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);
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);
}

View File

@ -12,7 +12,6 @@ class RootCheckerView extends StatelessWidget {
Widget build(BuildContext context) {
return ViewModelBuilder<RootCheckerViewModel>.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',

View File

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

View File

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