64 lines
1.6 KiB
Dart
Executable File
64 lines
1.6 KiB
Dart
Executable File
import 'package:external_repos/external_repos.dart';
|
|
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:injectable/injectable.dart';
|
|
import 'package:uae_stat/domain/entities/preferences_entity.dart';
|
|
import 'package:uae_stat/domain/entities/user_entity.dart';
|
|
|
|
@test
|
|
@injectable
|
|
class TUserRepo {
|
|
static UserEntity _state = UserEntity(
|
|
id: 'id',
|
|
name: 'Muhammad Hassan',
|
|
imgUrl: null,
|
|
email: 'muhammad.hassan@fcsc.gov.ae',
|
|
preferences: PreferencesEntity(
|
|
language: LanguageLocale.arAE,
|
|
favoriteIndicators: <IndicatorEnum>[].toIList(),
|
|
favoriteCountries: <ISOCountry>[].toIList(),
|
|
favoriteReports: <String>[].toIList(),
|
|
doNotifyOnIndicatorUpdates: false,
|
|
doNotifyOnCompetitivenessReportsUpdates: false,
|
|
doNotifyOnCountryUpdates: false,
|
|
),
|
|
);
|
|
|
|
Future<UserEntity> get(String token) => Future.delayed(
|
|
kThemeAnimationDuration,
|
|
() => _state,
|
|
);
|
|
|
|
Future<void> updateProfile(
|
|
String id, {
|
|
required String newName,
|
|
}) =>
|
|
Future.delayed(
|
|
kThemeAnimationDuration,
|
|
() => _state = _state.copyWith(
|
|
name: newName,
|
|
),
|
|
);
|
|
|
|
Future<void> syncPreferences(
|
|
PreferencesEntity prefs, {
|
|
required String id,
|
|
}) =>
|
|
Future.delayed(
|
|
kThemeAnimationDuration,
|
|
() => _state = _state.copyWith(
|
|
preferences: prefs,
|
|
),
|
|
);
|
|
|
|
/// throws [PasswordResetError]
|
|
Future<void> updatePw(
|
|
String id, {
|
|
required String oldPw,
|
|
required String newPw,
|
|
}) =>
|
|
Future.delayed(
|
|
kThemeAnimationDuration,
|
|
);
|
|
}
|