mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-05-10 21:07:06 +08:00
* Added OneSignal wrapper * documentation * Changes for callback of notification revieced * fixes for @Cordova decorators without Promise return * Merge * Improvements to OneSignal extended init function with notificationOpenedCallback as an optional parameter * Platforms removed OneSignal supports more than only these 3 platforms. It's available to nearly all Cordova platforms. * Init method turned into observable * Screen Orientation Plugin added. Closes #342
This commit is contained in:
parent
206fa625fd
commit
bd9366bdfe
@ -60,6 +60,7 @@ import {NativeStorage} from './plugins/nativestorage';
|
|||||||
import {MediaPlugin} from './plugins/media';
|
import {MediaPlugin} from './plugins/media';
|
||||||
import {Network} from './plugins/network';
|
import {Network} from './plugins/network';
|
||||||
import {OneSignal} from './plugins/onesignal';
|
import {OneSignal} from './plugins/onesignal';
|
||||||
|
import {ScreenOrientation} from './plugins/screen-orientation';
|
||||||
import {PinDialog} from './plugins/pin-dialog';
|
import {PinDialog} from './plugins/pin-dialog';
|
||||||
import {Printer} from './plugins/printer';
|
import {Printer} from './plugins/printer';
|
||||||
import {Push} from './plugins/push';
|
import {Push} from './plugins/push';
|
||||||
@ -145,6 +146,7 @@ export {
|
|||||||
NativeStorage,
|
NativeStorage,
|
||||||
Network,
|
Network,
|
||||||
OneSignal,
|
OneSignal,
|
||||||
|
ScreenOrientation,
|
||||||
PinDialog,
|
PinDialog,
|
||||||
Screenshot,
|
Screenshot,
|
||||||
SecureStorage,
|
SecureStorage,
|
||||||
@ -219,6 +221,7 @@ window['IonicNative'] = {
|
|||||||
Printer: Printer,
|
Printer: Printer,
|
||||||
Push: Push,
|
Push: Push,
|
||||||
OneSignal: OneSignal,
|
OneSignal: OneSignal,
|
||||||
|
ScreenOrientation: ScreenOrientation,
|
||||||
PinDialog: PinDialog,
|
PinDialog: PinDialog,
|
||||||
SafariViewController: SafariViewController,
|
SafariViewController: SafariViewController,
|
||||||
Screenshot: Screenshot,
|
Screenshot: Screenshot,
|
||||||
|
65
src/plugins/screen-orientation.ts
Normal file
65
src/plugins/screen-orientation.ts
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||||
|
|
||||||
|
declare var window;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Screen Orientation
|
||||||
|
* @description
|
||||||
|
* Cordova plugin to set/lock the screen orientation in a common way for iOS, Android, WP8 and Blackberry 10.
|
||||||
|
* This plugin is based on an early version of Screen Orientation API so the api does not currently match the current spec.
|
||||||
|
*
|
||||||
|
* Requires Cordova plugin: `cordova-plugin-screen-orientation`. For more info, please see the [Screen Orientation plugin docs](https://github.com/apache/cordova-plugin-screen-orientation).
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { ScreenOrientation } from 'ionic-native';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* // set to either landscape
|
||||||
|
* ScreenOrientation.lockOrientation('landscape');
|
||||||
|
*
|
||||||
|
* // allow user rotate
|
||||||
|
* ScreenOrientation.unlockOrientation();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'cordova-plugin-screen-orientation',
|
||||||
|
pluginRef: 'window.screen',
|
||||||
|
repo: 'https://github.com/apache/cordova-plugin-screen-orientation',
|
||||||
|
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||||
|
})
|
||||||
|
export class ScreenOrientation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lock the orientation to the passed value.
|
||||||
|
*
|
||||||
|
* Accepted orientation values:
|
||||||
|
* | Value | Description |
|
||||||
|
* |-------------------------------|------------------------------------------------------------------------------|
|
||||||
|
* | portrait-primary | The orientation is in the primary portrait mode. |
|
||||||
|
* | portrait-secondary | The orientation is in the secondary portrait mode. |
|
||||||
|
* | landscape-primary | The orientation is in the primary landscape mode. |
|
||||||
|
* | landscape-secondary | The orientation is in the secondary landscape mode. |
|
||||||
|
* | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). |
|
||||||
|
* | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). |
|
||||||
|
*
|
||||||
|
* @param {orientation} The orientation which should be locked. Accepted values see table above.
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static lockOrientation(orientation: string): void { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unlock and allow all orientations.
|
||||||
|
*/
|
||||||
|
@Cordova({ sync: true })
|
||||||
|
static unlockOrientation(): void { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the current orientation of the device.
|
||||||
|
*/
|
||||||
|
@CordovaProperty
|
||||||
|
static get orientation() {
|
||||||
|
return window.screen.orientation;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user