Skip to content

Commit

Permalink
Set zero flag in shared preferences.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsreichardt committed Dec 3, 2023
1 parent 9c7edb8 commit f610a1b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/src/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:ankigpt/src/providers/show_successful_playment_dialog.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:shared_preferences/shared_preferences.dart';

class HomePage extends ConsumerStatefulWidget {
const HomePage({
Expand All @@ -43,6 +44,7 @@ class _HomePage2State extends ConsumerState<HomePage> {

if (widget.has0Analytics) {
unawaited(increaseZeroCounter());
unawaited(setZeroFlag());
}
}

Expand All @@ -59,6 +61,15 @@ class _HomePage2State extends ConsumerState<HomePage> {
}
}

Future<void> setZeroFlag() async {
try {
final sharedPreferences = await SharedPreferences.getInstance();
await sharedPreferences.setBool('0', true);
} catch (e) {
ref.read(loggerProvider).i('Could not set zero flag', e);
}
}

void _maybeShowSuccessfulPayment() {
final notifier = ref.read(showSuccessfulPaymentDialogProvider.notifier);
final shouldShowSuccessfulPaymentDialog = notifier.get();
Expand Down

0 comments on commit f610a1b

Please sign in to comment.