Skip to content

Commit

Permalink
Update Chat.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
milchchan committed Nov 17, 2024
1 parent 84c7a52 commit 0681815
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions Apricot/Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,8 @@ struct Chat: View {
}
}
}) {
HStack(alignment: .center, spacing: 16.0) {
if checked > 0 {
if checked > 0 {
HStack(alignment: .center, spacing: 16.0) {
Image(systemName: "checkmark")
.frame(
width: 16.0,
Expand All @@ -679,9 +679,18 @@ struct Chat: View {
.system(size: 16.0)
)
.bold()
.transition(AnyTransition.opacity.combined(with: .scale))
Text(type)
.foregroundColor(Color(UIColor {
$0.userInterfaceStyle == .dark ? UIColor(white: 1.0, alpha: 1.0) : UIColor(white: 0.0, alpha: 1.0)
}))
.font(.subheadline)
.fontWeight(.semibold)
.lineLimit(1)
.truncationMode(.tail)
.textCase(.uppercase)
}

.transition(.opacity.animation(.linear(duration: 0.5)))
} else {
Text(type)
.foregroundColor(Color(UIColor {
$0.userInterfaceStyle == .dark ? UIColor(white: 1.0, alpha: 1.0) : UIColor(white: 0.0, alpha: 1.0)
Expand All @@ -691,6 +700,7 @@ struct Chat: View {
.lineLimit(1)
.truncationMode(.tail)
.textCase(.uppercase)
.transition(.opacity.animation(.linear(duration: 0.5)))
}
}
.frame(
Expand Down Expand Up @@ -2212,20 +2222,16 @@ struct Stage: UIViewRepresentable {
self.parent.attributes.removeAll()
self.parent.types = 0
self.parent.choices.removeAll()
self.parent.intensity = 0.5
self.parent.permissions.removeAll()
self.intensities.removeAll()

withAnimation {
self.parent.likability = nil
}
}

func agentDidChange(_ agent: AgentView) {
let nowDateComponents = Calendar.current.dateComponents([.calendar, .timeZone, .era, .year, .month, .day], from: Date(timeIntervalSinceNow: -60 * 60 * 24 * 7))
let thresholdDate = DateComponents(calendar: nowDateComponents.calendar, timeZone: nowDateComponents.timeZone, era: nowDateComponents.era, year: nowDateComponents.year, month: nowDateComponents.month, day: nowDateComponents.day, hour: 0, minute: 0, second: 0, nanosecond: 0).date ?? Date(timeIntervalSince1970: 0.0)

self.parent.attributes.append(contentsOf: agent.attributes)
self.parent.intensity = 0.5
self.intensities.removeAll()

for characterView in agent.characterViews {
if let name = characterView.name, let likes = Script.shared.likes[name] {
Expand All @@ -2244,6 +2250,7 @@ struct Stage: UIViewRepresentable {
}

withAnimation {
self.parent.likability = nil
self.parent.changing = false
}

Expand Down

0 comments on commit 0681815

Please sign in to comment.