forked from mirror/monocles_chat_clean
Add preference to disable auto download of all attachments
also in public channels and from strangers
This commit is contained in:
parent
532c6f6491
commit
3fcab53c08
8 changed files with 17 additions and 4 deletions
|
@ -154,7 +154,7 @@ public class PgpDecryptionService {
|
|||
message.setBody(body);
|
||||
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
|
||||
final HttpConnectionManager manager = mXmppConnectionService.getHttpConnectionManager();
|
||||
if (message.trusted()
|
||||
if ((mXmppConnectionService.easyDownloader() || message.trusted())
|
||||
&& message.treatAsDownloadable()
|
||||
&& manager.getAutoAcceptFileSize() > 0) {
|
||||
manager.createNewDownloadConnection(message);
|
||||
|
|
|
@ -4,8 +4,8 @@ import android.os.PowerManager;
|
|||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
|
@ -342,7 +342,7 @@ public class HttpDownloadConnection implements Transferable {
|
|||
|
||||
private long retrieveFileSize() throws IOException {
|
||||
try {
|
||||
Log.d(Config.LOGTAG, "retrieve file size. interactive:" + String.valueOf(interactive));
|
||||
Log.d(Config.LOGTAG, "retrieve file size. interactive:" + interactive);
|
||||
changeStatus(STATUS_CHECKING);
|
||||
HttpURLConnection connection;
|
||||
final String hostname = mUrl.getHost();
|
||||
|
|
|
@ -757,7 +757,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
|
||||
mXmppConnectionService.databaseBackend.createMessage(message);
|
||||
final HttpConnectionManager manager = this.mXmppConnectionService.getHttpConnectionManager();
|
||||
if (message.trusted() && message.treatAsDownloadable() && manager.getAutoAcceptFileSize() > 0) {
|
||||
if ((mXmppConnectionService.easyDownloader() || message.trusted()) && message.treatAsDownloadable() && manager.getAutoAcceptFileSize() > 0) {
|
||||
manager.createNewDownloadConnection(message);
|
||||
} else if (notify) {
|
||||
if (query != null && query.isCatchup()) {
|
||||
|
|
|
@ -1043,6 +1043,10 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean easyDownloader() {
|
||||
return getBooleanPreference(SettingsActivity.EASY_DOWNLOADER, R.bool.easy_downloader);
|
||||
}
|
||||
|
||||
private boolean dndOnSilentMode() {
|
||||
return getBooleanPreference(SettingsActivity.DND_ON_SILENT_MODE, R.bool.dnd_on_silent_mode);
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ public class SettingsActivity extends XmppActivity implements
|
|||
public static final String MAPPREVIEW_HOST = "mappreview_host";
|
||||
public static final String ALLOW_MESSAGE_CORRECTION = "allow_message_correction";
|
||||
public static final String USE_UNICOLORED_CHATBG = "unicolored_chatbg";
|
||||
public static final String EASY_DOWNLOADER = "easy_downloader";
|
||||
|
||||
public static final int REQUEST_CREATE_BACKUP = 0xbf8701;
|
||||
Preference multiAccountPreference;
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
<integer name="low_video_res">360</integer>
|
||||
<integer name="mid_video_res">720</integer>
|
||||
<integer name="high_video_res">1080</integer>
|
||||
<bool name="easy_downloader">true</bool>
|
||||
|
||||
<string-array name="domains">
|
||||
<item>pix-art.de</item>
|
||||
|
|
|
@ -1095,4 +1095,6 @@
|
|||
<string name="pref_mappreview_host_summary">Use a custom map preview host</string>
|
||||
<string name="pref_mappreview_host">Map preview host</string>
|
||||
<string name="webview_not_available">Webview is not available on your device.</string>
|
||||
<string name="pref_easy_downloader_summary">Automatically download all attachments in public channels and from strangers instead of showing a button for a manual download.</string>
|
||||
<string name="pref_easy_downloader">Automatically download all attachments</string>
|
||||
</resources>
|
||||
|
|
|
@ -334,6 +334,11 @@
|
|||
android:key="last_activity"
|
||||
android:summary="@string/pref_broadcast_last_activity_summary"
|
||||
android:title="@string/pref_broadcast_last_activity" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/easy_downloader"
|
||||
android:key="easy_downloader"
|
||||
android:summary="@string/pref_easy_downloader_summary"
|
||||
android:title="@string/pref_easy_downloader" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/notifications_from_strangers"
|
||||
android:key="notifications_from_strangers"
|
||||
|
|
Loading…
Add table
Reference in a new issue