Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SW-1340] fix: be able to open a tip deeplink on mobile #2366

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
pstachel marked this conversation as resolved.
Show resolved Hide resolved
pstachel marked this conversation as resolved.
Show resolved Hide resolved
&& 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