Merge branch 'dev' into fork/feat_alt_thumbnails_navigation_type

This commit is contained in:
oSumAtrIX 2024-03-29 00:34:17 +01:00
commit 22ae316dc3
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
3 changed files with 54 additions and 13 deletions

View File

@ -1,3 +1,30 @@
# [1.6.0](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0...v1.6.0) (2024-03-28)
### Bug Fixes
* **YouTube - Hide layout components:** Correctly hide community posts ([fbc8066](https://github.com/ReVanced/revanced-integrations/commit/fbc80667735778877f262763d6d53afb1dba3bf6))
* **YouTube - Navigation buttons:** Hide subscriptions tab ([623d11b](https://github.com/ReVanced/revanced-integrations/commit/623d11b8e8b9f5166b53d8ae195a5d5a6c644661))
### Features
* **GmsCore support:** Open download link if possible ([#596](https://github.com/ReVanced/revanced-integrations/issues/596)) ([999727d](https://github.com/ReVanced/revanced-integrations/commit/999727d5e6889b6242473f1b14bf618918417e77))
# [1.6.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.5.1-dev.2...v1.6.0-dev.1) (2024-03-28)
### Features
* **GmsCore support:** Open download link if possible ([#596](https://github.com/ReVanced/revanced-integrations/issues/596)) ([999727d](https://github.com/ReVanced/revanced-integrations/commit/999727d5e6889b6242473f1b14bf618918417e77))
## [1.5.1-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.5.1-dev.1...v1.5.1-dev.2) (2024-03-28)
### Bug Fixes
* **YouTube - Navigation buttons:** Hide subscriptions tab ([623d11b](https://github.com/ReVanced/revanced-integrations/commit/623d11b8e8b9f5166b53d8ae195a5d5a6c644661))
## [1.5.1-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.5.0...v1.5.1-dev.1) (2024-03-27)

View File

@ -1,13 +1,14 @@
package app.revanced.integrations.shared;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.RequiresApi;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Objects;
import static app.revanced.integrations.shared.StringRef.str;
@ -23,15 +24,29 @@ public class GmsCoreSupport {
private static final Uri GMS_CORE_PROVIDER
= Uri.parse("content://" + getGmsCoreVendor() + ".android.gsf.gservices/prefix");
private static void search(Context context, String uriString, String message) {
private static void open(String queryOrLink, String message) {
Utils.showToastLong(message);
var intent = new Intent(Intent.ACTION_WEB_SEARCH);
Intent intent;
try {
// Check if queryOrLink is a valid URL.
new URL(queryOrLink);
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(queryOrLink));
} catch (MalformedURLException e) {
intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY, queryOrLink);
}
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(SearchManager.QUERY, uriString);
context.startActivity(intent);
Utils.getContext().startActivity(intent);
// Gracefully exit, otherwise without Gms the app crashes and Android can nag the user.
System.exit(0);
}
/**
* Injection point.
*/
@RequiresApi(api = Build.VERSION_CODES.N)
public static void checkAvailability() {
var context = Objects.requireNonNull(Utils.getContext());
@ -40,22 +55,21 @@ public class GmsCoreSupport {
context.getPackageManager().getPackageInfo(GMS_CORE_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
} catch (PackageManager.NameNotFoundException exception) {
Logger.printInfo(() -> "GmsCore was not found", exception);
search(context, getGmsCoreDownloadLink(), str("gms_core_not_installed_warning"));
System.exit(0);
open(getGmsCoreDownload(), str("gms_core_not_installed_warning"));
return;
}
try (var client = context.getContentResolver().acquireContentProviderClient(GMS_CORE_PROVIDER)) {
if (client != null) return;
Logger.printInfo(() -> "GmsCore is not running in the background");
search(context, DONT_KILL_MY_APP_LINK, str("gms_core_not_running_warning"));
System.exit(0);
open(DONT_KILL_MY_APP_LINK, str("gms_core_not_running_warning"));
} catch (Exception ex) {
Logger.printException(() -> "Could not check GmsCore background task", ex);
}
}
private static String getGmsCoreDownloadLink() {
private static String getGmsCoreDownload() {
final var vendor = getGmsCoreVendor();
//noinspection SwitchStatementWithTooFewBranches
switch (vendor) {

View File

@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
android.useAndroidX = true
version = 1.5.1-dev.1
version = 1.6.0