Skip to content

Commit 6edc9ce

Browse files
committed
Merge branch 'main' into tgolen-remove-rnvps-13
2 parents 3a65a64 + 867235c commit 6edc9ce

125 files changed

Lines changed: 2377 additions & 2381 deletions

File tree

Some content is hidden

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

.github/scripts/validateActionsAndWorkflows.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title 'Validating the Github Actions and workflows using the json schemas provid
77
function downloadSchema {
88
[[ $1 = 'github-action.json' ]] && SCHEMA_NAME='GitHub Action' || SCHEMA_NAME='GitHub Workflow'
99
info "Downloading $SCHEMA_NAME schema..."
10-
if curl "https://json.schemastore.org/$1" --output "./tempSchemas/$1" --silent; then
10+
if curl "https://raw.githubusercontent.com/SchemaStore/schemastore/refs/heads/master/src/schemas/json/$1" --output "./tempSchemas/$1" --silent; then
1111
success "Successfully downloaded $SCHEMA_NAME schema!"
1212
else
1313
error "Failed downloading $SCHEMA_NAME schema"

.github/workflows/lint-changed.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,47 @@ jobs:
1717
if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }}
1818
runs-on: ubuntu-latest
1919
steps:
20+
- name: Count commits between merge base and HEAD
21+
id: count
22+
run: |
23+
# Compare the base commit and HEAD to get the count of commits after base
24+
# up to and including HEAD. Add 2 to this total when fetching history.
25+
#
26+
# When opening a PR, GitHub will create a merge commit that squashes
27+
# your changes for use in the workflow. So your history locally
28+
# may look like
29+
# o---o---o---B - development
30+
# /
31+
# ---o---1---C---o---o---A - main
32+
# Note that the `1` is the merge-base of development and main. The
33+
# number of commits after `1` upto and including `A` is 4.
34+
# In the workflow, GitHub squashs development, so it becomes:
35+
# ---o---1---C---o---o---A - main
36+
# \--M - PR branch
37+
# Where `M`` is the new squashed commit. To fetch enough history to
38+
# include the merge base, we need to fetch `M`, `A` through `C` and
39+
# `1` for total of 4+2=6 commits. The +2 commits accounts for the
40+
# base `1` and merge commit `M`.
41+
RAW_COUNT="$(gh api "repos/$REPO/compare/${BASE}...main" | jq -r '.total_commits')"
42+
ADJUSTED_COUNT=$((RAW_COUNT + 2))
43+
echo "count=$ADJUSTED_COUNT" >> "$GITHUB_OUTPUT"
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
BASE: ${{ github.event.pull_request.base.sha }}
47+
REPO: ${{ github.repository }}
48+
2049
- name: Checkout
2150
# v4
2251
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
52+
with:
53+
fetch-depth: ${{ fromJSON(steps.count.outputs.count) }}
2354

2455
- name: Setup Node
2556
uses: ./.github/actions/composite/setupNode
2657
with:
2758
IS_DESKTOP_BUILD: true
28-
59+
2960
- name: Run ESLint to check for deprecation warnings
3061
run: |
31-
# This will just fetch the latest commit from main
32-
git fetch origin main --no-tags --depth=1
33-
3462
# shellcheck disable=SC2046
3563
npm run lint-changed

.github/workflows/remote-build-android.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ jobs:
3535
IS_HYBRID_BUILD: ${{ matrix.is_hybrid_build && 'true' || 'false' }}
3636

3737
- name: RNEF Remote Build - Android
38-
uses: callstackincubator/android@c6ac9e01bf15271b4f7c24c88b37e884a26b04d6
38+
uses: callstackincubator/android@2f67a7003e5ed1bb4e483619ab582fabff25677d
3939
env:
4040
IS_HYBRID_APP: ${{ matrix.is_hybrid_build }}
4141
with:
4242
variant: ${{ matrix.variant }}
4343
github-token: ${{ github.token }}
44-
rnef-build-extra-params: '-PreactNativeArchitectures=arm64-v8a,x86_64'
44+
rnef-build-extra-params: '--extra-params -PreactNativeArchitectures=arm64-v8a,x86_64'
4545
comment-bot: false

.github/workflows/remote-build-ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
IS_HYBRID_BUILD: ${{ matrix.is_hybrid_build && 'true' || 'false' }}
3838

3939
- name: RNEF Remote Build - iOS
40-
uses: callstackincubator/ios@172a7f01cd8b19fdb5da9a984637d468eb6e0fad
40+
uses: callstackincubator/ios@78ed46313dac4ed09cb5cc73b9b1b9193d59d863
4141
env:
4242
IS_HYBRID_APP: ${{ matrix.is_hybrid_build }}
4343
with:

Mobile-Expensify

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ android {
114114
minSdkVersion rootProject.ext.minSdkVersion
115115
targetSdkVersion rootProject.ext.targetSdkVersion
116116
multiDexEnabled rootProject.ext.multiDexEnabled
117-
versionCode 1009015907
118-
versionName "9.1.59-7"
117+
versionCode 1009016003
118+
versionName "9.1.60-3"
119119
// Supported language variants must be declared here to avoid from being removed during the compilation.
120120
// This also helps us to not include unnecessary language variants in the APK.
121121
resConfigs "en", "es"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.expensify.chat;
2+
3+
import com.facebook.react.bridge.Arguments;
4+
import com.facebook.react.bridge.Promise;
5+
import com.facebook.react.bridge.ReactApplicationContext;
6+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
7+
import com.facebook.react.bridge.ReactMethod;
8+
import com.facebook.react.bridge.WritableMap;
9+
10+
import androidx.annotation.NonNull;
11+
12+
public class AppStateTrackerModule extends ReactContextBaseJavaModule {
13+
private final ReactApplicationContext reactContext;
14+
15+
public AppStateTrackerModule(ReactApplicationContext reactContext) {
16+
super(reactContext);
17+
this.reactContext = reactContext;
18+
}
19+
20+
@Override
21+
@NonNull
22+
public String getName() {
23+
return "AppStateTracker";
24+
}
25+
26+
@ReactMethod
27+
public void getApplicationState(Promise promise) {
28+
MainApplication applicationContext = (MainApplication) this.reactContext.getApplicationContext();
29+
WritableMap params = Arguments.createMap();
30+
params.putString("currentState", applicationContext.getCurrentState());
31+
params.putString("prevState", applicationContext.getPrevState());
32+
promise.resolve(params);
33+
}
34+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public List<NativeModule> createNativeModules(
2323

2424
modules.add(new StartupTimer(reactContext));
2525
modules.add(new ShareActionHandlerModule(reactContext));
26+
modules.add(new AppStateTrackerModule(reactContext));
2627

2728
return modules;
2829
}

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package com.expensify.chat
22

3+
import android.app.Activity
34
import com.facebook.react.common.assets.ReactFontManager
45

56
import android.app.ActivityManager
7+
import android.app.ActivityManager.RunningAppProcessInfo
8+
import android.content.Context
69
import android.content.res.Configuration
710
import android.database.CursorWindow
11+
import android.os.Bundle
812
import android.os.Process
913
import androidx.multidex.MultiDexApplication
1014
import com.expensify.chat.bootsplash.BootSplashPackage
@@ -27,6 +31,11 @@ import expo.modules.ApplicationLifecycleDispatcher
2731
import expo.modules.ReactNativeHostWrapper
2832

2933
class MainApplication : MultiDexApplication(), ReactApplication {
34+
var currentState: String = "active"
35+
private set
36+
var prevState: String = "inactive"
37+
private set
38+
3039
override val reactNativeHost: ReactNativeHost = ReactNativeHostWrapper(this, object : DefaultReactNativeHost(this) {
3140
override fun getUseDeveloperSupport() = BuildConfig.DEBUG
3241

@@ -64,6 +73,30 @@ class MainApplication : MultiDexApplication(), ReactApplication {
6473
return
6574
}
6675

76+
registerActivityLifecycleCallbacks(object: ActivityLifecycleCallbacks {
77+
override fun onActivityStarted(p0: Activity) {
78+
prevState = currentState
79+
currentState = "active"
80+
}
81+
82+
override fun onActivityStopped(p0: Activity) {
83+
val isOnForeground = isAppOnForeground()
84+
prevState = currentState
85+
currentState = if (isOnForeground) "active" else "background"
86+
}
87+
88+
override fun onActivityDestroyed(p0: Activity) {
89+
val isOnForeground = isAppOnForeground()
90+
prevState = currentState
91+
currentState = if (isOnForeground) "active" else "background"
92+
}
93+
94+
override fun onActivityCreated(p0: Activity, p1: Bundle?) {}
95+
override fun onActivityResumed(p0: Activity) {}
96+
override fun onActivityPaused(p0: Activity) {}
97+
override fun onActivitySaveInstanceState(p0: Activity, p1: Bundle) {}
98+
})
99+
67100
SoLoader.init(this, OpenSourceMergedSoMapping)
68101
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
69102
// If you opted-in for the New Architecture, we load the native entry point for this app.
@@ -106,4 +139,22 @@ class MainApplication : MultiDexApplication(), ReactApplication {
106139
it.pid == pid && it.processName.endsWith(":onfido_process")
107140
}
108141
}
142+
143+
/**
144+
* Checks if the application is currently running in the foreground.
145+
* https://stackoverflow.com/a/8490088/8398300
146+
*/
147+
private fun isAppOnForeground(): Boolean {
148+
val activityManager = applicationContext.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
149+
val appProcesses = activityManager.runningAppProcesses ?: return false
150+
val packageName: String = applicationContext.getPackageName()
151+
for (appProcess in appProcesses) {
152+
if (appProcess.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND &&
153+
appProcess.processName == packageName
154+
) {
155+
return true
156+
}
157+
}
158+
return false
159+
}
109160
}

config/webpack/webpack.common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ const getCommonConfiguration = ({file = '.env', platform = 'web'}: Environment):
114114
{from: 'web/favicon-unread.png'},
115115
{from: 'web/og-preview-image.png'},
116116
{from: 'web/apple-touch-icon.png'},
117+
{from: 'web/robots.txt'},
117118
{from: 'assets/images/expensify-app-icon.svg'},
118119
{from: 'web/manifest.json'},
119-
{from: 'web/thirdPartyScripts.js'},
120120
{from: 'assets/css', to: 'css'},
121121
{from: 'assets/fonts/web', to: 'fonts'},
122122
{from: 'assets/sounds', to: 'sounds'},

0 commit comments

Comments
 (0)