Cloud save fixes and improvements

This commit is contained in:
pelya
2014-08-26 01:28:42 +03:00
parent 5c864f1051
commit 4e67c9afc3
6 changed files with 50 additions and 16 deletions

View File

@@ -49,4 +49,9 @@ class CloudSave
{
return false;
}
public boolean isSignedIn()
{
return false;
}
}

View File

@@ -834,8 +834,21 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
context.requestNewAdvertisement();
}
public boolean cloudSave(String filename, String saveId, String dialogTitle, String description, String imageFile, long playedTimeMs)
public boolean cloudSave(final String filename, final String saveId, final String dialogTitle, final String description, final String imageFile, final long playedTimeMs)
{
if (context.cloudSave.isSignedIn() && saveId.length() > 0)
{
// Do not show progress dialog, run in a parallel thread, so main thread will not be blocked
new Thread(new Runnable()
{
public void run()
{
context.cloudSave.save(filename, saveId, dialogTitle, description, imageFile, playedTimeMs);
}
}).start();
return true;
}
context.runOnUiThread(new Runnable()
{
public void run()

View File

@@ -134,7 +134,8 @@ public class CloudSave implements GameHelper.GameHelperListener {
else
return false;
}
saveId = saveId.replaceAll("[^a-zA-Z0-9\\-._~]", "-");
Log.d("SDL", "CloudSave: urlescaping saveId: " + saveId);
Snapshots.OpenSnapshotResult result = Games.Snapshots.open(getApiClient(), saveId, true).await();
Snapshot crapshot = processSnapshotOpenResult(result, 0);
if( crapshot == null )
@@ -222,6 +223,10 @@ public class CloudSave implements GameHelper.GameHelperListener {
return false;
}
public boolean isSignedIn() {
return mHelper.isSignedIn();
}
// ===== Private API =====
boolean signInSucceeded = false;
@@ -339,10 +344,6 @@ public class CloudSave implements GameHelper.GameHelperListener {
return mHelper.getApiClient();
}
public boolean isSignedIn() {
return mHelper.isSignedIn();
}
public void beginUserInitiatedSignIn() {
mHelper.beginUserInitiatedSignIn();
}