chore: Merge upstream changes --------- Signed-off-by: Krille <c.kussowski@famedly.com> Co-authored-by: krille-chan <christian-kussowski@posteo.de> Co-authored-by: Krille <c.kussowski@famedly.com> Co-authored-by: Linerly <linerly@proton.me> Co-authored-by: Priit Jõerüüt <hwlate@joeruut.com> Co-authored-by: 大王叫我来巡山 <hamburger2048@users.noreply.hosted.weblate.org> Co-authored-by: fadelkon <fadelkon@posteo.net> Co-authored-by: Aindriú Mac Giolla Eoin <aindriu80@gmail.com> Co-authored-by: Edgars Andersons <Edgars+Weblate@gaitenis.id.lv> Co-authored-by: josé m <correoxm@disroot.org> Co-authored-by: Bezruchenko Simon <worcposj44@gmail.com> Co-authored-by: Christian <christian-pauly@posteo.de> Co-authored-by: - <hitekex@yandex.ru> Co-authored-by: Angelo Schirinzi <Odi-3@users.noreply.hosted.weblate.org> Co-authored-by: xabirequejo <xabi.rn@gmail.com> Co-authored-by: Piotr Orzechowski <piotr@orzechowski.tech> Co-authored-by: Rex_sa <rex.sa@pm.me> Co-authored-by: Tewuzij <tenajeza@outlook.com> Co-authored-by: goknarbahceli <goknarbahceli@proton.me> Co-authored-by: தமிழ்நேரம் <anishprabu.t@gmail.com> Co-authored-by: Erin <erin@erindesu.cz> Co-authored-by: EpicKiwi <me@epickiwi.fr> Co-authored-by: Christian Tietze <me@christiantietze.de> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
42 lines
1.3 KiB
Dart
42 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
|
|
|
extension SyncStatusLocalization on SyncStatusUpdate {
|
|
IconData get icon {
|
|
switch (status) {
|
|
case SyncStatus.waitingForResponse:
|
|
return Icons.hourglass_empty_outlined;
|
|
case SyncStatus.error:
|
|
return Icons.cloud_off_outlined;
|
|
case SyncStatus.processing:
|
|
return Icons.hourglass_top_outlined;
|
|
case SyncStatus.cleaningUp:
|
|
return Icons.hourglass_bottom_outlined;
|
|
case SyncStatus.finished:
|
|
return Icons.hourglass_full_outlined;
|
|
}
|
|
}
|
|
|
|
String calcLocalizedString(BuildContext context) {
|
|
final progress = this.progress;
|
|
switch (status) {
|
|
case SyncStatus.waitingForResponse:
|
|
return L10n.of(context).waitingForServer;
|
|
case SyncStatus.error:
|
|
return ((error?.exception ?? Object()) as Object)
|
|
.toLocalizedString(context);
|
|
case SyncStatus.processing:
|
|
case SyncStatus.cleaningUp:
|
|
case SyncStatus.finished:
|
|
return progress == null
|
|
? L10n.of(context).synchronizingPleaseWait
|
|
: L10n.of(context).synchronizingPleaseWaitCounter(
|
|
(progress * 100).round().toString(),
|
|
);
|
|
}
|
|
}
|
|
}
|