Skip to content

Commit

Permalink
feat: add provider for user (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
B0berman authored Apr 8, 2024
1 parent 2acae4d commit d356e30
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:api_client/api_client.dart';
import 'package:authentication_repository/authentication_repository.dart';
import 'package:board_info_repository/board_info_repository.dart';
import 'package:crossword_repository/crossword_repository.dart';
import 'package:flutter/material.dart';
Expand All @@ -15,10 +16,12 @@ class App extends StatelessWidget {
required this.apiClient,
required this.crosswordRepository,
required this.boardInfoRepository,
required this.user,
super.key,
});

final ApiClient apiClient;
final User user;
final CrosswordRepository crosswordRepository;
final BoardInfoRepository boardInfoRepository;

Expand All @@ -29,6 +32,7 @@ class App extends StatelessWidget {
return MultiProvider(
providers: [
Provider.value(value: apiClient.leaderboardResource),
Provider.value(value: user),
Provider.value(value: crosswordResource),
Provider.value(value: crosswordRepository),
Provider.value(value: boardInfoRepository),
Expand Down
1 change: 1 addition & 0 deletions lib/main_debug.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void main() async {
apiClient: apiClient,
crosswordRepository: CrosswordRepository(db: firestore),
boardInfoRepository: BoardInfoRepository(firestore: firestore),
user: await authenticationRepository.user.first,
);
},
),
Expand Down
1 change: 1 addition & 0 deletions lib/main_development.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void main() async {
apiClient: apiClient,
crosswordRepository: CrosswordRepository(db: firestore),
boardInfoRepository: BoardInfoRepository(firestore: firestore),
user: await authenticationRepository.user.first,
);
},
),
Expand Down
1 change: 1 addition & 0 deletions lib/main_local.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ void main() async {
apiClient: apiClient,
crosswordRepository: CrosswordRepository(db: firestore),
boardInfoRepository: BoardInfoRepository(firestore: firestore),
user: await authenticationRepository.user.first,
);
},
),
Expand Down
1 change: 1 addition & 0 deletions lib/main_production.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void main() async {
apiClient: apiClient,
crosswordRepository: CrosswordRepository(db: firestore),
boardInfoRepository: BoardInfoRepository(firestore: firestore),
user: await authenticationRepository.user.first,
);
},
),
Expand Down
1 change: 1 addition & 0 deletions lib/main_staging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void main() async {
apiClient: apiClient,
crosswordRepository: CrosswordRepository(db: firestore),
boardInfoRepository: BoardInfoRepository(firestore: firestore),
user: await authenticationRepository.user.first,
);
},
),
Expand Down
4 changes: 4 additions & 0 deletions test/app/view/app_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// ignore_for_file: prefer_const_constructors

import 'package:api_client/api_client.dart';
import 'package:authentication_repository/authentication_repository.dart';
import 'package:bloc_test/bloc_test.dart';
import 'package:board_info_repository/board_info_repository.dart';
import 'package:crossword_repository/crossword_repository.dart';
Expand All @@ -25,6 +26,8 @@ class _MockCrosswordResource extends Mock implements CrosswordResource {}

class _MockCrosswordBloc extends Mock implements CrosswordBloc {}

class _MockUser extends Mock implements User {}

void main() {
group('App', () {
late ApiClient apiClient;
Expand Down Expand Up @@ -59,6 +62,7 @@ void main() {
apiClient: apiClient,
crosswordRepository: crosswordRepository,
boardInfoRepository: boardInfoRepository,
user: _MockUser(),
),
);

Expand Down

0 comments on commit d356e30

Please sign in to comment.