mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-16 00:00:02 +08:00
Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0fd19fd33 | ||
|
|
f2c4f380f8 | ||
|
|
c96ae3db0d | ||
|
|
c2a6198576 | ||
|
|
2b3d4c9090 | ||
|
|
dbb17d801e | ||
|
|
0b1e4e6e84 | ||
|
|
8c82c87811 | ||
|
|
9997caf506 | ||
|
|
c8f53d2dc3 | ||
|
|
a10d763a41 | ||
|
|
e44fdb6730 | ||
|
|
bb8973a0ea | ||
|
|
6031a240a2 | ||
|
|
2bd244a536 | ||
|
|
64bff1bbed | ||
|
|
da5266cd65 | ||
|
|
c1082b1c14 | ||
|
|
2cf132ee88 | ||
|
|
e411146e8f | ||
|
|
5f63493bdc | ||
|
|
999c288b23 | ||
|
|
2e83ade978 | ||
|
|
08bf57f488 | ||
|
|
6f6392ea5c | ||
|
|
0b2227d35a | ||
|
|
4bfceadb65 | ||
|
|
61c73eaa4e | ||
|
|
c0c0c5cec5 | ||
|
|
5b82d82d75 | ||
|
|
36be795623 | ||
|
|
0996264483 | ||
|
|
2245bb8050 | ||
|
|
e14e00edba | ||
|
|
22102a7e4a | ||
|
|
6416c2544c | ||
|
|
73a510f9c2 | ||
|
|
b8b605db5e | ||
|
|
12168d991a | ||
|
|
93a119bf4b | ||
|
|
a7c62de389 | ||
|
|
8aca6718e1 | ||
|
|
1ec4bdef8f | ||
|
|
d6ed87d7cc | ||
|
|
55f3f37760 | ||
|
|
4f547dae30 |
76
CHANGELOG.md
76
CHANGELOG.md
@@ -1,3 +1,79 @@
|
||||
<a name="3.10.2"></a>
|
||||
## [3.10.2](https://github.com/driftyco/ionic-native/compare/v3.10.1...v3.10.2) (2017-05-20)
|
||||
|
||||
|
||||
|
||||
<a name="3.10.1"></a>
|
||||
## [3.10.1](https://github.com/driftyco/ionic-native/compare/v3.10.0...v3.10.1) (2017-05-20)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **core:** add getSupportedPlatforms method ([c8f53d2](https://github.com/driftyco/ionic-native/commit/c8f53d2))
|
||||
|
||||
|
||||
|
||||
<a name="3.10.0"></a>
|
||||
# [3.10.0](https://github.com/driftyco/ionic-native/compare/v3.9.2...v3.10.0) (2017-05-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **admob-free:** use otherPromise to fix browser development ([2bd244a](https://github.com/driftyco/ionic-native/commit/2bd244a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **native-keyboard:** add native keyboard plugin (#1588) ([6031a24](https://github.com/driftyco/ionic-native/commit/6031a24))
|
||||
* **user-agent:** add User-Agent plugin (#1582) ([6f6392e](https://github.com/driftyco/ionic-native/commit/6f6392e))
|
||||
|
||||
|
||||
|
||||
<a name="3.9.2"></a>
|
||||
## [3.9.2](https://github.com/driftyco/ionic-native/compare/v3.9.1...v3.9.2) (2017-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **action-sheet:** destructiveButtonLast is optional ([6416c25](https://github.com/driftyco/ionic-native/commit/6416c25))
|
||||
* **core:** decorators should define enumerable properties ([22102a7](https://github.com/driftyco/ionic-native/commit/22102a7))
|
||||
|
||||
|
||||
|
||||
<a name="3.9.1"></a>
|
||||
## [3.9.1](https://github.com/driftyco/ionic-native/compare/v3.9.0...v3.9.1) (2017-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **core:** fix issues when clearing observables ([93a119b](https://github.com/driftyco/ionic-native/commit/93a119b))
|
||||
|
||||
|
||||
|
||||
<a name="3.9.0"></a>
|
||||
# [3.9.0](https://github.com/driftyco/ionic-native/compare/v3.8.1...v3.9.0) (2017-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **android-permissions:** fix PERMISSION property and add requestPermission ([ebf4028](https://github.com/driftyco/ionic-native/commit/ebf4028)), closes [#1574](https://github.com/driftyco/ionic-native/issues/1574)
|
||||
* **app-preferences:** suite is sync ([3cb8383](https://github.com/driftyco/ionic-native/commit/3cb8383)), closes [#1321](https://github.com/driftyco/ionic-native/issues/1321)
|
||||
* **background-mode:** configure doesn't return anything ([92ef4f0](https://github.com/driftyco/ionic-native/commit/92ef4f0)), closes [#1457](https://github.com/driftyco/ionic-native/issues/1457)
|
||||
* **in-app-browser:** fix on method ([975a65d](https://github.com/driftyco/ionic-native/commit/975a65d)), closes [#1446](https://github.com/driftyco/ionic-native/issues/1446)
|
||||
* **media:** create should return null if plugin is not available ([d68618f](https://github.com/driftyco/ionic-native/commit/d68618f))
|
||||
* **media:** create will always return MediaObject even if plugin doesnt exist ([ee4b61e](https://github.com/driftyco/ionic-native/commit/ee4b61e))
|
||||
* **printer:** fix implementation and add pick method ([55071c0](https://github.com/driftyco/ionic-native/commit/55071c0))
|
||||
* **push:** fix types ([ca76593](https://github.com/driftyco/ionic-native/commit/ca76593)), closes [#1331](https://github.com/driftyco/ionic-native/issues/1331)
|
||||
* **secure-storage:** reject the promise if the plugin doesn't exist (#1562) ([d5919d1](https://github.com/driftyco/ionic-native/commit/d5919d1))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **linkedin:** add getActiveSession method ([4c8deb2](https://github.com/driftyco/ionic-native/commit/4c8deb2)), closes [#1570](https://github.com/driftyco/ionic-native/issues/1570)
|
||||
* **printer:** add check method ([991f2f0](https://github.com/driftyco/ionic-native/commit/991f2f0))
|
||||
|
||||
|
||||
|
||||
<a name="3.8.1"></a>
|
||||
## [3.8.1](https://github.com/driftyco/ionic-native/compare/v3.8.0...v3.8.1) (2017-05-16)
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ jobs:
|
||||
- run:
|
||||
name: Run tslint
|
||||
command: npm run lint
|
||||
- run: bash ./scripts/git/config.sh
|
||||
- run:
|
||||
name: Build changed plugins
|
||||
command: node scripts/ci-tests.js
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "3.8.1",
|
||||
"version": "3.10.2",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
|
||||
2
scripts/git/config.sh
Normal file
2
scripts/git/config.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
git config --global user.email "hi@ionicframework.com"
|
||||
git config --global user.name "Ionitron"
|
||||
@@ -24,7 +24,8 @@ class TestObject {
|
||||
pluginName: 'TestPlugin',
|
||||
pluginRef: 'testPlugin',
|
||||
repo: '',
|
||||
plugin: 'cordova-plugin-my-plugin'
|
||||
plugin: 'cordova-plugin-my-plugin',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
class TestPlugin extends IonicNativePlugin {
|
||||
|
||||
@@ -85,6 +86,10 @@ describe('Regular Decorators', () => {
|
||||
expect(TestPlugin.getPlugin()).toEqual(window.testPlugin);
|
||||
});
|
||||
|
||||
it('should return supported platforms', () => {
|
||||
expect(TestPlugin.getSupportedPlatforms()).toEqual(['Android', 'iOS']);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Cordova', () => {
|
||||
|
||||
@@ -135,7 +135,8 @@ export function InstanceCheck(opts: CordovaCheckOptions = {}) {
|
||||
return getPromise(() => { });
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -159,7 +160,8 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
|
||||
}
|
||||
return Promise.reject(check && check.error);
|
||||
}
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -239,7 +241,8 @@ export function Cordova(opts: CordovaOptions = {}) {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return wrap(this, methodName, opts).apply(this, args);
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -254,7 +257,8 @@ export function CordovaInstance(opts: any = {}) {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return wrapInstance(this, methodName, opts).apply(this, args);
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -312,7 +316,8 @@ export function CordovaFunctionOverride(opts: any = {}) {
|
||||
return {
|
||||
value: function(...args: any[]) {
|
||||
return overrideFunction(this, methodName, opts);
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -348,7 +353,8 @@ export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {
|
||||
wrappedSubscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,4 +38,9 @@ export class IonicNativePlugin {
|
||||
*/
|
||||
static getPluginInstallName(): string { return; }
|
||||
|
||||
/**
|
||||
* Returns the plugin's supported platforms
|
||||
*/
|
||||
static getSupportedPlatforms(): string[] { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { get, getPlugin, getPromise, cordovaWarn, pluginWarn } from './util';
|
||||
import { getPlugin, getPromise, cordovaWarn, pluginWarn } from './util';
|
||||
import { checkReady } from './bootstrap';
|
||||
import { CordovaOptions } from './decorators';
|
||||
|
||||
@@ -177,11 +177,11 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
|
||||
if (opts.clearWithArgs) {
|
||||
return callCordovaPlugin(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
}
|
||||
return get(window, pluginObj.constructor.getPluginRef())[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
return callCordovaPlugin(pluginObj, opts.clearFunction, []);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
|
||||
console.error(e);
|
||||
console.warn(e);
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -276,12 +276,12 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
||||
return () => {
|
||||
try {
|
||||
if (opts.clearWithArgs) {
|
||||
return pluginObj._objectInstance[opts.clearFunction].apply(pluginObj._objectInstance, args);
|
||||
return callInstance(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
|
||||
}
|
||||
return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult);
|
||||
return callInstance(pluginObj, opts.clearFunction, []);
|
||||
} catch (e) {
|
||||
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
|
||||
console.error(e);
|
||||
console.warn(e);
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -290,23 +290,16 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
||||
|
||||
return getPromise((resolve: Function, reject: Function) => {
|
||||
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
if (result && !result.error) {
|
||||
if (result && !!result.then) {
|
||||
result.then(resolve, reject);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
let pluginResult: any, rej: Function;
|
||||
const p = getPromise((resolve: Function, reject: Function) => {
|
||||
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
|
||||
rej = reject;
|
||||
});
|
||||
if (pluginResult && pluginResult.error) {
|
||||
p.catch(() => { });
|
||||
typeof rej === 'function' && rej(pluginResult.error);
|
||||
}
|
||||
return p;
|
||||
return getPromise((resolve: Function, reject: Function) => callInstance(pluginObj, methodName, args, opts, resolve, reject));
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ export interface ActionSheetOptions {
|
||||
/**
|
||||
* Choose if destructive button will be the last
|
||||
*/
|
||||
destructiveButtonLast: boolean;
|
||||
destructiveButtonLast?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,6 +96,14 @@ export interface AdMobFreeRewardVideoConfig {
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* AdMobFreeBannerConfig
|
||||
* AdMobFreeInterstitialConfig
|
||||
* AdMobFreeRewardVideoConfig
|
||||
* @classes
|
||||
* AdMobFreeBanner
|
||||
* AdMobFreeInterstitial
|
||||
* AdMobFreeRewardVideo
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AdMobFree',
|
||||
@@ -108,9 +116,10 @@ export interface AdMobFreeRewardVideoConfig {
|
||||
export class AdMobFree extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Convenience constructor to get event names
|
||||
* Convenience object to get event names
|
||||
* @type {Object}
|
||||
*/
|
||||
events = {
|
||||
events: any = {
|
||||
BANNER_LOAD: 'admob.banner.events.LOAD',
|
||||
BANNER_LOAD_FAIL: 'admob.banner.events.LOAD_FAIL',
|
||||
BANNER_OPEN: 'admob.banner.events.OPEN',
|
||||
@@ -142,19 +151,19 @@ export class AdMobFree extends IonicNativePlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the AdMobFreeBanner object
|
||||
* @type {AdMobFreeBanner}
|
||||
*/
|
||||
banner: AdMobFreeBanner = new AdMobFreeBanner();
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the AdMobFreeInterstitial object
|
||||
* @type {AdMobFreeInterstitial}
|
||||
*/
|
||||
interstitial: AdMobFreeInterstitial = new AdMobFreeInterstitial();
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the AdMobFreeRewardVideo object
|
||||
* @type {AdMobFreeRewardVideo}
|
||||
*/
|
||||
rewardVideo: AdMobFreeRewardVideo = new AdMobFreeRewardVideo();
|
||||
@@ -183,28 +192,28 @@ export class AdMobFreeBanner {
|
||||
* Hide the banner.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
hide(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Create banner.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
prepare(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Remove the banner.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
remove(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show the banner.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
show(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -231,21 +240,21 @@ export class AdMobFreeInterstitial {
|
||||
* Check if interstitial is ready
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
isReady(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Prepare interstitial
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
prepare(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show the interstitial
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
show(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -272,21 +281,21 @@ export class AdMobFreeRewardVideo {
|
||||
* Check if reward video is ready
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
isReady(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Prepare reward video
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
prepare(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Show the reward video
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
@Cordova({ otherPromise: true })
|
||||
show(): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@ export interface AdExtras {
|
||||
* @name AdMob
|
||||
* @description
|
||||
* Plugin for Google Ads, including AdMob / DFP (doubleclick for publisher) and mediations to other Ad networks.
|
||||
*
|
||||
* IMPORTANT NOTICE: this plugin takes a percentage out of your earnings if you profit more than $1,000. Read more about this on the plugin's repo. For a completely free alternative, see [AdMob Free](../admob-free).
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AdMob } from '@ionic-native/admob';
|
||||
|
||||
@@ -102,7 +102,7 @@ export interface AlipayOrder {
|
||||
pluginRef: 'Alipay.Base',
|
||||
repo: 'https://github.com/xueron/cordova-alipay-base',
|
||||
platforms: ['Android', 'iOS'],
|
||||
install: 'ionic plugin add https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id'
|
||||
install: 'ionic cordova plugin add https://github.com/xueron/cordova-alipay-base --variable APP_ID=your_app_id'
|
||||
})
|
||||
@Injectable()
|
||||
export class Alipay extends IonicNativePlugin {
|
||||
|
||||
@@ -79,7 +79,7 @@ export interface DeeplinkMatch {
|
||||
pluginRef: 'IonicDeeplink',
|
||||
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
|
||||
platforms: ['iOS', 'Android', 'Browser'],
|
||||
install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/',
|
||||
install: 'ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/',
|
||||
installVariables: ['URL_SCHEME', 'DEEPLINK_SCHEME', 'DEEPLINK_HOST', 'ANDROID_PATH_PREFIX']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -43,7 +43,7 @@ export interface FacebookLoginResponse {
|
||||
* Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
|
||||
*
|
||||
* ```bash
|
||||
* ionic plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
|
||||
* ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"
|
||||
* ```
|
||||
*
|
||||
* 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:
|
||||
@@ -114,7 +114,7 @@ export interface FacebookLoginResponse {
|
||||
plugin: 'cordova-plugin-facebook4',
|
||||
pluginRef: 'facebookConnectPlugin',
|
||||
repo: 'https://github.com/jeduan/cordova-plugin-facebook4',
|
||||
install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"',
|
||||
install: 'ionic cordova plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"',
|
||||
installVariables: ['APP_ID', 'APP_NAME'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface NotificationData {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { FCM } from 'ionic-native';
|
||||
* import { FCM } from '@ionic-native/fcm';
|
||||
*
|
||||
* constructor(private fcm: FCM) {}
|
||||
*
|
||||
@@ -38,7 +38,7 @@ export interface NotificationData {
|
||||
* })
|
||||
*
|
||||
* fcm.onNotification().subscribe(data=>{
|
||||
* if(data.wasPressed){
|
||||
* if(data.wasTapped){
|
||||
* console.log("Received in background");
|
||||
* } else {
|
||||
* console.log("Received in foreground");
|
||||
|
||||
@@ -400,6 +400,7 @@ export interface RemoveResult {
|
||||
fileRemoved: Entry;
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
export declare class FileSaver extends EventTarget {
|
||||
/**
|
||||
* When the FileSaver constructor is called, the user agent must return a new FileSaver object with readyState set to INIT.
|
||||
@@ -489,6 +490,7 @@ export declare class FileSaver extends EventTarget {
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
* This interface expands on the FileSaver interface to allow for multiple write actions, rather than just saving a single Blob.
|
||||
*/
|
||||
export declare class FileWriter extends FileSaver {
|
||||
@@ -528,6 +530,7 @@ export interface IWriteOptions {
|
||||
truncate?: number; // if present, number of bytes to truncate file to before writing
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
export declare class FileError {
|
||||
constructor(code: number);
|
||||
static NOT_FOUND_ERR: number;
|
||||
@@ -547,6 +550,7 @@ export declare class FileError {
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
export declare class FileReader {
|
||||
static EMPTY: number;
|
||||
static LOADING: number;
|
||||
|
||||
@@ -72,6 +72,9 @@ export interface FlurryAnalyticsLocation {
|
||||
horizontalAccuracy?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
export class FlurryAnalyticsObject {
|
||||
|
||||
constructor(private _objectInstance: any) { }
|
||||
|
||||
@@ -853,14 +853,14 @@ export class Marker {
|
||||
|
||||
/**
|
||||
* Set the marker position.
|
||||
* @param latLng {GoogleMapLatLng}
|
||||
* @param latLng {LatLng}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setPosition(latLng: LatLng): void { return; }
|
||||
|
||||
/**
|
||||
* Return the marker position.
|
||||
* @return {Promise<GoogleMapLatLng>}
|
||||
* @return {Promise<LatLng>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getPosition(): Promise<LatLng> { return; }
|
||||
|
||||
@@ -24,7 +24,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
pluginRef: 'window.plugins.googleplus',
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus',
|
||||
platforms: ['Web', 'Android', 'iOS'],
|
||||
install: 'ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid',
|
||||
install: 'ionic cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid',
|
||||
installVariables: ['REVERSED_CLIENT_ID']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -52,8 +52,8 @@ export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress' | 'rw_comp
|
||||
pluginName: 'LinkedIn',
|
||||
plugin: 'cordova-plugin-linkedin',
|
||||
pluginRef: 'cordova.plugins.LinkedIn',
|
||||
repo: 'https://github.com/zyramedia/cordova-plugin-linkedin',
|
||||
install: 'ionic plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID',
|
||||
repo: 'https://github.com/zyra/cordova-plugin-linkedin',
|
||||
install: 'ionic cordova plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Native Geocoder
|
||||
* @description
|
||||
* Cordova plugin for native forward and reverse geocoding
|
||||
|
||||
244
src/@ionic-native/plugins/native-keyboard/index.ts
Normal file
244
src/@ionic-native/plugins/native-keyboard/index.ts
Normal file
@@ -0,0 +1,244 @@
|
||||
import { Plugin, IonicNativePlugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
export interface NativeKeyboardOptions {
|
||||
|
||||
/**
|
||||
* A function invoked when the user submits his input. Receives the text as a single property. Make sure your page is UTF-8 encoded so Chinese and Emoji are rendered OK.
|
||||
*/
|
||||
onSubmit: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when the keyboard is about to pop up. Receives the height as a single property. (iOS only)
|
||||
*/
|
||||
onKeyboardWillShow: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when the keyboard popped up. Receives the height as a single property.
|
||||
*/
|
||||
onKeyboardDidShow: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when the keyboard is about to close. (iOS only)
|
||||
*/
|
||||
onKeyboardWillHide: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when the keyboard closed.
|
||||
*/
|
||||
onKeyboardDidHide: Function;
|
||||
|
||||
/**
|
||||
* A function invoked when any key is pressed, sends the entire text as response.
|
||||
*/
|
||||
onTextChanged: Function;
|
||||
|
||||
/**
|
||||
* Highly recommended to pass in if you want to replicate the behavior of the video's above (scroll down when the keyboard opens). Pass in the scrollable DOM element containing the messages.
|
||||
*/
|
||||
autoscrollElement: HTMLElement;
|
||||
|
||||
/**
|
||||
* If `autoscrollElement` was set you can also make the list scroll down initially, when the messenger bar (without the keyboard popping up) is shown.
|
||||
*/
|
||||
scrollToBottomAfterMessengerShows: boolean;
|
||||
|
||||
/**
|
||||
* Setting this to `true` is like the video's above: the keyboard doesn't close upon submit. Defaults to `false`.
|
||||
*/
|
||||
keepOpenAfterSubmit: boolean;
|
||||
|
||||
/**
|
||||
* Makes the messenger bar slide in from the bottom. Defaults to `false`.
|
||||
*/
|
||||
animated: boolean;
|
||||
|
||||
/**
|
||||
* Open the keyboard when showing the messenger. Defaults to `false`.
|
||||
*/
|
||||
showKeyboard: boolean;
|
||||
|
||||
/**
|
||||
* The default text set in the messenger input bar.
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* The color of the typed text. Defaults to `#444444`.
|
||||
*/
|
||||
textColor: string;
|
||||
|
||||
/**
|
||||
* Like a regular HTML input placeholder.
|
||||
*/
|
||||
placeholder: string;
|
||||
|
||||
/**
|
||||
* The color of the placeholder text. Defaults to `#CCCCCC`.
|
||||
*/
|
||||
placeholderColor: string;
|
||||
|
||||
/**
|
||||
* The background color of the messenger bar. Defaults to `#F6F6F6`.
|
||||
*/
|
||||
backgroundColor: string;
|
||||
|
||||
/**
|
||||
* The background color of the textview. Looks nicest on Android if it's the same color as the `backgroundColor` property. Defaults to `#F6F6F6`.
|
||||
*/
|
||||
textViewBackgroundColor: string;
|
||||
|
||||
/**
|
||||
* The border color of the textview. Defaults to `#666666`. (iOS only)
|
||||
*/
|
||||
textViewBorderColor: string;
|
||||
|
||||
/**
|
||||
* Setting this > 0 will make a counter show up on iOS (and ignore superfluous input on Android, for now)
|
||||
*/
|
||||
maxChars: number;
|
||||
|
||||
/**
|
||||
* Options are: `"none"`, `"split"`, `"countdown"`, `"countdownreversed"`. Note that if `maxChars` is set, `"none"` will still show a counter. Defaults to `"none"`. (iOS only)
|
||||
*/
|
||||
counterStyle: string;
|
||||
|
||||
/**
|
||||
* Options are: "default", "decimalpad", "phonepad", "numberpad", "namephonepad", "number", "email", "twitter", "url", "alphabet", "search", "ascii". (iOS only)
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* Options are: "light", "dark". (iOS only)
|
||||
*/
|
||||
appearance: string;
|
||||
|
||||
/**
|
||||
* Disables things like the Emoji keyboard and the Predicive text entry bar (iOS only)
|
||||
*/
|
||||
secure: boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
leftButton: NativeKeyboardLeftButton;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
rightButton: NativeKeyboardButton;
|
||||
|
||||
}
|
||||
|
||||
export interface NativeKeyboardButton {
|
||||
/**
|
||||
* Either "text" (Android only currently), "fontawesome" or "ionicon".
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* Depends on the type. Examples: for "text" use "Send", for "fontawesome" use "fa-battery-quarter", for "ionicon" use "\uf48a" (go to http://ionicons.com, right-click and inspect the icon and use the value you find in :before). Note that some fonticons are not supported as the embedded fonts in the plugin may lag behind a little. So try one of the older icons first.
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* If type is "text" you can set this to either "normal", "bold" or "italic".
|
||||
*/
|
||||
textStyle: string;
|
||||
/**
|
||||
* A function invoked when the button is pressed. Use this button to prompt the user what he wants to do next by for instance rendering an ActionSheet.
|
||||
*/
|
||||
onPress: Function;
|
||||
}
|
||||
|
||||
export interface NativeKeyboardLeftButton extends NativeKeyboardButton {
|
||||
/**
|
||||
* Set to `true` to disable the button once text has been entered.
|
||||
*/
|
||||
disabledWhenTextEntered: boolean;
|
||||
}
|
||||
|
||||
export interface NativeKeyboardUpdateMessengerOptions {
|
||||
/**
|
||||
* Replace the messenger's text by this. The current text remains if omitted.
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Position the cursor anywhere in the text range. Defaults to the end of the text.
|
||||
*/
|
||||
caretIndex: number;
|
||||
/**
|
||||
* If `false` or omitted no changes to the keyboard state are made.
|
||||
*/
|
||||
showKeyboard: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Native Keyboard
|
||||
* @description
|
||||
* A cross platform WhatsApp / Messenger / Slack -style keyboard even. For your Cordova app.
|
||||
*
|
||||
*
|
||||
* IMPORTANT NOTICE: this plugin is paid, please read more about this at the [plugin's repo](https://github.com/EddyVerbruggen/cordova-plugin-native-keyboard#i-like-it-hook-me-up).
|
||||
*
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { NativeKeyboard } from '@ionic-native/native-keyboard';
|
||||
*
|
||||
*
|
||||
* constructor(private nativeKeyboard: NativeKeyboard) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* NativeKeyboardOptions
|
||||
* NativeKeyboardButton
|
||||
* NativeKeyboardLeftButton
|
||||
* NativeKeyboardUpdateMessengerOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'NativeKeyboard',
|
||||
plugin: 'cordova-plugin-native-keyboard',
|
||||
pluginRef: 'NativeKeyboard',
|
||||
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-native-keyboard',
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class NativeKeyboard extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Show messenger
|
||||
* @param options {NativeKeyboardOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
showMessenger(options: NativeKeyboardOptions): void {}
|
||||
|
||||
/**
|
||||
* Hide messenger
|
||||
* @param options {NativeKeyboardOptions}
|
||||
*/
|
||||
@Cordova({ sync: true })
|
||||
hideMessenger(options: NativeKeyboardOptions): void {}
|
||||
|
||||
/**
|
||||
* Programmatically pop up the keyboard again if the user dismissed it.
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
showMessengerKeyboard(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Programmatically hide the keyboard (but not the messenger bar)
|
||||
*/
|
||||
@Cordova()
|
||||
hideMessengerKeyboard(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Manipulate the messenger while it's open. For instance if you want to update the text programmatically based on what the user typed.
|
||||
* @param options
|
||||
*/
|
||||
@Cordova()
|
||||
updateMessenger(options: NativeKeyboardUpdateMessengerOptions): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/merge';
|
||||
|
||||
|
||||
declare var navigator: any;
|
||||
declare const navigator: any;
|
||||
|
||||
/**
|
||||
* @name Network
|
||||
@@ -30,9 +30,9 @@ declare var navigator: any;
|
||||
*
|
||||
* // watch network for a connection
|
||||
* let connectSubscription = this.network.onConnect().subscribe(() => {
|
||||
* console.log('network connected!');
|
||||
* console.log('network connected!');
|
||||
* // We just got a connection but we need to wait briefly
|
||||
*
// before we determine the connection type. Might need to wait
|
||||
*
// before we determine the connection type. Might need to wait.
|
||||
* // prior to doing any api requests as well.
|
||||
* setTimeout(() => {
|
||||
* if (this.network.type === 'wifi') {
|
||||
|
||||
@@ -44,7 +44,7 @@ import { Injectable } from '@angular/core';
|
||||
plugin: 'cordova-plugin-photo-library',
|
||||
pluginRef: 'cordova.plugins.photoLibrary',
|
||||
repo: 'https://github.com/terikon/cordova-plugin-photo-library',
|
||||
install: 'ionic plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"',
|
||||
install: 'ionic cordova plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"',
|
||||
platforms: ['Android', 'Browser', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -172,7 +172,7 @@ export interface PinterestPin {
|
||||
plugin: 'cordova-plugin-pinterest',
|
||||
pluginRef: 'cordova.plugins.Pinterest',
|
||||
repo: 'https://github.com/zyramedia/cordova-plugin-pinterest',
|
||||
install: 'ionic plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID',
|
||||
install: 'ionic cordova plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID',
|
||||
installVariables: ['APP_ID'],
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
|
||||
@@ -264,7 +264,7 @@ export type PushEvent = 'registration' | 'error' | 'notification';
|
||||
plugin: 'phonegap-plugin-push',
|
||||
pluginRef: 'PushNotification',
|
||||
repo: 'https://github.com/phonegap/phonegap-plugin-push',
|
||||
install: 'ionic plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX',
|
||||
install: 'ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX',
|
||||
installVariables: ['SENDER_ID']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -25,7 +25,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
pluginRef: 'cordova.plugins.Rollbar',
|
||||
repo: 'https://github.com/Resgrid/cordova-plugins-rollbar',
|
||||
platforms: ['Android', 'iOS'],
|
||||
install: 'ionic plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN="YOUR_ROLLBAR_ACCEESS_TOKEN" --variable ROLLBAR_ENVIRONMENT="ROLLBAR_ENVIRONMENT"',
|
||||
install: 'ionic cordova plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN="YOUR_ROLLBAR_ACCEESS_TOKEN" --variable ROLLBAR_ENVIRONMENT="ROLLBAR_ENVIRONMENT"',
|
||||
installVariables: ['ROLLBAR_ACCESS_TOKEN', 'ROLLBAR_ENVIRONMENT']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
@@ -120,17 +120,8 @@ export class SecureStorage extends IonicNativePlugin {
|
||||
*/
|
||||
@CordovaCheck()
|
||||
create(store: string): Promise<SecureStorageObject> {
|
||||
<<<<<<< HEAD
|
||||
return new Promise((res: Function, rej: Function) => {
|
||||
const instance = new (SecureStorage.getPlugin())(() => res(new SecureStorageObject(instance)), rej, store);
|
||||
=======
|
||||
return new Promise((res, rej) => {
|
||||
if (checkAvailability('cordova.plugins.SecureStorage', null, 'SecureStorage') === true) {
|
||||
const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store);
|
||||
} else {
|
||||
rej('SecureStorage failure: cordova plugin is not available');
|
||||
}
|
||||
>>>>>>> 5145395dd7bea7d2fb81b11b356a4a7497c607e7
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ export interface SpeechRecognitionListeningOptionsAndroid {
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @name Speech Recognition
|
||||
* @description
|
||||
* This plugin does speech recognition using cloud services
|
||||
|
||||
@@ -42,14 +42,14 @@ export class TextToSpeech extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* This function speaks
|
||||
* @param options {string | TTSOptions} Text to speak or TTSOptions
|
||||
* @param textOrOptions {string | TTSOptions} Text to speak or TTSOptions
|
||||
* @return {Promise<any>} Returns a promise that resolves when the speaking finishes
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
speak(options: string | TTSOptions): Promise<any> {
|
||||
speak(textOrOptions: string | TTSOptions): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ export interface TwitterConnectResponse {
|
||||
plugin: 'twitter-connect-plugin',
|
||||
pluginRef: 'TwitterConnect',
|
||||
repo: 'https://github.com/ManifestWebDesign/twitter-connect-plugin',
|
||||
install: 'ionic plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key',
|
||||
install: 'ionic cordova plugin add twitter-connect-plugin --variable FABRIC_KEY=fabric_API_key',
|
||||
installVariables: ['FABRIC_KEY']
|
||||
})
|
||||
@Injectable()
|
||||
|
||||
73
src/@ionic-native/plugins/user-agent/index.ts
Normal file
73
src/@ionic-native/plugins/user-agent/index.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name User Agent
|
||||
* @description
|
||||
* The UserAgent plugin provides functions to set the HTTP user-agent header. For more info about User-Agents, please [see the HTTP User-Agent docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent).
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-useragent`. For more info, please see the [User-Agent plugin docs](https://github.com/LouisT/cordova-useragent).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { UserAgent } from '@ionic-native/user-agent';
|
||||
*
|
||||
*
|
||||
* constructor(private userAgent: UserAgent) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.userAgent.set('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36')
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* * this.userAgent.get()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* * this.userAgent.reset()
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'UserAgent',
|
||||
plugin: 'https://github.com/LouisT/cordova-useragent',
|
||||
pluginRef: 'plugins.useragent',
|
||||
repo: 'https://github.com/LouisT/cordova-useragent',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class UserAgent extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Changes the current user-agent to the one sent by argument.
|
||||
* @param userAgent {string} User-Agent
|
||||
* @return {Promise<any>} Returns a promise that resolves when the user-agent changes
|
||||
*/
|
||||
@Cordova()
|
||||
set(userAgent: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current user-agent string.
|
||||
* @return {Promise<any>} Returns a promise that resolves when the user-agent is returned
|
||||
*/
|
||||
@Cordova()
|
||||
get(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user-agent back to default
|
||||
* @return {Promise<any>} Returns a promise that resolves when the user-agent resets
|
||||
*/
|
||||
@Cordova()
|
||||
reset(): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
export interface WheelSelectorItem {
|
||||
description: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface WheelSelectorOptions {
|
||||
@@ -44,6 +44,13 @@ export interface WheelSelectorOptions {
|
||||
* Default: false
|
||||
*/
|
||||
wrapWheelText?: boolean;
|
||||
|
||||
/**
|
||||
* The json key to display, by default it is description, this allows for setting any
|
||||
* key/value to be displayed
|
||||
* Default: description
|
||||
*/
|
||||
displayKey?: string;
|
||||
}
|
||||
|
||||
export interface WheelSelectorData {
|
||||
@@ -65,54 +72,95 @@ export interface WheelSelectorData {
|
||||
* ...
|
||||
*
|
||||
* let jsonData = {
|
||||
* numbers: [
|
||||
* { description: "1" },
|
||||
* { description: "2" },
|
||||
* { description: "3" }
|
||||
* ],
|
||||
* fruits: [
|
||||
* { description: "Apple" },
|
||||
* { description: "Banana" },
|
||||
* { description: "Tangerine" }
|
||||
* ],
|
||||
* };
|
||||
* numbers: [
|
||||
* { description: "1" },
|
||||
* { description: "2" },
|
||||
* { description: "3" }
|
||||
* ],
|
||||
* fruits: [
|
||||
* { description: "Apple" },
|
||||
* { description: "Banana" },
|
||||
* { description: "Tangerine" }
|
||||
* ],
|
||||
* firstNames: [
|
||||
* { name: "Fred", id: '1' },
|
||||
* { name: "Jane", id: '2' },
|
||||
* { name: "Bob", id: '3' },
|
||||
* { name: "Earl", id: '4' },
|
||||
* { name: "Eunice", id: '5' }
|
||||
* ],
|
||||
* lastNames: [
|
||||
* { name: "Johnson", id: '100' },
|
||||
* { name: "Doe", id: '101' },
|
||||
* { name: "Kinishiwa", id: '102' },
|
||||
* { name: "Gordon", id: '103' },
|
||||
* { name: "Smith", id: '104' }
|
||||
* ]
|
||||
* };
|
||||
*
|
||||
* //use most of the default values
|
||||
* this.selector.show({
|
||||
* title: "Select some Fruit",
|
||||
* items: [
|
||||
* jsonData.numbers,
|
||||
* jsonData.fruits
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log('Selected: ' + result[0].description + ' at index: ' + result[0].index
|
||||
* + ' and ' + result[1].description + ' at index: ' + result[1].index);
|
||||
* },
|
||||
* err => console.log('Error occurred while getting result: ', err)
|
||||
* );
|
||||
* ...
|
||||
*
|
||||
* ...
|
||||
* //basic number selection, index is always returned in the result
|
||||
* selectANumber() {
|
||||
* this.selector.show({
|
||||
* title: "How Many?",
|
||||
* items: [
|
||||
* this.jsonData.numbers
|
||||
* ],
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log(result[0].description + ' at index: ' + result[0].index);
|
||||
* },
|
||||
* err => console.log('Error: ', err)
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* //set some initial default values to display: "2", "Tangerine"
|
||||
* this.selector.show({
|
||||
* title: "Select some Fruit",
|
||||
* items: [
|
||||
* jsonData.numbers,
|
||||
* jsonData.fruits
|
||||
* ],
|
||||
* defaultItems: [
|
||||
* jsonData.numbers[1],
|
||||
* jsonData.fruits[2]
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log('Selected: ' + result[0].description + ' at index: ' + result[0].index
|
||||
* + ' and ' + result[1].description + ' at index: ' + result[1].index);
|
||||
* },
|
||||
* err => console.log('Error occurred while getting result: ', err)
|
||||
* );
|
||||
* //basic selection, setting initial displayed default values: '3' 'Banana'
|
||||
* selectFruit() {
|
||||
* this.selector.show({
|
||||
* title: "How Much?",
|
||||
* items: [
|
||||
* this.jsonData.numbers, this.jsonData.fruits
|
||||
* ],
|
||||
* positiveButtonText: "Ok",
|
||||
* negativeButtonText: "Nope",
|
||||
* defaultItems: [
|
||||
* this.jsonData.numbers[2], // '3'
|
||||
* this.jsonData.fruits[3] // 'Banana'
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log(result[0].description + ' ' + result[1].description);
|
||||
* },
|
||||
* err => console.log('Error: ' + JSON.stringify(err))
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* //more complex as overrides which key to display
|
||||
* //then retrieve properties from original data
|
||||
* selectNamesUsingDisplayKey() {
|
||||
* this.selector.show({
|
||||
* title: "Who?",
|
||||
* items: [
|
||||
* this.jsonData.firstNames, this.jsonData.lastNames
|
||||
* ],
|
||||
* displayKey: 'name',
|
||||
* defaultItems: [
|
||||
* this.jsonData.firstNames[2],
|
||||
* this.jsonData.lastNames[3]
|
||||
* ]
|
||||
* }).then(
|
||||
* result => {
|
||||
* console.log(result[0].name + ' (id= ' + this.jsonData.firstNames[result[0].index].id + '), ' +
|
||||
* result[1].name + ' (id=' + this.jsonData.lastNames[result[1].index].id + ')');
|
||||
* },
|
||||
* err => console.log('Error: ' + JSON.stringify(err))
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* ```
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user