mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-05-20 14:30:10 -05:00
apdate checker upd
This commit is contained in:
-1
@@ -16,7 +16,6 @@ import com.liskovsoft.smartyoutubetv2.common.app.views.ViewManager;
|
||||
import com.liskovsoft.smartyoutubetv2.common.autoframerate.FormatItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class SplashActivity extends Activity {
|
||||
|
||||
private void checkForUpdates() {
|
||||
AppUpdateManager updatePresenter = AppUpdateManager.instance(this);
|
||||
updatePresenter.checkForUpdates();
|
||||
updatePresenter.start();
|
||||
updatePresenter.unhold();
|
||||
}
|
||||
}
|
||||
|
||||
+19
-6
@@ -3,8 +3,11 @@ package com.liskovsoft.smartyoutubetv2.tv.update;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import com.liskovsoft.appupdatechecker2.AppUpdateChecker;
|
||||
import com.liskovsoft.appupdatechecker2.AppUpdateCheckerListener;
|
||||
|
||||
public class AppUpdateManager {
|
||||
import java.util.List;
|
||||
|
||||
public class AppUpdateManager implements AppUpdateCheckerListener {
|
||||
private static final String UPDATE_MANIFEST_URL = "https://github.com/yuliskov/SmartYouTubeTV/releases/download/stable/smartyoutubetv.json";
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static AppUpdateManager sInstance;
|
||||
@@ -13,7 +16,7 @@ public class AppUpdateManager {
|
||||
|
||||
public AppUpdateManager(Context context) {
|
||||
mContext = context;
|
||||
mUpdateChecker = new AppUpdateChecker(mContext);
|
||||
mUpdateChecker = new AppUpdateChecker(mContext, this);
|
||||
}
|
||||
|
||||
public static AppUpdateManager instance(Context context) {
|
||||
@@ -24,11 +27,21 @@ public class AppUpdateManager {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void checkForUpdates() {
|
||||
mUpdateChecker.forceCheckForUpdates(UPDATE_MANIFEST_URL);
|
||||
}
|
||||
|
||||
public void unhold() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
mUpdateChecker.forceCheckForUpdates(UPDATE_MANIFEST_URL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onUpdateFound(List<String> changelog) {
|
||||
return AppUpdateCheckerListener.ACTION_INSTALL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
// NOP
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user