Skip to content
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

BAL-XX-GP-CSV-Data #151

Merged
merged 3 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 38 additions & 9 deletions Balance/Distraction/Gallery/LookImages/ImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ struct ImageView: View {
@State private var strMsg = ""
@State private var imgMsg = ""
@State var selectedCategory: Category

@State var tapRemove = false
@State var tapUnLike = false
@State var tapReturn = false
@State var tapLike = false
@State var tapDislike = false

var body: some View {
ActivityLogContainer {
ZStack {
Expand Down Expand Up @@ -118,6 +123,11 @@ struct ImageView: View {
removeFrom(type: "FavoritesArray", name: selected.name)
removeFrom(type: "RemovedArray", name: selected.name)
removeFrom(type: "UploadedArray", name: selected.name)

tapRemove = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
tapRemove = false
}
}) {
Image(systemName: "trash.fill")
.resizable()
Expand All @@ -130,8 +140,9 @@ struct ImageView: View {
.accessibilityLabel("trash.fill")
.scaleEffect(scaleValue)
.tint(primaryColor)
.scaleEffect(tapRemove ? 1.2 : 1)
.animation(.spring(), value: tapRemove)
}
.buttonStyle(ScaleButtonStyle())
.buttonStyle(ActivityLogButtonStyle(activityDescription: "IMAGE REVIEW: " + selected.name + " status: DELETE"))
}

Expand All @@ -143,6 +154,10 @@ struct ImageView: View {
self.imgMsg = "xmark.circle.fill"
removeFrom(type: "FavoritesArray", name: selected.name)
appendFrom(type: "RemovedArray", photo: selected)
tapDislike = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
tapDislike = false
}
}) {
Image("crossImage")
.resizable()
Expand All @@ -153,10 +168,10 @@ struct ImageView: View {
.clipShape(Circle())
.shadow(color: Color.black.opacity(0.50), radius: 3, x: 0, y: 2)
.accessibilityLabel("crossImage")
.scaleEffect(scaleValue)
.scaleEffect(tapDislike ? 1.2 : 1)
.animation(.spring(), value: tapDislike)
}
.buttonStyle(ScaleButtonStyle())
.buttonStyle(ActivityLogButtonStyle(activityDescription: "IMAGE REVIEW: " + selected.id + "status: REMOVED"))
.buttonStyle(ActivityLogButtonStyle(activityDescription: "IMAGE REVIEW: " + selected.id + " status: REMOVED"))
}

var likeAction: some View {
Expand All @@ -166,6 +181,10 @@ struct ImageView: View {
self.strMsg = "Added!"
self.imgMsg = "heart.fill"
appendFrom(type: "FavoritesArray", photo: selected)
tapLike = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
tapLike = false
}
}) {
Image("heartImage")
.resizable()
Expand All @@ -176,9 +195,9 @@ struct ImageView: View {
.clipShape(Circle())
.shadow(color: Color.black.opacity(0.50), radius: 3, x: 0, y: 2)
.accessibilityLabel("heartImage")
.scaleEffect(scaleValue)
.scaleEffect(tapLike ? 1.2 : 1)
.animation(.spring(), value: tapLike)
}
.buttonStyle(ScaleButtonStyle())
.buttonStyle(ActivityLogButtonStyle(activityDescription: "IMAGE REVIEW: " + selected.name + " status: FAVORITE"))
}

Expand All @@ -189,6 +208,10 @@ struct ImageView: View {
self.strMsg = "Removed from favorites!"
self.imgMsg = "heart.slash.fill"
removeFrom(type: "FavoritesArray", name: selected.name)
tapUnLike = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
tapUnLike = false
}
}) {
Image(systemName: "heart.slash.fill")
.resizable()
Expand All @@ -201,8 +224,9 @@ struct ImageView: View {
.accessibilityLabel("heart.slash.fill")
.scaleEffect(scaleValue)
.tint(primaryColor)
.scaleEffect(tapUnLike ? 1.2 : 1)
.animation(.spring(), value: tapUnLike)
}
.buttonStyle(ScaleButtonStyle())
.buttonStyle(ActivityLogButtonStyle(activityDescription: "IMAGE REVIEW: " + selected.name + " status: UNLIKE"))
}

Expand All @@ -213,6 +237,10 @@ struct ImageView: View {
self.strMsg = "Return to list!"
self.imgMsg = "arrowshape.turn.up.backward.circle.fill"
removeFrom(type: "RemovedArray", name: selected.name)
tapReturn = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
tapReturn = false
}
}) {
Image(systemName: "arrowshape.turn.up.backward.circle.fill")
.resizable()
Expand All @@ -225,8 +253,9 @@ struct ImageView: View {
.accessibilityLabel("backImage")
.scaleEffect(scaleValue)
.tint(primaryColor)
.scaleEffect(tapReturn ? 1.2 : 1)
.animation(.spring(), value: tapReturn)
}
.buttonStyle(ScaleButtonStyle())
.buttonStyle(ActivityLogButtonStyle(activityDescription: "IMAGE REVIEW: " + selected.name + " status: RETURN"))
}

Expand Down
4 changes: 2 additions & 2 deletions Balance/Profile/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ struct ProfileView: View {

func convertToCSV() -> String {
var noteAsCSV = ""
noteAsCSV.append(contentsOf: "time, description\n")
noteAsCSV.append(contentsOf: "id, startTime, endTime, duration, actionTime, actionDescription\n")

for log in logStore.logs {
for action in log.actions {
noteAsCSV.append(contentsOf: "\"\(action.time)\",\"\(action.description)\"\n")
noteAsCSV.append(contentsOf: "\"\(log.id)\",\"\(log.startTime)\",\"\(log.endTime)\",\"\(log.duration)\",\"\(action.time)\",\"\(action.description)\"\n")
}
}

Expand Down