diff --git a/assets/n8TN5qDG22PAuP50Il b/assets/n8TN5qDG22PAuP50Il index 4e289e8..e5ff107 100644 --- a/assets/n8TN5qDG22PAuP50Il +++ b/assets/n8TN5qDG22PAuP50Il @@ -4,4 +4,4 @@ APP_CONFIG_URL=https://raw.githubusercontent.com/JICA98/DailyAL/psycho/config ERROR_REPORT_URL= API_URL=https://dal-rust-api.onrender.com API_SECRET=9XkJNP7ACL4BCVpXzwAzFZaeqdPpwv0aWpV1b89AxkCCSXq6N035YN8wCV8fX1yijaJzinJBMHhyku92qVPXFiQSayfXYajtZtwktYJMrzSTSva18yGLQf9vvQuTALCc -BUILD_VARIANT=fdroid +BUILD_VARIANT=github diff --git a/lib/screens/homescreen.dart b/lib/screens/homescreen.dart index 5f56fda..1c5720c 100644 --- a/lib/screens/homescreen.dart +++ b/lib/screens/homescreen.dart @@ -1,4 +1,5 @@ import 'package:dailyanimelist/api/credmal.dart'; +import 'package:dailyanimelist/cache/cachemanager.dart'; import 'package:dailyanimelist/constant.dart'; import 'package:dailyanimelist/notifservice.dart'; import 'package:dailyanimelist/pages/explorepage.dart'; @@ -131,16 +132,28 @@ class _HomeScreenState extends State with TickerProviderStateMixin { } final tag = await getCurrentTag(); final git = await getLatestRelease(); - final available = isUpdateAvailable(tag, git.tagName ?? ''); - if (available) { + final latestTag = git.tagName ?? ''; + final available = isUpdateAvailable(tag, latestTag); + final hasAlreadyNotified = await _hasAlreadyNotified(latestTag); + if (available && !hasAlreadyNotified) { await showDialog( context: context, builder: (context) => showUpdateAvailablePopup(git, context, tag), ); + CacheManager.instance + .setValueForServiceAutoExpireIn('update', latestTag, 'true'); } } catch (e) {} } + Future _hasAlreadyNotified(String latestTag) async { + return (await CacheManager.instance + .getValueForServiceAutoExpire('update', latestTag)) + ?.toString() + .equals('true') ?? + false; + } + @override void dispose() { super.dispose();