Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: navigate the user to the home page after the app review #1072

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/apps/popup/pages/rate-app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export const RateAppPage = () => {
dispatchToMainStore(ratedInStoreChanged(true));

window.open(RateAppLinks[browser], '_blank');
navigate(RouterPath.Home);
}}
>
<Trans t={t}>Leave a review</Trans>
Expand All @@ -111,6 +112,7 @@ export const RateAppPage = () => {
dispatchToMainStore(askForReviewAfterChanged(datePlusFourMonth));

window.open('https://t.me/CSPRhub/4689', '_blank');
navigate(RouterPath.Home);
}}
>
<Trans t={t}>Get in touch</Trans>
Expand Down
10 changes: 8 additions & 2 deletions src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,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,
Expand Down Expand Up @@ -610,12 +614,14 @@ runtime.onMessage.addListener(
case getType(contactsReseted):
case getType(ratedInStoreChanged):
case getType(askForReviewAfterChanged):
case getType(resetRateApp):
case getType(ledgerNewWindowIdChanged):
case getType(ledgerStateCleared):
case getType(ledgerDeployChanged):
case getType(ledgerRecipientToSaveOnSuccessChanged):
case getType(addWatchingAccount):
case getType(setShowCSPRNamePromotion):
case getType(resetPromotion):
store.dispatch(action);
return sendResponse(undefined);

Expand Down
2 changes: 2 additions & 0 deletions src/background/redux/promotion/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ import { createAction } from 'typesafe-actions';
export const setShowCSPRNamePromotion = createAction(
'SET_SHOW_CSPR_NAME_PROMOTION'
)<boolean>();

export const resetPromotion = createAction('RESET_PROMOTION')();
27 changes: 16 additions & 11 deletions src/background/redux/promotion/reducer.ts
Original file line number Diff line number Diff line change
@@ -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<typeof setShowCSPRNamePromotion>
) => ({
...state,
showCSPRNamePromotion: action.payload
})
);
export const reducer = createReducer(initialState)
.handleAction(
setShowCSPRNamePromotion,
(
state: PromotionState,
action: ReturnType<typeof setShowCSPRNamePromotion>
) => ({
...state,
showCSPRNamePromotion: action.payload
})
)
.handleAction(resetPromotion, () => initialState);
2 changes: 2 additions & 0 deletions src/background/redux/rate-app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ export const ratedInStoreChanged = createAction(
export const askForReviewAfterChanged = createAction(
'ASK_FOR_REVIEW_AFTER_CHANGED'
)<number>();

export const resetRateApp = createAction('RESET_RATE_APP')();
6 changes: 4 additions & 2 deletions src/background/redux/rate-app/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -35,4 +36,5 @@ export const reducer = createReducer(initialState)
...state,
askForReviewAfter: action.payload
})
);
)
.handleAction(resetRateApp, () => initialState);
4 changes: 4 additions & 0 deletions src/background/redux/sagas/onboarding-sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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) {
Expand Down
Loading