UNPKG

2.51 kBTypeScriptView Raw
1export interface SafariViewControllerOptions {
2 url?: string;
3 hidden?: boolean;
4 toolbarColor?: string;
5 animated?: boolean;
6 showDefaultShareMenuItem?: boolean;
7 enterReaderModeIfAvailable?: boolean;
8 tintColor?: string;
9 transition?: string;
10}
11/**
12 * @name SafariViewController
13 * @description
14 * @usage
15 * ```
16 * import { SafariViewController } from 'ionic-native';
17 *
18 *
19 * SafariViewController.isAvailable()
20 * .then(
21 * (available: boolean) => {
22 * if(available){
23 *
24 * SafariViewController.show({
25 * url: 'http://ionic.io',
26 * hidden: false,
27 * animated: false,
28 * transition: 'curl',
29 * enterReaderModeIfAvailable: true,
30 * tintColor: '#ff0000'
31 * })
32 * .then(
33 * (result: any) => {
34 * if(result.event === 'opened') console.log('Opened');
35 * else if(result.event === 'loaded') console.log('Loaded');
36 * else if(result.event === 'closed') console.log('Closed');
37 * },
38 * (error: any) => console.error(error)
39 * );
40 *
41 * } else {
42 * // use fallback browser, example InAppBrowser
43 * }
44 * }
45 * );
46 * ```
47 * @interfaces
48 * SafariViewControllerOptions
49 */
50export declare class SafariViewController {
51 /**
52 * Checks if SafariViewController is available
53 * @returns {Promise<boolean>}
54 */
55 static isAvailable(): Promise<boolean>;
56 /**
57 * Shows Safari View Controller
58 * @param options {SafariViewControllerOptions} optional
59 * @returns {Promise<any>}
60 */
61 static show(options?: SafariViewControllerOptions): Promise<any>;
62 /**
63 * Hides Safari View Controller
64 */
65 static hide(): Promise<any>;
66 /**
67 * Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below.
68 * @returns {Promise<any>}
69 */
70 static connectToService(): Promise<any>;
71 /**
72 * Call this method whenever there's a chance the user will open an external url.
73 * @returns {Promise<any>}
74 */
75 static warmUp(): Promise<any>;
76 /**
77 * For even better performance optimization, call this methods if there's more than a 50% chance the user will open a certain URL.
78 * @param url{string}
79 * @returns {Promise<any>}
80 */
81 static mayLaunchUrl(url: string): Promise<any>;
82}