Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adds GoogleService.plist creation during build process #11863

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
bc5ebcb
Remove old google files
cortisiko Oct 16, 2024
168b1db
add build step for copying
Jonathansoufer Oct 18, 2024
5acf4da
create separated folder for Google Services
Jonathansoufer Oct 18, 2024
aa87720
update documentation
Jonathansoufer Oct 18, 2024
bbf78d8
add mocked plist
Jonathansoufer Oct 18, 2024
2aa558c
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 18, 2024
5fbffb0
fix typo
Jonathansoufer Oct 18, 2024
45c7f46
Merge branch 'NOTIFY-1236/add-GoogleService.plist-build-process' of g…
Jonathansoufer Oct 18, 2024
3117fae
add plist resource on ios
Jonathansoufer Oct 18, 2024
6208509
fix path
Jonathansoufer Oct 18, 2024
e82be19
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 18, 2024
99dc3a2
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 19, 2024
ad20caf
fix iOs build
Jonathansoufer Oct 20, 2024
d945069
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 21, 2024
b050e4b
add iOS pre build actions
Jonathansoufer Oct 21, 2024
47c8207
Merge branch 'NOTIFY-1236/add-GoogleService.plist-build-process' of g…
Jonathansoufer Oct 21, 2024
90335e3
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 21, 2024
8be4229
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 21, 2024
50820fb
add preBuild script
Jonathansoufer Oct 22, 2024
fd5d297
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 22, 2024
d674024
update iOS schema
Jonathansoufer Oct 23, 2024
5a56ac3
Merge branch 'NOTIFY-1236/add-GoogleService.plist-build-process' of g…
Jonathansoufer Oct 23, 2024
8adad71
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 23, 2024
6a5c3f6
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 23, 2024
8117c03
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 23, 2024
6d03751
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 23, 2024
56dc31e
update README
Jonathansoufer Oct 23, 2024
2e9b675
Merge branch 'NOTIFY-1236/add-GoogleService.plist-build-process' of g…
Jonathansoufer Oct 23, 2024
fc72fd8
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 24, 2024
cd6f12b
remove pre build stage
Jonathansoufer Oct 24, 2024
7f67b1e
Merge branch 'NOTIFY-1236/add-GoogleService.plist-build-process' of g…
Jonathansoufer Oct 24, 2024
e053c6e
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 24, 2024
0e0a6f7
Merge branch 'main' into NOTIFY-1236/add-GoogleService.plist-build-pr…
Jonathansoufer Oct 24, 2024
6980e0d
add model of GoogleService file
Jonathansoufer Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .android.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export FCM_CONFIG_PROJECT_ID=
export FCM_CONFIG_STORAGE_BUCKET=
export FCM_CONFIG_MESSAGING_SENDER_ID=
export FCM_CONFIG_APP_ID=
export GOOGLE_SERVICES_B64=
export GOOGLE_SERVICES_B64_ANDROID=

#Notifications Feature Announcements
export FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
export FEATURES_ANNOUNCEMENTS_SPACE_ID=
Expand Down
2 changes: 1 addition & 1 deletion .ios.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FCM_CONFIG_PROJECT_ID=
FCM_CONFIG_STORAGE_BUCKET=
FCM_CONFIG_MESSAGING_SENDER_ID=
FCM_CONFIG_APP_ID=
GOOGLE_SERVICES_B64=
GOOGLE_SERVICES_B64_IOS=
#Notifications Feature Announcements
FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
FEATURES_ANNOUNCEMENTS_SPACE_ID=
3 changes: 2 additions & 1 deletion .js.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export FCM_CONFIG_PROJECT_ID=""
export FCM_CONFIG_STORAGE_BUCKET=""
export FCM_CONFIG_MESSAGING_SENDER_ID=""
export FCM_CONFIG_APP_ID=""
export GOOGLE_SERVICES_B64=""
export GOOGLE_SERVICES_B64_ANDROID=""
export GOOGLE_SERVICES_B64_IOS=""
#Notifications Feature Announcements
export FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
export FEATURES_ANNOUNCEMENTS_SPACE_ID=
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,21 @@ cd metamask-mobile

**Firebase Messaging Setup**

Before running the app, keep in mind that MetaMask uses FCM (Firebase Cloud Message) to empower communications. Based on this, as an external contributor you would preferably need to provide your own FREE Firebase project config file with a matching client for package name `io.metamask`, and update your `google-services.json` file in the `android/app` directory as well your `.env` files (`.ios.env`, `.js.env`, `.android.env`), adding `GOOGLE_SERVICES_B64` variable depending on the environment you are running the app (ios/android).
Before running the app, keep in mind that MetaMask uses FCM (Firebase Cloud Message) to empower communications. Based on this, as an external contributor you would preferably need to provide your own FREE Firebase project config file with a matching client for package name `io.metamask`, and update your `google-services.json` file in the `android/app` or `GoogleService-Info.plist` file in the `ios` directory. In case you don't have FCM account, you can use `./android/app/google-services-example.json` for Android or `./ios/GoogleServices/GoogleService-Info-example.plist` for iOS and follow the steps below to populate the correct environment variables in the `.env` files (`.ios.env`, `.js.env`, `.android.env`), adding `GOOGLE_SERVICES_B64_ANDROID` or `GOOGLE_SERVICES_B64_IOS` variable depending on the environment you are running the app (ios/android).

ATTENTION: In case you don't provide your own Firebase project config file, you can make use of a mock file at `android/app/google-services-example.json`, following the steps below from the root of the project:
The value you should provide to `GOOGLE_SERVICES_B64_ANDROID` or `GOOGLE_SERVICES_B64_IOS` is the base64 encoded version of your Firebase project config file, which can be generated as follows:

**For Android**
```bash
echo "export GOOGLE_SERVICES_B64=\"$(base64 -w0 -i ./android/app/google-services-example.json)\"" | tee -a .js.env .ios.env .android.env
echo "export GOOGLE_SERVICES_B64_ANDROID=\"$(base64 -w0 -i ./android/app/google-services-example.json)\"" | tee -a .js.env .android.env
```
**For iOS**
```bash
echo "export GOOGLE_SERVICES_B64_IOS=\"$(base64 -w0 -i ./ios/GoogleServices/GoogleService-Info-example.plist)\"" | tee -a .js.env .ios.env
```

You can make usage of a mock file at `android/app/google-services-example.json`, following the same steps above from the root of the project.
> [!CAUTION]
> In case you don't provide your own Firebase project config file or run the steps above, you will face the error `No matching client found for package name 'io.metamask'`.

In case of any doubt, please follow the instructions in the link below to get your Firebase project config file.

Expand Down
30 changes: 30 additions & 0 deletions ios/GoogleServices/GoogleService-Info-example.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>mock-api-key-1234</string>
<key>GCM_SENDER_ID</key>
<string>mock-gcm-sender-id-1234</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>io.metamask.MetaMask</string>
<key>PROJECT_ID</key>
<string>mockproject-1234</string>
<key>STORAGE_BUCKET</key>
<string>mock-storage-bucket-1234.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>mock-google-app-id-1234</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions ios/MetaMask.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
B339FF3C289ABF2C001B89FB /* MetaMask-QA-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B339FEA72899852C001B89FB /* MetaMask-QA-Info.plist */; };
B638844E306CAE9147B52C85 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
BF39E5BAE0F34F9091FF6AC0 /* EuclidCircularB-Semibold.otf in Resources */ = {isa = PBXBuildFile; fileRef = A8DE9C5BC0714D648276E123 /* EuclidCircularB-Semibold.otf */; };
C8D12C552CC27D9600A1EA42 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C8D12C542CC27D9600A1EA42 /* GoogleService-Info.plist */; };
C8D12C562CC27D9600A1EA42 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C8D12C542CC27D9600A1EA42 /* GoogleService-Info.plist */; };
C8D12C572CC27D9600A1EA42 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C8D12C542CC27D9600A1EA42 /* GoogleService-Info.plist */; };
CD13D926E1E84D9ABFE672C0 /* Roboto-BlackItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3E2492C67CF345CABD7B8601 /* Roboto-BlackItalic.ttf */; };
CF9895772A3B49BE00B4C9B5 /* RCTMinimizer.m in Sources */ = {isa = PBXBuildFile; fileRef = CF9895762A3B49BE00B4C9B5 /* RCTMinimizer.m */; };
CF9895782A3B49BE00B4C9B5 /* RCTMinimizer.m in Sources */ = {isa = PBXBuildFile; fileRef = CF9895762A3B49BE00B4C9B5 /* RCTMinimizer.m */; };
Expand Down Expand Up @@ -302,6 +305,7 @@
BCC95B62DD6241678CDF73B3 /* CentraNo1-BookItalic.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "CentraNo1-BookItalic.otf"; path = "../app/fonts/CentraNo1-BookItalic.otf"; sourceTree = "<group>"; };
BF485CDA047B4D52852B87F5 /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; };
C752564A28B44392AEE16BD5 /* Roboto-Medium.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Roboto-Medium.ttf"; path = "../app/fonts/Roboto-Medium.ttf"; sourceTree = "<group>"; };
C8D12C542CC27D9600A1EA42 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
C9FD3FB1258A41A5A0546C83 /* Roboto-BoldItalic.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Roboto-BoldItalic.ttf"; path = "../app/fonts/Roboto-BoldItalic.ttf"; sourceTree = "<group>"; };
CE0434C5FB7C4C6F9FEBDCE2 /* EuclidCircularB-Medium.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "EuclidCircularB-Medium.otf"; path = "../app/fonts/EuclidCircularB-Medium.otf"; sourceTree = "<group>"; };
CF014205BB8964CFE74D4D8E /* Pods-MetaMask-QA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MetaMask-QA.release.xcconfig"; path = "Target Support Files/Pods-MetaMask-QA/Pods-MetaMask-QA.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -391,6 +395,7 @@
13B07FAE1A68108700A75B9A /* MetaMask */ = {
isa = PBXGroup;
children = (
C8FB8D032CC26E2500198964 /* GoogleServices */,
E83DB5392BBDB14700536063 /* PrivacyInfo.xcprivacy */,
B339FEA72899852C001B89FB /* MetaMask-QA-Info.plist */,
AA9EDF17249955C7005D89EE /* MetaMaskDebug.entitlements */,
Expand Down Expand Up @@ -533,6 +538,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
C8D12C542CC27D9600A1EA42 /* GoogleService-Info.plist */,
2EF283352B17EC4E00D7B4B1 /* Light-Swift-Untar-V2 */,
2EF283312B17EC1A00D7B4B1 /* RNTar.m */,
2EF283292B17EBD600D7B4B1 /* RnTar.swift */,
Expand Down Expand Up @@ -577,6 +583,13 @@
path = Pods;
sourceTree = "<group>";
};
C8FB8D032CC26E2500198964 /* GoogleServices */ = {
isa = PBXGroup;
children = (
);
path = GoogleServices;
sourceTree = "<group>";
};
CF9895742A3B48DC00B4C9B5 /* RCTMinimizer */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -786,6 +799,7 @@
08B7A641467C4723B98328E9 /* CentraNo1-Medium.otf in Resources */,
7F5D30C6178D467D96653D0F /* CentraNo1-MediumItalic.otf in Resources */,
3466654F43654D36B5D478CA /* config.json in Resources */,
C8D12C572CC27D9600A1EA42 /* GoogleService-Info.plist in Resources */,
DADE8F39CE81410A98B9B805 /* MMSans-Regular.otf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -802,6 +816,7 @@
2EF2826F2B0FF86900D7B4B1 /* Roboto-BlackItalic.ttf in Resources */,
E83DB5542BBDF2AF00536063 /* PrivacyInfo.xcprivacy in Resources */,
2EF282702B0FF86900D7B4B1 /* Roboto-Bold.ttf in Resources */,
C8D12C562CC27D9600A1EA42 /* GoogleService-Info.plist in Resources */,
2EF282712B0FF86900D7B4B1 /* debug.xcconfig in Resources */,
2EF282722B0FF86900D7B4B1 /* Roboto-BoldItalic.ttf in Resources */,
2EF282732B0FF86900D7B4B1 /* Roboto-Italic.ttf in Resources */,
Expand Down Expand Up @@ -860,6 +875,7 @@
B339FF29289ABD70001B89FB /* EuclidCircularB-Medium.otf in Resources */,
B339FF2A289ABD70001B89FB /* EuclidCircularB-MediumItalic.otf in Resources */,
B339FF3C289ABF2C001B89FB /* MetaMask-QA-Info.plist in Resources */,
C8D12C552CC27D9600A1EA42 /* GoogleService-Info.plist in Resources */,
B339FF2B289ABD70001B89FB /* EuclidCircularB-Regular.otf in Resources */,
B339FF2C289ABD70001B89FB /* EuclidCircularB-RegularItalic.otf in Resources */,
B339FF2D289ABD70001B89FB /* EuclidCircularB-Semibold.otf in Resources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2EF282522B0FF86900D7B4B1"
BuildableName = "MetaMask-Flask.app"
BlueprintName = "MetaMask-Flask"
ReferencedContainer = "container:MetaMask.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2EF282522B0FF86900D7B4B1"
BuildableName = "MetaMask-Flask.app"
BlueprintName = "MetaMask-Flask"
ReferencedContainer = "container:MetaMask.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2EF282522B0FF86900D7B4B1"
BuildableName = "MetaMask-Flask.app"
BlueprintName = "MetaMask-Flask"
ReferencedContainer = "container:MetaMask.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
21 changes: 16 additions & 5 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ prebuild_ios(){
echo "" > ios/debug.xcconfig
echo "" > ios/release.xcconfig
fi

#Create GoogleService-Info.plist file to be used by the Firebase services.
# Check if GOOGLE_SERVICES_B64_IOS is set
if [ ! -z "$GOOGLE_SERVICES_B64_IOS" ]; then
echo -n $GOOGLE_SERVICES_B64_IOS | base64 -d > ./ios/GoogleService-Info.plist
echo "GoogleService-Info.plist has been created successfully."
else
echo "GOOGLE_SERVICES_B64_IOS is not set in the .env file."
exit 1
fi

# Required to install mixpanel dep
git submodule update --init --recursive
unset PREFIX
Expand All @@ -191,12 +202,12 @@ prebuild_android(){
yes | cp -rf ./app/fonts/Metamask.ttf ./android/app/src/main/assets/fonts/Metamask.ttf

#Create google-services.json file to be used by the Firebase services.
# Check if GOOGLE_SERVICES_B64 is set
if [ ! -z "$GOOGLE_SERVICES_B64" ]; then
echo -n $GOOGLE_SERVICES_B64 | base64 -d > ./android/app/google-services.json
# Check if GOOGLE_SERVICES_B64_ANDROID is set
if [ ! -z "$GOOGLE_SERVICES_B64_ANDROID" ]; then
echo -n $GOOGLE_SERVICES_B64_ANDROID | base64 -d > ./android/app/google-services.json
echo "google-services.json has been created successfully."
else
echo "GOOGLE_SERVICES_B64 is not set in the .env file."
echo "GOOGLE_SERVICES_B64_ANDROID is not set in the .env file."
exit 1
fi

Expand Down Expand Up @@ -629,4 +640,4 @@ else
else
envFileMissing $ANDROID_ENV_FILE
fi
fi
fi
Loading