TF-1487 Apply linter rule

This commit is contained in:
dab246
2023-02-24 12:12:54 +07:00
committed by Dat Vu
parent 117a8a8fc6
commit 2b71aba278
155 changed files with 798 additions and 1039 deletions
@@ -25,9 +25,7 @@ class SearchDataSourceImpl extends SearchDataSource {
recentSearch.value,
recentSearch.toRecentSearchCache());
}
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
@@ -47,9 +45,7 @@ class SearchDataSourceImpl extends SearchDataSource {
: listRecentSearch;
return newListRecentSearch;
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
bool _filterRecentSearchCache(RecentSearchCache recentSearchCache, String? pattern) {
@@ -16,27 +16,21 @@ class SharePreferenceSpamReportDataSourceImpl extends SpamReportDataSource {
Future<DateTime> getLastTimeDismissedSpamReported() async {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.getLastTimeDismissedSpamReported();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<bool> storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.storeLastTimeDismissedSpamReported(lastTimeDismissedSpamReported);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<bool> deleteLastTimeDismissedSpamReported() {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
@@ -54,26 +48,20 @@ class SharePreferenceSpamReportDataSourceImpl extends SpamReportDataSource {
Future<void> deleteSpamReportState() {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<SpamReportState> getSpamReportState() {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.getSpamReportState();
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
@override
Future<void> storeSpamReportState(SpamReportState spamReportState) {
return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.storeSpamReportState(spamReportState);
}).catchError((error) {
_exceptionThrower.throwException(error);
});
}).catchError(_exceptionThrower.throwException);
}
}
@@ -28,12 +28,10 @@ class SpamReportDataSourceImpl extends SpamReportDataSource {
}
) {
return Future.sync(() async {
final _unreadSpamEmailsResponse = await _spamReportApi.getUnreadSpamEmailbox(
final unreadSpamEmailsResponse = await _spamReportApi.getUnreadSpamEmailbox(
accountId, mailboxFilterCondition: mailboxFilterCondition, limit: limit);
return _unreadSpamEmailsResponse;
}).catchError((error) {
_exceptionThrower.throwException(error);
});
return unreadSpamEmailsResponse;
}).catchError(_exceptionThrower.throwException);
}
@override
@@ -14,15 +14,15 @@ class SharePreferenceSpamReportDataSource extends SpamReportDataSource {
@override
Future<DateTime> getLastTimeDismissedSpamReported() async {
final _timeStamp = _sharedPreferences.getInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported) ?? 0;
final _lastTimeDismissedSpamReported = DateTime.fromMillisecondsSinceEpoch(_timeStamp);
return _lastTimeDismissedSpamReported;
final timeStamp = _sharedPreferences.getInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported) ?? 0;
final lastTimeDismissedSpamReported = DateTime.fromMillisecondsSinceEpoch(timeStamp);
return lastTimeDismissedSpamReported;
}
@override
Future<bool> storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async {
final _timeStamp = lastTimeDismissedSpamReported.millisecondsSinceEpoch;
return await _sharedPreferences.setInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported,_timeStamp);
final timeStamp = lastTimeDismissedSpamReported.millisecondsSinceEpoch;
return await _sharedPreferences.setInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported,timeStamp);
}
@override
@@ -48,13 +48,13 @@ class SharePreferenceSpamReportDataSource extends SpamReportDataSource {
@override
Future<SpamReportState> getSpamReportState() async {
final _spamReportState = _sharedPreferences.getString(MailboxDashboardConstant.keySpamReportState) ?? '';
return _spamReportState == SpamReportState.disabled.keyValue ? SpamReportState.disabled : SpamReportState.enabled;
final spamReportState = _sharedPreferences.getString(MailboxDashboardConstant.keySpamReportState) ?? '';
return spamReportState == SpamReportState.disabled.keyValue ? SpamReportState.disabled : SpamReportState.enabled;
}
@override
Future<bool> storeSpamReportState(SpamReportState spamReportState) async {
final _spamReportState = spamReportState.keyValue;
return await _sharedPreferences.setString(MailboxDashboardConstant.keySpamReportState, _spamReportState);
final spamReportState0 = spamReportState.keyValue;
return await _sharedPreferences.setString(MailboxDashboardConstant.keySpamReportState, spamReportState0);
}
}
@@ -40,12 +40,12 @@ class SpamReportApi {
.build()
.execute();
final _mailboxResponse = result
final mailboxResponse = result
.parse<GetMailboxResponse>(getMailboxInvocation.methodCallId, GetMailboxResponse.deserialize);
return Future.sync(() async {
final _unreadSpamMailbox = _mailboxResponse?.list.first;
return UnreadSpamEmailsResponse(unreadSpamMailbox: _unreadSpamMailbox);
final unreadSpamMailbox = mailboxResponse?.list.first;
return UnreadSpamEmailsResponse(unreadSpamMailbox: unreadSpamMailbox);
}).catchError((error) {
throw error;
});