{
- "name": "com.dalicitycard.app",
+ "name": "com.dalipolice.app",
"version": "1.0.3",
"lockfileVersion": 1,
"requires": true,
}
}
},
+ "cordova-ourcodeworld-preventscreenshots": {
+ "version": "git+https://github.com/sdkcarlos/cordova-ourcodeworld-preventscreenshots.git#d96f8657cc2bc44bb23be5db68f4307a0d7d10c5",
+ "from": "git+https://github.com/sdkcarlos/cordova-ourcodeworld-preventscreenshots.git"
+ },
"cordova-plugin-add-swift-support": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-add-swift-support/-/cordova-plugin-add-swift-support-2.0.2.tgz",
"resolved": "https://registry.npmjs.org/cordova-plugin-jcore/-/cordova-plugin-jcore-1.3.0.tgz",
"integrity": "sha512-QmkdABlkIHFaMUBsrjPqhpaWS7wuboRPeeVEUNoc4FlZNRoQgw35v0MaW+SbOk4SzVsEGvN6IFSVqa4106ljUw=="
},
+ "cordova-plugin-prevent-screenshot-coffice": {
+ "version": "git+https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git#705e0bd6ee9029fadcfd5520bb38dc3fa408e950",
+ "from": "git+https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git"
+ },
"cordova-plugin-qrscanner": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/cordova-plugin-qrscanner/-/cordova-plugin-qrscanner-3.0.1.tgz",
"cordova-android": "^8.0.0",
"cordova-browser": "^6.0.0",
"cordova-ios": "^5.0.1",
+ "cordova-ourcodeworld-preventscreenshots": "git+https://github.com/sdkcarlos/cordova-ourcodeworld-preventscreenshots.git",
"cordova-plugin-advanced-http": "^2.1.1",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-brightness": "^0.2.0",
"cordova-plugin-fingerprint-aio": "3.0.1",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-jcore": "^1.3.0",
+ "cordova-plugin-prevent-screenshot-coffice": "git+https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git",
"cordova-plugin-qrscanner": "^3.0.1",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-themeablebrowser": "^0.2.18",
"cordova-plugin-file": {},
"cordova-plugin-fingerprint-aio": {
"FACEID_USAGE_DESCRIPTION": " "
- }
+ },
+ "cordova-plugin-prevent-screenshot-coffice": {}
},
"platforms": [
"android",
{
"xml": "<feature name=\"Fingerprint\"><param name=\"android-package\" value=\"de.niklasmerz.cordova.biometric.Fingerprint\" /></feature>",
"count": 1
+ },
+ {
+ "xml": "<feature name=\"screenshotName\"><param name=\"android-package\" value=\"com.coffice.ScreenshotBlocker\" /><param name=\"onload\" value=\"true\" /></feature>",
+ "count": 1
}
]
}
},
"cordova-plugin-fingerprint-aio": {
"PACKAGE_NAME": "com.dalipolice.app"
+ },
+ "cordova-plugin-prevent-screenshot-coffice": {
+ "PACKAGE_NAME": "com.dalipolice.app"
}
},
"dependent_plugins": {},
"clobbers": [
"Fingerprint"
]
+ },
+ {
+ "id": "cordova-plugin-prevent-screenshot-coffice.screenshot",
+ "file": "plugins/cordova-plugin-prevent-screenshot-coffice/www/screenshot.js",
+ "pluginId": "cordova-plugin-prevent-screenshot-coffice",
+ "clobbers": [
+ "window.plugins.preventscreenshot"
+ ]
}
],
"plugin_metadata": {
"cordova-plugin-app-version": "0.1.9",
"cordova-plugin-wkwebview-engine": "1.2.1",
"cordova-plugin-brightness": "0.1.5",
- "cordova-plugin-fingerprint-aio": "3.0.1"
+ "cordova-plugin-fingerprint-aio": "3.0.1",
+ "cordova-plugin-prevent-screenshot-coffice": "1.0.1"
}
}
ndk {
abiFilters "armeabi"
}
- versionCode 14
- versionName '1.4.1'
+ versionCode 15
+ versionName '1.4.2'
targetSdkVersion 28
}
lintOptions {
"clobbers": [
"Fingerprint"
]
+ },
+ {
+ "id": "cordova-plugin-prevent-screenshot-coffice.screenshot",
+ "file": "plugins/cordova-plugin-prevent-screenshot-coffice/www/screenshot.js",
+ "pluginId": "cordova-plugin-prevent-screenshot-coffice",
+ "clobbers": [
+ "window.plugins.preventscreenshot"
+ ]
}
];
module.exports.metadata = {
"cordova-plugin-app-version": "0.1.9",
"cordova-plugin-wkwebview-engine": "1.2.1",
"cordova-plugin-brightness": "0.1.5",
- "cordova-plugin-fingerprint-aio": "3.0.1"
+ "cordova-plugin-fingerprint-aio": "3.0.1",
+ "cordova-plugin-prevent-screenshot-coffice": "1.0.1"
};
});
\ No newline at end of file
}
});
var uid = window.localStorage.getItem("uid");
+
window.JPush.setAlias({ sequence: 1, alias: uid },
(result) => {
var sequence = result.sequence
e.preventDefault();
app.backTo();
}, false);
+
+ window.plugins.preventscreenshot.disable(function(ret){}, function(ret){});
},
loadQrcode: function() {
$.showLoading("加载中");
--- /dev/null
+package com.coffice;
+
+import android.app.Activity;
+import android.view.WindowManager;
+
+import org.apache.cordova.*;
+import org.json.JSONArray;
+import org.json.JSONException;
+
+public class ScreenshotBlocker extends CordovaPlugin{
+ private com.coffice.ScreenshotBlocker mContext;
+
+ @Override
+ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+ super.initialize(cordova, webView);
+ Activity activity = this.cordova.getActivity();
+ activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ }
+
+ @Override
+ public boolean execute(String action, JSONArray data, final CallbackContext callbackContext) throws JSONException {
+ mContext = this;
+ if (action.equals("enable")) {
+ mContext.cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ try{
+ // Allow to make screenshots removing the FLAG_SECURE
+ if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
+ mContext.cordova.getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ }
+ callbackContext.success("Success");
+ }catch(Exception e){
+ callbackContext.error(e.toString());
+ }
+ }
+ });
+
+ return true;
+ }else if (action.equals("disable")) {
+ mContext.cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ try{
+ // Allow to make screenshots removing the FLAG_SECURE
+ // Disable the creation of screenshots adding the FLAG_SECURE to the window
+ if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
+ mContext.cordova.getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
+ WindowManager.LayoutParams.FLAG_SECURE);
+ }
+ callbackContext.success("Success");
+ }catch(Exception e){
+ callbackContext.error(e.toString());
+ }
+ }
+ });
+ return true;
+ }
+ else{
+ return false;
+ }
+
+ }
+
+}
<feature name="Fingerprint">
<param name="android-package" value="de.niklasmerz.cordova.biometric.Fingerprint" />
</feature>
+ <feature name="screenshotName">
+ <param name="android-package" value="com.coffice.ScreenshotBlocker" />
+ <param name="onload" value="true" />
+ </feature>
<name short="大理智警">dlapp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
"clobbers": [
"Fingerprint"
]
+ },
+ {
+ "id": "cordova-plugin-prevent-screenshot-coffice.screenshot",
+ "file": "plugins/cordova-plugin-prevent-screenshot-coffice/www/screenshot.js",
+ "pluginId": "cordova-plugin-prevent-screenshot-coffice",
+ "clobbers": [
+ "window.plugins.preventscreenshot"
+ ]
}
];
module.exports.metadata = {
"cordova-plugin-app-version": "0.1.9",
"cordova-plugin-wkwebview-engine": "1.2.1",
"cordova-plugin-brightness": "0.1.5",
- "cordova-plugin-fingerprint-aio": "3.0.1"
+ "cordova-plugin-fingerprint-aio": "3.0.1",
+ "cordova-plugin-prevent-screenshot-coffice": "1.0.1"
};
});
\ No newline at end of file
--- /dev/null
+/*global cordova, module*/
+(function(module){
+ function PreventScreenshots(){
+ var core = {};
+ var isEnabled = true;
+
+ var callFunctionIfExists = function(fn,params){
+ if(typeof(fn) !== "function"){
+ return false;
+ }
+
+ fn.call();
+ return true;
+ };
+
+ core.enable = function(success,error){
+ cordova.exec(function(data){
+ isEnabled = true;
+ callFunctionIfExists(success);
+ }, function(err){
+ callFunctionIfExists(error);
+ }, "OurCodeWorldpreventscreenshots", "enable", []);
+ };
+
+ core.disable = function(success,error){
+ cordova.exec(function(data){
+ isEnabled = false;
+ callFunctionIfExists(success);
+ }, function(err){
+ callFunctionIfExists(error);
+ }, "OurCodeWorldpreventscreenshots", "disable", []);
+ };
+
+ core.isEnabled = function(){
+ return isEnabled;
+ };
+
+ return core;
+ }
+
+ module.exports = new PreventScreenshots();
+})(module);
--- /dev/null
+cordova.define("com.ourcodeworld.preventscreenshots.OurCodeWorldpreventscreenshots", function(require, exports, module) {
+/*global cordova, module*/
+(function(module){
+ function PreventScreenshots(){
+ var core = {};
+ var isEnabled = true;
+
+ var callFunctionIfExists = function(fn,params){
+ if(typeof(fn) !== "function"){
+ return false;
+ }
+
+ fn.call();
+ return true;
+ };
+
+ core.enable = function(success,error){
+ cordova.exec(function(data){
+ isEnabled = true;
+ callFunctionIfExists(success);
+ }, function(err){
+ callFunctionIfExists(error);
+ }, "OurCodeWorldpreventscreenshots", "enable", []);
+ };
+
+ core.disable = function(success,error){
+ cordova.exec(function(data){
+ isEnabled = false;
+ callFunctionIfExists(success);
+ }, function(err){
+ callFunctionIfExists(error);
+ }, "OurCodeWorldpreventscreenshots", "disable", []);
+ };
+
+ core.isEnabled = function(){
+ return isEnabled;
+ };
+
+ return core;
+ }
+
+ module.exports = new PreventScreenshots();
+})(module);
+
+});
--- /dev/null
+cordova.define("cordova-plugin-prevent-screenshot-coffice.screenshot", function(require, exports, module) {
+var screenshot = {
+ enable: function (successCallback, errorCallback) {
+ cordova.exec(successCallback, errorCallback, 'screenshotName', 'enable', []);
+ },
+ disable: function (successCallback, errorCallback) {
+ cordova.exec(successCallback, errorCallback, 'screenshotName', 'disable', []);
+ },
+ registerListener : function(callback) {
+ cordova.exec(callback, callback, 'screenshotName', 'listen', []);
+
+ }
+}
+
+cordova.addConstructor(function () {
+ if (!window.plugins) {window.plugins = {};}
+
+ window.plugins.preventscreenshot = screenshot;
+ document.addEventListener("onTookScreenshot",function(){
+ console.log('tookScreenshot');
+ });
+ document.addEventListener("onGoingBackground",function(){
+ console.log('BackgroundCalled');
+ });
+ screenshot.registerListener(function(me) {
+ console.log('received listener:',me);
+ if(me === "background") {
+ var event = new Event('onGoingBackground');
+ document.dispatchEvent(event);
+ return;
+ }
+ if(me === "tookScreenshot") {
+ var event = new Event('onTookScreenshot');
+ document.dispatchEvent(event);
+ return;
+ }
+ });
+ return window.plugins.preventscreenshot;
+});
+});
},
"cordova-plugin-fingerprint-aio": {
"PACKAGE_NAME": "com.dalicitycard.app"
+ },
+ "cordova-plugin-prevent-screenshot-coffice": {
+ "PACKAGE_NAME": "com.dalipolice.app"
}
},
"dependent_plugins": {},
"clobbers": [
"Fingerprint"
]
+ },
+ {
+ "file": "plugins/cordova-plugin-prevent-screenshot-coffice/www/screenshot.js",
+ "id": "cordova-plugin-prevent-screenshot-coffice.screenshot",
+ "pluginId": "cordova-plugin-prevent-screenshot-coffice",
+ "clobbers": [
+ "window.plugins.preventscreenshot"
+ ]
}
],
"plugin_metadata": {
"cordova-plugin-app-version": "0.1.9",
"cordova-plugin-wkwebview-engine": "1.2.1",
"cordova-plugin-brightness": "0.1.5",
- "cordova-plugin-fingerprint-aio": "3.0.1"
+ "cordova-plugin-fingerprint-aio": "3.0.1",
+ "cordova-plugin-prevent-screenshot-coffice": "1.0.1"
}
}
"clobbers": [
"Fingerprint"
]
+ },
+ {
+ "file": "plugins/cordova-plugin-prevent-screenshot-coffice/www/screenshot.js",
+ "id": "cordova-plugin-prevent-screenshot-coffice.screenshot",
+ "pluginId": "cordova-plugin-prevent-screenshot-coffice",
+ "clobbers": [
+ "window.plugins.preventscreenshot"
+ ]
}
];
module.exports.metadata =
"cordova-plugin-app-version": "0.1.9",
"cordova-plugin-wkwebview-engine": "1.2.1",
"cordova-plugin-brightness": "0.1.5",
- "cordova-plugin-fingerprint-aio": "3.0.1"
+ "cordova-plugin-fingerprint-aio": "3.0.1",
+ "cordova-plugin-prevent-screenshot-coffice": "1.0.1"
}
// BOTTOM OF METADATA
});
\ No newline at end of file
--- /dev/null
+cordova.define("cordova-plugin-prevent-screenshot-coffice.screenshot", function(require, exports, module) { var screenshot = {
+ enable: function (successCallback, errorCallback) {
+ cordova.exec(successCallback, errorCallback, 'screenshotName', 'enable', []);
+ },
+ disable: function (successCallback, errorCallback) {
+ cordova.exec(successCallback, errorCallback, 'screenshotName', 'disable', []);
+ },
+ registerListener : function(callback) {
+ cordova.exec(callback, callback, 'screenshotName', 'listen', []);
+
+ }
+}
+
+cordova.addConstructor(function () {
+ if (!window.plugins) {window.plugins = {};}
+
+ window.plugins.preventscreenshot = screenshot;
+ document.addEventListener("onTookScreenshot",function(){
+ console.log('tookScreenshot');
+ });
+ document.addEventListener("onGoingBackground",function(){
+ console.log('BackgroundCalled');
+ });
+ screenshot.registerListener(function(me) {
+ console.log('received listener:',me);
+ if(me === "background") {
+ var event = new Event('onGoingBackground');
+ document.dispatchEvent(event);
+ return;
+ }
+ if(me === "tookScreenshot") {
+ var event = new Event('onTookScreenshot');
+ document.dispatchEvent(event);
+ return;
+ }
+ });
+ return window.plugins.preventscreenshot;
+});
+});
F939AD8D22BB769B006B371B /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F939AD8C22BB769B006B371B /* libsqlite3.0.tbd */; };
FDE92C386167415E8040F8AB /* AFURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = FDEE8379D7A34C55A616F700 /* AFURLResponseSerialization.m */; };
81B8C05354704A02AE1560A0 /* Fingerprint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BDB5993A0D495C9E97E995 /* Fingerprint.swift */; };
+ F70AC332CD71455D9E103429 /* ScreenshotBlocker.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD5959A12D340C3AB8685C0 /* ScreenshotBlocker.m */; };
+ 1ED02270B4D74F8BB970350D /* ScreenRecordingDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = E806644FDDDD4DB9B0A7D6E4 /* ScreenRecordingDetector.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
FE0B455916A4481681D59FE0 /* WebKit.framework */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
39BDB5993A0D495C9E97E995 /* Fingerprint.swift */ = {isa = PBXFileReference; name = "Fingerprint.swift"; path = "cordova-plugin-fingerprint-aio/Fingerprint.swift"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.swift; explicitFileType = undefined; includeInIndex = 0; };
705239B1B7D9402DA8A9FDA7 /* Bridging-Header.h */ = {isa = PBXFileReference; name = "Bridging-Header.h"; path = "cordova-plugin-fingerprint-aio/Bridging-Header.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
+ 8BD5959A12D340C3AB8685C0 /* ScreenshotBlocker.m */ = {isa = PBXFileReference; name = "ScreenshotBlocker.m"; path = "cordova-plugin-prevent-screenshot-coffice/ScreenshotBlocker.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; };
+ E806644FDDDD4DB9B0A7D6E4 /* ScreenRecordingDetector.m */ = {isa = PBXFileReference; name = "ScreenRecordingDetector.m"; path = "cordova-plugin-prevent-screenshot-coffice/ScreenRecordingDetector.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; };
+ 5FA4467FDA284333A275FA08 /* ScreenshotBlocker.h */ = {isa = PBXFileReference; name = "ScreenshotBlocker.h"; path = "cordova-plugin-prevent-screenshot-coffice/ScreenshotBlocker.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
+ 6C8C62629761432796084184 /* ScreenRecordingDetector.h */ = {isa = PBXFileReference; name = "ScreenRecordingDetector.h"; path = "cordova-plugin-prevent-screenshot-coffice/ScreenRecordingDetector.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
817A61F7D48245FA9567B115 /* Brightness.h */,
39BDB5993A0D495C9E97E995 /* Fingerprint.swift */,
705239B1B7D9402DA8A9FDA7 /* Bridging-Header.h */,
+ 8BD5959A12D340C3AB8685C0 /* ScreenshotBlocker.m */,
+ E806644FDDDD4DB9B0A7D6E4 /* ScreenRecordingDetector.m */,
+ 5FA4467FDA284333A275FA08 /* ScreenshotBlocker.h */,
+ 6C8C62629761432796084184 /* ScreenRecordingDetector.h */,
);
name = Plugins;
path = dlapp/Plugins;
1F969D21D7EF4CF1A547A1DF /* CDVWKProcessPoolFactory.m in Sources */,
C0A6FD40F47B434496535606 /* Brightness.m in Sources */,
81B8C05354704A02AE1560A0 /* Fingerprint.swift in Sources */,
+ F70AC332CD71455D9E103429 /* ScreenshotBlocker.m in Sources */,
+ 1ED02270B4D74F8BB970350D /* ScreenRecordingDetector.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
--- /dev/null
+//
+// ScreenRecordingDetector.h
+//
+
+/*
+ScreenRecordingDetector checks for screen capturing as well as airplay mirroring
+*/
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+extern NSString *kScreenRecordingDetectorRecordingStatusChangedNotification;
+
+@interface ScreenRecordingDetector : NSObject
+
++(instancetype)sharedInstance;
++ (void)triggerDetectorTimer;
++ (void)stopDetectorTimer;
+- (BOOL)isRecording;
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// ScreenRecordingDetector.m
+// ScreenCaptureDetector
+//
+//
+
+#import "ScreenRecordingDetector.h"
+float const kScreenRecordingDetectorTimerInterval = 1.0;
+NSString *kScreenRecordingDetectorRecordingStatusChangedNotification = @"kScreenRecordingDetectorRecordingStatusChangedNotification";
+
+@interface ScreenRecordingDetector()
+
+@property BOOL lastRecordingState;
+@property NSTimer *timer;
+
+@end
+@implementation ScreenRecordingDetector
+
+
++ (instancetype)sharedInstance {
+ static ScreenRecordingDetector *sharedInstance = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ sharedInstance = [[self alloc] init];
+ });
+ return sharedInstance;
+}
+- (id)init {
+ if (self = [super init]) {
+ // do some init stuff here..
+ self.lastRecordingState = NO; // initially the recording state is 'NO'. This is the default state.
+ self.timer = NULL;
+ }
+ return self;
+}
+- (BOOL)isRecording {
+ for (UIScreen *screen in UIScreen.screens) {
+ if ([screen respondsToSelector:@selector(isCaptured)]) {
+ // iOS 11+ has isCaptured method.
+ if ([screen performSelector:@selector(isCaptured)]) {
+ return YES; // screen capture is active
+ } else if (screen.mirroredScreen) {
+ return YES; // mirroring is active
+ }
+ } else {
+ // iOS version below 11.0
+ if (screen.mirroredScreen)
+ return YES;
+ }
+ }
+ return NO;
+}
++ (void)triggerDetectorTimer {
+
+ ScreenRecordingDetector *detector = [ScreenRecordingDetector sharedInstance];
+ if (detector.timer) {
+ [self stopDetectorTimer];
+ }
+ detector.timer = [NSTimer scheduledTimerWithTimeInterval:kScreenRecordingDetectorTimerInterval
+ target:detector
+ selector:@selector(checkCurrentRecordingStatus:)
+ userInfo:nil
+ repeats:YES];
+}
+- (void)checkCurrentRecordingStatus:(NSTimer *)timer {
+ BOOL isRecording = [self isRecording];
+ if (isRecording != self.lastRecordingState) {
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ [center postNotificationName: kScreenRecordingDetectorRecordingStatusChangedNotification object:nil];
+ }
+ self.lastRecordingState = isRecording;
+}
++ (void)stopDetectorTimer {
+ ScreenRecordingDetector *detector = [ScreenRecordingDetector sharedInstance];
+ if (detector.timer) {
+ [detector.timer invalidate];
+ detector.timer = NULL;
+ }
+}
+@end
\ No newline at end of file
--- /dev/null
+#import <Cordova/CDV.h>
+#import "ScreenRecordingDetector.h"
+
+
+@interface ScreenshotBlocker : CDVPlugin
+
+- (void)enable:(CDVInvokedUrlCommand*)command;
+-(void)listen:(CDVInvokedUrlCommand*)command;
+
+@end
--- /dev/null
+#import "ScreenshotBlocker.h"
+@interface ScreenshotBlocker() {
+ CDVInvokedUrlCommand * _eventCommand;
+}
+@end
+
+@implementation ScreenshotBlocker
+UIImageView* cover;
+- (void)pluginInitialize {
+ NSLog(@"Starting ScreenshotBlocker plugin");
+
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(appDidBecomeActive)
+ name:UIApplicationDidBecomeActiveNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(applicationWillResignActive)
+ name:UIApplicationWillResignActiveNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(tookScreeshot)
+ name:UIApplicationUserDidTakeScreenshotNotification
+ object:nil];
+
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(goingBackground)
+ name:UIApplicationWillResignActiveNotification
+ object:nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(screenCaptureStatusChanged)
+ name:kScreenRecordingDetectorRecordingStatusChangedNotification
+ object:nil];
+
+ /*
+ userDidTakeScreenshotNotification
+ */
+
+}
+
+- (void)enable:(CDVInvokedUrlCommand *)command
+{
+ CDVPluginResult* pluginResult = nil;
+ NSLog(@"Abilita observers");
+ /*
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(appDidBecomeActive)
+ name:UIApplicationDidBecomeActiveNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(applicationWillResignActive)
+ name:UIApplicationWillResignActiveNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(screenCaptureStatusChanged)
+ name:kScreenRecordingDetectorRecordingStatusChangedNotification
+ object:nil];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ */
+}
+-(void)listen:(CDVInvokedUrlCommand*)command {
+ _eventCommand = command;
+}
+
+
+-(void) goingBackground {
+ NSLog(@"Me la scattion in bck");
+ if(_eventCommand!=nil) {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"background"];
+ [pluginResult setKeepCallbackAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:_eventCommand.callbackId];
+ }
+}
+-(void)tookScreeshot {
+ NSLog(@"fatta la foto?");
+ if(_eventCommand!=nil) {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"tookScreenshot"];
+ [pluginResult setKeepCallbackAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:_eventCommand.callbackId];
+ }
+
+}
+
+-(void)setupView {
+ BOOL isCaptured = [[UIScreen mainScreen] isCaptured];
+ NSLog(@"Is screen captured? %@", (isCaptured?@"SI":@"NO"));
+
+ if ([[ScreenRecordingDetector sharedInstance] isRecording]) {
+ [self webView].alpha = 0.f;
+ NSLog(@"Registro o prendo screenshots");
+ } else {
+ [self webView].alpha = 1.f;
+ NSLog(@"Non registro");
+
+ }
+}
+
+-(void)appDidBecomeActive {
+ [ScreenRecordingDetector triggerDetectorTimer];
+ if(cover!=nil) {
+ [cover removeFromSuperview];
+ cover = nil;
+ }
+}
+-(void)applicationWillResignActive {
+ [ScreenRecordingDetector stopDetectorTimer];
+ if(cover == nil) {
+ cover = [[UIImageView alloc] initWithFrame:[self.webView frame]];
+ cover.backgroundColor = [UIColor blackColor];
+ [self.webView addSubview:cover];
+ }
+}
+-(void)screenCaptureStatusChanged {
+ [self setupView];
+}
+
+
+@end
<feature name="Fingerprint">
<param name="ios-package" value="Fingerprint" />
</feature>
+ <feature name="screenshotName">
+ <param name="ios-package" value="ScreenshotBlocker" />
+ <param name="onload" value="true" />
+ </feature>
<name short="大理智警">dlapp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
{
"xml": "<feature name=\"Fingerprint\"><param name=\"ios-package\" value=\"Fingerprint\" /></feature>",
"count": 1
+ },
+ {
+ "xml": "<feature name=\"screenshotName\"><param name=\"ios-package\" value=\"ScreenshotBlocker\" /><param name=\"onload\" value=\"true\" /></feature>",
+ "count": 1
}
]
}
"cordova-plugin-fingerprint-aio": {
"FACEID_USAGE_DESCRIPTION": " ",
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
+ },
+ "cordova-plugin-prevent-screenshot-coffice": {
+ "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}
},
"dependent_plugins": {},
"clobbers": [
"Fingerprint"
]
+ },
+ {
+ "id": "cordova-plugin-prevent-screenshot-coffice.screenshot",
+ "file": "plugins/cordova-plugin-prevent-screenshot-coffice/www/screenshot.js",
+ "pluginId": "cordova-plugin-prevent-screenshot-coffice",
+ "clobbers": [
+ "window.plugins.preventscreenshot"
+ ]
}
],
"plugin_metadata": {
"cordova-plugin-app-version": "0.1.9",
"cordova-plugin-wkwebview-engine": "1.2.1",
"cordova-plugin-brightness": "0.1.5",
- "cordova-plugin-fingerprint-aio": "3.0.1"
+ "cordova-plugin-fingerprint-aio": "3.0.1",
+ "cordova-plugin-prevent-screenshot-coffice": "1.0.1"
}
}
"clobbers": [
"Fingerprint"
]
+ },
+ {
+ "id": "cordova-plugin-prevent-screenshot-coffice.screenshot",
+ "file": "plugins/cordova-plugin-prevent-screenshot-coffice/www/screenshot.js",
+ "pluginId": "cordova-plugin-prevent-screenshot-coffice",
+ "clobbers": [
+ "window.plugins.preventscreenshot"
+ ]
}
];
module.exports.metadata = {
"cordova-plugin-app-version": "0.1.9",
"cordova-plugin-wkwebview-engine": "1.2.1",
"cordova-plugin-brightness": "0.1.5",
- "cordova-plugin-fingerprint-aio": "3.0.1"
+ "cordova-plugin-fingerprint-aio": "3.0.1",
+ "cordova-plugin-prevent-screenshot-coffice": "1.0.1"
};
});
\ No newline at end of file
--- /dev/null
+cordova.define("cordova-plugin-prevent-screenshot-coffice.screenshot", function(require, exports, module) {
+var screenshot = {
+ enable: function (successCallback, errorCallback) {
+ cordova.exec(successCallback, errorCallback, 'screenshotName', 'enable', []);
+ },
+ disable: function (successCallback, errorCallback) {
+ cordova.exec(successCallback, errorCallback, 'screenshotName', 'disable', []);
+ },
+ registerListener : function(callback) {
+ cordova.exec(callback, callback, 'screenshotName', 'listen', []);
+
+ }
+}
+
+cordova.addConstructor(function () {
+ if (!window.plugins) {window.plugins = {};}
+
+ window.plugins.preventscreenshot = screenshot;
+ document.addEventListener("onTookScreenshot",function(){
+ console.log('tookScreenshot');
+ });
+ document.addEventListener("onGoingBackground",function(){
+ console.log('BackgroundCalled');
+ });
+ screenshot.registerListener(function(me) {
+ console.log('received listener:',me);
+ if(me === "background") {
+ var event = new Event('onGoingBackground');
+ document.dispatchEvent(event);
+ return;
+ }
+ if(me === "tookScreenshot") {
+ var event = new Event('onTookScreenshot');
+ document.dispatchEvent(event);
+ return;
+ }
+ });
+ return window.plugins.preventscreenshot;
+});
+});
},
"cordova-plugin-fingerprint-aio": {
"PACKAGE_NAME": "com.dalicitycard.app"
+ },
+ "cordova-plugin-prevent-screenshot-coffice": {
+ "PACKAGE_NAME": "com.dalipolice.app"
}
},
"dependent_plugins": {
},
"cordova-plugin-fingerprint-aio": {
"PACKAGE_NAME": "com.dalicitycard.app"
+ },
+ "cordova-plugin-prevent-screenshot-coffice": {
+ "PACKAGE_NAME": "com.dalipolice.app"
}
},
"dependent_plugins": {
--- /dev/null
+MIT License
+
+Copyright (c) 2019 flotrugliocoffice
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null
+{
+ "_from": "git+https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git",
+ "_id": "cordova-plugin-prevent-screenshot-coffice@1.0.1",
+ "_inBundle": false,
+ "_integrity": "",
+ "_location": "/cordova-plugin-prevent-screenshot-coffice",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "git",
+ "raw": "https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git",
+ "rawSpec": "https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git",
+ "saveSpec": "git+https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git",
+ "fetchSpec": "https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git",
+ "gitCommittish": null
+ },
+ "_requiredBy": [
+ "#USER",
+ "/"
+ ],
+ "_resolved": "git+https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git#705e0bd6ee9029fadcfd5520bb38dc3fa408e950",
+ "_spec": "https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git",
+ "_where": "/Users/shuwei/works2/cordova/dlapp",
+ "author": {
+ "name": "Francesco Lo Truglio",
+ "email": "flotruglio@cofficegroup.com",
+ "url": "https://www.cofficegroup.com"
+ },
+ "bugs": {
+ "url": "https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice/issues"
+ },
+ "bundleDependencies": false,
+ "cordova": {
+ "id": "cordova-plugin-prevent-screenshot-coffice",
+ "platforms": [
+ "ios",
+ "android"
+ ]
+ },
+ "deprecated": false,
+ "description": "Cordova plugin for prevent screenCapture",
+ "homepage": "https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice#readme",
+ "keywords": [
+ "cordova",
+ "screencapture",
+ "ecosystem:cordova",
+ "cordova-android",
+ "cordova-ios"
+ ],
+ "license": "MIT",
+ "name": "cordova-plugin-prevent-screenshot-coffice",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git"
+ },
+ "scripts": {
+ "postversion": "git push && git push --tags",
+ "version": "replace -s 'version=\"(.+)(?=\">)' 'version=\"'$npm_package_version plugin.xml && git add plugin.xml"
+ },
+ "version": "1.0.1"
+}
--- /dev/null
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ id="cordova-plugin-prevent-screenshot-coffice"
+ version="1.0.1">
+
+ <name>cordova-plugin-prevent-screenshot-coffice</name>
+ <description>Cordova plugin for prevent screenCapture</description>
+ <license>MIT</license>
+ <keywords>cordova</keywords>
+ <repo>https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice</repo>
+ <issue>https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice/issues</issue>
+
+ <js-module src="www/screenshot.js" name="screenshot">
+ <clobbers target="window.plugins.preventscreenshot"/>
+ </js-module>
+
+ <engines>
+ <engine name="cordova" version=">=7.1.0"/>
+ <engine name="cordova-android" version=">=7.0.0"/>
+ <engine name="cordova-ios" version=">=4.3.0"/>
+ </engines>
+
+ <platform name="android">
+ <config-file target="res/xml/config.xml" parent="/*">
+ <feature name="screenshotName">
+ <param name="android-package" value="com.coffice.ScreenshotBlocker"/>
+ <param name="onload" value="true"/>
+ </feature>
+ </config-file>
+
+ <source-file src="src/android/com/coffice/ScreenshotBlocker.java" target-dir="src/com/coffice"/>
+ </platform>
+
+ <platform name="ios">
+ <config-file target="config.xml" parent="/*">
+ <feature name="screenshotName">
+ <param name="ios-package" value="ScreenshotBlocker"/>
+ <param name="onload" value="true"/>
+ </feature>
+ </config-file>
+
+ <header-file src="src/ios/ScreenshotBlocker.h"/>
+ <source-file src="src/ios/ScreenshotBlocker.m"/>
+ <header-file src="src/ios/ScreenRecordingDetector.h"/>
+ <source-file src="src/ios/ScreenRecordingDetector.m"/>
+ </platform>
+
+</plugin>
--- /dev/null
+package com.coffice;
+
+import android.app.Activity;
+import android.view.WindowManager;
+
+import org.apache.cordova.*;
+import org.json.JSONArray;
+import org.json.JSONException;
+
+public class ScreenshotBlocker extends CordovaPlugin{
+ private com.coffice.ScreenshotBlocker mContext;
+
+ @Override
+ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+ super.initialize(cordova, webView);
+ Activity activity = this.cordova.getActivity();
+ activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ }
+
+ @Override
+ public boolean execute(String action, JSONArray data, final CallbackContext callbackContext) throws JSONException {
+ mContext = this;
+ if (action.equals("enable")) {
+ mContext.cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ try{
+ // Allow to make screenshots removing the FLAG_SECURE
+ if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
+ mContext.cordova.getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
+ }
+ callbackContext.success("Success");
+ }catch(Exception e){
+ callbackContext.error(e.toString());
+ }
+ }
+ });
+
+ return true;
+ }else if (action.equals("disable")) {
+ mContext.cordova.getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ try{
+ // Allow to make screenshots removing the FLAG_SECURE
+ // Disable the creation of screenshots adding the FLAG_SECURE to the window
+ if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
+ mContext.cordova.getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
+ WindowManager.LayoutParams.FLAG_SECURE);
+ }
+ callbackContext.success("Success");
+ }catch(Exception e){
+ callbackContext.error(e.toString());
+ }
+ }
+ });
+ return true;
+ }
+ else{
+ return false;
+ }
+
+ }
+
+}
--- /dev/null
+//
+// ScreenRecordingDetector.h
+//
+
+/*
+ScreenRecordingDetector checks for screen capturing as well as airplay mirroring
+*/
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+extern NSString *kScreenRecordingDetectorRecordingStatusChangedNotification;
+
+@interface ScreenRecordingDetector : NSObject
+
++(instancetype)sharedInstance;
++ (void)triggerDetectorTimer;
++ (void)stopDetectorTimer;
+- (BOOL)isRecording;
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// ScreenRecordingDetector.m
+// ScreenCaptureDetector
+//
+//
+
+#import "ScreenRecordingDetector.h"
+float const kScreenRecordingDetectorTimerInterval = 1.0;
+NSString *kScreenRecordingDetectorRecordingStatusChangedNotification = @"kScreenRecordingDetectorRecordingStatusChangedNotification";
+
+@interface ScreenRecordingDetector()
+
+@property BOOL lastRecordingState;
+@property NSTimer *timer;
+
+@end
+@implementation ScreenRecordingDetector
+
+
++ (instancetype)sharedInstance {
+ static ScreenRecordingDetector *sharedInstance = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ sharedInstance = [[self alloc] init];
+ });
+ return sharedInstance;
+}
+- (id)init {
+ if (self = [super init]) {
+ // do some init stuff here..
+ self.lastRecordingState = NO; // initially the recording state is 'NO'. This is the default state.
+ self.timer = NULL;
+ }
+ return self;
+}
+- (BOOL)isRecording {
+ for (UIScreen *screen in UIScreen.screens) {
+ if ([screen respondsToSelector:@selector(isCaptured)]) {
+ // iOS 11+ has isCaptured method.
+ if ([screen performSelector:@selector(isCaptured)]) {
+ return YES; // screen capture is active
+ } else if (screen.mirroredScreen) {
+ return YES; // mirroring is active
+ }
+ } else {
+ // iOS version below 11.0
+ if (screen.mirroredScreen)
+ return YES;
+ }
+ }
+ return NO;
+}
++ (void)triggerDetectorTimer {
+
+ ScreenRecordingDetector *detector = [ScreenRecordingDetector sharedInstance];
+ if (detector.timer) {
+ [self stopDetectorTimer];
+ }
+ detector.timer = [NSTimer scheduledTimerWithTimeInterval:kScreenRecordingDetectorTimerInterval
+ target:detector
+ selector:@selector(checkCurrentRecordingStatus:)
+ userInfo:nil
+ repeats:YES];
+}
+- (void)checkCurrentRecordingStatus:(NSTimer *)timer {
+ BOOL isRecording = [self isRecording];
+ if (isRecording != self.lastRecordingState) {
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ [center postNotificationName: kScreenRecordingDetectorRecordingStatusChangedNotification object:nil];
+ }
+ self.lastRecordingState = isRecording;
+}
++ (void)stopDetectorTimer {
+ ScreenRecordingDetector *detector = [ScreenRecordingDetector sharedInstance];
+ if (detector.timer) {
+ [detector.timer invalidate];
+ detector.timer = NULL;
+ }
+}
+@end
\ No newline at end of file
--- /dev/null
+#import <Cordova/CDV.h>
+#import "ScreenRecordingDetector.h"
+
+
+@interface ScreenshotBlocker : CDVPlugin
+
+- (void)enable:(CDVInvokedUrlCommand*)command;
+-(void)listen:(CDVInvokedUrlCommand*)command;
+
+@end
--- /dev/null
+#import "ScreenshotBlocker.h"
+@interface ScreenshotBlocker() {
+ CDVInvokedUrlCommand * _eventCommand;
+}
+@end
+
+@implementation ScreenshotBlocker
+UIImageView* cover;
+- (void)pluginInitialize {
+ NSLog(@"Starting ScreenshotBlocker plugin");
+
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(appDidBecomeActive)
+ name:UIApplicationDidBecomeActiveNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(applicationWillResignActive)
+ name:UIApplicationWillResignActiveNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(tookScreeshot)
+ name:UIApplicationUserDidTakeScreenshotNotification
+ object:nil];
+
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(goingBackground)
+ name:UIApplicationWillResignActiveNotification
+ object:nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(screenCaptureStatusChanged)
+ name:kScreenRecordingDetectorRecordingStatusChangedNotification
+ object:nil];
+
+ /*
+ userDidTakeScreenshotNotification
+ */
+
+}
+
+- (void)enable:(CDVInvokedUrlCommand *)command
+{
+ CDVPluginResult* pluginResult = nil;
+ NSLog(@"Abilita observers");
+ /*
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(appDidBecomeActive)
+ name:UIApplicationDidBecomeActiveNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter]addObserver:self
+ selector:@selector(applicationWillResignActive)
+ name:UIApplicationWillResignActiveNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(screenCaptureStatusChanged)
+ name:kScreenRecordingDetectorRecordingStatusChangedNotification
+ object:nil];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ */
+}
+-(void)listen:(CDVInvokedUrlCommand*)command {
+ _eventCommand = command;
+}
+
+
+-(void) goingBackground {
+ NSLog(@"Me la scattion in bck");
+ if(_eventCommand!=nil) {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"background"];
+ [pluginResult setKeepCallbackAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:_eventCommand.callbackId];
+ }
+}
+-(void)tookScreeshot {
+ NSLog(@"fatta la foto?");
+ if(_eventCommand!=nil) {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"tookScreenshot"];
+ [pluginResult setKeepCallbackAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:_eventCommand.callbackId];
+ }
+
+}
+
+-(void)setupView {
+ BOOL isCaptured = [[UIScreen mainScreen] isCaptured];
+ NSLog(@"Is screen captured? %@", (isCaptured?@"SI":@"NO"));
+
+ if ([[ScreenRecordingDetector sharedInstance] isRecording]) {
+ [self webView].alpha = 0.f;
+ NSLog(@"Registro o prendo screenshots");
+ } else {
+ [self webView].alpha = 1.f;
+ NSLog(@"Non registro");
+
+ }
+}
+
+-(void)appDidBecomeActive {
+ [ScreenRecordingDetector triggerDetectorTimer];
+ if(cover!=nil) {
+ [cover removeFromSuperview];
+ cover = nil;
+ }
+}
+-(void)applicationWillResignActive {
+ [ScreenRecordingDetector stopDetectorTimer];
+ if(cover == nil) {
+ cover = [[UIImageView alloc] initWithFrame:[self.webView frame]];
+ cover.backgroundColor = [UIColor blackColor];
+ [self.webView addSubview:cover];
+ }
+}
+-(void)screenCaptureStatusChanged {
+ [self setupView];
+}
+
+
+@end
--- /dev/null
+var screenshot = {
+ enable: function (successCallback, errorCallback) {
+ cordova.exec(successCallback, errorCallback, 'screenshotName', 'enable', []);
+ },
+ disable: function (successCallback, errorCallback) {
+ cordova.exec(successCallback, errorCallback, 'screenshotName', 'disable', []);
+ },
+ registerListener : function(callback) {
+ cordova.exec(callback, callback, 'screenshotName', 'listen', []);
+
+ }
+}
+
+cordova.addConstructor(function () {
+ if (!window.plugins) {window.plugins = {};}
+
+ window.plugins.preventscreenshot = screenshot;
+ document.addEventListener("onTookScreenshot",function(){
+ console.log('tookScreenshot');
+ });
+ document.addEventListener("onGoingBackground",function(){
+ console.log('BackgroundCalled');
+ });
+ screenshot.registerListener(function(me) {
+ console.log('received listener:',me);
+ if(me === "background") {
+ var event = new Event('onGoingBackground');
+ document.dispatchEvent(event);
+ return;
+ }
+ if(me === "tookScreenshot") {
+ var event = new Event('onTookScreenshot');
+ document.dispatchEvent(event);
+ return;
+ }
+ });
+ return window.plugins.preventscreenshot;
+});
\ No newline at end of file
},
"is_top_level": true,
"variables": {}
+ },
+ "cordova-plugin-prevent-screenshot-coffice": {
+ "source": {
+ "type": "registry",
+ "id": "https://github.com/flotrugliocoffice/cordova-plugin-prevent-screenshot-coffice.git"
+ },
+ "is_top_level": true,
+ "variables": {}
}
}
\ No newline at end of file
"cordova-plugin-fingerprint-aio": {
"FACEID_USAGE_DESCRIPTION": " ",
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
+ },
+ "cordova-plugin-prevent-screenshot-coffice": {
+ "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}
},
"dependent_plugins": {
onDeviceReady: function() {
var uid = window.localStorage.getItem("token");
- console.log("1."+window.localStorage.getItem("uid"))
this.initJpush();
$('#scanBtn').click(function() {
//window.location = "scan.html";
onDeviceReady: function() {
var uid = window.localStorage.getItem("token");
- console.log("1."+window.localStorage.getItem("uid"))
this.initJpush();
$('#scanBtn').click(function() {
//window.location = "scan.html";
e.preventDefault();
app.backTo();
}, false);
+
+ window.plugins.preventscreenshot.disable(function(ret){}, function(ret){});
},
loadQrcode: function() {
$.showLoading("加载中");