This repository has been archived by the owner on Oct 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Modernize restart logic (#527)
- Loading branch information
1 parent
c6a1b9f
commit 0ea4e72
Showing
8 changed files
with
63 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
app/src/main/java/app/revanced/shared/settings/SettingsUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package app.revanced.shared.settings; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
/** | ||
* Class is used across multiple target apps. | ||
* | ||
* This entire class can _not_ reference: | ||
* {@link app.revanced.integrations.settings.SettingsEnum} | ||
* {@link app.revanced.twitch.settings.SettingsEnum} | ||
* {@link app.revanced.tiktok.settings.SettingsEnum} | ||
* | ||
* or any other code that references these app specific integration classes. | ||
*/ | ||
public class SettingsUtils { | ||
|
||
public static void restartApp(@NonNull Context context) { | ||
String packageName = context.getPackageName(); | ||
Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName); | ||
Intent mainIntent = Intent.makeRestartActivityTask(intent.getComponent()); | ||
// Required for API 34 and later | ||
// Ref: https://developer.android.com/about/versions/14/behavior-changes-14#safer-intents | ||
mainIntent.setPackage(packageName); | ||
context.startActivity(mainIntent); | ||
System.exit(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
dummy/src/main/java/com/google/android/apps/youtube/app/application/Shell_HomeActivity.java
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
dummy/src/main/java/com/ss/android/ugc/aweme/splash/SplashActivity.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
dummy/src/main/java/tv/twitch/android/app/core/LandingActivity.java
This file was deleted.
Oops, something went wrong.