Commit graph

42 commits

Author SHA1 Message Date
Daniel Gasienica
a76a6098c4 Simplify log statement 2018-03-19 19:27:59 -04:00
Daniel Gasienica
a61f2939fd Make isEnabled an instance variable 2018-03-05 10:29:11 -05:00
Daniel Gasienica
d6ff5af843 🎨 shouldUpdate --> needUpdate 2018-03-05 10:29:11 -05:00
Daniel Gasienica
541e0bfb72 Reduce log noise / size 2018-03-05 10:29:11 -05:00
Daniel Gasienica
a5a4ed7de7 Extract isAudioNotificationEnabled constant 2018-03-05 10:29:11 -05:00
Daniel Gasienica
dc38d40f20 Revert to disabled notification sound on <= Windows 7
We haven’t had the chance to test this using `node-notifier` on Windows 7.
2018-03-05 10:29:11 -05:00
Daniel Gasienica
5a4773fee7 Only play audio notification on supported platforms 2018-03-05 10:29:11 -05:00
Daniel Gasienica
dbc242c37f Improve debug log for notifications 2018-03-05 10:29:11 -05:00
Daniel Gasienica
b5e7882267 Use system notification sounds
Alternatively, there is per-platform support for specific sounds, but that would
require a larger investment:
- macOS: 9420a38fc3 (all-notification-options-with-their-defaults)
- Windows: https://docs.microsoft.com/en-us/previous-versions/windows/apps/hh761492(v=win.10)
2018-03-05 10:29:11 -05:00
Daniel Gasienica
59e59fb754 Remove new message audio notification
Bye, bye, dear Ka-Klunk!
2018-03-05 10:29:11 -05:00
Daniel Gasienica
8a8972f7ac NOTE: Improve i18n pluralization 2018-03-05 10:29:11 -05:00
Daniel Gasienica
a76b1389e6 Extract hasNotifications 2018-03-05 10:29:11 -05:00
Daniel Gasienica
9516d667da Rename enabled --> isEnabled 2018-03-05 10:29:11 -05:00
Daniel Gasienica
a4c52b8d64
Upgrade to Electron 1.8.2 / Node.js 8.2.1 (#2066)
* Upgrade to Electron 1.8.2 / Node.js 8.2.1

* Update CI Node.js versions

* Make `engines` top-level property

This was accidentally included under `build` which is disallowed
by `electron-builder`.

* Refactor notification updates

Allows easier debugging through variable inspection.

* Use `appId` for Application User Model ID

Recommended in:
https://github.com/electron/electron/issues/10864#issuecomment-346229090

* Update `spectron` to 3.8.0

* Bump `electron-builder` based dependencies

* Use `config.extraMetadata` instead of `em`

Prevents `Unknown argument: em` error.

See: https://github.com/electron-userland/electron-builder/issues/2615

* Revert AUMID to be based on `packageJson.name`

In our build artifact `packageJson.build.appId` causes an NPE.
2018-03-02 14:43:03 -05:00
Scott Nonnenberg
cdfdd6b381
Fix notifications: windows -> window, serialize false setting 2017-11-22 14:32:39 -08:00
Scott Nonnenberg
16ad94148a
Introduce library for notifications on downlevel windows (#1812) 2017-11-22 13:50:52 -08:00
Caner Elci
a3fbb9a6aa Fixed drawAttention() position to comply with user's settings (#1612)
This fix is related about issue #1587
window.drawAttention() repositioned to allow complete control over notifications by settings. It now does not draw attention when the notifications are off.
2017-10-30 13:55:36 -07:00
Lilia
0b7543b0f6 Fix audio notifications on linux (#1526)
This partially reverts commit 1b444a5e23.
Because support for system-level notification sound settings is inconsistent
across Win/Linux/OSX, do the simplest thing that will produce consistent
behavior on all platforms: suppress the system sound by always passing the
`silent: true` option, and play our own sound clip (copied from ios).

// FREEBIE
2017-10-03 11:08:14 -07:00
Scott Nonnenberg
10a38297b8 Only show notifications when done with sync (#1507)
This prevents the parade of notifications if a machine wakes up from
sleep. Basically covers situations that the loading screen doesn't
already.

When disabled, notifications will be cached until they are subsequently
re-enabled, at which time all the pending notifications will be summarized.

From the background page, notifications are disabled during connection attempts
until an empty event. This means we can always safely call conversation.notify
to queue a notification for the next batch, dropping some options from message
and conversation model methods.

We've also moved the calls to check window focus and draw attention to the
window, which were previously included in the conversation model, but are now
performed by the Notification system, because the time that the notification is
displayed might be some time after the message is added by the conversation, so
decisions about focus and attention should be made in that moment and not
before.

// FREEBIE
2017-09-29 09:15:28 -07:00
Lilia
1b444a5e23
Make os notifications respect our sound setting (#1445)
This removes our custom notification sound in favor of the system sound, and
ensures that the system sound is disabled if the user unchecks the audio
notification option.

// FREEBIE
2017-09-14 17:03:18 -07:00
lilia
4c5835e0af
Remove remaining call to extension.notification.update 2017-09-14 16:53:45 -07:00
lilia
d85ccbad4f
Remove extension.notification 2017-09-14 16:53:45 -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
e65007e297
Tweak default notification content
Change the placeholder content for when notifications are configured for
count-only or sender-only. Remove some options that are no longer
supported.

// FREEBIE
2017-09-14 16:53:43 -07:00
lilia
79872be9f5
Unfurl notifications
Since we no longer have support for list-style notifications, stop
coalescing notifications into batches and just show contents of the last
message received. Also open the window when clicking on a notification
if it has previously been closed.

// FREEBIE
2017-09-14 16:53:43 -07:00
Scott Nonnenberg
601081c1b8
More refactoring to reduce global event dependencies
All Whisper.events listeners are now defined and bound in background.js,
and we no longer need global methods for opening the inbox and
conversation views, as those are handled by AppView or internally by
InboxView.

// FREEBIE
2017-09-14 16:53:41 -07:00
lilia
859d49b3f4
Use relative paths
// FREEBIE
2017-09-14 16:53:34 -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
Asa Ayers
bda0430805 Add an option to play audio notifications 2017-02-02 09:00:14 -06:00
lilia
8939c61c7c Log on notification removal
// FREEBIE
2016-08-01 20:19:16 -07:00
lilia
7efdfc95ee Log when updating notifications
// FREEBIE
2016-07-28 18:39:14 -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
d8d34e7afc Icon upgrade
Also remove unused images.

// FREEBIE
2016-04-01 13:59:57 -07:00
lilia
f7191ad9de Clear notification when the last one is removed
Previously, we switched to not updating the notification popup on a
removal, since this usually respawns a new notification popup
unexpectedly. However, when the last relevant notification is cleared
(ie, by opening/reading the thread before the notification times out and
disappears on its own) we should clear the existing popup if there is
one.

// FREEBIE
2016-02-22 17:11:17 -08:00
lilia
a3c6061480 Add Notification Settings
Fixes #471

// FREEBIE
2016-02-18 12:22:43 -08:00
lilia
1f2dfc5ea9 Only update notification on add
Previously, notifications were persistent until explicitly dismissed
from the notification center (a bell icon in the system tray), but that
ui has been removed from chrome*, so now updating on remove is
unexpectedly creating a new notification pop up.

*http://blog.chromium.org/2015/10/streamlining-notifications-on-desktop.html

Fixes #667

// FREEBIE
2016-02-10 11:37:40 -08:00
lilia
d0b1aa3829 Silently remove read messages from existing notifications
Previous commit removed notification models from the global collection
but did not actually update the existing notification.

This commit refactors the notification interface to allow us to update
it without re-surfacing the notifcation onscreen.

// FREEBIE
2015-12-01 13:53:59 -08:00
lilia
50add90fd9 Include image previews in notifications
// FREEBIE
2015-09-14 14:02:05 -07:00
lilia
e8edbe53bc Improve notification behavior
Only allow one notification at a time. Use a basic notification for
normal messages, and image notification for image messages, and a list
notification when there are multiple unread messages.

// FREEBIE
2015-09-14 11:12:08 -07:00
lilia
f764445c86 Remove erroneous license file and headers
We only use GPLV3 around here.

// FREEBIE
2015-09-07 14:58:42 -07:00
lilia
3f37cd21a9 Remove remaining traces of localStorage
Add window.storage to the background page, which loads all data from the
'items' store in indexeddb, caching them in memory for synchronous
access, then override textsecure storage to use that in memory store.
2015-05-15 11:39:19 -07:00
lilia
fa3699cdd3 Trigger desktop notifications
Notifications show the conversation name, avatar, and new message text.
Clicking the notification opens the conversation.
2015-03-18 16:29:01 -07:00