-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* not showing playthough snackbar when navigating away * manually logging the screen view analytics
- Loading branch information
Showing
13 changed files
with
284 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
board_games_companion/lib/extensions/route_extensions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import 'package:flutter/widgets.dart'; | ||
|
||
import '../pages/about/about_page.dart'; | ||
import '../pages/board_game_details/board_game_details_page.dart'; | ||
import '../pages/edit_playthrough/edit_playthrough_page.dart'; | ||
import '../pages/edit_playthrough/playthrough_note_page.dart'; | ||
import '../pages/home/home_page.dart'; | ||
import '../pages/players/player_page.dart'; | ||
import '../pages/playthroughs/playthroughs_page.dart'; | ||
import '../pages/settings/settings_page.dart'; | ||
|
||
extension RouteExtensions on Route { | ||
String toScreenName() { | ||
switch (settings.name) { | ||
case AboutPage.pageRoute: | ||
return 'About'; | ||
case BoardGamesDetailsPage.pageRoute: | ||
return 'Board Games Details'; | ||
case EditPlaythroughPage.pageRoute: | ||
return 'Edit Playthrough'; | ||
case HomePage.pageRoute: | ||
return 'Home'; | ||
case PlaythroughsPage.pageRoute: | ||
return 'Playthroughs'; | ||
case PlaythroughNotePage.pageRoute: | ||
return 'Playthrough Note'; | ||
case PlayerPage.pageRoute: | ||
return 'Player'; | ||
case SettingsPage.pageRoute: | ||
return 'Settings'; | ||
default: | ||
return 'Undefined'; | ||
} | ||
} | ||
|
||
String toScreenClassName() { | ||
switch (settings.name) { | ||
case AboutPage.pageRoute: | ||
return 'AboutPage'; | ||
case BoardGamesDetailsPage.pageRoute: | ||
return 'BoardGamesDetailsPage'; | ||
case EditPlaythroughPage.pageRoute: | ||
return 'EditPlaythroughPage'; | ||
case HomePage.pageRoute: | ||
return 'HomePage'; | ||
case PlaythroughsPage.pageRoute: | ||
return 'PlaythroughsPage'; | ||
case PlaythroughNotePage.pageRoute: | ||
return 'PlaythroughNotePage'; | ||
case PlayerPage.pageRoute: | ||
return 'PlayerPage'; | ||
case SettingsPage.pageRoute: | ||
return 'SettingsPage'; | ||
default: | ||
return 'Undefined'; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// ignore_for_file: library_private_types_in_public_api | ||
|
||
import 'package:injectable/injectable.dart'; | ||
import 'package:mobx/mobx.dart'; | ||
import 'package:tuple/tuple.dart'; | ||
|
||
import '../../services/analytics_service.dart'; | ||
import '../../services/rate_and_review_service.dart'; | ||
import '../../stores/board_games_filters_store.dart'; | ||
import '../games/games_view_model.dart'; | ||
import '../players/players_view_model.dart'; | ||
import '../search_board_games/search_board_games_view_model.dart'; | ||
|
||
part 'home_view_model.g.dart'; | ||
|
||
@injectable | ||
class HomeViewModel = _HomeViewModelBase with _$HomeViewModel; | ||
|
||
abstract class _HomeViewModelBase with Store { | ||
_HomeViewModelBase( | ||
this.analyticsService, | ||
this.rateAndReviewService, | ||
this.playersViewModel, | ||
this.boardGamesFiltersStore, | ||
this.gamesViewModel, | ||
this.searchBoardGamesViewModel, | ||
); | ||
|
||
final AnalyticsService analyticsService; | ||
final RateAndReviewService rateAndReviewService; | ||
final PlayersViewModel playersViewModel; | ||
final BoardGamesFiltersStore boardGamesFiltersStore; | ||
final GamesViewModel gamesViewModel; | ||
final SearchBoardGamesViewModel searchBoardGamesViewModel; | ||
|
||
static const Map<int, Tuple2<String, String>> _screenViewByTabIndex = { | ||
0: Tuple2<String, String>('Games', 'GamesPage'), | ||
1: Tuple2<String, String>('Search', 'SearchBoardGamesPage'), | ||
2: Tuple2<String, String>('Players', 'PlayersPage'), | ||
}; | ||
|
||
Future<void> trackTabChange(int tabIndex) async { | ||
await analyticsService.logScreenView( | ||
screenName: _screenViewByTabIndex[tabIndex]!.item1, | ||
screenClass: _screenViewByTabIndex[tabIndex]!.item2, | ||
); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
board_games_companion/lib/pages/home/home_view_model.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.