intermediate
This commit is contained in:
@@ -8,7 +8,8 @@ import 'package:rxdart/rxdart.dart';
|
||||
typedef HistoryEvent = ({String tabId, HistoryState history});
|
||||
typedef ReaderableEvent = ({String tabId, ReaderableState readerable});
|
||||
typedef SecurityInfoEvent = ({String tabId, SecurityInfoState securityInfo});
|
||||
typedef IconEvent = ({String tabId, Uint8List? bytes});
|
||||
typedef IconChangeEvent = ({String tabId, Uint8List? bytes});
|
||||
typedef IconUpdateEvent = ({String url, Uint8List bytes});
|
||||
typedef ThumbnailEvent = ({String tabId, Uint8List? bytes});
|
||||
typedef FindResultsEvent = ({String tabId, List<FindResultState> results});
|
||||
|
||||
@@ -24,7 +25,8 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
final _securityInfoSubject = ReplaySubject<SecurityInfoEvent>();
|
||||
final _readerableSubject = ReplaySubject<ReaderableEvent>();
|
||||
|
||||
final _iconSubject = PublishSubject<IconEvent>();
|
||||
final _iconChangeSubject = PublishSubject<IconChangeEvent>();
|
||||
final _iconUpdateSubject = PublishSubject<IconUpdateEvent>();
|
||||
final _thumbnailSubject = PublishSubject<ThumbnailEvent>();
|
||||
final _findResultsSubject = PublishSubject<FindResultsEvent>();
|
||||
|
||||
@@ -41,7 +43,8 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
Stream<ReaderableEvent> get readerableEvents => _readerableSubject.stream;
|
||||
Stream<SecurityInfoEvent> get securityInfoEvents =>
|
||||
_securityInfoSubject.stream;
|
||||
Stream<IconEvent> get iconEvents => _iconSubject.stream;
|
||||
Stream<IconChangeEvent> get iconChangeEvents => _iconChangeSubject.stream;
|
||||
Stream<IconUpdateEvent> get iconUpdateEvents => _iconUpdateSubject.stream;
|
||||
Stream<ThumbnailEvent> get thumbnailEvents => _thumbnailSubject.stream;
|
||||
Stream<FindResultsEvent> get findResultsEvent => _findResultsSubject.stream;
|
||||
|
||||
@@ -114,7 +117,14 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
|
||||
@override
|
||||
void onIconChange(int timestamp, String id, Uint8List? bytes) {
|
||||
_iconSubject.addWhenMoreRecent(timestamp, id, (tabId: id, bytes: bytes));
|
||||
_iconChangeSubject
|
||||
.addWhenMoreRecent(timestamp, id, (tabId: id, bytes: bytes));
|
||||
}
|
||||
|
||||
@override
|
||||
void onIconUpdate(int timestamp, String url, Uint8List bytes) {
|
||||
_iconUpdateSubject
|
||||
.addWhenMoreRecent(timestamp, url, (url: url, bytes: bytes));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -162,7 +172,7 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
unawaited(_historySubject.close());
|
||||
unawaited(_readerableSubject.close());
|
||||
unawaited(_securityInfoSubject.close());
|
||||
unawaited(_iconSubject.close());
|
||||
unawaited(_iconChangeSubject.close());
|
||||
unawaited(_thumbnailSubject.close());
|
||||
unawaited(_findResultsSubject.close());
|
||||
unawaited(_tabAddedSubject.close());
|
||||
|
||||
@@ -10,14 +10,17 @@ class GeckoIconService {
|
||||
Future<IconResult> loadIcon({
|
||||
required Uri url,
|
||||
List<Resource> resources = const [],
|
||||
IconSize size = IconSize.defaultSize,
|
||||
bool isPrivate = false,
|
||||
bool waitOnNetworkLoad = true,
|
||||
}) async {
|
||||
return _api.loadIcon(
|
||||
IconRequest(
|
||||
url: url.toString(),
|
||||
size: IconSize.defaultSize,
|
||||
size: size,
|
||||
resources: resources,
|
||||
isPrivate: false,
|
||||
waitOnNetworkLoad: true,
|
||||
isPrivate: isPrivate,
|
||||
waitOnNetworkLoad: waitOnNetworkLoad,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Autogenerated from Pigeon (v22.7.0), do not edit directly.
|
||||
// Autogenerated from Pigeon (v22.7.1), do not edit directly.
|
||||
// See also: https://pub.dev/packages/pigeon
|
||||
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers
|
||||
|
||||
@@ -2492,6 +2492,8 @@ abstract class GeckoStateEvents {
|
||||
|
||||
void onEngineReadyStateChange(int timestamp, bool state);
|
||||
|
||||
void onIconUpdate(int timestamp, String url, Uint8List bytes);
|
||||
|
||||
void onTabAdded(int timestamp, String tabId);
|
||||
|
||||
void onTabListChange(int timestamp, List<String> tabIds);
|
||||
@@ -2570,6 +2572,37 @@ abstract class GeckoStateEvents {
|
||||
});
|
||||
}
|
||||
}
|
||||
{
|
||||
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onIconUpdate$messageChannelSuffix', pigeonChannelCodec,
|
||||
binaryMessenger: binaryMessenger);
|
||||
if (api == null) {
|
||||
pigeonVar_channel.setMessageHandler(null);
|
||||
} else {
|
||||
pigeonVar_channel.setMessageHandler((Object? message) async {
|
||||
assert(message != null,
|
||||
'Argument for dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onIconUpdate was null.');
|
||||
final List<Object?> args = (message as List<Object?>?)!;
|
||||
final int? arg_timestamp = (args[0] as int?);
|
||||
assert(arg_timestamp != null,
|
||||
'Argument for dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onIconUpdate was null, expected non-null int.');
|
||||
final String? arg_url = (args[1] as String?);
|
||||
assert(arg_url != null,
|
||||
'Argument for dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onIconUpdate was null, expected non-null String.');
|
||||
final Uint8List? arg_bytes = (args[2] as Uint8List?);
|
||||
assert(arg_bytes != null,
|
||||
'Argument for dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onIconUpdate was null, expected non-null Uint8List.');
|
||||
try {
|
||||
api.onIconUpdate(arg_timestamp!, arg_url!, arg_bytes!);
|
||||
return wrapResponse(empty: true);
|
||||
} on PlatformException catch (e) {
|
||||
return wrapResponse(error: e);
|
||||
} catch (e) {
|
||||
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
{
|
||||
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.flutter_mozilla_components.GeckoStateEvents.onTabAdded$messageChannelSuffix', pigeonChannelCodec,
|
||||
|
||||
Reference in New Issue
Block a user