Compare commits

...

5 Commits

Author SHA1 Message Date
14655fe55d allow http 2021-08-20 13:25:36 +02:00
cfc145c6c4 allow http 2021-08-18 10:00:41 +02:00
325bff305c Wifi fix 2021-08-14 14:11:19 +02:00
4371fb56f7 Merge remote-tracking branch 'origin/master' into development 2021-08-14 01:55:50 +02:00
7fbac92360 New release 2021-07-29 14:19:20 +02:00
13 changed files with 79 additions and 20 deletions

17
.idea/deploymentTargetDropDown.xml generated Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\jens\.android\avd\Android_11.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2021-08-14T11:41:28.444891400Z" />
</component>
</project>

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
versionCode 108 versionCode 109
versionName "1.6.38" versionName "1.6.39"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -10,8 +10,8 @@
{ {
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"versionCode": 106, "versionCode": 107,
"versionName": "1.6.35-googlePlay", "versionName": "1.6.36-googlePlay",
"outputFile": "app-googlePlayFlavor-release.apk" "outputFile": "app-googlePlayFlavor-release.apk"
} }
] ]

View File

@ -75,6 +75,7 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:usesClearTextTraffic="true"
android:allowClearUserData="true" android:allowClearUserData="true"
android:icon="@drawable/gears" android:icon="@drawable/gears"
android:label="@string/app_name" android:label="@string/app_name"

View File

@ -34,6 +34,8 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
import static com.jens.automation2.receivers.NotificationListener.EXTRA_TEXT; import static com.jens.automation2.receivers.NotificationListener.EXTRA_TEXT;
import static com.jens.automation2.receivers.NotificationListener.EXTRA_TITLE; import static com.jens.automation2.receivers.NotificationListener.EXTRA_TITLE;
import org.apache.commons.lang3.StringUtils;
public class Rule implements Comparable<Rule> public class Rule implements Comparable<Rule>
{ {
@ -812,38 +814,42 @@ public class Rule implements Comparable<Rule>
{ {
if(getLastExecution() == null || sbn.getPostTime() > this.lastExecution.getTimeInMillis()) if(getLastExecution() == null || sbn.getPostTime() > this.lastExecution.getTimeInMillis())
{ {
String app = sbn.getPackageName(); String notificationApp = sbn.getPackageName();
String title = sbn.getNotification().extras.getString(EXTRA_TITLE); String notificationTitle = sbn.getNotification().extras.getString(EXTRA_TITLE);
String text = sbn.getNotification().extras.getString(EXTRA_TEXT); String notificationText = sbn.getNotification().extras.getString(EXTRA_TEXT);
Miscellaneous.logEvent("i", "NotificationCheck", "Checking if this notification matches our rule " + this.getName() + ". App: " + app + ", title: " + title + ", text: " + text, 5); Miscellaneous.logEvent("i", "NotificationCheck", "Checking if this notification matches our rule " + this.getName() + ". App: " + notificationApp + ", title: " + notificationTitle + ", text: " + notificationText, 5);
if (!myApp.equals("-1")) if (!myApp.equals("-1"))
{ {
if (!app.equalsIgnoreCase(myApp)) if (!notificationApp.equalsIgnoreCase(myApp))
{ {
Miscellaneous.logEvent("i", "NotificationCheck", "Notification app name does not match rule.", 5); Miscellaneous.logEvent("i", "NotificationCheck", "Notification app name does not match rule.", 5);
continue; continue;
} }
} }
if (myTitle.length() > 0) if (!StringUtils.isEmpty(myTitle))
{ {
if (!Miscellaneous.compare(myTitleDir, myTitle, title)) if (!Miscellaneous.compare(myTitleDir, myTitle, notificationTitle))
{ {
Miscellaneous.logEvent("i", "NotificationCheck", "Notification title does not match rule.", 5); Miscellaneous.logEvent("i", "NotificationCheck", "Notification title does not match rule.", 5);
continue; continue;
} }
} }
else
Miscellaneous.logEvent("i", "NotificationCheck", "A required title for a notification trigger was not specified.", 5);
if (myText.length() > 0) if (!StringUtils.isEmpty(myText))
{ {
if (!Miscellaneous.compare(myTextDir, myText, text)) if (!Miscellaneous.compare(myTextDir, myText, notificationText))
{ {
Miscellaneous.logEvent("i", "NotificationCheck", "Notification text does not match rule.", 5); Miscellaneous.logEvent("i", "NotificationCheck", "Notification text does not match rule.", 5);
continue; continue;
} }
} }
else
Miscellaneous.logEvent("i", "NotificationCheck", "A required text for a notification trigger was not specified.", 5);
foundMatch = true; foundMatch = true;
break; break;

View File

@ -72,6 +72,7 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:usesClearTextTraffic="true"
android:allowClearUserData="true" android:allowClearUserData="true"
android:icon="@drawable/gears" android:icon="@drawable/gears"
android:label="@string/app_name" android:label="@string/app_name"

View File

@ -66,6 +66,7 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:usesClearTextTraffic="true"
android:allowClearUserData="true" android:allowClearUserData="true"
android:icon="@drawable/gears" android:icon="@drawable/gears"
android:label="@string/app_name" android:label="@string/app_name"

View File

@ -7,9 +7,12 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@ -55,6 +58,7 @@ public class ActivityManageTriggerWifi extends Activity
wifiSpinnerAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, wifiList); wifiSpinnerAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, wifiList);
spinnerWifiList.setAdapter(wifiSpinnerAdapter); spinnerWifiList.setAdapter(wifiSpinnerAdapter);
spinnerWifiList.setEnabled(false); // bug in Android; this only works when done in code, not in xml
if (getIntent().hasExtra("edit")) if (getIntent().hasExtra("edit"))
{ {
@ -128,12 +132,20 @@ public class ActivityManageTriggerWifi extends Activity
void reallyLoadWifiList() void reallyLoadWifiList()
{ {
WifiManager myWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); if(Build.VERSION.SDK_INT >= 30)
{
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.wifiApi30), ActivityManageTriggerWifi.this).show();
loadListOfVisibleWifis();
}
else
{
WifiManager myWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
for (WifiConfiguration wifi : myWifiManager.getConfiguredNetworks()) for (WifiConfiguration wifi : myWifiManager.getConfiguredNetworks())
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", "")); wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
}
if(wifiList.size() > 0) if (wifiList.size() > 0)
{ {
spinnerWifiList.setEnabled(true); spinnerWifiList.setEnabled(true);
Collections.sort(wifiList); Collections.sort(wifiList);
@ -147,6 +159,24 @@ public class ActivityManageTriggerWifi extends Activity
wifiSpinnerAdapter.notifyDataSetChanged(); wifiSpinnerAdapter.notifyDataSetChanged();
} }
void loadListOfVisibleWifis()
{
List<ScanResult> results = null;
try
{
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
results = wifiManager.getScanResults();
for (ScanResult wifi : results)
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "loadListOfVisibleWifis()", Log.getStackTraceString(e), 1);
}
}
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
{ {

View File

@ -244,7 +244,7 @@
<string name="volumeRingtoneNotifications">Sonido polifónico ý notificaciónes</string> <string name="volumeRingtoneNotifications">Sonido polifónico ý notificaciónes</string>
<string name="notificationRingtone">Sonido polifónico para notificaciónes</string> <string name="notificationRingtone">Sonido polifónico para notificaciónes</string>
<string name="incomingCallsRingtone">Sonido de llamadas</string> <string name="incomingCallsRingtone">Sonido de llamadas</string>
<string name="batteryLevel">NIvel de la bateria</string> <string name="batteryLevel">Nivel de la bateria</string>
<string name="selectBattery">Elija nivel de la bateria</string> <string name="selectBattery">Elija nivel de la bateria</string>
<string name="triggerNoiseLevel">Nivel del ruido fondo</string> <string name="triggerNoiseLevel">Nivel del ruido fondo</string>
<string name="anotherAppIsRunning">Otra app esta encendida/terminada</string> <string name="anotherAppIsRunning">Otra app esta encendida/terminada</string>

View File

@ -670,7 +670,7 @@
<string name="matching">matching</string> <string name="matching">matching</string>
<string name="urlRegex" translatable="false">https://regex101.com/</string> <string name="urlRegex" translatable="false">https://regex101.com/</string>
<string name="loadWifiList">Load wifi list</string> <string name="loadWifiList">Load wifi list</string>
<string name="needLocationPermForWifiList">The list of wifis your device has been connected to could be used to determine which places you have been to. That\'s why the location permission is required to load the list of wifis. If you want to be able to pick one from the list you need to grant that permission. If not you can still enter your wifi name manually.</string> <string name="needLocationPermForWifiList">The list of wifis your device has been connected to could be used to determine which places you have been to. That\'s why the location permission is required to load the list of wifis. If you want to be able to pick one from the list you need to grant that permission. If you do not want that, you can still enter your wifi name manually.</string>
<string name="noKnownWifis">There are no known wifis on your device.</string> <string name="noKnownWifis">There are no known wifis on your device.</string>
<string name="urlToTriggerExplanation">This feature does NOT open a browser, but triggers a URL in the background. You can use this e.g. to send commands to your home automation.</string> <string name="urlToTriggerExplanation">This feature does NOT open a browser, but triggers a URL in the background. You can use this e.g. to send commands to your home automation.</string>
<string name="automaticUpdateCheck">Check for updates</string> <string name="automaticUpdateCheck">Check for updates</string>
@ -690,4 +690,5 @@
<string name="bottom">Bottom</string> <string name="bottom">Bottom</string>
<string name="tabsPlacement">Position of tab bar</string> <string name="tabsPlacement">Position of tab bar</string>
<string name="tabsPlacementSummary">Choose where the tabs bar should be placed.</string> <string name="tabsPlacementSummary">Choose where the tabs bar should be placed.</string>
<string name="wifiApi30">Because Google screwd up yet another part of Android, starting with API 30 only the currently visible wifis can be displayed. Not all the ones your device knows.</string>
</resources> </resources>

View File

@ -0,0 +1 @@
* Klartext HTTP Datenverkehr für URL-Auslösen-Aktionen ermöglicht.

View File

@ -1,4 +1,4 @@
* Translations updated. * Translations updated.
* New action: Vibrate * New action: Vibrate
* Improved speed calculation * Improved speed calculation
* Position of tabbar can be chosen (top/bottom) * Position of tab-bar can be chosen (top/bottom)

View File

@ -0,0 +1 @@
* Allowed cleartext HTTP traffic for rules using triggerUrl action