Skip to content

Commit

Permalink
Add uninstall button
Browse files Browse the repository at this point in the history
Add uninstall button
  • Loading branch information
oaliaga committed Mar 23, 2023
1 parent a6a9ca0 commit c84f9f9
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/src/main/assets/html/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"main.css": "./static/css/main.cfa80321.chunk.css",
"main.js": "./static/js/main.1bcccd0c.chunk.js",
"main.js.map": "./static/js/main.1bcccd0c.chunk.js.map",
"main.js": "./static/js/main.e4910026.chunk.js",
"main.js.map": "./static/js/main.e4910026.chunk.js.map",
"runtime~main.js": "./static/js/runtime~main.8c97409f.js",
"runtime~main.js.map": "./static/js/runtime~main.8c97409f.js.map",
"static/js/2.d9125aad.chunk.js": "./static/js/2.d9125aad.chunk.js",
"static/js/2.d9125aad.chunk.js.map": "./static/js/2.d9125aad.chunk.js.map",
"index.html": "./index.html",
"precache-manifest.9dcf66ccb319bb2a066089692eb34c28.js": "./precache-manifest.9dcf66ccb319bb2a066089692eb34c28.js",
"precache-manifest.75a4185003e779fdf9586cee0711d4d2.js": "./precache-manifest.75a4185003e779fdf9586cee0711d4d2.js",
"service-worker.js": "./service-worker.js",
"static/css/main.cfa80321.chunk.css.map": "./static/css/main.cfa80321.chunk.css.map",
"static/media/02-Track-Find.png": "./static/media/02-Track-Find.ed00c298.png",
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/html/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><link rel="shortcut icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><title>Prey Client</title><link href="./static/css/main.cfa80321.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.d9125aad.chunk.js"></script><script src="./static/js/main.1bcccd0c.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><link rel="shortcut icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><title>Prey Client</title><link href="./static/css/main.cfa80321.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.d9125aad.chunk.js"></script><script src="./static/js/main.e4910026.chunk.js"></script></body></html>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
self.__precacheManifest = [
{
"revision": "1bcccd0cd81558f553f4",
"revision": "e4910026e3de78305e8f",
"url": "./static/css/main.cfa80321.chunk.css"
},
{
"revision": "1bcccd0cd81558f553f4",
"url": "./static/js/main.1bcccd0c.chunk.js"
"revision": "e4910026e3de78305e8f",
"url": "./static/js/main.e4910026.chunk.js"
},
{
"revision": "8c97409f0ee389fe75da",
Expand Down Expand Up @@ -136,7 +136,7 @@ self.__precacheManifest = [
"url": "./static/media/magdaclean-bold-webfont.baaac747.woff"
},
{
"revision": "4dbd0e1b75d7968d319f8083579da66d",
"revision": "8a5ed0cbd14ef0ec2b336f482a61984c",
"url": "./index.html"
}
];
2 changes: 1 addition & 1 deletion app/src/main/assets/html/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js");

importScripts(
"./precache-manifest.9dcf66ccb319bb2a066089692eb34c28.js"
"./precache-manifest.75a4185003e779fdf9586cee0711d4d2.js"
);

workbox.clientsClaim();
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/assets/html/static/js/main.1bcccd0c.chunk.js

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions app/src/main/assets/html/static/js/main.e4910026.chunk.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions app/src/main/java/com/prey/PreyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public class PreyConfig {
public static final String TIME_NEXT_LOCATIONBG = "TIME_NEXT_LOCATIONBG";
public static final String LOCATIONBG_DENIED = "LOCATIONBG_DENIED";
public static final String MSP_ACCOUNT = "MSP_ACCOUNT";
public static final String START = "START";

private boolean securityPrivilegesAlreadyPrompted;
private Context ctx;
Expand Down Expand Up @@ -1520,4 +1521,11 @@ public void setMspAccount(boolean mspAccount) {
saveBoolean(PreyConfig.MSP_ACCOUNT, mspAccount);
}

public boolean getStart() {
return getBoolean(PreyConfig.START, true);
}

public void setStart(boolean start) {
saveBoolean(PreyConfig.START, start);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ public String getUrl(Context ctx) {
&& canAccessStorage && isAdminActive && canDrawOverlays ;
boolean permissionsOrBasic = canAccessFineLocation || canAccessCoarseLocation || canAccessCamera
|| canAccessStorage || isAdminActive || canDrawOverlays ;
if (!permissionsOrBasic) {
boolean start = PreyConfig.getPreyConfig(this).getStart();
if (start || !permissionsOrBasic) {
url.append(URL_ONB).append("#/").append(lng).append("/start");
} else {
if (permissionsAndBasic) {
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/java/com/prey/activities/js/WebAppInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ public void touch() {

@JavascriptInterface
public boolean initConfigure() {
PreyConfig.getPreyConfig(mContext).setStart(false);
String deviceKey = PreyConfig.getPreyConfig(mContext).getDeviceId();
if (deviceKey != null && !"".equals(deviceKey)) {
return true;
Expand Down Expand Up @@ -1268,4 +1269,27 @@ public boolean initMspAccount() {
}
return initMspAccount;
}

@JavascriptInterface
public void uninstall() {
PreyLogger.d("uninstall");
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setMessage(R.string.preferences_uninstall_summary)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
PreyLogger.d("uninstall run:");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
new DetachDevice().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else
new DetachDevice().execute();
PreyConfig.getPreyConfig(mContext).setStart(true);
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
Dialog popup = builder.create();
popup.show();
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -371,5 +371,6 @@
<string name="help_error_attachment">El archivo seleccionado excede el tamaño máximo.</string>
<string name="help_no_file_chosen">No se eligió archivo</string>
<string name="error_token">La identificación de cuenta ha expirado o ha sido revocado, por favor contacta a tu administrador.</string>
<string name="preferences_uninstall_summary">¿Deseas continuar con el proceso de remover los permisos de Prey en este dipositivo? Recuerda reiniciar y luego desintalar.</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -377,5 +377,6 @@
<string name="help_error_attachment">File size exceeds maximum limit.</string>
<string name="help_no_file_chosen">No file chosen</string>
<string name="error_token">The account identification has expired or has been revoked, please contact your administrator.</string>
<string name="preferences_uninstall_summary">Do you want to continue with the process of removing Prey permissions on this device? Remember to reboot and then uninstall.</string>

</resources>

0 comments on commit c84f9f9

Please sign in to comment.