This commit is contained in:
2026-01-19 10:54:25 +01:00
parent e2a31ab923
commit 9933fc90e0
4 changed files with 34 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="bmmanager"
android:name="${applicationName}"

View File

@@ -9,14 +9,27 @@ import 'brandmeister_client.dart';
class AuthenticationManager extends ChangeNotifier {
static const String _tokenKey = 'apiToken';
final FlutterSecureStorage _storage = const FlutterSecureStorage(
aOptions: AndroidOptions(
encryptedSharedPreferences: true,
),
iOptions: IOSOptions(
accessibility: KeychainAccessibility.first_unlock,
),
);
late final FlutterSecureStorage _storage;
AuthenticationManager() {
_initStorage();
_loadToken();
}
void _initStorage() {
_storage = const FlutterSecureStorage(
aOptions: AndroidOptions(
encryptedSharedPreferences: true,
),
iOptions: IOSOptions(
accessibility: KeychainAccessibility.first_unlock,
),
webOptions: WebOptions(
dbName: 'bmmanager',
publicKey: 'bmmanager_public_key',
),
);
}
bool _isAuthenticated = false;
String _apiToken = '';
@@ -27,10 +40,6 @@ class AuthenticationManager extends ChangeNotifier {
String get apiToken => _apiToken;
UserInfo? get userInfo => _userInfo;
AuthenticationManager() {
_loadToken();
}
Future<void> _loadToken() async {
try {
final token = await _storage.read(key: _tokenKey);

View File

@@ -8,5 +8,11 @@
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>$(TeamIdentifierPrefix)io.kida.bmmanager</string>
</array>
</dict>
</plist>

View File

@@ -4,5 +4,11 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>$(TeamIdentifierPrefix)io.kida.bmmanager</string>
</array>
</dict>
</plist>