UNPKG

683 kBJavaScriptView Raw
1(function (exports) {
2'use strict';
3
4/**
5 * Initialize the ionic.native Angular module if we're running in ng1.
6 * This iterates through the list of registered plugins and dynamically
7 * creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovaStatusBar.
8 */
9function initAngular1(plugins) {
10 if (window.angular) {
11 var ngModule_1 = window.angular.module('ionic.native', []);
12 for (var name in plugins) {
13 var serviceName = '$cordova' + name;
14 var cls = plugins[name];
15 (function (serviceName, cls, name) {
16 ngModule_1.service(serviceName, [function () {
17 var funcs = window.angular.copy(cls);
18 funcs.prototype['name'] = name;
19 return funcs;
20 }]);
21 })(serviceName, cls, name);
22 }
23 }
24}
25
26function get(obj, path) {
27 for (var i = 0, path = path.split('.'), len = path.length; i < len; i++) {
28 if (!obj) {
29 return null;
30 }
31 obj = obj[path[i]];
32 }
33 return obj;
34}
35
36var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
37
38
39
40
41
42function createCommonjsModule(fn, module) {
43 return module = { exports: {} }, fn(module, module.exports), module.exports;
44}
45
46var root = createCommonjsModule(function (module, exports) {
47"use strict";
48var objectTypes = {
49 'boolean': false,
50 'function': true,
51 'object': true,
52 'number': false,
53 'string': false,
54 'undefined': false
55};
56exports.root = (objectTypes[typeof self] && self) || (objectTypes[typeof window] && window);
57var freeGlobal = objectTypes[typeof commonjsGlobal] && commonjsGlobal;
58if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
59 exports.root = freeGlobal;
60}
61});
62
63function isFunction(x) {
64 return typeof x === 'function';
65}
66var isFunction_2 = isFunction;
67
68var isFunction_1$1 = {
69 isFunction: isFunction_2
70};
71
72var isArray_1$1 = Array.isArray || (function (x) { return x && typeof x.length === 'number'; });
73
74var isArray = {
75 isArray: isArray_1$1
76};
77
78function isObject(x) {
79 return x != null && typeof x === 'object';
80}
81var isObject_2 = isObject;
82
83var isObject_1$1 = {
84 isObject: isObject_2
85};
86
87// typeof any so that it we don't have to cast when comparing a result to the error object
88var errorObject_1$2 = { e: {} };
89
90var errorObject = {
91 errorObject: errorObject_1$2
92};
93
94var errorObject_1$1 = errorObject;
95var tryCatchTarget;
96function tryCatcher() {
97 try {
98 return tryCatchTarget.apply(this, arguments);
99 }
100 catch (e) {
101 errorObject_1$1.errorObject.e = e;
102 return errorObject_1$1.errorObject;
103 }
104}
105function tryCatch(fn) {
106 tryCatchTarget = fn;
107 return tryCatcher;
108}
109var tryCatch_2 = tryCatch;
110
111
112var tryCatch_1$1 = {
113 tryCatch: tryCatch_2
114};
115
116var __extends$2 = (commonjsGlobal && commonjsGlobal.__extends) || function (d, b) {
117 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
118 function __() { this.constructor = d; }
119 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
120};
121/**
122 * An error thrown when one or more errors have occurred during the
123 * `unsubscribe` of a {@link Subscription}.
124 */
125var UnsubscriptionError = (function (_super) {
126 __extends$2(UnsubscriptionError, _super);
127 function UnsubscriptionError(errors) {
128 _super.call(this);
129 this.errors = errors;
130 var err = Error.call(this, errors ?
131 errors.length + " errors occurred during unsubscription:\n " + errors.map(function (err, i) { return ((i + 1) + ") " + err.toString()); }).join('\n ') : '');
132 this.name = err.name = 'UnsubscriptionError';
133 this.stack = err.stack;
134 this.message = err.message;
135 }
136 return UnsubscriptionError;
137}(Error));
138var UnsubscriptionError_2 = UnsubscriptionError;
139
140var UnsubscriptionError_1$1 = {
141 UnsubscriptionError: UnsubscriptionError_2
142};
143
144var isArray_1 = isArray;
145var isObject_1 = isObject_1$1;
146var isFunction_1$3 = isFunction_1$1;
147var tryCatch_1 = tryCatch_1$1;
148var errorObject_1 = errorObject;
149var UnsubscriptionError_1 = UnsubscriptionError_1$1;
150/**
151 * Represents a disposable resource, such as the execution of an Observable. A
152 * Subscription has one important method, `unsubscribe`, that takes no argument
153 * and just disposes the resource held by the subscription.
154 *
155 * Additionally, subscriptions may be grouped together through the `add()`
156 * method, which will attach a child Subscription to the current Subscription.
157 * When a Subscription is unsubscribed, all its children (and its grandchildren)
158 * will be unsubscribed as well.
159 *
160 * @class Subscription
161 */
162var Subscription = (function () {
163 /**
164 * @param {function(): void} [unsubscribe] A function describing how to
165 * perform the disposal of resources when the `unsubscribe` method is called.
166 */
167 function Subscription(unsubscribe) {
168 /**
169 * A flag to indicate whether this Subscription has already been unsubscribed.
170 * @type {boolean}
171 */
172 this.closed = false;
173 if (unsubscribe) {
174 this._unsubscribe = unsubscribe;
175 }
176 }
177 /**
178 * Disposes the resources held by the subscription. May, for instance, cancel
179 * an ongoing Observable execution or cancel any other type of work that
180 * started when the Subscription was created.
181 * @return {void}
182 */
183 Subscription.prototype.unsubscribe = function () {
184 var hasErrors = false;
185 var errors;
186 if (this.closed) {
187 return;
188 }
189 this.closed = true;
190 var _a = this, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
191 this._subscriptions = null;
192 if (isFunction_1$3.isFunction(_unsubscribe)) {
193 var trial = tryCatch_1.tryCatch(_unsubscribe).call(this);
194 if (trial === errorObject_1.errorObject) {
195 hasErrors = true;
196 (errors = errors || []).push(errorObject_1.errorObject.e);
197 }
198 }
199 if (isArray_1.isArray(_subscriptions)) {
200 var index = -1;
201 var len = _subscriptions.length;
202 while (++index < len) {
203 var sub = _subscriptions[index];
204 if (isObject_1.isObject(sub)) {
205 var trial = tryCatch_1.tryCatch(sub.unsubscribe).call(sub);
206 if (trial === errorObject_1.errorObject) {
207 hasErrors = true;
208 errors = errors || [];
209 var err = errorObject_1.errorObject.e;
210 if (err instanceof UnsubscriptionError_1.UnsubscriptionError) {
211 errors = errors.concat(err.errors);
212 }
213 else {
214 errors.push(err);
215 }
216 }
217 }
218 }
219 }
220 if (hasErrors) {
221 throw new UnsubscriptionError_1.UnsubscriptionError(errors);
222 }
223 };
224 /**
225 * Adds a tear down to be called during the unsubscribe() of this
226 * Subscription.
227 *
228 * If the tear down being added is a subscription that is already
229 * unsubscribed, is the same reference `add` is being called on, or is
230 * `Subscription.EMPTY`, it will not be added.
231 *
232 * If this subscription is already in an `closed` state, the passed
233 * tear down logic will be executed immediately.
234 *
235 * @param {TeardownLogic} teardown The additional logic to execute on
236 * teardown.
237 * @return {Subscription} Returns the Subscription used or created to be
238 * added to the inner subscriptions list. This Subscription can be used with
239 * `remove()` to remove the passed teardown logic from the inner subscriptions
240 * list.
241 */
242 Subscription.prototype.add = function (teardown) {
243 if (!teardown || (teardown === Subscription.EMPTY)) {
244 return Subscription.EMPTY;
245 }
246 if (teardown === this) {
247 return this;
248 }
249 var sub = teardown;
250 switch (typeof teardown) {
251 case 'function':
252 sub = new Subscription(teardown);
253 case 'object':
254 if (sub.closed || typeof sub.unsubscribe !== 'function') {
255 break;
256 }
257 else if (this.closed) {
258 sub.unsubscribe();
259 }
260 else {
261 (this._subscriptions || (this._subscriptions = [])).push(sub);
262 }
263 break;
264 default:
265 throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
266 }
267 return sub;
268 };
269 /**
270 * Removes a Subscription from the internal list of subscriptions that will
271 * unsubscribe during the unsubscribe process of this Subscription.
272 * @param {Subscription} subscription The subscription to remove.
273 * @return {void}
274 */
275 Subscription.prototype.remove = function (subscription) {
276 // HACK: This might be redundant because of the logic in `add()`
277 if (subscription == null || (subscription === this) || (subscription === Subscription.EMPTY)) {
278 return;
279 }
280 var subscriptions = this._subscriptions;
281 if (subscriptions) {
282 var subscriptionIndex = subscriptions.indexOf(subscription);
283 if (subscriptionIndex !== -1) {
284 subscriptions.splice(subscriptionIndex, 1);
285 }
286 }
287 };
288 Subscription.EMPTY = (function (empty) {
289 empty.closed = true;
290 return empty;
291 }(new Subscription()));
292 return Subscription;
293}());
294var Subscription_2 = Subscription;
295
296var Subscription_1$1 = {
297 Subscription: Subscription_2
298};
299
300var empty = {
301 closed: true,
302 next: function (value) { },
303 error: function (err) { throw err; },
304 complete: function () { }
305};
306
307var Observer = {
308 empty: empty
309};
310
311var root_1$2 = root;
312var Symbol = root_1$2.root.Symbol;
313var $$rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ?
314 Symbol.for('rxSubscriber') : '@@rxSubscriber';
315
316var rxSubscriber = {
317 $$rxSubscriber: $$rxSubscriber
318};
319
320var __extends$1 = (commonjsGlobal && commonjsGlobal.__extends) || function (d, b) {
321 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
322 function __() { this.constructor = d; }
323 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
324};
325var isFunction_1 = isFunction_1$1;
326var Subscription_1 = Subscription_1$1;
327var Observer_1 = Observer;
328var rxSubscriber_1$1 = rxSubscriber;
329/**
330 * Implements the {@link Observer} interface and extends the
331 * {@link Subscription} class. While the {@link Observer} is the public API for
332 * consuming the values of an {@link Observable}, all Observers get converted to
333 * a Subscriber, in order to provide Subscription-like capabilities such as
334 * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
335 * implementing operators, but it is rarely used as a public API.
336 *
337 * @class Subscriber<T>
338 */
339var Subscriber = (function (_super) {
340 __extends$1(Subscriber, _super);
341 /**
342 * @param {Observer|function(value: T): void} [destinationOrNext] A partially
343 * defined Observer or a `next` callback function.
344 * @param {function(e: ?any): void} [error] The `error` callback of an
345 * Observer.
346 * @param {function(): void} [complete] The `complete` callback of an
347 * Observer.
348 */
349 function Subscriber(destinationOrNext, error, complete) {
350 _super.call(this);
351 this.syncErrorValue = null;
352 this.syncErrorThrown = false;
353 this.syncErrorThrowable = false;
354 this.isStopped = false;
355 switch (arguments.length) {
356 case 0:
357 this.destination = Observer_1.empty;
358 break;
359 case 1:
360 if (!destinationOrNext) {
361 this.destination = Observer_1.empty;
362 break;
363 }
364 if (typeof destinationOrNext === 'object') {
365 if (destinationOrNext instanceof Subscriber) {
366 this.destination = destinationOrNext;
367 this.destination.add(this);
368 }
369 else {
370 this.syncErrorThrowable = true;
371 this.destination = new SafeSubscriber(this, destinationOrNext);
372 }
373 break;
374 }
375 default:
376 this.syncErrorThrowable = true;
377 this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);
378 break;
379 }
380 }
381 Subscriber.prototype[rxSubscriber_1$1.$$rxSubscriber] = function () { return this; };
382 /**
383 * A static factory for a Subscriber, given a (potentially partial) definition
384 * of an Observer.
385 * @param {function(x: ?T): void} [next] The `next` callback of an Observer.
386 * @param {function(e: ?any): void} [error] The `error` callback of an
387 * Observer.
388 * @param {function(): void} [complete] The `complete` callback of an
389 * Observer.
390 * @return {Subscriber<T>} A Subscriber wrapping the (partially defined)
391 * Observer represented by the given arguments.
392 */
393 Subscriber.create = function (next, error, complete) {
394 var subscriber = new Subscriber(next, error, complete);
395 subscriber.syncErrorThrowable = false;
396 return subscriber;
397 };
398 /**
399 * The {@link Observer} callback to receive notifications of type `next` from
400 * the Observable, with a value. The Observable may call this method 0 or more
401 * times.
402 * @param {T} [value] The `next` value.
403 * @return {void}
404 */
405 Subscriber.prototype.next = function (value) {
406 if (!this.isStopped) {
407 this._next(value);
408 }
409 };
410 /**
411 * The {@link Observer} callback to receive notifications of type `error` from
412 * the Observable, with an attached {@link Error}. Notifies the Observer that
413 * the Observable has experienced an error condition.
414 * @param {any} [err] The `error` exception.
415 * @return {void}
416 */
417 Subscriber.prototype.error = function (err) {
418 if (!this.isStopped) {
419 this.isStopped = true;
420 this._error(err);
421 }
422 };
423 /**
424 * The {@link Observer} callback to receive a valueless notification of type
425 * `complete` from the Observable. Notifies the Observer that the Observable
426 * has finished sending push-based notifications.
427 * @return {void}
428 */
429 Subscriber.prototype.complete = function () {
430 if (!this.isStopped) {
431 this.isStopped = true;
432 this._complete();
433 }
434 };
435 Subscriber.prototype.unsubscribe = function () {
436 if (this.closed) {
437 return;
438 }
439 this.isStopped = true;
440 _super.prototype.unsubscribe.call(this);
441 };
442 Subscriber.prototype._next = function (value) {
443 this.destination.next(value);
444 };
445 Subscriber.prototype._error = function (err) {
446 this.destination.error(err);
447 this.unsubscribe();
448 };
449 Subscriber.prototype._complete = function () {
450 this.destination.complete();
451 this.unsubscribe();
452 };
453 return Subscriber;
454}(Subscription_1.Subscription));
455var Subscriber_2 = Subscriber;
456/**
457 * We need this JSDoc comment for affecting ESDoc.
458 * @ignore
459 * @extends {Ignored}
460 */
461var SafeSubscriber = (function (_super) {
462 __extends$1(SafeSubscriber, _super);
463 function SafeSubscriber(_parent, observerOrNext, error, complete) {
464 _super.call(this);
465 this._parent = _parent;
466 var next;
467 var context = this;
468 if (isFunction_1.isFunction(observerOrNext)) {
469 next = observerOrNext;
470 }
471 else if (observerOrNext) {
472 context = observerOrNext;
473 next = observerOrNext.next;
474 error = observerOrNext.error;
475 complete = observerOrNext.complete;
476 if (isFunction_1.isFunction(context.unsubscribe)) {
477 this.add(context.unsubscribe.bind(context));
478 }
479 context.unsubscribe = this.unsubscribe.bind(this);
480 }
481 this._context = context;
482 this._next = next;
483 this._error = error;
484 this._complete = complete;
485 }
486 SafeSubscriber.prototype.next = function (value) {
487 if (!this.isStopped && this._next) {
488 var _parent = this._parent;
489 if (!_parent.syncErrorThrowable) {
490 this.__tryOrUnsub(this._next, value);
491 }
492 else if (this.__tryOrSetError(_parent, this._next, value)) {
493 this.unsubscribe();
494 }
495 }
496 };
497 SafeSubscriber.prototype.error = function (err) {
498 if (!this.isStopped) {
499 var _parent = this._parent;
500 if (this._error) {
501 if (!_parent.syncErrorThrowable) {
502 this.__tryOrUnsub(this._error, err);
503 this.unsubscribe();
504 }
505 else {
506 this.__tryOrSetError(_parent, this._error, err);
507 this.unsubscribe();
508 }
509 }
510 else if (!_parent.syncErrorThrowable) {
511 this.unsubscribe();
512 throw err;
513 }
514 else {
515 _parent.syncErrorValue = err;
516 _parent.syncErrorThrown = true;
517 this.unsubscribe();
518 }
519 }
520 };
521 SafeSubscriber.prototype.complete = function () {
522 if (!this.isStopped) {
523 var _parent = this._parent;
524 if (this._complete) {
525 if (!_parent.syncErrorThrowable) {
526 this.__tryOrUnsub(this._complete);
527 this.unsubscribe();
528 }
529 else {
530 this.__tryOrSetError(_parent, this._complete);
531 this.unsubscribe();
532 }
533 }
534 else {
535 this.unsubscribe();
536 }
537 }
538 };
539 SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
540 try {
541 fn.call(this._context, value);
542 }
543 catch (err) {
544 this.unsubscribe();
545 throw err;
546 }
547 };
548 SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
549 try {
550 fn.call(this._context, value);
551 }
552 catch (err) {
553 parent.syncErrorValue = err;
554 parent.syncErrorThrown = true;
555 return true;
556 }
557 return false;
558 };
559 SafeSubscriber.prototype._unsubscribe = function () {
560 var _parent = this._parent;
561 this._context = null;
562 this._parent = null;
563 _parent.unsubscribe();
564 };
565 return SafeSubscriber;
566}(Subscriber));
567
568var Subscriber_1$1 = {
569 Subscriber: Subscriber_2
570};
571
572var Subscriber_1 = Subscriber_1$1;
573var rxSubscriber_1 = rxSubscriber;
574function toSubscriber(nextOrObserver, error, complete) {
575 if (nextOrObserver) {
576 if (nextOrObserver instanceof Subscriber_1.Subscriber) {
577 return nextOrObserver;
578 }
579 if (nextOrObserver[rxSubscriber_1.$$rxSubscriber]) {
580 return nextOrObserver[rxSubscriber_1.$$rxSubscriber]();
581 }
582 }
583 if (!nextOrObserver && !error && !complete) {
584 return new Subscriber_1.Subscriber();
585 }
586 return new Subscriber_1.Subscriber(nextOrObserver, error, complete);
587}
588var toSubscriber_2 = toSubscriber;
589
590var toSubscriber_1$1 = {
591 toSubscriber: toSubscriber_2
592};
593
594var root_1$3 = root;
595function getSymbolObservable(context) {
596 var $$observable;
597 var Symbol = context.Symbol;
598 if (typeof Symbol === 'function') {
599 if (Symbol.observable) {
600 $$observable = Symbol.observable;
601 }
602 else {
603 $$observable = Symbol('observable');
604 Symbol.observable = $$observable;
605 }
606 }
607 else {
608 $$observable = '@@observable';
609 }
610 return $$observable;
611}
612var getSymbolObservable_1 = getSymbolObservable;
613var $$observable = getSymbolObservable(root_1$3.root);
614
615var observable = {
616 getSymbolObservable: getSymbolObservable_1,
617 $$observable: $$observable
618};
619
620var root_1 = root;
621var toSubscriber_1 = toSubscriber_1$1;
622var observable_1 = observable;
623/**
624 * A representation of any set of values over any amount of time. This the most basic building block
625 * of RxJS.
626 *
627 * @class Observable<T>
628 */
629var Observable = (function () {
630 /**
631 * @constructor
632 * @param {Function} subscribe the function that is called when the Observable is
633 * initially subscribed to. This function is given a Subscriber, to which new values
634 * can be `next`ed, or an `error` method can be called to raise an error, or
635 * `complete` can be called to notify of a successful completion.
636 */
637 function Observable(subscribe) {
638 this._isScalar = false;
639 if (subscribe) {
640 this._subscribe = subscribe;
641 }
642 }
643 /**
644 * Creates a new Observable, with this Observable as the source, and the passed
645 * operator defined as the new observable's operator.
646 * @method lift
647 * @param {Operator} operator the operator defining the operation to take on the observable
648 * @return {Observable} a new observable with the Operator applied
649 */
650 Observable.prototype.lift = function (operator) {
651 var observable$$1 = new Observable();
652 observable$$1.source = this;
653 observable$$1.operator = operator;
654 return observable$$1;
655 };
656 /**
657 * Registers handlers for handling emitted values, error and completions from the observable, and
658 * executes the observable's subscriber function, which will take action to set up the underlying data stream
659 * @method subscribe
660 * @param {PartialObserver|Function} observerOrNext (optional) either an observer defining all functions to be called,
661 * or the first of three possible handlers, which is the handler for each value emitted from the observable.
662 * @param {Function} error (optional) a handler for a terminal event resulting from an error. If no error handler is provided,
663 * the error will be thrown as unhandled
664 * @param {Function} complete (optional) a handler for a terminal event resulting from successful completion.
665 * @return {ISubscription} a subscription reference to the registered handlers
666 */
667 Observable.prototype.subscribe = function (observerOrNext, error, complete) {
668 var operator = this.operator;
669 var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete);
670 if (operator) {
671 operator.call(sink, this);
672 }
673 else {
674 sink.add(this._subscribe(sink));
675 }
676 if (sink.syncErrorThrowable) {
677 sink.syncErrorThrowable = false;
678 if (sink.syncErrorThrown) {
679 throw sink.syncErrorValue;
680 }
681 }
682 return sink;
683 };
684 /**
685 * @method forEach
686 * @param {Function} next a handler for each value emitted by the observable
687 * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise
688 * @return {Promise} a promise that either resolves on observable completion or
689 * rejects with the handled error
690 */
691 Observable.prototype.forEach = function (next, PromiseCtor) {
692 var _this = this;
693 if (!PromiseCtor) {
694 if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {
695 PromiseCtor = root_1.root.Rx.config.Promise;
696 }
697 else if (root_1.root.Promise) {
698 PromiseCtor = root_1.root.Promise;
699 }
700 }
701 if (!PromiseCtor) {
702 throw new Error('no Promise impl found');
703 }
704 return new PromiseCtor(function (resolve, reject) {
705 var subscription = _this.subscribe(function (value) {
706 if (subscription) {
707 // if there is a subscription, then we can surmise
708 // the next handling is asynchronous. Any errors thrown
709 // need to be rejected explicitly and unsubscribe must be
710 // called manually
711 try {
712 next(value);
713 }
714 catch (err) {
715 reject(err);
716 subscription.unsubscribe();
717 }
718 }
719 else {
720 // if there is NO subscription, then we're getting a nexted
721 // value synchronously during subscription. We can just call it.
722 // If it errors, Observable's `subscribe` will ensure the
723 // unsubscription logic is called, then synchronously rethrow the error.
724 // After that, Promise will trap the error and send it
725 // down the rejection path.
726 next(value);
727 }
728 }, reject, resolve);
729 });
730 };
731 Observable.prototype._subscribe = function (subscriber) {
732 return this.source.subscribe(subscriber);
733 };
734 /**
735 * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable
736 * @method Symbol.observable
737 * @return {Observable} this instance of the observable
738 */
739 Observable.prototype[observable_1.$$observable] = function () {
740 return this;
741 };
742 // HACK: Since TypeScript inherits static properties too, we have to
743 // fight against TypeScript here so Subject can have a different static create signature
744 /**
745 * Creates a new cold Observable by calling the Observable constructor
746 * @static true
747 * @owner Observable
748 * @method create
749 * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
750 * @return {Observable} a new cold observable
751 */
752 Observable.create = function (subscribe) {
753 return new Observable(subscribe);
754 };
755 return Observable;
756}());
757var Observable_2 = Observable;
758
759/**
760 * @private
761 * @param pluginRef
762 * @returns {null|*}
763 */
764var getPlugin = function (pluginRef) {
765 return get(window, pluginRef);
766};
767/**
768 * @private
769 * @param pluginObj
770 * @param method
771 */
772var pluginWarn = function (pluginObj, method) {
773 var pluginName = pluginObj.name, plugin = pluginObj.plugin;
774 if (method) {
775 console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
776 }
777 else {
778 console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
779 }
780 console.warn('Install the ' + pluginName + ' plugin: \'ionic plugin add ' + plugin + '\'');
781};
782/**
783 * @private
784 * @param pluginName
785 * @param method
786 */
787var cordovaWarn = function (pluginName, method) {
788 if (method) {
789 console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
790 }
791 else {
792 console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
793 }
794};
795function setIndex(args, opts, resolve, reject) {
796 if (opts === void 0) { opts = {}; }
797 // If the plugin method expects myMethod(success, err, options)
798 if (opts.callbackOrder === 'reverse') {
799 // Get those arguments in the order [resolve, reject, ...restOfArgs]
800 args.unshift(reject);
801 args.unshift(resolve);
802 }
803 else if (opts.callbackStyle === 'node') {
804 args.push(function (err, result) {
805 if (err) {
806 reject(err);
807 }
808 else {
809 resolve(result);
810 }
811 });
812 }
813 else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) {
814 var obj = {};
815 obj[opts.successName] = resolve;
816 obj[opts.errorName] = reject;
817 args.push(obj);
818 }
819 else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
820 // If we've specified a success/error index
821 args.splice(opts.successIndex, 0, resolve);
822 // We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour.
823 if (opts.errorIndex > args.length) {
824 args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
825 }
826 else {
827 args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
828 }
829 }
830 else {
831 // Otherwise, let's tack them on to the end of the argument list
832 // which is 90% of cases
833 args.push(resolve);
834 args.push(reject);
835 }
836 return args;
837}
838function callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject) {
839 if (opts === void 0) { opts = {}; }
840 // Try to figure out where the success/error callbacks need to be bound
841 // to our promise resolve/reject handlers.
842 args = setIndex(args, opts, resolve, reject);
843 var pluginInstance = getPlugin(pluginObj.pluginRef);
844 if (!pluginInstance) {
845 // Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation).
846 if (!window.cordova) {
847 cordovaWarn(pluginObj.name, methodName);
848 return {
849 error: 'cordova_not_available'
850 };
851 }
852 pluginWarn(pluginObj, methodName);
853 return {
854 error: 'plugin_not_installed'
855 };
856 }
857 // TODO: Illegal invocation needs window context
858 return get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args);
859}
860function getPromise(cb) {
861 var tryNativePromise = function () {
862 if (window.Promise) {
863 return new Promise(function (resolve, reject) {
864 cb(resolve, reject);
865 });
866 }
867 else {
868 console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.');
869 }
870 };
871 if (window.angular) {
872 var injector = window.angular.element(document.querySelector('[ng-app]') || document.body).injector();
873 if (injector) {
874 var $q = injector.get('$q');
875 return $q(function (resolve, reject) {
876 cb(resolve, reject);
877 });
878 }
879 else {
880 console.warn('Angular 1 was detected but $q couldn\'t be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won\'t trigger an automatic digest when promises resolve.');
881 return tryNativePromise();
882 }
883 }
884 else {
885 return tryNativePromise();
886 }
887}
888function wrapPromise(pluginObj, methodName, args, opts) {
889 if (opts === void 0) { opts = {}; }
890 var pluginResult, rej;
891 var p = getPromise(function (resolve, reject) {
892 pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
893 rej = reject;
894 });
895 // Angular throws an error on unhandled rejection, but in this case we have already printed
896 // a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
897 // to error
898 if (pluginResult && pluginResult.error) {
899 p.catch(function () { });
900 rej(pluginResult.error);
901 }
902 return p;
903}
904function wrapOtherPromise(pluginObj, methodName, args, opts) {
905 if (opts === void 0) { opts = {}; }
906 return getPromise(function (resolve, reject) {
907 var pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
908 if (pluginResult && pluginResult.error) {
909 reject(pluginResult.error);
910 }
911 pluginResult.then(resolve).catch(reject);
912 });
913}
914function wrapObservable(pluginObj, methodName, args, opts) {
915 if (opts === void 0) { opts = {}; }
916 return new Observable_2(function (observer) {
917 var pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
918 if (pluginResult && pluginResult.error) {
919 observer.error(pluginResult.error);
920 }
921 return function () {
922 try {
923 if (opts.clearFunction) {
924 if (opts.clearWithArgs) {
925 return get(window, pluginObj.pluginRef)[opts.clearFunction].apply(pluginObj, args);
926 }
927 return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult);
928 }
929 }
930 catch (e) {
931 console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
932 console.error(e);
933 }
934 };
935 });
936}
937function callInstance(pluginObj, methodName, args, opts, resolve, reject) {
938 if (opts === void 0) { opts = {}; }
939 args = setIndex(args, opts, resolve, reject);
940 return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
941}
942function wrapInstance(pluginObj, methodName, opts) {
943 if (opts === void 0) { opts = {}; }
944 return function () {
945 var args = [];
946 for (var _i = 0; _i < arguments.length; _i++) {
947 args[_i - 0] = arguments[_i];
948 }
949 if (opts.sync) {
950 // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
951 return callInstance(pluginObj, methodName, args, opts);
952 }
953 else if (opts.observable) {
954 return new Observable_2(function (observer) {
955 var pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
956 return function () {
957 try {
958 if (opts.clearWithArgs) {
959 return pluginObj._objectInstance[opts.clearFunction].apply(pluginObj._objectInstance, args);
960 }
961 return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult);
962 }
963 catch (e) {
964 console.warn('Unable to clear the previous observable watch for', pluginObj.name, methodName);
965 console.error(e);
966 }
967 };
968 });
969 }
970 else if (opts.otherPromise) {
971 return getPromise(function (resolve, reject) {
972 var result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
973 result.then(resolve, reject);
974 });
975 }
976 else {
977 return getPromise(function (resolve, reject) {
978 callInstance(pluginObj, methodName, args, opts, resolve, reject);
979 });
980 }
981 };
982}
983/**
984 * Wrap the event with an observable
985 * @param event
986 * @returns {Observable}
987 */
988function wrapEventObservable(event) {
989 return new Observable_2(function (observer) {
990 window.addEventListener(event, observer.next.bind(observer), false);
991 return function () { return window.removeEventListener(event, observer.next.bind(observer), false); };
992 });
993}
994/**
995 * @private
996 * @param pluginObj
997 * @param methodName
998 * @param opts
999 * @returns {function(...[any]): (undefined|*|Observable|*|*)}
1000 */
1001var wrap = function (pluginObj, methodName, opts) {
1002 if (opts === void 0) { opts = {}; }
1003 return function () {
1004 var args = [];
1005 for (var _i = 0; _i < arguments.length; _i++) {
1006 args[_i - 0] = arguments[_i];
1007 }
1008 if (opts.sync) {
1009 // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
1010 return callCordovaPlugin(pluginObj, methodName, args, opts);
1011 }
1012 else if (opts.observable) {
1013 return wrapObservable(pluginObj, methodName, args, opts);
1014 }
1015 else if (opts.eventObservable && opts.event) {
1016 return wrapEventObservable(opts.event);
1017 }
1018 else if (opts.otherPromise) {
1019 return wrapOtherPromise(pluginObj, methodName, args, opts);
1020 }
1021 else {
1022 return wrapPromise(pluginObj, methodName, args, opts);
1023 }
1024 };
1025};
1026/**
1027 * @private
1028 *
1029 * Class decorator specifying Plugin metadata. Required for all plugins.
1030 *
1031 * @usage
1032 * ```typescript
1033 * @Plugin({
1034 * name: 'MyPlugin',
1035 * plugin: 'cordova-plugin-myplugin',
1036 * pluginRef: 'window.myplugin'
1037 * })
1038 * export class MyPlugin {
1039 *
1040 * // Plugin wrappers, properties, and functions go here ...
1041 *
1042 * }
1043 * ```
1044 */
1045function Plugin(config) {
1046 return function (cls) {
1047 // Add these fields to the class
1048 for (var k in config) {
1049 cls[k] = config[k];
1050 }
1051 cls['installed'] = function () {
1052 return !!getPlugin(config.pluginRef);
1053 };
1054 return cls;
1055 };
1056}
1057/**
1058 * @private
1059 *
1060 * Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
1061 * and the required plugin are installed.
1062 */
1063function Cordova(opts) {
1064 if (opts === void 0) { opts = {}; }
1065 return function (target, methodName, descriptor) {
1066 return {
1067 value: function () {
1068 var args = [];
1069 for (var _i = 0; _i < arguments.length; _i++) {
1070 args[_i - 0] = arguments[_i];
1071 }
1072 return wrap(this, methodName, opts).apply(this, args);
1073 }
1074 };
1075 };
1076}
1077/**
1078 * @private
1079 *
1080 * Wrap an instance method
1081 */
1082function CordovaInstance(opts) {
1083 if (opts === void 0) { opts = {}; }
1084 return function (target, methodName) {
1085 return {
1086 value: function () {
1087 var args = [];
1088 for (var _i = 0; _i < arguments.length; _i++) {
1089 args[_i - 0] = arguments[_i];
1090 }
1091 return wrapInstance(this, methodName, opts).apply(this, args);
1092 }
1093 };
1094 };
1095}
1096/**
1097 * @private
1098 *
1099 *
1100 * Before calling the original method, ensure Cordova and the plugin are installed.
1101 */
1102function CordovaProperty(target, key, descriptor) {
1103 var originalMethod = descriptor.get;
1104 descriptor.get = function () {
1105 var args = [];
1106 for (var _i = 0; _i < arguments.length; _i++) {
1107 args[_i - 0] = arguments[_i];
1108 }
1109 if (!window.cordova) {
1110 cordovaWarn(this.name, null);
1111 return {};
1112 }
1113 var pluginObj = this;
1114 var pluginInstance = getPlugin(pluginObj.pluginRef);
1115 if (!pluginInstance) {
1116 pluginWarn(this, key);
1117 return {};
1118 }
1119 return originalMethod.apply(this, args);
1120 };
1121 return descriptor;
1122}
1123/**
1124 * @private
1125 * @param target
1126 * @param key
1127 * @param descriptor
1128 * @constructor
1129 */
1130function InstanceProperty(target, key, descriptor) {
1131 descriptor.get = function () {
1132 return this._objectInstance[key];
1133 };
1134 descriptor.set = function () {
1135 var args = [];
1136 for (var _i = 0; _i < arguments.length; _i++) {
1137 args[_i - 0] = arguments[_i];
1138 }
1139 this._objectInstance[key] = args[0];
1140 };
1141 return descriptor;
1142}
1143
1144var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1145 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1146 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1147 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;
1148 return c > 3 && r && Object.defineProperty(target, key, r), r;
1149};
1150/**
1151 * @name Action Sheet
1152 * @description
1153 * The ActionSheet plugin shows a native list of options the user can choose from.
1154 *
1155 * Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet).
1156 *
1157 * @usage
1158 * ```typescript
1159 * import { ActionSheet } from 'ionic-native';
1160 *
1161 *
1162 * let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
1163 * ActionSheet.show({
1164 * 'title': 'What do you want with this image?',
1165 * 'buttonLabels': buttonLabels,
1166 * 'addCancelButtonWithLabel': 'Cancel',
1167 * 'addDestructiveButtonWithLabel' : 'Delete'
1168 * }).then((buttonIndex: number) => {
1169 * console.log('Button pressed: ' + buttonIndex);
1170 * });
1171 * ```
1172 *
1173 * @advanced
1174 * ActionSheet options
1175 *
1176 * | Option | Type | Description |
1177 * |-------------------------------|-----------|----------------------------------------------|
1178 * | title |`string` | The title for the actionsheet |
1179 * | buttonLabels |`string[]` | the labels for the buttons. Uses the index x |
1180 * | androidTheme |`number` | Theme to be used on Android |
1181 * | androidEnableCancelButton |`boolean` | Enable a cancel on Android |
1182 * | winphoneEnableCancelButton |`boolean` | Enable a cancel on Windows Phone |
1183 * | addCancelButtonWithLabel |`string` | Add a cancel button with text |
1184 * | addDestructiveButtonWithLabel |`string` | Add a destructive button with text |
1185 * | position |`number[]` | On an iPad, set the X,Y position |
1186 *
1187 *
1188 */
1189var ActionSheet = (function () {
1190 function ActionSheet() {
1191 }
1192 /**
1193 * Show a native ActionSheet component. See below for options.
1194 * @param {options} Options See table below
1195 * @returns {Promise} Returns a Promise that resolves with the index of the
1196 * button pressed (1 based, so 1, 2, 3, etc.)
1197 */
1198 ActionSheet.show = function (options) { return; };
1199 /**
1200 * Progamtically hide the native ActionSheet
1201 * @returns {Promise} Returns a Promise that resolves when the actionsheet is closed
1202 */
1203 ActionSheet.hide = function (options) { return; };
1204 __decorate([
1205 Cordova()
1206 ], ActionSheet, "show", null);
1207 __decorate([
1208 Cordova()
1209 ], ActionSheet, "hide", null);
1210 ActionSheet = __decorate([
1211 Plugin({
1212 plugin: 'cordova-plugin-actionsheet',
1213 pluginRef: 'plugins.actionsheet',
1214 repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet',
1215 platforms: ['Android', 'iOS', 'Windows Phone 8']
1216 })
1217 ], ActionSheet);
1218 return ActionSheet;
1219}());
1220
1221var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1222 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1223 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1224 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;
1225 return c > 3 && r && Object.defineProperty(target, key, r), r;
1226};
1227/**
1228 * @name AdMob
1229 * @description Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
1230 * @usage
1231 * Please refer the the plugin's original repository for detailed usage.
1232 */
1233var AdMob = (function () {
1234 function AdMob() {
1235 }
1236 // Static Methods
1237 /**
1238 *
1239 * @param adIdOrOptions
1240 */
1241 AdMob.createBanner = function (adIdOrOptions) { return; };
1242 /**
1243 *
1244 */
1245 AdMob.removeBanner = function () { };
1246 /**
1247 *
1248 * @param position
1249 */
1250 AdMob.showBanner = function (position) { };
1251 /**
1252 *
1253 * @param x
1254 * @param y
1255 */
1256 AdMob.showBannerAtXY = function (x, y) { };
1257 /**
1258 *
1259 */
1260 AdMob.hideBanner = function () { };
1261 /**
1262 *
1263 * @param adIdOrOptions
1264 */
1265 AdMob.prepareInterstitial = function (adIdOrOptions) { return; };
1266 /**
1267 * Show interstitial
1268 */
1269 AdMob.showInterstitial = function () { };
1270 /**
1271 *
1272 */
1273 AdMob.isInterstitialReady = function () { return; };
1274 /**
1275 * Prepare a reward video ad
1276 * @param adIdOrOptions
1277 */
1278 AdMob.prepareRewardVideoAd = function (adIdOrOptions) { return; };
1279 /**
1280 * Show a reward video ad
1281 */
1282 AdMob.showRewardVideoAd = function () { };
1283 /**
1284 * Sets the values for configuration and targeting
1285 * @param options Returns a promise that resolves if the options are set successfully
1286 */
1287 AdMob.setOptions = function (options) { return; };
1288 /**
1289 * Get user ad settings
1290 * @returns {Promise<any>} Returns a promise that resolves with the ad settings
1291 */
1292 AdMob.getAdSettings = function () { return; };
1293 // Events
1294 AdMob.onBannerFailedToReceive = function () { return; };
1295 AdMob.onBannerReceive = function () { return; };
1296 AdMob.onBannerPresent = function () { return; };
1297 AdMob.onBannerLeaveApp = function () { return; };
1298 AdMob.onBannerDismiss = function () { return; };
1299 AdMob.onInterstitialFailedToReceive = function () { return; };
1300 AdMob.onInterstitialReceive = function () { return; };
1301 AdMob.onInterstitialPresent = function () { return; };
1302 AdMob.onInterstitialLeaveApp = function () { return; };
1303 AdMob.onInterstitialDismiss = function () { return; };
1304 __decorate$1([
1305 Cordova()
1306 ], AdMob, "createBanner", null);
1307 __decorate$1([
1308 Cordova({
1309 sync: true
1310 })
1311 ], AdMob, "removeBanner", null);
1312 __decorate$1([
1313 Cordova({
1314 sync: true
1315 })
1316 ], AdMob, "showBanner", null);
1317 __decorate$1([
1318 Cordova({
1319 sync: true
1320 })
1321 ], AdMob, "showBannerAtXY", null);
1322 __decorate$1([
1323 Cordova({
1324 sync: true
1325 })
1326 ], AdMob, "hideBanner", null);
1327 __decorate$1([
1328 Cordova()
1329 ], AdMob, "prepareInterstitial", null);
1330 __decorate$1([
1331 Cordova({
1332 sync: true
1333 })
1334 ], AdMob, "showInterstitial", null);
1335 __decorate$1([
1336 Cordova()
1337 ], AdMob, "isInterstitialReady", null);
1338 __decorate$1([
1339 Cordova()
1340 ], AdMob, "prepareRewardVideoAd", null);
1341 __decorate$1([
1342 Cordova({
1343 sync: true
1344 })
1345 ], AdMob, "showRewardVideoAd", null);
1346 __decorate$1([
1347 Cordova()
1348 ], AdMob, "setOptions", null);
1349 __decorate$1([
1350 Cordova()
1351 ], AdMob, "getAdSettings", null);
1352 __decorate$1([
1353 Cordova({
1354 eventObservable: true,
1355 event: 'onBannerFailedToReceive'
1356 })
1357 ], AdMob, "onBannerFailedToReceive", null);
1358 __decorate$1([
1359 Cordova({
1360 eventObservable: true,
1361 event: 'onBannerReceive'
1362 })
1363 ], AdMob, "onBannerReceive", null);
1364 __decorate$1([
1365 Cordova({
1366 eventObservable: true,
1367 event: 'onBannerPresent'
1368 })
1369 ], AdMob, "onBannerPresent", null);
1370 __decorate$1([
1371 Cordova({
1372 eventObservable: true,
1373 event: 'onBannerLeaveApp'
1374 })
1375 ], AdMob, "onBannerLeaveApp", null);
1376 __decorate$1([
1377 Cordova({
1378 eventObservable: true,
1379 event: 'onBannerDismiss'
1380 })
1381 ], AdMob, "onBannerDismiss", null);
1382 __decorate$1([
1383 Cordova({
1384 eventObservable: true,
1385 event: 'onInterstitialFailedToReceive'
1386 })
1387 ], AdMob, "onInterstitialFailedToReceive", null);
1388 __decorate$1([
1389 Cordova({
1390 eventObservable: true,
1391 event: 'onInterstitialReceive'
1392 })
1393 ], AdMob, "onInterstitialReceive", null);
1394 __decorate$1([
1395 Cordova({
1396 eventObservable: true,
1397 event: 'onInterstitialPresent'
1398 })
1399 ], AdMob, "onInterstitialPresent", null);
1400 __decorate$1([
1401 Cordova({
1402 eventObservable: true,
1403 event: 'onInterstitialLeaveApp'
1404 })
1405 ], AdMob, "onInterstitialLeaveApp", null);
1406 __decorate$1([
1407 Cordova({
1408 eventObservable: true,
1409 event: 'onInterstitialDismiss'
1410 })
1411 ], AdMob, "onInterstitialDismiss", null);
1412 AdMob = __decorate$1([
1413 Plugin({
1414 plugin: 'cordova-plugin-admobpro',
1415 pluginRef: 'AdMob',
1416 repo: 'https://github.com/floatinghotpot/cordova-admob-pro',
1417 platforms: ['Android', 'iOS', 'Windows Phone 8']
1418 })
1419 ], AdMob);
1420 return AdMob;
1421}());
1422
1423var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1424 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1425 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1426 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;
1427 return c > 3 && r && Object.defineProperty(target, key, r), r;
1428};
1429/**
1430 * @name Android Fingerprint Auth
1431 * @description
1432 * This plugin will open a native dialog fragment prompting the user to authenticate using their fingerprint. If the device has a secure lockscreen (pattern, PIN, or password), the user may opt to authenticate using that method as a backup.
1433 * @usage
1434 * ```typescript
1435 * import { AndroidFingerprintAuth } from 'ionic-native';
1436 *
1437 * AndroidFingerprintAuth.isAvailable()
1438 * .then((result)=> {
1439 * if(result.isAvailable){
1440 * // it is available
1441 *
1442 * AndroidFingerprintAuth.show({ clientId: "myAppName", clientSecret: "so_encrypted_much_secure_very_secret" })
1443 * .then(result => {
1444 * if(result.withFingerprint) {
1445 * console.log('Successfully authenticated with fingerprint!');
1446 * } else if(result.withPassword) {
1447 * console.log('Successfully authenticated with backup password!');
1448 * } else console.log('Didn\'t authenticate!');
1449 * })
1450 * .catch(error => console.error(error));
1451 *
1452 * } else {
1453 * // fingerprint auth isn't available
1454 * }
1455 * })
1456 * .catch(error => console.error(error));
1457 * ```
1458 */
1459var AndroidFingerprintAuth = (function () {
1460 function AndroidFingerprintAuth() {
1461 }
1462 /**
1463 * Opens a native dialog fragment to use the device hardware fingerprint scanner to authenticate against fingerprints registered for the device.
1464 * @param params {any}
1465 */
1466 AndroidFingerprintAuth.show = function (params) { return; };
1467 /**
1468 * Check if service is available
1469 */
1470 AndroidFingerprintAuth.isAvailable = function () { return; };
1471 __decorate$2([
1472 Cordova()
1473 ], AndroidFingerprintAuth, "show", null);
1474 __decorate$2([
1475 Cordova()
1476 ], AndroidFingerprintAuth, "isAvailable", null);
1477 AndroidFingerprintAuth = __decorate$2([
1478 Plugin({
1479 plugin: 'cordova-plugin-android-fingerprint-auth',
1480 pluginRef: 'FingerprintAuth',
1481 repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
1482 })
1483 ], AndroidFingerprintAuth);
1484 return AndroidFingerprintAuth;
1485}());
1486
1487var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1488 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1489 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1490 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;
1491 return c > 3 && r && Object.defineProperty(target, key, r), r;
1492};
1493/**
1494 * @name App Availability
1495 * @description
1496 * This plugin allows you to check if an app is installed on the user's device. It requires an URI Scheme (e.g. twitter://) on iOS or a Package Name (e.g com.twitter.android) on Android.
1497 *
1498 * Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability).
1499 *
1500 * @usage
1501 * ```typescript
1502 * import { AppAvailability } from 'ionic-native';
1503 *
1504 *
1505 * let app;
1506 *
1507 * if (device.platform === 'iOS') {
1508 * app = 'twitter://';
1509 * } else if (device.platform === 'Android') {
1510 * app = 'com.twitter.android';
1511 * }
1512 *
1513 * AppAvailability.check(app)
1514 * .then(
1515 * (yes: string) => console.log(app + ' is available'),
1516 * (no: string) => console.log(app + ' is NOT available')
1517 * );
1518 * ```
1519 */
1520var AppAvailability = (function () {
1521 function AppAvailability() {
1522 }
1523 /**
1524 * Checks if an app is available on device
1525 * @param {string} app Package name on android, or URI scheme on iOS
1526 * @returns {Promise<boolean>}
1527 */
1528 AppAvailability.check = function (app) { return; };
1529 __decorate$3([
1530 Cordova()
1531 ], AppAvailability, "check", null);
1532 AppAvailability = __decorate$3([
1533 Plugin({
1534 plugin: 'cordova-plugin-appavailability',
1535 pluginRef: 'appAvailability',
1536 repo: 'https://github.com/ohh2ahh/AppAvailability',
1537 platforms: ['Android', 'iOS']
1538 })
1539 ], AppAvailability);
1540 return AppAvailability;
1541}());
1542
1543var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1544 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1545 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1546 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;
1547 return c > 3 && r && Object.defineProperty(target, key, r), r;
1548};
1549/**
1550 * @name App Rate
1551 * @description
1552 * The AppRate plugin makes it easy to prompt the user to rate your app, either now, later, or never.
1553 *
1554 * Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate).
1555 *
1556 * @usage
1557 * ```typescript
1558 * import { AppRate } from 'ionic-native';
1559 *
1560 * AppRate.preferences.storeAppURL = {
1561 * ios: '<my_app_id>',
1562 * android: 'market://details?id=<package_name>',
1563 * };
1564 *
1565 * AppRate.promptForRating();
1566 * ```
1567 *
1568 * @advanced
1569 *
1570 * Rating dialog preferences
1571 *
1572 * | Option | Type | Default | Description |
1573 * |------------------------------|------------|---------|----------------------------------------------------------------------------------------|
1574 * | useLanguage | `String` | null | custom BCP 47 language tag |
1575 * | displayAppName | `String` | '' | custom application title |
1576 * | promptAgainForEachNewVersion | `Boolean` | true | show dialog again when application version will be updated |
1577 * | usesUntilPrompt | `Integer` | 3 | count of runs of application before dialog will be displayed |
1578 * | openStoreInApp | `Boolean` | false | leave app or no when application page opened in app store (now supported only for iOS) |
1579 * | useCustomRateDialog | `Boolean` | false | use custom view for rate dialog |
1580 * | callbacks.onButtonClicked | `Function` | null | call back function. called when user clicked on rate-dialog buttons |
1581 * | callbacks.onRateDialogShow | `Function` | null | call back function. called when rate-dialog showing |
1582 * | storeAppURL.ios | `String` | null | application id in AppStore |
1583 * | storeAppURL.android | `String` | null | application URL in GooglePlay |
1584 * | storeAppURL.blackberry | `String` | null | application URL in AppWorld |
1585 * | storeAppURL.windows8 | `String` | null | application URL in WindowsStore |
1586 * | customLocale | `Object` | null | custom locale object |
1587
1588 */
1589var AppRate = (function () {
1590 function AppRate() {
1591 }
1592 Object.defineProperty(AppRate, "preferences", {
1593 /**
1594 * Configure various settings for the Rating View.
1595 * See table below for options
1596 */
1597 get: function () { return window.AppRate.preferences; },
1598 enumerable: true,
1599 configurable: true
1600 });
1601 /**
1602 * Prompts the user for rating
1603 * @param {boolean} immediately Show the rating prompt immediately.
1604 */
1605 AppRate.promptForRating = function (immediately) { };
1606
1607 __decorate$4([
1608 CordovaProperty
1609 ], AppRate, "preferences", null);
1610 __decorate$4([
1611 Cordova()
1612 ], AppRate, "promptForRating", null);
1613 AppRate = __decorate$4([
1614 Plugin({
1615 plugin: 'cordova-plugin-apprate',
1616 pluginRef: 'AppRate',
1617 repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
1618 platforms: ['Android', 'iOS']
1619 })
1620 ], AppRate);
1621 return AppRate;
1622}());
1623
1624var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1625 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1626 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1627 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;
1628 return c > 3 && r && Object.defineProperty(target, key, r), r;
1629};
1630/**
1631 * @name App Version
1632 * @description
1633 * Reads the version of your app from the target build settings.
1634 *
1635 * Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version).
1636 *
1637 * @usage
1638 * ```typescript
1639 * import { AppVersion } from 'ionic-native';
1640 *
1641 *
1642 * AppVersion.getAppName();
1643 * AppVersion.getPackageName();
1644 * AppVersion.getVersionCode();
1645 * AppVersion.getVersionNumber();
1646 * ```
1647 */
1648var AppVersion = (function () {
1649 function AppVersion() {
1650 }
1651 /**
1652 * Returns the name of the app
1653 * @returns {Promise}
1654 */
1655 AppVersion.getAppName = function () { return; };
1656 /**
1657 * Returns the package name of the app
1658 * @returns {Promise}
1659 */
1660 AppVersion.getPackageName = function () { return; };
1661 /**
1662 * Returns the build identifier of the app
1663 * @returns {Promise}
1664 */
1665 AppVersion.getVersionCode = function () { return; };
1666 /**
1667 * Returns the version of the app
1668 * @returns {Promise}
1669 */
1670 AppVersion.getVersionNumber = function () { return; };
1671 __decorate$5([
1672 Cordova()
1673 ], AppVersion, "getAppName", null);
1674 __decorate$5([
1675 Cordova()
1676 ], AppVersion, "getPackageName", null);
1677 __decorate$5([
1678 Cordova()
1679 ], AppVersion, "getVersionCode", null);
1680 __decorate$5([
1681 Cordova()
1682 ], AppVersion, "getVersionNumber", null);
1683 AppVersion = __decorate$5([
1684 Plugin({
1685 plugin: 'cordova-plugin-app-version',
1686 pluginRef: 'cordova.getAppVersion',
1687 repo: 'https://github.com/whiteoctober/cordova-plugin-app-version',
1688 platforms: ['Android', 'iOS']
1689 })
1690 ], AppVersion);
1691 return AppVersion;
1692}());
1693
1694var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1695 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1696 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1697 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;
1698 return c > 3 && r && Object.defineProperty(target, key, r), r;
1699};
1700/**
1701 * @name Badge
1702 * @description
1703 * The essential purpose of badge numbers is to enable an application to inform its users that it has something for them — for example, unread messages — when the application isn’t running in the foreground.
1704 *
1705 * Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
1706 *
1707 * @usage
1708 * ```typescript
1709 * import { Badge } from 'ionic-native';
1710 *
1711 *
1712 * Badge.set(10);
1713 * Badge.increase();
1714 * Badge.clear();
1715 * ```
1716 */
1717var Badge = (function () {
1718 function Badge() {
1719 }
1720 /**
1721 * Clear the badge of the app icon.
1722 */
1723 Badge.clear = function () { return; };
1724 /**
1725 * Set the badge of the app icon.
1726 * @param {number} badgeNumber The new badge number.
1727 * @returns {Promise}
1728 */
1729 Badge.set = function (badgeNumber) { return; };
1730 /**
1731 * Get the badge of the app icon.
1732 * @returns {Promise}
1733 */
1734 Badge.get = function () { return; };
1735 /**
1736 * Increase the badge number.
1737 * @param {number} increaseBy Count to add to the current badge number
1738 * @returns {Promise}
1739 */
1740 Badge.increase = function (increaseBy) { return; };
1741 /**
1742 * Decrease the badge number.
1743 * @param {number} decreaseBy Count to subtract from the current badge number
1744 * @returns {Promise}
1745 */
1746 Badge.decrease = function (decreaseBy) { return; };
1747 /**
1748 * Determine if the app has permission to show badges.
1749 */
1750 Badge.hasPermission = function () { return; };
1751 /**
1752 * Register permission to set badge notifications
1753 * @returns {Promise}
1754 */
1755 Badge.registerPermission = function () { return; };
1756 __decorate$6([
1757 Cordova()
1758 ], Badge, "clear", null);
1759 __decorate$6([
1760 Cordova()
1761 ], Badge, "set", null);
1762 __decorate$6([
1763 Cordova()
1764 ], Badge, "get", null);
1765 __decorate$6([
1766 Cordova()
1767 ], Badge, "increase", null);
1768 __decorate$6([
1769 Cordova()
1770 ], Badge, "decrease", null);
1771 __decorate$6([
1772 Cordova()
1773 ], Badge, "hasPermission", null);
1774 __decorate$6([
1775 Cordova()
1776 ], Badge, "registerPermission", null);
1777 Badge = __decorate$6([
1778 Plugin({
1779 plugin: 'cordova-plugin-badge',
1780 pluginRef: 'cordova.plugins.notification.badge',
1781 repo: 'https://github.com/katzer/cordova-plugin-badge',
1782 platforms: ['Android', 'iOS', 'Browser', 'Windows', 'Amazon FireOS', 'Windows Phone 8']
1783 })
1784 ], Badge);
1785 return Badge;
1786}());
1787
1788var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1789 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1790 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1791 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;
1792 return c > 3 && r && Object.defineProperty(target, key, r), r;
1793};
1794/**
1795 * @name BackgroundGeolocation
1796 * @description
1797 * This plugin provides foreground and background geolocation with battery-saving "circular region monitoring" and "stop detection". For
1798 * more detail, please see https://github.com/mauron85/cordova-plugin-background-geolocation
1799 *
1800 * @usage
1801 *
1802 * ```typescript
1803 * import { BackgroundGeolocation } from 'ionic-native';
1804 *
1805 *
1806 * // When device is ready :
1807 * platform.ready().then(() => {
1808 * // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
1809 *
1810 * // BackgroundGeolocation is highly configurable. See platform specific configuration options
1811 * let config = {
1812 * desiredAccuracy: 10,
1813 * stationaryRadius: 20,
1814 * distanceFilter: 30,
1815 * debug: true, // enable this hear sounds for background-geolocation life-cycle.
1816 * stopOnTerminate: false, // enable this to clear background location settings when the app terminates
1817 * };
1818 *
1819 * BackgroundGeolocation.configure((location) => {
1820 console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
1821
1822 // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
1823 // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
1824 // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
1825 BackgroundGeolocation.finish(); // FOR IOS ONLY
1826
1827 * }, (error) => {
1828 * console.log('BackgroundGeolocation error');
1829 * }, config);
1830 *
1831 * // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
1832 * BackgroundGeolocation.start();
1833 * })
1834 *
1835 * // If you wish to turn OFF background-tracking, call the #stop method.
1836 * BackgroundGeolocation.stop();
1837 *
1838 * ```
1839 */
1840var BackgroundGeolocation = (function () {
1841 function BackgroundGeolocation() {
1842 }
1843 /**
1844 * Configure the plugin.
1845 *
1846 * @param {Function} Success callback will be called when background location is determined.
1847 * @param {Function} Fail callback to be executed every time a geolocation error occurs.
1848 * @param {Object} An object of type Config
1849 *
1850 * @return Location object, which tries to mimic w3c Coordinates interface.
1851 * See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
1852 * Callback to be executed every time a geolocation is recorded in the background.
1853 */
1854 BackgroundGeolocation.configure = function (callback, errorCallback, options) { return; };
1855 /**
1856 * Turn ON the background-geolocation system.
1857 * The user will be tracked whenever they suspend the app.
1858 */
1859 BackgroundGeolocation.start = function () { return; };
1860 /**
1861 * Turn OFF background-tracking
1862 */
1863 BackgroundGeolocation.stop = function () { return; };
1864 /**
1865 * Inform the native plugin that you're finished, the background-task may be completed
1866 * NOTE: IOS, WP only
1867 */
1868 BackgroundGeolocation.finish = function () { };
1869 /**
1870 * Force the plugin to enter "moving" or "stationary" state
1871 * NOTE: IOS, WP only
1872 */
1873 BackgroundGeolocation.changePace = function (isMoving) { };
1874 /**
1875 * Setup configuration
1876 */
1877 BackgroundGeolocation.setConfig = function (options) { return; };
1878 /**
1879 * Returns current stationaryLocation if available. null if not
1880 * NOTE: IOS, WP only
1881 */
1882 BackgroundGeolocation.getStationaryLocation = function () { return; };
1883 /**
1884 * Add a stationary-region listener. Whenever the devices enters "stationary-mode",
1885 * your #success callback will be executed with #location param containing #radius of region
1886 * NOTE: IOS, WP only
1887 */
1888 BackgroundGeolocation.onStationary = function () { return; };
1889 /**
1890 * Check if location is enabled on the device
1891 * @returns {Promise<number>} Returns a promise with int argument that takes values 0, 1 (true).
1892 * NOTE: ANDROID only
1893 */
1894 BackgroundGeolocation.isLocationEnabled = function () { return; };
1895 /**
1896 * Display app settings to change permissions
1897 */
1898 BackgroundGeolocation.showAppSettings = function () { };
1899 /**
1900 * Display device location settings
1901 */
1902 BackgroundGeolocation.showLocationSettings = function () { };
1903 /**
1904 * Method can be used to detect user changes in location services settings.
1905 * If user enable or disable location services then success callback will be executed.
1906 * In case or error (SettingNotFoundException) fail callback will be executed.
1907 * NOTE: ANDROID only
1908 */
1909 BackgroundGeolocation.watchLocationMode = function () { return; };
1910 /**
1911 * Stop watching for location mode changes.
1912 * NOTE: ANDROID only
1913 */
1914 BackgroundGeolocation.stopWatchingLocationMode = function () { };
1915 /**
1916 * Method will return all stored locations.
1917 * Locations are stored when:
1918 * - config.stopOnTerminate is false and main activity was killed
1919 * by the system
1920 * or
1921 * - option.debug is true
1922 * NOTE: ANDROID only
1923 */
1924 BackgroundGeolocation.getLocations = function () { return; };
1925 /**
1926 * Delete stored location by given locationId.
1927 * NOTE: ANDROID only
1928 */
1929 BackgroundGeolocation.deleteLocation = function (locationId) { return; };
1930 /**
1931 * Delete all stored locations.
1932 * NOTE: ANDROID only
1933 */
1934 BackgroundGeolocation.deleteAllLocations = function () { return; };
1935 __decorate$7([
1936 Cordova({
1937 sync: true
1938 })
1939 ], BackgroundGeolocation, "configure", null);
1940 __decorate$7([
1941 Cordova()
1942 ], BackgroundGeolocation, "start", null);
1943 __decorate$7([
1944 Cordova()
1945 ], BackgroundGeolocation, "stop", null);
1946 __decorate$7([
1947 Cordova()
1948 ], BackgroundGeolocation, "finish", null);
1949 __decorate$7([
1950 Cordova()
1951 ], BackgroundGeolocation, "changePace", null);
1952 __decorate$7([
1953 Cordova({
1954 callbackOrder: 'reverse'
1955 })
1956 ], BackgroundGeolocation, "setConfig", null);
1957 __decorate$7([
1958 Cordova()
1959 ], BackgroundGeolocation, "getStationaryLocation", null);
1960 __decorate$7([
1961 Cordova()
1962 ], BackgroundGeolocation, "onStationary", null);
1963 __decorate$7([
1964 Cordova()
1965 ], BackgroundGeolocation, "isLocationEnabled", null);
1966 __decorate$7([
1967 Cordova({ sync: true })
1968 ], BackgroundGeolocation, "showAppSettings", null);
1969 __decorate$7([
1970 Cordova({ sync: true })
1971 ], BackgroundGeolocation, "showLocationSettings", null);
1972 __decorate$7([
1973 Cordova()
1974 ], BackgroundGeolocation, "watchLocationMode", null);
1975 __decorate$7([
1976 Cordova()
1977 ], BackgroundGeolocation, "stopWatchingLocationMode", null);
1978 __decorate$7([
1979 Cordova()
1980 ], BackgroundGeolocation, "getLocations", null);
1981 __decorate$7([
1982 Cordova()
1983 ], BackgroundGeolocation, "deleteLocation", null);
1984 __decorate$7([
1985 Cordova()
1986 ], BackgroundGeolocation, "deleteAllLocations", null);
1987 BackgroundGeolocation = __decorate$7([
1988 Plugin({
1989 plugin: 'cordova-plugin-mauron85-background-geolocation',
1990 pluginRef: 'backgroundGeolocation',
1991 repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation',
1992 platforms: ['iOS', 'Android', 'Windows Phone 8']
1993 })
1994 ], BackgroundGeolocation);
1995 return BackgroundGeolocation;
1996}());
1997
1998var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1999 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2000 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2001 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;
2002 return c > 3 && r && Object.defineProperty(target, key, r), r;
2003};
2004/**
2005* @name Background Mode
2006* @description
2007* Cordova plugin to prevent the app from going to sleep while in background.
2008* Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
2009*@usage
2010* ```typescript
2011* import { BackgroundMode } from 'ionic-native';
2012*
2013* BackgroundMode.enable();
2014* ```
2015*
2016* @advanced
2017*
2018* Configuration options
2019*
2020* | Property | Type | Description |
2021* |----------|-----------|------------------------------------------------------------------------------|
2022* | title | `string` | Title of the background task. Optional |
2023* | ticker | `string` | The text that scrolls itself on the statusbar. Optional |
2024* | text | `string` | Description of the background task. Optional |
2025* | silent | `boolean` | If the plugin will display a notification or not. Default is false. Optional |
2026* | resume | `boolean` | Bring the app into the foreground if the notification is tapped. Optional |
2027*
2028*/
2029var BackgroundMode = (function () {
2030 function BackgroundMode() {
2031 }
2032 /**
2033 * Enable the background mode.
2034 * Once called, prevents the app from being paused while in background.
2035 */
2036 BackgroundMode.enable = function () { };
2037 /**
2038 * Disable the background mode.
2039 * Once the background mode has been disabled, the app will be paused when in background.
2040 */
2041 BackgroundMode.disable = function () { };
2042 /**
2043 * Checks if background mode is enabled or not.
2044 * @returns {boolean} returns a true of false if the background mode is enabled.
2045 */
2046 BackgroundMode.isEnabled = function () { return; };
2047 /**
2048 * Can be used to get the information if the background mode is active.
2049 * @returns {boolean} returns tru or flase if the background mode is active.
2050 */
2051 BackgroundMode.isActive = function () { return; };
2052 /**
2053 * Override the default title, ticker and text.
2054 * Available only for Android platform.
2055 * @param {Configure} options List of option to configure. See table below
2056 */
2057 BackgroundMode.setDefaults = function (options) { };
2058 /**
2059 * Modify the displayed information.
2060 * Available only for Android platform.
2061 * @param {Configure} options Any options you want to update. See table below.
2062 */
2063 BackgroundMode.update = function (options) { };
2064 /**
2065 * Sets a callback for a specific event
2066 * Can be used to get notified or run function when the background mode has been activated, deactivated or failed.
2067 * @param {string} eventName The name of the event. Available events: activate, deactivate, failure
2068 */
2069 BackgroundMode.on = function (eventName, callback) { };
2070 __decorate$8([
2071 Cordova({
2072 sync: true
2073 })
2074 ], BackgroundMode, "enable", null);
2075 __decorate$8([
2076 Cordova()
2077 ], BackgroundMode, "disable", null);
2078 __decorate$8([
2079 Cordova()
2080 ], BackgroundMode, "isEnabled", null);
2081 __decorate$8([
2082 Cordova()
2083 ], BackgroundMode, "isActive", null);
2084 __decorate$8([
2085 Cordova({
2086 platforms: ['Android']
2087 })
2088 ], BackgroundMode, "setDefaults", null);
2089 __decorate$8([
2090 Cordova({
2091 platforms: ['Android']
2092 })
2093 ], BackgroundMode, "update", null);
2094 __decorate$8([
2095 Cordova({
2096 sync: true
2097 })
2098 ], BackgroundMode, "on", null);
2099 BackgroundMode = __decorate$8([
2100 Plugin({
2101 plugin: 'cordova-plugin-background-mode',
2102 pluginRef: 'cordova.plugins.backgroundMode',
2103 repo: 'https://github.com/katzer/cordova-plugin-background-mode',
2104 platforms: ['Android', 'iOS', 'Windows Phone 8']
2105 })
2106 ], BackgroundMode);
2107 return BackgroundMode;
2108}());
2109
2110var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2111 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2112 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2113 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;
2114 return c > 3 && r && Object.defineProperty(target, key, r), r;
2115};
2116/**
2117 * @name Barcode Scanner
2118 * @description
2119 * The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you.
2120 *
2121 * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).
2122 *
2123 * @usage
2124 * ```typescript
2125 * import { BarcodeScanner } from 'ionic-native';
2126 *
2127 *
2128 * BarcodeScanner.scan().then((barcodeData) => {
2129 * // Success! Barcode data is here
2130 * }, (err) => {
2131 * // An error occurred
2132 * });
2133 * ```
2134 */
2135var BarcodeScanner = (function () {
2136 function BarcodeScanner() {
2137 }
2138 /**
2139 * Open the barcode scanner.
2140 * @param options {Object} Optional options to pass to the scanner
2141 * @return Returns a Promise that resolves with scanner data, or rejects with an error.
2142 */
2143 BarcodeScanner.scan = function (options) { return; };
2144 /**
2145 * Encodes data into a barcode.
2146 * NOTE: not well supported on Android
2147 * @param type {string} Type of encoding
2148 * @param data {any} Data to encode
2149 */
2150 BarcodeScanner.encode = function (type, data) { return; };
2151 /**
2152 * @private
2153 */
2154 BarcodeScanner.Encode = {
2155 TEXT_TYPE: 'TEXT_TYPE',
2156 EMAIL_TYPE: 'EMAIL_TYPE',
2157 PHONE_TYPE: 'PHONE_TYPE',
2158 SMS_TYPE: 'SMS_TYPE'
2159 };
2160 __decorate$9([
2161 Cordova({
2162 callbackOrder: 'reverse'
2163 })
2164 ], BarcodeScanner, "scan", null);
2165 __decorate$9([
2166 Cordova()
2167 ], BarcodeScanner, "encode", null);
2168 BarcodeScanner = __decorate$9([
2169 Plugin({
2170 plugin: 'phonegap-plugin-barcodescanner',
2171 pluginRef: 'cordova.plugins.barcodeScanner',
2172 repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner',
2173 platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows 10', 'Windows 8', 'BlackBerry 10', 'Browser']
2174 })
2175 ], BarcodeScanner);
2176 return BarcodeScanner;
2177}());
2178
2179var __decorate$10 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2180 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2181 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2182 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;
2183 return c > 3 && r && Object.defineProperty(target, key, r), r;
2184};
2185/**
2186 * @name Base64 To Gallery
2187 * @description This plugin allows you to save base64 data as a png image into the device
2188 * @usage
2189 * ```typescript
2190 * import { Base64ToGallery } from 'ionic-native';
2191 *
2192 *
2193 * Base64ToGallery.base64ToGallery(base64Data, 'img_').then(
2194 * res => console.log('Saved image to gallery ', res),
2195 * err => console.log('Error saving image to gallery ', err)
2196 * );
2197 * ```
2198 */
2199var Base64ToGallery = (function () {
2200 function Base64ToGallery() {
2201 }
2202 /**
2203 * Converts a base64 string to an image file in the device gallery
2204 * @param {string} data The actual base64 string that you want to save
2205 * @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
2206 * @returns {Promise} returns a promise that resolves when the image is saved.
2207 */
2208 Base64ToGallery.base64ToGallery = function (data, options) {
2209 return;
2210 };
2211 __decorate$10([
2212 Cordova({
2213 successIndex: 2,
2214 errorIndex: 3
2215 })
2216 ], Base64ToGallery, "base64ToGallery", null);
2217 Base64ToGallery = __decorate$10([
2218 Plugin({
2219 plugin: 'cordova-base64-to-gallery',
2220 pluginRef: 'cordova',
2221 repo: 'https://github.com/Nexxa/cordova-base64-to-gallery',
2222 platforms: ['Android', 'iOS', 'Windows Phone 8']
2223 })
2224 ], Base64ToGallery);
2225 return Base64ToGallery;
2226}());
2227
2228var __decorate$11 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2229 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2230 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2231 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;
2232 return c > 3 && r && Object.defineProperty(target, key, r), r;
2233};
2234/**
2235 * @name Battery Status
2236 * @description
2237 * Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status).
2238 *
2239 * @usage
2240 * ```typescript
2241 * import { BatteryStatus } from 'ionic-native';
2242 *
2243 *
2244 * // watch change in battery status
2245 * let subscription = BatteryStatus.onChange().subscribe(
2246 * (status: StatusObject) => {
2247 * console.log(status.level, status.isPlugged);
2248 * }
2249 * );
2250 *
2251 * // stop watch
2252 * subscription.unsubscribe();
2253 *
2254 * ```
2255 */
2256var BatteryStatus = (function () {
2257 function BatteryStatus() {
2258 }
2259 /**
2260 * Watch the change in battery level
2261 * @returns {Observable} Returns an observable that pushes a status object
2262 */
2263 BatteryStatus.onChange = function () { return; };
2264 /**
2265 * Watch when the battery level goes low
2266 * @returns {Observable<StatusObject>} Returns an observable that pushes a status object
2267 */
2268 BatteryStatus.onLow = function () { return; };
2269 /**
2270 * Watch when the battery level goes to critial
2271 * @returns {Observable<StatusObject>} Returns an observable that pushes a status object
2272 */
2273 BatteryStatus.onCritical = function () { return; };
2274 __decorate$11([
2275 Cordova({
2276 eventObservable: true,
2277 event: 'batterystatus'
2278 })
2279 ], BatteryStatus, "onChange", null);
2280 __decorate$11([
2281 Cordova({
2282 eventObservable: true,
2283 event: 'batterylow'
2284 })
2285 ], BatteryStatus, "onLow", null);
2286 __decorate$11([
2287 Cordova({
2288 eventObservable: true,
2289 event: 'batterycritical'
2290 })
2291 ], BatteryStatus, "onCritical", null);
2292 BatteryStatus = __decorate$11([
2293 Plugin({
2294 plugin: 'cordova-plugin-battery-status',
2295 repo: 'https://github.com/apache/cordova-plugin-battery-status',
2296 platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
2297 })
2298 ], BatteryStatus);
2299 return BatteryStatus;
2300}());
2301
2302var __decorate$12 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2303 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2304 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2305 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;
2306 return c > 3 && r && Object.defineProperty(target, key, r), r;
2307};
2308/**
2309 * @name Brightness
2310 * @description
2311 * The Brightness plugin let you control the display brightness of your device.
2312 *
2313 * Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness).
2314 *
2315 * @usage
2316 * ```typescript
2317 * import { Brightness } from 'ionic-native';
2318 *
2319 *
2320 * let brightnessValue: number = 0.8;
2321 * Brightness.setBrightness(brightnessValue);
2322 * ```
2323 *
2324 */
2325var Brightness = (function () {
2326 function Brightness() {
2327 }
2328 /**
2329 * Sets the brightness of the display.
2330 *
2331 * @param {value} Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness.
2332 * @returns {Promise} Returns a Promise that resolves if setting brightness was successful.
2333 */
2334 Brightness.setBrightness = function (value) { return; };
2335 /**
2336 * Reads the current brightness of the device display.
2337 *
2338 * @returns {Promise} Returns a Promise that resolves with the
2339 * brightness value of the device display (floating number between 0 and 1).
2340 */
2341 Brightness.getBrightness = function () { return; };
2342 /**
2343 * Keeps the screen on. Prevents the device from setting the screen to sleep.
2344 */
2345 Brightness.setKeepScreenOn = function (value) { };
2346 __decorate$12([
2347 Cordova()
2348 ], Brightness, "setBrightness", null);
2349 __decorate$12([
2350 Cordova()
2351 ], Brightness, "getBrightness", null);
2352 __decorate$12([
2353 Cordova()
2354 ], Brightness, "setKeepScreenOn", null);
2355 Brightness = __decorate$12([
2356 Plugin({
2357 plugin: 'cordova-plugin-brightness',
2358 pluginRef: 'cordova.plugins.brightness',
2359 repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
2360 platforms: ['Android', 'iOS']
2361 })
2362 ], Brightness);
2363 return Brightness;
2364}());
2365
2366var __decorate$13 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2367 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2368 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2369 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;
2370 return c > 3 && r && Object.defineProperty(target, key, r), r;
2371};
2372/**
2373 * @name BLE
2374 * @description
2375 * This plugin enables communication between a phone and Bluetooth Low Energy (BLE) peripherals.
2376 *
2377 * The plugin provides a simple JavaScript API for iOS and Android.
2378 *
2379 * - Scan for peripherals
2380 * - Connect to a peripheral
2381 * - Read the value of a characteristic
2382 * - Write new value to a characteristic
2383 * - Get notified when characteristic's value changes
2384 *
2385 * Advertising information is returned when scanning for peripherals. Service, characteristic, and property info is returned when connecting to a peripheral. All access is via service and characteristic UUIDs. The plugin manages handles internally.
2386 *
2387 * Simultaneous connections to multiple peripherals are supported.
2388 *
2389 * @usage
2390 *
2391 * ## Peripheral Data
2392 *
2393 * Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning.
2394 *
2395 * ```typescript
2396 * {
2397 * "name": "Battery Demo",
2398 * "id": "20:FF:D0:FF:D1:C0",
2399 * "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],
2400 * "rssi": -55
2401 * }
2402 * ```
2403 * After connecting, the peripheral object also includes service, characteristic and descriptor information.
2404 *
2405 * ```typescript
2406 * {
2407 * "name": "Battery Demo",
2408 * "id": "20:FF:D0:FF:D1:C0",
2409 * "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],
2410 * "rssi": -55,
2411 * "services": [
2412 * "1800",
2413 * "1801",
2414 * "180f"
2415 * ],
2416 * "characteristics": [
2417 * {
2418 * "service": "1800",
2419 * "characteristic": "2a00",
2420 * "properties": [
2421 * "Read"
2422 * ]
2423 * },
2424 * {
2425 * "service": "1800",
2426 * "characteristic": "2a01",
2427 * "properties": [
2428 * "Read"
2429 * ]
2430 * },
2431 * {
2432 * "service": "1801",
2433 * "characteristic": "2a05",
2434 * "properties": [
2435 * "Read"
2436 * ]
2437 * },
2438 * {
2439 * "service": "180f",
2440 * "characteristic": "2a19",
2441 * "properties": [
2442 * "Read"
2443 * ],
2444 * "descriptors": [
2445 * {
2446 * "uuid": "2901"
2447 * },
2448 * {
2449 * "uuid": "2904"
2450 * }
2451 * ]
2452 * }
2453 * ]
2454 * }
2455 * ```
2456 *
2457 * ## Advertising Data
2458 * Bluetooth advertising data is returned in when scanning for devices. The format format varies depending on your platform. On Android advertising data will be the raw advertising bytes. iOS does not allow access to raw advertising data, so a dictionary of data is returned.
2459 *
2460 * The advertising information for both Android and iOS appears to be a combination of advertising data and scan response data.
2461 *
2462 * ### Android
2463 *
2464 * ```typescript
2465 * {
2466 * "name": "demo",
2467 * "id": "00:1A:7D:DA:71:13",
2468 * "advertising": ArrayBuffer,
2469 * "rssi": -37
2470 * }
2471 * ```
2472 *
2473 * Convert the advertising info to a Uint8Array for processing. `var adData = new Uint8Array(peripheral.advertising)`
2474 *
2475 * ### iOS
2476 *
2477 * Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future.
2478 *
2479 * ```typescript
2480 * {
2481 * "name": "demo",
2482 * "id": "D8479A4F-7517-BCD3-91B5-3302B2F81802",
2483 * "advertising": {
2484 * "kCBAdvDataChannel": 37,
2485 * "kCBAdvDataServiceData": {
2486 * "FED8": {
2487 * "byteLength": 7 // data not shown
2488 * }
2489 * },
2490 * "kCBAdvDataLocalName": "demo",
2491 * "kCBAdvDataServiceUUIDs": ["FED8"],
2492 * "kCBAdvDataManufacturerData": {
2493 * "byteLength": 7 // data not shown
2494 * },
2495 * "kCBAdvDataTxPowerLevel": 32,
2496 * "kCBAdvDataIsConnectable": true
2497 * },
2498 * "rssi": -53
2499 * }
2500 * ```
2501 *
2502 * ## Typed Arrays
2503 *
2504 * This plugin uses typed Arrays or ArrayBuffers for sending and receiving data.
2505 *
2506 * This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving.
2507 *
2508 * ```typescript
2509 * // ASCII only
2510 * function stringToBytes(string) {
2511 * var array = new Uint8Array(string.length);
2512 * for (var i = 0, l = string.length; i < l; i++) {
2513 * array[i] = string.charCodeAt(i);
2514 * }
2515 * return array.buffer;
2516 * }
2517 *
2518 * // ASCII only
2519 * function bytesToString(buffer) {
2520 * return String.fromCharCode.apply(null, new Uint8Array(buffer));
2521 * }
2522 * ```
2523 * You can read more about typed arrays in these articles on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) and [HTML5 Rocks](http://www.html5rocks.com/en/tutorials/webgl/typed_arrays/).
2524 *
2525 * ## UUIDs
2526 *
2527 * UUIDs are always strings and not numbers. Some 16-bit UUIDs, such as '2220' look like integers, but they're not. (The integer 2220 is 0x8AC in hex.) This isn't a problem with 128 bit UUIDs since they look like strings 82b9e6e1-593a-456f-be9b-9215160ebcac. All 16-bit UUIDs should also be passed to methods as strings.
2528 *
2529 */
2530var BLE = (function () {
2531 function BLE() {
2532 }
2533 /**
2534 * Scan and discover BLE peripherals for the specified amount of time.
2535 *
2536 * @usage
2537 * ```
2538 * BLE.scan([], 5).subscribe(device => {
2539 * console.log(JSON.stringify(device));
2540 * });
2541 * ```
2542 * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
2543 * @param {number} seconds Number of seconds to run discovery
2544 * @return Returns an Observable that notifies of each peripheral that is discovered during the specified time.
2545 */
2546 BLE.scan = function (services, seconds) { return; };
2547 /**
2548 * Scan and discover BLE peripherals until `stopScan` is called.
2549 *
2550 * @usage
2551 * ```
2552 * BLE.startScan([]).subscribe(device => {
2553 * console.log(JSON.stringify(device));
2554 * });
2555 *
2556 * setTimeout(() => {
2557 * BLE.stopScan();
2558 * }, 5000);
2559 * ```
2560 * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices
2561 * @return Returns an Observable that notifies of each peripheral discovered.
2562 */
2563 BLE.startScan = function (services) { return; };
2564 /**
2565 * Stop a scan started by `startScan`.
2566 *
2567 * @usage
2568 * ```
2569 * BLE.startScan([]).subscribe(device => {
2570 * console.log(JSON.stringify(device));
2571 * });
2572 * setTimeout(() => {
2573 * BLE.stopScan().then(() => { console.log('scan stopped'); });
2574 * }, 5000);
2575 * ```
2576 * @return returns a Promise.
2577 */
2578 BLE.stopScan = function () { return; };
2579 /**
2580 * Connect to a peripheral.
2581 * @usage
2582 * ```
2583 * BLE.connect('12:34:56:78:9A:BC').subscribe(peripheralData => {
2584 * console.log(peripheralData);
2585 * },
2586 * peripheralData => {
2587 * console.log('disconnected');
2588 * });
2589 * ```
2590 * @param deviceId {string} UUID or MAC address of the peripheral
2591 * @return Returns an Observable that notifies of connect/disconnect.
2592 */
2593 BLE.connect = function (deviceId) { return; };
2594 /**
2595 * Disconnect from a peripheral.
2596 * @usage
2597 * ```
2598 * BLE.disconnect('12:34:56:78:9A:BC').then(() => {
2599 * console.log('Disconnected');
2600 * });
2601 * ```
2602 * @param deviceId {string} UUID or MAC address of the peripheral
2603 * @return Returns a Promise
2604 */
2605 BLE.disconnect = function (deviceId) { return; };
2606 /**
2607 * Read the value of a characteristic.
2608 *
2609 * @param {string} deviceId UUID or MAC address of the peripheral
2610 * @param {string} serviceUUID UUID of the BLE service
2611 * @param {string} characteristicUUID UUID of the BLE characteristic
2612 * @return Returns a Promise
2613 */
2614 BLE.read = function (deviceId, serviceUUID, characteristicUUID) { return; };
2615
2616 /**
2617 * Write the value of a characteristic.
2618 * @usage
2619 * ```
2620 * // send 1 byte to switch a light on
2621 * var data = new Uint8Array(1);
2622 * data[0] = 1;
2623 * BLE.write(device_id, "FF10", "FF11", data.buffer);
2624 *
2625 * // send a 3 byte value with RGB color
2626 * var data = new Uint8Array(3);
2627 * data[0] = 0xFF; // red
2628 * data[0] = 0x00; // green
2629 * data[0] = 0xFF; // blue
2630 * BLE.write(device_id, "ccc0", "ccc1", data.buffer);
2631 *
2632 * // send a 32 bit integer
2633 * var data = new Uint32Array(1);
2634 * data[0] = counterInput.value;
2635 * BLE.write(device_id, SERVICE, CHARACTERISTIC, data.buffer);
2636 *
2637 * ```
2638 * @param {string} deviceId UUID or MAC address of the peripheral
2639 * @param {string} serviceUUID UUID of the BLE service
2640 * @param {string} characteristicUUID UUID of the BLE characteristic
2641 * @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
2642 * @return Returns a Promise
2643 */
2644 BLE.write = function (deviceId, serviceUUID, characteristicUUID, value) { return; };
2645 /**
2646 * Write the value of a characteristic without waiting for confirmation from the peripheral.
2647 *
2648 * @param {string} deviceId UUID or MAC address of the peripheral
2649 * @param {string} serviceUUID UUID of the BLE service
2650 * @param {string} characteristicUUID UUID of the BLE characteristic
2651 * @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer.
2652 * @return Returns a Promise
2653 */
2654 BLE.writeWithoutResponse = function (deviceId, serviceUUID, characteristicUUID, value) { return; };
2655 /**
2656 * Register to be notified when the value of a characteristic changes.
2657 *
2658 * @usage
2659 * ```
2660 * BLE.startNotification(device_id, "FF10", "FF11").subscribe(buffer => {
2661 * console.log(String.fromCharCode.apply(null, new Uint8Array(buffer));
2662 * });
2663 * ```
2664 *
2665 * @param {string} deviceId UUID or MAC address of the peripheral
2666 * @param {string} serviceUUID UUID of the BLE service
2667 * @param {string} characteristicUUID UUID of the BLE characteristic
2668 * @return Returns an Observable that notifies of characteristic changes.
2669 */
2670 BLE.startNotification = function (deviceId, serviceUUID, characteristicUUID) { return; };
2671 /**
2672 * Stop being notified when the value of a characteristic changes.
2673 *
2674 * @param {string} deviceId UUID or MAC address of the peripheral
2675 * @param {string} serviceUUID UUID of the BLE service
2676 * @param {string} characteristicUUID UUID of the BLE characteristic
2677 * @return Returns a Promise.
2678 */
2679 BLE.stopNotification = function (deviceId, serviceUUID, characteristicUUID) { return; };
2680 /**
2681 * Report the connection status.
2682 *
2683 * @usage
2684 * ```
2685 * BLE.isConnected('FFCA0B09-CB1D-4DC0-A1EF-31AFD3EDFB53').then(
2686 * () => { console.log('connected'); },
2687 * () => { console.log('not connected'); }
2688 * );
2689 * ```
2690 * @param {string} deviceId UUID or MAC address of the peripheral
2691 * @return Returns a Promise.
2692 */
2693 BLE.isConnected = function (deviceId) { return; };
2694 /**
2695 * Report if bluetooth is enabled.
2696 *
2697 * @usage
2698 * ```
2699 * BLE.isEnabled().then(
2700 * () => { console.log('enabled'); },
2701 * () => { console.log('not enabled'); }
2702 * );
2703 * ```
2704 * @return Returns a Promise.
2705 */
2706 BLE.isEnabled = function () { return; };
2707 /**
2708 * Open System Bluetooth settings (Android only).
2709 *
2710 * @return Returns a Promise.
2711 */
2712 BLE.showBluetoothSettings = function () { return; };
2713 /**
2714 * Enable Bluetooth on the device (Android only).
2715 *
2716 * @return Returns a Promise.
2717 */
2718 BLE.enable = function () { return; };
2719 __decorate$13([
2720 Cordova({
2721 observable: true
2722 })
2723 ], BLE, "scan", null);
2724 __decorate$13([
2725 Cordova({
2726 observable: true,
2727 clearFunction: 'stopScan',
2728 clearWithArgs: true
2729 })
2730 ], BLE, "startScan", null);
2731 __decorate$13([
2732 Cordova()
2733 ], BLE, "stopScan", null);
2734 __decorate$13([
2735 Cordova({
2736 observable: true,
2737 clearFunction: 'disconnect',
2738 clearWithArgs: true
2739 })
2740 ], BLE, "connect", null);
2741 __decorate$13([
2742 Cordova()
2743 ], BLE, "disconnect", null);
2744 __decorate$13([
2745 Cordova()
2746 ], BLE, "read", null);
2747 __decorate$13([
2748 Cordova()
2749 ], BLE, "write", null);
2750 __decorate$13([
2751 Cordova()
2752 ], BLE, "writeWithoutResponse", null);
2753 __decorate$13([
2754 Cordova({
2755 observable: true,
2756 clearFunction: 'stopNotification',
2757 clearWithArgs: true
2758 })
2759 ], BLE, "startNotification", null);
2760 __decorate$13([
2761 Cordova()
2762 ], BLE, "stopNotification", null);
2763 __decorate$13([
2764 Cordova()
2765 ], BLE, "isConnected", null);
2766 __decorate$13([
2767 Cordova()
2768 ], BLE, "isEnabled", null);
2769 __decorate$13([
2770 Cordova()
2771 ], BLE, "showBluetoothSettings", null);
2772 __decorate$13([
2773 Cordova()
2774 ], BLE, "enable", null);
2775 BLE = __decorate$13([
2776 Plugin({
2777 plugin: 'cordova-plugin-ble-central',
2778 pluginRef: 'ble',
2779 repo: 'https://github.com/don/cordova-plugin-ble-central',
2780 platforms: ['iOS', 'Android']
2781 })
2782 ], BLE);
2783 return BLE;
2784}());
2785
2786var __decorate$14 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2787 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2788 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2789 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;
2790 return c > 3 && r && Object.defineProperty(target, key, r), r;
2791};
2792/**
2793 * @name Bluetooth Serial
2794 * @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
2795 * @usage
2796 * ```typescript
2797 * import { BluetoothSerial } from 'ionic-native';
2798 *
2799 *
2800 * // Write a string
2801 * BluetoothSerial.write("hello world").then(success, failure);
2802 *
2803 * // Array of int or bytes
2804 * BluetoothSerial.write([186, 220, 222]).then(success, failure);
2805 *
2806 * // Typed Array
2807 * var data = new Uint8Array(4);
2808 * data[0] = 0x41;
2809 * data[1] = 0x42;
2810 * data[2] = 0x43;
2811 * data[3] = 0x44;
2812 * BluetoothSerial.write(data).then(success, failure);
2813 *
2814 * // Array Buffer
2815 * BluetoothSerial.write(data.buffer).then(success, failure);
2816 * ```
2817 */
2818var BluetoothSerial = (function () {
2819 function BluetoothSerial() {
2820 }
2821 /**
2822 * Connect to a Bluetooth device
2823 * @param {string} macAddress_or_uuid Identifier of the remote device
2824 * @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
2825 */
2826 BluetoothSerial.connect = function (macAddress_or_uuid) { return; };
2827 /**
2828 * Connect insecurely to a Bluetooth device
2829 * @param {string} macAddress Identifier of the remote device
2830 * @returns {Observable} Subscribe to connect, unsubscribe to disconnect.
2831 */
2832 BluetoothSerial.connectInsecure = function (macAddress) { return; };
2833 /**
2834 * Writes data to the serial port
2835 * @param {any} data ArrayBuffer of data
2836 * @returns {Promise} returns a promise when data has been written
2837 */
2838 BluetoothSerial.write = function (data) { return; };
2839 /**
2840 * Gets the number of bytes of data available
2841 * @returns {Promise} returns a promise that contains the available bytes
2842 */
2843 BluetoothSerial.available = function () { return; };
2844 /**
2845 * Reads data from the buffer
2846 * @returns {Promise} returns a promise with data from the buffer
2847 */
2848 BluetoothSerial.read = function () { return; };
2849 /**
2850 * Reads data from the buffer until it reaches a delimiter
2851 * @param {string} delimiter string that you want to search until
2852 * @returns {Promise} returns a promise
2853 */
2854 BluetoothSerial.readUntil = function (delimiter) { return; };
2855 /**
2856 * Subscribe to be notified when data is received
2857 * @param {string} delimiter the string you want to watch for
2858 * @returns {Observable} returns an observable.
2859 */
2860 BluetoothSerial.subscribe = function (delimiter) { return; };
2861 /**
2862 * Subscribe to be notified when data is received
2863 * @returns {Observable} returns an observable
2864 */
2865 BluetoothSerial.subscribeRawData = function () { return; };
2866 /**
2867 * Clears data in buffer
2868 * @returns {Promise} returns a promise when completed
2869 */
2870 BluetoothSerial.clear = function () { return; };
2871 /**
2872 * Lists bonded devices
2873 * @returns {Promise} returns a promise
2874 */
2875 BluetoothSerial.list = function () { return; };
2876 /**
2877 * Reports if bluetooth is enabled
2878 * @returns {Promise} returns a promise
2879 */
2880 BluetoothSerial.isEnabled = function () { return; };
2881 /**
2882 * Reports the connection status
2883 * @returns {Promise} returns a promise
2884 */
2885 BluetoothSerial.isConnected = function () { return; };
2886 /**
2887 * Reads the RSSI from the connected peripheral
2888 * @returns {Promise} returns a promise
2889 */
2890 BluetoothSerial.readRSSI = function () { return; };
2891 /**
2892 * Show the Bluetooth settings on the device
2893 * @returns {Promise} returns a promise
2894 */
2895 BluetoothSerial.showBluetoothSettings = function () { return; };
2896 /**
2897 * Enable Bluetooth on the device
2898 * @returns {Promise} returns a promise
2899 */
2900 BluetoothSerial.enable = function () { return; };
2901 /**
2902 * Discover unpaired devices
2903 * @returns {Promise} returns a promise
2904 */
2905 BluetoothSerial.discoverUnpaired = function () { return; };
2906 /**
2907 * Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function.
2908 * @returns {Observable} Returns an observable
2909 */
2910 BluetoothSerial.setDeviceDiscoveredListener = function () { return; };
2911 /**
2912 * Sets the human readable device name that is broadcasted to other devices
2913 * @param {string} newName Desired name of device
2914 */
2915 BluetoothSerial.setName = function (newName) { };
2916 /**
2917 * Makes the device discoverable by other devices
2918 * @param {number} discoverableDuration Desired number of seconds device should be discoverable for
2919 */
2920 BluetoothSerial.setDiscoverable = function (discoverableDuration) { };
2921 __decorate$14([
2922 Cordova({
2923 platforms: ['Android', 'iOS', 'Windows Phone'],
2924 observable: true,
2925 clearFunction: 'disconnect'
2926 })
2927 ], BluetoothSerial, "connect", null);
2928 __decorate$14([
2929 Cordova({
2930 platforms: ['Android'],
2931 observable: true,
2932 clearFunction: 'disconnect'
2933 })
2934 ], BluetoothSerial, "connectInsecure", null);
2935 __decorate$14([
2936 Cordova({
2937 platforms: ['Android', 'iOS', 'Windows Phone']
2938 })
2939 ], BluetoothSerial, "write", null);
2940 __decorate$14([
2941 Cordova({
2942 platforms: ['Android', 'iOS', 'Windows Phone']
2943 })
2944 ], BluetoothSerial, "available", null);
2945 __decorate$14([
2946 Cordova({
2947 platforms: ['Android', 'iOS', 'Windows Phone']
2948 })
2949 ], BluetoothSerial, "read", null);
2950 __decorate$14([
2951 Cordova({
2952 platforms: ['Android', 'iOS', 'Windows Phone']
2953 })
2954 ], BluetoothSerial, "readUntil", null);
2955 __decorate$14([
2956 Cordova({
2957 platforms: ['Android', 'iOS', 'Windows Phone'],
2958 observable: true,
2959 clearFunction: 'unsubscribe'
2960 })
2961 ], BluetoothSerial, "subscribe", null);
2962 __decorate$14([
2963 Cordova({
2964 platforms: ['Android', 'iOS', 'Windows Phone'],
2965 observable: true,
2966 clearFunction: 'unsubscribeRawData'
2967 })
2968 ], BluetoothSerial, "subscribeRawData", null);
2969 __decorate$14([
2970 Cordova({
2971 platforms: ['Android', 'iOS', 'Windows Phone']
2972 })
2973 ], BluetoothSerial, "clear", null);
2974 __decorate$14([
2975 Cordova({
2976 platforms: ['Android', 'iOS', 'Windows Phone']
2977 })
2978 ], BluetoothSerial, "list", null);
2979 __decorate$14([
2980 Cordova({
2981 platforms: ['Android', 'iOS', 'Windows Phone']
2982 })
2983 ], BluetoothSerial, "isEnabled", null);
2984 __decorate$14([
2985 Cordova({
2986 platforms: ['Android', 'iOS', 'Windows Phone']
2987 })
2988 ], BluetoothSerial, "isConnected", null);
2989 __decorate$14([
2990 Cordova({
2991 platforms: ['Android', 'iOS', 'Windows Phone']
2992 })
2993 ], BluetoothSerial, "readRSSI", null);
2994 __decorate$14([
2995 Cordova({
2996 platforms: ['Android', 'iOS', 'Windows Phone']
2997 })
2998 ], BluetoothSerial, "showBluetoothSettings", null);
2999 __decorate$14([
3000 Cordova({
3001 platforms: ['Android', 'iOS', 'Windows Phone']
3002 })
3003 ], BluetoothSerial, "enable", null);
3004 __decorate$14([
3005 Cordova({
3006 platforms: ['Android', 'iOS', 'Windows Phone']
3007 })
3008 ], BluetoothSerial, "discoverUnpaired", null);
3009 __decorate$14([
3010 Cordova({
3011 platforms: ['Android', 'iOS', 'Windows Phone'],
3012 observable: true,
3013 clearFunction: 'clearDeviceDiscoveredListener'
3014 })
3015 ], BluetoothSerial, "setDeviceDiscoveredListener", null);
3016 __decorate$14([
3017 Cordova({
3018 platforms: ['Android'],
3019 sync: true
3020 })
3021 ], BluetoothSerial, "setName", null);
3022 __decorate$14([
3023 Cordova({
3024 platforms: ['Android'],
3025 sync: true
3026 })
3027 ], BluetoothSerial, "setDiscoverable", null);
3028 BluetoothSerial = __decorate$14([
3029 Plugin({
3030 repo: 'https://github.com/don/BluetoothSerial',
3031 plugin: 'cordova-plugin-bluetooth-serial',
3032 pluginRef: 'bluetoothSerial',
3033 platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
3034 })
3035 ], BluetoothSerial);
3036 return BluetoothSerial;
3037}());
3038
3039var __decorate$15 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3040 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3041 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3042 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;
3043 return c > 3 && r && Object.defineProperty(target, key, r), r;
3044};
3045/**
3046 * @name Calendar
3047 * @description
3048 * This plugin allows you to add events to the Calendar of the mobile device.
3049 *
3050 * Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
3051 *
3052 *
3053 * @usage
3054 * ```
3055 * import {Calendar} from 'ionic-native';
3056 *
3057 *
3058 *
3059 * Calendar.createCalendar('MyCalendar').then(
3060 * (msg) => { console.log(msg); },
3061 * (err) => { console.log(err); }
3062 * );
3063 * ```
3064 *
3065 */
3066var Calendar = (function () {
3067 function Calendar() {
3068 }
3069 /**
3070 * This function checks if we have permission to read/write from/to the calendar.
3071 * The promise will resolve with `true` when:
3072 * - You're running on iOS, or
3073 * - You're targetting API level lower than 23, or
3074 * - You're using Android < 6, or
3075 * - You've already granted permission
3076 *
3077 * If this returns false, you should call `requestReadWritePermissions` function
3078 * @returns {Promise<boolean>}
3079 */
3080 Calendar.hasReadWritePermission = function () { return; };
3081 /**
3082 * Check if we have read permission
3083 * @returns {Promise<boolean>}
3084 */
3085 Calendar.hasReadPermission = function () { return; };
3086 /**
3087 * Check if we have write permission
3088 * @returns {Promise<boolean>}
3089 */
3090 Calendar.hasWritePermission = function () { return; };
3091 /**
3092 * Request write permission
3093 * @returns {Promise<any>}
3094 */
3095 Calendar.requestWritePermission = function () { return; };
3096 /**
3097 * Request read permission
3098 * @returns {Promise<any>}
3099 */
3100 Calendar.requestReadPermission = function () { return; };
3101 /**
3102 * Requests read/write permissions
3103 * @returns {Promise<any>}
3104 */
3105 Calendar.requestReadWritePermission = function () { return; };
3106 /**
3107 * Create a calendar. (iOS only)
3108 *
3109 * @param {string | Object} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string
3110 * @return {Promise} Returns a Promise
3111 */
3112 Calendar.createCalendar = function (nameOrOptions) { return; };
3113 /**
3114 * Delete a calendar. (iOS only)
3115 * @param {string} name Name of the calendar to delete.
3116 * @return Returns a Promise
3117 */
3118 Calendar.deleteCalendar = function (name) { return; };
3119 /**
3120 * Returns the default calendar options.
3121 *
3122 * @return Returns an object with the default calendar options:
3123 * firstReminderMinutes: 60,
3124 * secondReminderMinutes: null,
3125 * recurrence: null, // options are: 'daily', 'weekly', 'monthly', 'yearly'
3126 * recurrenceInterval: 1, // only used when recurrence is set
3127 * recurrenceEndDate: null,
3128 * calendarName: null,
3129 * calendarId: null,
3130 * url: null
3131 */
3132 Calendar.getCalendarOptions = function () {
3133 return {
3134 firstReminderMinutes: 60,
3135 secondReminderMinutes: null,
3136 recurrence: null,
3137 recurrenceInterval: 1,
3138 recurrenceEndDate: null,
3139 calendarName: null,
3140 calendarId: null,
3141 url: null
3142 };
3143 };
3144 /**
3145 * Silently create an event.
3146 * @param {string} [title] The event title
3147 * @param {string} [location] The event location
3148 * @param {string} [notes] The event notes
3149 * @param {Date} [startDate] The event start date
3150 * @param {Date} [endDate] The event end date
3151 * @return Returns a Promise
3152 */
3153 Calendar.createEvent = function (title, location, notes, startDate, endDate) { return; };
3154 /**
3155 * Silently create an event with additional options.
3156 *
3157 * @param {string} [title] The event title
3158 * @param {string} [location] The event location
3159 * @param {string} [notes] The event notes
3160 * @param {Date} [startDate] The event start date
3161 * @param {Date} [endDate] The event end date
3162 * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
3163 * @return Returns a Promise
3164 */
3165 Calendar.createEventWithOptions = function (title, location, notes, startDate, endDate, options) { return; };
3166 /**
3167 * Interactively create an event.
3168 *
3169 * @param {string} [title] The event title
3170 * @param {string} [location] The event location
3171 * @param {string} [notes] The event notes
3172 * @param {Date} [startDate] The event start date
3173 * @param {Date} [endDate] The event end date
3174 * @return Returns a Promise
3175 */
3176 Calendar.createEventInteractively = function (title, location, notes, startDate, endDate) { return; };
3177 /**
3178 * Interactively create an event with additional options.
3179 *
3180 * @param {string} [title] The event title
3181 * @param {string} [location] The event location
3182 * @param {string} [notes] The event notes
3183 * @param {Date} [startDate] The event start date
3184 * @param {Date} [endDate] The event end date
3185 * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
3186 * @return Returns a Promise
3187 */
3188 Calendar.createEventInteractivelyWithOptions = function (title, location, notes, startDate, endDate, options) { return; };
3189 // deprecated
3190 // @Cordova()
3191 // static createEventInNamedCalendar(
3192 // title?: string,
3193 // location?: string,
3194 // notes?: string,
3195 // startDate?: Date,
3196 // endDate?: Date,
3197 // calendarName?: string
3198 // ) {}
3199 /**
3200 * Find an event.
3201 *
3202 * @param {string} [title] The event title
3203 * @param {string} [location] The event location
3204 * @param {string} [notes] The event notes
3205 * @param {Date} [startDate] The event start date
3206 * @param {Date} [endDate] The event end date
3207 * @return Returns a Promise
3208 */
3209 Calendar.findEvent = function (title, location, notes, startDate, endDate) { return; };
3210 /**
3211 * Find an event with additional options.
3212 * @param {string} [title] The event title
3213 * @param {string} [location] The event location
3214 * @param {string} [notes] The event notes
3215 * @param {Date} [startDate] The event start date
3216 * @param {Date} [endDate] The event end date
3217 * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
3218 * @return Returns a Promise that resolves with the event, or rejects with an error.
3219 */
3220 Calendar.findEventWithOptions = function (title, location, notes, startDate, endDate, options) { return; };
3221 /**
3222 * Find a list of events within the specified date range. (Android only)
3223 *
3224 * @param {Date} [startDate] The start date
3225 * @param {Date} [endDate] The end date
3226 * @return Returns a Promise that resolves with the list of events, or rejects with an error.
3227 */
3228 Calendar.listEventsInRange = function (startDate, endDate) { return; };
3229 /**
3230 * Get a list of all calendars.
3231 * @return A Promise that resolves with the list of calendars, or rejects with an error.
3232 */
3233 Calendar.listCalendars = function () { return; };
3234 /**
3235 * Get a list of all future events in the specified calendar. (iOS only)
3236 * @return Returns a Promise that resolves with the list of events, or rejects with an error.
3237 */
3238 Calendar.findAllEventsInNamedCalendar = function (calendarName) { return; };
3239 /**
3240 * Modify an event. (iOS only)
3241 *
3242 * @param {string} [title] The event title
3243 * @param {string} [location] The event location
3244 * @param {string} [notes] The event notes
3245 * @param {Date} [startDate] The event start date
3246 * @param {Date} [endDate] The event end date
3247 * @param {string} [newTitle] The new event title
3248 * @param {string} [newLocation] The new event location
3249 * @param {string} [newNotes] The new event notes
3250 * @param {Date} [newStartDate] The new event start date
3251 * @param {Date} [newEndDate] The new event end date
3252 * @return Returns a Promise
3253 */
3254 Calendar.modifyEvent = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate) { return; };
3255 /**
3256 * Modify an event with additional options. (iOS only)
3257 *
3258 * @param {string} [title] The event title
3259 * @param {string} [location] The event location
3260 * @param {string} [notes] The event notes
3261 * @param {Date} [startDate] The event start date
3262 * @param {Date} [endDate] The event end date
3263 * @param {string} [newTitle] The new event title
3264 * @param {string} [newLocation] The new event location
3265 * @param {string} [newNotes] The new event notes
3266 * @param {Date} [newStartDate] The new event start date
3267 * @param {Date} [newEndDate] The new event end date
3268 * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
3269 * @return Returns a Promise
3270 */
3271 Calendar.modifyEventWithOptions = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate, options) { return; };
3272 /**
3273 * Delete an event.
3274 *
3275 * @param {string} [title] The event title
3276 * @param {string} [location] The event location
3277 * @param {string} [notes] The event notes
3278 * @param {Date} [startDate] The event start date
3279 * @param {Date} [endDate] The event end date
3280 * @return Returns a Promise
3281 */
3282 Calendar.deleteEvent = function (title, location, notes, startDate, endDate) { return; };
3283 /**
3284 * Delete an event from the specified Calendar. (iOS only)
3285 *
3286 * @param {string} [title] The event title
3287 * @param {string} [location] The event location
3288 * @param {string} [notes] The event notes
3289 * @param {Date} [startDate] The event start date
3290 * @param {Date} [endDate] The event end date
3291 * @param {string} calendarName
3292 * @return Returns a Promise
3293 */
3294 Calendar.deleteEventFromNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { return; };
3295 /**
3296 * Open the calendar at the specified date.
3297 * @param {Date} date The date you want to open the calendar on
3298 * @return {Promise<any>} Promise returns a promise
3299 */
3300 Calendar.openCalendar = function (date) { return; };
3301 __decorate$15([
3302 Cordova()
3303 ], Calendar, "hasReadWritePermission", null);
3304 __decorate$15([
3305 Cordova()
3306 ], Calendar, "hasReadPermission", null);
3307 __decorate$15([
3308 Cordova()
3309 ], Calendar, "hasWritePermission", null);
3310 __decorate$15([
3311 Cordova()
3312 ], Calendar, "requestWritePermission", null);
3313 __decorate$15([
3314 Cordova()
3315 ], Calendar, "requestReadPermission", null);
3316 __decorate$15([
3317 Cordova()
3318 ], Calendar, "requestReadWritePermission", null);
3319 __decorate$15([
3320 Cordova()
3321 ], Calendar, "createCalendar", null);
3322 __decorate$15([
3323 Cordova()
3324 ], Calendar, "deleteCalendar", null);
3325 __decorate$15([
3326 Cordova({
3327 sync: true
3328 })
3329 ], Calendar, "getCalendarOptions", null);
3330 __decorate$15([
3331 Cordova()
3332 ], Calendar, "createEvent", null);
3333 __decorate$15([
3334 Cordova()
3335 ], Calendar, "createEventWithOptions", null);
3336 __decorate$15([
3337 Cordova()
3338 ], Calendar, "createEventInteractively", null);
3339 __decorate$15([
3340 Cordova()
3341 ], Calendar, "createEventInteractivelyWithOptions", null);
3342 __decorate$15([
3343 Cordova()
3344 ], Calendar, "findEvent", null);
3345 __decorate$15([
3346 Cordova()
3347 ], Calendar, "findEventWithOptions", null);
3348 __decorate$15([
3349 Cordova()
3350 ], Calendar, "listEventsInRange", null);
3351 __decorate$15([
3352 Cordova()
3353 ], Calendar, "listCalendars", null);
3354 __decorate$15([
3355 Cordova()
3356 ], Calendar, "findAllEventsInNamedCalendar", null);
3357 __decorate$15([
3358 Cordova()
3359 ], Calendar, "modifyEvent", null);
3360 __decorate$15([
3361 Cordova()
3362 ], Calendar, "modifyEventWithOptions", null);
3363 __decorate$15([
3364 Cordova()
3365 ], Calendar, "deleteEvent", null);
3366 __decorate$15([
3367 Cordova()
3368 ], Calendar, "deleteEventFromNamedCalendar", null);
3369 __decorate$15([
3370 Cordova()
3371 ], Calendar, "openCalendar", null);
3372 Calendar = __decorate$15([
3373 Plugin({
3374 plugin: 'cordova-plugin-calendar',
3375 pluginRef: 'plugins.calendar',
3376 repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin',
3377 platforms: ['Android', 'iOS']
3378 })
3379 ], Calendar);
3380 return Calendar;
3381}());
3382
3383var __decorate$16 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3384 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3385 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3386 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;
3387 return c > 3 && r && Object.defineProperty(target, key, r), r;
3388};
3389/**
3390 * @name CallNumber
3391 * @description
3392 * Call a number directly from your Cordova/Ionic application.
3393 *
3394 * @usage
3395 * ```
3396 * import {CallNumber} from 'ionic-native';
3397 *
3398 * CallNumber.callNumber(18001010101, true)
3399 * .then(() => console.log('Launched dialer!'))
3400 * .catch(() => console.log('Error launching dialer'));
3401 *
3402 * ```
3403 */
3404var CallNumber = (function () {
3405 function CallNumber() {
3406 }
3407 /**
3408 * Calls a phone number
3409 * @param numberToCall {string} The phone number to call as a string
3410 * @param bypassAppChooser {boolean} Set to true to bypass the app chooser and go directly to dialer
3411 */
3412 CallNumber.callNumber = function (numberToCall, bypassAppChooser) {
3413 return;
3414 };
3415 __decorate$16([
3416 Cordova({
3417 callbackOrder: 'reverse'
3418 })
3419 ], CallNumber, "callNumber", null);
3420 CallNumber = __decorate$16([
3421 Plugin({
3422 plugin: 'call-number',
3423 pluginRef: 'plugins.CallNumber',
3424 repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin',
3425 platforms: ['iOS', 'Android']
3426 })
3427 ], CallNumber);
3428 return CallNumber;
3429}());
3430
3431var __decorate$17 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3432 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3433 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3434 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;
3435 return c > 3 && r && Object.defineProperty(target, key, r), r;
3436};
3437/**
3438 * @name Camera
3439 * @description
3440 * Take a photo or capture video.
3441 *
3442 * Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
3443 *
3444 * @usage
3445 * ```typescript
3446 * import { Camera } from 'ionic-native';
3447 *
3448 *
3449 * Camera.getPicture(options).then((imageData) => {
3450 * // imageData is either a base64 encoded string or a file URI
3451 * // If it's base64:
3452 * let base64Image = 'data:image/jpeg;base64,' + imageData;
3453 * }, (err) => {
3454 * // Handle error
3455 * });
3456 * ```
3457 */
3458var Camera = (function () {
3459 function Camera() {
3460 }
3461 /**
3462 * Take a picture or video, or load one from the library.
3463 * @param {CameraOptions?} options Options that you want to pass to the camera. Encoding type, quality, etc. Optional
3464 * @return {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
3465 */
3466 Camera.getPicture = function (options) { return; };
3467 /**
3468 * Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.
3469 * Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI.
3470 * @return Returns a Promise
3471 */
3472 Camera.cleanup = function () { return; };
3473
3474 /**
3475 * @private
3476 * @enum {number}
3477 */
3478 Camera.DestinationType = {
3479 /** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */
3480 DATA_URL: 0,
3481 /** Return file uri (content://media/external/images/media/2 for Android) */
3482 FILE_URI: 1,
3483 /** Return native uri (eg. asset-library://... for iOS) */
3484 NATIVE_URI: 2
3485 };
3486 /**
3487 * @private
3488 * @enum {number}
3489 */
3490 Camera.EncodingType = {
3491 /** Return JPEG encoded image */
3492 JPEG: 0,
3493 /** Return PNG encoded image */
3494 PNG: 1
3495 };
3496 /**
3497 * @private
3498 * @enum {number}
3499 */
3500 Camera.MediaType = {
3501 /** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */
3502 PICTURE: 0,
3503 /** Allow selection of video only, ONLY RETURNS URL */
3504 VIDEO: 1,
3505 /** Allow selection from all media types */
3506 ALLMEDIA: 2
3507 };
3508 /**
3509 * @private
3510 * @enum {number}
3511 */
3512 Camera.PictureSourceType = {
3513 /** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
3514 PHOTOLIBRARY: 0,
3515 /** Take picture from camera */
3516 CAMERA: 1,
3517 /** Choose image from picture library (same as PHOTOLIBRARY for Android) */
3518 SAVEDPHOTOALBUM: 2
3519 };
3520 /**
3521 * @private
3522 * Matches iOS UIPopoverArrowDirection constants to specify arrow location on popover.
3523 * @enum {number}
3524 */
3525 Camera.PopoverArrowDirection = {
3526 ARROW_UP: 1,
3527 ARROW_DOWN: 2,
3528 ARROW_LEFT: 4,
3529 ARROW_RIGHT: 8,
3530 ARROW_ANY: 15
3531 };
3532 /**
3533 * @private
3534 * @enum {number}
3535 */
3536 Camera.Direction = {
3537 /** Use the back-facing camera */
3538 BACK: 0,
3539 /** Use the front-facing camera */
3540 FRONT: 1
3541 };
3542 __decorate$17([
3543 Cordova({
3544 callbackOrder: 'reverse'
3545 })
3546 ], Camera, "getPicture", null);
3547 __decorate$17([
3548 Cordova({
3549 platforms: ['iOS']
3550 })
3551 ], Camera, "cleanup", null);
3552 Camera = __decorate$17([
3553 Plugin({
3554 plugin: 'cordova-plugin-camera',
3555 pluginRef: 'navigator.camera',
3556 repo: 'https://github.com/apache/cordova-plugin-camera',
3557 platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu']
3558 })
3559 ], Camera);
3560 return Camera;
3561}());
3562
3563var __decorate$18 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3564 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3565 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3566 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;
3567 return c > 3 && r && Object.defineProperty(target, key, r), r;
3568};
3569/**
3570 * @name CameraPreview
3571 * @description
3572 * Showing camera preview in HTML
3573 *
3574 * For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview).
3575 *
3576 * @usage
3577 * ```
3578 * import { CameraPreview } from 'ionic-native';
3579 *
3580 * // camera options (Size and location)
3581 * let cameraRect: CameraPreviewRect = {
3582 * x: 100,
3583 * y: 100,
3584 * width: 200,
3585 * height: 200
3586 * };
3587 *
3588 *
3589 * // start camera
3590 * CameraPreview.startCamera(
3591 * cameraRect, // position and size of preview
3592 * 'front', // default camera
3593 * true, // tape to take picture
3594 * false, // disable drag
3595 * true // send the preview to the back of the screen so we can add overlaying elements
3596 * );
3597 *
3598 * // Set the handler to run every time we take a picture
3599 * CameraPreview.setOnPictureTakenHandler().subscribe((result) => {
3600 * console.log(result);
3601 * // do something with the result
3602 * });
3603 *
3604 *
3605 * // take a picture
3606 * CameraPreview.takePicture({
3607 * maxWidth: 640,
3608 * maxHeight: 640
3609 * });
3610 *
3611 * // Switch camera
3612 * CameraPreview.switchCamera();
3613 *
3614 * // set color effect to negative
3615 * CameraPreview.setColorEffect('negative');
3616 *
3617 * // Stop the camera preview
3618 * CameraPreview.stopCamera();
3619 *
3620 * ```
3621 *
3622 */
3623var CameraPreview = (function () {
3624 function CameraPreview() {
3625 }
3626 /**
3627 * Starts the camera preview instance.
3628 * @param {CameraPreviewRect} position and size of the preview window - {x: number, y: number, width: number, height: number}
3629 * @param {string} which camera to use - 'front' | 'back'
3630 * @param {boolean} enable tap to take picture
3631 * @param {boolean} enable preview box drag across the screen
3632 * @param {boolean} send preview box to the back of the webview
3633 * @param {number} alpha of the preview box
3634 */
3635 CameraPreview.startCamera = function (rect, defaultCamera, tapEnabled, dragEnabled, toBack, alpha) { };
3636
3637 /**
3638 * Stops the camera preview instance.
3639 */
3640 CameraPreview.stopCamera = function () { };
3641
3642 /**
3643 * Take the picture, the parameter size is optional
3644 * @param {CameraPreviewSize} optional - size of the picture to take
3645 */
3646 CameraPreview.takePicture = function (size) { };
3647
3648 /**
3649 * Register a callback function that receives the original picture and the image captured from the preview box.
3650 */
3651 CameraPreview.setOnPictureTakenHandler = function () { return; };
3652
3653 /**
3654 * Switch from the rear camera and front camera, if available.
3655 */
3656 CameraPreview.switchCamera = function () { };
3657
3658 /**
3659 * Show the camera preview box.
3660 */
3661 CameraPreview.show = function () { };
3662
3663 /**
3664 * Hide the camera preview box.
3665 */
3666 CameraPreview.hide = function () { };
3667
3668 /**
3669 * Set the default mode for the Flash.
3670 */
3671 // @Cordova({
3672 // sync: true
3673 // })
3674 // static setFlashMode(mode: number): void { };
3675 /**
3676 * Set camera color effect.
3677 */
3678 CameraPreview.setColorEffect = function (effect) { };
3679
3680 /**
3681 * @private
3682 * @enum {number}
3683 */
3684 CameraPreview.FlashMode = {
3685 OFF: 0,
3686 ON: 1,
3687 AUTO: 2
3688 };
3689 __decorate$18([
3690 Cordova({
3691 sync: true
3692 })
3693 ], CameraPreview, "startCamera", null);
3694 __decorate$18([
3695 Cordova({
3696 sync: true
3697 })
3698 ], CameraPreview, "stopCamera", null);
3699 __decorate$18([
3700 Cordova({
3701 sync: true
3702 })
3703 ], CameraPreview, "takePicture", null);
3704 __decorate$18([
3705 Cordova({
3706 observable: true
3707 })
3708 ], CameraPreview, "setOnPictureTakenHandler", null);
3709 __decorate$18([
3710 Cordova({
3711 sync: true
3712 })
3713 ], CameraPreview, "switchCamera", null);
3714 __decorate$18([
3715 Cordova({
3716 sync: true
3717 })
3718 ], CameraPreview, "show", null);
3719 __decorate$18([
3720 Cordova({
3721 sync: true
3722 })
3723 ], CameraPreview, "hide", null);
3724 __decorate$18([
3725 Cordova({
3726 sync: true
3727 })
3728 ], CameraPreview, "setColorEffect", null);
3729 CameraPreview = __decorate$18([
3730 Plugin({
3731 plugin: 'cordova-plugin-camera-preview',
3732 pluginRef: 'cordova.plugins.camerapreview',
3733 repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview',
3734 platforms: ['Android', 'iOS']
3735 })
3736 ], CameraPreview);
3737 return CameraPreview;
3738}());
3739
3740var __decorate$19 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3741 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3742 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3743 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;
3744 return c > 3 && r && Object.defineProperty(target, key, r), r;
3745};
3746/**
3747 * @name CardIO
3748 * @description
3749 * @usage
3750 * ```
3751 * import { CardIO } from 'ionic-native';
3752 *
3753 *
3754 * CardIO.canScan()
3755 * .then(
3756 * (res: boolean) => {
3757 * if(res){
3758 * let options = {
3759 * requireExpiry: true,
3760 * requireCCV: false,
3761 * requirePostalCode: false
3762 * };
3763 * CardIO.scan(options);
3764 * }
3765 * }
3766 * );
3767 * ```
3768 */
3769var CardIO = (function () {
3770 function CardIO() {
3771 }
3772 /**
3773 * Check whether card scanning is currently available. (May vary by
3774 * device, OS version, network connectivity, etc.)
3775 *
3776 */
3777 CardIO.canScan = function () { return; };
3778 /**
3779 * Scan a credit card with card.io.
3780 * @param {CardIOOptions} options Options for configuring the plugin
3781 */
3782 CardIO.scan = function (options) { return; };
3783 /**
3784 * Retrieve the version of the card.io library. Useful when contacting support.
3785 */
3786 CardIO.version = function () { return; };
3787 __decorate$19([
3788 Cordova()
3789 ], CardIO, "canScan", null);
3790 __decorate$19([
3791 Cordova()
3792 ], CardIO, "scan", null);
3793 __decorate$19([
3794 Cordova()
3795 ], CardIO, "version", null);
3796 CardIO = __decorate$19([
3797 Plugin({
3798 plugin: 'https://github.com/card-io/card.io-Cordova-Plugin',
3799 pluginRef: 'CardIO',
3800 repo: 'https://github.com/card-io/card.io-Cordova-Plugin',
3801 platforms: ['iOS', 'Android']
3802 })
3803 ], CardIO);
3804 return CardIO;
3805}());
3806
3807var __decorate$20 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3808 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3809 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3810 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;
3811 return c > 3 && r && Object.defineProperty(target, key, r), r;
3812};
3813/**
3814 * @name Clipboard
3815 * @description
3816 * Clipboard management plugin for Cordova that supports iOS, Android, and Windows Phone 8.
3817 *
3818 * Requires Cordova plugin: https://github.com/VersoSolutions/CordovaClipboard
3819 * For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
3820 *
3821 * @usage
3822 * ```typescript
3823 * import { Clipboard } from 'ionic-native';
3824 *
3825 *
3826 * Clipboard.copy('Hello world');
3827 *
3828 * Clipboard.paste().then(
3829 * (resolve: string) => {
3830 * alert(resolve);
3831 * },
3832 * (reject: string) => {
3833 * alert('Error: ' + reject);
3834 * }
3835 * );
3836 * );
3837 * ```
3838 */
3839var Clipboard = (function () {
3840 function Clipboard() {
3841 }
3842 /**
3843 * Copies the given text
3844 * @param {string} text Text that gets copied on the system clipboard
3845 * @returns {Promise<T>} Returns a promise after the text has been copied
3846 */
3847 Clipboard.copy = function (text) { return; };
3848 /**
3849 * Pastes the text stored in clipboard
3850 * @returns {Promise<T>} Returns a promise after the text has been pasted
3851 */
3852 Clipboard.paste = function () { return; };
3853 __decorate$20([
3854 Cordova()
3855 ], Clipboard, "copy", null);
3856 __decorate$20([
3857 Cordova()
3858 ], Clipboard, "paste", null);
3859 Clipboard = __decorate$20([
3860 Plugin({
3861 plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git',
3862 pluginRef: 'cordova.plugins.clipboard',
3863 repo: 'https://github.com/VersoSolutions/CordovaClipboard',
3864 platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
3865 })
3866 ], Clipboard);
3867 return Clipboard;
3868}());
3869
3870var __decorate$21 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3871 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3872 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3873 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;
3874 return c > 3 && r && Object.defineProperty(target, key, r), r;
3875};
3876/**
3877 * Defines the possible result statuses of the window.codePush.sync operation.
3878 */
3879var SyncStatus;
3880(function (SyncStatus) {
3881 /**
3882 * The application is up to date.
3883 */
3884 SyncStatus[SyncStatus["UP_TO_DATE"] = 0] = "UP_TO_DATE";
3885 /**
3886 * An update is available, it has been downloaded, unzipped and copied to the deployment folder.
3887 * After the completion of the callback invoked with SyncStatus.UPDATE_INSTALLED, the application will be reloaded with the updated code and resources.
3888 */
3889 SyncStatus[SyncStatus["UPDATE_INSTALLED"] = 1] = "UPDATE_INSTALLED";
3890 /**
3891 * An optional update is available, but the user declined to install it. The update was not downloaded.
3892 */
3893 SyncStatus[SyncStatus["UPDATE_IGNORED"] = 2] = "UPDATE_IGNORED";
3894 /**
3895 * An error happened during the sync operation. This might be an error while communicating with the server, downloading or unziping the update.
3896 * The console logs should contain more information about what happened. No update has been applied in this case.
3897 */
3898 SyncStatus[SyncStatus["ERROR"] = 3] = "ERROR";
3899 /**
3900 * There is an ongoing sync in progress, so this attempt to sync has been aborted.
3901 */
3902 SyncStatus[SyncStatus["IN_PROGRESS"] = 4] = "IN_PROGRESS";
3903 /**
3904 * Intermediate status - the plugin is about to check for updates.
3905 */
3906 SyncStatus[SyncStatus["CHECKING_FOR_UPDATE"] = 5] = "CHECKING_FOR_UPDATE";
3907 /**
3908 * Intermediate status - a user dialog is about to be displayed. This status will be reported only if user interaction is enabled.
3909 */
3910 SyncStatus[SyncStatus["AWAITING_USER_ACTION"] = 6] = "AWAITING_USER_ACTION";
3911 /**
3912 * Intermediate status - the update package is about to be downloaded.
3913 */
3914 SyncStatus[SyncStatus["DOWNLOADING_PACKAGE"] = 7] = "DOWNLOADING_PACKAGE";
3915 /**
3916 * Intermediate status - the update package is about to be installed.
3917 */
3918 SyncStatus[SyncStatus["INSTALLING_UPDATE"] = 8] = "INSTALLING_UPDATE";
3919})(SyncStatus || (SyncStatus = {}));
3920/**
3921 * Defines the available install modes for updates.
3922 */
3923var InstallMode;
3924(function (InstallMode) {
3925 /**
3926 * The update will be applied to the running application immediately. The application will be reloaded with the new content immediately.
3927 */
3928 InstallMode[InstallMode["IMMEDIATE"] = 0] = "IMMEDIATE";
3929 /**
3930 * The update is downloaded but not installed immediately. The new content will be available the next time the application is started.
3931 */
3932 InstallMode[InstallMode["ON_NEXT_RESTART"] = 1] = "ON_NEXT_RESTART";
3933 /**
3934 * The udpate is downloaded but not installed immediately. The new content will be available the next time the application is resumed or restarted, whichever event happends first.
3935 */
3936 InstallMode[InstallMode["ON_NEXT_RESUME"] = 2] = "ON_NEXT_RESUME";
3937})(InstallMode || (InstallMode = {}));
3938/**
3939 * @name CodePush
3940 * @description
3941 * CodePush plugin for Cordova by Microsoft that supports iOS and Android.
3942 *
3943 * For more info, please see https://github.com/ksachdeva/ionic2-code-push-example
3944 *
3945 * @usage
3946 * ```typescript
3947 * import { CodePush } from 'ionic-native';
3948 *
3949 * // note - mostly error & completed methods of observable will not fire
3950 * // as syncStatus will contain the current state of the update
3951 * CodePush.sync().subscribe((syncStatus) => console.log(syncStatus));
3952 *
3953 * const downloadProgress = (progress) => { console.log(`Downloaded ${progress.receivedBytes} of ${progress.totalBytes}`); }
3954 * CodePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus));
3955 *
3956 * ```
3957 */
3958var CodePush = (function () {
3959 function CodePush() {
3960 }
3961 /**
3962 * Get the current package information.
3963 *
3964 * @param packageSuccess Callback invoked with the currently deployed package information.
3965 * @param packageError Optional callback invoked in case of an error.
3966 */
3967 CodePush.getCurrentPackage = function () {
3968 return;
3969 };
3970 /**
3971 * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code.
3972 * This happends only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet.
3973 */
3974 CodePush.getPendingPackage = function () {
3975 return;
3976 };
3977 /**
3978 * Checks with the CodePush server if an update package is available for download.
3979 *
3980 * @param querySuccess Callback invoked in case of a successful response from the server.
3981 * The callback takes one RemotePackage parameter. A non-null package is a valid update.
3982 * A null package means the application is up to date for the current native application version.
3983 * @param queryError Optional callback invoked in case of an error.
3984 * @param deploymentKey Optional deployment key that overrides the config.xml setting.
3985 */
3986 CodePush.checkForUpdate = function (deploymentKey) {
3987 return;
3988 };
3989 /**
3990 * Notifies the plugin that the update operation succeeded and that the application is ready.
3991 * Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop.
3992 * If using sync API, calling this function is not required since sync calls it internally.
3993 *
3994 * @param notifySucceeded Optional callback invoked if the plugin was successfully notified.
3995 * @param notifyFailed Optional callback invoked in case of an error during notifying the plugin.
3996 */
3997 CodePush.notifyApplicationReady = function () {
3998 return;
3999 };
4000 /**
4001 * Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update
4002 * will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application.
4003 */
4004 CodePush.restartApplication = function () {
4005 return;
4006 };
4007 /**
4008 * Convenience method for installing updates in one method call.
4009 * This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods.
4010 *
4011 * The algorithm of this method is the following:
4012 * - Checks for an update on the CodePush server.
4013 * - If an update is available
4014 * - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version.
4015 * The update package will then be downloaded and applied.
4016 * - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version.
4017 * If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED.
4018 * - Otherwise, the update package will be downloaded and applied with no user interaction.
4019 * - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE.
4020 * - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR.
4021 *
4022 * @param syncCallback Optional callback to be called with the status of the sync operation.
4023 * @param syncOptions Optional SyncOptions parameter configuring the behavior of the sync operation.
4024 * @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter.
4025 *
4026 */
4027 CodePush.sync = function (syncOptions, downloadProgress) {
4028 return;
4029 };
4030 __decorate$21([
4031 Cordova()
4032 ], CodePush, "getCurrentPackage", null);
4033 __decorate$21([
4034 Cordova()
4035 ], CodePush, "getPendingPackage", null);
4036 __decorate$21([
4037 Cordova({
4038 callbackOrder: 'reverse'
4039 })
4040 ], CodePush, "checkForUpdate", null);
4041 __decorate$21([
4042 Cordova()
4043 ], CodePush, "notifyApplicationReady", null);
4044 __decorate$21([
4045 Cordova()
4046 ], CodePush, "restartApplication", null);
4047 __decorate$21([
4048 Cordova({
4049 observable: true,
4050 successIndex: 0,
4051 errorIndex: 3 // we don't need this, so we set it to a value higher than # of args
4052 })
4053 ], CodePush, "sync", null);
4054 CodePush = __decorate$21([
4055 Plugin({
4056 plugin: 'cordova-plugin-code-push',
4057 pluginRef: 'codePush',
4058 repo: 'https://github.com/Microsoft/cordova-plugin-code-push',
4059 platforms: ['Android', 'iOS']
4060 })
4061 ], CodePush);
4062 return CodePush;
4063}());
4064
4065var __decorate$22 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4066 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4067 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4068 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;
4069 return c > 3 && r && Object.defineProperty(target, key, r), r;
4070};
4071/**
4072 * @private
4073 */
4074var Contact = (function () {
4075 function Contact() {
4076 this._objectInstance = navigator.contacts.create();
4077 }
4078 Object.defineProperty(Contact.prototype, "id", {
4079 get: function () { return; },
4080 enumerable: true,
4081 configurable: true
4082 });
4083 Object.defineProperty(Contact.prototype, "displayName", {
4084 get: function () { return; },
4085 enumerable: true,
4086 configurable: true
4087 });
4088 Object.defineProperty(Contact.prototype, "name", {
4089 get: function () { return; },
4090 enumerable: true,
4091 configurable: true
4092 });
4093 Object.defineProperty(Contact.prototype, "nickname", {
4094 get: function () { return; },
4095 enumerable: true,
4096 configurable: true
4097 });
4098 Object.defineProperty(Contact.prototype, "phoneNumbers", {
4099 get: function () { return; },
4100 enumerable: true,
4101 configurable: true
4102 });
4103 Object.defineProperty(Contact.prototype, "emails", {
4104 get: function () { return; },
4105 enumerable: true,
4106 configurable: true
4107 });
4108 Object.defineProperty(Contact.prototype, "addresses", {
4109 get: function () { return; },
4110 enumerable: true,
4111 configurable: true
4112 });
4113 Object.defineProperty(Contact.prototype, "ims", {
4114 get: function () { return; },
4115 enumerable: true,
4116 configurable: true
4117 });
4118 Object.defineProperty(Contact.prototype, "organizations", {
4119 get: function () { return; },
4120 enumerable: true,
4121 configurable: true
4122 });
4123 Object.defineProperty(Contact.prototype, "birthday", {
4124 get: function () { return; },
4125 enumerable: true,
4126 configurable: true
4127 });
4128 Object.defineProperty(Contact.prototype, "note", {
4129 get: function () { return; },
4130 enumerable: true,
4131 configurable: true
4132 });
4133 Object.defineProperty(Contact.prototype, "photos", {
4134 get: function () { return; },
4135 enumerable: true,
4136 configurable: true
4137 });
4138 Object.defineProperty(Contact.prototype, "categories", {
4139 get: function () { return; },
4140 enumerable: true,
4141 configurable: true
4142 });
4143 Object.defineProperty(Contact.prototype, "urls", {
4144 get: function () { return; },
4145 enumerable: true,
4146 configurable: true
4147 });
4148 Contact.prototype.clone = function () {
4149 var newContact = new Contact();
4150 for (var prop in this) {
4151 if (prop === 'id')
4152 return;
4153 newContact[prop] = this[prop];
4154 }
4155 return newContact;
4156 };
4157 Contact.prototype.remove = function () { return; };
4158 Contact.prototype.save = function () { return; };
4159 __decorate$22([
4160 InstanceProperty
4161 ], Contact.prototype, "id", null);
4162 __decorate$22([
4163 InstanceProperty
4164 ], Contact.prototype, "displayName", null);
4165 __decorate$22([
4166 InstanceProperty
4167 ], Contact.prototype, "name", null);
4168 __decorate$22([
4169 InstanceProperty
4170 ], Contact.prototype, "nickname", null);
4171 __decorate$22([
4172 InstanceProperty
4173 ], Contact.prototype, "phoneNumbers", null);
4174 __decorate$22([
4175 InstanceProperty
4176 ], Contact.prototype, "emails", null);
4177 __decorate$22([
4178 InstanceProperty
4179 ], Contact.prototype, "addresses", null);
4180 __decorate$22([
4181 InstanceProperty
4182 ], Contact.prototype, "ims", null);
4183 __decorate$22([
4184 InstanceProperty
4185 ], Contact.prototype, "organizations", null);
4186 __decorate$22([
4187 InstanceProperty
4188 ], Contact.prototype, "birthday", null);
4189 __decorate$22([
4190 InstanceProperty
4191 ], Contact.prototype, "note", null);
4192 __decorate$22([
4193 InstanceProperty
4194 ], Contact.prototype, "photos", null);
4195 __decorate$22([
4196 InstanceProperty
4197 ], Contact.prototype, "categories", null);
4198 __decorate$22([
4199 InstanceProperty
4200 ], Contact.prototype, "urls", null);
4201 __decorate$22([
4202 CordovaInstance()
4203 ], Contact.prototype, "remove", null);
4204 __decorate$22([
4205 CordovaInstance()
4206 ], Contact.prototype, "save", null);
4207 return Contact;
4208}());
4209/**
4210 * @private
4211 */
4212var ContactName = (function () {
4213 function ContactName(formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix) {
4214 this._objectInstance = new window.ContactName(formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix);
4215 }
4216 Object.defineProperty(ContactName.prototype, "formatted", {
4217 get: function () { return; },
4218 enumerable: true,
4219 configurable: true
4220 });
4221 Object.defineProperty(ContactName.prototype, "familyName", {
4222 get: function () { return; },
4223 enumerable: true,
4224 configurable: true
4225 });
4226 Object.defineProperty(ContactName.prototype, "givenName", {
4227 get: function () { return; },
4228 enumerable: true,
4229 configurable: true
4230 });
4231 Object.defineProperty(ContactName.prototype, "middleName", {
4232 get: function () { return; },
4233 enumerable: true,
4234 configurable: true
4235 });
4236 Object.defineProperty(ContactName.prototype, "honorificPrefix", {
4237 get: function () { return; },
4238 enumerable: true,
4239 configurable: true
4240 });
4241 Object.defineProperty(ContactName.prototype, "honorificSuffix", {
4242 get: function () { return; },
4243 enumerable: true,
4244 configurable: true
4245 });
4246 __decorate$22([
4247 InstanceProperty
4248 ], ContactName.prototype, "formatted", null);
4249 __decorate$22([
4250 InstanceProperty
4251 ], ContactName.prototype, "familyName", null);
4252 __decorate$22([
4253 InstanceProperty
4254 ], ContactName.prototype, "givenName", null);
4255 __decorate$22([
4256 InstanceProperty
4257 ], ContactName.prototype, "middleName", null);
4258 __decorate$22([
4259 InstanceProperty
4260 ], ContactName.prototype, "honorificPrefix", null);
4261 __decorate$22([
4262 InstanceProperty
4263 ], ContactName.prototype, "honorificSuffix", null);
4264 return ContactName;
4265}());
4266/**
4267 * @private
4268 */
4269var ContactField = (function () {
4270 function ContactField(type, value, pref) {
4271 this._objectInstance = new window.ContactField(type, value, pref);
4272 }
4273 Object.defineProperty(ContactField.prototype, "type", {
4274 get: function () { return; },
4275 enumerable: true,
4276 configurable: true
4277 });
4278 Object.defineProperty(ContactField.prototype, "value", {
4279 get: function () { return; },
4280 enumerable: true,
4281 configurable: true
4282 });
4283 Object.defineProperty(ContactField.prototype, "pref", {
4284 get: function () { return; },
4285 enumerable: true,
4286 configurable: true
4287 });
4288 __decorate$22([
4289 InstanceProperty
4290 ], ContactField.prototype, "type", null);
4291 __decorate$22([
4292 InstanceProperty
4293 ], ContactField.prototype, "value", null);
4294 __decorate$22([
4295 InstanceProperty
4296 ], ContactField.prototype, "pref", null);
4297 return ContactField;
4298}());
4299/**
4300 * @private
4301 */
4302var ContactAddress = (function () {
4303 function ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country) {
4304 this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
4305 }
4306 Object.defineProperty(ContactAddress.prototype, "pref", {
4307 get: function () { return; },
4308 enumerable: true,
4309 configurable: true
4310 });
4311 Object.defineProperty(ContactAddress.prototype, "type", {
4312 get: function () { return; },
4313 enumerable: true,
4314 configurable: true
4315 });
4316 Object.defineProperty(ContactAddress.prototype, "formatted", {
4317 get: function () { return; },
4318 enumerable: true,
4319 configurable: true
4320 });
4321 Object.defineProperty(ContactAddress.prototype, "streetAddress", {
4322 get: function () { return; },
4323 enumerable: true,
4324 configurable: true
4325 });
4326 Object.defineProperty(ContactAddress.prototype, "locality", {
4327 get: function () { return; },
4328 enumerable: true,
4329 configurable: true
4330 });
4331 Object.defineProperty(ContactAddress.prototype, "region", {
4332 get: function () { return; },
4333 enumerable: true,
4334 configurable: true
4335 });
4336 Object.defineProperty(ContactAddress.prototype, "postalCode", {
4337 get: function () { return; },
4338 enumerable: true,
4339 configurable: true
4340 });
4341 Object.defineProperty(ContactAddress.prototype, "country", {
4342 get: function () { return; },
4343 enumerable: true,
4344 configurable: true
4345 });
4346 __decorate$22([
4347 InstanceProperty
4348 ], ContactAddress.prototype, "pref", null);
4349 __decorate$22([
4350 InstanceProperty
4351 ], ContactAddress.prototype, "type", null);
4352 __decorate$22([
4353 InstanceProperty
4354 ], ContactAddress.prototype, "formatted", null);
4355 __decorate$22([
4356 InstanceProperty
4357 ], ContactAddress.prototype, "streetAddress", null);
4358 __decorate$22([
4359 InstanceProperty
4360 ], ContactAddress.prototype, "locality", null);
4361 __decorate$22([
4362 InstanceProperty
4363 ], ContactAddress.prototype, "region", null);
4364 __decorate$22([
4365 InstanceProperty
4366 ], ContactAddress.prototype, "postalCode", null);
4367 __decorate$22([
4368 InstanceProperty
4369 ], ContactAddress.prototype, "country", null);
4370 return ContactAddress;
4371}());
4372/**
4373 * @private
4374 */
4375var ContactOrganization = (function () {
4376 function ContactOrganization() {
4377 this._objectInstance = new window.ContactOrganization();
4378 }
4379 Object.defineProperty(ContactOrganization.prototype, "pref", {
4380 get: function () { return; },
4381 enumerable: true,
4382 configurable: true
4383 });
4384 Object.defineProperty(ContactOrganization.prototype, "type", {
4385 get: function () { return; },
4386 enumerable: true,
4387 configurable: true
4388 });
4389 Object.defineProperty(ContactOrganization.prototype, "name", {
4390 get: function () { return; },
4391 enumerable: true,
4392 configurable: true
4393 });
4394 Object.defineProperty(ContactOrganization.prototype, "department", {
4395 get: function () { return; },
4396 enumerable: true,
4397 configurable: true
4398 });
4399 Object.defineProperty(ContactOrganization.prototype, "title", {
4400 get: function () { return; },
4401 enumerable: true,
4402 configurable: true
4403 });
4404 __decorate$22([
4405 InstanceProperty
4406 ], ContactOrganization.prototype, "pref", null);
4407 __decorate$22([
4408 InstanceProperty
4409 ], ContactOrganization.prototype, "type", null);
4410 __decorate$22([
4411 InstanceProperty
4412 ], ContactOrganization.prototype, "name", null);
4413 __decorate$22([
4414 InstanceProperty
4415 ], ContactOrganization.prototype, "department", null);
4416 __decorate$22([
4417 InstanceProperty
4418 ], ContactOrganization.prototype, "title", null);
4419 return ContactOrganization;
4420}());
4421/**
4422 * @private
4423 */
4424var ContactFindOptions = (function () {
4425 function ContactFindOptions() {
4426 this._objectInstance = new window.ContactFindOptions();
4427 }
4428 Object.defineProperty(ContactFindOptions.prototype, "filter", {
4429 get: function () { return; },
4430 enumerable: true,
4431 configurable: true
4432 });
4433 Object.defineProperty(ContactFindOptions.prototype, "multiple", {
4434 get: function () { return; },
4435 enumerable: true,
4436 configurable: true
4437 });
4438 Object.defineProperty(ContactFindOptions.prototype, "desiredFields", {
4439 get: function () { return; },
4440 enumerable: true,
4441 configurable: true
4442 });
4443 Object.defineProperty(ContactFindOptions.prototype, "hasPhoneNumber", {
4444 get: function () { return; },
4445 enumerable: true,
4446 configurable: true
4447 });
4448 __decorate$22([
4449 InstanceProperty
4450 ], ContactFindOptions.prototype, "filter", null);
4451 __decorate$22([
4452 InstanceProperty
4453 ], ContactFindOptions.prototype, "multiple", null);
4454 __decorate$22([
4455 InstanceProperty
4456 ], ContactFindOptions.prototype, "desiredFields", null);
4457 __decorate$22([
4458 InstanceProperty
4459 ], ContactFindOptions.prototype, "hasPhoneNumber", null);
4460 return ContactFindOptions;
4461}());
4462/**
4463 * @name Contacts
4464 * @description
4465 * Access and manage Contacts on the device.
4466 *
4467 * @usage
4468 *
4469 * ```typescript
4470 * import { Contact } from 'ionic-native';
4471 *
4472 *
4473 * let contact = new Contact();
4474 * contact.displayName = 'Mr. Ionitron';
4475 * contact.save().then(
4476 * () => console.log('Contact saved!', contact),
4477 * (error: any) => console.error('Error saving contact.', error)
4478 * );
4479 * ```
4480 *
4481 *
4482 */
4483var Contacts = (function () {
4484 function Contacts() {
4485 }
4486 /**
4487 * Create a single contact.
4488 * @return Returns a object Contact
4489 */
4490 Contacts.create = function () {
4491 return new Contact();
4492 };
4493 /**
4494 * Search for contacts in the Contacts list.
4495 * @param fields {string[]} Contact fields to be used as a search qualifier.
4496 * A zero-length contactFields parameter is invalid and results in ContactError.INVALID_ARGUMENT_ERROR.
4497 * A contactFields value of "*" searches all contact fields.
4498 *
4499 * @param options {Object} the options to query with:
4500 * filter: The search string used to find navigator.contacts. (string) (Default: "")
4501 * multiple: Determines if the find operation returns multiple navigator.contacts. (Boolean) (Default: false)
4502 * desiredFields: Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. (DOMString[]) [Optional]
4503 * hasPhoneNumber(Android only): Filters the search to only return contacts with a phone number informed. (Boolean) (Default: false)
4504 *
4505 * @return Returns a Promise that resolves with the search results (an array of Contact objects)
4506 */
4507 Contacts.find = function (fields, options) { return; };
4508 /**
4509 * Select a single Contact.
4510 * @return Returns a Promise that resolves with the selected Contact
4511 */
4512 Contacts.pickContact = function () { return; };
4513 __decorate$22([
4514 Cordova({
4515 successIndex: 1,
4516 errorIndex: 2
4517 })
4518 ], Contacts, "find", null);
4519 __decorate$22([
4520 Cordova()
4521 ], Contacts, "pickContact", null);
4522 Contacts = __decorate$22([
4523 Plugin({
4524 plugin: 'cordova-plugin-contacts',
4525 pluginRef: 'navigator.contacts',
4526 repo: 'https://github.com/apache/cordova-plugin-contacts'
4527 })
4528 ], Contacts);
4529 return Contacts;
4530}());
4531
4532var __decorate$23 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4533 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4534 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4535 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;
4536 return c > 3 && r && Object.defineProperty(target, key, r), r;
4537};
4538/**
4539 * @name Crop
4540 * @description Crops images
4541 * @usage
4542 * ```
4543 * import {Crop} from 'ionic-native';
4544 *
4545 * ...
4546 *
4547 * Crop.crop('path/to/image.jpg', {quality: 75})
4548 * .then(
4549 * newImage => console.log("new image path is: " + newImage),
4550 * error => console.error("Error cropping image", error)
4551 * );
4552 * ```
4553 */
4554var Crop = (function () {
4555 function Crop() {
4556 }
4557 /**
4558 * Crops an image
4559 * @param pathToImage
4560 * @param options
4561 * @return {Promise<string>} Returns a promise that resolves with the new image path, or rejects if failed to crop.
4562 */
4563 Crop.crop = function (pathToImage, options) { return; };
4564 __decorate$23([
4565 Cordova({
4566 callbackOrder: 'reverse'
4567 })
4568 ], Crop, "crop", null);
4569 Crop = __decorate$23([
4570 Plugin({
4571 plugin: 'cordova-plugin-crop',
4572 pluginRef: 'plugins',
4573 repo: 'https://github.com/jeduan/cordova-plugin-crop'
4574 })
4575 ], Crop);
4576 return Crop;
4577}());
4578
4579var __decorate$24 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4580 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4581 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4582 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;
4583 return c > 3 && r && Object.defineProperty(target, key, r), r;
4584};
4585/**
4586 * @name Date Picker
4587 * @description
4588 * The DatePicker plugin allows the user to fetch date or time using native dialogs.
4589 *
4590 * Platforms supported: iOS, Android, Windows
4591 *
4592 * Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
4593 *
4594 * @usage
4595 * ```typescript
4596 * import { DatePicker } from 'ionic-native';
4597 *
4598 *
4599 * DatePicker.show({
4600 * date: new Date(),
4601 * mode: 'date'
4602 * }).then(
4603 * date => console.log('Got date: ', date),
4604 * err => console.log('Error occurred while getting date: ', err)
4605 * );
4606 * ```
4607 *
4608 */
4609var DatePicker = (function () {
4610 function DatePicker() {
4611 }
4612 /**
4613 * Shows the date and/or time picker dialog(s)
4614 * @param {DatePickerOptions} options Options for the date picker.
4615 * @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
4616 */
4617 DatePicker.show = function (options) { return; };
4618 __decorate$24([
4619 Cordova()
4620 ], DatePicker, "show", null);
4621 DatePicker = __decorate$24([
4622 Plugin({
4623 plugin: 'cordova-plugin-datepicker',
4624 pluginRef: 'datePicker',
4625 repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker'
4626 })
4627 ], DatePicker);
4628 return DatePicker;
4629}());
4630
4631var __decorate$25 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4632 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4633 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4634 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;
4635 return c > 3 && r && Object.defineProperty(target, key, r), r;
4636};
4637/**
4638 * @name DB Meter
4639 * @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
4640 * @usage
4641 * ```typescript
4642 * import { DBMeter } from 'ionic-native';
4643 *
4644 *
4645 * // Start listening
4646 * let subscription = DBMeter.start().subscribe(
4647 * data => console.log(data)
4648 * );
4649 *
4650 * // Check if we are listening
4651 * DBMeter.isListening().then(
4652 * (isListening: boolean) => console.log(isListening)
4653 * );
4654 *
4655 * // Stop listening
4656 * subscription.unsubscribe();
4657 *
4658 * // Delete DBMeter instance from memory
4659 * DBMeter.delete().then(
4660 * () => console.log('Deleted DB Meter instance'),
4661 * error => console.log('Error occurred while deleting DB Meter instance')
4662 * );
4663 * ```
4664 */
4665var DBMeter = (function () {
4666 function DBMeter() {
4667 }
4668 /**
4669 * Starts listening
4670 * @return {Observable<string>} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.
4671 */
4672 DBMeter.start = function () { return; };
4673 /**
4674 * Stops listening
4675 * @private
4676 */
4677 DBMeter.stop = function () { return; };
4678 /**
4679 * Check if the DB Meter is listening
4680 * @return {Promise<boolean>} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening
4681 */
4682 DBMeter.isListening = function () { return; };
4683 /**
4684 * Delete the DB Meter instance
4685 * @return {Promise<any>} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.
4686 */
4687 DBMeter.delete = function () { return; };
4688 __decorate$25([
4689 Cordova({
4690 observable: true,
4691 clearFunction: 'stop'
4692 })
4693 ], DBMeter, "start", null);
4694 __decorate$25([
4695 Cordova()
4696 ], DBMeter, "stop", null);
4697 __decorate$25([
4698 Cordova()
4699 ], DBMeter, "isListening", null);
4700 __decorate$25([
4701 Cordova()
4702 ], DBMeter, "delete", null);
4703 DBMeter = __decorate$25([
4704 Plugin({
4705 plugin: 'cordova-plugin-dbmeter',
4706 pluginRef: 'DBMeter',
4707 repo: 'https://github.com/akofman/cordova-plugin-dbmeter',
4708 platforms: ['iOS', 'Android']
4709 })
4710 ], DBMeter);
4711 return DBMeter;
4712}());
4713
4714var __decorate$26 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4715 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4716 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4717 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;
4718 return c > 3 && r && Object.defineProperty(target, key, r), r;
4719};
4720/**
4721 * @name Ionic Deeplinks
4722 * @description This plugin handles deeplinks on iOS and Android for both custom URL scheme links
4723 * and Universal App Links.
4724 *
4725 * @usage
4726 * ```typescript
4727 * import { IonicDeeplinks } from 'ionic-native';
4728 *
4729 * ```
4730 */
4731var Deeplinks = (function () {
4732 function Deeplinks() {
4733 }
4734 /**
4735 * Define a set of paths to match against incoming deeplinks.
4736 *
4737 * @param {paths} Define a set of paths to match against incoming deeplinks.
4738 * paths takes an object of the form { 'path': data }. If a deeplink
4739 * matches the path, the resulting path-data pair will be returned in the
4740 * promise result which you can then use to navigate in the app as you see fit.
4741 * @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and
4742 * is rejected if a deeplink comes through that does not match a given path.
4743 */
4744 Deeplinks.route = function (paths) { return; };
4745 /**
4746 *
4747 * This is a convenience version of `route` that takes a reference to a NavController
4748 * from Ionic 2, or a custom class that conforms to this protocol:
4749 *
4750 * NavController.push = function(View, Params){}
4751 *
4752 * This handler will automatically navigate when a route matches. If you need finer-grained
4753 * control over the behavior of a matching deeplink, use the plain `route` method.
4754 *
4755 * @param {paths} Define a set of paths to match against incoming deeplinks.
4756 * paths takes an object of the form { 'path': data }. If a deeplink
4757 * matches the path, the resulting path-data pair will be returned in the
4758 * promise result which you can then use to navigate in the app as you see fit.
4759 *
4760 * @returns {Promise} Returns a Promise that resolves when a deeplink comes through, and
4761 * is rejected if a deeplink comes through that does not match a given path.
4762 */
4763 Deeplinks.routeWithNavController = function (navController, paths) { return; };
4764 __decorate$26([
4765 Cordova({
4766 observable: true
4767 })
4768 ], Deeplinks, "route", null);
4769 __decorate$26([
4770 Cordova({
4771 observable: true
4772 })
4773 ], Deeplinks, "routeWithNavController", null);
4774 Deeplinks = __decorate$26([
4775 Plugin({
4776 plugin: 'ionic-plugin-deeplinks',
4777 pluginRef: 'IonicDeeplink',
4778 repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
4779 platforms: ['iOS', 'Android'],
4780 install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/'
4781 })
4782 ], Deeplinks);
4783 return Deeplinks;
4784}());
4785
4786var __decorate$27 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4787 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4788 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4789 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;
4790 return c > 3 && r && Object.defineProperty(target, key, r), r;
4791};
4792/**
4793 * @name Device
4794 * @description
4795 * Access information about the underlying device and platform.
4796 *
4797 * @usage
4798 * ```typescript
4799 * import { Device } from 'ionic-native';
4800 *
4801 *
4802 * console.log('Device UUID is: ' + Device.device.uuid);
4803 * ```
4804 */
4805var Device = (function () {
4806 function Device() {
4807 }
4808 Object.defineProperty(Device, "device", {
4809 /**
4810 * Returns the whole device object.
4811 *
4812 * @returns {Object} The device object.
4813 */
4814 get: function () { return window.device; },
4815 enumerable: true,
4816 configurable: true
4817 });
4818 __decorate$27([
4819 CordovaProperty
4820 ], Device, "device", null);
4821 Device = __decorate$27([
4822 Plugin({
4823 plugin: 'cordova-plugin-device',
4824 pluginRef: 'device',
4825 repo: 'https://github.com/apache/cordova-plugin-device'
4826 })
4827 ], Device);
4828 return Device;
4829}());
4830
4831var __decorate$28 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4832 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4833 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4834 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;
4835 return c > 3 && r && Object.defineProperty(target, key, r), r;
4836};
4837var DeviceAccounts = (function () {
4838 function DeviceAccounts() {
4839 }
4840 /**
4841 * Gets all accounts registered on the Android Device
4842 */
4843 DeviceAccounts.get = function () { return; };
4844 /**
4845 * Get all accounts registered on Android device for requested type
4846 */
4847 DeviceAccounts.getByType = function (type) { return; };
4848 /**
4849 * Get all emails registered on Android device (accounts with 'com.google' type)
4850 */
4851 DeviceAccounts.getEmails = function () { return; };
4852 /**
4853 * Get the first email registered on Android device
4854 */
4855 DeviceAccounts.getEmail = function () { return; };
4856 __decorate$28([
4857 Cordova()
4858 ], DeviceAccounts, "get", null);
4859 __decorate$28([
4860 Cordova()
4861 ], DeviceAccounts, "getByType", null);
4862 __decorate$28([
4863 Cordova()
4864 ], DeviceAccounts, "getEmails", null);
4865 __decorate$28([
4866 Cordova()
4867 ], DeviceAccounts, "getEmail", null);
4868 DeviceAccounts = __decorate$28([
4869 Plugin({
4870 plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
4871 pluginRef: 'plugins.DeviceAccounts',
4872 repo: 'https://github.com/loicknuchel/cordova-device-accounts',
4873 platforms: ['Android']
4874 })
4875 ], DeviceAccounts);
4876 return DeviceAccounts;
4877}());
4878
4879var __decorate$29 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4880 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4881 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4882 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;
4883 return c > 3 && r && Object.defineProperty(target, key, r), r;
4884};
4885/**
4886 * @name Device Motion
4887 * @description
4888 * Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion).
4889 *
4890 * @usage
4891 * ```typescript
4892 * import { DeviceMotion } from 'ionic-native';
4893 *
4894 *
4895 * // Get the device current acceleration
4896 * DeviceMotion.getCurrentAcceleration().then(
4897 * (acceleration: AccelerationData) => console.log(acceleration),
4898 * (error: any) => console.log(error)
4899 * );
4900 *
4901 * // Watch device acceleration
4902 * var subscription = DeviceMotion.watchAcceleration().subscribe((acceleration: AccelerationData) => {
4903 * console.log(acceleration);
4904 * });
4905 *
4906 * // Stop watch
4907 * subscription.unsubscribe();
4908 *
4909 * ```
4910 */
4911var DeviceMotion = (function () {
4912 function DeviceMotion() {
4913 }
4914 /**
4915 * Get the current acceleration along the x, y, and z axes.
4916 * @returns {Promise<any>} Returns object with x, y, z, and timestamp properties
4917 */
4918 DeviceMotion.getCurrentAcceleration = function () { return; };
4919 /**
4920 * Watch the device acceleration. Clear the watch by unsubscribing from the observable.
4921 * @param {AccelerometerOptions} options list of options for the accelerometer.
4922 * @returns {Observable<AccelerationData>} Observable returns an observable that you can subscribe to
4923 */
4924 DeviceMotion.watchAcceleration = function (options) { return; };
4925 __decorate$29([
4926 Cordova()
4927 ], DeviceMotion, "getCurrentAcceleration", null);
4928 __decorate$29([
4929 Cordova({
4930 callbackOrder: 'reverse',
4931 observable: true,
4932 clearFunction: 'clearWatch'
4933 })
4934 ], DeviceMotion, "watchAcceleration", null);
4935 DeviceMotion = __decorate$29([
4936 Plugin({
4937 plugin: 'cordova-plugin-device-motion',
4938 pluginRef: 'navigator.accelerometer',
4939 repo: 'https://github.com/apache/cordova-plugin-device-motion'
4940 })
4941 ], DeviceMotion);
4942 return DeviceMotion;
4943}());
4944
4945var __decorate$30 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4946 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4947 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4948 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;
4949 return c > 3 && r && Object.defineProperty(target, key, r), r;
4950};
4951/**
4952 * @name Device Orientation
4953 * @description
4954 * Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation).
4955 *
4956 * @usage
4957 * ```typescript
4958 * // CompassHeading is an interface for compass
4959 * import { DeviceOrientation, CompassHeading } from 'ionic-native';
4960 *
4961 *
4962 * // Get the device current compass heading
4963 * DeviceOrientation.getCurrentHeading().then(
4964 * (data: CompassHeading) => console.log(data),
4965 * (error: any) => console.log(error)
4966 * );
4967 *
4968 * // Watch the device compass heading change
4969 * var subscription = DeviceOrientation.watchHeading().subscribe(
4970 * (data: CompassHeading) => console.log(data)
4971 * );
4972 *
4973 * // Stop watching heading change
4974 * subscription.unsubscribe();
4975 * ```
4976 */
4977var DeviceOrientation = (function () {
4978 function DeviceOrientation() {
4979 }
4980 /**
4981 * Get the current compass heading.
4982 * @returns {Promise<CompassHeading>}
4983 */
4984 DeviceOrientation.getCurrentHeading = function () { return; };
4985 /**
4986 * Get the device current heading at a regular interval
4987 *
4988 * Stop the watch by unsubscribing from the observable
4989 * @param {CompassOptions} options Options for compass. Frequency and Filter. Optional
4990 * @returns {Observable<CompassHeading>} Returns an observable that contains the compass heading
4991 */
4992 DeviceOrientation.watchHeading = function (options) { return; };
4993 __decorate$30([
4994 Cordova()
4995 ], DeviceOrientation, "getCurrentHeading", null);
4996 __decorate$30([
4997 Cordova({
4998 callbackOrder: 'reverse',
4999 observable: true,
5000 clearFunction: 'clearWatch'
5001 })
5002 ], DeviceOrientation, "watchHeading", null);
5003 DeviceOrientation = __decorate$30([
5004 Plugin({
5005 plugin: 'cordova-plugin-device-orientation',
5006 pluginRef: 'navigator.compass',
5007 repo: 'https://github.com/apache/cordova-plugin-device-orientation'
5008 })
5009 ], DeviceOrientation);
5010 return DeviceOrientation;
5011}());
5012
5013var __decorate$31 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
5014 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5015 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5016 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;
5017 return c > 3 && r && Object.defineProperty(target, key, r), r;
5018};
5019/**
5020 * @name Diagnostic
5021 * @description
5022 * Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
5023 *
5024 * @usage
5025 * ```typescript
5026 * import { Diagnostic } from 'ionic-native';
5027 *
5028 * let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); };
5029 * let errorCallback = (e) => console.error(e);
5030 *
5031 * Diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback);
5032 *
5033 * Diagnostic.isBluetoothAvailable().then(successCallback, errorCallback);
5034 *
5035 *
5036 * Diagnostic.getBluetoothState()
5037 * .then((state) => {
5038 * if (state == Diagnostic.bluetoothStates.POWERED_ON){
5039 * // do something
5040 * } else {
5041 * // do something else
5042 * }
5043 * }).catch(e => console.error(e));
5044 *
5045 * ```
5046 */
5047var Diagnostic = (function () {
5048 function Diagnostic() {
5049 }
5050 /**
5051 * Checks if app is able to access device location.
5052 * @returns {Promise<any>}
5053 */
5054 Diagnostic.isLocationAvailable = function () { return; };
5055 /**
5056 * Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
5057 * On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
5058 * @returns {Promise<any>}
5059 */
5060 Diagnostic.isWifiAvailable = function () { return; };
5061 /**
5062 * Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
5063 * application is authorized to use it.
5064 * @returns {Promise<any>}
5065 */
5066 Diagnostic.isCameraAvailable = function () { return; };
5067 /**
5068 * Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
5069 * On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
5070 * @returns {Promise<any>}
5071 */
5072 Diagnostic.isBluetoothAvailable = function () { return; };
5073 /**
5074 * Displays the device location settings to allow user to enable location services/change location mode.
5075 */
5076 Diagnostic.switchToLocationSettings = function () { };
5077 /**
5078 * Displays mobile settings to allow user to enable mobile data.
5079 */
5080 Diagnostic.switchToMobileDataSettings = function () { };
5081 /**
5082 * Displays Bluetooth settings to allow user to enable Bluetooth.
5083 */
5084 Diagnostic.switchToBluetoothSettings = function () { };
5085 /**
5086 * Displays WiFi settings to allow user to enable WiFi.
5087 */
5088 Diagnostic.switchToWifiSettings = function () { };
5089 /**
5090 * Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()`
5091 * @returns {Promise<boolean>}
5092 */
5093 Diagnostic.isWifiEnabled = function () { return; };
5094 /**
5095 * Enables/disables WiFi on the device.
5096 * Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android
5097 * @param state {boolean}
5098 */
5099 Diagnostic.setWifiState = function (state) { return; };
5100 /**
5101 * Enables/disables Bluetooth on the device.
5102 * Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android
5103 * @param state {boolean}
5104 */
5105 Diagnostic.setBluetoothState = function (state) { return; };
5106 /**
5107 * Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on.
5108 * @returns {Promise<boolean>}
5109 */
5110 Diagnostic.isLocationEnabled = function () { return; };
5111 /**
5112 * Checks if the application is authorized to use location.
5113 * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
5114 * @returns {Promise<any>}
5115 */
5116 Diagnostic.isLocationAuthorized = function () { return; };
5117 /**
5118 * Returns the location authorization status for the application.
5119 * @returns {Promise<any>}
5120 */
5121 Diagnostic.getLocationAuthorizationStatus = function () { return; };
5122 /**
5123 * Returns the location authorization status for the application.
5124 * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
5125 *
5126 * mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
5127 * @returns {Promise<any>}
5128 */
5129 Diagnostic.requestLocationAuthorization = function (mode) { return; };
5130 /**
5131 * Checks if camera hardware is present on device.
5132 * @returns {Promise<any>}
5133 */
5134 Diagnostic.isCameraPresent = function () { return; };
5135 /**
5136 * Checks if the application is authorized to use the camera.
5137 * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
5138 * @returns {Promise<any>}
5139 */
5140 Diagnostic.isCameraAuthorized = function () { return; };
5141 /**
5142 * Returns the camera authorization status for the application.
5143 * @returns {Promise<any>}
5144 */
5145 Diagnostic.getCameraAuthorizationStatus = function () { return; };
5146 /**
5147 * Requests camera authorization for the application.
5148 * @returns {Promise<any>}
5149 */
5150 Diagnostic.requestCameraAuthorization = function () { return; };
5151 /**
5152 * Checks if the application is authorized to use the microphone.
5153 * @returns {Promise<boolean>}
5154 */
5155 Diagnostic.isMicrophoneAuthorized = function () { return; };
5156 /**
5157 * Returns the microphone authorization status for the application.
5158 * @returns {Promise<any>}
5159 */
5160 Diagnostic.getMicrophoneAuthorizationStatus = function () { return; };
5161 /**
5162 * Requests microphone authorization for the application.
5163 * @returns {Promise<any>}
5164 */
5165 Diagnostic.requestMicrophoneAuthorization = function () { return; };
5166 /**
5167 * Checks if the application is authorized to use contacts (address book).
5168 * @returns {Promise<boolean>}
5169 */
5170 Diagnostic.isContactsAuthorized = function () { return; };
5171 /**
5172 * Returns the contacts authorization status for the application.
5173 * @returns {Promise<any>}
5174 */
5175 Diagnostic.getContactsAuthroizationStatus = function () { return; };
5176 /**
5177 * Requests contacts authorization for the application.
5178 * @returns {Promise<any>}
5179 */
5180 Diagnostic.requestContactsAuthorization = function () { return; };
5181 /**
5182 * Checks if the application is authorized to use the calendar.
5183 *
5184 * Notes for Android:
5185 * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
5186 *
5187 * Notes for iOS:
5188 * - This relates to Calendar Events (not Calendar Reminders)
5189 * @returns {Promise<any>}
5190 */
5191 Diagnostic.isCalendarAuthorized = function () { return; };
5192 /**
5193 * Returns the calendar authorization status for the application.
5194 *
5195 * Notes for Android:
5196 * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return `GRANTED` status as permissions are already granted at installation time.
5197 *
5198 * Notes for iOS:
5199 * - This relates to Calendar Events (not Calendar Reminders)
5200 *
5201 * @returns {Promise<any>}
5202 */
5203 Diagnostic.getCalendarAuthorizationStatus = function () { return; };
5204 /**
5205 * Requests calendar authorization for the application.
5206 *
5207 * Notes for iOS:
5208 * - Should only be called if authorization status is NOT_DETERMINED. Calling it when in any other state will have no effect and just return the current authorization status.
5209 * - This relates to Calendar Events (not Calendar Reminders)
5210 *
5211 * Notes for Android:
5212 * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
5213 * - This requests permission for `READ_CALENDAR` run-time permission
5214 * - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR`
5215 *
5216 * @returns {Promise<any>}
5217 */
5218 Diagnostic.requestCalendarAuthorization = function () { return; };
5219 /**
5220 * Opens settings page for this app.
5221 * On Android, this opens the "App Info" page in the Settings app.
5222 * On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback.
5223 * @returns {Promise<any>}
5224 */
5225 Diagnostic.switchToSettings = function () { return; };
5226 /**
5227 * Returns the state of Bluetooth on the device.
5228 * @returns {Promise<any>}
5229 */
5230 Diagnostic.getBluetoothState = function () { return; };
5231 /**
5232 * Registers a function to be called when a change in Bluetooth state occurs.
5233 * @param handler
5234 */
5235 Diagnostic.registerBluetoothStateChangeHandler = function (handler) { };
5236 /**
5237 * Registers a function to be called when a change in Location state occurs.
5238 * @param handler
5239 */
5240 Diagnostic.registerLocationStateChangeHandler = function (handler) { };
5241 /**
5242 * Checks if high-accuracy locations are available to the app from GPS hardware.
5243 * Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location.
5244 * @returns {Promise<any>}
5245 */
5246 Diagnostic.isGpsLocationAvailable = function () { return; };
5247 /**
5248 * Checks if location mode is set to return high-accuracy locations from GPS hardware.
5249 * Returns true if Location mode is enabled and is set to either:
5250 * - Device only = GPS hardware only (high accuracy)
5251 * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
5252 */
5253 Diagnostic.isGpsLocationEnabled = function () { return; };
5254 /**
5255 * Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
5256 * Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location.
5257 * @returns {Promise<any>}
5258 */
5259 Diagnostic.isNetworkLocationAvailable = function () { return; };
5260 /**
5261 * Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
5262 * Returns true if Location mode is enabled and is set to either:
5263 * - Battery saving = network triangulation and Wifi network IDs (low accuracy)
5264 * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
5265 * @returns {Promise<any>}
5266 */
5267 Diagnostic.isNetworkLocationEnabled = function () { return; };
5268 /**
5269 * Returns the current location mode setting for the device.
5270 * @returns {Promise<any>}
5271 */
5272 Diagnostic.getLocationMode = function () { return; };
5273 /**
5274 * Returns the current authorisation status for a given permission.
5275 * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
5276 * @param permission
5277 * @returns {Promise<any>}
5278 */
5279 Diagnostic.getPermissionAuthorizationStatus = function (permission) { return; };
5280 /**
5281 * Returns the current authorisation status for multiple permissions.
5282 * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
5283 * @param permissions
5284 * @returns {Promise<any>}
5285 */
5286 Diagnostic.getPermissionsAuthorizationStatus = function (permissions) { return; };
5287 /**
5288 * Requests app to be granted authorisation for a runtime permission.
5289 * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time.
5290 * @param permission
5291 * @returns {Promise<any>}
5292 */
5293 Diagnostic.requestRuntimePermission = function (permission) { return; };
5294 /**
5295 * Requests app to be granted authorisation for multiple runtime permissions.
5296 * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
5297 * @param permissions
5298 * @returns {Promise<any>}
5299 */
5300 Diagnostic.requestRuntimePermissions = function (permissions) { return; };
5301 /**
5302 * Checks if the device setting for Bluetooth is switched on.
5303 * This requires `BLUETOOTH` permission on Android
5304 * @returns {Promise<boolean>}
5305 */
5306 Diagnostic.isBluetoothEnabled = function () { return; };
5307 /**
5308 * Checks if the device has Bluetooth capabilities.
5309 * @returns {Promise<boolean>}
5310 */
5311 Diagnostic.hasBluetoothSupport = function () { return; };
5312 /**
5313 * Checks if the device has Bluetooth Low Energy (LE) capabilities.
5314 * @returns {Promise<boolean>}
5315 */
5316 Diagnostic.hasBluetoothLESupport = function () { return; };
5317 /**
5318 * Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
5319 * @returns {Promise<boolean>}
5320 */
5321 Diagnostic.hasBluetoothLEPeripheralSupport = function () { return; };
5322 /**
5323 * Checks if the application is authorized to use the Camera Roll in Photos app.
5324 * @returns {Promise<boolean>}
5325 */
5326 Diagnostic.isCameraRollAuthorized = function () { return; };
5327 /**
5328 * Returns the authorization status for the application to use the Camera Roll in Photos app.
5329 * @returns {Promise<boolean>}
5330 */
5331 Diagnostic.getCameraRollAuthorizationStatus = function () { return; };
5332 /**
5333 * Requests camera roll authorization for the application.
5334 * Should only be called if authorization status is NOT_REQUESTED.
5335 * Calling it when in any other state will have no effect.
5336 * @returns {Promise<any>}
5337 */
5338 Diagnostic.requestCameraRollAuthorization = function () { return; };
5339 /**
5340 * Checks if remote (push) notifications are enabled.
5341 * @returns {Promise<boolean>}
5342 */
5343 Diagnostic.isRemoteNotificationsEnabled = function () { return; };
5344 /**
5345 * Indicates if the app is registered for remote (push) notifications on the device.
5346 * @returns {Promise<boolean>}
5347 */
5348 Diagnostic.isRegisteredForRemoteNotifications = function () { return; };
5349 /**
5350 * Indicates the current setting of notification types for the app in the Settings app.
5351 * Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled.
5352 * @returns {Promise<any>}
5353 */
5354 Diagnostic.getRemoteNotificationTypes = function () { return; };
5355 /**
5356 * Checks if the application is authorized to use reminders.
5357 * @returns {Promise<boolean>}
5358 */
5359 Diagnostic.isRemindersAuthorized = function () { return; };
5360 /**
5361 * Returns the reminders authorization status for the application.
5362 * @returns {Promise<any>}
5363 */
5364 Diagnostic.getRemindersAuthorizationStatus = function () { return; };
5365 /**
5366 * Requests reminders authorization for the application.
5367 * @returns {Promise<any>}
5368 */
5369 Diagnostic.requestRemindersAuthorization = function () { return; };
5370 /**
5371 * Checks if the application is authorized for background refresh.
5372 * @returns {Promise<boolean>}
5373 */
5374 Diagnostic.isBackgroundRefreshAuthorized = function () { return; };
5375 /**
5376 * Returns the background refresh authorization status for the application.
5377 * @returns {Promise<any>}
5378 */
5379 Diagnostic.getBackgroundRefreshStatus = function () { return; };
5380 Diagnostic.permission = {
5381 READ_CALENDAR: 'READ_CALENDAR',
5382 WRITE_CALENDAR: 'WRITE_CALENDAR',
5383 CAMERA: 'CAMERA',
5384 READ_CONTACTS: 'READ_CONTACTS',
5385 WRITE_CONTACTS: 'WRITE_CONTACTS',
5386 GET_ACCOUNTS: 'GET_ACCOUNTS',
5387 ACCESS_FINE_LOCATION: 'ACCESS_FINE_LOCATION',
5388 ACCESS_COARSE_LOCATION: 'ACCESS_COARSE_LOCATION',
5389 RECORD_AUDIO: 'RECORD_AUDIO',
5390 READ_PHONE_STATE: 'READ_PHONE_STATE',
5391 CALL_PHONE: 'CALL_PHONE',
5392 ADD_VOICEMAIL: 'ADD_VOICEMAIL',
5393 USE_SIP: 'USE_SIP',
5394 PROCESS_OUTGOING_CALLS: 'PROCESS_OUTGOING_CALLS',
5395 READ_CALL_LOG: 'READ_CALL_LOG',
5396 WRITE_CALL_LOG: 'WRITE_CALL_LOG',
5397 SEND_SMS: 'SEND_SMS',
5398 RECEIVE_SMS: 'RECEIVE_SMS',
5399 READ_SMS: 'READ_SMS',
5400 RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH',
5401 RECEIVE_MMS: 'RECEIVE_MMS',
5402 WRITE_EXTERNAL_STORAGE: 'WRITE_EXTERNAL_STORAGE',
5403 READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE',
5404 BODY_SENSORS: 'BODY_SENSORS'
5405 };
5406 Diagnostic.permissionStatus = {
5407 GRANTED: 'GRANTED',
5408 GRANTED_WHEN_IN_USE: 'GRANTED_WHEN_IN_USE',
5409 RESTRICTED: 'RESTRICTED',
5410 DENIED: 'DENIED',
5411 DENIED_ALWAYS: 'DENIED_ALWAYS',
5412 NOT_REQUESTED: 'NOT_REQUESTED'
5413 };
5414 Diagnostic.locationAuthorizationMode = {
5415 ALWAYS: 'ALWAYS',
5416 WHEN_IN_USE: 'WHEN_IN_USE'
5417 };
5418 Diagnostic.permissionGroups = {
5419 CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'],
5420 CAMERA: ['CAMERA'],
5421 CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'],
5422 LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'],
5423 MICROPHONE: ['RECORD_AUDIO'],
5424 PHONE: ['READ_PHONE_STATE', 'CALL_PHONE', 'ADD_VOICEMAIL', 'USE_SIP', 'PROCESS_OUTGOING_CALLS', 'READ_CALL_LOG', 'WRITE_CALL_LOG'],
5425 SENSORS: ['BODY_SENSORS'],
5426 SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'],
5427 STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE']
5428 };
5429 Diagnostic.locationMode = {
5430 HIGH_ACCURACY: 'high_accuracy',
5431 DEVICE_ONLY: 'device_only',
5432 BATTERY_SAVING: 'battery_saving',
5433 LOCATION_OFF: 'location_off'
5434 };
5435 Diagnostic.bluetoothState = {
5436 UNKNOWN: 'unknown',
5437 RESETTING: 'resetting',
5438 UNSUPPORTED: 'unsupported',
5439 UNAUTHORIZED: 'unauthorized',
5440 POWERED_OFF: 'powered_off',
5441 POWERED_ON: 'powered_on',
5442 POWERING_OFF: 'powering_off',
5443 POWERING_ON: 'powering_on'
5444 };
5445 __decorate$31([
5446 Cordova()
5447 ], Diagnostic, "isLocationAvailable", null);
5448 __decorate$31([
5449 Cordova()
5450 ], Diagnostic, "isWifiAvailable", null);
5451 __decorate$31([
5452 Cordova()
5453 ], Diagnostic, "isCameraAvailable", null);
5454 __decorate$31([
5455 Cordova()
5456 ], Diagnostic, "isBluetoothAvailable", null);
5457 __decorate$31([
5458 Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
5459 ], Diagnostic, "switchToLocationSettings", null);
5460 __decorate$31([
5461 Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
5462 ], Diagnostic, "switchToMobileDataSettings", null);
5463 __decorate$31([
5464 Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
5465 ], Diagnostic, "switchToBluetoothSettings", null);
5466 __decorate$31([
5467 Cordova({ sync: true, platforms: ['Android', 'Windows 10'] })
5468 ], Diagnostic, "switchToWifiSettings", null);
5469 __decorate$31([
5470 Cordova({ platforms: ['Android', 'Windows 10'] })
5471 ], Diagnostic, "isWifiEnabled", null);
5472 __decorate$31([
5473 Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
5474 ], Diagnostic, "setWifiState", null);
5475 __decorate$31([
5476 Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] })
5477 ], Diagnostic, "setBluetoothState", null);
5478 __decorate$31([
5479 Cordova({ platforms: ['Android', 'iOS'] })
5480 ], Diagnostic, "isLocationEnabled", null);
5481 __decorate$31([
5482 Cordova()
5483 ], Diagnostic, "isLocationAuthorized", null);
5484 __decorate$31([
5485 Cordova({ platforms: ['Android', 'iOS'] })
5486 ], Diagnostic, "getLocationAuthorizationStatus", null);
5487 __decorate$31([
5488 Cordova({ platforms: ['Android', 'iOS'] })
5489 ], Diagnostic, "requestLocationAuthorization", null);
5490 __decorate$31([
5491 Cordova({ platforms: ['Android', 'iOS'] })
5492 ], Diagnostic, "isCameraPresent", null);
5493 __decorate$31([
5494 Cordova({ platforms: ['Android', 'iOS'] })
5495 ], Diagnostic, "isCameraAuthorized", null);
5496 __decorate$31([
5497 Cordova({ platforms: ['Android', 'iOS'] })
5498 ], Diagnostic, "getCameraAuthorizationStatus", null);
5499 __decorate$31([
5500 Cordova({ platforms: ['Android', 'iOS'] })
5501 ], Diagnostic, "requestCameraAuthorization", null);
5502 __decorate$31([
5503 Cordova({ platforms: ['Android', 'iOS'] })
5504 ], Diagnostic, "isMicrophoneAuthorized", null);
5505 __decorate$31([
5506 Cordova({ platforms: ['Android', 'iOS'] })
5507 ], Diagnostic, "getMicrophoneAuthorizationStatus", null);
5508 __decorate$31([
5509 Cordova({ platforms: ['Android', 'iOS'] })
5510 ], Diagnostic, "requestMicrophoneAuthorization", null);
5511 __decorate$31([
5512 Cordova({ platforms: ['Android', 'iOS'] })
5513 ], Diagnostic, "isContactsAuthorized", null);
5514 __decorate$31([
5515 Cordova({ platforms: ['Android', 'iOS'] })
5516 ], Diagnostic, "getContactsAuthroizationStatus", null);
5517 __decorate$31([
5518 Cordova({ platforms: ['Android', 'iOS'] })
5519 ], Diagnostic, "requestContactsAuthorization", null);
5520 __decorate$31([
5521 Cordova({ platforms: ['Android', 'iOS'] })
5522 ], Diagnostic, "isCalendarAuthorized", null);
5523 __decorate$31([
5524 Cordova({ platforms: ['Android', 'iOS'] })
5525 ], Diagnostic, "getCalendarAuthorizationStatus", null);
5526 __decorate$31([
5527 Cordova({ platforms: ['Android', 'iOS'] })
5528 ], Diagnostic, "requestCalendarAuthorization", null);
5529 __decorate$31([
5530 Cordova({ platforms: ['Android', 'iOS'] })
5531 ], Diagnostic, "switchToSettings", null);
5532 __decorate$31([
5533 Cordova({ platforms: ['Android', 'iOS'] })
5534 ], Diagnostic, "getBluetoothState", null);
5535 __decorate$31([
5536 Cordova({ platforms: ['Android', 'iOS'], sync: true })
5537 ], Diagnostic, "registerBluetoothStateChangeHandler", null);
5538 __decorate$31([
5539 Cordova({ platforms: ['Android', 'iOS'], sync: true })
5540 ], Diagnostic, "registerLocationStateChangeHandler", null);
5541 __decorate$31([
5542 Cordova({ platforms: ['Android'] })
5543 ], Diagnostic, "isGpsLocationAvailable", null);
5544 __decorate$31([
5545 Cordova({ platforms: ['Android'] })
5546 ], Diagnostic, "isGpsLocationEnabled", null);
5547 __decorate$31([
5548 Cordova({ platforms: ['Android'] })
5549 ], Diagnostic, "isNetworkLocationAvailable", null);
5550 __decorate$31([
5551 Cordova({ platforms: ['Android'] })
5552 ], Diagnostic, "isNetworkLocationEnabled", null);
5553 __decorate$31([
5554 Cordova({ platforms: ['Android'] })
5555 ], Diagnostic, "getLocationMode", null);
5556 __decorate$31([
5557 Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
5558 ], Diagnostic, "getPermissionAuthorizationStatus", null);
5559 __decorate$31([
5560 Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
5561 ], Diagnostic, "getPermissionsAuthorizationStatus", null);
5562 __decorate$31([
5563 Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
5564 ], Diagnostic, "requestRuntimePermission", null);
5565 __decorate$31([
5566 Cordova({ platforms: ['Android'], callbackOrder: 'reverse' })
5567 ], Diagnostic, "requestRuntimePermissions", null);
5568 __decorate$31([
5569 Cordova({ platforms: ['Android'] })
5570 ], Diagnostic, "isBluetoothEnabled", null);
5571 __decorate$31([
5572 Cordova({ platforms: ['Android'] })
5573 ], Diagnostic, "hasBluetoothSupport", null);
5574 __decorate$31([
5575 Cordova({ platforms: ['Android'] })
5576 ], Diagnostic, "hasBluetoothLESupport", null);
5577 __decorate$31([
5578 Cordova({ platforms: ['Android'] })
5579 ], Diagnostic, "hasBluetoothLEPeripheralSupport", null);
5580 __decorate$31([
5581 Cordova({ platforms: ['iOS'] })
5582 ], Diagnostic, "isCameraRollAuthorized", null);
5583 __decorate$31([
5584 Cordova({ platforms: ['iOS'] })
5585 ], Diagnostic, "getCameraRollAuthorizationStatus", null);
5586 __decorate$31([
5587 Cordova({ platforms: ['iOS'] })
5588 ], Diagnostic, "requestCameraRollAuthorization", null);
5589 __decorate$31([
5590 Cordova({ platforms: ['iOS'] })
5591 ], Diagnostic, "isRemoteNotificationsEnabled", null);
5592 __decorate$31([
5593 Cordova({ platforms: ['iOS'] })
5594 ], Diagnostic, "isRegisteredForRemoteNotifications", null);
5595 __decorate$31([
5596 Cordova({ platforms: ['iOS'] })
5597 ], Diagnostic, "getRemoteNotificationTypes", null);
5598 __decorate$31([
5599 Cordova({ platforms: ['iOS'] })
5600 ], Diagnostic, "isRemindersAuthorized", null);
5601 __decorate$31([
5602 Cordova({ platforms: ['iOS'] })
5603 ], Diagnostic, "getRemindersAuthorizationStatus", null);
5604 __decorate$31([
5605 Cordova({ platforms: ['iOS'] })
5606 ], Diagnostic, "requestRemindersAuthorization", null);
5607 __decorate$31([
5608 Cordova({ platforms: ['iOS'] })
5609 ], Diagnostic, "isBackgroundRefreshAuthorized", null);
5610 __decorate$31([
5611 Cordova({ platforms: ['iOS'] })
5612 ], Diagnostic, "getBackgroundRefreshStatus", null);
5613 Diagnostic = __decorate$31([
5614 Plugin({
5615 plugin: 'cordova.plugins.diagnostic',
5616 pluginRef: 'cordova.plugins.diagnostic',
5617 repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
5618 })
5619 ], Diagnostic);
5620 return Diagnostic;
5621}());
5622
5623var __decorate$32 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
5624 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5625 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5626 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;
5627 return c > 3 && r && Object.defineProperty(target, key, r), r;
5628};
5629/**
5630 * @name Dialogs
5631 * @description
5632 * This plugin gives you ability to access and customize the device native dialogs.
5633 *
5634 * Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
5635 *
5636 * @usage
5637 * ```typescript
5638 * import { Dialogs } from 'ionic-native';
5639 *
5640 *
5641 *
5642 *
5643 * ```
5644 */
5645var Dialogs = (function () {
5646 function Dialogs() {
5647 }
5648 /**
5649 * Shows a custom alert or dialog box.
5650 * @param {string} message Dialog message.
5651 * @param {string} title Dialog title. (Optional, defaults to Alert)
5652 * @param {string} buttonName Button name. (Optional, defaults to OK)
5653 * @returns {Promise<any>} Returns a blank promise once the user has dismissed the alert.
5654 */
5655 Dialogs.alert = function (message, title, buttonName) {
5656 if (title === void 0) { title = 'Alert'; }
5657 if (buttonName === void 0) { buttonName = 'OK'; }
5658 return;
5659 };
5660 /**
5661 * Displays a customizable confirmation dialog box.
5662 * @param {string} message Dialog message.
5663 * @param {string} title Dialog title. (Optional, defaults to Confirm)
5664 * @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to [OK,Cancel])
5665 * @returns {Promise<number>} Returns a promise that resolves the button index that was clicked. Note that the index use one-based indexing.
5666 */
5667 Dialogs.confirm = function (message, title, buttonLabels) {
5668 if (title === void 0) { title = 'Confirm'; }
5669 if (buttonLabels === void 0) { buttonLabels = ['OK', 'Cancel']; }
5670 return;
5671 };
5672 /**
5673 * Displays a native dialog box that is more customizable than the browser's prompt function.
5674 * @param {string} message Dialog message.
5675 * @param {string} title Dialog title. (Optional, defaults to Prompt)
5676 * @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"])
5677 * @param {string} defaultText Default textbox input value. (Optional, Default: empty string)
5678 * @returns {Promise<any>} Returns a promise that resolves an object with the button index clicked and the text entered
5679 */
5680 Dialogs.prompt = function (message, title, buttonLabels, defaultText) {
5681 if (title === void 0) { title = 'Prompt'; }
5682 if (buttonLabels === void 0) { buttonLabels = ['OK', 'Cancel']; }
5683 if (defaultText === void 0) { defaultText = ''; }
5684 return;
5685 };
5686 /**
5687 * The device plays a beep sound.
5688 * @param {numbers} times The number of times to repeat the beep.
5689 */
5690 Dialogs.beep = function (times) { };
5691 __decorate$32([
5692 Cordova({
5693 successIndex: 1,
5694 errorIndex: 4
5695 })
5696 ], Dialogs, "alert", null);
5697 __decorate$32([
5698 Cordova({
5699 successIndex: 1,
5700 errorIndex: 4
5701 })
5702 ], Dialogs, "confirm", null);
5703 __decorate$32([
5704 Cordova({
5705 successIndex: 1,
5706 errorIndex: 5
5707 })
5708 ], Dialogs, "prompt", null);
5709 __decorate$32([
5710 Cordova({
5711 sync: true
5712 })
5713 ], Dialogs, "beep", null);
5714 Dialogs = __decorate$32([
5715 Plugin({
5716 plugin: 'cordova-plugin-dialogs',
5717 pluginRef: 'navigator.notification',
5718 repo: 'https://github.com/apache/cordova-plugin-dialogs.git'
5719 })
5720 ], Dialogs);
5721 return Dialogs;
5722}());
5723
5724var __decorate$33 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
5725 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5726 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5727 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;
5728 return c > 3 && r && Object.defineProperty(target, key, r), r;
5729};
5730/**
5731 * @name Email Composer
5732 * @description
5733 *
5734 * Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer).
5735 *
5736 * DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
5737 * A good alternative to this plugin is the social sharing plugin.
5738 *
5739 * @usage
5740 * ```typescript
5741 * import { EmailComposer } from 'ionic-native';
5742 *
5743 *
5744 * EmailComposer.isAvailable().then((available: boolean) =>{
5745 * if(available) {
5746 * //Now we know we can send
5747 * }
5748 * });
5749 *
5750 * let email = {
5751 * to: 'max@mustermann.de',
5752 * cc: 'erika@mustermann.de',
5753 * bcc: ['john@doe.com', 'jane@doe.com'],
5754 * attachments: [
5755 * 'file://img/logo.png',
5756 * 'res://icon.png',
5757 * 'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...',
5758 * 'file://README.pdf'
5759 * ],
5760 * subject: 'Cordova Icons',
5761 * body: 'How are you? Nice greetings from Leipzig',
5762 * isHtml: true
5763 * };
5764 *
5765 * // Send a text message using default options
5766 * EmailComposer.open(email);
5767 *
5768 * ```
5769 */
5770var EmailComposer = (function () {
5771 function EmailComposer() {
5772 }
5773 /**
5774 * Verifies if sending emails is supported on the device.
5775 *
5776 * @param app {string?} An optional app id or uri scheme.
5777 * @returns {Promise<boolean>} Resolves if available, rejects if not available
5778 */
5779 EmailComposer.isAvailable = function (app) {
5780 return new Promise(function (resolve, reject) {
5781 if (app) {
5782 cordova.plugins.email.isAvailable(app, function (isAvailable) {
5783 if (isAvailable) {
5784 resolve();
5785 }
5786 else {
5787 reject();
5788 }
5789 });
5790 }
5791 else {
5792 cordova.plugins.email.isAvailable(function (isAvailable) {
5793 if (isAvailable) {
5794 resolve();
5795 }
5796 else {
5797 reject();
5798 }
5799 });
5800 }
5801 });
5802 };
5803 /**
5804 * Adds a new mail app alias.
5805 *
5806 * @param alias {string} The alias name
5807 * @param packageName {string} The package name
5808 */
5809 EmailComposer.addAlias = function (alias, packageName) { };
5810 /**
5811 * Displays the email composer pre-filled with data.
5812 *
5813 * @param email {Email} Email
5814 * @param scope {any?} An optional scope for the promise
5815 * @returns {Promise<any>} Resolves promise when the EmailComposer has been opened
5816 */
5817 EmailComposer.open = function (email, scope) { return; };
5818 __decorate$33([
5819 Cordova()
5820 ], EmailComposer, "addAlias", null);
5821 __decorate$33([
5822 Cordova({
5823 successIndex: 1,
5824 errorIndex: 3
5825 })
5826 ], EmailComposer, "open", null);
5827 EmailComposer = __decorate$33([
5828 Plugin({
5829 plugin: 'cordova-plugin-email-composer',
5830 pluginRef: 'cordova.plugins.email',
5831 repo: 'https://github.com/katzer/cordova-plugin-email-composer.git',
5832 platforms: ['Android', 'iOS', 'Windows Phone 8']
5833 })
5834 ], EmailComposer);
5835 return EmailComposer;
5836}());
5837
5838var __decorate$34 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
5839 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5840 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5841 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;
5842 return c > 3 && r && Object.defineProperty(target, key, r), r;
5843};
5844/**
5845 * @name EstimoteBeacons
5846 *
5847 * @description
5848 * This plugin enables communication between a phone and Estimote Beacons peripherals.
5849 *
5850 */
5851var EstimoteBeacons = (function () {
5852 function EstimoteBeacons() {
5853 }
5854 /**
5855 * Ask the user for permission to use location services
5856 * while the app is in the foreground.
5857 * You need to call this function or requestAlwaysAuthorization
5858 * on iOS 8+.
5859 * Does nothing on other platforms.
5860 *
5861 * @usage
5862 * ```
5863 * EstimoteBeacons.requestWhenInUseAuthorization().then(
5864 * () => { console.log('on success'); },
5865 * () => { console.log('on error'); }
5866 * );
5867 * ```
5868 *
5869 * @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
5870 * @return Returns a Promise.
5871 */
5872 EstimoteBeacons.requestWhenInUseAuthorization = function () { return; };
5873 /**
5874 * Ask the user for permission to use location services
5875 * whenever the app is running.
5876 * You need to call this function or requestWhenInUseAuthorization
5877 * on iOS 8+.
5878 * Does nothing on other platforms.
5879 *
5880 * @usage
5881 * ```
5882 * EstimoteBeacons.requestAlwaysAuthorization().then(
5883 * () => { console.log('on success'); },
5884 * () => { console.log('on error'); }
5885 * );
5886 * ```
5887 *
5888 * @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
5889 * @return Returns a Promise.
5890 */
5891 EstimoteBeacons.requestAlwaysAuthorization = function () { return; };
5892 /**
5893 * Get the current location authorization status.
5894 * Implemented on iOS 8+.
5895 * Does nothing on other platforms.
5896 *
5897 * @usage
5898 * ```
5899 * EstimoteBeacons.authorizationStatus().then(
5900 * (result) => { console.log('Location authorization status: ' + result); },
5901 * (errorMessage) => { console.log('Error: ' + errorMessage); }
5902 * );
5903 * ```
5904 *
5905 * @see {@link https://community.estimote.com/hc/en-us/articles/203393036-Estimote-SDK-and-iOS-8-Location-Services|Estimote SDK and iOS 8 Location Services}
5906 * @return Returns a Promise.
5907 */
5908 EstimoteBeacons.authorizationStatus = function () { return; };
5909 /**
5910 * Start advertising as a beacon.
5911 *
5912 * @usage
5913 * ```
5914 * EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
5915 * .then(() => { console.log('Beacon started'); });
5916 * setTimeout(() => {
5917 * EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
5918 * }, 5000);
5919 * ```
5920 * @param uuid {string} UUID string the beacon should advertise (mandatory).
5921 * @param major {number} Major value to advertise (mandatory).
5922 * @param minor {number} Minor value to advertise (mandatory).
5923 * @param regionId {string} Identifier of the region used to advertise (mandatory).
5924 * @return Returns a Promise.
5925 */
5926 EstimoteBeacons.startAdvertisingAsBeacon = function (uuid, major, minor, regionId) { return; };
5927 /**
5928 * Stop advertising as a beacon.
5929 *
5930 * @usage
5931 * ```
5932 * EstimoteBeacons.startAdvertisingAsBeacon('B9407F30-F5F8-466E-AFF9-25556B57FE6D', 1, 1, 'MyRegion')
5933 * .then(() => { console.log('Beacon started'); });
5934 * setTimeout(() => {
5935 * EstimoteBeacons.stopAdvertisingAsBeacon().then((result) => { console.log('Beacon stopped'); });
5936 * }, 5000);
5937 * ```
5938 * @return Returns a Promise.
5939 */
5940 EstimoteBeacons.stopAdvertisingAsBeacon = function () { return; };
5941 /**
5942 * Enable analytics.
5943 *
5944 * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
5945 *
5946 * @usage
5947 * ```
5948 * EstimoteBeacons.enableAnalytics(true).then(() => { console.log('Analytics enabled'); });
5949 * ```
5950 * @param enable {number} Boolean value to turn analytics on or off (mandatory).
5951 * @return Returns a Promise.
5952 */
5953 EstimoteBeacons.enableAnalytics = function (enable) { return; };
5954 /**
5955 * Test if analytics is enabled.
5956 *
5957 * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
5958 *
5959 * @usage
5960 * ```
5961 * EstimoteBeacons.isAnalyticsEnabled().then((enabled) => { console.log('Analytics enabled: ' + enabled); });
5962 * ```
5963 * @return Returns a Promise.
5964 */
5965 EstimoteBeacons.isAnalyticsEnabled = function () { return; };
5966 /**
5967 * Test if App ID and App Token is set.
5968 *
5969 * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
5970 *
5971 * @usage
5972 * ```
5973 * EstimoteBeacons.isAuthorized().then((isAuthorized) => { console.log('App ID and App Token is set: ' + isAuthorized); });
5974 * ```
5975 * @return Returns a Promise.
5976 */
5977 EstimoteBeacons.isAuthorized = function () { return; };
5978 /**
5979 * Set App ID and App Token.
5980 *
5981 * @see {@link http://estimote.github.io/iOS-SDK/Classes/ESTConfig.html|Further details}
5982 *
5983 * @usage
5984 * ```
5985 * EstimoteBeacons.setupAppIDAndAppToken('MyAppID', 'MyAppToken').then(() => { console.log('AppID and AppToken configured!'); });
5986 * ```
5987 * @param appID {string} The App ID (mandatory).
5988 * @param appToken {string} The App Token (mandatory).
5989 * @return Returns a Promise.
5990 */
5991 EstimoteBeacons.setupAppIDAndAppToken = function (appID, appToken) { return; };
5992 /**
5993 * Start scanning for all nearby beacons using CoreBluetooth (no region object is used).
5994 * Available on iOS.
5995 *
5996 * @usage
5997 * ```
5998 * EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
5999 * console.log(JSON.stringify(beacons));
6000 * });
6001 * setTimeout(() => {
6002 * EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
6003 * }, 5000);
6004 * ```
6005 * @return Returns an Observable that notifies of each beacon discovered.
6006 */
6007 EstimoteBeacons.startEstimoteBeaconDiscovery = function () { return; };
6008 /**
6009 * Stop CoreBluetooth scan. Available on iOS.
6010 *
6011 * @usage
6012 * ```
6013 * EstimoteBeacons.startEstimoteBeaconDiscovery().subscribe(beacons => {
6014 * console.log(JSON.stringify(beacons));
6015 * });
6016 * setTimeout(() => {
6017 * EstimoteBeacons.stopEstimoteBeaconDiscovery().then(() => { console.log('scan stopped'); });
6018 * }, 5000);
6019 * ```
6020 * @return returns a Promise.
6021 */
6022 EstimoteBeacons.stopEstimoteBeaconDiscovery = function () { return; };
6023 /**
6024 * Start ranging beacons. Available on iOS and Android.
6025 *
6026 * @usage
6027 * ```
6028 * let region: BeaconRegion = {} // Empty region matches all beacons.
6029 * EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
6030 * console.log(JSON.stringify(info));
6031 * });
6032 * setTimeout(() => {
6033 * EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
6034 * }, 5000);
6035 * ```
6036 * @param region {BeaconRegion} Dictionary with region properties (mandatory).
6037 * @return Returns an Observable that notifies of each beacon discovered.
6038 */
6039 EstimoteBeacons.startRangingBeaconsInRegion = function (region) { return; };
6040 /**
6041 * Stop ranging beacons. Available on iOS and Android.
6042 *
6043 * @usage
6044 * ```
6045 * let region: BeaconRegion = {} // Empty region matches all beacons.
6046 * EstimoteBeacons.startRangingBeaconsInRegion(region).subscribe(info => {
6047 * console.log(JSON.stringify(info));
6048 * });
6049 * setTimeout(() => {
6050 * EstimoteBeacons.stopRangingBeaconsInRegion(region).then(() => { console.log('scan stopped'); });
6051 * }, 5000);
6052 * ```
6053 * @param region {BeaconRegion} Dictionary with region properties (mandatory).
6054 * @return returns a Promise.
6055 */
6056 EstimoteBeacons.stopRangingBeaconsInRegion = function (region) { return; };
6057 /**
6058 * Start ranging secure beacons. Available on iOS.
6059 * This function has the same parameters/behaviour as
6060 * {@link EstimoteBeacons.startRangingBeaconsInRegion}.
6061 * To use secure beacons set the App ID and App Token using
6062 * {@link EstimoteBeacons.setupAppIDAndAppToken}.
6063 */
6064 EstimoteBeacons.startRangingSecureBeaconsInRegion = function (region) { return; };
6065 /**
6066 * Stop ranging secure beacons. Available on iOS.
6067 * This function has the same parameters/behaviour as
6068 * {@link EstimoteBeacons.stopRangingBeaconsInRegion}.
6069 */
6070 EstimoteBeacons.stopRangingSecureBeaconsInRegion = function (region) { return; };
6071 /**
6072 * Start monitoring beacons. Available on iOS and Android.
6073 *
6074 * @usage
6075 * ```
6076 * let region: BeaconRegion = {} // Empty region matches all beacons.
6077 * EstimoteBeacons.startMonitoringForRegion(region).subscribe(state => {
6078 * console.log('Region state: ' + JSON.stringify(state));
6079 * });
6080 * ```
6081 * @param region {BeaconRegion} Dictionary with region properties (mandatory).
6082 * @param [notifyEntryStateOnDisplay=false] {boolean} Set to true to detect if you
6083 * are inside a region when the user turns display on, see
6084 * {@link https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLBeaconRegion_class/index.html#//apple_ref/occ/instp/CLBeaconRegion/notifyEntryStateOnDisplay|iOS documentation}
6085 * for further details (optional, defaults to false, iOS only).
6086 * @return Returns an Observable that notifies of each region state discovered.
6087 */
6088 EstimoteBeacons.startMonitoringForRegion = function (region, notifyEntryStateOnDisplay) { return; };
6089 /**
6090 * Stop monitoring beacons. Available on iOS and Android.
6091 *
6092 * @usage
6093 * ```
6094 * let region: BeaconRegion = {} // Empty region matches all beacons.
6095 * EstimoteBeacons.stopMonitoringForRegion(region).then(() => { console.log('monitoring is stopped'); });
6096 * ```
6097 * @param region {BeaconRegion} Dictionary with region properties (mandatory).
6098 * @return returns a Promise.
6099 */
6100 EstimoteBeacons.stopMonitoringForRegion = function (region) { return; };
6101 /**
6102 * Start monitoring secure beacons. Available on iOS.
6103 * This function has the same parameters/behaviour as
6104 * EstimoteBeacons.startMonitoringForRegion.
6105 * To use secure beacons set the App ID and App Token using
6106 * {@link EstimoteBeacons.setupAppIDAndAppToken}.
6107 * @see {@link EstimoteBeacons.startMonitoringForRegion}
6108 */
6109 EstimoteBeacons.startSecureMonitoringForRegion = function (region, notifyEntryStateOnDisplay) { return; };
6110 /**
6111 * Stop monitoring secure beacons. Available on iOS.
6112 * This function has the same parameters/behaviour as
6113 * {@link EstimoteBeacons.stopMonitoringForRegion}.
6114 */
6115 EstimoteBeacons.stopSecureMonitoringForRegion = function (region) { return; };
6116 /**
6117 * Connect to Estimote Beacon. Available on Android.
6118 *
6119 * @usage
6120 * ```
6121 * EstimoteBeacons.connectToBeacon(FF:0F:F0:00:F0:00);
6122 * ```
6123 * ```
6124 * EstimoteBeacons.connectToBeacon({
6125 * proximityUUID: '000000FF-F00F-0FF0-F000-000FF0F00000',
6126 * major: 1,
6127 * minor: 1
6128 * });
6129 * ```
6130 * @param beacon {Beacon} Beacon to connect to.
6131 * @return returns a Promise.
6132 */
6133 EstimoteBeacons.connectToBeacon = function (beacon) { return; };
6134 /**
6135 * Disconnect from connected Estimote Beacon. Available on Android.
6136 *
6137 * @usage
6138 * ```
6139 * EstimoteBeacons.disconnectConnectedBeacon();
6140 * ```
6141 * @return returns a Promise.
6142 */
6143 EstimoteBeacons.disconnectConnectedBeacon = function () { return; };
6144 /**
6145 * Write proximity UUID to connected Estimote Beacon. Available on Android.
6146 *
6147 * @usage
6148 * ```
6149 * // Example that writes constant ESTIMOTE_PROXIMITY_UUID
6150 * EstimoteBeacons.writeConnectedProximityUUID(ESTIMOTE_PROXIMITY_UUID);
6151 *
6152 * @param uuid {string} String to write as new UUID
6153 * @return returns a Promise.
6154 */
6155 EstimoteBeacons.writeConnectedProximityUUID = function (uuid) { return; };
6156 /**
6157 * Write major to connected Estimote Beacon. Available on Android.
6158 *
6159 * @usage
6160 * ```
6161 * // Example that writes 1
6162 * EstimoteBeacons.writeConnectedMajor(1);
6163 *
6164 * @param major {number} number to write as new major
6165 * @return returns a Promise.
6166 */
6167 EstimoteBeacons.writeConnectedMajor = function (major) { return; };
6168 /**
6169 * Write minor to connected Estimote Beacon. Available on Android.
6170 *
6171 * @usage
6172 * ```
6173 * // Example that writes 1
6174 * EstimoteBeacons.writeConnectedMinor(1);
6175 *
6176 * @param minor {number} number to write as new minor
6177 * @return returns a Promise.
6178 */
6179 EstimoteBeacons.writeConnectedMinor = function (minor) { return; };
6180 /** Proximity value */
6181 EstimoteBeacons.ProximityUnknown = 0;
6182 /** Proximity value */
6183 EstimoteBeacons.ProximityImmediate = 1;
6184 /** Proximity value */
6185 EstimoteBeacons.ProximityNear = 2;
6186 /** Proximity value */
6187 EstimoteBeacons.ProximityFar = 3;
6188 /** Beacon colour */
6189 EstimoteBeacons.BeaconColorUnknown = 0;
6190 /** Beacon colour */
6191 EstimoteBeacons.BeaconColorMintCocktail = 1;
6192 /** Beacon colour */
6193 EstimoteBeacons.BeaconColorIcyMarshmallow = 2;
6194 /** Beacon colour */
6195 EstimoteBeacons.BeaconColorBlueberryPie = 3;
6196 /**
6197 * Beacon colour.
6198 */
6199 EstimoteBeacons.BeaconColorSweetBeetroot = 4;
6200 /** Beacon colour */
6201 EstimoteBeacons.BeaconColorCandyFloss = 5;
6202 /** Beacon colour */
6203 EstimoteBeacons.BeaconColorLemonTart = 6;
6204 /** Beacon colour */
6205 EstimoteBeacons.BeaconColorVanillaJello = 7;
6206 /** Beacon colour */
6207 EstimoteBeacons.BeaconColorLiquoriceSwirl = 8;
6208 /** Beacon colour */
6209 EstimoteBeacons.BeaconColorWhite = 9;
6210 /** Beacon colour */
6211 EstimoteBeacons.BeaconColorTransparent = 10;
6212 /** Region state */
6213 EstimoteBeacons.RegionStateUnknown = 'unknown';
6214 /** Region state */
6215 EstimoteBeacons.RegionStateOutside = 'outside';
6216 /** Region state */
6217 EstimoteBeacons.RegionStateInside = 'inside';
6218 __decorate$34([
6219 Cordova()
6220 ], EstimoteBeacons, "requestWhenInUseAuthorization", null);
6221 __decorate$34([
6222 Cordova()
6223 ], EstimoteBeacons, "requestAlwaysAuthorization", null);
6224 __decorate$34([
6225 Cordova()
6226 ], EstimoteBeacons, "authorizationStatus", null);
6227 __decorate$34([
6228 Cordova({
6229 clearFunction: 'stopAdvertisingAsBeacon'
6230 })
6231 ], EstimoteBeacons, "startAdvertisingAsBeacon", null);
6232 __decorate$34([
6233 Cordova()
6234 ], EstimoteBeacons, "stopAdvertisingAsBeacon", null);
6235 __decorate$34([
6236 Cordova()
6237 ], EstimoteBeacons, "enableAnalytics", null);
6238 __decorate$34([
6239 Cordova()
6240 ], EstimoteBeacons, "isAnalyticsEnabled", null);
6241 __decorate$34([
6242 Cordova()
6243 ], EstimoteBeacons, "isAuthorized", null);
6244 __decorate$34([
6245 Cordova()
6246 ], EstimoteBeacons, "setupAppIDAndAppToken", null);
6247 __decorate$34([
6248 Cordova({
6249 observable: true,
6250 clearFunction: 'stopEstimoteBeaconDiscovery'
6251 })
6252 ], EstimoteBeacons, "startEstimoteBeaconDiscovery", null);
6253 __decorate$34([
6254 Cordova()
6255 ], EstimoteBeacons, "stopEstimoteBeaconDiscovery", null);
6256 __decorate$34([
6257 Cordova({
6258 observable: true,
6259 clearFunction: 'stopRangingBeaconsInRegion',
6260 clearWithArgs: true
6261 })
6262 ], EstimoteBeacons, "startRangingBeaconsInRegion", null);
6263 __decorate$34([
6264 Cordova()
6265 ], EstimoteBeacons, "stopRangingBeaconsInRegion", null);
6266 __decorate$34([
6267 Cordova({
6268 observable: true,
6269 clearFunction: 'stopRangingSecureBeaconsInRegion',
6270 clearWithArgs: true
6271 })
6272 ], EstimoteBeacons, "startRangingSecureBeaconsInRegion", null);
6273 __decorate$34([
6274 Cordova()
6275 ], EstimoteBeacons, "stopRangingSecureBeaconsInRegion", null);
6276 __decorate$34([
6277 Cordova({
6278 observable: true,
6279 clearFunction: 'stopMonitoringForRegion',
6280 clearWithArgs: true,
6281 successIndex: 1,
6282 errorIndex: 2
6283 })
6284 ], EstimoteBeacons, "startMonitoringForRegion", null);
6285 __decorate$34([
6286 Cordova()
6287 ], EstimoteBeacons, "stopMonitoringForRegion", null);
6288 __decorate$34([
6289 Cordova({
6290 observable: true,
6291 clearFunction: 'stopSecureMonitoringForRegion',
6292 clearWithArgs: true,
6293 successIndex: 1,
6294 errorIndex: 2
6295 })
6296 ], EstimoteBeacons, "startSecureMonitoringForRegion", null);
6297 __decorate$34([
6298 Cordova()
6299 ], EstimoteBeacons, "stopSecureMonitoringForRegion", null);
6300 __decorate$34([
6301 Cordova()
6302 ], EstimoteBeacons, "connectToBeacon", null);
6303 __decorate$34([
6304 Cordova()
6305 ], EstimoteBeacons, "disconnectConnectedBeacon", null);
6306 __decorate$34([
6307 Cordova()
6308 ], EstimoteBeacons, "writeConnectedProximityUUID", null);
6309 __decorate$34([
6310 Cordova()
6311 ], EstimoteBeacons, "writeConnectedMajor", null);
6312 __decorate$34([
6313 Cordova()
6314 ], EstimoteBeacons, "writeConnectedMinor", null);
6315 EstimoteBeacons = __decorate$34([
6316 Plugin({
6317 plugin: 'cordova-plugin-estimote',
6318 pluginRef: 'estimote.beacons',
6319 repo: 'https://github.com/evothings/phonegap-estimotebeacons',
6320 platforms: ['iOS', 'Android']
6321 })
6322 ], EstimoteBeacons);
6323 return EstimoteBeacons;
6324}());
6325
6326var __decorate$35 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6327 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6328 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6329 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;
6330 return c > 3 && r && Object.defineProperty(target, key, r), r;
6331};
6332/**
6333 * @name Facebook
6334 * @description
6335 * Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android.
6336 *
6337 * Requires Cordova plugin: `cordova-plugin-facebook4`. For more info, please see the [Facebook Connect](https://github.com/jeduan/cordova-plugin-facebook4).
6338 *
6339 * #### Installation
6340 *
6341 * To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal at [https://developers.facebook.com/apps](https://developers.facebook.com/apps).
6342 *
6343 * [![fb-getstarted-1](/img/docs/native/Facebook/1.png)](https://developers.facebook.com/apps/)
6344 *
6345 * Retrieve the `App ID` and `App Name`.
6346 *
6347 * [![fb-getstarted-2](/img/docs/native/Facebook/2.png)](https://developers.facebook.com/apps/)
6348 *
6349 * Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
6350 *
6351 * ```bash
6352 * ionic plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
6353 * ```
6354 *
6355 * After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:
6356 *
6357 * [![fb-getstarted-3](/img/docs/native/Facebook/3.png)](https://developers.facebook.com/apps/)
6358 *
6359 * Click `'Add Platform'`.
6360 *
6361 * [![fb-getstarted-4](/img/docs/native/Facebook/4.png)](https://developers.facebook.com/apps/)
6362 *
6363 * At this point you'll need to open your project's [`config.xml`](https://cordova.apache.org/docs/en/latest/config_ref/index.html) file, found in the root directory of your project.
6364 *
6365 * Take note of the `id` for the next step:
6366 * ```
6367 * <widget id="com.mycompany.testapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
6368 * ```
6369 *
6370 * You can also edit the `id` to whatever you'd like it to be.
6371 *
6372 * #### iOS Install
6373 * Under 'Bundle ID', add the `id` from your `config.xml` file:
6374 *
6375 * [![fb-getstarted-5](/img/docs/native/Facebook/5.png)](https://developers.facebook.com/apps/)
6376 *
6377 *
6378 * #### Android Install
6379 * Under 'Google Play Package Name', add the `id` from your `config.xml` file:
6380 *
6381 * [![fb-getstarted-6](/img/docs/native/Facebook/6.png)](https://developers.facebook.com/apps/)
6382 *
6383 *
6384 * And that's it! You can now make calls to Facebook using the plugin.
6385 *
6386 * ## Events
6387 *
6388 * App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads.
6389 *
6390 * - [iOS] [https://developers.facebook.com/docs/ios/app-events](https://developers.facebook.com/docs/ios/app-events)
6391 * - [Android] [https://developers.facebook.com/docs/android/app-events](https://developers.facebook.com/docs/android/app-events)
6392 * - [JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success
6393 *
6394 * Activation events are automatically tracked for you in the plugin.
6395 *
6396 * Events are listed on the [insights page](https://www.facebook.com/insights/).
6397 *
6398 * For tracking events, see `logEvent` and `logPurchase`.
6399 *
6400 * @usage
6401 * ```typescript
6402 * import { Facebook } from 'ionic-native';
6403 *
6404 *
6405 *
6406 * ```
6407 *
6408 */
6409var Facebook = (function () {
6410 function Facebook() {
6411 }
6412 /**
6413 * Browser wrapper
6414 * @param {number} appId Your Facebook AppID from their dashboard
6415 * @param {string} version The version of API you may want to use. Optional
6416 */
6417 Facebook.browserInit = function (appId, version) {
6418 return;
6419 };
6420 /**
6421 * Login to Facebook to authenticate this app.
6422 *
6423 * ```typescript
6424 * {
6425 * status: "connected",
6426 * authResponse: {
6427 * session_key: true,
6428 * accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
6429 * expiresIn: 5183979,
6430 * sig: "...",
6431 * secret: "...",
6432 * userID: "634565435"
6433 * }
6434 * }
6435 * ```
6436 *
6437 * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
6438 * @return {Promise<FacebookLoginResponse>} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
6439 */
6440 Facebook.login = function (permissions) { return; };
6441 /**
6442 * Logout of Facebook.
6443 *
6444 * For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout)
6445 * @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
6446 */
6447 Facebook.logout = function () { return; };
6448 /**
6449 * Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
6450 *
6451 * 1) the user is logged into Facebook and has authenticated your application (connected)
6452 * 2) the user is logged into Facebook but has not authenticated your application (not_authorized)
6453 * 3) the user is either not logged into Facebook or explicitly logged out of your application so it doesn't attempt to connect to Facebook and thus, we don't know if they've authenticated your application or not (unknown)
6454 *
6455 * Resolves with a response like:
6456 *
6457 * ```
6458 * {
6459 * authResponse: {
6460 * userID: "12345678912345",
6461 * accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
6462 * session_Key: true,
6463 * expiresIn: "5183738",
6464 * sig: "..."
6465 * },
6466 * status: "connected"
6467 * }
6468 * ```
6469 *
6470 * For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus)
6471 *
6472 * @return Returns a Promise that resolves with a status, or rejects with an error
6473 */
6474 Facebook.getLoginStatus = function () { return; };
6475 /**
6476 * Get a Facebook access token for using Facebook services.
6477 *
6478 * @return Returns a Promise that resolves with an access token, or rejects with an error
6479 */
6480 Facebook.getAccessToken = function () { return; };
6481 /**
6482 * Show one of various Facebook dialogs. Example of options for a Share dialog:
6483 *
6484 * ```
6485 * {
6486 * method: "share",
6487 * href: "http://example.com",
6488 * caption: "Such caption, very feed.",
6489 * description: "Much description",
6490 * picture: 'http://example.com/image.png'
6491 * }
6492 * ```
6493 *
6494 * For more options see the [Cordova plugin docs](https://github.com/jeduan/cordova-plugin-facebook4#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui)
6495 * @options {Object} options The dialog options
6496 * @return Returns a Promise that resolves with success data, or rejects with an error
6497 */
6498 Facebook.showDialog = function (options) { return; };
6499 /**
6500 * Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
6501 *
6502 * For more information see:
6503 *
6504 * Calling the Graph API - https://developers.facebook.com/docs/javascript/reference/FB.api
6505 * Graph Explorer - https://developers.facebook.com/tools/explorer
6506 * Graph API - https://developers.facebook.com/docs/graph-api
6507 *
6508 * @param {string} requestPath Graph API endpoint you want to call
6509 * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request.
6510 * @return Returns a Promise that resolves with the result of the request, or rejects with an error
6511 */
6512 Facebook.api = function (requestPath, permissions) { return; };
6513 /**
6514 * Log an event. For more information see the Events section above.
6515 *
6516 * @param {string} name Name of the event
6517 * @param {Object} [params] An object containing extra data to log with the event
6518 * @param {number} [valueToSum] any value to be added to added to a sum on each event
6519 * @return
6520 */
6521 Facebook.logEvent = function (name, params, valueToSum) { return; };
6522 /**
6523 * Log a purchase. For more information see the Events section above.
6524 *
6525 * @param {number} value Value of the purchase.
6526 * @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217)
6527 * @return Returns a Promise
6528 */
6529 Facebook.logPurchase = function (value, currency) { return; };
6530 /**
6531 * Open App Invite dialog. Does not require login.
6532 *
6533 * For more information see:
6534 *
6535 * the App Invites Overview - https://developers.facebook.com/docs/app-invites/overview
6536 * the App Links docs - https://developers.facebook.com/docs/applinks
6537 *
6538 *
6539 * @param {Object} options An object containing an [App Link](https://developers.facebook.com/docs/applinks) URL to your app and an optional image URL.
6540 * url: [App Link](https://developers.facebook.com/docs/applinks) to your app
6541 * picture: image to be displayed in the App Invite dialog
6542 *
6543 * @return Returns a Promise that resolves with the result data, or rejects with an error
6544 */
6545 Facebook.appInvite = function (options) { return; };
6546 __decorate$35([
6547 Cordova()
6548 ], Facebook, "browserInit", null);
6549 __decorate$35([
6550 Cordova()
6551 ], Facebook, "login", null);
6552 __decorate$35([
6553 Cordova()
6554 ], Facebook, "logout", null);
6555 __decorate$35([
6556 Cordova()
6557 ], Facebook, "getLoginStatus", null);
6558 __decorate$35([
6559 Cordova()
6560 ], Facebook, "getAccessToken", null);
6561 __decorate$35([
6562 Cordova()
6563 ], Facebook, "showDialog", null);
6564 __decorate$35([
6565 Cordova()
6566 ], Facebook, "api", null);
6567 __decorate$35([
6568 Cordova()
6569 ], Facebook, "logEvent", null);
6570 __decorate$35([
6571 Cordova()
6572 ], Facebook, "logPurchase", null);
6573 __decorate$35([
6574 Cordova()
6575 ], Facebook, "appInvite", null);
6576 Facebook = __decorate$35([
6577 Plugin({
6578 plugin: 'cordova-plugin-facebook4',
6579 pluginRef: 'facebookConnectPlugin',
6580 repo: 'https://github.com/jeduan/cordova-plugin-facebook4',
6581 install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"'
6582 })
6583 ], Facebook);
6584 return Facebook;
6585}());
6586
6587var __decorate$36 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6588 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6589 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6590 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;
6591 return c > 3 && r && Object.defineProperty(target, key, r), r;
6592};
6593/**
6594 * @name File
6595 * @description
6596 * This plugin implements a File API allowing read/write access to files residing on the device.
6597 *
6598 * The File class implements static convenience functions to access files and directories.
6599 *
6600 * Example:
6601 * ```
6602 * import { File } from 'ionic-native';
6603 *
6604 * declare var cordova: any;
6605 * const fs:string = cordova.file.dataDirectory;
6606 * File.checkDir(this.fs, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
6607 * ```
6608 *
6609 * This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/
6610 * The (now-defunct) Directories and System extensions Latest: http://www.w3.org/TR/2012/WD-file-system-api-20120417/
6611 * Although most of the plugin code was written when an earlier spec was current: http://www.w3.org/TR/2011/WD-file-system-api-20110419/
6612 * It also implements the FileWriter spec : http://dev.w3.org/2009/dap/file-system/file-writer.html
6613 */
6614var File = (function () {
6615 function File() {
6616 }
6617 File.getFreeDiskSpace = function () {
6618 return;
6619 };
6620 /**
6621 * Check if a directory exists in a certain path, directory.
6622 *
6623 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6624 * @param {string} dir Name of directory to check
6625 * @return {Promise<boolean|FileError>} Returns a Promise that resolves to true if the directory exists or rejects with an error.
6626 */
6627 File.checkDir = function (path, dir) {
6628 if ((/^\//.test(dir))) {
6629 var err = new FileError(5);
6630 err.message = 'directory cannot start with \/';
6631 return Promise.reject(err);
6632 }
6633 var fullpath = path + dir;
6634 return File.resolveDirectoryUrl(fullpath)
6635 .then(function () {
6636 return true;
6637 });
6638 };
6639 /**
6640 * Creates a new directory in the specific path.
6641 * The replace boolean value determines whether to replace an existing directory with the same name.
6642 * If an existing directory exists and the replace value is false, the promise will fail and return an error.
6643 *
6644 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6645 * @param {string} dirName Name of directory to create
6646 * @param {boolean} replace If true, replaces file with same name. If false returns error
6647 * @return {Promise<DirectoryEntry|FileError>} Returns a Promise that resolves with a DirectoryEntry or rejects with an error.
6648 */
6649 File.createDir = function (path, dirName, replace) {
6650 if ((/^\//.test(dirName))) {
6651 var err = new FileError(5);
6652 err.message = 'directory cannot start with \/';
6653 return Promise.reject(err);
6654 }
6655 var options = {
6656 create: true
6657 };
6658 if (!replace) {
6659 options.exclusive = true;
6660 }
6661 return File.resolveDirectoryUrl(path)
6662 .then(function (fse) {
6663 return File.getDirectory(fse, dirName, options);
6664 });
6665 };
6666 /**
6667 * Remove a directory at a given path.
6668 *
6669 * @param {string} path The path to the directory
6670 * @param {string} dirName The directory name
6671 * @return {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
6672 */
6673 File.removeDir = function (path, dirName) {
6674 if ((/^\//.test(dirName))) {
6675 var err = new FileError(5);
6676 err.message = 'directory cannot start with \/';
6677 return Promise.reject(err);
6678 }
6679 return File.resolveDirectoryUrl(path)
6680 .then(function (fse) {
6681 return File.getDirectory(fse, dirName, { create: false });
6682 })
6683 .then(function (de) {
6684 return File.remove(de);
6685 });
6686 };
6687 /**
6688 * Move a directory to a given path.
6689 *
6690 * @param {string} path The source path to the directory
6691 * @param {string} dirName The source directory name
6692 * @param {string} newPath The destionation path to the directory
6693 * @param {string} newDirName The destination directory name
6694 * @return {Promise<DirectoryEntry|Entry|FileError>} Returns a Promise that resolves to the new DirectoryEntry object or rejects with an error.
6695 */
6696 File.moveDir = function (path, dirName, newPath, newDirName) {
6697 var _this = this;
6698 newDirName = newDirName || dirName;
6699 if ((/^\//.test(newDirName))) {
6700 var err = new FileError(5);
6701 err.message = 'directory cannot start with \/';
6702 return Promise.reject(err);
6703 }
6704 return this.resolveDirectoryUrl(path)
6705 .then(function (fse) {
6706 return _this.getDirectory(fse, dirName, { create: false });
6707 })
6708 .then(function (srcde) {
6709 return _this.resolveDirectoryUrl(newPath)
6710 .then(function (deste) {
6711 return File.move(srcde, deste, newDirName);
6712 });
6713 });
6714 };
6715 /**
6716 * Copy a directory in various methods. If destination directory exists, will fail to copy.
6717 *
6718 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6719 * @param {string} dirName Name of directory to copy
6720 * @param {string} newPath Base FileSystem of new location
6721 * @param {string} newDirName New name of directory to copy to (leave blank to remain the same)
6722 * @return {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry object or rejects with an error.
6723 */
6724 File.copyDir = function (path, dirName, newPath, newDirName) {
6725 var _this = this;
6726 if ((/^\//.test(newDirName))) {
6727 var err = new FileError(5);
6728 err.message = 'directory cannot start with \/';
6729 return Promise.reject(err);
6730 }
6731 return this.resolveDirectoryUrl(path)
6732 .then(function (fse) {
6733 return _this.getDirectory(fse, dirName, { create: false });
6734 })
6735 .then(function (srcde) {
6736 return _this.resolveDirectoryUrl(newPath)
6737 .then(function (deste) {
6738 return File.copy(srcde, deste, newDirName);
6739 });
6740 });
6741 };
6742 /**
6743 * List files and directory from a given path.
6744 *
6745 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6746 * @param {string} dirName Name of directory
6747 * @return {Promise<Entry[]>} Returns a Promise that resolves to an array of Entry objects or rejects with an error.
6748 */
6749 File.listDir = function (path, dirName) {
6750 if ((/^\//.test(dirName))) {
6751 var err = new FileError(5);
6752 err.message = 'directory cannot start with \/';
6753 return Promise.reject(err);
6754 }
6755 return File.resolveDirectoryUrl(path)
6756 .then(function (fse) {
6757 return File.getDirectory(fse, dirName, { create: false, exclusive: false });
6758 })
6759 .then(function (de) {
6760 var reader = de.createReader();
6761 return File.readEntries(reader);
6762 });
6763 };
6764 /**
6765 * Removes all files and the directory from a desired location.
6766 *
6767 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6768 * @param {string} dirName Name of directory
6769 * @return {Promise<RemoveResult>} Returns a Promise that resolves with a RemoveResult or rejects with an error.
6770 */
6771 File.removeRecursively = function (path, dirName) {
6772 if ((/^\//.test(dirName))) {
6773 var err = new FileError(5);
6774 err.message = 'directory cannot start with \/';
6775 return Promise.reject(err);
6776 }
6777 return File.resolveDirectoryUrl(path)
6778 .then(function (fse) {
6779 return File.getDirectory(fse, dirName, { create: false });
6780 })
6781 .then(function (de) {
6782 return File.rimraf(de);
6783 });
6784 };
6785 /**
6786 * Check if a file exists in a certain path, directory.
6787 *
6788 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6789 * @param {string} file Name of file to check
6790 * @return {Promise<boolean|FileError>} Returns a Promise that resolves with a boolean or rejects with an error.
6791 */
6792 File.checkFile = function (path, file) {
6793 if ((/^\//.test(file))) {
6794 var err = new FileError(5);
6795 err.message = 'file cannot start with \/';
6796 return Promise.reject(err);
6797 }
6798 return File.resolveLocalFilesystemUrl(path + file)
6799 .then(function (fse) {
6800 if (fse.isFile) {
6801 return true;
6802 }
6803 else {
6804 var err = new FileError(13);
6805 err.message = 'input is not a file';
6806 return Promise.reject(err);
6807 }
6808 });
6809 };
6810 /**
6811 * Creates a new file in the specific path.
6812 * The replace boolean value determines whether to replace an existing file with the same name.
6813 * If an existing file exists and the replace value is false, the promise will fail and return an error.
6814 *
6815 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6816 * @param {string} fileName Name of file to create
6817 * @param {boolean} replace If true, replaces file with same name. If false returns error
6818 * @return {Promise<FileEntry|FileError>} Returns a Promise that resolves to a FileEntry or rejects with an error.
6819 */
6820 File.createFile = function (path, fileName, replace) {
6821 if ((/^\//.test(fileName))) {
6822 var err = new FileError(5);
6823 err.message = 'file-name cannot start with \/';
6824 return Promise.reject(err);
6825 }
6826 var options = {
6827 create: true
6828 };
6829 if (!replace) {
6830 options.exclusive = true;
6831 }
6832 return File.resolveDirectoryUrl(path)
6833 .then(function (fse) {
6834 return File.getFile(fse, fileName, options);
6835 });
6836 };
6837 /**
6838 * Removes a file from a desired location.
6839 *
6840 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6841 * @param {string} fileName Name of file to remove
6842 * @return {Promise<RemoveResult|FileError>} Returns a Promise that resolves to a RemoveResult or rejects with an error.
6843 */
6844 File.removeFile = function (path, fileName) {
6845 if ((/^\//.test(fileName))) {
6846 var err = new FileError(5);
6847 err.message = 'file-name cannot start with \/';
6848 return Promise.reject(err);
6849 }
6850 return File.resolveDirectoryUrl(path)
6851 .then(function (fse) {
6852 return File.getFile(fse, fileName, { create: false });
6853 })
6854 .then(function (fe) {
6855 return File.remove(fe);
6856 });
6857 };
6858 /** Write a new file to the desired location.
6859 *
6860 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6861 * @param {string} fileName path relative to base path
6862 * @param {string | Blob} text content or blob to write
6863 * @param {boolean | WriteOptions} replaceOrOptions replace file if set to true. See WriteOptions for more information.
6864 * @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
6865 */
6866 File.writeFile = function (path, fileName, text, replaceOrOptions) {
6867 if ((/^\//.test(fileName))) {
6868 var err = new FileError(5);
6869 err.message = 'file-name cannot start with \/';
6870 return Promise.reject(err);
6871 }
6872 var opts = {};
6873 if (replaceOrOptions) {
6874 if (typeof (replaceOrOptions) === 'boolean') {
6875 opts.replace = replaceOrOptions;
6876 }
6877 }
6878 return File.resolveDirectoryUrl(path)
6879 .then(function (fse) {
6880 return File.getFile(fse, fileName, opts);
6881 })
6882 .then(function (fe) {
6883 return File.createWriter(fe);
6884 })
6885 .then(function (writer) {
6886 if (opts.append) {
6887 writer.seek(writer.length);
6888 }
6889 if (opts.hasOwnProperty('truncate')) {
6890 writer.truncate(opts.truncate);
6891 }
6892 return File.write(writer, text);
6893 });
6894 };
6895 /** Write to an existing file.
6896 *
6897 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6898 * @param {string} fileName path relative to base path
6899 * @param {string | Blob} text content or blob to write
6900 * @returns {Promise<void>} Returns a Promise that resolves or rejects with an error.
6901 */
6902 File.writeExistingFile = function (path, fileName, text) {
6903 if ((/^\//.test(fileName))) {
6904 var err = new FileError(5);
6905 err.message = 'file-name cannot start with \/';
6906 return Promise.reject(err);
6907 }
6908 return File.resolveDirectoryUrl(path)
6909 .then(function (fse) {
6910 return File.getFile(fse, fileName, { create: false });
6911 })
6912 .then(function (fe) {
6913 return File.createWriter(fe);
6914 })
6915 .then(function (writer) {
6916 return File.write(writer, text);
6917 });
6918 };
6919 /**
6920 * Read the contents of a file as text.
6921 *
6922 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6923 * @param {string} file Name of file, relative to path.
6924 * @return {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string or rejects with an error.
6925 */
6926 File.readAsText = function (path, file) {
6927 if ((/^\//.test(file))) {
6928 var err = new FileError(5);
6929 err.message = 'file-name cannot start with \/';
6930 return Promise.reject(err);
6931 }
6932 return File.resolveDirectoryUrl(path)
6933 .then(function (fse) {
6934 return File.getFile(fse, file, { create: false });
6935 })
6936 .then(function (fe) {
6937 var reader = new FileReader();
6938 return new Promise(function (resolve, reject) {
6939 reader.onloadend = function () {
6940 if (reader.result !== undefined || reader.result !== null) {
6941 resolve(reader.result);
6942 }
6943 else if (reader.error !== undefined || reader.error !== null) {
6944 reject(reader.error);
6945 }
6946 else {
6947 reject({ code: null, message: 'READER_ONLOADEND_ERR' });
6948 }
6949 };
6950 fe.file(function (file) {
6951 reader.readAsText(file);
6952 }, function (error) {
6953 reject(error);
6954 });
6955 });
6956 });
6957 };
6958 /**
6959 * Read file and return data as a base64 encoded data url.
6960 * A data url is of the form:
6961 * data:[<mediatype>][;base64],<data>
6962
6963 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
6964 * @param {string} file Name of file, relative to path.
6965 * @return {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as data URL or rejects with an error.
6966 */
6967 File.readAsDataURL = function (path, file) {
6968 if ((/^\//.test(file))) {
6969 var err = new FileError(5);
6970 err.message = 'file-name cannot start with \/';
6971 return Promise.reject(err);
6972 }
6973 return File.resolveDirectoryUrl(path)
6974 .then(function (fse) {
6975 return File.getFile(fse, file, { create: false });
6976 })
6977 .then(function (fe) {
6978 var reader = new FileReader();
6979 return new Promise(function (resolve, reject) {
6980 reader.onloadend = function () {
6981 if (reader.result !== undefined || reader.result !== null) {
6982 resolve(reader.result);
6983 }
6984 else if (reader.error !== undefined || reader.error !== null) {
6985 reject(reader.error);
6986 }
6987 else {
6988 reject({ code: null, message: 'READER_ONLOADEND_ERR' });
6989 }
6990 };
6991 fe.file(function (file) {
6992 reader.readAsDataURL(file);
6993 }, function (error) {
6994 reject(error);
6995 });
6996 });
6997 });
6998 };
6999 /**
7000 * Read file and return data as a binary data.
7001
7002 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
7003 * @param {string} file Name of file, relative to path.
7004 * @return {Promise<string|FileError>} Returns a Promise that resolves with the contents of the file as string rejects with an error.
7005 */
7006 File.readAsBinaryString = function (path, file) {
7007 if ((/^\//.test(file))) {
7008 var err = new FileError(5);
7009 err.message = 'file-name cannot start with \/';
7010 return Promise.reject(err);
7011 }
7012 return File.resolveDirectoryUrl(path)
7013 .then(function (fse) {
7014 return File.getFile(fse, file, { create: false });
7015 })
7016 .then(function (fe) {
7017 var reader = new FileReader();
7018 return new Promise(function (resolve, reject) {
7019 reader.onloadend = function () {
7020 if (reader.result !== undefined || reader.result !== null) {
7021 resolve(reader.result);
7022 }
7023 else if (reader.error !== undefined || reader.error !== null) {
7024 reject(reader.error);
7025 }
7026 else {
7027 reject({ code: null, message: 'READER_ONLOADEND_ERR' });
7028 }
7029 };
7030 fe.file(function (file) {
7031 reader.readAsBinaryString(file);
7032 }, function (error) {
7033 reject(error);
7034 });
7035 });
7036 });
7037 };
7038 /**
7039 * Read file and return data as an ArrayBuffer.
7040
7041 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
7042 * @param {string} file Name of file, relative to path.
7043 * @return {Promise<ArrayBuffer|FileError>} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects with an error.
7044 */
7045 File.readAsArrayBuffer = function (path, file) {
7046 if ((/^\//.test(file))) {
7047 var err = new FileError(5);
7048 err.message = 'file-name cannot start with \/';
7049 return Promise.reject(err);
7050 }
7051 return File.resolveDirectoryUrl(path)
7052 .then(function (fse) {
7053 return File.getFile(fse, file, { create: false });
7054 })
7055 .then(function (fe) {
7056 var reader = new FileReader();
7057 return new Promise(function (resolve, reject) {
7058 reader.onloadend = function () {
7059 if (reader.result !== undefined || reader.result !== null) {
7060 resolve(reader.result);
7061 }
7062 else if (reader.error !== undefined || reader.error !== null) {
7063 reject(reader.error);
7064 }
7065 else {
7066 reject({ code: null, message: 'READER_ONLOADEND_ERR' });
7067 }
7068 };
7069 fe.file(function (file) {
7070 reader.readAsArrayBuffer(file);
7071 }, function (error) {
7072 reject(error);
7073 });
7074 });
7075 });
7076 };
7077 /**
7078 * Move a file to a given path.
7079 *
7080 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
7081 * @param {string} fileName Name of file to move
7082 * @param {string} newPath Base FileSystem of new location
7083 * @param {string} newFileName New name of file to move to (leave blank to remain the same)
7084 * @return {Promise<Entry|FileError>} Returns a Promise that resolves to the new Entry or rejects with an error.
7085 */
7086 File.moveFile = function (path, fileName, newPath, newFileName) {
7087 var _this = this;
7088 newFileName = newFileName || fileName;
7089 if ((/^\//.test(newFileName))) {
7090 var err = new FileError(5);
7091 err.message = 'file name cannot start with \/';
7092 return Promise.reject(err);
7093 }
7094 return this.resolveDirectoryUrl(path)
7095 .then(function (fse) {
7096 return _this.getFile(fse, fileName, { create: false });
7097 })
7098 .then(function (srcfe) {
7099 return _this.resolveDirectoryUrl(newPath)
7100 .then(function (deste) {
7101 return File.move(srcfe, deste, newFileName);
7102 });
7103 });
7104 };
7105 /**
7106 * Copy a file in various methods. If file exists, will fail to copy.
7107 *
7108 * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
7109 * @param {string} fileName Name of file to copy
7110 * @param {string} newPath Base FileSystem of new location
7111 * @param {string} newFileName New name of file to copy to (leave blank to remain the same)
7112 * @return {Promise<Entry|FileError>} Returns a Promise that resolves to an Entry or rejects with an error.
7113 */
7114 File.copyFile = function (path, fileName, newPath, newFileName) {
7115 var _this = this;
7116 newFileName = newFileName || fileName;
7117 if ((/^\//.test(newFileName))) {
7118 var err = new FileError(5);
7119 err.message = 'file name cannot start with \/';
7120 return Promise.reject(err);
7121 }
7122 return this.resolveDirectoryUrl(path)
7123 .then(function (fse) {
7124 return _this.getFile(fse, fileName, { create: false });
7125 })
7126 .then(function (srcfe) {
7127 return _this.resolveDirectoryUrl(newPath)
7128 .then(function (deste) {
7129 return File.copy(srcfe, deste, newFileName);
7130 });
7131 });
7132 };
7133 // these private methods help avoid cascading error handling
7134 // in the public ones, primarily simply wrapping callback
7135 // operations to return Promises that can then be chained.
7136 /**
7137 * @private
7138 */
7139 File.fillErrorMessage = function (err) {
7140 err.message = File.cordovaFileError[err.code];
7141 };
7142 /**
7143 * @private
7144 */
7145 File.resolveLocalFilesystemUrl = function (furl) {
7146 return new Promise(function (resolve, reject) {
7147 try {
7148 window.resolveLocalFileSystemURL(furl, function (entry) {
7149 resolve(entry);
7150 }, function (err) {
7151 File.fillErrorMessage(err);
7152 reject(err);
7153 });
7154 }
7155 catch (xc) {
7156 File.fillErrorMessage(xc);
7157 reject(xc);
7158 }
7159 });
7160 };
7161 /**
7162 * @private
7163 */
7164 File.resolveDirectoryUrl = function (durl) {
7165 return File.resolveLocalFilesystemUrl(durl)
7166 .then(function (de) {
7167 if (de.isDirectory) {
7168 return de;
7169 }
7170 else {
7171 var err = new FileError(13);
7172 err.message = 'input is not a directory';
7173 return Promise.reject(err);
7174 }
7175 });
7176 };
7177 /**
7178 * @private
7179 */
7180 File.getDirectory = function (fse, dn, flags) {
7181 return new Promise(function (resolve, reject) {
7182 try {
7183 fse.getDirectory(dn, flags, function (de) {
7184 resolve(de);
7185 }, function (err) {
7186 File.fillErrorMessage(err);
7187 reject(err);
7188 });
7189 }
7190 catch (xc) {
7191 File.fillErrorMessage(xc);
7192 reject(xc);
7193 }
7194 });
7195 };
7196 /**
7197 * @private
7198 */
7199 File.getFile = function (fse, fn, flags) {
7200 return new Promise(function (resolve, reject) {
7201 try {
7202 fse.getFile(fn, flags, function (fe) {
7203 resolve(fe);
7204 }, function (err) {
7205 File.fillErrorMessage(err);
7206 reject(err);
7207 });
7208 }
7209 catch (xc) {
7210 File.fillErrorMessage(xc);
7211 reject(xc);
7212 }
7213 });
7214 };
7215 /**
7216 * @private
7217 */
7218 File.remove = function (fe) {
7219 return new Promise(function (resolve, reject) {
7220 fe.remove(function () {
7221 resolve({ success: true, fileRemoved: fe });
7222 }, function (err) {
7223 File.fillErrorMessage(err);
7224 reject(err);
7225 });
7226 });
7227 };
7228 /**
7229 * @private
7230 */
7231 File.move = function (srce, destdir, newName) {
7232 return new Promise(function (resolve, reject) {
7233 srce.moveTo(destdir, newName, function (deste) {
7234 resolve(deste);
7235 }, function (err) {
7236 File.fillErrorMessage(err);
7237 reject(err);
7238 });
7239 });
7240 };
7241 /**
7242 * @private
7243 */
7244 File.copy = function (srce, destdir, newName) {
7245 return new Promise(function (resolve, reject) {
7246 srce.copyTo(destdir, newName, function (deste) {
7247 resolve(deste);
7248 }, function (err) {
7249 File.fillErrorMessage(err);
7250 reject(err);
7251 });
7252 });
7253 };
7254 /**
7255 * @private
7256 */
7257 File.readEntries = function (dr) {
7258 return new Promise(function (resolve, reject) {
7259 dr.readEntries(function (entries) {
7260 resolve(entries);
7261 }, function (err) {
7262 File.fillErrorMessage(err);
7263 reject(err);
7264 });
7265 });
7266 };
7267 /**
7268 * @private
7269 */
7270 File.rimraf = function (de) {
7271 return new Promise(function (resolve, reject) {
7272 de.removeRecursively(function () {
7273 resolve({ success: true, fileRemoved: de });
7274 }, function (err) {
7275 File.fillErrorMessage(err);
7276 reject(err);
7277 });
7278 });
7279 };
7280 /**
7281 * @private
7282 */
7283 File.createWriter = function (fe) {
7284 return new Promise(function (resolve, reject) {
7285 fe.createWriter(function (writer) {
7286 resolve(writer);
7287 }, function (err) {
7288 File.fillErrorMessage(err);
7289 reject(err);
7290 });
7291 });
7292 };
7293 /**
7294 * @private
7295 */
7296 File.write = function (writer, gu) {
7297 if (gu instanceof Blob) {
7298 return this.writeFileInChunks(writer, gu);
7299 }
7300 return new Promise(function (resolve, reject) {
7301 writer.onwriteend = function (evt) {
7302 if (writer.error) {
7303 reject(writer.error);
7304 }
7305 else {
7306 resolve();
7307 }
7308 };
7309 writer.write(gu);
7310 });
7311 };
7312 /**
7313 * @private
7314 */
7315 File.writeFileInChunks = function (writer, file) {
7316 var BLOCK_SIZE = 1024 * 1024;
7317 var writtenSize = 0;
7318 function writeNextChunk() {
7319 var size = Math.min(BLOCK_SIZE, file.size - writtenSize);
7320 var chunk = file.slice(writtenSize, writtenSize + size);
7321 writtenSize += size;
7322 writer.write(chunk);
7323 }
7324 return new Promise(function (resolve, reject) {
7325 writer.onerror = reject;
7326 writer.onwrite = function () {
7327 if (writtenSize < file.size) {
7328 writeNextChunk();
7329 }
7330 else {
7331 resolve();
7332 }
7333 };
7334 writeNextChunk();
7335 });
7336 };
7337 File.cordovaFileError = {
7338 1: 'NOT_FOUND_ERR',
7339 2: 'SECURITY_ERR',
7340 3: 'ABORT_ERR',
7341 4: 'NOT_READABLE_ERR',
7342 5: 'ENCODING_ERR',
7343 6: 'NO_MODIFICATION_ALLOWED_ERR',
7344 7: 'INVALID_STATE_ERR',
7345 8: 'SYNTAX_ERR',
7346 9: 'INVALID_MODIFICATION_ERR',
7347 10: 'QUOTA_EXCEEDED_ERR',
7348 11: 'TYPE_MISMATCH_ERR',
7349 12: 'PATH_EXISTS_ERR',
7350 13: 'WRONG_ENTRY_TYPE',
7351 14: 'DIR_READ_ERR',
7352 };
7353 __decorate$36([
7354 Cordova()
7355 ], File, "getFreeDiskSpace", null);
7356 File = __decorate$36([
7357 Plugin({
7358 plugin: 'cordova-plugin-file',
7359 pluginRef: 'cordova.file',
7360 repo: 'https://github.com/apache/cordova-plugin-file'
7361 })
7362 ], File);
7363 return File;
7364}());
7365
7366var __decorate$37 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7367 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7368 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7369 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;
7370 return c > 3 && r && Object.defineProperty(target, key, r), r;
7371};
7372/**
7373 * @name FileChooser
7374 * @description
7375 *
7376 * Opens the file picker on Android for the user to select a file, returns a file URI.
7377 *
7378 * @usage
7379 * ```
7380 * import {FileChooser} from 'ionic-native';
7381 *
7382 * FileChooser.open()
7383 * .then(uri => console.log(uri);
7384 * .catch(e => console.log(e);
7385 *
7386 * ```
7387 */
7388var FileChooser = (function () {
7389 function FileChooser() {
7390 }
7391 /**
7392 * Open a file
7393 */
7394 FileChooser.open = function () { return; };
7395 __decorate$37([
7396 Cordova()
7397 ], FileChooser, "open", null);
7398 FileChooser = __decorate$37([
7399 Plugin({
7400 plugin: 'http://github.com/don/cordova-filechooser.git',
7401 pluginRef: 'fileChooser',
7402 repo: 'https://github.com/don/cordova-filechooser',
7403 platforms: ['Android']
7404 })
7405 ], FileChooser);
7406 return FileChooser;
7407}());
7408
7409var __decorate$38 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7410 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7411 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7412 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;
7413 return c > 3 && r && Object.defineProperty(target, key, r), r;
7414};
7415/**
7416 * @name FileOpener
7417 * @description
7418 * This plugin will open a file on your device file system with its default application.
7419 *
7420 * @usage
7421 * ```
7422 * import {FileOpener} from 'ionic-native';
7423 *
7424 *
7425 *
7426 * ```
7427 */
7428var FileOpener = (function () {
7429 function FileOpener() {
7430 }
7431 /**
7432 * Open an file
7433 * @param filePath {string} File Path
7434 * @param fileMIMEType {string} File MIME Type
7435 */
7436 FileOpener.open = function (filePath, fileMIMEType) { return; };
7437 /**
7438 * Uninstalls a package
7439 * @param packageId {string} Package ID
7440 */
7441 FileOpener.uninstall = function (packageId) { return; };
7442 /**
7443 * Check if an app is already installed
7444 * @param packageId {string} Package ID
7445 */
7446 FileOpener.appIsInstalled = function (packageId) { return; };
7447 __decorate$38([
7448 Cordova({
7449 callbackStyle: 'object',
7450 successName: 'success',
7451 errorName: 'error'
7452 })
7453 ], FileOpener, "open", null);
7454 __decorate$38([
7455 Cordova({
7456 callbackStyle: 'object',
7457 successName: 'success',
7458 errorName: 'error'
7459 })
7460 ], FileOpener, "uninstall", null);
7461 __decorate$38([
7462 Cordova({
7463 callbackStyle: 'object',
7464 successName: 'success',
7465 errorName: 'error'
7466 })
7467 ], FileOpener, "appIsInstalled", null);
7468 FileOpener = __decorate$38([
7469 Plugin({
7470 plugin: 'cordova-plugin-file-opener2',
7471 pluginRef: 'cordova.plugins.fileOpener2',
7472 repo: 'https://github.com/pwlin/cordova-plugin-file-opener2'
7473 })
7474 ], FileOpener);
7475 return FileOpener;
7476}());
7477
7478var __decorate$39 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7479 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7480 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7481 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;
7482 return c > 3 && r && Object.defineProperty(target, key, r), r;
7483};
7484/**
7485 * @name Transfer
7486 *
7487 * @description
7488 * This plugin allows you to upload and download files.
7489 *
7490 * @usage
7491 * ```typescript
7492 * import { Transfer } from 'ionic-native';
7493 *
7494 *
7495 * // Create instance:
7496 * const fileTransfer = new Transfer();
7497 *
7498 * // Upload a file:
7499 * fileTransfer.upload(..).then(..).catch(..);
7500 *
7501 * // Download a file:
7502 * fileTransfer.download(..).then(..).catch(..);
7503 *
7504 * // Abort active transfer:
7505 * fileTransfer.abort();
7506 *
7507 * E.g
7508 *
7509 * upload(){
7510 * const fileTransfer = new Transfer();
7511 * var options: any;
7512 *
7513 * options = {
7514 * fileKey: 'file',
7515 * fileName: 'name.jpg',
7516 * headers: {}
7517 * .....
7518 * }
7519 * fileTransfer.upload("<file path>", "<api endpoint>", options)
7520 * .then((data) => {
7521 * // success
7522 * }, (err) => {
7523 * // error
7524 * })
7525 * }
7526 *
7527 * ```
7528 *
7529 */
7530var Transfer = (function () {
7531 function Transfer() {
7532 this._objectInstance = new FileTransfer();
7533 }
7534 /**
7535 * Sends a file to a server.
7536 *
7537 * @param {string} fileUrl Filesystem URL representing the file on the device or a data URI. For backwards compatibility, this can also be the full path of the file on the device.
7538 * @param {string} url URL of the server to receive the file, as encoded by encodeURI().
7539 * @param {FileUploadOptions} options Optional parameters.
7540 * @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
7541 * @return Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError.
7542 */
7543 Transfer.prototype.upload = function (fileUrl, url, options, trustAllHosts) {
7544 return;
7545 };
7546 /**
7547 * Downloads a file from server.
7548 *
7549 * @param {string} source URL of the server to download the file, as encoded by encodeURI().
7550 * @param {stirng} target Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
7551 * @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
7552 * @param {object} Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc).
7553 * @return Returns a Promise that resolves to a FileEntry object.
7554 */
7555 Transfer.prototype.download = function (source, target, trustAllHosts, options) {
7556 return;
7557 };
7558 /**
7559 * Registers a listener that gets called whenever a new chunk of data is transferred.
7560 * @param {function} Listener that takes a progress event.
7561 */
7562 Transfer.prototype.onProgress = function (listener) {
7563 this._objectInstance.onprogress = listener;
7564 };
7565 /**
7566 * Aborts an in-progress transfer. The onerror callback is passed a FileTransferError
7567 * object which has an error code of FileTransferError.ABORT_ERR.
7568 */
7569 Transfer.prototype.abort = function () { };
7570 /**
7571 * Error code rejected from upload with FileTransferError
7572 * Defined in FileTransferError.
7573 * FILE_NOT_FOUND_ERR: 1 Return when file was not found
7574 * INVALID_URL_ERR: 2, Return when url was invalid
7575 * CONNECTION_ERR: 3, Return on connection error
7576 * ABORT_ERR: 4, Return on aborting
7577 * NOT_MODIFIED_ERR: 5 Return on "304 Not Modified" HTTP response
7578 * @enum {number}
7579 */
7580 Transfer.FileTransferErrorCode = {
7581 FILE_NOT_FOUND_ERR: 1,
7582 INVALID_URL_ERR: 2,
7583 CONNECTION_ERR: 3,
7584 ABORT_ERR: 4,
7585 NOT_MODIFIED_ERR: 5
7586 };
7587 __decorate$39([
7588 CordovaInstance({
7589 successIndex: 2,
7590 errorIndex: 3
7591 })
7592 ], Transfer.prototype, "upload", null);
7593 __decorate$39([
7594 CordovaInstance({
7595 successIndex: 2,
7596 errorIndex: 3
7597 })
7598 ], Transfer.prototype, "download", null);
7599 __decorate$39([
7600 CordovaInstance({
7601 sync: true
7602 })
7603 ], Transfer.prototype, "abort", null);
7604 Transfer = __decorate$39([
7605 Plugin({
7606 plugin: 'cordova-plugin-file-transfer',
7607 pluginRef: 'FileTransfer',
7608 repo: 'https://github.com/apache/cordova-plugin-file-transfer'
7609 })
7610 ], Transfer);
7611 return Transfer;
7612}());
7613
7614var __decorate$40 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7615 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7616 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7617 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;
7618 return c > 3 && r && Object.defineProperty(target, key, r), r;
7619};
7620/**
7621 * @name Flashlight
7622 * @description This plugin allows you to switch the flashlight / torch of the device on and off.
7623 *
7624 * Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin).
7625 *
7626 * @usage
7627 * ```typescript
7628 * import { Flashlight } from 'ionic-native';
7629 *
7630 *
7631 *
7632 * ```
7633 */
7634var Flashlight = (function () {
7635 function Flashlight() {
7636 }
7637 /**
7638 * Checks if the flashlight is available
7639 * @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flashlight is available.
7640 */
7641 Flashlight.available = function () { return; };
7642 /**
7643 * Switches the flashlight on
7644 * @returns {Promise<boolean>}
7645 */
7646 Flashlight.switchOn = function () { return; };
7647 /**
7648 * Switches the flashlight off
7649 * @returns {Promise<boolean>}
7650 */
7651 Flashlight.switchOff = function () { return; };
7652 /**
7653 * Toggles the flashlight
7654 * @returns {Promise<any>}
7655 */
7656 Flashlight.toggle = function () { return; };
7657 /**
7658 * Checks if the flashlight is turned on.
7659 * @returns {boolean}
7660 */
7661 Flashlight.isSwitchedOn = function () { return; };
7662 __decorate$40([
7663 Cordova()
7664 ], Flashlight, "available", null);
7665 __decorate$40([
7666 Cordova()
7667 ], Flashlight, "switchOn", null);
7668 __decorate$40([
7669 Cordova()
7670 ], Flashlight, "switchOff", null);
7671 __decorate$40([
7672 Cordova()
7673 ], Flashlight, "toggle", null);
7674 __decorate$40([
7675 Cordova({
7676 sync: true
7677 })
7678 ], Flashlight, "isSwitchedOn", null);
7679 Flashlight = __decorate$40([
7680 Plugin({
7681 plugin: 'cordova-plugin-flashlight',
7682 pluginRef: 'window.plugins.flashlight',
7683 repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git'
7684 })
7685 ], Flashlight);
7686 return Flashlight;
7687}());
7688
7689var __decorate$41 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7690 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7691 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7692 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;
7693 return c > 3 && r && Object.defineProperty(target, key, r), r;
7694};
7695var Geofence = (function () {
7696 function Geofence() {
7697 }
7698 /**
7699 * Initializes the plugin. User will be prompted to allow the app to use location and notifications.
7700 *
7701 * @return {Promise<any>}
7702 */
7703 Geofence.initialize = function () { return; };
7704
7705 /**
7706 * Adds a new geofence or array of geofences. For geofence object, see above.
7707 *
7708 * @return {Promise<any>}
7709 */
7710 Geofence.addOrUpdate = function (geofences) { return; };
7711
7712 /**
7713 * Removes a geofence or array of geofences. `geofenceID` corresponds to one or more IDs specified when the
7714 * geofence was created.
7715 *
7716 * @return {Promise<any>}
7717 */
7718 Geofence.remove = function (geofenceId) { return; };
7719
7720 /**
7721 * Removes all geofences.
7722 *
7723 * @return {Promise<any>}
7724 */
7725 Geofence.removeAll = function () { return; };
7726
7727 /**
7728 * Returns an array of geofences currently being monitored.
7729 *
7730 * @return {Promise<Array<string>>}
7731 */
7732 Geofence.getWatched = function () { return; };
7733
7734 /**
7735 * Called when a geofence is crossed in the direction specified by `TransitType`.
7736 *
7737 * @return {Promise<any>}
7738 */
7739 Geofence.onTransitionReceived = function () {
7740 return new Observable_2(function (observer) {
7741 window && window.geofence && (window.geofence.onTransitionReceived = observer.next.bind(observer));
7742 return function () { return window.geofence.onTransitionReceived = function () { }; };
7743 });
7744 };
7745 /**
7746 * Called when the user clicks a geofence notification. iOS and Android only.
7747 *
7748 * @return {Promise<Object>}
7749 */
7750 Geofence.onNotificationClicked = function () {
7751 return new Observable_2(function (observer) {
7752 window && window.geofence && (window.geofence.onNotificationClicked = observer.next.bind(observer));
7753 return function () { return window.geofence.onNotificationClicked = function () { }; };
7754 });
7755 };
7756 Geofence.TransitionType = {
7757 ENTER: 1,
7758 EXIT: 2,
7759 BOTH: 3
7760 };
7761 __decorate$41([
7762 Cordova()
7763 ], Geofence, "initialize", null);
7764 __decorate$41([
7765 Cordova()
7766 ], Geofence, "addOrUpdate", null);
7767 __decorate$41([
7768 Cordova()
7769 ], Geofence, "remove", null);
7770 __decorate$41([
7771 Cordova()
7772 ], Geofence, "removeAll", null);
7773 __decorate$41([
7774 Cordova()
7775 ], Geofence, "getWatched", null);
7776 Geofence = __decorate$41([
7777 Plugin({
7778 plugin: 'cordova-plugin-geofence',
7779 pluginRef: 'geofence',
7780 repo: 'https://github.com/cowbell/cordova-plugin-geofence/',
7781 platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
7782 })
7783 ], Geofence);
7784 return Geofence;
7785}());
7786
7787var __decorate$42 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7788 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7789 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7790 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;
7791 return c > 3 && r && Object.defineProperty(target, key, r), r;
7792};
7793/**
7794 * @name Geolocation
7795 * @description
7796 * This plugin provides information about the device's location, such as latitude and longitude. Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs.
7797 *
7798 * This API is based on the W3C Geolocation API Specification, and only executes on devices that don't already provide an implementation.
7799 *
7800 * @usage
7801 *
7802 * ```typescript
7803 * import { Geolocation } from 'ionic-native';
7804 *
7805 *
7806 * Geolocation.getCurrentPosition().then((resp) => {
7807 * // resp.coords.latitude
7808 * // resp.coords.longitude
7809 * })
7810 *
7811 * let watch = Geolocation.watchPosition();
7812 * watch.subscribe((data) => {
7813 * // data.coords.latitude
7814 * // data.coords.longitude
7815 * })
7816 * ```
7817 */
7818var Geolocation = (function () {
7819 function Geolocation() {
7820 }
7821 /**
7822 * Get the device's current position.
7823 *
7824 * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
7825 * @return Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error.
7826 */
7827 Geolocation.getCurrentPosition = function (options) { return; };
7828 /**
7829 * Watch the current device's position. Clear the watch by unsubscribing from
7830 * Observable changes.
7831 *
7832 * ```typescript
7833 * var subscription = Geolocation.watchPosition()
7834 * .filter((p) => p.code === undefined) //Filter Out Errors
7835 * .subscribe(position => {
7836 * console.log(position.coords.longitude + ' ' + position.coords.latitude);
7837 * });
7838 *
7839 * // To stop notifications
7840 * subscription.unsubscribe();
7841 * ```
7842 *
7843 * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
7844 * @return Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors.
7845 */
7846 Geolocation.watchPosition = function (options) {
7847 return new Observable_2(function (observer) {
7848 var watchId = navigator.geolocation.watchPosition(observer.next.bind(observer), observer.next.bind(observer), options);
7849 return function () { return navigator.geolocation.clearWatch(watchId); };
7850 });
7851 };
7852 __decorate$42([
7853 Cordova({
7854 callbackOrder: 'reverse'
7855 })
7856 ], Geolocation, "getCurrentPosition", null);
7857 Geolocation = __decorate$42([
7858 Plugin({
7859 plugin: 'cordova-plugin-geolocation',
7860 pluginRef: 'navigator.geolocation',
7861 repo: 'https://github.com/apache/cordova-plugin-geolocation'
7862 })
7863 ], Geolocation);
7864 return Geolocation;
7865}());
7866
7867var __decorate$43 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
7868 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7869 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7870 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;
7871 return c > 3 && r && Object.defineProperty(target, key, r), r;
7872};
7873/**
7874 * @name Globalization
7875 * @description
7876 * @usage
7877 * ```typescript
7878 * import { Globalization } from 'ionic-native';
7879 *
7880 *
7881 * ```
7882 */
7883var Globalization = (function () {
7884 function Globalization() {
7885 }
7886 /**
7887 * Returns the BCP-47 compliant language identifier tag to the successCallback with a properties object as a parameter. That object should have a value property with a String value.
7888 * @return {Promise<{value: string}>}
7889 */
7890 Globalization.getPreferredLanguage = function () { return; };
7891 /**
7892 * Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
7893 * @return {Promise<{value: string}>}
7894 */
7895 Globalization.getLocaleName = function () { return; };
7896 /**
7897 * Converts date to string
7898 * @param {Date} date Date you wish to convert
7899 * @param options Options for the converted date. Length, selector.
7900 * @return {Promise<{value: string}>} Returns a promise when the date has been converted.
7901 */
7902 Globalization.dateToString = function (date, options) { return; };
7903 /**
7904 * Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object.
7905 * @param {string} dateString Date as a string to be converted
7906 * @param options Options for the converted date. Length, selector.
7907 * @return {Promise<{value: string}>} Returns a promise when the date has been converted.
7908 */
7909 Globalization.stringToDate = function (dateString, options) { return; };
7910 /**
7911 * Returns a pattern string to format and parse dates according to the client's user preferences.
7912 * @param options Object with the format length and selector
7913 * @return {Promise<{value: string}>} Returns a promise.
7914 */
7915 Globalization.getDatePattern = function (options) { return; };
7916 /**
7917 * Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
7918 * @param options Object with type (narrow or wide) and item (month or days).
7919 * @return {Promise<{value: string}>} Returns a promise.
7920 */
7921 Globalization.getDateNames = function (options) { return; };
7922 /**
7923 * Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
7924 * @param {data} date Date to process
7925 * @returns {Promise<dst>} reutrns a promise with the value
7926 */
7927 Globalization.isDayLightSavingsTime = function (date) { return; };
7928 /**
7929 * Returns the first day of the week according to the client's user preferences and calendar.
7930 * @returns {Promise<value>} reutrns a promise with the value
7931 */
7932 Globalization.getFirstDayOfWeek = function () { return; };
7933 /**
7934 * Returns a number formatted as a string according to the client's user preferences.
7935 * @param options
7936 */
7937 Globalization.numberToString = function (options) { return; };
7938 /**
7939 *
7940 * @param {string} stringToConvert String you want to conver to a number
7941 * @param options The type of number you want to return. Can be decimal, percent, or currency.
7942 * @returns {Promise} Returns a promise with the value.
7943 */
7944 Globalization.stringToNumber = function (stringToConvert, options) { return; };
7945 /**
7946 * Returns a pattern string to format and parse numbers according to the client's user preferences.
7947 * @param options Can be decimal, percent, or currency.
7948 * @returns {Promise} returns a promise with the value.
7949 */
7950 Globalization.getNumberPattern = function (options) { return; };
7951 /**
7952 * Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
7953 * @param {string} currencyCode Currency Code.A
7954 * @returns {Promise} returns a promise with the value
7955 */
7956 Globalization.getCurrencyPattern = function (currencyCode) { return; };
7957 __decorate$43([
7958 Cordova()
7959 ], Globalization, "getPreferredLanguage", null);
7960 __decorate$43([
7961 Cordova()
7962 ], Globalization, "getLocaleName", null);
7963 __decorate$43([
7964 Cordova({
7965 successIndex: 1,
7966 errorIndex: 2
7967 })
7968 ], Globalization, "dateToString", null);
7969 __decorate$43([
7970 Cordova({
7971 successIndex: 1,
7972 errorIndex: 2
7973 })
7974 ], Globalization, "stringToDate", null);
7975 __decorate$43([
7976 Cordova({
7977 callbackOrder: 'reverse'
7978 })
7979 ], Globalization, "getDatePattern", null);
7980 __decorate$43([
7981 Cordova({
7982 callbackOrder: 'reverse'
7983 })
7984 ], Globalization, "getDateNames", null);
7985 __decorate$43([
7986 Cordova()
7987 ], Globalization, "isDayLightSavingsTime", null);
7988 __decorate$43([
7989 Cordova()
7990 ], Globalization, "getFirstDayOfWeek", null);
7991 __decorate$43([
7992 Cordova({
7993 successIndex: 1,
7994 errorIndex: 2
7995 })
7996 ], Globalization, "numberToString", null);
7997 __decorate$43([
7998 Cordova({
7999 successIndex: 1,
8000 errorIndex: 2
8001 })
8002 ], Globalization, "stringToNumber", null);
8003 __decorate$43([
8004 Cordova({
8005 callbackOrder: 'reverse'
8006 })
8007 ], Globalization, "getNumberPattern", null);
8008 __decorate$43([
8009 Cordova()
8010 ], Globalization, "getCurrencyPattern", null);
8011 Globalization = __decorate$43([
8012 Plugin({
8013 plugin: 'cordova-plugin-globalization',
8014 pluginRef: 'navigator.globalization',
8015 repo: 'https://github.com/apache/cordova-plugin-globalization'
8016 })
8017 ], Globalization);
8018 return Globalization;
8019}());
8020
8021var __decorate$44 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
8022 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8023 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8024 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;
8025 return c > 3 && r && Object.defineProperty(target, key, r), r;
8026};
8027/**
8028 * @name Google Plus
8029 * @description
8030 * @usage
8031 * ```typescript
8032 * import { GooglePlus } from 'ionic-native';
8033 *
8034 *
8035 * ```
8036 */
8037var GooglePlus = (function () {
8038 function GooglePlus() {
8039 }
8040 /**
8041 * The login function walks the user through the Google Auth process.
8042 * @param options
8043 */
8044 GooglePlus.login = function (options) { return; };
8045 /**
8046 * You can call trySilentLogin to check if they're already signed in to the app and sign them in silently if they are.
8047 * @param options
8048 */
8049 GooglePlus.trySilentLogin = function (options) { return; };
8050 /**
8051 * This will clear the OAuth2 token.
8052 */
8053 GooglePlus.logout = function () { return; };
8054 /**
8055 * This will clear the OAuth2 token, forget which account was used to login, and disconnect that account from the app. This will require the user to allow the app access again next time they sign in. Be aware that this effect is not always instantaneous. It can take time to completely disconnect.
8056 */
8057 GooglePlus.disconnect = function () { return; };
8058 __decorate$44([
8059 Cordova()
8060 ], GooglePlus, "login", null);
8061 __decorate$44([
8062 Cordova()
8063 ], GooglePlus, "trySilentLogin", null);
8064 __decorate$44([
8065 Cordova()
8066 ], GooglePlus, "logout", null);
8067 __decorate$44([
8068 Cordova()
8069 ], GooglePlus, "disconnect", null);
8070 GooglePlus = __decorate$44([
8071 Plugin({
8072 plugin: 'cordova-plugin-googleplus',
8073 pluginRef: 'window.plugins.googleplus',
8074 repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus',
8075 platforms: ['Web', 'Android', 'iOS'],
8076 install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid'
8077 })
8078 ], GooglePlus);
8079 return GooglePlus;
8080}());
8081
8082var __decorate$45 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
8083 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8084 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8085 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;
8086 return c > 3 && r && Object.defineProperty(target, key, r), r;
8087};
8088/**
8089 * @private
8090 * You can listen to these events where appropriate
8091 */
8092
8093/**
8094 * @private
8095 */
8096
8097/**
8098 * @name Google Maps
8099 * @description This plugin uses the native Google Maps SDK
8100 * @usage
8101 * ```
8102 * import { GoogleMap, GoogleMapsEvent } from 'ionic-native';
8103 *
8104 * // create a new map using element ID
8105 * let map = new GoogleMap('elementID');
8106 *
8107 * // or create a new map by passing HTMLElement
8108 * let element: HTMLElement = document.getElementById('elementID');
8109 *
8110 * // In Angular 2 or Ionic 2, if we have this element in html: <div #map></div>
8111 * // then we can use @ViewChild to find the element and pass it to GoogleMaps
8112 * @ViewChild('map') mapElement;
8113 * let map = new GoogleMap(mapElement);
8114 *
8115 * // listen to MAP_READY event
8116 * map.one(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
8117 *
8118 *
8119 * // create LatLng object
8120 * let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
8121 *
8122 * // create CameraPosition
8123 * let position: CameraPosition = {
8124 * target: ionic,
8125 * zoom: 18,
8126 * tilt: 30
8127 * };
8128 *
8129 * // move the map's camera to position
8130 * map.moveCamera(position);
8131 *
8132 * // create new marker
8133 * let markerOptions: GoogleMapsMarkerOptions = {
8134 * position: ionic,
8135 * title: 'Ionic'
8136 * };
8137 *
8138 * map.addMarker(markerOptions)
8139 * .then((marker: GoogleMapsMarker) => {
8140 * marker.showInfoWindow();
8141 * });
8142 * ```
8143 */
8144var GoogleMap = (function () {
8145 function GoogleMap(element, options) {
8146 if (typeof element === 'string')
8147 element = document.getElementById(element);
8148 this._objectInstance = plugin.google.maps.Map.getMap(element, options);
8149 }
8150 /**
8151 * Checks if a map object has been created and is available.
8152 *
8153 * @return {Promise<boolean>}
8154 */
8155 GoogleMap.isAvailable = function () {
8156 return;
8157 };
8158 /**
8159 * Listen to a map event.
8160 *
8161 * @return {Observable<any>}
8162 */
8163 GoogleMap.prototype.on = function (event) {
8164 var _this = this;
8165 return new Observable_2(function (observer) {
8166 _this._objectInstance.on(event, observer.next.bind(observer));
8167 return function () { return _this._objectInstance.off(event); };
8168 });
8169 };
8170 /**
8171 * Listen to a map event only once.
8172 *
8173 * @return {Promise<any>}
8174 */
8175 GoogleMap.prototype.one = function (event) {
8176 var _this = this;
8177 return new Promise(function (resolve) { return _this._objectInstance.one(event, resolve); });
8178 };
8179 GoogleMap.prototype.setDebuggable = function (isDebuggable) {
8180 };
8181 GoogleMap.prototype.setClickable = function (isClickable) {
8182 };
8183 /**
8184 * Get the position of the camera.
8185 *
8186 * @return {Promise<CameraPosition>}
8187 */
8188 GoogleMap.prototype.getCameraPosition = function () {
8189 return;
8190 };
8191 /**
8192 * Get the location of the user.
8193 *
8194 * @return {Promise<MyLocation>}
8195 */
8196 GoogleMap.prototype.getMyLocation = function (options) {
8197 return;
8198 };
8199 /**
8200 * Get the visible region.
8201 *
8202 * @return {Promise<VisibleRegion>}
8203 */
8204 GoogleMap.prototype.getVisibleRegion = function () {
8205 return;
8206 };
8207 GoogleMap.prototype.showDialog = function () {
8208 };
8209 GoogleMap.prototype.closeDialog = function () {
8210 };
8211 GoogleMap.prototype.getLicenseInfo = function () {
8212 return;
8213 };
8214 GoogleMap.prototype.setCenter = function (latLng) {
8215 };
8216 GoogleMap.prototype.setZoom = function (zoomLevel) {
8217 };
8218 GoogleMap.prototype.setMapTypeId = function (typeId) {
8219 };
8220 GoogleMap.prototype.setTilt = function (tiltLevel) {
8221 };
8222 GoogleMap.prototype.animateCamera = function (animateCameraOptions) { return; };
8223 GoogleMap.prototype.moveCamera = function (cameraPosition) { return; };
8224 GoogleMap.prototype.setMyLocationEnabled = function (enabled) {
8225 };
8226 GoogleMap.prototype.setIndoorEnabled = function (enabled) {
8227 };
8228 GoogleMap.prototype.setTrafficEnabled = function (enabled) {
8229 };
8230 GoogleMap.prototype.setCompassEnabled = function (enabled) {
8231 };
8232 GoogleMap.prototype.setAllGesturesEnabled = function (enabled) {
8233 };
8234 GoogleMap.prototype.addMarker = function (options) {
8235 var _this = this;
8236 return new Promise(function (resolve, reject) {
8237 _this._objectInstance.addMarker(options, function (marker) {
8238 if (marker) {
8239 resolve(new GoogleMapsMarker(marker));
8240 }
8241 else {
8242 reject();
8243 }
8244 });
8245 });
8246 };
8247 GoogleMap.prototype.addCircle = function (options) {
8248 var _this = this;
8249 return new Promise(function (resolve, reject) {
8250 _this._objectInstance.addCircle(options, function (circle) {
8251 if (circle) {
8252 resolve(new GoogleMapsCircle(circle));
8253 }
8254 else {
8255 reject();
8256 }
8257 });
8258 });
8259 };
8260 GoogleMap.prototype.addPolygon = function (options) {
8261 var _this = this;
8262 return new Promise(function (resolve, reject) {
8263 _this._objectInstance.addPolygon(options, function (polygon) {
8264 if (polygon) {
8265 resolve(new GoogleMapsPolygon(polygon));
8266 }
8267 else {
8268 reject();
8269 }
8270 });
8271 });
8272 };
8273 GoogleMap.prototype.addPolyline = function (options) {
8274 var _this = this;
8275 return new Promise(function (resolve, reject) {
8276 _this._objectInstance.addPolyline(options, function (polyline) {
8277 if (polyline) {
8278 resolve(new GoogleMapsPolyline(polyline));
8279 }
8280 else {
8281 reject();
8282 }
8283 });
8284 });
8285 };
8286 GoogleMap.prototype.addTileOverlay = function (options) {
8287 var _this = this;
8288 return new Promise(function (resolve, reject) {
8289 _this._objectInstance.addTileOverlay(options, function (tileOverlay) {
8290 if (tileOverlay) {
8291 resolve(new GoogleMapsTileOverlay(tileOverlay));
8292 }
8293 else {
8294 reject();
8295 }
8296 });
8297 });
8298 };
8299 GoogleMap.prototype.addGroundOverlay = function (options) {
8300 var _this = this;
8301 return new Promise(function (resolve, reject) {
8302 _this._objectInstance.addGroundOverlay(options, function (groundOverlay) {
8303 if (groundOverlay) {
8304 resolve(new GoogleMapsGroundOverlay(groundOverlay));
8305 }
8306 else {
8307 reject();
8308 }
8309 });
8310 });
8311 };
8312 GoogleMap.prototype.addKmlOverlay = function (options) {
8313 var _this = this;
8314 return new Promise(function (resolve, reject) {
8315 _this._objectInstance.addKmlOverlay(options, function (kmlOverlay) {
8316 if (kmlOverlay) {
8317 resolve(new GoogleMapsKmlOverlay(kmlOverlay));
8318 }
8319 else {
8320 reject();
8321 }
8322 });
8323 });
8324 };
8325 GoogleMap.prototype.setDiv = function (domNode) {
8326 };
8327 GoogleMap.prototype.setVisible = function (visible) {
8328 };
8329 GoogleMap.prototype.setOptions = function (options) {
8330 };
8331 GoogleMap.prototype.setBackgroundColor = function (backgroundColor) {
8332 };
8333 GoogleMap.prototype.setPadding = function (top, right, bottom, left) {
8334 };
8335 GoogleMap.prototype.clear = function () {
8336 };
8337 GoogleMap.prototype.refreshLayout = function () {
8338 };
8339 GoogleMap.prototype.fromLatLngToPoint = function (latLng, point) {
8340 return;
8341 };
8342 GoogleMap.prototype.fromPointToLatLng = function (point, latLng) {
8343 return;
8344 };
8345 GoogleMap.prototype.toDataURL = function () {
8346 return;
8347 };
8348 GoogleMap.prototype.remove = function () {
8349 };
8350 GoogleMap.prototype.panBy = function () {
8351 };
8352 __decorate$45([
8353 CordovaInstance({ sync: true })
8354 ], GoogleMap.prototype, "setDebuggable", null);
8355 __decorate$45([
8356 CordovaInstance({ sync: true })
8357 ], GoogleMap.prototype, "setClickable", null);
8358 __decorate$45([
8359 CordovaInstance()
8360 ], GoogleMap.prototype, "getCameraPosition", null);
8361 __decorate$45([
8362 CordovaInstance()
8363 ], GoogleMap.prototype, "getMyLocation", null);
8364 __decorate$45([
8365 CordovaInstance()
8366 ], GoogleMap.prototype, "getVisibleRegion", null);
8367 __decorate$45([
8368 CordovaInstance({ sync: true })
8369 ], GoogleMap.prototype, "showDialog", null);
8370 __decorate$45([
8371 CordovaInstance({ sync: true })
8372 ], GoogleMap.prototype, "closeDialog", null);
8373 __decorate$45([
8374 CordovaInstance()
8375 ], GoogleMap.prototype, "getLicenseInfo", null);
8376 __decorate$45([
8377 CordovaInstance({ sync: true })
8378 ], GoogleMap.prototype, "setCenter", null);
8379 __decorate$45([
8380 CordovaInstance({ sync: true })
8381 ], GoogleMap.prototype, "setZoom", null);
8382 __decorate$45([
8383 CordovaInstance({ sync: true })
8384 ], GoogleMap.prototype, "setMapTypeId", null);
8385 __decorate$45([
8386 CordovaInstance({ sync: true })
8387 ], GoogleMap.prototype, "setTilt", null);
8388 __decorate$45([
8389 CordovaInstance()
8390 ], GoogleMap.prototype, "animateCamera", null);
8391 __decorate$45([
8392 CordovaInstance()
8393 ], GoogleMap.prototype, "moveCamera", null);
8394 __decorate$45([
8395 CordovaInstance({ sync: true })
8396 ], GoogleMap.prototype, "setMyLocationEnabled", null);
8397 __decorate$45([
8398 CordovaInstance({ sync: true })
8399 ], GoogleMap.prototype, "setIndoorEnabled", null);
8400 __decorate$45([
8401 CordovaInstance({ sync: true })
8402 ], GoogleMap.prototype, "setTrafficEnabled", null);
8403 __decorate$45([
8404 CordovaInstance({ sync: true })
8405 ], GoogleMap.prototype, "setCompassEnabled", null);
8406 __decorate$45([
8407 CordovaInstance({ sync: true })
8408 ], GoogleMap.prototype, "setAllGesturesEnabled", null);
8409 __decorate$45([
8410 CordovaInstance({ sync: true })
8411 ], GoogleMap.prototype, "setDiv", null);
8412 __decorate$45([
8413 CordovaInstance({ sync: true })
8414 ], GoogleMap.prototype, "setVisible", null);
8415 __decorate$45([
8416 CordovaInstance({ sync: true })
8417 ], GoogleMap.prototype, "setOptions", null);
8418 __decorate$45([
8419 CordovaInstance({ sync: true })
8420 ], GoogleMap.prototype, "setBackgroundColor", null);
8421 __decorate$45([
8422 CordovaInstance({ sync: true })
8423 ], GoogleMap.prototype, "setPadding", null);
8424 __decorate$45([
8425 CordovaInstance({ sync: true })
8426 ], GoogleMap.prototype, "clear", null);
8427 __decorate$45([
8428 CordovaInstance({ sync: true })
8429 ], GoogleMap.prototype, "refreshLayout", null);
8430 __decorate$45([
8431 CordovaInstance()
8432 ], GoogleMap.prototype, "fromLatLngToPoint", null);
8433 __decorate$45([
8434 CordovaInstance()
8435 ], GoogleMap.prototype, "fromPointToLatLng", null);
8436 __decorate$45([
8437 CordovaInstance()
8438 ], GoogleMap.prototype, "toDataURL", null);
8439 __decorate$45([
8440 CordovaInstance({ sync: true })
8441 ], GoogleMap.prototype, "remove", null);
8442 __decorate$45([
8443 CordovaInstance({ sync: true })
8444 ], GoogleMap.prototype, "panBy", null);
8445 __decorate$45([
8446 Cordova()
8447 ], GoogleMap, "isAvailable", null);
8448 GoogleMap = __decorate$45([
8449 Plugin({
8450 pluginRef: 'plugin.google.maps.Map',
8451 plugin: 'cordova-plugin-googlemaps',
8452 repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
8453 install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"'
8454 })
8455 ], GoogleMap);
8456 return GoogleMap;
8457}());
8458/**
8459 * @private
8460 */
8461var GoogleMapsMarker = (function () {
8462 function GoogleMapsMarker(_objectInstance) {
8463 this._objectInstance = _objectInstance;
8464 }
8465 GoogleMapsMarker.prototype.addEventListener = function (event) {
8466 var _this = this;
8467 return new Observable_2(function (observer) {
8468 _this._objectInstance.addEventListener(event, observer.next.bind(observer));
8469 return function () { return _this._objectInstance.removeEventListener(event, observer.next.bind(observer)); };
8470 });
8471 };
8472 GoogleMapsMarker.prototype.isVisible = function () {
8473 return;
8474 };
8475 GoogleMapsMarker.prototype.setVisible = function (visible) {
8476 };
8477 GoogleMapsMarker.prototype.getHashCode = function () {
8478 return;
8479 };
8480 GoogleMapsMarker.prototype.remove = function () {
8481 };
8482 GoogleMapsMarker.prototype.setOpacity = function (alpha) {
8483 };
8484 GoogleMapsMarker.prototype.getOpacity = function () {
8485 return;
8486 };
8487 GoogleMapsMarker.prototype.setZIndex = function () {
8488 };
8489 GoogleMapsMarker.prototype.setIconAnchor = function (x, y) {
8490 };
8491 GoogleMapsMarker.prototype.setInfoWindowAnchor = function (x, y) {
8492 };
8493 GoogleMapsMarker.prototype.setDraggable = function (draggable) {
8494 };
8495 GoogleMapsMarker.prototype.isDraggable = function () {
8496 return;
8497 };
8498 GoogleMapsMarker.prototype.setFlat = function (flat) {
8499 return;
8500 };
8501 GoogleMapsMarker.prototype.setIcon = function (icon) {
8502 };
8503 GoogleMapsMarker.prototype.setTitle = function (title) {
8504 };
8505 GoogleMapsMarker.prototype.getTitle = function () {
8506 return;
8507 };
8508 GoogleMapsMarker.prototype.setSnippet = function (snippet) {
8509 };
8510 GoogleMapsMarker.prototype.getSnippet = function () {
8511 return;
8512 };
8513 GoogleMapsMarker.prototype.setRotation = function (rotation) {
8514 };
8515 GoogleMapsMarker.prototype.getRotation = function () {
8516 return;
8517 };
8518 GoogleMapsMarker.prototype.showInfoWindow = function () {
8519 return;
8520 };
8521 GoogleMapsMarker.prototype.hideInfoWindow = function () {
8522 return;
8523 };
8524 GoogleMapsMarker.prototype.setPosition = function (latLng) {
8525 };
8526 GoogleMapsMarker.prototype.getPosition = function () {
8527 return;
8528 };
8529 GoogleMapsMarker.prototype.getMap = function () {
8530 return;
8531 };
8532 GoogleMapsMarker.prototype.setAnimation = function (animation) {
8533 };
8534 __decorate$45([
8535 CordovaInstance({ sync: true })
8536 ], GoogleMapsMarker.prototype, "isVisible", null);
8537 __decorate$45([
8538 CordovaInstance()
8539 ], GoogleMapsMarker.prototype, "setVisible", null);
8540 __decorate$45([
8541 CordovaInstance({ sync: true })
8542 ], GoogleMapsMarker.prototype, "getHashCode", null);
8543 __decorate$45([
8544 CordovaInstance({ sync: true })
8545 ], GoogleMapsMarker.prototype, "remove", null);
8546 __decorate$45([
8547 CordovaInstance({ sync: true })
8548 ], GoogleMapsMarker.prototype, "setOpacity", null);
8549 __decorate$45([
8550 CordovaInstance({ sync: true })
8551 ], GoogleMapsMarker.prototype, "getOpacity", null);
8552 __decorate$45([
8553 CordovaInstance({ sync: true })
8554 ], GoogleMapsMarker.prototype, "setZIndex", null);
8555 __decorate$45([
8556 CordovaInstance({ sync: true })
8557 ], GoogleMapsMarker.prototype, "setIconAnchor", null);
8558 __decorate$45([
8559 CordovaInstance({ sync: true })
8560 ], GoogleMapsMarker.prototype, "setInfoWindowAnchor", null);
8561 __decorate$45([
8562 CordovaInstance({ sync: true })
8563 ], GoogleMapsMarker.prototype, "setDraggable", null);
8564 __decorate$45([
8565 CordovaInstance({ sync: true })
8566 ], GoogleMapsMarker.prototype, "isDraggable", null);
8567 __decorate$45([
8568 CordovaInstance({ sync: true })
8569 ], GoogleMapsMarker.prototype, "setFlat", null);
8570 __decorate$45([
8571 CordovaInstance({ sync: true })
8572 ], GoogleMapsMarker.prototype, "setIcon", null);
8573 __decorate$45([
8574 CordovaInstance({ sync: true })
8575 ], GoogleMapsMarker.prototype, "setTitle", null);
8576 __decorate$45([
8577 CordovaInstance({ sync: true })
8578 ], GoogleMapsMarker.prototype, "getTitle", null);
8579 __decorate$45([
8580 CordovaInstance({ sync: true })
8581 ], GoogleMapsMarker.prototype, "setSnippet", null);
8582 __decorate$45([
8583 CordovaInstance({ sync: true })
8584 ], GoogleMapsMarker.prototype, "getSnippet", null);
8585 __decorate$45([
8586 CordovaInstance({ sync: true })
8587 ], GoogleMapsMarker.prototype, "setRotation", null);
8588 __decorate$45([
8589 CordovaInstance({ sync: true })
8590 ], GoogleMapsMarker.prototype, "getRotation", null);
8591 __decorate$45([
8592 CordovaInstance({ sync: true })
8593 ], GoogleMapsMarker.prototype, "showInfoWindow", null);
8594 __decorate$45([
8595 CordovaInstance({ sync: true })
8596 ], GoogleMapsMarker.prototype, "hideInfoWindow", null);
8597 __decorate$45([
8598 CordovaInstance({ sync: true })
8599 ], GoogleMapsMarker.prototype, "setPosition", null);
8600 __decorate$45([
8601 CordovaInstance()
8602 ], GoogleMapsMarker.prototype, "getPosition", null);
8603 __decorate$45([
8604 CordovaInstance({ sync: true })
8605 ], GoogleMapsMarker.prototype, "getMap", null);
8606 __decorate$45([
8607 CordovaInstance({ sync: true })
8608 ], GoogleMapsMarker.prototype, "setAnimation", null);
8609 return GoogleMapsMarker;
8610}());
8611/**
8612 * @private
8613 */
8614var GoogleMapsCircle = (function () {
8615 function GoogleMapsCircle(_objectInstance) {
8616 this._objectInstance = _objectInstance;
8617 }
8618 GoogleMapsCircle.prototype.addEventListener = function (event) {
8619 var _this = this;
8620 return new Observable_2(function (observer) {
8621 _this._objectInstance.addEventListener(event, observer.next.bind(observer));
8622 return function () { return _this._objectInstance.removeEventListener(event, observer.next.bind(observer)); };
8623 });
8624 };
8625 GoogleMapsCircle.prototype.getCenter = function () {
8626 return;
8627 };
8628 GoogleMapsCircle.prototype.getRadius = function () {
8629 return;
8630 };
8631 GoogleMapsCircle.prototype.getStrokeColor = function () {
8632 return;
8633 };
8634 GoogleMapsCircle.prototype.getVisible = function () {
8635 return;
8636 };
8637 GoogleMapsCircle.prototype.getZIndex = function () {
8638 return;
8639 };
8640 GoogleMapsCircle.prototype.remove = function () {
8641 };
8642 GoogleMapsCircle.prototype.setCenter = function (latLng) {
8643 };
8644 GoogleMapsCircle.prototype.setFillColor = function (fillColor) {
8645 };
8646 GoogleMapsCircle.prototype.setStrokeColor = function (strokeColor) {
8647 };
8648 GoogleMapsCircle.prototype.setStrokeWidth = function (strokeWidth) {
8649 };
8650 GoogleMapsCircle.prototype.setVisible = function (visible) {
8651 };
8652 GoogleMapsCircle.prototype.setZIndex = function (zIndex) {
8653 };
8654 GoogleMapsCircle.prototype.setRadius = function (radius) {
8655 };
8656 GoogleMapsCircle.prototype.getMap = function () {
8657 return;
8658 };
8659 __decorate$45([
8660 CordovaInstance({ sync: true })
8661 ], GoogleMapsCircle.prototype, "getCenter", null);
8662 __decorate$45([
8663 CordovaInstance({ sync: true })
8664 ], GoogleMapsCircle.prototype, "getRadius", null);
8665 __decorate$45([
8666 CordovaInstance({ sync: true })
8667 ], GoogleMapsCircle.prototype, "getStrokeColor", null);
8668 __decorate$45([
8669 CordovaInstance({ sync: true })
8670 ], GoogleMapsCircle.prototype, "getVisible", null);
8671 __decorate$45([
8672 CordovaInstance({ sync: true })
8673 ], GoogleMapsCircle.prototype, "getZIndex", null);
8674 __decorate$45([
8675 CordovaInstance({ sync: true })
8676 ], GoogleMapsCircle.prototype, "remove", null);
8677 __decorate$45([
8678 CordovaInstance({ sync: true })
8679 ], GoogleMapsCircle.prototype, "setCenter", null);
8680 __decorate$45([
8681 CordovaInstance({ sync: true })
8682 ], GoogleMapsCircle.prototype, "setFillColor", null);
8683 __decorate$45([
8684 CordovaInstance({ sync: true })
8685 ], GoogleMapsCircle.prototype, "setStrokeColor", null);
8686 __decorate$45([
8687 CordovaInstance({ sync: true })
8688 ], GoogleMapsCircle.prototype, "setStrokeWidth", null);
8689 __decorate$45([
8690 CordovaInstance({ sync: true })
8691 ], GoogleMapsCircle.prototype, "setVisible", null);
8692 __decorate$45([
8693 CordovaInstance({ sync: true })
8694 ], GoogleMapsCircle.prototype, "setZIndex", null);
8695 __decorate$45([
8696 CordovaInstance({ sync: true })
8697 ], GoogleMapsCircle.prototype, "setRadius", null);
8698 __decorate$45([
8699 CordovaInstance({ sync: true })
8700 ], GoogleMapsCircle.prototype, "getMap", null);
8701 return GoogleMapsCircle;
8702}());
8703/**
8704 * @private
8705 */
8706var GoogleMapsPolyline = (function () {
8707 function GoogleMapsPolyline(_objectInstance) {
8708 this._objectInstance = _objectInstance;
8709 }
8710 GoogleMapsPolyline.prototype.addEventListener = function (event) {
8711 var _this = this;
8712 return new Observable_2(function (observer) {
8713 _this._objectInstance.addEventListener(event, observer.next.bind(observer));
8714 return function () { return _this._objectInstance.removeEventListener(event, observer.next.bind(observer)); };
8715 });
8716 };
8717 GoogleMapsPolyline.prototype.getPoints = function () {
8718 return;
8719 };
8720 GoogleMapsPolyline.prototype.getCOlor = function () {
8721 return;
8722 };
8723 GoogleMapsPolyline.prototype.getWidth = function () {
8724 return;
8725 };
8726 GoogleMapsPolyline.prototype.getGeodesic = function () {
8727 return;
8728 };
8729 GoogleMapsPolyline.prototype.getZIndex = function () {
8730 return;
8731 };
8732 GoogleMapsPolyline.prototype.remove = function () {
8733 };
8734 GoogleMapsPolyline.prototype.setPoints = function (points) {
8735 };
8736 GoogleMapsPolyline.prototype.setColor = function (color) {
8737 };
8738 GoogleMapsPolyline.prototype.setWidth = function (width) {
8739 };
8740 GoogleMapsPolyline.prototype.setVisible = function (visible) {
8741 };
8742 GoogleMapsPolyline.prototype.setZIndex = function (zIndex) {
8743 };
8744 GoogleMapsPolyline.prototype.setGeoDesic = function (geoDesic) {
8745 };
8746 GoogleMapsPolyline.prototype.getMap = function () {
8747 return;
8748 };
8749 __decorate$45([
8750 CordovaInstance({ sync: true })
8751 ], GoogleMapsPolyline.prototype, "getPoints", null);
8752 __decorate$45([
8753 CordovaInstance({ sync: true })
8754 ], GoogleMapsPolyline.prototype, "getCOlor", null);
8755 __decorate$45([
8756 CordovaInstance({ sync: true })
8757 ], GoogleMapsPolyline.prototype, "getWidth", null);
8758 __decorate$45([
8759 CordovaInstance({ sync: true })
8760 ], GoogleMapsPolyline.prototype, "getGeodesic", null);
8761 __decorate$45([
8762 CordovaInstance({ sync: true })
8763 ], GoogleMapsPolyline.prototype, "getZIndex", null);
8764 __decorate$45([
8765 CordovaInstance({ sync: true })
8766 ], GoogleMapsPolyline.prototype, "remove", null);
8767 __decorate$45([
8768 CordovaInstance({ sync: true })
8769 ], GoogleMapsPolyline.prototype, "setPoints", null);
8770 __decorate$45([
8771 CordovaInstance({ sync: true })
8772 ], GoogleMapsPolyline.prototype, "setColor", null);
8773 __decorate$45([
8774 CordovaInstance({ sync: true })
8775 ], GoogleMapsPolyline.prototype, "setWidth", null);
8776 __decorate$45([
8777 CordovaInstance({ sync: true })
8778 ], GoogleMapsPolyline.prototype, "setVisible", null);
8779 __decorate$45([
8780 CordovaInstance({ sync: true })
8781 ], GoogleMapsPolyline.prototype, "setZIndex", null);
8782 __decorate$45([
8783 CordovaInstance({ sync: true })
8784 ], GoogleMapsPolyline.prototype, "setGeoDesic", null);
8785 __decorate$45([
8786 CordovaInstance({ sync: true })
8787 ], GoogleMapsPolyline.prototype, "getMap", null);
8788 return GoogleMapsPolyline;
8789}());
8790/**
8791 * @private
8792 */
8793var GoogleMapsPolygon = (function () {
8794 function GoogleMapsPolygon(_objectInstance) {
8795 this._objectInstance = _objectInstance;
8796 }
8797 GoogleMapsPolygon.prototype.addEventListener = function (event) {
8798 var _this = this;
8799 return new Observable_2(function (observer) {
8800 _this._objectInstance.addEventListener(event, observer.next.bind(observer));
8801 return function () { return _this._objectInstance.removeEventListener(event, observer.next.bind(observer)); };
8802 });
8803 };
8804 GoogleMapsPolygon.prototype.getPoints = function () {
8805 return;
8806 };
8807 GoogleMapsPolygon.prototype.getStrokeColor = function () {
8808 return;
8809 };
8810 GoogleMapsPolygon.prototype.getFillColor = function () {
8811 return;
8812 };
8813 GoogleMapsPolygon.prototype.getStrokeWidth = function () {
8814 return;
8815 };
8816 GoogleMapsPolygon.prototype.getGeodesic = function () {
8817 return;
8818 };
8819 GoogleMapsPolygon.prototype.getVisible = function () {
8820 return;
8821 };
8822 GoogleMapsPolygon.prototype.getZIndex = function () {
8823 return;
8824 };
8825 GoogleMapsPolygon.prototype.remove = function () {
8826 };
8827 GoogleMapsPolygon.prototype.setPoints = function (points) {
8828 };
8829 GoogleMapsPolygon.prototype.setStrokeColor = function (strokeColor) {
8830 };
8831 GoogleMapsPolygon.prototype.setFillColor = function (fillColor) {
8832 };
8833 GoogleMapsPolygon.prototype.setStrokeWidth = function (strokeWidth) {
8834 };
8835 GoogleMapsPolygon.prototype.setVisible = function (visible) {
8836 };
8837 GoogleMapsPolygon.prototype.setZIndex = function (zIndex) {
8838 };
8839 GoogleMapsPolygon.prototype.setGeodesic = function (geodesic) {
8840 };
8841 __decorate$45([
8842 CordovaInstance({ sync: true })
8843 ], GoogleMapsPolygon.prototype, "getPoints", null);
8844 __decorate$45([
8845 CordovaInstance({ sync: true })
8846 ], GoogleMapsPolygon.prototype, "getStrokeColor", null);
8847 __decorate$45([
8848 CordovaInstance({ sync: true })
8849 ], GoogleMapsPolygon.prototype, "getFillColor", null);
8850 __decorate$45([
8851 CordovaInstance({ sync: true })
8852 ], GoogleMapsPolygon.prototype, "getStrokeWidth", null);
8853 __decorate$45([
8854 CordovaInstance({ sync: true })
8855 ], GoogleMapsPolygon.prototype, "getGeodesic", null);
8856 __decorate$45([
8857 CordovaInstance({ sync: true })
8858 ], GoogleMapsPolygon.prototype, "getVisible", null);
8859 __decorate$45([
8860 CordovaInstance({ sync: true })
8861 ], GoogleMapsPolygon.prototype, "getZIndex", null);
8862 __decorate$45([
8863 CordovaInstance({ sync: true })
8864 ], GoogleMapsPolygon.prototype, "remove", null);
8865 __decorate$45([
8866 CordovaInstance({ sync: true })
8867 ], GoogleMapsPolygon.prototype, "setPoints", null);
8868 __decorate$45([
8869 CordovaInstance({ sync: true })
8870 ], GoogleMapsPolygon.prototype, "setStrokeColor", null);
8871 __decorate$45([
8872 CordovaInstance({ sync: true })
8873 ], GoogleMapsPolygon.prototype, "setFillColor", null);
8874 __decorate$45([
8875 CordovaInstance({ sync: true })
8876 ], GoogleMapsPolygon.prototype, "setStrokeWidth", null);
8877 __decorate$45([
8878 CordovaInstance({ sync: true })
8879 ], GoogleMapsPolygon.prototype, "setVisible", null);
8880 __decorate$45([
8881 CordovaInstance({ sync: true })
8882 ], GoogleMapsPolygon.prototype, "setZIndex", null);
8883 __decorate$45([
8884 CordovaInstance({ sync: true })
8885 ], GoogleMapsPolygon.prototype, "setGeodesic", null);
8886 return GoogleMapsPolygon;
8887}());
8888/**
8889 * @private
8890 */
8891var GoogleMapsTileOverlay = (function () {
8892 function GoogleMapsTileOverlay(_objectInstance) {
8893 this._objectInstance = _objectInstance;
8894 }
8895 GoogleMapsTileOverlay.prototype.getVisible = function () {
8896 return;
8897 };
8898 GoogleMapsTileOverlay.prototype.setVisible = function (visible) {
8899 };
8900 GoogleMapsTileOverlay.prototype.getFadeIn = function () {
8901 return;
8902 };
8903 GoogleMapsTileOverlay.prototype.setFadeIn = function (fadeIn) {
8904 };
8905 GoogleMapsTileOverlay.prototype.getZIndex = function () {
8906 return;
8907 };
8908 GoogleMapsTileOverlay.prototype.setZIndex = function (zIndex) {
8909 };
8910 GoogleMapsTileOverlay.prototype.getOpacity = function () {
8911 return;
8912 };
8913 GoogleMapsTileOverlay.prototype.setOpacity = function (opacity) {
8914 };
8915 GoogleMapsTileOverlay.prototype.clearTileCache = function () {
8916 };
8917 GoogleMapsTileOverlay.prototype.remove = function () {
8918 };
8919 __decorate$45([
8920 CordovaInstance({ sync: true })
8921 ], GoogleMapsTileOverlay.prototype, "getVisible", null);
8922 __decorate$45([
8923 CordovaInstance({ sync: true })
8924 ], GoogleMapsTileOverlay.prototype, "setVisible", null);
8925 __decorate$45([
8926 CordovaInstance({ sync: true })
8927 ], GoogleMapsTileOverlay.prototype, "getFadeIn", null);
8928 __decorate$45([
8929 CordovaInstance({ sync: true })
8930 ], GoogleMapsTileOverlay.prototype, "setFadeIn", null);
8931 __decorate$45([
8932 CordovaInstance({ sync: true })
8933 ], GoogleMapsTileOverlay.prototype, "getZIndex", null);
8934 __decorate$45([
8935 CordovaInstance({ sync: true })
8936 ], GoogleMapsTileOverlay.prototype, "setZIndex", null);
8937 __decorate$45([
8938 CordovaInstance({ sync: true })
8939 ], GoogleMapsTileOverlay.prototype, "getOpacity", null);
8940 __decorate$45([
8941 CordovaInstance({ sync: true })
8942 ], GoogleMapsTileOverlay.prototype, "setOpacity", null);
8943 __decorate$45([
8944 CordovaInstance({ sync: true })
8945 ], GoogleMapsTileOverlay.prototype, "clearTileCache", null);
8946 __decorate$45([
8947 CordovaInstance({ sync: true })
8948 ], GoogleMapsTileOverlay.prototype, "remove", null);
8949 return GoogleMapsTileOverlay;
8950}());
8951/**
8952 * @private
8953 */
8954var GoogleMapsGroundOverlay = (function () {
8955 function GoogleMapsGroundOverlay(_objectInstance) {
8956 this._objectInstance = _objectInstance;
8957 }
8958 GoogleMapsGroundOverlay.prototype.setBearing = function (bearing) {
8959 };
8960 GoogleMapsGroundOverlay.prototype.getBearing = function () {
8961 return;
8962 };
8963 GoogleMapsGroundOverlay.prototype.setOpacity = function (opacity) {
8964 };
8965 GoogleMapsGroundOverlay.prototype.getOpacity = function () {
8966 return;
8967 };
8968 GoogleMapsGroundOverlay.prototype.setVisible = function (visible) {
8969 };
8970 GoogleMapsGroundOverlay.prototype.getVisible = function () {
8971 return;
8972 };
8973 GoogleMapsGroundOverlay.prototype.setImage = function (image) {
8974 };
8975
8976 GoogleMapsGroundOverlay.prototype.remove = function () {
8977 };
8978 __decorate$45([
8979 CordovaInstance({ sync: true })
8980 ], GoogleMapsGroundOverlay.prototype, "setBearing", null);
8981 __decorate$45([
8982 CordovaInstance({ sync: true })
8983 ], GoogleMapsGroundOverlay.prototype, "getBearing", null);
8984 __decorate$45([
8985 CordovaInstance({ sync: true })
8986 ], GoogleMapsGroundOverlay.prototype, "setOpacity", null);
8987 __decorate$45([
8988 CordovaInstance({ sync: true })
8989 ], GoogleMapsGroundOverlay.prototype, "getOpacity", null);
8990 __decorate$45([
8991 CordovaInstance({ sync: true })
8992 ], GoogleMapsGroundOverlay.prototype, "setVisible", null);
8993 __decorate$45([
8994 CordovaInstance({ sync: true })
8995 ], GoogleMapsGroundOverlay.prototype, "getVisible", null);
8996 __decorate$45([
8997 CordovaInstance({ sync: true })
8998 ], GoogleMapsGroundOverlay.prototype, "setImage", null);
8999 __decorate$45([
9000 CordovaInstance({ sync: true })
9001 ], GoogleMapsGroundOverlay.prototype, "remove", null);
9002 return GoogleMapsGroundOverlay;
9003}());
9004/**
9005 * @private
9006 */
9007var GoogleMapsKmlOverlay = (function () {
9008 function GoogleMapsKmlOverlay(_objectInstance) {
9009 this._objectInstance = _objectInstance;
9010 }
9011 GoogleMapsKmlOverlay.prototype.remove = function () {
9012 };
9013 GoogleMapsKmlOverlay.prototype.getOverlays = function () {
9014 return;
9015 };
9016 __decorate$45([
9017 CordovaInstance({ sync: true })
9018 ], GoogleMapsKmlOverlay.prototype, "remove", null);
9019 __decorate$45([
9020 CordovaInstance({ sync: true })
9021 ], GoogleMapsKmlOverlay.prototype, "getOverlays", null);
9022 return GoogleMapsKmlOverlay;
9023}());
9024/**
9025 * @private
9026 */
9027var GoogleMapsLatLngBounds = (function () {
9028 function GoogleMapsLatLngBounds(southwestOrArrayOfLatLng, northeast) {
9029 this.southwestOrArrayOfLatLng = southwestOrArrayOfLatLng;
9030 this.northeast = northeast;
9031 var args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;
9032 this._objectInstance = new plugin.google.maps.LatLngBounds(args);
9033 }
9034 GoogleMapsLatLngBounds.prototype.toString = function () {
9035 return;
9036 };
9037 GoogleMapsLatLngBounds.prototype.toUrlValue = function (precision) {
9038 return;
9039 };
9040 GoogleMapsLatLngBounds.prototype.extend = function (LatLng) {
9041 };
9042 GoogleMapsLatLngBounds.prototype.contains = function (LatLng) {
9043 return;
9044 };
9045 GoogleMapsLatLngBounds.prototype.getCenter = function () {
9046 return;
9047 };
9048 __decorate$45([
9049 CordovaInstance({ sync: true })
9050 ], GoogleMapsLatLngBounds.prototype, "toString", null);
9051 __decorate$45([
9052 CordovaInstance({ sync: true })
9053 ], GoogleMapsLatLngBounds.prototype, "toUrlValue", null);
9054 __decorate$45([
9055 CordovaInstance({ sync: true })
9056 ], GoogleMapsLatLngBounds.prototype, "extend", null);
9057 __decorate$45([
9058 CordovaInstance({ sync: true })
9059 ], GoogleMapsLatLngBounds.prototype, "contains", null);
9060 __decorate$45([
9061 CordovaInstance({ sync: true })
9062 ], GoogleMapsLatLngBounds.prototype, "getCenter", null);
9063 return GoogleMapsLatLngBounds;
9064}());
9065/**
9066 * @private
9067 */
9068var GoogleMapsLatLng = (function () {
9069 function GoogleMapsLatLng(lat, lng) {
9070 this.lat = lat;
9071 this.lng = lng;
9072 this._objectInstance = new plugin.google.maps.LatLng(lat, lng);
9073 }
9074 GoogleMapsLatLng.prototype.equals = function (other) {
9075 return this.lat === other.lat && this.lng === other.lng;
9076 };
9077 GoogleMapsLatLng.prototype.toString = function () {
9078 return;
9079 };
9080 GoogleMapsLatLng.prototype.toUrlValue = function (precision) {
9081 precision = precision || 6;
9082 return this.lat.toFixed(precision) + ',' + this.lng.toFixed(precision);
9083 };
9084 __decorate$45([
9085 CordovaInstance({ sync: true })
9086 ], GoogleMapsLatLng.prototype, "toString", null);
9087 return GoogleMapsLatLng;
9088}());
9089/**
9090 * @private
9091 */
9092
9093var __decorate$46 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
9094 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9095 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9096 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;
9097 return c > 3 && r && Object.defineProperty(target, key, r), r;
9098};
9099/**
9100 * @name Google Analytics
9101 * @description
9102 * This plugin connects to Google's native Universal Analytics SDK
9103 * Prerequisites:
9104 * - A Cordova 3.0+ project for iOS and/or Android
9105 * - A Mobile App property through the Google Analytics Admin Console
9106 * - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html)
9107 */
9108var GoogleAnalytics = (function () {
9109 function GoogleAnalytics() {
9110 }
9111 /**
9112 * In your 'deviceready' handler, set up your Analytics tracker.
9113 * https://developers.google.com/analytics/devguides/collection/analyticsjs/
9114 * @param {string} id Your Google Analytics Mobile App property
9115 */
9116 GoogleAnalytics.startTrackerWithId = function (id) { return; };
9117 /**
9118 * Track a screen
9119 * https://developers.google.com/analytics/devguides/collection/analyticsjs/screens
9120 *
9121 * @param {string} title Screen title
9122 * @param {string} campaignUrl Campaign url for measuring referrals
9123 */
9124 GoogleAnalytics.trackView = function (title, campaignUrl) { return; };
9125 /**
9126 * Track an event
9127 * https://developers.google.com/analytics/devguides/collection/analyticsjs/events
9128 * @param {string} category
9129 * @param {string} action
9130 * @param {string} label
9131 * @param {number} value
9132 */
9133 GoogleAnalytics.trackEvent = function (category, action, label, value) { return; };
9134 /**
9135 * Track an exception
9136 * @param {string} description
9137 * @param {boolean} fatal
9138 */
9139 GoogleAnalytics.trackException = function (description, fatal) { return; };
9140 /**
9141 * Track User Timing (App Speed)
9142 * @param {string} category
9143 * @param {number} intervalInMilliseconds
9144 * @param {string} variable
9145 * @param {string} label
9146 */
9147 GoogleAnalytics.trackTiming = function (category, intervalInMilliseconds, variable, label) { return; };
9148 /**
9149 * Add a Transaction (Ecommerce)
9150 * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans
9151 * @param {string} id
9152 * @param {string} affiliation
9153 * @param {number} revenue
9154 * @param {number} tax
9155 * @param {number} shipping
9156 * @param {string} currencyCode
9157 */
9158 GoogleAnalytics.addTransaction = function (id, affiliation, revenue, tax, shipping, currencyCode) { return; };
9159 /**
9160 * Add a Transaction Item (Ecommerce)
9161 * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addItem
9162 * @param {string} id
9163 * @param {string} name
9164 * @param {string} sku
9165 * @param {string} category
9166 * @param {number} price
9167 * @param {number} quantity
9168 * @param {string} currencyCode
9169 */
9170 GoogleAnalytics.addTransactionItem = function (id, name, sku, category, price, quantity, currencyCode) { return; };
9171 /**
9172 * Add a Custom Dimension
9173 * https://developers.google.com/analytics/devguides/platform/customdimsmets
9174 * @param {string} key
9175 * @param {string} value
9176 */
9177 GoogleAnalytics.addCustomDimension = function (key, value) { return; };
9178 /**
9179 * Set a UserId
9180 * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id
9181 * @param {string} id
9182 */
9183 GoogleAnalytics.setUserId = function (id) { };
9184 /**
9185 * Sets the app version
9186 * @param appVersion
9187 */
9188 GoogleAnalytics.setAppVersion = function (appVersion) { };
9189 /**
9190 * Set a anonymize Ip address
9191 * @param anonymize
9192 */
9193 GoogleAnalytics.setAnonymizeIp = function (anonymize) { };
9194 /**
9195 * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more
9196 * @param allow
9197 */
9198 GoogleAnalytics.setAllowIDFACollection = function (allow) { };
9199 /**
9200 * Enable verbose logging
9201 */
9202 GoogleAnalytics.debugMode = function () { return; };
9203 /**
9204 * Enable/disable automatic reporting of uncaught exceptions
9205 * @param {boolean} shouldEnable
9206 */
9207 GoogleAnalytics.enableUncaughtExceptionReporting = function (shouldEnable) { return; };
9208 __decorate$46([
9209 Cordova()
9210 ], GoogleAnalytics, "startTrackerWithId", null);
9211 __decorate$46([
9212 Cordova()
9213 ], GoogleAnalytics, "trackView", null);
9214 __decorate$46([
9215 Cordova()
9216 ], GoogleAnalytics, "trackEvent", null);
9217 __decorate$46([
9218 Cordova()
9219 ], GoogleAnalytics, "trackException", null);
9220 __decorate$46([
9221 Cordova()
9222 ], GoogleAnalytics, "trackTiming", null);
9223 __decorate$46([
9224 Cordova()
9225 ], GoogleAnalytics, "addTransaction", null);
9226 __decorate$46([
9227 Cordova()
9228 ], GoogleAnalytics, "addTransactionItem", null);
9229 __decorate$46([
9230 Cordova()
9231 ], GoogleAnalytics, "addCustomDimension", null);
9232 __decorate$46([
9233 Cordova({ sync: true })
9234 ], GoogleAnalytics, "setUserId", null);
9235 __decorate$46([
9236 Cordova({ sync: true })
9237 ], GoogleAnalytics, "setAppVersion", null);
9238 __decorate$46([
9239 Cordova({ sync: true })
9240 ], GoogleAnalytics, "setAnonymizeIp", null);
9241 __decorate$46([
9242 Cordova({ sync: true })
9243 ], GoogleAnalytics, "setAllowIDFACollection", null);
9244 __decorate$46([
9245 Cordova({ sync: true })
9246 ], GoogleAnalytics, "debugMode", null);
9247 __decorate$46([
9248 Cordova()
9249 ], GoogleAnalytics, "enableUncaughtExceptionReporting", null);
9250 GoogleAnalytics = __decorate$46([
9251 Plugin({
9252 plugin: 'cordova-plugin-google-analytics',
9253 pluginRef: 'analytics',
9254 repo: 'https://github.com/danwilson/google-analytics-plugin',
9255 platforms: ['Android', 'iOS']
9256 })
9257 ], GoogleAnalytics);
9258 return GoogleAnalytics;
9259}());
9260
9261var __decorate$47 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
9262 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9263 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9264 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;
9265 return c > 3 && r && Object.defineProperty(target, key, r), r;
9266};
9267/**
9268 * @name Hotspot
9269 * @description
9270 * @usage
9271 * ```typescript
9272 * import { Hotspot, Network } from 'ionic-native';
9273 *
9274 *
9275 * Hotspot.scanWifi().then((networks: Array<Network>) => {
9276 * console.log(networks);
9277 * });
9278 *
9279 * ```
9280 */
9281var Hotspot = (function () {
9282 function Hotspot() {
9283 }
9284 Hotspot.isAvailable = function () { return; };
9285 Hotspot.toggleWifi = function () { return; };
9286 /**
9287 * Configures and starts hotspot with SSID and Password
9288 *
9289 * @param {string} SSID - SSID of your new Access Point
9290 * @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
9291 * @param {string} password - password for your new Access Point
9292 *
9293 * @return {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
9294 */
9295 Hotspot.createHotspot = function (ssid, mode, password) { return; };
9296 /**
9297 * Turns on Access Point
9298 *
9299 * @return {Promise<boolean>} - true if AP is started
9300 */
9301 Hotspot.startHotspot = function () { return; };
9302 /**
9303 * Configures hotspot with SSID and Password
9304 *
9305 * @param {string} SSID - SSID of your new Access Point
9306 * @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
9307 * @param {string} password - password for your new Access Point
9308 *
9309 * @return {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
9310 */
9311 Hotspot.configureHotspot = function (ssid, mode, password) { return; };
9312 /**
9313 * Turns off Access Point
9314 *
9315 * @return {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
9316 */
9317 Hotspot.stopHotspot = function () { return; };
9318 /**
9319 * Checks if hotspot is enabled
9320 *
9321 * @return {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
9322 */
9323 Hotspot.isHotspotEnabled = function () { return; };
9324 Hotspot.getAllHotspotDevices = function () { return; };
9325 /**
9326 * Connect to a WiFi network
9327 *
9328 * @param {string} ssid
9329 * SSID to connect
9330 * @param {string} password
9331 * password to use
9332 *
9333 * @return {Promise<void>}
9334 * Promise that connection to the WiFi network was successfull, rejected if unsuccessful
9335 */
9336 Hotspot.connectToWifi = function (ssid, password) { return; };
9337 /**
9338 * Connect to a WiFi network
9339 *
9340 * @param {string} ssid
9341 * SSID to connect
9342 * @param {string} password
9343 * Password to use
9344 * @param {string} authentication
9345 * Authentication modes to use (LEAP, SHARED, OPEN)
9346 * @param {string[]} encryption
9347 * Encryption modes to use (CCMP, TKIP, WEP104, WEP40)
9348 *
9349 * @return {Promise<void>}
9350 * Promise that connection to the WiFi network was successfull, rejected if unsuccessful
9351 */
9352 Hotspot.connectToWifiAuthEncrypt = function (ssid, password, authentication, encryption) { return; };
9353 /**
9354 * Add a WiFi network
9355 *
9356 * @param {string} ssid
9357 * SSID of network
9358 * @param {string} mode
9359 * Authentication mode of (Open, WEP, WPA, WPA_PSK)
9360 * @param {string} password
9361 * Password for network
9362 *
9363 * @return {Promise<void>}
9364 * Promise that adding the WiFi network was successfull, rejected if unsuccessful
9365 */
9366 Hotspot.addWifiNetwork = function (ssid, mode, password) { return; };
9367 /**
9368 * Remove a WiFi network
9369 *
9370 * @param {string} ssid
9371 * SSID of network
9372 *
9373 * @return {Promise<void>}
9374 * Promise that removing the WiFi network was successfull, rejected if unsuccessful
9375 */
9376 Hotspot.removeWifiNetwork = function (ssid) { return; };
9377 Hotspot.isConnectedToInternet = function () { return; };
9378 Hotspot.isConnectedToInternetViaWifi = function () { return; };
9379 Hotspot.isWifiOn = function () { return; };
9380 Hotspot.isWifiSupported = function () { return; };
9381 Hotspot.isWifiDirectSupported = function () { return; };
9382 Hotspot.scanWifi = function () { return; };
9383 Hotspot.scanWifiByLevel = function () { return; };
9384 Hotspot.startWifiPeriodicallyScan = function (interval, duration) { return; };
9385 Hotspot.stopWifiPeriodicallyScan = function () { return; };
9386 Hotspot.getNetConfig = function () { return; };
9387 Hotspot.getConnectionInfo = function () { return; };
9388 Hotspot.pingHost = function (ip) { return; };
9389 /**
9390 * Gets MAC Address associated with IP Address from ARP File
9391 *
9392 * @param {string} ip - IP Address that you want the MAC Address of
9393 *
9394 * @return {Promise<string>} - A Promise for the MAC Address
9395 */
9396 Hotspot.getMacAddressOfHost = function (ip) { return; };
9397 /**
9398 * Checks if IP is live using DNS
9399 *
9400 * @param {string} ip - IP Address you want to test
9401 *
9402 * @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
9403 */
9404 Hotspot.isDnsLive = function (ip) { return; };
9405 /**
9406 * Checks if IP is live using socket And PORT
9407 *
9408 * @param {string} ip - IP Address you want to test
9409 *
9410 * @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
9411 */
9412 Hotspot.isPortLive = function (ip) { return; };
9413 /**
9414 * Checks if device is rooted
9415 *
9416 * @return {Promise<boolean>} - A Promise for whether the device is rooted
9417 */
9418 Hotspot.isRooted = function () { return; };
9419 __decorate$47([
9420 Cordova()
9421 ], Hotspot, "isAvailable", null);
9422 __decorate$47([
9423 Cordova()
9424 ], Hotspot, "toggleWifi", null);
9425 __decorate$47([
9426 Cordova()
9427 ], Hotspot, "createHotspot", null);
9428 __decorate$47([
9429 Cordova()
9430 ], Hotspot, "startHotspot", null);
9431 __decorate$47([
9432 Cordova()
9433 ], Hotspot, "configureHotspot", null);
9434 __decorate$47([
9435 Cordova()
9436 ], Hotspot, "stopHotspot", null);
9437 __decorate$47([
9438 Cordova()
9439 ], Hotspot, "isHotspotEnabled", null);
9440 __decorate$47([
9441 Cordova()
9442 ], Hotspot, "getAllHotspotDevices", null);
9443 __decorate$47([
9444 Cordova()
9445 ], Hotspot, "connectToWifi", null);
9446 __decorate$47([
9447 Cordova()
9448 ], Hotspot, "connectToWifiAuthEncrypt", null);
9449 __decorate$47([
9450 Cordova()
9451 ], Hotspot, "addWifiNetwork", null);
9452 __decorate$47([
9453 Cordova()
9454 ], Hotspot, "removeWifiNetwork", null);
9455 __decorate$47([
9456 Cordova()
9457 ], Hotspot, "isConnectedToInternet", null);
9458 __decorate$47([
9459 Cordova()
9460 ], Hotspot, "isConnectedToInternetViaWifi", null);
9461 __decorate$47([
9462 Cordova()
9463 ], Hotspot, "isWifiOn", null);
9464 __decorate$47([
9465 Cordova()
9466 ], Hotspot, "isWifiSupported", null);
9467 __decorate$47([
9468 Cordova()
9469 ], Hotspot, "isWifiDirectSupported", null);
9470 __decorate$47([
9471 Cordova()
9472 ], Hotspot, "scanWifi", null);
9473 __decorate$47([
9474 Cordova()
9475 ], Hotspot, "scanWifiByLevel", null);
9476 __decorate$47([
9477 Cordova()
9478 ], Hotspot, "startWifiPeriodicallyScan", null);
9479 __decorate$47([
9480 Cordova()
9481 ], Hotspot, "stopWifiPeriodicallyScan", null);
9482 __decorate$47([
9483 Cordova()
9484 ], Hotspot, "getNetConfig", null);
9485 __decorate$47([
9486 Cordova()
9487 ], Hotspot, "getConnectionInfo", null);
9488 __decorate$47([
9489 Cordova()
9490 ], Hotspot, "pingHost", null);
9491 __decorate$47([
9492 Cordova()
9493 ], Hotspot, "getMacAddressOfHost", null);
9494 __decorate$47([
9495 Cordova()
9496 ], Hotspot, "isDnsLive", null);
9497 __decorate$47([
9498 Cordova()
9499 ], Hotspot, "isPortLive", null);
9500 __decorate$47([
9501 Cordova()
9502 ], Hotspot, "isRooted", null);
9503 Hotspot = __decorate$47([
9504 Plugin({
9505 plugin: 'cordova-plugin-hotspot',
9506 pluginRef: 'cordova.plugins.hotspot',
9507 repo: 'https://github.com/hypery2k/cordova-hotspot-plugin',
9508 platforms: ['Android']
9509 })
9510 ], Hotspot);
9511 return Hotspot;
9512}());
9513
9514var __decorate$48 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
9515 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9516 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9517 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;
9518 return c > 3 && r && Object.defineProperty(target, key, r), r;
9519};
9520/**
9521 * @name Httpd
9522 * @description
9523 * Embedded httpd for Cordova apps. Light weight HTTP server.
9524 * @usage
9525 * ```typescript
9526 * import {Httpd, HttpdOptions} from 'ionic-native';
9527 *
9528 * let options: HttpdOptions = {
9529 * www_root: 'httpd_root', // relative path to app's www directory
9530 * port: 80,
9531 * localhost_only: false
9532 * };
9533 *
9534 * Httpd.startServer(options).subscribe((data) => {
9535 * console.log('Server is live');
9536 * });
9537 *
9538 * ```
9539 */
9540var Httpd = (function () {
9541 function Httpd() {
9542 }
9543 /**
9544 * Starts a web server.
9545 * @returns {Observable<string>} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.
9546 * @param options {HttpdOptions}
9547 */
9548 Httpd.startServer = function (options) { return; };
9549 /**
9550 * Gets the URL of the running server
9551 * @returns {Promise<string>} Returns a promise that resolves with the URL of the web server.
9552 */
9553 Httpd.getUrl = function () { return; };
9554 /**
9555 * Get the local path of the running webserver
9556 * @returns {Promise<string>} Returns a promise that resolves with the local path of the web server.
9557 */
9558 Httpd.getLocalPath = function () { return; };
9559 __decorate$48([
9560 Cordova({
9561 observable: true,
9562 clearFunction: 'stopServer'
9563 })
9564 ], Httpd, "startServer", null);
9565 __decorate$48([
9566 Cordova()
9567 ], Httpd, "getUrl", null);
9568 __decorate$48([
9569 Cordova()
9570 ], Httpd, "getLocalPath", null);
9571 Httpd = __decorate$48([
9572 Plugin({
9573 plugin: 'https://github.com/floatinghotpot/cordova-httpd.git',
9574 pluginRef: 'cordova.plugins.CorHttpd',
9575 repo: 'https://github.com/floatinghotpot/cordova-httpd',
9576 platforms: ['iOS', 'Android']
9577 })
9578 ], Httpd);
9579 return Httpd;
9580}());
9581
9582var __decorate$49 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
9583 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9584 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9585 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;
9586 return c > 3 && r && Object.defineProperty(target, key, r), r;
9587};
9588/**
9589 * @name IBeacon
9590 * @description
9591 * This plugin provides functions for working with iBeacons.
9592 *
9593 * The plugin's API closely mimics the one exposed through the [CLLocationManager](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html) introduced in iOS 7.
9594 *
9595 * @usage
9596 *
9597 * ```typescript
9598 * import { IBeacon } from 'ionic-native';
9599 *
9600 *
9601 * // Request permission to use location on iOS
9602 * IBeacon.requestAlwaysAuthorization();
9603 * // create a new delegate and register it with the native layer
9604 * let delegate = IBeacon.Delegate();
9605 *
9606 * // Subscribe to some of the delegate's event handlers
9607 * delegate.didRangeBeaconsInRegion()
9608 * .subscribe(
9609 * data => console.log('didRangeBeaconsInRegion: ', data),
9610 * error => console.error();
9611 * );
9612 * delegate.didStartMonitoringForRegion()
9613 * .subscribe(
9614 * data => console.log('didStartMonitoringForRegion: ', data),
9615 * error => console.error();
9616 * );
9617 * delegate.didEnterRegion()
9618 * .subscribe(
9619 * data => {
9620 * console.log('didEnterRegion: ', data);
9621 * }
9622 * );
9623 *
9624 * let beaconRegion = IBeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E');
9625 *
9626 * IBeacon.startMonitoringForRegion(beaconRegion)
9627 * .then(
9628 * () => console.log('Native layer recieved the request to monitoring'),
9629 * error => console.error('Native layer failed to begin monitoring: ', error)
9630 * );
9631 * ```
9632 */
9633var IBeacon = (function () {
9634 function IBeacon() {
9635 }
9636 /**
9637 * Instances of this class are delegates between the {@link LocationManager} and
9638 * the code that consumes the messages generated on in the native layer.
9639 *
9640 * @returns {Delegate} An instance of the type {@type Delegate}.
9641 */
9642 IBeacon.Delegate = function () {
9643 var delegate = new cordova.plugins.locationManager.Delegate();
9644 delegate.didChangeAuthorizationStatus = function (pluginResult) {
9645 return new Observable_2(function (observer) {
9646 var cb = function (data) { return observer.next(data); };
9647 return delegate.didChangeAuthorizationStatus = cb;
9648 });
9649 };
9650 delegate.didDetermineStateForRegion = function (pluginResult) {
9651 return new Observable_2(function (observer) {
9652 var cb = function (data) { return observer.next(data); };
9653 return delegate.didDetermineStateForRegion = cb;
9654 });
9655 };
9656 delegate.didEnterRegion = function (pluginResult) {
9657 return new Observable_2(function (observer) {
9658 var cb = function (data) { return observer.next(data); };
9659 return delegate.didEnterRegion = cb;
9660 });
9661 };
9662 delegate.didExitRegion = function (pluginResult) {
9663 return new Observable_2(function (observer) {
9664 var cb = function (data) { return observer.next(data); };
9665 return delegate.didExitRegion = cb;
9666 });
9667 };
9668 delegate.didRangeBeaconsInRegion = function (pluginResult) {
9669 return new Observable_2(function (observer) {
9670 var cb = function (data) { return observer.next(data); };
9671 return delegate.didRangeBeaconsInRegion = cb;
9672 });
9673 };
9674 delegate.didStartMonitoringForRegion = function (pluginResult) {
9675 return new Observable_2(function (observer) {
9676 var cb = function (data) { return observer.next(data); };
9677 return delegate.didStartMonitoringForRegion = cb;
9678 });
9679 };
9680 delegate.monitoringDidFailForRegionWithError = function (pluginResult) {
9681 return new Observable_2(function (observer) {
9682 var cb = function (data) { return observer.next(data); };
9683 return delegate.monitoringDidFailForRegionWithError = cb;
9684 });
9685 };
9686 delegate.peripheralManagerDidStartAdvertising = function (pluginResult) {
9687 return new Observable_2(function (observer) {
9688 var cb = function (data) { return observer.next(data); };
9689 return delegate.peripheralManagerDidStartAdvertising = cb;
9690 });
9691 };
9692 delegate.peripheralManagerDidUpdateState = function (pluginResult) {
9693 return new Observable_2(function (observer) {
9694 var cb = function (data) { return observer.next(data); };
9695 return delegate.peripheralManagerDidUpdateState = cb;
9696 });
9697 };
9698 cordova.plugins.locationManager.setDelegate(delegate);
9699 return delegate;
9700 };
9701 /**
9702 * Creates a new BeaconRegion
9703 *
9704 * @param {String} identifier @see {CLRegion}
9705 * @param {String} uuid The proximity ID of the beacon being targeted.
9706 * This value must not be blank nor invalid as a UUID.
9707 * @param {Number} major The major value that you use to identify one or more beacons.
9708 * @param {Number} minor The minor value that you use to identify a specific beacon.
9709 * @param {BOOL} notifyEntryStateOnDisplay
9710 *
9711 * @return Returns the BeaconRegion that was created
9712 */
9713 IBeacon.BeaconRegion = function (identifer, uuid, major, minor, notifyEntryStateOnDisplay) {
9714 return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
9715 };
9716 /**
9717 * @return Returns the Delegate
9718 */
9719 IBeacon.getDelegate = function () { return; };
9720 /**
9721 * @param {Delegate} delegate An instance of a delegate to register with the native layer.
9722 *
9723 * @return Returns the Delegate
9724 */
9725 IBeacon.setDelegate = function (delegate) { return; };
9726 /**
9727 * Signals the native layer that the client side is ready to consume messages.
9728 * Readiness here means that it has a {Delegate} set by the consumer javascript
9729 * code.
9730 *
9731 * The {LocationManager.setDelegate()} will implicitly call this method as well,
9732 * therefore the only case when you have to call this manually is if you don't
9733 * wish to specify a {Delegate} of yours.
9734 *
9735 * The purpose of this signaling mechanism is to make the events work when the
9736 * app is being woken up by the Operating System to give it a chance to handle
9737 * region monitoring events for example.
9738 *
9739 * If you don't set a {Delegate} and don't call this method manually, an error
9740 * message get emitted in the native runtime and the DOM as well after a certain
9741 * period of time.
9742 *
9743 * @return Returns a promise which is resolved as soon as the
9744 * native layer acknowledged the request and started to send events.
9745 */
9746 IBeacon.onDomDelegateReady = function () { return; };
9747 /**
9748 * Determines if bluetooth is switched on, according to the native layer.
9749 * @returns Returns a promise which is resolved with a {Boolean}
9750 * indicating whether bluetooth is active.
9751 */
9752 IBeacon.isBluetoothEnabled = function () { return; };
9753 /**
9754 * Enables Bluetooth using the native Layer. (ANDROID ONLY)
9755 *
9756 * @returns Returns a promise which is resolved when Bluetooth
9757 * could be enabled. If not, the promise will be rejected with an error.
9758 */
9759 IBeacon.enableBluetooth = function () { return; };
9760 /**
9761 * Disables Bluetooth using the native Layer. (ANDROID ONLY)
9762 *
9763 * @returns Returns a promise which is resolved when Bluetooth
9764 * could be enabled. If not, the promise will be rejected with an error.
9765 */
9766 IBeacon.disableBluetooth = function () { return; };
9767 /**
9768 * Start monitoring the specified region.
9769 *
9770 * If a region of the same type with the same identifier is already being
9771 * monitored for this application,
9772 * it will be removed from monitoring. For circular regions, the region
9773 * monitoring service will prioritize
9774 * regions by their size, favoring smaller regions over larger regions.
9775 *
9776 * This is done asynchronously and may not be immediately reflected in monitoredRegions.
9777 *
9778 * @param {Region} region An instance of {Region} which will be monitored
9779 * by the operating system.
9780 *
9781 * @return Returns a promise which is resolved as soon as the
9782 * native layer acknowledged the dispatch of the monitoring request.
9783 */
9784 IBeacon.startMonitoringForRegion = function (region) { return; };
9785 /**
9786 * Stop monitoring the specified region. It is valid to call
9787 * stopMonitoringForRegion: for a region that was registered for monitoring
9788 * with a different location manager object, during this or previous
9789 * launches of your application.
9790 *
9791 * This is done asynchronously and may not be immediately reflected in monitoredRegions.
9792 *
9793 * @param {Region} region An instance of {Region} which will be monitored
9794 * by the operating system.
9795 *
9796 * @return Returns a promise which is resolved as soon as the
9797 * native layer acknowledged the dispatch of the request to stop monitoring.
9798 */
9799 IBeacon.stopMonitoringForRegion = function (region) { return; };
9800 /**
9801 * Request state the for specified region. When result is ready
9802 * didDetermineStateForRegion is triggered. This can be any region,
9803 * also those which is not currently monitored.
9804 *
9805 * This is done asynchronously and may not be immediately reflected in monitoredRegions.
9806 *
9807 * @param {Region} region An instance of {Region} which will be monitored
9808 * by the operating system.
9809 *
9810 * @return Returns a promise which is resolved as soon as the
9811 * native layer acknowledged the dispatch of the request to stop monitoring.
9812 */
9813 IBeacon.requestStateForRegion = function (region) { return; };
9814 /**
9815 * Start ranging the specified beacon region.
9816 *
9817 * If a region of the same type with the same identifier is already being
9818 * monitored for this application, it will be removed from monitoring.
9819 *
9820 * This is done asynchronously and may not be immediately reflected in rangedRegions.
9821 *
9822 * @param {Region} region An instance of {BeaconRegion} which will be monitored
9823 * by the operating system.
9824 *
9825 * @return Returns a promise which is resolved as soon as the
9826 * native layer acknowledged the dispatch of the monitoring request.
9827 */
9828 IBeacon.startRangingBeaconsInRegion = function (region) { return; };
9829 /**
9830 * Stop ranging the specified region. It is valid to call
9831 * stopMonitoringForRegion: for a region that was registered for ranging
9832 * with a different location manager object, during this or previous
9833 * launches of your application.
9834 *
9835 * This is done asynchronously and may not be immediately reflected in rangedRegions.
9836 *
9837 * @param {Region} region An instance of {BeaconRegion} which will be monitored
9838 * by the operating system.
9839 *
9840 * @return Returns a promise which is resolved as soon as the
9841 * native layer acknowledged the dispatch of the request to stop monitoring.
9842 */
9843 IBeacon.stopRangingBeaconsInRegion = function (region) { return; };
9844 /**
9845 * Queries the native layer to determine the current authorization in effect.
9846 *
9847 * @returns Returns a promise which is resolved with the
9848 * requested authorization status.
9849 */
9850 IBeacon.getAuthorizationStatus = function () { return; };
9851 /**
9852 * For iOS 8 and above only. The permission model has changed by Apple in iOS 8, making it necessary for apps to
9853 * explicitly request permissions via methods like these:
9854 * <a href="https://developer.apple.com/library/prerelease/iOS/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/requestWhenInUseAuthorization">requestWhenInUseAuthorization</a>
9855 * <a href="https://developer.apple.com/library/prerelease/iOS/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/requestAlwaysAuthorization">requestAlwaysAuthorization</a>
9856 *
9857 * If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization}
9858 * @returns Returns a promise that is resolved when the request dialog is shown.
9859 */
9860 IBeacon.requestWhenInUseAuthorization = function () { return; };
9861 /**
9862 * See the docuemntation of {@code requestWhenInUseAuthorization} for further details.
9863 *
9864 * @returns Returns a promise which is resolved when the native layer
9865 * shows the request dialog.
9866 */
9867 IBeacon.requestAlwaysAuthorization = function () { return; };
9868 /**
9869 *
9870 * @returns Returns a promise which is resolved with an {Array}
9871 * of {Region} instances that are being monitored by the native layer.
9872 */
9873 IBeacon.getMonitoredRegions = function () { return; };
9874 /**
9875 *
9876 * @returns Returns a promise which is resolved with an {Array}
9877 * of {Region} instances that are being ranged by the native layer.
9878 */
9879 IBeacon.getRangedRegions = function () { return; };
9880 /**
9881 * Determines if ranging is available or not, according to the native layer.
9882 * @returns Returns a promise which is resolved with a {Boolean}
9883 * indicating whether ranging is available or not.
9884 */
9885 IBeacon.isRangingAvailable = function () { return; };
9886 /**
9887 * Determines if region type is supported or not, according to the native layer.
9888 *
9889 * @param {Region} region An instance of {Region} which will be checked
9890 * by the operating system.
9891 *
9892 * @returns Returns a promise which is resolved with a {Boolean}
9893 * indicating whether the region type is supported or not.
9894 */
9895 IBeacon.isMonitoringAvailableForClass = function (region) { return; };
9896 /**
9897 * Start advertising the specified region.
9898 *
9899 * If a region a different identifier is already being advertised for
9900 * this application, it will be replaced with the new identifier.
9901 *
9902 * This call will accept a valid beacon even when no BlueTooth is available,
9903 * and will start when BlueTooth is powered on. See {Delegate.}
9904 *
9905 * @param {Region} region An instance of {Region} which will be advertised
9906 * by the operating system.
9907 * @param {Integer} measuredPower: Optional parameter, if left empty, the device will
9908 * use it's own default value.
9909 *
9910 * @return Returns a promise which is resolved as soon as the
9911 * native layer acknowledged the dispatch of the advertising request.
9912 */
9913 IBeacon.startAdvertising = function (region, measuredPower) { return; };
9914 /**
9915 * Stop advertising as a beacon.
9916 *
9917 * This is done asynchronously and may not be immediately reflected in isAdvertising.
9918 *
9919 * @return Returns a promise which is resolved as soon as the
9920 * native layer acknowledged the dispatch of the request to stop advertising.
9921 */
9922 IBeacon.stopAdvertising = function (region) { return; };
9923 /**
9924 * Determines if advertising is available or not, according to the native layer.
9925 * @returns Returns a promise which is resolved with a {Boolean}
9926 * indicating whether advertising is available or not.
9927 */
9928 IBeacon.isAdvertisingAvailable = function () { return; };
9929 /**
9930 * Determines if advertising is currently active, according to the native layer.
9931 * @returns Returns a promise which is resolved with a {Boolean}
9932 * indicating whether advertising is active.
9933 */
9934 IBeacon.isAdvertising = function () { return; };
9935 /**
9936 * Disables debug logging in the native layer. Use this method if you want
9937 * to prevent this plugin from writing to the device logs.
9938 *
9939 * @returns Returns a promise which is resolved as soon as the
9940 * native layer has set the logging level accordingly.
9941 */
9942 IBeacon.disableDebugLogs = function () { return; };
9943 /**
9944 * Enables the posting of debug notifications in the native layer. Use this method if you want
9945 * to allow the plugin the posting local notifications.
9946 * This can be very helpful when debugging how to apps behave when launched into the background.
9947 *
9948 * @returns Returns a promise which is resolved as soon as the
9949 * native layer has set the flag to enabled.
9950 */
9951 IBeacon.enableDebugNotifications = function () { return; };
9952 /**
9953 * Disables the posting of debug notifications in the native layer. Use this method if you want
9954 * to prevent the plugin from posting local notifications.
9955 *
9956 * @returns Returns a promise which is resolved as soon as the
9957 * native layer has set the flag to disabled.
9958 */
9959 IBeacon.disableDebugNotifications = function () { return; };
9960 /**
9961 * Enables debug logging in the native layer. Use this method if you want
9962 * a debug the inner workings of this plugin.
9963 *
9964 * @returns Returns a promise which is resolved as soon as the
9965 * native layer has set the logging level accordingly.
9966 */
9967 IBeacon.enableDebugLogs = function () { return; };
9968 /**
9969 * Appends the provided [message] to the device logs.
9970 * Note: If debug logging is turned off, this won't do anything.
9971 *
9972 * @param {String} message The message to append to the device logs.
9973 *
9974 * @returns Returns a promise which is resolved with the log
9975 * message received by the native layer for appending. The returned message
9976 * is expected to be equivalent to the one provided in the original call.
9977 */
9978 IBeacon.appendToDeviceLog = function (message) { return; };
9979 __decorate$49([
9980 Cordova()
9981 ], IBeacon, "getDelegate", null);
9982 __decorate$49([
9983 Cordova()
9984 ], IBeacon, "setDelegate", null);
9985 __decorate$49([
9986 Cordova({ otherPromise: true })
9987 ], IBeacon, "onDomDelegateReady", null);
9988 __decorate$49([
9989 Cordova({ otherPromise: true })
9990 ], IBeacon, "isBluetoothEnabled", null);
9991 __decorate$49([
9992 Cordova({ otherPromise: true })
9993 ], IBeacon, "enableBluetooth", null);
9994 __decorate$49([
9995 Cordova({ otherPromise: true })
9996 ], IBeacon, "disableBluetooth", null);
9997 __decorate$49([
9998 Cordova({ otherPromise: true })
9999 ], IBeacon, "startMonitoringForRegion", null);
10000 __decorate$49([
10001 Cordova({ otherPromise: true })
10002 ], IBeacon, "stopMonitoringForRegion", null);
10003 __decorate$49([
10004 Cordova({ otherPromise: true })
10005 ], IBeacon, "requestStateForRegion", null);
10006 __decorate$49([
10007 Cordova({ otherPromise: true })
10008 ], IBeacon, "startRangingBeaconsInRegion", null);
10009 __decorate$49([
10010 Cordova({ otherPromise: true })
10011 ], IBeacon, "stopRangingBeaconsInRegion", null);
10012 __decorate$49([
10013 Cordova({ otherPromise: true })
10014 ], IBeacon, "getAuthorizationStatus", null);
10015 __decorate$49([
10016 Cordova({ otherPromise: true })
10017 ], IBeacon, "requestWhenInUseAuthorization", null);
10018 __decorate$49([
10019 Cordova({ otherPromise: true })
10020 ], IBeacon, "requestAlwaysAuthorization", null);
10021 __decorate$49([
10022 Cordova({ otherPromise: true })
10023 ], IBeacon, "getMonitoredRegions", null);
10024 __decorate$49([
10025 Cordova({ otherPromise: true })
10026 ], IBeacon, "getRangedRegions", null);
10027 __decorate$49([
10028 Cordova({ otherPromise: true })
10029 ], IBeacon, "isRangingAvailable", null);
10030 __decorate$49([
10031 Cordova({ otherPromise: true })
10032 ], IBeacon, "isMonitoringAvailableForClass", null);
10033 __decorate$49([
10034 Cordova({ otherPromise: true })
10035 ], IBeacon, "startAdvertising", null);
10036 __decorate$49([
10037 Cordova({ otherPromise: true })
10038 ], IBeacon, "stopAdvertising", null);
10039 __decorate$49([
10040 Cordova({ otherPromise: true })
10041 ], IBeacon, "isAdvertisingAvailable", null);
10042 __decorate$49([
10043 Cordova({ otherPromise: true })
10044 ], IBeacon, "isAdvertising", null);
10045 __decorate$49([
10046 Cordova({ otherPromise: true })
10047 ], IBeacon, "disableDebugLogs", null);
10048 __decorate$49([
10049 Cordova({ otherPromise: true })
10050 ], IBeacon, "enableDebugNotifications", null);
10051 __decorate$49([
10052 Cordova({ otherPromise: true })
10053 ], IBeacon, "disableDebugNotifications", null);
10054 __decorate$49([
10055 Cordova({ otherPromise: true })
10056 ], IBeacon, "enableDebugLogs", null);
10057 __decorate$49([
10058 Cordova({ otherPromise: true })
10059 ], IBeacon, "appendToDeviceLog", null);
10060 IBeacon = __decorate$49([
10061 Plugin({
10062 plugin: 'cordova-plugin-ibeacon',
10063 pluginRef: 'cordova.plugins.locationManager',
10064 repo: 'https://github.com/petermetz/cordova-plugin-ibeacon',
10065 platforms: ['Android', 'iOS']
10066 })
10067 ], IBeacon);
10068 return IBeacon;
10069}());
10070
10071var __decorate$50 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10072 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10073 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10074 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;
10075 return c > 3 && r && Object.defineProperty(target, key, r), r;
10076};
10077/**
10078 * @name Image Picker
10079 * @description
10080 * Cordova Plugin For Multiple Image Selection
10081 *
10082 * Requires Cordova plugin: `cordova-plugin-image-picker`.
10083 * For more info, please see the https://github.com/wymsee/cordova-imagePicker
10084 *
10085 * @usage
10086 * ```typescript
10087 * import { ImagePicker } from 'ionic-native';
10088 *
10089 *
10090 *
10091 * ImagePicker.getPictures(options).then((results) => {
10092 * for (var i = 0; i < results.length; i++) {
10093 * console.log('Image URI: ' + results[i]);
10094 * }
10095 * }, (err) => { });
10096 * ```
10097 */
10098var ImagePicker = (function () {
10099 function ImagePicker() {
10100 }
10101 /**
10102 * Pick pictures from the library.
10103 * @param {ImagePickerOptions} options
10104 * @return Returns a Promise that resolves the image file URI
10105 * otherwise rejects with an error.
10106 */
10107 ImagePicker.getPictures = function (options) { return; };
10108 __decorate$50([
10109 Cordova({
10110 callbackOrder: 'reverse'
10111 })
10112 ], ImagePicker, "getPictures", null);
10113 ImagePicker = __decorate$50([
10114 Plugin({
10115 plugin: 'cordova-plugin-image-picker',
10116 pluginRef: 'window.imagePicker',
10117 repo: 'https://github.com/wymsee/cordova-imagePicker'
10118 })
10119 ], ImagePicker);
10120 return ImagePicker;
10121}());
10122
10123var __decorate$51 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10124 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10125 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10126 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;
10127 return c > 3 && r && Object.defineProperty(target, key, r), r;
10128};
10129/**
10130 * @name ImageResizer
10131 * @description
10132 * Cordova Plugin For Image Resize
10133 *
10134 * Requires plugin `info.protonet.imageresizer` - use the Ionic CLI and type in the following command:
10135 * `ionic plugin add https://github.com/protonet/cordova-plugin-image-resizer.git`
10136 *
10137 * For more info, please see the https://github.com/protonet/cordova-plugin-image-resizer
10138 *
10139 * @usage
10140 * ```typescript
10141 * import { ImageResizer, ImageResizerOptions } from 'ionic-native';
10142 *
10143 * let options = {
10144 * uri: uri,
10145 * folderName: 'Protonet',
10146 * quality: 90,
10147 * width: 1280,
10148 * height: 1280
10149 * } as ImageResizerOptions;
10150 *
10151 * ImageResizer
10152 * .resize(options)
10153 * .then(
10154 * (filePath: string) => { console.log('FilePath', filePath); },
10155 * () => { console.log('Error occured'); }
10156 * )
10157 * ```
10158 */
10159var ImageResizer = (function () {
10160 function ImageResizer() {
10161 }
10162 ImageResizer.resize = function (options) { return; };
10163 __decorate$51([
10164 Cordova()
10165 ], ImageResizer, "resize", null);
10166 ImageResizer = __decorate$51([
10167 Plugin({
10168 plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git',
10169 pluginRef: 'ImageResizer',
10170 repo: 'https://github.com/protonet/cordova-plugin-image-resizer'
10171 })
10172 ], ImageResizer);
10173 return ImageResizer;
10174}());
10175
10176var __decorate$52 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10177 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10178 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10179 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;
10180 return c > 3 && r && Object.defineProperty(target, key, r), r;
10181};
10182/**
10183 * @name InAppBrowser
10184 * @description Launches in app Browser
10185 * @usage
10186 * ```typescript
10187 * import {InAppBrowser} from 'ionic-native';
10188 *
10189 *
10190 * ...
10191 *
10192 *
10193 * let browser = new InAppBrowser('https://ionic.io', '_system');
10194 * browser.executeScript(...);
10195 * browser.insertCSS(...);
10196 * browser.close();
10197 * ```
10198 */
10199var InAppBrowser = (function () {
10200 /**
10201 * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
10202 * @param url The URL to load.
10203 * @param target The target in which to load the URL, an optional parameter that defaults to _self.
10204 * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
10205 * The options string must not contain any blank space, and each feature's
10206 * name/value pairs must be separated by a comma. Feature names are case insensitive.
10207 */
10208 function InAppBrowser(url, target, options) {
10209 try {
10210 this._objectInstance = cordova.InAppBrowser.open(url, target, options);
10211 }
10212 catch (e) {
10213 window.open(url);
10214 console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open, all instance methods will NOT work.');
10215 }
10216 }
10217 InAppBrowser.open = function (url, target, options) {
10218 console.warn('Native: Your current usage of the InAppBrowser plugin is depreciated as of ionic-native@1.3.8. Please check the Ionic Native docs for the latest usage details.');
10219 };
10220 /**
10221 * Displays an InAppBrowser window that was opened hidden. Calling this has no effect
10222 * if the InAppBrowser was already visible.
10223 */
10224 InAppBrowser.prototype.show = function () { };
10225 /**
10226 * Closes the InAppBrowser window.
10227 */
10228 InAppBrowser.prototype.close = function () { };
10229 /**
10230 * Injects JavaScript code into the InAppBrowser window.
10231 * @param script Details of the script to run, specifying either a file or code key.
10232 */
10233 InAppBrowser.prototype.executeScript = function (script) { return; };
10234 /**
10235 * Injects CSS into the InAppBrowser window.
10236 * @param css Details of the script to run, specifying either a file or code key.
10237 */
10238 InAppBrowser.prototype.insertCss = function (css) { return; };
10239 /**
10240 * A method that allows you to listen to events happening in the browser.
10241 * @param event Event name
10242 * @returns {Observable<any>} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
10243 */
10244 InAppBrowser.prototype.on = function (event) {
10245 var _this = this;
10246 return new Observable_2(function (observer) {
10247 _this._objectInstance.addEventListener(event, observer.next.bind(observer));
10248 return function () { return _this._objectInstance.removeEventListener(event, observer.next.bind(observer)); };
10249 });
10250 };
10251 __decorate$52([
10252 CordovaInstance({ sync: true })
10253 ], InAppBrowser.prototype, "show", null);
10254 __decorate$52([
10255 CordovaInstance({ sync: true })
10256 ], InAppBrowser.prototype, "close", null);
10257 __decorate$52([
10258 CordovaInstance()
10259 ], InAppBrowser.prototype, "executeScript", null);
10260 __decorate$52([
10261 CordovaInstance()
10262 ], InAppBrowser.prototype, "insertCss", null);
10263 InAppBrowser = __decorate$52([
10264 Plugin({
10265 plugin: 'cordova-plugin-inappbrowser',
10266 pluginRef: 'cordova.InAppBrowser',
10267 repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
10268 })
10269 ], InAppBrowser);
10270 return InAppBrowser;
10271}());
10272
10273var __decorate$53 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10274 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10275 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10276 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;
10277 return c > 3 && r && Object.defineProperty(target, key, r), r;
10278};
10279/**
10280 * @name InAppPurchase
10281 * @description
10282 * A lightweight Cordova plugin for in app purchases on iOS/Android.
10283 *
10284 * @usage
10285 * ```ts
10286 * import {InAppPurchase} from 'ionic-native';
10287 *
10288 * InAppPurchase
10289 * .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...])
10290 * .then((products) => {
10291 * console.log(products);
10292 * // [{ productId: 'com.yourapp.prod1', 'title': '...', description: '...', price: '...' }, ...]
10293 * })
10294 * .catch((err) => {
10295 * console.log(err);
10296 * });
10297 *
10298 *
10299 * InAppPurchase
10300 * .buy('com.yourapp.prod1')
10301 * .then((data)=> {
10302 * console.log(data);
10303 * // {
10304 * // transactionId: ...
10305 * // receipt: ...
10306 * // signature: ...
10307 * // }
10308 * })
10309 * .catch((err)=> {
10310 * console.log(err);
10311 * });
10312 *
10313 * ```
10314 *
10315 * @advanced
10316 *
10317 * ```ts
10318 * // fist buy the product...
10319 * InAppPurchase
10320 * .buy('com.yourapp.consumable_prod1')
10321 * .then(data => InAppPurchase.consume(data.productType, data.receipt, data.signature))
10322 * .then(() => console.log('product was successfully consumed!'))
10323 * .catch( err=> console.log(err))
10324 * ```
10325 *
10326 *
10327 */
10328var InAppPurchase = (function () {
10329 function InAppPurchase() {
10330 }
10331 /**
10332 * Retrieves a list of full product data from Apple/Google. This method must be called before making purchases.
10333 * @param {array<string>} productId an array of product ids.
10334 * @returns {Promise} Returns a Promise that resolves with an array of objects.
10335 */
10336 InAppPurchase.getProducts = function (productId) { return; };
10337 /**
10338 * Buy a product that matches the productId.
10339 * @param {string} productId A string that matches the product you want to buy.
10340 * @returns {Promise} Returns a Promise that resolves with the transaction details.
10341 */
10342 InAppPurchase.buy = function (productId) { return; };
10343 /**
10344 * Same as buy, but for subscription based products.
10345 * @param {string} productId A string that matches the product you want to subscribe to.
10346 * @returns {Promise} Returns a Promise that resolves with the transaction details.
10347 */
10348 InAppPurchase.subscribe = function (productId) { return; };
10349 /**
10350 * Call this function after purchasing a "consumable" product to mark it as consumed. On Android, you must consume products that you want to let the user purchase multiple times. If you will not consume the product after a purchase, the next time you will attempt to purchase it you will get the error message:
10351 * @param {string} productType
10352 * @param {string} receipt
10353 * @param {string} signature
10354 */
10355 InAppPurchase.consume = function (productType, receipt, signature) { return; };
10356 /**
10357 * Restore all purchases from the store
10358 * @returns {Promise} Returns a promise with an array of purchases.
10359 */
10360 InAppPurchase.restorePurchases = function () { return; };
10361 /**
10362 * Get the receipt.
10363 * @returns {Promise<string>} Returns a promise that contains the string for the receipt
10364 */
10365 InAppPurchase.getReceipt = function () { return; };
10366 __decorate$53([
10367 Cordova({
10368 otherPromise: true
10369 })
10370 ], InAppPurchase, "getProducts", null);
10371 __decorate$53([
10372 Cordova({
10373 otherPromise: true
10374 })
10375 ], InAppPurchase, "buy", null);
10376 __decorate$53([
10377 Cordova({
10378 otherPromise: true
10379 })
10380 ], InAppPurchase, "subscribe", null);
10381 __decorate$53([
10382 Cordova({
10383 otherPromise: true
10384 })
10385 ], InAppPurchase, "consume", null);
10386 __decorate$53([
10387 Cordova({
10388 otherPromise: true
10389 })
10390 ], InAppPurchase, "restorePurchases", null);
10391 __decorate$53([
10392 Cordova({
10393 otherPromise: true,
10394 platforms: ['iOS']
10395 })
10396 ], InAppPurchase, "getReceipt", null);
10397 InAppPurchase = __decorate$53([
10398 Plugin({
10399 plugin: 'cordova-plugin-inapppurchase',
10400 pluginRef: 'inAppPurchase',
10401 platforms: ['Android', 'iOS'],
10402 repo: 'https://github.com/AlexDisler/cordova-plugin-inapppurchase'
10403 })
10404 ], InAppPurchase);
10405 return InAppPurchase;
10406}());
10407
10408var __decorate$54 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10409 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10410 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10411 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;
10412 return c > 3 && r && Object.defineProperty(target, key, r), r;
10413};
10414/**
10415 * @name Insomnia
10416 * @description
10417 * Prevent the screen of the mobile device from falling asleep.
10418 *
10419 * @usage
10420 * ```typescript
10421 * import { Insomnia } from 'ionic-native';
10422 *
10423 *
10424 * Insomnia.keepAwake()
10425 * .then(
10426 * () => console.log('success'),
10427 * () => console.log('error')
10428 * );
10429 *
10430 * Insomnia.allowSleepAgain()
10431 * .then(
10432 * () => console.log('success'),
10433 * () => console.log('error')
10434 * );
10435 * ```
10436 *
10437 */
10438var Insomnia = (function () {
10439 function Insomnia() {
10440 }
10441 /**
10442 * Keeps awake the application
10443 * @returns {Promise}
10444 */
10445 Insomnia.keepAwake = function () { return; };
10446 /**
10447 * Allows the application to sleep again
10448 * @returns {Promise}
10449 */
10450 Insomnia.allowSleepAgain = function () { return; };
10451 __decorate$54([
10452 Cordova()
10453 ], Insomnia, "keepAwake", null);
10454 __decorate$54([
10455 Cordova()
10456 ], Insomnia, "allowSleepAgain", null);
10457 Insomnia = __decorate$54([
10458 Plugin({
10459 plugin: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git',
10460 pluginRef: 'plugins.insomnia',
10461 repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin',
10462 platforms: ['Android', 'iOS', 'Windows Phone 8']
10463 })
10464 ], Insomnia);
10465 return Insomnia;
10466}());
10467
10468var __decorate$55 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10469 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10470 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10471 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;
10472 return c > 3 && r && Object.defineProperty(target, key, r), r;
10473};
10474/**
10475 * @name Instagram
10476 * @description Share a photo with the instagram app
10477 *
10478 * @usage
10479 * ```
10480 * import {Instagram} from 'ionic-native';
10481 *
10482 * Instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
10483 * .then(() => console.log('Shared!'))
10484 * .catch((error: any) => console.error(error));
10485 *
10486 * ```
10487 */
10488var Instagram = (function () {
10489 function Instagram() {
10490 }
10491 /**
10492 * Detect if the Instagram application is installed on the device.
10493 *
10494 * @return {Promise<boolean|string>} Returns a promise that returns a boolean value if installed, or the app version on android
10495 */
10496 Instagram.isInstalled = function () { return; };
10497 /**
10498 * Share an image on Instagram
10499 * Note: Instagram app stopped accepting pre-filled captions on both iOS and Android. As a work-around, the caption is copied to the clipboard. You have to inform your users to paste the caption.
10500 *
10501 * @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share
10502 * @param caption The caption of the image
10503 * @return {Promise<any>} Returns a promise that resolves if the image was shared
10504 */
10505 Instagram.share = function (canvasIdOrDataUrl, caption) { return; };
10506 /**
10507 * Share a library asset or video
10508 * @param assetLocalIdentifier A local fileURI
10509 * @return {Promise<any>} Returns a promise that resolves if the image was shared
10510 */
10511 Instagram.shareAsset = function (assetLocalIdentifier) { return; };
10512 __decorate$55([
10513 Cordova({
10514 callbackStyle: 'node'
10515 })
10516 ], Instagram, "isInstalled", null);
10517 __decorate$55([
10518 Cordova({
10519 callbackStyle: 'node'
10520 })
10521 ], Instagram, "share", null);
10522 __decorate$55([
10523 Cordova({
10524 callbackOrder: 'reverse'
10525 })
10526 ], Instagram, "shareAsset", null);
10527 Instagram = __decorate$55([
10528 Plugin({
10529 plugin: 'cordova-instagram-plugin',
10530 pluginRef: 'Instagram',
10531 repo: 'https://github.com/vstirbu/InstagramPlugin'
10532 })
10533 ], Instagram);
10534 return Instagram;
10535}());
10536
10537var __decorate$56 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10538 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10539 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10540 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;
10541 return c > 3 && r && Object.defineProperty(target, key, r), r;
10542};
10543/**
10544 * @name IsDebug
10545 * @description
10546 * Detect if the app is running in debug mode or not.
10547 * Debug mode is when the app is built and installed locally via xcode / eclipse / the cordova cli etc, compared to release mode when the app was downloaded from the app / play store via an end user.
10548 *
10549 * @usage
10550 * ```
10551 * import {IsDebug} from 'ionic-native';
10552 *
10553 * IsDebug.getIsDebug()
10554 * .then((isDebug: boolean) => console.log('Is debug:', isDebug))
10555 * .catch((error: any) => console.error(error));
10556 *
10557 * ```
10558 */
10559var IsDebug = (function () {
10560 function IsDebug() {
10561 }
10562 /**
10563 * Determine if an app was installed via xcode / eclipse / the ionic CLI etc
10564 * @return {Promise<boolean>} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user.
10565 */
10566 IsDebug.getIsDebug = function () {
10567 return;
10568 };
10569 __decorate$56([
10570 Cordova()
10571 ], IsDebug, "getIsDebug", null);
10572 IsDebug = __decorate$56([
10573 Plugin({
10574 plugin: 'cordova-plugin-is-debug',
10575 pluginRef: 'cordova.plugins.IsDebug',
10576 repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug'
10577 })
10578 ], IsDebug);
10579 return IsDebug;
10580}());
10581
10582var __decorate$57 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10583 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10584 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10585 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;
10586 return c > 3 && r && Object.defineProperty(target, key, r), r;
10587};
10588/**
10589 * @name Keyboard
10590 * @description
10591 * @usage
10592 * ```typescript
10593 * import { Keyboard } from 'ionic-native';
10594 *
10595 *
10596 *
10597 * ```
10598 */
10599var Keyboard = (function () {
10600 function Keyboard() {
10601 }
10602 /**
10603 * Hide the keyboard accessory bar with the next, previous and done buttons.
10604 * @param hide {boolean}
10605 */
10606 Keyboard.hideKeyboardAccessoryBar = function (hide) { };
10607 /**
10608 * Force keyboard to be shown.
10609 */
10610 Keyboard.show = function () { };
10611 /**
10612 * Close the keyboard if open.
10613 */
10614 Keyboard.close = function () { };
10615 /**
10616 * Prevents the native UIScrollView from moving when an input is focused.
10617 * @param disable
10618 */
10619 Keyboard.disableScroll = function (disable) { };
10620 /**
10621 * Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
10622 */
10623 Keyboard.onKeyboardShow = function () { return; };
10624 /**
10625 * Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
10626 */
10627 Keyboard.onKeyboardHide = function () { return; };
10628 __decorate$57([
10629 Cordova({ sync: true })
10630 ], Keyboard, "hideKeyboardAccessoryBar", null);
10631 __decorate$57([
10632 Cordova({
10633 sync: true,
10634 platforms: ['Android', 'BlackBerry 10', 'Windows']
10635 })
10636 ], Keyboard, "show", null);
10637 __decorate$57([
10638 Cordova({
10639 sync: true,
10640 platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
10641 })
10642 ], Keyboard, "close", null);
10643 __decorate$57([
10644 Cordova({
10645 sync: true,
10646 platforms: ['iOS', 'Windows']
10647 })
10648 ], Keyboard, "disableScroll", null);
10649 __decorate$57([
10650 Cordova({
10651 eventObservable: true,
10652 event: 'native.keyboardshow',
10653 platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
10654 })
10655 ], Keyboard, "onKeyboardShow", null);
10656 __decorate$57([
10657 Cordova({
10658 eventObservable: true,
10659 event: 'native.keyboardhide',
10660 platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
10661 })
10662 ], Keyboard, "onKeyboardHide", null);
10663 Keyboard = __decorate$57([
10664 Plugin({
10665 plugin: 'ionic-plugin-keyboard',
10666 pluginRef: 'cordova.plugins.Keyboard',
10667 repo: 'https://github.com/driftyco/ionic-plugin-keyboard'
10668 })
10669 ], Keyboard);
10670 return Keyboard;
10671}());
10672
10673var __decorate$58 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10674 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10675 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10676 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;
10677 return c > 3 && r && Object.defineProperty(target, key, r), r;
10678};
10679/**
10680 * @name Launch Navigator
10681 * @description
10682 * Requires Cordova plugin: uk.co.workingedge.phonegap.plugin.launchnavigator. For more info, please see the [LaunchNavigator plugin docs](https://github.com/dpa99c/phonegap-launch-navigator).
10683 *
10684 * @usage
10685 * Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper.
10686 *
10687 * ```typescript
10688 * import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';
10689 *
10690 * let options: LaunchNavigatorOptions = {
10691 * start: 'London, ON',
10692 * app: LaunchNavigator.APPS.UBER
10693 * };
10694 *
10695 * LaunchNavigator.navigate('Toronto, ON', options)
10696 * .then(
10697 * success => console.log('Launched navigator'),
10698 * error => console.log('Error launching navigator', error)
10699 * );
10700 * ```
10701 */
10702var LaunchNavigator = (function () {
10703 function LaunchNavigator() {
10704 }
10705 /**
10706 * Launches navigator app
10707 * @param destination {string|number[]} Location name or coordinates (as string or array)
10708 * @param options {LaunchNavigatorOptions}
10709 * @returns {Promise<any>}
10710 */
10711 LaunchNavigator.navigate = function (destination, options) { return; };
10712 /**
10713 * Determines if the given app is installed and available on the current device.
10714 * @param app {string}
10715 */
10716 LaunchNavigator.isAppAvailable = function (app) { return; };
10717 /**
10718 * Returns a list indicating which apps are installed and available on the current device.
10719 */
10720 LaunchNavigator.availableApps = function () { return; };
10721 /**
10722 * Returns the display name of the specified app.
10723 * @param app {string}
10724 */
10725 LaunchNavigator.getAppDisplayName = function (app) { return; };
10726 /**
10727 * Returns list of supported apps on a given platform.
10728 * @param platform {string}
10729 */
10730 LaunchNavigator.getAppsForPlatform = function (platform) { return; };
10731 /**
10732 * Indicates if an app on a given platform supports specification of transport mode.
10733 * @param app {string} specified as a string, you can use one of the constants, e.g `LaunchNavigator.APP.GOOGLE_MAPS`
10734 * @param platform {string}
10735 */
10736 LaunchNavigator.supportsTransportMode = function (app, platform) { return; };
10737 /**
10738 * Returns the list of transport modes supported by an app on a given platform.
10739 * @param app {string}
10740 * @param platform {string}
10741 */
10742 LaunchNavigator.getTransportModes = function (app, platform) { return; };
10743 /**
10744 * Indicates if an app on a given platform supports specification of launch mode.
10745 * Note that currently only Google Maps on Android does.
10746 * @param app {string}
10747 * @param platform {string}
10748 */
10749 LaunchNavigator.supportsLaunchMode = function (app, platform) { return; };
10750 /**
10751 * Indicates if an app on a given platform supports specification of start location.
10752 * @param app {string}
10753 * @param platform {string}
10754 */
10755 LaunchNavigator.supportsStart = function (app, platform) { return; };
10756 LaunchNavigator.supportsStartName = function (app, platform) { return; };
10757 LaunchNavigator.supportsDestName = function (app, platform) { return; };
10758 LaunchNavigator.userSelect = function (destination, options) { };
10759 LaunchNavigator.APP = {
10760 USER_SELECT: 'user_select',
10761 APPLE_MAPS: 'apple_maps',
10762 GOOGLE_MAPS: 'google_maps',
10763 WAZE: 'waze',
10764 CITYMAPPER: 'citymapper',
10765 NAVIGON: 'navigon',
10766 TRANSIT_APP: 'transit_app',
10767 YANDEX: 'yandex',
10768 UBER: 'uber',
10769 TOMTOM: 'tomtom',
10770 BING_MAPS: 'bing_maps',
10771 SYGIC: 'sygic',
10772 HERE_MAPS: 'here_maps',
10773 MOOVIT: 'moovit'
10774 };
10775 LaunchNavigator.TRANSPORT_MODE = {
10776 DRIVING: 'driving',
10777 WALKING: 'walking',
10778 BICYCLING: 'bicycling',
10779 TRANSIT: 'transit'
10780 };
10781 __decorate$58([
10782 Cordova({
10783 successIndex: 1,
10784 errorIndex: 2
10785 })
10786 ], LaunchNavigator, "navigate", null);
10787 __decorate$58([
10788 Cordova()
10789 ], LaunchNavigator, "isAppAvailable", null);
10790 __decorate$58([
10791 Cordova()
10792 ], LaunchNavigator, "availableApps", null);
10793 __decorate$58([
10794 Cordova({ sync: true })
10795 ], LaunchNavigator, "getAppDisplayName", null);
10796 __decorate$58([
10797 Cordova({ sync: true })
10798 ], LaunchNavigator, "getAppsForPlatform", null);
10799 __decorate$58([
10800 Cordova({ sync: true })
10801 ], LaunchNavigator, "supportsTransportMode", null);
10802 __decorate$58([
10803 Cordova({ sync: true })
10804 ], LaunchNavigator, "getTransportModes", null);
10805 __decorate$58([
10806 Cordova({ sync: true })
10807 ], LaunchNavigator, "supportsLaunchMode", null);
10808 __decorate$58([
10809 Cordova({ sync: true })
10810 ], LaunchNavigator, "supportsStart", null);
10811 __decorate$58([
10812 Cordova({ sync: true })
10813 ], LaunchNavigator, "supportsStartName", null);
10814 __decorate$58([
10815 Cordova({ sync: true })
10816 ], LaunchNavigator, "supportsDestName", null);
10817 __decorate$58([
10818 Cordova({ sync: true })
10819 ], LaunchNavigator, "userSelect", null);
10820 LaunchNavigator = __decorate$58([
10821 Plugin({
10822 plugin: 'uk.co.workingedge.phonegap.plugin.launchnavigator',
10823 pluginRef: 'launchnavigator',
10824 repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git'
10825 })
10826 ], LaunchNavigator);
10827 return LaunchNavigator;
10828}());
10829
10830var __decorate$59 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
10831 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10832 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10833 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;
10834 return c > 3 && r && Object.defineProperty(target, key, r), r;
10835};
10836/**
10837 * @name Local Notifications
10838 * @description
10839 * This plugin allows you to display local notifications on the device
10840 *
10841 * @usage
10842 * ```typescript
10843 * import { LocalNotifications } from 'ionic-native';
10844 *
10845 *
10846 * // Schedule a single notification
10847 * LocalNotifications.schedule({
10848 * id: 1,
10849 * text: 'Single Notification',
10850 * sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
10851 * data: { secret: key }
10852 * });
10853 *
10854 *
10855 * // Schedule multiple notifications
10856 * LocalNotifications.schedule([{
10857 * id: 1,
10858 * text: 'Multi Notification 1',
10859 * sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
10860 * data: { secret:key }
10861 * },{
10862 * id: 2,
10863 * title: 'Local Notification Example',
10864 * text: 'Multi Notification 2',
10865 * icon: 'http://example.com/icon.png'
10866 * }]);
10867 *
10868 *
10869 * // Schedule delayed notification
10870 * LocalNotifications.schedule({
10871 * text: 'Delayed Notification',
10872 * at: new Date(new Date().getTime() + 3600),
10873 * led: 'FF0000',
10874 * sound: null
10875 * });
10876 * ```
10877 *
10878 */
10879var LocalNotifications = (function () {
10880 function LocalNotifications() {
10881 }
10882 /**
10883 * Schedules a single or multiple notifications
10884 * @param options
10885 */
10886 LocalNotifications.schedule = function (options) { };
10887 /**
10888 * Updates a previously scheduled notification. Must include the id in the options parameter.
10889 * @param options
10890 */
10891 LocalNotifications.update = function (options) { };
10892 /**
10893 * Clears single or multiple notifications
10894 * @param notificationId A single notification id, or an array of notification ids.
10895 * @returns {Promise} Returns a promise when the notification had been cleared
10896 */
10897 LocalNotifications.clear = function (notificationId) { return; };
10898 /**
10899 * Clears all notifications
10900 * @returns {Promise} Returns a promise when all notifications have cleared
10901 */
10902 LocalNotifications.clearAll = function () { return; };
10903 /**
10904 * Cancels single or multiple notifications
10905 * @param notificationId A single notification id, or an array of notification ids.
10906 * @returns {Promise} Returns a promise when the notification is canceled
10907 */
10908 LocalNotifications.cancel = function (notificationId) { return; };
10909 /**
10910 * Cancels all notifications
10911 * @returns {Promise} Returns a promise when all notifications are canceled
10912 */
10913 LocalNotifications.cancelAll = function () { return; };
10914 /**
10915 * Checks presence of a notification
10916 * @param notificationId
10917 * @returns {Promise} Returns a promise
10918 */
10919 LocalNotifications.isPresent = function (notificationId) { return; };
10920 /**
10921 * Checks is a notification is scheduled
10922 * @param notificationId
10923 * @returns {Promise} Returns a promise
10924 */
10925 LocalNotifications.isScheduled = function (notificationId) { return; };
10926 /**
10927 * Checks if a notification is triggered
10928 * @param notificationId
10929 * @returns {Promise} Returns a promise
10930 */
10931 LocalNotifications.isTriggered = function (notificationId) { return; };
10932 /**
10933 * Get all the notification ids
10934 * @returns {Promise} Returns a promise
10935 */
10936 LocalNotifications.getAllIds = function () { return; };
10937 /**
10938 * Get the ids of triggered notifications
10939 * @returns {Promise} Returns a promise
10940 */
10941 LocalNotifications.getTriggeredIds = function () { return; };
10942 /**
10943 * Get the ids of scheduled notifications
10944 * @returns {Promise} Returns a promise
10945 */
10946 LocalNotifications.getScheduledIds = function () { return; };
10947 /**
10948 * Get a notification object
10949 * @param notificationId The id of the notification to get
10950 * @returns {Promise} Returns a promise
10951 */
10952 LocalNotifications.get = function (notificationId) { return; };
10953 /**
10954 * Get a scheduled notification object
10955 * @param notificationId The id of the notification to get
10956 * @returns {Promise} Returns a promise
10957 */
10958 LocalNotifications.getScheduled = function (notificationId) { return; };
10959 /**
10960 * Get a triggered notification object
10961 * @param notificationId The id of the notification to get
10962 * @returns {Promise} Returns a promise
10963 */
10964 LocalNotifications.getTriggered = function (notificationId) { return; };
10965 /**
10966 * Get all notification objects
10967 * @returns {Promise} Returns a promise
10968 */
10969 LocalNotifications.getAll = function () { return; };
10970 /**
10971 * Get all scheduled notification objects
10972 * @returns {Promise} Returns a promise
10973 */
10974 LocalNotifications.getAllScheduled = function () { return; };
10975 /**
10976 * Get all triggered notification objects
10977 * @returns {Promise} Returns a promise
10978 */
10979 LocalNotifications.getAllTriggered = function () { return; };
10980 /**
10981 * Register permission to show notifications if not already granted.
10982 * @returns {Promise} Returns a promise
10983 */
10984 LocalNotifications.registerPermission = function () { return; };
10985 /**
10986 * Informs if the app has the permission to show notifications.
10987 * @returns {Promise} Returns a promise
10988 */
10989 LocalNotifications.hasPermission = function () { return; };
10990 /**
10991 * Sets a callback for a specific event
10992 * @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall
10993 * @param callback Call back function. All events return notification and state parameter. clear and clearall return state parameter only.
10994 */
10995 LocalNotifications.on = function (eventName, callback) { };
10996 __decorate$59([
10997 Cordova({
10998 sync: true
10999 })
11000 ], LocalNotifications, "schedule", null);
11001 __decorate$59([
11002 Cordova({
11003 sync: true
11004 })
11005 ], LocalNotifications, "update", null);
11006 __decorate$59([
11007 Cordova()
11008 ], LocalNotifications, "clear", null);
11009 __decorate$59([
11010 Cordova({
11011 successIndex: 0,
11012 errorIndex: 2
11013 })
11014 ], LocalNotifications, "clearAll", null);
11015 __decorate$59([
11016 Cordova()
11017 ], LocalNotifications, "cancel", null);
11018 __decorate$59([
11019 Cordova({
11020 successIndex: 0,
11021 errorIndex: 2
11022 })
11023 ], LocalNotifications, "cancelAll", null);
11024 __decorate$59([
11025 Cordova()
11026 ], LocalNotifications, "isPresent", null);
11027 __decorate$59([
11028 Cordova()
11029 ], LocalNotifications, "isScheduled", null);
11030 __decorate$59([
11031 Cordova()
11032 ], LocalNotifications, "isTriggered", null);
11033 __decorate$59([
11034 Cordova()
11035 ], LocalNotifications, "getAllIds", null);
11036 __decorate$59([
11037 Cordova()
11038 ], LocalNotifications, "getTriggeredIds", null);
11039 __decorate$59([
11040 Cordova()
11041 ], LocalNotifications, "getScheduledIds", null);
11042 __decorate$59([
11043 Cordova()
11044 ], LocalNotifications, "get", null);
11045 __decorate$59([
11046 Cordova()
11047 ], LocalNotifications, "getScheduled", null);
11048 __decorate$59([
11049 Cordova()
11050 ], LocalNotifications, "getTriggered", null);
11051 __decorate$59([
11052 Cordova()
11053 ], LocalNotifications, "getAll", null);
11054 __decorate$59([
11055 Cordova()
11056 ], LocalNotifications, "getAllScheduled", null);
11057 __decorate$59([
11058 Cordova()
11059 ], LocalNotifications, "getAllTriggered", null);
11060 __decorate$59([
11061 Cordova()
11062 ], LocalNotifications, "registerPermission", null);
11063 __decorate$59([
11064 Cordova()
11065 ], LocalNotifications, "hasPermission", null);
11066 __decorate$59([
11067 Cordova({
11068 sync: true
11069 })
11070 ], LocalNotifications, "on", null);
11071 LocalNotifications = __decorate$59([
11072 Plugin({
11073 plugin: 'de.appplant.cordova.plugin.local-notification',
11074 pluginRef: 'cordova.plugins.notification.local',
11075 repo: 'https://github.com/katzer/cordova-plugin-local-notifications'
11076 })
11077 ], LocalNotifications);
11078 return LocalNotifications;
11079}());
11080
11081var __decorate$60 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11082 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11083 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11084 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;
11085 return c > 3 && r && Object.defineProperty(target, key, r), r;
11086};
11087/**
11088 * @name Media Capture
11089 * @description
11090 * @usage
11091 * ```typescript
11092 * import { MediaCapture } from 'ionic-native';
11093 *
11094 *
11095 * let options: CaptureImageOptions = { limit: 3 };
11096 * MediaCapture.captureImage(options)
11097 * .then(
11098 * (data: MediaFile[]) => console.log(data),
11099 * (err: CaptureError) => console.error(err)
11100 * );
11101 *
11102 * ```
11103 */
11104var MediaCapture = (function () {
11105 function MediaCapture() {
11106 }
11107 Object.defineProperty(MediaCapture, "supportedImageModes", {
11108 /**
11109 * The audio recording formats supported by the device.
11110 * @returns {ConfigurationData[]}
11111 */
11112 get: function () {
11113 return navigator.device.capture.supportedImageModes;
11114 },
11115 enumerable: true,
11116 configurable: true
11117 });
11118 Object.defineProperty(MediaCapture, "supportedAudioModes", {
11119 /**
11120 * The recording image sizes and formats supported by the device.
11121 * @returns {ConfigurationData[]}
11122 */
11123 get: function () {
11124 return navigator.device.capture.supportedAudioModes;
11125 },
11126 enumerable: true,
11127 configurable: true
11128 });
11129 Object.defineProperty(MediaCapture, "supportedVideoModes", {
11130 /**
11131 * The recording video resolutions and formats supported by the device.
11132 * @returns {ConfigurationData[]}
11133 */
11134 get: function () {
11135 return navigator.device.capture.supportedVideoModes;
11136 },
11137 enumerable: true,
11138 configurable: true
11139 });
11140 /**
11141 * Start the audio recorder application and return information about captured audio clip files.
11142 * @param options
11143 */
11144 MediaCapture.captureAudio = function (options) { return; };
11145 /**
11146 * Start the camera application and return information about captured image files.
11147 * @param options
11148 */
11149 MediaCapture.captureImage = function (options) { return; };
11150 /**
11151 * Start the video recorder application and return information about captured video clip files.
11152 * @param options
11153 */
11154 MediaCapture.captureVideo = function (options) { return; };
11155 /**
11156 * is fired if the capture call is successful
11157 */
11158 MediaCapture.onPendingCaptureResult = function () { return; };
11159 /**
11160 * is fired if the capture call is unsuccessful
11161 */
11162 MediaCapture.onPendingCaptureError = function () { return; };
11163 __decorate$60([
11164 CordovaProperty
11165 ], MediaCapture, "supportedImageModes", null);
11166 __decorate$60([
11167 CordovaProperty
11168 ], MediaCapture, "supportedAudioModes", null);
11169 __decorate$60([
11170 CordovaProperty
11171 ], MediaCapture, "supportedVideoModes", null);
11172 __decorate$60([
11173 Cordova({
11174 callbackOrder: 'reverse'
11175 })
11176 ], MediaCapture, "captureAudio", null);
11177 __decorate$60([
11178 Cordova({
11179 callbackOrder: 'reverse'
11180 })
11181 ], MediaCapture, "captureImage", null);
11182 __decorate$60([
11183 Cordova({
11184 callbackOrder: 'reverse'
11185 })
11186 ], MediaCapture, "captureVideo", null);
11187 __decorate$60([
11188 Cordova({
11189 eventObservable: true,
11190 event: 'pendingcaptureresult'
11191 })
11192 ], MediaCapture, "onPendingCaptureResult", null);
11193 __decorate$60([
11194 Cordova({
11195 eventObservable: true,
11196 event: 'pendingcaptureerror'
11197 })
11198 ], MediaCapture, "onPendingCaptureError", null);
11199 MediaCapture = __decorate$60([
11200 Plugin({
11201 plugin: 'cordova-plugin-media-capture',
11202 pluginRef: 'navigator.device.capture',
11203 repo: 'https://github.com/apache/cordova-plugin-media-capture'
11204 })
11205 ], MediaCapture);
11206 return MediaCapture;
11207}());
11208
11209var __decorate$61 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11210 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11211 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11212 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;
11213 return c > 3 && r && Object.defineProperty(target, key, r), r;
11214};
11215/**
11216 * @name NativeAudio
11217 * @description Native Audio Playback
11218 * @usage
11219 * ```typescript
11220 * import {NativeAudio} from 'ionic-native';
11221 *
11222 * NativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError);
11223 * NativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError);
11224 *
11225 * NativeAudio.play('uniqueId1').then(onSuccess, onError);
11226 * NativeAudio.loop('uniqueId2').then(onSuccess, onError);
11227 *
11228 * NativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError);
11229 *
11230 * NativeAudio.stop('uniqueId1').then(onSuccess,onError);
11231 *
11232 * NativeAudio.unload('uniqueId1').then(onSuccess,onError);
11233 *
11234 * ```
11235 */
11236var NativeAudio = (function () {
11237 function NativeAudio() {
11238 }
11239 /**
11240 * Loads an audio file into memory. Optimized for short clips / single shots (up to five seconds). Cannot be stopped / looped.
11241 * @param id {string} unique ID for the audio file
11242 * @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
11243 * @returns {Promise<any>}
11244 */
11245 NativeAudio.preloadSimple = function (id, assetPath) { return; };
11246 /**
11247 * Loads an audio file into memory. Optimized for background music / ambient sound. Uses highlevel native APIs with a larger footprint. (iOS: AVAudioPlayer). Can be stopped / looped and used with multiple voices. Can be faded in and out using the delay parameter.
11248 * @param id {string} unique ID for the audio file
11249 * @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset.
11250 * @param volume {number} the volume of the preloaded sound (0.1 to 1.0)
11251 * @param voices {number} the number of multichannel voices available
11252 * @param delay {number}
11253 * @returns {Promise<any>}
11254 */
11255 NativeAudio.preloadComplex = function (id, assetPath, volume, voices, delay) { return; };
11256 /**
11257 * Plays an audio asset
11258 * @param id {string} unique ID for the audio file
11259 * @param completeCallback {Function} callback to be invoked when audio is done playing
11260 */
11261 NativeAudio.play = function (id, completeCallback) { return; };
11262 /**
11263 * Stops playing an audio
11264 * @param id {string} unique ID for the audio file
11265 */
11266 NativeAudio.stop = function (id) { return; };
11267 /**
11268 * Loops an audio asset infinitely, this only works for complex assets
11269 * @param id {string} unique ID for the audio file
11270 * @return {Promise<any>}
11271 */
11272 NativeAudio.loop = function (id) { return; };
11273 /**
11274 * Unloads an audio file from memory
11275 * @param id {string} unique ID for the audio file
11276 */
11277 NativeAudio.unload = function (id) { return; };
11278 /**
11279 * Changes the volume for preloaded complex assets.
11280 * @param id {string} unique ID for the audio file
11281 * @param volume {number} the volume of the audio asset (0.1 to 1.0)
11282 */
11283 NativeAudio.setVolumeForComplexAsset = function (id, volume) { return; };
11284 __decorate$61([
11285 Cordova()
11286 ], NativeAudio, "preloadSimple", null);
11287 __decorate$61([
11288 Cordova()
11289 ], NativeAudio, "preloadComplex", null);
11290 __decorate$61([
11291 Cordova({
11292 successIndex: 1,
11293 errorIndex: 2
11294 })
11295 ], NativeAudio, "play", null);
11296 __decorate$61([
11297 Cordova()
11298 ], NativeAudio, "stop", null);
11299 __decorate$61([
11300 Cordova()
11301 ], NativeAudio, "loop", null);
11302 __decorate$61([
11303 Cordova()
11304 ], NativeAudio, "unload", null);
11305 __decorate$61([
11306 Cordova()
11307 ], NativeAudio, "setVolumeForComplexAsset", null);
11308 NativeAudio = __decorate$61([
11309 Plugin({
11310 plugin: 'cordova-plugin-nativeaudio',
11311 pluginRef: 'plugins.NativeAudio',
11312 repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio'
11313 })
11314 ], NativeAudio);
11315 return NativeAudio;
11316}());
11317
11318var __decorate$62 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11319 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11320 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11321 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;
11322 return c > 3 && r && Object.defineProperty(target, key, r), r;
11323};
11324/**
11325 * @name NativePageTransitions
11326 * @description
11327 * The Native Page Transitions plugin uses native hardware acceleration to animate your transitions between views. You have complete control over the type of transition, the duration, and direction.
11328 *
11329 * @usage
11330 * ```
11331 * import {NativePageTransitions, TransitionOptions} from 'ionic-native';
11332 *
11333 * let options: TransitionOptions = {
11334 * direction: 'up',
11335 * duration: 500,
11336 * slowdownfactor: 3,
11337 * slidePixels: 20,
11338 * iosdelay: 100,
11339 * androiddelay: 150,
11340 * winphonedelay: 250,
11341 * fixedPixelsTop: 0,
11342 * fixedPixelsBottom: 60
11343 * };
11344 *
11345 * NativePageTransitions.slide(options)
11346 * .then(onSuccess)
11347 * .catch(onError);
11348 *
11349 * ```
11350 */
11351var NativePageTransitions = (function () {
11352 function NativePageTransitions() {
11353 }
11354 /**
11355 * Perform a slide animation
11356 * @param options {TransitionOptions} Options for the transition
11357 */
11358 NativePageTransitions.slide = function (options) { return; };
11359 /**
11360 * Perform a flip animation
11361 * @param options {TransitionOptions} Options for the transition
11362 */
11363 NativePageTransitions.flip = function (options) { return; };
11364 /**
11365 * Perform a fade animation
11366 * @param options {TransitionOptions} Options for the transition
11367 */
11368 NativePageTransitions.fade = function (options) { return; };
11369 /**
11370 * Perform a slide animation
11371 * @param options {TransitionOptions} Options for the transition
11372 */
11373 NativePageTransitions.drawer = function (options) { return; };
11374 /**
11375 * Perform a slide animation
11376 * @param options {TransitionOptions} Options for the transition
11377 */
11378 NativePageTransitions.curl = function (options) { return; };
11379 __decorate$62([
11380 Cordova()
11381 ], NativePageTransitions, "slide", null);
11382 __decorate$62([
11383 Cordova()
11384 ], NativePageTransitions, "flip", null);
11385 __decorate$62([
11386 Cordova({ platforms: ['iOS', 'Android'] })
11387 ], NativePageTransitions, "fade", null);
11388 __decorate$62([
11389 Cordova({ platforms: ['iOS', 'Android'] })
11390 ], NativePageTransitions, "drawer", null);
11391 __decorate$62([
11392 Cordova({ platforms: ['iOS'] })
11393 ], NativePageTransitions, "curl", null);
11394 NativePageTransitions = __decorate$62([
11395 Plugin({
11396 plugin: 'com.telerik.plugins.nativepagetransitions',
11397 pluginRef: 'plugins.nativepagetransitions',
11398 repo: 'https://github.com/Telerik-Verified-Plugins/NativePageTransitions',
11399 platforms: ['iOS', 'Android', 'Windows Phone']
11400 })
11401 ], NativePageTransitions);
11402 return NativePageTransitions;
11403}());
11404
11405var __decorate$63 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11406 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11407 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11408 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;
11409 return c > 3 && r && Object.defineProperty(target, key, r), r;
11410};
11411/**
11412 * @name NativeStorage
11413 * @description Native storage of variables in Android and iOS
11414 *
11415 * @usage
11416 * ```typescript
11417 * import { NativeStorage } from 'ionic-native';
11418 *
11419 * NativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
11420 * .then(
11421 * () => console.log('Stored item!'),
11422 * error => console.error('Error storing item', error)
11423 * );
11424 *
11425 * NativeStorage.getItem('myitem')
11426 * .then(
11427 * data => console.log(data),
11428 * error => console.error(error)
11429 * );
11430 * ```
11431 */
11432var NativeStorage = (function () {
11433 function NativeStorage() {
11434 }
11435 /**
11436 * Stores a value
11437 * @param reference {string}
11438 * @param value
11439 */
11440 NativeStorage.setItem = function (reference, value) { return; };
11441 /**
11442 * Gets a stored item
11443 * @param reference {string}
11444 */
11445 NativeStorage.getItem = function (reference) { return; };
11446 /**
11447 * Removes a single stored item
11448 * @param reference {string}
11449 */
11450 NativeStorage.remove = function (reference) { return; };
11451 /**
11452 * Removes all stored values.
11453 */
11454 NativeStorage.clear = function () { return; };
11455 __decorate$63([
11456 Cordova()
11457 ], NativeStorage, "setItem", null);
11458 __decorate$63([
11459 Cordova()
11460 ], NativeStorage, "getItem", null);
11461 __decorate$63([
11462 Cordova()
11463 ], NativeStorage, "remove", null);
11464 __decorate$63([
11465 Cordova()
11466 ], NativeStorage, "clear", null);
11467 NativeStorage = __decorate$63([
11468 Plugin({
11469 plugin: 'cordova-plugin-nativestorage',
11470 pluginRef: 'NativeStorage',
11471 repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage'
11472 })
11473 ], NativeStorage);
11474 return NativeStorage;
11475}());
11476
11477var __decorate$64 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11478 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11479 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11480 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;
11481 return c > 3 && r && Object.defineProperty(target, key, r), r;
11482};
11483/**
11484 * @name Market
11485 * @description
11486 * Opens an app's page in the market place (Google Play, App Store)
11487 *
11488 * @usage
11489 * ```
11490 * import {Market} from 'ionic-native';
11491 *
11492 * Market.open('your.package.name');
11493 *
11494 * ```
11495 */
11496var Market = (function () {
11497 function Market() {
11498 }
11499 /**
11500 * Opens an app in Google Play / App Store
11501 * @param appId {string} Package name
11502 * @param callbacks {Object} Optional callbacks
11503 */
11504 Market.open = function (appId, callbacks) { };
11505 __decorate$64([
11506 Cordova({ sync: true })
11507 ], Market, "open", null);
11508 Market = __decorate$64([
11509 Plugin({
11510 plugin: 'cordova-plugin-market',
11511 pluginRef: 'plugins.market',
11512 repo: 'https://github.com/xmartlabs/cordova-plugin-market'
11513 })
11514 ], Market);
11515 return Market;
11516}());
11517
11518var __decorate$65 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11519 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11520 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11521 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;
11522 return c > 3 && r && Object.defineProperty(target, key, r), r;
11523};
11524/**
11525 * @name MediaPlugin
11526 * @description
11527 * @usage
11528 * ```typescript
11529 * import { MediaPlugin } from 'ionic-native';
11530 *
11531 *
11532 *
11533 * // Create a MediaPlugin instance. Expects path to file or url as argument
11534 * var file = new MediaPlugin('path/to/file.mp3');
11535 *
11536 * // Catch the Success & Error Output
11537 * // Platform Quirks
11538 * // iOS calls success on completion of playback only
11539 * // Android calls success on completion of playback AND on release()
11540 * file.init.then(() => {
11541 * console.log('Playback Finished');
11542 * }, (err) => {
11543 * console.log('somthing went wrong! error code: ' + err.code + ' message: ' + err.message);
11544 * });
11545 *
11546 * // play the file
11547 * file.play();
11548 *
11549 * // pause the file
11550 * file.pause();
11551 *
11552 * // get current playback position
11553 * file.getCurrentPosition().then((position) => {
11554 * console.log(position);
11555 * });
11556 *
11557 * // get file duration
11558 * file.getDuration().then((duration) => {
11559 * console.log(position);
11560 * });
11561 *
11562 * // skip to 10 seconds (expects int value in ms)
11563 * file.seekTo(10000);
11564 *
11565 * // stop playing the file
11566 * file.stop();
11567 *
11568 * // release the native audio resource
11569 * // Platform Quirks:
11570 * // iOS simply create a new instance and the old one will be overwritten
11571 * // Android you must call release() to destroy instances of media when you are done
11572 * file.release();
11573 *
11574 * // Recording to a file
11575 * var newFile = new MediaPlugin('path/to/file.mp3');
11576 * newFile.startRecord();
11577 *
11578 * newFile.stopRecord();
11579 *
11580 *
11581 *
11582 * ```
11583 */
11584var MediaPlugin = (function () {
11585 // Methods
11586 /**
11587 * Open a media file
11588 * @param src {string} A URI containing the audio content.
11589 */
11590 function MediaPlugin(src) {
11591 var _this = this;
11592 this.init = new Promise(function (resolve, reject) {
11593 _this.status = new Observable_2(function (observer) {
11594 _this._objectInstance = new Media(src, resolve, reject, observer.next.bind(observer));
11595 });
11596 });
11597 }
11598 /**
11599 * Get the current amplitude of the current recording.
11600 * @returns {Promise} Returns a promise with the amplitude of the current recording
11601 */
11602 MediaPlugin.prototype.getCurrentAmplitude = function () { return; };
11603 /**
11604 * Get the current position within an audio file. Also updates the Media object's position parameter.
11605 * @returns {Promise} Returns a promise with the position of the current recording
11606 */
11607 MediaPlugin.prototype.getCurrentPosition = function () { return; };
11608 /**
11609 * Get the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.
11610 * @returns {Promise} Returns a promise with the duration of the current recording
11611 */
11612 MediaPlugin.prototype.getDuration = function () { return; };
11613 /**
11614 * Starts or resumes playing an audio file.
11615 */
11616 MediaPlugin.prototype.play = function (iosOptions) { };
11617 /**
11618 * Pauses playing an audio file.
11619 */
11620 MediaPlugin.prototype.pause = function () { };
11621 /**
11622 * Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed.
11623 */
11624 MediaPlugin.prototype.release = function () { };
11625 /**
11626 * Sets the current position within an audio file.
11627 * @param {number} milliseconds The time position you want to set for the current audio file
11628 */
11629 MediaPlugin.prototype.seekTo = function (milliseconds) { };
11630 /**
11631 * Set the volume for an audio file.
11632 * @param volume The volume to set for playback. The value must be within the range of 0.0 to 1.0.
11633 */
11634 MediaPlugin.prototype.setVolume = function (volume) { };
11635 /**
11636 * Starts recording an audio file.
11637 */
11638 MediaPlugin.prototype.startRecord = function () { };
11639 /**
11640 * Stops recording
11641 */
11642 MediaPlugin.prototype.stopRecord = function () { };
11643 /**
11644 * Stops playing an audio file.
11645 */
11646 MediaPlugin.prototype.stop = function () { };
11647 // Constants
11648 /**
11649 * @private
11650 */
11651 MediaPlugin.MEDIA_NONE = 0;
11652 /**
11653 * @private
11654 */
11655 MediaPlugin.MEDIA_STARTING = 1;
11656 /**
11657 * @private
11658 */
11659 MediaPlugin.MEDIA_RUNNING = 2;
11660 /**
11661 * @private
11662 */
11663 MediaPlugin.MEDIA_PAUSED = 3;
11664 /**
11665 * @private
11666 */
11667 MediaPlugin.MEDIA_STOPPED = 4;
11668 // error codes
11669 /**
11670 * @private
11671 */
11672 MediaPlugin.MEDIA_ERR_ABORTED = 1;
11673 /**
11674 * @private
11675 */
11676 MediaPlugin.MEDIA_ERR_NETWORK = 2;
11677 /**
11678 * @private
11679 */
11680 MediaPlugin.MEDIA_ERR_DECODE = 3;
11681 /**
11682 * @private
11683 */
11684 MediaPlugin.MEDIA_ERR_NONE_SUPPORTED = 4;
11685 __decorate$65([
11686 CordovaInstance()
11687 ], MediaPlugin.prototype, "getCurrentAmplitude", null);
11688 __decorate$65([
11689 CordovaInstance()
11690 ], MediaPlugin.prototype, "getCurrentPosition", null);
11691 __decorate$65([
11692 CordovaInstance({
11693 sync: true
11694 })
11695 ], MediaPlugin.prototype, "getDuration", null);
11696 __decorate$65([
11697 CordovaInstance({
11698 sync: true
11699 })
11700 ], MediaPlugin.prototype, "play", null);
11701 __decorate$65([
11702 CordovaInstance({
11703 sync: true
11704 })
11705 ], MediaPlugin.prototype, "pause", null);
11706 __decorate$65([
11707 CordovaInstance({
11708 sync: true
11709 })
11710 ], MediaPlugin.prototype, "release", null);
11711 __decorate$65([
11712 CordovaInstance({
11713 sync: true
11714 })
11715 ], MediaPlugin.prototype, "seekTo", null);
11716 __decorate$65([
11717 CordovaInstance({
11718 sync: true
11719 })
11720 ], MediaPlugin.prototype, "setVolume", null);
11721 __decorate$65([
11722 CordovaInstance({
11723 sync: true
11724 })
11725 ], MediaPlugin.prototype, "startRecord", null);
11726 __decorate$65([
11727 CordovaInstance({
11728 sync: true
11729 })
11730 ], MediaPlugin.prototype, "stopRecord", null);
11731 __decorate$65([
11732 CordovaInstance({
11733 sync: true
11734 })
11735 ], MediaPlugin.prototype, "stop", null);
11736 MediaPlugin = __decorate$65([
11737 Plugin({
11738 repo: 'https://github.com/apache/cordova-plugin-media',
11739 plugin: 'cordova-plugin-media',
11740 pluginRef: 'Media'
11741 })
11742 ], MediaPlugin);
11743 return MediaPlugin;
11744}());
11745
11746var __decorate$66 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11747 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11748 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11749 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;
11750 return c > 3 && r && Object.defineProperty(target, key, r), r;
11751};
11752/**
11753 * @name Mixpanel
11754 * @description
11755 * Cordova Plugin that wraps Mixpanel SDK for Android and iOS
11756 *
11757 * @usage
11758 * ```
11759 * import {Mixpanel} from 'ionic-native';
11760 *
11761 * Mixpanel.init(token)
11762 * .then(onSuccess)
11763 * .catch(onError);
11764 *
11765 * ```
11766 */
11767var Mixpanel = (function () {
11768 function Mixpanel() {
11769 }
11770 /**
11771 *
11772 * @param aliasId {string}
11773 * @param originalId {string}
11774 * @returns {Promise<any>}
11775 */
11776 Mixpanel.alias = function (aliasId, originalId) { return; };
11777 /**
11778 *
11779 * @returns {Promise<any>}
11780 */
11781 Mixpanel.distinctId = function () { return; };
11782 /**
11783 *
11784 */
11785 Mixpanel.flush = function () { return; };
11786 /**
11787 *
11788 * @param distinctId {string}
11789 * @returns {Promise<any>}
11790 */
11791 Mixpanel.identify = function (distinctId) { return; };
11792 /**
11793 *
11794 * @param token {string}
11795 * @returns {Promise<any>}
11796 */
11797 Mixpanel.init = function (token) { return; };
11798 /**
11799 *
11800 * @param superProperties
11801 * @returns {Promise<any>}
11802 */
11803 Mixpanel.registerSuperProperties = function (superProperties) { return; };
11804 /**
11805 *
11806 * @returns {Promise<any>}
11807 */
11808 Mixpanel.reset = function () { return; };
11809 /**
11810 *
11811 * @param eventName
11812 * @param eventProperties
11813 */
11814 Mixpanel.track = function (eventName, eventProperties) { return; };
11815 /**
11816 *
11817 * @returns {Promise<any>}
11818 */
11819 Mixpanel.showSurvey = function () { return; };
11820 Object.defineProperty(Mixpanel, "people", {
11821 /**
11822 *
11823 * @returns {MixpanelPeople}
11824 */
11825 get: function () { return mixpanel.people; },
11826 enumerable: true,
11827 configurable: true
11828 });
11829
11830 __decorate$66([
11831 Cordova()
11832 ], Mixpanel, "alias", null);
11833 __decorate$66([
11834 Cordova()
11835 ], Mixpanel, "distinctId", null);
11836 __decorate$66([
11837 Cordova()
11838 ], Mixpanel, "flush", null);
11839 __decorate$66([
11840 Cordova()
11841 ], Mixpanel, "identify", null);
11842 __decorate$66([
11843 Cordova()
11844 ], Mixpanel, "init", null);
11845 __decorate$66([
11846 Cordova()
11847 ], Mixpanel, "registerSuperProperties", null);
11848 __decorate$66([
11849 Cordova()
11850 ], Mixpanel, "reset", null);
11851 __decorate$66([
11852 Cordova()
11853 ], Mixpanel, "track", null);
11854 __decorate$66([
11855 Cordova()
11856 ], Mixpanel, "showSurvey", null);
11857 __decorate$66([
11858 CordovaProperty
11859 ], Mixpanel, "people", null);
11860 Mixpanel = __decorate$66([
11861 Plugin({
11862 plugin: 'cordova-plugin-mixpanel',
11863 pluginRef: 'mixpanel',
11864 repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin'
11865 })
11866 ], Mixpanel);
11867 return Mixpanel;
11868}());
11869
11870var __decorate$67 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11871 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11872 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11873 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;
11874 return c > 3 && r && Object.defineProperty(target, key, r), r;
11875};
11876/**
11877 * @name MusicControls
11878 * @description
11879 * Music controls for Cordova applications.
11880 * Display a 'media' notification with play/pause, previous, next buttons, allowing the user to control the play.
11881 * Handle also headset event (plug, unplug, headset button).
11882 *
11883 * @usage
11884 * ```
11885 * import {MusicControls} from 'ionic-native';
11886 *
11887 * MusicControls.create({
11888 * track : 'Time is Running Out', // optional, default : ''
11889 * artist : 'Muse', // optional, default : ''
11890 * cover : 'albums/absolution.jpg', // optional, default : nothing
11891 * // cover can be a local path (use fullpath 'file:///storage/emulated/...', or only 'my_image.jpg' if my_image.jpg is in the www folder of your app)
11892 * // or a remote url ('http://...', 'https://...', 'ftp://...')
11893 * isPlaying : true, // optional, default : true
11894 * dismissable : true, // optional, default : false
11895 *
11896 * // hide previous/next/close buttons:
11897 * hasPrev : false, // show previous button, optional, default: true
11898 * hasNext : false, // show next button, optional, default: true
11899 * hasClose : true, // show close button, optional, default: false
11900 *
11901 * // Android only, optional
11902 * // text displayed in the status bar when the notification (and the ticker) are updated
11903 * ticker : 'Now playing "Time is Running Out"'
11904 * });
11905 *
11906 * MusicControls.subscribe().subscribe(action => {
11907 *
11908 * switch(action) {
11909 * case 'music-controls-next':
11910 * // Do something
11911 * break;
11912 * case 'music-controls-previous':
11913 * // Do something
11914 * break;
11915 * case 'music-controls-pause':
11916 * // Do something
11917 * break;
11918 * case 'music-controls-play':
11919 * // Do something
11920 * break;
11921 * case 'music-controls-destroy':
11922 * // Do something
11923 * break;
11924 *
11925 * // Headset events (Android only)
11926 * case 'music-controls-media-button' :
11927 * // Do something
11928 * break;
11929 * case 'music-controls-headset-unplugged':
11930 * // Do something
11931 * break;
11932 * case 'music-controls-headset-plugged':
11933 * // Do something
11934 * break;
11935 * default:
11936 * break;
11937 * }
11938 *
11939 * });
11940 *
11941 * MusicControls.listen(); // activates the observable above
11942 *
11943 * MusicControls.updateIsPlaying(true);
11944 *
11945 *
11946 * ```
11947 */
11948var MusicControls = (function () {
11949 function MusicControls() {
11950 }
11951 /**
11952 * Create the media controls
11953 * @param options {MusicControlsOptions}
11954 * @returns {Promise<any>}
11955 */
11956 MusicControls.create = function (options) { return; };
11957 /**
11958 * Destroy the media controller
11959 * @returns {Promise<any>}
11960 */
11961 MusicControls.destroy = function () { return; };
11962 /**
11963 * Subscribe to the events of the media controller
11964 * @returns {Observable<any>}
11965 */
11966 MusicControls.subscribe = function () { return; };
11967 /**
11968 * Start listening for events, this enables the Observable from the subscribe method
11969 */
11970 MusicControls.listen = function () { };
11971 /**
11972 * Toggle play/pause:
11973 * @param isPlaying {boolean}
11974 */
11975 MusicControls.updateIsPlaying = function (isPlaying) { };
11976 __decorate$67([
11977 Cordova()
11978 ], MusicControls, "create", null);
11979 __decorate$67([
11980 Cordova()
11981 ], MusicControls, "destroy", null);
11982 __decorate$67([
11983 Cordova({
11984 observable: true
11985 })
11986 ], MusicControls, "subscribe", null);
11987 __decorate$67([
11988 Cordova({ sync: true })
11989 ], MusicControls, "listen", null);
11990 __decorate$67([
11991 Cordova({ sync: true })
11992 ], MusicControls, "updateIsPlaying", null);
11993 MusicControls = __decorate$67([
11994 Plugin({
11995 plugin: 'cordova-plugin-music-controls',
11996 pluginRef: 'MusicControls',
11997 repo: 'https://github.com/homerours/cordova-music-controls-plugin'
11998 })
11999 ], MusicControls);
12000 return MusicControls;
12001}());
12002
12003var __decorate$68 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12004 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12005 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12006 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;
12007 return c > 3 && r && Object.defineProperty(target, key, r), r;
12008};
12009/**
12010 * @name Network
12011 * @description
12012 * Requires Cordova plugin: cordova-plugin-network-information. For more info, please see the [Network plugin docs](https://github.com/apache/cordova-plugin-network-information).
12013 *
12014 * @usage
12015 * ```typescript
12016 * import { Network } from 'ionic-native';
12017 *
12018 * // watch network for a disconnect
12019 * let disconnectSubscription = Network.onDisconnect().subscribe(() => {
12020 * console.log('network was disconnected :-(');
12021 * });
12022 *
12023 * // stop disconnect watch
12024 * disconnectSubscription.unsubscribe();
12025 *
12026 *
12027 * // watch network for a connection
12028 * let connectSubscription = Network.onConnect().subscribe(() => {
12029 * console.log('network connected!');
12030
12031 * // We just got a connection but we need to wait briefly
12032 *
12033 // before we determine the connection type. Might need to wait
12034
12035 * // prior to doing any api requests as well.
12036 * setTimeout(() => {
12037 * if (Network.connection === 'wifi') {
12038 * console.log('we got a wifi connection, woohoo!');
12039 * }
12040 * }, 3000);
12041 * });
12042 *
12043 * // stop connect watch
12044 * connectSubscription.unsubscribe();
12045 *
12046 * ```
12047 * @advanced
12048 * The `connection` property will return one of the following connection types: `unknown`, `ethernet`, `wifi`, `2g`, `3g`, `4g`, `cellular`, `none`
12049 */
12050var Network = (function () {
12051 function Network() {
12052 }
12053 Object.defineProperty(Network, "connection", {
12054 /**
12055 * Return the network connection type
12056 */
12057 get: function () { return navigator.connection.type; },
12058 enumerable: true,
12059 configurable: true
12060 });
12061 /**
12062 * Get notified when the device goes offline
12063 * @returns {Observable<any>} Returns an observable.
12064 */
12065 Network.onDisconnect = function () { return; };
12066 /**
12067 * Get notified when the device goes online
12068 * @returns {Observable<any>} Returns an observable.
12069 */
12070 Network.onConnect = function () { return; };
12071 __decorate$68([
12072 CordovaProperty
12073 ], Network, "connection", null);
12074 __decorate$68([
12075 Cordova({
12076 eventObservable: true,
12077 event: 'offline'
12078 })
12079 ], Network, "onDisconnect", null);
12080 __decorate$68([
12081 Cordova({
12082 eventObservable: true,
12083 event: 'online'
12084 })
12085 ], Network, "onConnect", null);
12086 Network = __decorate$68([
12087 Plugin({
12088 plugin: 'cordova-plugin-network-information',
12089 repo: 'https://github.com/apache/cordova-plugin-network-information',
12090 platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser'],
12091 pluginRef: 'navigator.connection'
12092 })
12093 ], Network);
12094 return Network;
12095}());
12096
12097var __decorate$69 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12098 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12099 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12100 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;
12101 return c > 3 && r && Object.defineProperty(target, key, r), r;
12102};
12103/**
12104 * @name NFC
12105 * @description
12106 * The NFC plugin allows you to read and write NFC tags. You can also beam to, and receive from, other NFC enabled devices.
12107 *
12108 * Use to
12109 * - read data from NFC tags
12110 * - write data to NFC tags
12111 * - send data to other NFC enabled devices
12112 * - receive data from NFC devices
12113 *
12114 * This plugin uses NDEF (NFC Data Exchange Format) for maximum compatibilty between NFC devices, tag types, and operating systems.
12115 *
12116 * @usage
12117 * ```
12118 * import {NFC, Ndef} from 'ionic-native';
12119 *
12120 * let message = Ndef.textRecord('Hello world');
12121 * NFC.share([message]).then(onSuccess).catch(onError);
12122 *
12123 * ```
12124 */
12125var NFC = (function () {
12126 function NFC() {
12127 }
12128 /**
12129 * Registers an event listener for any NDEF tag.
12130 * @param onSuccess
12131 * @param onFailure
12132 * @return {Promise<any>}
12133 */
12134 NFC.addNdefListener = function (onSuccess, onFailure) { return; };
12135 /**
12136 * Registers an event listener for tags matching any tag type.
12137 * @param mimeType
12138 * @param onSuccess
12139 * @param onFailure
12140 * @return {Promise<any>}
12141 */
12142 NFC.addTagDiscoveredListener = function (mimeType, onSuccess, onFailure) { return; };
12143 /**
12144 * Registers an event listener for NDEF tags matching a specified MIME type.
12145 * @param onSuccess
12146 * @param onFailure
12147 * @return {Promise<any>}
12148 */
12149 NFC.addMimeTypeListener = function (onSuccess, onFailure) { return; };
12150 /**
12151 * Registers an event listener for formatable NDEF tags.
12152 * @param onSuccess
12153 * @param onFailure
12154 * @return {Promise<any>}
12155 */
12156 NFC.addNdefFormatableListener = function (onSuccess, onFailure) { return; };
12157 /**
12158 * Qrites an NdefMessage to a NFC tag.
12159 * @param message {any[]}
12160 * @return {Promise<any>}
12161 */
12162 NFC.write = function (message) { return; };
12163 /**
12164 * Makes a NFC tag read only. **Warning** this is permanent.
12165 * @return {Promise<any>}
12166 */
12167 NFC.makeReadyOnly = function () { return; };
12168 /**
12169 * Shares an NDEF Message via peer-to-peer.
12170 * @param message An array of NDEF Records.
12171 * @return {Promise<any>}
12172 */
12173 NFC.share = function (message) { return; };
12174 /**
12175 * Stop sharing NDEF data via peer-to-peer.
12176 * @return {Promise<any>}
12177 */
12178 NFC.unshare = function () { return; };
12179 /**
12180 * Erase a NDEF tag
12181 */
12182 NFC.erase = function () { return; };
12183 /**
12184 * Send a file to another device via NFC handover.
12185 * @param uris A URI as a String, or an array of URIs.
12186 * @return {Promise<any>}
12187 */
12188 NFC.handover = function (uris) { return; };
12189 /**
12190 * Stop sharing NDEF data via NFC handover.
12191 * @return {Promise<any>}
12192 */
12193 NFC.stopHandover = function () { return; };
12194 /**
12195 * Show the NFC settings on the device.
12196 * @return {Promise<any>}
12197 */
12198 NFC.showSettings = function () { return; };
12199 /**
12200 * Check if NFC is available and enabled on this device.
12201 * @return {Promise<any>}
12202 */
12203 NFC.enabled = function () { return; };
12204 __decorate$69([
12205 Cordova({
12206 observable: true,
12207 successIndex: 0,
12208 errorIndex: 3,
12209 clearFunction: 'removeNdefListener',
12210 clearWithArgs: true
12211 })
12212 ], NFC, "addNdefListener", null);
12213 __decorate$69([
12214 Cordova({
12215 observable: true,
12216 successIndex: 1,
12217 errorIndex: 4,
12218 clearFunction: 'removeTagDiscoveredListener',
12219 clearWithArgs: true
12220 })
12221 ], NFC, "addTagDiscoveredListener", null);
12222 __decorate$69([
12223 Cordova({
12224 observable: true,
12225 successIndex: 0,
12226 errorIndex: 3,
12227 clearFunction: 'removeMimeTypeListener',
12228 clearWithArgs: true
12229 })
12230 ], NFC, "addMimeTypeListener", null);
12231 __decorate$69([
12232 Cordova({
12233 observable: true,
12234 successIndex: 0,
12235 errorIndex: 3
12236 })
12237 ], NFC, "addNdefFormatableListener", null);
12238 __decorate$69([
12239 Cordova()
12240 ], NFC, "write", null);
12241 __decorate$69([
12242 Cordova()
12243 ], NFC, "makeReadyOnly", null);
12244 __decorate$69([
12245 Cordova()
12246 ], NFC, "share", null);
12247 __decorate$69([
12248 Cordova()
12249 ], NFC, "unshare", null);
12250 __decorate$69([
12251 Cordova()
12252 ], NFC, "erase", null);
12253 __decorate$69([
12254 Cordova()
12255 ], NFC, "handover", null);
12256 __decorate$69([
12257 Cordova()
12258 ], NFC, "stopHandover", null);
12259 __decorate$69([
12260 Cordova()
12261 ], NFC, "showSettings", null);
12262 __decorate$69([
12263 Cordova()
12264 ], NFC, "enabled", null);
12265 NFC = __decorate$69([
12266 Plugin({
12267 plugin: 'phonegap-nfc',
12268 pluginRef: 'nfc',
12269 repo: 'https://github.com/chariotsolutions/phonegap-nfc'
12270 })
12271 ], NFC);
12272 return NFC;
12273}());
12274
12275var __decorate$70 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12276 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12277 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12278 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;
12279 return c > 3 && r && Object.defineProperty(target, key, r), r;
12280};
12281/**
12282 * @name OneSignal
12283 * @description
12284 * The OneSignal plugin is an client implementation for using the [OneSignal](https://onesignal.com/) Service.
12285 * OneSignal is a simple implementation for delivering push notifications.
12286 *
12287 * Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
12288 *
12289 * @usage
12290 * ```typescript
12291 * import { OneSignal } from 'ionic-native';
12292 *
12293 * OneSignal.init('b2f7f966-d8cc-11e4-bed1-df8f05be55ba',
12294 * {googleProjectNumber: '703322744261'})
12295 * .subscribe(jsonData => {
12296 * console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
12297 * });
12298 *
12299 * OneSignal.enableInAppAlertNotification(true);
12300 * ```
12301 *
12302 */
12303var OneSignal = (function () {
12304 function OneSignal() {
12305 }
12306 /**
12307 * Only required method you need to call to setup OneSignal to receive push notifications. Call this from the `deviceready` event.
12308 *
12309 * @param {appId} Your AppId from your OneSignal app
12310 * @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
12311 * @returns {Observable} when a notification is received. Handle your notification action here.
12312 */
12313 OneSignal.init = function (appId, options) { return; };
12314 /**
12315 * Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt.
12316 * Only use if you passed false to autoRegister when calling init.
12317 */
12318 OneSignal.registerForPushNotifications = function () { };
12319 /**
12320 * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
12321 * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
12322 *
12323 * @param {key} Key of your choosing to create or update.
12324 * @param {value} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag.
12325 */
12326 OneSignal.sendTag = function (key, value) { };
12327 /**
12328 * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users.
12329 * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time.
12330 *
12331 * @param {json} Pass a json object with key/value pairs like: {key: "value", key2: "value2"}
12332 */
12333 OneSignal.sendTags = function (json) { };
12334 /**
12335 * Retrieve a list of tags that have been set on the user from the OneSignal server.
12336 *
12337 * @returns {Promise} Returns a Promise that resolves when tags are recieved.
12338 */
12339 OneSignal.getTags = function () { return; };
12340 /**
12341 * Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one.
12342 *
12343 * @param {key} Key to remove.
12344 */
12345 OneSignal.deleteTag = function (key) { };
12346 /**
12347 * Deletes tags that were previously set on a user with `sendTag` or `sendTags`.
12348 *
12349 * @param {keys} Keys to remove.
12350 */
12351 OneSignal.deleteTags = function (keys) { };
12352 /**
12353 * Lets you retrieve the OneSignal user id and device token.
12354 * Your handler is called after the device is successfully registered with OneSignal.
12355 *
12356 * @returns {Promise} Returns a Promise that reolves if the device was successfully registered.
12357 * It returns a JSON with `userId`and `pushToken`.
12358 */
12359 OneSignal.getIds = function () { return; };
12360 /**
12361 * Warning:
12362 * Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications.
12363 *
12364 * By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode.
12365 * Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode.
12366 *
12367 * @param {enable} false to disable vibrate, true to re-enable it.
12368 */
12369 OneSignal.enableVibrate = function (enable) { };
12370 /**
12371 * Warning:
12372 * Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications.
12373 *
12374 * By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on.
12375 * Passing false means that the device will only vibrate unless the device is set to a total silent mode.
12376 *
12377 * @param {enable} false to disable sound, true to re-enable it.
12378 */
12379 OneSignal.enableSound = function (enable) { };
12380 /**
12381 * Warning:
12382 * Only applies to Android and Amazon devices.
12383 *
12384 * By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
12385 * If set to true notifications will always show in the notification area and notificationOpenedCallback will not fire until the user taps on the notification.
12386 *
12387 * @param {enable} enable
12388 */
12389 OneSignal.enableNotificationsWhenActive = function (enable) { };
12390 /**
12391 * By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
12392 * If set to true notifications will be shown as native alert boxes if a notification is received when the user is in your app.
12393 * The notificationOpenedCallback is then fired after the alert box is closed.
12394 *
12395 * @param {enable} enable
12396 */
12397 OneSignal.enableInAppAlertNotification = function (enable) { };
12398 /**
12399 * You can call this method with false to opt users out of receiving all notifications through OneSignal.
12400 * You can pass true later to opt users back into notifications.
12401 *
12402 * @param {enable} enable
12403 */
12404 OneSignal.setSubscription = function (enable) { };
12405 /**
12406 *
12407 * @param {notificationObj} Parameters see POST [documentation](https://documentation.onesignal.com/v2.0/docs/notifications-create-notification)
12408 * @returns {Promise} Returns a Promise that resolves if the notification was send successfully.
12409 */
12410 OneSignal.postNotification = function (notificationObj) { return; };
12411 /**
12412 * Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard.
12413 */
12414 OneSignal.promptLocation = function () { };
12415 /**
12416 * Enable logging to help debug if you run into an issue setting up OneSignal.
12417 * The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
12418
12419 * The higher the value the more information is shown.
12420 *
12421 * @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages)
12422 */
12423 OneSignal.setLogLevel = function (logLevel) { };
12424 __decorate$70([
12425 Cordova({ observable: true })
12426 ], OneSignal, "init", null);
12427 __decorate$70([
12428 Cordova({ sync: true })
12429 ], OneSignal, "registerForPushNotifications", null);
12430 __decorate$70([
12431 Cordova({ sync: true })
12432 ], OneSignal, "sendTag", null);
12433 __decorate$70([
12434 Cordova({ sync: true })
12435 ], OneSignal, "sendTags", null);
12436 __decorate$70([
12437 Cordova()
12438 ], OneSignal, "getTags", null);
12439 __decorate$70([
12440 Cordova({ sync: true })
12441 ], OneSignal, "deleteTag", null);
12442 __decorate$70([
12443 Cordova({ sync: true })
12444 ], OneSignal, "deleteTags", null);
12445 __decorate$70([
12446 Cordova()
12447 ], OneSignal, "getIds", null);
12448 __decorate$70([
12449 Cordova({ sync: true })
12450 ], OneSignal, "enableVibrate", null);
12451 __decorate$70([
12452 Cordova({ sync: true })
12453 ], OneSignal, "enableSound", null);
12454 __decorate$70([
12455 Cordova({ sync: true })
12456 ], OneSignal, "enableNotificationsWhenActive", null);
12457 __decorate$70([
12458 Cordova({ sync: true })
12459 ], OneSignal, "enableInAppAlertNotification", null);
12460 __decorate$70([
12461 Cordova({ sync: true })
12462 ], OneSignal, "setSubscription", null);
12463 __decorate$70([
12464 Cordova()
12465 ], OneSignal, "postNotification", null);
12466 __decorate$70([
12467 Cordova({ sync: true })
12468 ], OneSignal, "promptLocation", null);
12469 __decorate$70([
12470 Cordova({ sync: true })
12471 ], OneSignal, "setLogLevel", null);
12472 OneSignal = __decorate$70([
12473 Plugin({
12474 plugin: 'onesignal-cordova-plugin',
12475 pluginRef: 'plugins.OneSignal',
12476 repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK'
12477 })
12478 ], OneSignal);
12479 return OneSignal;
12480}());
12481
12482var __decorate$71 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12483 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12484 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12485 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;
12486 return c > 3 && r && Object.defineProperty(target, key, r), r;
12487};
12488/**
12489 * @name Photo Viewer
12490 * @description This plugin can display your image in full screen with the ability to pan, zoom, and share the image.
12491 * @usage
12492 * ```typescript
12493 * import { PhotoViewer } from 'ionic-native';
12494 *
12495 * PhotoViewer.show('https://mysite.com/path/to/image.jpg');
12496 *
12497 * PhotoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false});
12498 * ```
12499 */
12500var PhotoViewer = (function () {
12501 function PhotoViewer() {
12502 }
12503 /**
12504 * Shows an image in full screen
12505 * @param url {string} URL or path to image
12506 * @param title {string}
12507 * @param options {any}
12508 */
12509 PhotoViewer.show = function (url, title, options) { };
12510 __decorate$71([
12511 Cordova({ sync: true })
12512 ], PhotoViewer, "show", null);
12513 PhotoViewer = __decorate$71([
12514 Plugin({
12515 plugin: 'com-sarriaroman-photoviewer',
12516 pluginRef: 'PhotoViewer',
12517 repo: 'https://github.com/sarriaroman/photoviewer'
12518 })
12519 ], PhotoViewer);
12520 return PhotoViewer;
12521}());
12522
12523var __decorate$72 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12524 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12525 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12526 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;
12527 return c > 3 && r && Object.defineProperty(target, key, r), r;
12528};
12529/**
12530 * @name Screen Orientation
12531 * @description
12532 * Cordova plugin to set/lock the screen orientation in a common way for iOS, Android, WP8 and Blackberry 10.
12533 * This plugin is based on an early version of Screen Orientation API so the api does not currently match the current spec.
12534 *
12535 * Requires Cordova plugin: `cordova-plugin-screen-orientation`. For more info, please see the [Screen Orientation plugin docs](https://github.com/apache/cordova-plugin-screen-orientation).
12536 *
12537 * @usage
12538 * ```typescript
12539 * import { ScreenOrientation } from 'ionic-native';
12540 *
12541 *
12542 * // set to either landscape
12543 * ScreenOrientation.lockOrientation('landscape');
12544 *
12545 * // allow user rotate
12546 * ScreenOrientation.unlockOrientation();
12547 * ```
12548 *
12549 * @advanced
12550 *
12551 * Accepted orientation values:
12552 *
12553 * | Value | Description |
12554 * |-------------------------------|------------------------------------------------------------------------------|
12555 * | portrait-primary | The orientation is in the primary portrait mode. |
12556 * | portrait-secondary | The orientation is in the secondary portrait mode. |
12557 * | landscape-primary | The orientation is in the primary landscape mode. |
12558 * | landscape-secondary | The orientation is in the secondary landscape mode. |
12559 * | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). |
12560 * | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). |
12561 *
12562 */
12563var ScreenOrientation = (function () {
12564 function ScreenOrientation() {
12565 }
12566 /**
12567 * Lock the orientation to the passed value.
12568 * See below for accepted values
12569 * @param {orientation} The orientation which should be locked. Accepted values see table below.
12570 */
12571 ScreenOrientation.lockOrientation = function (orientation) { };
12572 /**
12573 * Unlock and allow all orientations.
12574 */
12575 ScreenOrientation.unlockOrientation = function () { };
12576 Object.defineProperty(ScreenOrientation, "orientation", {
12577 /*
12578 * Get the current orientation of the device.
12579 */
12580 get: function () {
12581 return window.screen.orientation;
12582 },
12583 enumerable: true,
12584 configurable: true
12585 });
12586 __decorate$72([
12587 Cordova({ sync: true })
12588 ], ScreenOrientation, "lockOrientation", null);
12589 __decorate$72([
12590 Cordova({ sync: true })
12591 ], ScreenOrientation, "unlockOrientation", null);
12592 __decorate$72([
12593 CordovaProperty
12594 ], ScreenOrientation, "orientation", null);
12595 ScreenOrientation = __decorate$72([
12596 Plugin({
12597 plugin: 'cordova-plugin-screen-orientation',
12598 pluginRef: 'window.screen',
12599 repo: 'https://github.com/apache/cordova-plugin-screen-orientation',
12600 platforms: ['Android', 'iOS', 'Windows Phone 8']
12601 })
12602 ], ScreenOrientation);
12603 return ScreenOrientation;
12604}());
12605
12606var __decorate$73 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12607 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12608 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12609 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;
12610 return c > 3 && r && Object.defineProperty(target, key, r), r;
12611};
12612/**
12613 * @name PayPal
12614 * @description
12615 * PayPal plugin for Cordova/Ionic Applications
12616 *
12617 * @usage
12618 * ```
12619 * import {PayPal} from 'ionic-native';
12620 *
12621 * PayPal.init({
12622 * "PayPalEnvironmentProduction": "YOUR_PRODUCTION_CLIENT_ID",
12623 "PayPalEnvironmentSandbox": "YOUR_SANDBOX_CLIENT_ID"
12624 })
12625 * .then(onSuccess)
12626 * .catch(onError);
12627 *
12628 * ```
12629 */
12630var PayPal = (function () {
12631 function PayPal() {
12632 }
12633 /**
12634 * You must preconnect to PayPal to prepare the device for processing payments.
12635 * This improves the user experience, by making the presentation of the
12636 * UI faster. The preconnect is valid for a limited time, so
12637 * the recommended time to preconnect is on page load.
12638 *
12639 * @param {String} environment: available options are "PayPalEnvironmentNoNetwork", "PayPalEnvironmentProduction" and "PayPalEnvironmentSandbox"
12640 * @param {PayPalConfiguration} configuration: For Future Payments merchantName, merchantPrivacyPolicyURL and merchantUserAgreementURL must be set be set
12641 */
12642 PayPal.init = function (environment, configuration) { return; };
12643 /**
12644 * Retreive the version of PayPal iOS SDK Library.
12645 */
12646 PayPal.version = function () { return; };
12647 /**
12648 * Start PayPal UI to collect payment from the user.
12649 * See https://developer.paypal.com/webapps/developer/docs/integration/mobile/ios-integration-guide/
12650 * for more documentation of the params.
12651 *
12652 * @param {PayPalPayment} payment: PayPalPayment object
12653 */
12654 PayPal.renderSinglePaymentUI = function (payment) { return; };
12655 /**
12656 * Once a user has consented to future payments, when the user subsequently initiates a PayPal payment
12657 * from their device to be completed by your server, PayPal uses a Correlation ID to verify that the
12658 * payment is originating from a valid, user-consented device+application.
12659 * This helps reduce fraud and decrease declines.
12660 * This method MUST be called prior to initiating a pre-consented payment (a "future payment") from a mobile device.
12661 * Pass the result to your server, to include in the payment request sent to PayPal.
12662 * Do not otherwise cache or store this value.
12663 */
12664 PayPal.clientMetadataID = function () { return; };
12665 /**
12666 * Please Read Docs on Future Payments at https://github.com/paypal/PayPal-iOS-SDK#future-payments
12667 */
12668 PayPal.renderFuturePaymentUI = function () { return; };
12669 /**
12670 * Please Read Docs on Profile Sharing at https://github.com/paypal/PayPal-iOS-SDK#profile-sharing
12671 *
12672 * @param {Array<string>} scopes: scopes Set of requested scope-values. Accepted scopes are: openid, profile, address, email, phone, futurepayments and paypalattributes
12673 * See https://developer.paypal.com/docs/integration/direct/identity/attributes/ for more details
12674 **/
12675 PayPal.renderProfileSharingUI = function (scopes) { return; };
12676 __decorate$73([
12677 Cordova()
12678 ], PayPal, "init", null);
12679 __decorate$73([
12680 Cordova()
12681 ], PayPal, "version", null);
12682 __decorate$73([
12683 Cordova()
12684 ], PayPal, "renderSinglePaymentUI", null);
12685 __decorate$73([
12686 Cordova()
12687 ], PayPal, "clientMetadataID", null);
12688 __decorate$73([
12689 Cordova()
12690 ], PayPal, "renderFuturePaymentUI", null);
12691 __decorate$73([
12692 Cordova()
12693 ], PayPal, "renderProfileSharingUI", null);
12694 PayPal = __decorate$73([
12695 Plugin({
12696 plugin: 'com.paypal.cordova.mobilesdk',
12697 pluginRef: 'PayPalMobile',
12698 repo: 'https://github.com/paypal/PayPal-Cordova-Plugin'
12699 })
12700 ], PayPal);
12701 return PayPal;
12702}());
12703
12704var __decorate$74 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12705 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12706 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12707 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;
12708 return c > 3 && r && Object.defineProperty(target, key, r), r;
12709};
12710/**
12711 * @name Pin Dialog
12712 * @description
12713 *
12714 * @usage
12715 * ```typescript
12716 * import { PinDialog } from 'ionic-native';
12717 *
12718 *
12719 * PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel'])
12720 * .then(
12721 * (result: any) => {
12722 * if (result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
12723 * else if(result.buttonIndex == 2) console.log('User cancelled');
12724 * }
12725 * );
12726 * ```
12727 */
12728var PinDialog = (function () {
12729 function PinDialog() {
12730 }
12731 /**
12732 * Show pin dialog
12733 * @param {string} message Message to show the user
12734 * @param {string} title Title of the dialog
12735 * @param {string[]} buttons Buttons to show
12736 */
12737 PinDialog.prompt = function (message, title, buttons) { return; };
12738 __decorate$74([
12739 Cordova({
12740 successIndex: 1
12741 })
12742 ], PinDialog, "prompt", null);
12743 PinDialog = __decorate$74([
12744 Plugin({
12745 plugin: 'cordova-plugin-pin-dialog',
12746 pluginRef: 'plugins.pinDialog',
12747 repo: 'https://github.com/Paldom/PinDialog'
12748 })
12749 ], PinDialog);
12750 return PinDialog;
12751}());
12752
12753var __decorate$75 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12754 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12755 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12756 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;
12757 return c > 3 && r && Object.defineProperty(target, key, r), r;
12758};
12759/**
12760 * @name PowerManagement
12761 * @description
12762 * The PowerManagement plugin offers access to the devices power-management functionality.
12763 * It should be used for applications which keep running for a long time without any user interaction.
12764 *
12765 * @usage
12766 * ```
12767 * import {PowerManagement} from 'ionic-native';
12768 *
12769 * PowerManagement.acquire()
12770 * .then(onSuccess)
12771 * .catch(onError);
12772 *
12773 * ```
12774 */
12775var PowerManagement = (function () {
12776 function PowerManagement() {
12777 }
12778 /**
12779 * Acquire a wakelock by calling this.
12780 */
12781 PowerManagement.acquire = function () { return; };
12782 /**
12783 * This acquires a partial wakelock, allowing the screen to be dimmed.
12784 */
12785 PowerManagement.dim = function () { return; };
12786 /**
12787 * Release the wakelock. It's important to do this when you're finished with the wakelock, to avoid unnecessary battery drain.
12788 */
12789 PowerManagement.release = function () { return; };
12790 /**
12791 * By default, the plugin will automatically release a wakelock when your app is paused (e.g. when the screen is turned off, or the user switches to another app).
12792 * It will reacquire the wakelock upon app resume. If you would prefer to disable this behaviour, you can use this function.
12793 * @param set {boolean}
12794 */
12795 PowerManagement.setReleaseOnPause = function (set) { return; };
12796 __decorate$75([
12797 Cordova()
12798 ], PowerManagement, "acquire", null);
12799 __decorate$75([
12800 Cordova()
12801 ], PowerManagement, "dim", null);
12802 __decorate$75([
12803 Cordova()
12804 ], PowerManagement, "release", null);
12805 __decorate$75([
12806 Cordova()
12807 ], PowerManagement, "setReleaseOnPause", null);
12808 PowerManagement = __decorate$75([
12809 Plugin({
12810 plugin: 'cordova-plugin-powermanagement-orig',
12811 pluginRef: 'https://github.com/Viras-/cordova-plugin-powermanagement',
12812 repo: 'powerManagement'
12813 })
12814 ], PowerManagement);
12815 return PowerManagement;
12816}());
12817
12818var __decorate$76 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12819 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12820 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12821 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;
12822 return c > 3 && r && Object.defineProperty(target, key, r), r;
12823};
12824/**
12825 * @name Printer
12826 * @description Prints documents or HTML rendered content
12827 * @usage
12828 * ```typescript
12829 * import {Printer, PrintOptions} from 'ionic-native';
12830 *
12831 * Printer.isAvailable().then(onSuccess, onError);
12832 *
12833 * let options: PrintOptions = {
12834 * name: 'MyDocument',
12835 * printerId: 'printer007',
12836 * duplex: true,
12837 * landscape: true,
12838 * grayscale: true
12839 * };
12840 *
12841 * Printer.print(content, options).then(onSuccess, onError);
12842 * ```
12843 */
12844var Printer = (function () {
12845 function Printer() {
12846 }
12847 /**
12848 * Checks whether to device is capable of printing.
12849 */
12850 Printer.isAvailable = function () { return; };
12851 /**
12852 * Sends content to the printer.
12853 * @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
12854 * @param {options} The options to pass to the printer
12855 */
12856 Printer.print = function (content, options) { return; };
12857 __decorate$76([
12858 Cordova()
12859 ], Printer, "isAvailable", null);
12860 __decorate$76([
12861 Cordova()
12862 ], Printer, "print", null);
12863 Printer = __decorate$76([
12864 Plugin({
12865 plugin: 'de.appplant.cordova.plugin.printer',
12866 pluginRef: 'cordova.plugins.printer',
12867 repo: 'https://github.com/katzer/cordova-plugin-printer.git',
12868 platforms: ['Android', 'iOS']
12869 })
12870 ], Printer);
12871 return Printer;
12872}());
12873
12874var __decorate$77 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12875 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12876 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12877 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;
12878 return c > 3 && r && Object.defineProperty(target, key, r), r;
12879};
12880/**
12881 * @name Push
12882 * @description
12883 * Register and receive push notifications.
12884 *
12885 * Requires Cordova plugin: `phonegap-plugin-push`. For more info, please see the [Push plugin docs](https://github.com/phonegap/phonegap-plugin-push).
12886 *
12887 * For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
12888 *
12889 * @usage
12890 * ```typescript
12891 * import { Push } from 'ionic-native';
12892 * ```
12893 */
12894var Push = (function () {
12895 function Push() {
12896 }
12897 /**
12898 * Initialize the plugin on the native side.
12899 *
12900 * ```
12901 * var push = Push.init({
12902 * android: {
12903 * senderID: '12345679'
12904 * },
12905 * ios: {
12906 * alert: 'true',
12907 * badge: true,
12908 * sound: 'false'
12909 * },
12910 * windows: {}
12911 * });
12912 * ```
12913 *
12914 * @param {PushOptions} options The Push [options](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#parameters).
12915 * @return {PushNotification} Returns a new [PushNotification](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#pushonevent-callback) object.
12916 */
12917 Push.init = function (options) { return; };
12918 /**
12919 * Check whether the push notification permission has been granted.
12920 * @return {Promise} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
12921 */
12922 Push.hasPermission = function () { return; };
12923 __decorate$77([
12924 Cordova({
12925 sync: true
12926 })
12927 ], Push, "init", null);
12928 __decorate$77([
12929 Cordova()
12930 ], Push, "hasPermission", null);
12931 Push = __decorate$77([
12932 Plugin({
12933 plugin: 'phonegap-plugin-push',
12934 pluginRef: 'PushNotification',
12935 repo: 'https://github.com/phonegap/phonegap-plugin-push'
12936 })
12937 ], Push);
12938 return Push;
12939}());
12940
12941var __decorate$78 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
12942 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12943 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12944 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;
12945 return c > 3 && r && Object.defineProperty(target, key, r), r;
12946};
12947/**
12948 * @name SafariViewController
12949 * @description
12950 * @usage
12951 * ```
12952 * import { SafariViewController } from 'ionic-native';
12953 *
12954 *
12955 * SafariViewController.isAvailable()
12956 * .then(
12957 * (available: boolean) => {
12958 * if(available){
12959 *
12960 * SafariViewController.show({
12961 * url: 'http://ionic.io',
12962 * hidden: false,
12963 * animated: false,
12964 * transition: 'curl',
12965 * enterReaderModeIfAvailable: true,
12966 * tintColor: '#ff0000'
12967 * })
12968 * .then(
12969 * (result: any) => {
12970 * if(result.event === 'opened') console.log('Opened');
12971 * else if(result.event === 'loaded') console.log('Loaded');
12972 * else if(result.event === 'closed') console.log('Closed');
12973 * },
12974 * (error: any) => console.error(error)
12975 * );
12976 *
12977 * } else {
12978 * // use fallback browser, example InAppBrowser
12979 * }
12980 * }
12981 * );
12982 * ```
12983 */
12984var SafariViewController = (function () {
12985 function SafariViewController() {
12986 }
12987 /**
12988 * Checks if SafariViewController is available
12989 */
12990 SafariViewController.isAvailable = function () { return; };
12991 /**
12992 * Shows Safari View Controller
12993 * @param options
12994 */
12995 SafariViewController.show = function (options) { return; };
12996 /**
12997 * Hides Safari View Controller
12998 */
12999 SafariViewController.hide = function () { };
13000 /**
13001 * Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below.
13002 */
13003 SafariViewController.connectToService = function () { return; };
13004 /**
13005 * Call this method whenever there's a chance the user will open an external url.
13006 */
13007 SafariViewController.warmUp = function () { return; };
13008 /**
13009 * For even better performance optimization, call this methods if there's more than a 50% chance the user will open a certain URL.
13010 * @param url
13011 */
13012 SafariViewController.mayLaunchUrl = function (url) { return; };
13013 __decorate$78([
13014 Cordova()
13015 ], SafariViewController, "isAvailable", null);
13016 __decorate$78([
13017 Cordova()
13018 ], SafariViewController, "show", null);
13019 __decorate$78([
13020 Cordova()
13021 ], SafariViewController, "hide", null);
13022 __decorate$78([
13023 Cordova()
13024 ], SafariViewController, "connectToService", null);
13025 __decorate$78([
13026 Cordova()
13027 ], SafariViewController, "warmUp", null);
13028 __decorate$78([
13029 Cordova()
13030 ], SafariViewController, "mayLaunchUrl", null);
13031 SafariViewController = __decorate$78([
13032 Plugin({
13033 plugin: 'cordova-plugin-safariviewcontroller',
13034 pluginRef: 'SafariViewController',
13035 platforms: ['iOS', 'Android'],
13036 repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller'
13037 })
13038 ], SafariViewController);
13039 return SafariViewController;
13040}());
13041
13042var __decorate$79 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13043 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13044 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13045 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;
13046 return c > 3 && r && Object.defineProperty(target, key, r), r;
13047};
13048/**
13049 * @name Screenshot
13050 * @description Captures a screen shot
13051 * @usage
13052 * ```typescript
13053 * import {Screenshot} from 'ionic-native';
13054 *
13055 * // Take a screenshot and save to file
13056 * Screenshot.save('jpg', 80, 'myscreenshot.jpg').then(onSuccess, onError);
13057 *
13058 * // Take a screenshot and get temporary file URI
13059 * Screenshot.URI(80).then(onSuccess, onError);
13060 * ```
13061 */
13062var Screenshot = (function () {
13063 function Screenshot() {
13064 }
13065 /**
13066 * Takes screenshot and saves the image
13067 *
13068 * @param {string} format. Format can take the value of either 'jpg' or 'png'
13069 * On ios, only 'jpg' format is supported
13070 * @param {number} quality. Determines the quality of the screenshot.
13071 * Default quality is set to 100.
13072 * @param {string} filename. Name of the file as stored on the storage
13073 */
13074 Screenshot.save = function (format, quality, filename) {
13075 return new Promise(function (resolve, reject) {
13076 navigator.screenshot.save(function (error, result) {
13077 if (error) {
13078 reject(error);
13079 }
13080 else {
13081 resolve(result);
13082 }
13083 }, format, quality, filename);
13084 });
13085 };
13086 /**
13087 * Takes screenshot and returns the image as an URI
13088 *
13089 * @param {number} quality. Determines the quality of the screenshot.
13090 * Default quality is set to 100.
13091 */
13092 Screenshot.URI = function (quality) {
13093 return new Promise(function (resolve, reject) {
13094 navigator.screenshot.URI(function (error, result) {
13095 if (error) {
13096 reject(error);
13097 }
13098 else {
13099 resolve(result);
13100 }
13101 }, quality);
13102 });
13103 };
13104 Screenshot = __decorate$79([
13105 Plugin({
13106 plugin: 'https://github.com/gitawego/cordova-screenshot.git',
13107 pluginRef: 'navigator.screenshot',
13108 repo: 'https://github.com/gitawego/cordova-screenshot.git'
13109 })
13110 ], Screenshot);
13111 return Screenshot;
13112}());
13113
13114var __decorate$80 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13115 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13116 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13117 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;
13118 return c > 3 && r && Object.defineProperty(target, key, r), r;
13119};
13120/**
13121 * @name Secure Storage
13122 * @description
13123 * This plugin gets, sets and removes key,value pairs from a device's secure storage.
13124 *
13125 * Requires Cordova plugin: `cordova-plugin-secure-storage`. For more info, please see the [Cordova Secure Storage docs](https://github.com/Crypho/cordova-plugin-secure-storage).
13126 *
13127 * @usage
13128 *
13129 * ```typescript
13130 * import { SecureStorage } from 'ionic-native';
13131 *
13132 * let secureStorage: SecureStorage = new SecureStorage();
13133 * secureStorage.create('my_store_name')
13134 * .then(
13135 * () => console.log('Storage is ready!'),
13136 * error => console.log(error)
13137 * );
13138 *
13139 * secureStorage.get('myitem')
13140 * .then(
13141 * data => console.log(data),
13142 * error => console.log(error)
13143 * );
13144 *
13145 * secureStorage.set('myitem', 'myvalue')
13146 * .then(
13147 * data => console.log(data),
13148 * error => console.log(error)
13149 * );
13150 *
13151 * secureStorage.remove('myitem')
13152 * .then(
13153 * data => console.log(data),
13154 * error => console.log(error)
13155 * );
13156 * ```
13157 */
13158var SecureStorage = (function () {
13159 function SecureStorage() {
13160 }
13161 /**
13162 * Creates a namespaced storage.
13163 * @param store {string}
13164 */
13165 SecureStorage.prototype.create = function (store) {
13166 var _this = this;
13167 return new Promise(function (res, rej) {
13168 _this._objectInstance = new cordova.plugins.SecureStorage(res, rej, store);
13169 });
13170 };
13171 /**
13172 * Gets a stored item
13173 * @param reference {string}
13174 */
13175 SecureStorage.prototype.get = function (reference) { return; };
13176 /**
13177 * Stores a value
13178 * @param reference {string}
13179 * @param value {string}
13180 */
13181 SecureStorage.prototype.set = function (reference, value) { return; };
13182 /**
13183 * Removes a single stored item
13184 * @param reference {string}
13185 */
13186 SecureStorage.prototype.remove = function (reference) { return; };
13187 __decorate$80([
13188 CordovaInstance({
13189 callbackOrder: 'reverse'
13190 })
13191 ], SecureStorage.prototype, "get", null);
13192 __decorate$80([
13193 CordovaInstance({
13194 callbackOrder: 'reverse'
13195 })
13196 ], SecureStorage.prototype, "set", null);
13197 __decorate$80([
13198 CordovaInstance({
13199 callbackOrder: 'reverse'
13200 })
13201 ], SecureStorage.prototype, "remove", null);
13202 SecureStorage = __decorate$80([
13203 Plugin({
13204 plugin: 'cordova-plugin-secure-storage',
13205 pluginRef: 'plugins.securestorage',
13206 repo: 'https://github.com/Crypho/cordova-plugin-secure-storage',
13207 platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
13208 })
13209 ], SecureStorage);
13210 return SecureStorage;
13211}());
13212
13213var __decorate$81 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13214 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13215 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13216 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;
13217 return c > 3 && r && Object.defineProperty(target, key, r), r;
13218};
13219/**
13220 * @name Shake
13221 * @description Handles shake gesture
13222 * @usage
13223 * ```typescript
13224 * import {Shake} from 'ionic-native';
13225 *
13226 * let watch = Shake.startWatch(60).subscribe(() => {
13227 * // do something
13228 * });
13229 *
13230 * watch.unsubscribe();
13231 * ```
13232 */
13233var Shake = (function () {
13234 function Shake() {
13235 }
13236 /**
13237 * Watch for shake gesture
13238 * @param sensitivity {number} Optional sensitivity parameter. Defaults to 40
13239 */
13240 Shake.startWatch = function (sensitivity) { return; };
13241 __decorate$81([
13242 Cordova({
13243 observable: true,
13244 clearFunction: 'stopWatch',
13245 successIndex: 0,
13246 errorIndex: 2
13247 })
13248 ], Shake, "startWatch", null);
13249 Shake = __decorate$81([
13250 Plugin({
13251 plugin: 'cordova-plugin-shake',
13252 pluginRef: 'shake',
13253 repo: 'https://github.com/leecrossley/cordova-plugin-shake'
13254 })
13255 ], Shake);
13256 return Shake;
13257}());
13258
13259var __decorate$82 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13260 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13261 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13262 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;
13263 return c > 3 && r && Object.defineProperty(target, key, r), r;
13264};
13265/**
13266 * @name Sim
13267 * @description
13268 * Gets info from the Sim card like the carrier name, mcc, mnc and country code and other system dependent info.
13269 *
13270 * Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim).
13271 *
13272 * @usage
13273 * ```typescript
13274 * import { Sim } from 'ionic-native';
13275 *
13276 *
13277 * Sim.getSimInfo().then(
13278 * (info) => console.log('Sim info: ', info),
13279 * (err) => console.log('Unable to get sim info: ', err)
13280 * );
13281 * ```
13282 */
13283var Sim = (function () {
13284 function Sim() {
13285 }
13286 /**
13287 * Returns info from the SIM card.
13288 * @returns {Promise}
13289 */
13290 Sim.getSimInfo = function () { return; };
13291 __decorate$82([
13292 Cordova()
13293 ], Sim, "getSimInfo", null);
13294 Sim = __decorate$82([
13295 Plugin({
13296 plugin: 'cordova-plugin-sim',
13297 pluginRef: 'plugins.sim',
13298 repo: 'https://github.com/pbakondy/cordova-plugin-sim',
13299 platforms: ['Android', 'iOS', 'Windows Phone']
13300 })
13301 ], Sim);
13302 return Sim;
13303}());
13304
13305var __decorate$83 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13306 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13307 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13308 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;
13309 return c > 3 && r && Object.defineProperty(target, key, r), r;
13310};
13311/**
13312 * @name SMS
13313 * @description
13314 *
13315 * Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
13316 *
13317 * @usage
13318 * ```typescript
13319 * import { SMS } from 'ionic-native';
13320 *
13321 *
13322 * // Send a text message using default options
13323 * SMS.send('416123456', 'Hello world!');
13324 * ```
13325 */
13326var SMS = (function () {
13327 function SMS() {
13328 }
13329 /**
13330 * Sends sms to a number
13331 * @param phoneNumber {string|Array<string>} Phone number
13332 * @param message {string} Message
13333 * @param options {SmsOptions} Options
13334 * @returns {Promise<any>} Resolves promise when the SMS has been sent
13335 */
13336 SMS.send = function (phoneNumber, message, options) { return; };
13337 __decorate$83([
13338 Cordova()
13339 ], SMS, "send", null);
13340 SMS = __decorate$83([
13341 Plugin({
13342 plugin: 'cordova-sms-plugin',
13343 pluginRef: 'sms',
13344 repo: 'https://github.com/cordova-sms/cordova-sms-plugin',
13345 platforms: ['Android', 'iOS', 'Windows Phone 8']
13346 })
13347 ], SMS);
13348 return SMS;
13349}());
13350
13351var __decorate$84 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13352 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13353 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13354 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;
13355 return c > 3 && r && Object.defineProperty(target, key, r), r;
13356};
13357/**
13358 * @name Social Sharing
13359 * @description
13360 * Share text, files, images, and links via social networks, sms, and email.
13361 * @usage
13362 * ```typescript
13363 * import { SocialSharing } from 'ionic-native';
13364 *
13365 * // Check if sharing via email is supported
13366 * SocialSharing.canShareViaEmail().then(() => {
13367 * // Sharing via email is possible
13368 * }).catch(() => {
13369 * // Sharing via email is not possible
13370 * });
13371 *
13372 * // Share via email
13373 * SocialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => {
13374 * // Success!
13375 * }).catch(() => {
13376 * // Error!
13377 * });
13378 * ```
13379 */
13380var SocialSharing = (function () {
13381 function SocialSharing() {
13382 }
13383 /**
13384 * Shares using the share sheet
13385 * @param message {string} The message you would like to share.
13386 * @param subject {string} The subject
13387 * @param file {string|string[]} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone.
13388 * @param url {string} A URL to share
13389 * @returns {Promise}
13390 */
13391 SocialSharing.share = function (message, subject, file, url) { return; };
13392 /**
13393 * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
13394 * @param options {object} The options object with the message, subject, files, url and chooserTitle properties.
13395 * @returns {Promise}
13396 */
13397 SocialSharing.shareWithOptions = function (options) { return; };
13398 /**
13399 * Checks if you can share via a specific app.
13400 * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
13401 * @param message {string}
13402 * @param subject {string}
13403 * @param image {string}
13404 * @param url {string}
13405 * @returns {Promise}
13406 */
13407 SocialSharing.canShareVia = function (appName, message, subject, image, url) { return; };
13408 /**
13409 * Shares directly to Twitter
13410 * @param message {string}
13411 * @param image {string}
13412 * @param url {string}
13413 * @returns {Promise}
13414 */
13415 SocialSharing.shareViaTwitter = function (message, image, url) { return; };
13416 /**
13417 * Shares directly to Facebook
13418 * @param message {string}
13419 * @param image {string}
13420 * @param url {string}
13421 * @returns {Promise}
13422 */
13423 SocialSharing.shareViaFacebook = function (message, image, url) { return; };
13424 /**
13425 * Shares directly to Facebook with a paste message hint
13426 * @param message {string}
13427 * @param image {string}
13428 * @param url {string}
13429 * @param pasteMessageHint {string}
13430 * @returns {Promise}
13431 */
13432 SocialSharing.shareViaFacebookWithPasteMessageHint = function (message, image, url, pasteMessageHint) { return; };
13433 /**
13434 * Shares directly to Instagram
13435 * @param message {string}
13436 * @param image {string}
13437 * @returns {Promise}
13438 */
13439 SocialSharing.shareViaInstagram = function (message, image) { return; };
13440 /**
13441 * Shares directly to WhatsApp
13442 * @param message {string}
13443 * @param image {string}
13444 * @param url {string}
13445 * @returns {Promise}
13446 */
13447 SocialSharing.shareViaWhatsApp = function (message, image, url) { return; };
13448 /**
13449 * Shares directly to a WhatsApp Contact
13450 * @param receiver {string} Pass phone number on Android, and Addressbook ID (abid) on iOS
13451 * @param message {string} Message to send
13452 * @param image {string} Image to send (does not work on iOS
13453 * @param url {string} Link to send
13454 * @returns {Promise}
13455 */
13456 SocialSharing.shareViaWhatsAppToReceiver = function (receiver, message, image, url) { return; };
13457 /**
13458 * Share via SMS
13459 * @param messge {string} message to send
13460 * @param phoneNumber {string} Number or multiple numbers seperated by commas
13461 * @returns {Promise}
13462 */
13463 SocialSharing.shareViaSMS = function (messge, phoneNumber) { return; };
13464 /**
13465 * Checks if you can share via email
13466 * @returns {Promise}
13467 */
13468 SocialSharing.canShareViaEmail = function () { return; };
13469 /**
13470 * Share via Email
13471 * @param message {string}
13472 * @param subject {string}
13473 * @param to {string[]}
13474 * @param cc {string[]} Optional
13475 * @param bcc {string[]} Optional
13476 * @param files {string|string[]} Optional URL or local path to file(s) to attach
13477 * @returns {Promise}
13478 */
13479 SocialSharing.shareViaEmail = function (message, subject, to, cc, bcc, files) { return; };
13480 /**
13481 * Share via AppName
13482 * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
13483 * @param message {string}
13484 * @param subject {string}
13485 * @param image {string}
13486 * @param url {string}
13487 * @returns {Promise}
13488 */
13489 SocialSharing.shareVia = function (appName, message, subject, image, url) { return; };
13490 __decorate$84([
13491 Cordova()
13492 ], SocialSharing, "share", null);
13493 __decorate$84([
13494 Cordova({
13495 platforms: ['iOS', 'Android']
13496 })
13497 ], SocialSharing, "shareWithOptions", null);
13498 __decorate$84([
13499 Cordova({
13500 successIndex: 5,
13501 errorIndex: 6,
13502 platforms: ['iOS', 'Android']
13503 })
13504 ], SocialSharing, "canShareVia", null);
13505 __decorate$84([
13506 Cordova({
13507 successIndex: 3,
13508 errorIndex: 4,
13509 platforms: ['iOS', 'Android']
13510 })
13511 ], SocialSharing, "shareViaTwitter", null);
13512 __decorate$84([
13513 Cordova({
13514 successIndex: 3,
13515 errorIndex: 4,
13516 platforms: ['iOS', 'Android']
13517 })
13518 ], SocialSharing, "shareViaFacebook", null);
13519 __decorate$84([
13520 Cordova({
13521 successIndex: 4,
13522 errorIndex: 5,
13523 platforms: ['iOS', 'Android']
13524 })
13525 ], SocialSharing, "shareViaFacebookWithPasteMessageHint", null);
13526 __decorate$84([
13527 Cordova({
13528 platforms: ['iOS', 'Android']
13529 })
13530 ], SocialSharing, "shareViaInstagram", null);
13531 __decorate$84([
13532 Cordova({
13533 successIndex: 3,
13534 errorIndex: 4,
13535 platforms: ['iOS', 'Android']
13536 })
13537 ], SocialSharing, "shareViaWhatsApp", null);
13538 __decorate$84([
13539 Cordova({
13540 successIndex: 4,
13541 errorIndex: 5,
13542 platforms: ['iOS', 'Android']
13543 })
13544 ], SocialSharing, "shareViaWhatsAppToReceiver", null);
13545 __decorate$84([
13546 Cordova({
13547 platforms: ['iOS', 'Android']
13548 })
13549 ], SocialSharing, "shareViaSMS", null);
13550 __decorate$84([
13551 Cordova({
13552 platforms: ['iOS', 'Android']
13553 })
13554 ], SocialSharing, "canShareViaEmail", null);
13555 __decorate$84([
13556 Cordova({
13557 platforms: ['iOS', 'Android'],
13558 successIndex: 6,
13559 errorIndex: 7
13560 })
13561 ], SocialSharing, "shareViaEmail", null);
13562 __decorate$84([
13563 Cordova({
13564 successIndex: 5,
13565 errorIndex: 6,
13566 platforms: ['iOS', 'Android']
13567 })
13568 ], SocialSharing, "shareVia", null);
13569 SocialSharing = __decorate$84([
13570 Plugin({
13571 plugin: 'cordova-plugin-x-socialsharing',
13572 pluginRef: 'plugins.socialsharing',
13573 repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin',
13574 platforms: ['iOS', 'Android', 'Windows Phone']
13575 })
13576 ], SocialSharing);
13577 return SocialSharing;
13578}());
13579
13580var __decorate$85 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13581 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13582 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13583 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;
13584 return c > 3 && r && Object.defineProperty(target, key, r), r;
13585};
13586/**
13587 * @name Spinner Dialog
13588 * @description
13589 * @usage
13590 * ```typescript
13591 * import { SpinnerDialog } from 'ionic-native';
13592 *
13593 *
13594 * SpinnerDialog.show();
13595 *
13596 * SpinnerDialog.hide();
13597 * ```
13598 */
13599var SpinnerDialog = (function () {
13600 function SpinnerDialog() {
13601 }
13602 /**
13603 * Shows the spinner dialog
13604 * @param title {string} Spinner title (shows on Android only)
13605 * @param message {string} Spinner message
13606 * @param cancelCallback {boolean|function} Set to true to set spinner not cancelable. Or provide a function to call when the user cancels the spinner.
13607 * @param iOSOptions {object} Options for iOS only
13608 */
13609 SpinnerDialog.show = function (title, message, cancelCallback, iOSOptions) { };
13610 /**
13611 * Hides the spinner dialog if visible
13612 */
13613 SpinnerDialog.hide = function () { };
13614 __decorate$85([
13615 Cordova({
13616 sync: true
13617 })
13618 ], SpinnerDialog, "show", null);
13619 __decorate$85([
13620 Cordova({
13621 sync: true
13622 })
13623 ], SpinnerDialog, "hide", null);
13624 SpinnerDialog = __decorate$85([
13625 Plugin({
13626 plugin: 'cordova-plugin-spinner-dialog',
13627 pluginRef: 'window.plugins.spinnerDialog',
13628 repo: 'https://github.com/Paldom/SpinnerDialog',
13629 platforms: ['Android', 'iOS', 'Windows Phone 8']
13630 })
13631 ], SpinnerDialog);
13632 return SpinnerDialog;
13633}());
13634
13635var __decorate$86 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13636 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13637 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13638 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;
13639 return c > 3 && r && Object.defineProperty(target, key, r), r;
13640};
13641/**
13642 * @name Splashscreen
13643 * @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
13644 * @usage
13645 * ```typescript
13646 * import { Splashscreen } from 'ionic-native';
13647 *
13648 *
13649 * Splashscreen.show();
13650 *
13651 * Splashscreen.hide();
13652 * ```
13653 */
13654var Splashscreen = (function () {
13655 function Splashscreen() {
13656 }
13657 /**
13658 * Shows the splashscreen
13659 */
13660 Splashscreen.show = function () { };
13661 /**
13662 * Hides the splashscreen
13663 */
13664 Splashscreen.hide = function () { };
13665 __decorate$86([
13666 Cordova({
13667 sync: true
13668 })
13669 ], Splashscreen, "show", null);
13670 __decorate$86([
13671 Cordova({
13672 sync: true
13673 })
13674 ], Splashscreen, "hide", null);
13675 Splashscreen = __decorate$86([
13676 Plugin({
13677 plugin: 'cordova-plugin-splashscreen',
13678 pluginRef: 'navigator.splashscreen',
13679 repo: 'https://github.com/apache/cordova-plugin-splashscreen'
13680 })
13681 ], Splashscreen);
13682 return Splashscreen;
13683}());
13684
13685var __decorate$87 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13686 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13687 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13688 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;
13689 return c > 3 && r && Object.defineProperty(target, key, r), r;
13690};
13691/**
13692 * @name SQLite
13693 *
13694 * @description
13695 * Access SQLite databases on the device.
13696 *
13697 * @usage
13698 *
13699 * ```typescript
13700 * import { SQLite } from 'ionic-native';
13701 *
13702 * let db = new SQLite();
13703 * db.openDatabase({
13704 * name: 'data.db',
13705 * location: 'default' // the location field is required
13706 * }).then(() => {
13707 * db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
13708 *
13709 * }, (err) => {
13710 * console.error('Unable to execute sql: ', err);
13711 * });
13712 * }, (err) => {
13713 * console.error('Unable to open database: ', err);
13714 * });
13715 * ```
13716 *
13717 */
13718var SQLite = (function () {
13719 function SQLite() {
13720 }
13721 Object.defineProperty(SQLite.prototype, "databaseFeatures", {
13722 get: function () {
13723 return this._objectInstance.databaseFeatures;
13724 },
13725 enumerable: true,
13726 configurable: true
13727 });
13728 /**
13729 * Open or create a SQLite database file.
13730 *
13731 * See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database
13732 *
13733 * @param config the config for opening the database.
13734 * @usage
13735 *
13736 * ```typescript
13737 * import { SQLite } from 'ionic-native';
13738 *
13739 * let db = new SQLite();
13740 * db.openDatabase({
13741 * name: 'data.db',
13742 * location: 'default' // the location field is required
13743 * }).then(() => {
13744 * db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
13745 *
13746 * }, (err) => {
13747 * console.error('Unable to execute sql', err);
13748 * })
13749 * }, (err) => {
13750 * console.error('Unable to open database', err);
13751 * });
13752 * ```
13753 */
13754 SQLite.prototype.openDatabase = function (config) {
13755 var _this = this;
13756 return new Promise(function (resolve, reject) {
13757 sqlitePlugin.openDatabase(config, function (db) {
13758 _this._objectInstance = db;
13759 resolve(db);
13760 }, function (error) {
13761 console.warn(error);
13762 reject(error);
13763 });
13764 });
13765 };
13766 SQLite.prototype.addTransaction = function (transaction) { };
13767 SQLite.prototype.transaction = function (fn) { return; };
13768 SQLite.prototype.readTransaction = function (fn) { return; };
13769 SQLite.prototype.startNextTransaction = function () { };
13770 SQLite.prototype.close = function () { return; };
13771 SQLite.prototype.start = function () { };
13772 /**
13773 * Execute SQL on the opened database. Note, you must call `openDatabase` first, and
13774 * ensure it resolved and successfully opened the database.
13775 *
13776 * @usage
13777 *
13778 * ```typescript
13779 * db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
13780 * // Access the items through resultSet.rows
13781 * // resultSet.rows.item(i)
13782 * }, (err) => {})
13783 * ```
13784 */
13785 SQLite.prototype.executeSql = function (statement, params) { return; };
13786 SQLite.prototype.addStatement = function (sql, values) { return; };
13787 SQLite.prototype.sqlBatch = function (sqlStatements) { return; };
13788 SQLite.prototype.abortallPendingTransactions = function () { };
13789 SQLite.prototype.handleStatementSuccess = function (handler, response) { };
13790 SQLite.prototype.handleStatementFailure = function (handler, response) { };
13791 SQLite.prototype.run = function () { };
13792 SQLite.prototype.abort = function (txFailure) { };
13793 SQLite.prototype.finish = function () { };
13794 SQLite.prototype.abortFromQ = function (sqlerror) { };
13795 SQLite.echoTest = function () { return; };
13796 SQLite.deleteDatabase = function (first) { return; };
13797 __decorate$87([
13798 CordovaInstance({
13799 sync: true
13800 })
13801 ], SQLite.prototype, "addTransaction", null);
13802 __decorate$87([
13803 CordovaInstance()
13804 ], SQLite.prototype, "transaction", null);
13805 __decorate$87([
13806 CordovaInstance()
13807 ], SQLite.prototype, "readTransaction", null);
13808 __decorate$87([
13809 CordovaInstance({
13810 sync: true
13811 })
13812 ], SQLite.prototype, "startNextTransaction", null);
13813 __decorate$87([
13814 CordovaInstance()
13815 ], SQLite.prototype, "close", null);
13816 __decorate$87([
13817 CordovaInstance({
13818 sync: true
13819 })
13820 ], SQLite.prototype, "start", null);
13821 __decorate$87([
13822 CordovaInstance()
13823 ], SQLite.prototype, "executeSql", null);
13824 __decorate$87([
13825 CordovaInstance()
13826 ], SQLite.prototype, "addStatement", null);
13827 __decorate$87([
13828 CordovaInstance()
13829 ], SQLite.prototype, "sqlBatch", null);
13830 __decorate$87([
13831 CordovaInstance({
13832 sync: true
13833 })
13834 ], SQLite.prototype, "abortallPendingTransactions", null);
13835 __decorate$87([
13836 CordovaInstance({
13837 sync: true
13838 })
13839 ], SQLite.prototype, "handleStatementSuccess", null);
13840 __decorate$87([
13841 CordovaInstance({
13842 sync: true
13843 })
13844 ], SQLite.prototype, "handleStatementFailure", null);
13845 __decorate$87([
13846 CordovaInstance({
13847 sync: true
13848 })
13849 ], SQLite.prototype, "run", null);
13850 __decorate$87([
13851 CordovaInstance({
13852 sync: true
13853 })
13854 ], SQLite.prototype, "abort", null);
13855 __decorate$87([
13856 CordovaInstance({
13857 sync: true
13858 })
13859 ], SQLite.prototype, "finish", null);
13860 __decorate$87([
13861 CordovaInstance({
13862 sync: true
13863 })
13864 ], SQLite.prototype, "abortFromQ", null);
13865 __decorate$87([
13866 Cordova()
13867 ], SQLite, "echoTest", null);
13868 __decorate$87([
13869 Cordova()
13870 ], SQLite, "deleteDatabase", null);
13871 SQLite = __decorate$87([
13872 Plugin({
13873 pluginRef: 'sqlitePlugin',
13874 plugin: 'cordova-sqlite-storage',
13875 repo: 'https://github.com/litehelpers/Cordova-sqlite-storage'
13876 })
13877 ], SQLite);
13878 return SQLite;
13879}());
13880
13881var __decorate$88 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
13882 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13883 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
13884 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;
13885 return c > 3 && r && Object.defineProperty(target, key, r), r;
13886};
13887/**
13888 * @name Status Bar
13889 * @description
13890 * Manage the appearance of the native status bar.
13891 *
13892 * Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
13893 *
13894 * @usage
13895 * ```typescript
13896 * import { StatusBar } from 'ionic-native';
13897 *
13898 *
13899 * StatusBar.overlaysWebView(true); // let status bar overlay webview
13900 *
13901 * StatusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
13902 * ```
13903 *
13904 */
13905var StatusBar = (function () {
13906 function StatusBar() {
13907 }
13908 /**
13909 * Set whether the status bar overlays the main app view. The default
13910 * is true.
13911 *
13912 * @param {boolean} doesOverlay Whether the status bar overlays the main app view.
13913 */
13914 StatusBar.overlaysWebView = function (doesOverlay) { };
13915
13916 /**
13917 * Use the default statusbar (dark text, for light backgrounds).
13918 */
13919 StatusBar.styleDefault = function () { };
13920
13921 /**
13922 * Use the lightContent statusbar (light text, for dark backgrounds).
13923 */
13924 StatusBar.styleLightContent = function () { };
13925
13926 /**
13927 * Use the blackTranslucent statusbar (light text, for dark backgrounds).
13928 */
13929 StatusBar.styleBlackTranslucent = function () { };
13930
13931 /**
13932 * Use the blackOpaque statusbar (light text, for dark backgrounds).
13933 */
13934 StatusBar.styleBlackOpaque = function () { };
13935
13936 /**
13937 * Set the status bar to a specific named color. Valid options:
13938 * black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown.
13939 *
13940 * iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
13941 *
13942 * @param {string} colorName The name of the color (from above)
13943 */
13944 StatusBar.backgroundColorByName = function (colorName) { };
13945
13946 /**
13947 * Set the status bar to a specific hex color (CSS shorthand supported!).
13948 *
13949 * iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
13950 *
13951 * @param {string} hexString The hex value of the color.
13952 */
13953 StatusBar.backgroundColorByHexString = function (hexString) { };
13954
13955 /**
13956 * Hide the StatusBar
13957 */
13958 StatusBar.hide = function () { };
13959
13960 /**
13961 * Show the StatusBar
13962 */
13963 StatusBar.show = function () { };
13964
13965 Object.defineProperty(StatusBar, "isVisible", {
13966 /**
13967 * Whether the StatusBar is currently visible or not.
13968 */
13969 get: function () { return window.StatusBar.isVisible; },
13970 enumerable: true,
13971 configurable: true
13972 });
13973 __decorate$88([
13974 Cordova({
13975 sync: true
13976 })
13977 ], StatusBar, "overlaysWebView", null);
13978 __decorate$88([
13979 Cordova({
13980 sync: true
13981 })
13982 ], StatusBar, "styleDefault", null);
13983 __decorate$88([
13984 Cordova({
13985 sync: true
13986 })
13987 ], StatusBar, "styleLightContent", null);
13988 __decorate$88([
13989 Cordova({
13990 sync: true
13991 })
13992 ], StatusBar, "styleBlackTranslucent", null);
13993 __decorate$88([
13994 Cordova({
13995 sync: true
13996 })
13997 ], StatusBar, "styleBlackOpaque", null);
13998 __decorate$88([
13999 Cordova({
14000 sync: true
14001 })
14002 ], StatusBar, "backgroundColorByName", null);
14003 __decorate$88([
14004 Cordova({
14005 sync: true
14006 })
14007 ], StatusBar, "backgroundColorByHexString", null);
14008 __decorate$88([
14009 Cordova({
14010 sync: true
14011 })
14012 ], StatusBar, "hide", null);
14013 __decorate$88([
14014 Cordova({
14015 sync: true
14016 })
14017 ], StatusBar, "show", null);
14018 __decorate$88([
14019 CordovaProperty
14020 ], StatusBar, "isVisible", null);
14021 StatusBar = __decorate$88([
14022 Plugin({
14023 plugin: 'cordova-plugin-statusbar',
14024 pluginRef: 'StatusBar',
14025 repo: 'https://github.com/apache/cordova-plugin-statusbar',
14026 platforms: ['iOS', 'Android', 'Windows Phone 8', 'Windows 8', 'Windows 10']
14027 })
14028 ], StatusBar);
14029 return StatusBar;
14030}());
14031
14032var __decorate$89 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14033 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14034 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14035 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;
14036 return c > 3 && r && Object.defineProperty(target, key, r), r;
14037};
14038/**
14039 * @name StreamingMedia
14040 * @description
14041 * This plugin allows you to stream audio and video in a fullscreen, native player on iOS and Android.
14042 *
14043 * @usage
14044 * ```
14045 * import {StreamingMedia, StreamingVideoOptions} from 'ionic-native';
14046 *
14047 * let options: StreamingVideoOptions = {
14048 * successCallback: () => { console.log('Video played') },
14049 * errorCallback: (e) => { console.log('Error streaming') },
14050 * orientation: 'landscape'
14051 * };
14052 *
14053 * StreamingMedia.('https://path/to/video/stream', options);
14054 *
14055 * ```
14056 */
14057var StreamingMedia = (function () {
14058 function StreamingMedia() {
14059 }
14060 /**
14061 * Streams a video
14062 * @param videoUrl {string} The URL of the video
14063 * @param options {StreamingVideoOptions} Options
14064 */
14065 StreamingMedia.playVideo = function (videoUrl, options) { };
14066 /**
14067 * Streams an audio
14068 * @param audioUrl {string} The URL of the audio stream
14069 * @param options {StreamingAudioOptions} Options
14070 */
14071 StreamingMedia.playAudio = function (audioUrl, options) { };
14072 /**
14073 * Stops streaming audio
14074 */
14075 StreamingMedia.stopAudio = function () { };
14076 /**
14077 * Pauses streaming audio
14078 */
14079 StreamingMedia.pauseAudio = function () { };
14080 /**
14081 * Resumes streaming audio
14082 */
14083 StreamingMedia.resumeAudio = function () { };
14084 __decorate$89([
14085 Cordova({ sync: true })
14086 ], StreamingMedia, "playVideo", null);
14087 __decorate$89([
14088 Cordova({ sync: true })
14089 ], StreamingMedia, "playAudio", null);
14090 __decorate$89([
14091 Cordova({ sync: true })
14092 ], StreamingMedia, "stopAudio", null);
14093 __decorate$89([
14094 Cordova({ sync: true, platforms: ['iOS'] })
14095 ], StreamingMedia, "pauseAudio", null);
14096 __decorate$89([
14097 Cordova({ sync: true, platforms: ['iOS'] })
14098 ], StreamingMedia, "resumeAudio", null);
14099 StreamingMedia = __decorate$89([
14100 Plugin({
14101 plugin: 'cordova-plugin-streaming-media',
14102 pluginRef: 'plugins.streamingMedia',
14103 repo: 'https://github.com/nchutchind/cordova-plugin-streaming-media',
14104 platforms: ['Android', 'iOS']
14105 })
14106 ], StreamingMedia);
14107 return StreamingMedia;
14108}());
14109
14110var __decorate$90 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14111 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14112 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14113 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;
14114 return c > 3 && r && Object.defineProperty(target, key, r), r;
14115};
14116/**
14117 * @name 3DTouch
14118 * @description
14119 * @usage
14120 * Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient.
14121 * ```
14122 * import { ThreeDeeTouch } from 'ionic-native';
14123 *
14124 * // import for type completion on variables
14125 * import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from 'ionic-native';
14126 * ...
14127 *
14128 * ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable));
14129 *
14130 * ThreeDeeTouch.watchForceTouches()
14131 * .subscribe(
14132 * (data: ThreeDeeTouchForceTouch) => {
14133 * console.log("Force touch %" + data.force);
14134 * console.log("Force touch timestamp: " + data.timestamp);
14135 * console.log("Force touch x: " + data.x);
14136 * console.log("Force touch y: " + data.y);
14137 * }
14138 * );
14139 *
14140 *
14141 * let actions: Array<ThreeDeeTouchQuickAction> = [
14142 * {
14143 * type: 'checkin',
14144 * title: 'Check in',
14145 * subtitle: 'Quickly check in',
14146 * iconType: 'Compose'
14147 * },
14148 * {
14149 * type: 'share',
14150 * title: 'Share',
14151 * subtitle: 'Share like you care',
14152 * iconType: 'Share'
14153 * },
14154 * {
14155 * type: 'search',
14156 * title: 'Search',
14157 * iconType: 'Search'
14158 * },
14159 * {
14160 * title: 'Show favorites',
14161 * iconTemplate: 'HeartTemplate'
14162 * }
14163 * ];
14164 * ThreeDeeTouch.configureQuickActions(actions);
14165 *
14166 * ThreeDeeTouchForceTouch.onHomeIconPressed().subscribe(
14167 * (payload) => {
14168 * // returns an object that is the button you presed
14169 * console.log('Pressed the ${payload.title} button')
14170 * console.log(payload.type)
14171 *
14172 * }
14173 * )
14174 * ```
14175 */
14176var ThreeDeeTouch = (function () {
14177 function ThreeDeeTouch() {
14178 }
14179 /**
14180 * You need an iPhone 6S or some future tech to use the features of this plugin, so you can check at runtime if the user's device is supported.
14181 * @returns {Promise<boolean>} returns a promise that resolves with a boolean that indicates whether the plugin is available or not
14182 */
14183 ThreeDeeTouch.isAvailable = function () { return; };
14184 /**
14185 * You can get a notification when the user force touches the webview. The plugin defines a Force Touch when at least 75% of the maximum force is applied to the screen. Your app will receive the x and y coordinates, so you have to figure out which UI element was touched.
14186 * @returns {Observable<ThreeDeeTouchForceTouch>} Returns an observable that sends a `ThreeDeeTouchForceTouch` object
14187 */
14188 ThreeDeeTouch.watchForceTouches = function () { return; };
14189 /**
14190 * setup the 3D-touch actions, takes an array of objects with the following
14191 * @param {string} type (optional) A type that can be used `onHomeIconPressed` callback
14192 * @param {string} title Title for your action
14193 * @param {string} subtitle (optional) A short description for your action
14194 * @param {string} iconType (optional) Choose between Prohibit, Contact, Home, MarkLocation, Favorite, Love, Cloud, Invitation, Confirmation, Mail, Message, Date, Time, CapturePhoto, CaptureVideo, Task, TaskCompleted, Alarm, Bookmark, Shuffle, Audio, Update
14195 */
14196 ThreeDeeTouch.configureQuickActions = function (quickActions) { };
14197 /**
14198 * When a home icon is pressed, your app launches and this JS callback is invoked.
14199 * @returns {Observable<any>} returns an observable that notifies you when he user presses on the home screen icon
14200 */
14201 ThreeDeeTouch.onHomeIconPressed = function () {
14202 return new Observable_2(function (observer) {
14203 if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) {
14204 window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
14205 }
14206 else {
14207 observer.error('3dTouch plugin is not available.');
14208 observer.complete();
14209 }
14210 });
14211 };
14212 /**
14213 * Enable Link Preview.
14214 * UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
14215 */
14216 ThreeDeeTouch.enableLinkPreview = function () { };
14217 /**
14218 * Disabled the link preview feature, if enabled.
14219 */
14220 ThreeDeeTouch.disableLinkPreview = function () { };
14221 __decorate$90([
14222 Cordova()
14223 ], ThreeDeeTouch, "isAvailable", null);
14224 __decorate$90([
14225 Cordova({
14226 observable: true
14227 })
14228 ], ThreeDeeTouch, "watchForceTouches", null);
14229 __decorate$90([
14230 Cordova({
14231 sync: true
14232 })
14233 ], ThreeDeeTouch, "configureQuickActions", null);
14234 __decorate$90([
14235 Cordova({
14236 sync: true
14237 })
14238 ], ThreeDeeTouch, "enableLinkPreview", null);
14239 __decorate$90([
14240 Cordova({
14241 sync: true
14242 })
14243 ], ThreeDeeTouch, "disableLinkPreview", null);
14244 ThreeDeeTouch = __decorate$90([
14245 Plugin({
14246 plugin: 'cordova-plugin-3dtouch',
14247 pluginRef: 'ThreeDeeTouch',
14248 repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch',
14249 platforms: ['iOS']
14250 })
14251 ], ThreeDeeTouch);
14252 return ThreeDeeTouch;
14253}());
14254
14255var __decorate$91 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14256 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14257 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14258 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;
14259 return c > 3 && r && Object.defineProperty(target, key, r), r;
14260};
14261/**
14262 * @name Toast
14263 * @description
14264 * This plugin allows you to show a native Toast (a little text popup) on iOS, Android and WP8. It's great for showing a non intrusive native notification which is guaranteed always in the viewport of the browser.
14265 *
14266 * Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).
14267 *
14268 * @usage
14269 * ```typescript
14270 * import { Toast } from 'ionic-native';
14271 *
14272 *
14273 * Toast.show("I'm a toast", '5000', 'center').subscribe(
14274 * toast => {
14275 * console.log(toast);
14276 * }
14277 * );
14278 * ```
14279 */
14280var Toast = (function () {
14281 function Toast() {
14282 }
14283 /**
14284 * Show a native toast for the given duration at the specified position.
14285 *
14286 * @param {string} message The message to display.
14287 * @param {string} duration Duration to show the toast, either 'short', 'long' or any number of milliseconds: '1500'.
14288 * @param {string} position Where to position the toast, either 'top', 'center', or 'bottom'.
14289 * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
14290 */
14291 Toast.show = function (message, duration, position) { return; };
14292 /**
14293 * Manually hide any currently visible toast.
14294 * @return {Promise} Returns a Promise that resolves on success.
14295 */
14296 Toast.hide = function () { return; };
14297 /**
14298 * Show a native toast with the given options.
14299 *
14300 * @param {Object} options Options for showing a toast. Available options:
14301 * message The message to display.
14302 * duration Duration to show the toast, either 'short', 'long' or any number of milliseconds: '1500'.
14303 * position Where to position the toast, either 'top', 'center', or 'bottom'.
14304 * addPixelsY Offset in pixels to move the toast up or down from its specified position.
14305 *
14306 * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
14307 */
14308 Toast.showWithOptions = function (options) { return; };
14309 /**
14310 * Shorthand for `show(message, 'short', 'top')`.
14311 * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
14312 */
14313 Toast.showShortTop = function (message) { return; };
14314 /**
14315 * Shorthand for `show(message, 'short', 'center')`.
14316 * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
14317 */
14318 Toast.showShortCenter = function (message) { return; };
14319 /**
14320 * Shorthand for `show(message, 'short', 'bottom')`.
14321 * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
14322 */
14323 Toast.showShortBottom = function (message) { return; };
14324 /**
14325 * Shorthand for `show(message, 'long', 'top')`.
14326 * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
14327 */
14328 Toast.showLongTop = function (message) { return; };
14329 /**
14330 * Shorthand for `show(message, 'long', 'center')`.
14331 * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
14332 */
14333 Toast.showLongCenter = function (message) { return; };
14334 /**
14335 * Shorthand for `show(message, 'long', 'bottom')`.
14336 * @return {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.
14337 */
14338 Toast.showLongBottom = function (message) { return; };
14339 __decorate$91([
14340 Cordova({
14341 observable: true,
14342 clearFunction: 'hide'
14343 })
14344 ], Toast, "show", null);
14345 __decorate$91([
14346 Cordova()
14347 ], Toast, "hide", null);
14348 __decorate$91([
14349 Cordova({
14350 observable: true,
14351 clearFunction: 'hide'
14352 })
14353 ], Toast, "showWithOptions", null);
14354 __decorate$91([
14355 Cordova({
14356 observable: true,
14357 clearFunction: 'hide'
14358 })
14359 ], Toast, "showShortTop", null);
14360 __decorate$91([
14361 Cordova({
14362 observable: true,
14363 clearFunction: 'hide'
14364 })
14365 ], Toast, "showShortCenter", null);
14366 __decorate$91([
14367 Cordova({
14368 observable: true,
14369 clearFunction: 'hide'
14370 })
14371 ], Toast, "showShortBottom", null);
14372 __decorate$91([
14373 Cordova({
14374 observable: true,
14375 clearFunction: 'hide'
14376 })
14377 ], Toast, "showLongTop", null);
14378 __decorate$91([
14379 Cordova({
14380 observable: true,
14381 clearFunction: 'hide'
14382 })
14383 ], Toast, "showLongCenter", null);
14384 __decorate$91([
14385 Cordova({
14386 observable: true,
14387 clearFunction: 'hide'
14388 })
14389 ], Toast, "showLongBottom", null);
14390 Toast = __decorate$91([
14391 Plugin({
14392 plugin: 'cordova-plugin-x-toast',
14393 pluginRef: 'plugins.toast',
14394 repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin',
14395 platforms: ['Android', 'iOS', 'Windows Phone 8']
14396 })
14397 ], Toast);
14398 return Toast;
14399}());
14400
14401var __decorate$92 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14402 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14403 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14404 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;
14405 return c > 3 && r && Object.defineProperty(target, key, r), r;
14406};
14407/**
14408 * @name TouchID
14409 * @description
14410 * Scan the fingerprint of a user with the TouchID sensor.
14411 *
14412 * Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id).
14413 *
14414 * @usage
14415 * ### Import Touch ID Plugin into Project
14416 * ```typescript
14417 * import { TouchID } from 'ionic-native';
14418 * ```
14419 * ### Check for Touch ID Availability
14420 * ```typescript
14421 * TouchID.isAvailable()
14422 * .then(
14423 * res => console.log('TouchID is available!'),
14424 * err => console.error('TouchID is not available', err)
14425 * );
14426 * ```
14427 * ### Invoke Touch ID w/ Custom Message
14428 *
14429 * ```typescript
14430 * TouchID.verifyFingerprint('Scan your fingerprint please')
14431 * .then(
14432 * res => console.log('Ok', res),
14433 * err => console.error('Error', err)
14434 * );
14435 * ```
14436 *
14437 * ### Error Codes
14438 *
14439 * The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently.
14440 *
14441 * Here is a list of some of the error codes:
14442 *
14443 * - `-1` - Fingerprint scan failed more than 3 times
14444 * - `-2` or `-128` - User tapped the 'Cancel' button
14445 * - `-3` - User tapped the 'Enter Passcode' or 'Enter Password' button
14446 * - `-4` - The scan was cancelled by the system (Home button for example)
14447 * - `-6` - TouchID is not Available
14448 * - `-8` - TouchID is locked out from too many tries
14449 */
14450var TouchID = (function () {
14451 function TouchID() {
14452 }
14453 /**
14454 * Checks Whether TouchID is available or not.
14455 *
14456 * @return {Promise} Returns a Promise that resolves if yes, rejects if no.
14457 */
14458 TouchID.isAvailable = function () { return; };
14459 /**
14460 * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen.
14461 *
14462 * @param {string} message The message to display
14463 * @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
14464 */
14465 TouchID.verifyFingerprint = function (message) { return; };
14466 /**
14467 * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
14468 *
14469 * @param {string} message The message to display
14470 * @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
14471 */
14472 TouchID.verifyFingerprintWithCustomPasswordFallback = function (message) { return; };
14473 /**
14474 * Show TouchID dialog with custom 'Enter Password' message and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
14475 *
14476 * @param {string} message The message to display
14477 * @param {string} enterPasswordLabel Custom text for the 'Enter Password' button
14478 * @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
14479 */
14480 TouchID.verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel = function (message, enterPasswordLabel) { return; };
14481 __decorate$92([
14482 Cordova()
14483 ], TouchID, "isAvailable", null);
14484 __decorate$92([
14485 Cordova()
14486 ], TouchID, "verifyFingerprint", null);
14487 __decorate$92([
14488 Cordova()
14489 ], TouchID, "verifyFingerprintWithCustomPasswordFallback", null);
14490 __decorate$92([
14491 Cordova()
14492 ], TouchID, "verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel", null);
14493 TouchID = __decorate$92([
14494 Plugin({
14495 plugin: 'cordova-plugin-touch-id',
14496 pluginRef: 'plugins.touchid',
14497 repo: 'https://github.com/EddyVerbruggen/cordova-plugin-touch-id',
14498 platforms: ['iOS']
14499 })
14500 ], TouchID);
14501 return TouchID;
14502}());
14503
14504var __decorate$93 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14505 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14506 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14507 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;
14508 return c > 3 && r && Object.defineProperty(target, key, r), r;
14509};
14510/**
14511 * @name TextToSpeech
14512 * @description
14513 * Text to Speech plugin
14514 *
14515 * @usage
14516 * ```
14517 * import {TextToSpeech} from 'ionic-native';
14518 *
14519 * TextToSpeech.speak('Hello World')
14520 * .then(() => console.log('Success'))
14521 * .catch((reason: any) => console.log(reason));
14522 *
14523 * ```
14524 */
14525var TextToSpeech = (function () {
14526 function TextToSpeech() {
14527 }
14528 /**
14529 * This function speaks
14530 * @param options {string | TTSOptions} Text to speak or TTSOptions
14531 * @return {Promise<any>} Returns a promise that resolves when the speaking finishes
14532 */
14533 TextToSpeech.speak = function (options) {
14534 return;
14535 };
14536 __decorate$93([
14537 Cordova({
14538 successIndex: 1,
14539 errorIndex: 2
14540 })
14541 ], TextToSpeech, "speak", null);
14542 TextToSpeech = __decorate$93([
14543 Plugin({
14544 plugin: 'cordova-plugin-tts',
14545 pluginRef: 'TTS',
14546 repo: 'https://github.com/vilic/cordova-plugin-tts'
14547 })
14548 ], TextToSpeech);
14549 return TextToSpeech;
14550}());
14551
14552var __decorate$94 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14553 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14554 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14555 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;
14556 return c > 3 && r && Object.defineProperty(target, key, r), r;
14557};
14558/**
14559 * @name Twitter Connect
14560 * @description
14561 * Plugin to use Twitter Single Sign On
14562 * Uses Twitter's Fabric SDK
14563 * ```typescript
14564 * import {TwitterConnect} from 'ionic-native';
14565 *
14566 * function onSuccess(response) {
14567 * console.log(response);
14568 *
14569 * // Will console log something like:
14570 * // {
14571 * // userName: 'myuser',
14572 * // userId: '12358102',
14573 * // secret: 'tokenSecret'
14574 * // token: 'accessTokenHere'
14575 * // }
14576 * }
14577 *
14578 * TwitterConnect.login().then(onSuccess, onError);
14579 *
14580 * TwitterConnect.logout().then(onLogoutSuccess, onLogoutError);
14581 * ```
14582 */
14583var TwitterConnect = (function () {
14584 function TwitterConnect() {
14585 }
14586 /**
14587 * Logs in
14588 * @return {Promise<TwitterConnectResponse>} returns a promise that resolves if logged in and rejects if failed to login
14589 */
14590 TwitterConnect.login = function () { return; };
14591 /**
14592 * Logs out
14593 * @return {Promise<any>} returns a promise that resolves if logged out and rejects if failed to logout
14594 */
14595 TwitterConnect.logout = function () { return; };
14596 /**
14597 * Returns user's profile information
14598 * @return {Promise<any>} returns a promise that resolves if user profile is successfully retrieved and rejects if request fails
14599 */
14600 TwitterConnect.showUser = function () { return; };
14601 __decorate$94([
14602 Cordova()
14603 ], TwitterConnect, "login", null);
14604 __decorate$94([
14605 Cordova()
14606 ], TwitterConnect, "logout", null);
14607 __decorate$94([
14608 Cordova()
14609 ], TwitterConnect, "showUser", null);
14610 TwitterConnect = __decorate$94([
14611 Plugin({
14612 plugin: 'twitter-connect-plugin',
14613 pluginRef: 'TwitterConnect',
14614 repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin',
14615 install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key'
14616 })
14617 ], TwitterConnect);
14618 return TwitterConnect;
14619}());
14620
14621var __decorate$95 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14622 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14623 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14624 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;
14625 return c > 3 && r && Object.defineProperty(target, key, r), r;
14626};
14627/**
14628 * @name Vibration
14629 * @description Vibrates the device
14630 * @usage
14631 * ```typescript
14632 * import { Vibration } from 'ionic-native';
14633 *
14634 *
14635 * // Vibrate the device for a second
14636 * // Duration is ignored on iOS.
14637 * Vibration.vibrate(1000);
14638 *
14639 * // Vibrate 2 seconds
14640 * // Pause for 1 second
14641 * // Vibrate for 2 seconds
14642 * // Patterns work on Android and Windows only
14643 * Vibration.vibrate([2000,1000,2000]);
14644 *
14645 * // Stop any current vibrations immediately
14646 * // Works on Android and Windows only
14647 * Vibration.vibrate(0);
14648 * ```
14649 */
14650var Vibration = (function () {
14651 function Vibration() {
14652 }
14653 /**
14654 * Vibrates the device for given amount of time.
14655 * @param time {number|Array<number>} Milliseconds to vibrate the device. If passed an array of numbers, it will define a vibration pattern. Pass 0 to stop any vibration immediately.
14656 */
14657 Vibration.vibrate = function (time) { };
14658 __decorate$95([
14659 Cordova({
14660 sync: true
14661 })
14662 ], Vibration, "vibrate", null);
14663 Vibration = __decorate$95([
14664 Plugin({
14665 plugin: 'cordova-plugin-vibration',
14666 pluginRef: 'navigator',
14667 repo: 'https://github.com/apache/cordova-plugin-vibration',
14668 platforms: ['Android', 'iOS', 'Windows 8.1 Phone', 'Windows 8.1', 'Windows 10']
14669 })
14670 ], Vibration);
14671 return Vibration;
14672}());
14673
14674var __decorate$96 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14675 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14676 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14677 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;
14678 return c > 3 && r && Object.defineProperty(target, key, r), r;
14679};
14680/**
14681 * @name VideoEditor
14682 * @description Edit videos using native device APIs
14683 *
14684 * @usage
14685 * ```
14686 * import {VideoEditor} from 'ionic-native';
14687 *
14688 * VideoEditor.transcodeVideo({
14689 * fileUri: '/path/to/input.mov',
14690 * outputFileName: 'output.mp4',
14691 * outputFileType: VideoEditor.OutputFileType.MPEG4
14692 * })
14693 * .then((fileUri: string) => console.log('video transcode success', fileUri))
14694 * .catch((error: any) => console.log('video transcode error', error));
14695 *
14696 * ```
14697 */
14698var VideoEditor = (function () {
14699 function VideoEditor() {
14700 }
14701 /**
14702 * Transcode a video
14703 * @param options {TranscodeOptions} Options
14704 * @return {Promise<string>} Returns a promise that resolves to the path of the transcoded video
14705 */
14706 VideoEditor.transcodeVideo = function (options) { return; };
14707 /**
14708 * Trim a video
14709 * @param options {TrimOptions} Options
14710 * @return {Promise<string>} Returns a promise that resolves to the path of the trimmed video
14711 */
14712 VideoEditor.trim = function (options) { return; };
14713 /**
14714 * Create a JPEG thumbnail from a video
14715 * @param options {CreateThumbnailOptions} Options
14716 * @return {Promise<string>} Returns a promise that resolves to the path to the jpeg image on the device
14717 */
14718 VideoEditor.createThumbnail = function (options) { return; };
14719 /**
14720 * Get info on a video (width, height, orientation, duration, size, & bitrate)
14721 * @param options {GetVideoInfoOptions} Options
14722 * @return {Promise<VideoInfo>} Returns a promise that resolves to an object containing info on the video
14723 */
14724 VideoEditor.getVideoInfo = function (options) { return; };
14725 VideoEditor.OptimizeForNetworkUse = {
14726 NO: 0,
14727 YES: 1
14728 };
14729 VideoEditor.OutputFileType = {
14730 M4V: 0,
14731 MPEG4: 1,
14732 M4A: 2,
14733 QUICK_TIME: 3
14734 };
14735 __decorate$96([
14736 Cordova({
14737 callbackOrder: 'reverse'
14738 })
14739 ], VideoEditor, "transcodeVideo", null);
14740 __decorate$96([
14741 Cordova({
14742 callbackOrder: 'reverse',
14743 platforms: ['iOS']
14744 })
14745 ], VideoEditor, "trim", null);
14746 __decorate$96([
14747 Cordova({
14748 callbackOrder: 'reverse'
14749 })
14750 ], VideoEditor, "createThumbnail", null);
14751 __decorate$96([
14752 Cordova({
14753 callbackOrder: 'reverse'
14754 })
14755 ], VideoEditor, "getVideoInfo", null);
14756 VideoEditor = __decorate$96([
14757 Plugin({
14758 plugin: 'cordova-plugin-video-editor',
14759 pluginRef: 'VideoEditor',
14760 repo: 'https://github.com/jbavari/cordova-plugin-video-editor',
14761 platforms: ['Android', 'iOS', 'Windows Phone 8']
14762 })
14763 ], VideoEditor);
14764 return VideoEditor;
14765}());
14766
14767var __decorate$97 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14768 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14769 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14770 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;
14771 return c > 3 && r && Object.defineProperty(target, key, r), r;
14772};
14773/**
14774 * @name VideoPlayer
14775 * @description
14776 * A Codova plugin that simply allows you to immediately play a video in fullscreen mode.
14777 *
14778 * Requires Cordova plugin: `com.moust.cordova.videoplayer`. For more info, please see the [VideoPlayer plugin docs](https://github.com/moust/cordova-plugin-videoplayer).
14779 *
14780 * @usage
14781 * ```typescript
14782 * import { VideoPlayer } from 'ionic-native';
14783 *
14784 *
14785 * // Playing a video.
14786 * VideoPlayer.play("file:///android_asset/www/movie.mp4").then(() => {
14787 * console.log('video completed');
14788 * }).catch(err => {
14789 * console.log(err);
14790 * });
14791 *
14792 * ```
14793 */
14794var VideoPlayer = (function () {
14795 function VideoPlayer() {
14796 }
14797 /**
14798 * Plays the video from the passed url.
14799 * @param fileUrl {string} File url to the video.
14800 * @param options {VideoOptions?} Optional video playback settings. See options above.
14801 * @returns {Promise<any>} Resolves promise when the video was played successfully.
14802 */
14803 VideoPlayer.play = function (fileUrl, options) { return; };
14804 /**
14805 * Stops the video playback immediatly.
14806 */
14807 VideoPlayer.close = function () { };
14808 __decorate$97([
14809 Cordova()
14810 ], VideoPlayer, "play", null);
14811 __decorate$97([
14812 Cordova({ sync: true })
14813 ], VideoPlayer, "close", null);
14814 VideoPlayer = __decorate$97([
14815 Plugin({
14816 plugin: 'cordova-plugin-videoplayer',
14817 pluginRef: 'VideoPlayer',
14818 repo: 'https://github.com/moust/cordova-plugin-videoplayer',
14819 platforms: ['Android']
14820 })
14821 ], VideoPlayer);
14822 return VideoPlayer;
14823}());
14824
14825var __decorate$98 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14826 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14827 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14828 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;
14829 return c > 3 && r && Object.defineProperty(target, key, r), r;
14830};
14831/**
14832 * @name WebIntent
14833 * @description
14834 * @usage
14835 * For usage information please refer to the plugin's Github repo.
14836 *
14837 * ```typescript
14838 * import {WebIntent} from 'ionic-native';
14839 *
14840 * WebIntent.startActivity(options).then(onSuccess, onError);
14841 *
14842 * ```
14843 */
14844var WebIntent = (function () {
14845 function WebIntent() {
14846 }
14847 Object.defineProperty(WebIntent, "ACTION_VIEW", {
14848 get: function () {
14849 return window.plugins.webintent.ACTION_VIEW;
14850 },
14851 enumerable: true,
14852 configurable: true
14853 });
14854 Object.defineProperty(WebIntent, "EXTRA_TEXT", {
14855 get: function () {
14856 return window.plugins.webintent.EXTRA_TEXT;
14857 },
14858 enumerable: true,
14859 configurable: true
14860 });
14861 WebIntent.startActivity = function (options) { return; };
14862 WebIntent.hasExtra = function (extra) { return; };
14863 WebIntent.getExtra = function (extra) { return; };
14864 WebIntent.getUri = function () { return; };
14865
14866 WebIntent.onNewIntent = function () { return; };
14867
14868 WebIntent.sendBroadcast = function (options) { return; };
14869 __decorate$98([
14870 CordovaProperty
14871 ], WebIntent, "ACTION_VIEW", null);
14872 __decorate$98([
14873 CordovaProperty
14874 ], WebIntent, "EXTRA_TEXT", null);
14875 __decorate$98([
14876 Cordova()
14877 ], WebIntent, "startActivity", null);
14878 __decorate$98([
14879 Cordova()
14880 ], WebIntent, "hasExtra", null);
14881 __decorate$98([
14882 Cordova()
14883 ], WebIntent, "getExtra", null);
14884 __decorate$98([
14885 Cordova()
14886 ], WebIntent, "getUri", null);
14887 __decorate$98([
14888 Cordova()
14889 ], WebIntent, "onNewIntent", null);
14890 __decorate$98([
14891 Cordova()
14892 ], WebIntent, "sendBroadcast", null);
14893 WebIntent = __decorate$98([
14894 Plugin({
14895 plugin: 'https://github.com/Initsogar/cordova-webintent.git',
14896 pluginRef: 'window.plugins.webintent',
14897 repo: 'https://github.com/Initsogar/cordova-webintent.git',
14898 platforms: ['Android']
14899 })
14900 ], WebIntent);
14901 return WebIntent;
14902}());
14903
14904var __decorate$99 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14905 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14906 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14907 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;
14908 return c > 3 && r && Object.defineProperty(target, key, r), r;
14909};
14910/**
14911 * @name YoutubeVideoPlayer
14912 * @description
14913 * Plays YouTube videos in Native YouTube App
14914 *
14915 * @usage
14916 * ```
14917 * import {YoutubeVideoPlayer} from 'ionic-native';
14918 *
14919 * YouTubeVideoPlayer.openVideo('myvideoid');
14920 *
14921 * ```
14922 */
14923var YoutubeVideoPlayer = (function () {
14924 function YoutubeVideoPlayer() {
14925 }
14926 /**
14927 * Plays a YouTube video
14928 * @param videoId {string} Video ID
14929 */
14930 YoutubeVideoPlayer.openVideo = function (videoId) { };
14931 __decorate$99([
14932 Cordova({ sync: true })
14933 ], YoutubeVideoPlayer, "openVideo", null);
14934 YoutubeVideoPlayer = __decorate$99([
14935 Plugin({
14936 plugin: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer.git',
14937 pluginRef: 'YoutubeVideoPlayer',
14938 repo: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer',
14939 platforms: ['Android', 'iOS']
14940 })
14941 ], YoutubeVideoPlayer);
14942 return YoutubeVideoPlayer;
14943}());
14944
14945var __decorate$100 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
14946 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14947 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
14948 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;
14949 return c > 3 && r && Object.defineProperty(target, key, r), r;
14950};
14951/**
14952 * @name Zip
14953 * @description
14954 * A Cordova plugin to unzip files in Android and iOS.
14955 *
14956 * @usage
14957 * ```
14958 * import {Zip} from 'ionic-native';
14959 *
14960 * Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%'))
14961 * .then((result) => {
14962 * if(result === 0) console.log('SUCCESS');
14963 * if(result === -1) console.log('FAILED');
14964 * });
14965 *
14966 * ```
14967 */
14968var Zip = (function () {
14969 function Zip() {
14970 }
14971 /**
14972 * Extracts files from a ZIP archive
14973 * @param sourceZip {string} Source ZIP file
14974 * @param destUrl {string} Destination folder
14975 * @param onProgress {Function} optional callback to be called on progress update
14976 * @return {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
14977 */
14978 Zip.unzip = function (sourceZip, destUrl, onProgress) { return; };
14979 __decorate$100([
14980 Cordova({
14981 successIndex: 2,
14982 errorIndex: 4
14983 })
14984 ], Zip, "unzip", null);
14985 Zip = __decorate$100([
14986 Plugin({
14987 plugin: 'cordova-plugin-zip',
14988 pluginRef: 'zip',
14989 repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip',
14990 })
14991 ], Zip);
14992 return Zip;
14993}());
14994
14995var DEVICE_READY_TIMEOUT = 2000;
14996// Window export to use outside of a module loading system
14997window['IonicNative'] = {
14998 ActionSheet: ActionSheet,
14999 AdMob: AdMob,
15000 AndroidFingerprintAuth: AndroidFingerprintAuth,
15001 AppAvailability: AppAvailability,
15002 AppRate: AppRate,
15003 AppVersion: AppVersion,
15004 Badge: Badge,
15005 BackgroundGeolocation: BackgroundGeolocation,
15006 BackgroundMode: BackgroundMode,
15007 BarcodeScanner: BarcodeScanner,
15008 Base64ToGallery: Base64ToGallery,
15009 BatteryStatus: BatteryStatus,
15010 Brightness: Brightness,
15011 BLE: BLE,
15012 BluetoothSerial: BluetoothSerial,
15013 Calendar: Calendar,
15014 CallNumber: CallNumber,
15015 Camera: Camera,
15016 CameraPreview: CameraPreview,
15017 CardIO: CardIO,
15018 Clipboard: Clipboard,
15019 CodePush: CodePush,
15020 Contacts: Contacts,
15021 Crop: Crop,
15022 DatePicker: DatePicker,
15023 DBMeter: DBMeter,
15024 Deeplinks: Deeplinks,
15025 Device: Device,
15026 DeviceAccounts: DeviceAccounts,
15027 DeviceMotion: DeviceMotion,
15028 DeviceOrientation: DeviceOrientation,
15029 Dialogs: Dialogs,
15030 Diagnostic: Diagnostic,
15031 EmailComposer: EmailComposer,
15032 EstimoteBeacons: EstimoteBeacons,
15033 Facebook: Facebook,
15034 File: File,
15035 FileChooser: FileChooser,
15036 FileOpener: FileOpener,
15037 Flashlight: Flashlight,
15038 Geofence: Geofence,
15039 Geolocation: Geolocation,
15040 Globalization: Globalization,
15041 GooglePlus: GooglePlus,
15042 GoogleMap: GoogleMap,
15043 GoogleAnalytics: GoogleAnalytics,
15044 Hotspot: Hotspot,
15045 Httpd: Httpd,
15046 IBeacon: IBeacon,
15047 ImagePicker: ImagePicker,
15048 ImageResizer: ImageResizer,
15049 InAppBrowser: InAppBrowser,
15050 InAppPurchase: InAppPurchase,
15051 Instagram: Instagram,
15052 IsDebug: IsDebug,
15053 Keyboard: Keyboard,
15054 LaunchNavigator: LaunchNavigator,
15055 LocalNotifications: LocalNotifications,
15056 Market: Market,
15057 MediaCapture: MediaCapture,
15058 MediaPlugin: MediaPlugin,
15059 Mixpanel: Mixpanel,
15060 MusicControls: MusicControls,
15061 NativeAudio: NativeAudio,
15062 NativePageTransitions: NativePageTransitions,
15063 NativeStorage: NativeStorage,
15064 Network: Network,
15065 PayPal: PayPal,
15066 NFC: NFC,
15067 Printer: Printer,
15068 Push: Push,
15069 OneSignal: OneSignal,
15070 PhotoViewer: PhotoViewer,
15071 ScreenOrientation: ScreenOrientation,
15072 PinDialog: PinDialog,
15073 PowerManagement: PowerManagement,
15074 SafariViewController: SafariViewController,
15075 Screenshot: Screenshot,
15076 SecureStorage: SecureStorage,
15077 Shake: Shake,
15078 Sim: Sim,
15079 SMS: SMS,
15080 SocialSharing: SocialSharing,
15081 SpinnerDialog: SpinnerDialog,
15082 Splashscreen: Splashscreen,
15083 SQLite: SQLite,
15084 StatusBar: StatusBar,
15085 StreamingMedia: StreamingMedia,
15086 ThreeDeeTouch: ThreeDeeTouch,
15087 Toast: Toast,
15088 TouchID: TouchID,
15089 Transfer: Transfer,
15090 TextToSpeech: TextToSpeech,
15091 TwitterConnect: TwitterConnect,
15092 VideoEditor: VideoEditor,
15093 VideoPlayer: VideoPlayer,
15094 Vibration: Vibration,
15095 WebIntent: WebIntent,
15096 YoutubeVideoPlayer: YoutubeVideoPlayer,
15097 Zip: Zip
15098};
15099initAngular1(window['IonicNative']);
15100// To help developers using cordova, we listen for the device ready event and
15101// log an error if it didn't fire in a reasonable amount of time. Generally,
15102// when this happens, developers should remove and reinstall plugins, since
15103// an inconsistent plugin is often the culprit.
15104var before = Date.now();
15105var didFireReady = false;
15106document.addEventListener('deviceready', function () {
15107 console.log('DEVICE READY FIRED AFTER', (Date.now() - before), 'ms');
15108 didFireReady = true;
15109});
15110setTimeout(function () {
15111 if (!didFireReady && window.cordova) {
15112 console.warn("Native: deviceready did not fire within " + DEVICE_READY_TIMEOUT + "ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.");
15113 }
15114}, DEVICE_READY_TIMEOUT);
15115
15116function isAPIResponseError(x) {
15117 return x.meta.status >= 400;
15118}
15119
15120var __extends$3 = (undefined && undefined.__extends) || function (d, b) {
15121 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
15122 function __() { this.constructor = d; }
15123 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15124};
15125/**
15126 * @hidden
15127 */
15128var Exception = (function (_super) {
15129 __extends$3(Exception, _super);
15130 function Exception(message) {
15131 _super.call(this, message);
15132 this.message = message;
15133 this.name = 'Exception';
15134 this.stack = (new Error()).stack;
15135 }
15136 Exception.prototype.toString = function () {
15137 return this.name + ": " + this.message;
15138 };
15139 return Exception;
15140}(Error));
15141/**
15142 * An error with generic error details.
15143 *
15144 * Error details can be extracted depending on the type of `D`. For instance,
15145 * if the type of `D` is `string[]`, you can do this:
15146 *
15147 * ```typescript
15148 * function handleError(err: IDetailedError<string[]>) {
15149 * for (let i in err.details) {
15150 * console.error('got error code: ' + i);
15151 * }
15152 * }
15153 * ```
15154 *
15155 * @featured
15156 */
15157var DetailedError = (function (_super) {
15158 __extends$3(DetailedError, _super);
15159 function DetailedError(
15160 /**
15161 * The error message.
15162 */
15163 message,
15164 /**
15165 * The error details.
15166 */
15167 details) {
15168 _super.call(this, message);
15169 this.message = message;
15170 this.details = details;
15171 this.name = 'DetailedError';
15172 }
15173 return DetailedError;
15174}(Exception));
15175
15176/**
15177 * @hidden
15178 */
15179var DeferredPromise = (function () {
15180 function DeferredPromise() {
15181 this.init();
15182 }
15183 DeferredPromise.prototype.init = function () {
15184 var _this = this;
15185 this.promise = new Promise(function (resolve, reject) {
15186 _this.resolve = function (v) {
15187 resolve(v);
15188 return _this.promise;
15189 };
15190 _this.reject = function (e) {
15191 reject(e);
15192 return _this.promise;
15193 };
15194 });
15195 };
15196 DeferredPromise.rejectImmediately = function (err) {
15197 return new Promise(function (resolve, reject) {
15198 reject(err);
15199 });
15200 };
15201 return DeferredPromise;
15202}());
15203
15204var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
15205var SEMVER_REGEX = /^v?([0-9]+)\.?([0-9]+)?\.?([0-9]+)?\.?.*$/;
15206function isValidEmail(email) {
15207 return EMAIL_REGEX.test(email);
15208}
15209function parseSemanticVersion(s) {
15210 var r = s.trim().match(SEMVER_REGEX);
15211 if (!r) {
15212 throw new Error('Invalid semantic version.');
15213 }
15214 var v = {
15215 'major': Number(r[1])
15216 };
15217 if (r[2]) {
15218 v.minor = Number(r[2]);
15219 }
15220 if (r[3]) {
15221 v.patch = Number(r[3]);
15222 }
15223 return v;
15224}
15225
15226var __extends = (undefined && undefined.__extends) || function (d, b) {
15227 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
15228 function __() { this.constructor = d; }
15229 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15230};
15231/**
15232 * @hidden
15233 */
15234
15235/**
15236 * @hidden
15237 */
15238var CombinedAuthTokenContext = (function () {
15239 function CombinedAuthTokenContext(deps, label) {
15240 this.label = label;
15241 this.storage = deps.storage;
15242 this.tempStorage = deps.tempStorage;
15243 }
15244 CombinedAuthTokenContext.prototype.get = function () {
15245 var permToken = this.storage.get(this.label);
15246 var tempToken = this.tempStorage.get(this.label);
15247 var token = tempToken || permToken;
15248 return token;
15249 };
15250 CombinedAuthTokenContext.prototype.store = function (token, options) {
15251 if (options === void 0) { options = { 'permanent': true }; }
15252 if (options.permanent) {
15253 this.storage.set(this.label, token);
15254 }
15255 else {
15256 this.tempStorage.set(this.label, token);
15257 }
15258 };
15259 CombinedAuthTokenContext.prototype.delete = function () {
15260 this.storage.delete(this.label);
15261 this.tempStorage.delete(this.label);
15262 };
15263 return CombinedAuthTokenContext;
15264}());
15265/**
15266 * `Auth` handles authentication of a single user, such as signing up, logging
15267 * in & out, social provider authentication, etc.
15268 *
15269 * @featured
15270 */
15271var Auth = (function () {
15272 function Auth(deps) {
15273 this.config = deps.config;
15274 this.emitter = deps.emitter;
15275 this.authModules = deps.authModules;
15276 this.tokenContext = deps.tokenContext;
15277 this.userService = deps.userService;
15278 }
15279 Object.defineProperty(Auth.prototype, "passwordResetUrl", {
15280 /**
15281 * Link the user to this URL for password resets. Only for email/password
15282 * authentication.
15283 *
15284 * Use this if you want to use our password reset forms instead of creating
15285 * your own in your app.
15286 */
15287 get: function () {
15288 return this.config.getURL('web') + "/password/reset/" + this.config.get('app_id');
15289 },
15290 enumerable: true,
15291 configurable: true
15292 });
15293 /**
15294 * Check whether the user is logged in or not.
15295 *
15296 * If an auth token exists in local storage, the user is logged in.
15297 */
15298 Auth.prototype.isAuthenticated = function () {
15299 var token = this.tokenContext.get();
15300 if (token) {
15301 return true;
15302 }
15303 return false;
15304 };
15305 /**
15306 * Sign up a user with the given data. Only for email/password
15307 * authentication.
15308 *
15309 * `signup` does not affect local data or the current user until `login` is
15310 * called. This means you'll likely want to log in your users manually after
15311 * signup.
15312 *
15313 * If a signup fails, the promise rejects with a [`IDetailedError`
15314 * object](/api/client/idetailederror) that contains an array of error codes
15315 * from the cloud.
15316 *
15317 * @param details - The details that describe a user.
15318 */
15319 Auth.prototype.signup = function (details) {
15320 return this.authModules.basic.signup(details);
15321 };
15322 /**
15323 * Attempt to log the user in with the given credentials. For custom & social
15324 * logins, kick-off the authentication process.
15325 *
15326 * After login, the full user is loaded from the cloud and saved in local
15327 * storage along with their auth token.
15328 *
15329 * @note TODO: Better error handling docs.
15330 *
15331 * @param moduleId
15332 * The authentication provider module ID to use with this login.
15333 * @param credentials
15334 * For email/password authentication, give an email and password. For social
15335 * authentication, exclude this parameter. For custom authentication, send
15336 * whatever you need.
15337 * @param options
15338 * Options for this login, such as whether to remember the login and
15339 * InAppBrowser window options for authentication providers that make use of
15340 * it.
15341 */
15342 Auth.prototype.login = function (moduleId, credentials, options) {
15343 var _this = this;
15344 if (options === void 0) { options = {}; }
15345 if (typeof options.remember === 'undefined') {
15346 options.remember = true;
15347 }
15348 if (typeof options.inAppBrowserOptions === 'undefined') {
15349 options.inAppBrowserOptions = {};
15350 }
15351 if (typeof options.inAppBrowserOptions.location === 'undefined') {
15352 options.inAppBrowserOptions.location = false;
15353 }
15354 if (typeof options.inAppBrowserOptions.clearcache === 'undefined') {
15355 options.inAppBrowserOptions.clearcache = true;
15356 }
15357 if (typeof options.inAppBrowserOptions.clearsessioncache === 'undefined') {
15358 options.inAppBrowserOptions.clearsessioncache = true;
15359 }
15360 var context = this.authModules[moduleId];
15361 if (!context) {
15362 throw new Error('Authentication class is invalid or missing:' + context);
15363 }
15364 return context.authenticate(credentials, options).then(function (r) {
15365 _this.storeToken(options, r.token);
15366 return _this.userService.load().then(function () {
15367 var user = _this.userService.current();
15368 user.store();
15369 return r;
15370 });
15371 });
15372 };
15373 /**
15374 * Log the user out of the app.
15375 *
15376 * This clears the auth token out of local storage and restores the user to
15377 * an unauthenticated state.
15378 */
15379 Auth.prototype.logout = function () {
15380 this.tokenContext.delete();
15381 var user = this.userService.current();
15382 user.unstore();
15383 user.clear();
15384 };
15385 /**
15386 * Kick-off the password reset process. Only for email/password
15387 * authentication.
15388 *
15389 * An email will be sent to the user with a short password reset code, which
15390 * they can copy back into your app and use the [`confirmPasswordReset()`
15391 * method](#confirmPasswordReset).
15392 *
15393 * @param email - The email address to which to send a code.
15394 */
15395 Auth.prototype.requestPasswordReset = function (email) {
15396 this.storage.set('auth_password_reset_email', email);
15397 return this.authModules.basic.requestPasswordReset(email);
15398 };
15399 /**
15400 * Confirm a password reset.
15401 *
15402 * When the user gives you their password reset code into your app and their
15403 * requested changed password, call this method.
15404 *
15405 * @param code - The password reset code from the user.
15406 * @param newPassword - The requested changed password from the user.
15407 */
15408 Auth.prototype.confirmPasswordReset = function (code, newPassword) {
15409 var email = this.storage.get('auth_password_reset_email');
15410 if (!email) {
15411 return DeferredPromise.rejectImmediately(new Error('email address not found in local storage'));
15412 }
15413 else {
15414 return this.authModules.basic.confirmPasswordReset(email, code, newPassword);
15415 }
15416 };
15417 /**
15418 * Get the raw auth token of the active user from local storage.
15419 */
15420 Auth.prototype.getToken = function () {
15421 return this.tokenContext.get();
15422 };
15423 /**
15424 * @hidden
15425 */
15426 Auth.prototype.storeToken = function (options, token) {
15427 if (options === void 0) { options = { 'remember': true }; }
15428 var originalToken = this.authToken;
15429 this.authToken = token;
15430 this.tokenContext.store(this.authToken, { 'permanent': options.remember });
15431 this.emitter.emit('auth:token-changed', { 'old': originalToken, 'new': this.authToken });
15432 };
15433 /**
15434 * @hidden
15435 */
15436 Auth.getDetailedErrorFromResponse = function (res) {
15437 var errors = [];
15438 var details = [];
15439 if (isAPIResponseError(res.body) && typeof res.body.error.details !== 'undefined') {
15440 details = res.body.error.details;
15441 }
15442 for (var i = 0; i < details.length; i++) {
15443 var detail = details[i];
15444 if (detail.error_type) {
15445 errors.push(detail.error_type + '_' + detail.parameter);
15446 }
15447 }
15448 return new DetailedError('Error creating user', errors);
15449 };
15450 return Auth;
15451}());
15452/**
15453 * @hidden
15454 */
15455var AuthType = (function () {
15456 function AuthType(deps) {
15457 this.config = deps.config;
15458 this.client = deps.client;
15459 this.emitter = deps.emitter;
15460 }
15461 AuthType.prototype.parseInAppBrowserOptions = function (opts) {
15462 if (!opts) {
15463 return '';
15464 }
15465 var p = [];
15466 for (var k in opts) {
15467 var v = void 0;
15468 if (typeof opts[k] === 'boolean') {
15469 v = opts[k] ? 'yes' : 'no';
15470 }
15471 else {
15472 v = opts[k];
15473 }
15474 p.push(k + "=" + v);
15475 }
15476 return p.join(',');
15477 };
15478 AuthType.prototype.inAppBrowserFlow = function (moduleId, data, options) {
15479 var _this = this;
15480 if (data === void 0) { data = {}; }
15481 if (options === void 0) { options = {}; }
15482 var deferred = new DeferredPromise();
15483 if (!window || !window.cordova) {
15484 return deferred.reject(new Error('Cordova is missing--can\'t login with InAppBrowser flow.'));
15485 }
15486 this.emitter.once('cordova:deviceready', function () {
15487 if (!window.cordova.InAppBrowser) {
15488 deferred.reject(new Error('InAppBrowser plugin missing'));
15489 return;
15490 }
15491 _this.client.post("/auth/login/" + moduleId)
15492 .send({
15493 'app_id': _this.config.get('app_id'),
15494 'callback': window.location.href,
15495 'data': data
15496 })
15497 .end(function (err, res) {
15498 if (err) {
15499 deferred.reject(err);
15500 }
15501 else {
15502 var w_1 = window.cordova.InAppBrowser.open(res.body.data.url, '_blank', _this.parseInAppBrowserOptions(options.inAppBrowserOptions));
15503 var onExit_1 = function () {
15504 deferred.reject(new Error('InAppBrowser exit'));
15505 };
15506 var onLoadError_1 = function () {
15507 deferred.reject(new Error('InAppBrowser loaderror'));
15508 };
15509 var onLoadStart = function (data) {
15510 if (data.url.slice(0, 20) === 'http://auth.ionic.io') {
15511 var queryString = data.url.split('#')[0].split('?')[1];
15512 var paramParts = queryString.split('&');
15513 var params = {};
15514 for (var i = 0; i < paramParts.length; i++) {
15515 var part = paramParts[i].split('=');
15516 params[part[0]] = part[1];
15517 }
15518 w_1.removeEventListener('exit', onExit_1);
15519 w_1.removeEventListener('loaderror', onLoadError_1);
15520 w_1.close();
15521 deferred.resolve({
15522 'token': params['token'],
15523 'signup': Boolean(parseInt(params['signup'], 10))
15524 });
15525 }
15526 };
15527 w_1.addEventListener('exit', onExit_1);
15528 w_1.addEventListener('loaderror', onLoadError_1);
15529 w_1.addEventListener('loadstart', onLoadStart);
15530 }
15531 });
15532 });
15533 return deferred.promise;
15534 };
15535 return AuthType;
15536}());
15537/**
15538 * @hidden
15539 */
15540var BasicAuthType = (function (_super) {
15541 __extends(BasicAuthType, _super);
15542 function BasicAuthType() {
15543 _super.apply(this, arguments);
15544 }
15545 BasicAuthType.prototype.authenticate = function (data, options) {
15546 var deferred = new DeferredPromise();
15547 if (!data.email || !data.password) {
15548 return deferred.reject(new Error('email and password are required for basic authentication'));
15549 }
15550 this.client.post('/auth/login')
15551 .send({
15552 'app_id': this.config.get('app_id'),
15553 'email': data.email,
15554 'password': data.password
15555 })
15556 .end(function (err, res) {
15557 if (err) {
15558 deferred.reject(err);
15559 }
15560 else {
15561 deferred.resolve({
15562 'token': res.body.data.token
15563 });
15564 }
15565 });
15566 return deferred.promise;
15567 };
15568 BasicAuthType.prototype.requestPasswordReset = function (email) {
15569 var deferred = new DeferredPromise();
15570 if (!email) {
15571 return deferred.reject(new Error('Email is required for password reset request.'));
15572 }
15573 this.client.post('/users/password/reset')
15574 .send({
15575 'app_id': this.config.get('app_id'),
15576 'email': email,
15577 'flow': 'app'
15578 })
15579 .end(function (err, res) {
15580 if (err) {
15581 deferred.reject(err);
15582 }
15583 else {
15584 deferred.resolve();
15585 }
15586 });
15587 return deferred.promise;
15588 };
15589 BasicAuthType.prototype.confirmPasswordReset = function (email, code, newPassword) {
15590 var deferred = new DeferredPromise();
15591 if (!code || !email || !newPassword) {
15592 return deferred.reject(new Error('Code, new password, and email are required.'));
15593 }
15594 this.client.post('/users/password')
15595 .send({
15596 'reset_token': code,
15597 'new_password': newPassword,
15598 'email': email
15599 })
15600 .end(function (err, res) {
15601 if (err) {
15602 deferred.reject(err);
15603 }
15604 else {
15605 deferred.resolve();
15606 }
15607 });
15608 return deferred.promise;
15609 };
15610 BasicAuthType.prototype.signup = function (data) {
15611 var deferred = new DeferredPromise();
15612 if (data.email) {
15613 if (!isValidEmail(data.email)) {
15614 return deferred.reject(new DetailedError('Invalid email supplied.', ['invalid_email']));
15615 }
15616 }
15617 else {
15618 return deferred.reject(new DetailedError('Email is required for email/password auth signup.', ['required_email']));
15619 }
15620 if (!data.password) {
15621 return deferred.reject(new DetailedError('Password is required for email/password auth signup.', ['required_password']));
15622 }
15623 var userData = {
15624 'app_id': this.config.get('app_id'),
15625 'email': data.email,
15626 'password': data.password
15627 };
15628 // optional details
15629 if (data.username) {
15630 userData.username = data.username;
15631 }
15632 if (data.image) {
15633 userData.image = data.image;
15634 }
15635 if (data.name) {
15636 userData.name = data.name;
15637 }
15638 if (data.custom) {
15639 userData.custom = data.custom;
15640 }
15641 this.client.post('/users')
15642 .send(userData)
15643 .end(function (err, res) {
15644 if (err) {
15645 deferred.reject(Auth.getDetailedErrorFromResponse(err.response));
15646 }
15647 else {
15648 deferred.resolve();
15649 }
15650 });
15651 return deferred.promise;
15652 };
15653 return BasicAuthType;
15654}(AuthType));
15655/**
15656 * hidden
15657 */
15658var NativeAuth = (function () {
15659 function NativeAuth(deps) {
15660 this.config = deps.config;
15661 this.client = deps.client;
15662 this.userService = deps.userService;
15663 this.tokenContext = deps.tokenContext;
15664 this.emitter = deps.emitter;
15665 }
15666 /**
15667 * Get the raw auth token of the active user from local storage.
15668 * @hidden
15669 */
15670 NativeAuth.prototype.getToken = function () {
15671 return this.tokenContext.get();
15672 };
15673 /**
15674 * @hidden
15675 */
15676 NativeAuth.prototype.storeToken = function (token) {
15677 var originalToken = this.authToken;
15678 this.authToken = token;
15679 this.tokenContext.store(this.authToken, { 'permanent': true });
15680 this.emitter.emit('auth:token-changed', { 'old': originalToken, 'new': this.authToken });
15681 };
15682 return NativeAuth;
15683}());
15684/**
15685 * GoogleNativeAuth handles logging into googleplus through the cordova-plugin-googleplus plugin.'
15686 * @featured
15687 */
15688var GoogleAuth = (function (_super) {
15689 __extends(GoogleAuth, _super);
15690 function GoogleAuth() {
15691 _super.apply(this, arguments);
15692 }
15693 GoogleAuth.prototype.logout = function () {
15694 var deferred = new DeferredPromise();
15695 this.tokenContext.delete();
15696 var user = this.userService.current();
15697 user.unstore();
15698 user.clear();
15699 GooglePlus.logout().then(function () {
15700 deferred.resolve();
15701 }, function (err) {
15702 deferred.reject(err);
15703 });
15704 return deferred.promise;
15705 };
15706 GoogleAuth.prototype.login = function () {
15707 var _this = this;
15708 var deferred = new DeferredPromise();
15709 var authConfig = this.config.settings.auth;
15710 this.emitter.once('cordova:deviceready', function () {
15711 var scope = ['profile', 'email'];
15712 if (!GooglePlus) {
15713 deferred.reject(new Error('Ionic native is not installed'));
15714 return;
15715 }
15716 if (!window || !window.cordova) {
15717 deferred.reject(new Error('Cordova is missing'));
15718 return;
15719 }
15720 if (!window.plugins || !window.plugins.googleplus) {
15721 deferred.reject(new Error('GooglePlus cordova plugin is missing.'));
15722 return;
15723 }
15724 if (!authConfig || !authConfig.google || !authConfig.google.webClientId) {
15725 deferred.reject(new Error('Missing google web client id. Please visit http://docs.ionic.io/services/users/google-auth.html#native'));
15726 return;
15727 }
15728 if (authConfig.google.scope) {
15729 authConfig.google.scope.forEach(function (item) {
15730 if (scope.indexOf(item) === -1) {
15731 scope.push(item);
15732 }
15733 });
15734 }
15735 GooglePlus.login({ 'webClientId': authConfig.google.webClientId, 'offline': true, 'scopes': scope.join(' ') }).then(function (success) {
15736 if (!success.serverAuthCode) {
15737 deferred.reject(new Error('Failed to retrieve offline access token.'));
15738 return;
15739 }
15740 var request_object = {
15741 'app_id': _this.config.get('app_id'),
15742 'serverAuthCode': success.serverAuthCode,
15743 'additional_fields': scope,
15744 'flow': 'native-mobile'
15745 };
15746 _this.client.post('/auth/login/google')
15747 .send(request_object)
15748 .end(function (err, res) {
15749 if (err) {
15750 deferred.reject(err);
15751 }
15752 else {
15753 _this.storeToken(res.body.data.token);
15754 _this.userService.load().then(function () {
15755 var user = _this.userService.current();
15756 user.store();
15757 deferred.resolve({
15758 'token': res.body.data.token,
15759 'signup': Boolean(parseInt(res.body.data.signup, 10))
15760 });
15761 });
15762 }
15763 });
15764 }, function (err) {
15765 deferred.reject(err);
15766 });
15767 });
15768 return deferred.promise;
15769 };
15770 return GoogleAuth;
15771}(NativeAuth));
15772/**
15773 * FacebookNative handles logging into facebook through the cordova-plugin-facebook4 plugin.
15774 * @featured
15775 */
15776var FacebookAuth = (function (_super) {
15777 __extends(FacebookAuth, _super);
15778 function FacebookAuth() {
15779 _super.apply(this, arguments);
15780 }
15781 FacebookAuth.prototype.logout = function () {
15782 var deferred = new DeferredPromise();
15783 this.tokenContext.delete();
15784 var user = this.userService.current();
15785 user.unstore();
15786 user.clear();
15787 // Clear the facebook auth.
15788 Facebook.logout().then(function () {
15789 deferred.resolve();
15790 }, function (err) {
15791 deferred.reject(err);
15792 });
15793 return deferred.promise;
15794 };
15795 FacebookAuth.prototype.login = function () {
15796 var _this = this;
15797 var deferred = new DeferredPromise();
15798 var authConfig = this.config.settings.auth;
15799 var scope = ['public_profile', 'email'];
15800 if (authConfig && authConfig.facebook && authConfig.facebook.scope) {
15801 authConfig.facebook.scope.forEach(function (item) {
15802 if (scope.indexOf(item) === -1) {
15803 scope.push(item);
15804 }
15805 });
15806 }
15807 this.emitter.once('cordova:deviceready', function () {
15808 if (!Facebook) {
15809 deferred.reject(new Error('Ionic native is not installed'));
15810 return;
15811 }
15812 if (!window || !window.cordova) {
15813 deferred.reject(new Error('Cordova is missing.'));
15814 return;
15815 }
15816 if (!window.facebookConnectPlugin) {
15817 deferred.reject(new Error('Please install the cordova-plugin-facebook4 plugin'));
15818 return;
15819 }
15820 Facebook.login(scope).then(function (r) {
15821 scope.splice(scope.indexOf('public_profile'), 1);
15822 var request_object = {
15823 'app_id': _this.config.get('app_id'),
15824 'access_token': r.authResponse.accessToken,
15825 'additional_fields': scope,
15826 'flow': 'native-mobile'
15827 };
15828 _this.client.post('/auth/login/facebook')
15829 .send(request_object)
15830 .end(function (err, res) {
15831 if (err) {
15832 deferred.reject(err);
15833 }
15834 else {
15835 _this.storeToken(res.body.data.token);
15836 _this.userService.load().then(function () {
15837 var user = _this.userService.current();
15838 user.store();
15839 deferred.resolve({
15840 'token': res.body.data.token,
15841 'signup': Boolean(parseInt(res.body.data.signup, 10))
15842 });
15843 });
15844 }
15845 });
15846 }, function (err) {
15847 deferred.reject(err);
15848 });
15849 });
15850 return deferred.promise;
15851 };
15852 return FacebookAuth;
15853}(NativeAuth));
15854/**
15855 * @hidden
15856 */
15857var CustomAuthType = (function (_super) {
15858 __extends(CustomAuthType, _super);
15859 function CustomAuthType() {
15860 _super.apply(this, arguments);
15861 }
15862 CustomAuthType.prototype.authenticate = function (data, options) {
15863 if (data === void 0) { data = {}; }
15864 return this.inAppBrowserFlow('custom', data, options);
15865 };
15866 return CustomAuthType;
15867}(AuthType));
15868/**
15869 * @hidden
15870 */
15871var TwitterAuthType = (function (_super) {
15872 __extends(TwitterAuthType, _super);
15873 function TwitterAuthType() {
15874 _super.apply(this, arguments);
15875 }
15876 TwitterAuthType.prototype.authenticate = function (data, options) {
15877 if (data === void 0) { data = {}; }
15878 return this.inAppBrowserFlow('twitter', data, options);
15879 };
15880 return TwitterAuthType;
15881}(AuthType));
15882/**
15883 * @hidden
15884 */
15885var FacebookAuthType = (function (_super) {
15886 __extends(FacebookAuthType, _super);
15887 function FacebookAuthType() {
15888 _super.apply(this, arguments);
15889 }
15890 FacebookAuthType.prototype.authenticate = function (data, options) {
15891 if (data === void 0) { data = {}; }
15892 return this.inAppBrowserFlow('facebook', data, options);
15893 };
15894 return FacebookAuthType;
15895}(AuthType));
15896/**
15897 * @hidden
15898 */
15899var GithubAuthType = (function (_super) {
15900 __extends(GithubAuthType, _super);
15901 function GithubAuthType() {
15902 _super.apply(this, arguments);
15903 }
15904 GithubAuthType.prototype.authenticate = function (data, options) {
15905 if (data === void 0) { data = {}; }
15906 return this.inAppBrowserFlow('github', data, options);
15907 };
15908 return GithubAuthType;
15909}(AuthType));
15910/**
15911 * @hidden
15912 */
15913var GoogleAuthType = (function (_super) {
15914 __extends(GoogleAuthType, _super);
15915 function GoogleAuthType() {
15916 _super.apply(this, arguments);
15917 }
15918 GoogleAuthType.prototype.authenticate = function (data, options) {
15919 if (data === void 0) { data = {}; }
15920 return this.inAppBrowserFlow('google', data, options);
15921 };
15922 return GoogleAuthType;
15923}(AuthType));
15924/**
15925 * @hidden
15926 */
15927var InstagramAuthType = (function (_super) {
15928 __extends(InstagramAuthType, _super);
15929 function InstagramAuthType() {
15930 _super.apply(this, arguments);
15931 }
15932 InstagramAuthType.prototype.authenticate = function (data, options) {
15933 if (data === void 0) { data = {}; }
15934 return this.inAppBrowserFlow('instagram', data, options);
15935 };
15936 return InstagramAuthType;
15937}(AuthType));
15938/**
15939 * @hidden
15940 */
15941var LinkedInAuthType = (function (_super) {
15942 __extends(LinkedInAuthType, _super);
15943 function LinkedInAuthType() {
15944 _super.apply(this, arguments);
15945 }
15946 LinkedInAuthType.prototype.authenticate = function (data, options) {
15947 if (data === void 0) { data = {}; }
15948 return this.inAppBrowserFlow('linkedin', data, options);
15949 };
15950 return LinkedInAuthType;
15951}(AuthType));
15952
15953var index = createCommonjsModule(function (module) {
15954/**
15955 * Expose `Emitter`.
15956 */
15957
15958if (typeof module !== 'undefined') {
15959 module.exports = Emitter;
15960}
15961
15962/**
15963 * Initialize a new `Emitter`.
15964 *
15965 * @api public
15966 */
15967
15968function Emitter(obj) {
15969 if (obj) return mixin(obj);
15970}
15971
15972/**
15973 * Mixin the emitter properties.
15974 *
15975 * @param {Object} obj
15976 * @return {Object}
15977 * @api private
15978 */
15979
15980function mixin(obj) {
15981 for (var key in Emitter.prototype) {
15982 obj[key] = Emitter.prototype[key];
15983 }
15984 return obj;
15985}
15986
15987/**
15988 * Listen on the given `event` with `fn`.
15989 *
15990 * @param {String} event
15991 * @param {Function} fn
15992 * @return {Emitter}
15993 * @api public
15994 */
15995
15996Emitter.prototype.on =
15997Emitter.prototype.addEventListener = function(event, fn){
15998 this._callbacks = this._callbacks || {};
15999 (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
16000 .push(fn);
16001 return this;
16002};
16003
16004/**
16005 * Adds an `event` listener that will be invoked a single
16006 * time then automatically removed.
16007 *
16008 * @param {String} event
16009 * @param {Function} fn
16010 * @return {Emitter}
16011 * @api public
16012 */
16013
16014Emitter.prototype.once = function(event, fn){
16015 function on() {
16016 this.off(event, on);
16017 fn.apply(this, arguments);
16018 }
16019
16020 on.fn = fn;
16021 this.on(event, on);
16022 return this;
16023};
16024
16025/**
16026 * Remove the given callback for `event` or all
16027 * registered callbacks.
16028 *
16029 * @param {String} event
16030 * @param {Function} fn
16031 * @return {Emitter}
16032 * @api public
16033 */
16034
16035Emitter.prototype.off =
16036Emitter.prototype.removeListener =
16037Emitter.prototype.removeAllListeners =
16038Emitter.prototype.removeEventListener = function(event, fn){
16039 this._callbacks = this._callbacks || {};
16040
16041 // all
16042 if (0 == arguments.length) {
16043 this._callbacks = {};
16044 return this;
16045 }
16046
16047 // specific event
16048 var callbacks = this._callbacks['$' + event];
16049 if (!callbacks) return this;
16050
16051 // remove all handlers
16052 if (1 == arguments.length) {
16053 delete this._callbacks['$' + event];
16054 return this;
16055 }
16056
16057 // remove specific handler
16058 var cb;
16059 for (var i = 0; i < callbacks.length; i++) {
16060 cb = callbacks[i];
16061 if (cb === fn || cb.fn === fn) {
16062 callbacks.splice(i, 1);
16063 break;
16064 }
16065 }
16066 return this;
16067};
16068
16069/**
16070 * Emit `event` with the given args.
16071 *
16072 * @param {String} event
16073 * @param {Mixed} ...
16074 * @return {Emitter}
16075 */
16076
16077Emitter.prototype.emit = function(event){
16078 this._callbacks = this._callbacks || {};
16079 var args = [].slice.call(arguments, 1)
16080 , callbacks = this._callbacks['$' + event];
16081
16082 if (callbacks) {
16083 callbacks = callbacks.slice(0);
16084 for (var i = 0, len = callbacks.length; i < len; ++i) {
16085 callbacks[i].apply(this, args);
16086 }
16087 }
16088
16089 return this;
16090};
16091
16092/**
16093 * Return array of callbacks for `event`.
16094 *
16095 * @param {String} event
16096 * @return {Array}
16097 * @api public
16098 */
16099
16100Emitter.prototype.listeners = function(event){
16101 this._callbacks = this._callbacks || {};
16102 return this._callbacks['$' + event] || [];
16103};
16104
16105/**
16106 * Check if this emitter has `event` handlers.
16107 *
16108 * @param {String} event
16109 * @return {Boolean}
16110 * @api public
16111 */
16112
16113Emitter.prototype.hasListeners = function(event){
16114 return !! this.listeners(event).length;
16115};
16116});
16117
16118/**
16119 * Reduce `arr` with `fn`.
16120 *
16121 * @param {Array} arr
16122 * @param {Function} fn
16123 * @param {Mixed} initial
16124 *
16125 * TODO: combatible error handling?
16126 */
16127
16128var index$2 = function(arr, fn, initial){
16129 var idx = 0;
16130 var len = arr.length;
16131 var curr = arguments.length == 3
16132 ? initial
16133 : arr[idx++];
16134
16135 while (idx < len) {
16136 curr = fn.call(null, curr, arr[idx], ++idx, arr);
16137 }
16138
16139 return curr;
16140};
16141
16142/**
16143 * Module dependencies.
16144 */
16145
16146var Emitter = index;
16147var reduce = index$2;
16148
16149/**
16150 * Root reference for iframes.
16151 */
16152
16153var root$2;
16154if (typeof window !== 'undefined') { // Browser window
16155 root$2 = window;
16156} else if (typeof self !== 'undefined') { // Web Worker
16157 root$2 = self;
16158} else { // Other environments
16159 root$2 = commonjsGlobal;
16160}
16161
16162/**
16163 * Noop.
16164 */
16165
16166function noop(){}
16167
16168/**
16169 * Check if `obj` is a host object,
16170 * we don't want to serialize these :)
16171 *
16172 * TODO: future proof, move to compoent land
16173 *
16174 * @param {Object} obj
16175 * @return {Boolean}
16176 * @api private
16177 */
16178
16179function isHost(obj) {
16180 var str = {}.toString.call(obj);
16181
16182 switch (str) {
16183 case '[object File]':
16184 case '[object Blob]':
16185 case '[object FormData]':
16186 return true;
16187 default:
16188 return false;
16189 }
16190}
16191
16192/**
16193 * Determine XHR.
16194 */
16195
16196request.getXHR = function () {
16197 if (root$2.XMLHttpRequest
16198 && (!root$2.location || 'file:' != root$2.location.protocol
16199 || !root$2.ActiveXObject)) {
16200 return new XMLHttpRequest;
16201 } else {
16202 try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}
16203 try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}
16204 try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}
16205 try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}
16206 }
16207 return false;
16208};
16209
16210/**
16211 * Removes leading and trailing whitespace, added to support IE.
16212 *
16213 * @param {String} s
16214 * @return {String}
16215 * @api private
16216 */
16217
16218var trim = ''.trim
16219 ? function(s) { return s.trim(); }
16220 : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); };
16221
16222/**
16223 * Check if `obj` is an object.
16224 *
16225 * @param {Object} obj
16226 * @return {Boolean}
16227 * @api private
16228 */
16229
16230function isObject$1(obj) {
16231 return obj === Object(obj);
16232}
16233
16234/**
16235 * Serialize the given `obj`.
16236 *
16237 * @param {Object} obj
16238 * @return {String}
16239 * @api private
16240 */
16241
16242function serialize(obj) {
16243 if (!isObject$1(obj)) return obj;
16244 var pairs = [];
16245 for (var key in obj) {
16246 if (null != obj[key]) {
16247 pushEncodedKeyValuePair(pairs, key, obj[key]);
16248 }
16249 }
16250 return pairs.join('&');
16251}
16252
16253/**
16254 * Helps 'serialize' with serializing arrays.
16255 * Mutates the pairs array.
16256 *
16257 * @param {Array} pairs
16258 * @param {String} key
16259 * @param {Mixed} val
16260 */
16261
16262function pushEncodedKeyValuePair(pairs, key, val) {
16263 if (Array.isArray(val)) {
16264 return val.forEach(function(v) {
16265 pushEncodedKeyValuePair(pairs, key, v);
16266 });
16267 }
16268 pairs.push(encodeURIComponent(key)
16269 + '=' + encodeURIComponent(val));
16270}
16271
16272/**
16273 * Expose serialization method.
16274 */
16275
16276 request.serializeObject = serialize;
16277
16278 /**
16279 * Parse the given x-www-form-urlencoded `str`.
16280 *
16281 * @param {String} str
16282 * @return {Object}
16283 * @api private
16284 */
16285
16286function parseString(str) {
16287 var obj = {};
16288 var pairs = str.split('&');
16289 var parts;
16290 var pair;
16291
16292 for (var i = 0, len = pairs.length; i < len; ++i) {
16293 pair = pairs[i];
16294 parts = pair.split('=');
16295 obj[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
16296 }
16297
16298 return obj;
16299}
16300
16301/**
16302 * Expose parser.
16303 */
16304
16305request.parseString = parseString;
16306
16307/**
16308 * Default MIME type map.
16309 *
16310 * superagent.types.xml = 'application/xml';
16311 *
16312 */
16313
16314request.types = {
16315 html: 'text/html',
16316 json: 'application/json',
16317 xml: 'application/xml',
16318 urlencoded: 'application/x-www-form-urlencoded',
16319 'form': 'application/x-www-form-urlencoded',
16320 'form-data': 'application/x-www-form-urlencoded'
16321};
16322
16323/**
16324 * Default serialization map.
16325 *
16326 * superagent.serialize['application/xml'] = function(obj){
16327 * return 'generated xml here';
16328 * };
16329 *
16330 */
16331
16332 request.serialize = {
16333 'application/x-www-form-urlencoded': serialize,
16334 'application/json': JSON.stringify
16335 };
16336
16337 /**
16338 * Default parsers.
16339 *
16340 * superagent.parse['application/xml'] = function(str){
16341 * return { object parsed from str };
16342 * };
16343 *
16344 */
16345
16346request.parse = {
16347 'application/x-www-form-urlencoded': parseString,
16348 'application/json': JSON.parse
16349};
16350
16351/**
16352 * Parse the given header `str` into
16353 * an object containing the mapped fields.
16354 *
16355 * @param {String} str
16356 * @return {Object}
16357 * @api private
16358 */
16359
16360function parseHeader(str) {
16361 var lines = str.split(/\r?\n/);
16362 var fields = {};
16363 var index$$1;
16364 var line;
16365 var field;
16366 var val;
16367
16368 lines.pop(); // trailing CRLF
16369
16370 for (var i = 0, len = lines.length; i < len; ++i) {
16371 line = lines[i];
16372 index$$1 = line.indexOf(':');
16373 field = line.slice(0, index$$1).toLowerCase();
16374 val = trim(line.slice(index$$1 + 1));
16375 fields[field] = val;
16376 }
16377
16378 return fields;
16379}
16380
16381/**
16382 * Check if `mime` is json or has +json structured syntax suffix.
16383 *
16384 * @param {String} mime
16385 * @return {Boolean}
16386 * @api private
16387 */
16388
16389function isJSON(mime) {
16390 return /[\/+]json\b/.test(mime);
16391}
16392
16393/**
16394 * Return the mime type for the given `str`.
16395 *
16396 * @param {String} str
16397 * @return {String}
16398 * @api private
16399 */
16400
16401function type(str){
16402 return str.split(/ *; */).shift();
16403}
16404
16405/**
16406 * Return header field parameters.
16407 *
16408 * @param {String} str
16409 * @return {Object}
16410 * @api private
16411 */
16412
16413function params(str){
16414 return reduce(str.split(/ *; */), function(obj, str){
16415 var parts = str.split(/ *= */)
16416 , key = parts.shift()
16417 , val = parts.shift();
16418
16419 if (key && val) obj[key] = val;
16420 return obj;
16421 }, {});
16422}
16423
16424/**
16425 * Initialize a new `Response` with the given `xhr`.
16426 *
16427 * - set flags (.ok, .error, etc)
16428 * - parse header
16429 *
16430 * Examples:
16431 *
16432 * Aliasing `superagent` as `request` is nice:
16433 *
16434 * request = superagent;
16435 *
16436 * We can use the promise-like API, or pass callbacks:
16437 *
16438 * request.get('/').end(function(res){});
16439 * request.get('/', function(res){});
16440 *
16441 * Sending data can be chained:
16442 *
16443 * request
16444 * .post('/user')
16445 * .send({ name: 'tj' })
16446 * .end(function(res){});
16447 *
16448 * Or passed to `.send()`:
16449 *
16450 * request
16451 * .post('/user')
16452 * .send({ name: 'tj' }, function(res){});
16453 *
16454 * Or passed to `.post()`:
16455 *
16456 * request
16457 * .post('/user', { name: 'tj' })
16458 * .end(function(res){});
16459 *
16460 * Or further reduced to a single call for simple cases:
16461 *
16462 * request
16463 * .post('/user', { name: 'tj' }, function(res){});
16464 *
16465 * @param {XMLHTTPRequest} xhr
16466 * @param {Object} options
16467 * @api private
16468 */
16469
16470function Response(req, options) {
16471 options = options || {};
16472 this.req = req;
16473 this.xhr = this.req.xhr;
16474 // responseText is accessible only if responseType is '' or 'text' and on older browsers
16475 this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')
16476 ? this.xhr.responseText
16477 : null;
16478 this.statusText = this.req.xhr.statusText;
16479 this.setStatusProperties(this.xhr.status);
16480 this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());
16481 // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
16482 // getResponseHeader still works. so we get content-type even if getting
16483 // other headers fails.
16484 this.header['content-type'] = this.xhr.getResponseHeader('content-type');
16485 this.setHeaderProperties(this.header);
16486 this.body = this.req.method != 'HEAD'
16487 ? this.parseBody(this.text ? this.text : this.xhr.response)
16488 : null;
16489}
16490
16491/**
16492 * Get case-insensitive `field` value.
16493 *
16494 * @param {String} field
16495 * @return {String}
16496 * @api public
16497 */
16498
16499Response.prototype.get = function(field){
16500 return this.header[field.toLowerCase()];
16501};
16502
16503/**
16504 * Set header related properties:
16505 *
16506 * - `.type` the content type without params
16507 *
16508 * A response of "Content-Type: text/plain; charset=utf-8"
16509 * will provide you with a `.type` of "text/plain".
16510 *
16511 * @param {Object} header
16512 * @api private
16513 */
16514
16515Response.prototype.setHeaderProperties = function(header){
16516 // content-type
16517 var ct = this.header['content-type'] || '';
16518 this.type = type(ct);
16519
16520 // params
16521 var obj = params(ct);
16522 for (var key in obj) this[key] = obj[key];
16523};
16524
16525/**
16526 * Parse the given body `str`.
16527 *
16528 * Used for auto-parsing of bodies. Parsers
16529 * are defined on the `superagent.parse` object.
16530 *
16531 * @param {String} str
16532 * @return {Mixed}
16533 * @api private
16534 */
16535
16536Response.prototype.parseBody = function(str){
16537 var parse = request.parse[this.type];
16538 return parse && str && (str.length || str instanceof Object)
16539 ? parse(str)
16540 : null;
16541};
16542
16543/**
16544 * Set flags such as `.ok` based on `status`.
16545 *
16546 * For example a 2xx response will give you a `.ok` of __true__
16547 * whereas 5xx will be __false__ and `.error` will be __true__. The
16548 * `.clientError` and `.serverError` are also available to be more
16549 * specific, and `.statusType` is the class of error ranging from 1..5
16550 * sometimes useful for mapping respond colors etc.
16551 *
16552 * "sugar" properties are also defined for common cases. Currently providing:
16553 *
16554 * - .noContent
16555 * - .badRequest
16556 * - .unauthorized
16557 * - .notAcceptable
16558 * - .notFound
16559 *
16560 * @param {Number} status
16561 * @api private
16562 */
16563
16564Response.prototype.setStatusProperties = function(status){
16565 // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
16566 if (status === 1223) {
16567 status = 204;
16568 }
16569
16570 var type = status / 100 | 0;
16571
16572 // status / class
16573 this.status = this.statusCode = status;
16574 this.statusType = type;
16575
16576 // basics
16577 this.info = 1 == type;
16578 this.ok = 2 == type;
16579 this.clientError = 4 == type;
16580 this.serverError = 5 == type;
16581 this.error = (4 == type || 5 == type)
16582 ? this.toError()
16583 : false;
16584
16585 // sugar
16586 this.accepted = 202 == status;
16587 this.noContent = 204 == status;
16588 this.badRequest = 400 == status;
16589 this.unauthorized = 401 == status;
16590 this.notAcceptable = 406 == status;
16591 this.notFound = 404 == status;
16592 this.forbidden = 403 == status;
16593};
16594
16595/**
16596 * Return an `Error` representative of this response.
16597 *
16598 * @return {Error}
16599 * @api public
16600 */
16601
16602Response.prototype.toError = function(){
16603 var req = this.req;
16604 var method = req.method;
16605 var url = req.url;
16606
16607 var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';
16608 var err = new Error(msg);
16609 err.status = this.status;
16610 err.method = method;
16611 err.url = url;
16612
16613 return err;
16614};
16615
16616/**
16617 * Expose `Response`.
16618 */
16619
16620request.Response = Response;
16621
16622/**
16623 * Initialize a new `Request` with the given `method` and `url`.
16624 *
16625 * @param {String} method
16626 * @param {String} url
16627 * @api public
16628 */
16629
16630function Request(method, url) {
16631 var self = this;
16632 Emitter.call(this);
16633 this._query = this._query || [];
16634 this.method = method;
16635 this.url = url;
16636 this.header = {};
16637 this._header = {};
16638 this.on('end', function(){
16639 var err = null;
16640 var res = null;
16641
16642 try {
16643 res = new Response(self);
16644 } catch(e) {
16645 err = new Error('Parser is unable to parse the response');
16646 err.parse = true;
16647 err.original = e;
16648 // issue #675: return the raw response if the response parsing fails
16649 err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null;
16650 return self.callback(err);
16651 }
16652
16653 self.emit('response', res);
16654
16655 if (err) {
16656 return self.callback(err, res);
16657 }
16658
16659 if (res.status >= 200 && res.status < 300) {
16660 return self.callback(err, res);
16661 }
16662
16663 var new_err = new Error(res.statusText || 'Unsuccessful HTTP response');
16664 new_err.original = err;
16665 new_err.response = res;
16666 new_err.status = res.status;
16667
16668 self.callback(new_err, res);
16669 });
16670}
16671
16672/**
16673 * Mixin `Emitter`.
16674 */
16675
16676Emitter(Request.prototype);
16677
16678/**
16679 * Allow for extension
16680 */
16681
16682Request.prototype.use = function(fn) {
16683 fn(this);
16684 return this;
16685}
16686
16687/**
16688 * Set timeout to `ms`.
16689 *
16690 * @param {Number} ms
16691 * @return {Request} for chaining
16692 * @api public
16693 */
16694
16695Request.prototype.timeout = function(ms){
16696 this._timeout = ms;
16697 return this;
16698};
16699
16700/**
16701 * Clear previous timeout.
16702 *
16703 * @return {Request} for chaining
16704 * @api public
16705 */
16706
16707Request.prototype.clearTimeout = function(){
16708 this._timeout = 0;
16709 clearTimeout(this._timer);
16710 return this;
16711};
16712
16713/**
16714 * Abort the request, and clear potential timeout.
16715 *
16716 * @return {Request}
16717 * @api public
16718 */
16719
16720Request.prototype.abort = function(){
16721 if (this.aborted) return;
16722 this.aborted = true;
16723 this.xhr.abort();
16724 this.clearTimeout();
16725 this.emit('abort');
16726 return this;
16727};
16728
16729/**
16730 * Set header `field` to `val`, or multiple fields with one object.
16731 *
16732 * Examples:
16733 *
16734 * req.get('/')
16735 * .set('Accept', 'application/json')
16736 * .set('X-API-Key', 'foobar')
16737 * .end(callback);
16738 *
16739 * req.get('/')
16740 * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
16741 * .end(callback);
16742 *
16743 * @param {String|Object} field
16744 * @param {String} val
16745 * @return {Request} for chaining
16746 * @api public
16747 */
16748
16749Request.prototype.set = function(field, val){
16750 if (isObject$1(field)) {
16751 for (var key in field) {
16752 this.set(key, field[key]);
16753 }
16754 return this;
16755 }
16756 this._header[field.toLowerCase()] = val;
16757 this.header[field] = val;
16758 return this;
16759};
16760
16761/**
16762 * Remove header `field`.
16763 *
16764 * Example:
16765 *
16766 * req.get('/')
16767 * .unset('User-Agent')
16768 * .end(callback);
16769 *
16770 * @param {String} field
16771 * @return {Request} for chaining
16772 * @api public
16773 */
16774
16775Request.prototype.unset = function(field){
16776 delete this._header[field.toLowerCase()];
16777 delete this.header[field];
16778 return this;
16779};
16780
16781/**
16782 * Get case-insensitive header `field` value.
16783 *
16784 * @param {String} field
16785 * @return {String}
16786 * @api private
16787 */
16788
16789Request.prototype.getHeader = function(field){
16790 return this._header[field.toLowerCase()];
16791};
16792
16793/**
16794 * Set Content-Type to `type`, mapping values from `request.types`.
16795 *
16796 * Examples:
16797 *
16798 * superagent.types.xml = 'application/xml';
16799 *
16800 * request.post('/')
16801 * .type('xml')
16802 * .send(xmlstring)
16803 * .end(callback);
16804 *
16805 * request.post('/')
16806 * .type('application/xml')
16807 * .send(xmlstring)
16808 * .end(callback);
16809 *
16810 * @param {String} type
16811 * @return {Request} for chaining
16812 * @api public
16813 */
16814
16815Request.prototype.type = function(type){
16816 this.set('Content-Type', request.types[type] || type);
16817 return this;
16818};
16819
16820/**
16821 * Force given parser
16822 *
16823 * Sets the body parser no matter type.
16824 *
16825 * @param {Function}
16826 * @api public
16827 */
16828
16829Request.prototype.parse = function(fn){
16830 this._parser = fn;
16831 return this;
16832};
16833
16834/**
16835 * Set Accept to `type`, mapping values from `request.types`.
16836 *
16837 * Examples:
16838 *
16839 * superagent.types.json = 'application/json';
16840 *
16841 * request.get('/agent')
16842 * .accept('json')
16843 * .end(callback);
16844 *
16845 * request.get('/agent')
16846 * .accept('application/json')
16847 * .end(callback);
16848 *
16849 * @param {String} accept
16850 * @return {Request} for chaining
16851 * @api public
16852 */
16853
16854Request.prototype.accept = function(type){
16855 this.set('Accept', request.types[type] || type);
16856 return this;
16857};
16858
16859/**
16860 * Set Authorization field value with `user` and `pass`.
16861 *
16862 * @param {String} user
16863 * @param {String} pass
16864 * @return {Request} for chaining
16865 * @api public
16866 */
16867
16868Request.prototype.auth = function(user, pass){
16869 var str = btoa(user + ':' + pass);
16870 this.set('Authorization', 'Basic ' + str);
16871 return this;
16872};
16873
16874/**
16875* Add query-string `val`.
16876*
16877* Examples:
16878*
16879* request.get('/shoes')
16880* .query('size=10')
16881* .query({ color: 'blue' })
16882*
16883* @param {Object|String} val
16884* @return {Request} for chaining
16885* @api public
16886*/
16887
16888Request.prototype.query = function(val){
16889 if ('string' != typeof val) val = serialize(val);
16890 if (val) this._query.push(val);
16891 return this;
16892};
16893
16894/**
16895 * Write the field `name` and `val` for "multipart/form-data"
16896 * request bodies.
16897 *
16898 * ``` js
16899 * request.post('/upload')
16900 * .field('foo', 'bar')
16901 * .end(callback);
16902 * ```
16903 *
16904 * @param {String} name
16905 * @param {String|Blob|File} val
16906 * @return {Request} for chaining
16907 * @api public
16908 */
16909
16910Request.prototype.field = function(name, val){
16911 if (!this._formData) this._formData = new root$2.FormData();
16912 this._formData.append(name, val);
16913 return this;
16914};
16915
16916/**
16917 * Queue the given `file` as an attachment to the specified `field`,
16918 * with optional `filename`.
16919 *
16920 * ``` js
16921 * request.post('/upload')
16922 * .attach(new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
16923 * .end(callback);
16924 * ```
16925 *
16926 * @param {String} field
16927 * @param {Blob|File} file
16928 * @param {String} filename
16929 * @return {Request} for chaining
16930 * @api public
16931 */
16932
16933Request.prototype.attach = function(field, file, filename){
16934 if (!this._formData) this._formData = new root$2.FormData();
16935 this._formData.append(field, file, filename || file.name);
16936 return this;
16937};
16938
16939/**
16940 * Send `data` as the request body, defaulting the `.type()` to "json" when
16941 * an object is given.
16942 *
16943 * Examples:
16944 *
16945 * // manual json
16946 * request.post('/user')
16947 * .type('json')
16948 * .send('{"name":"tj"}')
16949 * .end(callback)
16950 *
16951 * // auto json
16952 * request.post('/user')
16953 * .send({ name: 'tj' })
16954 * .end(callback)
16955 *
16956 * // manual x-www-form-urlencoded
16957 * request.post('/user')
16958 * .type('form')
16959 * .send('name=tj')
16960 * .end(callback)
16961 *
16962 * // auto x-www-form-urlencoded
16963 * request.post('/user')
16964 * .type('form')
16965 * .send({ name: 'tj' })
16966 * .end(callback)
16967 *
16968 * // defaults to x-www-form-urlencoded
16969 * request.post('/user')
16970 * .send('name=tobi')
16971 * .send('species=ferret')
16972 * .end(callback)
16973 *
16974 * @param {String|Object} data
16975 * @return {Request} for chaining
16976 * @api public
16977 */
16978
16979Request.prototype.send = function(data){
16980 var obj = isObject$1(data);
16981 var type = this.getHeader('Content-Type');
16982
16983 // merge
16984 if (obj && isObject$1(this._data)) {
16985 for (var key in data) {
16986 this._data[key] = data[key];
16987 }
16988 } else if ('string' == typeof data) {
16989 if (!type) this.type('form');
16990 type = this.getHeader('Content-Type');
16991 if ('application/x-www-form-urlencoded' == type) {
16992 this._data = this._data
16993 ? this._data + '&' + data
16994 : data;
16995 } else {
16996 this._data = (this._data || '') + data;
16997 }
16998 } else {
16999 this._data = data;
17000 }
17001
17002 if (!obj || isHost(data)) return this;
17003 if (!type) this.type('json');
17004 return this;
17005};
17006
17007/**
17008 * Invoke the callback with `err` and `res`
17009 * and handle arity check.
17010 *
17011 * @param {Error} err
17012 * @param {Response} res
17013 * @api private
17014 */
17015
17016Request.prototype.callback = function(err, res){
17017 var fn = this._callback;
17018 this.clearTimeout();
17019 fn(err, res);
17020};
17021
17022/**
17023 * Invoke callback with x-domain error.
17024 *
17025 * @api private
17026 */
17027
17028Request.prototype.crossDomainError = function(){
17029 var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
17030 err.crossDomain = true;
17031
17032 err.status = this.status;
17033 err.method = this.method;
17034 err.url = this.url;
17035
17036 this.callback(err);
17037};
17038
17039/**
17040 * Invoke callback with timeout error.
17041 *
17042 * @api private
17043 */
17044
17045Request.prototype.timeoutError = function(){
17046 var timeout = this._timeout;
17047 var err = new Error('timeout of ' + timeout + 'ms exceeded');
17048 err.timeout = timeout;
17049 this.callback(err);
17050};
17051
17052/**
17053 * Enable transmission of cookies with x-domain requests.
17054 *
17055 * Note that for this to work the origin must not be
17056 * using "Access-Control-Allow-Origin" with a wildcard,
17057 * and also must set "Access-Control-Allow-Credentials"
17058 * to "true".
17059 *
17060 * @api public
17061 */
17062
17063Request.prototype.withCredentials = function(){
17064 this._withCredentials = true;
17065 return this;
17066};
17067
17068/**
17069 * Initiate request, invoking callback `fn(res)`
17070 * with an instanceof `Response`.
17071 *
17072 * @param {Function} fn
17073 * @return {Request} for chaining
17074 * @api public
17075 */
17076
17077Request.prototype.end = function(fn){
17078 var self = this;
17079 var xhr = this.xhr = request.getXHR();
17080 var query = this._query.join('&');
17081 var timeout = this._timeout;
17082 var data = this._formData || this._data;
17083
17084 // store callback
17085 this._callback = fn || noop;
17086
17087 // state change
17088 xhr.onreadystatechange = function(){
17089 if (4 != xhr.readyState) return;
17090
17091 // In IE9, reads to any property (e.g. status) off of an aborted XHR will
17092 // result in the error "Could not complete the operation due to error c00c023f"
17093 var status;
17094 try { status = xhr.status } catch(e) { status = 0; }
17095
17096 if (0 == status) {
17097 if (self.timedout) return self.timeoutError();
17098 if (self.aborted) return;
17099 return self.crossDomainError();
17100 }
17101 self.emit('end');
17102 };
17103
17104 // progress
17105 var handleProgress = function(e){
17106 if (e.total > 0) {
17107 e.percent = e.loaded / e.total * 100;
17108 }
17109 e.direction = 'download';
17110 self.emit('progress', e);
17111 };
17112 if (this.hasListeners('progress')) {
17113 xhr.onprogress = handleProgress;
17114 }
17115 try {
17116 if (xhr.upload && this.hasListeners('progress')) {
17117 xhr.upload.onprogress = handleProgress;
17118 }
17119 } catch(e) {
17120 // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
17121 // Reported here:
17122 // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
17123 }
17124
17125 // timeout
17126 if (timeout && !this._timer) {
17127 this._timer = setTimeout(function(){
17128 self.timedout = true;
17129 self.abort();
17130 }, timeout);
17131 }
17132
17133 // querystring
17134 if (query) {
17135 query = request.serializeObject(query);
17136 this.url += ~this.url.indexOf('?')
17137 ? '&' + query
17138 : '?' + query;
17139 }
17140
17141 // initiate request
17142 xhr.open(this.method, this.url, true);
17143
17144 // CORS
17145 if (this._withCredentials) xhr.withCredentials = true;
17146
17147 // body
17148 if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !isHost(data)) {
17149 // serialize stuff
17150 var contentType = this.getHeader('Content-Type');
17151 var serialize = this._parser || request.serialize[contentType ? contentType.split(';')[0] : ''];
17152 if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];
17153 if (serialize) data = serialize(data);
17154 }
17155
17156 // set header fields
17157 for (var field in this.header) {
17158 if (null == this.header[field]) continue;
17159 xhr.setRequestHeader(field, this.header[field]);
17160 }
17161
17162 // send stuff
17163 this.emit('request', this);
17164
17165 // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
17166 // We need null here if data is undefined
17167 xhr.send(typeof data !== 'undefined' ? data : null);
17168 return this;
17169};
17170
17171/**
17172 * Faux promise support
17173 *
17174 * @param {Function} fulfill
17175 * @param {Function} reject
17176 * @return {Request}
17177 */
17178
17179Request.prototype.then = function (fulfill, reject) {
17180 return this.end(function(err, res) {
17181 err ? reject(err) : fulfill(res);
17182 });
17183}
17184
17185/**
17186 * Expose `Request`.
17187 */
17188
17189request.Request = Request;
17190
17191/**
17192 * Issue a request:
17193 *
17194 * Examples:
17195 *
17196 * request('GET', '/users').end(callback)
17197 * request('/users').end(callback)
17198 * request('/users', callback)
17199 *
17200 * @param {String} method
17201 * @param {String|Function} url or callback
17202 * @return {Request}
17203 * @api public
17204 */
17205
17206function request(method, url) {
17207 // callback
17208 if ('function' == typeof url) {
17209 return new Request('GET', method).end(url);
17210 }
17211
17212 // url first
17213 if (1 == arguments.length) {
17214 return new Request('GET', method);
17215 }
17216
17217 return new Request(method, url);
17218}
17219
17220/**
17221 * GET `url` with optional callback `fn(res)`.
17222 *
17223 * @param {String} url
17224 * @param {Mixed|Function} data or fn
17225 * @param {Function} fn
17226 * @return {Request}
17227 * @api public
17228 */
17229
17230request.get = function(url, data, fn){
17231 var req = request('GET', url);
17232 if ('function' == typeof data) fn = data, data = null;
17233 if (data) req.query(data);
17234 if (fn) req.end(fn);
17235 return req;
17236};
17237
17238/**
17239 * HEAD `url` with optional callback `fn(res)`.
17240 *
17241 * @param {String} url
17242 * @param {Mixed|Function} data or fn
17243 * @param {Function} fn
17244 * @return {Request}
17245 * @api public
17246 */
17247
17248request.head = function(url, data, fn){
17249 var req = request('HEAD', url);
17250 if ('function' == typeof data) fn = data, data = null;
17251 if (data) req.send(data);
17252 if (fn) req.end(fn);
17253 return req;
17254};
17255
17256/**
17257 * DELETE `url` with optional callback `fn(res)`.
17258 *
17259 * @param {String} url
17260 * @param {Function} fn
17261 * @return {Request}
17262 * @api public
17263 */
17264
17265function del(url, fn){
17266 var req = request('DELETE', url);
17267 if (fn) req.end(fn);
17268 return req;
17269}
17270
17271request['del'] = del;
17272request['delete'] = del;
17273
17274/**
17275 * PATCH `url` with optional `data` and callback `fn(res)`.
17276 *
17277 * @param {String} url
17278 * @param {Mixed} data
17279 * @param {Function} fn
17280 * @return {Request}
17281 * @api public
17282 */
17283
17284request.patch = function(url, data, fn){
17285 var req = request('PATCH', url);
17286 if ('function' == typeof data) fn = data, data = null;
17287 if (data) req.send(data);
17288 if (fn) req.end(fn);
17289 return req;
17290};
17291
17292/**
17293 * POST `url` with optional `data` and callback `fn(res)`.
17294 *
17295 * @param {String} url
17296 * @param {Mixed} data
17297 * @param {Function} fn
17298 * @return {Request}
17299 * @api public
17300 */
17301
17302request.post = function(url, data, fn){
17303 var req = request('POST', url);
17304 if ('function' == typeof data) fn = data, data = null;
17305 if (data) req.send(data);
17306 if (fn) req.end(fn);
17307 return req;
17308};
17309
17310/**
17311 * PUT `url` with optional `data` and callback `fn(res)`.
17312 *
17313 * @param {String} url
17314 * @param {Mixed|Function} data or fn
17315 * @param {Function} fn
17316 * @return {Request}
17317 * @api public
17318 */
17319
17320request.put = function(url, data, fn){
17321 var req = request('PUT', url);
17322 if ('function' == typeof data) fn = data, data = null;
17323 if (data) req.send(data);
17324 if (fn) req.end(fn);
17325 return req;
17326};
17327
17328/**
17329 * Expose `request`.
17330 */
17331
17332var client = request;
17333
17334
17335
17336var request$1 = Object.freeze({
17337 default: client,
17338 __moduleExports: client
17339});
17340
17341/**
17342 * `Client` is for making HTTP requests to the API.
17343 *
17344 * Under the hood, it uses
17345 * [superagent](http://visionmedia.github.io/superagent/). When a method is
17346 * called, you can call any number of superagent functions on it and then call
17347 * `end()` to complete and send the request.
17348 *
17349 * @featured
17350 */
17351var Client = (function () {
17352 function Client(
17353 /**
17354 * @hidden
17355 */
17356 tokenContext,
17357 /**
17358 * @hidden
17359 */
17360 baseUrl, req // TODO: use superagent types
17361 ) {
17362 this.tokenContext = tokenContext;
17363 this.baseUrl = baseUrl;
17364 if (typeof req === 'undefined') {
17365 req = request$1['default'] || request$1;
17366 }
17367 this.req = req;
17368 }
17369 /**
17370 * GET request for retrieving a resource from the API.
17371 *
17372 * @param endpoint - The path of the API endpoint.
17373 */
17374 Client.prototype.get = function (endpoint) {
17375 return this.supplement(this.req.get, endpoint);
17376 };
17377 /**
17378 * POST request for sending a new resource to the API.
17379 *
17380 * @param endpoint - The path of the API endpoint.
17381 */
17382 Client.prototype.post = function (endpoint) {
17383 return this.supplement(this.req.post, endpoint);
17384 };
17385 /**
17386 * PUT request for replacing a resource in the API.
17387 *
17388 * @param endpoint - The path of the API endpoint.
17389 */
17390 Client.prototype.put = function (endpoint) {
17391 return this.supplement(this.req.put, endpoint);
17392 };
17393 /**
17394 * PATCH request for performing partial updates to a resource in the API.
17395 *
17396 * @param endpoint - The path of the API endpoint.
17397 */
17398 Client.prototype.patch = function (endpoint) {
17399 return this.supplement(this.req.patch, endpoint);
17400 };
17401 /**
17402 * DELETE request for deleting a resource from the API.
17403 *
17404 * @param endpoint - The path of the API endpoint.
17405 */
17406 Client.prototype.delete = function (endpoint) {
17407 return this.supplement(this.req.delete, endpoint);
17408 };
17409 /**
17410 * @hidden
17411 */
17412 Client.prototype.request = function (method, endpoint) {
17413 return this.supplement(this.req.bind(this.req, method), endpoint);
17414 };
17415 /**
17416 * @private
17417 */
17418 Client.prototype.supplement = function (fn, endpoint) {
17419 if (endpoint.substring(0, 1) !== '/') {
17420 throw Error('endpoint must start with leading slash');
17421 }
17422 var req = fn(this.baseUrl + endpoint);
17423 var token = this.tokenContext.get();
17424 if (token) {
17425 req.set('Authorization', "Bearer " + token);
17426 }
17427 return req;
17428 };
17429 return Client;
17430}());
17431
17432/**
17433 * @hidden
17434 */
17435var Config = (function () {
17436 function Config() {
17437 /**
17438 * @private
17439 */
17440 this.urls = {
17441 'api': 'https://api.ionic.io',
17442 'web': 'https://web.ionic.io'
17443 };
17444 }
17445 /**
17446 * Register a new config.
17447 */
17448 Config.prototype.register = function (settings) {
17449 this.settings = settings;
17450 };
17451 /**
17452 * Get a value from the core settings. You should use `settings` attribute
17453 * directly for core settings and other settings.
17454 *
17455 * @deprecated
17456 *
17457 * @param name - The settings key to get.
17458 */
17459 Config.prototype.get = function (name) {
17460 if (!this.settings || !this.settings.core) {
17461 return undefined;
17462 }
17463 return this.settings.core[name];
17464 };
17465 /**
17466 * @hidden
17467 */
17468 Config.prototype.getURL = function (name) {
17469 var urls = (this.settings && this.settings.core && this.settings.core.urls) || {};
17470 if (urls[name]) {
17471 return urls[name];
17472 }
17473 return this.urls[name];
17474 };
17475 return Config;
17476}());
17477
17478/**
17479 * @hidden
17480 */
17481var Cordova$1 = (function () {
17482 function Cordova(deps, options) {
17483 if (options === void 0) { options = {}; }
17484 this.options = options;
17485 this.app = deps.appStatus;
17486 this.device = deps.device;
17487 this.emitter = deps.emitter;
17488 this.logger = deps.logger;
17489 this.registerEventHandlers();
17490 }
17491 Cordova.prototype.bootstrap = function () {
17492 var _this = this;
17493 var events = ['pause', 'resume'];
17494 document.addEventListener('deviceready', function () {
17495 var args = [];
17496 for (var _i = 0; _i < arguments.length; _i++) {
17497 args[_i - 0] = arguments[_i];
17498 }
17499 _this.emitter.emit('cordova:deviceready', { 'args': args });
17500 var _loop_1 = function(e) {
17501 document.addEventListener(e, function () {
17502 var args = [];
17503 for (var _i = 0; _i < arguments.length; _i++) {
17504 args[_i - 0] = arguments[_i];
17505 }
17506 _this.emitter.emit('cordova:' + e, { 'args': args });
17507 }, false);
17508 };
17509 for (var _a = 0, events_1 = events; _a < events_1.length; _a++) {
17510 var e = events_1[_a];
17511 _loop_1(e);
17512 }
17513 }, false);
17514 };
17515 /**
17516 * @private
17517 */
17518 Cordova.prototype.registerEventHandlers = function () {
17519 var _this = this;
17520 this.emitter.on('cordova:pause', function () {
17521 _this.app.closed = true;
17522 });
17523 this.emitter.on('cordova:resume', function () {
17524 _this.app.closed = false;
17525 });
17526 };
17527 return Cordova;
17528}());
17529
17530/**
17531 * @hidden
17532 */
17533var Core = (function () {
17534 function Core(deps) {
17535 /**
17536 * @private
17537 */
17538 this._version = '0.11.0';
17539 this.config = deps.config;
17540 this.logger = deps.logger;
17541 this.emitter = deps.emitter;
17542 this.insights = deps.insights;
17543 if (!this.config.settings || !this.config.settings.core || !this.config.settings.core.app_id) {
17544 throw new Error('Missing app_id in cloud settings. Have you configured your app properly?');
17545 }
17546 }
17547 Core.prototype.init = function () {
17548 this.registerEventHandlers();
17549 this.onResume();
17550 };
17551 Object.defineProperty(Core.prototype, "version", {
17552 get: function () {
17553 return this._version;
17554 },
17555 enumerable: true,
17556 configurable: true
17557 });
17558 /**
17559 * @private
17560 */
17561 Core.prototype.onResume = function () {
17562 this.insights.track('mobileapp.opened');
17563 };
17564 /**
17565 * @private
17566 */
17567 Core.prototype.registerEventHandlers = function () {
17568 var _this = this;
17569 this.emitter.on('cordova:resume', function () {
17570 _this.onResume();
17571 });
17572 this.emitter.on('push:notification', function (data) {
17573 if (data.message.app.asleep || data.message.app.closed) {
17574 _this.insights.track('mobileapp.opened.push');
17575 }
17576 });
17577 };
17578 return Core;
17579}());
17580
17581var NO_PLUGIN = new Error('Missing deploy plugin: `ionic-plugin-deploy`');
17582/**
17583 * `Deploy` handles live deploys of the app. Downloading, extracting, and
17584 * rolling back snapshots.
17585 *
17586 * @featured
17587 */
17588var Deploy = (function () {
17589 function Deploy(deps,
17590 /**
17591 * @hidden
17592 */
17593 options) {
17594 var _this = this;
17595 if (options === void 0) { options = {}; }
17596 this.options = options;
17597 /**
17598 * The active deploy channel. Set this to change the channel on which
17599 * `Deploy` operates.
17600 */
17601 this.channel = 'production';
17602 this.config = deps.config;
17603 this.emitter = deps.emitter;
17604 this.logger = deps.logger;
17605 this.emitter.once('device:ready', function () {
17606 if (_this._getPlugin()) {
17607 _this.plugin.init(_this.config.get('app_id'), _this.config.getURL('api'));
17608 }
17609 _this.emitter.emit('deploy:ready');
17610 });
17611 }
17612 /**
17613 * Check for updates on the active channel.
17614 *
17615 * The promise resolves with a boolean. When `true`, a new snapshot exists on
17616 * the channel.
17617 */
17618 Deploy.prototype.check = function () {
17619 var _this = this;
17620 var deferred = new DeferredPromise();
17621 this.emitter.once('deploy:ready', function () {
17622 if (_this._getPlugin()) {
17623 _this.plugin.check(_this.config.get('app_id'), _this.channel, function (result) {
17624 if (result && result === 'true') {
17625 _this.logger.info('Ionic Deploy: an update is available');
17626 deferred.resolve(true);
17627 }
17628 else {
17629 _this.logger.info('Ionic Deploy: no updates available');
17630 deferred.resolve(false);
17631 }
17632 }, function (error) {
17633 _this.logger.error('Ionic Deploy: encountered an error while checking for updates');
17634 deferred.reject(error);
17635 });
17636 }
17637 else {
17638 deferred.reject(NO_PLUGIN);
17639 }
17640 });
17641 return deferred.promise;
17642 };
17643 /**
17644 * Download the available snapshot.
17645 *
17646 * This should be used in conjunction with
17647 * [`extract()`](/api/client/deploy/#extract).
17648 *
17649 * @param options
17650 * Options for this download, such as a progress callback.
17651 */
17652 Deploy.prototype.download = function (options) {
17653 var _this = this;
17654 if (options === void 0) { options = {}; }
17655 var deferred = new DeferredPromise();
17656 this.emitter.once('deploy:ready', function () {
17657 if (_this._getPlugin()) {
17658 _this.plugin.download(_this.config.get('app_id'), function (result) {
17659 if (result === 'true') {
17660 _this.logger.info('Ionic Deploy: download complete');
17661 deferred.resolve();
17662 }
17663 else if (result === 'false') {
17664 deferred.reject(new Error('Ionic Deploy: Download has failed: see native logs.'));
17665 }
17666 else {
17667 if (options.onProgress) {
17668 options.onProgress(result);
17669 }
17670 }
17671 }, function (error) {
17672 deferred.reject(error);
17673 });
17674 }
17675 else {
17676 deferred.reject(NO_PLUGIN);
17677 }
17678 });
17679 return deferred.promise;
17680 };
17681 /**
17682 * Extract the downloaded snapshot.
17683 *
17684 * This should be called after [`download()`](/api/client/deploy/#download)
17685 * successfully resolves.
17686 *
17687 * @param options
17688 */
17689 Deploy.prototype.extract = function (options) {
17690 var _this = this;
17691 if (options === void 0) { options = {}; }
17692 var deferred = new DeferredPromise();
17693 this.emitter.once('deploy:ready', function () {
17694 if (_this._getPlugin()) {
17695 _this.plugin.extract(_this.config.get('app_id'), function (result) {
17696 if (result === 'done') {
17697 _this.logger.info('Ionic Deploy: extraction complete');
17698 deferred.resolve();
17699 }
17700 else {
17701 if (options.onProgress) {
17702 options.onProgress(result);
17703 }
17704 }
17705 }, function (error) {
17706 deferred.reject(error);
17707 });
17708 }
17709 else {
17710 deferred.reject(NO_PLUGIN);
17711 }
17712 });
17713 return deferred.promise;
17714 };
17715 /**
17716 * Immediately reload the app with the latest deployed snapshot.
17717 *
17718 * This is only necessary to call if you have downloaded and extracted a
17719 * snapshot and wish to instantly reload the app with the latest deploy. The
17720 * latest deploy will automatically be loaded when the app is started.
17721 */
17722 Deploy.prototype.load = function () {
17723 var _this = this;
17724 this.emitter.once('deploy:ready', function () {
17725 if (_this._getPlugin()) {
17726 _this.plugin.redirect(_this.config.get('app_id'));
17727 }
17728 });
17729 };
17730 /**
17731 * Get information about the current snapshot.
17732 *
17733 * The promise is resolved with an object that has key/value pairs pertaining
17734 * to the currently deployed snapshot.
17735 */
17736 Deploy.prototype.info = function () {
17737 var _this = this;
17738 var deferred = new DeferredPromise(); // TODO
17739 this.emitter.once('deploy:ready', function () {
17740 if (_this._getPlugin()) {
17741 _this.plugin.info(_this.config.get('app_id'), function (result) {
17742 deferred.resolve(result);
17743 }, function (err) {
17744 deferred.reject(err);
17745 });
17746 }
17747 else {
17748 deferred.reject(NO_PLUGIN);
17749 }
17750 });
17751 return deferred.promise;
17752 };
17753 /**
17754 * List the snapshots that have been installed on this device.
17755 *
17756 * The promise is resolved with an array of snapshot UUIDs.
17757 */
17758 Deploy.prototype.getSnapshots = function () {
17759 var _this = this;
17760 var deferred = new DeferredPromise(); // TODO
17761 this.emitter.once('deploy:ready', function () {
17762 if (_this._getPlugin()) {
17763 _this.plugin.getVersions(_this.config.get('app_id'), function (result) {
17764 deferred.resolve(result);
17765 }, function (err) {
17766 deferred.reject(err);
17767 });
17768 }
17769 else {
17770 deferred.reject(NO_PLUGIN);
17771 }
17772 });
17773 return deferred.promise;
17774 };
17775 /**
17776 * Remove a snapshot from this device.
17777 *
17778 * @param uuid
17779 * The snapshot UUID to remove from the device.
17780 */
17781 Deploy.prototype.deleteSnapshot = function (uuid) {
17782 var _this = this;
17783 var deferred = new DeferredPromise(); // TODO
17784 this.emitter.once('deploy:ready', function () {
17785 if (_this._getPlugin()) {
17786 _this.plugin.deleteVersion(_this.config.get('app_id'), uuid, function (result) {
17787 deferred.resolve(result);
17788 }, function (err) {
17789 deferred.reject(err);
17790 });
17791 }
17792 else {
17793 deferred.reject(NO_PLUGIN);
17794 }
17795 });
17796 return deferred.promise;
17797 };
17798 /**
17799 * Fetches the metadata for a given snapshot. If no UUID is given, it will
17800 * attempt to grab the metadata for the most recently known snapshot.
17801 *
17802 * @param uuid
17803 * The snapshot from which to grab metadata.
17804 */
17805 Deploy.prototype.getMetadata = function (uuid) {
17806 var _this = this;
17807 var deferred = new DeferredPromise(); // TODO
17808 this.emitter.once('deploy:ready', function () {
17809 if (_this._getPlugin()) {
17810 _this.plugin.getMetadata(_this.config.get('app_id'), uuid, function (result) {
17811 deferred.resolve(result.metadata);
17812 }, function (err) {
17813 deferred.reject(err);
17814 });
17815 }
17816 else {
17817 deferred.reject(NO_PLUGIN);
17818 }
17819 });
17820 return deferred.promise;
17821 };
17822 /**
17823 * @private
17824 */
17825 Deploy.prototype._getPlugin = function () {
17826 if (typeof window.IonicDeploy === 'undefined') {
17827 this.logger.warn('Ionic Deploy: Disabled! Deploy plugin is not installed or has not loaded. Have you run `ionic plugin add ionic-plugin-deploy` yet?');
17828 return;
17829 }
17830 if (!this.plugin) {
17831 this.plugin = window.IonicDeploy;
17832 }
17833 return this.plugin;
17834 };
17835 return Deploy;
17836}());
17837
17838/**
17839 * @hidden
17840 */
17841var Device$1 = (function () {
17842 function Device(deps) {
17843 this.deps = deps;
17844 this.native = this.deps.nativeDevice;
17845 this.emitter = this.deps.emitter;
17846 this.type = this.determineDeviceType();
17847 this.registerEventHandlers();
17848 }
17849 Device.prototype.isAndroid = function () {
17850 return this.type === 'android';
17851 };
17852 Device.prototype.isIOS = function () {
17853 return this.type === 'iphone' || this.type === 'ipad';
17854 };
17855 Device.prototype.isConnectedToNetwork = function (options) {
17856 if (options === void 0) { options = {}; }
17857 if (typeof navigator.connection === 'undefined' ||
17858 typeof navigator.connection.type === 'undefined' ||
17859 typeof Connection === 'undefined') {
17860 if (!options.strictMode) {
17861 return true;
17862 }
17863 return false;
17864 }
17865 switch (navigator.connection.type) {
17866 case Connection.ETHERNET:
17867 case Connection.WIFI:
17868 case Connection.CELL_2G:
17869 case Connection.CELL_3G:
17870 case Connection.CELL_4G:
17871 case Connection.CELL:
17872 return true;
17873 default:
17874 return false;
17875 }
17876 };
17877 /**
17878 * @private
17879 */
17880 Device.prototype.registerEventHandlers = function () {
17881 var _this = this;
17882 if (this.type === 'unknown') {
17883 this.emitter.emit('device:ready');
17884 }
17885 else {
17886 this.emitter.once('cordova:deviceready', function () {
17887 _this.emitter.emit('device:ready');
17888 });
17889 }
17890 };
17891 /**
17892 * @private
17893 */
17894 Device.prototype.determineDeviceType = function () {
17895 var agent = navigator.userAgent;
17896 var ipad = agent.match(/iPad/i);
17897 if (ipad && (ipad[0].toLowerCase() === 'ipad')) {
17898 return 'ipad';
17899 }
17900 var iphone = agent.match(/iPhone/i);
17901 if (iphone && (iphone[0].toLowerCase() === 'iphone')) {
17902 return 'iphone';
17903 }
17904 var android = agent.match(/Android/i);
17905 if (android && (android[0].toLowerCase() === 'android')) {
17906 return 'android';
17907 }
17908 return 'unknown';
17909 };
17910 return Device;
17911}());
17912
17913/**
17914 * A registered event receiver.
17915 */
17916var EventReceiver = (function () {
17917 function EventReceiver(
17918 /**
17919 * An registered identifier for this event receiver.
17920 */
17921 key,
17922 /**
17923 * The registered name of the event.
17924 */
17925 event,
17926 /**
17927 * The actual callback.
17928 */
17929 handler) {
17930 this.key = key;
17931 this.event = event;
17932 this.handler = handler;
17933 }
17934 return EventReceiver;
17935}());
17936/**
17937 * Stores callbacks for registered events.
17938 */
17939var EventEmitter = (function () {
17940 function EventEmitter() {
17941 /**
17942 * @private
17943 */
17944 this.n = 0;
17945 /**
17946 * @private
17947 */
17948 this.eventReceivers = {};
17949 /**
17950 * @private
17951 */
17952 this.eventsEmitted = {};
17953 }
17954 /**
17955 * Register an event callback which gets triggered every time the event is
17956 * fired.
17957 *
17958 * @param event
17959 * The event name.
17960 * @param callback
17961 * A callback to attach to this event.
17962 */
17963 EventEmitter.prototype.on = function (event, callback) {
17964 if (typeof this.eventReceivers[event] === 'undefined') {
17965 this.eventReceivers[event] = {};
17966 }
17967 var receiver = new EventReceiver(this.n, event, callback);
17968 this.n++;
17969 this.eventReceivers[event][receiver.key] = receiver;
17970 return receiver;
17971 };
17972 /**
17973 * Unregister an event receiver returned from
17974 * [`on()`](/api/client/eventemitter#on).
17975 *
17976 * @param receiver
17977 * The event receiver.
17978 */
17979 EventEmitter.prototype.off = function (receiver) {
17980 if (typeof this.eventReceivers[receiver.event] === 'undefined' ||
17981 typeof this.eventReceivers[receiver.event][receiver.key] === 'undefined') {
17982 throw new Error('unknown event receiver');
17983 }
17984 delete this.eventReceivers[receiver.event][receiver.key];
17985 };
17986 /**
17987 * Register an event callback that gets triggered only once. If the event was
17988 * triggered before your callback is registered, it calls your callback
17989 * immediately.
17990 *
17991 * @note TODO: Fix the docs for () => void syntax.
17992 *
17993 * @param event
17994 * The event name.
17995 * @param callback
17996 * A callback to attach to this event. It takes no arguments.
17997 */
17998 EventEmitter.prototype.once = function (event, callback) {
17999 var _this = this;
18000 if (this.emitted(event)) {
18001 callback();
18002 }
18003 else {
18004 this.on(event, function () {
18005 if (!_this.emitted(event)) {
18006 callback();
18007 }
18008 });
18009 }
18010 };
18011 /**
18012 * Trigger an event. Call all callbacks in the order they were registered.
18013 *
18014 * @param event
18015 * The event name.
18016 * @param data
18017 * An object to pass to every callback.
18018 */
18019 EventEmitter.prototype.emit = function (event, data) {
18020 if (typeof this.eventReceivers[event] === 'undefined') {
18021 this.eventReceivers[event] = {};
18022 }
18023 if (typeof this.eventsEmitted[event] === 'undefined') {
18024 this.eventsEmitted[event] = 0;
18025 }
18026 for (var k in this.eventReceivers[event]) {
18027 this.eventReceivers[event][k].handler(data);
18028 }
18029 this.eventsEmitted[event] += 1;
18030 };
18031 /**
18032 * Return a count of the number of times an event has been triggered.
18033 *
18034 * @param event
18035 * The event name.
18036 */
18037 EventEmitter.prototype.emitted = function (event) {
18038 if (typeof this.eventsEmitted[event] === 'undefined') {
18039 return 0;
18040 }
18041 return this.eventsEmitted[event];
18042 };
18043 return EventEmitter;
18044}());
18045
18046/**
18047 * @hidden
18048 */
18049var Stat = (function () {
18050 function Stat(appId, stat, value) {
18051 if (value === void 0) { value = 1; }
18052 this.appId = appId;
18053 this.stat = stat;
18054 this.value = value;
18055 this.appId = appId;
18056 this.stat = stat;
18057 this.value = value;
18058 this.created = new Date();
18059 }
18060 Stat.prototype.toJSON = function () {
18061 return {
18062 app_id: this.appId,
18063 stat: this.stat,
18064 value: this.value,
18065 created: this.created.toISOString(),
18066 };
18067 };
18068 return Stat;
18069}());
18070/**
18071 * A client for Insights that handles batching, user activity insight, and
18072 * sending insights at an interval.
18073 *
18074 * @hidden
18075 */
18076var Insights = (function () {
18077 function Insights(deps, options) {
18078 var _this = this;
18079 if (options === void 0) { options = {}; }
18080 this.options = options;
18081 this.app = deps.appStatus;
18082 this.storage = deps.storage;
18083 this.config = deps.config;
18084 this.client = deps.client;
18085 this.device = deps.device;
18086 this.logger = deps.logger;
18087 this.batch = [];
18088 if (typeof this.options.intervalSubmit === 'undefined') {
18089 this.options.intervalSubmit = 60 * 1000;
18090 }
18091 if (typeof this.options.intervalActiveCheck === 'undefined') {
18092 this.options.intervalActiveCheck = 1000;
18093 }
18094 if (typeof this.options.submitCount === 'undefined') {
18095 this.options.submitCount = 100;
18096 }
18097 if (this.options.intervalSubmit) {
18098 setInterval(function () {
18099 _this.submit();
18100 }, this.options.intervalSubmit);
18101 }
18102 if (this.options.intervalActiveCheck) {
18103 setInterval(function () {
18104 if (!_this.app.closed) {
18105 _this.checkActivity();
18106 }
18107 }, this.options.intervalActiveCheck);
18108 }
18109 }
18110 /**
18111 * Track an insight.
18112 *
18113 * @param stat - The insight name.
18114 * @param value - The number by which to increment this insight.
18115 */
18116 Insights.prototype.track = function (stat, value) {
18117 if (value === void 0) { value = 1; }
18118 this.trackStat(new Stat(this.config.settings.core.app_id, stat, value));
18119 };
18120 Insights.prototype.checkActivity = function () {
18121 var session = this.storage.get('insights_session');
18122 if (!session) {
18123 this.markActive();
18124 }
18125 else {
18126 var d = new Date(session);
18127 var hour = 60 * 60 * 1000;
18128 if (d.getTime() + hour < new Date().getTime()) {
18129 this.markActive();
18130 }
18131 }
18132 };
18133 Insights.prototype.markActive = function () {
18134 this.track('mobileapp.active');
18135 if (!this.device.native || !this.device.native.device || !this.device.native.device.platform) {
18136 this.logger.warn('Ionic Insights: Device information unavailable.');
18137 }
18138 else {
18139 var device = this.device.native.device;
18140 var platform = this.normalizeDevicePlatform(device.platform);
18141 var platformVersion = this.normalizeVersion(device.version);
18142 var cordovaVersion = this.normalizeVersion(device.cordova);
18143 this.track("mobileapp.active.platform." + platform);
18144 this.track("mobileapp.active.platform." + platform + "." + platformVersion);
18145 this.track("mobileapp.active.cordova." + cordovaVersion);
18146 }
18147 this.storage.set('insights_session', new Date().toISOString());
18148 };
18149 Insights.prototype.normalizeDevicePlatform = function (platform) {
18150 return platform.toLowerCase().replace(/[^a-z0-9_]/g, '_');
18151 };
18152 Insights.prototype.normalizeVersion = function (s) {
18153 var v;
18154 try {
18155 v = String(parseSemanticVersion(s).major);
18156 }
18157 catch (e) {
18158 v = 'unknown';
18159 }
18160 return v;
18161 };
18162 Insights.prototype.trackStat = function (stat) {
18163 this.batch.push(stat);
18164 if (this.shouldSubmit()) {
18165 this.submit();
18166 }
18167 };
18168 Insights.prototype.shouldSubmit = function () {
18169 return this.batch.length >= this.options.submitCount;
18170 };
18171 Insights.prototype.submit = function () {
18172 var _this = this;
18173 if (this.batch.length === 0) {
18174 return;
18175 }
18176 var insights = [];
18177 for (var _i = 0, _a = this.batch; _i < _a.length; _i++) {
18178 var stat = _a[_i];
18179 insights.push(stat.toJSON());
18180 }
18181 this.client.post('/insights')
18182 .send({ 'insights': insights })
18183 .end(function (err, res) {
18184 if (err) {
18185 _this.logger.error('Ionic Insights: Could not send insights.', err);
18186 }
18187 });
18188 this.batch = [];
18189 };
18190 return Insights;
18191}());
18192
18193/**
18194 * Simple console logger.
18195 */
18196var Logger = (function () {
18197 function Logger(options) {
18198 if (options === void 0) { options = {}; }
18199 this.options = options;
18200 /**
18201 * The function to use to log info level messages.
18202 */
18203 this.infofn = console.log.bind(console);
18204 /**
18205 * The function to use to log warn level messages.
18206 */
18207 this.warnfn = console.warn.bind(console);
18208 /**
18209 * The function to use to log error level messages.
18210 */
18211 this.errorfn = console.error.bind(console);
18212 }
18213 /**
18214 * Send a log at info level.
18215 *
18216 * @note TODO: Fix optionalParams in docs.
18217 *
18218 * @param message - The message to log.
18219 */
18220 Logger.prototype.info = function (message) {
18221 var optionalParams = [];
18222 for (var _i = 1; _i < arguments.length; _i++) {
18223 optionalParams[_i - 1] = arguments[_i];
18224 }
18225 if (!this.options.silent) {
18226 this.infofn.apply(this, [message].concat(optionalParams));
18227 }
18228 };
18229 /**
18230 * Send a log at warn level.
18231 *
18232 * @note TODO: Fix optionalParams in docs.
18233 *
18234 * @param message - The message to log.
18235 */
18236 Logger.prototype.warn = function (message) {
18237 var optionalParams = [];
18238 for (var _i = 1; _i < arguments.length; _i++) {
18239 optionalParams[_i - 1] = arguments[_i];
18240 }
18241 if (!this.options.silent) {
18242 this.warnfn.apply(this, [message].concat(optionalParams));
18243 }
18244 };
18245 /**
18246 * Send a log at error level.
18247 *
18248 * @note TODO: Fix optionalParams in docs.
18249 *
18250 * @param message - The message to log.
18251 */
18252 Logger.prototype.error = function (message) {
18253 var optionalParams = [];
18254 for (var _i = 1; _i < arguments.length; _i++) {
18255 optionalParams[_i - 1] = arguments[_i];
18256 }
18257 this.errorfn.apply(this, [message].concat(optionalParams));
18258 };
18259 return Logger;
18260}());
18261
18262/**
18263 * Represents a push notification sent to the device.
18264 *
18265 * @featured
18266 */
18267var PushMessage = (function () {
18268 function PushMessage() {
18269 }
18270 /**
18271 * Create a PushMessage from the push plugin's format.
18272 *
18273 * @hidden
18274 *
18275 * @param data - The plugin's notification object.
18276 */
18277 PushMessage.fromPluginData = function (data) {
18278 var message = new PushMessage();
18279 message.raw = data;
18280 message.text = data.message;
18281 message.title = data.title;
18282 message.count = data.count;
18283 message.sound = data.sound;
18284 message.image = data.image;
18285 message.app = {
18286 'asleep': !data.additionalData.foreground,
18287 'closed': data.additionalData.coldstart
18288 };
18289 message.payload = data.additionalData['payload'];
18290 return message;
18291 };
18292 PushMessage.prototype.toString = function () {
18293 return "<PushMessage [\"" + this.title + "\"]>";
18294 };
18295 return PushMessage;
18296}());
18297
18298/**
18299 * `Push` handles push notifications for this app.
18300 *
18301 * @featured
18302 */
18303var Push$1 = (function () {
18304 function Push(deps, options) {
18305 if (options === void 0) { options = {}; }
18306 this.options = options;
18307 /**
18308 * @private
18309 */
18310 this.blockRegistration = false;
18311 /**
18312 * @private
18313 */
18314 this.blockUnregister = false;
18315 /**
18316 * @private
18317 */
18318 this.blockSaveToken = false;
18319 /**
18320 * @private
18321 */
18322 this.registered = false;
18323 this.config = deps.config;
18324 this.auth = deps.auth;
18325 this.userService = deps.userService;
18326 this.device = deps.device;
18327 this.client = deps.client;
18328 this.emitter = deps.emitter;
18329 this.storage = deps.storage;
18330 this.logger = deps.logger;
18331 // Check for the required values to use this service
18332 if (this.device.isAndroid() && !this.options.sender_id) {
18333 this.logger.error('Ionic Push: GCM project number not found (http://docs.ionic.io/docs/push-android-setup)');
18334 return;
18335 }
18336 if (!options.pluginConfig) {
18337 options.pluginConfig = {};
18338 }
18339 if (this.device.isAndroid()) {
18340 // inject gcm key for PushPlugin
18341 if (!options.pluginConfig.android) {
18342 options.pluginConfig.android = {};
18343 }
18344 if (!options.pluginConfig.android.senderID) {
18345 options.pluginConfig.android.senderID = this.options.sender_id;
18346 }
18347 }
18348 this.options = options;
18349 }
18350 Object.defineProperty(Push.prototype, "token", {
18351 get: function () {
18352 if (!this._token) {
18353 this._token = this.storage.get('push_token') || undefined;
18354 }
18355 return this._token;
18356 },
18357 set: function (val) {
18358 if (!val) {
18359 this.storage.delete('push_token');
18360 }
18361 else {
18362 this.storage.set('push_token', val);
18363 }
18364 this._token = val;
18365 },
18366 enumerable: true,
18367 configurable: true
18368 });
18369 /**
18370 * Register a token with the API.
18371 *
18372 * When a token is saved, you can send push notifications to it. If a user is
18373 * logged in, the token is linked to them by their ID.
18374 *
18375 * @param token - The token.
18376 * @param options
18377 */
18378 Push.prototype.saveToken = function (token, options) {
18379 var _this = this;
18380 if (options === void 0) { options = {}; }
18381 var deferred = new DeferredPromise();
18382 var tokenData = {
18383 'token': token.token,
18384 'app_id': this.config.get('app_id')
18385 };
18386 if (!options.ignore_user) {
18387 var user = this.userService.current();
18388 if (this.auth.isAuthenticated()) {
18389 tokenData.user_id = user.id;
18390 }
18391 }
18392 if (this.blockSaveToken) {
18393 return deferred.reject(new Error('A token save operation is already in progress.'));
18394 }
18395 this.client.post('/push/tokens')
18396 .send(tokenData)
18397 .end(function (err, res) {
18398 if (err) {
18399 _this.blockSaveToken = false;
18400 _this.logger.error('Ionic Push:', err);
18401 deferred.reject(err);
18402 }
18403 else {
18404 _this.blockSaveToken = false;
18405 _this.logger.info('Ionic Push: saved push token: ' + token.token);
18406 if (tokenData.user_id) {
18407 _this.logger.info('Ionic Push: added push token to user: ' + tokenData.user_id);
18408 }
18409 token.id = res.body.data.id;
18410 token.type = res.body.data.type;
18411 token.saved = true;
18412 deferred.resolve(token);
18413 }
18414 });
18415 return deferred.promise;
18416 };
18417 /**
18418 * Registers the device with GCM/APNS to get a push token.
18419 *
18420 * After a device is registered, you will likely want to save the token with
18421 * [`saveToken()`](/api/client/push/#saveToken) to the API.
18422 */
18423 Push.prototype.register = function () {
18424 var _this = this;
18425 var deferred = new DeferredPromise();
18426 if (this.blockRegistration) {
18427 return deferred.reject(new Error('Another registration is already in progress.'));
18428 }
18429 this.blockRegistration = true;
18430 this.emitter.once('device:ready', function () {
18431 var pushPlugin = _this._getPushPlugin();
18432 if (pushPlugin) {
18433 _this.plugin = pushPlugin.init(_this.options.pluginConfig);
18434 _this.plugin.on('registration', function (data) {
18435 _this.blockRegistration = false;
18436 _this.token = { 'token': data.registrationId, 'registered': false, 'saved': false };
18437 _this.token.registered = true;
18438 deferred.resolve(_this.token);
18439 });
18440 _this.plugin.on('error', function (err) {
18441 _this.logger.error('Ionic Push:', err);
18442 deferred.reject(err);
18443 });
18444 _this._callbackRegistration();
18445 _this.registered = true;
18446 }
18447 else {
18448 deferred.reject(new Error('Push plugin not found! See logs.'));
18449 }
18450 });
18451 return deferred.promise;
18452 };
18453 /**
18454 * Invalidate the current push token.
18455 */
18456 Push.prototype.unregister = function () {
18457 var _this = this;
18458 var deferred = new DeferredPromise();
18459 if (this.blockUnregister) {
18460 return deferred.reject(new Error('An unregister operation is already in progress.'));
18461 }
18462 var pushToken = this.token;
18463 if (!pushToken) {
18464 return deferred.resolve();
18465 }
18466 var tokenData = {
18467 'token': pushToken.token,
18468 'app_id': this.config.get('app_id')
18469 };
18470 if (this.plugin) {
18471 this.plugin.unregister(function () { }, function () { });
18472 }
18473 this.client.post('/push/tokens/invalidate')
18474 .send(tokenData)
18475 .end(function (err, res) {
18476 _this.blockUnregister = false;
18477 if (err) {
18478 _this.logger.error('Ionic Push:', err);
18479 deferred.reject(err);
18480 }
18481 else {
18482 _this.logger.info('Ionic Push: unregistered push token');
18483 delete _this.token;
18484 deferred.resolve();
18485 }
18486 });
18487 this.blockUnregister = true;
18488 return deferred.promise;
18489 };
18490 /**
18491 * @private
18492 */
18493 Push.prototype._callbackRegistration = function () {
18494 var _this = this;
18495 this.plugin.on('registration', function (data) {
18496 if (_this.options.debug) {
18497 _this.logger.info('Ionic Push (debug): device token registered: ' + _this.token);
18498 }
18499 _this.emitter.emit('push:register', _this.token);
18500 });
18501 this.plugin.on('notification', function (data) {
18502 var message = PushMessage.fromPluginData(data);
18503 if (_this.options.debug) {
18504 _this.logger.info('Ionic Push (debug): notification received: ' + message);
18505 }
18506 _this.emitter.emit('push:notification', { 'message': message, 'raw': data });
18507 });
18508 this.plugin.on('error', function (e) {
18509 if (_this.options.debug) {
18510 _this.logger.error('Ionic Push (debug): unexpected error occured.');
18511 _this.logger.error('Ionic Push:', e);
18512 }
18513 _this.emitter.emit('push:error', { 'err': e });
18514 });
18515 };
18516 /**
18517 * @private
18518 */
18519 Push.prototype._getPushPlugin = function () {
18520 var plugin = window.PushNotification;
18521 if (!plugin) {
18522 if (this.device.isIOS() || this.device.isAndroid()) {
18523 this.logger.error('Ionic Push: PushNotification plugin is required. Have you run `ionic plugin add phonegap-plugin-push` ?');
18524 }
18525 else {
18526 this.logger.warn('Ionic Push: Disabled! Native push notifications will not work in a browser. Run your app on an actual device to use push.');
18527 }
18528 }
18529 return plugin;
18530 };
18531 return Push;
18532}());
18533
18534/**
18535 * @hidden
18536 */
18537var LocalStorageStrategy = (function () {
18538 function LocalStorageStrategy() {
18539 }
18540 LocalStorageStrategy.prototype.get = function (key) {
18541 return localStorage.getItem(key);
18542 };
18543 LocalStorageStrategy.prototype.set = function (key, value) {
18544 return localStorage.setItem(key, value);
18545 };
18546 LocalStorageStrategy.prototype.delete = function (key) {
18547 return localStorage.removeItem(key);
18548 };
18549 return LocalStorageStrategy;
18550}());
18551/**
18552 * @hidden
18553 */
18554var SessionStorageStrategy = (function () {
18555 function SessionStorageStrategy() {
18556 }
18557 SessionStorageStrategy.prototype.get = function (key) {
18558 return sessionStorage.getItem(key);
18559 };
18560 SessionStorageStrategy.prototype.set = function (key, value) {
18561 return sessionStorage.setItem(key, value);
18562 };
18563 SessionStorageStrategy.prototype.delete = function (key) {
18564 return sessionStorage.removeItem(key);
18565 };
18566 return SessionStorageStrategy;
18567}());
18568/**
18569 * A generic local/session storage abstraction.
18570 */
18571var Storage = (function () {
18572 function Storage(deps, options) {
18573 if (options === void 0) { options = { 'prefix': 'ionic', 'cache': true }; }
18574 this.options = options;
18575 this.strategy = deps.strategy;
18576 this.storageCache = {};
18577 }
18578 /**
18579 * Set a value in the storage by the given key.
18580 *
18581 * @param key - The storage key to set.
18582 * @param value - The value to set. (Must be JSON-serializable).
18583 */
18584 Storage.prototype.set = function (key, value) {
18585 key = this.standardizeKey(key);
18586 var json = JSON.stringify(value);
18587 this.strategy.set(key, json);
18588 if (this.options.cache) {
18589 this.storageCache[key] = value;
18590 }
18591 };
18592 /**
18593 * Delete a value from the storage by the given key.
18594 *
18595 * @param key - The storage key to delete.
18596 */
18597 Storage.prototype.delete = function (key) {
18598 key = this.standardizeKey(key);
18599 this.strategy.delete(key);
18600 if (this.options.cache) {
18601 delete this.storageCache[key];
18602 }
18603 };
18604 /**
18605 * Get a value from the storage by the given key.
18606 *
18607 * @param key - The storage key to get.
18608 */
18609 Storage.prototype.get = function (key) {
18610 key = this.standardizeKey(key);
18611 if (this.options.cache) {
18612 var cached = this.storageCache[key];
18613 if (cached) {
18614 return cached;
18615 }
18616 }
18617 var json = this.strategy.get(key);
18618 if (!json) {
18619 return null;
18620 }
18621 try {
18622 var value = JSON.parse(json);
18623 if (this.options.cache) {
18624 this.storageCache[key] = value;
18625 }
18626 return value;
18627 }
18628 catch (err) {
18629 return null;
18630 }
18631 };
18632 /**
18633 * @private
18634 */
18635 Storage.prototype.standardizeKey = function (key) {
18636 return this.options.prefix + "_" + key;
18637 };
18638 return Storage;
18639}());
18640
18641var dataTypeMapping = {};
18642var DataTypeSchema = (function () {
18643 function DataTypeSchema(properties) {
18644 this.data = {};
18645 this.setProperties(properties);
18646 }
18647 DataTypeSchema.prototype.setProperties = function (properties) {
18648 if (properties instanceof Object) {
18649 for (var x in properties) {
18650 this.data[x] = properties[x];
18651 }
18652 }
18653 };
18654 DataTypeSchema.prototype.toJSON = function () {
18655 var data = this.data;
18656 return {
18657 '__Ionic_DataTypeSchema': data.name,
18658 'value': data.value
18659 };
18660 };
18661 DataTypeSchema.prototype.isValid = function () {
18662 if (this.data.name && this.data.value) {
18663 return true;
18664 }
18665 return false;
18666 };
18667 return DataTypeSchema;
18668}());
18669var DataType = (function () {
18670 function DataType() {
18671 }
18672 DataType.get = function (name, value) {
18673 if (dataTypeMapping[name]) {
18674 return new dataTypeMapping[name](value);
18675 }
18676 return false;
18677 };
18678 DataType.getMapping = function () {
18679 return dataTypeMapping;
18680 };
18681 Object.defineProperty(DataType, "Schema", {
18682 get: function () {
18683 return DataTypeSchema;
18684 },
18685 enumerable: true,
18686 configurable: true
18687 });
18688 DataType.register = function (name, cls) {
18689 dataTypeMapping[name] = cls;
18690 };
18691 return DataType;
18692}());
18693var UniqueArray = (function () {
18694 function UniqueArray(value) {
18695 this.data = [];
18696 if (value instanceof Array) {
18697 for (var x in value) {
18698 this.push(value[x]);
18699 }
18700 }
18701 }
18702 UniqueArray.prototype.toJSON = function () {
18703 var data = this.data;
18704 var schema = new DataTypeSchema({ 'name': 'UniqueArray', 'value': data });
18705 return schema.toJSON();
18706 };
18707 UniqueArray.fromStorage = function (value) {
18708 return new UniqueArray(value);
18709 };
18710 UniqueArray.prototype.push = function (value) {
18711 if (this.data.indexOf(value) === -1) {
18712 this.data.push(value);
18713 }
18714 };
18715 UniqueArray.prototype.pull = function (value) {
18716 var index = this.data.indexOf(value);
18717 this.data.splice(index, 1);
18718 };
18719 return UniqueArray;
18720}());
18721DataType.register('UniqueArray', UniqueArray);
18722
18723/**
18724 * @hidden
18725 */
18726var UserContext = (function () {
18727 function UserContext(deps) {
18728 this.config = deps.config;
18729 this.storage = deps.storage;
18730 }
18731 Object.defineProperty(UserContext.prototype, "label", {
18732 get: function () {
18733 return 'user_' + this.config.get('app_id');
18734 },
18735 enumerable: true,
18736 configurable: true
18737 });
18738 UserContext.prototype.unstore = function () {
18739 this.storage.delete(this.label);
18740 };
18741 UserContext.prototype.store = function (user) {
18742 this.storage.set(this.label, user.serializeForStorage());
18743 };
18744 UserContext.prototype.load = function (user) {
18745 var data = this.storage.get(this.label);
18746 if (data) {
18747 user.id = data.id;
18748 user.data = new UserData(data.data);
18749 user.details = data.details || {};
18750 user.social = data.social || {};
18751 user.fresh = data.fresh;
18752 return user;
18753 }
18754 return null;
18755 };
18756 return UserContext;
18757}());
18758/**
18759 * @hidden
18760 */
18761var UserData = (function () {
18762 function UserData(data) {
18763 if (data === void 0) { data = {}; }
18764 this.data = {};
18765 if ((typeof data === 'object')) {
18766 this.data = data;
18767 this.deserializeDataTypes();
18768 }
18769 }
18770 UserData.prototype.get = function (key, defaultValue) {
18771 if (this.data.hasOwnProperty(key)) {
18772 return this.data[key];
18773 }
18774 else {
18775 if (defaultValue === 0 || defaultValue === false) {
18776 return defaultValue;
18777 }
18778 return defaultValue || null;
18779 }
18780 };
18781 UserData.prototype.set = function (key, value) {
18782 this.data[key] = value;
18783 };
18784 UserData.prototype.unset = function (key) {
18785 delete this.data[key];
18786 };
18787 /**
18788 * @private
18789 */
18790 UserData.prototype.deserializeDataTypes = function () {
18791 if (this.data) {
18792 for (var x in this.data) {
18793 // if we have an object, let's check for custom data types
18794 if (this.data[x] && typeof this.data[x] === 'object') {
18795 // do we have a custom type?
18796 if (this.data[x].__Ionic_DataTypeSchema) {
18797 var name = this.data[x].__Ionic_DataTypeSchema;
18798 var mapping = DataType.getMapping();
18799 if (mapping[name]) {
18800 // we have a custom type and a registered class, give the custom data type
18801 // from storage
18802 this.data[x] = mapping[name].fromStorage(this.data[x].value);
18803 }
18804 }
18805 }
18806 }
18807 }
18808 };
18809 return UserData;
18810}());
18811/**
18812 * Represents a user of the app.
18813 *
18814 * @featured
18815 */
18816var User = (function () {
18817 function User(deps) {
18818 /**
18819 * The details (email, password, etc) of this user.
18820 */
18821 this.details = {};
18822 /**
18823 * The social details of this user.
18824 */
18825 this.social = {};
18826 this.service = deps.service;
18827 this.fresh = true;
18828 this._unset = {};
18829 this.data = new UserData();
18830 }
18831 /**
18832 * Check whether this user is anonymous or not.
18833 *
18834 * If the `id` property is set, the user is no longer anonymous.
18835 */
18836 User.prototype.isAnonymous = function () {
18837 if (!this.id) {
18838 return true;
18839 }
18840 else {
18841 return false;
18842 }
18843 };
18844 /**
18845 * Get a value from this user's custom data.
18846 *
18847 * Optionally, a default value can be provided.
18848 *
18849 * @param key - The data key to get.
18850 * @param defaultValue - The value to return if the key is absent.
18851 */
18852 User.prototype.get = function (key, defaultValue) {
18853 return this.data.get(key, defaultValue);
18854 };
18855 /**
18856 * Set a value in this user's custom data.
18857 *
18858 * @param key - The data key to set.
18859 * @param value - The value to set.
18860 */
18861 User.prototype.set = function (key, value) {
18862 delete this._unset[key];
18863 return this.data.set(key, value);
18864 };
18865 /**
18866 * Delete a value from this user's custom data.
18867 *
18868 * @param key - The data key to delete.
18869 */
18870 User.prototype.unset = function (key) {
18871 this._unset[key] = true;
18872 return this.data.unset(key);
18873 };
18874 /**
18875 * Revert this user to a fresh, anonymous state.
18876 */
18877 User.prototype.clear = function () {
18878 this.id = undefined;
18879 this.data = new UserData();
18880 this.details = {};
18881 this.fresh = true;
18882 };
18883 /**
18884 * Save this user to the API.
18885 */
18886 User.prototype.save = function () {
18887 this._unset = {};
18888 return this.service.save();
18889 };
18890 /**
18891 * Delete this user from the API.
18892 */
18893 User.prototype.delete = function () {
18894 return this.service.delete();
18895 };
18896 /**
18897 * Load the user from the API, overwriting the local user's data.
18898 *
18899 * @param id - The user ID to load into this user.
18900 */
18901 User.prototype.load = function (id) {
18902 return this.service.load(id);
18903 };
18904 /**
18905 * Store this user in local storage.
18906 */
18907 User.prototype.store = function () {
18908 this.service.store();
18909 };
18910 /**
18911 * Remove this user from local storage.
18912 */
18913 User.prototype.unstore = function () {
18914 this.service.unstore();
18915 };
18916 /**
18917 * @hidden
18918 */
18919 User.prototype.serializeForAPI = function () {
18920 return {
18921 'email': this.details.email,
18922 'password': this.details.password,
18923 'username': this.details.username,
18924 'image': this.details.image,
18925 'name': this.details.name,
18926 'custom': this.data.data
18927 };
18928 };
18929 /**
18930 * @hidden
18931 */
18932 User.prototype.serializeForStorage = function () {
18933 return {
18934 'id': this.id,
18935 'data': this.data.data,
18936 'details': this.details,
18937 'fresh': this.fresh,
18938 'social': this.social
18939 };
18940 };
18941 User.prototype.toString = function () {
18942 return "<User [" + (this.isAnonymous() ? 'anonymous' : this.id) + "]>";
18943 };
18944 return User;
18945}());
18946/**
18947 * @hidden
18948 */
18949var SingleUserService = (function () {
18950 function SingleUserService(deps, config) {
18951 if (config === void 0) { config = {}; }
18952 this.config = config;
18953 this.client = deps.client;
18954 this.context = deps.context;
18955 }
18956 SingleUserService.prototype.current = function () {
18957 if (!this.user) {
18958 this.user = this.context.load(new User({ 'service': this }));
18959 }
18960 if (!this.user) {
18961 this.user = new User({ 'service': this });
18962 }
18963 return this.user;
18964 };
18965 SingleUserService.prototype.store = function () {
18966 this.context.store(this.current());
18967 };
18968 SingleUserService.prototype.unstore = function () {
18969 this.context.unstore();
18970 };
18971 SingleUserService.prototype.load = function (id) {
18972 if (id === void 0) { id = 'self'; }
18973 var deferred = new DeferredPromise();
18974 var user = this.current();
18975 this.client.get("/users/" + id)
18976 .end(function (err, res) {
18977 if (err) {
18978 deferred.reject(err);
18979 }
18980 else {
18981 user.id = res.body.data.uuid;
18982 user.data = new UserData(res.body.data.custom);
18983 user.details = res.body.data.details;
18984 user.fresh = false;
18985 user.social = res.body.data.social;
18986 deferred.resolve();
18987 }
18988 });
18989 return deferred.promise;
18990 };
18991 SingleUserService.prototype.delete = function () {
18992 var deferred = new DeferredPromise();
18993 if (!this.user) {
18994 return deferred.reject(new Error('No user loaded to delete.'));
18995 }
18996 if (this.user.isAnonymous()) {
18997 return deferred.reject(new Error('User is anonymous and cannot be deleted from the API.'));
18998 }
18999 this.unstore();
19000 this.client.delete("/users/" + this.user.id)
19001 .end(function (err, res) {
19002 if (err) {
19003 deferred.reject(err);
19004 }
19005 else {
19006 deferred.resolve();
19007 }
19008 });
19009 return deferred.promise;
19010 };
19011 SingleUserService.prototype.save = function () {
19012 var _this = this;
19013 var deferred = new DeferredPromise();
19014 this.store();
19015 if (!this.user) {
19016 return deferred.reject(new Error('No user loaded to save.'));
19017 }
19018 if (this.user.isAnonymous()) {
19019 return deferred.reject(new Error('User is anonymous and cannot be updated in the API. Use load(<id>) or signup a user using auth.'));
19020 }
19021 this.client.patch("/users/" + this.user.id)
19022 .send(this.user.serializeForAPI())
19023 .end(function (err, res) {
19024 if (err) {
19025 deferred.reject(err);
19026 }
19027 else {
19028 if (_this.user) {
19029 _this.user.fresh = false;
19030 }
19031 deferred.resolve();
19032 }
19033 });
19034 return deferred.promise;
19035 };
19036 return SingleUserService;
19037}());
19038
19039var __decorate$101 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
19040 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19041 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
19042 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;
19043 return c > 3 && r && Object.defineProperty(target, key, r), r;
19044};
19045var __metadata = (undefined && undefined.__metadata) || function (k, v) {
19046 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
19047};
19048var modules = {};
19049function cache(target, propertyKey, descriptor) {
19050 var method = descriptor.get;
19051 descriptor.get = function () {
19052 if (typeof method !== 'undefined' && typeof modules[propertyKey] === 'undefined') {
19053 var value = method.apply(this, arguments);
19054 modules[propertyKey] = value;
19055 }
19056 return modules[propertyKey];
19057 };
19058 descriptor.set = function (value) { };
19059}
19060/**
19061 * @hidden
19062 */
19063var Container = (function () {
19064 function Container() {
19065 }
19066 Object.defineProperty(Container.prototype, "appStatus", {
19067 get: function () {
19068 return { 'asleep': false, 'closed': false };
19069 },
19070 enumerable: true,
19071 configurable: true
19072 });
19073 Object.defineProperty(Container.prototype, "config", {
19074 get: function () {
19075 return new Config();
19076 },
19077 enumerable: true,
19078 configurable: true
19079 });
19080 Object.defineProperty(Container.prototype, "eventEmitter", {
19081 get: function () {
19082 return new EventEmitter();
19083 },
19084 enumerable: true,
19085 configurable: true
19086 });
19087 Object.defineProperty(Container.prototype, "logger", {
19088 get: function () {
19089 var config = this.config;
19090 var c = {};
19091 if (typeof config.settings !== 'undefined' && typeof config.settings.logger !== 'undefined') {
19092 c = config.settings.logger;
19093 }
19094 return new Logger(c);
19095 },
19096 enumerable: true,
19097 configurable: true
19098 });
19099 Object.defineProperty(Container.prototype, "localStorageStrategy", {
19100 get: function () {
19101 return new LocalStorageStrategy();
19102 },
19103 enumerable: true,
19104 configurable: true
19105 });
19106 Object.defineProperty(Container.prototype, "sessionStorageStrategy", {
19107 get: function () {
19108 return new SessionStorageStrategy();
19109 },
19110 enumerable: true,
19111 configurable: true
19112 });
19113 Object.defineProperty(Container.prototype, "authTokenContext", {
19114 get: function () {
19115 var label = 'auth_' + this.config.get('app_id');
19116 return new CombinedAuthTokenContext({
19117 'storage': new Storage({ 'strategy': this.localStorageStrategy }),
19118 'tempStorage': new Storage({ 'strategy': this.sessionStorageStrategy })
19119 }, label);
19120 },
19121 enumerable: true,
19122 configurable: true
19123 });
19124 Object.defineProperty(Container.prototype, "client", {
19125 get: function () {
19126 return new Client(this.authTokenContext, this.config.getURL('api'));
19127 },
19128 enumerable: true,
19129 configurable: true
19130 });
19131 Object.defineProperty(Container.prototype, "insights", {
19132 get: function () {
19133 return new Insights({
19134 'appStatus': this.appStatus,
19135 'storage': new Storage({ 'strategy': this.localStorageStrategy }),
19136 'config': this.config,
19137 'client': this.client,
19138 'device': this.device,
19139 'logger': this.logger
19140 });
19141 },
19142 enumerable: true,
19143 configurable: true
19144 });
19145 Object.defineProperty(Container.prototype, "core", {
19146 get: function () {
19147 return new Core({
19148 'config': this.config,
19149 'logger': this.logger,
19150 'emitter': this.eventEmitter,
19151 'insights': this.insights
19152 });
19153 },
19154 enumerable: true,
19155 configurable: true
19156 });
19157 Object.defineProperty(Container.prototype, "device", {
19158 get: function () {
19159 return new Device$1({ 'nativeDevice': Device, 'emitter': this.eventEmitter });
19160 },
19161 enumerable: true,
19162 configurable: true
19163 });
19164 Object.defineProperty(Container.prototype, "cordova", {
19165 get: function () {
19166 return new Cordova$1({
19167 'appStatus': this.appStatus,
19168 'device': this.device,
19169 'emitter': this.eventEmitter,
19170 'logger': this.logger
19171 });
19172 },
19173 enumerable: true,
19174 configurable: true
19175 });
19176 Object.defineProperty(Container.prototype, "userContext", {
19177 get: function () {
19178 return new UserContext({ 'storage': new Storage({ 'strategy': this.localStorageStrategy }), 'config': this.config });
19179 },
19180 enumerable: true,
19181 configurable: true
19182 });
19183 Object.defineProperty(Container.prototype, "singleUserService", {
19184 get: function () {
19185 return new SingleUserService({ 'client': this.client, 'context': this.userContext });
19186 },
19187 enumerable: true,
19188 configurable: true
19189 });
19190 Object.defineProperty(Container.prototype, "authModules", {
19191 get: function () {
19192 var authModuleDeps = {
19193 'config': this.config,
19194 'client': this.client,
19195 'emitter': this.eventEmitter
19196 };
19197 return {
19198 'basic': new BasicAuthType(authModuleDeps),
19199 'custom': new CustomAuthType(authModuleDeps),
19200 'twitter': new TwitterAuthType(authModuleDeps),
19201 'facebook': new FacebookAuthType(authModuleDeps),
19202 'github': new GithubAuthType(authModuleDeps),
19203 'google': new GoogleAuthType(authModuleDeps),
19204 'instagram': new InstagramAuthType(authModuleDeps),
19205 'linkedin': new LinkedInAuthType(authModuleDeps)
19206 };
19207 },
19208 enumerable: true,
19209 configurable: true
19210 });
19211 Object.defineProperty(Container.prototype, "auth", {
19212 get: function () {
19213 return new Auth({
19214 'config': this.config,
19215 'emitter': this.eventEmitter,
19216 'authModules': this.authModules,
19217 'tokenContext': this.authTokenContext,
19218 'userService': this.singleUserService
19219 });
19220 },
19221 enumerable: true,
19222 configurable: true
19223 });
19224 Object.defineProperty(Container.prototype, "facebookAuth", {
19225 get: function () {
19226 return new FacebookAuth({
19227 'config': this.config,
19228 'client': this.client,
19229 'userService': this.singleUserService,
19230 'storage': new Storage({ 'strategy': this.localStorageStrategy }),
19231 'tokenContext': this.authTokenContext,
19232 'emitter': this.eventEmitter
19233 });
19234 },
19235 enumerable: true,
19236 configurable: true
19237 });
19238 Object.defineProperty(Container.prototype, "googleAuth", {
19239 get: function () {
19240 return new GoogleAuth({
19241 'config': this.config,
19242 'client': this.client,
19243 'userService': this.singleUserService,
19244 'storage': new Storage({ 'strategy': this.localStorageStrategy }),
19245 'tokenContext': this.authTokenContext,
19246 'emitter': this.eventEmitter
19247 });
19248 },
19249 enumerable: true,
19250 configurable: true
19251 });
19252 Object.defineProperty(Container.prototype, "push", {
19253 get: function () {
19254 var config = this.config;
19255 var c = {};
19256 if (typeof config.settings !== 'undefined' && typeof config.settings.push !== 'undefined') {
19257 c = config.settings.push;
19258 }
19259 return new Push$1({
19260 'config': config,
19261 'auth': this.auth,
19262 'userService': this.singleUserService,
19263 'device': this.device,
19264 'client': this.client,
19265 'emitter': this.eventEmitter,
19266 'storage': new Storage({ 'strategy': this.localStorageStrategy }),
19267 'logger': this.logger
19268 }, c);
19269 },
19270 enumerable: true,
19271 configurable: true
19272 });
19273 Object.defineProperty(Container.prototype, "deploy", {
19274 get: function () {
19275 return new Deploy({
19276 'config': this.config,
19277 'emitter': this.eventEmitter,
19278 'logger': this.logger
19279 });
19280 },
19281 enumerable: true,
19282 configurable: true
19283 });
19284 __decorate$101([
19285 cache,
19286 __metadata('design:type', Object)
19287 ], Container.prototype, "appStatus", null);
19288 __decorate$101([
19289 cache,
19290 __metadata('design:type', Object)
19291 ], Container.prototype, "config", null);
19292 __decorate$101([
19293 cache,
19294 __metadata('design:type', Object)
19295 ], Container.prototype, "eventEmitter", null);
19296 __decorate$101([
19297 cache,
19298 __metadata('design:type', Object)
19299 ], Container.prototype, "logger", null);
19300 __decorate$101([
19301 cache,
19302 __metadata('design:type', Object)
19303 ], Container.prototype, "localStorageStrategy", null);
19304 __decorate$101([
19305 cache,
19306 __metadata('design:type', Object)
19307 ], Container.prototype, "sessionStorageStrategy", null);
19308 __decorate$101([
19309 cache,
19310 __metadata('design:type', Object)
19311 ], Container.prototype, "authTokenContext", null);
19312 __decorate$101([
19313 cache,
19314 __metadata('design:type', Object)
19315 ], Container.prototype, "client", null);
19316 __decorate$101([
19317 cache,
19318 __metadata('design:type', Object)
19319 ], Container.prototype, "insights", null);
19320 __decorate$101([
19321 cache,
19322 __metadata('design:type', Object)
19323 ], Container.prototype, "core", null);
19324 __decorate$101([
19325 cache,
19326 __metadata('design:type', Object)
19327 ], Container.prototype, "device", null);
19328 __decorate$101([
19329 cache,
19330 __metadata('design:type', Object)
19331 ], Container.prototype, "cordova", null);
19332 __decorate$101([
19333 cache,
19334 __metadata('design:type', Object)
19335 ], Container.prototype, "userContext", null);
19336 __decorate$101([
19337 cache,
19338 __metadata('design:type', Object)
19339 ], Container.prototype, "singleUserService", null);
19340 __decorate$101([
19341 cache,
19342 __metadata('design:type', Object)
19343 ], Container.prototype, "authModules", null);
19344 __decorate$101([
19345 cache,
19346 __metadata('design:type', Object)
19347 ], Container.prototype, "auth", null);
19348 __decorate$101([
19349 cache,
19350 __metadata('design:type', Object)
19351 ], Container.prototype, "facebookAuth", null);
19352 __decorate$101([
19353 cache,
19354 __metadata('design:type', Object)
19355 ], Container.prototype, "googleAuth", null);
19356 __decorate$101([
19357 cache,
19358 __metadata('design:type', Object)
19359 ], Container.prototype, "push", null);
19360 __decorate$101([
19361 cache,
19362 __metadata('design:type', Object)
19363 ], Container.prototype, "deploy", null);
19364 return Container;
19365}());
19366
19367/**
19368 * Angular 1 modules and factories for the bundle
19369 */
19370function bootstrapAngular1() {
19371 if (typeof angular === 'undefined') {
19372 return; // No global angular--this is not an AngularJS project.
19373 }
19374 var container = new Container();
19375 angular.element(document).ready(function () {
19376 container.core.init();
19377 container.cordova.bootstrap();
19378 });
19379 angular.module('ionic.cloud', [])
19380 .provider('$ionicCloudConfig', function () {
19381 var config = container.config;
19382 this.register = function (settings) {
19383 config.register(settings);
19384 };
19385 this.$get = function () {
19386 return config;
19387 };
19388 })
19389 .provider('$ionicCloud', ['$ionicCloudConfigProvider', function ($ionicCloudConfigProvider) {
19390 this.init = function (value) {
19391 $ionicCloudConfigProvider.register(value);
19392 };
19393 this.$get = [function () {
19394 return container.core;
19395 }];
19396 }])
19397 .factory('$ionicCloudClient', [function () {
19398 return container.client;
19399 }])
19400 .factory('$ionicUser', [function () {
19401 return container.singleUserService.current();
19402 }])
19403 .factory('$ionicAuth', [function () {
19404 return container.auth;
19405 }])
19406 .factory('$FacebookAuth', [function () {
19407 return container.facebookAuth;
19408 }])
19409 .factory('$GoogleAuth', [function () {
19410 return container.googleAuth;
19411 }])
19412 .factory('$ionicPush', [function () {
19413 return container.push;
19414 }])
19415 .factory('$ionicDeploy', [function () {
19416 return container.deploy;
19417 }])
19418 .run(['$window', '$q', '$rootScope', function ($window, $q, $rootScope) {
19419 if (typeof $window.Promise === 'undefined') {
19420 $window.Promise = $q;
19421 }
19422 else {
19423 var init = DeferredPromise.prototype.init;
19424 DeferredPromise.prototype.init = function () {
19425 init.apply(this, arguments);
19426 this.promise = $q.when(this.promise);
19427 };
19428 }
19429 var emit = EventEmitter.prototype.emit;
19430 EventEmitter.prototype.emit = function (name, data) {
19431 $rootScope.$broadcast('cloud:' + name, data);
19432 return emit.apply(this, arguments);
19433 };
19434 }]);
19435}
19436
19437bootstrapAngular1();
19438
19439exports.Auth = Auth;
19440exports.AuthType = AuthType;
19441exports.BasicAuthType = BasicAuthType;
19442exports.CustomAuthType = CustomAuthType;
19443exports.FacebookAuth = FacebookAuth;
19444exports.FacebookAuthType = FacebookAuthType;
19445exports.GithubAuthType = GithubAuthType;
19446exports.GoogleAuth = GoogleAuth;
19447exports.GoogleAuthType = GoogleAuthType;
19448exports.InstagramAuthType = InstagramAuthType;
19449exports.LinkedInAuthType = LinkedInAuthType;
19450exports.TwitterAuthType = TwitterAuthType;
19451exports.Client = Client;
19452exports.Config = Config;
19453exports.Cordova = Cordova$1;
19454exports.Core = Core;
19455exports.Deploy = Deploy;
19456exports.Device = Device$1;
19457exports.Exception = Exception;
19458exports.DetailedError = DetailedError;
19459exports.DIContainer = Container;
19460exports.EventEmitter = EventEmitter;
19461exports.Insights = Insights;
19462exports.Logger = Logger;
19463exports.Push = Push$1;
19464exports.PushMessage = PushMessage;
19465exports.Storage = Storage;
19466exports.LocalStorageStrategy = LocalStorageStrategy;
19467exports.SessionStorageStrategy = SessionStorageStrategy;
19468exports.UserContext = UserContext;
19469exports.User = User;
19470exports.SingleUserService = SingleUserService;
19471
19472}((this.Ionic = this.Ionic || {})));
19473//# sourceMappingURL=ionic.cloud.js.map