From 2dccec99cc34118f04d5a1528fdf09f395034152 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sun, 25 Dec 2022 14:21:09 -0300 Subject: [PATCH] Revert "Just no" This reverts commit c5fcf49eda158383f51bc739e8c53712519d5979. --- .../updater/GithubSelfUpdaterImpl.java | 22 ++++--------------- .../android/fragments/SettingsFragment.java | 5 +---- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/mastodon/src/github/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java b/mastodon/src/github/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java index 9ca406ff9..7c9a59b88 100644 --- a/mastodon/src/github/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java +++ b/mastodon/src/github/java/org/joinmastodon/android/updater/GithubSelfUpdaterImpl.java @@ -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)); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java index 29051c15c..6d62d9438 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -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){