feat(app): add script and tasks

This commit is contained in:
petrovyuri
2025-01-21 18:59:02 +03:00
parent 17d096baac
commit 40fc2209a4
8 changed files with 84 additions and 12 deletions

33
.vscode/launch.json vendored
View File

@@ -2,22 +2,47 @@
"version": "0.2.0",
"configurations": [
{
"name": "dev",
"name": "GMS_dev",
"type": "dart",
"request": "launch",
"program": "${workspaceFolder}/lib/targets/dev.dart",
"preLaunchTask": "switch_to_gms"
},
{
"name": "stage",
"name": "GMS_stage",
"type": "dart",
"request": "launch",
"program": "${workspaceFolder}/lib/targets/stage.dart",
"preLaunchTask": "switch_to_gms"
},
{
"name": "prod",
"name": "GMS_prod",
"type": "dart",
"request": "launch",
"program": "${workspaceFolder}/lib/targets/prod.dart",
}
"preLaunchTask": "switch_to_gms"
},
{
"name": "Aurora_dev",
"type": "dart",
"request": "launch",
"program": "${workspaceFolder}/lib/targets/dev.dart",
"preLaunchTask": "switch_to_aurora"
},
{
"name": "Aurora_stage",
"type": "dart",
"request": "launch",
"program": "${workspaceFolder}/lib/targets/stage.dart",
"preLaunchTask": "switch_to_aurora"
},
{
"name": "Aurora_prod",
"type": "dart",
"request": "launch",
"program": "${workspaceFolder}/lib/targets/prod.dart",
"preLaunchTask": "switch_to_aurora"
},
]
}

12
.vscode/tasks.json vendored
View File

@@ -37,6 +37,18 @@
"reveal": "always"
},
"problemMatcher": []
},
{
"label": "switch_to_gms",
"type": "shell",
"command": "./switch_service.sh gms",
"problemMatcher": []
},
{
"label": "switch_to_aurora",
"type": "shell",
"command": "./switch_service.sh aurora",
"problemMatcher": []
}
]
}

View File

@@ -15,8 +15,8 @@ final class AppSecureStorage implements ISecureStorage {
@override
final String secretKey;
@override
String get name => 'AuroraAppSecureStorage';
static const name = 'AuroraAppSecureStorage';
/// Экземпляр хранилища данных
final _box = const FlutterSecureStorage();
@@ -45,4 +45,7 @@ final class AppSecureStorage implements ISecureStorage {
Future<void> write(String key, String value) async {
await _box.write(key: key, value: value);
}
@override
String get nameImpl => AppSecureStorage.name;
}

View File

@@ -41,4 +41,7 @@ final class AppSecureStorage implements ISecureStorage {
Future<void> write(String key, String value) async {
await _box.write(key: key, value: value);
}
@override
String get nameImpl => AppSecureStorage.name;
}

View File

@@ -41,4 +41,6 @@ abstract interface class ISecureStorage {
/// Принимает:
/// - [key] - ключ
Future<bool> exists(String key);
String get nameImpl;
}

View File

@@ -15,6 +15,9 @@ class MainScreen extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Реализация SecureStorage: ${context.di.secureStorage.nameImpl}',
),
const SizedBox(height: 16),
Text(
'Окружение: ${context.di.appConfig.env.name}',

View File

@@ -32,13 +32,9 @@ dependencies:
app_services:
### Базовая реализация ###
path: app_services/gms/app_services
path: app_services/gms/app_services
### Аврора реализация ###
#path: app_services/aurora/app_services
### Telegram реализация ###
#path: app_services/telegram/app_services
# path: app_services/aurora/app_services
dev_dependencies:
flutter_test:

28
switch_service.sh Normal file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
SERVICE=$1
PUBSPEC_FILE="pubspec.yaml"
if [ -z "$SERVICE" ]; then
echo "Usage: $0 [gms|aurora]"
exit 1
fi
case "$SERVICE" in
gms)
sed -i 's|^\(\s*\)#\s*path: app_services/gms/app_services|\1path: app_services/gms/app_services|' "$PUBSPEC_FILE"
sed -i 's|^\(\s*\)path: app_services/aurora/app_services|\1# path: app_services/aurora/app_services|' "$PUBSPEC_FILE"
;;
aurora)
sed -i 's|^\(\s*\)#\s*path: app_services/aurora/app_services|\1path: app_services/aurora/app_services|' "$PUBSPEC_FILE"
sed -i 's|^\(\s*\)path: app_services/gms/app_services|\1# path: app_services/gms/app_services|' "$PUBSPEC_FILE"
;;
*)
echo "Unknown option: $SERVICE"
echo "Usage: $0 [gms|aurora]"
exit 1
;;
esac
echo "Переключились на $SERVICE. Запуск flutter pub get..."
flutter pub get