From 3a63f63a3c14812a548a7996c681a9b473468a81 Mon Sep 17 00:00:00 2001 From: Alberto Ponces Date: Wed, 17 Aug 2022 13:18:08 +0100 Subject: [PATCH] fix: minor UI and UX fixes --- lib/models/patched_application.dart | 4 ++-- lib/ui/views/root_checker/root_checker_view.dart | 7 +------ .../views/root_checker/root_checker_viewmodel.dart | 14 -------------- lib/ui/widgets/latest_commit_card.dart | 14 ++++++++++++-- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/lib/models/patched_application.dart b/lib/models/patched_application.dart index ea530fa6..73e5d5f9 100644 --- a/lib/models/patched_application.dart +++ b/lib/models/patched_application.dart @@ -36,8 +36,8 @@ class PatchedApplication { Map toJson() => _$PatchedApplicationToJson(this); - static Uint8List bytesFromString(String pictureUrl) => - Uint8List.fromList(pictureUrl.codeUnits); + static Uint8List bytesFromString(String icon) => + Uint8List.fromList(icon.codeUnits); static String bytesToString(Uint8List bytes) => String.fromCharCodes(bytes); } diff --git a/lib/ui/views/root_checker/root_checker_view.dart b/lib/ui/views/root_checker/root_checker_view.dart index 73f0763c..9a63230f 100644 --- a/lib/ui/views/root_checker/root_checker_view.dart +++ b/lib/ui/views/root_checker/root_checker_view.dart @@ -12,7 +12,6 @@ class RootCheckerView extends StatelessWidget { Widget build(BuildContext context) { return ViewModelBuilder.reactive( disposeViewModel: false, - onModelReady: (model) => model.initialize, viewModelBuilder: () => RootCheckerViewModel(), builder: (context, model, child) => Scaffold( floatingActionButton: Column( @@ -64,11 +63,7 @@ class RootCheckerView extends StatelessWidget { ), const SizedBox(height: 170), MagiskButton( - onPressed: () { - model - .getMagiskPermissions() - .then((value) => model.checkRoot()); - }, + onPressed: () => model.checkRoot(), ), I18nText( 'rootCheckerView.grantedPermission', diff --git a/lib/ui/views/root_checker/root_checker_viewmodel.dart b/lib/ui/views/root_checker/root_checker_viewmodel.dart index 1b674fdd..3d6f2092 100644 --- a/lib/ui/views/root_checker/root_checker_viewmodel.dart +++ b/lib/ui/views/root_checker/root_checker_viewmodel.dart @@ -9,11 +9,6 @@ class RootCheckerViewModel extends BaseViewModel { final _navigationService = locator(); bool? isRooted = false; - Future initialize() async { - await checkRoot(); - notifyListeners(); - } - Future checkRoot() async { isRooted = await Root.isRooted(); if (isRooted == true) { @@ -22,15 +17,6 @@ class RootCheckerViewModel extends BaseViewModel { notifyListeners(); } - Future getMagiskPermissions() async { - try { - await Root.exec(cmd: 'cat /proc/version'); - } on Exception { - return false; - } - return true; - } - Future navigateToHome() async { final prefs = await SharedPreferences.getInstance(); prefs.setBool('isRooted', isRooted!); diff --git a/lib/ui/widgets/latest_commit_card.dart b/lib/ui/widgets/latest_commit_card.dart index 91692a9f..052b00de 100644 --- a/lib/ui/widgets/latest_commit_card.dart +++ b/lib/ui/widgets/latest_commit_card.dart @@ -54,7 +54,12 @@ class _LatestCommitCardState extends State { 'latestCommitCard.loadingLabel', ), builder: (context, snapshot) => Text( - "${snapshot.data!} ago", + snapshot.data!.isNotEmpty + ? snapshot.data! + : FlutterI18n.translate( + context, + 'latestCommitCard.loadingLabel', + ), style: robotoTextStyle, ), ), @@ -82,7 +87,12 @@ class _LatestCommitCardState extends State { 'latestCommitCard.loadingLabel', ), builder: (context, snapshot) => Text( - "${snapshot.data!} ago", + snapshot.data!.isNotEmpty + ? snapshot.data! + : FlutterI18n.translate( + context, + 'latestCommitCard.loadingLabel', + ), style: robotoTextStyle, ), ),