From d5afe333aacaf591ac2a9bd4928711d964a6cac3 Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Mon, 11 May 2020 07:19:39 +0000 Subject: [PATCH 01/11] Add support for storyboard images --- src/ios/PrivacyScreenPlugin.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ios/PrivacyScreenPlugin.m b/src/ios/PrivacyScreenPlugin.m index 67303ee..ff3dedd 100644 --- a/src/ios/PrivacyScreenPlugin.m +++ b/src/ios/PrivacyScreenPlugin.m @@ -74,6 +74,16 @@ - (CDV_iOSDevice) getCurrentDevice return device; } +- (BOOL) isUsingCDVLaunchScreen { + NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"]; + if (launchStoryboardName) { + return ([launchStoryboardName isEqualToString:@"CDVLaunchScreen"]); + } else { + return NO; + } +} + + - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(id<CDVScreenOrientationDelegate>)orientationDelegate device:(CDV_iOSDevice)device { // Use UILaunchImageFile if specified in plist. Otherwise, use Default. @@ -81,6 +91,13 @@ - (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(i NSUInteger supportedOrientations = [orientationDelegate supportedInterfaceOrientations]; + // detect if we are using CB-9762 Launch Storyboard; if so, return the associated image instead + if ([self isUsingCDVLaunchScreen]) { + imageName = @"LaunchStoryboard"; + return imageName; + } + + // Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape BOOL supportsLandscape = (supportedOrientations & UIInterfaceOrientationMaskLandscape); BOOL supportsPortrait = (supportedOrientations & UIInterfaceOrientationMaskPortrait || supportedOrientations & UIInterfaceOrientationMaskPortraitUpsideDown); From 0aeb1151fd90c216413b2f0d4e5f578460d26e18 Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Mon, 11 May 2020 07:41:54 +0000 Subject: [PATCH 02/11] FillImage --- src/ios/PrivacyScreenPlugin.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ios/PrivacyScreenPlugin.m b/src/ios/PrivacyScreenPlugin.m index ff3dedd..368bed6 100644 --- a/src/ios/PrivacyScreenPlugin.m +++ b/src/ios/PrivacyScreenPlugin.m @@ -40,6 +40,10 @@ - (void)onAppWillResignActive:(UIApplication *)application imageView = [[UIImageView alloc]initWithFrame:[self.viewController.view bounds]]; [imageView setImage:splash]; + // [imageView setContentMode:UIViewContentModeCenter]; // custom + //[imageView setContentMode:UIViewContentModeScaleAspectFit]; // custom + [imageView setContentMode:UIViewContentModeScaleAspectFill]; // custom + #ifdef __CORDOVA_4_0_0 [[UIApplication sharedApplication].keyWindow addSubview:imageView]; #else From 4a95fb3537dc69f8ad5d60741962bd1595bc11b8 Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Mon, 11 May 2020 11:07:52 +0000 Subject: [PATCH 03/11] Adapt docs, name and versioning --- README.md | 6 ++++-- package.json | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1631370..cac22b9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ -PrivacyScreenPlugin +PrivacyScreenPlugin-Storyboard ================== +This is a fork of the wonderful [PrivacyScreenPlugin](https://github.com/devgeeks/PrivacyScreenPlugin) +It's the same codebase for Android. For iOS it adds basic support for [iOS Storyboard images](https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/#launch-storyboard-images). Both iOS (as of iOS 7) and Android have app switchers that display a screenshot of your app. @@ -7,7 +9,7 @@ This is a lovely feature for most apps, but if your app displays sensitive infor This plugin flags your app so that it doesn't show your users' sensitive data in the task switcher. It sets the [FLAG_SECURE](http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE) flag in Android (which also prevents manual screenshots from being taken) and hides the window in iOS. -On iOS this plugin will try to show your splashscreen in the app switcher. It will search for splashscreens prefixed by `Default` or the value of the key `UILaunchImageFile` in your .plist file. +On iOS this plugin will try to show your splashscreen in the app switcher. It will search for splashscreens prefixed by `Default`, the value of the key `UILaunchImageFile` in your .plist file or use the provided Storyboard image. If it fails to find a splashscreen for a specific device or orientation (portrait or landscape), a black screen is shown instead. Installation diff --git a/package.json b/package.json index 46b9128..df14d1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "cordova-plugin-privacyscreen", - "version": "0.4.0", + "name": "cordova-plugin-privacyscreen-storyboard", + "version": "0.0.1", "description": "Secures your app from displaying a screenshot in task switchers under Android and iOS. Keeps sensitive information private.", "cordova": { "id": "cordova-plugin-privacyscreen", @@ -21,9 +21,10 @@ "cordova-ios" ], "author": "Tommy-Carlos Willaims <tommy@devgeeks.org>", + "contributors": ["Holger Grosse-Plankermann <holger.grosse-plankermann@codecentric.de>"], "license": "MIT", "bugs": { - "url": "https://github.com/devgeeks/PrivacyScreenPlugin/issues" + "url": "https://github.com/holgergp/PrivacyScreenPlugin/issues" }, - "homepage": "https://github.com/devgeeks/PrivacyScreenPlugin#readme" + "homepage": "https://github.com/holgergp/PrivacyScreenPlugin#readme" } From 56de6c8447f8af15f9d21ec27ac37876a1b50bbb Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Mon, 11 May 2020 11:08:30 +0000 Subject: [PATCH 04/11] Set approriate contentMode when using storyboard images --- src/ios/PrivacyScreenPlugin.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ios/PrivacyScreenPlugin.m b/src/ios/PrivacyScreenPlugin.m index 368bed6..810d404 100644 --- a/src/ios/PrivacyScreenPlugin.m +++ b/src/ios/PrivacyScreenPlugin.m @@ -40,9 +40,10 @@ - (void)onAppWillResignActive:(UIApplication *)application imageView = [[UIImageView alloc]initWithFrame:[self.viewController.view bounds]]; [imageView setImage:splash]; - // [imageView setContentMode:UIViewContentModeCenter]; // custom - //[imageView setContentMode:UIViewContentModeScaleAspectFit]; // custom - [imageView setContentMode:UIViewContentModeScaleAspectFill]; // custom + if ([self isUsingCDVLaunchScreen]) { + // launch screen expects the image to be scaled using AspectFill. + imageView.contentMode = UIViewContentModeScaleAspectFill; + } #ifdef __CORDOVA_4_0_0 [[UIApplication sharedApplication].keyWindow addSubview:imageView]; @@ -74,6 +75,8 @@ - (CDV_iOSDevice) getCurrentDevice // this is appropriate for detecting the runtime screen environment device.iPhone6 = (device.iPhone && limit == 667.0); device.iPhone6Plus = (device.iPhone && limit == 736.0); + device.iPhoneX = (device.iPhone && limit >= 812.0); + return device; } From d6a3722aa5f9ca0018cdccff890340d27dd86f19 Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Mon, 11 May 2020 11:11:25 +0000 Subject: [PATCH 05/11] Add Gitpod badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cac22b9..9472058 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[](https://gitpod.io/#https://github.com/holgergp/PrivacyScreenPlugin) + PrivacyScreenPlugin-Storyboard ================== This is a fork of the wonderful [PrivacyScreenPlugin](https://github.com/devgeeks/PrivacyScreenPlugin) From 9506059c85e7798be656ecad3082a06e1e069f61 Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Mon, 11 May 2020 11:14:02 +0000 Subject: [PATCH 06/11] Update some docs --- README.md | 4 ++-- package.json | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9472058..ebf4a5b 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ Installation For Cordova 3.x.x: -1. To add this plugin just type: `cordova plugin add cordova-plugin-privacyscreen` or `phonegap local plugin add cordova-plugin-privacyscreen` -2. To remove this plugin type: `cordova plugin remove cordova-plugin-privacyscreen` or `phonegap local plugin remove cordova-plugin-privacyscreen` +1. To add this plugin just type: `cordova plugin add cordova-plugin-privacyscreen-storyboard` or `phonegap local plugin add cordova-plugin-privacyscreen-storyboard` +2. To remove this plugin type: `cordova plugin remove cordova-plugin-privacyscreen-storyboard` or `phonegap local plugin remove cordova-plugin-privacyscreen-storyboard` Usage: ------ diff --git a/package.json b/package.json index df14d1e..549faf0 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "description": "Secures your app from displaying a screenshot in task switchers under Android and iOS. Keeps sensitive information private.", "cordova": { - "id": "cordova-plugin-privacyscreen", + "id": "cordova-plugin-privacyscreen-storyboard", "platforms": [ "android", "ios" @@ -11,14 +11,15 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/devgeeks/PrivacyScreenPlugin.git" + "url": "git+https://github.com/holgergp/PrivacyScreenPlugin.git" }, "keywords": [ "privacy", "cordova", "ecosystem:cordova", "cordova-android", - "cordova-ios" + "cordova-ios", + "storyboard" ], "author": "Tommy-Carlos Willaims <tommy@devgeeks.org>", "contributors": ["Holger Grosse-Plankermann <holger.grosse-plankermann@codecentric.de>"], From 98e9fa18911700150a13ebfaf1047c0a5ac0477d Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Mon, 11 May 2020 11:18:21 +0000 Subject: [PATCH 07/11] Reflect change of reponame --- package.json | 6 +++--- plugin.xml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 549faf0..553ecaf 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/holgergp/PrivacyScreenPlugin.git" + "url": "git+https://github.com/holgergp/PrivacyScreenPlugin-Storyboard.git" }, "keywords": [ "privacy", @@ -25,7 +25,7 @@ "contributors": ["Holger Grosse-Plankermann <holger.grosse-plankermann@codecentric.de>"], "license": "MIT", "bugs": { - "url": "https://github.com/holgergp/PrivacyScreenPlugin/issues" + "url": "https://github.com/holgergp/PrivacyScreenPlugin-Storyboard/issues" }, - "homepage": "https://github.com/holgergp/PrivacyScreenPlugin#readme" + "homepage": "https://github.com/holgergp/PrivacyScreenPlugin-Storyboard#readme" } diff --git a/plugin.xml b/plugin.xml index db96057..9f94418 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-privacyscreen" version="0.3.1"> +<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-privacyscreen-storyboard" version="0.3.1"> - <name>PrivacyScreenPlugin</name> + <name>PrivacyScreenPlugin-Storyboard</name> <description>Secures your app from displaying a screenshot in task switchers under Android and iOS. Keeps sensitive information private.</description> <license>MIT</license> <platform name="android"> From bb33d27ff38ddb03662b094491d2200594c381fe Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Tue, 12 May 2020 06:43:53 +0000 Subject: [PATCH 08/11] Fix syntax error --- src/ios/PrivacyScreenPlugin.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ios/PrivacyScreenPlugin.m b/src/ios/PrivacyScreenPlugin.m index 810d404..cdbdb3c 100644 --- a/src/ios/PrivacyScreenPlugin.m +++ b/src/ios/PrivacyScreenPlugin.m @@ -75,8 +75,6 @@ - (CDV_iOSDevice) getCurrentDevice // this is appropriate for detecting the runtime screen environment device.iPhone6 = (device.iPhone && limit == 667.0); device.iPhone6Plus = (device.iPhone && limit == 736.0); - device.iPhoneX = (device.iPhone && limit >= 812.0); - return device; } From 4d885cd7da5ae045bc8e58a885b7059e4beac4bd Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Tue, 12 May 2020 06:58:19 +0000 Subject: [PATCH 09/11] Update docs --- README.md | 8 ++------ package.json | 10 +++++----- plugin.xml | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ebf4a5b..5729874 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ -[](https://gitpod.io/#https://github.com/holgergp/PrivacyScreenPlugin) - PrivacyScreenPlugin-Storyboard ================== -This is a fork of the wonderful [PrivacyScreenPlugin](https://github.com/devgeeks/PrivacyScreenPlugin) -It's the same codebase for Android. For iOS it adds basic support for [iOS Storyboard images](https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/#launch-storyboard-images). Both iOS (as of iOS 7) and Android have app switchers that display a screenshot of your app. @@ -19,8 +15,8 @@ Installation For Cordova 3.x.x: -1. To add this plugin just type: `cordova plugin add cordova-plugin-privacyscreen-storyboard` or `phonegap local plugin add cordova-plugin-privacyscreen-storyboard` -2. To remove this plugin type: `cordova plugin remove cordova-plugin-privacyscreen-storyboard` or `phonegap local plugin remove cordova-plugin-privacyscreen-storyboard` +1. To add this plugin just type: `cordova plugin add cordova-plugin-privacyscreen` or `phonegap local plugin add cordova-plugin-privacyscreen` +2. To remove this plugin type: `cordova plugin remove cordova-plugin-privacyscreen` or `phonegap local plugin remove cordova-plugin-privacyscreen` Usage: ------ diff --git a/package.json b/package.json index 553ecaf..c4d6be5 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "cordova-plugin-privacyscreen-storyboard", + "name": "cordova-plugin-privacyscreen", "version": "0.0.1", "description": "Secures your app from displaying a screenshot in task switchers under Android and iOS. Keeps sensitive information private.", "cordova": { - "id": "cordova-plugin-privacyscreen-storyboard", + "id": "cordova-plugin-privacyscreen", "platforms": [ "android", "ios" @@ -11,7 +11,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/holgergp/PrivacyScreenPlugin-Storyboard.git" + "url": "git+https://github.com/devgeeks/PrivacyScreenPlugin.git" }, "keywords": [ "privacy", @@ -25,7 +25,7 @@ "contributors": ["Holger Grosse-Plankermann <holger.grosse-plankermann@codecentric.de>"], "license": "MIT", "bugs": { - "url": "https://github.com/holgergp/PrivacyScreenPlugin-Storyboard/issues" + "url": "https://github.com/devgeeks/PrivacyScreenPlugin/issues" }, - "homepage": "https://github.com/holgergp/PrivacyScreenPlugin-Storyboard#readme" + "homepage": "https://github.com/devgeeks/PrivacyScreenPlugin#readme" } diff --git a/plugin.xml b/plugin.xml index 9f94418..802947b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-privacyscreen-storyboard" version="0.3.1"> +<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-privacyscreen" version="0.3.1"> <name>PrivacyScreenPlugin-Storyboard</name> <description>Secures your app from displaying a screenshot in task switchers under Android and iOS. Keeps sensitive information private.</description> From 663e6425555e715613870436636894c1fdfd220f Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Tue, 12 May 2020 06:59:57 +0000 Subject: [PATCH 10/11] Amend docs --- package.json | 2 +- plugin.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c4d6be5..d19f744 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-privacyscreen", - "version": "0.0.1", + "version": "0.4.1", "description": "Secures your app from displaying a screenshot in task switchers under Android and iOS. Keeps sensitive information private.", "cordova": { "id": "cordova-plugin-privacyscreen", diff --git a/plugin.xml b/plugin.xml index 802947b..db96057 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-privacyscreen" version="0.3.1"> - <name>PrivacyScreenPlugin-Storyboard</name> + <name>PrivacyScreenPlugin</name> <description>Secures your app from displaying a screenshot in task switchers under Android and iOS. Keeps sensitive information private.</description> <license>MIT</license> <platform name="android"> From 3c02ebe6c6bf210016ab1482aeff6393d96712be Mon Sep 17 00:00:00 2001 From: Holger Grosse-Plankermann <holgergp@gmail.com> Date: Tue, 12 May 2020 07:00:53 +0000 Subject: [PATCH 11/11] Alter docs some more --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5729874..e19ca6d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -PrivacyScreenPlugin-Storyboard +PrivacyScreenPlugin ================== Both iOS (as of iOS 7) and Android have app switchers that display a screenshot of your app.