From f168a7c68000708406b8e4061fa4d2aca0634088 Mon Sep 17 00:00:00 2001
From: OSBotify <76178356+OSBotify@users.noreply.github.com>
Date: Wed, 23 Mar 2022 17:19:20 -0700
Subject: [PATCH 1/2] Merge pull request #8279 from
Expensify/version-BUILD-28a45ed0a8ef502619f2117d51011af193022a54
Update version to 1.1.44-5 on main
(cherry picked from commit 9c6c2a9441c1f8b51bccd8a7ee4a79058f5b5d95)
---
android/app/build.gradle | 4 ++--
ios/NewExpensify/Info.plist | 2 +-
ios/NewExpensifyTests/Info.plist | 2 +-
package-lock.json | 2 +-
package.json | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 25d654513186..d0ba0472b2f6 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -152,8 +152,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
- versionCode 1001014404
- versionName "1.1.44-4"
+ versionCode 1001014405
+ versionName "1.1.44-5"
}
splits {
abi {
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index bf0b269a4fdc..2d78b403a0c0 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -31,7 +31,7 @@
CFBundleVersion
- 1.1.44.4
+ 1.1.44.5
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist
index 519df107fcfe..8757ed345baa 100644
--- a/ios/NewExpensifyTests/Info.plist
+++ b/ios/NewExpensifyTests/Info.plist
@@ -19,6 +19,6 @@
CFBundleSignature
????
CFBundleVersion
- 1.1.44.4
+ 1.1.44.5
diff --git a/package-lock.json b/package-lock.json
index 83a63f9b596d..b2b1a3efb160 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.1.44-4",
+ "version": "1.1.44-5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 15478832efd9..63b0333cf35d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.1.44-4",
+ "version": "1.1.44-5",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
From 658010338e673f7c6c26881e80b437798feebec3 Mon Sep 17 00:00:00 2001
From: Rory Abraham <47436092+roryabraham@users.noreply.github.com>
Date: Wed, 23 Mar 2022 15:11:38 -0700
Subject: [PATCH 2/2] Merge pull request #8271 from
Expensify/marcaaron-onReadyTask
(cherry picked from commit b6133305088a272e6d8c014cd6546f2e16f23a42)
---
src/components/GrowlNotification/index.js | 9 +++++++--
src/libs/ActiveClientManager/index.js | 12 +++---------
src/libs/Growl.js | 5 ++++-
src/libs/createOnReadyTask.js | 18 ++++++++++++++++++
4 files changed, 32 insertions(+), 12 deletions(-)
create mode 100644 src/libs/createOnReadyTask.js
diff --git a/src/components/GrowlNotification/index.js b/src/components/GrowlNotification/index.js
index d5d8659d307b..e3a16b600d13 100644
--- a/src/components/GrowlNotification/index.js
+++ b/src/components/GrowlNotification/index.js
@@ -12,6 +12,7 @@ import * as Expensicons from '../Icon/Expensicons';
import styles from '../../styles/styles';
import GrowlNotificationContainer from './GrowlNotificationContainer';
import CONST from '../../CONST';
+import * as Growl from '../../libs/Growl';
const types = {
[CONST.GROWL.SUCCESS]: {
@@ -31,8 +32,8 @@ const types = {
const INACTIVE_POSITION_Y = -255;
class GrowlNotification extends Component {
- constructor() {
- super();
+ constructor(props) {
+ super(props);
this.state = {
bodyText: '',
@@ -44,6 +45,10 @@ class GrowlNotification extends Component {
this.fling = this.fling.bind(this);
}
+ componentDidMount() {
+ Growl.setIsReady();
+ }
+
/**
* Show the growl notification
*
diff --git a/src/libs/ActiveClientManager/index.js b/src/libs/ActiveClientManager/index.js
index e0bc5fc5f371..569f29fdcd2e 100644
--- a/src/libs/ActiveClientManager/index.js
+++ b/src/libs/ActiveClientManager/index.js
@@ -3,18 +3,16 @@ import Onyx from 'react-native-onyx';
import Str from 'expensify-common/lib/str';
import ONYXKEYS from '../../ONYXKEYS';
import * as ActiveClients from '../actions/ActiveClients';
+import createOnReadyTask from '../createOnReadyTask';
const clientID = Str.guid();
const maxClients = 20;
let activeClients;
-let isInitialized;
// Keeps track of the ActiveClientManager's readiness in one place
// so that multiple calls of isReady resolve the same promise
-const isInitializedPromise = new Promise((resolve) => {
- isInitialized = resolve;
-});
+const [isReady, setIsReady] = createOnReadyTask();
Onyx.connect({
key: ONYXKEYS.ACTIVE_CLIENTS,
@@ -32,11 +30,7 @@ Onyx.connect({
*/
function init() {
ActiveClients.addClient(clientID)
- .then(isInitialized);
-}
-
-function isReady() {
- return isInitializedPromise;
+ .then(setIsReady);
}
/**
diff --git a/src/libs/Growl.js b/src/libs/Growl.js
index b4915c22bad4..85ba042b71a0 100644
--- a/src/libs/Growl.js
+++ b/src/libs/Growl.js
@@ -1,7 +1,9 @@
import React from 'react';
import CONST from '../CONST';
+import createOnReadyTask from './createOnReadyTask';
const growlRef = React.createRef();
+const [isGrowlReady, setIsReady] = createOnReadyTask();
/**
* Show the growl notification
@@ -11,7 +13,7 @@ const growlRef = React.createRef();
* @param {Number} [duration]
*/
function show(bodyText, type, duration = CONST.GROWL.DURATION) {
- growlRef.current.show(bodyText, type, duration);
+ isGrowlReady().then(() => growlRef.current.show(bodyText, type, duration));
}
/**
@@ -42,4 +44,5 @@ export default {
export {
growlRef,
+ setIsReady,
};
diff --git a/src/libs/createOnReadyTask.js b/src/libs/createOnReadyTask.js
new file mode 100644
index 000000000000..3d6546641175
--- /dev/null
+++ b/src/libs/createOnReadyTask.js
@@ -0,0 +1,18 @@
+/**
+ * Helper method to create a task to track the "readiness" of something and defer any actions until after something is "ready".
+ *
+ * @example
+ *
+ * const [isSomethingReady, setIsReady] = createOnReadyTask();
+ * isSomethingReady().then(() => doIt());
+ * setIsReady(); // -> doIt() will now execute
+ *
+ * @returns {Array}
+ */
+export default function createOnReadyTask() {
+ let resolveIsReadyPromise;
+ const isReadyPromise = (new Promise((resolve) => {
+ resolveIsReadyPromise = resolve;
+ }));
+ return [() => isReadyPromise, resolveIsReadyPromise];
+}