Skip to content

Commit 910111f

Browse files
authored
Merge pull request #4197 from Expensify/update-staging-from-main
2 parents 97cf4bd + 65f0a12 commit 910111f

File tree

77 files changed

+1077
-397
lines changed

Some content is hidden

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

77 files changed

+1077
-397
lines changed

.github/ISSUE_TEMPLATE/Performance.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Report a performance issue
3+
about: Use to report an issue or propose a solution related to app performance
4+
title: "[Performance] "
5+
labels: Engineering
6+
---
7+
8+
If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/CONTRIBUTING.md) for onboarding and email [email protected] to request to join our Slack channel!
9+
___
10+
11+
## What performance issue do we need to solve?
12+
e.g. memory consumption, storage read/write times, React native bridge concerns, inefficient React component rendering, etc.
13+
14+
## What is the impact of this on end-users?
15+
List specific user experiences that will be improved by solving this problem e.g. app boot time, time to for some interaction to complete, etc.
16+
17+
## List any benchmarks that show the severity of the issue
18+
Please also provide exact steps taken to collect metrics above if any so we can independently verify the results.
19+
20+
## Proposed solution (if any)
21+
Please list out the steps you think we should take to solve this issue.
22+
23+
## List any benchmarks after implementing the changes to show impacts of the proposed solution (if any)
24+
Note: These should be the same as the benchmarks collected before any changes.
25+
26+
## Platform:
27+
Where is this issue occurring?
28+
29+
- [ ] Web
30+
- [ ] iOS
31+
- [ ] Android
32+
- [ ] Desktop App
33+
- [ ] Mobile Web
34+
35+
**Version Number:**
36+
**Logs:** https://stackoverflow.com/c/expensify/questions/4856
37+
**Notes/Photos/Videos:** Any additional supporting documentation
38+
**Expensify/Expensify Issue URL:**
39+
40+
[View all open jobs on Upwork](https://www.upwork.com/ab/jobs/search/?q=Expensify%20React%20Native&sort=recency&user_location_match=2)

.github/ISSUE_TEMPLATE/Standard.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ Can the user still use Expensify without this being fixed? Have you informed the
2222
## Platform:
2323
Where is this issue occurring?
2424

25-
Web
26-
iOS
27-
Android
28-
Desktop App
29-
Mobile Web
25+
- [ ] Web
26+
- [ ] iOS
27+
- [ ] Android
28+
- [ ] Desktop App
29+
- [ ] Mobile Web
3030

3131
**Version Number:**
3232
**Logs:** https://stackoverflow.com/c/expensify/questions/4856

.github/workflows/deployBlocker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: |
3232
echo "DEPLOY_BLOCKER_URL=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
3333
echo "DEPLOY_BLOCKER_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
34-
echo "DEPLOY_BLOCKER_TITLE=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
34+
echo "DEPLOY_BLOCKER_TITLE=$(sed -e "s/'/'\\\\''/g; s/\`/\\\\\`/g; 1s/^/'/; \$s/\$/'/" <<< ${{ github.event.pull_request.title }})" >> $GITHUB_ENV
3535
3636
- name: Update StagingDeployCash with new deploy blocker
3737
uses: Expensify/Expensify.cash/.github/actions/createOrUpdateStagingDeploy@main
@@ -54,7 +54,7 @@ jobs:
5454
channel: '#deployer',
5555
attachments: [{
5656
color: "#DB4545",
57-
text: '💥 New E.cash Deploy Blocker: <${{ env.DEPLOY_BLOCKER_URL }}|${{ env.DEPLOY_BLOCKER_TITLE }}>',
57+
text: '💥 New E.cash Deploy Blocker: <${{ env.DEPLOY_BLOCKER_URL }}|'+ `${{ env.DEPLOY_BLOCKER_TITLE }}`.replace(/(^'|'$)/gi, '').replace(/'\''/gi,'\'') + '>',
5858
}]
5959
}
6060
env:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ You can use any IDE or code editing tool for developing on any platform. Use you
4545
* Changes applied to Javascript will be applied automatically, any changes to native code will require a recompile
4646

4747
## Running the Android app 🤖
48-
* To install the Android dependencies, run: `npm install`, then `gradle` will install all linked dependencies
48+
* To install the Android dependencies, run: `npm install`
4949
* Make sure you have Java installed `java -version`. If not, install it by running `npm install -g openjdk8`.
5050
* To run a on a **Development Emulator**: `npm run android`
5151
* Changes applied to Javascript will be applied automatically, any changes to native code will require a recompile
@@ -248,7 +248,7 @@ localize the following types of data when presented to the user (even accessibil
248248
- Phones: see [LocalPhoneNumber](https://github.com/Expensify/Expensify.cash/blob/bdfbafe18ee2d60f766c697744f23fad64b62cad/src/libs/LocalePhoneNumber.js#L51-L52)
249249

250250
In most cases, you will be needing to localize data used in a component, if that's the case, there's a HOC [withLocalize](https://github.com/Expensify/Expensify.cash/blob/37465dbd07da1feab8347835d82ed3d2302cde4c/src/components/withLocalize.js).
251-
It will abstract most of the logic you need (mostly subscribe to the [PREFERRED_LOCALE](https://github.com/Expensify/Expensify.cash/blob/6cf1a56df670a11bf61aa67eeb64c1f87161dea1/src/ONYXKEYS.js#L88) Onyx key)
251+
It will abstract most of the logic you need (mostly subscribe to the [NVP_PREFERRED_LOCALE](https://github.com/Expensify/Expensify.cash/blob/6cf1a56df670a11bf61aa67eeb64c1f87161dea1/src/ONYXKEYS.js#L88) Onyx key)
252252
and is the preferred way of localizing things inside components.
253253

254254
Some pointers:

android/app/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "com.google.firebase.firebase-perf"
23
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
34
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
45

@@ -149,8 +150,8 @@ android {
149150
minSdkVersion rootProject.ext.minSdkVersion
150151
targetSdkVersion rootProject.ext.targetSdkVersion
151152
multiDexEnabled rootProject.ext.multiDexEnabled
152-
versionCode 1001007904
153-
versionName "1.0.79-4"
153+
versionCode 1001007905
154+
versionName "1.0.79-5"
154155
}
155156
splits {
156157
abi {
@@ -233,6 +234,9 @@ dependencies {
233234
implementation jscFlavor
234235
}
235236

237+
implementation platform("com.google.firebase:firebase-bom:20.0.2")
238+
implementation "com.google.firebase:firebase-perf"
239+
236240
// GIF support
237241
implementation 'com.facebook.fresco:fresco:2.3.0'
238242
implementation 'com.facebook.fresco:animated-gif:2.3.0'

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
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
7-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
7+
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning">
8+
<meta-data
9+
android:name="firebase_performance_logcat_enabled"
10+
android:value="true"
11+
/>
12+
</application>
813
</manifest>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.expensify.chat;
2+
3+
import com.facebook.react.ReactPackage;
4+
import com.facebook.react.bridge.NativeModule;
5+
import com.facebook.react.bridge.ReactApplicationContext;
6+
import com.facebook.react.uimanager.ViewManager;
7+
8+
import java.util.ArrayList;
9+
import java.util.Collections;
10+
import java.util.List;
11+
12+
public class ExpensifyAppPackage implements ReactPackage {
13+
14+
@Override
15+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
16+
return Collections.emptyList();
17+
}
18+
19+
@Override
20+
public List<NativeModule> createNativeModules(
21+
ReactApplicationContext reactContext) {
22+
List<NativeModule> modules = new ArrayList<>();
23+
24+
modules.add(new StartupTimer(reactContext));
25+
26+
return modules;
27+
}
28+
29+
}

android/app/src/main/java/com/expensify/chat/MainApplication.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import org.unimodules.adapters.react.ModuleRegistryAdapter;
2222
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
2323
import org.unimodules.core.interfaces.SingletonModule;
24+
import com.facebook.react.bridge.JSIModulePackage;
25+
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
2426

2527
public class MainApplication extends MultiDexApplication implements ReactApplication {
2628

@@ -40,6 +42,7 @@ protected List<ReactPackage> getPackages() {
4042
// Packages that cannot be autolinked yet can be added manually here, for example:
4143
// packages.add(new MyReactNativePackage());
4244
packages.add(new PlaidPackage());
45+
packages.add(new ExpensifyAppPackage());
4346

4447
// Add unimodules
4548
List<ReactPackage> unimodules = Arrays.<ReactPackage>asList(
@@ -53,6 +56,11 @@ protected List<ReactPackage> getPackages() {
5356
protected String getJSMainModuleName() {
5457
return "index";
5558
}
59+
60+
@Override
61+
protected JSIModulePackage getJSIModulePackage() {
62+
return new ReanimatedJSIModulePackage();
63+
}
5664
};
5765

5866
@Override
@@ -69,6 +77,11 @@ public void onCreate() {
6977
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(false);
7078
}
7179

80+
// Start the "js_load" custom performance tracing metric. This timer is stopped by a native
81+
// module in the JS so we can measure total time starting in the native layer and ending in
82+
// the JS layer.
83+
StartupTimer.start();
84+
7285
// Increase SQLite DB write size
7386
try {
7487
Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize");
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.expensify.chat;
2+
import android.util.Log;
3+
4+
import com.facebook.react.bridge.ReactApplicationContext;
5+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
6+
import com.facebook.react.bridge.ReactMethod;
7+
import com.google.firebase.perf.FirebasePerformance;
8+
import com.google.firebase.perf.metrics.Trace;
9+
10+
public class StartupTimer extends ReactContextBaseJavaModule {
11+
StartupTimer(ReactApplicationContext context) {
12+
super(context);
13+
}
14+
15+
private static Trace trace = null;
16+
17+
@Override
18+
public String getName() {
19+
return "StartupTimer";
20+
}
21+
22+
@ReactMethod
23+
public void stop() {
24+
if (trace == null) {
25+
return;
26+
}
27+
28+
trace.stop();
29+
}
30+
31+
public static void start() {
32+
if (BuildConfig.DEBUG) {
33+
Log.d("StartupTimer", "Metric tracing disabled in DEBUG");
34+
} else {
35+
trace = FirebasePerformance.getInstance().newTrace("js_loaded");
36+
trace.start();
37+
}
38+
}
39+
}

android/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ buildscript {
1818
dependencies {
1919
classpath("com.android.tools.build:gradle:4.1.0")
2020
classpath("com.google.gms:google-services:4.3.4")
21-
classpath("com.google.firebase:firebase-crashlytics-gradle:2.3.0")
21+
classpath("com.google.firebase:firebase-crashlytics-gradle:2.7.1")
22+
classpath("com.google.firebase:perf-plugin:1.4.0")
2223
// NOTE: Do not place your application dependencies here; they belong
2324
// in the individual module build.gradle files
2425
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
Lines changed: 13 additions & 0 deletions
Loading

assets/images/avatars/room.svg

Lines changed: 5 additions & 7 deletions
Loading

assets/images/new-expensify-dev.svg

Lines changed: 10 additions & 14 deletions
Loading

0 commit comments

Comments
 (0)