Page MenuHomePhabricator

D8191.diff
No OneTemporary

D8191.diff

diff --git a/lib/actions/device-actions.js b/lib/actions/device-actions.js
--- a/lib/actions/device-actions.js
+++ b/lib/actions/device-actions.js
@@ -1,5 +1,6 @@
// @flow
+import type { VersionResponse } from '../types/device-types.js';
import type { CallServerEndpoint } from '../utils/call-server-endpoint.js';
import { getConfig } from '../utils/config.js';
@@ -20,4 +21,23 @@
return deviceToken;
};
-export { setDeviceTokenActionTypes, setDeviceToken };
+const getVersionActionTypes = Object.freeze({
+ started: 'GET_VERSION_STARTED',
+ success: 'GET_VERSION_SUCCESS',
+ failed: 'GET_VERSION_FAILED',
+});
+const getVersion =
+ (callServerEndpoint: CallServerEndpoint): (() => Promise<VersionResponse>) =>
+ async () => {
+ const response = await callServerEndpoint('version');
+ return {
+ codeVersion: response.codeVersion,
+ };
+ };
+
+export {
+ setDeviceTokenActionTypes,
+ setDeviceToken,
+ getVersionActionTypes,
+ getVersion,
+};
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -17,6 +17,7 @@
UpdateUserAvatarResponse,
} from './avatar-types.js';
import type { CryptoStore } from './crypto-types.js';
+import type { VersionResponse } from './device-types.js';
import type { ClientDBDraftInfo, DraftStore } from './draft-types.js';
import type { EnabledApps, SupportedApps } from './enabled-apps.js';
import type {
@@ -1142,6 +1143,22 @@
+payload: {
+dataLoaded: boolean,
},
+ }
+ | {
+ +type: 'GET_VERSION_STARTED',
+ +loadingInfo?: LoadingInfo,
+ +payload?: void,
+ }
+ | {
+ +type: 'GET_VERSION_SUCCESS',
+ +payload: VersionResponse,
+ +loadingInfo: LoadingInfo,
+ }
+ | {
+ +type: 'GET_VERSION_FAILED',
+ +error: true,
+ +payload: Error,
+ +loadingInfo: LoadingInfo,
};
export type ActionPayload = ?(Object | Array<*> | $ReadOnlyArray<*> | string);

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 7:18 AM (18 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574507
Default Alt Text
D8191.diff (1 KB)

Event Timeline