-
Notifications
You must be signed in to change notification settings - Fork 24
feat(chat bubbles): reactively update sender name - WPB-19514 #3455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dmitrysimkin
wants to merge
51
commits into
develop
Choose a base branch
from
feature/CB-4-update-sender-name
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
3993646
Added initial classes
dmitrysimkin fbbae89
Add preview app
dmitrysimkin 7564174
Make VM be main actor
dmitrysimkin d5e5677
Added model and datasource
dmitrysimkin 22b78bb
Code style
dmitrysimkin 7563f13
Added way to add messages
dmitrysimkin 45ce965
Code style
dmitrysimkin 3f3270d
Generate with domain models and map to VMs
dmitrysimkin a9aa4ae
Format
dmitrysimkin a9cdbba
Add more comments and improve code
dmitrysimkin 378a48f
Add some more comments
dmitrysimkin 748c81a
Fixed build error
dmitrysimkin 6029bac
Load real messages
dmitrysimkin 4d96548
Access modificator
dmitrysimkin d5305e9
Get rid of UICOllectionView custom class
dmitrysimkin 026afa9
Use background context to load messages from DB
dmitrysimkin 9685eb0
Format
dmitrysimkin 9d914d8
Code style
dmitrysimkin 5e93e67
Remove identifiable
dmitrysimkin b40004f
Fixed memory leak
dmitrysimkin 14b08b7
Format
dmitrysimkin f23d876
Added new message
dmitrysimkin f3c3142
Address PR comments
dmitrysimkin 2443d4c
Make possible to pass sender changed publisher
dmitrysimkin e2deaaf
Format
dmitrysimkin 8262a57
Use sync context to get notified when other send messages
dmitrysimkin 9aa6e34
Fixed crash on scrolling
dmitrysimkin ecc1511
Code style
dmitrysimkin 4c1316f
Merge branch 'feature/CB-3-handle-message-send-WPB-19373' into featur…
dmitrysimkin 4a1df1f
Reworked to have name publisher and attributed string
dmitrysimkin 4965f87
Subscribe to real sender name changes
dmitrysimkin ee901e0
Improve signatures
dmitrysimkin c17716b
Rename
dmitrysimkin 4179871
Optimise making SenderObserver
dmitrysimkin eceae73
Rename
dmitrysimkin 6d0e7ea
Format
dmitrysimkin c2f5166
Merge branch 'develop' into feature/CB-load-real-messages-WPB-19328
dmitrysimkin 0d8ae4d
Merge branch 'develop' into feature/CB-load-real-messages-WPB-19328
dmitrysimkin 2a9da12
Merge branch 'feature/CB-load-real-messages-WPB-19328' into feature/C…
dmitrysimkin 3107cd6
Merge branch 'feature/CB-3-handle-message-send-WPB-19373' into featur…
dmitrysimkin a4b048a
Removed not need complextity
dmitrysimkin 4472d45
Format
dmitrysimkin bc0b177
Merge branch 'develop' into feature/CB-3-handle-message-send-WPB-19373
dmitrysimkin 56e0cb0
Remove prints
dmitrysimkin 62392a0
Merge branch 'feature/CB-3-handle-message-send-WPB-19373' into featur…
dmitrysimkin 3e2752f
Merge branch 'develop' into feature/CB-3-handle-message-send-WPB-19373
dmitrysimkin e5356aa
Fixed build issue
dmitrysimkin c869591
Merge branch 'feature/CB-3-handle-message-send-WPB-19373' into featur…
dmitrysimkin e12c337
Merge branch 'develop' into feature/CB-4-update-sender-name
dmitrysimkin 419681f
Merge branch 'develop' into feature/CB-4-update-sender-name
netbe fd8d8e6
Merge branch 'develop' into feature/CB-4-update-sender-name
netbe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
WireMessaging/Sources/WireMessagingDomain/SenderNamePublisherProvider.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Wire | ||
// Copyright (C) 2025 Wire Swiss GmbH | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see http://www.gnu.org/licenses/. | ||
// | ||
|
||
import Foundation | ||
public import Combine | ||
|
||
public protocol SenderNameObserverProtocol { | ||
var authorChangedPublisher: AnyPublisher<String, Never>? { get } | ||
} | ||
|
||
public typealias SenderNameObserverProvider = (UserModel?) -> (any SenderNameObserverProtocol)? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,18 +16,27 @@ | |
// along with this program. If not, see http://www.gnu.org/licenses/. | ||
// | ||
|
||
import Foundation | ||
package import Foundation | ||
package import Combine | ||
|
||
class SenderViewModel: ObservableObject { | ||
package class SenderViewModel: ObservableObject { | ||
|
||
enum State { | ||
package enum State { | ||
case empty | ||
case exists(AttributedString) | ||
} | ||
|
||
@Published var state: State | ||
|
||
init(state: State) { | ||
private var cancellables: Set<AnyCancellable> = [] | ||
|
||
package init( | ||
state: State, | ||
namePublisher: AnyPublisher<String, Never>? | ||
) { | ||
self.state = state | ||
namePublisher?.sink { [weak self] name in | ||
self?.state = .exists(AttributedString(name)) | ||
}.store(in: &cancellables) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: no risk of having a binding still active when a view is reused ? probably works differently in SwiftUI but on UIKit we could have these issues with reusable cells if we didn't clear out the subscriptions which could mess the UI. |
||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.