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.
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 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
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 commit 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 invitiation. Also, the
Forum Sharing Manger is notified when users leave a forum.
Closes#322
Set ongoing notification to minimum priority
Setting the priority of the ongoing notification to PRIORITY_MIN prevents it from being shown in the status bar on Android 4.1 and later. The service still runs in the foreground.
Thanks to @str4d for finding the solution. Closes#154.
See merge request !169
Prepare for new Forum Sharing Client
Methods for creating, adding and removing forums have been moved to the
`ForumManager`. In order to still handle removing forums properly, a
`RemoveForumHook` has been introduced.
Methods for sharing forums with all current and future contacts have
been removed along with the localGroup where this information was saved.
The `ShareForumActivity` now has the proper label.
The `SessionId` and the `ProtocolEngine` have been moved to the
`clients` package.
This addresses part of #322 and part of what has been discussed in #320.
See merge request !156
Methods for creating, adding and removing forums have been moved to the
`ForumManager`. In order to still handle removing forums properly, a
`RemoveForumHook` has been introduced.
Methods for sharing forums with all current and future contacts have
been removed along with the localGroup where this information was saved.
The `ShareForumActivity` now has the proper label.
The `SessionId` and the `ProtocolEngine` have been moved to the
`clients` package.
This addresses part of #322 and part of what has been discussed in #320.
Hold a wake lock while Tor is connected to the internet
This is a partial fix for #314. As noted on that ticket, if a Tor connection is lost for any reason other than the device sleeping, the plugin won't try to replace the lost connection. I'm leaving the ticket open until that more general issue is solved.
The Tor plugin uses several variables to keep track of its connectivity status. This patch refactors those variables into an inner class to improve readability and ensure they're accessed atomically. However, it's still possible for the plugin's state to become inconsistent with the state of the Tor process. For example, calls to updateConnectionStatus() may run concurrently on the IO executor, so their calls to enableNetwork() may be interleaved. As usual, locking would solve this problem but create the potential for deadlock, so I won't try to solve it in this patch.
See merge request !168
Use Android executor for background API calls
Some Android API calls need to be made from a thread with a message queue, but to keep the UI responsive they shouldn't be made from the UI thread.
This patch gives AndroidExecutor a captive thread with a message queue to execute tasks, and converts various background tasks from creating their own threads to using AndroidExecutor and IoExecutor.
This allows us to upgrade the support library to 23.2.1. Fixes#332.
See merge request !161
Add Snackbar and Toolbar Button to Forum List
This MR is a small change that replaces the custom UI elements in
the forum list with a Snackbar and a Toolbar menu.
It also fixes a background color that was still present with fragment from the NavDrawer.
Before:

After:

It addresses one part (2b) of #305 and is part of #121.
See merge request !163
This commit is a small change that replaces the custom UI elements in
the forum list with a Snackbar and an Toolbar menu.
Addresses one part (2b) of #305
Converts the splash screen to XML format
Removes all programatic calls that modify the layout and uses the XML
resource instead.
See merge request !123
This commit introduces an abstract `BaseContactListAdapter` which provides
most of the adapter logic. The original `ContactListAdapter` extends it to
show date and online status of the contacts.
The new `ContactChooserAdapter` which is used for introductions extends
the `ContactListAdapter` and adds logic for graying out contacts from
different identities than the currently used one.
A new `ContactSelectorAdapter` extends the `BaseContactListAdapter` and
allows to select multiple contacts. It offers a method to return a
collection of all selected `ContactId`s.
This commit also sneaks in an animation when the 'Share Forum' button
is clicked.
Closes#292
Use consistent styling for dialogs. #296
Converted all dialogs to use the support library and the Briar theme, so they have a consistent Material Design appearance across all Android versions.
See merge request !152
Move create forum post and share forum buttons in action bar
According to the designs in #305, the 'create forum post' and 'share forum' buttons will go into the in action bar.
In the spirit of keeping MRs small and to avoid conflicts with #306, I did this first and independently of future work.
This also introduces constants for the `GROUP_ID`, `FORUM_NAME` and `MIN_TIMESTAMP` as they were used for the two buttons.
Closes#313
See merge request !150