Skip to content

(iOS) Added preferences for privacy on background only and overriding LaunchImage #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a7aea66
(iOS) added option “PrivacyOnBackground” to activate privacy only in …
MobilityTiago Feb 23, 2017
f726af1
Changed version number to 0.3.2.
MobilityTiago Feb 23, 2017
5e0095a
Updated Readme.md
MobilityTiago Feb 24, 2017
1572f80
Added fix for issue with some app generators that can’t use ‘-’ in re…
MobilityTiago Mar 1, 2017
50be9f9
Changed to version 0.3.3
MobilityTiago Mar 1, 2017
ebf8a8c
Fixed bad logic after testing.
MobilityTiago Mar 1, 2017
fcba592
Added “PrivacyImageName” preference for custom image names in bundle.…
MobilityTiago Mar 1, 2017
74884d5
Added option for www path image. Version 0.3.5
MobilityTiago Mar 3, 2017
5864939
Changed to version 0.3.6 \n
MobilityTiago Mar 24, 2017
9ac9c96
js fix
MobilityTiago Mar 24, 2017
417aad3
timer fix
MobilityTiago Mar 24, 2017
cdf05a9
Changed to version 0.3.7\n
MobilityTiago Mar 27, 2017
20c451b
Default timer fix
MobilityTiago Mar 27, 2017
195a89a
Fix for preview image being stuck after leaving app rapidly on splash.
MobilityTiago Aug 4, 2017
d61c5d9
Additional fix
MobilityTiago Aug 4, 2017
ddfb6d2
Fix for Privacy screen getting iOs app stuck on iOS 8+ devices.
MobilityTiago Sep 4, 2017
c2e0635
Updated files with 0.3.10 version
MobilityTiago Sep 4, 2017
6350dfa
Changed version to 0.4.0 \n
MobilityTiago Dec 15, 2017
d1c88a9
Launch Imges
MobilityTiago Dec 18, 2017
c421569
Added iPhone 4S support
MobilityTiago Jan 10, 2018
e887a5d
Update PrivacyScreenPlugin.h
ncaeiro75 Jan 31, 2018
6e4242d
Update PrivacyScreenPlugin.m
ncaeiro75 Jan 31, 2018
36f59ee
Merge pull request #1 from ncaeiro75/patch-2
MobilityTiago Jan 31, 2018
c2dd3c8
Merge pull request #2 from ncaeiro75/patch-1
MobilityTiago Jan 31, 2018
7d66752
Changed version
MobilityTiago Jan 31, 2018
6ce5655
Bug fix for pull request and clean up
MobilityTiago Jan 31, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,24 @@ For Cordova 3.x.x:
Usage:
------

This plugin exposes no interface, it simply sets your app to be private. You don't need to do anything except install the plugin.
This plugin exposes no interface in Android, it simply sets your app to be private. You don't need to do anything except install the plugin.

In iOS the privacy screen fades on page load or in a set time interval, if you want more control you have the following functions:
- setTimer(successCallback, errorCallback, timeInterval) : sets timer to make privacy screen fade away (default is 3 seconds and can be set through preference).
- hidePrivacyScreen(successCallback, errorCallback) : Explicitely hides the privacy screen.
- showPrivacyScreen(successCallback, errorCallback) : Explicitely shows the privacy screen (respects timer interval to fade)

For iOS there are 3 preferences that can be set in config.xml:
- "PrivacyOnBackground": If set to "true" allows splashscreen to be shown only when app enters background (i.e. switched to another app or pressed the home button)
- "PrivacyOverrideLaunchImage": If set to "true" allows privacy screen to be the Default image even if LaunchImage is set in the info-plist
- "PrivacyImageName": String for image name, images should be in the app bundle and follow the size naming convention (i.e. for app name "Test", there should be a "Test-667h.png" in the bundle for iPhone 6)
- "PrivacyTimer": accepts a value in seconds for the privacy screen timer

When using splash storyboard add images to the config xml.
(i.e
<splash src="res/screen/ios/LaunchImage@2x~universal~anyany.png" />
<splash src="res/screen/ios/LaunchImage@3x~universal~anyany.png" />
)

Test this plugin on a real device because the iOS simulator (7.1 at least) does a poor job hiding your app.

Expand All @@ -36,4 +53,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-privacyscreen",
"version": "0.3.1",
"version": "0.4.3",
"description": "Secures your app from displaying a screenshot in task switchers under Android and iOS. Keeps sensitive information private.",
"cordova": {
"id": "cordova-plugin-privacyscreen",
Expand Down
7 changes: 6 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<?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" version="0.4.3">

<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>

<js-module src="www/PrivacyScreenPlugin.js" name="PrivacyScreenPlugin">
<clobbers target="window.plugins.privacyscreen" />
</js-module>

<platform name="android">

<config-file parent="/*" target="res/xml/config.xml">
Expand Down
18 changes: 18 additions & 0 deletions src/android/PrivacyScreenPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,22 @@ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
Activity activity = this.cordova.getActivity();
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
//Not used in Android
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if ("setTimer".equals(action)) {
callbackContext.success();
return true;
}
else if ("hidePrivacyScreen".equals(action)) {
callbackContext.success();
return true;
}
else if ("showPrivacyScreen".equals(action)) {
callbackContext.success();
return true;
}

return false; // Returning false results in a "MethodNotFound" error.
}
}
7 changes: 6 additions & 1 deletion src/ios/PrivacyScreenPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ typedef struct {
BOOL iPhone6;
BOOL iPhone6Plus;
BOOL retina;
BOOL iPhoneX;

} CDV_iOSDevice;

@interface PrivacyScreenPlugin : CDVPlugin

@end
- (void) setTimer:(CDVInvokedUrlCommand*)command;
- (void) hidePrivacyScreen:(CDVInvokedUrlCommand*)command;
- (void) showPrivacyScreen:(CDVInvokedUrlCommand*)command;

@end
Loading