-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Improve UX for Liker Land app in-app (#996)
- Loading branch information
Showing
17 changed files
with
273 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { mapActions, mapGetters } from 'vuex'; | ||
|
||
import { checkIsLikeCoinApp } from '~/util/client'; | ||
|
||
import walletLoginMixin from '~/mixins/wallet-login'; | ||
|
||
export default { | ||
mixins: [walletLoginMixin], | ||
computed: { | ||
...mapGetters(['walletHasLoggedIn']), | ||
isInInAppBrowser() { | ||
return this.$route.query.in_app !== undefined || checkIsLikeCoinApp(); | ||
}, | ||
}, | ||
watch: { | ||
isInInAppBrowser: { | ||
immediate: true, | ||
async handler(isInInAppBrowser) { | ||
if (process.server || !isInInAppBrowser || this.walletHasLoggedIn) { | ||
return; | ||
} | ||
await this.connectWallet(); | ||
}, | ||
}, | ||
}, | ||
methods: { | ||
...mapActions(['openConnectWalletModal', 'initWalletAndLogin']), | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { mapActions } from 'vuex'; | ||
|
||
import { logTrackerEvent } from '~/util/EventLogger'; | ||
|
||
export default { | ||
methods: { | ||
...mapActions([ | ||
'openConnectWalletModal', | ||
'disconnectWallet', | ||
'initWallet', | ||
'initWalletAndLogin', | ||
'initIfNecessary', | ||
'restoreSession', | ||
'signLogin', | ||
]), | ||
async connectWallet({ shouldSkipLogin = false } = {}) { | ||
try { | ||
const connection = await this.openConnectWalletModal({ | ||
language: this.$i18n.locale.split('-')[0], | ||
}); | ||
if (!connection) return false; | ||
const { method } = connection; | ||
logTrackerEvent( | ||
this, | ||
'user', | ||
`connected_wallet_${method}`, | ||
'connected_wallet', | ||
1 | ||
); | ||
return shouldSkipLogin | ||
? this.initWallet(connection) | ||
: this.initWalletAndLogin(connection); | ||
} catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.error(err); | ||
return false; | ||
} | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.