parent
b060894a6c
commit
2dccec99cc
|
@ -40,7 +40,6 @@ import okhttp3.Response;
|
|||
public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
|
||||
private static final long CHECK_PERIOD=6*3600*1000L;
|
||||
private static final String TAG="GithubSelfUpdater";
|
||||
private static String changelog;
|
||||
|
||||
private UpdateState state=UpdateState.NO_UPDATE;
|
||||
private UpdateInfo info;
|
||||
|
@ -110,11 +109,6 @@ public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
|
|||
MastodonAPIController.runInBackground(this::actuallyCheckForUpdates);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getChangelog(){
|
||||
MastodonAPIController.runInBackground(this::actuallyGetChangelog);
|
||||
}
|
||||
|
||||
private void actuallyCheckForUpdates(){
|
||||
Request req=new Request.Builder()
|
||||
.url("https://api.github.com/repos/LucasGGamerM/moshidon/releases/latest")
|
||||
|
@ -181,7 +175,7 @@ public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
|
|||
}
|
||||
}
|
||||
|
||||
public void actuallyGetChangelog(){
|
||||
public String getChangelog(){
|
||||
String changelog = null;
|
||||
Request req=new Request.Builder()
|
||||
.url("https://api.github.com/repos/LucasGGamerM/moshidon/releases/latest")
|
||||
|
@ -192,24 +186,16 @@ public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
|
|||
changelog=obj.get("body").getAsString();
|
||||
if(changelog == null){
|
||||
Log.w(TAG, "No changelog available");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
return changelog;
|
||||
}catch(Exception x){
|
||||
Log.w(TAG, "getChangelog: ", x);
|
||||
}finally{
|
||||
// setState(changelog==null ? UpdateState.NO_UPDATE : UpdateState.UPDATE_AVAILABLE);
|
||||
setChangelog(changelog);
|
||||
}
|
||||
}
|
||||
|
||||
private void setChangelog(String changelog){
|
||||
this.changelog = changelog;
|
||||
}
|
||||
|
||||
public String getChangelogText(){
|
||||
return changelog;
|
||||
}
|
||||
|
||||
|
||||
private void setState(UpdateState state){
|
||||
this.state=state;
|
||||
E.post(new SelfUpdateStateChangedEvent(state));
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.joinmastodon.android.fragments;
|
|||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -268,9 +267,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
|||
}
|
||||
|
||||
private void onGetChangelogClick(){
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getContext());
|
||||
alertDialogBuilder.setTitle("Something TODO remove this");
|
||||
alertDialogBuilder.setMessage(GithubSelfUpdater.getInstance().getChangelog());
|
||||
GithubSelfUpdater.getInstance().getChangelog();
|
||||
}
|
||||
|
||||
private void onThemePreferenceClick(GlobalUserPreferences.ThemePreference theme){
|
||||
|
|
Loading…
Reference in New Issue