Commit Graph

7232 Commits

Author SHA1 Message Date
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
Daniel Gasienica fca8de16c8 Add required Message.id: string 2018-04-25 15:24:52 -04:00
Daniel Gasienica dd7e51e697 🎨 Fix formatting 2018-04-25 15:24:52 -04:00
Daniel Gasienica 3ad74e0c3e Remove implied strict compiler options 2018-04-25 15:24:52 -04:00
Daniel Gasienica 74582de2d1 Clarify naming 2018-04-25 15:24:52 -04:00
Daniel Gasienica 6330a8d9f3 Simplify expression 2018-04-25 15:24:52 -04:00
Daniel Gasienica f99e6306c3 Simplify withSection 2018-04-25 15:24:52 -04:00
Daniel Gasienica d98d08a7e0 Remove obsolete TODO 2018-04-25 15:24:52 -04:00
Daniel Gasienica e97b078088 Use componentWillUnmount 2018-04-25 15:24:52 -04:00
Daniel Gasienica 9abf1f0fcd Use dash-case for CSS class names 2018-04-25 15:24:52 -04:00
Daniel Gasienica 9134701f7c Move filesize from Bower to npm 2018-04-25 15:24:52 -04:00
Daniel Gasienica 2e121310e4 🎨 Fix lint error 2018-04-25 15:24:52 -04:00
Daniel Gasienica 4d04638358 Document changes for MVP 2018-04-25 15:24:52 -04:00
Daniel Gasienica c3e04ecf87 Remove use of LoadingIndicator 2018-04-25 15:24:52 -04:00
Daniel Gasienica 6d5d0df1c0 🎨 Fix TSLint errors 2018-04-25 15:24:52 -04:00
Daniel Gasienica 8b9516de72 Update test for attachment metadata 2018-04-25 15:24:52 -04:00
Daniel Gasienica 86a9923181 Remove TODOs 2018-04-25 15:24:52 -04:00
Daniel Gasienica 204de3aaea Lazily bind Signal.Components.MediaGallery 2018-04-25 15:24:52 -04:00
Daniel Gasienica 146178f977 Update schema documentation 2018-04-25 15:24:51 -04:00
Daniel Gasienica f240269d7b MVP: Only show images in media gallery 2018-04-25 15:24:51 -04:00
Daniel Gasienica b4e3749c88 MVP: Only show media tab
Until we support showing documents.
2018-04-25 15:24:51 -04:00
Daniel Gasienica 60ed82b728 Show all lightbox controls in style guide 2018-04-25 15:24:51 -04:00
Daniel Gasienica b4a4182613 Hide ‘Save As…’ button in media gallery
Wait until we support it.
2018-04-25 15:24:51 -04:00
Daniel Gasienica a7ed21a811 Add shouldShowSaveAsButton option 2018-04-25 15:24:51 -04:00
Daniel Gasienica 0d676a65b8 Open media gallery item in lightbox 2018-04-25 15:24:51 -04:00
Daniel Gasienica a9f7f18721 Add ItemClickEvent 2018-04-25 15:24:51 -04:00
Daniel Gasienica d634a414c3 Make visibility of previous/next buttons opt-in 2018-04-25 15:24:51 -04:00
Daniel Gasienica 142236640e Click lightbox to close 2018-04-25 15:24:51 -04:00
Daniel Gasienica ce825fbd66 Rename save to onSave 2018-04-25 15:24:51 -04:00
Daniel Gasienica 1b9e581e90 Show lightbox image as large as possible 2018-04-25 15:24:51 -04:00
Daniel Gasienica 2cb0b0aeb1 Add arrow controls 2018-04-25 15:24:51 -04:00
Daniel Gasienica f0895af6dc Add right arrow SVG 2018-04-25 15:24:51 -04:00
Daniel Gasienica 246e0ca87b Add note about inline styles 2018-04-25 15:24:51 -04:00
Daniel Gasienica b0e1cc49a5 Remove legacy Backbone lightbox 2018-04-25 15:24:51 -04:00