mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-18 14:23:42 +00:00
Remove extension WebView data during uninstall
This commit is contained in:
1 parent
c47b735fc4
commit
d642ae5018
25 files changed
+609
-19
No files matched your search
@@ -18,6 +18,10 @@ class WebViewProfile {
|
||||
final String id;
|
||||
static const _channel = MethodChannel('com.pichillilorenzo/flutter_inappwebview_cookiemanager');
|
||||
|
||||
Future<void> remove() async {
|
||||
await _call('gopeed.removeProfile', {});
|
||||
}
|
||||
|
||||
Future<void> prepare(String proxyUrl) async {
|
||||
await _call('gopeed.prepareProfile', {'proxyUrl': proxyUrl});
|
||||
}
|
||||
|
||||
@@ -130,6 +130,9 @@ class WebViewRpcService {
|
||||
switch (method) {
|
||||
case 'webview.isAvailable':
|
||||
return {'available': true};
|
||||
case 'profile.remove':
|
||||
await _removeProfile(_string(params, 'profileId'));
|
||||
return {};
|
||||
case 'page.open':
|
||||
return _openPage(params);
|
||||
case 'page.addInitScript':
|
||||
@@ -188,6 +191,15 @@ class WebViewRpcService {
|
||||
return {'pageId': pageId};
|
||||
}
|
||||
|
||||
Future<void> _removeProfile(String id) async {
|
||||
for (final page in _pagesById.values.where((page) => page.cookieManager.id == id).toList()) {
|
||||
await _closePage(page.pageId);
|
||||
}
|
||||
// Let visible platform views unmount before releasing their native store.
|
||||
await WidgetsBinding.instance.endOfFrame;
|
||||
await WebViewProfile(id).remove();
|
||||
}
|
||||
|
||||
WebViewRpcPageSession _page(Map<String, dynamic> params) {
|
||||
final page = _pagesById[_pageId(params)];
|
||||
if (page == null) {
|
||||
|
||||
Reference in new issue
Block a user