feat: alphabet list, change Layout etc
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import '../models/app_error.dart';
|
||||
import '../models/update_failure.dart';
|
||||
import 'app_localizations.dart';
|
||||
|
||||
extension AppLocalizationsHelpers on AppLocalizations {
|
||||
@@ -44,47 +45,18 @@ extension AppLocalizationsHelpers on AppLocalizations {
|
||||
};
|
||||
}
|
||||
|
||||
/// Update messages still come from the OTA plugin as plain strings.
|
||||
String _updateMessage(String? message) {
|
||||
return switch (message) {
|
||||
'Update failed' => updateFailed,
|
||||
'Download failed' => downloadFailed,
|
||||
'Installation failed' => installationFailed,
|
||||
'Update already in progress' => updateAlreadyInProgress,
|
||||
_ => message ?? genericError,
|
||||
String updateFailureText(UpdateFailure? failure) {
|
||||
return switch (failure) {
|
||||
UpdateFailure.download => updateDownloadFailed,
|
||||
UpdateFailure.checksum => updateChecksumFailed,
|
||||
UpdateFailure.permission => updatePermissionDenied,
|
||||
UpdateFailure.install => updateInstallFailed,
|
||||
UpdateFailure.alreadyRunning => updateAlreadyInProgress,
|
||||
UpdateFailure.simulated => simulatedDownloadError,
|
||||
UpdateFailure.unknown || null => updateFailed,
|
||||
};
|
||||
}
|
||||
|
||||
String updateStatus(String status) {
|
||||
if (status.startsWith('Downloading ')) {
|
||||
return downloading(status.substring('Downloading '.length));
|
||||
}
|
||||
|
||||
return switch (status) {
|
||||
'Preparing download…' => preparingDownload,
|
||||
'Download failed' => downloadFailed,
|
||||
'Installing update…' => installingUpdate,
|
||||
'Update installed! Restarting…' => updateInstalledRestarting,
|
||||
'Installation failed' => installationFailed,
|
||||
'Update already running' => updateAlreadyRunning,
|
||||
_ => status,
|
||||
};
|
||||
}
|
||||
|
||||
String updateError(String? message) {
|
||||
if (message == null) return updateFailed;
|
||||
if (message.startsWith('Download failed')) return downloadFailedWithDetail;
|
||||
if (message.startsWith('Installation failed')) {
|
||||
return installationFailedWithDetail;
|
||||
}
|
||||
if (message == 'Simulated download error (network timeout)') {
|
||||
return simulatedDownloadError;
|
||||
}
|
||||
if (message == 'Update already in progress') return updateAlreadyInProgress;
|
||||
|
||||
return _updateMessage(message);
|
||||
}
|
||||
|
||||
String devAction(String? message) {
|
||||
if (message == null) return '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user