diff --git a/src/App.vue b/src/App.vue
index 263bd214e..e48e54e69 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -28,7 +28,14 @@ export default {
}
},
computed: {
- ...mapState(['activeNetwork', 'brokerReady', 'keyUpdatedAt', 'termsAcceptedAt', 'unlockedAt']),
+ ...mapState([
+ 'activeNetwork',
+ 'brokerReady',
+ 'keyUpdatedAt',
+ 'termsAcceptedAt',
+ 'unlockedAt',
+ 'whatsNewModalVersion'
+ ]),
...mapState({
locale: (state) => state.app?.locale
}),
@@ -41,7 +48,7 @@ export default {
},
methods: {
...mapActions(['initializeAnalytics']),
- ...mapActions('app', ['setLocalePreference', 'getBrowserLocale'])
+ ...mapActions('app', ['setLocalePreference', 'getBrowserLocale', 'setWhatsNewModalContent'])
},
async created() {
await this.initializeAnalytics()
@@ -56,6 +63,13 @@ export default {
// store the locale in state
await this.setLocalePreference({ locale: this.currentLocale })
}
+ if (
+ this.whatsNewModalVersion !== this.appVersion ||
+ process.env.VUE_APP_SHOW_WHATS_NEW_ALWAYS
+ ) {
+ const content = await import(`@/locales/${this.currentLocale}/whats_new.json`)
+ await this.setWhatsNewModalContent({ content: content.default })
+ }
this.localesLoaded = true
},
watch: {
diff --git a/src/components/WhatsNewModal.vue b/src/components/WhatsNewModal.vue
index 4df51145d..d553048c9 100644
--- a/src/components/WhatsNewModal.vue
+++ b/src/components/WhatsNewModal.vue
@@ -25,15 +25,6 @@
-
-
-
-
-
-
- {{ clapCount }}
-
-
@@ -76,27 +67,7 @@ import { version } from '/package.json'
import { mapActions, mapState } from 'vuex'
import ArrowLeftIcon from '@/assets/icons/arrow_left.svg'
import ArrowRightIcon from '@/assets/icons/arrow_right.svg'
-import Clap from './icons/Clap.vue'
import SpinnerIcon from '@/assets/icons/spinner.svg'
-import firebase from 'firebase/app'
-import 'firebase/database'
-import 'firebase/auth'
-import 'firebase/firestore'
-
-const firebaseConfig = {
- apiKey: process.env.VUE_APP_FIREBASE_API_KEY,
- authDomain: process.env.VUE_APP_FIREBASE_AUTH_DOMAIN,
- databaseURL: process.env.VUE_APP_FIREBASE_DATABASE_URL,
- projectId: process.env.VUE_APP_FIREBASE_PROJECT_ID,
- storageBucket: process.env.VUE_APP_FIREBASE_STORAGE_BUCKET,
- messagingSenderId: process.env.VUE_APP_FIREBASE_MESSAGING_SENDER_ID,
- appId: process.env.VUE_APP_FIREBASE_APP_ID,
- measurementId: process.env.VUE_APP_FIREBASE_MEASUREMENT_ID
-}
-
-let db = null
-let clapCollection = null
-let clapDoc = null
export default {
components: {
@@ -104,7 +75,6 @@ export default {
ArrowRightIcon,
ArrowLeftIcon,
Logo,
- Clap,
SpinnerIcon
},
data: function () {
@@ -112,29 +82,12 @@ export default {
open: false,
currentView: 1,
hasClapped: false,
- loading: false,
- loadingContent: true,
- clapCount: 0,
- whatsNewModalContent: {}
- }
- },
- async mounted() {
- try {
- const app = firebase.initializeApp(firebaseConfig)
- db = firebase.firestore(app)
-
- await firebase.auth().signInAnonymously()
-
- clapCollection = db.collection('claps')
- clapDoc = clapCollection.doc(this.appVersion)
-
- this.getClapCount()
- } catch (err) {
- console.error(err)
+ loading: false
}
},
computed: {
...mapState(['whatsNewModalVersion', 'termsAcceptedAt', 'unlockedAt']),
+ ...mapState('app', ['whatsNewModalContent']),
appVersion() {
return version
},
@@ -147,38 +100,6 @@ export default {
...mapActions(['setWhatsNewModalVersion']),
close() {
this.open = false
- },
- async getClapCount() {
- this.loading = true
- try {
- const clapSnap = await clapDoc.get()
- if (clapSnap.exists) {
- this.clapCount = clapSnap.data().count
- } else {
- await clapDoc.set({ count: 0 })
- }
- } catch (err) {
- console.error(err)
- }
- this.loading = false
- },
- async clap() {
- try {
- let count = this.clapCount
- let clapped = this.hasClapped
- if (clapped) {
- count > 0 ? count-- : count
- clapped = false
- } else {
- count++
- clapped = true
- }
- await clapDoc.update({ count })
- this.clapCount = count
- this.hasClapped = clapped
- } catch (err) {
- console.error(err)
- }
}
},
async created() {
@@ -187,17 +108,8 @@ export default {
process.env.VUE_APP_SHOW_WHATS_NEW_ALWAYS
) {
this.open = true
- const locale = this.currentLocale || process.env.VUE_APP_DEFAULT_LOCALE
- const content = await import(`@/locales/${locale}/whats_new.json`)
- this.whatsNewModalContent = content.default
- this.loadingContent = false
this.setWhatsNewModalVersion({ version: this.appVersion })
}
- },
- beforeDestroy() {
- clapDoc = null
- clapCollection = null
- db = null
}
}
diff --git a/src/store/modules/app/actions.js b/src/store/modules/app/actions.js
index 05be40980..b9aa2174b 100644
--- a/src/store/modules/app/actions.js
+++ b/src/store/modules/app/actions.js
@@ -49,6 +49,9 @@ export const actions = {
})
}
},
+ setWhatsNewModalContent: ({ commit }, { content }) => {
+ commit('SET_WHATS_NEW_MODAL_CONTENT', { content })
+ },
openTransakWidgetTab: ({ dispatch, rootState }, { chain, asset, address }) => {
const widgetUrl = process.env.VUE_APP_TRANSAK_WIDGET_URL
const apiKey = process.env.VUE_APP_TRANSAK_API_KEY
diff --git a/src/store/modules/app/mutations.js b/src/store/modules/app/mutations.js
index 729e21e66..3e33e83b0 100644
--- a/src/store/modules/app/mutations.js
+++ b/src/store/modules/app/mutations.js
@@ -5,6 +5,9 @@ export const mutations = {
SET_ANALYTICS_OPTIN_MODAL_OPEN(state, { open }) {
state.analyticsOptInModalOpen = open
},
+ SET_WHATS_NEW_MODAL_CONTENT(state, { content }) {
+ state.whatsNewModalContent = content
+ },
SET_ORIGIN_ACCESS_ACTIVE(state, { active }) {
state.requestOriginAccessActive = active
},
diff --git a/src/store/modules/app/state.js b/src/store/modules/app/state.js
index e79e9dc08..e4cde01d1 100644
--- a/src/store/modules/app/state.js
+++ b/src/store/modules/app/state.js
@@ -8,5 +8,6 @@ export const state = () => ({
buyCryptoOverviewModalOpen: false,
ledgertSignRequestModalOpen: false,
settingsModalOpen: false,
+ whatsNewModalContent: null,
locale: null
})