Tor writes to a temporary file and then renames it over the old
file, if any, so CLOSE_WRITE never occurs. The old code was
working in most cases because it received IGNORED when the old
file was unlinked and didn't check the event type.
* Move PluginConfig out of bramble-android. Projects using bramble now need to provide it.
* Add a PluginConfig#shouldPoll() method which can be used to disable polling altogether.
* Move Poller instantiation to the PluginManager.
This will be changed once we have a way to reset state for peers
that were contacts already at some point in the past.
One contact might have deleted the other, but not vice versa.
So they have mismatching state that needs to be reset.
See #2 for more information.
It is possible that a remote DECLINE message arrives short before the
user responds to the introduction.
This will cause a ProtocolStateException which (for now) is just caught
and a generic (existing) error message will be shown.
Previously, DECLINE messages let directly to the START state
for introducer and introducees.
So incoming ACCEPT and DECLINE messages needed to be ignored in START state
introducing undefined behavior into the protocol.
This is fixed with this commit by adding two additional states
to the introducer state machine as well as making use of the existing
LOCAL_DECLINED state for the introducees.
A fake ACTIVATE message would cause us to activate the transport keys
before the contact has received our auth message,
which would compromise forward secrecy.
When the user attempts an introduction, instead of the introduction
message input field, an explanatory text will be shown and the
introduction can not be made until the last one has been finished.
This ensures we bind to the wifi interface even if it doesn't have internet access and there's another interface with internet access (e.g. mobile data).
In practise, this is not noticeable in the UI.
Only when the database is congested, it should become visible and
prevent a crash when the sound setting is clicked.
This can help to prevent non-determinism introduced by the crunching
process.
More information:
e48f9f0773
With enabled and disabled crunching,
the size of the signed release APK was 17809681 bytes.
Related to #164
This is the same behavior as Signal.
We might want to adjust the delay later on.
This is also introduces a new BriarNotificationBuilder as a first step
to clean up the Notification Manager code.
The crash happens because the serialization of recently used emoji uses
';' to separate the emojis.
One of the ASCII emojis however has a ';' in the beginning.
When this one is used by the user,
it causes an empty string to be returned when deserializing.
This commit prevents the crash by changing the separator to a tab.
It uses a different settings string to store the emoji,
so users will lose the list of recently used emoji when they update to
this version.
PS. That wasn't my idea ;)
to have all the code related to that in one place,
so it is easier to maintain and to spot bugs.
This also checks that only blogs without an existing sharing session
are shared and initialized again.
It extends an existing test to catch the missing check.
This removes some debugging information from the previous commit
to not leak private information via the sharing sessions.
Fixes#979
* Add setting to show notification on the lockscreen
* Don't block notifications in the contact-/-group/-forum/-bloglist
Signed-off-by: goapunk <noobie@goapunks.net>
The last (empty) stage of this configuration used to
complain about not finding any tests. I replace the last
stage with a copy of the briar-android configuration
and removed briar-android from the list of prerequisites,
so all stages now contain tests.
* Set filterTouchesWhenObscured for all views
* Warn the user if Apps using the SYSTEM_ALERT_WINDOW permission are installed
* Warn the user if an App using the permission is installed while Briar is running
Signed-off-by: goapunk <noobie@goapunks.net>
These counters are already reset when the user clicks the notification
or vists the area of the app the notifications are for.
This also removes a potential intent hijacking vulnerability.
Store invitation outcome in metadata and make it available to the UI
This MR is based on !479 and should only be merged after that one has been merged as well.
It stores the invitation outcome in the message metadata and includes it in the `canBeOpened()` calculation for private groups and sharables.
Closes#877
See merge request !480
Migrate blog sharing to new sharing client infrastructure
This MR contains a second small commit that fixes#816 and adds a test for it.
Closes#476, #701
See merge request !479
Check the blog item in NavDrawer when opening a blog via notification
There are three scenarios where the selected item in the NavDrawer changes:
1. The user selects an item -> the item is checked automatically.
2. The user pressed back -> already handled in onBackPressed (needs to be extended with #606)
3. The user touched a notification -> handled by this commit.
Signed-off-by: goapunk <noobie@goapunks.net>
Closes#889
See merge request !481
Stop periodic list update only once
When testing the forum unread code, I noticed the recycler view is detaching twice. Once because the stop method is called and once because the view detaches from the window. Wouldn't it be safe to null the refresher when the updates are stopped?
See merge request !478
Remove code for collapsing threads and for reply count
Besides removing lots of code, this MR also improves the encapsulation between adapter and view holders.
Closes#478, #502, #526, #682, #683, #835, #836
See merge request !477
Threaded Unread Handling

This leaves in the collapsing code for now and just hides the UI element for collapsing. The code can be removed in a second pass to simplify the adapter.
Closes#879
See merge request !476
New Forum Sharing Client
This is very similar to how the private group invitations work and I am sure there's still some tiny bugs that I didn't catch.
All existing integration tests either pass or have been modified to pass.
Once this has been merged, the code should be usable for blog sharing as well.
Closes#475
See merge request !467
Fix memory leaks caused by periodic view refreshing tasks
This branch implements @goapunk's suggested solution to #851. Credit goes to @ernir for finding the bug and the initial solution, and @goapunk for the improved solution - I just did a quick implementation so we can get this fixed as quickly as possible.
Closes#851
See merge request !473
Make sure contact name is initialized when needed
This uses a Listenable Future and unfortunately requires 4 basically identical methods to handle the incoming events. Any suggestions for improving that are welcome.
Closes#710
See merge request !472
Add a handleDbException() method to BaseActivity
This adds a `handleDbException()` method to BaseActivity and a corresponding method for fragments that calls through to the activity.
For now, the method just finishes the activity
and NavDrawerActivity overrides it to do nothing,
and all the error places marked with TODO that finish the activity call the method instead.
That gives us zero functional improvement over the status quo,
but it allows us to change the default behaviour easily,
and then we can start thinking about which cases should have non-default behaviour.
First part of #469
See merge request !469
and a corresponding method for fragments that calls through to the activity.
For now, the method just finishes the activity
and NavDrawerActivity overrides it to do nothing,
and all the error places marked with TODO that finish the activity call the method instead.
That gives us zero functional improvement over the status quo,
but it allows us to change the default behaviour easily,
and then we can start thinking about which cases should have non-default behaviour.
Show open button in private conversation after accepting invitations
To keep the implementation simple, the Open button does appear where the Accept button had been previously.
In order to make the Open button functional, I had to make the `GroupId` of the invitation target available to the UI. Most code in this MR is due to that.

Closes#793
See merge request !457
Ignore QR code results until local QR code is created
* Make scanning only possible after we are "ready" (= our QrCode was created and set).
Signed-off-by: goapunk <noobie@goapunks.net>
Closes#814
See merge request !454
Update all logos
The launcher icons are now in mipmap folders which is the recommended practice, because on a low-res device, the high res drawables are stripped from the app. This is bad when the user decides to show the app icons really big on the launcher and the high-res drawables are not available anymore.
The old launcher icon seemed to have some sort of 3D effect.

Navigation Drawer Old:

Navigation Drawer New:

Closes#828
See merge request !459
Use different notification icons for different features


Closes#795
See merge request !460
Plugins throw exceptions for startup errors
Please review carefully as I don't know much about the code I have touched here.
Closes#285
See merge request !462
Move all unit tests to their modules and remove briar-tests
There are now tests in these modules:
* bramble-api
* bramble-core
* bramble-j2se
* briar-core
* briar-android
In order to run all -core tests together, the following AS run configuration can be used:

Closes#778
See merge request !456
Add sharing information to private group ActionBar subtitle

Closes#646
See merge request !455
Add creator and online information to group member list


Closes#813
See merge request !448
Add sharing info to ForumActivity action bar subtitle
This indirectly does also most of the work for adding the same information to private groups. However, completing this is blocked by !448.

Second part of #646
See merge request !451
Add blog sharing information to toolbar subtitle
This MR introduces a new `SharingController` which is supposed to be used in activities that show blogs, groups and forums. Feedback on this approach is welcome before this is used to add "Shared with" support to other parts of the UI.
The toolbar subtitle shows information about how many contacts the current shareable is shared with and how many of those are online.
So far this is implemented for blogs:

One part of #646
See merge request !447
Fix Sharing Status screens
* Remove distinction between "shared with" and "shared by"
* Show all contacts a blog is shared with
* Show online status of contacts in sharing screen

Closes#810
See merge request !445
Introduce Dialog Theme for Onboarding
Currently onboarding dialogs and confirmation dialogs look the same. This MR introduces a new dialog theme for onboarding dialogs that looks like the tap target onboarding, so that the user can immediately spot the purpose of the dialog.

See merge request !446
* Remove distinction between "shared with" and "shared by"
* Show all contacts a blog is shared with
* Show online status of contacts in sharing screen
Require a label for hashing
* Add a string label argument to `CryptoComponent#hash()`
* Convert `DoubleDigest` from implementing `MessageDigest`
to implementing `org.spongycastle.crypto.Digest`
(we need to keep `DoubleDigest` for `FortunaGenerator`)
* Convert all other uses of `MessageDigest` to `CryptoComponent#hash()`
* Remove `CryptoComponent#getMessageDigest()`, `MessageDigest` and `DigestWrapper`
Closes#548
See merge request !442
Ensure key agreement tasks finish if they ignore interrupts
The problem here was that `BluetoothSocket#connect()` was throwing an IOException when the task was interrupted - the task treated this like any other connection failure and retried, so the task never finished.
The fix is to check whether the timeout has expired before retrying, so the task eventually finishes even if it ignores the original interrupt.
Closes#283
See merge request !443
* Add a string label argument to CryptoComponent#hash()
* Convert DoubleDigest from implementing MessageDigest
to implementing org.spongycastle.crypto.Digest
(we need to keep DoubleDigest for FortunaGenerator)
* Convert all other uses of MessageDigest to CryptoComponent#hash()
* Remove CryptoComponent#getMessageDigest(), MessageDigest and DigestWrapper
Remove blog pagers
I set out to fix potential race conditions in the blog pagers (the screens you reach by tapping the body of a blog post, that allow you to swipe left and right through the posts in the combined feed or a single blog). The race conditions here are similar to those addressed by !356, but the adapters don't inherit from BriarAdapter so they need to be fixed separately.
While I was looking into this I found a few minor problems with the pagers:
* The feed pager wasn't responding to events - this was fixed in !398
* The feed pager finishes NavDrawerActivity when any blog is removed
* The feed isn't updated when a blog is added (this applies to the list view as well as the pager)
* Posts aren't removed from the feed pager when a blog is removed
The last problem is quite serious - the feed pager's adapter contains posts that are no longer in the DB, so they'll fail to load. To fix that problem, the adapter needs to be cleared in onStop() and repopulated in onStart(). This is the same approach we use for other adapters where items can be removed from the underlying dataset. Unfortunately, FragmentStatePagerAdapter has some odd behaviour when you clear and repopulate it:
1. When reselecting the previously selected item after clearing and repopulating the adapter, the item slides into view instead of just appearing, which makes it look like you've accidentally swiped.
2. Items are sometimes duplicated when clearing and repopulating the adapter, so swiping left or right shows another copy of the same post.
These problems only seem to happen if the adapter is cleared - adding new posts works fine on master, although I think there might be some luck involved - FragmentStatePagerAdapter doesn't seem to be designed to support items changing positions.
I spent a lot of time trying to resolve these problems before concluding that maybe it wasn't worth it, and we should just remove the pagers. That's what's currently implemented in this branch. Tapping the body of a post will show the full-length post, but you won't be able to swipe left or right.
The swiping functionality was nice to have, so if you have ideas for fixing the bugs I'd love to hear them. But I'd rather remove this functionality than keep it in a buggy state with no plan for how to fix it.
Closes#705
See merge request !400
Add integration tests for GroupInvitationManager
This MR is based on !433. It adds some integration tests for the private group invitation protocol. One of those tests fails at the moment.
It does not yet cover all corner cases, so it does not fully address #760, but addresses a part of it. Suggestions for more scenarios to test are welcome.
[Wording changed to prevent #760 from being closed automatically based on the description.]
See merge request !434
Refactor Integration Tests
This is quite a massive MR (currently 1763 additions and 3482 deletions). However, there's not so much happening. The only thing I did was moving redundant code from the various protocol integration tests to the `BriarIntegrationTest` class.
All integration tests are still passing.
Closes#727
See merge request !433
Fix Contacts Item always beeing selected if Back is pressed in the NavMenu
Signed-off-by: goapunk <noobie@goapunks.net>
Closes#782
See merge request !438
Bring back the toolbar shadow

Closes#477
See merge request !431
Make navigation drawer scrollable

Closes#666
See merge request !432
Use uuid created from the commitment/payload instead of the uuid returned from getUuid()
Signed-off-by: goapunk <noobie@goapunks.net>
Closes#774
See merge request !435
Make original author look like commenter when reblogged
This wasn't as simple as changing the persona in the XML,
because the same layout is used for a post whether reblogged or not.
So the persona needs to be changed programmatically for reblogged posts.
For this, the `AuthorView#setPersona()` method has been made public and
was changed to always set all views into the desired state to support
usage in a RecyclerView.

Closes#639
See merge request !426
This wasn't as simple as changing the persona in the XML,
because the same layout is used for a post whether reblogged or not.
So the persona needs to be changed programmatically for reblogged posts.
For this, the `AuthorView#setPersona()` method has been made public and
was changed to always set all views into the desired state to support
usage in a RecyclerView.
make TextInputView resizable again
* TextInputView can resize up to 3 lines again
Signed-off-by: goapunk <noobie@goapunks.net>
Closes#762
See merge request !425
Remove old signature class from API
I decided not to remove the SignatureImpl class, as it's not a trivial wrapper around the Bouncy Castle class, but I moved the interface into briar-core and made it package-private.
Closes#763
See merge request !424
Require a label for signing
This adds a sign() and a verify() method to the CryptoComponent
that take a mandatory label argument to ensure that signatures can't be
repurposed.
Closes#549
See merge request !419
Add visibility information to group member list

Closes#754
See merge request !418
use SHOW_IMPLICIT when showing the softkeyboard, otherwise it won't auto hide
* remove the forced hiding in ThreadListActivity as it should no longer be required
Signed-off-by: goapunk <noobie@goapunks.net>
Closes#761
See merge request !421
Activity module refactor
Broke the Activity module into numerous modules to be able to make numerous controller's package visible
Closes#752
See merge request !417
Do not track incoming positive introduction responses
Positive introduction responses are not shown in the UI (for introducees) and are therefore not marked as read. If they would be tracked, the unread message count would be higher than it actually is and would never decrease.
This is a minimal fix that could be better, but I didn't bother to refactor anything, because we need to rewrite the introduction client eventually anyway once more.
Closes#759
See merge request !416
Add third group visibility state
This branch adds a third group visibility state: each group is either invisible, visible, or shared with respect to each contact.
Invisible means that the contact doesn't see any sign that we subscribe to the group. Visible means that the contact can send us messages in the group, but we won't send the contact messages in the group. Shared means that the contact can send us messages in the group and we'll send the contact any shared messages in the group.
This is a preparatory step for #756. I'll put up another MR with the changes that close that ticket.
See merge request !410
Factor MessageTracker out of BdfIncomingMessageHook
The branch moves the MessageTracker implementation from BdfIncomingMessageHook to a separate class. This will allow the private group invitation client to track messages from classes other than the one that implements the delivery hook.
I've also fixed a couple of bugs, removed some redundant code from the validation manager, and added null-safety annotations (which is how I noticed the bugs).
See merge request !405
Add visibility and OPTIONS button to private group join notices


Closes#732
See merge request !408
Made private group timestamp greater than that of latest message
I did not change `getPreviousMsgId()` to `getPreviousMsgHeader()` because there doesn't seem to be a need for it anymore.
Closes#755
See merge request !409
Add onboarding dialog for revealing contacts screen
This MR is based on !406.

See merge request !407
Add UI for revealing contacts within a private group
This addresses one part of #732. Join notices and onboarding will follow in separate MRs.
Although this MR is technically not based on !402, it does require it to be merged first to compile.

See merge request !406
Mark relationship visible when syncing group with peer
This branch updates the private group invitation protocol to use @grote's new method for marking a contact relationship visible to the group.
I've changed the method slightly because the protocol state machine allows us to leave and re-enter the BOTH_JOINED state (see diagram on #659), so the relationship may already be visible when the method is called. In that case the visibility isn't updated, so we stick with whichever of revealed-by-us and revealed-by-contact happened first.
See merge request !402
Prepare UI for revealing contacts
This changes the visibility of some methods (that need to be accessed from another package), removes unnecessary abstractions and fixes erroneous static import of GroupId constant.
See merge request !404
Add new Exception handler
While working on #732 I again needed to use a `UiResultExceptionHandler` when I actually don't need to return a result. We have some other places in the code like this. So I introduced a `UiExceptionHandler` without the result part and used it where appropriate. While I was touching some classes, I also added the new annotations.
This MR includes another small commit that notifies only on local group messages. Joining a group is a message as well and without this change, you are notified about a new message when you yourself joined your newly created group.
See merge request !403
Add support for revealing contacts to the PrivateGroupManager
This also adds three integration tests and improves some small details here and there in the private group client.
Prerequisite for #732.
See merge request !396
Preserve the order of descriptors in QR code payloads
This fixes a regression caused by my recent changes to the Payload class.
Closes#748
See merge request !399
Don't crash if camera is reopened or surface is recreated
This branch fixes the crash is described in #720, which can be reproduced easily by scanning a QR code and failing to connect (for example, scan a screenshot of a QR code from a device that's no longer listening). When the camera view becomes visible again after trying to connect, its surfaceCreated() callback is called again with the same surface. An IllegalStateException added in !340 causes the crash.
Closes#720
See merge request !397
Make the feed pager respond to events, block notifications
This branch fixes a bug I found while working on #705: FeedPostPagerFragment doesn't start or stop the controller, so it doesn't load newly received posts or block notifications, unlike FeedFragment.
See merge request !398
Encode transport properties more compactly in QR codes
The [original BQP spec](https://code.briarproject.org/akwizgran/briar/wikis/BQP) described a compact encoding for transport properties, with the goal of making the QR code as small as possible. At some point during the implementation, I asked @str4d to use TransportIds and TransportProperties instead, as described in the [current spec](https://code.briarproject.org/akwizgran/briar-spec/blob/master/protocols/BQP.md). That was a mistake.
Using the original format reduces the payload from 60 to 34 bytes (43% smaller) for Bluetooth only, and from 96 to 49 bytes (49% smaller) for Bluetooth and LAN. This makes it easier to scan codes from low-resolution screens using fixed-focus and/or low-resolution cameras. Using this branch I can exchange codes between the Sony Xperia Tipo (320x480 screen, fixed focus, 640x480 preview size) and the Huawei Ascend Y300 (480x800 screen, infinity focus, 1280x720 preview size).
This also removes an obstacle to implementing #558, as TransportIds are no longer included in QR codes.
Closes#346.
See merge request !394
Private group invitation protocol
This branch implements the private group invitation protocol. The implementation is something of an experiment with a new way of writing client protocols.
We start with a role enum that lists the roles in the protocol, and a state enum for each role, which lists the states in the role's state machine. Then there's a session class, parameterised by the state class and therefore by the role, which represents the session information held by that role. Then there's an engine interface, parameterised by the session class and therefore by the role, which encapsulates the protocol logic for the role. Most of this stuff can be created pretty mechanically from the state machine diagrams.
The engine interface has a method for each type of message and each local action. I started out with one method for all messages and another for all local actions, but that turned out to be a bad design - the information about what kind of message was being handled was lost when the message was passed to the engine, and had to be recovered using an instanceof ladder.
Each engine method takes a message or an action and a session, and returns an updated session. A transaction is passed in so the engine can send messages, attach events, and do any other work it needs to do (such as changing the visibility of groups, in the case of this protocol). This removes the need to run tasks outside the engine, so the protocol logic is better encapsulated inside the engine.
Parsing and encoding of messages and sessions is separated from protocol logic. MessageParser, MessageEncoder and the validator are the only classes that know how messages and their metadata are formatted, and likewise SessionParser and SessionEncoder are the only classes that know how sessions are formatted. The metadata keys are declared in a package-private interface.
It's common knowledge that I never make mistakes, so to keep things interesting I've hidden 114 deliberate mistakes in this code. See how many you can spot!
Needs tests before #709 is closed.
See merge request !382
Mark private messages read properly
Depends on !386.
This branch uses the same approach as forums to mark messages read, i.e. each message is marked read when it becomes visible, rather than marking all messages read in a batch when the activity finishes. This fixes two problems: messages not being marked read when isFinishing() is false, for example when leaving the activity via the home button, and a race condition between updating and loading the group count when leaving the activity, resulting in a stale unread message count in the contact list.
Closes#196.
See merge request !388
Create GroupDissolvedEvent and react to it
This MR also makes the private group list react to incoming group invitations (once they are implemented).


Closes#736, #737
See merge request !392
Return to group after not inviting new members
This MR also closes the keyboard when returning from the message fragment.
Closes#735
See merge request !389
Fixed asynchronous Activity leaks in Fragments
If a Fragment has been detached its `getActivity()` method will return null, providing numerous crash possibilities within the app.
My approach to fixing this is to make Fragments use their own `runOnUiThreadUnlessDestroyed` method, which also checks if the Fragment has been detached before running the Runnable
Closes#714
See merge request !387
Use contact ID rather than messaging group ID to identify conversation
We originally used the private messaging group ID to identify the private conversation, but now that the conversation includes messages from multiple clients it's more appropriate to use the contact ID.
This refactoring isn't urgent - I've had the branch lying around for a while, but I'm putting it up for review because #734 will touch some of the same code.
See merge request !386
Add unit tests for KeyManagerImpl
This also creates a `TransportKeyManager` interface and a factory for that to be able to test things separately.
Closes#205
See merge request !380
Let only the creator invite new members to private groups
A little bug I noticed when reviewing the implementation of the invitation protocol.
See merge request !383
Improve QR code workflow slightly
* Improve wording so contacts know they need meet up to scan
and scan each other's codes
* Use consistent progress bar styles
Closes#348
See merge request !381
Implement UX for viewing the membership of a private group
This MR is the second and last MR to address #678. The first part is in !377.

Closes#678
See merge request !364
Implement UX for leaving a group
This MR also includes the creator's part of the UX for dissolving a group since it is almost the same.

Closes#671
See merge request !367
Remove forum content type and change bodies to string
Also removes support for anonymous forum posts.
This MR depends on !360.
Closes#698, #681
See merge request !370
Refactor contact lists, their adapters and items
This was supposed to be a preparation for #678 to make the contacts lists cleaner and easier to re-use for different use-cases. Turns out #678 can't use this work, but it is probably nice to have anyway.
During this work, support for multiple identities has been removed from the various contact lists.
See merge request !363
Implement UX for showing and answering private group invitations
As usual, this MR contains several logically separate commits that could be split out into smaller MRs if desired. It consists of two main parts:
* Showing open invitations in the list of private groups with a snackbar
* Showing invitations and responses in the private conversation
For both parts, the existing code was refactored to allow for a smooth implementation and to leave maintainable code behind.



Closes#707
See merge request !357
ProtocolStateException for client protocols
Methods that implement local actions in a client protocol (for example, accepting an invitation) can throw this exception to indicate that the action wasn't taken because the action isn't applicable to the current state. This can happen if the protocol state machine is updated by an incoming message and the user takes an action before the UI has been updated.
See merge request !368
Disable EmojiTextView software layer rendering when cache is too small
This needs to be tested if it works as intended on several devices.
See merge request !362
Limit scene transition animations to API 23 and above
to work-around [android bug #224270](https://code.google.com/p/android/issues/detail?id=224270).
This is only necessary if the transitioning view might not be available anymore when the exit transition is made.
Closes#686
See merge request !361
Implement UX for creating a private group
This MR allows the user to create a new private group and select contacts to be invited into the group.
There are currently 6 commits starting with some small refactoring for code reuse and making more functionality available in the backend. Each commit could be split up into a dedicated MR if desired.

Closes#661
See merge request !353
Fix race conditions when updating UI from events (again)
This is my second attempt at fixing race conditions caused by updating the UI from events while background tasks are loading data from the DB. Unlike my first attempt, this one is pretty simple and doesn't require too much reasoning about possible races.
The first commit fixes a few list loading bugs I found while working on this problem, and moves the lifecycle callbacks from resume/pause to start/stop, closing #609. The second commit contains the fix for #705, which works as follows:
* Each BriarAdapter has a revision counter
* Before making a change to the adapter that could be overwritten by a background task, increment the revision
* Before starting a background task that could overwrite other changes, get the current revision
* Before applying changes from a background task that could overwrite other changes, check whether the revision has changed
* If the revision has changed, restart the background task
* Otherwise apply the changes
Closes#609. #705 remains open because the PagerAdapters for blogs need to be updated.
See merge request !356
Private Group Threaded Conversation
This MR refactors the forum activity, its controller, its adapter and view holder so *most* of the code can be re-used for private groups by making heavy use of generics.
The refactoring has 1383 additions and 1087 deletions, so just grows the code-base slightly and adding the private group conversation just takes an additional 400 lines.
The MR also includes one commit that moves post/message creation more into clients, so the UI doesn't need to keep track of timestamps. This commit can of course be split out into a separate MR if desired.
Closes#662, #663
See merge request !350
This way the forum and private group client do not need to keep track of
message timestamps themselves and do not need to interact with
post/message factories.
Use constructor injection for controllers
Also made some listeners volatile.
This is part of #704 - if I don't find any other classes that need constructor injection I'll close the ticket.
See merge request !351
Null safety annotations
The @NotNullByDefault annotation marks all fields, methods and parameters in a class or package @NotNull, so Android Studio will warn if values that may be null are used. Please use this annotation for new classes, and specify @Nullable for any fields, methods and parameters that may be null.
Injected fields are initialised to null, so injected classes should use @MethodsNotNullByDefault and @ParametersNotNullByDefault, or specify @Nullable for injected fields.
See merge request !349
Private Group List UI
This MR implements the UI for the list of private groups.
It reacts to three types of events to refresh the displayed data:
* new group message received
* private group added
* private group removed
Missing from final implementation:
* entering groups
* adding new groups
* reacting to a future group dissolved event
* actually removing a dissolved group



Closes#660
See merge request !335
Always show the keyboard when asked for it
The main fix is maintaining the internal keyboard state when the entire view gets hidden, because `onMeasure()` isn't called anymore in that case and can't update it itself.
Closes#676
See merge request !348
Always check whether the context has been destroyed
#551 has the same root cause as #610, which is that when a background operation completes, we need to check whether the activity or fragment that started the operation has been destroyed before doing anything with the UI.
DestroyableActivity has been renamed to DestroyableContext because it's now implemented by some fragments as well. Various existing listener interfaces now extend DestroyableContext.
I also modified the ActivityLifecycleController interface so the activity is passed into the onActivityCreate() method rather than being injected - @ernir please check I haven't broken anything!
Closes#551
See merge request !341
Fix NPE when stopping KeyAgreementTask, improve thread safety
This branch fixes#696 and improves the thread safety of the camera code, mostly by adding @UiThread annotations and occasionally by moving stuff onto the UI thread that might have happened on other threads before.
Closes#696
See merge request !345
Use new group metadata for showing lists
What was supposed to be a minimal change turned into a rather large MR. I did my best to keep things in separate commits, so I can still split this into smaller MRs if desired.
While making use of the new group metadata in the contact and forum list, I noticed some other things in need of improvement to get rid of needing to load all messages:
* Refactor `SharingManager` so its events provide message headers that can be used to update list items
* Add `GroupId` to conversation items, so the metadata of the respective group can be updated as well when marking the items read
* Create a very basic `ConversationManager` so the GroupCount for the various clients can be queried in one go without needing to know all their groups per contact
* Fix a nasty bug that caused forum and blog invitation to not update their read state
* Fix some bugs related to displaying the forum list with proper unread count
Some casual measurements with just a few contacts and messages showed a reduction of the contact list load time by one third.
See merge request !343
Refactor existing adapters into a generic superclass
This MR also moves various blog classes into their own packages and makes the required visibility changes.
Closes#687
See merge request !346
Fix IntroductionManager unit tests
I forgot to run the unit tests after changing the `GroupCount` serialization in response to a review comment. This MR fixes the tests.
See merge request !344
Store message count, unread count and timestamp of latest message in group metadata
This is to eventually address #373 and slowness of other lists. The group metadata is not yet used, but if this MR isn't merged fast, another commit that actually uses it and thus takes care of the slowness will be added.
Closes#584, #585, #586
See merge request !336
Clean up identicon code, remove unused classes
I noticed some debug-level logging coming from the identicon code, went in there to remove it, and realised half the code was unused, so I removed that too.
No functional changes except that the logging is gone and the opacity is now OPAQUE rather than UNKNOWN, which wasn't valid in this context.
See merge request !339
Emoji Support for all user input
All text that can be generated by users will show emoji from the shipped sprites by using the `EmojiTextView` instead of the normal `TextView`.
For all messages and posts, the custom emoji keyboard is now available as well. For this, a new `LargeTextInputView` has been introduced that is a sub-class of `TextInputView`. In order for the emoticon keyboard to work properly the existing views had to be modified heavily, sometimes resulting in new behavior such as scroll views now being above the fixed input field. Actual testing on a device (preferably with a tiny screen) is recommended to make sure this still works as expected. Screenshots will be included at the end of this post.
This MR also disables menu actions rather than hiding them and it includes a fix for a regression that was not showing the keyboard automatically in forums.





Closes#92
See merge request !329
Fix regression in IntroduceeManager
This was happening when the remote response arrives before the local
response is made and thus the local response needs to be send with the
ACK following. The problem was that we ACK was sent before the response
which is not allowed and resulted in the session being aborted by the
introducee. This was happening, because recursion is hard ;)
The fix is only restarting another protocol engine to send the ACK
after the first run has been completed.
An integration test was added to prevent such regression in the future
and to test this code path.
Closes#695
See merge request !338
This was happening when the remote response arrives before the local
response is made and thus the local response needs to be send with the
ACK following. The problem was that we ACK was sent before the response
which is not allowed and resulted in the session being aborted by the
introducee. This was happening, because recursion is hard ;)
The fix is only restarting another protocol engine to send the ACK
after the first run has been completed.
An integration test was added to prevent such regression in the future
and to test this code path.
All text that can be generated by users will show emoji from the
shipped sprites.
For all messages and posts, the custom emoji keyboard is now available.
This also disables menu actions rather than hiding them and thus
closes#677
Included is a fix for a regression that was not showing the keyboard
automatically in forums and thus
closes#676
Create PrivateGroupManager Facade and stub implementation
Some classes were renamed and new base classes introduced in the process. I suggest to expand the "Changed files" before reviewing to get an overview over the changes.
Closes#673
See merge request !332
Fix integration tests
First problem was a race condition with message delivery and the second
one due to the fact that we no longer plan to allow adding of additional
blogs, so the test for that has simply been removed.
See merge request !333
First problem was a race condition with message delivery and the second
one due to the fact that we no longer plan to allow adding of additional
blogs, so the test for that has simply been removed.
Forum controller thread safety and tree safety
This branch solves the concurrent forum issues by code restructure and refactoring.
Closes#556Closes#552
See merge request !262
When a message is shared, share its transitive dependencies
Like other recursive operations on the dependency graph, this is
not done in a single transaction to prevent an attacker from creating
arbitrary large transactions.
So at startup, the `ValidationManager` finds and resumes any
unfinished operations, by looking for unshared messages with shared
dependents.
Closes#589
See merge request !325
Like other recursive operations on the dependency graph, this is
not done in a single transaction to prevent an attacker from creating
arbitrary large transactions.
So at startup, the `ValidationManager` finds and resumes any
unfinished operations, by looking for shared messages with unshared
dependencies.
Try harder to find suitable camera parameters
This branch fixes QR code scanning on the Galaxy Nexus running Cyanogen Mod 12.1 (Android 5.1.1), without breaking QR code scanning on any of the other test devices.
The problem on the Galaxy Nexus was that the selected scene mode was overriding the selected focus mode, so we asked for continuous picture mode but got macro mode. Macro mode requires startAutoFocus() to be called, but we weren't calling it because we'd asked for continuous picture mode.
The fix for that problem is to query the focus mode after applying the parameters and call startAutoFocus() based on the actual mode rather than the requested mode.
But then I discovered another problem: barcode scene mode was setting the flash to auto, so in low light the flash was turning on and off while trying to scan QR codes. That might work well for printed QR codes, but it's terrible when scanning from a screen.
The fix for the new problem is to select barcode scene mode, then try to disable the flash, and if that fails, reset the scene mode. Then we pick the best available video stabilisation, focus mode and preview size.
On the Galaxy Nexus with CM 12.1, that means we use continuous picture mode instead of barcode scene mode, which works fine. All the other test devices pick the same settings as before.
See merge request !321
Check whether File#listFiles() returns null
The docs say this can happen if there's an I/O error. Also fixed a throw-in-finally-block warning and renamed an IoUtils method to make its contract clearer.
See merge request !328
Remove base32 TODOs, fix a potential NPE
I thought we'd be able to get higher data density in QR codes by using base32 instead of base64, allowing the QR code to use alphanumeric mode instead of byte mode. But I tried it, and although the QR code does use alphanumeric mode, it comes out at exactly the same size (see the 346-use-base32-for-qr-codes branch). So this MR removes the TODOs and fixes a potential NPE I spotted while working on the other branch.
See merge request !327
Recreate cache directory after deleting app data
This fixes a warning on the Moto G:
```
E/libEGL: error creating cache file /data/data/org.briarproject/cache/com.android.opengl.shaders_cache: No such file or directory (2)
```
@grote might possibly be related to hardware rendering issues.
See merge request !326
Add first onboarding screen
When the user enters a private conversation after adding her second
contact, an onboarding screen will be shown highlighting the possibility
of introducing the contacts to each other.

Closes#357
See merge request !324
When the user enters a private conversation after adding her second
contact, an onboarding screen will be shown highlighting the possibility
of introducing the contacts to each other.
Emoji
This MR introduces a custom Emoji implementation to Briar for devices that do not support Emoji sufficiently. It is heavily based on Signal's implementation. Hence, the license for the Android part has been changed to GPLv3.
So far, emoji input is only supported for forums and private conversations that both rely on the same `TextInputView`.

See merge request !317
Include stream number in stream header nonce
See the corresponding change in the BTP spec for an explanation:
388e1d23c0Closes#329
See merge request !320
Fix potential NPE in AndroidExecutorImpl
Always wait for the startup latch to ensure the background thread's Handler is initialised before using it.
Closes#665.
See merge request !319
Clean HTML from RSS feeds with Jsoup and Show Link Warning
This adds HTML cleaning with the Jsoup library based on a whitelist. The resulting HTML is then used to create a `Spannable` in Android. This spannable is traversed and URLs are replaced by a custom dialog fragment that shows the following warning.

Closes#569
See merge request !311
Refactor ValidationManager and fix some bugs
The validation manager uses a pattern of throwing an exception from within a transaction, then trying to ensure that the transaction gets committed anyway by setting it complete in a finally block. This is a bad idea - if the intentional exception isn't thrown but a later method throws an unintentional exception, the changes up to that point will be committed instead of rolled back.
I reworked the control flow to remove this pattern, and in the process realised that the validation manager was doing a lot of work to provide objects to attach to MessageStateChangedEvents, which are only used by tests these days. So I fixed that and a couple of other issues.
The VALID state is no longer needed and has been removed.
Closes#619
See merge request !313
Resolve Outstanding Blog Issues
This MR has several commits which fix individual small issues. The biggest commit is a refactoring of the `BlogActivity`, so its `ViewPager` can be used also for the Blog feed.
Closes#637
See merge request !309
Show Blog Posts always in the same design
This also adds comments to the blog post detail screen that were previously missing.
It re-uses the existing `BlogPostViewHolder` and its `bind()` methods effectively reducing the amount of code necessary.
Closes#636
See merge request !307
Add one introduction test for modified response message
This is only the first part of #627, but I am putting it up for review already, since the second part will be very similar and issues found here will likely apply to both.
See merge request !306
Fetch RSS feeds via Tor
This patch replaces jsocks with our own minimal SOCKS 5 implementation, which is compatible with Android's OpenSSL hacks (see discussion on #599 for the horrifying details). This allows us to use OkHttp over Tor to fetch RSS feeds.
It turns out that SOCKS 5 without authentication is a really simple protocol: https://tools.ietf.org/html/rfc1928Closes#599.
See merge request !308
UI for reblogging and blog comments
This MR wraps all blog posts inside a `CardView` and adds a reblog button to blog posts. When this button is pressed, a new activity opens that shows the blog post again and allows the user to reblog it into their own blog. An optional comment can be added.
Also a new compound view `AuthorView` is introduced to display authors and their trust level in a consistent way.
The `BlogController` has been refactored, so the `FeedController` can share most code through an abstract base class.

Closes#496, #437
See merge request !300
Scroll down Adding Contact screen
Normally, you would introduce a new layout only for small screens, but in this case it is easier and has less maintenance overhead to just scroll down the screen, so the button is always visible after loading.
While I was at it, I also replaced `getLocalAuthors()` by the new `getLocalAuthor()`.
Closes#616
See merge request !294
Factor out Tor Socks Port
This MR factors out the local Tor port, so other clients can listen to an `TransportEnabledEvent` for Tor and start tasks as soon as Tor becomes available. This would also enable client to pass traffic through Tor's local SOCKS proxy.
See merge request !301
Attach optional messages to invitations in Conversation view

Closes#359
See merge request !299
Add support for comments and reblogging to Blog Client
Comments and reblogs need to depend on the post they refer to.
Since message dependencies are limited to one group,
the post and also the comments need to be wrapped
when commented on or reblogged to another blog (and group).
For this reason, in addition to comments, two new wrapping message types
are introduced. They retain all data of the original messages and allow
for reconstruction and signature verification.
This MR breaks backwards compatibility with old blog posts.
It removes the content type, title and parent ID from the post.
Furthermore, it includes one commit that replaces the `Message` in `MessageSharedEvent` with a `MessageId`.
Closes#494
See merge request !285
Sign Introduction Information to be able to discover MITM attack
The local introducee doesn't know whether each piece of information received from the introducer originates from the remote introducee or has been replaced by the introducer, i.e. whether the introducer is carrying out a man-in-the-middle attack.
The introduction protocol doesn't aim to detect or prevent man-in-the-middle attacks. We only aim to establish that if the remote identity public key is not replaced then the remote ephemeral public key, transport properties and timestamp are not replaced either. This MR adds a MAC and a signature to the introduction protocol's ACK message to fulfill that aim. See #364 for the detailed security argument.
Later, when the local introducee verifies that the remote identity public key belongs to a particular person (#513), she can also be sure that the remote ephemeral public key, transport properties and timestamp originated from that person.
Closes#364
See merge request !297
Before the introducee sends her ACK,
she derives a master key from the ephemeral shared secret as before.
Two nonces and a MAC key are then derived from the master key.
The local introducee signs one of the nonces and calculates a MAC
over her own identity public key, ephemeral public key,
transport properties and timestamp.
The local introducee includes the signature and MAC in her ACK.
On receiving the remote introducee's ACK,
the local introducee verifies the signature and MAC.
Should the verification fail, an ABORT is sent to the introducer and
the remote introducee that was added as inactive is deleted again.
Comments and reblogs need to depend on the post they refer to.
Since message dependencies are limited to one group,
the post and also the comments need to be wrapped
when commented on or reblogged to another blog.
For this reason, in addition to comments, two new wrapping message types
are introduced. They retain all data of the original messages and allow
for reconstruction and signature verification.
This commit breaks backwards compatibility with old blog posts.
It removes the content type, title and parent ID from the post
message structure.
Use Briar's IoUtils.copy(), not H2's IOUtils.copy()
Our implementation closes both streams, H2's implementation leaves them open.
Closes#614.
See merge request !293
Blog controller thread safety
This patch removes the mutable list of posts from the blog controller to make it thread-safe, and adds a cache of message bodies to speed up reloads.
Closes#555.
See merge request !276
Remove sensitive information from crash and feedback reports
This depends on MR !290 and removes also the crash report settings.
Closes#311
See merge request !291
Scrub addresses before logging them
MAC, IP and onion addresses are now scrubbed before logging to ensure we don't leave any sensitive information in plaintext on the device or send it in crash reports or feedback.
* Bluetooth MAC addresses keep the first and last octets
* IPv4 addresses keep the first and last octets
* IPv6 addresses should be scrubbed completely (couldn't test)
* Onion addresses keep the first three characters
If an address is invalid it will not be scrubbed to enable debugging, because it is most likely not sensitive.
Closes#592
See merge request !290
Add feed title to imported entries
Also fixes one bug where a new feed was not saved and improved HTML stripping a bit.
Closes#483
See merge request !287
Server-side code for accepting crash reports and feedback
* Moved some shared code for copying InputStreams to OutputStreams into a utility class
* Modified the dev report sender to send one report per connection
* Easier to handle on the server side
* If the connection fails after sending any reports, they don't need to be resent
* Tor will reuse the circuit, so it's cheap
* Added server-side code for accepting dev reports
* We need to protect the server's resources from DoS attacks
* Reports can't be larger than 1 MB
* Connections are limited to an average rate of one per minute
* The rate limiter uses a token bucket to allow bursts of up to 1,000 connections
* If the rate limit is exceeded, connection attempts will fail - clients will retry next time they sign in
* The limits can be raised when we move to a bigger server (and when we have some users)
See merge request !288
Fix two crashes when scanning QR codes
One crash was two due the `Context` being `null` and the other due to the camera being opened within an `AsyncTask`.
Closes#583
See merge request !282
Let clients decide whether to share messages or not
Before this MR, the `ValidationManager` was sharing all messages after they had been delivered. Now, it is within the client's responsibility whether to share messages or not. So far, only the Blog and the Forum client are sharing incoming messages.
Closes#595
See merge request !283
Group strings and remove unused resources
Before I grouped the strings, I removed unused resources as well to not group things that are not being used anymore.
The grouping tries to follow a normal usage lifecycle of the app where the user works their way down the navigation drawer and explores all features in one area.
Closes#342
See merge request !277
Update Tor assets if they're older than the APK
Extract the Tor binary, GeoIP database and config file from the APK if they haven't been extracted since the APK was last updated.
On the Galaxy Nexus, skipping extraction of the binary if it's already up to date shaves about 1.5 seconds off the Tor plugin's startup time.
Closes#582.
Depends on !272.
See merge request !273
Care for lint errors
No more general disabling of abortOnError
Resolved all *errors* beside language ones MissingTranslation & ImpliedQuantity
Issue context: #567
See merge request !274
Don't connect to Tor if it's already running
For some time now we've had a reliable way of shutting down the Tor process (the __OwningControllerProcess command line argument combined with the TAKEOWNERSHIP command), but TorPlugin#start() still assumes that Tor may already be running. This allows another app to bind the Tor control and SOCKS ports and collect confidential data from Briar (#578). It also allows two Briar instances running on the same device to try to communicate with the same Tor process, which prevents proper shutdown (#572).
This patch prevents the Tor plugin from starting unless it's able to start its own Tor process with the expected control and SOCKS ports. If two Briar instances are running on the same device, only one of them will be able to use Tor. The other should fail to start its Tor plugin and then function normally without Tor access, including normal shutdown.
Fixes#572, #578. Open another ticket if you want two Briar instances on the same device to have their own Tor processes. :-)
See merge request !272
Allow unsubscribing from shared blogs
Only personal blogs from non-contacts can be removed.
This also adds integration tests that check the conditions under which blogs can actually be removed.
Closes#579
See merge request !268
Show Explanatory Graphic Before Scanning QR Codes


Closes#429
See merge request !270
Fix crashes when no Bluetooth or no Camera is available
Briar crashed when run in a device without bluetooth or without camera
such as an emulator.
Closes#514
See merge request !269
Prevent empty state messages from showing briefly
When we clear a list in `onPause()`, the proper behavior is that the empty state
message is shown, because the list is indeed empty.
However, we will reload the list content again in `onResume()`,
so the fix chosen in this MR is to force showing the progress bar
right after clearing the list.
Closes#576
See merge request !267
When we clear a list in onPause(), the proper behavior is that the empty state
message is shown, because the list is indeed empty.
However, we will reload the list content again in onResume(),
so the fix chosen in this commit is to force showing the progress bar
right after clearing the list.
Closes#576
UI for sharing blogs
Not posting any screenshots, because the UI is the same as for forums.
This does not yet offer the possibility to unsubscribe from blogs again. Should be done in a different MR as this one is big enough already.
Closes#498, #497
See merge request !263
This commit refactors the code for sharing forums,
so it can be used for sharing blogs as well.
It does not yet include code for responding to blog invitations.
Simple UI for Managing and Importing RSS Feeds
Please note that this does not yet include the reblogging style for displaying imported RSS entries.



Closes#517
See merge request !251
Keep track of which RSS entries have been seen
This is done by remembering the time of the latest entry.
All entries newer than that are considered new and will be posted.
Closes#485
See merge request !249
Implement background task for fetching RSS feeds
* Implemented in briar-core as a `ScheduledExecutorService`
that gets started when the app starts
* The briar-api has a `FeedManager` interface
that the UI can use to register and unregister feeds
* In this first iteration, feeds are fetched via HTTP(S), not Tor
Closes#484
See merge request !247
* Implemented in briar-core as a `ScheduledExecutorService`
that gets started when the app starts
* The briar-api has a `FeedManager` interface
that the UI can use to register and unregister feeds
* In this first iteration, feeds are fetched via HTTP(S), not Tor
Closes#484
UX improvements for crash reports and feedback
(The background color of the first screenshot is white, but I now changed it to use the same background color like everywhere)

Closes#335
See merge request !246
The old behaviour was a leftover from the days of limited retention periods. The new behaviour will interact better with dependencies and message queues.
Pause Periodic List Refresh when View is not Visible
This MR also sneaks in a second commit which stops the cevron in the forum list to sometimes lose its blue color. I noticed this when testing this MR with short refresh intervals. This is not as nice of specifying the color as a tint, but unfortunately tints are not yet ready for primetime on Android.
Closes#553
See merge request !259
Show notifications for new blog posts
This also adds a setting allowing people to turn blog post notifications off.
As instructed, this does not yet improve upon the current notification mechanism, but rather follows it, leaving the improvements for #289.
Closes#488
See merge request !258
Show Personal Blog When Clicking On Post in Combined Blog Feed
This is your own personal blog when clicking on your own posts. Note how you can also write posts from that screen and no trust indicator is shown for the posts:

This is somebody else's blog on a dedicated screen after clicking on a blog post:

Closes#415
See merge request !256
Use Client Layer Events in ContactListFragment
This prevents trying to access the same group metadata in different groups.
Also, the conversation does not need to be reloaded once introduction messages arrive.
Closes#535
See merge request !254
Remove PersistentData classes as they aren't thread-safe
This MR depends on !244 and does not claim to resolve *all* issues with the ForumActivity.
Closes#544
See merge request !253
Introduce client layer events for forums
The forum UI depended on sync layer events such as `MessageStateChangedEvent`.
Now, the forum client broadcasts its own high-level event (`ForumPostReceivedEvent`)
with the information the UI needs (`ForumPostHeader`).
Closes#310
See merge request !244
Database queries for metadata only returned it for messages that were delivered already.
However, there are cases (e.g. a pending message needs to be delivered) where
the validator needs to retrieve the metadata from the database.
For these cases, a special database query has been introduced.
The forum UI depended on sync layer events such as MessageStateChangedEvent.
Now, the forum client broadcasts its own high-level event (`ForumPostReceivedEvent`)
with the information the UI needs (`ForumPostHeader`).
Closes#310
This prevents trying to access the same group metadata in different groups.
Also, the conversation does not need to be reloaded once introduction messages arrive.
Closes#535
Micro Blogs UI
**Attention:** This MR includes several other commits which are supposed to end up in separate MRs. I suggest that you review **per commit**. Once the first two commits have green light, I can split out the other commits into other MRs. This way I don't have to work myself through a long rebase chain every time I make a change to the bottom MR.
This MR is full of commits that introduce features that we will not be using initially. The last commit implements the Micro Blogs UI on top of the framework the first commits establish and hides/disables all future features for now.
I suggest we merge this as is and clean things up later when we have a clearer idea what features we will be doing eventually.





Closes#436
See merge request !214
Make it clearer who will be introduced
Show contact names under avatars before sending introduction to make it clearer who will be introduced.

Closes#356
See merge request !242
Show all Forum Invitations, not only the first one to prevent cut-offs and forks
This MR solves the problems outlined in #461 by always showing forum invitations, even if the user already subscribed to the forum.
Available Forums have been renamed to Forum Invitations in the UI:


Closes#461
See merge request !241
Set focus mode properly when scanning QR codes
This simple fix contributed by @m8r-v9bo74 fixed the issue on my Xperia
Pro that could never focus on the QR code before. Focusing and scanning
still works on my other test devices.
Closes#346
See merge request !243
Improve Account Setup Screen
* Explain what "account creation" means on first run (#151)
* Use hints instead of dedicated text views
* Move password strength meter up into the user's view
* Always move user's view to current input field
* Improve "Forgot Password" dialog






Please note that the dialog button colors will be changed in !214 to the official design. Here they have the old colors.
Closes#151, #207
See merge request !229
This simple fix contributed by @m8r-v9bo74 fixed the issue on my Xperia
Pro that could never focus on the QR code before. Focusing and scanning
still works on my other test devices.
Closes#346
* Explain what "account creation" means on first run
* Use hints instead of dedicated text views
* Move password strength meter up into the user's view
* Always move user's view to current input field
* Improve "Forgot Password" dialog
Closes#151
Simple Empty State Messages
This MR implements very basic and simple empty state messages for the
current features.
This is how it looks (note that the contact add FAB will be removed soon):




Closes#327
See merge request !236
Update Timestamps Every Minute
Yes by using `notifyDataSetChanged()` I am invalidating everything, but view binding is very fast and the RecyclerView is smart about it. I could parse the dataset and use `notifyItemChanged()` only on the elements that matter, but this is not generic and a lot more code which is not necessarily faster. I suggest we go with my simple and generic approach for now and optimize when we actually notice a performance problem.
Closes#455
See merge request !238
This commit addes a combined blog feed that shows all posts of all
subscribed blogs in the order the blog posts have been received.
For now, this commit also hides other blog functionality like adding
additional blogs and browsing individual blogs.
Closes#417
This allows for swiping left/right to read other posts by using
a ViewPager.
This hasn't been done as a separate activity, but with
fragments, so both can share the `BlogPersistentData` without
needing to reload it.
Closes#428
This does not yet support multiple identities. It just shows blogs
created by the first identity, but can easily be adapted for
multi-identity support.
Closes#410
Clicking the plus in the toolbar open the `CreateBlogActivity` which
allows the user to create a new blog. Only the first identity is
considered, but support for more identities can be easily added later.
The actual list of blogs in the My Blogs tab will be done in the next
commit.
Font Colors and Separate Themes
Once applied this commit will change the font colors according to the
design and move all themes into a dedicated file.
Closes#333
See merge request !228
Make timestamps prettier and more useful
Here's some example timestamps I have been testing with. That's how it will look like when this MR is merged:

Closes#230
See merge request !235
Deduplicate contact exchange protocol
`ContactExchangeTask` was originally extracted from the Bluetooth invitation task; this completes the refactoring.
Closes#365.
See merge request !199
Make use of Existing Translations
Adds first translations to source code and sets up transifex config
file. Pull more translations later with:
```bash
cd briar-android
tx pull --mode=developer
```
Closes#448

See merge request !226
Adds first translations to source code and sets up transifex config
file. Pull more translations later with:
cd briar-android
tx pull --mode=developer
Closes#448
Separate Date and Author Name in Forum Posts
This also fixes the issue there the trust indicator was shown at the top on some devices.

Closes#442
See merge request !227
Fix IdentityManager hooks
This commit makes sure that there is only one identity manager that is
initialized early enough so hooks can be added properly.
Closes#446
See merge request !225
Backend for Automatic Micro Blogs
This MR introduces automatic personal blogs to the Blog client. When a contact is added, her personal blog will also be added automatically. Also, when a new identity is added, a personal blog for that identity is created.
The first commit changes the blog paradigm to short-form blogs and introduces other things that will be useful later in the UI (!214) such as a BlogPostAdded event and the possibility to delete/remove blogs (not the personal ones).
This MR is based on !224 to prevent crashes that are fixed by it. So please review and merge !224 first.
See merge request !223
When a contact is added, her personal blog will also be added automatically.
Also, when a new identity is added, a personal blog for that identity is created.
Part of #436
Removes teaser and makes body mandatory.
It also adds support for deleting blogs and
introduces a getAuthorStatus() method to the IdentityManager
that takes a running transaction.
Forum improvements
Forum Activity improvements:
* Orientation changes now restore the activity properly, e.g. input text and state is retained
* Snack bar is now, when appropriate, clickable
* The bottom divider is no longer visible for the bottom entry
* Code refactoring for improved simplicity and less redundancy
* Timestamp check to ensure that new posts are not older than the latest post
Closes#426Closes#423Closes#424
See merge request !218
Fixing fragment instance restore
Alas, it turns out that my neat way of integrating the Fragments into the dependency graph was not without problems. Me and @grote discovered that this presented us with a lot of problems on orientation changes as the Activity is re-created, and therefore parts of the dependency graph. The simplest solution was simply to abandon the idea, i.e. with this branch Fragments are no longer part of the dependency graph.
See merge request !215
Blog Client with Factories and Validator
This implements a simple initial blog client that covers the basic blog actions, but no deletion/removal of blogs, yet.
Classes for Blogs and Blog Post Headers have been introduced along with the associated factories.
A `BlogPostValidator` has been added that validates incoming blog posts.
Closes#402Closes#404
See merge request !212
New Trust Level Indicator Replaces The Stars
This implements a generic `TrustIndicatorView` with a `setTrustLevel()`
method which updates the drawable according to the `Author.State`.
It also removes unused files from the repo.
This is based on !212 and should only be merged after it.
Closes#78
See merge request !217
This implements a simple initial blog client that covers the basic blog
actions, but no deletion/removal of blogs, yet.
Classes for Blogs and Blog Post Headers have been introduced along with
the associated factories.
A `BlogPostValidator` has been added that validates incoming blog posts.
Closes#402Closes#404
Fix NPE in ForumSharingStatusActivity by only accessing group in contact list
Only access group in contact list where it is guaranteed to exist.
Closes#430
See merge request !211
Client layer events for messaging
Adds and uses a new `PrivateMessageReceivedEvent` and eliminate the need for an event for adding local messages. Both done in separate commits.
This addresses part of #309
See merge request !208
Address Race-Condition in Forum Sharing
When Two Contacts Share Same Forum with each other at the same time a race condition causes them both to delete each other's invitation. This is solved by an Alice/Bob test as suggested in #388.
See merge request !205
Adds badges to the forum list that indicate unread posts
This MR adds badges to the forum list that indicate unread posts. It does so by extending the compound view `TextAvatarView` and provides convenient setters that take care of the required UI changes. The new badge can also be used to indicate a problem with the forum.

I decided not to check if the forum is shared from someone or with someone and indicate a problem in this case, because this requires iterating two times over all contacts and their group metadata for each forum. If someone considers it important to check for this information, we can create a ticket for doing this within the forum and not in the forum list.
See merge request !207
Blog Fragment in Navigation Drawer with Tabs
This replaces the custom layouts in the navigation drawer with a
`NavigationView` and adds a menu entry for Blogs.
A Main Blogs fragment is added that holds a `TabLayout` and a
`ViewPager`. Five tabs are already added, but they just have a single
placeholder fragment that is to be replaced by the actual fragments.
Please note that the header in the navigation drawer is just provisional. I am sure @Megalox can design a better one.


Closes#409
See merge request !210
This replaces the custom layouts in the navigation drawer with a
`NavigationView` and adds a menu entry for Blogs.
A Main Blogs fragment is added that holds a `TabLayout` and a
`ViewPager`. Five tabs are already added, but they just have a single
placeholder fragment that is to be replaced by the actual fragments.
Closes#409
It does so by extending the compound view `TextAvatarView` and provides
convienient setters that take care of the required UI changes.
The new badge can also be used to indicate a problem with the forum.
Closes#408
122 threaded discussions
This branch contains the complete code for the nested forums (UI & back-end).
* This branch has an optional randomized set of dummy test data, uncomment one line in ForumActivity.java and then open up any forum.
See merge request !201
Message Dependencies
This MR adds a new table to the database to hold message dependencies.
It introduces two more message states (pending and delivered) and completely changes the validation and message delivery logic.
Since this is a **very invasive** change, please **review carefully**. It is better to catch issues now than having to debug things later. If you notice an area without tests, please let me know. I tried to have tests for all changes.
Unfortunately, this MR turned out rather large, but most of it are actually tests and you can review one commit after the other without needing to see the full changelog.
In order to reflect the new states, things that were previously true for `VALID` messages have been changed to now be true for `DELIVERED` messages. This might have changed the semantics in some places and can have unindented side-effects.
The `DatabaseComponent` was extended with methods for:
* adding dependencies
* getting dependencies and states of a message
* getting messages that depend on a message (dependents) and their states
* getting messages to be delivered (by startup hook)
* getting pending messages to be possibly delivered (by startup hook)
The `valid` column in the database was renamed to `state` along with the associated methods to better reflect its new extended meaning.
Since pending messages should not be available to clients, many database queries have been modified to only return results for delivered messages. I might have missed some. Please check carefully. Also you might want to think about how you could create arbitrarily large transactions by sending malicious messages.
Please note that the database version was bumped in this MR.
Closes#382
See merge request !198
that handles message dependencies reported from clients.
The MessageValidatedEvent has been renamed into a MessageDeliveredEvent
since there were no real use cases for the former any more.
This adds a new table to the database to hold message dependencies.
It introduces two more message states: pending and delivered
The valid column in the database was renamed to state to better reflect
its new extended meaning.
The DatabaseComponent was extended with three methods for:
* adding dependencies
* getting dependencies of a message
* getting messages that depend on a message (dependents)
* getting messages to be delivered (by startup hook)
* getting pending messages to be possibly delivered (by startup hook)
In order to reflect the new states, things that were previously true for
VALID messages have been changed to now be true for DELIVERED messages.
Since pending messages should not be available to clients, many database
queries have been modified to only return results for delivered
messages.
All added methods and changes should come with updated unit tests.
Please note that the database version was bumped in this commit.
added parent id to metadata and a unit test
The parent id, a necessary attribute for nested forums, was not being added to the metadata in the forum manager. Additionally, a simple forum manager unit was created.
See merge request !202
Introduce a MessageContext class to be used by all validators
This change will allow to pass message dependencies from the client validators to the `ValidationManager`.
Please see my thoughts in #382 for more details.
See merge request !197
Forum Sharing Status
The new activity shows who you are sharing a forum with and who shares a
forum with you. It is accessible from the overflow menu when in a forum.

Closes#398
See merge request !191
The new activity shows who you are sharing a forum with and who shares a
forum with you. It is accessible from the overflow menu when in a forum.
Closes#398
Handle invitations to the same forum by multiple contacts
This also uses the new metadata queries in the forum sharing client.
Please note that this is based on !184.
See merge request !188
Replace BDF data structures with classes in forum sharing client
This introduces two new classes for protocol session states: One for the sharer and one for the invitee.
The respective classes for protocol state machines and actions have been moved into these classes as inner classes.
The two new classes replace the `BdfDictionary` that was used before to represent the local state information of a forum sharing session.
A similar technique is used for local actions and protocol messages.
Local actions are just represented by one Enum and protocol messages have their own classes now that also handle serialization into BdfDictionaries and BdfLists.
Closes#378
See merge request !184
Contact List Unread Messages
Adds unread count as bubble to avatar image in contact list.
Please note that this is based on !190.

Closes#399
See merge request !192
Increase Avatar border and change shadow color


See merge request !190
Extract ForumFactory from ForumManager
The code for creating forums in ForumManager was used by
ForumSharingManager and also needed by InviteeEngine.
This extracts it into its own class.
Closes#375
See merge request !195
The code for creating forums in ForumManager was used by
ForumSharingManager and also needed by InviteeEngine.
This extracts it into its own class.
Closes#375
Clean up Introduction Session States
...for introducer when both introducees have been deleted.
It can't be deleted when only one introducee is removed, because then all messages in the private conversation with the other introducee will disappear, because their corresponding session state can't be found anymore.
Closes#372
See merge request !189
* This is called when a migration is started while opening the database.
* It will be called once for each migration being applied.
*/
voidonMigrationRun();
}
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.