Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility Issue with HarmonyOS has error #2389

Open
1 task done
shanshen6 opened this issue Nov 21, 2024 · 5 comments
Open
1 task done

Compatibility Issue with HarmonyOS has error #2389

shanshen6 opened this issue Nov 21, 2024 · 5 comments
Labels
enhancement New feature or request unplanned This will not be worked on

Comments

@shanshen6
Copy link

shanshen6 commented Nov 21, 2024

Is there an existing issue for this?

Use case

https://gitee.com/harmonycommando_flutter/flutter

flutter build hap

Error output

start hap build...
../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:269:13:
Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match
'TargetPlatform.ohos'.
 - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart'
 ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart').
Try adding a default case or cases that match 'TargetPlatform.ohos'.
    switch (defaultTargetPlatform) {
            ^
../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:479:13:
Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match
'TargetPlatform.ohos'.
 - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart'
 ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart').
Try adding a default case or cases that match 'TargetPlatform.ohos'.
    switch (defaultTargetPlatform) {
            ^
../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:625:13:
Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match
'TargetPlatform.ohos'.
 - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart'
 ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart').
Try adding a default case or cases that match 'TargetPlatform.ohos'.
    switch (defaultTargetPlatform) {
            ^
../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:679:15:
Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match
'TargetPlatform.ohos'.
 - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart'
 ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart').
Try adding a default case or cases that match 'TargetPlatform.ohos'.
      switch (defaultTargetPlatform) {
              ^
../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:693:15:
Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match
'TargetPlatform.ohos'.
 - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart'
 ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart').
Try adding a default case or cases that match 'TargetPlatform.ohos'.
      switch (defaultTargetPlatform) {
              ^
../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:803:17:
Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match
'TargetPlatform.ohos'.
 - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart'
 ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart').
Try adding a default case or cases that match 'TargetPlatform.ohos'.
        switch (defaultTargetPlatform) {
                ^
../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/delegate.dart:843:15:
Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't match
'TargetPlatform.ohos'.
 - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart'
 ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart').
Try adding a default case or cases that match 'TargetPlatform.ohos'.
      switch (defaultTargetPlatform) {
              ^
../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/text/text_selection.da
rt:911:13: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't
match 'TargetPlatform.ohos'.
 - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart'
 ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart').
Try adding a default case or cases that match 'TargetPlatform.ohos'.
    switch (defaultTargetPlatform) {
            ^
../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_quill-10.8.5/lib/src/editor/widgets/text/text_selection.da
rt:1068:15: Error: The type 'TargetPlatform' is not exhaustively matched by the switch cases since it doesn't
match 'TargetPlatform.ohos'.
 - 'TargetPlatform' is from 'package:flutter/src/foundation/platform.dart'
 ('../../../ohos/flutter/packages/flutter/lib/src/foundation/platform.dart').
Try adding a default case or cases that match 'TargetPlatform.ohos'.
      switch (defaultTargetPlatform) {
              ^
Target kernel_snapshot failed: Exception
#0      KernelSnapshot.build (package:flutter_tools/src/build_system/targets/common.dart:279:7)
<asynchronous suspension>
#1      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:875:9)
<asynchronous suspension>
#2      Future.wait.<anonymous closure> (dart:async/future.dart:524:21)
<asynchronous suspension>
#3      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)
<asynchronous suspension>
#4      Future.wait.<anonymous closure> (dart:async/future.dart:524:21)
<asynchronous suspension>
#5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:813:32)
<asynchronous suspension>
#6      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:642:16)
<asynchronous suspension>
#7      flutterAssemble (package:flutter_tools/src/ohos/hvigor.dart:306:32)
<asynchronous suspension>
#8      OhosHvigorBuilder.flutterBuildPre (package:flutter_tools/src/ohos/hvigor.dart:543:27)
<asynchronous suspension>
#9      OhosHvigorBuilder.buildApplicationPipeLine (package:flutter_tools/src/ohos/hvigor.dart:681:5)
<asynchronous suspension>
#10     OhosHvigorBuilder.buildHap (package:flutter_tools/src/ohos/hvigor.dart:479:5)
<asynchronous suspension>
#11     BuildHapCommand.runCommand (package:flutter_tools/src/commands/build_hap.dart:80:5)
<asynchronous suspension>
#12     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1394:27)
<asynchronous suspension>
#13     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#14     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#15     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)
<asynchronous suspension>
#16     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#17     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)
<asynchronous suspension>
#18     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
<asynchronous suspension>
#19     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#20     main (package:flutter_tools/executable.dart:93:3)
<asynchronous suspension>

Error: Failed to compile application for the Ohos.
Running Hvigor task assembleHap...       

Proposal

Dear Flutter Quill Team,

We are currently using Flutter Quill as a cross-platform editor in our project. However, we have encountered several issues when trying to adapt it for HarmonyOS. Specifically, when running the flutter build hap command, we are faced with numerous errors that prevent us from successfully building the application for HarmonyOS.

Steps to Reproduce:

Set up a Flutter project with Flutter Quill as a dependency.
Attempt to build the project for HarmonyOS using the flutter build hap command.
Observe the errors that occur during the build process.

Expected Behavior:

The project should build successfully for HarmonyOS without any errors.

Actual Behavior:

The build process fails with multiple errors, indicating compatibility issues with HarmonyOS.

Error Logs:

(Include any relevant error logs or screenshots here)

Environment:

Flutter version: (include your Flutter version here)
Dart version: (include your Dart version here)
Flutter Quill version: (include the version of Flutter Quill you are using)
HarmonyOS version: (include the version of HarmonyOS you are targeting)

Additional Context:

We believe that resolving these compatibility issues would greatly benefit the Flutter community, as it would enable more developers to use Flutter Quill in their HarmonyOS projects. We would appreciate any assistance or guidance you can provide to help us overcome these challenges.

Thank you for your attention to this matter. We look forward to your response.

Best regards,

@shanshen6 shanshen6 added the enhancement New feature or request label Nov 21, 2024
@shanshen6
Copy link
Author

image Dear Flutter Quill Team,

We are currently using Flutter Quill as a cross-platform editor in our project. However, we have encountered several issues when trying to adapt it for HarmonyOS. Specifically, the delegate.dart file does not seem to be fully compatible with HarmonyOS. When running the flutter build hap command, we encounter numerous errors related to the lack of support for TargetPlatform.ohos.

Details:

File: delegate.dart
Issue: The file does not handle TargetPlatform.ohos in various switch statements, leading to build errors when targeting HarmonyOS.
Example:
In the onTapDown method, the TargetPlatform.ohos case is missing.
In the onDragSelectionUpdate method, the TargetPlatform.ohos case is not properly handled.
Steps to Reproduce:

Set up a Flutter project with Flutter Quill as a dependency.
Attempt to build the project for HarmonyOS using the flutter build hap command.
Observe the errors that occur during the build process.
Expected Behavior:

The project should build successfully for HarmonyOS without any errors.

Actual Behavior:

The build process fails with multiple errors, indicating compatibility issues with HarmonyOS.

Error Logs:

(Include any relevant error logs or screenshots here)

Environment:

Flutter version: (include your Flutter version here)
Dart version: (include your Dart version here)
Flutter Quill version: (include the version of Flutter Quill you are using)
HarmonyOS version: (include the version of HarmonyOS you are targeting)

Additional Context:

We believe that resolving these compatibility issues would greatly benefit the Flutter community, as it would enable more developers to use Flutter Quill in their HarmonyOS projects. We would appreciate any assistance or guidance you can provide to help us overcome these challenges.

Thank you for your attention to this matter. We look forward to your response.

Best regards,

@EchoEllet EchoEllet added minor Minimal impact or cosmetic issue. Can be resolved at a later time without affecting overall function deferred This issue is not a current priority and will not be addressed in the near future. labels Nov 21, 2024
@mny459
Copy link

mny459 commented Nov 22, 2024

Same issue.

@EchoEllet
Copy link
Collaborator

A workaround:

switch (defaultTargetPlatform) {
  case TargetPlatform.android:
  case TargetPlatform.ohos:
  // Assuming HarmonyOS has the same behavior as Android...
  break;
}

The project uses plugins and dependencies that don't support HarmonyOS yet, so it will probably have broken behavior and buggy.

@wangjinshan
Copy link

Subject: Issues with HarmonyOS Case Implementation in Flutter Quill

Hi ,

I hope this email finds you well.

I wanted to bring to your attention some issues we've encountered with the recent implementation of the HarmonyOS (ohos) case in the Flutter Quill package. Specifically, we noticed that treating the HarmonyOS case the same as the Android case has led to several problems:

Paste Functionality: The paste functionality is not working as expected.
Magnifier Feature: The magnifier feature cannot be disabled.
Image Insertion: We are unable to insert images.
These issues are critical for our application, and it appears that a short-term fix might not be feasible.

Could you please look into these problems and provide guidance on how we can resolve them?

Is there any developer currently using this SDK on HarmonyOS? There isn't a good editor available for HarmonyOS right now, and this SDK is definitely going to be the top choice for a rich text editor on HarmonyOS in the future.

Thank you for your attention to this matter.

Best regards

@EchoEllet
Copy link
Collaborator

Image Insertion: We are unable to insert images.
These issues are critical for our application, and it appears that a short-term fix might not be feasible.
Could you please look into these problems and provide guidance on how we can resolve them?

As I mentioned previously, most of those functionalities are either platform behavior or require platform native code, the project uses dependencies and plugins that don't support HarmonyOS, and supporting a new platform isn't something we plan on.

I strongly prefer fewer features that are done well and not half-baked solutions.

@EchoEllet EchoEllet added unplanned This will not be worked on and removed minor Minimal impact or cosmetic issue. Can be resolved at a later time without affecting overall function deferred This issue is not a current priority and will not be addressed in the near future. labels Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request unplanned This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants