mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 16:32:39 +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 gdInstalled = GamePackageUtils.isGameInstalled(packageManager)
|
||||||
val geodeInstalled = LaunchUtils.isGeodeInstalled(this)
|
val geodeInstalled = LaunchUtils.isGeodeInstalled(this)
|
||||||
|
|
||||||
if (gdInstalled && geodeInstalled && intent.getBooleanExtra("restarted", false)) {
|
val restartImmediately = intent.getBooleanExtra("restarted", false)
|
||||||
onLaunch(this)
|
if (gdInstalled && geodeInstalled && restartImmediately) {
|
||||||
|
val withSafeMode = intent.getBooleanExtra("safe-mode", false)
|
||||||
|
onLaunch(this, withSafeMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
|
|||||||
@@ -191,10 +191,16 @@ object GeodeUtils {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun restartGame() {
|
fun restartGame() {
|
||||||
|
restartGame(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun restartGame(safeMode: Boolean) {
|
||||||
activity.get()?.run {
|
activity.get()?.run {
|
||||||
packageManager.getLaunchIntentForPackage(packageName)?.also {
|
packageManager.getLaunchIntentForPackage(packageName)?.also {
|
||||||
val mainIntent = Intent.makeRestartActivityTask(it.component)
|
val mainIntent = Intent.makeRestartActivityTask(it.component)
|
||||||
mainIntent.putExtra("restarted", true)
|
mainIntent.putExtra("restarted", true)
|
||||||
|
mainIntent.putExtra("safe-mode", safeMode)
|
||||||
startActivity(mainIntent)
|
startActivity(mainIntent)
|
||||||
exitProcess(0)
|
exitProcess(0)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user