-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add live location status view in the snapshot view
- Loading branch information
1 parent
533e331
commit 2f4a35a
Showing
6 changed files
with
93 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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: 0 additions & 26 deletions
26
...stomAttachments/LocationAttachment/LocationAttachmentPayload+AttachmentViewProvider.swift
This file was deleted.
Oops, something went wrong.
This file contains 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 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
54 changes: 54 additions & 0 deletions
54
...treamChat/Components/CustomAttachments/LocationAttachment/LocationSharingStatusView.swift
This file contains 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,54 @@ | ||
// | ||
// Copyright © 2025 Stream.io Inc. All rights reserved. | ||
// | ||
|
||
import StreamChat | ||
import StreamChatUI | ||
import UIKit | ||
|
||
class LocationSharingStatusView: _View, ThemeProvider { | ||
private lazy var statusLabel: UILabel = { | ||
let label = UILabel() | ||
label.translatesAutoresizingMaskIntoConstraints = false | ||
label.font = appearance.fonts.footnote | ||
label.textColor = appearance.colorPalette.subtitleText | ||
return label | ||
}() | ||
|
||
private var activeSharingImage: UIImage? = UIImage( | ||
systemName: "location.fill", | ||
withConfiguration: UIImage.SymbolConfiguration(scale: .medium) | ||
) | ||
|
||
private var inactiveSharingImage: UIImage? = UIImage( | ||
systemName: "location.slash.fill", | ||
withConfiguration: UIImage.SymbolConfiguration(scale: .medium) | ||
) | ||
|
||
private lazy var iconImageView: UIImageView = { | ||
let imageView = UIImageView() | ||
imageView.translatesAutoresizingMaskIntoConstraints = false | ||
imageView.contentMode = .scaleAspectFit | ||
imageView.image = activeSharingImage | ||
return imageView | ||
}() | ||
|
||
override func setUpLayout() { | ||
super.setUpLayout() | ||
|
||
let container = HContainer(spacing: 4, alignment: .center) { | ||
iconImageView | ||
.width(16) | ||
.height(16) | ||
statusLabel | ||
}.embed(in: self) | ||
} | ||
|
||
func updateStatus(isSharing: Bool) { | ||
statusLabel.text = isSharing ? "Live location active" : "Live location ended" | ||
iconImageView.image = isSharing ? activeSharingImage : inactiveSharingImage | ||
iconImageView.tintColor = isSharing | ||
? appearance.colorPalette.accentPrimary | ||
: appearance.colorPalette.subtitleText | ||
} | ||
} |
This file contains 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