Skip to content

Commit

Permalink
Enable WebView debugging and update dependencies
Browse files Browse the repository at this point in the history
Added platform checks for Android and iOS in `book_screen.dart` to conditionally enable WebView debugging. Updated the Android `build.gradle` to force a specific WebView version and enabled WebKit Developer Extras in macOS `AppDelegate.swift`. Adjusted dependencies in `pubspec.lock`.
  • Loading branch information
jmgeffroy committed Sep 2, 2024
1 parent 442adf1 commit c0e437d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions demo-app/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ allprojects {
}

}
// From https://github.com/pichillilorenzo/flutter_inappwebview/pull/2182
configurations.all {
resolutionStrategy {
force 'androidx.webkit:webkit:1.8.0'
}
}
}


Expand Down
7 changes: 7 additions & 0 deletions demo-app/macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ class AppDelegate: FlutterAppDelegate {
override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}

override func applicationDidFinishLaunching(_ aNotification: Notification) {
super.applicationDidFinishLaunching(aNotification)

// Allow WebView inspection
UserDefaults.standard.set(true, forKey: "WebKitDeveloperExtras")
}
}
6 changes: 3 additions & 3 deletions demo-app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
version: "0.0.99"
source_span:
dependency: transitive
description:
Expand Down Expand Up @@ -1091,10 +1091,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
url: "https://pub.dev"
source: hosted
version: "14.2.5"
version: "14.2.4"
web:
dependency: transitive
description:
Expand Down
5 changes: 4 additions & 1 deletion reader_widget/lib/views/viewers/book_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';

import 'package:dartx/dartx.dart';
import 'package:fimber/fimber.dart';
Expand Down Expand Up @@ -51,7 +52,9 @@ abstract class BookScreenState<T extends BookScreen,
}

Future<bool> loadWebViewConfig() async {
await InAppWebViewController.setWebContentsDebuggingEnabled(true);
if (Platform.isAndroid || Platform.isIOS) {
await InAppWebViewController.setWebContentsDebuggingEnabled(true);
}
return true;
}

Expand Down

0 comments on commit c0e437d

Please sign in to comment.