Commit graph

47 commits

Author SHA1 Message Date
Scott Nonnenberg
a7d78c0e9b Sealed Sender support
https://signal.org/blog/sealed-sender/
2018-10-29 14:49:18 -07:00
Scott Nonnenberg
cd60bdd08a Move conversations to SQLCipher 2018-10-01 18:18:37 -07:00
Scott Nonnenberg
3105b77475 Migrate to SQLCipher for messages/cache
Quite a few other fixes, including:
  - Sending to contact with no avatar yet (not synced from mobile)
  - Left pane doesn't update quickly or at all on new message
  - Left pane doesn't show sent or error status

Also:
 - Contributing.md: Ensure set of linux dev dependencies is complete
2018-07-31 17:08:45 -07:00
Scott Nonnenberg
5933a34a18 Use window.log in browser context, turn on console eslint rule 2018-07-21 14:52:43 -07:00
Scott Nonnenberg
675e34fc8d New React component: ConversationListItem, installed in left pane
When collecting a conversation's last message, we grab that message's
status as well (if outgoing) and show it.
2018-07-17 20:25:55 -07:00
Scott Nonnenberg
43a44793c5 Remove jshint - move everything over to eslint
Also removed all hints of previous linters
2018-07-17 15:54:32 -07:00
Scott Nonnenberg
1c23c6a9d7 Remove window.config in favor of window.getXXX() accessors 2018-06-14 17:03:53 -07:00
Daniel Gasienica
95321e5d3e Remove Vim mode lines 2018-04-30 16:53:34 -04:00
Daniel Gasienica
1dd87ad197 Format all source code using Prettier 2018-04-30 16:53:34 -04:00
Daniel Gasienica
24f4ad53bc Use single quotes for identifiers 2018-04-11 15:54:32 -04:00
Daniel Gasienica
08f6886f3e Strengthen precondition of ConversationController.getOrCreate 2018-03-27 19:52:18 -04:00
Daniel Gasienica
83c979fb84 Rename createTemporary to dangerouslyCreateAndAdd
Class: `ConversationController`.

This function should not be used in application code as it creates potentially
invalid `Conversation` instances in our global conversation collection. We keep
making it available for testing purposes.
2018-03-27 19:52:17 -04:00
Scott Nonnenberg
b01b939d15
Clear conversation list when the conversations collection resets 2018-03-14 14:42:15 -07:00
Scott Nonnenberg
c81d3f5c0b
Allow ConversationController.load() to be called more than once 2018-03-14 14:42:14 -07:00
Scott Nonnenberg
9acb189650
Remove config after unlink, clear db when linked with new number 2018-03-14 14:42:13 -07:00
Martino Pilia
7034d8759d Add badge for unread messages to the tray icon (#1934)
This commit adds a badge to the tray icon that displays the number of
unread messages, if there is any. It is implemented by providing
alternative versions of the icon, that replace the default image when a
message is received.

The badge is rendered graphically as a red circle containing the number
of unread messages. Since a different icon file is needed for each
possible number of unread messages, but this number is clearly
unbounded, only the numbers from 1 to 9 are provided. If there are 10 or
more unread messages, a single badge (depicted as "9+") is used.

Resolves #1917
2018-01-17 15:27:58 -08:00
Scott Nonnenberg
ce01eb7913
Log more info w/http errors, resilient to invalid group members (#1968)
* api.js: HttpError now preserves more of original error info

* Allow invalid conversation to be added to ConversationController

If a number we don't believe is valid comes in as part of a group, we
fall apart. We event prevent display of that conversation. Because we
have 'isValid()' protections in place for the places we create contacts
from user input in desktop (the search bar), we can temporarily add an
invalid contact to our collection (not saving it to the database) to
unblock this group scenario.

Still investigating what kind of phone number is valid in a mobile app
but not valid for us.

* Finish the debuggable error support

* Fix logging in the case of an invalid number
2018-01-12 16:19:26 -08:00
Scott Nonnenberg
f0aaa7a1c5
Introduce intl-friendly sort order for contact lists (#1900) 2017-12-14 16:30:11 -08:00
Scott Nonnenberg
c94d4efd18
Beta versions support: SxS support, in-app env/instance display (#1606)
* Script for beta config; unique data dir, in-app env/type display

To release a beta build, increment the version and add -beta-N to the
end, then go through all the standard release activities.

The prepare-build npm script then updates key bits of the package.json
to ensure that the beta build can be installed alongside a production
build. This includes a new name ('Signal Beta') and a different location
for application data.

Note: Beta builds can be installed alongside production builds.

As part of this, a couple new bits of data are shown across the app:

- Environment (development or test, not shown if production)
- App Instance (disabled in production; used for multiple accounts)

These are shown in:

- The window title - both environment and app instance. You can tell
  beta builds because the app name, preceding these data bits, is
  different.
- The about window - both environment and app instance. You can tell
  beta builds from the version number.
- The header added to the debug log - just environment. The version
  number will tell us if it's a beta build, and app instance isn't
  helpful.

* Turn on single-window mode in non-production modes

Because it's really frightening when you see 'unable to read from db'
errors in the console.

* aply.sh: More instructions for initial setup and testing

* Gruntfile: Get consistent with use of package.json datas

* Linux: manually update desktop keys, since macros not available
2017-10-30 13:57:13 -07:00
Scott Nonnenberg
61a2a1a8f8 Improve fixtures, restore InboxView rendering on the test page (#1562) 2017-10-13 16:48:50 -07:00
Scott Nonnenberg
151d1797db Fix intermittent conversation sort order problem (#1558)
We were inserting based on what was already in the DOM, instead of
using the index from our conversation collection.

FREEBIE
2017-10-13 11:47:13 -07:00
lilia
bd7f4febaa
Remove dead code
These are all unused, obsolete, or no-op functions at this point.

// FREEBIE
2017-09-14 16:53:45 -07:00
lilia
c4ccf7c8e3
Inline setUnreadCount
// FREEBIE
2017-09-14 16:53:44 -07:00
Scott Nonnenberg
4cba16cb61 Fetch all conversations on startup of app, not on inbox load (#1437)
* Fetch all conversations on startup of app, not on inbox load

A recent change to fetch conversations less didn't take into account all
that can happen in the app without the inbox loaded. That only happens
when the window is shown, and messages can come in with the app in the
background. In that case, the conversation wouldn't have been loaded
from the database, but would be saved to the database anyway, losing
data.

This change fetches all conversations as soon as the the data store is
ready for a fetch. It also introduces failsafe throws to ensure that
synchronous ConversationController accesses don't happen until the
initial fetch is complete. A new getUnsafe() method was required to
account for some of the model setup that happens during that initial
conversation fetch.

Fixes #1428

FREEBIE

* Fix tests: ConversationController.load() required before get()

FREEBIE
2017-09-06 18:18:46 -07:00
Scott Nonnenberg
d8ce198f55 Fetch conversations once, clean up ConversationController API (#1420)
* Fetch conversations once, clean up ConversationController API

Race conditions around re-fetching have caused some problems recently,
so this removes the need to re-fetch conversations. They are fetched
once or saved once, and that is it. All interaction goes through the
ConversationController, which is the central source of truth.

We have two rules for Conversations:

1. If a conversation is in the ConversationController it doesn't need
   to be fetched, but its initial fetch/save might be in progress. You
   can wait for that fetch/save with conversation.initialPromise.
2. If a conversation is not already in the ConversationController, it's
   not yet in the database. It needs to be added to the
   ConversationController and saved to the database.

FREEBIE

* Remove Conversation.fetch() call in Message.handleDataMessage()

FREEBIE

* ConversationController.API cleanup: Fix two missing spots

FREEBIE
2017-09-01 09:10:41 -07:00
Scott Nonnenberg
b14667ae40 Additional error handling/logging during contact sync (#1395)
FREEBIE
2017-08-30 09:35:04 -07:00
Scott Nonnenberg
65283d2794 Unload conversations and old messages every half-hour
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
3e8b34f3d0 findOrCreateById instead of private-specific method
Anyway, findOrCreateById with no type didn't succeed, because the
conversation didn't validate.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
3e0fa995dd When finding all groups involving a number, load from DB not memory
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
0adc398a6f Fetch conversation before saving in all sync handlers
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
1cf9289b1a Add items to conversation history when user verifies/unverifies
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
1383dc141f Ensure that expired messages are removed from the frontend 2016-09-28 17:20:02 -07:00
lilia
72dd93aa02 Clear window attention if all messages are marked read
Fixes #758

// FREEBIE
2016-04-14 11:57:56 -07:00
lilia
bb2868f1ec Debounce updates to notifications and other events
Wait for one second of silence before displaying new notifications,
updating the unread count and conversation list previews.

Fixes #470
2016-04-11 14:55:38 -07:00
lilia
07a0463b65 Fix conversation list self-resorting
When deleting all messages in a conversation, the entry in the left pane
should be inserted into the alphabetical portion of the list. To keep it
in this collection, do not nullify active_at.

To ensure the list view is keeping itself correctly sorted, make sure
that resorting behavior is triggered any time a relevant attribute is
changed.

This fixes deleted conversations jumping to the top of the list, and
conversation order scrambling when getting a group or contact sync
message from our master device.

Fixes #734

// FREEBIE
2016-03-25 14:32:57 -07:00
lilia
760bfffb50 Show all contacts all the time
Contacts without conversation identity appear in alphabetical order at
the end of the inbox.

// FREEBIE
2016-03-18 11:21:11 -07:00
lilia
7fb4d3d8aa Load all inbox convos before rendering
This is a better alternative to the fix in 0434c4b, which causes
problems when creating a new conversation from entering a phone number.

// FREEBIE
2016-03-17 20:58:56 -07:00
lilia
fd8bac2003 Fix conversation list ordering
Order conversation list by timestamp instead of active_at. The former is
the send time of the most recent message. The latter is typically the
receive time of that message. This can cause mis-ordering if you send a
message while processing a backlog of incoming messages.

Fixes #617

// FREEBIE
2016-03-04 06:34:31 -08:00
lilia
1be45f3775 Derive global unread count from individual counts
// FREEBIE
2016-02-22 17:11:17 -08:00
lilia
31b29b67f2 Don't let unreadCount become negative
If you had an inaccurate unread count due to previously broken unread
tracking, it's possible to go negative and never fully recover. Fixed
by clamping to zero.

// FREEBIE
2015-11-19 10:47:50 -08:00
OdysseasKr
83298b8979 Mark conversation as read if open and window focused
Messages that are received in the active conversation while the window
is focused, are automatically marked as read.

The conversation appears as unread for a split second as the incoming message
arrives but it gets marked as read as soon as the message is displayed.
2015-11-19 10:40:07 -08:00
ody
8c59862e3d Fix global unread message counting
Fixed the global counting of unread messages. This makes the "unreadCount"
variable in storage to stay in sync with the sum of unread messages in each
conversation. To achieve this, the controller_view updates the global
variable whenever messages are received or read.
2015-11-19 10:40:02 -08:00
lilia
c167fc964d Revert "Remove global updateInbox method"
This reverts commit 1c70293bba.

This broke tests by blocking the database deletion during test
setup.
2015-09-17 15:42:13 -07:00
lilia
310f40fcad Contact sync should update existing contacts
// FREEBIE
2015-09-17 14:26:25 -07:00
lilia
1c70293bba Remove global updateInbox method
This operation now needs to be done exactly once, at startup, so we
don't need to expose a global method for it.

// FREEBIE
2015-09-17 13:44:44 -07:00
lilia
6364cda7cb Create requires an object
// FREEBIE
2015-09-17 11:42:59 -07:00
lilia
0017f196ef Move ConversationController to its own file
Encapsulate the global conversation cache collection against accidental
access, avoiding the data-clobbering bug fixed in previous commit.

Also move some one-off program initialization code from panel controller
to background.js

// FREEBIE
2015-09-16 23:43:14 -07:00