mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-03 01:28:37 +02:00
fix(extensions): serialize verification callbacks
This commit is contained in:
@@ -1409,9 +1409,37 @@ class PlatformBridge {
|
||||
});
|
||||
}
|
||||
|
||||
static final Map<String, Future<bool>> _extensionSessionGrantCompletions =
|
||||
<String, Future<bool>>{};
|
||||
|
||||
static Future<bool> completeExtensionSessionGrant(
|
||||
String extensionId,
|
||||
String grant,
|
||||
) {
|
||||
final normalizedExtensionId = extensionId.trim();
|
||||
final key = normalizedExtensionId.toLowerCase();
|
||||
final activeCompletion = _extensionSessionGrantCompletions[key];
|
||||
if (activeCompletion != null) {
|
||||
_log.d(
|
||||
'Joining active completeExtensionSessionGrant: $normalizedExtensionId',
|
||||
);
|
||||
return activeCompletion;
|
||||
}
|
||||
|
||||
late final Future<bool> completion;
|
||||
completion = _completeExtensionSessionGrant(normalizedExtensionId, grant)
|
||||
.whenComplete(() {
|
||||
if (identical(_extensionSessionGrantCompletions[key], completion)) {
|
||||
_extensionSessionGrantCompletions.remove(key);
|
||||
}
|
||||
});
|
||||
_extensionSessionGrantCompletions[key] = completion;
|
||||
return completion;
|
||||
}
|
||||
|
||||
static Future<bool> _completeExtensionSessionGrant(
|
||||
String extensionId,
|
||||
String grant,
|
||||
) async {
|
||||
_log.d('completeExtensionSessionGrant: $extensionId');
|
||||
final result = await _channel.invokeMethod(
|
||||
|
||||
Reference in New Issue
Block a user