diff --git a/src/redux/actions/applicationActions.ts b/src/redux/actions/applicationActions.ts index 65effa481..f13fb24ac 100644 --- a/src/redux/actions/applicationActions.ts +++ b/src/redux/actions/applicationActions.ts @@ -31,7 +31,8 @@ import { SET_COLOR_THEME, SET_SETTINGS_MIGRATED, HIDE_POSTS_THUMBNAILS, - SET_TERMS_ACCEPTED + SET_TERMS_ACCEPTED, + SET_ENC_UNLOCK_PIN } from '../constants/constants'; export const login = (payload) => ({ @@ -209,4 +210,9 @@ export const setIsTermsAccepted = (isTermsAccepted:boolean) => ({ type: SET_TERMS_ACCEPTED }) +export const setEncryptedUnlockPin = (encryptedUnlockPin:string) => ({ + payload:encryptedUnlockPin, + type: SET_ENC_UNLOCK_PIN +}) + diff --git a/src/redux/constants/constants.js b/src/redux/constants/constants.js index 74d54ee44..5424ebee0 100644 --- a/src/redux/constants/constants.js +++ b/src/redux/constants/constants.js @@ -36,6 +36,7 @@ export const SET_LAST_APP_VERSION = 'SET_LAST_APP_VERSION'; export const SET_COLOR_THEME = 'SET_COLOR_THEME'; export const SET_SETTINGS_MIGRATED = 'SET_SETTINGS_MIGRATED'; export const SET_TERMS_ACCEPTED = 'SET_TERMS_ACCEPTED'; +export const SET_ENC_UNLOCK_PIN = 'SET_ENC_UNLOCK_PIN'; // Accounts export const ADD_OTHER_ACCOUNT = 'ADD_OTHER_ACCOUNT'; diff --git a/src/redux/reducers/applicationReducer.ts b/src/redux/reducers/applicationReducer.ts index 3b7984dd0..3efe2aacc 100644 --- a/src/redux/reducers/applicationReducer.ts +++ b/src/redux/reducers/applicationReducer.ts @@ -30,6 +30,7 @@ import { SET_SETTINGS_MIGRATED, HIDE_POSTS_THUMBNAILS, SET_TERMS_ACCEPTED, + SET_ENC_UNLOCK_PIN } from '../constants/constants'; interface State { @@ -65,6 +66,7 @@ interface State { pin: string|null; isPinCodeOpen: boolean; isRenderRequired: boolean; + encUnlockPin: string; lastAppVersion:string; settingsMigratedV2: boolean; hidePostsThumbnails: boolean; @@ -104,13 +106,14 @@ const initialState:State = { pin: null, isPinCodeOpen: false, isRenderRequired: false, + encUnlockPin: '', lastAppVersion:'', settingsMigratedV2: false, hidePostsThumbnails: false, isTermsAccepted: false, }; -export default function (state = initialState, action) { +export default function (state = initialState, action):State { switch (action.type) { case LOGIN: return { @@ -283,6 +286,12 @@ export default function (state = initialState, action) { isTermsAccepted:action.payload } + case SET_ENC_UNLOCK_PIN: + return { + ...state, + encUnlockPin:action.payload + } + default: return state; }