diff --git a/src/apps/popup/pages/rate-app/index.tsx b/src/apps/popup/pages/rate-app/index.tsx index 2ae0b19ec..701db47b0 100644 --- a/src/apps/popup/pages/rate-app/index.tsx +++ b/src/apps/popup/pages/rate-app/index.tsx @@ -95,6 +95,7 @@ export const RateAppPage = () => { dispatchToMainStore(ratedInStoreChanged(true)); window.open(RateAppLinks[browser], '_blank'); + navigate(RouterPath.Home); }} > Leave a review @@ -111,6 +112,7 @@ export const RateAppPage = () => { dispatchToMainStore(askForReviewAfterChanged(datePlusFourMonth)); window.open('https://t.me/CSPRhub/4689', '_blank'); + navigate(RouterPath.Home); }} > Get in touch diff --git a/src/background/index.ts b/src/background/index.ts index e924f940b..cbefa9e4a 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -62,10 +62,14 @@ import { ledgerRecipientToSaveOnSuccessChanged, ledgerStateCleared } from '@background/redux/ledger/actions'; -import { setShowCSPRNamePromotion } from '@background/redux/promotion/actions'; +import { + resetPromotion, + setShowCSPRNamePromotion +} from '@background/redux/promotion/actions'; import { askForReviewAfterChanged, - ratedInStoreChanged + ratedInStoreChanged, + resetRateApp } from '@background/redux/rate-app/actions'; import { accountAdded, @@ -626,6 +630,7 @@ runtime.onMessage.addListener( case getType(contactsReseted): case getType(ratedInStoreChanged): case getType(askForReviewAfterChanged): + case getType(resetRateApp): case getType(accountBalancesChanged): case getType(accountBalancesReseted): case getType(ledgerNewWindowIdChanged): @@ -634,6 +639,7 @@ runtime.onMessage.addListener( case getType(ledgerRecipientToSaveOnSuccessChanged): case getType(addWatchingAccount): case getType(setShowCSPRNamePromotion): + case getType(resetPromotion): store.dispatch(action); return sendResponse(undefined); diff --git a/src/background/redux/promotion/actions.ts b/src/background/redux/promotion/actions.ts index 96afe133f..11f44a91a 100644 --- a/src/background/redux/promotion/actions.ts +++ b/src/background/redux/promotion/actions.ts @@ -3,3 +3,5 @@ import { createAction } from 'typesafe-actions'; export const setShowCSPRNamePromotion = createAction( 'SET_SHOW_CSPR_NAME_PROMOTION' )(); + +export const resetPromotion = createAction('RESET_PROMOTION')(); diff --git a/src/background/redux/promotion/reducer.ts b/src/background/redux/promotion/reducer.ts index 58d0dc49e..30fcad494 100644 --- a/src/background/redux/promotion/reducer.ts +++ b/src/background/redux/promotion/reducer.ts @@ -1,19 +1,24 @@ import { createReducer } from 'typesafe-actions'; -import { setShowCSPRNamePromotion } from '@background/redux/promotion/actions'; +import { + resetPromotion, + setShowCSPRNamePromotion +} from '@background/redux/promotion/actions'; import { PromotionState } from '@background/redux/promotion/types'; const initialState: PromotionState = { showCSPRNamePromotion: true }; -export const reducer = createReducer(initialState).handleAction( - setShowCSPRNamePromotion, - ( - state: PromotionState, - action: ReturnType - ) => ({ - ...state, - showCSPRNamePromotion: action.payload - }) -); +export const reducer = createReducer(initialState) + .handleAction( + setShowCSPRNamePromotion, + ( + state: PromotionState, + action: ReturnType + ) => ({ + ...state, + showCSPRNamePromotion: action.payload + }) + ) + .handleAction(resetPromotion, () => initialState); diff --git a/src/background/redux/rate-app/actions.ts b/src/background/redux/rate-app/actions.ts index a8c9e6728..e8aed8c87 100644 --- a/src/background/redux/rate-app/actions.ts +++ b/src/background/redux/rate-app/actions.ts @@ -7,3 +7,5 @@ export const ratedInStoreChanged = createAction( export const askForReviewAfterChanged = createAction( 'ASK_FOR_REVIEW_AFTER_CHANGED' )(); + +export const resetRateApp = createAction('RESET_RATE_APP')(); diff --git a/src/background/redux/rate-app/reducer.ts b/src/background/redux/rate-app/reducer.ts index 3beb69c8e..32533871e 100644 --- a/src/background/redux/rate-app/reducer.ts +++ b/src/background/redux/rate-app/reducer.ts @@ -2,7 +2,8 @@ import { createReducer } from 'typesafe-actions'; import { askForReviewAfterChanged, - ratedInStoreChanged + ratedInStoreChanged, + resetRateApp } from '@background/redux/rate-app/actions'; import { RateAppState } from '@background/redux/rate-app/types'; @@ -35,4 +36,5 @@ export const reducer = createReducer(initialState) ...state, askForReviewAfter: action.payload }) - ); + ) + .handleAction(resetRateApp, () => initialState); diff --git a/src/background/redux/sagas/onboarding-sagas.ts b/src/background/redux/sagas/onboarding-sagas.ts index efd071518..a2caa6812 100644 --- a/src/background/redux/sagas/onboarding-sagas.ts +++ b/src/background/redux/sagas/onboarding-sagas.ts @@ -4,6 +4,8 @@ import { storage } from 'webextension-polyfill'; import { disableOnboardingFlow } from '@background/open-onboarding-flow'; import { contactsReseted } from '@background/redux/contacts/actions'; +import { resetPromotion } from '@background/redux/promotion/actions'; +import { resetRateApp } from '@background/redux/rate-app/actions'; import { recipientPublicKeyReseted } from '@background/redux/recent-recipient-public-keys/actions'; import { vaultSettingsReseted } from '@background/redux/settings/actions'; @@ -54,6 +56,8 @@ function* resetVaultSaga() { yield put(recipientPublicKeyReseted()); yield put(contactsReseted()); yield put(vaultSettingsReseted()); + yield put(resetRateApp()); + yield put(resetPromotion()); storage.local.clear(); } catch (err) {