OOBE: Restart app after onboarding to renew permission scopes [1/2]

This commit is contained in:
Rahul Patel
2024-06-25 22:02:31 +05:30
parent 3615c39163
commit 8857353029
3 changed files with 28 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ import com.aurora.gplayapi.data.models.App
import com.aurora.store.R
import com.aurora.store.util.Log
import com.aurora.store.util.Preferences
import kotlin.system.exitProcess
val Context.inflater: LayoutInflater
get() = LayoutInflater.from(this)
@@ -135,3 +136,15 @@ fun Context.isIgnoringBatteryOptimizations(): Boolean {
true
}
}
fun Context.restartApp() {
val intent = packageManager.getLaunchIntentForPackage(packageName)
val componentName = intent?.component
val newIntent = Intent.makeRestartActivityTask(componentName)
newIntent.setPackage(packageName)
startActivity(newIntent)
exitProcess(0)
}