Add intent filter to deep link settings pages
This commit is contained in:
parent
2c07895386
commit
84a62ae8e0
@ -65,6 +65,15 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="de.mm20.launcher2.ui.launcher.LauncherActivity" />
|
android:value="de.mm20.launcher2.ui.launcher.LauncherActivity" />
|
||||||
|
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https"/>
|
||||||
|
<data android:path="/in-app"/>
|
||||||
|
<data android:host="kvaesitso.mm20.de"/>
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".launcher.sheets.BindAndConfigureAppWidgetActivity" />
|
<activity android:name=".launcher.sheets.BindAndConfigureAppWidgetActivity" />
|
||||||
|
|||||||
@ -83,16 +83,24 @@ class SettingsActivity : BaseActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||||
|
|
||||||
val newRoute = intent?.getStringExtra(EXTRA_ROUTE)
|
val newRoute = getStartRoute(intent)
|
||||||
route = newRoute
|
route = newRoute
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
val navController = rememberNavController()
|
val navController = rememberNavController()
|
||||||
|
|
||||||
LaunchedEffect(route) {
|
LaunchedEffect(route) {
|
||||||
navController.navigate(route ?: "settings") {
|
try {
|
||||||
popUpTo("settings") {
|
navController.navigate(route ?: "settings") {
|
||||||
inclusive = true
|
popUpTo("settings") {
|
||||||
|
inclusive = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: IllegalArgumentException) {
|
||||||
|
navController.navigate("settings") {
|
||||||
|
popUpTo("settings") {
|
||||||
|
inclusive = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,10 +296,18 @@ class SettingsActivity : BaseActivity() {
|
|||||||
|
|
||||||
override fun onNewIntent(intent: Intent) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
val newRoute = intent.getStringExtra(EXTRA_ROUTE)
|
val newRoute = getStartRoute(intent)
|
||||||
route = newRoute
|
route = newRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getStartRoute(intent: Intent): String? {
|
||||||
|
if (intent.data?.host == "kvaesitso.mm20.de") {
|
||||||
|
return intent.data?.getQueryParameter("route")
|
||||||
|
} else {
|
||||||
|
return intent.getStringExtra(EXTRA_ROUTE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val EXTRA_ROUTE = "de.mm20.launcher2.settings.ROUTE"
|
const val EXTRA_ROUTE = "de.mm20.launcher2.settings.ROUTE"
|
||||||
const val ROUTE_WEATHER_INTEGRATION = "settings/integrations/weather"
|
const val ROUTE_WEATHER_INTEGRATION = "settings/integrations/weather"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user