summaryrefslogtreecommitdiff
path: root/plugins/nl.x-services.plugins.insomnia/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/nl.x-services.plugins.insomnia/src')
-rw-r--r--plugins/nl.x-services.plugins.insomnia/src/android/nl/xservices/plugins/Insomnia.java47
-rw-r--r--plugins/nl.x-services.plugins.insomnia/src/firefoxos/insomnia.js16
-rwxr-xr-xplugins/nl.x-services.plugins.insomnia/src/ios/Insomnia.h9
-rwxr-xr-xplugins/nl.x-services.plugins.insomnia/src/ios/Insomnia.m32
-rw-r--r--plugins/nl.x-services.plugins.insomnia/src/wp8/Insomnia.cs19
5 files changed, 0 insertions, 123 deletions
diff --git a/plugins/nl.x-services.plugins.insomnia/src/android/nl/xservices/plugins/Insomnia.java b/plugins/nl.x-services.plugins.insomnia/src/android/nl/xservices/plugins/Insomnia.java
deleted file mode 100644
index 95094938..00000000
--- a/plugins/nl.x-services.plugins.insomnia/src/android/nl/xservices/plugins/Insomnia.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package nl.xservices.plugins;
-
-import android.view.WindowManager;
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-
-public class Insomnia extends CordovaPlugin {
-
- private static final String ACTION_KEEP_AWAKE = "keepAwake";
- private static final String ACTION_ALLOW_SLEEP_AGAIN = "allowSleepAgain";
-
- @Override
- public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
- try {
- if (ACTION_KEEP_AWAKE.equals(action)) {
- cordova.getActivity().runOnUiThread(
- new Runnable() {
- public void run() {
- cordova.getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
- }
- });
- return true;
-
- } else if (ACTION_ALLOW_SLEEP_AGAIN.equals(action)) {
- cordova.getActivity().runOnUiThread(
- new Runnable() {
- public void run() {
- cordova.getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
- }
- });
- return true;
-
- } else {
- callbackContext.error("insomnia." + action + " is not a supported function. Did you mean '" + ACTION_KEEP_AWAKE + "'?");
- return false;
- }
- } catch (Exception e) {
- callbackContext.error(e.getMessage());
- return false;
- }
- }
-}
diff --git a/plugins/nl.x-services.plugins.insomnia/src/firefoxos/insomnia.js b/plugins/nl.x-services.plugins.insomnia/src/firefoxos/insomnia.js
deleted file mode 100644
index ed4ea3af..00000000
--- a/plugins/nl.x-services.plugins.insomnia/src/firefoxos/insomnia.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var lock;
-
-module.exports = {
- keepAwake: function() {
- if (navigator.requestWakeLock) {
- lock = navigator.requestWakeLock("screen");
- }
- },
- allowSleepAgain: function() {
- if (lock && typeof lock.unlock === "function") {
- lock.unlock();
- }
- }
-};
-
-require("cordova/exec/proxy").add("Insomnia", module.exports);
diff --git a/plugins/nl.x-services.plugins.insomnia/src/ios/Insomnia.h b/plugins/nl.x-services.plugins.insomnia/src/ios/Insomnia.h
deleted file mode 100755
index c13c07ba..00000000
--- a/plugins/nl.x-services.plugins.insomnia/src/ios/Insomnia.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#import <Cordova/CDV.h>
-
-@interface Insomnia :CDVPlugin
-
-- (void) keepAwake:(CDVInvokedUrlCommand*)command;
-
-- (void) allowSleepAgain:(CDVInvokedUrlCommand*)command;
-
-@end
diff --git a/plugins/nl.x-services.plugins.insomnia/src/ios/Insomnia.m b/plugins/nl.x-services.plugins.insomnia/src/ios/Insomnia.m
deleted file mode 100755
index 7eca3b07..00000000
--- a/plugins/nl.x-services.plugins.insomnia/src/ios/Insomnia.m
+++ /dev/null
@@ -1,32 +0,0 @@
-#import "Insomnia.h"
-#import <Cordova/CDV.h>
-
-@implementation Insomnia
-
-- (void) keepAwake:(CDVInvokedUrlCommand*)command {
- NSString *callbackId = command.callbackId;
-
- // Acquire a reference to the local UIApplication singleton
- UIApplication* app = [UIApplication sharedApplication];
-
- if (![app isIdleTimerDisabled]) {
- [app setIdleTimerDisabled:true];
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-}
-
-- (void) allowSleepAgain:(CDVInvokedUrlCommand*)command {
- NSString *callbackId = command.callbackId;
-
- // Acquire a reference to the local UIApplication singleton
- UIApplication* app = [UIApplication sharedApplication];
-
- if([app isIdleTimerDisabled]) {
- [app setIdleTimerDisabled:false];
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
-}
-
-@end \ No newline at end of file
diff --git a/plugins/nl.x-services.plugins.insomnia/src/wp8/Insomnia.cs b/plugins/nl.x-services.plugins.insomnia/src/wp8/Insomnia.cs
deleted file mode 100644
index 034d1711..00000000
--- a/plugins/nl.x-services.plugins.insomnia/src/wp8/Insomnia.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.Phone.Shell;
-
-namespace WPCordovaClassLib.Cordova.Commands
-{
- public class Insomnia : BaseCommand
- {
- public void keepAwake(string options)
- {
- PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
- DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
- }
-
- public void allowSleepAgain(string options)
- {
- PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
- DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
- }
- }
-}