Skip to content

Commit

Permalink
Fix expo-payments-stripe/with-expokit example (#2295)
Browse files Browse the repository at this point in the history
* with-expokit example is working now on ios

* fixed return url in example with expokit

* Made requested changes

* Ensure everything runs

* Revert unneeded changes

* Revert unneeded changes to .gitignore
  • Loading branch information
Szymon20000 authored and sjchmiela committed Oct 10, 2018
1 parent 2f57753 commit 3e33c55
Show file tree
Hide file tree
Showing 32 changed files with 1,627 additions and 1,423 deletions.
29 changes: 0 additions & 29 deletions modules/test_suite_flutter/android/.idea/codeStyles/Project.xml

This file was deleted.

Expand Up @@ -20,7 +20,7 @@ android {
buildToolsVersion '27.0.3'

defaultConfig {
applicationId 'host.exp.exponent.payments.stripe.examples.expokit'
applicationId 'host.exp.exponent.payments.stripe'
targetSdkVersion 26
versionCode 1
versionName '1.0.0'
Expand Down Expand Up @@ -64,8 +64,8 @@ android {
ext.enableCrashlytics = false
}
release {
/*minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'*/
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
Expand All @@ -80,11 +80,9 @@ android {
packagingOptions {
pickFirst "**"
}

configurations.all {
resolutionStrategy.force 'com.android.support:design:27.1.0'
}

configurations.all {
resolutionStrategy.force 'com.android.support:design:27.1.0'
}
}

// Don't use modern jsc-android since it still has some critical bugs that
Expand All @@ -103,14 +101,10 @@ apply from: 'expo.gradle'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation project(':expo-permissions')
implementation project(':expo-permissions-interface')
implementation project(':expo-payments-stripe')
implementation project(':expo-core')
implementation project(':expo-react-native-adapter')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:multidex:1.0.1'

// Our dependencies
implementation 'com.android.support:appcompat-v7:27.1.1'

// Our dependencies from ExpoView
// DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
Expand Down Expand Up @@ -176,14 +170,13 @@ dependencies {
testImplementation 'com.android.support.test:runner:1.0.2-alpha1'
testImplementation 'com.android.support.test:rules:1.0.2-alpha1'


implementation('host.exp.exponent:expoview:29.0.0@aar') {
implementation('host.exp.exponent:expoview:30.0.0@aar') {
transitive = true
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
exclude group: 'com.github.thefuntasty', module: 'CreditCardEntry'
exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
}

/* REMOVED_WHEN_DISTRIBUTING_FROM_HERE
implementation(project(path: ':expoview')) {
// Excluding okhttp3 included by expo-file-system
Expand Down
Expand Up @@ -24,58 +24,45 @@ afterEvaluate {
runBefore("preBuild", exponentPrebuildStep)

// Based on https://github.com/facebook/react-native/blob/master/react.gradle
// Grab all build types and product flavors
def buildTypes = android.buildTypes.collect { type -> type.name }
def productFlavors = android.productFlavors.collect { flavor -> flavor.name }

// When no product flavors defined, use empty
if (!productFlavors) productFlavors.add("")

productFlavors.each { productFlavorName ->
buildTypes.each { buildTypeName ->
// Create variant and target names
def flavorNameCapitalized = "${productFlavorName.capitalize()}"
def buildNameCapitalized = "${buildTypeName.capitalize()}"
def targetName = "${flavorNameCapitalized}${buildNameCapitalized}"
def targetPath = productFlavorName ?
"${productFlavorName}/${buildTypeName}" :
"${buildTypeName}"

def assetsDir = file("$buildDir/intermediates/assets/${targetPath}")

// Bundle task name for variant
def bundleExpoAssetsTaskName = "bundle${targetName}ExpoAssets"

def currentBundleTask = tasks.create(
name: bundleExpoAssetsTaskName,
type: Exec) {
description = "Expo bundle assets for ${targetName}."

// Create dirs if they are not there (e.g. the "clean" task just ran)
doFirst {
assetsDir.mkdirs()
}

// Set up inputs and outputs so gradle can cache the result
inputs.files fileTree(dir: expoRoot, excludes: inputExcludes)
outputs.dir assetsDir

// Set up the call to exp
workingDir expoRoot

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine("cmd", "/c", ".\\node_modules\\expokit\\detach-scripts\\run-exp.bat", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
} else {
commandLine("./node_modules/expokit/detach-scripts/run-exp.sh", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
}

enabled targetName.toLowerCase().contains("release") || targetName.toLowerCase().contains("prod")

android.applicationVariants.each { variant ->
def targetName = variant.name.capitalize()
def targetPath = variant.dirName

def assetsDir = file("$buildDir/intermediates/assets/${targetPath}")

// Bundle task name for variant
def bundleExpoAssetsTaskName = "bundle${targetName}ExpoAssets"

def currentBundleTask = tasks.create(
name: bundleExpoAssetsTaskName,
type: Exec) {
description = "Expo bundle assets for ${targetName}."

// Create dirs if they are not there (e.g. the "clean" task just ran)
doFirst {
assetsDir.mkdirs()
}

currentBundleTask.dependsOn("merge${targetName}Resources")
currentBundleTask.dependsOn("merge${targetName}Assets")
// Set up inputs and outputs so gradle can cache the result
inputs.files fileTree(dir: expoRoot, excludes: inputExcludes)
outputs.dir assetsDir

runBefore("process${targetName}Resources", currentBundleTask)
// Set up the call to exp
workingDir expoRoot

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine("cmd", "/c", ".\\node_modules\\expokit\\detach-scripts\\run-exp.bat", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
} else {
commandLine("./node_modules/expokit/detach-scripts/run-exp.sh", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
}

enabled targetName.toLowerCase().contains("release") || targetName.toLowerCase().contains("prod")
}

currentBundleTask.dependsOn("merge${targetName}Resources")
currentBundleTask.dependsOn("merge${targetName}Assets")

runBefore("process${targetName}Resources", currentBundleTask)
}
}
Expand Up @@ -11,7 +11,7 @@
"client_id": "android:host.exp.exponent",
"client_type": 1,
"android_client_info": {
"package_name": "host.exp.exponent.payments.stripe.examples.expokit",
"package_name": "host.exp.exponent.payments.stripe",
"certificate_hash": ""
}
},
Expand Down
Expand Up @@ -28,6 +28,22 @@
##### Crashlytics #####
-keepattributes SourceFile,LineNumberTable

##### Expo Universal Modules #####

-keepclassmembers class * {
@expo.core.interfaces.ExpoProp *;
}
-keepclassmembers class * {
@expo.core.interfaces.ExpoMethod *;
}

-keepclassmembers class * {
@**.expo.core.interfaces.ExpoProp *;
}
-keepclassmembers class * {
@**.expo.core.interfaces.ExpoMethod *;
}

##### React Native #####
-keep,allowobfuscation @interface **.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface **.facebook.proguard.annotations.KeepGettersAndSetters
Expand Down
Expand Up @@ -5,11 +5,11 @@
xmlns:tools="http://schemas.android.com/tools">

<permission
android:name="host.exp.exponent.payments.stripe.examples.expokit.permission.C2D_MESSAGE"
android:name="host.exp.exponent.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>

<!-- These are required permissions to make the app run -->
<uses-permission android:name="host.exp.exponent.payments.stripe.examples.expokit.permission.C2D_MESSAGE" />
<uses-permission android:name="host.exp.exponent.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
Expand All @@ -24,6 +24,7 @@
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

<!-- These require runtime permissions on M -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand Down Expand Up @@ -75,7 +76,7 @@
android:theme="@style/Theme.Exponent.Splash"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<data android:scheme="expb30bd136a19a44adba16125e3f75abc5"/>
<data android:scheme="exp9d1ea7e1de174f31828a156ea7a38e11"/>

<action android:name="android.intent.action.VIEW"/>

Expand All @@ -87,6 +88,7 @@

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- ADD DETACH APP SPECIFIC INTENT FILTERS -->
</activity>

<activity
Expand All @@ -96,6 +98,7 @@
android:theme="@style/Theme.Exponent.Splash"
android:windowSoftInputMode="adjustResize">
<!-- ADD SHELL INTENT FILTERS HERE -->
<!-- ADD SHELL APP SPECIFIC INTENT FILTERS -->
</activity>

<activity
Expand All @@ -121,13 +124,13 @@

<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
<!-- ADD DEV SETTINGS HERE -->
<activity android:name="abi30_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
<activity android:name="abi29_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
<activity android:name="abi28_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
<activity android:name="abi27_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
<activity android:name="abi26_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
<activity android:name="abi25_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
<activity android:name="abi24_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>
<activity android:name="abi23_0_0.com.facebook.react.devsupport.DevSettingsActivity"/>

<activity
android:name=".ExponentDevActivity"
Expand All @@ -151,28 +154,30 @@
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="host.exp.exponent.payments.stripe.examples.expokit" android:path="oauthredirect"/>
<data android:scheme="host.exp.exponent" android:path="oauthredirect"/>
</intent-filter>
</activity>

<activity
android:exported="true"
android:launchMode="singleTask"
android:name="expo.modules.payments.stripe.RedirectUriReceiver"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="expaymentsstripe" />
</intent-filter>
</activity>

<activity
android:name=".oauth.OAuthResultActivity">
</activity>

<!-- START OF STRIPE SCHEMES -->
<activity
android:exported="true"
android:launchMode="singleTask"
android:name="expo.modules.payments.stripe.RedirectUriReceiver"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="expo.modules.payments.stripe.200dd997-2f5c-4a54-ba60-811275997c0c" />
</intent-filter>
</activity>
<!-- Versioned Activity for Stripe -->
<!-- END OF STRIPE SCHEMES -->

<activity
android:name=".chrometabs.ChromeTabsManagerActivity">
</activity>
Expand Down Expand Up @@ -243,7 +248,7 @@
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>

<category android:name="host.exp.exponent.payments.stripe.examples.expokit"/>
<category android:name="host.exp.exponent"/>
</intent-filter>
</receiver>

Expand Down Expand Up @@ -309,6 +314,8 @@

<!-- The Facebook SDK runs FacebookInitProvider on startup and crashes if there isn't an ID here -->
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb0"/>

<meta-data android:name="standaloneStripeScheme" android:value="200dd997-2f5c-4a54-ba60-811275997c0c" />
</application>

</manifest>
@@ -1 +1 @@
{"android":{"package":"host.exp.exponent","publishBundlePath":"../android/app/src/main/assets/kernel.android.bundle"},"description":"","entryPoint":"_universe/entry.js","extra":{"amplitudeApiKey":"081e5ec53f869b440b225d5e40ec73f9"},"icon":"https://s3.amazonaws.com/exp-brand-assets/ExponentEmptyManifest_192.png","iconUrl":"https://s3.amazonaws.com/exp-brand-assets/ExponentEmptyManifest_192.png","ios":{"bundleIdentifier":"host.exp.exponent","publishBundlePath":"../ios/Exponent/Supporting/kernel.ios.bundle","supportsTablet":true},"isKernel":true,"kernel":{"androidManifestPath":"../android/app/src/main/assets/kernel-manifest.json","iosManifestPath":"../ios/Exponent/Supporting/kernel-manifest.json"},"locales":{},"name":"expo-home","orientation":"portrait","packagerOpts":{"config":"./_universe/rn-cli.config.js"},"platforms":["ios","android"],"primaryColor":"#cccccc","privacy":"unlisted","scheme":"exp","sdkVersion":"UNVERSIONED","slug":"home","updates":{"checkAutomatically":"ON_LOAD","fallbackToCacheTimeout":0},"version":"29.0.0","id":"@exponent/home","revisionId":"29.0.0-r.geE6kePn1E","publishedTime":"2018-07-20T21:04:14.772Z","bundleUrl":"https://exp.host/@exponent/home/bundle","releaseChannel":"default","hostUri":"exp.host/@exponent/home"}
{"android":{"package":"host.exp.exponent","publishBundlePath":"../android/app/src/main/assets/kernel.android.bundle"},"description":"","entryPoint":"_universe/entry.js","extra":{"amplitudeApiKey":"081e5ec53f869b440b225d5e40ec73f9"},"icon":"https://s3.amazonaws.com/exp-brand-assets/ExponentEmptyManifest_192.png","iconUrl":"https://s3.amazonaws.com/exp-brand-assets/ExponentEmptyManifest_192.png","ios":{"bundleIdentifier":"host.exp.exponent","publishBundlePath":"../ios/Exponent/Supporting/kernel.ios.bundle","supportsTablet":true},"isKernel":true,"kernel":{"androidManifestPath":"../android/app/src/main/assets/kernel-manifest.json","iosManifestPath":"../ios/Exponent/Supporting/kernel-manifest.json"},"locales":{},"name":"expo-home","orientation":"portrait","packagerOpts":{"config":"./_universe/rn-cli.config.js"},"platforms":["ios","android"],"primaryColor":"#cccccc","privacy":"unlisted","scheme":"exp","sdkVersion":"UNVERSIONED","slug":"home","updates":{"checkAutomatically":"ON_LOAD","fallbackToCacheTimeout":0},"version":"30.0.0","id":"@exponent/home","revisionId":"30.0.0-r.mODbJYwWMD","publishedTime":"2018-09-07T15:00:25.192Z","commitTime":"2018-09-07T15:00:25.228Z","bundleUrl":"https://exp.host/@exponent/home/bundle","releaseChannel":"default","hostUri":"exp.host/@exponent/home"}

0 comments on commit 3e33c55

Please sign in to comment.