This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add image keyboard support on Android #27763
Closed
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
54a9657
Android GIF/Image Insertion
zlshames 5f0582e
Remove debug logs
tneotia d2ab746
Add test for commitContent
tneotia 983c07c
[flutter_releases] Flutter beta 2.5.0-5.3.pre Engine Cherrypicks (#28…
christopherfujino 89ca066
[flutter_releases] Flutter Stable 2.2.3 Engine Cherrypicks Pt 2 (#27087)
christopherfujino b4c40dd
Full GIF/Image Insertion
zlshames 17e900e
Update commitContent slightly
tneotia e414b03
Fix build
tneotia 805f6f8
Fix build pt2
tneotia 9123435
Fix build pt3
tneotia 26d13e0
remove undefined function to test
ryanawhelan 58c5299
update format to match dart standard for Java
ryanawhelan 9d0eb17
Merge pull request #2 from ryanawhelan/fix_build
zlshames bbb3286
Adds contentCommitMimeTypes support
zlshames fa50825
Formatting fixes
zlshames 0c1dbbd
Merge branch 'master' of github.com:BlueBubblesApp/engine into zach/c…
zlshames a933522
Merge pull request #3 from BlueBubblesApp/zach/commit-mimes
zlshames 3cead60
2.8.1 content commit merges & comment fixes
zlshames 4f735ff
Java refactor
zlshames 76f5faf
Merge pull request #5 from BlueBubblesApp/zach/gif-insertion-pr
zlshames 5d6d517
Adds additional parameter to TextInputChannel.Configuration
zlshames 6004596
Merge pull request #6 from BlueBubblesApp/zach/gif-insertion-pr
zlshames 0224531
Fix build failures
tneotia f1d7ab0
Merge remote-tracking branch 'flutter/master' into tanay/gif-insertio…
tneotia 41fe8f0
Remove duplicate function
tneotia 4105ebc
Fix missing imports
tneotia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove debug logs
- Loading branch information
commit 5f0582ef1e0331ba654209ba11f059229fd5a992
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -487,15 +487,11 @@ public boolean performEditorAction(int actionCode) { | |
|
||
@Override | ||
public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) { | ||
Log.d("HackFlutterEngine", "Content Commit Invoked"); | ||
|
||
// Ensure permission is granted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Period here. |
||
if (BuildCompat.isAtLeastNMR1() && (flags & InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BuildCompat.isAtLeastNMR1() is deprecated. You can use the equivalent: https://developer.android.com/reference/androidx/core/os/BuildCompat#isAtLeastNMR1() |
||
try { | ||
inputContentInfo.requestPermission(); | ||
Log.d("HackFlutterEngine", "Content Commit request permissions: PASS"); | ||
} catch (Exception e) { | ||
Log.d("HackFlutterEngine", "Content Commit reqest permissions: FAIL"); | ||
return false; | ||
} | ||
} | ||
|
@@ -505,14 +501,12 @@ public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundl | |
|
||
final Uri uri = inputContentInfo.getContentUri(); | ||
final String mimeType = inputContentInfo.getDescription().getMimeType(0); | ||
Log.d("HackFlutterEngine", "Content Commit received URI: " + uri + " (MIME: " + mimeType + ")"); | ||
Context context = mFlutterView.getContext(); | ||
Boolean retval = false; | ||
|
||
try { | ||
final InputStream is = context.getContentResolver().openInputStream(uri); | ||
final byte[] data = this.readStreamFully(is, 64 * 1024); | ||
Log.d("HackFlutterEngine", "Content Commit data length: " + data.length); | ||
|
||
final Map<String, Object> obj = new HashMap<>(); | ||
obj.put("mimeType", mimeType); | ||
|
@@ -523,22 +517,12 @@ public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundl | |
textInputChannel.commitContent(mClient, obj); | ||
retval = true; | ||
} catch (FileNotFoundException ex) { | ||
Log.d("HackFlutterEngine", "Content Commit load file: FAIL (Not Found)"); | ||
} catch (Exception ex) { | ||
Log.d("HackFlutterEngine", "Content Commit load data: FAIL"); | ||
} finally { | ||
inputContentInfo.releasePermission(); | ||
} | ||
|
||
if (retval) { | ||
Log.d("HackFlutterEngine", "Content Commit Result: PASS"); | ||
} | ||
|
||
return retval; | ||
} | ||
|
||
// If it gets to this point, it failed | ||
Log.d("HackFlutterEngine", "Content Commit Result: FAIL"); | ||
return false; | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good point was recently brought up by @matthew-carroll about how APIs like this should follow Flutter's declarative pattern instead of being imperative. So instead of telling the client to commit the content, informing the client that the user committed content (
contentCommitted
maybe?). Though, it seems that adjacent API methods already have an imperative pattern, so maybe now is not the time to change that.