Skip to content

Commit

Permalink
navigate the user to the home page after the app review
Browse files Browse the repository at this point in the history
  • Loading branch information
ost-ptk committed Oct 9, 2024
1 parent d9479cd commit e09007d
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 15 deletions.
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 @@ -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,
Expand Down Expand Up @@ -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):
Expand All @@ -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);

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

0 comments on commit e09007d

Please sign in to comment.