Refactor application package structure and update Firebase iOS bundle IDs for different environments.

This commit is contained in:
Faris Armoush
2025-07-13 12:37:53 +03:00
parent e1b0d56cfd
commit c4fa2256f0
9 changed files with 18 additions and 15 deletions

View File

@ -14,7 +14,7 @@
android:icon="@mipmap/ic_launcher"
android:allowBackup="false">
<activity
android:name="com.example.syncrow_app.MainActivity"
android:name="com.syncrow.mobile.MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"

View File

@ -1,4 +1,4 @@
package com.example.syncrow_application
package com.syncrow.mobile
import io.flutter.embedding.android.FlutterActivity

View File

@ -17,8 +17,7 @@ import 'package:syncrow_app/firebase_options_staging.dart' as staging;
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
const flavor = String.fromEnvironment('flavor');
static FirebaseOptions currentPlatform(String flavor) {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
@ -30,11 +29,12 @@ class DefaultFirebaseOptions {
return dev.DefaultFirebaseOptions.currentPlatform;
case 'staging':
return staging.DefaultFirebaseOptions.currentPlatform;
case 'prod':
case 'production':
return prod.DefaultFirebaseOptions.currentPlatform;
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this flavor.',
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
}

View File

@ -73,6 +73,6 @@ class DefaultFirebaseOptions {
projectId: 'syncrow-prod-79446',
databaseURL: 'https://syncrow-staging-79446.asia-southeast1.firebasedatabase.app/',
storageBucket: 'syncrow-prod-79446.firebasestorage.app',
iosBundleId: 'com.syncrow.mobile.dev',
iosBundleId: 'com.syncrow.iot.ex.dev',
);
}

View File

@ -62,7 +62,7 @@ class DefaultFirebaseOptions {
projectId: 'syncrow-staging',
databaseURL: 'https://syncrow-prod-79446.asia-southeast1.firebasedatabase.app/',
storageBucket: 'syncrow-staging.appspot.com',
iosBundleId: 'com.example.syncrow.app',
iosBundleId: 'com.syncrow.iot.ex',
);
static const FirebaseOptions web = FirebaseOptions(

View File

@ -73,6 +73,6 @@ class DefaultFirebaseOptions {
projectId: 'syncrow-prod-79446',
databaseURL: 'https://syncrow-staging-79446.asia-southeast1.firebasedatabase.app/',
storageBucket: 'syncrow-prod-79446.firebasestorage.app',
iosBundleId: 'com.syncrow.mobile.staging',
iosBundleId: 'com.syncrow.iot.ex.staging',
);
}

View File

@ -42,7 +42,8 @@ void main() {
initialSetup();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
options: DefaultFirebaseOptions.currentPlatform('production'),
name: 'syncrow_app',
);
//final SharedPreferences prefs = await SharedPreferences.getInstance();

View File

@ -40,7 +40,8 @@ void main() {
initialSetup();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
options: DefaultFirebaseOptions.currentPlatform('dev'),
name: 'syncrow_app',
);
//final SharedPreferences prefs = await SharedPreferences.getInstance();

View File

@ -5,11 +5,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:syncrow_app/firebase_options_staging.dart';
import 'package:syncrow_app/services/locator.dart';
import 'package:syncrow_app/utils/bloc_observer.dart';
import 'package:syncrow_app/utils/helpers/localization_helpers.dart';
import 'firebase_options.dart';
import 'my_app.dart';
void main() {
@ -40,7 +40,8 @@ void main() {
initialSetup();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
options: DefaultFirebaseOptions.currentPlatform('staging'),
name: 'syncrow_app',
);
//final SharedPreferences prefs = await SharedPreferences.getInstance();