1 | import { Observable } from 'rxjs/Observable';
|
2 | export interface ThreeDeeTouchQuickAction {
|
3 | /**
|
4 | * Type that can be used in the onHomeIconPressed callback
|
5 | */
|
6 | type?: string;
|
7 | /**
|
8 | * Title
|
9 | */
|
10 | title: string;
|
11 | /**
|
12 | * Subtitle
|
13 | */
|
14 | subtitle?: string;
|
15 | /**
|
16 | * Icon type. Case insensitive
|
17 | */
|
18 | iconType?: string;
|
19 | /**
|
20 | * Icon template
|
21 | */
|
22 | iconTemplate?: string;
|
23 | }
|
24 | export interface ThreeDeeTouchForceTouch {
|
25 | /**
|
26 | * Touch force
|
27 | */
|
28 | force: number;
|
29 | /**
|
30 | * Timestamp of action
|
31 | */
|
32 | timestamp: number;
|
33 | /**
|
34 | * X coordinate of action
|
35 | */
|
36 | x: number;
|
37 | /**
|
38 | * Y coordinate of action
|
39 | */
|
40 | y: number;
|
41 | }
|
42 | /**
|
43 | * @name 3DTouch
|
44 | * @description
|
45 | * @usage
|
46 | * Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient.
|
47 | * ```
|
48 | * import { ThreeDeeTouch } from 'ionic-native';
|
49 | *
|
50 | * // import for type completion on variables
|
51 | * import { ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from 'ionic-native';
|
52 | * ...
|
53 | *
|
54 | * ThreeDeeTouch.isAvailable().then(isAvailable => console.log("3D Touch available? " + isAvailable));
|
55 | *
|
56 | * ThreeDeeTouch.watchForceTouches()
|
57 | * .subscribe(
|
58 | * (data: ThreeDeeTouchForceTouch) => {
|
59 | * console.log("Force touch %" + data.force);
|
60 | * console.log("Force touch timestamp: " + data.timestamp);
|
61 | * console.log("Force touch x: " + data.x);
|
62 | * console.log("Force touch y: " + data.y);
|
63 | * }
|
64 | * );
|
65 | *
|
66 | *
|
67 | * let actions: Array<ThreeDeeTouchQuickAction> = [
|
68 | * {
|
69 | * type: 'checkin',
|
70 | * title: 'Check in',
|
71 | * subtitle: 'Quickly check in',
|
72 | * iconType: 'Compose'
|
73 | * },
|
74 | * {
|
75 | * type: 'share',
|
76 | * title: 'Share',
|
77 | * subtitle: 'Share like you care',
|
78 | * iconType: 'Share'
|
79 | * },
|
80 | * {
|
81 | * type: 'search',
|
82 | * title: 'Search',
|
83 | * iconType: 'Search'
|
84 | * },
|
85 | * {
|
86 | * title: 'Show favorites',
|
87 | * iconTemplate: 'HeartTemplate'
|
88 | * }
|
89 | * ];
|
90 | * ThreeDeeTouch.configureQuickActions(actions);
|
91 | *
|
92 | * ThreeDeeTouch.onHomeIconPressed().subscribe(
|
93 | * (payload) => {
|
94 | * // returns an object that is the button you presed
|
95 | * console.log('Pressed the ${payload.title} button')
|
96 | * console.log(payload.type)
|
97 | *
|
98 | * }
|
99 | * )
|
100 | * ```
|
101 | * @interfaces
|
102 | * ThreeDeeTouchQuickAction
|
103 | * ThreeDeeTouchForceTouch
|
104 | */
|
105 | export declare class ThreeDeeTouch {
|
106 | /**
|
107 | * 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.
|
108 | * @returns {Promise<boolean>} returns a promise that resolves with a boolean that indicates whether the plugin is available or not
|
109 | */
|
110 | static isAvailable(): Promise<boolean>;
|
111 | /**
|
112 | * 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.
|
113 | * @returns {Observable<ThreeDeeTouchForceTouch>} Returns an observable that sends a `ThreeDeeTouchForceTouch` object
|
114 | */
|
115 | static watchForceTouches(): Observable<ThreeDeeTouchForceTouch>;
|
116 | /**
|
117 | * setup the 3D-touch actions, takes an array of objects with the following
|
118 | * @param {string} type (optional) A type that can be used `onHomeIconPressed` callback
|
119 | * @param {string} title Title for your action
|
120 | * @param {string} subtitle (optional) A short description for your action
|
121 | * @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
|
122 | * @param {string} iconTemplate (optional) Can be used to provide your own icon
|
123 | */
|
124 | static configureQuickActions(quickActions: Array<ThreeDeeTouchQuickAction>): void;
|
125 | /**
|
126 | * When a home icon is pressed, your app launches and this JS callback is invoked.
|
127 | * @returns {Observable<any>} returns an observable that notifies you when he user presses on the home screen icon
|
128 | */
|
129 | static onHomeIconPressed(): Observable<any>;
|
130 | /**
|
131 | * Enable Link Preview.
|
132 | * UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
|
133 | */
|
134 | static enableLinkPreview(): void;
|
135 | /**
|
136 | * Disabled the link preview feature, if enabled.
|
137 | */
|
138 | static disableLinkPreview(): void;
|
139 | }
|