Rix notifications reenabling. https://redmine.stoutner.com/issues/864 master
authorSoren Stoutner <soren@stoutner.com>
Tue, 21 Jun 2022 18:33:13 +0000 (11:33 -0700)
committerSoren Stoutner <soren@stoutner.com>
Tue, 21 Jun 2022 18:33:13 +0000 (11:33 -0700)
app/build.gradle
app/src/main/assets/de/changelog.html
app/src/main/assets/en/changelog.html
app/src/main/assets/es/changelog.html
app/src/main/assets/fr/changelog.html
app/src/main/assets/it/changelog.html
app/src/main/assets/ru/changelog.html
app/src/main/java/com/stoutner/privacycell/services/RealtimeMonitoringService.kt
build.gradle

index cfe53cddcbc1f958c57a3c854d614121235c130a..e9ea6d2a90e566a493a824b2984b095416570a53 100644 (file)
@@ -59,7 +59,7 @@ dependencies {
     implementation 'androidx.work:work-runtime-ktx:2.7.1'
 
     // Include the Kotlin standard library.  This should be the same version number listed in the project build.gradle.
-    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21'
+    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.0'
 
     // Include the Google material library.
     implementation 'com.google.android.material:material:1.6.1'
index a2c7fb6f202d682bc835bd1ff96f873aea6cd346..b761189db583739bcc4469e45d4ef9c3472af238 100644 (file)
@@ -29,8 +29,8 @@
     </head>
 
     <body>
-        <h3>1.8 (Version Code 9)</h3>
-        <p>14. Juni 2022 - Mindest-API 30, Ziel-API 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (Version Code 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14. Juni 2022</a> - Mindest-API 30, Ziel-API 32</p>
         <ul>
             <li>Der <a href="https://redmine.stoutner.com/issues/851">Sprach-Netzwerk-Status</a> wird nun bei der Einschätzung der Gesamt-Sicherheit des Funknetzwerks berücksichtigt.</li>
             <li>Fehler behoben, durch den gelegentlich <a href="https://redmine.stoutner.com/issues/850">Benachrichtigungen nicht abgeschaltet werden konnten</a>.</li>
index b253e64e2e19bf2b58c320b621d1c7b338dbe312..055815924f30703e4a322f5e8a1849efc192022f 100644 (file)
@@ -27,8 +27,8 @@
     </head>
 
     <body>
-        <h3>1.8 (version code 9)</h3>
-        <p>14 June 2022 - minimum API 30, target API 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (version code 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 June 2022</a> - minimum API 30, target API 32</p>
         <ul>
             <li>Include the <a href="https://redmine.stoutner.com/issues/851">voice network status</a> in determining the overall security of the cell network.</li>
             <li>Fix a bug that sometimes <a href="https://redmine.stoutner.com/issues/850">prevented notifications from being disabled</a>.</li>
index 7336a955ac8afef2b82efc9ebe67dc13847b999d..1bf7ded0373c95e8f4a1d4b20a5ddc00d4b879bd 100644 (file)
@@ -29,8 +29,8 @@
     </head>
 
     <body>
-        <h3>1.8 (versión del código 9)</h3>
-        <p>14 de junio de 2022 - API mínimo 30, API objetivo 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (versión del código 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 de junio de 2022</a> - API mínimo 30, API objetivo 32</p>
         <ul>
             <li>Incluir el <a href="https://redmine.stoutner.com/issues/851">estado de la red de voz</a> para determinar la seguridad general de la red celular.</li>
             <li>Corregir un error que a veces <a href="https://redmine.stoutner.com/issues/850">impedía desactivar las notificaciones</a>.</li>
index 25415dbda5e4f2af62ab477f16bd2a676ab0d788..9ff5061fd5d7f39cf364b923a0e06bfac8ed5b28 100644 (file)
@@ -29,8 +29,8 @@
     </head>
 
     <body>
-        <h3>1.8 (version de code 9)</h3>
-        <p>14 June 2022 - API minimum 30, API cible 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (version de code 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 June 2022</a> - API minimum 30, API cible 32</p>
         <ul>
             <li>Include the <a href="https://redmine.stoutner.com/issues/851">voice network status</a> in determining the overall security of the cell network.</li>
             <li>Fix a bug that sometimes <a href="https://redmine.stoutner.com/issues/850">prevented notifications from being disabled</a>.</li>
index 24cde78fe5de5ceb2a07a20bbab76a257c82fe0a..a7b4bc957c545342aa9bd53e7ec9bc85a9b6aacb 100644 (file)
@@ -29,8 +29,8 @@
     </head>
 
     <body>
-        <h3>1.8 (versione codice 9)</h3>
-        <p>14 Giugno 2022 - minima API 30, target API 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (versione codice 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 Giugno 2022</a> - minima API 30, target API 32</p>
         <ul>
             <li>Incluso lo <a href="https://redmine.stoutner.com/issues/851">stato della rete voce</a> nella determinazione della sicurezza complessiva della rete.</li>
             <li>Correzione di un baco che talvolta <a href="https://redmine.stoutner.com/issues/850">impediva di disabilitare le notifiche</a>.</li>
index feb457f5fac596564785db17d827fe2ad130b404..85e82bc2063acef9c312c542a49ea1d2bc7b7eec 100644 (file)
@@ -27,8 +27,8 @@
     </head>
 
     <body>
-        <h3>1.8 (код версии 9)</h3>
-        <p>14 июня 2022 года - минимальный API 30, целевой API 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (код версии 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 июня 2022 года</a> - минимальный API 30, целевой API 32</p>
         <ul>
             <li>Теперь при определении общей безопасности сотовой сети <a href="https://redmine.stoutner.com/issues/851">будет учитываться статус голосовой сети</a>.</li>
             <li>Исправлена ошибка, из-за которой иногда <a href="https://redmine.stoutner.com/issues/850">не удавалось отключить уведомления</a>.</li>
index 5d9ad3a4a76f6f7d746c9dfc6148e0ebb7fe8467..c54e290813c07abd015b1f3d0443dc7afdc45317 100644 (file)
@@ -154,33 +154,48 @@ class RealtimeMonitoringService : Service() {
             // Instantiate the protocol helper.
             val protocolHelper = ProtocolHelper()
 
+            // Get a handle for the telephony manager.
+            val telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
+
             // Define the phone state listener.  The `PhoneStateListener` can be replaced by `TelephonyCallback` once the minimum API >= 31.
             phoneStateListener = object : PhoneStateListener() {
                 @Deprecated("Deprecated in Java")
                 override fun onServiceStateChanged(serviceState: ServiceState) {  // Update the voice network status.
-                    // Get the network registration info for the voice network, which is the second of the three entries (the first appears to be Wi-Fi and the third appears to be the cell data network).
-                    val networkRegistrationInfo = serviceState.networkRegistrationInfoList[1]
-
-                    // Get the consider 3G antiquated preference.
-                    val consider3gAntiquated = sharedPreferences.getBoolean(getString(R.string.consider_3g_antiquated_key), false)
-
-                    // Update the voice network security status.
-                    voiceNetworkSecurityStatus = protocolHelper.checkNetwork(networkRegistrationInfo.accessNetworkTechnology, consider3gAntiquated)
-
-                    // Populate the notification.
-                    populateNotification()
+                    // Check to see if realtime monitoring is enabled.  Sometimes the system keeps running the service even when it is supposed to shut down.
+                    if (sharedPreferences.getBoolean(applicationContext.getString(R.string.realtime_monitoring_key), true)) {  // Realtime monitoring is enabled.
+                        // Get the network registration info for the voice network, which is the second of the three entries (the first appears to be Wi-Fi and the third appears to be the cell data network).
+                        val networkRegistrationInfo = serviceState.networkRegistrationInfoList[1]
+
+                        // Get the consider 3G antiquated preference.
+                        val consider3gAntiquated = sharedPreferences.getBoolean(getString(R.string.consider_3g_antiquated_key), false)
+
+                        // Update the voice network security status.
+                        voiceNetworkSecurityStatus = protocolHelper.checkNetwork(networkRegistrationInfo.accessNetworkTechnology, consider3gAntiquated)
+
+                        // Populate the notification.
+                        populateNotification()
+                    } else {  // Realtime monitoring is disabled.
+                        // Cancel the current listener if it exists.  The `PhoneStateListener` can be replaced by `TelephonyCallback` once the minimum API >= 31.
+                        telephonyManager.listen(phoneStateListener, LISTEN_NONE)
+                    }
                 }
 
                 @Deprecated("Deprecated in Java")
                 override fun onDisplayInfoChanged(telephonyDisplayInfo: TelephonyDisplayInfo) {  // Update the data network status.
-                    // Get the consider 3G antiquated preference.
-                    val consider3gAntiquated = sharedPreferences.getBoolean(getString(R.string.consider_3g_antiquated_key), false)
-
-                    // Update the data network security status.
-                    dataNetworkSecurityStatus = protocolHelper.checkNetwork(telephonyDisplayInfo.networkType, consider3gAntiquated)
-
-                    // Populate the notification.
-                    populateNotification()
+                    // Check to see if realtime monitoring is enabled.  Sometimes the system keeps running the service even when it is supposed to shut down.
+                    if (sharedPreferences.getBoolean(applicationContext.getString(R.string.realtime_monitoring_key), true)) {  // Realtime monitoring is enabled.
+                        // Get the consider 3G antiquated preference.
+                        val consider3gAntiquated = sharedPreferences.getBoolean(getString(R.string.consider_3g_antiquated_key), false)
+
+                        // Update the data network security status.
+                        dataNetworkSecurityStatus = protocolHelper.checkNetwork(telephonyDisplayInfo.networkType, consider3gAntiquated)
+
+                        // Populate the notification.
+                        populateNotification()
+                    } else {  // Realtime monitoring is disabled.
+                        // Cancel the current listener if it exists.  The `PhoneStateListener` can be replaced by `TelephonyCallback` once the minimum API >= 31.
+                        telephonyManager.listen(phoneStateListener, LISTEN_NONE)
+                    }
                 }
             }
 
index a994e46b72bdbe4886483096427077c47d6fab2a..7083cd3c68ab75a369493bd747b6174704711c1e 100644 (file)
@@ -26,7 +26,7 @@ buildscript {
 
     dependencies {
         classpath 'com.android.tools.build:gradle:7.2.1'
-        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
+        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
 
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files