diff --git a/board_games_companion/lib/services/rate_and_review_service.dart b/board_games_companion/lib/services/rate_and_review_service.dart index ce485aad..2de134ac 100644 --- a/board_games_companion/lib/services/rate_and_review_service.dart +++ b/board_games_companion/lib/services/rate_and_review_service.dart @@ -14,15 +14,15 @@ class RateAndReviewService { static const Duration _requiredAppUsedForDuration = Duration(days: 14); static const Duration _remindMeLaterDuration = Duration(days: 7); static const Duration _requiredAppLaunchedForDuration = Duration(seconds: 30); - static const int _requiredNumberOfEventsLogged = 300; + static const int _requiredNumberOfSignificantActions = 300; bool showRateAndReviewDialog = false; Future increaseNumberOfSignificantActions() async { - int numberOfLoggedEvents = _preferencesService.getNumberOfSignificantActions(); - if (numberOfLoggedEvents < _requiredNumberOfEventsLogged) { + int numberOfSignificantActions = _preferencesService.getNumberOfSignificantActions(); + if (numberOfSignificantActions < _requiredNumberOfSignificantActions) { await _preferencesService.setNumberOfSignificantActions( - numberOfLoggedEvents += 1, + numberOfSignificantActions += 1, ); } @@ -36,7 +36,7 @@ class RateAndReviewService { return; } - InAppReview.instance.requestReview(); + await InAppReview.instance.requestReview(); await _preferencesService.setRateAndReviewDialogSeen(); } @@ -72,7 +72,7 @@ class RateAndReviewService { firstTimeLaunchDate.add(_requiredAppUsedForDuration).isBefore(nowUtc) && appLaunchDate.add(_requiredAppLaunchedForDuration).isBefore(nowUtc) && (remindMeLaterDate == null || remindMeLaterDate.isBefore(nowUtc)) && - numberOfSignificantActions >= _requiredNumberOfEventsLogged; + numberOfSignificantActions >= _requiredNumberOfSignificantActions; } catch (e, stack) { FirebaseCrashlytics.instance.recordError(e, stack); } diff --git a/board_games_companion/lib/stores/board_game_details_store.dart b/board_games_companion/lib/stores/board_game_details_store.dart index a6b996d5..f9cbc39c 100644 --- a/board_games_companion/lib/stores/board_game_details_store.dart +++ b/board_games_companion/lib/stores/board_game_details_store.dart @@ -38,7 +38,7 @@ class BoardGameDetailsStore with ChangeNotifier { ); if (boardGameExpansionDetails != null && - boardGameExpansionDetails.isExpansion! && + (boardGameExpansionDetails.isExpansion ?? false) && boardGameExpansionDetails.isOwned) { boardGameExpansion.isInCollection = true; } diff --git a/board_games_companion/lib/stores/playthroughs_store.dart b/board_games_companion/lib/stores/playthroughs_store.dart index 2eb5313a..88450e49 100644 --- a/board_games_companion/lib/stores/playthroughs_store.dart +++ b/board_games_companion/lib/stores/playthroughs_store.dart @@ -22,7 +22,7 @@ class PlaythroughsStore with ChangeNotifier { final AnalyticsService _analyticsService; BoardGameDetails? _selectedBoardGame; - List? _playthroughs; + List _playthroughs = []; BoardGameDetails? get selectedBoardGame => _selectedBoardGame; @@ -41,7 +41,7 @@ class PlaythroughsStore with ChangeNotifier { FirebaseCrashlytics.instance.recordError(e, stack); } - return _playthroughs ?? []; + return _playthroughs; } Future createPlaythrough( @@ -59,7 +59,7 @@ class PlaythroughsStore with ChangeNotifier { duration, ); - _playthroughs!.add(newPlaythrough!); + _playthroughs.add(newPlaythrough!); notifyListeners(); await _analyticsService.logEvent( @@ -96,7 +96,7 @@ class PlaythroughsStore with ChangeNotifier { try { final deleteSucceeded = await _playthroughService.deletePlaythrough(playthroughId); if (deleteSucceeded) { - _playthroughs!.removeWhere((p) => p.id == playthroughId); + _playthroughs.removeWhere((p) => p.id == playthroughId); notifyListeners(); }