Skip to content

Commit

Permalink
fix: be able to open a tip deeplink on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
CedrikNikita committed Sep 29, 2023
1 parent 125271c commit bbcf398
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/composables/deepLinkApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
Router,
RouteLocationNormalized as Route,
} from 'vue-router';

import { ROUTE_ACCOUNT } from '@/popup/router/routeNames';
import { checkIfSuperheroCallbackUrl } from '@/utils';
import { MODAL_TRANSFER_SEND } from '@/constants';
import { useModals } from '@/composables/modals';
Expand All @@ -26,8 +28,11 @@ export function useDeepLinkApi({ router }: UseDeepLinkApiOptions) {
/**
* Function needed to support legacy tipping from superhero.com
*/
function checkIfOpenTransferSendModal() {
if (checkIfSuperheroCallbackUrl(route.query)) {
async function checkIfOpenTransferSendModal(currentRoute: Route) {
if (
currentRoute.path.slice(1) === ROUTE_ACCOUNT
&& checkIfSuperheroCallbackUrl(currentRoute.query)
) {
const { openModal } = useModals();

openModal(MODAL_TRANSFER_SEND);
Expand Down
16 changes: 11 additions & 5 deletions src/popup/pages/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
<script lang="ts">
import {
defineComponent,
onMounted,
watch,
} from 'vue';
import { useRouter } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
import {
Expand Down Expand Up @@ -97,6 +97,7 @@ export default defineComponent({
},
setup() {
const store = useStore();
const route = useRoute();
const router = useRouter();
const {
Expand All @@ -107,9 +108,14 @@ export default defineComponent({
const { isNodeMainnet, isNodeTestnet } = useAeSdk({ store });
onMounted(() => {
checkIfOpenTransferSendModal();
});
watch(
() => route.query,
() => checkIfOpenTransferSendModal(route),
{
deep: true,
immediate: true,
},
);
return {
PROTOCOL_AETERNITY,
Expand Down

0 comments on commit bbcf398

Please sign in to comment.