Fix mixed tabs and spaces (#1379)

Tabs are now used consistently in any files that had previously been a
mix of tabs and spaces.
pull/1337/head^2
Mark Stacey 3 years ago committed by GitHub
parent ca8a624960
commit 9f9a1121c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 274
      android/app/build.gradle
  2. 12
      android/app/src/androidTest/java/com/metamask/DetoxTest.java
  3. 244
      android/app/src/main/AndroidManifest.xml
  4. 48
      android/app/src/main/java/io/metamask/MainActivity.java
  5. 62
      android/app/src/main/java/io/metamask/MainApplication.java
  6. 14
      android/app/src/main/java/io/metamask/SplashActivity.java
  7. 266
      android/app/src/main/java/io/metamask/nativeModules/RCTAnalytics.java
  8. 22
      android/app/src/main/java/io/metamask/nativeModules/RCTAnalyticsPackage.java
  9. 14
      android/app/src/main/res/drawable/background_splash.xml
  10. 4
      android/app/src/main/res/values/colors.xml
  11. 2
      android/app/src/main/res/values/strings.xml
  12. 18
      android/app/src/main/res/values/styles.xml
  13. 10
      android/app/src/main/res/xml/react_native_config.xml
  14. 80
      android/build.gradle
  15. 32
      app/util/browserScripts.js
  16. 196
      ios/MetaMask.xcodeproj/xcshareddata/xcschemes/MetaMask.xcscheme
  17. 40
      ios/MetaMask/Base.lproj/LaunchScreen.xib
  18. 16
      ios/fastlane/Fastfile
  19. 82
      scripts/auto-changelog.sh
  20. 121
      scripts/build.sh
  21. 16
      shim.js

@ -1,6 +1,6 @@
def getPassword(String currentUser, String keyChain) {
def stdout = new ByteArrayOutputStream()
def stderr = new ByteArrayOutputStream()
def stdout = new ByteArrayOutputStream()
def stderr = new ByteArrayOutputStream()
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
exec {
commandLine 'security', '-q', 'find-generic-password', '-a', currentUser, '-s', keyChain, '-w'
@ -12,7 +12,7 @@ def getPassword(String currentUser, String keyChain) {
exec {
// In order for this to work you need to store it:
// secret-tool store --label='mm' server mm user mm key mm-upload-key
commandLine 'secret-tool', 'lookup', 'server', currentUser, 'user', currentUser, 'key', keyChain
commandLine 'secret-tool', 'lookup', 'server', currentUser, 'user', currentUser, 'key', keyChain
standardOutput = stdout
errorOutput = stderr
ignoreExitValue true
@ -20,23 +20,23 @@ def getPassword(String currentUser, String keyChain) {
} else {
throw new GradleException('Unsupported OS! Only MacOSx and Linux are supported')
}
//noinspection GroovyAssignabilityCheck
stdout.toString().trim()
//noinspection GroovyAssignabilityCheck
stdout.toString().trim()
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: "com.android.application"
@ -45,7 +45,7 @@ apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
@ -76,8 +76,8 @@ import com.android.build.OutputFile
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
@ -86,8 +86,8 @@ import com.android.build.OutputFile
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
@ -122,7 +122,7 @@ import com.android.build.OutputFile
*/
project.ext.react = [
entryFile: "index.js"
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
@ -147,13 +147,13 @@ def enableProguardInReleaseBuilds = false
* override fabric properties file if MM_FABRIC_API_KEY is set
*/
def buildFabricPropertiesIfNeeded() {
def FABRIC_API_KEY = System.getenv('MM_FABRIC_API_KEY')
if (FABRIC_API_KEY) {
def commentMessage = "AUTOGEN FABRIC PROPERTIES"
ant.propertyfile(file: "fabric.properties", comment: commentMessage) {
entry(key: "apiKey", value: FABRIC_API_KEY)
}
}
def FABRIC_API_KEY = System.getenv('MM_FABRIC_API_KEY')
if (FABRIC_API_KEY) {
def commentMessage = "AUTOGEN FABRIC PROPERTIES"
ant.propertyfile(file: "fabric.properties", comment: commentMessage) {
entry(key: "apiKey", value: FABRIC_API_KEY)
}
}
}
android {
@ -163,138 +163,138 @@ android {
buildFabricPropertiesIfNeeded()
}
compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 26
versionName "0.2.13"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
dexOptions {
javaMaxHeapSize "2048M"
}
manifestPlaceholders = [
MM_BRANCH_KEY_TEST: "$System.env.MM_BRANCH_KEY_TEST",
MM_BRANCH_KEY_LIVE: "$System.env.MM_BRANCH_KEY_LIVE",
MM_MIXPANEL_TOKEN: "$System.env.MM_MIXPANEL_TOKEN"
]
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 26
versionName "0.2.13"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
dexOptions {
javaMaxHeapSize "2048M"
}
manifestPlaceholders = [
MM_BRANCH_KEY_TEST: "$System.env.MM_BRANCH_KEY_TEST",
MM_BRANCH_KEY_LIVE: "$System.env.MM_BRANCH_KEY_LIVE",
MM_MIXPANEL_TOKEN: "$System.env.MM_MIXPANEL_TOKEN"
]
missingDimensionStrategy 'react-native-camera', 'general'
}
}
signingConfigs {
def pass = getPassword("mm","mm-upload-key")
release {
storeFile file('../keystores/release.keystore')
storePassword pass
keyAlias 'key0'
keyPassword pass
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
buildTypes {
debug {
manifestPlaceholders = [isDebug:true]
}
release {
manifestPlaceholders = [isDebug:false]
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
release {
storeFile file('../keystores/release.keystore')
storePassword pass
keyAlias 'key0'
keyPassword pass
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
buildTypes {
debug {
manifestPlaceholders = [isDebug:true]
}
release {
manifestPlaceholders = [isDebug:false]
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
buildTypes.each {
it.buildConfigField 'String', 'foxCode', "\"$System.env.MM_FOX_CODE\""
it.buildConfigField 'String', 'foxCode', "\"$System.env.MM_FOX_CODE\""
}
packagingOptions {
// Make sure libjsc.so does not packed in APK
exclude "**/libjsc.so"
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-sensors')
implementation project(':react-native-reanimated')
implementation project(':react-native-webview')
implementation project(':react-native-fabric')
implementation project(':@react-native-community_netinfo')
implementation project(':react-native-view-shot')
implementation project(':lottie-react-native')
implementation project(':@react-native-community_async-storage')
implementation project(':react-native-push-notification')
implementation project(':react-native-background-timer')
implementation project(':react-native-device-info')
implementation project(':react-native-svg')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-screens')
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'org.chromium:v8-android:7.8.+'
implementation project(':react-native-branch')
implementation project(':react-native-sensors')
implementation project(':react-native-reanimated')
implementation project(':react-native-webview')
implementation project(':react-native-fabric')
implementation project(':@react-native-community_netinfo')
implementation project(':react-native-view-shot')
implementation project(':lottie-react-native')
implementation project(':@react-native-community_async-storage')
implementation project(':react-native-push-notification')
implementation project(':react-native-background-timer')
implementation project(':react-native-device-info')
implementation project(':react-native-svg')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-screens')
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'org.chromium:v8-android:7.8.+'
implementation project(':react-native-branch')
implementation "io.branch.sdk.android:library:4.1.2"
implementation project(':react-native-camera')
implementation project(':react-native-share')
implementation project(':react-native-i18n')
implementation project(':react-native-aes-crypto')
implementation project(':react-native-keychain')
implementation project(':react-native-os')
implementation project(':react-native-randombytes')
implementation project(':react-native-fs')
implementation project(':react-native-vector-icons')
implementation project(':react-native-camera')
implementation project(':react-native-share')
implementation project(':react-native-i18n')
implementation project(':react-native-aes-crypto')
implementation project(':react-native-keychain')
implementation project(':react-native-os')
implementation project(':react-native-randombytes')
implementation project(':react-native-fs')
implementation project(':react-native-vector-icons')
implementation 'com.mixpanel.android:mixpanel-android:5.+'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
transitive = true;
}
androidTestImplementation('com.wix:detox:+') { transitive = true }
androidTestImplementation 'junit:junit:4.12'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
transitive = true;
}
androidTestImplementation('com.wix:detox:+') { transitive = true }
androidTestImplementation 'junit:junit:4.12'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
from configurations.compile
into 'libs'
}

@ -14,11 +14,11 @@ import androidx.test.rule.ActivityTestRule;
@LargeTest
public class DetoxTest {
@Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
@Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
@Test
public void runDetoxTests() {
Detox.runTests(mActivityRule);
}
@Test
public void runDetoxTests() {
Detox.runTests(mActivityRule);
}
}

@ -1,135 +1,137 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.metamask"
package="io.metamask"
xmlns:tools="http://schemas.android.com/tools"
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-sdk tools:overrideLibrary="com.tectiv3.aes" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-sdk tools:overrideLibrary="com.tectiv3.aes" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:hardwareAccelerated="true"
android:usesCleartextTraffic="${isDebug}"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning"
android:networkSecurityConfig="@xml/react_native_config"
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:hardwareAccelerated="true"
android:usesCleartextTraffic="${isDebug}"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning"
android:networkSecurityConfig="@xml/react_native_config"
>
<activity
android:launchMode="singleTask"
android:name=".SplashActivity"
android:theme="@style/SplashTheme"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:launchMode="singleTask"
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Branch URI Scheme -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="metamask.app.link" />
<data android:scheme="https" android:host="metamask-alternate.app.link" />
<data android:scheme="https" android:host="metamask.test-app.link" />
<data android:scheme="https" android:host="metamask-alternate.test-app.link" />
</intent-filter>
<intent-filter>
<data android:scheme="metamask" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="ethereum" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="dapp" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="wc" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="https" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<activity
android:launchMode="singleTask"
android:name=".SplashActivity"
android:theme="@style/SplashTheme"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:launchMode="singleTask"
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Branch URI Scheme -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="metamask.app.link" />
<data android:scheme="https" android:host="metamask-alternate.app.link" />
<data android:scheme="https" android:host="metamask.test-app.link" />
<data android:scheme="https" android:host="metamask-alternate.test-app.link" />
</intent-filter>
<intent-filter>
<data android:scheme="metamask" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="ethereum" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="dapp" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="wc" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data android:scheme="https" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<!-- Branch App Links (optional) -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="metamask.io" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<!-- Branch init -->
<meta-data android:name="io.branch.sdk.BranchKey" android:value="${MM_BRANCH_KEY_LIVE}" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="${MM_BRANCH_KEY_TEST}" />
<meta-data android:name="io.branch.sdk.TestMode" android:value="false" />
<!-- PUSH NOTIFICATIONS -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name"
<!-- Branch App Links (optional) -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="metamask.io" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<!-- Branch init -->
<meta-data android:name="io.branch.sdk.BranchKey" android:value="${MM_BRANCH_KEY_LIVE}" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="${MM_BRANCH_KEY_TEST}" />
<meta-data android:name="io.branch.sdk.TestMode" android:value="false" />
<!-- PUSH NOTIFICATIONS -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name"
android:value="io.metamask"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description"
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description"
android:value="io.metamask"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@color/lightgray"/>
<!-- MIXPANEL -->
<meta-data android:name="com.mixpanel.android.mpmetrics.MixpanelAPI.token" android:value="${MM_MIXPANEL_TOKEN}" />
<!-- MIXPANEL -->
<meta-data android:name="com.mixpanel.android.mpmetrics.MixpanelAPI.token" android:value="${MM_MIXPANEL_TOKEN}" />
<!-- Branch install referrer tracking (optional) -->
<receiver android:name="io.branch.referral.InstallListener" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="io.metamask.provider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
</application>
<!-- Branch install referrer tracking (optional) -->
<receiver android:name="io.branch.referral.InstallListener" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="io.metamask.provider"
android:grantUriPermissions="true"
android:exported="false"
>
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths"
/>
</provider>
</application>
</manifest>

@ -18,13 +18,13 @@ import androidx.annotation.NonNull;
public class MainActivity extends ReactFragmentActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "MetaMask";
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "MetaMask";
}
// Override onStart, onNewIntent:
@ -53,24 +53,24 @@ public class MainActivity extends ReactFragmentActivity {
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@NonNull
@Override
protected Bundle getLaunchOptions() {
Bundle bundle = new Bundle();
if(BuildConfig.foxCode != null){
bundle.putString("foxCode", BuildConfig.foxCode);
} else {
bundle.putString("foxCode", "debug");
}
return bundle;
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@NonNull
@Override
protected Bundle getLaunchOptions() {
Bundle bundle = new Bundle();
if(BuildConfig.foxCode != null){
bundle.putString("foxCode", BuildConfig.foxCode);
} else {
bundle.putString("foxCode", "debug");
}
return bundle;
}
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}

@ -49,39 +49,39 @@ public class MainApplication extends MultiDexApplication implements ShareApplica
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNSensorsPackage(),
new ReanimatedPackage(),
new RNCWebViewPackage(),
new FabricPackage(),
new NetInfoPackage(),
new RNViewShotPackage(),
new LottiePackage(),
new AsyncStoragePackage(),
new ReactNativePushNotificationPackage(),
new BackgroundTimerPackage(),
new RNDeviceInfo(),
new SvgPackage(),
new RNGestureHandlerPackage(),
new RNScreensPackage(),
new RNBranchPackage(),
new KeychainPackage(),
new RandomBytesPackage(),
new RCTAesPackage(),
new RNCameraPackage(),
new RNFSPackage(),
new RNI18nPackage(),
new RNOSModule(),
new RNSharePackage(),
new VectorIconsPackage(),
new RCTAnalyticsPackage()
new MainReactPackage(),
new RNSensorsPackage(),
new ReanimatedPackage(),
new RNCWebViewPackage(),
new FabricPackage(),
new NetInfoPackage(),
new RNViewShotPackage(),
new LottiePackage(),
new AsyncStoragePackage(),
new ReactNativePushNotificationPackage(),
new BackgroundTimerPackage(),
new RNDeviceInfo(),
new SvgPackage(),
new RNGestureHandlerPackage(),
new RNScreensPackage(),
new RNBranchPackage(),
new KeychainPackage(),
new RandomBytesPackage(),
new RCTAesPackage(),
new RNCameraPackage(),
new RNFSPackage(),
new RNI18nPackage(),
new RNOSModule(),
new RNSharePackage(),
new VectorIconsPackage(),
new RCTAnalyticsPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
}
};
@Override
@ -97,8 +97,8 @@ public class MainApplication extends MultiDexApplication implements ShareApplica
SoLoader.init(this, /* native exopackage */ false);
}
@Override
public String getFileProviderAuthority() {
return BuildConfig.APPLICATION_ID + ".provider";
}
@Override
public String getFileProviderAuthority() {
return BuildConfig.APPLICATION_ID + ".provider";
}
}

@ -5,12 +5,12 @@ import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}

@ -28,161 +28,161 @@ import io.fabric.sdk.android.Fabric;
public class RCTAnalytics extends ReactContextBaseJavaModule {
MixpanelAPI mixpanel;
private static Tweak<String> remoteVariables = MixpanelAPI.stringTweak("remoteVariables","{}");
private static Tweak<String> remoteVariables = MixpanelAPI.stringTweak("remoteVariables","{}");
public RCTAnalytics(ReactApplicationContext reactContext) {
super(reactContext);
try{
ApplicationInfo ai = reactContext.getPackageManager().getApplicationInfo(reactContext.getPackageName(), PackageManager.GET_META_DATA);
String mixpanelToken = (String)ai.metaData.get("com.mixpanel.android.mpmetrics.MixpanelAPI.token");
this.mixpanel =
MixpanelAPI.getInstance(reactContext, mixpanelToken);
public RCTAnalytics(ReactApplicationContext reactContext) {
super(reactContext);
try{
ApplicationInfo ai = reactContext.getPackageManager().getApplicationInfo(reactContext.getPackageName(), PackageManager.GET_META_DATA);
String mixpanelToken = (String)ai.metaData.get("com.mixpanel.android.mpmetrics.MixpanelAPI.token");
this.mixpanel =
MixpanelAPI.getInstance(reactContext, mixpanelToken);
}catch (PackageManager.NameNotFoundException e){
Log.d("RCTAnalytics","init:token missing");
}
}
}catch (PackageManager.NameNotFoundException e){
Log.d("RCTAnalytics","init:token missing");
}
}
@Override
public String getName() {
return "Analytics";
}
@Override
public String getName() {
return "Analytics";
}
@ReactMethod
public void trackEvent(ReadableMap e) {
@ReactMethod
public void trackEvent(ReadableMap e) {
String eventCategory = e.getString("category");
JSONObject props = toJSONObject(e);
props.remove("category");
this.mixpanel.track(eventCategory, props);
}
}
@ReactMethod
public void optIn(boolean val) {
public void optIn(boolean val) {
if(val){
if(val){
this.mixpanel.optInTracking();
Fabric.with(this.getReactApplicationContext(), new Crashlytics());
Fabric.with(this.getReactApplicationContext(), new Crashlytics());
}else{
this.mixpanel.optOutTracking();
}
}
}
@ReactMethod
public void getRemoteVariables(Promise promise) {
try{
String vars = remoteVariables.get();
promise.resolve(vars);
} catch (Error e){
promise.reject(e);
}
@ReactMethod
public void getRemoteVariables(Promise promise) {
try{
String vars = remoteVariables.get();
promise.resolve(vars);
} catch (Error e){
promise.reject(e);
}
}
}
private JSONObject toJSONObject(ReadableMap readableMap){
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
JSONObject map = new JSONObject();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
try{
switch (readableMap.getType(key)) {
case Null:
map.put(key, null);
break;
case Boolean:
map.put(key, readableMap.getBoolean(key));
break;
case Number:
map.put(key, readableMap.getDouble(key));
break;
case String:
map.put(key, readableMap.getString(key));
break;
case Map:
map.put(key, toHashMap(readableMap.getMap(key)));
break;
case Array:
map.put(key, toArrayList(readableMap.getArray(key)));
break;
default:
throw new IllegalArgumentException("Could not convert object with key: " + key + ".");
}
}catch(JSONException e){
Log.d("RCTAnalytics","JSON parse error");
}
}
return map;
}
private HashMap<String, Object> toHashMap(ReadableMap readableMap){
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
HashMap<String, Object> hashMap = new HashMap<>();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
switch (readableMap.getType(key)) {
case Null:
hashMap.put(key, null);
break;
case Boolean:
hashMap.put(key, readableMap.getBoolean(key));
break;
case Number:
hashMap.put(key, readableMap.getDouble(key));
break;
case String:
hashMap.put(key, readableMap.getString(key));
break;
case Map:
hashMap.put(key, toHashMap(readableMap.getMap(key)));
break;
case Array:
hashMap.put(key, toArrayList(readableMap.getArray(key)));
break;
default:
throw new IllegalArgumentException("Could not convert object with key: " + key + ".");
}
}
return hashMap;
}
private ArrayList<Object> toArrayList(ReadableArray readableArray) {
ArrayList<Object> arrayList = new ArrayList<>();
for (int i = 0; i < readableArray.size(); i++) {
switch (readableArray.getType(i)) {
case Null:
arrayList.add(null);
break;
case Boolean:
arrayList.add(readableArray.getBoolean(i));
break;
case Number:
arrayList.add(readableArray.getDouble(i));
break;
case String:
arrayList.add(readableArray.getString(i));
break;
case Map:
arrayList.add(toHashMap(readableArray.getMap(i)));
break;
case Array:
arrayList.add(toArrayList(readableArray.getArray(i)));
break;
default:
throw new IllegalArgumentException("Could not convert object at index: " + i + ".");
}
}
return arrayList;
}
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
JSONObject map = new JSONObject();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
try{
switch (readableMap.getType(key)) {
case Null:
map.put(key, null);
break;
case Boolean:
map.put(key, readableMap.getBoolean(key));
break;
case Number:
map.put(key, readableMap.getDouble(key));
break;
case String:
map.put(key, readableMap.getString(key));
break;
case Map:
map.put(key, toHashMap(readableMap.getMap(key)));
break;
case Array:
map.put(key, toArrayList(readableMap.getArray(key)));
break;
default:
throw new IllegalArgumentException("Could not convert object with key: " + key + ".");
}
}catch(JSONException e){
Log.d("RCTAnalytics","JSON parse error");
}
}
return map;
}
private HashMap<String, Object> toHashMap(ReadableMap readableMap){
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
HashMap<String, Object> hashMap = new HashMap<>();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
switch (readableMap.getType(key)) {
case Null:
hashMap.put(key, null);
break;
case Boolean:
hashMap.put(key, readableMap.getBoolean(key));
break;
case Number:
hashMap.put(key, readableMap.getDouble(key));
break;
case String:
hashMap.put(key, readableMap.getString(key));
break;
case Map:
hashMap.put(key, toHashMap(readableMap.getMap(key)));
break;
case Array:
hashMap.put(key, toArrayList(readableMap.getArray(key)));
break;
default:
throw new IllegalArgumentException("Could not convert object with key: " + key + ".");
}
}
return hashMap;
}
private ArrayList<Object> toArrayList(ReadableArray readableArray) {
ArrayList<Object> arrayList = new ArrayList<>();
for (int i = 0; i < readableArray.size(); i++) {
switch (readableArray.getType(i)) {
case Null:
arrayList.add(null);
break;
case Boolean:
arrayList.add(readableArray.getBoolean(i));
break;
case Number:
arrayList.add(readableArray.getDouble(i));
break;
case String:
arrayList.add(readableArray.getString(i));
break;
case Map:
arrayList.add(toHashMap(readableArray.getMap(i)));
break;
case Array:
arrayList.add(toArrayList(readableArray.getArray(i)));
break;
default:
throw new IllegalArgumentException("Could not convert object at index: " + i + ".");
}
}
return arrayList;
}
}

@ -11,19 +11,19 @@ import java.util.List;
public class RCTAnalyticsPackage implements ReactPackage {
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new RCTAnalytics(reactContext));
modules.add(new RCTAnalytics(reactContext));
return modules;
}
return modules;
}
}

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/white"/>
<item
android:drawable="@color/white"/>
<item
android:width="200dp"
android:height="200dp"
android:drawable="@mipmap/splash"
android:gravity="center" />
<item
android:width="200dp"
android:height="200dp"
android:drawable="@mipmap/splash"
android:gravity="center" />
</layer-list>

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white">#FFFFFF</color>
<color name="lightgray">#EBEBED</color>
<color name="white">#FFFFFF</color>
<color name="lightgray">#EBEBED</color>
</resources>

@ -1,3 +1,3 @@
<resources>
<string name="app_name">MetaMask</string>
<string name="app_name">MetaMask</string>
</resources>

@ -1,22 +1,22 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:statusBarColor">@color/lightgray</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:navigationBarColor">@color/lightgray</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
<item name="android:statusBarColor">@color/white</item>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
<item name="android:statusBarColor">@color/white</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:navigationBarColor">@color/white</item>
<item name="android:navigationBarColor">@color/white</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
</style>
</resources>

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">10.0.2.2</domain>
<domain includeSubdomains="false">10.0.3.2</domain>
</domain-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">10.0.2.2</domain>
<domain includeSubdomains="false">10.0.3.2</domain>
</domain-config>
</network-security-config>

@ -11,63 +11,63 @@ buildscript {
kotlin_version = "1.3.50"
kotlinVersion = "$kotlin_version"
}
repositories {
google()
jcenter()
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven { // Replace AAR from original RN with AAR from react-native-v8
url("$rootDir/../node_modules/react-native-v8/dist")
}
maven {
// prebuilt libv8android.so
url("$rootDir/../node_modules/v8-android/dist")
repositories {
mavenLocal()
google()
jcenter()
maven { // Replace AAR from original RN with AAR from react-native-v8
url("$rootDir/../node_modules/react-native-v8/dist")
}
maven {
// prebuilt libv8android.so
url("$rootDir/../node_modules/v8-android/dist")
}
maven {
url "https://jitpack.io"
}
maven {
// All of Detox' artifacts are provided via the npm module
url "$rootDir/../node_modules/detox/Detox-android"
}
}
// All of Detox' artifacts are provided via the npm module
url "$rootDir/../node_modules/detox/Detox-android"
}
}
subprojects {
afterEvaluate {
project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion = rootProject.ext.compileSdkVersion
buildToolsVersion = rootProject.ext.buildToolsVersion
}
}
}
}
afterEvaluate {
project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion = rootProject.ext.compileSdkVersion
buildToolsVersion = rootProject.ext.buildToolsVersion
}
}
}
}
}
subprojects {project ->
if (project.name.contains('react-native-fabric')) {
buildscript {
repositories {
if (project.name.contains('react-native-fabric')) {
buildscript {
repositories {
google()
jcenter()
maven {
url = 'https://dl.bintray.com/android/android-tools/'
maven {
url = 'https://dl.bintray.com/android/android-tools/'
}
}
}
}
}
}
}
}

@ -1,19 +1,19 @@
const getWindowInformation = `
const shortcutIcon = window.document.querySelector('head > link[rel="shortcut icon"]');
const icon = shortcutIcon || Array.from(window.document.querySelectorAll('head > link[rel="icon"]')).find((icon) => Boolean(icon.href));
const shortcutIcon = window.document.querySelector('head > link[rel="shortcut icon"]');
const icon = shortcutIcon || Array.from(window.document.querySelectorAll('head > link[rel="icon"]')).find(