Page MenuHomePhabricator

Implement JNI interface to use C++ code to update thread unread status on Android
ClosedPublic

Authored by marcin on Jun 7 2022, 7:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 24, 9:47 PM
Unknown Object (File)
Sun, Nov 24, 9:47 PM
Unknown Object (File)
Sun, Nov 24, 9:44 PM
Unknown Object (File)
Sun, Nov 24, 9:44 PM
Unknown Object (File)
Sun, Nov 24, 9:44 PM
Unknown Object (File)
Sun, Nov 24, 9:44 PM
Unknown Object (File)
Sun, Nov 24, 9:43 PM
Unknown Object (File)
Sun, Nov 24, 9:43 PM

Details

Summary

Implement JNI files to expose C++ thread update functionality to CommNotificationsHandler.java

Test Plan

No testing plan. Child differential will use those files to update thread unread status in CommNotificationsHandler and will provide testing plan.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

marcin requested review of this revision.Jun 7 2022, 7:32 AM

Great work figuring this all out... the JNI stuff is not easyI

native/android/app/src/cpp/ThreadOperationsJNIHelper.cpp
13

I assume it's okay to call initialize multiple times? (Eg. initialize is idempotent)

native/android/app/src/cpp/ThreadOperationsJNIHelper.cpp
13

Yes! SQLiteQueryExecutor::initialize uses std::call_once so it is idempotent.

Rebase to master after CI change

tomek added inline comments.
native/android/app/src/cpp/ThreadOperationsJNIHelper.cpp
8–9 ↗(On Diff #13437)

Could you check if it is possible to use std::string as a parameter. According to https://github.com/facebookincubator/fbjni/blob/main/docs/quickref.md#methods-using-java-strings it seems like it might be possible.

10 ↗(On Diff #13437)

It's nice that we can use bool directly

This revision is now accepted and ready to land.Jun 8 2022, 7:09 AM

Use std::string in JNI files instead of facebook::jni::JString