Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
Browse files Browse the repository at this point in the history
…ture/24464-editing-category-money-request
  • Loading branch information
rezkiy37 committed Sep 20, 2023
2 parents abd2d25 + 4c207ec commit 8912f26
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 61 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/deployExpensifyHelp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
name: Deploy ExpensifyHelp

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001037205
versionName "1.3.72-5"
versionCode 1001037206
versionName "1.3.72-6"
}

flavorDimensions "default"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.72.5</string>
<string>1.3.72.6</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.3.72.5</string>
<string>1.3.72.6</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions 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.3.72-5",
"version": "1.3.72-6",
"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
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function isReportManager(report) {
* @returns {Boolean}
*/
function isReportApproved(report) {
return report && report.statusNum === CONST.REPORT.STATE_NUM.SUBMITTED && report.statusNum === CONST.REPORT.STATUS.APPROVED;
return report && report.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && report.statusNum === CONST.REPORT.STATUS.APPROVED;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
import ELECTRON_EVENTS from '../../../desktop/ELECTRON_EVENTS';
import {HasFocus, IsVisible, OnVisibilityChange} from './types';

/**
* Detects whether the app is visible or not. Electron supports document.visibilityState,
* but switching to another app while Electron is partially occluded will not trigger a state of hidden
* so we ask the main process synchronously whether the BrowserWindow.isFocused()
*
* @returns {Boolean}
*/
function isVisible() {
return window.electron.sendSync(ELECTRON_EVENTS.REQUEST_VISIBILITY);
}
const isVisible: IsVisible = () => !!window.electron.sendSync(ELECTRON_EVENTS.REQUEST_VISIBILITY);

/**
* @returns {Boolean}
*/
function hasFocus() {
return true;
}
const hasFocus: HasFocus = () => true;

/**
* Adds event listener for changes in visibility state
*
* @param {Function} callback
*
* @return {Function} removes the listener
*/
function onVisibilityChange(callback) {
const onVisibilityChange: OnVisibilityChange = (callback) => {
// Deliberately strip callback argument to be consistent across implementations
window.electron.on(ELECTRON_EVENTS.FOCUS, () => callback());
window.electron.on(ELECTRON_EVENTS.BLUR, () => callback());
Expand All @@ -34,7 +22,7 @@ function onVisibilityChange(callback) {
window.electron.removeAllListeners(ELECTRON_EVENTS.FOCUS);
window.electron.removeAllListeners(ELECTRON_EVENTS.BLUR);
};
}
};

export default {
isVisible,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,21 @@
// they do not use the Notification lib.

import {AppState} from 'react-native';
import {HasFocus, IsVisible, OnVisibilityChange} from './types';

/**
* @return {Boolean}
*/
const isVisible = () => AppState.currentState === 'active';
const isVisible: IsVisible = () => AppState.currentState === 'active';

/**
* @returns {Boolean}
*/
function hasFocus() {
return true;
}
const hasFocus: HasFocus = () => true;

/**
* Adds event listener for changes in visibility state
*
* @param {Function} callback
*
* @return {Function} removes the listener
*/
function onVisibilityChange(callback) {
const onVisibilityChange: OnVisibilityChange = (callback) => {
// Deliberately strip callback argument to be consistent across implementations
const subscription = AppState.addEventListener('change', () => callback());

return () => subscription.remove();
}
};

export default {
isVisible,
Expand Down
21 changes: 5 additions & 16 deletions src/libs/Visibility/index.js → src/libs/Visibility/index.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,25 @@
import {AppState} from 'react-native';
import {HasFocus, IsVisible, OnVisibilityChange} from './types';

/**
* Detects whether the app is visible or not.
*
* @returns {Boolean}
*/
function isVisible() {
return document.visibilityState === 'visible';
}
const isVisible: IsVisible = () => document.visibilityState === 'visible';

/**
* Whether the app is focused.
*
* @returns {Boolean}
*/
function hasFocus() {
return document.hasFocus();
}
const hasFocus: HasFocus = () => document.hasFocus();

/**
* Adds event listener for changes in visibility state
*
* @param {Function} callback
*
* @return {Function} removes the listener
*/
function onVisibilityChange(callback) {
const onVisibilityChange: OnVisibilityChange = (callback) => {
// Deliberately strip callback argument to be consistent across implementations
const subscription = AppState.addEventListener('change', () => callback());

return () => subscription.remove();
}
};

export default {
isVisible,
Expand Down
5 changes: 5 additions & 0 deletions src/libs/Visibility/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type IsVisible = () => boolean;
type HasFocus = () => boolean;
type OnVisibilityChange = (callback: () => void) => () => void;

export type {IsVisible, HasFocus, OnVisibilityChange};
18 changes: 18 additions & 0 deletions src/types/modules/electron.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// TODO: Move this type to desktop/contextBridge.js once it is converted to TS
type ContextBridgeApi = {
send: (channel: string, data?: unknown) => void;
sendSync: (channel: string, data?: unknown) => unknown;
invoke: (channel: string, ...args: unknown) => Promise<unknown>;
on: (channel: string, func: () => void) => void;
removeAllListeners: (channel: string) => void;
};

declare global {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface Window {
electron: ContextBridgeApi;
}
}

// We used the export {} line to mark this file as an external module
export {};

0 comments on commit 8912f26

Please sign in to comment.