Change image avatars
This commit is contained in:
parent
d8aa3db3ee
commit
89702c6e42
|
@ -51,7 +51,7 @@ public class HomeTimelineService {
|
|||
|
||||
// Retrieve newest visible status (last visible by user).
|
||||
let dbNewestStatus = StatusDataHandler.shared.getMaximumStatus(accountId: account.id, viewContext: backgroundContext)
|
||||
let lastSeenStatusId = dbNewestStatus?.rebloggedStatusId ?? dbNewestStatus?.id
|
||||
let lastSeenStatusId = dbNewestStatus?.id
|
||||
|
||||
// Refresh/load home timeline (refreshing on top downloads always first 40 items).
|
||||
// When Apple introduce good way to show new items without scroll to top then we can change that method.
|
||||
|
|
|
@ -64,10 +64,19 @@ struct ImageRowItem: View {
|
|||
ImageAvatar(displayName: self.status.accountDisplayName,
|
||||
avatarUrl: self.status.accountAvatar,
|
||||
rebloggedAccountDisplayName: self.status.rebloggedAccountDisplayName,
|
||||
rebloggedAccountAvatar: self.status.rebloggedAccountAvatar) {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.status.accountId,
|
||||
accountDisplayName: self.status.accountDisplayName,
|
||||
accountUserName: self.status.accountUsername))
|
||||
rebloggedAccountAvatar: self.status.rebloggedAccountAvatar) { isAuthor in
|
||||
if isAuthor {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.status.accountId,
|
||||
accountDisplayName: self.status.accountDisplayName,
|
||||
accountUserName: self.status.accountUsername))
|
||||
} else {
|
||||
if let rebloggedAccountId = self.status.rebloggedAccountId,
|
||||
let rebloggedAccountUsername = self.status.rebloggedAccountUsername {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: rebloggedAccountId,
|
||||
accountDisplayName: self.status.rebloggedAccountDisplayName,
|
||||
accountUserName: rebloggedAccountUsername))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
|
@ -147,10 +156,19 @@ struct ImageRowItem: View {
|
|||
ImageAvatar(displayName: self.status.accountDisplayName,
|
||||
avatarUrl: self.status.accountAvatar,
|
||||
rebloggedAccountDisplayName: self.status.rebloggedAccountDisplayName,
|
||||
rebloggedAccountAvatar: self.status.rebloggedAccountAvatar) {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.status.accountId,
|
||||
accountDisplayName: self.status.accountDisplayName,
|
||||
accountUserName: self.status.accountUsername))
|
||||
rebloggedAccountAvatar: self.status.rebloggedAccountAvatar) { isAuthor in
|
||||
if isAuthor {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.status.accountId,
|
||||
accountDisplayName: self.status.accountDisplayName,
|
||||
accountUserName: self.status.accountUsername))
|
||||
} else {
|
||||
if let rebloggedAccountId = self.status.rebloggedAccountId,
|
||||
let rebloggedAccountUsername = self.status.rebloggedAccountUsername {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: rebloggedAccountId,
|
||||
accountDisplayName: self.status.rebloggedAccountDisplayName,
|
||||
accountUserName: rebloggedAccountUsername))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImageFavourite(isFavourited: $isFavourited)
|
||||
|
|
|
@ -69,10 +69,19 @@ struct ImageRowItemAsync: View {
|
|||
ImageAvatar(displayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
avatarUrl: self.statusViewModel.account.avatar,
|
||||
rebloggedAccountDisplayName: self.statusViewModel.reblogStatus?.account.displayNameWithoutEmojis,
|
||||
rebloggedAccountAvatar: self.statusViewModel.reblogStatus?.account.avatar) {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.statusViewModel.account.id,
|
||||
accountDisplayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
accountUserName: self.statusViewModel.account.acct))
|
||||
rebloggedAccountAvatar: self.statusViewModel.reblogStatus?.account.avatar) { isAuthor in
|
||||
if isAuthor {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.statusViewModel.account.id,
|
||||
accountDisplayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
accountUserName: self.statusViewModel.account.acct))
|
||||
} else {
|
||||
if let rebloggedAccountId = self.statusViewModel.reblogStatus?.account.id,
|
||||
let rebloggedAccountUsername = self.statusViewModel.reblogStatus?.account.acct {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: rebloggedAccountId,
|
||||
accountDisplayName: self.statusViewModel.reblogStatus?.account.displayNameWithoutEmojis,
|
||||
accountUserName: rebloggedAccountUsername))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,10 +156,19 @@ struct ImageRowItemAsync: View {
|
|||
ImageAvatar(displayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
avatarUrl: self.statusViewModel.account.avatar,
|
||||
rebloggedAccountDisplayName: self.statusViewModel.reblogStatus?.account.displayNameWithoutEmojis,
|
||||
rebloggedAccountAvatar: self.statusViewModel.reblogStatus?.account.avatar) {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.statusViewModel.account.id,
|
||||
accountDisplayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
accountUserName: self.statusViewModel.account.acct))
|
||||
rebloggedAccountAvatar: self.statusViewModel.reblogStatus?.account.avatar) { isAuthor in
|
||||
if isAuthor {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: self.statusViewModel.account.id,
|
||||
accountDisplayName: self.statusViewModel.account.displayNameWithoutEmojis,
|
||||
accountUserName: self.statusViewModel.account.acct))
|
||||
} else {
|
||||
if let rebloggedAccountId = self.statusViewModel.reblogStatus?.account.id,
|
||||
let rebloggedAccountUsername = self.statusViewModel.reblogStatus?.account.acct {
|
||||
self.routerPath.navigate(to: .userProfile(accountId: rebloggedAccountId,
|
||||
accountDisplayName: self.statusViewModel.reblogStatus?.account.displayNameWithoutEmojis,
|
||||
accountUserName: rebloggedAccountUsername))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ public struct ContentWarning<Content: View, Blurred: View>: View {
|
|||
.transition(.opacity)
|
||||
|
||||
VStack(alignment: .trailing) {
|
||||
Spacer()
|
||||
HStack(alignment: .bottom) {
|
||||
HStack(alignment: .top) {
|
||||
Spacer()
|
||||
Button {
|
||||
withAnimation {
|
||||
|
@ -41,10 +40,12 @@ public struct ContentWarning<Content: View, Blurred: View>: View {
|
|||
.font(.system(size: 18))
|
||||
.foregroundColor(.white.opacity(0.8))
|
||||
.shadow(color: Color.black, radius: 1)
|
||||
.padding([.top, .bottom, .leading], 12)
|
||||
.padding(.top, 11)
|
||||
.padding(.trailing, 16)
|
||||
.padding([.bottom, .leading], 16)
|
||||
}
|
||||
}
|
||||
.padding(.trailing, 64)
|
||||
Spacer()
|
||||
}
|
||||
.foregroundColor(.mainTextColor)
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ public struct ImageAvatar: View {
|
|||
private let avatarUrl: URL?
|
||||
private let rebloggedAccountDisplayName: String?
|
||||
private let rebloggedAccountAvatar: URL?
|
||||
private let onTap: () -> Void
|
||||
private let onTap: (Bool) -> Void
|
||||
|
||||
public init(displayName: String?, avatarUrl: URL?, rebloggedAccountDisplayName: String?, rebloggedAccountAvatar: URL?, onTap: @escaping () -> Void) {
|
||||
public init(displayName: String?, avatarUrl: URL?, rebloggedAccountDisplayName: String?, rebloggedAccountAvatar: URL?, onTap: @escaping (Bool) -> Void) {
|
||||
self.displayName = displayName
|
||||
self.avatarUrl = avatarUrl
|
||||
self.rebloggedAccountAvatar = rebloggedAccountAvatar
|
||||
|
@ -28,26 +28,24 @@ public struct ImageAvatar: View {
|
|||
|
||||
public var body: some View {
|
||||
if self.applicationState.showAvatarsOnTimeline {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
HStack(alignment: .center) {
|
||||
LazyImage(url: avatarUrl) { state in
|
||||
if let image = state.image {
|
||||
self.buildAvatar(image: image)
|
||||
} else if state.isLoading {
|
||||
self.buildAvatar()
|
||||
} else {
|
||||
self.buildAvatar()
|
||||
}
|
||||
VStack(alignment: .leading, spacing: 0){
|
||||
HStack(alignment: .center, spacing: 0) {
|
||||
HStack(alignment: .center, spacing: 4) {
|
||||
UserAvatar(accountAvatar: avatarUrl, size: .mini)
|
||||
Text(displayName ?? "")
|
||||
.fontWeight(.semibold)
|
||||
.lineLimit(1)
|
||||
.padding(.trailing, 8)
|
||||
}
|
||||
.font(.footnote)
|
||||
.foregroundColor(.white.opacity(0.8))
|
||||
.background(.black.opacity(0.4))
|
||||
.clipShape(Capsule())
|
||||
.padding(.leading, 8)
|
||||
.padding(.top, 8)
|
||||
.onTapGesture {
|
||||
self.onTap(true)
|
||||
}
|
||||
|
||||
Text(displayName ?? "")
|
||||
.lineLimit(1)
|
||||
.font(.system(size: 15))
|
||||
.foregroundColor(.white.opacity(0.8))
|
||||
.fontWeight(.semibold)
|
||||
.shadow(color: .black, radius: 2)
|
||||
|
||||
Spacer()
|
||||
|
||||
if let rebloggedAccountAvatar = self.rebloggedAccountAvatar,
|
||||
let rebloggedAccountDisplayName = self.rebloggedAccountDisplayName {
|
||||
|
@ -62,16 +60,17 @@ public struct ImageAvatar: View {
|
|||
.foregroundColor(.white.opacity(0.8))
|
||||
.background(.black.opacity(0.4))
|
||||
.clipShape(Capsule())
|
||||
.padding(.leading, 32)
|
||||
.padding(.leading, 8)
|
||||
.padding(.top, 8)
|
||||
.onTapGesture {
|
||||
self.onTap(false)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding(8)
|
||||
.onTapGesture {
|
||||
self.onTap()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.trailing, 58)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue