25 lines
815 B
Dart
25 lines
815 B
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
class PendingShare {
|
|
final List<String> filePaths;
|
|
final String? text;
|
|
final DateTime receivedAt;
|
|
|
|
const PendingShare({
|
|
required this.filePaths,
|
|
required this.text,
|
|
required this.receivedAt,
|
|
});
|
|
|
|
bool get hasFiles => filePaths.isNotEmpty;
|
|
bool get hasText => text != null && text!.isNotEmpty;
|
|
bool get isEmpty => !hasFiles && !hasText;
|
|
|
|
/// True when [other] carries the same payload. The iOS Share Extension
|
|
/// fires two `open(url)` requests per share (see ShareViewController), so
|
|
/// the same share can arrive twice on the media stream — receivedAt is
|
|
/// deliberately ignored here so such duplicates compare equal.
|
|
bool contentEquals(PendingShare other) =>
|
|
text == other.text && listEquals(filePaths, other.filePaths);
|
|
}
|