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

feat: updated example envs and README #12027

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .android.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ android/app/_build*

# if we ever want to add google services
android/app/google-services.json
ios/GoogleService-Info.plist

# node.js
node_modules/
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=""
Copy link
Contributor

@legobeat legobeat Oct 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand this correctly?

  • GOOGLE_SERVICES_B64_ANDROID is used for android builds and not for ios builds
  • GOOGLE_SERVICES_B64_IOS is used for ios builds and not for android builds
  • they are never actually used at the same time in the same build

If so, wouldn't it be better to keep letting the build system handle this by keeping the single GOOGLE_SERVICES_B64, instead of having the dev manage 2 separate env vars?

export GOOGLE_SERVICES_B64_IOS=""
#Notifications Feature Announcements
export FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
export FEATURES_ANNOUNCEMENTS_SPACE_ID=
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,24 @@ 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 .ios.env .android.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.
**For iOS**
```bash
echo "export GOOGLE_SERVICES_B64_IOS=\"$(base64 -w0 -i ./ios/GoogleServices/GoogleService-Info-example.plist)\"" | tee -a .js.env .ios.env
```

In case of any doubt, please follow the instructions in the link below to get your Firebase project config file.
[!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.
[Firebase Project Quickstart](https://firebaseopensource.com/projects/firebase/quickstart-js/messaging/readme/#getting_started)

**Install dependencies**
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>
26 changes: 26 additions & 0 deletions ios/GoogleServices/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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>$(FCM_CONFIG_API_KEY)</string>
<key>GCM_SENDER_ID</key>
<string>$(FCM_CONFIG_MESSAGING_SENDER_ID)</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>PROJECT_ID</key>
<string>$(FCM_CONFIG_PROJECT_ID)</string>
<key>STORAGE_BUCKET</key>
<string>$(FCM_CONFIG_STORAGE_BUCKET)</string>
<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>$(FCM_CONFIG_APP_ID)</string>
</dict>
</plist>
20 changes: 14 additions & 6 deletions ios/MetaMask.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
07CBADD9D4B441008304F8D3 /* EuclidCircularB-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = A98029A3662F4C1391489A6B /* EuclidCircularB-Light.otf */; };
08B7A641467C4723B98328E9 /* CentraNo1-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = F97653CAD1D04E1B8713C428 /* CentraNo1-Medium.otf */; };
0FD509E0336BF221F6527B24 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
0FD509E0336BF221F6527B24 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
Expand Down Expand Up @@ -134,15 +134,18 @@
B339FF2E289ABD70001B89FB /* EuclidCircularB-SemiboldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 9499B01ECAC44DA29AC44E80 /* EuclidCircularB-SemiboldItalic.otf */; };
B339FF32289ABD70001B89FB /* Branch.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 153F84C92319B8DB00C19B63 /* Branch.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B339FF3C289ABF2C001B89FB /* MetaMask-QA-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B339FEA72899852C001B89FB /* MetaMask-QA-Info.plist */; };
B638844E306CAE9147B52C85 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
B638844E306CAE9147B52C85 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
BF39E5BAE0F34F9091FF6AC0 /* EuclidCircularB-Semibold.otf in Resources */ = {isa = PBXBuildFile; fileRef = A8DE9C5BC0714D648276E123 /* EuclidCircularB-Semibold.otf */; };
C8424AE42CCC01F900F0BEB7 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C8424AE32CCC01F900F0BEB7 /* GoogleService-Info.plist */; };
C8424AE52CCC01F900F0BEB7 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C8424AE32CCC01F900F0BEB7 /* GoogleService-Info.plist */; };
C8424AE62CCC01F900F0BEB7 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C8424AE32CCC01F900F0BEB7 /* 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 */; };
CF98DA9C28D9FEB700096782 /* RCTScreenshotDetect.m in Sources */ = {isa = PBXBuildFile; fileRef = CF98DA9B28D9FEB700096782 /* RCTScreenshotDetect.m */; };
CFD8DFC828EDD4C800CC75F6 /* RCTScreenshotDetect.m in Sources */ = {isa = PBXBuildFile; fileRef = CF98DA9B28D9FEB700096782 /* RCTScreenshotDetect.m */; };
D171C39A8BD44DBEB6B68480 /* EuclidCircularB-MediumItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 42CBA652072F4BE2A8B815C1 /* EuclidCircularB-MediumItalic.otf */; };
D45BF85DECACCB74EDCBE88A /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
D45BF85DECACCB74EDCBE88A /* (null) in Frameworks */ = {isa = PBXBuildFile; };
D5BA0E32DFAA451781D5093E /* CentraNo1-BoldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 4560812198A247039A1CF5A5 /* CentraNo1-BoldItalic.otf */; };
DADE8F39CE81410A98B9B805 /* MMSans-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 2EBD310362314C3ABFF40AD1 /* MMSans-Regular.otf */; };
DC6A024F56DD43E1A83B47B1 /* Roboto-MediumItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D5FF0FF1DFB74B3C8BB99E09 /* Roboto-MediumItalic.ttf */; };
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>"; };
C8424AE32CCC01F900F0BEB7 /* 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 @@ -337,9 +341,9 @@
650F2B9D24DC5FF200C3B9C4 /* libRCTAesForked.a in Frameworks */,
153C1ABB2217BCDC0088EFE0 /* JavaScriptCore.framework in Frameworks */,
153F84CA2319B8FD00C19B63 /* Branch.framework in Frameworks */,
0FD509E0336BF221F6527B24 /* BuildFile in Frameworks */,
D45BF85DECACCB74EDCBE88A /* BuildFile in Frameworks */,
B638844E306CAE9147B52C85 /* BuildFile in Frameworks */,
0FD509E0336BF221F6527B24 /* (null) in Frameworks */,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem to be artifacts left over from removed files. Let's remove all of these null lines.

D45BF85DECACCB74EDCBE88A /* (null) in Frameworks */,
B638844E306CAE9147B52C85 /* (null) in Frameworks */,
ED2E8FE6D71BE9319F3B27D3 /* libPods-MetaMask.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -533,6 +537,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
C8424AE32CCC01F900F0BEB7 /* GoogleService-Info.plist */,
2EF283352B17EC4E00D7B4B1 /* Light-Swift-Untar-V2 */,
2EF283312B17EC1A00D7B4B1 /* RNTar.m */,
2EF283292B17EBD600D7B4B1 /* RnTar.swift */,
Expand Down Expand Up @@ -765,6 +770,7 @@
EF65C42EA15B4774B1947A12 /* Roboto-Medium.ttf in Resources */,
DC6A024F56DD43E1A83B47B1 /* Roboto-MediumItalic.ttf in Resources */,
34CEE49BC79D411687B42FA9 /* Roboto-Regular.ttf in Resources */,
C8424AE62CCC01F900F0BEB7 /* GoogleService-Info.plist in Resources */,
7E08FB90F3754D47994208B4 /* Roboto-Thin.ttf in Resources */,
7C0226ABD9694AEDBAF3016F /* Roboto-ThinItalic.ttf in Resources */,
15ACC9FB226555820063978B /* LaunchScreen.xib in Resources */,
Expand Down Expand Up @@ -819,6 +825,7 @@
2EF282802B0FF86900D7B4B1 /* EuclidCircularB-BoldItalic.otf in Resources */,
2EF282812B0FF86900D7B4B1 /* EuclidCircularB-Light.otf in Resources */,
2EF282822B0FF86900D7B4B1 /* EuclidCircularB-LightItalic.otf in Resources */,
C8424AE52CCC01F900F0BEB7 /* GoogleService-Info.plist in Resources */,
2EF282832B0FF86900D7B4B1 /* EuclidCircularB-Medium.otf in Resources */,
2EF282842B0FF86900D7B4B1 /* EuclidCircularB-MediumItalic.otf in Resources */,
2EF282852B0FF86900D7B4B1 /* EuclidCircularB-Regular.otf in Resources */,
Expand All @@ -840,6 +847,7 @@
B339FF15289ABD70001B89FB /* Roboto-BlackItalic.ttf in Resources */,
B339FF16289ABD70001B89FB /* Roboto-Bold.ttf in Resources */,
B339FF17289ABD70001B89FB /* debug.xcconfig in Resources */,
C8424AE42CCC01F900F0BEB7 /* GoogleService-Info.plist in Resources */,
B339FF18289ABD70001B89FB /* Roboto-BoldItalic.ttf in Resources */,
B339FF19289ABD70001B89FB /* Roboto-Italic.ttf in Resources */,
B339FF1A289ABD70001B89FB /* Roboto-Light.ttf in Resources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<PreActions>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having the copy scripts in Xcode scripts, we could probably copy the files in build.sh instead so that we can consolidate it between platforms and would be easier to manage.

<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "cp ${SRCROOT}/GoogleServices/GoogleService-Info.plist ${SRCROOT}/GoogleService-Info.plist&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B339FEF8289ABD70001B89FB"
BuildableName = "MetaMask-QA.app"
BlueprintName = "MetaMask-QA"
ReferencedContainer = "container:MetaMask.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
<PreActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "cp ${SRCROOT}/GoogleServices/GoogleService-Info.plist ${SRCROOT}/GoogleService-Info.plist&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "MetaMask.app"
BlueprintName = "MetaMask"
ReferencedContainer = "container:MetaMask.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand Down
1 change: 1 addition & 0 deletions ios/MetaMask/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import <Firebase.h>
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>

Expand Down
3 changes: 2 additions & 1 deletion ios/MetaMask/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import "AppDelegate.h"
#import <Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
Expand All @@ -19,7 +20,7 @@
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{

[FIRApp configure];
NSString *foxCodeFromBundle = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"fox_code"];

NSString *foxCode;
Expand Down
25 changes: 19 additions & 6 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ prebuild_ios(){
# Required to install mixpanel dep
git submodule update --init --recursive
unset PREFIX
# 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/GoogleServices/GoogleService-Info.plist
echo "GoogleService-Info.plist has been created successfully."
# Ensure the file has read and write permissions
chmod 664 ./ios/GoogleServices/GoogleService-Info.plist
else
echo "GOOGLE_SERVICES_B64_IOS is not set in the .env file."
exit 1
fi
}

prebuild_android(){
Expand All @@ -190,13 +201,15 @@ prebuild_android(){
# Copy fonts with iconset
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
#Create google-services.json file to be used by the Firebase services.
# 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."
# Ensure the file has read and write permissions
chmod 664 ./android/app/google-services.json
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 +642,4 @@ else
else
envFileMissing $ANDROID_ENV_FILE
fi
fi
fi
Loading