-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
index.ts
71 lines (66 loc) · 1.95 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
/**
* @name Instagram
* @description Share a photo with the instagram app
*
* @usage
* ```typescript
* import { Instagram } from '@ionic-native/instagram';
*
* constructor(private instagram: Instagram) { }
*
* ...
*
* this.instagram.share('data:image/png;uhduhf3hfif33', 'Caption')
* .then(() => console.log('Shared!'))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
pluginName: 'Instagram',
plugin: 'cordova-instagram-plugin',
pluginRef: 'Instagram',
repo: 'https://github.com/vstirbu/InstagramPlugin',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Instagram extends IonicNativePlugin {
/**
* Detect if the Instagram application is installed on the device.
*
* @returns {Promise<boolean|string>} Returns a promise that returns a boolean value if installed, or the app version on android
*/
@Cordova({
callbackStyle: 'node'
})
isInstalled(): Promise<boolean | string> {
return;
}
/**
* Share an image on Instagram
* 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.
*
* @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share
* @param caption The caption of the image
* @returns {Promise<any>} Returns a promise that resolves if the image was shared
*/
@Cordova({
callbackStyle: 'node'
})
share(canvasIdOrDataUrl: string, caption?: string): Promise<any> {
return;
}
/**
* Share a library asset or video
* @param assetLocalIdentifier A local fileURI
* @returns {Promise<any>} Returns a promise that resolves if the image was shared
*/
@Cordova({
callbackOrder: 'reverse'
})
shareAsset(assetLocalIdentifier: string): Promise<any> {
return;
}
}