Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Add image keyboard support on Android #27763

Closed
wants to merge 26 commits into from
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 Jul 11, 2021
5f0582e
Remove debug logs
tneotia Jul 28, 2021
d2ab746
Add test for commitContent
tneotia Jul 29, 2021
983c07c
[flutter_releases] Flutter beta 2.5.0-5.3.pre Engine Cherrypicks (#28…
christopherfujino Sep 2, 2021
89ca066
[flutter_releases] Flutter Stable 2.2.3 Engine Cherrypicks Pt 2 (#27087)
christopherfujino Jun 30, 2021
b4c40dd
Full GIF/Image Insertion
zlshames Jul 11, 2021
17e900e
Update commitContent slightly
tneotia Nov 6, 2021
e414b03
Fix build
tneotia Nov 10, 2021
805f6f8
Fix build pt2
tneotia Nov 10, 2021
9123435
Fix build pt3
tneotia Nov 10, 2021
26d13e0
remove undefined function to test
ryanawhelan Jan 9, 2022
58c5299
update format to match dart standard for Java
ryanawhelan Jan 9, 2022
9d0eb17
Merge pull request #2 from ryanawhelan/fix_build
zlshames Jan 10, 2022
bbb3286
Adds contentCommitMimeTypes support
zlshames Jan 15, 2022
fa50825
Formatting fixes
zlshames Jan 15, 2022
0c1dbbd
Merge branch 'master' of github.com:BlueBubblesApp/engine into zach/c…
zlshames Jan 15, 2022
a933522
Merge pull request #3 from BlueBubblesApp/zach/commit-mimes
zlshames Jan 15, 2022
3cead60
2.8.1 content commit merges & comment fixes
zlshames Jan 28, 2022
4f735ff
Java refactor
zlshames Jan 28, 2022
76f5faf
Merge pull request #5 from BlueBubblesApp/zach/gif-insertion-pr
zlshames Jan 28, 2022
5d6d517
Adds additional parameter to TextInputChannel.Configuration
zlshames Jan 28, 2022
6004596
Merge pull request #6 from BlueBubblesApp/zach/gif-insertion-pr
zlshames Jan 28, 2022
0224531
Fix build failures
tneotia Apr 13, 2022
f1d7ab0
Merge remote-tracking branch 'flutter/master' into tanay/gif-insertio…
tneotia Apr 13, 2022
41fe8f0
Remove duplicate function
tneotia Apr 13, 2022
4105ebc
Fix missing imports
tneotia Apr 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove debug logs
  • Loading branch information
tneotia committed Jul 28, 2021
commit 5f0582ef1e0331ba654209ba11f059229fd5a992
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,11 @@ public boolean performEditorAction(int actionCode) {

@Override
public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) {
Copy link
Contributor

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.

Log.d("HackFlutterEngine", "Content Commit Invoked");

// Ensure permission is granted
Copy link
Contributor

Choose a reason for hiding this comment

The 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) {
Copy link

Choose a reason for hiding this comment

The 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;
}
}
Expand All @@ -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);
Expand All @@ -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;
}

Expand Down