From 09865483f39e01a52e401baba280260df2c2e766 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 28 Dec 2020 16:12:01 +0100 Subject: cleanup, remove unused code and deprecated comments --- .../appUpdate/DownloadConnector.java | 1 - .../appUpdate/FileProviderUtil.java | 15 --------------- .../appUpdate/InstallActivity.java | 1 - .../appUpdate/UpdateDownloadManager.java | 20 -------------------- .../java/se/leap/bitmaskclient/eip/EipCommand.java | 3 +-- 5 files changed, 1 insertion(+), 39 deletions(-) diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java index d4c5de7f..f081331f 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/DownloadConnector.java @@ -88,7 +88,6 @@ public class DownloadConnector { Response response = okHttpClient.newCall(request).execute(); ResponseBody body = response.body(); - InputStream in = body.byteStream(); long contentLength = body.contentLength(); source = body.source(); sink = Okio.buffer(Okio.sink(destFile)); diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java index 756a3b99..4966a863 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/FileProviderUtil.java @@ -26,10 +26,6 @@ import java.io.File; import se.leap.bitmaskclient.BuildConfig; -/** - * From Signal - */ - public class FileProviderUtil { private static final String AUTHORITY = BuildConfig.APPLICATION_ID +".fileprovider"; @@ -38,15 +34,4 @@ public class FileProviderUtil { if (Build.VERSION.SDK_INT >= 24) return FileProvider.getUriForFile(context, AUTHORITY, file); else return Uri.fromFile(file); } - - public static boolean isAuthority(@NonNull Uri uri) { - return AUTHORITY.equals(uri.getAuthority()); - } - - public static boolean delete(@NonNull Context context, @NonNull Uri uri) { - if (AUTHORITY.equals(uri.getAuthority())) { - return context.getContentResolver().delete(uri, null, null) > 0; - } - return new File(uri.getPath()).delete(); - } } diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java index f2f82238..028f47bc 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/InstallActivity.java @@ -28,7 +28,6 @@ import androidx.annotation.Nullable; import java.io.File; -import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.utils.PreferenceHelper; diff --git a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java index 698a0d17..f2eabc7b 100644 --- a/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java +++ b/app/src/fatweb/java/se.leap.bitmaskclient/appUpdate/UpdateDownloadManager.java @@ -22,8 +22,6 @@ import android.os.Bundle; import android.os.ResultReceiver; import android.util.Log; -import androidx.annotation.NonNull; - import java.io.File; import okhttp3.OkHttpClient; @@ -114,7 +112,6 @@ public class UpdateDownloadManager implements Logger, DownloadConnector.Download sendToReceiverOrBroadcast(receiver, UPDATE_DOWNLOAD_FAILED, result); } break; - } } @@ -164,23 +161,6 @@ public class UpdateDownloadManager implements Logger, DownloadConnector.Download return task; } - private static void clearPreviousDownloads(@NonNull Context context, String destinationFile) { - File directory = context.getExternalFilesDir(null); - - if (directory == null) { - Log.w(TAG, "Failed to read external files directory."); - return; - } - - for (File file : directory.listFiles()) { - if (file.getName().equals(destinationFile)) { - if (file.delete()) { - Log.d(TAG, "Deleted " + file.getName()); - } - } - } - } - private Bundle checkVersionFile(Bundle task) { OkHttpClient client = clientGenerator.init(); String versionString = DownloadConnector.requestTextFileFromServer(BuildConfig.version_file_url, client); diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java index 1ee32654..25450f56 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java @@ -4,9 +4,9 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.ResultReceiver; + import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; -import androidx.core.content.ContextCompat; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -38,7 +38,6 @@ public class EipCommand { * @param resultReceiver The resultreceiver to reply to */ private static void execute(@NotNull Context context, @NotNull String action, @Nullable ResultReceiver resultReceiver, @Nullable Intent vpnIntent) { - // TODO validate "action"...how do we get the list of intent-filters for a class via Android API? if (vpnIntent == null) { vpnIntent = new Intent(); } -- cgit v1.2.3