Skip to content

Commit

Permalink
Fix volume migration and add update message
Browse files Browse the repository at this point in the history
  • Loading branch information
remixz committed Aug 1, 2017
1 parent 585e8bb commit 482b71b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
22 changes: 20 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<template>
<div class="sans-serif" id="app">
<umi-header />
<div v-if="newDomain" class="fixed bottom-0 right-0 z-max bg-light-blue pa3 code shadow-1 br2 br--top br--left">
<span>📢 <b>UPDATE:</b> umi.bruggie.com is now umi.party! 🎉</span>
<span class="f6 fw5 dib ml1 ba b--black bg-transparent bg-animate hover-bg-blue hover-white br1 pointer ph2 pv1 tc" @click="newDomain = false">Close</span>

</div>
<main class="bg-white center pv1 ph3 mv3">
<router-view v-if="loaded"></router-view>
<div v-else-if="error">
Expand Down Expand Up @@ -44,7 +49,8 @@ export default {
data () {
return {
loaded: false,
error: false
error: false,
newDomain: false
}
},
metaInfo () {
Expand Down Expand Up @@ -127,7 +133,14 @@ export default {
})
const query = encodeURIComponent(JSON.stringify(obj))
localStorage.setItem('migrated', true)
location.replace(`https://umi.party/migrate?info=${query}&route=${encodeURIComponent(this.$route.fullPath)}`)
return location.replace(`https://umi.party/migrate?info=${query}&route=${encodeURIComponent(this.$route.fullPath)}`)
}
// accidentally broke migration, so volume would be set as the string `undefined`
// this breaks the player, so i'll check for it here before the app mounts
const volume = localStorage.getItem('clappr.umi.party.volume')
if (volume && volume === 'undefined') {
localStorage.setItem('clappr.umi.party.volume', '100')
}
await this.$store.dispatch('startSession')
Expand All @@ -142,6 +155,11 @@ export default {
this.$socket.on('app-update', () => {
runtime.update()
})
if (localStorage.getItem('new-domain')) {
this.newDomain = true
localStorage.removeItem('new-domain')
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/pages/Migrate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
const parsed = JSON.parse(info)
Object.keys(parsed).forEach((key) => {
let newKey = key
if (key.contains('clappr')) {
key = key.replace('umi.bruggie.com', 'umi.party')
newKey = key.replace('umi.bruggie.com', 'umi.party')
}
localStorage.setItem(key, parsed[key])
localStorage.setItem(newKey, parsed[key])
})
localStorage.setItem('new-domain', true)
location.replace(route || '/')
} catch (err) {
location.replace('/')
Expand Down

0 comments on commit 482b71b

Please sign in to comment.