Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quavedev/universal-links
Meteor package that allows you to expose your native iOS settings to enable Universal Links.
https://github.com/quavedev/universal-links
cordova ios meteor-package universal-links
Last synced: 2 days ago
JSON representation
Meteor package that allows you to expose your native iOS settings to enable Universal Links.
- Host: GitHub
- URL: https://github.com/quavedev/universal-links
- Owner: quavedev
- Created: 2020-05-20T14:24:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-14T12:04:47.000Z (over 4 years ago)
- Last Synced: 2024-11-11T22:36:54.001Z (2 months ago)
- Topics: cordova, ios, meteor-package, universal-links
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-meteor - quave:universal-links - A Meteor package that allows you to expose your native iOS settings to enable Universal Links. (Mobile)
README
# quave:universal-links
`quave:universal-links` is a Meteor package that allows you to expose your native iOS settings to enable Universal Links.
## Why
It is very useful to lunch your app from a link and this package make this configuration a breeze.
Remember that you need to enable `Associated Domains` in your app and also configure Universal Links in your `mobile-config.js`.
We believe we are not reinventing the wheel in this package but what we are doing is like putting together the wheels in the vehicle :).
## Installation
```sh
meteor add quave:universal-links
```### Usage
In your settings
```json
"packages": {
"quave:universal-links": {
"appleTeamId": "VR7QCJTCL2",
"appleBundleId": "com.yoursite.app"
}
}
```In your server
```javascript
import { Meteor } from 'meteor/meteor';import { registerUniversalLinksHandler } from 'meteor/quave:universal-links';
Meteor.startup(() => {
registerUniversalLinksHandler();
});
```That is it, now you can access http://localhost:3000/apple-app-site-association and you will get back Apple required configuration for Universal Links.
## Advanced
If you want to provide `appleTeamId` and `appleBundleId` in runtime (in case you serve multiple apps from the same backend) you can use
`createResponderAppleAppSiteAssociation` function. See a full example from a market place that each store can have a native app.```javascript
import { createResponderAppleAppSiteAssociation } from 'meteor/quave:universal-links';import { StoresCollection } from '../../app/stores/data/StoresCollection';
import { getNativeStoresInfo } from './native';
import { getBaseUrlFromHeaders } from '../mode/modeCommon';export const appleAppSiteAssociation = (req, res) => {
const baseUrl = getBaseUrlFromHeaders(req.headers);
const store = StoresCollection.findByFullUrl(baseUrl);
const nativeStoresInfo = getNativeStoresInfo(store);if (!nativeStoresInfo.nativeAppEnabled) {
res.setHeader('Content-Type', 'text/html');
res.writeHead(405);
res.end(`Native App not enabled for ${store.name}
`);
return;
}
if (!nativeStoresInfo.appleTeamId || !nativeStoresInfo.appleBundleId) {
res.setHeader('Content-Type', 'text/html');
res.writeHead(405);
res.end(
`Bundle ID and Team ID are not configured for ${store.name}
`
);
return;
}createResponderAppleAppSiteAssociation(nativeStoresInfo)(req, res);
};Meteor.startup(() => {
WebApp.connectHandlers.use(
APPLE_APP_SITE_ASSOCIATION_PATH,
Meteor.bindEnvironment(appleAppSiteAssociation)
);
});
```### License
MIT