Skip to content

Commit

Permalink
Added option to disable google services
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyPavlenko committed Nov 18, 2021
1 parent 3fe4b30 commit c127d2d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
def abi = project.properties['ABI']
VERSION_CODE = 174
VERSION_NAME = "1.8.7"
VERSION_CODE = 175
VERSION_NAME = "1.8.8"
SDK_MIN_VERSION = 23
SDK_TARGET_VERSION = 30
SDK_COMPILE_VERSION = 30
Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ APP_ID_SFX='.dear.google.please.dont.block'
DIR="$(cd "$(dirname "$0")"; pwd -P)"
DEST_DIR="$DIR/dist"
mkdir -p "$DEST_DIR"
export NO_GS=true

bundletool_universal() {
local AAB="$1"
Expand Down
2 changes: 2 additions & 0 deletions fermata/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ android {
dimension "version"
resValue "string", "app_name", "@string/app_name_mobile"
buildConfigField "boolean", 'AUTO', 'false'
buildConfigField "boolean", 'ENABLE_GS', "${gradle.ext.enableGoogleServices}"
}

auto {
dimension "version"
applicationIdSuffix '.auto' + project.getProperties().getOrDefault('APP_ID_SFX', '')
resValue "string", "app_name", "@string/app_name_auto"
buildConfigField "boolean", 'AUTO', 'true'
buildConfigField "boolean", 'ENABLE_GS', "${gradle.ext.enableGoogleServices}"

dependencies {
implementation fileTree(dir: 'lib/auto', include: ['*.aar'])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.aap.fermata.ui.fragment;

import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
import static me.aap.fermata.BuildConfig.ENABLE_GS;
import static me.aap.fermata.util.Utils.isSafSupported;
import static me.aap.fermata.vfs.FermataVfsManager.GDRIVE_ID;
import static me.aap.fermata.vfs.FermataVfsManager.M3U_ID;
Expand Down Expand Up @@ -130,7 +131,7 @@ public void addFolder() {
if (isSafSupported(a)) b.addItem(R.id.vfs_content, R.string.vfs_content);
b.addItem(R.id.vfs_sftp, R.string.vfs_sftp);
b.addItem(R.id.vfs_smb, R.string.vfs_smb);
b.addItem(R.id.vfs_gdrive, R.string.vfs_gdrive);
if (ENABLE_GS) b.addItem(R.id.vfs_gdrive, R.string.vfs_gdrive);
b.addItem(R.id.m3u_playlist, R.string.m3u_playlist);
});
}
Expand All @@ -144,7 +145,7 @@ private boolean addFolder(OverlayMenuItem item) {
} else if (itemId == R.id.vfs_content) {
addFolderIntent();
return true;
} else if (itemId == R.id.vfs_gdrive) {
} else if (ENABLE_GS && (itemId == R.id.vfs_gdrive)) {
addFolderVfs(GDRIVE_ID, R.string.vfs_gdrive);
return true;
} else if (itemId == R.id.vfs_sftp) {
Expand Down
10 changes: 7 additions & 3 deletions fermata/src/main/java/me/aap/fermata/vfs/FermataVfsManager.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.aap.fermata.vfs;

import static me.aap.fermata.BuildConfig.ENABLE_GS;
import static me.aap.utils.async.Completed.completed;
import static me.aap.utils.async.Completed.completedNull;
import static me.aap.utils.async.Completed.failed;
Expand Down Expand Up @@ -51,15 +52,17 @@ public FermataVfsManager() {
super(filesystems());

PreferenceStore ps = FermataApplication.get().getPreferenceStore();
initProvider(ps, ENABLE_GDRIVE, GDRIVE_ID);
if (ENABLE_GS) initProvider(ps, ENABLE_GDRIVE, GDRIVE_ID);
initProvider(ps, ENABLE_SFTP, SFTP_ID);
initProvider(ps, ENABLE_SMB, SMB_ID);
}

public FutureSupplier<VfsProvider> getProvider(String scheme) {
switch (scheme) {
case GDRIVE_ID:
return getProvider(scheme, ENABLE_GDRIVE, GDRIVE_CLASS, GDRIVE_ID, R.string.vfs_gdrive);
return ENABLE_GS
? getProvider(scheme, ENABLE_GDRIVE, GDRIVE_CLASS, GDRIVE_ID, R.string.vfs_gdrive)
: completedNull();
case SFTP_ID:
return getProvider(scheme, ENABLE_SFTP, SFTP_CLASS, SFTP_ID, R.string.vfs_sftp);
case SMB_ID:
Expand All @@ -86,7 +89,8 @@ private static List<VirtualFileSystem> filesystems() {
p.add(GenericFileSystem.Provider.getInstance().createFileSystem(ps).getOrThrow());
p.add(ContentFileSystem.Provider.getInstance().createFileSystem(ps).getOrThrow());
p.add(M3uFileSystem.Provider.getInstance().createFileSystem(ps).getOrThrow());
addFileSystem(p, ps, ENABLE_GDRIVE, app, GDRIVE_CLASS, GDRIVE_ID, R.string.vfs_gdrive);
if (ENABLE_GS)
addFileSystem(p, ps, ENABLE_GDRIVE, app, GDRIVE_CLASS, GDRIVE_ID, R.string.vfs_gdrive);
addFileSystem(p, ps, ENABLE_SFTP, app, SFTP_CLASS, SFTP_ID, R.string.vfs_sftp);
addFileSystem(p, ps, ENABLE_SMB, app, SMB_CLASS, SMB_ID, R.string.vfs_smb);
return p;
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ rootProject.name = 'Fermata Music Player'
gradle.ext.modules = []
gradle.ext.addonInfo = new StringBuilder(512)
gradle.ext.localProps = new Properties()
gradle.ext.enableGoogleServices = file('fermata/google-services.json').isFile()
gradle.ext.enableGoogleServices = (System.getenv('NO_GS') == null)
&& file('fermata/google-services.json').isFile()
def localPropsFile = file('local.properties')
if (localPropsFile.isFile()) gradle.ext.localProps.load(localPropsFile.newDataInputStream())
def exoRoot = file('depends/ExoPlayer')
Expand Down

0 comments on commit c127d2d

Please sign in to comment.