From 53b4cf297e74a8a62a6b13b91dd173364e24ed9f Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 9 Jul 2023 14:44:31 -0400 Subject: [PATCH] v2.2.0: removed support for android instant apps --- android/src/main/AndroidManifest.xml | 1 - .../assets/messages/scenes/scenes.properties | 1 - .../messages/windows/windows.properties | 1 - .../scenes/InterlevelScene.java | 35 +------------------ .../scenes/TitleScene.java | 10 ++---- .../services/updates/Updates.java | 16 ++------- .../windows/WndGame.java | 13 ------- .../windows/WndSettings.java | 2 +- .../services/updates/UpdateService.java | 12 +++---- .../services/updates/DebugUpdates.java | 12 +------ .../services/updates/GitHubUpdates.java | 12 +------ 11 files changed, 14 insertions(+), 101 deletions(-) diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index cdc3ff53d..34bf71a83 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -44,7 +44,6 @@ - diff --git a/core/src/main/assets/messages/scenes/scenes.properties b/core/src/main/assets/messages/scenes/scenes.properties index 68d10d6c5..dd5e2461a 100644 --- a/core/src/main/assets/messages/scenes/scenes.properties +++ b/core/src/main/assets/messages/scenes/scenes.properties @@ -81,7 +81,6 @@ scenes.interlevelscene$mode.resurrect=Resurrecting... scenes.interlevelscene$mode.return=Returning... scenes.interlevelscene$mode.fall=Falling... scenes.interlevelscene$mode.reset=Resetting... -scenes.interlevelscene.install=Install the Game scenes.interlevelscene.file_not_found=Save file not found. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that. scenes.interlevelscene.io_error=Cannot read save file. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that. diff --git a/core/src/main/assets/messages/windows/windows.properties b/core/src/main/assets/messages/windows/windows.properties index 6d2e81f8c..d4fcbd375 100644 --- a/core/src/main/assets/messages/windows/windows.properties +++ b/core/src/main/assets/messages/windows/windows.properties @@ -37,7 +37,6 @@ windows.wndenergizeitem.energize_all=Turn all into %d energy windows.wnderror.title=ERROR windows.wndgame.settings=Settings -windows.wndgame.install=Install the Game windows.wndgame.challenges=Challenges windows.wndgame.rankings=Rankings windows.wndgame.start=Start New Game diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java index b346a9496..ee9405dd5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java @@ -22,7 +22,6 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import com.shatteredpixel.shatteredpixeldungeon.Assets; -import com.shatteredpixel.shatteredpixeldungeon.Chrome; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; @@ -38,12 +37,8 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm; import com.shatteredpixel.shatteredpixeldungeon.levels.features.LevelTransition; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.shatteredpixel.shatteredpixeldungeon.services.updates.Updates; import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog; -import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock; -import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton; -import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.windows.WndError; import com.watabou.gltextures.TextureCache; @@ -164,11 +159,7 @@ public class InterlevelScene extends PixelScene { else if (lastRegion == 5) loadingAsset = Assets.Interfaces.LOADING_HALLS; else loadingAsset = Assets.Interfaces.SHADOW; - //slow down transition when displaying an install prompt - if (Updates.isInstallable()){ - fadeTime += 0.5f; //adds 1 second total - //speed up transition when debugging - } else if (DeviceCompat.isDebug()){ + if (DeviceCompat.isDebug()){ fadeTime = 0f; } @@ -220,30 +211,6 @@ public class InterlevelScene extends PixelScene { align(message); add( message ); - if (Updates.isInstallable()){ - StyledButton install = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(this, "install")){ - @Override - public void update() { - super.update(); - float p = timeLeft / fadeTime; - if (phase == Phase.FADE_IN) alpha(1 - p); - else if (phase == Phase.FADE_OUT) alpha(p); - else alpha(1); - } - - @Override - protected void onClick() { - super.onClick(); - Updates.launchInstall(); - } - }; - install.icon(Icons.get(Icons.CHANGES)); - install.textColor(Window.SHPX_COLOR); - install.setSize(install.reqWidth()+5, 20); - install.setPos((Camera.main.width - install.width())/2, (Camera.main.height - message.bottom())/3 + message.bottom()); - add(install); - } - phase = Phase.FADE_IN; timeLeft = fadeTime; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java index 16c9134c1..337adc039 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java @@ -279,10 +279,9 @@ public class TitleScene extends PixelScene { public void update() { super.update(); - if (!updateShown && (Updates.updateAvailable() || Updates.isInstallable())){ + if (!updateShown && Updates.updateAvailable()){ updateShown = true; - if (Updates.isInstallable()) text(Messages.get(TitleScene.class, "install")); - else text(Messages.get(TitleScene.class, "update")); + text(Messages.get(TitleScene.class, "update")); } if (updateShown){ @@ -292,10 +291,7 @@ public class TitleScene extends PixelScene { @Override protected void onClick() { - if (Updates.isInstallable()){ - Updates.launchInstall(); - - } else if (Updates.updateAvailable()){ + if (Updates.updateAvailable()){ AvailableUpdateData update = Updates.updateData(); ShatteredPixelDungeon.scene().addToFront( new WndOptions( diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/Updates.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/Updates.java index 52758fc64..fd55b8c09 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/Updates.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/Updates.java @@ -37,8 +37,8 @@ public class Updates { private static Date lastCheck = null; private static final long CHECK_DELAY = 1000*60*60; //1 hour - public static boolean isUpdateable(){ - return supportsUpdates() && service.isUpdateable(); + public static boolean supportsUpdatePrompts(){ + return supportsUpdates() && service.supportsUpdatePrompts(); } public static boolean supportsBetaChannel(){ @@ -46,7 +46,7 @@ public class Updates { } public static void checkForUpdate(){ - if (!isUpdateable()) return; + if (!supportsUpdatePrompts()) return; if (lastCheck != null && (new Date().getTime() - lastCheck.getTime()) < CHECK_DELAY) return; //We do this so that automatically enabled beta checking (for users who DLed a beta) persists afterward @@ -92,16 +92,6 @@ public class Updates { lastCheck = null; } - public static boolean isInstallable(){ - return supportsUpdates() && service.isInstallable(); - } - - public static void launchInstall(){ - if (supportsUpdates()){ - service.initializeInstall(); - } - } - public static boolean supportsReviews() { return supportsUpdates() && service.supportsReviews(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java index 5f2dc4c01..527b88c7a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java @@ -31,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.HeroSelectScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.RankingsScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene; -import com.shatteredpixel.shatteredpixeldungeon.services.updates.Updates; import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; @@ -62,18 +61,6 @@ public class WndGame extends Window { }); curBtn.icon(Icons.get(Icons.PREFS)); - //install prompt - if (Updates.isInstallable()){ - addButton( curBtn = new RedButton( Messages.get(this, "install") ) { - @Override - protected void onClick() { - Updates.launchInstall(); - } - } ); - curBtn.textColor(Window.SHPX_COLOR); - curBtn.icon(Icons.get(Icons.CHANGES)); - } - // Challenges window if (Dungeon.challenges > 0) { addButton( curBtn = new RedButton( Messages.get(this, "challenges") ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java index f589ffeef..ef2b97d65 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java @@ -824,7 +824,7 @@ public class WndSettings extends WndTabbed { chkNews.checked(SPDSettings.news()); add(chkNews); - if (Updates.supportsUpdates() && Updates.isUpdateable()) { + if (Updates.supportsUpdates() && Updates.supportsUpdatePrompts()) { chkUpdates = new CheckBox(Messages.get(this, "updates")) { @Override protected void onClick() { diff --git a/services/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/UpdateService.java b/services/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/UpdateService.java index 14fbb276a..5fa42c1f4 100644 --- a/services/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/UpdateService.java +++ b/services/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/UpdateService.java @@ -21,7 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.services.updates; -//TODO with install and review functionality, this service is less and less just about updates +//TODO with review functionality, this service is about more than just updates // perhaps rename to PlatformService, StoreService, DistributionService, etc? public abstract class UpdateService { @@ -31,8 +31,8 @@ public abstract class UpdateService { public abstract void onConnectionFailed(); } - //whether the app is updateable via an ingame prompt (e.g. not a demo or an android instant app) - public abstract boolean isUpdateable(); + //whether the service supports offering update notifications via an ingame prompt + public abstract boolean supportsUpdatePrompts(); //whether the service supports an opt-in channel for betas public abstract boolean supportsBetaChannel(); @@ -41,15 +41,11 @@ public abstract class UpdateService { public abstract void initializeUpdate( AvailableUpdateData update ); - //whether the app installable via an ingame prompt (e.g. a demo, or an android instant app) - public abstract boolean isInstallable(); - - public abstract void initializeInstall(); - public static abstract class ReviewResultCallback { public abstract void onComplete(); } + //whether the service supports prompts to review the game via and ingame prompt public abstract boolean supportsReviews(); public abstract void initializeReview( ReviewResultCallback callback ); diff --git a/services/updates/debugUpdates/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/DebugUpdates.java b/services/updates/debugUpdates/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/DebugUpdates.java index 969cb723b..f3699ac53 100644 --- a/services/updates/debugUpdates/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/DebugUpdates.java +++ b/services/updates/debugUpdates/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/DebugUpdates.java @@ -29,7 +29,7 @@ public class DebugUpdates extends UpdateService { private static AvailableUpdateData debugUpdateInfo; @Override - public boolean isUpdateable() { + public boolean supportsUpdatePrompts() { return false; //turn on to debug update prompts } @@ -59,16 +59,6 @@ public class DebugUpdates extends UpdateService { Game.platform.openURI( update.URL ); } - @Override - public boolean isInstallable() { - return false; //turn on to test install prompts - } - - @Override - public void initializeInstall() { - //does nothing - } - @Override public boolean supportsReviews() { return false; //turn on to debug review prompts diff --git a/services/updates/githubUpdates/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/GitHubUpdates.java b/services/updates/githubUpdates/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/GitHubUpdates.java index c8c490441..e6fc5cb6e 100644 --- a/services/updates/githubUpdates/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/GitHubUpdates.java +++ b/services/updates/githubUpdates/src/main/java/com/shatteredpixel/shatteredpixeldungeon/services/updates/GitHubUpdates.java @@ -38,7 +38,7 @@ public class GitHubUpdates extends UpdateService { private static Pattern versionCodePattern = Pattern.compile("internal version number: ([0-9]*)", Pattern.CASE_INSENSITIVE); @Override - public boolean isUpdateable() { + public boolean supportsUpdatePrompts() { return true; } @@ -127,16 +127,6 @@ public class GitHubUpdates extends UpdateService { Game.platform.openURI( update.URL ); } - @Override - public boolean isInstallable() { - return false; - } - - @Override - public void initializeInstall() { - //does nothing, always installed - } - @Override public boolean supportsReviews() { return false;