mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-04 15:49:49 +00:00
40 lines
755 B
Dart
40 lines
755 B
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
class ContinuedProcessing {
|
|
const ContinuedProcessing._();
|
|
|
|
static const _channel =
|
|
MethodChannel('gopeed/continued_processing');
|
|
|
|
static Future<bool> isSupported() async {
|
|
if (!Platform.isIOS) return false;
|
|
|
|
try {
|
|
return await _channel.invokeMethod<bool>(
|
|
'isSupported',
|
|
) ??
|
|
false;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static Future<bool> setEnabled(
|
|
bool enabled,
|
|
) async {
|
|
if (!Platform.isIOS) return false;
|
|
|
|
try {
|
|
return await _channel.invokeMethod<bool>(
|
|
'setEnabled',
|
|
{'enabled': enabled},
|
|
) ??
|
|
false;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|