Remove unused download events (#1236)

* Remove unused DownloadRedditVideoEvent

* Remove unused DownloadMediaEvent
This commit is contained in:
Sergei Kozelko 2022-11-19 16:25:38 +07:00 committed by GitHub
parent a1df8f4d38
commit da58688586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 29 deletions

View File

@ -1,9 +0,0 @@
package ml.docilealligator.infinityforreddit.events;
public class DownloadMediaEvent {
public boolean isSuccessful;
public DownloadMediaEvent(boolean isSuccessful) {
this.isSuccessful = isSuccessful;
}
}

View File

@ -1,9 +0,0 @@
package ml.docilealligator.infinityforreddit.events;
public class DownloadRedditVideoEvent {
public boolean isSuccessful;
public DownloadRedditVideoEvent(boolean isSuccessful) {
this.isSuccessful = isSuccessful;
}
}

View File

@ -27,8 +27,6 @@ import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat; import androidx.core.app.NotificationManagerCompat;
import androidx.documentfile.provider.DocumentFile; import androidx.documentfile.provider.DocumentFile;
import org.greenrobot.eventbus.EventBus;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -45,7 +43,6 @@ import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.apis.DownloadFile; import ml.docilealligator.infinityforreddit.apis.DownloadFile;
import ml.docilealligator.infinityforreddit.broadcastreceivers.DownloadedMediaDeleteActionBroadcastReceiver; import ml.docilealligator.infinityforreddit.broadcastreceivers.DownloadedMediaDeleteActionBroadcastReceiver;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.events.DownloadMediaEvent;
import ml.docilealligator.infinityforreddit.utils.APIUtils; import ml.docilealligator.infinityforreddit.utils.APIUtils;
import ml.docilealligator.infinityforreddit.utils.NotificationUtils; import ml.docilealligator.infinityforreddit.utils.NotificationUtils;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
@ -337,14 +334,12 @@ public class DownloadMediaService extends Service {
-1, randomNotificationIdOffset, null, null); -1, randomNotificationIdOffset, null, null);
break; break;
} }
EventBus.getDefault().post(new DownloadMediaEvent(false));
} else { } else {
MediaScannerConnection.scanFile( MediaScannerConnection.scanFile(
DownloadMediaService.this, new String[]{destinationFileUri.toString()}, null, DownloadMediaService.this, new String[]{destinationFileUri.toString()}, null,
(path, uri) -> { (path, uri) -> {
updateNotification(mediaType, R.string.downloading_media_finished, -1, updateNotification(mediaType, R.string.downloading_media_finished, -1,
randomNotificationIdOffset, destinationFileUri, mimeType); randomNotificationIdOffset, destinationFileUri, mimeType);
EventBus.getDefault().post(new DownloadMediaEvent(true));
} }
); );
} }

View File

@ -25,15 +25,12 @@ import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.os.Process; import android.os.Process;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.util.Log;
import androidx.core.app.NotificationChannelCompat; import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat; import androidx.core.app.NotificationManagerCompat;
import androidx.documentfile.provider.DocumentFile; import androidx.documentfile.provider.DocumentFile;
import org.greenrobot.eventbus.EventBus;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -52,7 +49,6 @@ import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.apis.DownloadFile; import ml.docilealligator.infinityforreddit.apis.DownloadFile;
import ml.docilealligator.infinityforreddit.broadcastreceivers.DownloadedMediaDeleteActionBroadcastReceiver; import ml.docilealligator.infinityforreddit.broadcastreceivers.DownloadedMediaDeleteActionBroadcastReceiver;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.events.DownloadRedditVideoEvent;
import ml.docilealligator.infinityforreddit.utils.NotificationUtils; import ml.docilealligator.infinityforreddit.utils.NotificationUtils;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
@ -594,13 +590,11 @@ public class DownloadRedditVideoService extends Service {
randomNotificationIdOffset, null); randomNotificationIdOffset, null);
break; break;
} }
EventBus.getDefault().post(new DownloadRedditVideoEvent(false));
} else { } else {
MediaScannerConnection.scanFile( MediaScannerConnection.scanFile(
this, new String[]{destinationFileUri.toString()}, null, this, new String[]{destinationFileUri.toString()}, null,
(path, uri) -> { (path, uri) -> {
updateNotification(R.string.downloading_reddit_video_finished, -1, randomNotificationIdOffset, destinationFileUri); updateNotification(R.string.downloading_reddit_video_finished, -1, randomNotificationIdOffset, destinationFileUri);
EventBus.getDefault().post(new DownloadRedditVideoEvent(true));
} }
); );
} }