Trigger URL fixes

This commit is contained in:
2025-11-29 23:41:32 +01:00
parent 4282c53372
commit f7d8389668
13 changed files with 14 additions and 62 deletions

View File

@@ -115,8 +115,7 @@ public class Actions
public static void closeNotification(Action action) public static void closeNotification(Action action)
{ {
NotificationManager nm = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager nm = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
// for(StatusBarNotification n : nm.getActiveNotifications())
// {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
{ {
String[] params = action.getParameter2().split(Action.actionParameter2Split, -1); String[] params = action.getParameter2().split(Action.actionParameter2Split, -1);
@@ -193,7 +192,6 @@ public class Actions
Miscellaneous.logEvent("i", "NotificationCloseCheck", "NotificationListener instance is null. Can\'t close notification.", 3); Miscellaneous.logEvent("i", "NotificationCloseCheck", "NotificationListener instance is null. Can\'t close notification.", 3);
} }
} }
// }
} }
public static void sendBroadcast(Context context, String action) public static void sendBroadcast(Context context, String action)

View File

@@ -96,7 +96,6 @@ import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
@@ -127,6 +126,8 @@ import eu.chainfire.libsuperuser.Shell;
public class Miscellaneous extends Service public class Miscellaneous extends Service
{ {
protected static String writeableFolderStringCache = null; protected static String writeableFolderStringCache = null;
protected final static String http_error_string = "HTTP_ERROR";
protected final static String last_trigger_url_result_string = "last_trigger_url_result";
public static Context startupContext; public static Context startupContext;
public static final String lineSeparator = System.getProperty("line.separator"); public static final String lineSeparator = System.getProperty("line.separator");
@@ -199,7 +200,7 @@ public class Miscellaneous extends Service
// immediate deallocation of all system resources // immediate deallocation of all system resources
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
if(errorFound) if(errorFound)
return "httpError"; return http_error_string;
else else
return responseBody.toString(); return responseBody.toString();
} }
@@ -275,7 +276,7 @@ public class Miscellaneous extends Service
catch(Exception e) catch(Exception e)
{ {
Miscellaneous.logEvent("e", "HTTP error", Log.getStackTraceString(e), 3); Miscellaneous.logEvent("e", "HTTP error", Log.getStackTraceString(e), 3);
return "httpError"; return http_error_string;
} }
// finally // finally
// { // {
@@ -853,15 +854,15 @@ public class Miscellaneous extends Service
} }
} }
if(source.contains("[last_trigger_url_result]")) if(source.contains("[" + last_trigger_url_result_string + "]"))
{ {
try try
{ {
source = source.replace("[last_trigger_url_result]", AutomationService.getInstance().getVariableMap().get("last_trigger_url_result")); source = source.replace("[" + last_trigger_url_result_string + "]", AutomationService.getInstance().getVariableMap().get(last_trigger_url_result_string));
} }
catch (Exception e) catch (Exception e)
{ {
Miscellaneous.logEvent("w", "Variable replacement", "Error replacing variable last_trigger_url_result.", 3); Miscellaneous.logEvent("w", "Variable replacement", "Error replacing variable " + last_trigger_url_result_string + ".", 3);
} }
} }

View File

@@ -36,18 +36,8 @@ public class NfcReceiver
public static NfcAdapter getNfcAdapter(Context context) public static NfcAdapter getNfcAdapter(Context context)
{ {
if(nfcAdapter == null) if(nfcAdapter == null)
{ nfcAdapter = NfcAdapter.getDefaultAdapter(context);
if(Build.VERSION.SDK_INT <= 10)
{
// NFC not supported until after Gingerbread.
Miscellaneous.logEvent("w", "NFC", context.getResources().getString(R.string.nfcNotSupportedInThisAndroidVersionYet), 3);
return null;
}
else
{
nfcAdapter = NfcAdapter.getDefaultAdapter(context);
}
}
return nfcAdapter; return nfcAdapter;
} }
@@ -91,28 +81,6 @@ public class NfcReceiver
new NdefReaderTask().execute(tag); new NdefReaderTask().execute(tag);
} }
} }
// else if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action))
// {
//
// // In case we would still use the Tech Discovered Intent
// Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
// String[] techList = tag.getTechList();
// String searchedTech = Ndef.class.getName();
//
// for (String tech : techList)
// {
// if (searchedTech.equals(tech))
// {
// new NdefReaderTask().execute(tag);
// break;
// }
// }
// }
// else
// {
// // No NFC NDEF intent
// Miscellaneous.logEvent("w", "NFC", context.getResources().getString(R.string.nfcNoNdefIntentBut) + " " + action + ".", 5);
// }
} }
@SuppressLint("NewApi") @SuppressLint("NewApi")
@@ -334,14 +302,6 @@ public class NfcReceiver
return false; return false;
} }
else if(Build.VERSION.SDK_INT <= 10)
{
// NFC not supported until after Gingerbread.
if(showErrorMessage)
Toast.makeText(context, context.getResources().getString(R.string.nfcNotSupportedInThisAndroidVersionYet), Toast.LENGTH_LONG).show();
return false;
}
return true; return true;
} }

View File

@@ -302,7 +302,6 @@
<string name="nfcTagFoundWithText">Tag gefunden mit Bezeichner:</string> <string name="nfcTagFoundWithText">Tag gefunden mit Bezeichner:</string>
<string name="nfcUnsupportedEncoding">Nicht unterstützte Kodierung:</string> <string name="nfcUnsupportedEncoding">Nicht unterstützte Kodierung:</string>
<string name="nfcNoNdefIntentBut">Kein NFC NDEF intent, sondern</string> <string name="nfcNoNdefIntentBut">Kein NFC NDEF intent, sondern</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC wird in dieser Android Version noch nicht unterstützt.</string>
<string name="cantRunRule">Regeln können nicht ausgeführt werden.</string> <string name="cantRunRule">Regeln können nicht ausgeführt werden.</string>
<string name="nfcApplyTagToRule">Aktuellen Tag in Regel übernehmen</string> <string name="nfcApplyTagToRule">Aktuellen Tag in Regel übernehmen</string>
<string name="nfcTagReadSuccessfully">Tag erfolgreich gelesen.</string> <string name="nfcTagReadSuccessfully">Tag erfolgreich gelesen.</string>

View File

@@ -443,7 +443,6 @@
<string name="nfcTagFoundWithText">Tag encontrado con etiqueta:</string> <string name="nfcTagFoundWithText">Tag encontrado con etiqueta:</string>
<string name="nfcUnsupportedEncoding">No hay soporte para este codigo:</string> <string name="nfcUnsupportedEncoding">No hay soporte para este codigo:</string>
<string name="nfcNoNdefIntentBut">No NFC NDEF intent, pero</string> <string name="nfcNoNdefIntentBut">No NFC NDEF intent, pero</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC sin soporto en esta version Android, todavia no.</string>
<string name="cantRunRule">No puedo ejecutar reglas.</string> <string name="cantRunRule">No puedo ejecutar reglas.</string>
<string name="nfcApplyTagToRule">Aplicar este tag a regla</string> <string name="nfcApplyTagToRule">Aplicar este tag a regla</string>
<string name="nfcTagReadSuccessfully">Tag escritoso con éxito.</string> <string name="nfcTagReadSuccessfully">Tag escritoso con éxito.</string>

View File

@@ -305,7 +305,6 @@
<string name="nfcTagFoundWithText">Étiquette trouvée :</string> <string name="nfcTagFoundWithText">Étiquette trouvée :</string>
<string name="nfcUnsupportedEncoding">Codage non pris en charge :</string> <string name="nfcUnsupportedEncoding">Codage non pris en charge :</string>
<string name="nfcNoNdefIntentBut">Aucun NFC NDEF atteint, mais</string> <string name="nfcNoNdefIntentBut">Aucun NFC NDEF atteint, mais</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC non pris en charge dans cette version Android.</string>
<string name="cantRunRule">Impossible déxécuter les règles.</string> <string name="cantRunRule">Impossible déxécuter les règles.</string>
<string name="nfcApplyTagToRule">Affecter létiquette à la règle</string> <string name="nfcApplyTagToRule">Affecter létiquette à la règle</string>
<string name="nfcTagReadSuccessfully">Succès de lecture de létiquette.</string> <string name="nfcTagReadSuccessfully">Succès de lecture de létiquette.</string>

View File

@@ -300,7 +300,6 @@
<string name="nfcEnterValidIdentifier">Inserire un nome valido per l\'etichetta (come "Porta d\'ingresso di casa").</string> <string name="nfcEnterValidIdentifier">Inserire un nome valido per l\'etichetta (come "Porta d\'ingresso di casa").</string>
<string name="nfcNoNdefIntentBut">Nessun Intent NFC NDEF, ma</string> <string name="nfcNoNdefIntentBut">Nessun Intent NFC NDEF, ma</string>
<string name="nfcNoTag">Nessuna etichetta rilevata.</string> <string name="nfcNoTag">Nessuna etichetta rilevata.</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC non ancora supportato in questa versione di Android.</string>
<string name="nfcReadTag">Leggi ID dall\'etichetta</string> <string name="nfcReadTag">Leggi ID dall\'etichetta</string>
<string name="nfcTag">Etichetta NFC</string> <string name="nfcTag">Etichetta NFC</string>
<string name="nfcTagDataNotUsable">Dati dell\'etichetta non leggibili, si prega di riscriverli.</string> <string name="nfcTagDataNotUsable">Dati dell\'etichetta non leggibili, si prega di riscriverli.</string>

View File

@@ -300,7 +300,6 @@
<string name="nfcTagFoundWithText">Tag gevonden met tekst:</string> <string name="nfcTagFoundWithText">Tag gevonden met tekst:</string>
<string name="nfcUnsupportedEncoding">Niet ondersteunde codering:</string> <string name="nfcUnsupportedEncoding">Niet ondersteunde codering:</string>
<string name="nfcNoNdefIntentBut">Geen NFC NDEF bedoeling, maar</string> <string name="nfcNoNdefIntentBut">Geen NFC NDEF bedoeling, maar</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC nog niet ondersteund in deze Android versie.</string>
<string name="cantRunRule">Kan regels niet uitvoeren.</string> <string name="cantRunRule">Kan regels niet uitvoeren.</string>
<string name="nfcApplyTagToRule">Pas Tag toe op regel</string> <string name="nfcApplyTagToRule">Pas Tag toe op regel</string>
<string name="nfcTagReadSuccessfully">Tag succesvol gelezen.</string> <string name="nfcTagReadSuccessfully">Tag succesvol gelezen.</string>

View File

@@ -365,7 +365,6 @@
<string name="nfcTagFoundWithText">Znaleziono tag z tekstem:</string> <string name="nfcTagFoundWithText">Znaleziono tag z tekstem:</string>
<string name="nfcUnsupportedEncoding">Nieobsługiwane kodowanie:</string> <string name="nfcUnsupportedEncoding">Nieobsługiwane kodowanie:</string>
<string name="nfcNoNdefIntentBut"> Brak intencji NFC NDEF, ale</string> <string name="nfcNoNdefIntentBut"> Brak intencji NFC NDEF, ale</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC nie jest jeszcze obsługiwane w tej wersji Androida.</string>
<string name="cantRunRule">Nie można uruchomić reguł.</string> <string name="cantRunRule">Nie można uruchomić reguł.</string>
<string name="cantDownloadTooFewRequestsInSettings" translatable="false">Can\'t download anything. Amount of http requests in settings is lower than 1.</string> <string name="cantDownloadTooFewRequestsInSettings" translatable="false">Can\'t download anything. Amount of http requests in settings is lower than 1.</string>
<string name="nfcApplyTagToRule">Zastosuj tag do reguły</string> <string name="nfcApplyTagToRule">Zastosuj tag do reguły</string>

View File

@@ -334,8 +334,7 @@
<string name="nfcTagFoundWithText">Найдена метка с текстом:</string> <string name="nfcTagFoundWithText">Найдена метка с текстом:</string>
<string name="nfcUnsupportedEncoding">Неподдерживаемая кодировка:</string> <string name="nfcUnsupportedEncoding">Неподдерживаемая кодировка:</string>
<string name="nfcNoNdefIntentBut">Нет NFC NDEF Intent, но</string> <string name="nfcNoNdefIntentBut">Нет NFC NDEF Intent, но</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC пока не поддерживается в этой версии Android.</string> <string name="cantRunRule">Не удается запустить правила.</string>
<string name="cantRunRule">Не удается запустить правила.</string>
<string name="cantDownloadTooFewRequestsInSettings" translatable="false">Не получается загрузить. Количество http запросов в настройках меньше 1.</string> <string name="cantDownloadTooFewRequestsInSettings" translatable="false">Не получается загрузить. Количество http запросов в настройках меньше 1.</string>
<string name="nfcApplyTagToRule">Применить метку к правилу</string> <string name="nfcApplyTagToRule">Применить метку к правилу</string>
<string name="nfcTagReadSuccessfully">Метка прочитана успешно.</string> <string name="nfcTagReadSuccessfully">Метка прочитана успешно.</string>

View File

@@ -296,7 +296,6 @@
<string name="nfcTagFoundWithText">找到标签,文本为:</string> <string name="nfcTagFoundWithText">找到标签,文本为:</string>
<string name="nfcUnsupportedEncoding">不支持的编码:</string> <string name="nfcUnsupportedEncoding">不支持的编码:</string>
<string name="nfcNoNdefIntentBut">没有 NFC NDEF Intent但是</string> <string name="nfcNoNdefIntentBut">没有 NFC NDEF Intent但是</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">此 Android 版本尚不支持 NFC。</string>
<string name="cantRunRule">无法运行规则。</string> <string name="cantRunRule">无法运行规则。</string>
<string name="nfcApplyTagToRule">将标签应用到规则</string> <string name="nfcApplyTagToRule">将标签应用到规则</string>
<string name="nfcTagReadSuccessfully">标签读取成功。</string> <string name="nfcTagReadSuccessfully">标签读取成功。</string>

View File

@@ -366,7 +366,6 @@
<string name="nfcTagFoundWithText">Tag found with text:</string> <string name="nfcTagFoundWithText">Tag found with text:</string>
<string name="nfcUnsupportedEncoding">Unsupported encoding:</string> <string name="nfcUnsupportedEncoding">Unsupported encoding:</string>
<string name="nfcNoNdefIntentBut">No NFC NDEF intent, but</string> <string name="nfcNoNdefIntentBut">No NFC NDEF intent, but</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC not supported in this Android version, yet.</string>
<string name="cantRunRule">Cannot run rules.</string> <string name="cantRunRule">Cannot run rules.</string>
<string name="cantDownloadTooFewRequestsInSettings" translatable="false">Can\'t download anything. Amount of http requests in settings is lower than 1.</string> <string name="cantDownloadTooFewRequestsInSettings" translatable="false">Can\'t download anything. Amount of http requests in settings is lower than 1.</string>
<string name="nfcApplyTagToRule">Apply tag to rule</string> <string name="nfcApplyTagToRule">Apply tag to rule</string>

View File

@@ -1,6 +1,8 @@
* Fixed: Crash in Play Store version when starting the service * Fixed: Crash in Play Store version when starting the service
* Fixed: trigger url result was not stored correctly in a variable * Fixed: trigger url result was not stored correctly in a variable
* Fixed: In case of HTTP errors during trigger url actions, the return value in the variable was not set according to documentation.
* Fixed: Crash when clicking +/- when creating/editing TimeFrame trigger * Fixed: Crash when clicking +/- when creating/editing TimeFrame trigger
* Fixed: Permission BLUETOOTH_CONNECT requested for Bluetooth trigger editor in Google Play version * Fixed: Permission BLUETOOTH_CONNECT requested for Bluetooth trigger editor in Google Play version
* Fixed: Airplane mode trigger didn't work if no locations where defined. * Fixed: Airplane mode trigger didn't work if no locations where defined.
* Fixed: Vibrate action didn't work on some devices
* Added Possibility to select UI theme, hence enabling modern UI designs * Added Possibility to select UI theme, hence enabling modern UI designs