Revert "Just no"

This reverts commit c5fcf49eda.
This commit is contained in:
LucasGGamerM 2022-12-25 14:21:09 -03:00
parent b060894a6c
commit 2dccec99cc
2 changed files with 5 additions and 22 deletions

View File

@ -40,7 +40,6 @@ import okhttp3.Response;
public class GithubSelfUpdaterImpl extends GithubSelfUpdater{ public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
private static final long CHECK_PERIOD=6*3600*1000L; private static final long CHECK_PERIOD=6*3600*1000L;
private static final String TAG="GithubSelfUpdater"; private static final String TAG="GithubSelfUpdater";
private static String changelog;
private UpdateState state=UpdateState.NO_UPDATE; private UpdateState state=UpdateState.NO_UPDATE;
private UpdateInfo info; private UpdateInfo info;
@ -110,11 +109,6 @@ public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
MastodonAPIController.runInBackground(this::actuallyCheckForUpdates); MastodonAPIController.runInBackground(this::actuallyCheckForUpdates);
} }
@Override
public void getChangelog(){
MastodonAPIController.runInBackground(this::actuallyGetChangelog);
}
private void actuallyCheckForUpdates(){ private void actuallyCheckForUpdates(){
Request req=new Request.Builder() Request req=new Request.Builder()
.url("https://api.github.com/repos/LucasGGamerM/moshidon/releases/latest") .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; String changelog = null;
Request req=new Request.Builder() Request req=new Request.Builder()
.url("https://api.github.com/repos/LucasGGamerM/moshidon/releases/latest") .url("https://api.github.com/repos/LucasGGamerM/moshidon/releases/latest")
@ -192,24 +186,16 @@ public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
changelog=obj.get("body").getAsString(); changelog=obj.get("body").getAsString();
if(changelog == null){ if(changelog == null){
Log.w(TAG, "No changelog available"); Log.w(TAG, "No changelog available");
return; return null;
} }
return changelog;
}catch(Exception x){ }catch(Exception x){
Log.w(TAG, "getChangelog: ", 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; return changelog;
} }
private void setState(UpdateState state){ private void setState(UpdateState state){
this.state=state; this.state=state;
E.post(new SelfUpdateStateChangedEvent(state)); E.post(new SelfUpdateStateChangedEvent(state));

View File

@ -3,7 +3,6 @@ package org.joinmastodon.android.fragments;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
@ -268,9 +267,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
} }
private void onGetChangelogClick(){ private void onGetChangelogClick(){
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getContext()); GithubSelfUpdater.getInstance().getChangelog();
alertDialogBuilder.setTitle("Something TODO remove this");
alertDialogBuilder.setMessage(GithubSelfUpdater.getInstance().getChangelog());
} }
private void onThemePreferenceClick(GlobalUserPreferences.ThemePreference theme){ private void onThemePreferenceClick(GlobalUserPreferences.ThemePreference theme){