Commit Graph

20 Commits

Author SHA1 Message Date
Harry
363868c46f
Expose wrapped types in MediaGalleryResourceFinder 2024-04-15 09:16:14 -07:00
Harry
40af904a24
Another chunk of TSResource type migrations for conversation view classes 2024-04-15 09:15:27 -07:00
Harry
b63468b98b
Clean up MediaGalleryResourceFinder API 2024-04-11 09:30:36 -07:00
Harry
a6b2cd966f
Wrap MediaGalleryRecordFinder completely transparently in MediaGalleryResourceFinder 2024-04-11 09:29:47 -07:00
Harry
c898c69ff6
Reorganize MediaGalleryFinder file with no code changes 2024-04-11 09:28:13 -07:00
Igor Solomennikov
20c55e7dec
Add necessary imports to Swift files.
Necessary for converting ChatListVC to Swift.
2023-06-05 16:04:48 -07:00
Igor Solomennikov
8f6fbdf827
Convert SignalBaseTest to Swift. 2023-06-02 21:24:50 -07:00
george-signal
45186034d6
Bring order to index paths in All Media 2023-03-06 14:55:17 -08:00
george-signal
ce18ac8d29
[All media] Add filtering to prerelease builds. 2023-03-03 15:55:13 -08:00
george-signal
242d949439
Race condition fixes in MediaGallerySections 2023-01-23 15:45:24 -08:00
george-signal
e47a9cba34
Adopt MediaGalleryCollectionViewUpdater, redux. 2023-01-04 14:26:44 -08:00
Harry
120c7ebd8e
Revert "Adopt MediaGalleryCollectionViewUpdater"
This reverts commit e8f21942d5.
2022-12-23 14:00:28 -08:00
george-signal
e8f21942d5
Adopt MediaGalleryCollectionViewUpdater 2022-12-20 17:26:30 -08:00
george-signal
7a49a0fa82
Adopt JournalingOrderedDictionary. (#5405)
This change also moves mutation to the ordered
dictionary into a separate queue. There is no
change to behavior yet because the queue is only
dispatched to synchronously so far. Doing this
forces changes to how database transactions are
acquired since they must be used on the same queue
where they orignated.
2022-11-16 17:31:23 -08:00
george-signal
9956f148de
Move impl into State (#5345)
In order to get the most out of struct method
mutability annotations, move the code that
modifies MediaGallerySections.State into State.
The remaining methods in MediaGallerySections are
wafer-thin wrappers. Eventually
MediaGallerySections will justify its existence by
managing two instances of state.
2022-11-04 15:48:27 -07:00
george-signal
b9e8235d30
Store rowid for each item in MediaGallerySections
* Encapsulate mutable state of MediaGallerySections.

This is the first baby step toward imbuing
MediaGallerySections with multi-version
concurrency.

* Store rowid for each item in MediaGallerySections

This is necessary for forthcoming asynchronicity
as well as to correct existing problems where an
IndexPath is used as an identifier for an item.
IndexPath is a bad identifier because a database
change can invalidate it at any time. This will be
needed, for example, by an async ensureItemLoaded
method.
2022-11-04 15:23:14 -07:00
Evan Hahn
370ff654e7
Change license to AGPL
Change license to AGPL

This commit:

- Updates the `LICENSE` file

- Start every file with something like:

      // Copyright YEAR_FIRST_PUBLISHED Signal Messenger, LLC
      // SPDX-License-Identifier: AGPL-3.0-only

---

First, I removed existing license headers with this Ruby 3.1.2 script:

    require 'set'

    EXTENSIONS_TO_CHECK = Set['.h', '.hpp', '.cpp', '.m', '.mm', '.pch', '.swift']

    same = 0
    different = 0

    all_files = `git ls-files`.lines.map { |line| line.strip }
    all_files.each do |relative_path|
      if relative_path == 'Pods'
        next
      end

      unless EXTENSIONS_TO_CHECK.include? File.extname(relative_path)
        next
      end

      path = File.expand_path(relative_path)

      contents = File.read(path)
      new_contents = contents.sub(/\/\/\n\/\/  Copyright .*\n\/\/\n\n/, '')

      if contents == new_contents
        same += 1
      else
        different += 1
      end

      File.write(path, new_contents)
    end

    puts "updated #{different} file(s), left #{same} untouched"

I'm sure this script could be improved, but it worked well enough.

Then, I created `Scripts/lint/lint-license-headers` and ran it to auto-
fix a lot of files. This changed the mode of some files, but I think
that's actually desirable. For example,
`SignalServiceKit/src/Util/AppContext.m` previously had a mode of
`0755/-rwxr-xr-x`, and it's now `0644/-rw-r--r--`.

Then I fixed some stragglers and updated the precommit script.

See [a similar change in the Desktop app][0].

[0]: 8bfaf598af
2022-10-13 08:25:37 -05:00
Jordan Rose
bb7d5892d9
MediaGallery: Separate the loading logic into MediaGallerySections (take two)
Re-applies 4e37af097b and ecd0740c7d after further testing and cleanup.
2022-08-24 10:46:29 -07:00
Jordan Rose
182e97f02c Revert "MediaGallery: Separate the lazy loading logic into a testable MediaGallerySections"
This reverts commit 4e37af097b.
2022-05-10 10:34:57 -07:00
Jordan Rose
4e37af097b
MediaGallery: Separate the lazy loading logic into a testable MediaGallerySections
MediaGallery models a list of GalleryDate-based sections (in practice, months), each of which has a certain number of items. Sections are loaded on demand (that is, there may be newer and older sections that are not in the model), and always know their number of items. Items are also loaded on demand, potentially non-contiguously. This model is designed around the needs of UICollectionView (a thread's All Media view), but it also supports flat views of media (swiping between items in the media detail view, which can cross album boundaries).

This model is a result of refactoring I did last year to improve the performance and UX of the All Media view, but the implementation in MediaGallery.swift is entangled with the actual attachments and messages in the database, making it hard to test. This commit pulls the state management part out into its own struct, MediaGallerySections, which wraps the OrderedDictionary of items-by-section. Our MediaGalleryItem model references TSAttachmentStream directly and our queries go straight to the database, so to avoid having to set up real attachments in testing, MediaGallerySections is generic over a loader (delegate? data source?) of items with "gallery dates" and unique IDs. Now all the basic section- and item-loading APIs can be unit-tested.
2022-05-09 18:04:12 -07:00