File tree Expand file tree Collapse file tree 6 files changed +45
-1
lines changed
Expand file tree Collapse file tree 6 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 8787
8888 - name : Run Android tests
8989 run : |
90+ echo "STOREFRONT_DOMAIN=\"myshopify.com\"" > sample/.env
9091 yarn module build
9192 yarn sample test:android --no-daemon
9293
Original file line number Diff line number Diff line change @@ -103,3 +103,6 @@ sample/vendor
103103! .yarn /releases
104104! .yarn /sdks
105105! .yarn /versions
106+
107+ # Sample app
108+ sample /** /AndroidManifest.xml
Original file line number Diff line number Diff line change @@ -146,3 +146,21 @@ apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")
146146apply from : file(" ../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle" ); applyNativeModulesAppBuildGradle(project)
147147
148148apply from : project(' :react-native-config' ). projectDir. getPath() + " /dotenv.gradle"
149+
150+ def properties = loadProperties()
151+ def storefrontDomain = properties. getProperty(" STOREFRONT_DOMAIN" )
152+
153+ if (! storefrontDomain) {
154+ println (" **** Please add a .env file with STOREFRONT_DOMAIN set *****" )
155+ }
156+
157+ task generateAndroidManifestFromTemplate {
158+ doLast {
159+ def templateFile = file(' src/main/AndroidManifest.template.xml' )
160+ def outputFile = file(' src/main/AndroidManifest.xml' )
161+ def content = templateFile. getText(' UTF-8' ). replace(' {{STOREFRONT_DOMAIN}}' , " $storefrontDomain " )
162+ outputFile. write(content, ' UTF-8' )
163+ }
164+ }
165+
166+ preBuild. dependsOn(generateAndroidManifestFromTemplate)
Original file line number Diff line number Diff line change 11<manifest xmlns : android =" http://schemas.android.com/apk/res/android" >
22
33 <uses-permission android : name =" android.permission.INTERNET" />
4+ <uses-permission android : name =" android.permission.ACCESS_FINE_LOCATION" />
5+ <uses-permission android : name =" android.permission.ACCESS_COARSE_LOCATION" />
46
57 <application
68 android : name =" .MainApplication"
1719 android : launchMode =" singleTask"
1820 android : windowSoftInputMode =" adjustResize"
1921 android : exported =" true" >
22+
23+ <!-- This action signifies that the activity is the entry point of the application -->
2024 <intent-filter >
2125 <action android : name =" android.intent.action.MAIN" />
2226 <category android : name =" android.intent.category.LAUNCHER" />
27+ </intent-filter >
28+
29+ <!-- Configuration for app linking -->
30+ <intent-filter >
31+ <action android : name =" android.intent.action.VIEW" />
32+ <category android : name =" android.intent.category.DEFAULT" />
33+ <category android : name =" android.intent.category.BROWSABLE" />
34+
35+ <!-- Note: the host here will be replaced on application start -->
36+ <data android : scheme =" https" android : host ={{STOREFRONT_DOMAIN}} />
2337 </intent-filter >
2438 </activity >
2539 </application >
Original file line number Diff line number Diff line change @@ -20,4 +20,12 @@ buildscript {
2020 }
2121}
2222
23+ def loadProperties () {
24+ def props = new Properties ()
25+ file(' ../.env' ). withInputStream {
26+ props. load(it)
27+ }
28+ return props
29+ }
30+
2331apply plugin : " com.facebook.react.rootproject"
Original file line number Diff line number Diff line change 1111 "build:ios" : " sh ./scripts/build_ios" ,
1212 "lint" : " yarn typecheck && eslint ." ,
1313 "ios" : " react-native run-ios --simulator 'iPhone 15 Pro'" ,
14- "start" : " react-native start -- --simulator 'iPhone 15 Pro'" ,
14+ "start" : " react-native start -- --simulator 'iPhone 15 Pro' --reset-cache " ,
1515 "typecheck" : " tsc --noEmit" ,
1616 "test:ios" : " sh ./scripts/test_ios" ,
1717 "test:android" : " sh ./scripts/test_android"
You can’t perform that action at this time.
0 commit comments