274 code encapsulation
The goal of this branch is to better compartmentalize, structure and simplify the code in the Android module. It does this via the following techniques:
* Extended use of Dagger by introducing a component for Activities that injects, among other things, SharedPreferences and Fragments. The latter makes it possible to mock fragments more easily and letting Dagger automatically handle its injections.
* Decouple Briar API code, from the activities and Fragments, and encapsulate in re-usable Controller classes
* Introduce a UI-thread App event bus that the Helper classes use to communicate with Activities & Fragments.
* Define the testing methods in the briar-android module per Robolectric and Mockito
NOTE! Don't be alarmed if you see the contact introduction message one more time, one of the changes was to purify UI shared preferences from the Briar shared preferences, which now only contain preferences related to the API and it's usage.
closes#274
See merge request !130
Forum Sharing Client UI
This changes `ShareForumActivity` to use two fragments to facilitate
forum sharing with the new Forum Sharing Client backend.
The `ContactSelectorFragment` allows the user to select a
number of contacts. If there is an ongoing sharing session or the forum
is already shared with the contact, it is disabled in the list. If there
is at least one contact selected, a button appears in the toolbar that
brings the user to the `ShareForumMessageFragment` where the user can
write an optional message to be send along with the invitation.
After sending an invitation, the user is brought back to the forum that
she shared and there is a snackbar showing up briefly to indicate the
successful invitation.
The invitation is shown along with the message within the private
conversation of each contact. The person who shares the forum also sees
the invitation and the message as outgoing messages that also display
the current status of the messages.
A notification is shown like for other private messages as well.
Please note that this commit does not include a way for users to respond
to invitations. This is in MR !172. Both MRs are based on the new backend in !170.


See merge request !171
Modernize AvailableForumsActivity
Turn list of available forums into a `BriarRecyclerView` with XML layout.
Allow to respond to forum invitations from the list of available forums.
The user can either accept or decline an invitation.

See merge request !172
This changes `ShareForumActivity` to use two fragments to facilitate
forum sharing with the new Forum Sharing Client backend.
The `ContactSelectorFragment` allows the user to select a
number of contacts. If there is an ongoing sharing session or the forum
is already shared with the contact, it is disabled in the list. If there
is at least one contact selected, a button appears in the toolbar that
brings the user to the `ShareForumMessageFragment` where the user can
write an optional message to be send along with the invitation.
After sending an invitation, the user is brought back to the forum that
she shared and there is a snackbar showing up briefly to indicate the
successful invitation.
The invitation is shown along with the message within the private
conversation of each contact. The person who shares the forum also sees
the invitation and the message as outgoing messages that also display
the current status of the messages.
A notification is shown like for other private messages as well.
Please note that this commit does not include a way for users to respond
to invitations.
Turn list of available forums into a BriarRecyclerView with XML layout.
Allow to respond to forum invitations from the list of available forums.
The user can either accept or decline an invitation.
New List of Forums
The adapter of the `ForumListFragment` has been changed into a
`BriarRecyclerView` and all its code has been adapted and simplified
accordingly.
All UI of the forum list is now defined in XML layouts. This enabled me to move the snackbar into onCreate().
Before:

After:

See merge request !175
Try harder to connect to contacts
* When an outgoing connection is lost, try to reconnect to the contact straight away
* Use periodic polling for Tor, regardless of whether our hidden service descriptor has been published
* Reduce polling intervals for all plugins (this can be reverted if we solve the connectivity issues)
Closes#262, #314. Hopefully helps with #361.
See merge request !177
Forum Sharing Integration Tests
This adds integration tests for these cases:
* normal invitation session where invitee accepts
* normal invitation session where invitee declines
* session where invitee leaves again after she joined
* session where sharer leaves after invitee has joined
* session where sharer leaves before invitee can respond
* sharer reuses the session ID of the previous session
* after accepting the invitation, the invitee invites the sharer to the same forum
* after session contacts delete each other and session states get cleaned up
Closes#339
See merge request !173
Forum Sharing Client Backend
This MR replaces the old `ForumSharingManagerImpl` with a new one
which is based on state machines and the `ProtocolEngine`.
There is a `SharerEngine` and a `InviteeEngine` that take care of state
transitions, messages, events and trigger actions to be carried out by
the `ForumSharingManagerImpl`. This is all very similar to the
Introduction Client.
The general sharing paradigm has been changed from sharing as a state to
sharing as an action. Now the UI can allow users to invite contacts to
forums. The contacts can accept or decline the invitation. Also, the
Forum Sharing Manager is notified when users leave a forum.
Please note that you will need the UI to actually test this. It is coming up soon in another MR.
Closes#322
See merge request !170
Do not allow session ID reuse and clean up sessions for introducee
It was possible that a malicious introducer sends new request with the
same session ID that was used previously and thus causing introducees to
have multiple states for the same session ID.
This commits prevents that from happening and adds an integration test
for that scenario.
Also if an introducee removes an introducer, all past session states
will be deleted from the database. For this, a test was added as well.
Closes#371Closes#372
See merge request !179
It was possible that a malicious introducer sends new request with the
same session ID that was used previously and thus causing introducees to
have multiple states for the same session ID.
This commits prevents that from happening and adds an integration test
for that scenario.
Also if an introducee removes an introducer, all past session states
will be deleted from the database. For this, a test was added as well.
Closes#371Closes#372
The adapter of the `ForumListFragment` has been changed into a
`BriarRecyclerView` and all its code has been adapted and simplified
accordingly.
All UI of the forum list is now defined in XML layouts.