mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-06-08 00:00:19 +08:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4aec187e8c | |||
| d9188446a0 | |||
| 7ae6e10375 | |||
| ea53a1923a | |||
| f45f34442a | |||
| 49de11e761 | |||
| c29aaca857 | |||
| 9241339b2c | |||
| 9c8b0ceda6 | |||
| 78c226e83d | |||
| ef148d2a68 | |||
| 7fa2f7f364 | |||
| 5ef96d4558 | |||
| e39810b7d0 | |||
| f211da7280 | |||
| c1398eb54b | |||
| 1e1aaad7aa | |||
| 54ef50178b | |||
| 6f7171d26b | |||
| cf75a53438 | |||
| 8ab1d13fb3 | |||
| dd250a6d17 | |||
| 9082c5efbf | |||
| b19f6d1ccd | |||
| abc90f2e6a | |||
| 717c1438c4 | |||
| 67e0713f18 |
@@ -1,3 +1,26 @@
|
||||
<a name="2.2.10"></a>
|
||||
## [2.2.10](https://github.com/driftyco/ionic-native/compare/v2.2.9...v2.2.10) (2016-12-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **contacts:** fix few bugs in Contacts ([#846](https://github.com/driftyco/ionic-native/issues/846)) ([b19f6d1](https://github.com/driftyco/ionic-native/commit/b19f6d1))
|
||||
* **sqlite:** add static constructor, and fix resolve type ([#697](https://github.com/driftyco/ionic-native/issues/697)) ([9082c5e](https://github.com/driftyco/ionic-native/commit/9082c5e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **actionsheet:** add ActionSheetOptions interface ([f211da7](https://github.com/driftyco/ionic-native/commit/f211da7))
|
||||
* **googlemap:** add disableAutoPan to GoogleMapsMarkerOptions ([cf75a53](https://github.com/driftyco/ionic-native/commit/cf75a53)), closes [#844](https://github.com/driftyco/ionic-native/issues/844)
|
||||
* **googlemaps:** add markerClick and infoClick to MarkerOptions ([6f7171d](https://github.com/driftyco/ionic-native/commit/6f7171d))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.9"></a>
|
||||
## [2.2.9](https://github.com/driftyco/ionic-native/compare/v2.2.8...v2.2.9) (2016-12-01)
|
||||
|
||||
|
||||
|
||||
<a name="2.2.8"></a>
|
||||
## [2.2.8](https://github.com/driftyco/ionic-native/compare/v2.2.7...v2.2.8) (2016-12-01)
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "2.2.8",
|
||||
"version": "2.2.11",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"main": "dist/es5/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
|
||||
+5
-5
@@ -30,7 +30,7 @@ docType: "<$ doc.docType $>"
|
||||
<@ if param.optional @><div><em>(optional)</em></div><@ endif @>
|
||||
</td>
|
||||
<td>
|
||||
<$ param.returnType | escape $>
|
||||
<code><$ param.returnType | escape $></code>
|
||||
</td>
|
||||
<td>
|
||||
<$ param.description | marked $>
|
||||
@@ -308,13 +308,13 @@ docType: "<$ doc.docType $>"
|
||||
<!-- other classes -->
|
||||
<@ for tag in doc.tags.tags -@>
|
||||
<@ if tag.tagName == 'classes' -@>
|
||||
<h2><a class="anchor" name="related-classes" href="#related-classes"></a>Related Classes</h2>
|
||||
<!--<h2><a class="anchor" name="related-classes" href="#related-classes"></a>Related Classes</h2>-->
|
||||
<@ set classes = tag.description.split('\n') @>
|
||||
<@ for item in classes -@>
|
||||
<@ if item.length > 1 @>
|
||||
<@ for export in doc.moduleDoc.exports -@>
|
||||
<@ if export.name == item @>
|
||||
<h3><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h3>
|
||||
<h2><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h2>
|
||||
<$ documentClass(export) $>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
@@ -327,11 +327,11 @@ docType: "<$ doc.docType $>"
|
||||
<!-- interfaces -->
|
||||
<@ for tag in doc.tags.tags -@>
|
||||
<@ if tag.tagName == 'interfaces' @>
|
||||
<h2><a class="anchor" name="interfaces" href="#interfaces"></a>Interfaces</h2>
|
||||
<!--<h2><a class="anchor" name="interfaces" href="#interfaces"></a>Interfaces</h2>-->
|
||||
<@ set interfaces = tag.description.split('\n') @>
|
||||
<@ for item in interfaces -@>
|
||||
<@ if item.length > 1 @>
|
||||
<h3><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h3>
|
||||
<h2><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h2>
|
||||
<$ interfaceTable(item) $>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
|
||||
@@ -24,7 +24,8 @@ function run {
|
||||
cd $SITE_DIR
|
||||
|
||||
# if no changes, don't commit
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
if ! git diff-index --quiet HEAD --
|
||||
then
|
||||
echo "-- No changes detected for the following commit, docs not updated."
|
||||
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
|
||||
else
|
||||
@@ -37,7 +38,7 @@ function run {
|
||||
git fetch
|
||||
git rebase
|
||||
|
||||
git push origin master
|
||||
git push origin master || :
|
||||
|
||||
echo "-- Updated docs for $VERSION_NAME succesfully!"
|
||||
fi
|
||||
|
||||
+39
-28
@@ -12,7 +12,6 @@ import { Cordova, Plugin } from './plugin';
|
||||
* ```typescript
|
||||
* import { ActionSheet } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* let buttonLabels = ['Share via Facebook', 'Share via Twitter'];
|
||||
* ActionSheet.show({
|
||||
* 'title': 'What do you want with this image?',
|
||||
@@ -23,22 +22,8 @@ import { Cordova, Plugin } from './plugin';
|
||||
* console.log('Button pressed: ' + buttonIndex);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @advanced
|
||||
* ActionSheet options
|
||||
*
|
||||
* | Option | Type | Description |
|
||||
* |-------------------------------|-----------|----------------------------------------------|
|
||||
* | title |`string` | The title for the actionsheet |
|
||||
* | buttonLabels |`string[]` | the labels for the buttons. Uses the index x |
|
||||
* | androidTheme |`number` | Theme to be used on Android |
|
||||
* | androidEnableCancelButton |`boolean` | Enable a cancel on Android |
|
||||
* | winphoneEnableCancelButton |`boolean` | Enable a cancel on Windows Phone |
|
||||
* | addCancelButtonWithLabel |`string` | Add a cancel button with text |
|
||||
* | addDestructiveButtonWithLabel |`string` | Add a destructive button with text |
|
||||
* | position |`number[]` | On an iPad, set the X,Y position |
|
||||
*
|
||||
*
|
||||
* @interfaces
|
||||
* ActionSheetOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ActionSheet',
|
||||
@@ -51,21 +36,12 @@ export class ActionSheet {
|
||||
|
||||
/**
|
||||
* Show a native ActionSheet component. See below for options.
|
||||
* @param {options} Options See table below
|
||||
* @param options {ActionSheetOptions} Options See table below
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the index of the
|
||||
* button pressed (1 based, so 1, 2, 3, etc.)
|
||||
*/
|
||||
@Cordova()
|
||||
static show(options?: {
|
||||
buttonLabels: string[],
|
||||
title?: string,
|
||||
androidTheme?: number,
|
||||
androidEnableCancelButton?: boolean,
|
||||
winphoneEnableCancelButton?: boolean,
|
||||
addCancelButtonWithLabel?: string,
|
||||
addDestructiveButtonWithLabel?: string,
|
||||
position?: number[]
|
||||
}): Promise<any> { return; }
|
||||
static show(options?: ActionSheetOptions): Promise<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
@@ -76,3 +52,38 @@ export class ActionSheet {
|
||||
static hide(options?: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
export interface ActionSheetOptions {
|
||||
/**
|
||||
* The labels for the buttons. Uses the index x
|
||||
*/
|
||||
buttonLabels: string[];
|
||||
/**
|
||||
* The title for the actionsheet
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* Theme to be used on Android
|
||||
*/
|
||||
androidTheme?: number;
|
||||
/**
|
||||
* Enable a cancel on Android
|
||||
*/
|
||||
androidEnableCancelButton?: boolean;
|
||||
/**
|
||||
* Enable a cancel on Windows Phone
|
||||
*/
|
||||
winphoneEnableCancelButton?: boolean;
|
||||
/**
|
||||
* Add a cancel button with text
|
||||
*/
|
||||
addCancelButtonWithLabel?: string;
|
||||
/**
|
||||
* Add a destructive button with text
|
||||
*/
|
||||
addDestructiveButtonWithLabel?: string;
|
||||
/**
|
||||
* On an iPad, set the X,Y position
|
||||
*/
|
||||
position?: number[];
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export class AppRate {
|
||||
* See table below for options
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get preferences() { return window.AppRate.preferences; }
|
||||
static preferences;
|
||||
|
||||
/**
|
||||
* Prompts the user for rating
|
||||
|
||||
+96
-127
@@ -1,8 +1,10 @@
|
||||
import { Cordova, CordovaInstance, InstanceProperty, Plugin } from './plugin';
|
||||
import { CordovaInstance, InstanceProperty, Plugin, getPromise } from './plugin';
|
||||
|
||||
declare var window: any,
|
||||
navigator: any;
|
||||
|
||||
export type ContactFieldType = 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@@ -42,20 +44,20 @@ export interface IContactProperties {
|
||||
*/
|
||||
export class Contact implements IContactProperties {
|
||||
private _objectInstance: any;
|
||||
@InstanceProperty get id(): string { return; }
|
||||
@InstanceProperty get displayName(): string { return; }
|
||||
@InstanceProperty get name(): IContactName {return; }
|
||||
@InstanceProperty get nickname(): string { return; }
|
||||
@InstanceProperty get phoneNumbers(): IContactField[] { return; }
|
||||
@InstanceProperty get emails(): IContactField[] { return; }
|
||||
@InstanceProperty get addresses(): IContactAddress[] { return; }
|
||||
@InstanceProperty get ims(): IContactField[] { return; }
|
||||
@InstanceProperty get organizations(): IContactOrganization[] { return; }
|
||||
@InstanceProperty get birthday(): Date { return; }
|
||||
@InstanceProperty get note(): string { return; }
|
||||
@InstanceProperty get photos(): IContactField[] { return; }
|
||||
@InstanceProperty get categories(): IContactField[] { return; }
|
||||
@InstanceProperty get urls(): IContactField[] { return; }
|
||||
@InstanceProperty id: string;
|
||||
@InstanceProperty displayName: string;
|
||||
@InstanceProperty name: IContactName;
|
||||
@InstanceProperty nickname: string;
|
||||
@InstanceProperty phoneNumbers: IContactField[];
|
||||
@InstanceProperty emails: IContactField[];
|
||||
@InstanceProperty addresses: IContactAddress[];
|
||||
@InstanceProperty ims: IContactField[];
|
||||
@InstanceProperty organizations: IContactOrganization[];
|
||||
@InstanceProperty birthday: Date;
|
||||
@InstanceProperty note: string;
|
||||
@InstanceProperty photos: IContactField[];
|
||||
@InstanceProperty categories: IContactField[];
|
||||
@InstanceProperty urls: IContactField[];
|
||||
|
||||
constructor() {
|
||||
this._objectInstance = navigator.contacts.create();
|
||||
@@ -73,8 +75,14 @@ export class Contact implements IContactProperties {
|
||||
@CordovaInstance()
|
||||
remove(): Promise<any> { return; }
|
||||
|
||||
@CordovaInstance()
|
||||
save(): Promise<any> { return; }
|
||||
save(): Promise<any> {
|
||||
return getPromise((resolve, reject) => {
|
||||
this._objectInstance.save((contact) => {
|
||||
this._objectInstance = contact;
|
||||
resolve(this);
|
||||
}, reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,49 +128,37 @@ export interface IContactName {
|
||||
* @private
|
||||
*/
|
||||
export class ContactName implements IContactName {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(formatted?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string) {
|
||||
this._objectInstance = new window.ContactName(formatted, familyName, givenName, middleName, honorificPrefix, honorificSuffix);
|
||||
}
|
||||
|
||||
@InstanceProperty get formatted(): string { return; }
|
||||
@InstanceProperty get familyName(): string { return; }
|
||||
@InstanceProperty get givenName(): string { return; }
|
||||
@InstanceProperty get middleName(): string { return; }
|
||||
@InstanceProperty get honorificPrefix(): string { return; }
|
||||
@InstanceProperty get honorificSuffix(): string { return; }
|
||||
constructor(public formatted?: string,
|
||||
public familyName?: string,
|
||||
public givenName?: string,
|
||||
public middleName?: string,
|
||||
public honorificPrefix?: string,
|
||||
public honorificSuffix?: string) {}
|
||||
}
|
||||
|
||||
export interface IContactField {
|
||||
/** A string that indicates what type of field this is, home for example. */
|
||||
type: string;
|
||||
type?: string;
|
||||
/** The value of the field, such as a phone number or email address. */
|
||||
value: string;
|
||||
value?: string;
|
||||
/** Set to true if this ContactField contains the user's preferred value. */
|
||||
pref: boolean;
|
||||
pref?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export class ContactField implements IContactField {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(type?: string, value?: string, pref?: boolean) {
|
||||
this._objectInstance = new window.ContactField(type, value, pref);
|
||||
}
|
||||
|
||||
@InstanceProperty get type(): string { return; }
|
||||
@InstanceProperty get value(): string { return; }
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
constructor(public type?: string,
|
||||
public value?: string,
|
||||
public pref?: boolean) {}
|
||||
}
|
||||
|
||||
export interface IContactAddress {
|
||||
/** Set to true if this ContactAddress contains the user's preferred value. */
|
||||
pref?: boolean;
|
||||
/** A string indicating what type of field this is, home for example. */
|
||||
type?: string;
|
||||
type?: string;
|
||||
/** The full address formatted for display. */
|
||||
formatted?: string;
|
||||
/** The full street address. */
|
||||
@@ -181,42 +177,21 @@ export interface IContactAddress {
|
||||
* @private
|
||||
*/
|
||||
export class ContactAddress implements IContactAddress {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor(pref?: boolean,
|
||||
type?: string,
|
||||
formatted?: string,
|
||||
streetAddress?: string,
|
||||
locality?: string,
|
||||
region?: string,
|
||||
postalCode?: string,
|
||||
country?: string) {
|
||||
this._objectInstance = new window.ContactAddress(pref, type, formatted, streetAddress, locality, region, postalCode, country);
|
||||
}
|
||||
|
||||
/** Set to true if this ContactAddress contains the user's preferred value. */
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
/** A string indicating what type of field this is, home for example. */
|
||||
@InstanceProperty get type(): string { return; }
|
||||
/** The full address formatted for display. */
|
||||
@InstanceProperty get formatted(): string { return; }
|
||||
/** The full street address. */
|
||||
@InstanceProperty get streetAddress(): string { return; }
|
||||
/** The city or locality. */
|
||||
@InstanceProperty get locality(): string { return; }
|
||||
/** The state or region. */
|
||||
@InstanceProperty get region(): string { return; }
|
||||
/** The zip code or postal code. */
|
||||
@InstanceProperty get postalCode(): string { return; }
|
||||
/** The country name. */
|
||||
@InstanceProperty get country(): string { return; }
|
||||
constructor(public pref?: boolean,
|
||||
public type?: string,
|
||||
public formatted?: string,
|
||||
public streetAddress?: string,
|
||||
public locality?: string,
|
||||
public region?: string,
|
||||
public postalCode?: string,
|
||||
public country?: string) {}
|
||||
}
|
||||
|
||||
export interface IContactOrganization {
|
||||
/** Set to true if this ContactOrganization contains the user's preferred value. */
|
||||
pref?: boolean;
|
||||
/** A string that indicates what type of field this is, home for example. */
|
||||
type?: string;
|
||||
type?: string;
|
||||
/** The name of the organization. */
|
||||
name?: string;
|
||||
/** The department the contract works for. */
|
||||
@@ -229,20 +204,13 @@ export interface IContactOrganization {
|
||||
* @private
|
||||
*/
|
||||
export class ContactOrganization implements IContactOrganization {
|
||||
private _objectInstance: any;
|
||||
constructor() {
|
||||
this._objectInstance = new window.ContactOrganization();
|
||||
}
|
||||
/** Set to true if this ContactOrganization contains the user's preferred value. */
|
||||
@InstanceProperty get pref(): boolean { return; }
|
||||
/** A string that indicates what type of field this is, home for example. */
|
||||
@InstanceProperty get type(): string { return; }
|
||||
/** The name of the organization. */
|
||||
@InstanceProperty get name(): string { return; }
|
||||
/** The department the contract works for. */
|
||||
@InstanceProperty get department(): string { return; }
|
||||
/** The contact's title at the organization. */
|
||||
@InstanceProperty get title(): string { return; }
|
||||
constructor(
|
||||
public type?: string,
|
||||
public name?: string,
|
||||
public department?: string,
|
||||
public title?: string,
|
||||
public pref?: boolean
|
||||
) {}
|
||||
}
|
||||
|
||||
/** Search options to filter navigator.contacts. */
|
||||
@@ -263,31 +231,10 @@ export interface IContactFindOptions {
|
||||
* @private
|
||||
*/
|
||||
export class ContactFindOptions implements IContactFindOptions {
|
||||
private _objectInstance: any;
|
||||
|
||||
constructor() {
|
||||
this._objectInstance = new window.ContactFindOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* The search string used to find navigator.contacts. (Default: "")
|
||||
*/
|
||||
@InstanceProperty get filter(): string { return; }
|
||||
|
||||
/**
|
||||
* Determines if the find operation returns multiple navigator.contacts. (Default: false)
|
||||
*/
|
||||
@InstanceProperty get multiple(): boolean { return; }
|
||||
|
||||
/**
|
||||
* Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields.
|
||||
*/
|
||||
@InstanceProperty get desiredFields(): any { return; }
|
||||
|
||||
/**
|
||||
* (Android only): Filters the search to only return contacts with a phone number informed.
|
||||
*/
|
||||
@InstanceProperty get hasPhoneNumber(): boolean { return; }
|
||||
constructor(public filter?: string,
|
||||
public multiple?: boolean,
|
||||
public desiredFields?: string[],
|
||||
public hasPhoneNumber?: boolean) {}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,18 +249,23 @@ export class ContactFindOptions implements IContactFindOptions {
|
||||
*
|
||||
*
|
||||
* let contact = new Contact();
|
||||
* contact.displayName = 'Mr. Ionitron';
|
||||
*
|
||||
* contact.name = new ContactName(null, 'Smith', 'John');
|
||||
* contact.phoneNumbers = [new ContactField('mobile', '6471234567')];
|
||||
* contact.save().then(
|
||||
* () => console.log('Contact saved!', contact),
|
||||
* (error: any) => console.error('Error saving contact.', error)
|
||||
* );
|
||||
*
|
||||
* ```
|
||||
* @interfaces
|
||||
* IContactProperties
|
||||
* @classes
|
||||
* ContactFindOptions
|
||||
* ContactOrganization
|
||||
* ContactAddress
|
||||
* IContactError
|
||||
* IContactName
|
||||
* IContactField
|
||||
* IContactAddress
|
||||
* IContactOrganization
|
||||
* IContactFindOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Contacts',
|
||||
@@ -332,29 +284,46 @@ export class Contacts {
|
||||
|
||||
/**
|
||||
* Search for contacts in the Contacts list.
|
||||
* @param fields {string[]} Contact fields to be used as a search qualifier.
|
||||
* @param fields {ContactFieldType[]} Contact fields to be used as a search qualifier.
|
||||
* A zero-length contactFields parameter is invalid and results in ContactError.INVALID_ARGUMENT_ERROR.
|
||||
* A contactFields value of "*" searches all contact fields.
|
||||
*
|
||||
* @param options {Object} the options to query with:
|
||||
* @param options {IContactFindOptions} the options to query with:
|
||||
* filter: The search string used to find navigator.contacts. (string) (Default: "")
|
||||
* multiple: Determines if the find operation returns multiple navigator.contacts. (Boolean) (Default: false)
|
||||
* desiredFields: Contact fields to be returned back. If specified, the resulting Contact object only features values for these fields. (DOMString[]) [Optional]
|
||||
* hasPhoneNumber(Android only): Filters the search to only return contacts with a phone number informed. (Boolean) (Default: false)
|
||||
*
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the search results (an array of Contact objects)
|
||||
* @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
|
||||
*/
|
||||
@Cordova({
|
||||
successIndex: 1,
|
||||
errorIndex: 2
|
||||
})
|
||||
static find(fields: string[], options?: any): Promise<any> { return; }
|
||||
static find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.find(fields, (contacts) => {
|
||||
resolve(contacts.map(processContact));
|
||||
}, reject, options);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Select a single Contact.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the selected Contact
|
||||
* @returns {Promise<Contact>} Returns a Promise that resolves with the selected Contact
|
||||
*/
|
||||
@Cordova()
|
||||
static pickContact(): Promise<any> { return; }
|
||||
static pickContact(): Promise<Contact> {
|
||||
return getPromise((resolve, reject) => {
|
||||
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function processContact(contact) {
|
||||
let newContact = new Contact();
|
||||
for (let prop in contact) {
|
||||
if (typeof contact[prop] === 'function') continue;
|
||||
newContact[prop] = contact[prop];
|
||||
}
|
||||
return newContact;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ export class Deeplinks {
|
||||
* matches the path, the resulting path-data pair will be returned in the
|
||||
* promise result which you can then use to navigate in the app as you see fit.
|
||||
*
|
||||
* @returns {Observable<DeeplinkMatch} Returns an Observable that resolves each time a deeplink comes through, and
|
||||
* @returns {Observable<DeeplinkMatch>} Returns an Observable that resolves each time a deeplink comes through, and
|
||||
* errors if a deeplink comes through that does not match a given path.
|
||||
*/
|
||||
@Cordova({
|
||||
|
||||
+33
-31
@@ -1,31 +1,6 @@
|
||||
import { CordovaProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window: {
|
||||
device: Device
|
||||
};
|
||||
|
||||
export interface Device {
|
||||
/** Get the version of Cordova running on the device. */
|
||||
cordova: string;
|
||||
/**
|
||||
* The device.model returns the name of the device's model or product. The value is set
|
||||
* by the device manufacturer and may be different across versions of the same product.
|
||||
*/
|
||||
model: string;
|
||||
/** Get the device's operating system name. */
|
||||
platform: string;
|
||||
/** Get the device's Universally Unique Identifier (UUID). */
|
||||
uuid: string;
|
||||
/** Get the operating system version. */
|
||||
version: string;
|
||||
/** Get the device's manufacturer. */
|
||||
manufacturer: string;
|
||||
/** Whether the device is running on a simulator. */
|
||||
isVirtual: boolean;
|
||||
/** Get the device hardware serial number. */
|
||||
serial: string;
|
||||
}
|
||||
declare var window: any;
|
||||
|
||||
/**
|
||||
* @name Device
|
||||
@@ -37,7 +12,7 @@ export interface Device {
|
||||
* import { Device } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* console.log('Device UUID is: ' + Device.device.uuid);
|
||||
* console.log('Device UUID is: ' + Device.uuid);
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
@@ -48,12 +23,39 @@ export interface Device {
|
||||
})
|
||||
export class Device {
|
||||
|
||||
/** Get the version of Cordova running on the device. */
|
||||
@CordovaProperty
|
||||
static cordova: string;
|
||||
|
||||
/**
|
||||
* Returns the whole device object.
|
||||
*
|
||||
* @returns {Device} The device object.
|
||||
* The device.model returns the name of the device's model or product. The value is set
|
||||
* by the device manufacturer and may be different across versions of the same product.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get device(): Device { return window.device; }
|
||||
static model: string;
|
||||
|
||||
/** Get the device's operating system name. */
|
||||
@CordovaProperty
|
||||
static platform: string;
|
||||
|
||||
/** Get the device's Universally Unique Identifier (UUID). */
|
||||
@CordovaProperty
|
||||
static uuid: string;
|
||||
|
||||
/** Get the operating system version. */
|
||||
@CordovaProperty
|
||||
static version: string;
|
||||
|
||||
/** Get the device's manufacturer. */
|
||||
@CordovaProperty
|
||||
static manufacturer: string;
|
||||
|
||||
/** Whether the device is running on a simulator. */
|
||||
@CordovaProperty
|
||||
static isVirtual: boolean;
|
||||
|
||||
/** Get the device hardware serial number. */
|
||||
@CordovaProperty
|
||||
static serial: string;
|
||||
|
||||
}
|
||||
|
||||
+163
-1
@@ -481,18 +481,80 @@ export interface VisibleRegion {
|
||||
* @private
|
||||
*/
|
||||
export interface GoogleMapsMarkerOptions {
|
||||
/**
|
||||
* The icon image url or properties. Also you can specify HTML Color values. Alternatively you can specify the image as Base64
|
||||
*/
|
||||
icon?: any;
|
||||
|
||||
/**
|
||||
* The content of the infoWindow.
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* The snippet of the infoWindow.
|
||||
*/
|
||||
snippet?: string;
|
||||
|
||||
/**
|
||||
* The position of the marker.
|
||||
*/
|
||||
position?: GoogleMapsLatLng;
|
||||
|
||||
/**
|
||||
* Specify the anchor of the InfoWindow
|
||||
*/
|
||||
infoWindowAnchor?: number[];
|
||||
|
||||
/**
|
||||
* Set true if you want to enable to drag the marker. (Default: false) Important! Drag starts after long pressed on the marker.
|
||||
*/
|
||||
draggable?: boolean;
|
||||
|
||||
/**
|
||||
* Set true if you want to use a flat marker. (Default: false)
|
||||
*/
|
||||
flat?: boolean;
|
||||
|
||||
/**
|
||||
* Set rotation angle. (Default: 0)
|
||||
*/
|
||||
rotation?: number;
|
||||
|
||||
/**
|
||||
* Set false if you want to hide. (Default: true)
|
||||
*/
|
||||
visible?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the options for title.
|
||||
*/
|
||||
styles?: any;
|
||||
|
||||
/**
|
||||
* Which animation to play when marker is added to a map.
|
||||
*/
|
||||
animation?: string;
|
||||
|
||||
/**
|
||||
* iOS only, Plugin Version >= 1.3.3 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (You're able to run this on Android, but it will have no effect)
|
||||
*/
|
||||
zIndex?: number;
|
||||
|
||||
/**
|
||||
* Set to true to disable auto panning when the marker is clicked.
|
||||
*/
|
||||
disableAutoPan?: boolean;
|
||||
|
||||
/**
|
||||
* Function to be invoked when the user clicks on the marker
|
||||
*/
|
||||
markerClick?: Function;
|
||||
|
||||
/**
|
||||
* Function to be invoked when the user clicks on the info box
|
||||
*/
|
||||
infoClick?: Function;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -537,78 +599,178 @@ export class GoogleMapsMarker {
|
||||
@CordovaInstance({sync: true})
|
||||
set(key: string, value: any): void { }
|
||||
|
||||
/**
|
||||
* Return true if the marker is visible
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
isVisible(): boolean { return; }
|
||||
|
||||
/**
|
||||
* Set false if you want to hide the marker.
|
||||
* @param visible
|
||||
*/
|
||||
@CordovaInstance()
|
||||
setVisible(visible: boolean): void { }
|
||||
|
||||
/**
|
||||
* Return the marker hash code.
|
||||
* @return {string} Marker hash code
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getHashCode(): string { return; }
|
||||
|
||||
/**
|
||||
* Remove the marker completely.
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
remove(): void { }
|
||||
|
||||
/**
|
||||
* Change the marker opacity.
|
||||
* @param alpha {number} Opacity
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setOpacity(alpha: number): void { }
|
||||
|
||||
/**
|
||||
* Return the marker opacity.
|
||||
* @return {number} Opacity
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getOpacity(): number { return; }
|
||||
|
||||
/**
|
||||
* iOS only, Plugin Version >= 1.3.3 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays. (You're able to run this on Android, but it will have no effect)
|
||||
* @return {number}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setZIndex(): void { }
|
||||
setZIndex(): number { return; }
|
||||
|
||||
/**
|
||||
* Change the info window anchor. This defaults to 50% from the left of the image and at the bottom of the image.
|
||||
* @param x {number}
|
||||
* @param y {number}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setIconAnchor(x: number, y: number): void { }
|
||||
|
||||
/**
|
||||
* Change the info window anchor. This defaults to 50% from the left of the image and at the top of the image.
|
||||
* @param x {number}
|
||||
* @param y {number}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setInfoWindowAnchor(x: number, y: number): void { }
|
||||
|
||||
/**
|
||||
* Set true if you allows all users to drag the marker.
|
||||
* @param draggable {boolean}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setDraggable(draggable: boolean): void { }
|
||||
|
||||
/**
|
||||
* Return true if the marker drag is enabled.
|
||||
* @return {boolean}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
isDraggable(): boolean { return; }
|
||||
|
||||
/**
|
||||
* Set true if you want to be flat marker.
|
||||
* @param flat {boolean}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setFlat(flat: boolean): void { return; }
|
||||
|
||||
/**
|
||||
* Change icon url and/or size
|
||||
* @param icon
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setIcon(icon: GoogleMapsMarkerIcon): void { return; }
|
||||
|
||||
/**
|
||||
* Change title of the infoWindow.
|
||||
* @param title {string}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setTitle(title: string): void { }
|
||||
|
||||
/**
|
||||
* Return the title strings.
|
||||
* @return {string}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getTitle(): string { return; }
|
||||
|
||||
/**
|
||||
* Change snippet of the infoWindow.
|
||||
* @param snippet {string}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setSnippet(snippet: string): void { }
|
||||
|
||||
/**
|
||||
* Return the snippet strings.
|
||||
* @return {string}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getSnippet(): string { return; }
|
||||
|
||||
/**
|
||||
* Set the marker rotation angle.
|
||||
* @param rotation {number}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setRotation(rotation: number): void { }
|
||||
|
||||
/**
|
||||
* Return the marker rotation angle.
|
||||
* @return {number}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getRotation(): number { return; }
|
||||
|
||||
/**
|
||||
* Show the infoWindow of the marker.
|
||||
* @return {number}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
showInfoWindow(): number { return; }
|
||||
|
||||
/**
|
||||
* Hide the infoWindow of the marker.
|
||||
* @return {number}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
hideInfoWindow(): number { return; }
|
||||
|
||||
/**
|
||||
* Set the marker position.
|
||||
* @param latLng {GoogleMapLatLng}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setPosition(latLng: GoogleMapsLatLng): void { return; }
|
||||
|
||||
/**
|
||||
* Return the marker position.
|
||||
* @return {Promise<GoogleMapLatLng>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
getPosition(): Promise<GoogleMapsLatLng> { return; }
|
||||
|
||||
/**
|
||||
* Return the map instance.
|
||||
* @return {GoogleMap}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
getMap(): GoogleMap { return; }
|
||||
|
||||
/**
|
||||
* Specify the animation either `DROP` or `BOUNCE`
|
||||
* @param animation {string}
|
||||
*/
|
||||
@CordovaInstance({ sync: true })
|
||||
setAnimation(animation: string): void { }
|
||||
|
||||
|
||||
@@ -33,9 +33,8 @@ export class Httpd {
|
||||
|
||||
/**
|
||||
* Starts a web server.
|
||||
* @returns {Observable<string>} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.
|
||||
* @param options {HttpdOptions}
|
||||
* @returns {Observable<string>}
|
||||
* @returns {Observable<string>} Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.
|
||||
*/
|
||||
@Cordova({
|
||||
observable: true,
|
||||
|
||||
@@ -33,27 +33,21 @@ export class MediaCapture {
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get supportedImageModes(): ConfigurationData[] {
|
||||
return <ConfigurationData[]>navigator.device.capture.supportedImageModes;
|
||||
}
|
||||
static supportedImageModes: ConfigurationData[];
|
||||
|
||||
/**
|
||||
* The audio recording formats supported by the device.
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get supportedAudioModes(): ConfigurationData[] {
|
||||
return <ConfigurationData[]>navigator.device.capture.supportedAudioModes;
|
||||
}
|
||||
static supportedAudioModes: ConfigurationData[];
|
||||
|
||||
/**
|
||||
* The recording video resolutions and formats supported by the device.
|
||||
* @returns {ConfigurationData[]}
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get supportedVideoModes(): ConfigurationData[] {
|
||||
return <ConfigurationData[]>navigator.device.capture.supportedVideoModes;
|
||||
}
|
||||
static supportedVideoModes: ConfigurationData[];
|
||||
|
||||
/**
|
||||
* Start the audio recorder application and return information about captured audio clip files.
|
||||
|
||||
@@ -16,6 +16,8 @@ declare var mixpanel: any;
|
||||
* .catch(onError);
|
||||
*
|
||||
* ```
|
||||
* @classes
|
||||
* MixpanelPeople
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'Mixpanel',
|
||||
|
||||
@@ -55,7 +55,7 @@ export class Network {
|
||||
* Return the network connection type
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get connection(): string { return navigator.connection.type; }
|
||||
static connection: string;
|
||||
|
||||
/**
|
||||
* Get notified when the device goes offline
|
||||
|
||||
+33
-26
@@ -127,7 +127,10 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
|
||||
return get(window, pluginObj.pluginRef)[methodName].apply(pluginInstance, args);
|
||||
}
|
||||
|
||||
function getPromise(cb) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function getPromise(cb) {
|
||||
|
||||
const tryNativePromise = () => {
|
||||
if (window.Promise) {
|
||||
@@ -404,43 +407,47 @@ export function CordovaInstance(opts: any = {}) {
|
||||
*
|
||||
* Before calling the original method, ensure Cordova and the plugin are installed.
|
||||
*/
|
||||
export function CordovaProperty(target: Function, key: string, descriptor: TypedPropertyDescriptor<any>) {
|
||||
let originalMethod = descriptor.get;
|
||||
|
||||
descriptor.get = function(...args: any[]) {
|
||||
if (!window.cordova) {
|
||||
cordovaWarn(this.name, null);
|
||||
return {};
|
||||
}
|
||||
let pluginObj: any = this;
|
||||
let pluginInstance = getPlugin(pluginObj.pluginRef);
|
||||
export function CordovaProperty(target: any, key: string) {
|
||||
const exists = () => {
|
||||
let pluginInstance = getPlugin(target.pluginRef);
|
||||
if (!pluginInstance) {
|
||||
pluginWarn(this, key);
|
||||
return {};
|
||||
pluginWarn(target, key);
|
||||
return false;
|
||||
}
|
||||
return originalMethod.apply(this, args);
|
||||
return true;
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
Object.defineProperty(target, key, {
|
||||
get: () => {
|
||||
if (exists()) {
|
||||
return getPlugin(target.pluginRef)[key];
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
set: (value) => {
|
||||
if (exists()) {
|
||||
getPlugin(target.pluginRef)[key] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param target
|
||||
* @param key
|
||||
* @param descriptor
|
||||
* @constructor
|
||||
*/
|
||||
export function InstanceProperty(target: any, key: string, descriptor: TypedPropertyDescriptor<any>) {
|
||||
descriptor.get = function() {
|
||||
return this._objectInstance[key];
|
||||
};
|
||||
|
||||
descriptor.set = function(...args: any[]) {
|
||||
this._objectInstance[key] = args[0];
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
export function InstanceProperty(target: any, key: string) {
|
||||
Object.defineProperty(target, key, {
|
||||
get: function(){
|
||||
return this._objectInstance[key];
|
||||
},
|
||||
set: function(value){
|
||||
this._objectInstance[key] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,11 +59,9 @@ export class ScreenOrientation {
|
||||
@Cordova({ sync: true })
|
||||
static unlockOrientation(): void { }
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the current orientation of the device.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get orientation() {
|
||||
return window.screen.orientation;
|
||||
}
|
||||
static orientation: string;
|
||||
}
|
||||
|
||||
+22
-36
@@ -1,4 +1,4 @@
|
||||
import {Cordova, CordovaInstance, Plugin, pluginWarn} from './plugin';
|
||||
import {Cordova, CordovaInstance, Plugin, pluginWarn, InstanceProperty} from './plugin';
|
||||
|
||||
|
||||
declare var sqlitePlugin;
|
||||
@@ -14,6 +14,20 @@ declare var sqlitePlugin;
|
||||
* ```typescript
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* // OPTION A: Use static constructor
|
||||
* SQLite.openDatabase({
|
||||
* name: 'data.db',
|
||||
* location: 'default'
|
||||
* })
|
||||
* .then((db: SQLite) => {
|
||||
*
|
||||
* db.executeSQL('create table danceMoves(name VARCHAR(32))').then(() => {}).catch(() => {});
|
||||
*
|
||||
* })
|
||||
* .catch(error => console.error('Error openening database', error);
|
||||
*
|
||||
*
|
||||
* // OPTION B: Create a new instance of SQLite
|
||||
* let db = new SQLite();
|
||||
* db.openDatabase({
|
||||
* name: 'data.db',
|
||||
@@ -39,38 +53,22 @@ declare var sqlitePlugin;
|
||||
export class SQLite {
|
||||
|
||||
private _objectInstance: any;
|
||||
get databaseFeatures(): any {
|
||||
return this._objectInstance.databaseFeatures;
|
||||
}
|
||||
|
||||
@InstanceProperty databaseFeatures: any;
|
||||
|
||||
constructor() { }
|
||||
|
||||
static openDatabase(config: any): Promise<SQLite> {
|
||||
return new SQLite().openDatabase(config);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open or create a SQLite database file.
|
||||
*
|
||||
* See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database
|
||||
*
|
||||
* @param config the config for opening the database.
|
||||
* @returns {Promise<any>}
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { SQLite } from 'ionic-native';
|
||||
*
|
||||
* let db = new SQLite();
|
||||
* db.openDatabase({
|
||||
* name: 'data.db',
|
||||
* location: 'default' // the location field is required
|
||||
* }).then(() => {
|
||||
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
|
||||
*
|
||||
* }, (err) => {
|
||||
* console.error('Unable to execute sql', err);
|
||||
* })
|
||||
* }, (err) => {
|
||||
* console.error('Unable to open database', err);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
openDatabase(config: any): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -132,18 +130,6 @@ export class SQLite {
|
||||
/**
|
||||
* Execute SQL on the opened database. Note, you must call `openDatabase` first, and
|
||||
* ensure it resolved and successfully opened the database.
|
||||
*
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
|
||||
* // Access the items through resultSet.rows
|
||||
* // resultSet.rows.item(i)
|
||||
* }, (err) => {})
|
||||
* ```
|
||||
* @param statement {string}
|
||||
* @param params {any}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@CordovaInstance()
|
||||
executeSql(statement: string, params: any): Promise<any> { return; }
|
||||
|
||||
@@ -117,6 +117,6 @@ export class StatusBar {
|
||||
* Whether the StatusBar is currently visible or not.
|
||||
*/
|
||||
@CordovaProperty
|
||||
static get isVisible() { return window.StatusBar.isVisible; }
|
||||
static isVisible: boolean;
|
||||
|
||||
}
|
||||
|
||||
@@ -26,14 +26,10 @@ declare var window;
|
||||
export class WebIntent {
|
||||
|
||||
@CordovaProperty
|
||||
static get ACTION_VIEW() {
|
||||
return window.plugins.webintent.ACTION_VIEW;
|
||||
}
|
||||
static ACTION_VIEW;
|
||||
|
||||
@CordovaProperty
|
||||
static get EXTRA_TEXT() {
|
||||
return window.plugins.webintent.EXTRA_TEXT;
|
||||
}
|
||||
static EXTRA_TEXT;
|
||||
|
||||
/**
|
||||
* @param options {Object} { action: any, url: string, type?: string }
|
||||
|
||||
Reference in New Issue
Block a user