awesome-landing
v1.0.1
Published
redirect from webpage to mobile application
Downloads
771
Readme
awesome-landing
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
.