Skip to content

Commit

Permalink
Merge pull request #9261 from Expensify/update-staging-from-main
Browse files Browse the repository at this point in the history
Update version to 1.1.70-1 on staging
  • Loading branch information
OSBotify committed May 31, 2022
2 parents ad9da57 + abce093 commit 60ce200
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 19 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001017000
versionName "1.1.70-0"
versionCode 1001017001
versionName "1.1.70-1"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.70.0</string>
<string>1.1.70.1</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.70.0</string>
<string>1.1.70.1</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.1.70-0",
"version": "1.1.70-1",
"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.",
Expand Down
61 changes: 61 additions & 0 deletions src/libs/API.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import _ from 'underscore';
import Onyx from 'react-native-onyx';
import * as Request from './Request';
import * as SequentialQueue from './Network/SequentialQueue';
import {version} from '../../package.json';

function write(command, apiCommandParameters = {}, onyxData = {}) {
// Optimistically update Onyx
if (onyxData.optimisticData) {
Onyx.update(onyxData.optimisticData);
}

// Assemble the data we'll send to the API
const data = {
...apiCommandParameters,
appversion: version,
};

// Assemble all the request data we'll be storing in the queue
const request = {
command,
data,
..._.omit(onyxData, 'optimisticData'),
};

// Write commands can be saved and retried, so push it to the SequentialQueue
SequentialQueue.push(request);
}

function makeRequestWithSideEffects(command, apiCommandParameters = {}, onyxData = {}) {
// Optimistically update Onyx
if (onyxData.optimisticData) {
Onyx.update(onyxData.optimisticData);
}

// Assemble the data we'll send to the API
const data = {
...apiCommandParameters,
appversion: version,
};

// Assemble all the request data we'll be storing
const request = {
command,
data,
..._.omit(onyxData, 'optimisticData'),
};

// Return a promise containing the response from HTTPS
return Request.processWithMiddleware(request);
}

function read(command, apiCommandParameters, onyxData) {
makeRequestWithSideEffects(command, apiCommandParameters, onyxData);
}

export {
write,
makeRequestWithSideEffects,
read,
};
8 changes: 6 additions & 2 deletions src/libs/Middleware/Reauthentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ function Reauthentication(response, request, isFromSequentialQueue) {
return data;
}

request.resolve(data);
if (request.resolve) {
request.resolve(data);
}
return;
}

Expand Down Expand Up @@ -81,7 +83,9 @@ function Reauthentication(response, request, isFromSequentialQueue) {
return data;
}

request.resolve(data);
if (request.resolve) {
request.resolve(data);
}

// Return response data so we can chain the response with the following middlewares.
return data;
Expand Down
4 changes: 3 additions & 1 deletion src/libs/Middleware/Retry.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ function Retry(response, request, isFromSequentialQueue) {
console.debug('[Network] There was an error in the Log API command, unable to log to server!', error);
}

request.resolve({jsonCode: CONST.JSON_CODE.UNABLE_TO_RETRY});
if (request.resolve) {
request.resolve({jsonCode: CONST.JSON_CODE.UNABLE_TO_RETRY});
}
});
}

Expand Down
19 changes: 9 additions & 10 deletions src/libs/Middleware/SaveResponseInOnyx.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ function SaveResponseInOnyx(response, request) {
.then((responseData) => {
// We'll only save the onyxData, successData and failureData for the refactored commands
if (_.has(responseData, 'onyxData')) {
let data;
const data = [];
if (responseData.jsonCode === 200) {
data = [
...request.successData,
...responseData.onyxData,
];
} else {
data = [
...request.failureData,
...responseData.onyxData,
];
if (request.successData) {
data.push(...request.successData);
}
} else if (request.failureData) {
data.push(...request.failureData);
}
if (responseData.onyxData) {
data.push(...responseData.onyxData);
}
Onyx.update(data);
}
Expand Down

0 comments on commit 60ce200

Please sign in to comment.