From c946f7c8922b767d636ef58960ab9f5b6bdc181e Mon Sep 17 00:00:00 2001 From: vyPal Date: Thu, 7 Sep 2023 17:08:00 +0200 Subject: [PATCH] Fix shorebird to show notification --- lib/home.dart | 32 +++----------------------------- shorebird.yaml | 2 +- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/lib/home.dart b/lib/home.dart index 0f33db6..e47a3ba 100644 --- a/lib/home.dart +++ b/lib/home.dart @@ -13,7 +13,7 @@ import 'package:package_info/package_info.dart'; import 'package:restart_app/restart_app.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:shorebird_code_push/shorebird_code_push_web.dart'; +import 'package:shorebird_code_push/shorebird_code_push.dart'; import 'package:url_launcher/url_launcher.dart'; class HomePage extends StatefulWidget { @@ -189,20 +189,14 @@ class HomePageState extends State { }); if (isUpdateAvailable) { - _showUpdateAvailableBanner(); - } else { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('No update available'), - ), - ); + _downloadUpdate(); } } void _showDownloadingBanner() { ScaffoldMessenger.of(context).showMaterialBanner( const MaterialBanner( - content: Text('Downloading...'), + content: Text('Downloading patch...'), actions: [ SizedBox( height: 14, @@ -216,26 +210,6 @@ class HomePageState extends State { ); } - void _showUpdateAvailableBanner() { - ScaffoldMessenger.of(context).showMaterialBanner( - MaterialBanner( - content: const Text('Update available'), - actions: [ - TextButton( - onPressed: () async { - ScaffoldMessenger.of(context).hideCurrentMaterialBanner(); - await _downloadUpdate(); - - if (!mounted) return; - ScaffoldMessenger.of(context).hideCurrentMaterialBanner(); - }, - child: const Text('Download'), - ), - ], - ), - ); - } - void _showRestartBanner() { ScaffoldMessenger.of(context).showMaterialBanner( const MaterialBanner( diff --git a/shorebird.yaml b/shorebird.yaml index b14e9f6..8416cd9 100644 --- a/shorebird.yaml +++ b/shorebird.yaml @@ -10,4 +10,4 @@ app_id: 0f4dc1a8-0c38-409f-838c-9bca97783f4a # If auto_update: false, you will need to use package:shorebird_code_push to trigger updates. # https://pub.dev/packages/shorebird_code_push # Uncomment the following line to disable automatic updates. -auto_update: true \ No newline at end of file +auto_update: false \ No newline at end of file