diff --git a/src/actions/rootActions.js b/src/actions/rootActions.js index 70db38f677..40c0f54548 100644 --- a/src/actions/rootActions.js +++ b/src/actions/rootActions.js @@ -2,7 +2,6 @@ import { SHOW_NOTIFICATION, HIDE_NOTIFICATION, APP_CHANGE_ONLINE_STATUS, - USER_DIGEST_CHANGE, APP_LAUNCHED, } from './types' @@ -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 }) diff --git a/src/actions/types.js b/src/actions/types.js index 76c8754c2c..acf462a09d 100644 --- a/src/actions/types.js +++ b/src/actions/types.js @@ -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' diff --git a/src/epics/handleEmailLogin.js b/src/epics/handleEmailLogin.js index 66dbd3529d..91da1b6205 100644 --- a/src/epics/handleEmailLogin.js +++ b/src/epics/handleEmailLogin.js @@ -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!) { @@ -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) diff --git a/src/epics/handleLaunch.js b/src/epics/handleLaunch.js index b4973d62ca..49d36e661f 100644 --- a/src/epics/handleLaunch.js +++ b/src/epics/handleLaunch.js @@ -20,7 +20,6 @@ export const USER_GQL_FRAGMENT = gql` address } settings { - newsletterSubscription isBetaMode theme isPromoter diff --git a/src/epics/rootEpics.js b/src/epics/rootEpics.js index 8da402ed85..e16bcb61e3 100644 --- a/src/epics/rootEpics.js +++ b/src/epics/rootEpics.js @@ -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' @@ -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 diff --git a/src/pages/Account/gql.js b/src/pages/Account/gql.js deleted file mode 100644 index c876f0f6c0..0000000000 --- a/src/pages/Account/gql.js +++ /dev/null @@ -1,9 +0,0 @@ -import gql from 'graphql-tag' - -export const NEWSLETTER_SUBSCRIPTION_MUTATION = gql` - mutation changeNewsletterSubscription($subscription: NewsletterSubscriptionType) { - changeNewsletterSubscription(newsletterSubscription: $subscription) { - newsletterSubscription - } - } -` diff --git a/src/reducers/user.js b/src/reducers/user.js index 2be3cb1045..6982d6deef 100644 --- a/src/reducers/user.js +++ b/src/reducers/user.js @@ -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' @@ -17,7 +16,6 @@ export const initialState = { isTelegarmDeepLinkError: false, telegramDeepLink: '', isTelegramConnecting: false, - newsletterSubscription: 'OFF', }, apikeys: [], subscriptions: [], @@ -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 }) diff --git a/src/stores/user/settings.js b/src/stores/user/settings.js index 7807363f21..d2d22d0932 100644 --- a/src/stores/user/settings.js +++ b/src/stores/user/settings.js @@ -13,7 +13,6 @@ export const DEFAULT_SETTINGS = { alertNotifyTelegram: false, pageSize: 20, theme: 'default', - newsletterSubscription: 'OFF', alertsPerDayLimit: {}, } @@ -21,7 +20,6 @@ export const USER_SETTINGS_FRAGMENT = gql` fragment userSettigsFragment on UserSettings { hidePrivacyData isBetaMode - newsletterSubscription pageSize alertNotifyEmail alertNotifyTelegram