awesome-landing

1.0.1 • Public • Published

awesome-landing

NPM version build status Test coverage npm download


How to use

open and download all in one

import commonLanding from 'awesome-landing'
 
// for open app
const urlScheme = 'appscheme://app.scheme'
const androidIntentScheme = 'intent://app.intent/#Intent;scheme=appscheme;package=app.package;action=app.action;end'
 
// for download app
const iosDownloadUrl = 'https://itunes.apple.com/us/app/appid'
const androidDownloadUrl = 'https://play.google.com/store/apps/details?id=app.id'
const androidPackageName = 'app.package.name'
const androidIntentDownloadScheme = 'intent://app.intent/#Intent;scheme=appScheme;end'
 
commonLanding({
  urlScheme,
  iosDownloadUrl,
  androidPackageName,
  androidIntentScheme,
  androidDownloadUrl,
  androidIntentDownloadScheme,
  forceIntent, // force Android to use intent
})

Theses params are optional:

  • androidIntentScheme
  • androidIntentDownLoadScheme
  • forceIntent

separate open and download

import {
  openApp,
  download,
} from 'awesome-landing'
 
// for open app
const urlScheme = 'appscheme://app.scheme'
const androidIntentScheme = 'intent://app.intent/#Intent;scheme=appscheme;package=app.package;action=app.action;end'
 
// for download app
const iosDownloadUrl = 'https://itunes.apple.com/us/app/appid'
const androidDownloadUrl = 'https://play.google.com/store/apps/details?id=app.id'
const androidPackageName = 'app.package.name'
const androidIntentDownloadScheme = 'intent://app.intent/#Intent;scheme=appScheme;end'
 
// openApp() returns a Promise
openApp({
  urlScheme,
  androidPackageName,
  androidIntentScheme,
}).then(res => {
  console.log('open app res:', res)
}).catch(e => {
  console.log('open app failed:', e)
})
 
 
download({
  iosDownloadUrl,
  androidDownloadUrl,
  androidIntentDownloadScheme,
})

How to debug

  • add query in url __landingDebug__=1

How to mock userAgent

window.sessionStorage.DEBUG_SCHEME_UA = YOUR_MOCK_UA_STRING

Contributors


yangmingshan


zhangyuheng


xudafeng

This project follows the git-contributor spec, auto upated at Thu Oct 18 2018 11:07:22 GMT+0800.

Readme

Keywords

none

Package Sidebar

Install

npm i awesome-landing

Weekly Downloads

93

Version

1.0.1

License

MIT

Unpacked Size

14 kB

Total Files

5

Last publish

Collaborators

  • xudafeng
  • zyhack