change the format of custom Url scheme
This commit is contained in:
parent
93961806eb
commit
98dbb358bd
|
|
@ -33,6 +33,7 @@ import JKMyFriends from '../page/JKMyFriends';
|
|||
import JKNotifications from '../page/JKNotifications';
|
||||
import JKMessageModal from '../profile/JKMessageModal';
|
||||
import JKUnsubscribe from '../page/JKUnsubscribe';
|
||||
import JKAppLaunch from '../page/JKAppLaunch';
|
||||
|
||||
import JKMusicSessions from '../page/JKMusicSessions';
|
||||
import JKNewMusicSession from '../page/JKNewMusicSession';
|
||||
|
|
@ -305,6 +306,7 @@ function JKDashboardMain() {
|
|||
<PrivateRoute path="/shopping-cart" component={JKShoppingCart} />
|
||||
<PrivateRoute path="/checkout/success" component={JKCheckoutSuccess} />
|
||||
<PrivateRoute path="/checkout" component={JKCheckout} />
|
||||
<PrivateRoute path="/applaunch" component={JKAppLaunch} />
|
||||
{/*Redirect*/}
|
||||
<Redirect to="/errors/404" />
|
||||
</Switch>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import jkCustomUrlScheme from '../../helpers/jkCustomUrlScheme';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Card, CardBody, Row, Col } from 'reactstrap';
|
||||
import FalconCardHeader from '../common/FalconCardHeader';
|
||||
|
||||
const JKCustomUrlSchemaHandle = () => {
|
||||
const [urlScheme, setUrlScheme] = useState(null);
|
||||
const { t } = useTranslation();
|
||||
useEffect(() => {
|
||||
const queryStr = window.location.search;
|
||||
if (!queryStr) return;
|
||||
const appUrl = jkCustomUrlScheme('createSession', queryStr);
|
||||
setUrlScheme(appUrl);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (urlScheme) {
|
||||
window.open(urlScheme, "_blank");
|
||||
}
|
||||
}, [urlScheme]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Card>
|
||||
<FalconCardHeader title={t('new.page_title', { ns: 'sessions' })} titleClass="font-weight-bold" />
|
||||
<CardBody className="pt-0">
|
||||
<Row>
|
||||
<Col>
|
||||
<div className='pt-5 text-center pb-5'>
|
||||
{urlScheme && (
|
||||
<p>
|
||||
If JamKazam app doesn't open automatically, <a href={urlScheme}>click here</a>.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default JKCustomUrlSchemaHandle;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useRef, useState, useEffect } from 'react';
|
||||
//import {useHistory} from 'react-router-dom';
|
||||
import {useHistory} from 'react-router-dom';
|
||||
import { Form, FormGroup, Input, Label, Card, CardBody, Button, Row, Col } from 'reactstrap';
|
||||
import FalconCardHeader from '../common/FalconCardHeader';
|
||||
import JKTooltip from '../common/JKTooltip';
|
||||
|
|
@ -31,7 +31,7 @@ const JKNewMusicSession = () => {
|
|||
const [privacy, setPrivacy] = useState('1');
|
||||
const [submitted, setSubmitted] = useState(false);
|
||||
const [showAppUnavailable, setShowAppUnavailable] = useState(false);
|
||||
//const history = useHistory();
|
||||
const history = useHistory();
|
||||
const formRef = useRef();
|
||||
const isNativeAppAvailable = useNativeAppCheck();
|
||||
const { nativeAppUnavailable, setNativeAppUnavailable } = useNativeApp();
|
||||
|
|
@ -97,9 +97,9 @@ const JKNewMusicSession = () => {
|
|||
//window.open jamkazam app url using custom URL scheme
|
||||
//an example URL would be: jamkazam://url=https://www.jamkazam.com/client#/createSession/privacy~2|description~hello|inviteeIds~1,2,3,4
|
||||
const q = `privacy~${payload.privacy}|description~${payload.description}|inviteeIds~${payload.inviteeIds}`;
|
||||
const urlScheme = jkCustomUrlScheme('createSession', q);
|
||||
window.location.href = urlScheme;
|
||||
//history.push('/sessions');
|
||||
//const urlScheme = jkCustomUrlScheme('createSession', q);
|
||||
//window.location.href = urlScheme;
|
||||
//history.push(`/applaunch?${q}`);
|
||||
} catch (error) {
|
||||
toggleAppUnavilableModel();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export default (section, queryStr) => {
|
||||
const url = encodeURI(`${process.env.REACT_APP_CLIENT_BASE_URL}/signin?redirect-to=/client#/${section}/custom~yes|${queryStr}`);
|
||||
const urlScheme = `jamkazam://url=${url}`;
|
||||
const url = encodeURI(`${process.env.REACT_APP_CLIENT_BASE_URL}/client#/${section}/custom~yes|${queryStr}`);
|
||||
const urlScheme = `jamkazam://${url}`;
|
||||
return urlScheme;
|
||||
};
|
||||
Loading…
Reference in New Issue