Added intent to download AdGuard lists

This commit is contained in:
M66B 2024-03-22 08:31:58 +01:00
parent ef2578bd83
commit 8746e5362f
7 changed files with 15 additions and 0 deletions

View File

@ -622,6 +622,7 @@
<action android:name="${applicationId}.RULE" /> <action android:name="${applicationId}.RULE" />
<action android:name="${applicationId}.TEMPLATE" /> <action android:name="${applicationId}.TEMPLATE" />
<action android:name="${applicationId}.DISCONNECT.ME" /> <action android:name="${applicationId}.DISCONNECT.ME" />
<action android:name="${applicationId}.ADGUARD" />
</intent-filter> </intent-filter>
</service> </service>

View File

@ -629,6 +629,7 @@
<action android:name="${applicationId}.RULE" /> <action android:name="${applicationId}.RULE" />
<action android:name="${applicationId}.TEMPLATE" /> <action android:name="${applicationId}.TEMPLATE" />
<action android:name="${applicationId}.DISCONNECT.ME" /> <action android:name="${applicationId}.DISCONNECT.ME" />
<action android:name="${applicationId}.ADGUARD" />
</intent-filter> </intent-filter>
</service> </service>

View File

@ -628,6 +628,7 @@
<action android:name="${applicationId}.RULE" /> <action android:name="${applicationId}.RULE" />
<action android:name="${applicationId}.TEMPLATE" /> <action android:name="${applicationId}.TEMPLATE" />
<action android:name="${applicationId}.DISCONNECT.ME" /> <action android:name="${applicationId}.DISCONNECT.ME" />
<action android:name="${applicationId}.ADGUARD" />
</intent-filter> </intent-filter>
</service> </service>

View File

@ -628,6 +628,7 @@
<action android:name="${applicationId}.RULE" /> <action android:name="${applicationId}.RULE" />
<action android:name="${applicationId}.TEMPLATE" /> <action android:name="${applicationId}.TEMPLATE" />
<action android:name="${applicationId}.DISCONNECT.ME" /> <action android:name="${applicationId}.DISCONNECT.ME" />
<action android:name="${applicationId}.ADGUARD" />
</intent-filter> </intent-filter>
</service> </service>

View File

@ -623,6 +623,7 @@
<action android:name="${applicationId}.RULE" /> <action android:name="${applicationId}.RULE" />
<action android:name="${applicationId}.TEMPLATE" /> <action android:name="${applicationId}.TEMPLATE" />
<action android:name="${applicationId}.DISCONNECT.ME" /> <action android:name="${applicationId}.DISCONNECT.ME" />
<action android:name="${applicationId}.ADGUARD" />
</intent-filter> </intent-filter>
</service> </service>

View File

@ -54,6 +54,7 @@ public class ServiceExternal extends ServiceBase {
private static final String ACTION_RULE = BuildConfig.APPLICATION_ID + ".RULE"; private static final String ACTION_RULE = BuildConfig.APPLICATION_ID + ".RULE";
private static final String ACTION_TEMPLATE = BuildConfig.APPLICATION_ID + ".TEMPLATE"; private static final String ACTION_TEMPLATE = BuildConfig.APPLICATION_ID + ".TEMPLATE";
private static final String ACTION_DISCONNECT_ME = BuildConfig.APPLICATION_ID + ".DISCONNECT.ME"; private static final String ACTION_DISCONNECT_ME = BuildConfig.APPLICATION_ID + ".DISCONNECT.ME";
private static final String ACTION_ADGUARD = BuildConfig.APPLICATION_ID + ".ADGUARD";
// adb shell am start-foreground-service -a eu.faircode.email.POLL --es account Gmail // adb shell am start-foreground-service -a eu.faircode.email.POLL --es account Gmail
// adb shell am start-foreground-service -a eu.faircode.email.ENABLE --es account Gmail // adb shell am start-foreground-service -a eu.faircode.email.ENABLE --es account Gmail
@ -62,6 +63,7 @@ public class ServiceExternal extends ServiceBase {
// adb shell am start-foreground-service -a eu.faircode.email.RULE --es account Gmail -es rule Test // adb shell am start-foreground-service -a eu.faircode.email.RULE --es account Gmail -es rule Test
// adb shell am start-foreground-service -a eu.faircode.email.TEMPLATE --es template ... --es identity ... --es to ... --es cc ... --es subject ... // adb shell am start-foreground-service -a eu.faircode.email.TEMPLATE --es template ... --es identity ... --es to ... --es cc ... --es subject ...
// adb shell am start-foreground-service -a eu.faircode.email.DISCONNECT // adb shell am start-foreground-service -a eu.faircode.email.DISCONNECT
// adb shell am start-foreground-service -a eu.faircode.email.ADGUARD
@Override @Override
public void onCreate() { public void onCreate() {
@ -118,6 +120,9 @@ public class ServiceExternal extends ServiceBase {
case ACTION_DISCONNECT_ME: case ACTION_DISCONNECT_ME:
disconnect(context, intent); disconnect(context, intent);
break; break;
case ACTION_ADGUARD:
adguard(context, intent);
break;
default: default:
throw new IllegalArgumentException(action); throw new IllegalArgumentException(action);
} }
@ -330,4 +335,8 @@ public class ServiceExternal extends ServiceBase {
private static void disconnect(Context context, Intent intent) throws IOException, JSONException { private static void disconnect(Context context, Intent intent) throws IOException, JSONException {
DisconnectBlacklist.download(context); DisconnectBlacklist.download(context);
} }
private static void adguard(Context context, Intent intent) throws IOException, JSONException {
Adguard.download(context);
}
} }

View File

@ -622,6 +622,7 @@
<action android:name="${applicationId}.RULE" /> <action android:name="${applicationId}.RULE" />
<action android:name="${applicationId}.TEMPLATE" /> <action android:name="${applicationId}.TEMPLATE" />
<action android:name="${applicationId}.DISCONNECT.ME" /> <action android:name="${applicationId}.DISCONNECT.ME" />
<action android:name="${applicationId}.ADGUARD" />
</intent-filter> </intent-filter>
</service> </service>