From ef1533bffd5c643f93f6aa918f9755d02aab671f Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Mon, 11 Apr 2022 17:59:19 +0200 Subject: [PATCH 1/2] Open Exposure Notification documentation Since microG with Exposure Notification is not available on the store anymore, open the documentation page associated to Exposure Notification installation when clicking on "Tap to add Exposure Notifications" in the microG Settings. --- .../kotlin/org/microg/gms/ui/SettingsFragment.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/SettingsFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/SettingsFragment.kt index 717ac3400..8f29bceef 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/SettingsFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/SettingsFragment.kt @@ -22,6 +22,7 @@ import org.microg.tools.ui.ResourceSettingsFragment import android.content.ActivityNotFoundException import android.content.ComponentName import android.content.Intent +import android.net.Uri class SettingsFragment : ResourceSettingsFragment() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { @@ -48,7 +49,7 @@ class SettingsFragment : ResourceSettingsFragment() { true } findPreference(PREF_EXPOSURE_INSTALL)?.onPreferenceClickListener = Preference.OnPreferenceClickListener { - startApplication("foundation.e.apps") + openBrowserAt(EXPOSURE_INSTALL_DOC_URL) true } findPreference(PREF_ABOUT)!!.onPreferenceClickListener = Preference.OnPreferenceClickListener { @@ -92,6 +93,12 @@ class SettingsFragment : ResourceSettingsFragment() { } } + fun openBrowserAt(url: String) { + val intent = Intent(Intent.ACTION_VIEW) + intent.data = Uri.parse(url) + startActivity(intent) + } + private suspend fun updateDetails(context: Context) { val gcmServiceInfo = getGcmServiceInfo(context) if (gcmServiceInfo.configuration.enabled) { @@ -128,6 +135,9 @@ class SettingsFragment : ResourceSettingsFragment() { const val PREF_CHECKIN = "pref_checkin" const val PREF_EXPOSURE = "pref_exposure" const val PREF_EXPOSURE_INSTALL = "pref_exposure_install" + const val EXPOSURE_INSTALL_DOC_URL = + "https://doc.e.foundation/support-topics/micro-g#how-to-update-the-microg-exposure-notification-framework" + } init { -- GitLab From f7c246b794a46e86f6b9f5dfd92c41dcf96aefaa Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Tue, 12 Apr 2022 14:42:03 +0200 Subject: [PATCH 2/2] Remove dead code --- .../org/microg/gms/ui/SettingsFragment.kt | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/SettingsFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/SettingsFragment.kt index 8f29bceef..0b5fd2b8b 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/SettingsFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/SettingsFragment.kt @@ -17,10 +17,7 @@ import org.microg.gms.gcm.getGcmServiceInfo import org.microg.gms.safetynet.SafetyNetPreferences import org.microg.nlp.client.GeocodeClient import org.microg.nlp.client.LocationClient -import org.microg.nlp.client.UnifiedLocationClient import org.microg.tools.ui.ResourceSettingsFragment -import android.content.ActivityNotFoundException -import android.content.ComponentName import android.content.Intent import android.net.Uri @@ -67,32 +64,6 @@ class SettingsFragment : ResourceSettingsFragment() { } } - private fun launchComponent(packageName: String, name: String) { - val launch_intent = Intent("android.intent.action.MAIN") - launch_intent.addCategory("android.intent.category.LAUNCHER") - launch_intent.component = ComponentName(packageName, name) - launch_intent.putExtra("open_search", true) - launch_intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK - requireActivity().startActivity(launch_intent) - } - - fun startApplication(application_name: String?) { - try { - val intent = Intent("android.intent.action.MAIN") - intent.addCategory("android.intent.category.LAUNCHER") - intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION) - val resolveinfo_list = requireActivity().packageManager.queryIntentActivities(intent, 0) - for (info in resolveinfo_list) { - if (info.activityInfo.packageName == application_name) { - launchComponent(info.activityInfo.packageName, info.activityInfo.name) - break - } - } - } catch (e: ActivityNotFoundException) { - e.message - } - } - fun openBrowserAt(url: String) { val intent = Intent(Intent.ACTION_VIEW) intent.data = Uri.parse(url) -- GitLab