From 2d9695344bc45dc583b725789e1ec338edc5a837 Mon Sep 17 00:00:00 2001 From: Jens Date: Wed, 23 Jun 2021 22:01:40 +0200 Subject: [PATCH] Permission --- .../java/com/jens/automation2/Action.java | 81 +++++-------------- .../com/jens/automation2/Miscellaneous.java | 9 --- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 13 +++ app/src/main/res/values-it/strings.xml | 1 + 5 files changed, 33 insertions(+), 72 deletions(-) diff --git a/app/src/main/java/com/jens/automation2/Action.java b/app/src/main/java/com/jens/automation2/Action.java index c2407c4..0cb58e1 100644 --- a/app/src/main/java/com/jens/automation2/Action.java +++ b/app/src/main/java/com/jens/automation2/Action.java @@ -345,18 +345,11 @@ public class Action * Old version. Those checks should not be necessary anymore. Also they didn't work * because profiles were created with names like silent, vibrate and normal. */ -// if(this.getParameter2().equals("silent")) -// Actions.setSound(context, AudioManager.RINGER_MODE_SILENT); -// else if(this.getParameter2().equals("vibrate")) -// Actions.setSound(context, AudioManager.RINGER_MODE_VIBRATE); -// else if(this.getParameter2().equals("normal")) -// Actions.setSound(context, AudioManager.RINGER_MODE_NORMAL); -// else -// { + Profile p = Profile.getByName(this.getParameter2()); if (p != null) p.activate(context); -// } + break; case triggerUrl: triggerUrl(context); @@ -490,62 +483,24 @@ public class Action while(attempts <= Settings.httpAttempts && response.equals("httpError")) { Miscellaneous.logEvent("i", "HTTP Request", "Attempt " + String.valueOf(attempts++) + " of " + String.valueOf(Settings.httpAttempts), 3); - -// try -// { - // Either thorough checking or no encryption - if(!Settings.httpAcceptAllCertificates | !urlString.toLowerCase(Locale.getDefault()).contains("https")) -// { -// URL url = new URL(urlString); -// URLConnection urlConnection = url.openConnection(); -// urlConnection.setReadTimeout(Settings.httpAttemptsTimeout * 1000); -// InputStream in = urlConnection.getInputStream(); -// response = Miscellaneous.convertStreamToString(in); - - response = Miscellaneous.downloadURL(urlString, urlUsername, urlPassword); -// } - else -// { - response = Miscellaneous.downloadURLwithoutCertificateChecking(urlString, urlUsername, urlPassword); -// post = new HttpGet(new URI(urlString)); -// final HttpParams httpParams = new BasicHttpParams(); -// HttpConnectionParams.setConnectionTimeout(httpParams, Settings.httpAttemptsTimeout * 1000); -// HttpClient client = new DefaultHttpClient(httpParams); -// -// client = sslClient(client); -// -// // Execute HTTP Post Request -// HttpResponse result = client.execute(post); -// response = EntityUtils.toString(result.getEntity()); -// } -// } -// catch (URISyntaxException e) -// { -// Miscellaneous.logEvent("w", "HTTP RESULT", Log.getStackTraceString(e), 3); -// } -// catch (ClientProtocolException e) -// { -// Miscellaneous.logEvent("w", "HTTP RESULT", Log.getStackTraceString(e), 3); -// } -// catch (IOException e) -// { -// Miscellaneous.logEvent("w", "HTTP RESULT", Log.getStackTraceString(e), 3); -// e.printStackTrace(); -// } -// finally -// { - try - { - Thread.sleep(Settings.httpAttemptGap * 1000); - } - catch (InterruptedException e1) - { - Miscellaneous.logEvent("w", "HTTP RESULT", "Failed to pause between HTTP requests.", 5); - } -// } + + // Either thorough checking or no encryption + if(!Settings.httpAcceptAllCertificates || !urlString.toLowerCase(Locale.getDefault()).contains("https")) + response = Miscellaneous.downloadURL(urlString, urlUsername, urlPassword); + else + response = Miscellaneous.downloadURLwithoutCertificateChecking(urlString, urlUsername, urlPassword); + + try + { + Thread.sleep(Settings.httpAttemptGap * 1000); + } + catch (InterruptedException e1) + { + Miscellaneous.logEvent("w", "HTTP RESULT", "Failed to pause between HTTP requests.", 5); + } } -// Miscellaneous.logEvent("i", "HTTPS RESULT", response, 3); + Miscellaneous.logEvent("i", "HTTPS RESULT", response, 5); return response; } diff --git a/app/src/main/java/com/jens/automation2/Miscellaneous.java b/app/src/main/java/com/jens/automation2/Miscellaneous.java index dd56f71..01d1fbd 100644 --- a/app/src/main/java/com/jens/automation2/Miscellaneous.java +++ b/app/src/main/java/com/jens/automation2/Miscellaneous.java @@ -121,15 +121,6 @@ public class Miscellaneous extends Service if(url.toLowerCase().contains("https")) { connection = (HttpsURLConnection) urlObject.openConnection(); - -// if(Settings.httpAcceptAllCertificates) -// { -// SSLContext sc = SSLContext.getInstance("TLS"); -// sc.init(null, getInsecureTrustManager(), new java.security.SecureRandom()); -// HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); -// Miscellaneous.disableSSLCertificateChecking(); -// HttpsURLConnection.setDefaultHostnameVerifier(getInsecureHostnameVerifier()); -// } } else connection = (HttpURLConnection) urlObject.openConnection(); diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 332c9e9..2b13188 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -584,4 +584,5 @@ Nach Updates suchen Position gefunden. Der vorgeschlagene Mindestradius für Orte beträgt %1$d m. Es konnte nur eine ungenaue Position gefunden werden. Das funktioniert u.U. nicht zuverlässig. Der vorgeschlagene Mindestradius für Orte beträgt %1$d m. + Gehen Sie auf dem nächsten Bildschirm bitte auf Berechtigungen, dann Position. Wählen Sie dort Immer erlauben aus, um Automation zu ermöglichen, die Position im Hintergrund zu ermitteln. \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 4cd5afd..c9f6d7e 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -558,4 +558,17 @@ Incluya las paréntecis en su texto.\n\n[uniqueid] - el número único de su dis Esos son los permisos necesarios. Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo. Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo. + Esta nota no aparecerá otra vez. + No pude encontrar una posición despues un limite de 120 segundos.. + En la proxima pantalla por favor vaya a permisos, luego posición. Ahi elija \"Siempre permitir\" para permitir Automation determinar la posición en el fondo. + Hubo un error durante exportar la configuración. + Reglas y sitios serán exportado con exito. + Hubo un error durante importando reglas y sitios. + No pude importar todos los archivos aplicables. + Despues de cliquear importar o exportar elija el directorio de que archivos serán importados o a que serán exportados. Si exporta archivos que ya existen serán sobreescribidos. + Hubo un error iniciar una regla. + La posición no mas sera determinado en el fondo. Cliquee aqui para averiguar más. + Mostrar noticias de la app en la pantalla principal. + Noticias solo de esta app. Hablamos de 1-2 veces per año, no mas. + Esta characteristica es basado en software libre. Por eso no esta disponsible in la versión F-Droid. \ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index b1c79af..9ecc5ca 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -577,4 +577,5 @@ Memorizza un file di log Si Clonare + Status