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(ci): Expo #12244

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c36edda
Expo init & initial dependencies fixes
andrepimenta Nov 8, 2024
abcb412
Fix Minimizer
andrepimenta Nov 8, 2024
b181a1f
Fix android - expo-build-properties
andrepimenta Nov 8, 2024
f586844
Install dev client & fix iOS startup
andrepimenta Nov 8, 2024
820321f
Deeplinks working
andrepimenta Nov 8, 2024
d482e09
Update commands
andrepimenta Nov 8, 2024
b239c13
Merge branch 'main' into feat/expo
andrepimenta Nov 8, 2024
b62c24f
dedupe dependencies
andrepimenta Nov 8, 2024
537b324
Merge branch 'feat/expo' of https://github.com/MetaMask/metamask-mobi…
andrepimenta Nov 8, 2024
75f15f8
Change SWIFT_PRECOMPILE_BRIDGING_HEADER to no because of AST error
andrepimenta Nov 11, 2024
7d3908a
Update jest because of expo vector icons incompatibility
andrepimenta Nov 11, 2024
97dfdba
Test npx expo for building release
andrepimenta Nov 11, 2024
8313809
Add if debug
andrepimenta Nov 11, 2024
d629c06
Test fix iOS QA builds
andrepimenta Nov 12, 2024
15e0ff3
Fix podfile
andrepimenta Nov 12, 2024
0bee935
Update tsconfig.json
andrepimenta Nov 12, 2024
42499c2
Merge branch 'main' into feat/expo
andrepimenta Nov 12, 2024
1d9f6f0
Merge branch 'main' into feat/expo
andrepimenta Nov 12, 2024
c492be1
Update github scripts tsconfig
andrepimenta Nov 12, 2024
b0a927a
Merge branch 'feat/expo' of https://github.com/MetaMask/metamask-mobi…
andrepimenta Nov 12, 2024
8d11697
Merge branch 'main' into feat/expo
andrepimenta Nov 12, 2024
6bc1cd8
Fix gh tsconfig
andrepimenta Nov 12, 2024
4c50f3f
Merge branch 'feat/expo' of https://github.com/MetaMask/metamask-mobi…
andrepimenta Nov 12, 2024
40bd6fb
Merge branch 'main' into feat/expo
andrepimenta Nov 12, 2024
a73d485
Merge branch 'main' into feat/expo
andrepimenta Nov 13, 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
60 changes: 59 additions & 1 deletion .github/scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
{
"extends": "../../tsconfig.json"
"compilerOptions": {
/* Basic Options */
"target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": [
"es2017",
] /* Specify library files to be included in the compilation. */,
"allowJs": true /* Allow javascript files to be compiled. */,
// "checkJs": true, /* Report errors in .js files. */
"jsx": "react-native" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */
"noEmit": true /* Do not emit outputs. */,
// "incremental": true, /* Enable incremental compilation */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
"isolatedModules": true /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */,
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
"resolveJsonModule": true /* Allows importing JSON files */,
"baseUrl": "." /* Base directory to resolve non-absolute module names. */,
/* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
"skipLibCheck": true /* Skip type checking of declaration files. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
},
"exclude": [
"node_modules",
"jest.config.js"
]
}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DerivedData
project.xcworkspace
ios/debug.xcconfig
ios/release.xcconfig
.xcode.env.local

# android / intellij
build/
Expand Down Expand Up @@ -130,4 +131,8 @@ docs/assets/termsOfUse.html
android/app/src/main/assets/modules.json

# Google firebase base64 derived configs
**/GoogleService-Info.plist
**/GoogleService-Info.plist
# Expo
.expo
dist/
web-build/
5 changes: 5 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ react {
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
//
// Added by install-expo-modules
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", rootDir.getAbsoluteFile().getParentFile().getAbsolutePath(), "android", "absolute"].execute(null, rootDir).text.trim())
cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())
bundleCommand = "export:embed"
}

// Override default React Native to generate source maps for Hermes
Expand Down
7 changes: 7 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<data android:host="metamask-alternate.app.link" />
<data android:host="metamask.test-app.link" />
<data android:host="metamask-alternate.test-app.link" />
<data android:scheme="expo-metamask" />
</intent-filter>
<!-- Branch URI Scheme -->
<intent-filter>
Expand Down Expand Up @@ -114,6 +115,12 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="expo-metamask" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<!-- Explicitly opt-in to safe browsing -->
<meta-data android:name="android.webkit.WebView.EnableSafeBrowsing" android:value="true" />
Expand Down
5 changes: 3 additions & 2 deletions android/app/src/main/java/io/metamask/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.metamask;
import expo.modules.ReactActivityDelegateWrapper;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
Expand Down Expand Up @@ -62,7 +63,7 @@ public void onNewIntent(Intent intent) {
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new DefaultReactActivityDelegate(this, getMainComponentName(), DefaultNewArchitectureEntryPoint.getFabricEnabled()) {
return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(this, getMainComponentName(), DefaultNewArchitectureEntryPoint.getFabricEnabled()) {
@Override
protected Bundle getLaunchOptions() {
Bundle initialProperties = new Bundle();
Expand All @@ -73,6 +74,6 @@ protected Bundle getLaunchOptions() {
}
return initialProperties;
}
};
});
}
}
16 changes: 13 additions & 3 deletions android/app/src/main/java/io/metamask/MainApplication.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package io.metamask;
import android.content.res.Configuration;
import expo.modules.ApplicationLifecycleDispatcher;
import expo.modules.ReactNativeHostWrapper;

import android.app.Application;
import com.facebook.react.ReactApplication;
Expand Down Expand Up @@ -37,7 +40,7 @@ public String getFileProviderAuthority() {
return BuildConfig.APPLICATION_ID + ".provider";
}

private final ReactNativeHost mReactNativeHost = new DefaultReactNativeHost(this) {
private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
Expand Down Expand Up @@ -68,9 +71,9 @@ protected Boolean isHermesEnabled() {

@Override
protected String getJSMainModuleName() {
return "index";
return ".expo/.virtual-metro-entry";
}
};
});

@Override
public ReactNativeHost getReactNativeHost() {
Expand Down Expand Up @@ -112,5 +115,12 @@ public void onCreate() {
}

ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
ApplicationLifecycleDispatcher.onApplicationCreate(this);
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
}
}
2 changes: 1 addition & 1 deletion android/app/src/main/res/xml/react_native_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<domain includeSubdomains="false">10.0.2.2</domain>
<domain includeSubdomains="false">10.0.3.2</domain>
</domain-config>
<base-config cleartextTrafficPermitted="false" />
<base-config cleartextTrafficPermitted="${isDebug}" />
</network-security-config>
3 changes: 3 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
15 changes: 14 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{
"name": "MetaMask",
"displayName": "MetaMask"
"displayName": "MetaMask",
"plugins": [
[
"expo-build-properties",
{
"android": {
"extraMavenRepos": [
"../../node_modules/@notifee/react-native/android/libs"
]
},
"ios": { }
}
]
]
}
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line import/no-commonjs
module.exports = {
ignore: [/\/ses\.cjs/],
presets: ['module:metro-react-native-babel-preset'],
presets: ['babel-preset-expo'],
plugins: [
'transform-inline-environment-variables',
'react-native-reanimated/plugin',
Expand Down
1 change: 1 addition & 0 deletions ios/MetaMask-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
//

#import <React/RCTBridgeModule.h>
#import <Expo/Expo.h>
Loading
Loading