Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -1,44 +1,22 @@
|
||||
// File generated by FlutterFire CLI.
|
||||
|
||||
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
|
||||
import 'package:flutter/foundation.dart'
|
||||
show defaultTargetPlatform, kIsWeb, TargetPlatform;
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
/// Default [FirebaseOptions] for use with your Firebase apps.
|
||||
/// Environment-aware [FirebaseOptions] for the Staff app.
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// import 'firebase_options.dart';
|
||||
/// // ...
|
||||
/// await Firebase.initializeApp(
|
||||
/// options: DefaultFirebaseOptions.currentPlatform,
|
||||
/// );
|
||||
/// ```
|
||||
/// Selects the correct Firebase configuration based on the compile-time
|
||||
/// `ENV` dart define (dev, stage, prod). Defaults to dev.
|
||||
class DefaultFirebaseOptions {
|
||||
static FirebaseOptions get currentPlatform {
|
||||
if (kIsWeb) {
|
||||
return web;
|
||||
return _webOptions;
|
||||
}
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
return android;
|
||||
return _androidOptions;
|
||||
case TargetPlatform.iOS:
|
||||
return ios;
|
||||
case TargetPlatform.macOS:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for macos - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
case TargetPlatform.windows:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for windows - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
case TargetPlatform.linux:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for linux - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
return _iosOptions;
|
||||
default:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions are not supported for this platform.',
|
||||
@@ -46,7 +24,65 @@ class DefaultFirebaseOptions {
|
||||
}
|
||||
}
|
||||
|
||||
static const FirebaseOptions web = FirebaseOptions(
|
||||
static FirebaseOptions get _androidOptions {
|
||||
switch (AppEnvironment.current) {
|
||||
case AppEnvironment.dev:
|
||||
return _devAndroid;
|
||||
case AppEnvironment.stage:
|
||||
return _stageAndroid;
|
||||
case AppEnvironment.prod:
|
||||
return _prodAndroid;
|
||||
}
|
||||
}
|
||||
|
||||
static FirebaseOptions get _iosOptions {
|
||||
switch (AppEnvironment.current) {
|
||||
case AppEnvironment.dev:
|
||||
return _devIos;
|
||||
case AppEnvironment.stage:
|
||||
return _stageIos;
|
||||
case AppEnvironment.prod:
|
||||
return _prodIos;
|
||||
}
|
||||
}
|
||||
|
||||
static FirebaseOptions get _webOptions {
|
||||
switch (AppEnvironment.current) {
|
||||
case AppEnvironment.dev:
|
||||
return _devWeb;
|
||||
case AppEnvironment.stage:
|
||||
return _stageWeb;
|
||||
case AppEnvironment.prod:
|
||||
return _prodWeb;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// DEV (krow-workforce-dev)
|
||||
// ===========================================================================
|
||||
|
||||
static const FirebaseOptions _devAndroid = FirebaseOptions(
|
||||
apiKey: 'AIzaSyDBYhflhK6DThKnS7RM-9raKdvyKzLUjY4',
|
||||
appId: '1:933560802882:android:ee100eab75b6b04c7757db',
|
||||
messagingSenderId: '933560802882',
|
||||
projectId: 'krow-workforce-dev',
|
||||
storageBucket: 'krow-workforce-dev.firebasestorage.app',
|
||||
);
|
||||
|
||||
static const FirebaseOptions _devIos = FirebaseOptions(
|
||||
apiKey: 'AIzaSyDyEXkzZAWpXXe4dAesYaZflt5BEtMn9tA',
|
||||
appId: '1:933560802882:ios:edf97dab6eb87b977757db',
|
||||
messagingSenderId: '933560802882',
|
||||
projectId: 'krow-workforce-dev',
|
||||
storageBucket: 'krow-workforce-dev.firebasestorage.app',
|
||||
androidClientId:
|
||||
'933560802882-fbqg2icq24bmci3f84evjrbth5huh87f.apps.googleusercontent.com',
|
||||
iosClientId:
|
||||
'933560802882-fphpkdjubve8k7e8ogqj3fk1qducv3sg.apps.googleusercontent.com',
|
||||
iosBundleId: 'dev.krowwithus.staff',
|
||||
);
|
||||
|
||||
static const FirebaseOptions _devWeb = FirebaseOptions(
|
||||
apiKey: 'AIzaSyBqRtZPMGU-Sz5x5UnRrunKu5NSWYyPRn8',
|
||||
appId: '1:933560802882:web:173a841992885bb27757db',
|
||||
messagingSenderId: '933560802882',
|
||||
@@ -56,23 +92,62 @@ class DefaultFirebaseOptions {
|
||||
measurementId: 'G-9S7WEQTDKX',
|
||||
);
|
||||
|
||||
static const FirebaseOptions android = FirebaseOptions(
|
||||
apiKey: 'AIzaSyDBYhflhK6DThKnS7RM-9raKdvyKzLUjY4',
|
||||
appId: '1:933560802882:android:1ae05d85c865f77c7757db',
|
||||
messagingSenderId: '933560802882',
|
||||
projectId: 'krow-workforce-dev',
|
||||
storageBucket: 'krow-workforce-dev.firebasestorage.app',
|
||||
// ===========================================================================
|
||||
// STAGE (krow-workforce-staging)
|
||||
// ===========================================================================
|
||||
|
||||
static const FirebaseOptions _stageAndroid = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCgTXI3QhbEK3r4J5y7ek_6AxqhmR99QjY',
|
||||
appId: '1:1032971403708:android:14e471d055e59597356bb9',
|
||||
messagingSenderId: '1032971403708',
|
||||
projectId: 'krow-workforce-staging',
|
||||
storageBucket: 'krow-workforce-staging.firebasestorage.app',
|
||||
);
|
||||
|
||||
static const FirebaseOptions ios = FirebaseOptions(
|
||||
apiKey: 'AIzaSyDyEXkzZAWpXXe4dAesYaZflt5BEtMn9tA',
|
||||
appId: '1:933560802882:ios:fa584205b356de937757db',
|
||||
messagingSenderId: '933560802882',
|
||||
projectId: 'krow-workforce-dev',
|
||||
storageBucket: 'krow-workforce-dev.firebasestorage.app',
|
||||
androidClientId: '933560802882-fbqg2icq24bmci3f84evjrbth5huh87f.apps.googleusercontent.com',
|
||||
iosClientId: '933560802882-29olj9ku64jbe9h7flinha6hbi8qrluh.apps.googleusercontent.com',
|
||||
iosBundleId: 'com.krowwithus.staff',
|
||||
static const FirebaseOptions _stageIos = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCgTXI3QhbEK3r4J5y7ek_6AxqhmR99QjY',
|
||||
appId: '1:1032971403708:ios:8c2bbd76bc4f55d9356bb9',
|
||||
messagingSenderId: '1032971403708',
|
||||
projectId: 'krow-workforce-staging',
|
||||
storageBucket: 'krow-workforce-staging.firebasestorage.app',
|
||||
iosBundleId: 'stage.krowwithus.staff',
|
||||
);
|
||||
|
||||
}
|
||||
static const FirebaseOptions _stageWeb = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCgTXI3QhbEK3r4J5y7ek_6AxqhmR99QjY',
|
||||
appId: '', // TODO: Register web app in krow-workforce-staging
|
||||
messagingSenderId: '1032971403708',
|
||||
projectId: 'krow-workforce-staging',
|
||||
storageBucket: 'krow-workforce-staging.firebasestorage.app',
|
||||
);
|
||||
|
||||
// ===========================================================================
|
||||
// PROD (krow-workforce-prod)
|
||||
// TODO: Fill in after creating krow-workforce-prod Firebase project
|
||||
// ===========================================================================
|
||||
|
||||
static const FirebaseOptions _prodAndroid = FirebaseOptions(
|
||||
apiKey: '', // TODO: Add prod API key
|
||||
appId: '', // TODO: Add prod app ID
|
||||
messagingSenderId: '', // TODO: Add prod sender ID
|
||||
projectId: 'krow-workforce-prod',
|
||||
storageBucket: 'krow-workforce-prod.firebasestorage.app',
|
||||
);
|
||||
|
||||
static const FirebaseOptions _prodIos = FirebaseOptions(
|
||||
apiKey: '', // TODO: Add prod API key
|
||||
appId: '', // TODO: Add prod app ID
|
||||
messagingSenderId: '', // TODO: Add prod sender ID
|
||||
projectId: 'krow-workforce-prod',
|
||||
storageBucket: 'krow-workforce-prod.firebasestorage.app',
|
||||
iosBundleId: 'prod.krowwithus.staff',
|
||||
);
|
||||
|
||||
static const FirebaseOptions _prodWeb = FirebaseOptions(
|
||||
apiKey: '', // TODO: Add prod API key
|
||||
appId: '', // TODO: Add prod app ID
|
||||
messagingSenderId: '', // TODO: Add prod sender ID
|
||||
projectId: 'krow-workforce-prod',
|
||||
storageBucket: 'krow-workforce-prod.firebasestorage.app',
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user