Commit Graph

30 Commits (f9ce27f2c8bf9e6b871ebd7c82f753b24db19af9)

Author SHA1 Message Date
lilia eb1cfe9b70 Move notification listeners to background
Otherwise they will be re-registered by the frontend page.

// FREEBIE
10 years ago
lilia 7f4ef6e9e7 Remove double-check of unread count
This same condition is already enforced in the markRead method.

// FREEBIE
10 years ago
lilia 78d7296f84 Fix tests
// FREEBIE
10 years ago
lilia 50add90fd9 Include image previews in notifications
// FREEBIE
10 years ago
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
10 years ago
lilia f764445c86 Remove erroneous license file and headers
We only use GPLV3 around here.

// FREEBIE
10 years ago
lilia 00dfcbb462 Change websocket closed message 10 years ago
adambar 52857f09ea Fix for conversation & inbox windows closing callbacks never called.
As discussed in similar issue there: https://github.com/GoogleChrome/chromedeveditor/issues/1023 - it is not possible to add onClosed event listener on an 'abstract' current window property, it needs to be set on the particular window instance instead.

Before that change, the clean up function was never actually called, because the listener was never properly attached. That was probably the reason of existence for "panel isn't actually open ... and so we try again." code that was executed if the previous window wasn't cleaned up properly (so actually every time). This code is no longer needed, I guess, as the windows are now cleaned up properly.
10 years ago
lilia 3eafefe18e Don't display notifications for open windows.
Just update and draw attention to them.

Fixes #238

// FREEBIE
10 years ago
lilia bc4d31cf72 Fix for inbox sometimes not reappearing
Apparently focusing an app window does not implicitly unhide it.

// FREEBIE
10 years ago
lilia 12eb553a3f Draw attention to windows on new messages 10 years ago
lilia f6a326577d Crash fixes for chromium
My current version of chromium inexplicably exposes a crippled version
of chrome.browserAction even though we are now a packaged app and should
not have that functionality exposed to us anymore. This results in some
errors to the tune of "property 'foo' of undefined".

It also doesn't support the innerBounds property for window creation,
only the older (deprecated) bounds property.
10 years ago
lilia 029c9754f0 Fix tests 10 years ago
lilia 5a7ab54ee6 Fix registration page
Also make it accessible by providing a mode argument to the install
function. Previously developers could just edit the url but we no longer
have the address bar as an app window, so now they must close the
default installer and run the following from the background page
console: `extension.install('standalone')`.

In the production build, this should result in an error since it is not
supported / the register page is not included there.
10 years ago
lilia 7afd0a02e8 Convert beforeunload listeners 10 years ago
lilia 002ff45312 Adapt window management to chrome app window api
Appify tabs, windows, browserAction

Port the extension.windows.focus function to new window api and
generalize its error handling in the case where the requested window
does not exist. An error will be passed to the callback.

Port extension.browserAction and rename it to the more generic
extension.onLaunched.

Use of the id option when opening a window ensures that attempting to
open a duplicate window merely focuses the existing window.

Finally, after registration, close the options window and open the
inbox.

Port extension.remove
10 years ago
lilia f90f6328dd Don't resolve the background page til storage is ready 10 years ago
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.
10 years ago
lilia 76e170686a Make getBackground async 10 years ago
lilia bf2bf4cfd9 Remove redirect to index from registration.done() 10 years ago
lilia fd6e2954f7 Curtail over-zealous websocket reconnects
Closes #173

Previously, in the event of a failed websocket auth, we would attempt to
reconnect once a second ad infinitum. This changeset ensures that we
only reconnect automatically if the socket closed 'normally' as
indicated by the code on the socket's CloseEvent. Otherwise, show a
'Websocket closed' error on the inbox view.

Ideally we would show a more contextual error (ie, 'Unauthorized'), but
unfortunately the actual server response code is not available to our
code. It can be observed in the console output from the background page,
but programmatically, we only receive the WebSocket CloseEvent codes
listed here:
https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes

The websocket error message is displayed by a normally-hidden but ever
present socket status element. Clicking this element will immediately
refresh the background page, which will try again to open the websocket
connection.
10 years ago
lilia 607d5d3307 Abstract chrome browser action and windows stuff 10 years ago
lilia 5762e59c41 DRY up registration event callbacks
This was just a special case of the extension.on/trigger interface.
10 years ago
lilia 470346c9c4 Save incoming messages and pass to frontend asynchronously
After a message is saved asynchronsly, fire an event and pass the
message attributes to frontend listeners via the chrome-runtime API.

This behavior is similar to the 'storage' event fired by localStorage.
11 years ago
lilia 5a0e199fc5 Namespace registration helpers 11 years ago
Sumit Bindal d537d6a91f Fixing lint errors
Fixing JSLint Problems
11 years ago
lilia 13446e9c17 "Fix dirty hack" (runtime.reload) in chromium.js
Runtime reload is overkill and causes a jarring ux. Instead, send and
receive messages across the runtime. Also, if we need to jump between
the main ui and options pages, simply navigate within the current tab
rather than spawning a new one.
11 years ago
Marco 69ba6581b0 moved some chromium-specific code into chromium.js (using extension.navigator namespace) 11 years ago
Matt Corallo aec36468bc Request new keys (largely untested) 11 years ago
Matt Corallo d9bf0a41fb textsecure.storage, chromium.js 11 years ago