Page MenuHomePhabricator

Use MessageOperationsUtilities on Android
ClosedPublic

Authored by marcin on May 18 2022, 3:35 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 12:24 PM
Unknown Object (File)
Sat, Nov 9, 11:54 PM
Unknown Object (File)
Sat, Nov 9, 9:18 PM
Unknown Object (File)
Sat, Nov 9, 8:28 PM
Unknown Object (File)
Sat, Nov 9, 8:27 PM
Unknown Object (File)
Sat, Nov 9, 8:24 PM
Unknown Object (File)
Sat, Nov 9, 8:00 PM
Unknown Object (File)
Sat, Nov 9, 7:49 PM

Details

Summary

This diff uses MessageOperationsFunctionality and JNI files from previous diff to store notification in CommNotificationsHandler on Android.

Test Plan

Log message content in C++ when sending notification. Do this for every message type. Additionally temporarily modify send.js prepareAndroidNotification code to send notification as if codeVersion < 31 and check that messages are still parsed correctly.

Comment out set_encryption_key method in SQLiteQueryExecutor (to disable encryption) code build app on an emulator, launch it and immediately kill. Then send a message from another client. Open device file explorer in Android studio and download comm.sqlite database. Examine its content in some sqlite explorer (vscode has a preety good one) to ensure that messages are there even though app was not launched after sending message.

Diff Detail

Repository
rCOMM Comm
Branch
marcin/eng-490
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested changes to this revision.May 18 2022, 9:58 AM
tomek added inline comments.
native/android/app/src/main/java/app/comm/android/CommNotificationsHandler.java
103–104 ↗(On Diff #12887)

We should inverse the order here. It's probably cheaper to first check if the notification has message infos than to access the file system. So check the file system only after we're sure we have something to save.

123–124 ↗(On Diff #12887)

That's probably fine - it may happen

This revision now requires changes to proceed.May 18 2022, 9:58 AM
tomek requested changes to this revision.May 20 2022, 1:47 AM
tomek added inline comments.
native/android/app/src/main/java/app/comm/android/CommNotificationsHandler.java
105–112 ↗(On Diff #12938)

We don't need this code at all. codeVersion indicates the client version of code. If we have a client with code version < 31, and that client would like to have the code you implemented, an update should be made which will increase the code version.

Older code versions should always be handled on server side and never on client side.

This revision now requires changes to proceed.May 20 2022, 1:47 AM

Remove unnecessary code that parses < 31 version notification structure.

tomek requested changes to this revision.May 20 2022, 8:23 AM
tomek added inline comments.
native/android/app/src/main/java/app/comm/android/CommNotificationsHandler.java
103 ↗(On Diff #12982)

This name is misleading as it is a File and we name it path. Maybe just sqliteFile would be ok?

106 ↗(On Diff #12982)

We still need to update the name, right?

107 ↗(On Diff #12982)

In Java we should avoid using toString for any logic - it is ok for debugging purposes but nothing more. It looks like File has getPath method - should we use that?

This revision now requires changes to proceed.May 20 2022, 8:23 AM

Use storeMessageInfos, refactor code to better Java style

This revision is now accepted and ready to land.May 23 2022, 10:18 AM
This revision was automatically updated to reflect the committed changes.