From b0d9102e8e3411b2e9abb47b1040088e88d28dd6 Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Mon, 19 Feb 2024 12:52:29 +0100 Subject: [PATCH] Remove SplitInstall notification when auth token is not available. According to QA the behavior is a bit flaky. We may reintroduce it later on. --- .../splitinstall/SplitInstallBinder.kt | 113 ------------------ app/src/main/res/values-de/strings.xml | 9 +- app/src/main/res/values-es/strings.xml | 7 +- app/src/main/res/values-fr/strings.xml | 7 +- app/src/main/res/values-is/strings.xml | 7 +- app/src/main/res/values-it/strings.xml | 7 +- app/src/main/res/values-nb-rNO/strings.xml | 7 +- app/src/main/res/values-sv/strings.xml | 7 +- app/src/main/res/values-uk/strings.xml | 1 - app/src/main/res/values/strings.xml | 6 - 10 files changed, 7 insertions(+), 164 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt b/app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt index aad39a2d7..0a95cdbed 100644 --- a/app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt +++ b/app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt @@ -18,22 +18,13 @@ package foundation.e.apps.install.splitinstall -import android.Manifest -import android.app.NotificationChannel -import android.app.NotificationManager -import android.app.PendingIntent import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import android.content.pm.PackageManager -import android.os.Build -import androidx.core.app.ActivityCompat -import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.core.content.pm.PackageInfoCompat import foundation.e.apps.ISplitInstallService import foundation.e.apps.MainActivity -import foundation.e.apps.R import foundation.e.apps.data.DownloadManager import foundation.e.apps.data.application.ApplicationRepository import foundation.e.apps.data.login.AuthenticatorRepository @@ -60,7 +51,6 @@ class SplitInstallBinder( companion object { const val TAG = "SplitInstallerBinder" const val AUTH_DATA_ERROR_MESSAGE = "Could not get auth data" - const val NOTIFICATION_CHANNEL = "Dynamic module install" const val NOTIFICATION_ID_KEY = "notification_id_key" const val PACKAGE_NAME_KEY = "package_name_key" const val PREFERENCES_FILE_NAME = "packages_to_ignore" @@ -75,7 +65,6 @@ class SplitInstallBinder( if (authenticatorRepository.gplayAuth == null) { Timber.w(AUTH_DATA_ERROR_MESSAGE) - handleError(packageName) return } @@ -84,111 +73,9 @@ class SplitInstallBinder( } } catch (exception: GPlayLoginException) { Timber.w("$AUTH_DATA_ERROR_MESSAGE $exception") - handleError(packageName) } } - private fun handleError(packageName: String) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { - return - } - - createNotificationChannel(context) - showErrorNotification(context, packageName) - } - - private fun createNotificationChannel(context: Context) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { - return - } - - val descriptionText = context.getString(R.string.notification_channel_desc) - val notificationChannel = NotificationChannel( - NOTIFICATION_CHANNEL, - NOTIFICATION_CHANNEL, - NotificationManager.IMPORTANCE_LOW - ).apply { - description = descriptionText - } - - val notificationManager = - context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - - notificationManager.createNotificationChannel(notificationChannel) - } - - private fun showErrorNotification(context: Context, packageName: String) { - if (ActivityCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) - != PackageManager.PERMISSION_GRANTED - ) { - return - } - - val preferences = context.getSharedPreferences(PREFERENCES_FILE_NAME, Context.MODE_PRIVATE) - val ignoreList = preferences.getStringSet(PACKAGES_LIST_KEY, Collections.emptySet()) - if (ignoreList != null && packageName in ignoreList) return - - val appInfo = context.packageManager.getPackageInfo(packageName, 0).applicationInfo - val appLabel = context.packageManager.getApplicationLabel(appInfo) - val callerUid = appInfo.uid - val contentText = context.getString( - R.string.split_install_warning_text, - appLabel - ) - - val notificationBuilder = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL) - .setSmallIcon(R.drawable.app_lounge_notification_icon) - .setContentTitle(context.getString(R.string.split_install_warning_title, appLabel)) - .setContentText(contentText) - .setStyle(NotificationCompat.BigTextStyle().bigText(contentText)) - .addAction( - NotificationCompat.Action.Builder( - null, - context.getString(R.string.sign_in), - buildSignInPendingIntent(callerUid) - ).build() - ) - .addAction( - NotificationCompat.Action.Builder( - null, - context.getString(R.string.ignore), - buildIgnorePendingIntent(callerUid, packageName) - ).build() - ) - - with(NotificationManagerCompat.from(context)) { - notify(callerUid, notificationBuilder.build()) - } - } - - private fun buildIgnorePendingIntent(callerUid: Int, packageName: String): PendingIntent { - - val ignoreIntent = Intent(context, IgnoreReceiver::class.java).apply { - putExtra(NOTIFICATION_ID_KEY, callerUid) - putExtra(PACKAGE_NAME_KEY, packageName) - } - - return PendingIntent.getBroadcast( - context, - callerUid, - ignoreIntent, - PendingIntent.FLAG_MUTABLE - ) - } - - private fun buildSignInPendingIntent(callerUid: Int): PendingIntent { - val signInIntent = Intent(context, SignInReceiver::class.java).apply { - putExtra(NOTIFICATION_ID_KEY, callerUid) - } - - return PendingIntent.getBroadcast( - context, - callerUid, - signInIntent, - PendingIntent.FLAG_MUTABLE - ) - } - fun setService(service: foundation.e.splitinstall.ISplitInstallService) { splitInstallSystemService = service installPendingModules() diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 4cb3a2fd6..4b3a8341c 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -170,11 +170,4 @@ Das anonyme Konto, das von Ihnen genutzt wird, ist nicht verfügbar. Bitte erneuern (refresh) Sie die Sitzung, um ein neues anonymes Konto zu erhalten. SITZUNG ERNEUERN Bitte etwas Platz auf dem Telefon freimachen, damit die App Lounge ordnungsgemäß funktionieren kann. - - - Warnung bezüglich %s - %s möchte zusätzliche Module installieren. Sie müssen sich erneut bei AppLounge anmelden, um sie installieren zu können. - Split-Installationskanal - Einloggen - Ignorieren - \ No newline at end of file + diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 39c336b12..8f20b9eff 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -156,11 +156,6 @@ O mostrar sólo Libera %1$s en tu teléfono para recibir las últimas actualizaciones. Por favor, libera algo de espacio en tu teléfono para que App Lounge funcione correctamente. - Advertencia sobre %s - %s quiere instalar módulos adicionales. Debes iniciar sesión en AppLounge nuevamente para poder instalarlos. - Canal de instalación dividido - Iniciar sesión - Ignorar Descargando… Comprobando actualizaciones... Actualizar aplicaciones instaladas por otras tiendas @@ -177,4 +172,4 @@ \n\t- mitigar el microtargeting \n - limitar el impacto en caso de que esta cuenta sea restringida por Google." Archivo adicional para %s - \ No newline at end of file + diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 77d6840b6..cab017eee 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -168,9 +168,4 @@ Libérez %1$s sur votre téléphone afin de bénéficier des dernières mises à jour. Merci de libérer de l\'espace sur votre téléphone pour qu\'App Lounge puisse fonctionner correctement. Vérification des mises à jour... - Avertissement concernant %s - %s souhaite installer des modules supplémentaires. Vous devez vous reconnecter à AppLounge pour pouvoir les installer. - Canal d\'installation fractionnée - Connexion - Ignorer - \ No newline at end of file + diff --git a/app/src/main/res/values-is/strings.xml b/app/src/main/res/values-is/strings.xml index 778468262..63f559f7d 100644 --- a/app/src/main/res/values-is/strings.xml +++ b/app/src/main/res/values-is/strings.xml @@ -171,9 +171,4 @@ Losaðu um %1$s pláss á símanum þínum til að fá nýjustu uppfærslur. Athuga með uppfærslur... Losaðu um svolítið pláss á símanum þínum svo App Lounge geti virkað eðlilega. - Hunsa - Skipta upp uppsetningarás - Aðvörun viðkomandi %s - %s vill fá að setja upp viðbótareiningar.Þú þarft að skrá þig aftur inn í AppLounge til að geta sett þær inn. - Skrá inn - \ No newline at end of file + diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a06fe7b42..666c770a4 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -167,14 +167,9 @@ \n\t• limitare l\'impatto nel caso in cui l\'account venga bloccato da Google Per poter scaricare l\'aggiornamento, devi liberare %1$s di spazio sullo smartphone. Se non liberi un pò di spazio sullo smartphone, App Lounge non può funzionare correttamente. - Avviso riguardante %s - %s vuole installare moduli aggiuntivi. Per poterlo fare, devi accedere nuovamente ad AppLounge. - Canale d\'installazione frazionata - Accedi - Ignora Verifico Aggiornamenti... Richiedi report ad Exodus Toccando su \"%1$s\" verrà aperto un tab sul tuo browser con il nome del pacchetto app preimpostato.<br /><br />Tocca su \"Perform analysis\" per aviare l\'analisi da parte di Exodus.<br /><br />Quando verrò mostrato il pulsante \"See the report\" (potrebbe volerci un pò di tempo, a seconda dell\'app scelta) puoi chiudere il tab e tornare alla descrizione app su %2$s dove dovresti vedere il Punteggio Privacy. A volte Exodus non riesce ad analizzare l\'app.<br /><br />NB: potresti dover aspettare anche 10 min per poter vedere il punteggio nella descrizione app. L\'account anonimo che stai utilizzando non è disponibile. Agiorna la sessione per ottenerne un altro. AGGIORNA SESSIONE - \ No newline at end of file + diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index d127090b6..2c4be1008 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -171,9 +171,4 @@ Frigjør %1$s på telefonen for å kunne få de nyeste oppdateringene. Vennligst frigjør litt plass på telefonen din slik at App Lounge kan fungere som den skal. Ved å klikke på \"%1$s\" åpnes det en fane i nettleseren din med applikasjonens pakkenavn forhåndsutfylt.<br /><br />Klikk på \"Utfør analyse\" for å starte analysen i Exodus.<br /><br />Når knappen \"Se rapport\" vises (det kan ta en stund avhengig av applikasjon) kan du lukke fanen og gå tilbake til appbeskrivelsen i %2$s hvor du skulle se personvernscoren. Noen ganger kan Exodus mislykkes i å analysere applikasjonen.<br /><br />Merk: det kan ta opptil 10 minutter før personvernscoren vises i appbeskrivelsen. - Ignorer - Delt installasjonskanal - Advarsel angående %s - %s vil installere ekstra moduler. Du må logge inn på App Lounge på nytt for å kunne installere dem. - Logg inn - \ No newline at end of file + diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index b1eb1f3f1..ab2a1146a 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -171,9 +171,4 @@ \n\t• minska effekten om detta konto skulle begränsas av Google Att tvinga en installation tillåter dig att hämta och installera men det är inte garanterat att fungera.

Försök att installera appar som inte stöds kan orsaka krascher eller göra systemet långsammare.

Vi arbetar med att göra det mer kompatibelt med denna applikation i en nära framtid.
Genom att trycka på \"%1$s\" kommer en flik öppnas i din webbläsare med appens paketnamn förifyllt.<br /><br />Tryck på \"Perform analysis\" för att starta analysen av Exodus.<br /><br /> När knappen \"See the report\" visas (det kan ta ett tag beroende på appen) kan du stänga fliken och gå tillbaka till appbeskrivningen i %2$s där du bör se integritetspoängen. Ibland kan Exodus misslyckas med att analysera appen. <br /><br />OBS! Det kan ta upp till 10 min innan poängen visas i appbeskrivningen. - Ignorera - Kanal för delad installation - Varning gällande %s - %s vill installera extra moduler. Du måste logga in till AppLounge igen för att kunna installera dom. - Logga in - \ No newline at end of file + diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 88eac496b..12b9d97a8 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -155,5 +155,4 @@ Це може бути тому, що токен не міг бути згенерований / підтверджений, або за інших причин. \n \nНатисніть «Повторити спробу» щоб спробувати знову. - Зареєструватися \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index aeb2e0597..4825fd0ed 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -213,10 +213,4 @@ Clicking on \"%1$s\" will open a tab in your browser with the app\'s package name prefilled.<br /><br />Click on \"Perform analysis\" to start the analysis by Exodus.<br /><br />When the button \"See the report\" is displayed (it can take a while depending on the app) you can close the tab and go back to the app description in %2$s where you should see the Privacy Score. Sometimes Exodus can fail to analyze the app.<br /><br />NB: it can take up to 10 min for the score to be displayed in the app description. Free up %1$s on your phone to get the latest updates. Please free up some space on your phone so App Lounge can work properly. - - Warning regarding %s - %s wants to install extra modules. You must sign in again to AppLounge to be able to install them. - Split Install channel - Sign in - Ignore \ No newline at end of file -- GitLab