Skip to content

Commit 1bf3664

Browse files
authored
chore: update android app (#4597)
* chore: update android app * chore: update deprecated actions * chore: update expo-font
1 parent 77d3af7 commit 1bf3664

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+302
-321
lines changed

.github/workflows/publish-each-pr.yml

+20-11
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,42 @@ jobs:
88
if: github.event.pull_request.head.repo.full_name == 'callstack/react-native-paper'
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v1
11+
uses: actions/checkout@v4
1212

1313
- name: Setup Node.js
14-
uses: actions/setup-node@v1
14+
uses: actions/setup-node@v4
1515
with:
16-
node-version: 16.x
16+
node-version: 18.x
1717

1818
- name: Setup Expo
1919
uses: expo/expo-github-action@v7
2020
with:
2121
eas-version: latest
2222
token: ${{ secrets.EXPO_TOKEN }}
2323

24-
- name: Get yarn cache
24+
- name: Restore dependencies
2525
id: yarn-cache
26-
run: echo "::set-output name=dir::$(yarn cache dir)"
27-
28-
- name: Check yarn cache
29-
uses: actions/cache@v1
26+
uses: actions/cache/restore@v4
3027
with:
31-
path: ${{ steps.yarn-cache.outputs.dir }}
32-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
28+
path: '**/node_modules'
29+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
3330
restore-keys: |
31+
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
3432
${{ runner.os }}-yarn-
3533
3634
- name: Install dependencies
37-
run: yarn
35+
if: steps.yarn-cache.outputs.cache-hit != 'true'
36+
run: |
37+
sudo corepack enable
38+
yarn --cwd example --immutable
39+
yarn --immutable
40+
41+
- name: Cache dependencies
42+
if: steps.yarn-cache.outputs.cache-hit != 'true'
43+
uses: actions/cache/save@v4
44+
with:
45+
path: '**/node_modules'
46+
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}
3847

3948
- name: Publish Expo app
4049
working-directory: ./example

.github/workflows/updates.yml

+21-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Node.js
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: 16.x
18+
node-version: 18.x
1919

2020
- name: Setup Expo
2121
uses: expo/expo-github-action@v7
@@ -24,18 +24,29 @@ jobs:
2424
eas-version: latest
2525
token: ${{ secrets.EXPO_TOKEN }}
2626

27-
- name: Get yarn cache
28-
id: yarn-cache-path
29-
run: echo "::set-output name=dir::$(yarn cache dir)"
30-
31-
- uses: actions/cache@v4
27+
- name: Restore dependencies
28+
id: yarn-cache
29+
uses: actions/cache/restore@v4
3230
with:
33-
path: ${{ steps.yarn-cache-path.outputs.dir }}
34-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
35-
restore-keys: ${{ runner.os }}-yarn-
31+
path: '**/node_modules'
32+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
33+
restore-keys: |
34+
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
35+
${{ runner.os }}-yarn-
3636
3737
- name: Install dependencies
38-
run: yarn
38+
if: steps.yarn-cache.outputs.cache-hit != 'true'
39+
run: |
40+
sudo corepack enable
41+
yarn --cwd example --immutable
42+
yarn --immutable
43+
44+
- name: Cache dependencies
45+
if: steps.yarn-cache.outputs.cache-hit != 'true'
46+
uses: actions/cache/save@v4
47+
with:
48+
path: '**/node_modules'
49+
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}
3950

4051
- name: Publish Expo app update
4152
working-directory: ./example

example/android/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ build/
1010
local.properties
1111
*.iml
1212
*.hprof
13+
.cxx/
1314

1415
# Bundle artifacts
1516
*.jsbundle

example/android/app/build.gradle

+25-83
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@ apply plugin: "com.android.application"
22
apply plugin: "org.jetbrains.kotlin.android"
33
apply plugin: "com.facebook.react"
44

5-
import com.android.build.OutputFile
6-
75
def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
8-
def expoDebuggableVariants = ['debug']
9-
// Override `debuggableVariants` for expo-updates debugging
10-
if (System.getenv('EX_UPDATES_NATIVE_DEBUG') == "1") {
11-
react {
12-
expoDebuggableVariants = []
13-
}
14-
}
15-
166

177
/**
188
* This is the configuration block to customize your React Native Android app.
@@ -22,17 +12,20 @@ react {
2212
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
2313
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
2414
hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
25-
debuggableVariants = expoDebuggableVariants
15+
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
16+
17+
// Use Expo CLI to bundle the app, this ensures the Metro config
18+
// works correctly with Expo projects.
19+
cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
20+
bundleCommand = "export:embed"
2621

2722
/* Folders */
28-
// The root of your project, i.e. where "package.json" lives. Default is '..'
29-
// root = file("../")
30-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
31-
// reactNativeDir = file("../node_modules/react-native")
32-
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
33-
// codegenDir = file("../node_modules/react-native-codegen")
34-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
35-
// cliFile = file("../node_modules/react-native/cli.js")
23+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
24+
// root = file("../../")
25+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
26+
// reactNativeDir = file("../../node_modules/react-native")
27+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
28+
// codegenDir = file("../../node_modules/@react-native/codegen")
3629

3730
/* Variants */
3831
// The list of variants to that are debuggable. For those we're going to
@@ -43,9 +36,7 @@ react {
4336
/* Bundling */
4437
// A list containing the node command and its flags. Default is just 'node'.
4538
// nodeExecutableAndArgs = ["node"]
46-
//
47-
// The command to run when bundling. By default is 'bundle'
48-
// bundleCommand = "ram-bundle"
39+
4940
//
5041
// The path to the CLI configuration file. Default is empty.
5142
// bundleConfig = file(../rn-cli.config.js)
@@ -67,22 +58,10 @@ react {
6758
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
6859
// hermesFlags = ["-O", "-output-source-map"]
6960

61+
/* Autolinking */
7062
autolinkLibrariesWithApp()
7163
}
7264

73-
// Override `hermesEnabled` by `expo.jsEngine`
74-
ext {
75-
hermesEnabled = (findProperty('expo.jsEngine') ?: "hermes") == "hermes"
76-
}
77-
78-
/**
79-
* Set this to true to create four separate APKs instead of one,
80-
* one for each native architecture. This is useful if you don't
81-
* use App Bundles (https://developer.android.com/guide/app-bundle/)
82-
* and want to have separate APKs to upload to the Play Store.
83-
*/
84-
def enableSeparateBuildPerCPUArchitecture = false
85-
8665
/**
8766
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
8867
*/
@@ -101,21 +80,11 @@ def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInRelea
10180
*/
10281
def jscFlavor = 'org.webkit:android-jsc:+'
10382

104-
/**
105-
* Private function to get the list of Native Architectures you want to build.
106-
* This reads the value from reactNativeArchitectures in your gradle.properties
107-
* file and works together with the --active-arch-only flag of react-native run-android.
108-
*/
109-
def reactNativeArchitectures() {
110-
def value = project.getProperties().get("reactNativeArchitectures")
111-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
112-
}
113-
11483
android {
11584
ndkVersion rootProject.ext.ndkVersion
11685

11786
buildToolsVersion rootProject.ext.buildToolsVersion
118-
compileSdkVersion rootProject.ext.compileSdkVersion
87+
compileSdk rootProject.ext.compileSdkVersion
11988

12089
namespace 'com.callstack.reactnativepaperexample'
12190
defaultConfig {
@@ -125,15 +94,6 @@ android {
12594
versionCode 28
12695
versionName "3.14.0"
12796
}
128-
129-
splits {
130-
abi {
131-
reset()
132-
enable enableSeparateBuildPerCPUArchitecture
133-
universalApk false // If true, also generate a universal APK
134-
include (*reactNativeArchitectures())
135-
}
136-
}
13797
signingConfigs {
13898
debug {
13999
storeFile file('debug.keystore')
@@ -153,24 +113,17 @@ android {
153113
shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)
154114
minifyEnabled enableProguardInReleaseBuilds
155115
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
116+
crunchPngs (findProperty('android.enablePngCrunchInReleaseBuilds')?.toBoolean() ?: true)
156117
}
157118
}
158-
159-
// applicationVariants are e.g. debug, release
160-
applicationVariants.all { variant ->
161-
variant.outputs.each { output ->
162-
// For each separate APK per architecture, set a unique version code as described here:
163-
// https://developer.android.com/studio/build/configure-apk-splits.html
164-
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
165-
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
166-
def abi = output.getFilter(OutputFile.ABI)
167-
if (abi != null) { // null for the universal-debug, universal-release variants
168-
output.versionCodeOverride =
169-
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
170-
}
171-
119+
packagingOptions {
120+
jniLibs {
121+
useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
172122
}
173123
}
124+
androidResources {
125+
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
126+
}
174127
}
175128

176129
// Apply static values from `gradle.properties` to the `android.packagingOptions`
@@ -200,35 +153,24 @@ dependencies {
200153
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
201154
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
202155
def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
203-
def frescoVersion = rootProject.ext.frescoVersion
204-
205-
// If your app supports Android versions before Ice Cream Sandwich (API level 14)
206-
if (isGifEnabled || isWebpEnabled) {
207-
implementation("com.facebook.fresco:fresco:${frescoVersion}")
208-
implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}")
209-
}
210156

211157
if (isGifEnabled) {
212158
// For animated gif support
213-
implementation("com.facebook.fresco:animated-gif:${frescoVersion}")
159+
implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}")
214160
}
215161

216162
if (isWebpEnabled) {
217163
// For webp support
218-
implementation("com.facebook.fresco:webpsupport:${frescoVersion}")
164+
implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}")
219165
if (isWebpAnimatedEnabled) {
220166
// Animated webp support
221-
implementation("com.facebook.fresco:animated-webp:${frescoVersion}")
167+
implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}")
222168
}
223169
}
224170

225-
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
226-
227171
if (hermesEnabled.toBoolean()) {
228172
implementation("com.facebook.react:hermes-android")
229173
} else {
230174
implementation jscFlavor
231175
}
232176
}
233-
234-
applyNativeModulesAppBuildGradle(project)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

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

6-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
6+
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:usesCleartextTraffic" />
77
</manifest>
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,34 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.callstack.reactnativepaperexample">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22
<uses-permission android:name="android.permission.INTERNET"/>
33
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
4+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
45
<uses-permission android:name="android.permission.VIBRATE"/>
56
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
6-
77
<queries>
88
<intent>
99
<action android:name="android.intent.action.VIEW"/>
1010
<category android:name="android.intent.category.BROWSABLE"/>
1111
<data android:scheme="https"/>
1212
</intent>
1313
</queries>
14-
15-
<application
16-
android:name=".MainApplication"
17-
android:label="@string/app_name"
18-
android:icon="@mipmap/ic_launcher"
19-
android:roundIcon="@mipmap/ic_launcher_round"
20-
android:allowBackup="true"
21-
android:theme="@style/AppTheme"
22-
android:usesCleartextTraffic="true"
23-
android:supportsRtl="true"
24-
>
25-
14+
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true">
2615
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
27-
<meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="exposdk:50.0.19"/>
16+
<meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="@string/expo_runtime_version"/>
2817
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
2918
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
3019
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://u.expo.dev/ba8f5139-58fe-48f0-b2f2-2d675b6eb2d4"/>
31-
32-
<activity
33-
android:name=".MainActivity"
34-
android:label="@string/app_name"
35-
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
36-
android:launchMode="singleTask"
37-
android:windowSoftInputMode="adjustResize"
38-
android:theme="@style/Theme.App.SplashScreen"
39-
android:exported="true"
40-
android:screenOrientation="unspecified">
41-
20+
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="unspecified">
4221
<intent-filter>
4322
<action android:name="android.intent.action.MAIN"/>
4423
<category android:name="android.intent.category.LAUNCHER"/>
4524
</intent-filter>
46-
4725
<intent-filter>
4826
<action android:name="android.intent.action.VIEW"/>
4927
<category android:name="android.intent.category.DEFAULT"/>
5028
<category android:name="android.intent.category.BROWSABLE"/>
5129
<data android:scheme="com.callstack.reactnativepaperexample"/>
5230
<data android:scheme="exp+react-native-paper-example"/>
5331
</intent-filter>
54-
5532
</activity>
5633
</application>
5734
</manifest>

0 commit comments

Comments
 (0)