Skip to content

Commit

Permalink
feat: Native path is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ptbrowne committed Jun 4, 2019
1 parent 9d10c09 commit d2dd431
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions react/AppLinker/native.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { UNIVERSAL_LINK_URL } from 'cozy-ui/transpiled/react/AppLinker/native.config.js'

export const getUniversalLinkDomain = () => {
return UNIVERSAL_LINK_URL
}
Expand All @@ -12,12 +13,15 @@ export const getUniversalLinkDomain = () => {
* @param {string} options.cozyUrl - https://name.mycozy.cloud, optional if fallbackUrl is passed
* @return {string} - https://links.cozy.cloud/drive/?fallback...
*/
export const generateUniversalLink = ({
slug,
nativePath,
fallbackUrl,
cozyUrl
}) => {
export const generateUniversalLink = options => {
const { slug, cozyUrl } = options
let { fallbackUrl, nativePath } = options
nativePath = nativePath || '/'
if (!cozyUrl && !fallbackUrl) {
throw new Error(
'Must have either cozyUrl or fallbackUrl to generate universal link.'
)
}
if (cozyUrl && !fallbackUrl) {
fallbackUrl = new URL(cozyUrl)
fallbackUrl.host = fallbackUrl.host
Expand Down

0 comments on commit d2dd431

Please sign in to comment.