-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(instagram): add instagram sharing plugin (#453)
Closes #307
- Loading branch information
1 parent
14e41a3
commit f3e698f
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import {Plugin, Cordova} from './plugin'; | ||
|
||
/** | ||
* @name Instagram | ||
* @description Share a photo with the instagram app | ||
* | ||
* @usage | ||
* ``` | ||
* import {Instagram} from 'ionic-native'; | ||
* | ||
* Instagram.share('data:image/png;uhduhf3hfif33', 'Caption') | ||
* .then(() => console.log('Shared!')) | ||
* .catch((error: any) => console.error(error)); | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
plugin: 'cordova-instagram-plugin', | ||
pluginRef: 'Instagram', | ||
repo: 'https://github.com/vstirbu/InstagramPlugin' | ||
}) | ||
export class Instagram { | ||
|
||
/** | ||
* Detect if the Instagram application is installed on the device. | ||
* | ||
* @return {Promise<boolean|string>} Returns a promise that returns a boolean value if installed, or the app version on android | ||
*/ | ||
@Cordova({ | ||
callbackStyle: 'node' | ||
}) | ||
static 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 | ||
* @return {Promise<any>} Returns a promise that resolves if the image was shared | ||
*/ | ||
@Cordova({ | ||
callbackStyle: 'node' | ||
}) | ||
static share(canvasIdOrDataUrl: string, caption?: string): Promise<any> {return;} | ||
|
||
/** | ||
* Share a library asset or video | ||
* @param assetLocalIdentifier A local fileURI | ||
* @return {Promise<any>} Returns a promise that resolves if the image was shared | ||
*/ | ||
@Cordova({ | ||
callbackOrder: 'reverse' | ||
}) | ||
static shareAsset(assetLocalIdentifier: string): Promise<any> {return;} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters