nc-photos/app/lib/mobile/android/download.dart

27 lines
706 B
Dart
Raw Normal View History

import 'dart:async';
import 'package:flutter/services.dart';
class DownloadEvent {
2021-10-02 11:12:54 +02:00
static StreamSubscription<DownloadCancelEvent> listenDownloadCancel() =>
_cancelStream.listen(null);
/// User canceled the download job
static const exceptionCodeUserCanceled = "userCanceled";
2021-10-02 11:12:54 +02:00
static const _downloadCancelChannel = EventChannel(
"com.nkming.nc_photos/download_event/action_download_cancel");
2022-07-08 16:52:18 +02:00
static final _cancelStream = _downloadCancelChannel
2021-10-02 11:12:54 +02:00
.receiveBroadcastStream()
.map((data) => DownloadCancelEvent(
data["notificationId"],
));
}
2021-10-02 11:12:54 +02:00
class DownloadCancelEvent {
const DownloadCancelEvent(this.notificationId);
final int notificationId;
}