Skip to content

Commit

Permalink
Merge pull request #134 from onestudio-co/Virtual-branch
Browse files Browse the repository at this point in the history
Virtual branch
  • Loading branch information
salahamassi authored Jul 31, 2024
2 parents 2f15d15 + 71f20cc commit 82c5d2b
Show file tree
Hide file tree
Showing 29 changed files with 337 additions and 468 deletions.
31 changes: 7 additions & 24 deletions android/app/src/production/google-services.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,26 @@
{
"project_info": {
"project_number": "766000556009",
"project_id": "flutter-bond-87485",
"storage_bucket": "flutter-bond-87485.appspot.com"
"project_number": "1077101979846",
"project_id": "flutter-bond-8ae02",
"storage_bucket": "flutter-bond-8ae02.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:766000556009:android:5a55ed668d929522d0cd78",
"mobilesdk_app_id": "1:1077101979846:android:00afb3c0b4d1b8ae3a0fc7",
"android_client_info": {
"package_name": "ps.app.bond"
}
},
"oauth_client": [
{
"client_id": "766000556009-bus1p8rgt7mmd8ij9g0nu8vbcioub8b8.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDfL8g3p3PmS3kUNPDxn5_RaKKDmFcZKKw"
"current_key": "AIzaSyCabR-NAV535DJ8NjcQhhllO3qR11q7mIM"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "766000556009-bus1p8rgt7mmd8ij9g0nu8vbcioub8b8.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "766000556009-0u0bfplre3qmoe13fq7imp8e6528e4af.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "ps.app.bond"
}
}
]
"other_platform_oauth_client": []
}
}
}
Expand Down
31 changes: 7 additions & 24 deletions android/app/src/staging/google-services.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,26 @@
{
"project_info": {
"project_number": "1060161913171",
"project_id": "flutter-bond-staging",
"storage_bucket": "flutter-bond-staging.appspot.com"
"project_number": "390157281889",
"project_id": "flutter-bond-staging-7dd42",
"storage_bucket": "flutter-bond-staging-7dd42.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1060161913171:android:af73c28cf1b003f555a1a6",
"mobilesdk_app_id": "1:390157281889:android:bf4d85c3c9a51044ab9820",
"android_client_info": {
"package_name": "ps.app.bond.staging"
}
},
"oauth_client": [
{
"client_id": "1060161913171-div6fmuh41opo5r2bh6h1ib5o1sbs1p5.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDSzUXbQV5Z2-psxdjITf1XNtCyFjnWm34"
"current_key": "AIzaSyA-AjzVELSPttuIp2k6kydk0RX-DORqPpg"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1060161913171-div6fmuh41opo5r2bh6h1ib5o1sbs1p5.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "1060161913171-81tqkgkcqusecm5mv2qu1a6n0kcusjb6.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "ps.app.flutterBond.staging"
}
}
]
"other_platform_oauth_client": []
}
}
}
Expand Down
1 change: 1 addition & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"flutter":{"platforms":{"android":{"buildConfigurations":{"src/production":{"projectId":"flutter-bond-8ae02","appId":"1:1077101979846:android:00afb3c0b4d1b8ae3a0fc7","fileOutput":"android/app/src/production/google-services.json"},"src/staging":{"projectId":"flutter-bond-staging-7dd42","appId":"1:390157281889:android:bf4d85c3c9a51044ab9820","fileOutput":"android/app/src/staging/google-services.json"}}},"ios":{"buildConfigurations":{"Debug-Production":{"projectId":"flutter-bond-8ae02","appId":"1:1077101979846:ios:a2d61d584196a5be3a0fc7","uploadDebugSymbols":true,"fileOutput":"ios/Production/GoogleService-Info.plist"},"Release-Production":{"projectId":"flutter-bond-8ae02","appId":"1:1077101979846:ios:a2d61d584196a5be3a0fc7","uploadDebugSymbols":true,"fileOutput":"ios/Production/GoogleService-Info.plist"},"Debug-Staging":{"projectId":"flutter-bond-staging-7dd42","appId":"1:390157281889:ios:8c87b8875dcdd94aab9820","uploadDebugSymbols":true,"fileOutput":"ios/Staging/GoogleService-Info.plist"},"Release-Staging":{"projectId":"flutter-bond-staging-7dd42","appId":"1:390157281889:ios:8c87b8875dcdd94aab9820","uploadDebugSymbols":true,"fileOutput":"ios/Staging/GoogleService-Info.plist"}}},"macos":{"buildConfigurations":{"Debug-Production":{"projectId":"flutter-bond-8ae02","appId":"1:1077101979846:ios:bb43f2ef1264d0e03a0fc7","uploadDebugSymbols":true,"fileOutput":"macos/Production/GoogleService-Info.plist"},"Release-Production":{"projectId":"flutter-bond-8ae02","appId":"1:1077101979846:ios:bb43f2ef1264d0e03a0fc7","uploadDebugSymbols":true,"fileOutput":"macos/Production/GoogleService-Info.plist"},"Debug-Staging":{"projectId":"flutter-bond-staging-7dd42","appId":"1:390157281889:ios:ba7ec93993371072ab9820","uploadDebugSymbols":true,"fileOutput":"macos/Staging/GoogleService-Info.plist"},"Release-Staging":{"projectId":"flutter-bond-staging-7dd42","appId":"1:390157281889:ios:ba7ec93993371072ab9820","uploadDebugSymbols":true,"fileOutput":"macos/Staging/GoogleService-Info.plist"}}},"dart":{"lib/firebase_options_production.dart":{"projectId":"flutter-bond-8ae02","configurations":{"android":"1:1077101979846:android:00afb3c0b4d1b8ae3a0fc7","ios":"1:1077101979846:ios:a2d61d584196a5be3a0fc7","macos":"1:1077101979846:ios:bb43f2ef1264d0e03a0fc7"}},"lib/firebase_options_staging.dart":{"projectId":"flutter-bond-staging-7dd42","configurations":{"android":"1:390157281889:android:bf4d85c3c9a51044ab9820","ios":"1:390157281889:ios:8c87b8875dcdd94aab9820","macos":"1:390157281889:ios:ba7ec93993371072ab9820"}}}}}}
129 changes: 63 additions & 66 deletions firebase_config.bash
Original file line number Diff line number Diff line change
@@ -1,76 +1,73 @@
#!/bin/bash

capitalize_first_letter() {
local word="$1"
echo "$word" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}'
}

# Description: This script configures Firebase for different environments using the FlutterFire CLI.

# VARIABLES TO BE MODIFIED
# Function to configure Firebase
configure_firebase() {
local PROJECT_ID=$1
local ANDROID_PACKAGE_NAME=$2
local IOS_BUNDLE_ID=$3
local MACOS_BUNDLE_ID=$4
local ENV=$5
local IOS_BUILD_CONFIG=$6
local MACOS_BUILD_CONFIG=$7
local OUT_FILE=$8

# Production Environment
PROJECT_ID_PRODUCTION="flutter-bond-87485" # Firebase project ID for production
ANDROID_PACKAGE_NAME_PRODUCTION="ps.app.bond" # Android package name for production
IOS_BUNDLE_ID_PRODUCTION="ps.app.bond" # iOS bundle ID for production
MACOS_BUNDLE_ID_PRODUCTION="ps.app.flutterBond" # macOS bundle ID for production
WEB_APP_ID_PRODUCTION="1:766000556009:web:2165a143cd98adf4d0cd78" # Web app ID for production
if [ -z "$PROJECT_ID" ]; then
echo "No PROJECT_ID provided for ${ENV} environment. Creating a new Firebase project..."
PROJECT_NAME="flutter-bond-${ENV}-$(date +%s)"
firebase projects:create $PROJECT_NAME --display-name "$PROJECT_NAME"
PROJECT_ID=$(firebase projects:list --filter="$PROJECT_NAME" --format="value(projectId)")
echo "Created new Firebase project with ID: $PROJECT_ID"
fi

# Staging Environment
PROJECT_ID_STAGING="flutter-bond-staging" # Firebase project ID for staging
ANDROID_PACKAGE_NAME_STAGING="ps.app.bond.staging" # Android package name for staging
IOS_BUNDLE_ID_STAGING="ps.app.bond.staging" # iOS bundle ID for staging
MACOS_BUNDLE_ID_STAGING="ps.app.flutterBond.staging" # macOS bundle ID for staging
WEB_APP_ID_STAGING="1:1060161913171:web:68b14b55cce605b655a1a6" # Web app ID for staging
echo "Configuring Firebase for ${ENV} environment with project ID $PROJECT_ID..."

capitalized_env=$(capitalize_first_letter "$ENV")

# Production Environment Configuration
flutterfire configure \
--yes \
--project=$PROJECT_ID_PRODUCTION \
--platforms=ios,macos,android,web \
--android-out=android/app/src/production/google-services.json \
--android-package-name=$ANDROID_PACKAGE_NAME_PRODUCTION \
--ios-build-config='Debug-Production' \
--ios-out=/ios/production/GoogleService-Info.plist \
--ios-bundle-id=$IOS_BUNDLE_ID_PRODUCTION \
--macos-build-config='Debug-Production' \
--macos-out=/macos/production/GoogleService-Info.plist \
--macos-bundle-id=$MACOS_BUNDLE_ID_PRODUCTION \
--web-app-id=$WEB_APP_ID_PRODUCTION \
--out=lib/firebase_options_production.dart
flutterfire configure \
--yes \
--project=$PROJECT_ID \
--platforms=ios,macos,android \
--android-out=android/app/src/${ENV}/google-services.json \
--android-package-name=$ANDROID_PACKAGE_NAME \
--ios-build-config=$IOS_BUILD_CONFIG \
--ios-out=ios/${capitalized_env}/GoogleService-Info.plist \
--ios-bundle-id=$IOS_BUNDLE_ID \
--macos-build-config=$MACOS_BUILD_CONFIG \
--macos-out=macos/${capitalized_env}/GoogleService-Info.plist \
--macos-bundle-id=$MACOS_BUNDLE_ID \
--out=lib/firebase_options_${ENV}.dart

# Production Environment Release Configuration
flutterfire configure \
--yes \
--project=$PROJECT_ID_PRODUCTION \
--ios-build-config='Release-Production' \
--ios-out=/ios/production/GoogleService-Info.plist \
--ios-bundle-id=$IOS_BUNDLE_ID_PRODUCTION \
--macos-build-config='Release-Production' \
--macos-out=/macos/production/GoogleService-Info.plist \
--macos-bundle-id=$MACOS_BUNDLE_ID_PRODUCTION \
--out=lib/firebase_options_production.dart
if [ $? -ne 0 ]; then
echo "Error configuring Firebase for ${ENV} environment."
exit 1
else
echo "Successfully configured Firebase for ${ENV} environment."
fi
}

# Production Environment
PROJECT_ID_PRODUCTION="flutter-bond-8ae02"
ANDROID_PACKAGE_NAME_PRODUCTION="ps.app.bond"
IOS_BUNDLE_ID_PRODUCTION="ps.app.bond"
MACOS_BUNDLE_ID_PRODUCTION="ps.app.flutterBond"

# Staging Environment
PROJECT_ID_STAGING="flutter-bond-staging-7dd42"
ANDROID_PACKAGE_NAME_STAGING="ps.app.bond.staging"
IOS_BUNDLE_ID_STAGING="ps.app.bond.staging"
MACOS_BUNDLE_ID_STAGING="ps.app.flutterBond.staging"

# Staging Environment Configuration
flutterfire configure \
--yes \
--project=$PROJECT_ID_STAGING \
--platforms=ios,macos,android,web \
--android-out=android/app/src/staging/google-services.json \
--android-package-name=$ANDROID_PACKAGE_NAME_STAGING \
--ios-build-config='Debug-Staging' \
--ios-out=/ios/staging/GoogleService-Info.plist \
--ios-bundle-id=$IOS_BUNDLE_ID_STAGING \
--macos-build-config='Debug-Staging' \
--macos-out=/macos/staging/GoogleService-Info.plist \
--macos-bundle-id=$MACOS_BUNDLE_ID_STAGING \
--web-app-id=$WEB_APP_ID_STAGING \
--out=lib/firebase_options_staging.dart
# Configure Production Environment
configure_firebase $PROJECT_ID_PRODUCTION $ANDROID_PACKAGE_NAME_PRODUCTION $IOS_BUNDLE_ID_PRODUCTION $MACOS_BUNDLE_ID_PRODUCTION "production" "Debug-Production" "Debug-Production" "firebase_options_production.dart"
configure_firebase $PROJECT_ID_PRODUCTION $ANDROID_PACKAGE_NAME_PRODUCTION $IOS_BUNDLE_ID_PRODUCTION $MACOS_BUNDLE_ID_PRODUCTION "production" "Release-Production" "Release-Production" "firebase_options_production.dart"

# Staging Environment Release Configuration
flutterfire configure \
--yes \
--project=$PROJECT_ID_STAGING \
--platforms=ios,macos \
--ios-build-config='Release-Staging' \
--ios-out=/ios/staging/GoogleService-Info.plist \
--ios-bundle-id=$IOS_BUNDLE_ID_STAGING \
--macos-build-config='Release-Staging' \
--macos-out=/macos/staging/GoogleService-Info.plist \
--macos-bundle-id=$MACOS_BUNDLE_ID_STAGING \
--out=lib/firebase_options_staging.dart
# Configure Staging Environment
configure_firebase $PROJECT_ID_STAGING $ANDROID_PACKAGE_NAME_STAGING $IOS_BUNDLE_ID_STAGING $MACOS_BUNDLE_ID_STAGING "staging" "Debug-Staging" "Debug-Staging" "firebase_options_staging.dart"
configure_firebase $PROJECT_ID_STAGING $ANDROID_PACKAGE_NAME_STAGING $IOS_BUNDLE_ID_STAGING $MACOS_BUNDLE_ID_STAGING "staging" "Release-Staging" "Release-Staging" "firebase_options_staging.dart"
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>766000556009-0u0bfplre3qmoe13fq7imp8e6528e4af.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.766000556009-0u0bfplre3qmoe13fq7imp8e6528e4af</string>
<key>API_KEY</key>
<string>AIzaSyDVvGOc_wPjffCwxy9BlL5kweFhp7-rfYg</string>
<string>AIzaSyBC8Jb_W3UwqIVcq9OE7WrcF3sQerxDdsQ</string>
<key>GCM_SENDER_ID</key>
<string>766000556009</string>
<string>1077101979846</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>ps.app.bond</string>
<key>PROJECT_ID</key>
<string>flutter-bond-87485</string>
<string>flutter-bond-8ae02</string>
<key>STORAGE_BUCKET</key>
<string>flutter-bond-87485.appspot.com</string>
<string>flutter-bond-8ae02.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
Expand All @@ -29,6 +25,6 @@
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:766000556009:ios:c008c663168299bed0cd78</string>
<string>1:1077101979846:ios:a2d61d584196a5be3a0fc7</string>
</dict>
</plist>
Loading

0 comments on commit 82c5d2b

Please sign in to comment.