mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
d5de52a789
This is typically used to set wallpaper or contact photos
42 lines
969 B
Dart
42 lines
969 B
Dart
import 'package:nc_photos/mobile/android/share.dart';
|
|
import 'package:nc_photos/platform/share.dart' as itf;
|
|
|
|
class AndroidFileShareFile {
|
|
const AndroidFileShareFile(this.fileUri, this.mimeType);
|
|
|
|
final String fileUri;
|
|
final String? mimeType;
|
|
}
|
|
|
|
class AndroidFileShare implements itf.FileShare {
|
|
const AndroidFileShare(this.files);
|
|
|
|
@override
|
|
Future<void> share() {
|
|
final uris = files.map((e) => e.fileUri).toList();
|
|
final mimes = files.map((e) => e.mimeType).toList();
|
|
return Share.shareItems(uris, mimes);
|
|
}
|
|
|
|
Future<void> setAs() {
|
|
assert(files.length == 1);
|
|
return Share.shareAsAttachData(files.first.fileUri, files.first.mimeType);
|
|
}
|
|
|
|
final List<AndroidFileShareFile> files;
|
|
}
|
|
|
|
class AndroidTextShare extends itf.TextShare {
|
|
AndroidTextShare(
|
|
this.text, {
|
|
this.mimeType = "text/plain",
|
|
});
|
|
|
|
@override
|
|
share() {
|
|
return Share.shareText(text, mimeType);
|
|
}
|
|
|
|
final String text;
|
|
final String? mimeType;
|
|
}
|