Created
February 6, 2018 20:04
-
-
Save wolverineks/6128b1d365e85eb93458a9a38fc4562e to your computer and use it in GitHub Desktop.
Proposed Redux State
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type WalletId = string | |
export type CurrencyCode = string | |
export type IsoCurrencyCode = string | |
export type PluginName = string | |
export type SceneKey = string | |
export type SceneData = Object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type State = { | |
edge: EdgeState, // everything non-serializable | |
account: AccountState, | |
wallets: WalletsState, | |
settings: SettingsState, | |
scenes: ScenesState, | |
device: DeviceState | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type EdgeState = { // everything non-serializable | |
account: EdgeAccount | null, | |
context: EdgeContext | null, | |
wallets: {[WalletId]: EdgeCurrencyWallet} // keto-derived from account? | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type AccountState = { | |
username: string, // keto-derived from state.edge.account | |
loginType: // keto-derived from state.edge.account | |
‘newAccount’ | |
| ‘password’ | |
| ‘pin’ | |
| ‘recovery’ | |
| ‘key’ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type SettingsState = { | |
autoLogoutMode: { | |
isEnabled: boolean, | |
seconds: number | |
}, | |
bluetoothMode: { | |
isEnabled: boolean | |
}, | |
defaultFiat: IsoCurrencyCode, | |
merchantMode: { | |
isEnabled: boolean | |
}, | |
otpMode: { | |
isEnabled: boolean, | |
key: string, | |
resetDate: Date | |
}, | |
touchId: { | |
isEnabled: boolean, | |
isSupported: boolean | |
}, | |
byCurrencyCode: CurrencySettingsState | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type CurrencySettingsState = { | |
[CurrencyCode]: { | |
denominations: {[key: string]: EdgeDenomination}, | |
displayDenominationKey: string, // overkill? confusing? | |
displayDenomination: EdgeDenomination, // keto-derived | |
exchangeDenomination: EdgeDenomination, // keto-derived | |
spendingLimits: { | |
daily: { | |
isEnabled: boolean, | |
nativeAmount: string | |
}, | |
transaction: { | |
isEnabled: boolean, | |
nativeAmount: string | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type WalletsState = { | |
byId: {[WalletId]: GuiWallet}, | |
activeWalletIds: Array<WalletId>, | |
archivedWalletIds: Array<WalletId>, | |
selectedWalletId: WalletId | |
selectedCurrencyCode: CurrencyCode | |
selectedWallet: GuiWallet // derived from byId[selectedWalletId] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type ScenesState = { // incomplete, just an example | |
[SceneKey]: SceneData, | |
main: { | |
dropdownAlert: { // displays globally | |
isVisible: boolean | |
}, | |
popupModal: { // displays globally | |
isVisible: boolean | |
}, | |
passwordReminderModal: { // displays globally | |
isVisible: boolean | |
}, | |
}, | |
walletList: { | |
deleteWalletModal: { // displays only on this scene | |
isVisible: boolean, | |
walletId: WalletId | |
}, | |
getPrivateSeedModal: { // displays only on this scene | |
isVisible: boolean, | |
walletId: WalletId | |
}, | |
renameWalletModal: { // displays only on this scene | |
isVisible: boolean, | |
walletId: WalletId | |
}, | |
resyncWalletModal: { // displays only on this scene | |
isVisible: boolean, | |
walletId: WalletId | |
}, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type DeviceState = { | |
permissions: PermissionsState, | |
contacts: ContactsState, | |
locale: LocaleState, | |
specs: SpecsState, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type PermissionState = ‘granted’ | ‘denied’ | ‘restricted’ | null | |
export type Permission = ‘bluetooth’ | ‘camera’ | ‘contacts’ | ‘photos’ | |
export type PermissionsState = { | |
[Permission]: PermissionState | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type GuiContact = { | |
hasThumbnail: boolean, | |
emailAddresses: Array<string>, | |
postalAddress: Array<string>, | |
middleName: string, | |
company: string, | |
jobTitle: string, | |
familyName: string, | |
thumbnailPath: string, | |
recordID: string, | |
givenName: string, | |
} | |
export type ContactsState = Array<GuiContact> | null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type LocaleState = { | |
localeIdentifier: string, | |
decimalSeparator: string, | |
quotationBeginDelimiterKey: string, | |
quotationEndDelimiterKey: string, | |
currencySymbol: string, | |
currencyCode: string, | |
// ios only: | |
usesMetricSystem: boolean, | |
localeLanguageCode: string, | |
countryCode: string, | |
calendar: string, | |
groupingSeparator: string, | |
collatorIdentifier: string, | |
alternateQuotationBeginDelimiterKey: string, | |
alternateQuotationEndDelimiterKey: string, | |
measurementSystem: string, | |
preferredLanguages: Array<string> | |
} | null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type SpecsState = { | |
// android only | |
// apiLevel: number, | |
// firstInstallTime: number, | |
// ipAddress: Promise<string>, | |
// instanceId: string, | |
// lastUpdateTime: number, | |
// macAddress: Promise<string>, | |
// maxMemory: number, | |
// phoneNumber: string, | |
// serialNumber: string, | |
applicationName: string, | |
brand: string, | |
buildNumber: string, | |
bundleId: string, | |
carrier: string, | |
deviceCountry: string, | |
deviceId: string, | |
deviceLocale: string, | |
deviceName: string, | |
freeDiskStorage: number, | |
manufacturer: string, | |
model: string, | |
readableVersion: string, | |
systemName: string, | |
systemVersion: string, | |
timezone: string, | |
totalDiskCapacity: number, | |
totalMemory: number, | |
uniqueId: string, | |
userAgent: string, | |
version: string, | |
is24Hour: boolean, | |
isEmulator: string, | |
isPinOrFingerprintSet: boolean, | |
isTablet: boolean | |
} | null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment