Skip to content

Commit

Permalink
latest deps
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed May 17, 2021
1 parent 6598bd6 commit 83ff9bb
Show file tree
Hide file tree
Showing 49 changed files with 826 additions and 627 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:built_collection/built_collection.dart';
import 'package:rxdart/rxdart.dart';
import 'package:rxdart_ext/rxdart_ext.dart';

import '../../domain/model/card.dart';
import '../../domain/repository/card_repository.dart';
Expand Down
10 changes: 5 additions & 5 deletions MobileApp/datn/lib/data/repository/city_repository_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ class CityRepositoryImpl implements CityRepository {
};

final RxSharedPreferences _preferences;
final ValueConnectableStream<City> _selectedCity$;
final ValueStream<City> _selectedCity$;

CityRepositoryImpl(this._preferences, UserLocalSource userLocalSource)
: _selectedCity$ = _buildSelectedCity(_preferences, userLocalSource)
..connect();
: _selectedCity$ = _buildSelectedCity(_preferences, userLocalSource);

@override
BuiltList<City> get allCities => _allCities;
Expand All @@ -63,7 +62,7 @@ class CityRepositoryImpl implements CityRepository {
@override
ValueStream<City> get selectedCity$ => _selectedCity$;

static ValueConnectableStream<City> _buildSelectedCity(
static ValueStream<City> _buildSelectedCity(
RxSharedPreferences prefs,
UserLocalSource userLocalSource,
) {
Expand All @@ -77,7 +76,8 @@ class CityRepositoryImpl implements CityRepository {
return prefs
.getStringStream(_city_key)
.map((name) => _allCitiesByName[name] ?? _allCities.first)
.publishValueSeeded(_allCities.first);
.publishValueSeeded(_allCities.first)
..connect();
}

static City _findNearestCityFrom(LocationLocal location) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class FavoritesRepositoryImpl implements FavoritesRepository {
(initial) => _changes.scan<BuiltList<Movie>>(
(acc, change, _) {
if (change is _Toggled) {
return acc!.rebuild((b) {
return acc.rebuild((b) {
change.favorite
? b.insert(0, change.movie)
: b.removeWhere((item) => item.id == change.movie.id);
Expand Down
25 changes: 13 additions & 12 deletions MobileApp/datn/lib/data/repository/user_repository_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class UserRepositoryImpl implements UserRepository {

final SearchKeywordSource _searchKeywordSource;

final ValueStream<Optional<User>> _user$;
final ValueStream<Optional<User>?> _user$;

UserRepositoryImpl(
this._auth,
Expand All @@ -62,20 +62,21 @@ class UserRepositoryImpl implements UserRepository {
.getToken()
.then((token) => token != null ? {'fcm_token': token} : null);

static ValueStream<Optional<User>> _buildUserStream(
static ValueStream<Optional<User>?> _buildUserStream(
FirebaseAuth _auth,
UserLocalSource _userLocalSource,
Function1<UserLocal, User> userLocalToUserDomain,
) =>
Rx.combineLatest3<Object?, UserLocal?, String?, Optional<User>>(
_auth.userChanges(),
_userLocalSource.user$,
_userLocalSource.token$,
(Object? user, UserLocal? local, String? token) =>
user == null || local == null || token == null
? Optional.none()
: Optional.some(userLocalToUserDomain(local))).publishValue()
..connect();
Rx.combineLatest3<Object?, UserLocal?, String?, Optional<User>?>(
_auth.userChanges(),
_userLocalSource.user$,
_userLocalSource.token$,
(Object? user, UserLocal? local, String? token) =>
user == null || local == null || token == null
? Optional.none()
: Optional.some(userLocalToUserDomain(local)))
.publishValueSeeded(null)
..connect();

Future<AuthState> _isUserLocalCompletedLogin([UserLocal? local]) async {
local ??= await _userLocalSource.user;
Expand Down Expand Up @@ -298,7 +299,7 @@ class UserRepositoryImpl implements UserRepository {
}

@override
ValueStream<Optional<User>> get user$ => _user$;
ValueStream<Optional<User>?> get user$ => _user$;

@override
Future<void> resetPassword(String email) =>
Expand Down
2 changes: 1 addition & 1 deletion MobileApp/datn/lib/domain/repository/user_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract class UserRepository {
/// - [ValueStream.value] is null when no actual value is emitted.
/// - [ValueStream.value] is [Some] when user logged in.
/// - [ValueStream.value] is [None] when user not logged in.
ValueStream<Optional<User>> get user$;
ValueStream<Optional<User>?> get user$;

Future<AuthState> checkAuth();

Expand Down
9 changes: 4 additions & 5 deletions MobileApp/datn/lib/generated/intl/messages_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ MessageLookupByLibrary? _findExact(String localeName) {
/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async {
var availableLocale = Intl.verifiedLocale(
localeName,
(locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new Future.value(false);
}
Expand All @@ -60,8 +59,8 @@ bool _messagesExistFor(String locale) {
}

MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
onFailure: (_) => null);
var actualLocale =
Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
if (actualLocale == null) return null;
return _findExact(actualLocale);
}
Loading

0 comments on commit 83ff9bb

Please sign in to comment.