fix(storage optimization): Removed and replaced used of PStore with G… (#1730)
* fix(storage optimization): Removed and replaced used of PStore with GetStorage --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com> Co-authored-by: ggurdin <ggurdin@gmail.com>
This commit is contained in:
parent
67b118387c
commit
4c1594d6f0
18 changed files with 111 additions and 168 deletions
|
|
@ -507,10 +507,10 @@ class ChatListController extends State<ChatList>
|
|||
spaceId,
|
||||
);
|
||||
|
||||
// #Pangea
|
||||
final String? justInputtedCode =
|
||||
MatrixState.pangeaController.pStoreService.read(
|
||||
MatrixState.pangeaController.classController.chatBox.read(
|
||||
PLocalKey.justInputtedCode,
|
||||
isAccountData: false,
|
||||
);
|
||||
final newSpaceCode = space?.classCode(context);
|
||||
if (newSpaceCode == justInputtedCode) return;
|
||||
|
|
|
|||
|
|
@ -6,15 +6,16 @@ import 'package:uuid/uuid.dart';
|
|||
import 'package:fluffychat/pangea/activity_planner/activity_plan_model.dart';
|
||||
|
||||
class BookmarkedActivitiesRepo {
|
||||
static final GetStorage _storage = GetStorage('bookmarked_activities');
|
||||
static const Uuid _uuid = Uuid();
|
||||
|
||||
static final GetStorage _bookStorage = GetStorage('bookmarked_activities');
|
||||
|
||||
/// save an activity to the list of bookmarked activities
|
||||
/// returns the activity with a bookmarkId
|
||||
static Future<ActivityPlanModel> save(ActivityPlanModel activity) async {
|
||||
activity.bookmarkId ??= _uuid.v4();
|
||||
|
||||
await _storage.write(
|
||||
await _bookStorage.write(
|
||||
activity.bookmarkId!,
|
||||
activity.toJson(),
|
||||
);
|
||||
|
|
@ -23,15 +24,16 @@ class BookmarkedActivitiesRepo {
|
|||
return activity;
|
||||
}
|
||||
|
||||
static Future<void> remove(String bookmarkId) => _storage.remove(bookmarkId);
|
||||
static Future<void> remove(String bookmarkId) =>
|
||||
_bookStorage.remove(bookmarkId);
|
||||
|
||||
static bool isBookmarked(ActivityPlanModel activity) {
|
||||
return activity.bookmarkId != null &&
|
||||
_storage.read(activity.bookmarkId!) != null;
|
||||
_bookStorage.read(activity.bookmarkId!) != null;
|
||||
}
|
||||
|
||||
static List<ActivityPlanModel> get() {
|
||||
final list = _storage.getValues();
|
||||
final list = _bookStorage.getValues();
|
||||
|
||||
if (list == null) return [];
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'dart:math';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
|
|
@ -22,6 +23,7 @@ import 'package:fluffychat/pangea/learning_settings/models/language_model.dart';
|
|||
|
||||
/// A minimized version of AnalyticsController that get the logged in user's analytics
|
||||
class GetAnalyticsController extends BaseController {
|
||||
final GetStorage analyticsBox = GetStorage("analytics_storage");
|
||||
late PangeaController _pangeaController;
|
||||
late MessageAnalyticsController perMessage;
|
||||
|
||||
|
|
@ -173,7 +175,7 @@ class GetAnalyticsController extends BaseController {
|
|||
/// eventID.
|
||||
Map<String, List<OneConstructUse>> get messagesSinceUpdate {
|
||||
try {
|
||||
final dynamic locallySaved = _pangeaController.pStoreService.read(
|
||||
final dynamic locallySaved = analyticsBox.read(
|
||||
PLocalKey.messagesSinceUpdate,
|
||||
);
|
||||
if (locallySaved == null) return {};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import 'package:fluffychat/pangea/common/utils/error_handler.dart';
|
|||
import 'package:fluffychat/pangea/events/models/pangea_token_model.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/learning_settings/models/language_model.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
||||
enum AnalyticsUpdateType { server, local }
|
||||
|
||||
|
|
@ -316,14 +317,16 @@ class PutAnalyticsController extends BaseController<AnalyticsStream> {
|
|||
/// Clears the local cache of recently sent constructs. Called before updating analytics
|
||||
void clearMessagesSinceUpdate({clearDrafts = false}) {
|
||||
if (clearDrafts) {
|
||||
_pangeaController.pStoreService.delete(PLocalKey.messagesSinceUpdate);
|
||||
MatrixState.pangeaController.getAnalytics.analyticsBox
|
||||
.remove(PLocalKey.messagesSinceUpdate);
|
||||
return;
|
||||
}
|
||||
|
||||
final localCache = _pangeaController.getAnalytics.messagesSinceUpdate;
|
||||
final draftKeys = localCache.keys.where((key) => key.startsWith('draft'));
|
||||
if (draftKeys.isEmpty) {
|
||||
_pangeaController.pStoreService.delete(PLocalKey.messagesSinceUpdate);
|
||||
MatrixState.pangeaController.getAnalytics.analyticsBox
|
||||
.remove(PLocalKey.messagesSinceUpdate);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -343,7 +346,7 @@ class PutAnalyticsController extends BaseController<AnalyticsStream> {
|
|||
final constructJsons = entry.value.map((e) => e.toJson()).toList();
|
||||
formattedCache[entry.key] = constructJsons;
|
||||
}
|
||||
await _pangeaController.pStoreService.save(
|
||||
await MatrixState.pangeaController.getAnalytics.analyticsBox.write(
|
||||
PLocalKey.messagesSinceUpdate,
|
||||
formattedCache,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
|
|
@ -22,6 +23,8 @@ import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.
|
|||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
||||
class AppVersionUtil {
|
||||
static final GetStorage _versionBox = GetStorage("version_storage");
|
||||
|
||||
static Future<AppVersionResponse> _getAppVersion(
|
||||
String accessToken,
|
||||
) async {
|
||||
|
|
@ -148,7 +151,7 @@ class AppVersionUtil {
|
|||
);
|
||||
|
||||
if (!mandatoryUpdate && dialogResponse != OkCancelResult.ok) {
|
||||
await MatrixState.pangeaController.pStoreService.save(
|
||||
await _versionBox.write(
|
||||
PLocalKey.showedUpdateDialog,
|
||||
DateTime.now().toIso8601String(),
|
||||
);
|
||||
|
|
@ -210,8 +213,7 @@ class AppVersionUtil {
|
|||
}
|
||||
|
||||
static DateTime? get showedUpdateDialog {
|
||||
final entry = MatrixState.pangeaController.pStoreService
|
||||
.read(PLocalKey.showedUpdateDialog);
|
||||
final entry = _versionBox.read(PLocalKey.showedUpdateDialog);
|
||||
if (entry == null) return null;
|
||||
try {
|
||||
return DateTime.parse(entry);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import 'package:matrix/matrix.dart';
|
|||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||
import 'package:fluffychat/pangea/common/constants/local.key.dart';
|
||||
import 'package:fluffychat/pangea/common/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||
|
|
@ -20,7 +19,6 @@ void chatListHandleSpaceTap(
|
|||
ChatListController controller,
|
||||
Room space,
|
||||
) {
|
||||
final PangeaController pangeaController = MatrixState.pangeaController;
|
||||
void setActiveSpaceAndCloseChat() {
|
||||
controller.setActiveSpace(space.id);
|
||||
|
||||
|
|
@ -102,8 +100,9 @@ void chatListHandleSpaceTap(
|
|||
(element) =>
|
||||
element.isSpace && element.membership == Membership.join,
|
||||
);
|
||||
final justInputtedCode = pangeaController.pStoreService
|
||||
.read(PLocalKey.justInputtedCode, isAccountData: false);
|
||||
final justInputtedCode = MatrixState
|
||||
.pangeaController.classController.chatBox
|
||||
.read(PLocalKey.justInputtedCode);
|
||||
if (rooms.any((s) => s.spaceChildren.any((c) => c.roomId == space.id))) {
|
||||
autoJoin(space);
|
||||
} else if (justInputtedCode != null &&
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import 'package:fluffychat/widgets/matrix.dart';
|
|||
import '../../../config/app_config.dart';
|
||||
import '../../choreographer/controllers/it_feedback_controller.dart';
|
||||
import '../utils/firebase_analytics.dart';
|
||||
import '../utils/p_store.dart';
|
||||
|
||||
class PangeaController {
|
||||
///pangeaControllers
|
||||
|
|
@ -56,7 +55,6 @@ class PangeaController {
|
|||
late PracticeActivityRecordController activityRecordController;
|
||||
|
||||
///store Services
|
||||
late PStore pStoreService;
|
||||
final pLanguageStore = PangeaLanguage();
|
||||
|
||||
StreamSubscription? _languageStream;
|
||||
|
|
@ -94,7 +92,6 @@ class PangeaController {
|
|||
|
||||
/// Initialize controllers
|
||||
_addRefInObjects() {
|
||||
pStoreService = PStore(pangeaController: this);
|
||||
userController = UserController(this);
|
||||
languageController = LanguageController(this);
|
||||
classController = ClassController(this);
|
||||
|
|
|
|||
|
|
@ -1,67 +0,0 @@
|
|||
import 'package:get_storage/get_storage.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/common/controllers/pangea_controller.dart';
|
||||
|
||||
/// Utility to save and read data both in the matrix profile (this is the default
|
||||
/// behavior) and in the local storage (local needs to be specificied). An
|
||||
/// instance of this class is created in the PangeaController.
|
||||
class PStore {
|
||||
final GetStorage _box = GetStorage();
|
||||
final PangeaController pangeaController;
|
||||
|
||||
PStore({required this.pangeaController});
|
||||
|
||||
/// Saves the provided [data] with the specified [key] in the local storage.
|
||||
///
|
||||
/// By default, the [data] is considered as account data, but you can set
|
||||
/// [isAccountData] to false if it's not account-related data.
|
||||
///
|
||||
/// Example usage:
|
||||
/// ```dart
|
||||
/// await save('user', {'name': 'John Doe', 'age': 25});
|
||||
/// ```
|
||||
Future<void> save(
|
||||
String key,
|
||||
dynamic data, {
|
||||
bool isAccountData = true,
|
||||
}) async {
|
||||
await _box.write(_key(key, isAccountData: isAccountData), data);
|
||||
}
|
||||
|
||||
/// Reads the value associated with the given [key] from the local store.
|
||||
///
|
||||
/// If [isAccountData] is true, tries to find key assosiated with the logged in user.
|
||||
/// Otherwise, it is read from the general store.
|
||||
///
|
||||
/// Returns the value associated with the [key], or
|
||||
/// null if the user ID is null or value hasn't been set.
|
||||
dynamic read(String key, {bool isAccountData = true}) {
|
||||
return pangeaController.matrixState.client.userID != null
|
||||
? _box.read(_key(key, isAccountData: isAccountData))
|
||||
: null;
|
||||
}
|
||||
|
||||
/// Deletes the value associated with the given [key] from the local store.
|
||||
///
|
||||
/// If [isAccountData] is true (default), will try to use key assosiated with the logged in user's ID
|
||||
///
|
||||
/// Returns a [Future] that completes when the value is successfully deleted.
|
||||
/// If the user is not logged in, the value will not be deleted and the [Future] will complete with null.
|
||||
Future<void> delete(String key, {bool isAccountData = true}) async {
|
||||
return pangeaController.matrixState.client.userID != null
|
||||
? _box.remove(_key(key, isAccountData: isAccountData))
|
||||
: null;
|
||||
}
|
||||
|
||||
/// Returns the key for storing data in the pangea store.
|
||||
///
|
||||
/// The [key] parameter represents the base key for the data.
|
||||
/// The [isAccountData] parameter indicates whether the data is account-specific.
|
||||
/// If [isAccountData] is true, the account-specific key is returned by appending the user ID to the base key.
|
||||
/// If [isAccountData] is false, the base key is returned as is.
|
||||
String _key(String key, {bool isAccountData = true}) {
|
||||
return isAccountData
|
||||
? pangeaController.matrixState.client.userID! + key
|
||||
: key;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ class CustomizedSvg extends StatelessWidget {
|
|||
/// Icon to show in case of error
|
||||
final Widget errorIcon;
|
||||
|
||||
static final GetStorage _svgStorage = GetStorage('svg_cache');
|
||||
const CustomizedSvg({
|
||||
super.key,
|
||||
required this.svgUrl,
|
||||
|
|
@ -23,8 +24,6 @@ class CustomizedSvg extends StatelessWidget {
|
|||
this.errorIcon = const Icon(Icons.error_outline),
|
||||
});
|
||||
|
||||
static final GetStorage _svgStorage = GetStorage('svg_cache');
|
||||
|
||||
Future<String?> _fetchSvg() async {
|
||||
final cachedSvgEntry = _svgStorage.read(svgUrl);
|
||||
if (cachedSvgEntry != null && cachedSvgEntry is Map<String, dynamic>) {
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ class UserSettingsState extends State<UserSettingsPage> {
|
|||
}
|
||||
|
||||
bool get isSSOSignup {
|
||||
final loginTypeEntry =
|
||||
_pangeaController.pStoreService.read(PLocalKey.loginType);
|
||||
final loginTypeEntry = MatrixState.pangeaController.userController.loginBox
|
||||
.read(PLocalKey.loginType);
|
||||
return loginTypeEntry is String && loginTypeEntry == 'sso';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ Future<void> pangeaSSOLoginAction(
|
|||
token: token,
|
||||
initialDeviceDisplayName: PlatformInfos.clientName,
|
||||
);
|
||||
MatrixState.pangeaController.pStoreService.save(PLocalKey.loginType, 'sso');
|
||||
|
||||
MatrixState.pangeaController.userController.loginBox
|
||||
.write(PLocalKey.loginType, 'sso');
|
||||
GoogleAnalytics.login(provider.name!, loginRes.userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,23 +20,25 @@ import '../../common/controllers/base_controller.dart';
|
|||
class ClassController extends BaseController {
|
||||
late PangeaController _pangeaController;
|
||||
|
||||
//Storage Initialization
|
||||
final GetStorage chatBox = GetStorage("chat_list_storage");
|
||||
final GetStorage linkBox = GetStorage("link_storage");
|
||||
static final GetStorage _classStorage = GetStorage('class_storage');
|
||||
|
||||
ClassController(PangeaController pangeaController) : super() {
|
||||
_pangeaController = pangeaController;
|
||||
}
|
||||
|
||||
static final GetStorage _aliasStorage = GetStorage('alias_storage');
|
||||
|
||||
void setActiveSpaceIdInChatListController(String? classId) {
|
||||
setState({"activeSpaceId": classId});
|
||||
}
|
||||
|
||||
Future<void> joinCachedSpaceCode(BuildContext context) async {
|
||||
final String? classCode = _pangeaController.pStoreService.read(
|
||||
final String? classCode = linkBox.read(
|
||||
PLocalKey.cachedClassCodeToJoin,
|
||||
isAccountData: false,
|
||||
);
|
||||
|
||||
final String? alias = _aliasStorage.read(PLocalKey.cachedAliasToJoin);
|
||||
final String? alias = _classStorage.read(PLocalKey.cachedAliasToJoin);
|
||||
|
||||
if (classCode != null) {
|
||||
await joinClasswithCode(
|
||||
|
|
@ -44,13 +46,12 @@ class ClassController extends BaseController {
|
|||
classCode,
|
||||
);
|
||||
|
||||
await _pangeaController.pStoreService.delete(
|
||||
await linkBox.remove(
|
||||
PLocalKey.cachedClassCodeToJoin,
|
||||
isAccountData: false,
|
||||
);
|
||||
} else if (alias != null) {
|
||||
await joinCachedRoomAlias(alias, context);
|
||||
await _aliasStorage.remove(PLocalKey.cachedAliasToJoin);
|
||||
await _classStorage.remove(PLocalKey.cachedAliasToJoin);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +66,7 @@ class ClassController extends BaseController {
|
|||
|
||||
final client = Matrix.of(context).client;
|
||||
if (!client.isLogged()) {
|
||||
await _aliasStorage.write(PLocalKey.cachedAliasToJoin, alias);
|
||||
await _classStorage.write(PLocalKey.cachedAliasToJoin, alias);
|
||||
context.go("/home");
|
||||
return;
|
||||
}
|
||||
|
|
@ -140,10 +141,9 @@ class ClassController extends BaseController {
|
|||
}
|
||||
|
||||
final chosenClassId = foundClasses.first;
|
||||
await _pangeaController.pStoreService.save(
|
||||
await chatBox.write(
|
||||
PLocalKey.justInputtedCode,
|
||||
classCode,
|
||||
isAccountData: false,
|
||||
);
|
||||
return chosenClassId;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -40,10 +40,9 @@ class _JoinClassWithLinkState extends State<JoinClassWithLink> {
|
|||
);
|
||||
return;
|
||||
}
|
||||
await pangeaController.pStoreService.save(
|
||||
await MatrixState.pangeaController.classController.linkBox.write(
|
||||
PLocalKey.cachedClassCodeToJoin,
|
||||
classCode,
|
||||
isAccountData: false,
|
||||
);
|
||||
context.go("/home");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
|
|||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:purchases_flutter/purchases_flutter.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
|
@ -83,6 +84,7 @@ class SubscriptionController extends BaseController {
|
|||
await initialize();
|
||||
}
|
||||
|
||||
final GetStorage subscriptionBox = GetStorage("subscription_storage");
|
||||
Future<void> _initialize() async {
|
||||
try {
|
||||
if (_userID == null) {
|
||||
|
|
@ -122,11 +124,10 @@ class SubscriptionController extends BaseController {
|
|||
},
|
||||
);
|
||||
} else {
|
||||
final bool? beganWebPayment = _pangeaController.pStoreService.read(
|
||||
PLocalKey.beganWebPayment,
|
||||
);
|
||||
final bool? beganWebPayment =
|
||||
subscriptionBox.read(PLocalKey.beganWebPayment);
|
||||
if (beganWebPayment ?? false) {
|
||||
await _pangeaController.pStoreService.delete(
|
||||
await subscriptionBox.remove(
|
||||
PLocalKey.beganWebPayment,
|
||||
);
|
||||
if (isSubscribed) {
|
||||
|
|
@ -173,7 +174,7 @@ class SubscriptionController extends BaseController {
|
|||
selectedSubscription.duration!,
|
||||
isPromo: isPromo,
|
||||
);
|
||||
await _pangeaController.pStoreService.save(
|
||||
await subscriptionBox.write(
|
||||
PLocalKey.beganWebPayment,
|
||||
true,
|
||||
);
|
||||
|
|
@ -274,7 +275,7 @@ class SubscriptionController extends BaseController {
|
|||
: SubscriptionStatus.dimissedPaywall;
|
||||
|
||||
DateTime? get _lastDismissedPaywall {
|
||||
final lastDismissed = _pangeaController.pStoreService.read(
|
||||
final lastDismissed = subscriptionBox.read(
|
||||
PLocalKey.dismissedPaywall,
|
||||
);
|
||||
if (lastDismissed == null) return null;
|
||||
|
|
@ -282,7 +283,7 @@ class SubscriptionController extends BaseController {
|
|||
}
|
||||
|
||||
int? get _paywallBackoff {
|
||||
final backoff = _pangeaController.pStoreService.read(
|
||||
final backoff = subscriptionBox.read(
|
||||
PLocalKey.paywallBackoff,
|
||||
);
|
||||
if (backoff == null) return null;
|
||||
|
|
@ -299,18 +300,18 @@ class SubscriptionController extends BaseController {
|
|||
}
|
||||
|
||||
void dismissPaywall() async {
|
||||
await _pangeaController.pStoreService.save(
|
||||
await subscriptionBox.write(
|
||||
PLocalKey.dismissedPaywall,
|
||||
DateTime.now().toString(),
|
||||
);
|
||||
|
||||
if (_paywallBackoff == null) {
|
||||
await _pangeaController.pStoreService.save(
|
||||
await subscriptionBox.write(
|
||||
PLocalKey.paywallBackoff,
|
||||
1,
|
||||
);
|
||||
} else {
|
||||
await _pangeaController.pStoreService.save(
|
||||
await subscriptionBox.write(
|
||||
PLocalKey.paywallBackoff,
|
||||
_paywallBackoff! + 1,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ class AvailableSubscriptionsInfo {
|
|||
List<SubscriptionDetails> availableSubscriptions = [];
|
||||
SubscriptionAppIds? appIds;
|
||||
List<SubscriptionDetails>? allProducts;
|
||||
final subscriptionBox =
|
||||
MatrixState.pangeaController.subscriptionController.subscriptionBox;
|
||||
|
||||
AvailableSubscriptionsInfo({
|
||||
this.appIds,
|
||||
|
|
@ -113,14 +115,14 @@ class AvailableSubscriptionsInfo {
|
|||
}
|
||||
|
||||
Future<void> _cacheSubscriptionInfo() async {
|
||||
await MatrixState.pangeaController.pStoreService.save(
|
||||
await subscriptionBox.write(
|
||||
PLocalKey.availableSubscriptionInfo,
|
||||
toJson(),
|
||||
);
|
||||
}
|
||||
|
||||
static AvailableSubscriptionsInfo? _getCachedSubscriptionInfo() {
|
||||
final json = MatrixState.pangeaController.pStoreService.read(
|
||||
AvailableSubscriptionsInfo? _getCachedSubscriptionInfo() {
|
||||
final json = subscriptionBox.read(
|
||||
PLocalKey.availableSubscriptionInfo,
|
||||
);
|
||||
if (json is! Map<String, dynamic>) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:jwt_decode/jwt_decode.dart';
|
||||
import 'package:matrix/matrix.dart' as matrix;
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ import '../models/user_model.dart';
|
|||
|
||||
/// Controller that manages saving and reading of user/profile information
|
||||
class UserController extends BaseController {
|
||||
final GetStorage loginBox = GetStorage("login_storage");
|
||||
late PangeaController _pangeaController;
|
||||
UserController(PangeaController pangeaController) : super() {
|
||||
_pangeaController = pangeaController;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ Future<void> _loginFuture({
|
|||
}
|
||||
},
|
||||
);
|
||||
MatrixState.pangeaController.pStoreService
|
||||
.save(PLocalKey.loginType, 'password');
|
||||
MatrixState.pangeaController.userController.loginBox
|
||||
.write(PLocalKey.loginType, 'password');
|
||||
GoogleAnalytics.login("pangea", loginRes.userId);
|
||||
}
|
||||
|
|
|
|||
94
pubspec.lock
94
pubspec.lock
|
|
@ -101,10 +101,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: async
|
||||
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
|
||||
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.12.0"
|
||||
version: "2.11.0"
|
||||
audio_session:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -205,10 +205,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
|
||||
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
version: "2.1.1"
|
||||
build_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -229,10 +229,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: characters
|
||||
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
|
||||
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
version: "1.3.0"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -269,18 +269,18 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
|
||||
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "1.1.1"
|
||||
collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: collection
|
||||
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
||||
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.19.1"
|
||||
version: "1.19.0"
|
||||
colorize:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -493,10 +493,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
|
||||
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
version: "1.3.1"
|
||||
fcm_shared_isolate:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -516,10 +516,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4
|
||||
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.1"
|
||||
version: "7.0.0"
|
||||
file_picker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -1391,18 +1391,18 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
|
||||
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.8"
|
||||
version: "10.0.7"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
|
||||
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.9"
|
||||
version: "3.0.8"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1471,10 +1471,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
|
||||
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.17"
|
||||
version: "0.12.16+1"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1504,10 +1504,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
|
||||
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.16.0"
|
||||
version: "1.15.0"
|
||||
mgrs_dart:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1624,10 +1624,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: path
|
||||
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
|
||||
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
version: "1.9.0"
|
||||
path_parsing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1752,10 +1752,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
|
||||
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.6"
|
||||
version: "3.1.5"
|
||||
platform_detect:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1832,10 +1832,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: process
|
||||
sha256: "107d8be718f120bbba9dcd1e95e3bd325b1b4a4f07db64154635ba03f2567a0d"
|
||||
sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.3"
|
||||
version: "5.0.2"
|
||||
proj4dart:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -2213,10 +2213,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
|
||||
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.10.1"
|
||||
version: "1.10.0"
|
||||
sprintf:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -2269,26 +2269,26 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
|
||||
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.12.1"
|
||||
version: "1.12.0"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
|
||||
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
version: "2.1.2"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
|
||||
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
version: "1.3.0"
|
||||
string_validator:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -2341,34 +2341,34 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
|
||||
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.2"
|
||||
version: "1.2.1"
|
||||
test:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test
|
||||
sha256: "301b213cd241ca982e9ba50266bd3f5bd1ea33f1455554c5abb85d1be0e2d87e"
|
||||
sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.25.15"
|
||||
version: "1.25.8"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
|
||||
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.4"
|
||||
version: "0.7.3"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa"
|
||||
sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.8"
|
||||
version: "0.6.5"
|
||||
text_to_speech:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -2661,10 +2661,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
|
||||
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.3.1"
|
||||
version: "14.3.0"
|
||||
wakelock_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -2786,5 +2786,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">=3.7.0-0 <4.0.0"
|
||||
dart: ">=3.5.1 <4.0.0"
|
||||
flutter: ">=3.24.0"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue