Skip to content

Commit

Permalink
Merge pull request #2702 from santiment/fix/remove-newsletter-subscri…
Browse files Browse the repository at this point in the history
…ption-weekly-digest

newsletter subscription weekly digest related codes removed
  • Loading branch information
peratik authored Jan 17, 2023
2 parents 39f6fff + ef4e711 commit e5d9316
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 64 deletions.
6 changes: 0 additions & 6 deletions src/actions/rootActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
SHOW_NOTIFICATION,
HIDE_NOTIFICATION,
APP_CHANGE_ONLINE_STATUS,
USER_DIGEST_CHANGE,
APP_LAUNCHED,
} from './types'

Expand Down Expand Up @@ -32,9 +31,4 @@ export const changeNetworkStatus = (newtworkStatus) => ({
},
})

export const changeDigestSubscription = (type = 'WEEKLY') => ({
type: USER_DIGEST_CHANGE,
payload: type,
})

export const launchApp = () => ({ type: APP_LAUNCHED })
1 change: 0 additions & 1 deletion src/actions/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const USER_LOGIN_SUCCESS = '[user] LOGIN_SUCCESS'
export const USER_EMAIL_LOGIN = '[user] EMAIL_LOGIN'
export const USER_EMAIL_CHANGE = '[user] EMAIL_CHANGE'
export const USER_SUBSCRIPTION_CHANGE = '[user] SUBSCRIPTION_CHANGE'
export const USER_DIGEST_CHANGE = '[user] DIGEST_CHANGE'
export const USER_USERNAME_CHANGE = '[user] USERNAME_CHANGE'
export const USER_NAME_CHANGE = '[user] NAME_CHANGE'
export const USER_AVATAR_CHANGE = '[user] AVATAR_CHANGE'
Expand Down
27 changes: 1 addition & 26 deletions src/epics/handleEmailLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { trackTwitterSignUpEvent } from 'webkit/analytics/twitter'
import { getSavedLoginMethod } from 'webkit/analytics/events/utils'
import { trackLoginFinish, LoginType } from 'webkit/analytics/events/general'
import { trackSignupFinish } from 'webkit/analytics/events/onboarding'
import { changeDigestSubscription, showNotification } from '../actions/rootActions'
import { showNotification } from '../actions/rootActions'
import * as actions from './../actions/types'
import { savePrevAuthProvider } from '../utils/localStorage'
import GA from './../utils/tracking'
import { setCoupon } from '../utils/coupon'
import { USER_GQL_FRAGMENT } from './handleLaunch'
import { NEWSLETTER_SUBSCRIPTION_MUTATION } from '../pages/Account/gql'

const EMAIL_LOGIN_VERIFY_MUTATION = gql`
mutation emailLoginVerify($email: String!, $token: String!) {
Expand Down Expand Up @@ -93,30 +92,6 @@ export const handleLoginSuccess = (action$) =>
return Observable.of({ type: actions.USER_LOGIN_FAILED, payload: error })
})

export const digestSubscriptionEpic = (action$, store, { client }) =>
action$
.ofType(actions.USER_LOGIN_SUCCESS)
.take(1)
.mergeMap(({ subscribeToWeeklyNewsletter, user: { privacyPolicyAccepted } }) =>
(privacyPolicyAccepted ? Observable.of(true) : action$.ofType(actions.USER_SETTING_GDPR))
.delayWhen(() => Observable.timer(2000))
.take(1)
.mergeMap((action) => {
if (subscribeToWeeklyNewsletter) {
return Observable.from(
client.mutate({
mutation: NEWSLETTER_SUBSCRIPTION_MUTATION,
variables: {
subscription: 'WEEKLY',
},
}),
).mergeMap(() => Observable.of(changeDigestSubscription()))
}

return Observable.empty()
}),
)

const handleEmailLogin = (action$, store, { client }) =>
action$
.ofType(actions.USER_EMAIL_LOGIN)
Expand Down
1 change: 0 additions & 1 deletion src/epics/handleLaunch.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const USER_GQL_FRAGMENT = gql`
address
}
settings {
newsletterSubscription
isBetaMode
theme
isPromoter
Expand Down
3 changes: 1 addition & 2 deletions src/epics/rootEpics.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'rxjs'
import { combineEpics } from 'redux-observable'
import handleLauched from './handleLaunch'
import handleLogout from './handleLogout'
import handleEmailLogin, { digestSubscriptionEpic, handleLoginSuccess } from './handleEmailLogin'
import handleEmailLogin, { handleLoginSuccess } from './handleEmailLogin'
import handleEthLogin, { connectNewWallet, removeConnectedWallet } from './handleEthLogin'
import logoutEpic from './../pages/Logout/LogoutEpic'
import handleGDPR from './handleGDPR'
Expand Down Expand Up @@ -39,7 +39,6 @@ export default combineEpics(
handleEmailLogin,
// First handler after user is logged in (Ethereum or Email Provider)
handleLoginSuccess,
digestSubscriptionEpic,
handleEthLogin,
handleGDPR,
// user's assets lists
Expand Down
9 changes: 0 additions & 9 deletions src/pages/Account/gql.js

This file was deleted.

17 changes: 0 additions & 17 deletions src/reducers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { updateAmplitude } from 'webkit/analytics/amplitude'
import { stores } from '../svelte'
import * as actions from '../actions/types'
import { updateUser } from '../stores/user'
import { updateUserSettingsCache } from '../stores/user/settings'
import { updateUserSubscriptions } from '../stores/user/subscriptions'
import { loginUser, logoutUser } from '../stores/user/flow'

Expand All @@ -17,7 +16,6 @@ export const initialState = {
isTelegarmDeepLinkError: false,
telegramDeepLink: '',
isTelegramConnecting: false,
newsletterSubscription: 'OFF',
},
apikeys: [],
subscriptions: [],
Expand Down Expand Up @@ -117,21 +115,6 @@ export default (state = initialState, action) => {
},
}
}
case actions.USER_DIGEST_CHANGE:
updateUserSettingsCache({
newsletterSubscription: action.payload,
})
return {
...state,
data: {
...state.data,
settings: {
...state.data.settings,
newsletterSubscription: action.payload,
},
},
}

case actions.USER_SETTING_GDPR:
const { privacyPolicyAccepted, marketingAccepted } = action.payload
updateUser({ privacyPolicyAccepted, marketingAccepted })
Expand Down
2 changes: 0 additions & 2 deletions src/stores/user/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ export const DEFAULT_SETTINGS = {
alertNotifyTelegram: false,
pageSize: 20,
theme: 'default',
newsletterSubscription: 'OFF',
alertsPerDayLimit: {},
}

export const USER_SETTINGS_FRAGMENT = gql`
fragment userSettigsFragment on UserSettings {
hidePrivacyData
isBetaMode
newsletterSubscription
pageSize
alertNotifyEmail
alertNotifyTelegram
Expand Down

0 comments on commit e5d9316

Please sign in to comment.