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 717ac3400b190d7318e26067bab427df07b6d9d9..0b5fd2b8bbcbd8afb4e8413ffd3a0a86efb31485 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,11 +17,9 @@ 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 class SettingsFragment : ResourceSettingsFragment() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { @@ -48,7 +46,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 { @@ -66,30 +64,10 @@ 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) + startActivity(intent) } private suspend fun updateDetails(context: Context) { @@ -128,6 +106,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 {