mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
fix: fix broken manager update implmentation
This commit is contained in:
parent
d2e8e7dd5d
commit
15a32a18b7
3 changed files with 9 additions and 2 deletions
|
@ -17,6 +17,7 @@ class HomeView extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ViewModelBuilder<HomeViewModel>.reactive(
|
return ViewModelBuilder<HomeViewModel>.reactive(
|
||||||
disposeViewModel: false,
|
disposeViewModel: false,
|
||||||
|
fireOnViewModelReadyOnce: true,
|
||||||
onViewModelReady: (model) => model.initialize(context),
|
onViewModelReady: (model) => model.initialize(context),
|
||||||
viewModelBuilder: () => locator<HomeViewModel>(),
|
viewModelBuilder: () => locator<HomeViewModel>(),
|
||||||
builder: (context, model, child) => Scaffold(
|
builder: (context, model, child) => Scaffold(
|
||||||
|
|
|
@ -116,7 +116,13 @@ class HomeViewModel extends BaseViewModel {
|
||||||
|
|
||||||
Future<bool> hasManagerUpdates() async {
|
Future<bool> hasManagerUpdates() async {
|
||||||
final String? latestVersion = await _managerAPI.getLatestManagerVersion();
|
final String? latestVersion = await _managerAPI.getLatestManagerVersion();
|
||||||
final String currentVersion = await _managerAPI.getCurrentManagerVersion();
|
String currentVersion = await _managerAPI.getCurrentManagerVersion();
|
||||||
|
|
||||||
|
// add v to current version
|
||||||
|
if (!currentVersion.startsWith('v')) {
|
||||||
|
currentVersion = 'v$currentVersion';
|
||||||
|
}
|
||||||
|
|
||||||
if (latestVersion != currentVersion) {
|
if (latestVersion != currentVersion) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
FutureBuilder<bool>(
|
FutureBuilder<bool>(
|
||||||
future: locator<HomeViewModel>().hasManagerUpdates(),
|
future: model.hasManagerUpdates(),
|
||||||
initialData: false,
|
initialData: false,
|
||||||
builder: (context, snapshot) => Opacity(
|
builder: (context, snapshot) => Opacity(
|
||||||
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
|
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
|
||||||
|
|
Loading…
Reference in a new issue