1
+ import 'package:auth_repository/auth_repository.dart' ;
2
+ import 'package:core/core.dart' hide AppStatus;
3
+ import 'package:data_repository/data_repository.dart' ;
1
4
import 'package:flutter/material.dart' ;
2
5
import 'package:flutter_bloc/flutter_bloc.dart' ;
6
+ import 'package:flutter_news_app_mobile_client_full_source_code/account/bloc/account_bloc.dart' ;
7
+ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/account_page.dart' ;
8
+ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/manage_followed_items/manage_followed_items_page.dart' ;
9
+ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/manage_followed_items/sources/add_source_to_follow_page.dart' ;
10
+ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/manage_followed_items/sources/followed_sources_list_page.dart' ;
11
+ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/manage_followed_items/topics/add_topic_to_follow_page.dart' ;
12
+ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/manage_followed_items/topics/followed_topics_list_page.dart' ;
13
+ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/saved_headlines_page.dart' ;
14
+ import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart' ;
15
+ import 'package:flutter_news_app_mobile_client_full_source_code/app/config/config.dart'
16
+ as local_config;
17
+ import 'package:flutter_news_app_mobile_client_full_source_code/app/view/app_shell.dart' ;
18
+ import 'package:flutter_news_app_mobile_client_full_source_code/authentication/bloc/authentication_bloc.dart' ;
19
+ import 'package:flutter_news_app_mobile_client_full_source_code/authentication/view/authentication_page.dart' ;
20
+ import 'package:flutter_news_app_mobile_client_full_source_code/authentication/view/email_code_verification_page.dart' ;
21
+ import 'package:flutter_news_app_mobile_client_full_source_code/authentication/view/request_code_page.dart' ;
22
+ import 'package:flutter_news_app_mobile_client_full_source_code/entity_details/view/entity_details_page.dart' ;
23
+ import 'package:flutter_news_app_mobile_client_full_source_code/headline-details/bloc/headline_details_bloc.dart' ;
24
+ import 'package:flutter_news_app_mobile_client_full_source_code/headline-details/bloc/similar_headlines_bloc.dart' ;
25
+ import 'package:flutter_news_app_mobile_client_full_source_code/headline-details/view/headline_details_page.dart' ;
26
+ // import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/bloc/countries_filter_bloc.dart';
27
+ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/bloc/headlines_feed_bloc.dart' ;
28
+ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/bloc/sources_filter_bloc.dart' ;
29
+ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/bloc/topics_filter_bloc.dart' ;
30
+ // import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/country_filter_page.dart';
31
+ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/headlines_feed_page.dart' ;
32
+ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/headlines_filter_page.dart' ;
33
+ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/source_filter_page.dart' ;
34
+ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/view/topic_filter_page.dart' ;
35
+ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-search/bloc/headlines_search_bloc.dart' ;
36
+ import 'package:flutter_news_app_mobile_client_full_source_code/headlines-search/view/headlines_search_page.dart' ;
37
+ import 'package:flutter_news_app_mobile_client_full_source_code/l10n/l10n.dart' ;
38
+ import 'package:flutter_news_app_mobile_client_full_source_code/router/routes.dart' ;
39
+ import 'package:flutter_news_app_mobile_client_full_source_code/settings/bloc/settings_bloc.dart' ;
40
+ import 'package:flutter_news_app_mobile_client_full_source_code/settings/view/appearance_settings_page.dart' ;
41
+ import 'package:flutter_news_app_mobile_client_full_source_code/settings/view/feed_settings_page.dart' ;
42
+ import 'package:flutter_news_app_mobile_client_full_source_code/settings/view/font_settings_page.dart' ;
43
+ import 'package:flutter_news_app_mobile_client_full_source_code/settings/view/language_settings_page.dart' ;
44
+ import 'package:flutter_news_app_mobile_client_full_source_code/settings/view/notification_settings_page.dart' ;
45
+ import 'package:flutter_news_app_mobile_client_full_source_code/settings/view/settings_page.dart' ;
46
+ import 'package:flutter_news_app_mobile_client_full_source_code/settings/view/theme_settings_page.dart' ;
47
+ import 'package:flutter_news_app_mobile_client_full_source_code/shared/services/feed_injector_service.dart' ;
3
48
import 'package:go_router/go_router.dart' ;
4
- import 'package:ht_auth_repository/ht_auth_repository.dart' ;
5
- import 'package:ht_data_repository/ht_data_repository.dart' ;
6
- import 'package:ht_main/account/bloc/account_bloc.dart' ;
7
- import 'package:ht_main/account/view/account_page.dart' ;
8
- import 'package:ht_main/account/view/manage_followed_items/manage_followed_items_page.dart' ;
9
- import 'package:ht_main/account/view/manage_followed_items/sources/add_source_to_follow_page.dart' ;
10
- import 'package:ht_main/account/view/manage_followed_items/sources/followed_sources_list_page.dart' ;
11
- import 'package:ht_main/account/view/manage_followed_items/topics/add_topic_to_follow_page.dart' ;
12
- import 'package:ht_main/account/view/manage_followed_items/topics/followed_topics_list_page.dart' ;
13
- import 'package:ht_main/account/view/saved_headlines_page.dart' ;
14
- import 'package:ht_main/app/bloc/app_bloc.dart' ;
15
- import 'package:ht_main/app/config/config.dart' as local_config;
16
- import 'package:ht_main/app/view/app_shell.dart' ;
17
- import 'package:ht_main/authentication/bloc/authentication_bloc.dart' ;
18
- import 'package:ht_main/authentication/view/authentication_page.dart' ;
19
- import 'package:ht_main/authentication/view/email_code_verification_page.dart' ;
20
- import 'package:ht_main/authentication/view/request_code_page.dart' ;
21
- import 'package:ht_main/entity_details/view/entity_details_page.dart' ;
22
- import 'package:ht_main/headline-details/bloc/headline_details_bloc.dart' ;
23
- import 'package:ht_main/headline-details/bloc/similar_headlines_bloc.dart' ;
24
- import 'package:ht_main/headline-details/view/headline_details_page.dart' ;
25
- // import 'package:ht_main/headlines-feed/bloc/countries_filter_bloc.dart';
26
- import 'package:ht_main/headlines-feed/bloc/headlines_feed_bloc.dart' ;
27
- import 'package:ht_main/headlines-feed/bloc/sources_filter_bloc.dart' ;
28
- import 'package:ht_main/headlines-feed/bloc/topics_filter_bloc.dart' ;
29
- // import 'package:ht_main/headlines-feed/view/country_filter_page.dart';
30
- import 'package:ht_main/headlines-feed/view/headlines_feed_page.dart' ;
31
- import 'package:ht_main/headlines-feed/view/headlines_filter_page.dart' ;
32
- import 'package:ht_main/headlines-feed/view/source_filter_page.dart' ;
33
- import 'package:ht_main/headlines-feed/view/topic_filter_page.dart' ;
34
- import 'package:ht_main/headlines-search/bloc/headlines_search_bloc.dart' ;
35
- import 'package:ht_main/headlines-search/view/headlines_search_page.dart' ;
36
- import 'package:ht_main/l10n/l10n.dart' ;
37
- import 'package:ht_main/router/routes.dart' ;
38
- import 'package:ht_main/settings/bloc/settings_bloc.dart' ;
39
- import 'package:ht_main/settings/view/appearance_settings_page.dart' ;
40
- import 'package:ht_main/settings/view/feed_settings_page.dart' ;
41
- import 'package:ht_main/settings/view/font_settings_page.dart' ;
42
- import 'package:ht_main/settings/view/language_settings_page.dart' ;
43
- import 'package:ht_main/settings/view/notification_settings_page.dart' ;
44
- import 'package:ht_main/settings/view/settings_page.dart' ;
45
- import 'package:ht_main/settings/view/theme_settings_page.dart' ;
46
- import 'package:ht_main/shared/services/feed_injector_service.dart' ;
47
- import 'package:ht_shared/ht_shared.dart' hide AppStatus;
48
49
49
50
/// Creates and configures the GoRouter instance for the application.
50
51
///
51
52
/// Requires an [authStatusNotifier] to trigger route re-evaluation when
52
53
/// authentication state changes.
53
54
GoRouter createRouter ({
54
55
required ValueNotifier <AppStatus > authStatusNotifier,
55
- required HtAuthRepository htAuthenticationRepository ,
56
- required HtDataRepository <Headline > htHeadlinesRepository,
57
- required HtDataRepository <Topic > htTopicsRepository,
58
- required HtDataRepository <Country > htCountriesRepository,
59
- required HtDataRepository <Source > htSourcesRepository,
60
- required HtDataRepository <UserAppSettings > htUserAppSettingsRepository,
61
- required HtDataRepository <UserContentPreferences >
56
+ required AuthRepository authenticationRepository ,
57
+ required DataRepository <Headline > htHeadlinesRepository,
58
+ required DataRepository <Topic > htTopicsRepository,
59
+ required DataRepository <Country > htCountriesRepository,
60
+ required DataRepository <Source > htSourcesRepository,
61
+ required DataRepository <UserAppSettings > htUserAppSettingsRepository,
62
+ required DataRepository <UserContentPreferences >
62
63
htUserContentPreferencesRepository,
63
- required HtDataRepository <RemoteConfig > htRemoteConfigRepository,
64
+ required DataRepository <RemoteConfig > htRemoteConfigRepository,
64
65
required local_config.AppEnvironment environment,
65
66
}) {
66
67
// Instantiate AccountBloc once to be shared
67
68
final accountBloc = AccountBloc (
68
- authenticationRepository: htAuthenticationRepository ,
69
+ authenticationRepository: authenticationRepository ,
69
70
userContentPreferencesRepository: htUserContentPreferencesRepository,
70
71
environment: environment,
71
72
);
@@ -226,7 +227,7 @@ GoRouter createRouter({
226
227
227
228
return BlocProvider (
228
229
create: (context) => AuthenticationBloc (
229
- authenticationRepository: context.read <HtAuthRepository >(),
230
+ authenticationRepository: context.read <AuthRepository >(),
230
231
),
231
232
child: AuthenticationPage (
232
233
headline: headline,
@@ -355,14 +356,12 @@ GoRouter createRouter({
355
356
BlocProvider .value (value: accountBloc),
356
357
BlocProvider (
357
358
create: (context) => HeadlineDetailsBloc (
358
- headlinesRepository: context
359
- .read <HtDataRepository <Headline >>(),
359
+ headlinesRepository: context.read <DataRepository <Headline >>(),
360
360
),
361
361
),
362
362
BlocProvider (
363
363
create: (context) => SimilarHeadlinesBloc (
364
- headlinesRepository: context
365
- .read <HtDataRepository <Headline >>(),
364
+ headlinesRepository: context.read <DataRepository <Headline >>(),
366
365
),
367
366
),
368
367
],
@@ -386,7 +385,7 @@ GoRouter createRouter({
386
385
final feedInjectorService = FeedInjectorService ();
387
386
return HeadlinesFeedBloc (
388
387
headlinesRepository: context
389
- .read <HtDataRepository <Headline >>(),
388
+ .read <DataRepository <Headline >>(),
390
389
feedInjectorService: feedInjectorService,
391
390
appBloc: context.read <AppBloc >(),
392
391
)..add (const HeadlinesFeedFetchRequested ());
@@ -397,9 +396,9 @@ GoRouter createRouter({
397
396
final feedInjectorService = FeedInjectorService ();
398
397
return HeadlinesSearchBloc (
399
398
headlinesRepository: context
400
- .read <HtDataRepository <Headline >>(),
401
- topicRepository: context.read <HtDataRepository <Topic >>(),
402
- sourceRepository: context.read <HtDataRepository <Source >>(),
399
+ .read <DataRepository <Headline >>(),
400
+ topicRepository: context.read <DataRepository <Topic >>(),
401
+ sourceRepository: context.read <DataRepository <Source >>(),
403
402
appBloc: context.read <AppBloc >(),
404
403
feedInjectorService: feedInjectorService,
405
404
);
@@ -433,13 +432,13 @@ GoRouter createRouter({
433
432
BlocProvider (
434
433
create: (context) => HeadlineDetailsBloc (
435
434
headlinesRepository: context
436
- .read <HtDataRepository <Headline >>(),
435
+ .read <DataRepository <Headline >>(),
437
436
),
438
437
),
439
438
BlocProvider (
440
439
create: (context) => SimilarHeadlinesBloc (
441
440
headlinesRepository: context
442
- .read <HtDataRepository <Headline >>(),
441
+ .read <DataRepository <Headline >>(),
443
442
),
444
443
),
445
444
],
@@ -486,7 +485,7 @@ GoRouter createRouter({
486
485
builder: (context, state) => BlocProvider (
487
486
create: (context) => TopicsFilterBloc (
488
487
topicsRepository: context
489
- .read <HtDataRepository <Topic >>(),
488
+ .read <DataRepository <Topic >>(),
490
489
),
491
490
child: const TopicFilterPage (),
492
491
),
@@ -499,10 +498,10 @@ GoRouter createRouter({
499
498
builder: (context, state) => BlocProvider (
500
499
create: (context) => SourcesFilterBloc (
501
500
sourcesRepository: context
502
- .read <HtDataRepository <Source >>(),
501
+ .read <DataRepository <Source >>(),
503
502
countriesRepository: // Added missing repository
504
503
context
505
- .read <HtDataRepository <Country >>(),
504
+ .read <DataRepository <Country >>(),
506
505
),
507
506
// Pass initialSelectedSources, country ISO codes, and source types from state.extra
508
507
child: Builder (
@@ -561,13 +560,13 @@ GoRouter createRouter({
561
560
BlocProvider (
562
561
create: (context) => HeadlineDetailsBloc (
563
562
headlinesRepository: context
564
- .read <HtDataRepository <Headline >>(),
563
+ .read <DataRepository <Headline >>(),
565
564
),
566
565
),
567
566
BlocProvider (
568
567
create: (context) => SimilarHeadlinesBloc (
569
568
headlinesRepository: context
570
- .read <HtDataRepository <Headline >>(),
569
+ .read <DataRepository <Headline >>(),
571
570
),
572
571
),
573
572
],
@@ -603,7 +602,7 @@ GoRouter createRouter({
603
602
create: (context) {
604
603
final settingsBloc = SettingsBloc (
605
604
userAppSettingsRepository: context
606
- .read <HtDataRepository <UserAppSettings >>(),
605
+ .read <DataRepository <UserAppSettings >>(),
607
606
);
608
607
// Only load settings if a userId is available
609
608
if (userId != null ) {
@@ -729,13 +728,13 @@ GoRouter createRouter({
729
728
BlocProvider (
730
729
create: (context) => HeadlineDetailsBloc (
731
730
headlinesRepository: context
732
- .read <HtDataRepository <Headline >>(),
731
+ .read <DataRepository <Headline >>(),
733
732
),
734
733
),
735
734
BlocProvider (
736
735
create: (context) => SimilarHeadlinesBloc (
737
736
headlinesRepository: context
738
- .read <HtDataRepository <Headline >>(),
737
+ .read <DataRepository <Headline >>(),
739
738
),
740
739
),
741
740
],
0 commit comments