fixed pending share race error on warm app start
This commit is contained in:
@@ -12,4 +12,17 @@ class PendingShare {
|
||||
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) {
|
||||
if (text != other.text) return false;
|
||||
if (filePaths.length != other.filePaths.length) return false;
|
||||
for (var i = 0; i < filePaths.length; i++) {
|
||||
if (filePaths[i] != other.filePaths[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user