Skip to content

Commit

Permalink
chore: Follow up update snackbar
Browse files Browse the repository at this point in the history
  • Loading branch information
krille-chan committed Nov 4, 2024
1 parent 448a111 commit c447c20
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions lib/utils/show_update_snackbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,18 @@ abstract class UpdateNotifier {
static const String versionStoreKey = 'last_known_version';

static void showUpdateSnackBar(BuildContext context) async {
final theme = Theme.of(context);
final scaffoldMessenger = ScaffoldMessenger.of(context);
final currentVersion = await PlatformInfos.getVersion();
final store = await SharedPreferences.getInstance();
final storedVersion = store.getString(versionStoreKey);

if (currentVersion != storedVersion) {
if (storedVersion != null) {
ScaffoldFeatureController? controller;
controller = scaffoldMessenger.showSnackBar(
scaffoldMessenger.showSnackBar(
SnackBar(
duration: const Duration(seconds: 30),
content: Row(
children: [
IconButton(
icon: Icon(
Icons.close_outlined,
size: 20,
color: theme.colorScheme.onPrimary,
),
onPressed: () => controller?.close(),
),
Expanded(
child: Text(
L10n.of(context).updateInstalled(currentVersion),
),
),
],
),
showCloseIcon: true,
content: Text(L10n.of(context).updateInstalled(currentVersion)),
action: SnackBarAction(
label: L10n.of(context).changelog,
onPressed: () => launchUrlString(AppConfig.changelogUrl),
Expand Down

0 comments on commit c447c20

Please sign in to comment.