Skip to content

Commit

Permalink
✨ Default to authcore for mobile client in iscn-ar
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Mar 29, 2022
1 parent 09290c7 commit 420c22f
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions pages/in/widget/iscn-ar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ import { mapActions, mapGetters } from 'vuex';
import BigNumber from 'bignumber.js';
import mime from 'mime-types';
import { timeout } from '@/util/misc';
import { checkIsMobileClient } from '~/util/client';
import {
queryLikeCoinBalance as queryCosmosLikeCoinBalance,
calculateGas as calculateCosmosGas,
Expand Down Expand Up @@ -359,6 +360,7 @@ export default {
ExclamationIcon,
LedgerIcon,
StarIcon,
isMobileClient: false,
};
},
async asyncData({
Expand Down Expand Up @@ -407,10 +409,13 @@ export default {
return f;
},
showKeplrOverrideButton() {
return this.showWalletOption && this.getUserIsRegistered && !this.isUsingKeplr;
return this.showWalletOption
&& (this.isMobileClient || this.getUserIsRegistered)
&& !this.isUsingKeplr;
},
},
async mounted() {
this.isMobileClient = checkIsMobileClient();
if (this.opener && !window.opener) {
this.$nuxt.error({ statusCode: 400, message: 'Cannot access window opener' });
}
Expand Down Expand Up @@ -439,6 +444,7 @@ export default {
'calculateISCNTxTotalFee',
'sendISCNSignature',
'setReAuthDialogShow',
'popupAuthDialogInPlace',
]),
onWindowMessage(event) {
if (event && event.data && typeof event.data === 'string') {
Expand Down Expand Up @@ -690,25 +696,31 @@ export default {
const iscnIdString = encodeURIComponent(iscnId);
window.location.href = `https://app.${IS_TESTNET ? 'rinkeby.' : ''}like.co/view/${iscnIdString}?layout=popup`;
},
handleAutheticate() {
if (this.getUserIsRegistered) {
if (this.getAuthCoreNeedReAuth) {
this.setReAuthDialogShow(true);
return true;
}
} else if (this.isMobileClient) {
this.popupAuthDialogInPlace({ route: this.$route, isSignIn: true });
return true;
}
return false;
},
async onClickContinueRegister({ forceKeplr = false } = {}) {
if (!this.isUsingKeplr) {
if (!forceKeplr && this.getUserIsRegistered) {
if (this.getAuthCoreNeedReAuth) {
this.setReAuthDialogShow(true);
return;
}
if (!forceKeplr) {
if (this.handleAutheticate()) return;
} else {
await this.connectKeplr();
}
}
this.submitISCNTransfer();
},
async onClickBeginRegister({ forceKeplr = false } = {}) {
if (!forceKeplr && this.getUserIsRegistered) {
if (this.getAuthCoreNeedReAuth) {
this.setReAuthDialogShow(true);
return;
}
if (!forceKeplr) {
if (this.handleAutheticate()) return;
} else {
await this.connectKeplr();
}
Expand Down

0 comments on commit 420c22f

Please sign in to comment.