increase min sdk and apply new formatter
This commit is contained in:
@@ -18,8 +18,9 @@ class LoadUrlFlags {
|
||||
static const LoadUrlFlags EXTERNAL = LoadUrlFlags._(1 << 2);
|
||||
static const LoadUrlFlags ALLOW_POPUPS = LoadUrlFlags._(1 << 3);
|
||||
static const LoadUrlFlags BYPASS_CLASSIFIER = LoadUrlFlags._(1 << 4);
|
||||
static const LoadUrlFlags LOAD_FLAGS_FORCE_ALLOW_DATA_URI =
|
||||
LoadUrlFlags._(1 << 5);
|
||||
static const LoadUrlFlags LOAD_FLAGS_FORCE_ALLOW_DATA_URI = LoadUrlFlags._(
|
||||
1 << 5,
|
||||
);
|
||||
static const LoadUrlFlags LOAD_FLAGS_REPLACE_HISTORY = LoadUrlFlags._(1 << 6);
|
||||
static const LoadUrlFlags LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE =
|
||||
LoadUrlFlags._(1 << 7);
|
||||
|
||||
@@ -42,12 +42,13 @@ abstract class Source {
|
||||
String? packageId,
|
||||
int? packageCategory,
|
||||
) {
|
||||
final caller = packageId != null
|
||||
? ExternalPackage(
|
||||
packageId: packageId,
|
||||
category: PackageCategory.fromInt(packageCategory).toValue(),
|
||||
)
|
||||
: null;
|
||||
final caller =
|
||||
packageId != null
|
||||
? ExternalPackage(
|
||||
packageId: packageId,
|
||||
category: PackageCategory.fromInt(packageCategory).toValue(),
|
||||
)
|
||||
: null;
|
||||
|
||||
switch (sourceId) {
|
||||
case 1:
|
||||
|
||||
+27
-27
@@ -15,47 +15,47 @@ class BaseSelectionAction extends CustomSelectionAction {
|
||||
|
||||
class CallAction extends BaseSelectionAction {
|
||||
CallAction(PerformAction action)
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_CALL',
|
||||
title: 'Call',
|
||||
pattern: SelectionPattern.phone,
|
||||
performAction: action,
|
||||
);
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_CALL',
|
||||
title: 'Call',
|
||||
pattern: SelectionPattern.phone,
|
||||
performAction: action,
|
||||
);
|
||||
}
|
||||
|
||||
class EmailAction extends BaseSelectionAction {
|
||||
EmailAction(PerformAction action)
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_EMAIL',
|
||||
title: 'Email',
|
||||
pattern: SelectionPattern.email,
|
||||
performAction: action,
|
||||
);
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_EMAIL',
|
||||
title: 'Email',
|
||||
pattern: SelectionPattern.email,
|
||||
performAction: action,
|
||||
);
|
||||
}
|
||||
|
||||
class SearchAction extends BaseSelectionAction {
|
||||
SearchAction(PerformAction action)
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_SEARCH',
|
||||
title: 'Search',
|
||||
performAction: action,
|
||||
);
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_SEARCH',
|
||||
title: 'Search',
|
||||
performAction: action,
|
||||
);
|
||||
}
|
||||
|
||||
class PrivateSearchAction extends BaseSelectionAction {
|
||||
PrivateSearchAction(PerformAction action)
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_SEARCH_PRIVATELY',
|
||||
title: 'Private Search',
|
||||
performAction: action,
|
||||
);
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_SEARCH_PRIVATELY',
|
||||
title: 'Private Search',
|
||||
performAction: action,
|
||||
);
|
||||
}
|
||||
|
||||
class ShareAction extends BaseSelectionAction {
|
||||
ShareAction(PerformAction action)
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_SHARE',
|
||||
title: 'Share',
|
||||
performAction: action,
|
||||
);
|
||||
: super(
|
||||
id: 'CUSTOM_CONTEXT_MENU_SHARE',
|
||||
title: 'Share',
|
||||
performAction: action,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -47,17 +47,15 @@ class GeckoAddonService extends GeckoAddonEvents {
|
||||
) {
|
||||
switch (actionType) {
|
||||
case WebExtensionActionType.browser:
|
||||
_browserExtensionSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
extensionId,
|
||||
(extensionId: extensionId, data: null),
|
||||
);
|
||||
_browserExtensionSubject.addWhenMoreRecent(timestamp, extensionId, (
|
||||
extensionId: extensionId,
|
||||
data: null,
|
||||
));
|
||||
case WebExtensionActionType.page:
|
||||
_pageExtensionSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
extensionId,
|
||||
(extensionId: extensionId, data: null),
|
||||
);
|
||||
_pageExtensionSubject.addWhenMoreRecent(timestamp, extensionId, (
|
||||
extensionId: extensionId,
|
||||
data: null,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,17 +68,15 @@ class GeckoAddonService extends GeckoAddonEvents {
|
||||
) {
|
||||
switch (actionType) {
|
||||
case WebExtensionActionType.browser:
|
||||
_browserIconSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
extensionId,
|
||||
(extensionId: extensionId, bytes: icon),
|
||||
);
|
||||
_browserIconSubject.addWhenMoreRecent(timestamp, extensionId, (
|
||||
extensionId: extensionId,
|
||||
bytes: icon,
|
||||
));
|
||||
case WebExtensionActionType.page:
|
||||
_pageIconSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
extensionId,
|
||||
(extensionId: extensionId, bytes: icon),
|
||||
);
|
||||
_pageIconSubject.addWhenMoreRecent(timestamp, extensionId, (
|
||||
extensionId: extensionId,
|
||||
bytes: icon,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,17 +89,15 @@ class GeckoAddonService extends GeckoAddonEvents {
|
||||
) {
|
||||
switch (actionType) {
|
||||
case WebExtensionActionType.browser:
|
||||
_browserExtensionSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
extensionId,
|
||||
(extensionId: extensionId, data: extensionData),
|
||||
);
|
||||
_browserExtensionSubject.addWhenMoreRecent(timestamp, extensionId, (
|
||||
extensionId: extensionId,
|
||||
data: extensionData,
|
||||
));
|
||||
case WebExtensionActionType.page:
|
||||
_pageExtensionSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
extensionId,
|
||||
(extensionId: extensionId, data: extensionData),
|
||||
);
|
||||
_pageExtensionSubject.addWhenMoreRecent(timestamp, extensionId, (
|
||||
extensionId: extensionId,
|
||||
data: extensionData,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ class GeckoDeleteBrowserDataService {
|
||||
final GeckoDeleteBrowsingDataController _api;
|
||||
|
||||
GeckoDeleteBrowserDataService({GeckoDeleteBrowsingDataController? api})
|
||||
: _api = api ?? _apiInstance;
|
||||
: _api = api ?? _apiInstance;
|
||||
|
||||
Future<void> deleteTabs() {
|
||||
return _api.deleteTabs();
|
||||
|
||||
+4
-3
@@ -6,7 +6,7 @@ class GeckoEngineSettingsService {
|
||||
final GeckoEngineSettingsApi _api;
|
||||
|
||||
GeckoEngineSettingsService({GeckoEngineSettingsApi? api})
|
||||
: _api = api ?? _apiInstance;
|
||||
: _api = api ?? _apiInstance;
|
||||
|
||||
Future<void> setDefaultSettings(
|
||||
GeckoEngineSettings settings, {
|
||||
@@ -30,8 +30,9 @@ class GeckoEngineSettingsService {
|
||||
}
|
||||
|
||||
Future<void> httpsOnlyMode(HttpsOnlyMode state) {
|
||||
return _api
|
||||
.updateRuntimeSettings(GeckoEngineSettings(httpsOnlyMode: state));
|
||||
return _api.updateRuntimeSettings(
|
||||
GeckoEngineSettings(httpsOnlyMode: state),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> globalPrivacyControlEnabled(bool state) {
|
||||
|
||||
@@ -82,11 +82,10 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
|
||||
@override
|
||||
void onHistoryStateChange(int timestamp, String id, HistoryState state) {
|
||||
_historySubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
id,
|
||||
(tabId: id, history: state),
|
||||
);
|
||||
_historySubject.addWhenMoreRecent(timestamp, id, (
|
||||
tabId: id,
|
||||
history: state,
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -95,11 +94,10 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
String id,
|
||||
ReaderableState state,
|
||||
) {
|
||||
_readerableSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
id,
|
||||
(tabId: id, readerable: state),
|
||||
);
|
||||
_readerableSubject.addWhenMoreRecent(timestamp, id, (
|
||||
tabId: id,
|
||||
readerable: state,
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -108,50 +106,47 @@ class GeckoEventService extends GeckoStateEvents {
|
||||
String id,
|
||||
SecurityInfoState state,
|
||||
) {
|
||||
_securityInfoSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
id,
|
||||
(tabId: id, securityInfo: state),
|
||||
);
|
||||
_securityInfoSubject.addWhenMoreRecent(timestamp, id, (
|
||||
tabId: id,
|
||||
securityInfo: state,
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
void onIconChange(int timestamp, String id, Uint8List? bytes) {
|
||||
_iconChangeSubject
|
||||
.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));
|
||||
_iconUpdateSubject.addWhenMoreRecent(timestamp, url, (
|
||||
url: url,
|
||||
bytes: bytes,
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
void onThumbnailChange(int timestamp, String id, Uint8List? bytes) {
|
||||
_thumbnailSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
id,
|
||||
(tabId: id, bytes: bytes),
|
||||
);
|
||||
_thumbnailSubject.addWhenMoreRecent(timestamp, id, (
|
||||
tabId: id,
|
||||
bytes: bytes,
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
void onFindResults(int timestamp, String id, List<FindResultState?> results) {
|
||||
_findResultsSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
id,
|
||||
(tabId: id, results: results.nonNulls.toList()),
|
||||
);
|
||||
_findResultsSubject.addWhenMoreRecent(timestamp, id, (
|
||||
tabId: id,
|
||||
results: results.nonNulls.toList(),
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
void onTabAdded(int timestamp, String tabId) {
|
||||
_tabAddedSubject.addWhenMoreRecent(
|
||||
timestamp,
|
||||
null,
|
||||
tabId,
|
||||
);
|
||||
_tabAddedSubject.addWhenMoreRecent(timestamp, null, tabId);
|
||||
}
|
||||
|
||||
GeckoEventService.setUp({
|
||||
|
||||
@@ -7,11 +7,11 @@ class GeckoFindInPageService {
|
||||
final String? tabId;
|
||||
|
||||
GeckoFindInPageService({required this.tabId, GeckoFindApi? api})
|
||||
: _api = api ?? _apiInstance;
|
||||
: _api = api ?? _apiInstance;
|
||||
|
||||
GeckoFindInPageService.forActiveTab({GeckoFindApi? api})
|
||||
: _api = api ?? _apiInstance,
|
||||
tabId = null;
|
||||
: _api = api ?? _apiInstance,
|
||||
tabId = null;
|
||||
|
||||
Future<void> findAll(String text) {
|
||||
return _api.findAll(tabId, text);
|
||||
|
||||
@@ -12,16 +12,17 @@ class GeckoPrefService {
|
||||
}
|
||||
|
||||
Future<Map<String, Object>> applyPrefs(Map<String, Object> prefs) {
|
||||
final buffer = prefs.entries.map((pref) {
|
||||
final value = switch (pref.value) {
|
||||
final bool x => '$x',
|
||||
final int x => '$x',
|
||||
final String x => '"$x"',
|
||||
_ => throw Exception('Unknow pref type')
|
||||
};
|
||||
final buffer =
|
||||
prefs.entries.map((pref) {
|
||||
final value = switch (pref.value) {
|
||||
final bool x => '$x',
|
||||
final int x => '$x',
|
||||
final String x => '"$x"',
|
||||
_ => throw Exception('Unknow pref type'),
|
||||
};
|
||||
|
||||
return 'user_pref("${pref.key}", $value);';
|
||||
}).join();
|
||||
return 'user_pref("${pref.key}", $value);';
|
||||
}).join();
|
||||
|
||||
return _apiInstance.applyPrefs(buffer);
|
||||
}
|
||||
|
||||
@@ -29,11 +29,12 @@ class GeckoReaderableService extends ReaderViewController {
|
||||
ReaderViewEvents? readerEvents,
|
||||
BinaryMessenger? binaryMessenger,
|
||||
String messageChannelSuffix = '',
|
||||
}) : _events = readerEvents ??
|
||||
ReaderViewEvents(
|
||||
binaryMessenger: binaryMessenger,
|
||||
messageChannelSuffix: messageChannelSuffix,
|
||||
) {
|
||||
}) : _events =
|
||||
readerEvents ??
|
||||
ReaderViewEvents(
|
||||
binaryMessenger: binaryMessenger,
|
||||
messageChannelSuffix: messageChannelSuffix,
|
||||
) {
|
||||
ReaderViewController.setUp(
|
||||
this,
|
||||
binaryMessenger: binaryMessenger,
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ class GeckoSelectionActionService extends GeckoSelectionActionEvents {
|
||||
BinaryMessenger? binaryMessenger,
|
||||
String messageChannelSuffix = '',
|
||||
GeckoSelectionActionController? api,
|
||||
}) : _api = api ?? _apiInstance,
|
||||
_actions = [] {
|
||||
}) : _api = api ?? _apiInstance,
|
||||
_actions = [] {
|
||||
GeckoSelectionActionEvents.setUp(
|
||||
this,
|
||||
binaryMessenger: binaryMessenger,
|
||||
|
||||
@@ -10,11 +10,11 @@ class GeckoSessionService {
|
||||
final GeckoSessionApi _api;
|
||||
|
||||
GeckoSessionService({required String this.tabId, GeckoSessionApi? api})
|
||||
: _api = api ?? _apiInstance;
|
||||
: _api = api ?? _apiInstance;
|
||||
|
||||
GeckoSessionService.forActiveTab({GeckoSessionApi? api})
|
||||
: _api = api ?? _apiInstance,
|
||||
tabId = null;
|
||||
: _api = api ?? _apiInstance,
|
||||
tabId = null;
|
||||
|
||||
Future<void> loadUrl({
|
||||
required Uri url,
|
||||
@@ -43,10 +43,7 @@ class GeckoSessionService {
|
||||
}
|
||||
|
||||
Future<void> reload({LoadUrlFlags flags = LoadUrlFlags.NONE}) {
|
||||
return _api.reload(
|
||||
tabId: tabId,
|
||||
flags: flags.toValue(),
|
||||
);
|
||||
return _api.reload(tabId: tabId, flags: flags.toValue());
|
||||
}
|
||||
|
||||
Future<void> stopLoading() {
|
||||
@@ -54,31 +51,19 @@ class GeckoSessionService {
|
||||
}
|
||||
|
||||
Future<void> goBack({bool userInteraction = true}) {
|
||||
return _api.goBack(
|
||||
tabId: tabId,
|
||||
userInteraction: userInteraction,
|
||||
);
|
||||
return _api.goBack(tabId: tabId, userInteraction: userInteraction);
|
||||
}
|
||||
|
||||
Future<void> goForward({bool userInteraction = true}) {
|
||||
return _api.goForward(
|
||||
tabId: tabId,
|
||||
userInteraction: userInteraction,
|
||||
);
|
||||
return _api.goForward(tabId: tabId, userInteraction: userInteraction);
|
||||
}
|
||||
|
||||
Future<void> goToHistoryIndex({required int index}) {
|
||||
return _api.goToHistoryIndex(
|
||||
index: index,
|
||||
tabId: tabId,
|
||||
);
|
||||
return _api.goToHistoryIndex(index: index, tabId: tabId);
|
||||
}
|
||||
|
||||
Future<void> requestDesktopSite({required bool enable}) {
|
||||
return _api.requestDesktopSite(
|
||||
enable: enable,
|
||||
tabId: tabId,
|
||||
);
|
||||
return _api.requestDesktopSite(enable: enable, tabId: tabId);
|
||||
}
|
||||
|
||||
Future<void> exitFullscreen() {
|
||||
@@ -110,9 +95,7 @@ class GeckoSessionService {
|
||||
return _api.translateRestore(tabId: tabId);
|
||||
}
|
||||
|
||||
Future<void> crashRecovery({
|
||||
List<String>? tabIds,
|
||||
}) {
|
||||
Future<void> crashRecovery({List<String>? tabIds}) {
|
||||
return _api.crashRecovery(tabIds: tabIds);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,7 @@ import 'package:rxdart/rxdart.dart';
|
||||
final _lastEventTimes = <Subject, Map<dynamic, int>>{};
|
||||
|
||||
extension SubjectAddRecent<T> on Subject<T> {
|
||||
void addWhenMoreRecent(
|
||||
int timestamp,
|
||||
dynamic identifier,
|
||||
T value,
|
||||
) {
|
||||
void addWhenMoreRecent(int timestamp, dynamic identifier, T value) {
|
||||
_lastEventTimes[this] ??= {};
|
||||
|
||||
if ((_lastEventTimes[this]?[identifier] ?? 0) < timestamp) {
|
||||
|
||||
@@ -23,8 +23,9 @@ class GeckoView extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _GeckoViewState extends State<GeckoView> {
|
||||
static const platform =
|
||||
MethodChannel('me.movenext.flutter_mozilla_components/trim_memory');
|
||||
static const platform = MethodChannel(
|
||||
'me.movenext.flutter_mozilla_components/trim_memory',
|
||||
);
|
||||
|
||||
final browserService = GeckoBrowserService();
|
||||
|
||||
@@ -46,10 +47,7 @@ class _GeckoViewState extends State<GeckoView> {
|
||||
Widget build(BuildContext context) {
|
||||
return PlatformViewLink(
|
||||
viewType: 'eu.lensai/gecko',
|
||||
surfaceFactory: (
|
||||
context,
|
||||
controller,
|
||||
) {
|
||||
surfaceFactory: (context, controller) {
|
||||
return AndroidViewSurface(
|
||||
controller: controller as AndroidViewController,
|
||||
gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
|
||||
@@ -58,12 +56,12 @@ class _GeckoViewState extends State<GeckoView> {
|
||||
},
|
||||
onCreatePlatformView: (PlatformViewCreationParams params) {
|
||||
return PlatformViewsService.initExpensiveAndroidView(
|
||||
id: params.id,
|
||||
viewType: 'eu.lensai/gecko',
|
||||
layoutDirection: TextDirection.ltr,
|
||||
creationParams: {},
|
||||
creationParamsCodec: const StandardMessageCodec(),
|
||||
)
|
||||
id: params.id,
|
||||
viewType: 'eu.lensai/gecko',
|
||||
layoutDirection: TextDirection.ltr,
|
||||
creationParams: {},
|
||||
creationParamsCodec: const StandardMessageCodec(),
|
||||
)
|
||||
..addOnPlatformViewCreatedListener((value) async {
|
||||
params.onPlatformViewCreated(value);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user