diff --git a/yuuna/android/app/build.gradle b/yuuna/android/app/build.gradle index 12d3d5b9..abb08675 100644 --- a/yuuna/android/app/build.gradle +++ b/yuuna/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 33 + compileSdkVersion 34 ndkVersion '21.4.7075529' compileOptions { diff --git a/yuuna/lib/src/creator/enhancements/bing_images_search_enhancement.dart b/yuuna/lib/src/creator/enhancements/bing_images_search_enhancement.dart index a3e79daf..da3f0b88 100644 --- a/yuuna/lib/src/creator/enhancements/bing_images_search_enhancement.dart +++ b/yuuna/lib/src/creator/enhancements/bing_images_search_enhancement.dart @@ -92,15 +92,11 @@ class BingImagesSearchEnhancement extends ImageEnhancement { HeadlessInAppWebView webView = HeadlessInAppWebView( initialUrlRequest: URLRequest( - url: Uri.parse( + url: WebUri( "https://www.bing.com/images/search?q=$searchTerm')", ), ), - initialOptions: InAppWebViewGroupOptions( - android: AndroidInAppWebViewOptions( - blockNetworkImage: true, - ), - ), + initialSettings: InAppWebViewSettings(blockNetworkImage: true), onLoadStop: (controller, uri) async { Directory appDirDoc = await getApplicationSupportDirectory(); String bingImagesPath = '${appDirDoc.path}/bingImages'; diff --git a/yuuna/lib/src/media/sources/reader_lyrics_source.dart b/yuuna/lib/src/media/sources/reader_lyrics_source.dart index d74c6125..8187f38e 100644 --- a/yuuna/lib/src/media/sources/reader_lyrics_source.dart +++ b/yuuna/lib/src/media/sources/reader_lyrics_source.dart @@ -140,16 +140,12 @@ class ReaderLyricsSource extends ReaderMediaSource { bool webViewBusy = true; HeadlessInAppWebView webView = HeadlessInAppWebView( - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions( - userAgent: userAgent, - ), - android: AndroidInAppWebViewOptions( - blockNetworkImage: true, - ), + initialSettings: InAppWebViewSettings( + userAgent: userAgent, + blockNetworkImage: true, ), initialUrlRequest: URLRequest( - url: Uri.parse(searchUrl), + url: WebUri(searchUrl), ), onLoadStop: (controller, uri) async { text = await controller.evaluateJavascript(source: ''' @@ -186,16 +182,12 @@ class ReaderLyricsSource extends ReaderMediaSource { bool googleWebViewBusy = true; HeadlessInAppWebView googleWebView = HeadlessInAppWebView( - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions( - userAgent: userAgent, - ), - android: AndroidInAppWebViewOptions( - blockNetworkImage: true, - ), + initialSettings: InAppWebViewSettings( + userAgent: userAgent, + blockNetworkImage: true, ), initialUrlRequest: URLRequest( - url: Uri.parse( + url: WebUri( 'https://google.com/search?q=$artist+$title+歌詞+site:uta-net.com/song'), ), onLoadStop: (controller, uri) async { @@ -216,16 +208,12 @@ class ReaderLyricsSource extends ReaderMediaSource { if (firstResultUrl != null) { bool utanetWebViewBusy = true; HeadlessInAppWebView utanetWebView = HeadlessInAppWebView( - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions( - userAgent: userAgent, - ), - android: AndroidInAppWebViewOptions( - blockNetworkImage: true, - ), + initialSettings: InAppWebViewSettings( + userAgent: userAgent, + blockNetworkImage: true, ), initialUrlRequest: URLRequest( - url: Uri.parse(firstResultUrl!), + url: WebUri(firstResultUrl!), ), onLoadStop: (controller, uri) async { text = await controller.evaluateJavascript(source: ''' diff --git a/yuuna/lib/src/media/sources/reader_mokuro_source.dart b/yuuna/lib/src/media/sources/reader_mokuro_source.dart index 4ce6129f..1a6253e0 100644 --- a/yuuna/lib/src/media/sources/reader_mokuro_source.dart +++ b/yuuna/lib/src/media/sources/reader_mokuro_source.dart @@ -248,15 +248,12 @@ class ReaderMokuroSource extends ReaderMediaSource { ); HeadlessInAppWebView webView = HeadlessInAppWebView( - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions( - allowFileAccessFromFileURLs: true, - allowUniversalAccessFromFileURLs: true, - ), - android: AndroidInAppWebViewOptions(), + initialSettings: InAppWebViewSettings( + allowFileAccessFromFileURLs: true, + allowUniversalAccessFromFileURLs: true, ), initialUrlRequest: URLRequest( - url: Uri.parse( + url: WebUri( 'file://$parentDirectory/${Uri.encodeComponent(directoryBasename)}/${Uri.encodeComponent(fileBasename)}'), ), onLoadStop: (controller, url) async { diff --git a/yuuna/lib/src/media/sources/reader_ttu_source.dart b/yuuna/lib/src/media/sources/reader_ttu_source.dart index e2aba16c..e77b8c72 100644 --- a/yuuna/lib/src/media/sources/reader_ttu_source.dart +++ b/yuuna/lib/src/media/sources/reader_ttu_source.dart @@ -256,7 +256,7 @@ class ReaderTtuSource extends ReaderMediaSource { HeadlessInAppWebView webView = HeadlessInAppWebView( initialUrlRequest: URLRequest( - url: Uri.parse('http://localhost:$port/'), + url: WebUri('http://localhost:$port/'), ), onLoadStop: (controller, url) async { controller.evaluateJavascript(source: getHistoryJs); diff --git a/yuuna/lib/src/pages/implementations/browser_source_page.dart b/yuuna/lib/src/pages/implementations/browser_source_page.dart index 29db6835..1f25be3d 100644 --- a/yuuna/lib/src/pages/implementations/browser_source_page.dart +++ b/yuuna/lib/src/pages/implementations/browser_source_page.dart @@ -319,7 +319,7 @@ class _BrowserSourcePageState extends BaseSourcePageState { text: Uri.decodeFull( _uriNotifier.value?.removeFragment().toString() ?? ''), onBrowse: (url) { - _controller.loadUrl(urlRequest: URLRequest(url: Uri.parse(url))); + _controller.loadUrl(urlRequest: URLRequest(url: WebUri(url))); }, ), ); @@ -328,7 +328,7 @@ class _BrowserSourcePageState extends BaseSourcePageState { /// Get the default context menu for sources that make use of embedded web /// views. ContextMenu get contextMenu => ContextMenu( - options: ContextMenuOptions( + settings: ContextMenuSettings( hideDefaultSystemContextMenuItems: true, ), menuItems: [ @@ -343,7 +343,7 @@ class _BrowserSourcePageState extends BaseSourcePageState { /// Get the default context menu for sources that make use of embedded web /// views. ContextMenu get emptyContextMenu => ContextMenu( - options: ContextMenuOptions( + settings: ContextMenuSettings( hideDefaultSystemContextMenuItems: true, ), menuItems: [], @@ -351,8 +351,7 @@ class _BrowserSourcePageState extends BaseSourcePageState { ContextMenuItem searchMenuItem() { return ContextMenuItem( - iosId: '1', - androidId: 1, + id: 1, title: t.search, action: searchMenuAction, ); @@ -360,8 +359,7 @@ class _BrowserSourcePageState extends BaseSourcePageState { ContextMenuItem stashMenuItem() { return ContextMenuItem( - iosId: '2', - androidId: 2, + id: 2, title: t.stash, action: stashMenuAction, ); @@ -369,8 +367,7 @@ class _BrowserSourcePageState extends BaseSourcePageState { ContextMenuItem copyMenuItem() { return ContextMenuItem( - iosId: '3', - androidId: 3, + id: 3, title: t.copy, action: copyMenuAction, ); @@ -378,8 +375,7 @@ class _BrowserSourcePageState extends BaseSourcePageState { ContextMenuItem shareMenuItem() { return ContextMenuItem( - iosId: '4', - androidId: 4, + id: 4, title: t.share, action: shareMenuAction, ); @@ -387,8 +383,7 @@ class _BrowserSourcePageState extends BaseSourcePageState { ContextMenuItem creatorMenuItem() { return ContextMenuItem( - iosId: '5', - androidId: 5, + id: 5, title: t.creator, action: creatorMenuAction, ); @@ -478,13 +473,10 @@ class _BrowserSourcePageState extends BaseSourcePageState { scrollX = newX; scrollY = newY; }, - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions( - userAgent: userAgent, - ), + initialSettings: InAppWebViewSettings( + userAgent: userAgent, ), - initialUrlRequest: - URLRequest(url: Uri.parse(widget.item!.mediaIdentifier)), + initialUrlRequest: URLRequest(url: WebUri(widget.item!.mediaIdentifier)), contextMenu: contextMenu, onConsoleMessage: onConsoleMessage, onWebViewCreated: (controller) { diff --git a/yuuna/lib/src/pages/implementations/creator_page.dart b/yuuna/lib/src/pages/implementations/creator_page.dart index ccb61c3b..ff70a609 100644 --- a/yuuna/lib/src/pages/implementations/creator_page.dart +++ b/yuuna/lib/src/pages/implementations/creator_page.dart @@ -209,23 +209,11 @@ class _CreatorPageState extends BasePageState { onWillPop: onWillPop, child: GestureDetector( onTap: () => FocusManager.instance.primaryFocus?.unfocus(), - child: Stack( - children: [ - buildBlur(), - buildScaffold(), - ], - ), + child: buildScaffold(), ), ); } - Widget buildBlur() { - return BackdropFilter( - filter: ImageFilter.blur(sigmaX: 25, sigmaY: 25), - child: Container(), - ); - } - AppBar buildAppBar() { return AppBar( backgroundColor: Colors.transparent, @@ -463,7 +451,7 @@ class _CreatorPageState extends BasePageState { return Scaffold( backgroundColor: - theme.colorScheme.background.withOpacity(isCardEditing ? 0.5 : 1), + theme.colorScheme.background.withOpacity(isCardEditing ? 0.96 : 1), key: _scaffoldKey, resizeToAvoidBottomInset: true, appBar: showPortrait ? buildAppBar() : null, diff --git a/yuuna/lib/src/pages/implementations/mokuro_catalog_browse_page.dart b/yuuna/lib/src/pages/implementations/mokuro_catalog_browse_page.dart index 8262b834..8d62a344 100644 --- a/yuuna/lib/src/pages/implementations/mokuro_catalog_browse_page.dart +++ b/yuuna/lib/src/pages/implementations/mokuro_catalog_browse_page.dart @@ -183,7 +183,7 @@ class _MokuroCatalogBrowsePageState /// Get the default context menu for sources that make use of embedded web /// views. ContextMenu get contextMenu => ContextMenu( - options: ContextMenuOptions( + settings: ContextMenuSettings( hideDefaultSystemContextMenuItems: true, ), menuItems: [ @@ -198,7 +198,7 @@ class _MokuroCatalogBrowsePageState /// Get the default context menu for sources that make use of embedded web /// views. ContextMenu get emptyContextMenu => ContextMenu( - options: ContextMenuOptions( + settings: ContextMenuSettings( hideDefaultSystemContextMenuItems: true, ), menuItems: [], @@ -206,8 +206,7 @@ class _MokuroCatalogBrowsePageState ContextMenuItem searchMenuItem() { return ContextMenuItem( - iosId: '1', - androidId: 1, + id: 1, title: t.search, action: searchMenuAction, ); @@ -215,8 +214,7 @@ class _MokuroCatalogBrowsePageState ContextMenuItem stashMenuItem() { return ContextMenuItem( - iosId: '2', - androidId: 2, + id: 2, title: t.stash, action: stashMenuAction, ); @@ -224,8 +222,7 @@ class _MokuroCatalogBrowsePageState ContextMenuItem copyMenuItem() { return ContextMenuItem( - iosId: '3', - androidId: 3, + id: 3, title: t.copy, action: copyMenuAction, ); @@ -233,8 +230,7 @@ class _MokuroCatalogBrowsePageState ContextMenuItem shareMenuItem() { return ContextMenuItem( - iosId: '4', - androidId: 4, + id: 4, title: t.share, action: shareMenuAction, ); @@ -242,8 +238,7 @@ class _MokuroCatalogBrowsePageState ContextMenuItem creatorMenuItem() { return ContextMenuItem( - iosId: '5', - androidId: 5, + id: 5, title: t.creator, action: creatorMenuAction, ); @@ -327,17 +322,13 @@ class _MokuroCatalogBrowsePageState Widget buildBody() { return InAppWebView( - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions( - verticalScrollBarEnabled: false, - horizontalScrollBarEnabled: false, - ), - android: AndroidInAppWebViewOptions( - initialScale: MediaQuery.of(context).size.width ~/ 1.5, - ), + initialSettings: InAppWebViewSettings( + verticalScrollBarEnabled: false, + horizontalScrollBarEnabled: false, + initialScale: MediaQuery.of(context).size.width ~/ 1.5, ), initialUrlRequest: URLRequest( - url: Uri.parse(widget.catalog?.url ?? widget.item!.mediaIdentifier)), + url: WebUri(widget.catalog?.url ?? widget.item!.mediaIdentifier)), contextMenu: contextMenu, onConsoleMessage: onConsoleMessage, onWebViewCreated: (controller) { diff --git a/yuuna/lib/src/pages/implementations/reader_ttu_source_page.dart b/yuuna/lib/src/pages/implementations/reader_ttu_source_page.dart index ba2f204d..2a4e5b49 100644 --- a/yuuna/lib/src/pages/implementations/reader_ttu_source_page.dart +++ b/yuuna/lib/src/pages/implementations/reader_ttu_source_page.dart @@ -254,13 +254,13 @@ class _ReaderTtuSourcePageState extends BaseSourcePageState return selectedText; } - AndroidCacheMode get cacheMode { + CacheMode get cacheMode { if (mediaSource.currentTtuInternalVersion == ReaderTtuSource.ttuInternalVersion) { - return AndroidCacheMode.LOAD_CACHE_ELSE_NETWORK; + return CacheMode.LOAD_CACHE_ELSE_NETWORK; } else { mediaSource.setTtuInternalVersion(); - return AndroidCacheMode.LOAD_NO_CACHE; + return CacheMode.LOAD_NO_CACHE; } } @@ -277,37 +277,32 @@ class _ReaderTtuSourcePageState extends BaseSourcePageState Widget buildReaderArea(LocalAssetsServer server) { return InAppWebView( initialUrlRequest: URLRequest( - url: Uri.parse( + url: WebUri( widget.item?.mediaIdentifier ?? 'http://localhost:${server.boundPort}/manage.html', ), ), - androidOnPermissionRequest: (controller, origin, resources) async { - return PermissionRequestResponse( - resources: resources, - action: PermissionRequestResponseAction.GRANT, + onPermissionRequest: (controller, origin) async { + return PermissionResponse( + action: PermissionResponseAction.GRANT, ); }, - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions( - allowFileAccessFromFileURLs: true, - allowUniversalAccessFromFileURLs: true, - mediaPlaybackRequiresUserGesture: false, - verticalScrollBarEnabled: false, - horizontalScrollBarEnabled: false, - javaScriptCanOpenWindowsAutomatically: true, - useOnDownloadStart: true, - ), - android: AndroidInAppWebViewOptions( - verticalScrollbarThumbColor: Colors.transparent, - verticalScrollbarTrackColor: Colors.transparent, - horizontalScrollbarThumbColor: Colors.transparent, - horizontalScrollbarTrackColor: Colors.transparent, - scrollbarFadingEnabled: false, - appCachePath: appModel.browserDirectory.path, - cacheMode: cacheMode, - supportMultipleWindows: true, - ), + initialSettings: InAppWebViewSettings( + allowFileAccessFromFileURLs: true, + allowUniversalAccessFromFileURLs: true, + mediaPlaybackRequiresUserGesture: false, + verticalScrollBarEnabled: false, + horizontalScrollBarEnabled: false, + javaScriptCanOpenWindowsAutomatically: true, + useOnDownloadStart: true, + verticalScrollbarThumbColor: Colors.transparent, + verticalScrollbarTrackColor: Colors.transparent, + horizontalScrollbarThumbColor: Colors.transparent, + horizontalScrollbarTrackColor: Colors.transparent, + scrollbarFadingEnabled: false, + appCachePath: appModel.browserDirectory.path, + cacheMode: cacheMode, + supportMultipleWindows: true, ), contextMenu: contextMenu, onConsoleMessage: onConsoleMessage, @@ -336,29 +331,25 @@ class _ReaderTtuSourcePageState extends BaseSourcePageState width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height * (3 / 4), child: InAppWebView( - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions( - supportZoom: false, - disableContextMenu: true, - allowFileAccessFromFileURLs: true, - allowUniversalAccessFromFileURLs: true, - mediaPlaybackRequiresUserGesture: false, - verticalScrollBarEnabled: false, - horizontalScrollBarEnabled: false, - javaScriptCanOpenWindowsAutomatically: true, - userAgent: 'random', - useOnDownloadStart: true, - ), - android: AndroidInAppWebViewOptions( - verticalScrollbarThumbColor: Colors.transparent, - verticalScrollbarTrackColor: Colors.transparent, - horizontalScrollbarThumbColor: Colors.transparent, - horizontalScrollbarTrackColor: Colors.transparent, - scrollbarFadingEnabled: false, - appCachePath: appModel.browserDirectory.path, - cacheMode: cacheMode, - supportMultipleWindows: true, - ), + initialSettings: InAppWebViewSettings( + supportZoom: false, + disableContextMenu: true, + allowFileAccessFromFileURLs: true, + allowUniversalAccessFromFileURLs: true, + mediaPlaybackRequiresUserGesture: false, + verticalScrollBarEnabled: false, + horizontalScrollBarEnabled: false, + javaScriptCanOpenWindowsAutomatically: true, + userAgent: 'random', + useOnDownloadStart: true, + verticalScrollbarThumbColor: Colors.transparent, + verticalScrollbarTrackColor: Colors.transparent, + horizontalScrollbarThumbColor: Colors.transparent, + horizontalScrollbarTrackColor: Colors.transparent, + scrollbarFadingEnabled: false, + appCachePath: appModel.browserDirectory.path, + cacheMode: cacheMode, + supportMultipleWindows: true, ), windowId: createWindowRequest.windowId, onDownloadStartRequest: onDownloadStartRequest, @@ -580,7 +571,7 @@ if (!window.getSelection().isCollapsed) { /// Get the default context menu for sources that make use of embedded web /// views. ContextMenu get contextMenu => ContextMenu( - options: ContextMenuOptions( + settings: ContextMenuSettings( hideDefaultSystemContextMenuItems: true, ), menuItems: [ @@ -595,7 +586,7 @@ if (!window.getSelection().isCollapsed) { /// Get the default context menu for sources that make use of embedded web /// views. ContextMenu get emptyContextMenu => ContextMenu( - options: ContextMenuOptions( + settings: ContextMenuSettings( hideDefaultSystemContextMenuItems: true, ), menuItems: [], @@ -603,8 +594,7 @@ if (!window.getSelection().isCollapsed) { ContextMenuItem searchMenuItem() { return ContextMenuItem( - iosId: '1', - androidId: 1, + id: 1, title: t.search, action: searchMenuAction, ); @@ -612,8 +602,7 @@ if (!window.getSelection().isCollapsed) { ContextMenuItem stashMenuItem() { return ContextMenuItem( - iosId: '2', - androidId: 2, + id: 2, title: t.stash, action: stashMenuAction, ); @@ -621,8 +610,7 @@ if (!window.getSelection().isCollapsed) { ContextMenuItem copyMenuItem() { return ContextMenuItem( - iosId: '3', - androidId: 3, + id: 3, title: t.copy, action: copyMenuAction, ); @@ -630,8 +618,7 @@ if (!window.getSelection().isCollapsed) { ContextMenuItem shareMenuItem() { return ContextMenuItem( - iosId: '4', - androidId: 4, + id: 4, title: t.share, action: shareMenuAction, ); @@ -639,8 +626,7 @@ if (!window.getSelection().isCollapsed) { ContextMenuItem creatorMenuItem() { return ContextMenuItem( - iosId: '5', - androidId: 5, + id: 5, title: t.creator, action: creatorMenuAction, ); diff --git a/yuuna/pubspec.lock b/yuuna/pubspec.lock index 5b30f52b..3b979dd5 100644 --- a/yuuna/pubspec.lock +++ b/yuuna/pubspec.lock @@ -668,11 +668,19 @@ packages: dependency: "direct main" description: path: "." - ref: "759bd376214a763ab17ce2ede2c5a00b38330e13" - resolved-ref: "759bd376214a763ab17ce2ede2c5a00b38330e13" + ref: ffd182431017ec919ece3f80bf5e22a9286189af + resolved-ref: ffd182431017ec919ece3f80bf5e22a9286189af url: "https://github.com/lrorpilla/flutter_inappwebview" source: git - version: "5.7.2+3" + version: "6.0.0-beta.25" + flutter_inappwebview_internal_annotations: + dependency: transitive + description: + name: flutter_inappwebview_internal_annotations + sha256: "064a8ccbc76217dcd3b0fd6c6ea6f549e69b2849a0233b5bb46af9632c3ce2ff" + url: "https://pub.dev" + source: hosted + version: "1.1.0" flutter_launcher_icons: dependency: "direct main" description: diff --git a/yuuna/pubspec.yaml b/yuuna/pubspec.yaml index fb4ac38b..d7084810 100644 --- a/yuuna/pubspec.yaml +++ b/yuuna/pubspec.yaml @@ -55,7 +55,7 @@ dependencies: flutter_inappwebview: git: url: https://github.com/lrorpilla/flutter_inappwebview - ref: 759bd376214a763ab17ce2ede2c5a00b38330e13 + ref: ffd182431017ec919ece3f80bf5e22a9286189af flutter_launcher_icons: ^0.12.0 flutter_logs: ^2.1.11 flutter_native_splash: ^2.2.8