Skip to content

Commit c1b3feb

Browse files
refactor: update example project to RN 0.65.1
1 parent 7d81991 commit c1b3feb

File tree

21 files changed

+15142
-804
lines changed

21 files changed

+15142
-804
lines changed

example/android/app/build.gradle

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,9 @@ def jscFlavor = 'org.webkit:android-jsc:+'
126126
def enableHermes = project.ext.react.get("enableHermes", false);
127127

128128
android {
129+
ndkVersion rootProject.ext.ndkVersion
129130
compileSdkVersion rootProject.ext.compileSdkVersion
130131

131-
compileOptions {
132-
sourceCompatibility JavaVersion.VERSION_1_8
133-
targetCompatibility JavaVersion.VERSION_1_8
134-
}
135-
136132
defaultConfig {
137133
applicationId "com.example.intercomreactnative"
138134
minSdkVersion rootProject.ext.minSdkVersion
@@ -186,18 +182,21 @@ android {
186182
variant.outputs.each { output ->
187183
// For each separate APK per architecture, set a unique version code as described here:
188184
// https://developer.android.com/studio/build/configure-apk-splits.html
185+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
189186
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
190187
def abi = output.getFilter(OutputFile.ABI)
191188
if (abi != null) { // null for the universal-debug, universal-release variants
192189
output.versionCodeOverride =
193-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
190+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
194191
}
195192

196193
}
197194
}
198195
}
199196

200197
dependencies {
198+
// implementation("com.squareup.okhttp3:okhttp-urlconnection:4.9.1") <- required for applications that uses RN < 0.65
199+
201200
implementation fileTree(dir: "libs", include: ["*.jar"])
202201
//noinspection GradleDynamicVersion
203202
implementation "com.facebook.react:react-native:+" // From node_modules
@@ -232,7 +231,7 @@ dependencies {
232231
// Run this once to be able to run the application with BUCK
233232
// puts all compile dependencies into folder libs for BUCK to use
234233
task copyDownloadableDepsToLibs(type: Copy) {
235-
from configurations.compile
234+
from configurations.implementation
236235
into 'libs'
237236
}
238237

example/android/app/src/debug/AndroidManifest.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
66

7-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
7+
<application
8+
android:usesCleartextTraffic="true"
9+
tools:targetApi="28"
10+
tools:ignore="GoogleAppIndexingWarning">
11+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
12+
</application>
813
</manifest>

example/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,5 @@
3434
android:name="com.intercom.reactnative.RNIntercomPushBroadcastReceiver"
3535
tools:replace="android:exported"
3636
android:exported="true" />
37-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
3837
</application>
39-
4038
</manifest>

example/android/app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
4+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
55
<!-- Customize your theme here. -->
66
<item name="android:textColor">#000000</item>
77
</style>

example/android/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ buildscript {
55
def isFoss = taskRequests.contains("foss")
66

77
ext {
8-
buildToolsVersion = "29.0.2"
8+
buildToolsVersion = "30.0.2"
99
minSdkVersion = 21
10-
compileSdkVersion = 29
11-
targetSdkVersion = 29
10+
compileSdkVersion = 30
11+
targetSdkVersion = 30
12+
ndkVersion = "20.1.5948944"
1213
}
1314
repositories {
1415
google()
15-
jcenter()
16+
mavenCentral()
1617
}
1718
dependencies {
18-
classpath("com.android.tools.build:gradle:4.0.1")
19+
classpath("com.android.tools.build:gradle:4.2.1")
1920

2021
// NOTE: Do not place your application dependencies here; they belong
2122
// in the individual module build.gradle files
@@ -27,6 +28,7 @@ buildscript {
2728

2829
allprojects {
2930
repositories {
31+
mavenCentral()
3032
mavenLocal()
3133
maven {
3234
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
@@ -38,7 +40,7 @@ allprojects {
3840
}
3941

4042
google()
41-
jcenter()
43+
4244
maven { url 'https://www.jitpack.io' }
4345
}
4446
}

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919

2020
android.useAndroidX=true
2121
android.enableJetifier=true
22-
FLIPPER_VERSION=0.54.0
22+
FLIPPER_VERSION=0.93.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

example/android/gradlew.bat

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
5454
set JAVA_HOME=%JAVA_HOME:"=%
5555
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5656

57-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5858

5959
echo.
6060
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,28 +64,13 @@ echo location of your Java installation.
6464

6565
goto fail
6666

67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
8267
:execute
8368
@rem Setup the command line
8469

8570
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8671

8772
@rem Execute Gradle
88-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
73+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
8974

9075
:end
9176
@rem End local scope for the variables with windows NT shell

example/e2e/helpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ const boot = async () => {
3838
};
3939
driver.addCommand('boot', boot);
4040

41-
const closeOverlay = async () => {
42-
const buttonId = browser.isAndroid ? `~Close` : `~intercom close button`;
41+
const closeOverlay = async (customCloseButtonId?: string) => {
42+
const buttonId = browser.isAndroid ? `~Close` : customCloseButtonId || `~intercom close button`;
4343

4444
const closeButton = await $(buttonId);
4545
await closeButton.waitForDisplayed({ timeout: 22000 });
@@ -68,7 +68,7 @@ const closeHelpCenterOverlay = async () => {
6868
await closeButton.waitForDisplayed({ timeout: 22000 });
6969
await closeButton.click();
7070
} else {
71-
await closeOverlay();
71+
await closeOverlay('~help center close button');
7272
}
7373
};
7474
browser.addCommand('closeHelpCenterOverlay', closeHelpCenterOverlay);

example/e2e/tests/mainIntercom.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('Intercom E2E', () => {
9595

9696
const launcherId = driver.isAndroid
9797
? '~Intercom launcher'
98-
: '~intercom launcher';
98+
: '~launcher';
9999
await (await $(launcherId)).waitForDisplayed({ timeout: 12000 });
100100
await driver.clickWithDelay('~toggle-launcher-visibility', 12000);
101101
});

0 commit comments

Comments
 (0)