mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-19 02:19:23 +01:00
feat(youtube/microg-support): handle availability of Vanced MicroG
This commit is contained in:
parent
6762ea4178
commit
afa9d3cbb1
@ -0,0 +1,33 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import static app.revanced.integrations.sponsorblock.StringRef.str;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.widget.Toast;
|
||||
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
|
||||
public class MicroGSupport {
|
||||
private static final String MICROG_VENDOR = "com.mgoogle";
|
||||
private static final String MICROG_PACKAGE_NAME = "com.mgoogle.android.gms";
|
||||
private static final String VANCED_MICROG_DOWNLOAD_LINK = "https://github.com/TeamVanced/VancedMicroG/releases/latest";
|
||||
|
||||
public static void checkAvailability() {
|
||||
var context = ReVancedUtils.getContext();
|
||||
assert context != null;
|
||||
try {
|
||||
context.getPackageManager().getPackageInfo(MICROG_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
|
||||
LogHelper.debug(ReVancedUtils.class, "MicroG is installed on the device");
|
||||
} catch (PackageManager.NameNotFoundException exception) {
|
||||
LogHelper.printException(ReVancedUtils.class, "MicroG was not found", exception);
|
||||
Toast.makeText(context, str("microg_not_installed_warning"), Toast.LENGTH_LONG).show();
|
||||
|
||||
var intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(VANCED_MICROG_DOWNLOAD_LINK));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user