fix: minor UI and UX fixes

This commit is contained in:
Alberto Ponces 2022-08-17 13:18:08 +01:00
parent 165bd4aec2
commit 3a63f63a3c
4 changed files with 15 additions and 24 deletions

View File

@ -36,8 +36,8 @@ class PatchedApplication {
Map toJson() => _$PatchedApplicationToJson(this); Map toJson() => _$PatchedApplicationToJson(this);
static Uint8List bytesFromString(String pictureUrl) => static Uint8List bytesFromString(String icon) =>
Uint8List.fromList(pictureUrl.codeUnits); Uint8List.fromList(icon.codeUnits);
static String bytesToString(Uint8List bytes) => String.fromCharCodes(bytes); static String bytesToString(Uint8List bytes) => String.fromCharCodes(bytes);
} }

View File

@ -12,7 +12,6 @@ class RootCheckerView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ViewModelBuilder<RootCheckerViewModel>.reactive( return ViewModelBuilder<RootCheckerViewModel>.reactive(
disposeViewModel: false, disposeViewModel: false,
onModelReady: (model) => model.initialize,
viewModelBuilder: () => RootCheckerViewModel(), viewModelBuilder: () => RootCheckerViewModel(),
builder: (context, model, child) => Scaffold( builder: (context, model, child) => Scaffold(
floatingActionButton: Column( floatingActionButton: Column(
@ -64,11 +63,7 @@ class RootCheckerView extends StatelessWidget {
), ),
const SizedBox(height: 170), const SizedBox(height: 170),
MagiskButton( MagiskButton(
onPressed: () { onPressed: () => model.checkRoot(),
model
.getMagiskPermissions()
.then((value) => model.checkRoot());
},
), ),
I18nText( I18nText(
'rootCheckerView.grantedPermission', 'rootCheckerView.grantedPermission',

View File

@ -9,11 +9,6 @@ class RootCheckerViewModel extends BaseViewModel {
final _navigationService = locator<NavigationService>(); final _navigationService = locator<NavigationService>();
bool? isRooted = false; bool? isRooted = false;
Future<void> initialize() async {
await checkRoot();
notifyListeners();
}
Future<void> checkRoot() async { Future<void> checkRoot() async {
isRooted = await Root.isRooted(); isRooted = await Root.isRooted();
if (isRooted == true) { if (isRooted == true) {
@ -22,15 +17,6 @@ class RootCheckerViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
Future<bool> getMagiskPermissions() async {
try {
await Root.exec(cmd: 'cat /proc/version');
} on Exception {
return false;
}
return true;
}
Future<void> navigateToHome() async { Future<void> navigateToHome() async {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
prefs.setBool('isRooted', isRooted!); prefs.setBool('isRooted', isRooted!);

View File

@ -54,7 +54,12 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
'latestCommitCard.loadingLabel', 'latestCommitCard.loadingLabel',
), ),
builder: (context, snapshot) => Text( builder: (context, snapshot) => Text(
"${snapshot.data!} ago", snapshot.data!.isNotEmpty
? snapshot.data!
: FlutterI18n.translate(
context,
'latestCommitCard.loadingLabel',
),
style: robotoTextStyle, style: robotoTextStyle,
), ),
), ),
@ -82,7 +87,12 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
'latestCommitCard.loadingLabel', 'latestCommitCard.loadingLabel',
), ),
builder: (context, snapshot) => Text( builder: (context, snapshot) => Text(
"${snapshot.data!} ago", snapshot.data!.isNotEmpty
? snapshot.data!
: FlutterI18n.translate(
context,
'latestCommitCard.loadingLabel',
),
style: robotoTextStyle, style: robotoTextStyle,
), ),
), ),