diff --git a/app/android/app/build.gradle b/app/android/app/build.gradle index b325108d06d7..5d978c880157 100644 --- a/app/android/app/build.gradle +++ b/app/android/app/build.gradle @@ -41,7 +41,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "dev.linwood.butterfly" minSdkVersion 21 targetSdkVersion flutter.targetSdkVersion diff --git a/app/android/gradle/wrapper/gradle-wrapper.properties b/app/android/gradle/wrapper/gradle-wrapper.properties index eb1a55be0e15..e1b837a19c22 100644 --- a/app/android/gradle/wrapper/gradle-wrapper.properties +++ b/app/android/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=f397b287023acdba1e9f6fc5ea72d22dd63669d59ed4a289a29b1a76eee151c6 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionSha256Sum=7a00d51fb93147819aab76024feece20b6b84e420694101f276be952e08bef03 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/app/lib/bloc/document_bloc.dart b/app/lib/bloc/document_bloc.dart index 49bdfe3abe35..aee4efbaa43f 100644 --- a/app/lib/bloc/document_bloc.dart +++ b/app/lib/bloc/document_bloc.dart @@ -406,12 +406,11 @@ class DocumentBloc extends ReplayBloc { }).toList()))); final updatedCurrent = event.tools.entries.firstWhereOrNull((element) => oldTools[element.key] == - current.currentIndexCubit.state.handler.data || - current.currentIndexCubit.state.toggleableHandlers - .containsKey(element.key)); + current.currentIndexCubit.state.handler.data); if (updatedCurrent != null) { current.currentIndexCubit.updateTool(this, updatedCurrent.value); } + current.currentIndexCubit.updateTogglingTools(this, event.tools); final updatedTempCurrent = event.tools.entries.firstWhereOrNull( (element) => oldTools[element.key] == diff --git a/app/lib/cubits/current_index.dart b/app/lib/cubits/current_index.dart index 4471588c6931..f59e65e313b9 100644 --- a/app/lib/cubits/current_index.dart +++ b/app/lib/cubits/current_index.dart @@ -1191,4 +1191,40 @@ class CurrentIndexCubit extends Cubit { emit(state.copyWith(areaNavigatorExact: value)); void setAreaNavigatorAsk(bool value) => emit(state.copyWith(areaNavigatorAsk: value)); + + void updateTogglingTools(DocumentBloc bloc, Map tools) { + final blocState = bloc.state; + if (blocState is! DocumentLoadSuccess) return; + final newHandlers = Map>.from(state.toggleableHandlers); + final newForegrounds = + Map>.from(state.toggleableForegrounds); + for (final entry in tools.entries) { + final index = entry.key; + final tool = entry.value; + final old = state.toggleableHandlers[index]; + if (old == null) continue; + if (old.data == tool) continue; + old.dispose(bloc); + for (final r in state.toggleableForegrounds[index] ?? []) { + r.dispose(); + } + final handler = Handler.fromTool(tool); + final document = blocState.data; + final page = blocState.page; + final info = blocState.info; + final currentArea = blocState.currentArea; + final foregrounds = + handler.createForegrounds(this, document, page, info, currentArea); + if (handler.setupForegrounds) { + Future.wait(foregrounds.map((e) async => + await e.setup(document, blocState.assetService, page))); + } + newHandlers[index] = handler; + newForegrounds[index] = foregrounds; + } + emit(state.copyWith( + toggleableHandlers: newHandlers, + toggleableForegrounds: newForegrounds, + )); + } } diff --git a/app/lib/setup_web.dart b/app/lib/setup_web.dart index e11d4e8861a0..fc67caeab5d3 100644 --- a/app/lib/setup_web.dart +++ b/app/lib/setup_web.dart @@ -4,7 +4,7 @@ import 'setup.dart' as general_setup; import 'embed/action_web.dart' as action; Future setup() async { - BrowserContextMenu.disableContextMenu(); + await BrowserContextMenu.disableContextMenu(); action.setup(); await general_setup.setup(); } diff --git a/app/pubspec.lock b/app/pubspec.lock index 9b1d7d09cb92..efddd622a4a2 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -185,10 +185,10 @@ packages: dependency: transitive description: name: camera_avfoundation - sha256: "2e4c568f70e406ccb87376bc06b53d2f5bebaab71e2fbcc1a950e31449381bcf" + sha256: c3038e6e72e284b14ad246a419f26908c08f8886d114cb8a2e351988439bfa68 url: "https://pub.dev" source: hosted - version: "0.9.17+5" + version: "0.9.17+6" camera_platform_interface: dependency: transitive description: