Commit graph

3915 commits

Author SHA1 Message Date
Daniel Gasienica 4c0c55082f Move navigation controls to the bottom 2018-04-27 16:31:43 -04:00
Daniel Gasienica fb8d4e2421 Implement basic lightbox with gallery support 2018-04-27 16:31:42 -04:00
Daniel Gasienica 43e19f3b06 Prevent default event on icon button clicks 2018-04-27 16:31:42 -04:00
Daniel Gasienica b3d0438537 Show hand cursor on media grid items 2018-04-27 16:31:42 -04:00
Daniel Gasienica 45d6c7a5a8 Implement video support in lightbox 2018-04-27 16:31:42 -04:00
Daniel Gasienica ac04f0648a Load more documents than media 2018-04-27 16:31:42 -04:00
Daniel Gasienica 6ee56b8445 Remove newlines 2018-04-27 16:31:42 -04:00
Daniel Gasienica b86f9c0be8 Allow saving of attachments from media gallery lightbox 2018-04-27 16:31:42 -04:00
Daniel Gasienica b74b761255 Implement click to save for document list 2018-04-27 16:31:42 -04:00
Daniel Gasienica 8ca5a391af arrayBufferToObjectURL: Ensure data is ArrayBuffer 2018-04-27 16:31:42 -04:00
Daniel Gasienica b27fdd1559 Use pointer cursor for DocumentListItem 2018-04-27 16:31:42 -04:00
Daniel Gasienica 41fe50553f Replace Backbone saveFile with Attachment.save 2018-04-27 16:31:42 -04:00
Daniel Gasienica 9a76d4bcf8 Whitelist assert global for tests 2018-04-27 16:31:42 -04:00
Daniel Gasienica 4a5e61eaf4 Implement Attachment.save 2018-04-27 16:31:42 -04:00
Daniel Gasienica 3727205606 Organize ESLint file list 2018-04-27 16:31:42 -04:00
Daniel Gasienica 954433366e Load documents for media gallery 2018-04-27 16:31:42 -04:00
Daniel Gasienica f8119be97b Include videos in media gallery 2018-04-27 16:31:42 -04:00
Daniel Gasienica 37d73accde Show ‘Documents’ tab 2018-04-27 16:31:42 -04:00
Daniel Gasienica 96c44094e3 Implement Conversation.fetchFileAttachments 2018-04-27 16:31:42 -04:00
Daniel Gasienica 3a8582ee16 Re-enable media gallery access 2018-04-27 16:31:42 -04:00
Daniel Gasienica 2a5f513ebc Organize globals 2018-04-27 16:31:42 -04:00
Scott Nonnenberg 45bf1d5bfc
styleguide: Make filesize/Signal.Util.GoogleChrome available (#2302)
styleguide: Make filesize and Signal.Util.GoogleChrome available
2018-04-27 09:56:22 -07:00
Scott Nonnenberg ccf14710a3 styleguide: Make filesize and Signal.Util.GoogleChrome available 2018-04-27 08:51:46 -07:00
Daniel Gasienica 73a0032b75 Remove duplicate entry from .gitignore (#2271) 2018-04-26 20:29:45 -04:00
Balázs Keresztury dac1f69c16 Removed duplicate entry from .gitignore 2018-04-26 20:28:47 -04:00
Scott Nonnenberg fdd6985a79
Thumbnails for new video attachments and video quotes (#2293)
Two major changes here:

1. When you attach a video to your message, you see a thumbnail of its first frame in the composition area, instead of a generic file icon
2. When you reply to a message with a video in it, your message will include a thumbnail of that video (we'll also generate thumbnails for video quotes if not provided already)

I also made a change to our quote-loading algorithm, since I noticed that our previous approach had some performance issues now that we support video. Where before, we privileged our ability to make local thumbnails at a higher quality, now we defer to any thumbnail we have saved on the quote. So the algorithm for preparing a quote for display is now:

1. Load thumbnail from disk
2. Check to see if quoted message is in memory already. If it is, and we weren't able to load a thumbnail already, generate it from quoted message.
3. If there is an attachment in quote, and we couldn't find message in memory, and the attachment contentType is either image or video, we will go to the database to find the referenced message and create a thumbnail from it.

Bonus bug-fix: The scroll down button in the bottom right of the conversation no longer has an outline when you click it.
2018-04-26 12:27:05 -07:00
Scott Nonnenberg 1bc8452337 Remove the outline for the scroll down button
In the future we'll re-enable this for keyboard navigation. For now,
it's really distracting.
2018-04-26 12:04:34 -07:00
Scott Nonnenberg 84c7a4c293 Move to some of our global utility methods 2018-04-26 12:01:31 -07:00
Scott Nonnenberg 403fb1fd60 Make algorithm for finding thumbnails more efficient 2018-04-26 12:00:57 -07:00
Scott Nonnenberg 27a30b3267 Respond to PR feedback
- makeThumbnail -> makeImageThumbnail
- duplicate 'display: flex'
- remove no-longer-applicable comment
2018-04-26 09:50:13 -07:00
Scott Nonnenberg ac0b50d20f
Generate thumbnails for new video attachments, video quotes 2018-04-25 18:32:46 -07:00
Scott Nonnenberg 0e99ca61a2
eslintify file_input_view.js 2018-04-25 15:06:27 -07:00
Scott Nonnenberg b9b85a0030
v1.9.0-beta.1
Send quoted replies via hover menu on message (#2284, #2292)

Fixed: Linking a new iOS device would not initially show iOS theme (#2284)

Fixed: In iOS theme, narrow images would result in a broken chat bubble (#2273, #2282)

Dev:
  - Fix beta install instructions in readme for debian-based linux (#2262)
  - Media Gallery: Phase 1 - currently disabled (#2236)
2018-04-25 13:01:54 -07:00
Daniel Gasienica acf8a1a96c
Media Gallery: Phase 1 (#2236)
- [x] Index each `Message` based on whether it has an attachment
      (visual or document), e.g.
      ~~`attachmentTypes: 'visual' | 'document' | 'mixed' | 'none'`~~.
      ~~`attachmentTypes: 'visual' | 'document' | 'none'`~~
      - `hasVisualMediaAttachments: IndexedDB.IndexablePresence`
        (`1 | undefined`)
      - `hasFileAttachment: IndexedDB.IndexablePresence` (`1 | undefined`)
      - `hasAttachments: IndexedDB.IndexableBoolean` (`1 | 0`)
- [x] Create migration to initialize index
- [x] Add menu for viewing all media: **View All Media**
- [x] Add IndexedDB index for:
  - [x] visual media attachments
  - [x] file attachments
  - [x] attachments (general)
- [x] Render tabs: **Media** and **Documents**
- [x] Group messages by date
- [x] Add `GoogleChrome` module to explicitly whitelist file formats it can
      render / play back.
- [x] Render list of media thumbnails
  - [x] Avoid loading videos into memory as they are too big.
        **TODO:** Could we do that for any large attachment before we have
        thumbnails?
  - [x] Show video icon for videos as we don’t have thumbnails (yet).
- [x] Implement lightbox
   - [x] Rebuild Backbone lightbox using React
   - [x] Add right arrow SVG (`forward.svg` for symmetry with `back.svg`).
   - [x] Add next / previous buttons
   - [x] Port support for `Escape` key to close
   - [x] Port click close
- [x] Show lightbox when clicking on media thumbnail
- [x] Switch from `MIME.is*` to `GoogleChrome.is[Image|Video]TypeSupported`
- [x] Disable access to media gallery until it’s complete.
- [x] **Infrastructure:** Move `filesize` from Bower to npm/yarn.
- [x] **Infrastructure:** Add support for _Prettier_ code formatting.
      Opt-in via pragma:
      ```
      /**
       * @prettier
       */
      ```
  Run via `yarn format` command. **TODO:** Add support Git commit hook, etc.
- [x] **Infrastructure:** Add basic TypeScript type definitions for Backbone
      `Model` and `Collection`.
- [x] **Infrastructure:** Created pattern for fetching index data without adding
      more code to existing Backbone collections.
      See `Conversation.fetchVisualMediaAttachments`.
- [x] **Infrastructure:** Created variable for `z-index`.
      **TODO:** Replace all usages of explicit `z-index` with variables
      over time.
- [x] **Infrastructure:** Created `Signal.Backbone.Views.Lightbox` module to
      experiment interop with Backbone without using Backbone or jQuery itself
      to align with long-term plans.
- [x] **Infrastructure:** Enable all strict checks by TypeScript compiler.
- [x] **Infrastructure:** Add new TSLint rules (see comments in `tslint.json`).


### Phase 1

- [x] Only show images in media gallery until we have video support in lightbox
      (and potentially thumbnails for grid).
- [x] Show up to 50 of most recent images until we have infinite scrolling.
- [x] Hide ‘Save As…’ button in media gallery until we port underlying
      functionality from Backbone to React.
- [x] Disable previous/next navigation until implemented.
2018-04-25 15:44:48 -04:00
Daniel Gasienica bf3a547a76 Organize globals 2018-04-25 15:28:56 -04:00
Daniel Gasienica 19411a78c8 Remove dead code 2018-04-25 15:25:12 -04:00
Daniel Gasienica 52e4e5aece Omit undefined keys when comparing IndexedDB data 2018-04-25 15:25:12 -04:00
Daniel Gasienica f36f206a01 Use IndexablePresence for hasFileAttachments and hasVisualMediaAttachments
Reduces index size, makes it easier to debug using IndexedDB inspector, and
hopefully improves lookup performance.
2018-04-25 15:25:12 -04:00
Daniel Gasienica 3a33d862c0 Update backup test fixture 2018-04-25 15:25:12 -04:00
Daniel Gasienica c8e51f1d06 Disable media gallery access until feature is complete 2018-04-25 15:25:12 -04:00
Daniel Gasienica 5c81e1b353 Watch TypeScript files in Grunt 2018-04-25 15:25:12 -04:00
Daniel Gasienica 8e3c38d5fe Fix formatting 2018-04-25 15:25:12 -04:00
Daniel Gasienica b65370c8d7 Prefer GoogleChrome.is* over MIME.is* 2018-04-25 15:25:12 -04:00
Daniel Gasienica 64c3d604aa Fix type errors 2018-04-25 15:24:52 -04:00
Daniel Gasienica cd6912f0dd 🎨 Autoformat code 2018-04-25 15:24:52 -04:00
Daniel Gasienica 823a58f98a Prevent NPE 2018-04-25 15:24:52 -04:00
Daniel Gasienica 96be0df8c7 Show lightbox controls based on presence of handlers 2018-04-25 15:24:52 -04:00
Daniel Gasienica 59650035ec Use 🇺🇸 spelling 2018-04-25 15:24:52 -04:00
Daniel Gasienica feff820cd4 Prefer custom styles over strong 2018-04-25 15:24:52 -04:00
Daniel Gasienica 657a2d6149 Document the use of CSS vs inline styles 2018-04-25 15:24:52 -04:00