v0.8.0: added an update notification service

This commit is contained in:
Evan Debenham
2019-11-22 15:05:47 -05:00
parent 2e533b74db
commit 2138ad24ec
24 changed files with 606 additions and 13 deletions

View File

@@ -20,6 +20,10 @@ task debug(dependsOn: classes, type: JavaExec) {
systemProperty 'Specification-Title', appName
systemProperty 'Specification-Version', appVersionName + "-INDEV"
systemProperty 'Implementation-Version', appVersionCode
dependencies {
debugImplementation project(':services:updates:debugUpdates')
}
}
//need a separate task to compile dependencies first, seeing as we're setting them up in an odd way
@@ -38,6 +42,10 @@ task release(dependsOn: compileForRelease, type: Jar) {
attributes 'Specification-Version': appVersionName
attributes 'Implementation-Version': appVersionCode
}
dependencies {
releaseImplementation project(':services:updates:githubUpdates')
}
}
dependencies {
@@ -47,4 +55,8 @@ dependencies {
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
//Need these at compile time to prevent errors there.
// The actual dependency used at runtime will vary based on source set.
compileOnly project(':services:updates:debugUpdates')
}

View File

@@ -29,6 +29,8 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Preferences;
import com.badlogic.gdx.utils.SharedLibraryLoader;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.services.updates.UpdateImpl;
import com.shatteredpixel.shatteredpixeldungeon.services.updates.Updates;
import com.watabou.noosa.Game;
import com.watabou.utils.FileUtils;
import com.watabou.utils.Point;
@@ -79,6 +81,10 @@ public class DesktopLauncher {
} catch (NumberFormatException e) {
Game.versionCode = Integer.parseInt(System.getProperty("Implementation-Version"));
}
if (UpdateImpl.supportsUpdates()){
Updates.service = UpdateImpl.getUpdateService();
}
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();

View File

@@ -58,6 +58,11 @@ public class DesktopPlatformSupport extends PlatformSupport {
} );
}
@Override
public boolean connectedToUnmeteredNetwork() {
return true; //no easy way to check this in desktop, just assume user doesn't care
}
@Override
public void promptTextInput(String title, String hintText, int maxLen, boolean multiLine, String posTxt, String negTxt, TextCallback callback) {