5720: Remove useless color, fix some issue with AvatarImage border

This commit is contained in:
MaximeE
2022-03-24 11:00:29 +01:00
parent ce0893bb37
commit 8e6ae3a667
14 changed files with 44 additions and 65 deletions
@@ -36,9 +36,9 @@ struct LocationSharingMarkerView<Content: View>: View {
.rotation(Angle(degrees: 45))
.fill(backgroundColor)
.frame(width: 7, height: 7)
.offset(x: 0, y: 22)
.offset(x: 0, y: 21)
markerImage
.frame(width: 42, height: 42)
.frame(width: 40, height: 40)
}
}
}
@@ -53,12 +53,12 @@ struct LocationSharingUserMarkerView_Previews: PreviewProvider {
displayName: "Alice")
VStack(alignment: .center, spacing: 15) {
LocationSharingMarkerView(backgroundColor: .green) {
AvatarImage(avatarData: avatarData, size: nil)
.shapedBorder(color: Color.green, borderWidth: 3, shape: Circle())
AvatarImage(avatarData: avatarData, size: .medium)
.border()
}
LocationSharingMarkerView(backgroundColor: .green) {
AvatarImage(avatarData: avatarData, size: nil)
.shapedBorder(color: Color.green, borderWidth: 3, shape: Circle())
AvatarImage(avatarData: avatarData, size: .medium)
.border()
}
}
}
@@ -49,18 +49,20 @@ struct LocationSharingOptionButton_Previews: PreviewProvider {
LocationSharingOptionButton(text: VectorL10n.locationSharingStaticShareTitle) {
} buttonIcon: {
AvatarImage(avatarData: AvatarInput(mxContentUri: nil, matrixItemId: "Alice", displayName: "Alice"), size: nil)
.shapedBorder(color: Color.green, borderWidth: 3, shape: Circle())
AvatarImage(avatarData: AvatarInput(mxContentUri: nil, matrixItemId: "Alice", displayName: "Alice"), size: .medium)
.border()
}
LocationSharingOptionButton(text: VectorL10n.locationSharingLiveShareTitle) {
} buttonIcon: {
Image(uiImage: Asset.Images.locationLiveIcon.image)
.resizable()
}
LocationSharingOptionButton(text: VectorL10n.locationSharingPinDropShareTitle) {
} buttonIcon: {
Image(uiImage: Asset.Images.locationPinIcon.image)
.resizable()
}
}
}
@@ -91,8 +91,8 @@ struct LocationSharingView: View {
LocationSharingOptionButton(text: VectorL10n.locationSharingStaticShareTitle) {
context.send(viewAction: .share)
} buttonIcon: {
AvatarImage(avatarData: context.viewState.userAvatarData, size: nil)
.shapedBorder(color: theme.displayUserColor(for: context.viewState.userAvatarData.matrixItemId), borderWidth: 3, shape: Circle())
AvatarImage(avatarData: context.viewState.userAvatarData, size: .medium)
.border()
}
.disabled(!context.viewState.shareButtonEnabled)
// Hide for now until live location sharing is finished
@@ -101,6 +101,7 @@ struct LocationSharingView: View {
// TODO: - Start live location sharing
} buttonIcon: {
Image(uiImage: Asset.Images.locationLiveIcon.image)
.resizable()
}
.disabled(!context.viewState.shareButtonEnabled)
}
@@ -109,6 +110,7 @@ struct LocationSharingView: View {
// TODO: - Pin drop sharing action
} buttonIcon: {
Image(uiImage: Asset.Images.locationPinIcon.image)
.resizable()
}
.disabled(!context.viewState.shareButtonEnabled)
}
@@ -131,6 +133,9 @@ struct LocationSharingView: View {
struct LocationSharingView_Previews: PreviewProvider {
static let stateRenderer = MockLocationSharingScreenState.stateRenderer
static var previews: some View {
stateRenderer.screenGroup()
Group {
stateRenderer.screenGroup().theme(.light).preferredColorScheme(.light)
stateRenderer.screenGroup().theme(.dark).preferredColorScheme(.dark)
}
}
}
@@ -49,9 +49,9 @@ class UserLocationAnnotatonView: MGLUserLocationAnnotationView {
private func addUserMarkerView(with avatarData: AvatarInputProtocol) {
guard let avatarImageView = UIHostingController(rootView: LocationSharingMarkerView(backgroundColor: theme.displayUserColor(for: avatarData.matrixItemId)) {
AvatarImage(avatarData: avatarData, size: nil)
.shapedBorder(color: theme.displayUserColor(for: avatarData.matrixItemId), borderWidth: 3, shape: Circle())
guard let avatarImageView = UIHostingController(rootView: LocationSharingMarkerView(backgroundColor: theme.userColor(for: avatarData.matrixItemId)) {
AvatarImage(avatarData: avatarData, size: .medium)
.border()
}).view else {
return
}