mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 08:19:33 +00:00
add restart with safe mode util
This commit is contained in:
2 files changed
+10
-2
No files matched your search
@@ -104,8 +104,10 @@ class MainActivity : ComponentActivity() {
|
||||
val gdInstalled = GamePackageUtils.isGameInstalled(packageManager)
|
||||
val geodeInstalled = LaunchUtils.isGeodeInstalled(this)
|
||||
|
||||
if (gdInstalled && geodeInstalled && intent.getBooleanExtra("restarted", false)) {
|
||||
onLaunch(this)
|
||||
val restartImmediately = intent.getBooleanExtra("restarted", false)
|
||||
if (gdInstalled && geodeInstalled && restartImmediately) {
|
||||
val withSafeMode = intent.getBooleanExtra("safe-mode", false)
|
||||
onLaunch(this, withSafeMode)
|
||||
}
|
||||
|
||||
enableEdgeToEdge()
|
||||
|
||||
@@ -191,10 +191,16 @@ object GeodeUtils {
|
||||
|
||||
@JvmStatic
|
||||
fun restartGame() {
|
||||
restartGame(true)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun restartGame(safeMode: Boolean) {
|
||||
activity.get()?.run {
|
||||
packageManager.getLaunchIntentForPackage(packageName)?.also {
|
||||
val mainIntent = Intent.makeRestartActivityTask(it.component)
|
||||
mainIntent.putExtra("restarted", true)
|
||||
mainIntent.putExtra("safe-mode", safeMode)
|
||||
startActivity(mainIntent)
|
||||
exitProcess(0)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user