Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2897387
D12307.id40920.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D12307.id40920.diff
View Options
diff --git a/lib/flow-typed/npm/tcomb_v3.x.x.js b/lib/flow-typed/npm/tcomb_v3.x.x.js
--- a/lib/flow-typed/npm/tcomb_v3.x.x.js
+++ b/lib/flow-typed/npm/tcomb_v3.x.x.js
@@ -65,7 +65,7 @@
};
}
- declare export class TEnums extends TBaseType<string> {
+ declare export class TEnums extends TBaseType<string | number> {
meta: {
+kind: 'enums',
+name: string,
@@ -119,7 +119,7 @@
): TDict<{ [key: S]: T }>,
union<+T>(types: $ReadOnlyArray<TType<T>>, name?: string): TUnion<T>,
+enums: {
- of(enums: $ReadOnlyArray<string>, name?: string): TEnums,
+ of(enums: $ReadOnlyArray<string> | $ReadOnlyArray<number>, name?: string): TEnums,
},
irreducible<T>(
name: string,
diff --git a/lib/reducers/aux-user-reducer.js b/lib/reducers/aux-user-reducer.js
--- a/lib/reducers/aux-user-reducer.js
+++ b/lib/reducers/aux-user-reducer.js
@@ -131,6 +131,7 @@
...state.auxUserInfos[userID],
fid: state.auxUserInfos[userID]?.fid ?? null,
deviceList: action.payload.deviceLists[userID],
+ platformDetails: action.payload.usersPlatformDetails[userID],
},
},
});
diff --git a/lib/reducers/aux-user-reducer.test.js b/lib/reducers/aux-user-reducer.test.js
--- a/lib/reducers/aux-user-reducer.test.js
+++ b/lib/reducers/aux-user-reducer.test.js
@@ -6,7 +6,11 @@
setAuxUserFIDsActionType,
setPeerDeviceListsActionType,
} from '../actions/aux-user-actions.js';
-import type { RawDeviceList } from '../types/identity-service-types.js';
+import {
+ type RawDeviceList,
+ type IdentityPlatformDetails,
+ identityDeviceTypes,
+} from '../types/identity-service-types.js';
jest.mock('../utils/config.js');
@@ -98,10 +102,18 @@
devices: ['D1', 'D2'],
timestamp: 1,
};
+ const platformDetails1: IdentityPlatformDetails = {
+ deviceType: identityDeviceTypes.ANDROID,
+ codeVersion: 350,
+ };
const deviceList2: RawDeviceList = {
devices: ['D3'],
timestamp: 1,
};
+ const platformDetails2: IdentityPlatformDetails = {
+ deviceType: identityDeviceTypes.IOS,
+ codeVersion: 349,
+ };
const updateAuxUserInfosAction = {
type: setPeerDeviceListsActionType,
@@ -110,6 +122,10 @@
userID_1: deviceList1,
userID_2: deviceList2,
},
+ usersPlatformDetails: {
+ userID_1: platformDetails1,
+ userID_2: platformDetails2,
+ },
},
};
@@ -121,10 +137,12 @@
userID_1: {
fid: 'farcasterID_1',
deviceList: deviceList1,
+ platformDetails: platformDetails1,
},
userID_2: {
fid: null,
deviceList: deviceList2,
+ platformDetails: platformDetails2,
},
},
});
diff --git a/lib/types/aux-user-types.js b/lib/types/aux-user-types.js
--- a/lib/types/aux-user-types.js
+++ b/lib/types/aux-user-types.js
@@ -4,9 +4,14 @@
FarcasterUser,
RawDeviceList,
UsersRawDeviceLists,
+ IdentityPlatformDetails,
} from './identity-service-types.js';
-export type AuxUserInfo = { +fid: ?string, deviceList?: RawDeviceList };
+export type AuxUserInfo = {
+ +fid: ?string,
+ +deviceList?: RawDeviceList,
+ +platformDetails?: IdentityPlatformDetails,
+};
export type AuxUserInfos = { +[userID: string]: AuxUserInfo };
@@ -24,4 +29,5 @@
export type SetPeerDeviceListsPayload = {
+deviceLists: UsersRawDeviceLists,
+ +usersPlatformDetails: { +[userID: string]: IdentityPlatformDetails },
};
diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js
--- a/lib/types/identity-service-types.js
+++ b/lib/types/identity-service-types.js
@@ -1,6 +1,6 @@
// @flow
-import t, { type TInterface, type TList, type TDict } from 'tcomb';
+import t, { type TInterface, type TList, type TDict, type TEnums } from 'tcomb';
import {
identityKeysBlobValidator,
@@ -17,6 +17,7 @@
currentUserInfoValidator,
type CurrentUserInfo,
} from './user-types.js';
+import { values } from '../utils/objects.js';
import { tUserID, tShape } from '../utils/validation-utils.js';
export type UserAuthMetadata = {
@@ -322,3 +323,22 @@
WINDOWS: 4,
MAC_OS: 5,
});
+
+export type IdentityDeviceType = $Values<typeof identityDeviceTypes>;
+export const identityDeviceTypeValidator: TEnums = t.enums.of(
+ values(identityDeviceTypes),
+);
+
+export type IdentityPlatformDetails = {
+ deviceType: IdentityDeviceType,
+ codeVersion: number,
+ stateVersion?: number,
+ majorDesktopVersion?: number,
+};
+export const identityPlatformDetailsValidator: TInterface<IdentityPlatformDetails> =
+ tShape<IdentityPlatformDetails>({
+ deviceType: identityDeviceTypeValidator,
+ codeVersion: t.Number,
+ stateVersion: t.maybe(t.Number),
+ majorDesktopVersion: t.maybe(t.Number),
+ });
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 5, 11:14 PM (20 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2246793
Default Alt Text
D12307.id40920.diff (4 KB)
Attached To
Mode
D12307: Add identity platform details to aux user store
Attached
Detach File
Event Timeline
Log In to Comment