From 2675901bea615802f6f0cced88b3ac8a8bf31fde Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 19 Aug 2020 20:45:03 -0400 Subject: [PATCH] v0.8.2c: added reviews to the structure of update services --- .../services/updates/Updates.java | 14 ++++++++++++++ .../services/updates/UpdateService.java | 8 ++++++++ .../services/updates/DebugUpdates.java | 6 ++++++ .../services/updates/GitHubUpdates.java | 5 +++++ 4 files changed, 33 insertions(+) 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 864a97c68..1cad81931 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 @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.services.updates; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; +import com.watabou.utils.Callback; import java.util.Date; @@ -92,4 +93,17 @@ public class Updates { } } + public static void launchReview(Callback callback){ + if (supportsUpdates()){ + service.initializeReview(new UpdateService.ReviewResultCallback() { + @Override + public void onComplete() { + callback.call(); + } + }); + } else { + callback.call(); + } + } + } 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 281b633af..1df7d2a8f 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,6 +21,8 @@ package com.shatteredpixel.shatteredpixeldungeon.services.updates; +//TODO with install and review functionality, this service is less and less just about updates +// perhaps rename to PlatformService, StoreService, DistributionService, etc? public abstract class UpdateService { public static abstract class UpdateResultCallback { @@ -41,4 +43,10 @@ public abstract class UpdateService { public abstract void initializeInstall(); + public static abstract class ReviewResultCallback { + public abstract void onComplete(); + } + + 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 5c23f9f30..8c1bfdb73 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 @@ -65,4 +65,10 @@ public class DebugUpdates extends UpdateService { //does nothing } + @Override + public void initializeReview(ReviewResultCallback callback) { + //does nothing + callback.onComplete(); + } + } 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 5e3ee18a4..e0806cf84 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 @@ -135,4 +135,9 @@ public class GitHubUpdates extends UpdateService { //does nothing, always installed } + @Override + public void initializeReview(ReviewResultCallback callback) { + //does nothing, no review functionality here + callback.onComplete(); + } }