1
1
import 'dart:async' ;
2
2
3
+ import 'package:auth_repository/auth_repository.dart' ;
3
4
import 'package:bloc/bloc.dart' ;
5
+ import 'package:core/core.dart' ;
6
+ import 'package:data_repository/data_repository.dart' ;
4
7
import 'package:equatable/equatable.dart' ;
5
- import 'package:ht_auth_repository/ht_auth_repository.dart' ;
6
- import 'package:ht_data_repository/ht_data_repository.dart' ;
7
- import 'package:ht_main/app/config/config.dart' as local_config;
8
- import 'package:ht_shared/ht_shared.dart' ;
8
+ import 'package:flutter_news_app_mobile_client_full_source_code/app/config/config.dart'
9
+ as local_config;
9
10
import 'package:logging/logging.dart' ;
10
11
11
12
part 'account_event.dart' ;
12
13
part 'account_state.dart' ;
13
14
14
15
class AccountBloc extends Bloc <AccountEvent , AccountState > {
15
16
AccountBloc ({
16
- required HtAuthRepository authenticationRepository,
17
- required HtDataRepository <UserContentPreferences >
17
+ required AuthRepository authenticationRepository,
18
+ required DataRepository <UserContentPreferences >
18
19
userContentPreferencesRepository,
19
20
required local_config.AppEnvironment environment,
20
21
Logger ? logger,
@@ -23,7 +24,7 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
23
24
_environment = environment,
24
25
_logger = logger ?? Logger ('AccountBloc' ),
25
26
super (const AccountState ()) {
26
- // Listen to user changes from HtAuthRepository
27
+ // Listen to user changes from AuthRepository
27
28
_userSubscription = _authenticationRepository.authStateChanges.listen ((
28
29
user,
29
30
) {
@@ -39,8 +40,8 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
39
40
on < AccountClearUserPreferences > (_onAccountClearUserPreferences);
40
41
}
41
42
42
- final HtAuthRepository _authenticationRepository;
43
- final HtDataRepository <UserContentPreferences >
43
+ final AuthRepository _authenticationRepository;
44
+ final DataRepository <UserContentPreferences >
44
45
_userContentPreferencesRepository;
45
46
final local_config.AppEnvironment _environment;
46
47
final Logger _logger;
@@ -149,9 +150,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
149
150
clearError: true ,
150
151
),
151
152
);
152
- } on HtHttpException catch (e) {
153
+ } on HttpException catch (e) {
153
154
_logger.severe (
154
- 'Failed to create default preferences with HtHttpException : $e ' ,
155
+ 'Failed to create default preferences with HttpException : $e ' ,
155
156
);
156
157
emit (state.copyWith (status: AccountStatus .failure, error: e));
157
158
} catch (e, st) {
@@ -169,9 +170,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
169
170
),
170
171
);
171
172
}
172
- } on HtHttpException catch (e) {
173
+ } on HttpException catch (e) {
173
174
_logger.severe (
174
- 'AccountLoadUserPreferences failed with HtHttpException : $e ' ,
175
+ 'AccountLoadUserPreferences failed with HttpException : $e ' ,
175
176
);
176
177
emit (state.copyWith (status: AccountStatus .failure, error: e));
177
178
} catch (e, st) {
@@ -227,9 +228,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
227
228
clearError: true ,
228
229
),
229
230
);
230
- } on HtHttpException catch (e) {
231
+ } on HttpException catch (e) {
231
232
_logger.severe (
232
- 'AccountSaveHeadlineToggled failed with HtHttpException : $e ' ,
233
+ 'AccountSaveHeadlineToggled failed with HttpException : $e ' ,
233
234
);
234
235
emit (state.copyWith (status: AccountStatus .failure, error: e));
235
236
} catch (e, st) {
@@ -284,10 +285,8 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
284
285
clearError: true ,
285
286
),
286
287
);
287
- } on HtHttpException catch (e) {
288
- _logger.severe (
289
- 'AccountFollowTopicToggled failed with HtHttpException: $e ' ,
290
- );
288
+ } on HttpException catch (e) {
289
+ _logger.severe ('AccountFollowTopicToggled failed with HttpException: $e ' );
291
290
emit (state.copyWith (status: AccountStatus .failure, error: e));
292
291
} catch (e, st) {
293
292
_logger.severe (
@@ -344,9 +343,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
344
343
clearError: true ,
345
344
),
346
345
);
347
- } on HtHttpException catch (e) {
346
+ } on HttpException catch (e) {
348
347
_logger.severe (
349
- 'AccountFollowSourceToggled failed with HtHttpException : $e ' ,
348
+ 'AccountFollowSourceToggled failed with HttpException : $e ' ,
350
349
);
351
350
emit (state.copyWith (status: AccountStatus .failure, error: e));
352
351
} catch (e, st) {
@@ -392,9 +391,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
392
391
clearError: true ,
393
392
),
394
393
);
395
- } on HtHttpException catch (e) {
394
+ } on HttpException catch (e) {
396
395
_logger.severe (
397
- 'AccountClearUserPreferences failed with HtHttpException : $e ' ,
396
+ 'AccountClearUserPreferences failed with HttpException : $e ' ,
398
397
);
399
398
emit (state.copyWith (status: AccountStatus .failure, error: e));
400
399
} catch (e, st) {
0 commit comments