mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
[Android] don't load forge.profile.properties when the user is using the obb directory
- until google permits unrestricted access outside the app-specific directory on certain apps via flag, the option to use obb as entrypoint is required since accessing outside the scoped storage is really not recommended (https://issuetracker.google.com/issues?q=scoped%20storage%20slow).
This commit is contained in:
@@ -88,7 +88,7 @@ public class Forge implements ApplicationListener {
|
|||||||
if (GuiBase.getInterface() == null) {
|
if (GuiBase.getInterface() == null) {
|
||||||
clipboard = clipboard0;
|
clipboard = clipboard0;
|
||||||
deviceAdapter = deviceAdapter0;
|
deviceAdapter = deviceAdapter0;
|
||||||
GuiBase.setUsingAppDirectory(assetDir0.contains("forge.app"));
|
GuiBase.setUsingAppDirectory(assetDir0.contains("forge.app")); //obb directory on android uses the package name as entrypoint
|
||||||
GuiBase.setInterface(new GuiMobile(assetDir0));
|
GuiBase.setInterface(new GuiMobile(assetDir0));
|
||||||
GuiBase.enablePropertyConfig(value);
|
GuiBase.enablePropertyConfig(value);
|
||||||
isPortraitMode = androidOrientation;
|
isPortraitMode = androidOrientation;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import forge.gui.GuiBase;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
@@ -133,6 +134,7 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
ForgeProfileProperties.setDecksDir(newDir);
|
ForgeProfileProperties.setDecksDir(newDir);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (!GuiBase.isUsingAppDirectory()) {
|
||||||
lstItems.addItem(new StorageOption(localizer.getMessage("lblDataLocation"), ForgeProfileProperties.getUserDir()) {
|
lstItems.addItem(new StorageOption(localizer.getMessage("lblDataLocation"), ForgeProfileProperties.getUserDir()) {
|
||||||
@Override
|
@Override
|
||||||
protected void onDirectoryChanged(String newDir) {
|
protected void onDirectoryChanged(String newDir) {
|
||||||
@@ -154,6 +156,7 @@ public class FilesPage extends TabPage<SettingsScreen> {
|
|||||||
lstItems.addItem(cardPicsOption, 1);
|
lstItems.addItem(cardPicsOption, 1);
|
||||||
lstItems.addItem(decksOption, 1);
|
lstItems.addItem(decksOption, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doLayout(float width, float height) {
|
protected void doLayout(float width, float height) {
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ public final class ForgeConstants {
|
|||||||
public static final String DECK_BASE_DIR;
|
public static final String DECK_BASE_DIR;
|
||||||
public static final String DECK_CONSTRUCTED_DIR;
|
public static final String DECK_CONSTRUCTED_DIR;
|
||||||
static {
|
static {
|
||||||
ForgeProfileProperties.load();
|
ForgeProfileProperties.load(GuiBase.isUsingAppDirectory());
|
||||||
USER_DIR = ForgeProfileProperties.getUserDir();
|
USER_DIR = ForgeProfileProperties.getUserDir();
|
||||||
CACHE_DIR = ForgeProfileProperties.getCacheDir();
|
CACHE_DIR = ForgeProfileProperties.getCacheDir();
|
||||||
CACHE_CARD_PICS_DIR = ForgeProfileProperties.getCardPicsDir();
|
CACHE_CARD_PICS_DIR = ForgeProfileProperties.getCardPicsDir();
|
||||||
|
|||||||
@@ -57,11 +57,11 @@ public class ForgeProfileProperties {
|
|||||||
//prevent initializing static class
|
//prevent initializing static class
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load() {
|
public static void load(boolean isUsingAppDirectory) {
|
||||||
final Properties props = new Properties();
|
final Properties props = new Properties();
|
||||||
final File propFile = new File(ForgeConstants.PROFILE_FILE);
|
final File propFile = new File(ForgeConstants.PROFILE_FILE);
|
||||||
try {
|
try {
|
||||||
if (propFile.canRead()) {
|
if (propFile.canRead() && !isUsingAppDirectory) {
|
||||||
props.load(new FileInputStream(propFile));
|
props.load(new FileInputStream(propFile));
|
||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user