Compare commits

...

19 Commits

Author SHA1 Message Date
Ibby
41abaeb7c9 chore(): update changelog 2016-10-15 13:17:23 -04:00
Ibby
4dc82383a0 2.2.4 2016-10-15 13:17:06 -04:00
Ibrahim Hadeed
799e2f0b2e fix(sqlite): fix callback order for transaction (#700) 2016-10-15 07:41:46 -07:00
Ibrahim Hadeed
b95f88c165 feat(mixpanel): MixpanelPeople returns promises (#681)
* feat(mixpanel): make MixpanelPeople return promises

* remove decorator from people property

* add cordova decorator'

* test(mixpanel): add mixpanel tests

* test(mixpanel): remove unused imports

* fix(mixpanel): fix MixpanelPeople class

closes #667
2016-10-15 07:41:37 -07:00
Ibrahim Hadeed
bbda6e22a2 feat(device-feedback): add DeviceFeedback plugin (#696) 2016-10-15 07:41:06 -07:00
Ibby
3edfafb6f9 feat(image-picker): add new android methods 2016-10-15 07:40:22 -07:00
Ibby
99c1d499f7 chore(): update contributing guide 2016-10-14 08:12:35 -04:00
Ibby
37ed9a097a docs(toast): add interface to docs 2016-10-14 07:11:41 -04:00
Ibby
db3d5b63c6 docs(image-picker): add interface docs 2016-10-14 06:44:57 -04:00
Ibby
6521e1833c refractor(): change return type of configure 2016-10-14 06:43:02 -04:00
Ibby
debe6834ef chore(): update changelog 2016-10-14 06:06:49 -04:00
Ibby
292c8801ea Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-10-14 06:06:31 -04:00
william
b031ceed99 docs(camera-preview): fix repo link (#695)
Breaking link to Repo.
2016-10-14 03:06:11 -07:00
Ibby
82d4ec2738 2.2.3 2016-10-14 06:03:59 -04:00
Ibby
9c55358620 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-10-13 19:15:46 -04:00
Ibby
51bc5ef542 docs(ble): update docs for isEnabled
closes #665
2016-10-13 19:15:38 -04:00
Colin Frick
74a252b324 fix(googlemaps): Expose 'type' property in GoogleMapsLatLngBounds #693 (#694) 2016-10-13 16:00:15 -07:00
Ramon Henrique Ornelas
43c8592b40 style(file): fix angular style (#685) 2016-10-12 19:52:27 -07:00
Ramon Henrique Ornelas
babfb0dca3 fix(onesignal): update to match latest API version (#691) 2016-10-12 19:51:57 -07:00
17 changed files with 239 additions and 60 deletions

View File

@@ -1,18 +1,19 @@
# Contributing to Ionic Native
## Feature request?
Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add.
Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.
## Have an issue?
#### There are no rules, but here are a few things to consider:
###### Before you submit an issue:
* Do a quick search to see if there are similar issues
* **Check that you are using the latest version of** `ionic-native`
* Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic 2, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/v2/api/platform/Platform/#ready).
* **Check that you are using the latest version of** `ionic-native`, you can install the latest version by running `npm i --save ionic-native@latest`
###### Still having problems? submit an issue with the following details:
* Short description of the issue
* Steps to reproduce
* Stack trace (if available)
## Feature request?
Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add.
Take a look at our [Developer Guide](https://github.com/driftyco/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins.

View File

@@ -1,3 +1,31 @@
<a name="2.2.4"></a>
## [2.2.4](https://github.com/driftyco/ionic-native/compare/v2.2.3...v2.2.4) (2016-10-15)
### Bug Fixes
* **sqlite:** fix callback order for transaction ([#700](https://github.com/driftyco/ionic-native/issues/700)) ([799e2f0](https://github.com/driftyco/ionic-native/commit/799e2f0))
### Features
* **device-feedback:** add DeviceFeedback plugin ([#696](https://github.com/driftyco/ionic-native/issues/696)) ([bbda6e2](https://github.com/driftyco/ionic-native/commit/bbda6e2))
* **image-picker:** add new android methods ([3edfafb](https://github.com/driftyco/ionic-native/commit/3edfafb))
* **mixpanel:** MixpanelPeople returns promises ([#681](https://github.com/driftyco/ionic-native/issues/681)) ([b95f88c](https://github.com/driftyco/ionic-native/commit/b95f88c)), closes [#667](https://github.com/driftyco/ionic-native/issues/667)
<a name="2.2.3"></a>
## [2.2.3](https://github.com/driftyco/ionic-native/compare/v2.2.2...v2.2.3) (2016-10-14)
### Bug Fixes
* **googlemaps:** Expose 'type' property in GoogleMapsLatLngBounds [#693](https://github.com/driftyco/ionic-native/issues/693) ([#694](https://github.com/driftyco/ionic-native/issues/694)) ([74a252b](https://github.com/driftyco/ionic-native/commit/74a252b))
* **onesignal:** update to match latest API version ([#691](https://github.com/driftyco/ionic-native/issues/691)) ([babfb0d](https://github.com/driftyco/ionic-native/commit/babfb0d))
<a name="2.2.2"></a>
## [2.2.2](https://github.com/driftyco/ionic-native/compare/v2.2.1...v2.2.2) (2016-10-12)

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "2.2.2",
"version": "2.2.4",
"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",

View File

@@ -32,6 +32,7 @@ import { DatePicker } from './plugins/datepicker';
import { DBMeter } from './plugins/dbmeter';
import { Deeplinks } from './plugins/deeplinks';
import { Device } from './plugins/device';
import { DeviceFeedback } from './plugins/device-feedback';
import { DeviceAccounts } from './plugins/deviceaccounts';
import { DeviceMotion } from './plugins/devicemotion';
import { DeviceOrientation } from './plugins/deviceorientation';
@@ -139,6 +140,7 @@ export * from './plugins/datepicker';
export * from './plugins/dbmeter';
export * from './plugins/deeplinks';
export * from './plugins/device';
export * from './plugins/device-feedback';
export * from './plugins/deviceaccounts';
export * from './plugins/devicemotion';
export * from './plugins/deviceorientation';
@@ -248,6 +250,7 @@ window['IonicNative'] = {
DBMeter,
Deeplinks,
Device,
DeviceFeedback,
DeviceAccounts,
DeviceMotion,
DeviceOrientation,

View File

@@ -236,8 +236,8 @@ export interface Config {
*
* // When device is ready :
* platform.ready().then(() => {
* // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
*
* // IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
*
* // BackgroundGeolocation is highly configurable. See platform specific configuration options
* let config = {
* desiredAccuracy: 10,
@@ -330,10 +330,9 @@ export class BackgroundGeolocation {
/**
* Configure the plugin.
*
* @param {Function} Success callback will be called when background location is determined.
* @param {Function} Fail callback to be executed every time a geolocation error occurs.
* @param {Object} An object of type Config
*
* @param {Function} callback callback will be called when background location is determined.
* @param {Function} errorCallback callback to be executed every time a geolocation error occurs.
* @param {Config} options An object of type Config
* @return Location object, which tries to mimic w3c Coordinates interface.
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
* Callback to be executed every time a geolocation is recorded in the background.
@@ -341,7 +340,7 @@ export class BackgroundGeolocation {
@Cordova({
sync: true
})
static configure(callback: Function, errorCallback: Function, options: Config): void { return; }
static configure(callback: Function, errorCallback: Function, options: Config): any { return; }
/**
* Turn ON the background-geolocation system.

View File

@@ -400,17 +400,10 @@ export class BLE {
/**
* Report if bluetooth is enabled.
*
* @usage
* ```
* BLE.isEnabled().then(
* () => { console.log('enabled'); },
* () => { console.log('not enabled'); }
* );
* ```
* @return Returns a Promise.
* @return {Promise<void>} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled.
*/
@Cordova()
static isEnabled(): Promise<any> { return; }
static isEnabled(): Promise<void> { return; }
/**
* Open System Bluetooth settings (Android only).

View File

@@ -19,7 +19,7 @@ export interface CameraPreviewSize {
* @description
* Showing camera preview in HTML
*
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview').
* For more info, please see the [Cordova Camera Preview Plugin Docs](https://github.com/westonganger/cordova-plugin-camera-preview).
*
* @usage
* ```

View File

@@ -0,0 +1,54 @@
import {Plugin, Cordova} from './plugin';
/**
* @name DeviceFeedback
* @description
*
* Plugin that lets you provide haptic or acoustic feedback on Android devices.
*
* @usage
* ```
* import { DeviceFeedback } from 'ionic-native';
*
* DeviceFeedback.acoustic();
*
* DeviceFeedback.haptic(0);
*
* DeviceFeedback.isFeedbackEnabled()
* .then((feedback) => {
* console.log(feedback);
* // {
* // acoustic: true,
* // haptic: true
* // }
* });
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-velda-devicefeedback',
pluginRef: 'plugins.deviceFeedback',
repo: 'https://github.com/VVelda/device-feedback',
platforms: ['Android']
})
export class DeviceFeedback {
/**
* Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do.
*/
@Cordova({ sync: true })
static acoustic(): void { }
/**
* Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do.
* @param type {Number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap.
*/
@Cordova({ sync: true })
static haptic(type: number): void { }
/**
* Check if haptic and acoustic feedback is enabled by user settings.
*/
@Cordova()
static isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; }
}

View File

@@ -1,4 +1,4 @@
import {Plugin, pluginWarn} from './plugin';
import { Plugin, pluginWarn } from './plugin';
declare var window: any;
declare var cordova: any;

View File

@@ -885,6 +885,7 @@ export class GoogleMapsLatLngBounds {
@InstanceProperty get northeast(): GoogleMapsLatLng { return; }
@InstanceProperty get southwest(): GoogleMapsLatLng { return; }
@InstanceProperty get type(): string { return; }
constructor(southwestOrArrayOfLatLng: GoogleMapsLatLng | GoogleMapsLatLng[], northeast?: GoogleMapsLatLng) {
let args = !!northeast ? [southwestOrArrayOfLatLng, northeast] : southwestOrArrayOfLatLng;

View File

@@ -2,19 +2,23 @@ import { Cordova, Plugin } from './plugin';
export interface ImagePickerOptions {
// max images to be selected, defaults to 15. If this is set to 1, upon
// selection of a single image, the plugin will return it.
/**
* max images to be selected, defaults to 15. If this is set to 1, upon selection of a single image, the plugin will return it.
*/
maximumImagesCount?: number;
// max width and height to allow the images to be. Will keep aspect
// ratio no matter what. So if both are 800, the returned image
// will be at most 800 pixels wide and 800 pixels tall. If the width is
// 800 and height 0 the image will be 800 pixels wide if the source
// is at least that wide.
/**
* Max width to allow images to be
*/
width?: number;
/**
* Max height to allow images to be
*/
height?: number;
// quality of resized image, defaults to 100
/**
* Quality of images, defaults to 100
*/
quality?: number;
}
@@ -38,6 +42,8 @@ export interface ImagePickerOptions {
* }
* }, (err) => { });
* ```
* @interfaces
* ImagePickerOptions
*/
@Plugin({
plugin: 'cordova-plugin-image-picker',
@@ -56,4 +62,22 @@ export class ImagePicker {
})
static getPictures(options: ImagePickerOptions): Promise<any> { return; }
/**
* Check if we have permission to read images
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean that indicates whether we have permission
*/
@Cordova({
platforms: ['Android']
})
static hasReadPermission(): Promise<boolean> { return; }
/**
* Request permission to read images
* @returns {Promise<any>}
*/
@Cordova({
platforms: ['Android']
})
static requestReadPermission(): Promise<any> { return; }
}

View File

@@ -1,7 +1,15 @@
import { Cordova, CordovaProperty, Plugin } from './plugin';
import { Cordova, Plugin } from './plugin';
declare var mixpanel: any;
/**
* @private
*/
export const pluginMeta = {
plugin: 'cordova-plugin-mixpanel',
pluginRef: 'mixpanel',
repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin'
};
/**
* @name Mixpanel
@@ -18,11 +26,7 @@ declare var mixpanel: any;
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-mixpanel',
pluginRef: 'mixpanel',
repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin'
})
@Plugin(pluginMeta)
export class Mixpanel {
/**
*
@@ -96,17 +100,61 @@ export class Mixpanel {
*
* @returns {MixpanelPeople}
*/
@CordovaProperty
static get people(): MixpanelPeople { return mixpanel.people; };
static get people(): typeof MixpanelPeople {
return MixpanelPeople;
};
}
/**
* @private
*/
export declare class MixpanelPeople {
static identify(distinctId: string, onSuccess?: Function, onFail?: Function): void;
static increment(peopleProperties: any, onSuccess?: Function, onFail?: Function): void;
static setPushId(pushId: string, onSuccess?: Function, onFail?: Function): void;
static set(peopleProperties: any, onSuccess?: Function, onFail?: Function): void;
static setOnce(peopleProperties: any, onSuccess?: Function, onFail?: Function): void;
export class MixpanelPeople {
/**
* @private
*/
static plugin: string = pluginMeta.plugin;
/**
* @private
*/
static pluginRef: string = pluginMeta.pluginRef + '.people';
/**
*
* @param distinctId {string}
* @return {Promise<any>}
*/
@Cordova()
static identify(distinctId: string): Promise<any> { return; }
/**
*
* @param peopleProperties {string}
* @return {Promise<any>}
*/
@Cordova()
static increment(peopleProperties: any): Promise<any> { return; }
/**
*
* @param pushId
* @return {Promise<any>}
*/
@Cordova()
static setPushId(pushId: string): Promise<any> { return; }
/**
*
* @param peopleProperties
* @return {Promise<any>}
*/
@Cordova()
static set(peopleProperties: any): Promise<any> { return; }
/**
*
* @param peopleProperties
* @return {Promise<any>}
*/
@Cordova()
static setOnce(peopleProperties: any): Promise<any> { return; }
}

View File

@@ -1,7 +1,6 @@
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
/**
* @name OneSignal
* @description
@@ -16,7 +15,7 @@ import { Observable } from 'rxjs/Observable';
*
* OneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261');
*
* OneSignal.enableInAppAlertNotification(true);
* OneSignal.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
*
* OneSignal.handleNotificationReceived().subscribe(() => {
* // do something when notification is received
@@ -38,7 +37,7 @@ import { Observable } from 'rxjs/Observable';
export class OneSignal {
/**
* @private
* constants to use in inFocusDisplaying()
*/
static OSInFocusDisplayOption = {
None: 0,
@@ -172,17 +171,13 @@ export class OneSignal {
static enableSound(enable: boolean): void { }
/**
* Warning:
* Only applies to Android and Amazon devices.
*
* By default this is false and notifications will not be shown when the user is in your app, instead the notificationOpenedCallback is fired.
* If set to true notifications will always show in the notification area and notificationOpenedCallback will not fire until the user taps on the notification.
* Setting to control how OneSignal notifications will be shown when one is received while your app is in focus. By default this is set to inAppAlert, which can be helpful during development.
*
* @param {boolean} enable
* @param {number} displayOption Options are 0 = None, 1 = InAppAlert, and 2 = Notification.
*/
@Cordova({ sync: true })
static enableNotificationsWhenActive(enable: boolean): void { }
static inFocusDisplaying(displayOption: number): void { }
/**
* You can call this method with false to opt users out of receiving all notifications through OneSignal.

View File

@@ -87,7 +87,10 @@ export class SQLite {
})
addTransaction(transaction: any): void { }
@CordovaInstance()
@CordovaInstance({
successIndex: 2,
errorIndex: 1
})
transaction(fn: any): Promise<any> { return; }
@CordovaInstance()

View File

@@ -53,6 +53,8 @@ export interface ToastOptions {
* }
* );
* ```
* @interfaces
* ToastOptions
*/
@Plugin({
plugin: 'cordova-plugin-x-toast',

View File

@@ -1,4 +1,4 @@
/// <reference path="./../typings/index.d.ts" />
/// <reference path="../typings/index.d.ts" />
import 'es6-shim';
import {Plugin, Cordova} from './../src/plugins/plugin';

View File

@@ -0,0 +1,28 @@
import {Mixpanel} from '../../src/plugins/mixpanel';
declare const window: any;
window.mixpanel = {
people: {
identify: (args, success, error) => success('Success')
}
};
describe('Mixpanel', () => {
it('should return MixpanelPeople', () => {
expect(Mixpanel.people).toBeDefined();
expect(Mixpanel.people.identify).toBeDefined();
});
it('should call a method of MixpanelPeople', (done) => {
const spy = spyOn(window.mixpanel.people, 'identify').and.callThrough();
Mixpanel.people.identify('veryDistinctSuchIdVeryWow')
.then(result => {
expect(result).toEqual('Success');
done();
});
expect(spy.calls.mostRecent().args[0]).toEqual('veryDistinctSuchIdVeryWow');
expect(window.mixpanel.people.identify).toHaveBeenCalled();
});
});