1 | ;
|
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7 | };
|
8 | var plugin_1 = require('./plugin');
|
9 | /**
|
10 | * @name Ionic Deeplinks
|
11 | * @description This plugin handles deeplinks on iOS and Android for both custom URL scheme links
|
12 | * and Universal App Links.
|
13 | *
|
14 | * @usage
|
15 | * ```typescript
|
16 | * import { Deeplinks } from 'ionic-native';
|
17 | *
|
18 | * Deeplinks.route({
|
19 | '/about-us': AboutPage,
|
20 | '/universal-links-test': AboutPage,
|
21 | '/products/:productId': ProductPage
|
22 | }).subscribe((match) => {
|
23 | // match.$route - the route we matched, which is the matched entry from the arguments to route()
|
24 | // match.$args - the args passed in the link
|
25 | // match.$link - the full link data
|
26 | console.log('Successfully matched route', match);
|
27 | }, (nomatch) => {
|
28 | // nomatch.$link - the full link data
|
29 | console.error('Got a deeplink that didn\'t match', nomatch);
|
30 | });
|
31 | * ```
|
32 | *
|
33 | * Alternatively, if you're using Ionic 2, there's a convenience method that takes a reference to a `NavController` and handles
|
34 | * the actual navigation for you:
|
35 | *
|
36 | * ```typescript
|
37 | * Deeplinks.routeWithNavController(this.navController, {
|
38 | '/about-us': AboutPage,
|
39 | '/products/:productId': ProductPage
|
40 | }).subscribe((match) => {
|
41 | // match.$route - the route we matched, which is the matched entry from the arguments to route()
|
42 | // match.$args - the args passed in the link
|
43 | // match.$link - the full link data
|
44 | console.log('Successfully matched route', match);
|
45 | }, (nomatch) => {
|
46 | // nomatch.$link - the full link data
|
47 | console.error('Got a deeplink that didn\'t match', nomatch);
|
48 | });
|
49 | * ```
|
50 | *
|
51 | * See the [Ionic 2 Deeplinks Demo](https://github.com/driftyco/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to
|
52 | * retrieve the `NavController` reference at runtime.
|
53 | *
|
54 | * @interfaces
|
55 | * DeeplinkMatch
|
56 | */
|
57 | var Deeplinks = (function () {
|
58 | function Deeplinks() {
|
59 | }
|
60 | /**
|
61 | * Define a set of paths to match against incoming deeplinks.
|
62 | *
|
63 | * @param {paths} Define a set of paths to match against incoming deeplinks.
|
64 | * paths takes an object of the form { 'path': data }. If a deeplink
|
65 | * matches the path, the resulting path-data pair will be returned in the
|
66 | * promise result which you can then use to navigate in the app as you see fit.
|
67 | * @returns {Observable<DeeplinkMatch>} Returns an Observable that is called each time a deeplink comes through, and
|
68 | * errors if a deeplink comes through that does not match a given path.
|
69 | */
|
70 | Deeplinks.route = function (paths) { return; };
|
71 | /**
|
72 | *
|
73 | * This is a convenience version of `route` that takes a reference to a NavController
|
74 | * from Ionic 2, or a custom class that conforms to this protocol:
|
75 | *
|
76 | * NavController.push = function(View, Params){}
|
77 | *
|
78 | * This handler will automatically navigate when a route matches. If you need finer-grained
|
79 | * control over the behavior of a matching deeplink, use the plain `route` method.
|
80 | *
|
81 | * @param {paths} Define a set of paths to match against incoming deeplinks.
|
82 | * paths takes an object of the form { 'path': data }. If a deeplink
|
83 | * matches the path, the resulting path-data pair will be returned in the
|
84 | * promise result which you can then use to navigate in the app as you see fit.
|
85 | *
|
86 | * @returns {Observable<DeeplinkMatch>} Returns an Observable that resolves each time a deeplink comes through, and
|
87 | * errors if a deeplink comes through that does not match a given path.
|
88 | */
|
89 | Deeplinks.routeWithNavController = function (navController, paths) { return; };
|
90 | __decorate([
|
91 | plugin_1.Cordova({
|
92 | observable: true
|
93 | })
|
94 | ], Deeplinks, "route", null);
|
95 | __decorate([
|
96 | plugin_1.Cordova({
|
97 | observable: true
|
98 | })
|
99 | ], Deeplinks, "routeWithNavController", null);
|
100 | Deeplinks = __decorate([
|
101 | plugin_1.Plugin({
|
102 | pluginName: 'Deeplinks',
|
103 | plugin: 'ionic-plugin-deeplinks',
|
104 | pluginRef: 'IonicDeeplink',
|
105 | repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
|
106 | platforms: ['iOS', 'Android'],
|
107 | install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/'
|
108 | })
|
109 | ], Deeplinks);
|
110 | return Deeplinks;
|
111 | }());
|
112 | exports.Deeplinks = Deeplinks;
|
113 | //# sourceMappingURL=deeplinks.js.map |
\ | No newline at end of file |