Commit ba80a94
Add Static Location and Live Location Support (#3531)
* Add static and live location payloads
* Update the demo app to use static location attachment
* Add new `ChannelController.sendStaticLocation()` to instantly send a location message to a channel
* Change the Demo App to send the current location instead of dummy ones
* Add location background mode to Demo App
* Add staticLocation to the attachments register
* Create a CurrentUserLocationProvider to make it easier to fetch the current user location
* Fix not being able to part live location payload
* Update DemoApp to support live location attachments
* Add support for partial message update in MessageUpdater
* Expose the Throttler (Revert this, and use it internally)
* Add `shareLiveLocation()` and `stopLiveLocation()` to `ChannelController`
* Refactor logic to fetch current active locations + Improve API
* Add extra data to location attachment payloads
* Add `LocationAttachmentInfo` to be used as argument
* Add `text` to partial message update endpoint
* Add `ChatMessageController.updateMessage()` to support partially updating a message
* Change location live updates APIs
* Improve Demo App Location Provider
* Improve API by observing active live locations messages
* Fixed starting monitoring location whenever an active location was updated
* Make the API even easier and add additional delegate methods to know when the user should start and stop location sharing
* Move the Throttler to LLC, just like the Debouncer
* Move the Throttling to the current user controller to automatically protect against abusive updates
* Some minor cleanups
* Simplify currentUserControllerDidStartSharingLiveLocation API
* Improve location attachment view
* Add live location map when tapping the live location attachmen
* Animate the user location tracking
* Optimal animation
* Optmizate animation smoothness and server spamm
* Add CoreData concurrency flag to StreamDevelopers scheme
* Fix crash when creating the MessageController from a background thread
* Fix snapshot chaching
* Fix map detail view controller not showing initial position
* Fix avatar view in map view
* Add pulse animation when live sharing
* Refactor LocationDetailViewController to only use the message controller
* Refactor code structure of the map detail view controller
* Add bottom sheet to stop location sharing
* Add stopLiveLocationSharing() to Message Controller
* Fix stop sharing button not working
* FIx bottom sheet logic
* Add static pin in detail view
* Fix sharing location for other users active location messages
* Finish logic for location snapshot view when static vs live
* Add live location status view in the snapshot view
* Minor cleanup
* Fix copyright
* Fix loading indicator snapshot view
* Remove support of mixed attachments to locations
* Add MessageEndpoints test coverage
* Add test coverage to message updater
* Add test coverage to Message Repository
* Add test coverage to message attachments extensions
* Add test coverage to parsing attachments
* Add test coverage to MessageDTO
* Add message updater mock
* ActiveLiveLocationAlreadyExists init should not be public
* Add test coverage to Message Controller
* Add test coverage to Channel Controller
* Fix concurrency issues when stopping and updating the live location at the same time
* Fix Message Controller Tests
* Change updateMessage -> partialUpdateMessage
* Add unset support for partial update message
* Update CHANGELOG.md
* Fix tests, not compiling because of unset
* Fix test_updatePartialMessage_makesCorrectAPICall
* Make `ChatMessageController.updateLiveLocation()` internal
* Update CHANGELOG.md
* Fix reloading the snapshot when not necesasry
* Fix avatar view showing for a split second in the snapshot view for static attachments
* Change location attachment to have dynamic height depending on message list size
* Extract avatar size in snapshot view
* Fix minor typo
* Add fixed width to map snapshot and simplify caching logic
* Use a banner view instead of a sheet in the map detail view
* Present the map instead of pushing when on iPad
* Add more documentation on how "Tracking" behaviour works
* Enable locations by default in the demo app
* Fix quote message for live location
* Fix location attachments should not be editable
* Do not show location attachment picker when inside thread
* Fix preview message for location attachments
* Fix detail map show Stop Sharing button for another user
* Disable locations feature by default
* Add experimental flag
* Update CHANGELOG.md
* Revert "Disable locations feature by default"
This reverts commit 0765272.
* Revert "Add experimental flag"
This reverts commit d06eda0.
* Revert "Update CHANGELOG.md"
This reverts commit 37bd1d1.
* Fix missing stuff from merge conflicts
* Update CHANGELOG.md
* Rename LocationAttachmentInfo to LocationInfo
* Add LocationDTO
* Update Atlantis
* Refactor to new SharedLocation object
* Demo App new Static Location integration
* Fix Merge Conflicts Errors
* Add new location endpoints
* Implement new stop live location sharing
* Remove stopLiveLocationSharing from ChannelController
* Implement optimistic stop live location sharing
* Add `CurrentUserController.loadLiveLocations()`
* Add new updateLiveLocation endpoint instead of using partial update message
* Migrate existing unit tests to the new implementation
* Fix not possible to open location detail view
* Remove unnecessary location optimistic update
* Auto-centering feature
* Fix sharing location of failed messages
* Fix stopping a live location not triggering didStopLiveLocationSharing delegate
* Update CHANGELOG.md
* Fix parsing active current active location messages
* Remove unused message updater in ChannelController
* Fix docs typo
* Add action sheet to select live location in the demo app
* Make atlantis version static
* Fix unit tests compilation
* Fix removeAllData test
* Remove `didChangeActiveLiveLocationMessages` since it is not needed for now
* Improve docs of current user controller
* Revert "Remove `didChangeActiveLiveLocationMessages` since it is not needed for now"
This reverts commit 37f4290.
# Conflicts:
# Sources/StreamChat/Controllers/CurrentUserController/CurrentUserController.swift
* Make sure live location is changed to not active when reaches the end
* Forward to the current user delegate event if there was an error updating live location
* Fix potential memory leak
* Use message updater directly in the current user controller
* Add option to provide location info from createNewMessage
* Only call didStartSharingLiveLocation or didStopSharingLiveLocation if are from the current device
* Handle multi device logic when updating live location sharing
* Revert Multi-Device logic for now
* Fix compilation tests
* Add message updater tests
* Add test coverage to loadAllActiveLiveLocations
* Add test coverage to use device Id when creating new live location message
* Update CHANGELOG.md
* Fix flaky test_stopLiveLocationSharing_apiFailure_revertsOptimisticUpdate
* Render endAt text in the location attachment images
* Fix not able to share 1min location
* Fix auto center button showing in static locations
* Add `channel.config.sharedLocationsEnabled`
* Add `canShareLocation` capability
* Add `ChatChannel.activeLiveLocations`
* Rename LocationDTO -> SharedLocationDTO
* Fix Channel.json typo
* Add `ActiveLiveLocationsEndTimeTracker` to track when the endAt is reached
* Fix concurrency issue in ActiveLiveLocationsEndTimeTracker
* Add missing properties to shared location
* Optimistically stop active live location when starting a new one
* Expose `CurrentUserController.activeLiveLocationMessages`
* Remove outdated comment
* Add test coverage to ActiveLiveLocationsEndTimeTracker
* Fix the ActiveLiveLocationsEndTimeTracker not triggering an UI Update
* Try to make test less flaky
* Add missing docs to `CurrentUserController.loadActiveLocationsMessages()`
---------
Co-authored-by: Alexey Alter-Pesotskiy <[email protected]>1 parent ad8e9fc commit ba80a94
File tree
84 files changed
+4022
-320
lines changed- DemoApp
- Screens
- AppConfigViewController
- StreamChat
- Components
- CustomAttachments
- LocationAttachment
- Sources/StreamChat
- APIClient/Endpoints
- Payloads
- Controllers
- ChannelController
- CurrentUserController
- MessageController
- Database
- DTOs
- StreamChatModel.xcdatamodeld/StreamChatModel.xcdatamodel
- Models
- Location
- Repositories
- Utils
- WebSocketClient/Events
- Workers
- Background
- StreamChat.xcodeproj
- TestTools/StreamChatTestTools
- Extensions/Unique
- Fixtures/JSONs
- Mocks
- Models + Extensions
- StreamChat
- Controllers
- Database
- Workers
- SpyPattern/Spy
- TestData/DummyData
- Tests/StreamChatTests
- APIClient/Endpoints
- Payloads
- Controllers
- ChannelController
- MessageController
- Database
- DTOs
- Models
- Repositories
- WebSocketClient/EventMiddlewares
- Workers
- Background
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
84 files changed
+4022
-320
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
7 | 24 | | |
8 | 25 | | |
9 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 5 | | |
16 | 6 | | |
17 | 7 | | |
| |||
30 | 20 | | |
31 | 21 | | |
32 | 22 | | |
| 23 | + | |
| 24 | + | |
33 | 25 | | |
34 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
35 | 43 | | |
36 | 44 | | |
37 | 45 | | |
| |||
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
| |||
70 | 82 | | |
71 | 83 | | |
72 | 84 | | |
73 | | - | |
74 | | - | |
75 | 85 | | |
76 | 86 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | 65 | | |
68 | 66 | | |
69 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
81 | 92 | | |
82 | 93 | | |
83 | 94 | | |
| |||
99 | 110 | | |
100 | 111 | | |
101 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
102 | 144 | | |
103 | 145 | | |
104 | 146 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
0 commit comments