Skip to content

Commit

Permalink
Изменения хранилища для фикса бага #224 (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
KriseevM authored Feb 22, 2024
1 parent 22806be commit a36358b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
android:label="ННГУ"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:fullBackupContent="false"
>
<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
import 'dart:developer';
import 'package:flutter/services.dart';
import 'package:injector/injector.dart';
import 'package:unn_mobile/core/services/interfaces/auth_data_provider.dart';
import 'package:unn_mobile/core/services/interfaces/authorisation_service.dart';
import 'package:unn_mobile/core/models/auth_data.dart';
import 'package:unn_mobile/core/services/interfaces/authorisation_refresh_service.dart';

import 'package:unn_mobile/core/services/interfaces/storage_service.dart';

class AuthorisationRefreshServiceImpl implements AuthorisationRefreshService {
final _authDataProvider = Injector.appInstance.get<AuthDataProvider>();
final _authorisationService = Injector.appInstance.get<AuthorisationService>();
final _authDataProvider = Injector.appInstance.get<AuthDataProvider>();
final _authorisationService =
Injector.appInstance.get<AuthorisationService>();
final _storage = Injector.appInstance.get<StorageService>();

Future<bool> _userDataExistsInStorage() async{
AuthData authData = await _authDataProvider.getData();
return !(authData.login == AuthData.getDefaultParameter() || authData.login == AuthData.getDefaultParameter());
Future<bool> _userDataExistsInStorage() async {
try {
AuthData authData = await _authDataProvider.getData();
return !(authData.login == AuthData.getDefaultParameter() ||
authData.login == AuthData.getDefaultParameter());
} on PlatformException catch (error) {
log("Exception: ${error.message}; code: ${error.code}\nStackTrace: \n${error.stacktrace}");
_storage.clear();
return false;
}
}

@override
Expand Down
4 changes: 3 additions & 1 deletion lib/core/services/implementations/storage_service_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import 'package:unn_mobile/core/services/interfaces/storage_service.dart';

class StorageServiceImpl implements StorageService {
SharedPreferences? _sharedPreferences;
final FlutterSecureStorage _secureStorage = const FlutterSecureStorage();
final FlutterSecureStorage _secureStorage = const FlutterSecureStorage(aOptions: AndroidOptions(
encryptedSharedPreferences: true
));

final Map<String, String?> _secureCache = {};
final Map<String, String?> _nonSecureCache = {};
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: unn_mobile
description: A mobile application for UNN Portal website
publish_to: 'none'
version: 0.1.2+9
version: 0.1.2+11

environment:
sdk: '>=3.1.2 <4.0.0'
Expand Down

0 comments on commit a36358b

Please sign in to comment.