Skip to content

Commit

Permalink
Merge pull request #172 from prey/rename
Browse files Browse the repository at this point in the history
Rename
  • Loading branch information
oaliaga authored May 3, 2023
2 parents 74af0e9 + c84f9f9 commit 1b9ea70
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {

targetSdkVersion 33

versionCode 310
versionName '2.4.6'
versionCode 312
versionName '2.4.7'

multiDexEnabled true
}
Expand Down
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.

10 changes: 9 additions & 1 deletion app/src/main/java/com/prey/PreyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class PreyConfig {
private static PreyConfig cachedInstance = null;
public static final String TAG = "PREY";
private static final String HTTP = "https://";
public static final String VERSION_PREY_DEFAULT = "2.4.6";
public static final String VERSION_PREY_DEFAULT = "2.4.7";
// Milliseconds per second
private static final int MILLISECONDS_PER_SECOND = 1000;
// Set to 1000 * 60 in production.
Expand Down 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();
}
}
16 changes: 16 additions & 0 deletions app/src/main/java/com/prey/json/actions/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import org.json.JSONObject;

import android.content.Context;
import android.provider.Settings;

import com.prey.PreyConfig;
import com.prey.PreyLogger;
import com.prey.PreyUtils;
import com.prey.actions.HttpDataService;
import com.prey.actions.aware.AwareConfig;
import com.prey.actions.aware.AwareController;
Expand Down Expand Up @@ -70,6 +72,20 @@ public List<HttpDataService> get(Context ctx, List<ActionResult> list, JSONObje
ArrayList<HttpDataService> dataToBeSent = new ArrayList<HttpDataService>();
dataToBeSent.add(data);
PreyWebServices.getInstance().sendPreyHttpData(ctx, dataToBeSent);
try {
String nameDevice = Settings.Secure.getString(ctx.getContentResolver(), "bluetooth_name");
if (nameDevice != null && !"".equals(nameDevice)) {
PreyLogger.d(String.format("nameDevice: %s", nameDevice));
PreyWebServices.getInstance().sendPreyHttpDataName(ctx, nameDevice);
String nameDeviceInfo = PreyWebServices.getInstance().getNameDevice(ctx);
if (nameDeviceInfo != null && !"".equals(nameDeviceInfo)) {
PreyLogger.d(String.format("nameDeviceInfo: %s", nameDeviceInfo));
PreyConfig.getPreyConfig(ctx).setDeviceName(nameDeviceInfo);
}
}
} catch (Exception e) {
PreyLogger.d(String.format("Data wasn't send: %s", e.getMessage()));
}
return dataToBeSent;
}

Expand Down
23 changes: 23 additions & 0 deletions app/src/main/java/com/prey/net/PreyWebServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,13 @@ private PreyHttpResponse checkPassword(String apikey, String password, Context c
if(response!=null&&response.getStatusCode()== HttpURLConnection.HTTP_UNAUTHORIZED){
throw new PreyException(json);
}
//StatusCode 500-504
if (response != null && (response.getStatusCode() >= HttpURLConnection.HTTP_INTERNAL_ERROR &&
response.getStatusCode() <= HttpURLConnection.HTTP_GATEWAY_TIMEOUT)) {
CharSequence err = ctx.getText(R.string.error_communication_500);
json = new StringBuffer("{\"error\":[\"").append(err).append("\"]}").toString();
throw new PreyException(json);
}
try {
PreyLogger.d("____[token]_________________apikey:"+apikey+" password:"+password);
String apiv2 = FileConfigReader.getInstance(ctx).getApiV2();
Expand Down Expand Up @@ -613,6 +620,22 @@ public PreyHttpResponse sendPreyHttpData(Context ctx, ArrayList<HttpDataService>
return preyHttpResponse;
}

public PreyHttpResponse sendPreyHttpDataName(Context ctx, String nameDevice) {
Map<String, String> parameters = new HashMap<String, String>();
PreyHttpResponse preyHttpResponse = null;
parameters.put("name", nameDevice);
try {
String url = getDataUrlJson(ctx);
if (UtilConnection.isInternetAvailable(ctx)) {
preyHttpResponse = PreyRestHttpClient.getInstance(ctx).postAutentication(url, parameters);
PreyLogger.d(String.format("Data sent_: %s", (preyHttpResponse == null ? "" : preyHttpResponse.getResponseAsString())));
}
} catch (Exception e) {
PreyLogger.e("Data wasn't send", e);
}
return preyHttpResponse;
}

public PreyVerify verifyUsers(Context ctx) throws Exception {
String apiKey= PreyConfig.getPreyConfig(ctx).getApiKey();
String apiv2 = FileConfigReader.getInstance(ctx).getApiV2();
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@

<string name="error_title">¡Tenemos un problema!</string>
<string name="error_communication_exception">Revisa tu conexión y vuelve a intentarlo.</string>
<string name="error_communication_500">No pudimos comunicarnos con nuestros servidores debido a un error de conexión. por favor asegúrate de tener una conexión estable.</string>
<string name="error_cant_add_this_device">El equipo no se pudo agregar a tu cuenta Prey. Revisa el email y contraseña que ingresaste. %s</string>
<string name="error_registered_password_has_changed">La contraseña actual ingresada no es válida.</string>
<string name="error_cant_report_forgotten_password">La contraseña no se pudo reportar como olvidada. Por favor inténtalo nuevamente.</string>
Expand Down Expand Up @@ -370,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>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@

<string name="error_title">We have a situation!</string>

<string name="error_communication_exception">Check your settings and try again.</string>

<string name="error_communication_500">We couldn\'t reach our servers due to a connection error. please ensure you have a stable connection.</string>
<string name="error_cant_add_this_device">Can\'t add this device to your prey account. Please check again the email and password provided. %s</string>

<string name="error_registered_password_has_changed">Can\'t change password. The current password entered is invalid.</string>

<string name="error_cant_report_forgotten_password">Can\'t report forgotten password. Please try again later.</string>
Expand Down Expand Up @@ -376,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 1b9ea70

Please sign in to comment.