Skip to content

Commit

Permalink
lint: comply with rules and improve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
alexruzenhack committed Feb 2, 2024
1 parent 9dd5e7c commit 4197662
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
16 changes: 9 additions & 7 deletions src/components/AskForPushNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ export default function AskForPushNotification(props) {
dispatch(pushDismissOptInQuestion());
};

const pushNotificationOptInModal = () => (<ActionModal
title={t`Do you want to enable push notifications for this wallet?`}
text={t`You can always change this later in the settings menu`}
button={t`Yes, enable`}
onAction={onEnablePushNotifications}
onDismiss={putDismissOptInQuestion}
/>);
const pushNotificationOptInModal = () => (
<ActionModal
title={t`Do you want to enable push notifications for this wallet?`}
text={t`You can always change this later in the settings menu`}
button={t`Yes, enable`}
onAction={onEnablePushNotifications}
onDismiss={putDismissOptInQuestion}
/>
);

if (showOptIn) {
return pushNotificationOptInModal();
Expand Down
8 changes: 4 additions & 4 deletions src/sagas/pushNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
take,
takeLatest,
debounce,
delay,
spawn,
} from 'redux-saga/effects';
import messaging from '@react-native-firebase/messaging';
Expand Down Expand Up @@ -320,16 +319,17 @@ export function* init() {
// after its initialization, but only opens the opt-in
// modal after waller become ready.
// Spwan creates a detached thread from this current thread.
yield spawn(function* handleOptIn(){
yield spawn(function* handleOptIn() {
const { ready } = yield race({
ready: take(types.WALLET_STATE_READY),
// Do nothing with error, only terminates the thread.
error: take(types.WALLET_STATE_ERROR),
});

if (ready) {
// If the user has not been asked yet, we should ask him if he wants to enable push notifications
// We should appear only once, so we should save the fact that the user has dismissed the question
// Ask user for push notification opt-in if it has not
// been asked previously. It appears only once because
// we persist the dismiss action on store.
const optInDismissed = STORE.getItem(pushNotificationKey.optInDismissed);
if (optInDismissed === null || !optInDismissed) {
yield put(pushAskOptInQuestion());
Expand Down

0 comments on commit 4197662

Please sign in to comment.