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"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application <application
android:label="bmmanager" android:label="bmmanager"
android:name="${applicationName}" android:name="${applicationName}"

View File

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

View File

@@ -8,5 +8,11 @@
<true/> <true/>
<key>com.apple.security.network.server</key> <key>com.apple.security.network.server</key>
<true/> <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> </dict>
</plist> </plist>

View File

@@ -4,5 +4,11 @@
<dict> <dict>
<key>com.apple.security.app-sandbox</key> <key>com.apple.security.app-sandbox</key>
<true/> <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> </dict>
</plist> </plist>