Skip to content

Commit

Permalink
Cleanup for handover (#62)
Browse files Browse the repository at this point in the history
# Cleanup for handover


## ⚙️ Release Notes 
* Minor adjustments within the app to have it ready for handover.


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
Supereg authored Mar 19, 2024
1 parent 33404b4 commit 955fd37
Show file tree
Hide file tree
Showing 65 changed files with 1,709 additions and 2,136 deletions.
3 changes: 0 additions & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,6 @@ only_rules:
# The variable should be placed on the left, the constant on the right of a comparison operator.
- yoda_condition

attributes:
attributes_with_arguments_always_on_line_above: false

deployment_target: # Availability checks or attributes shouldn’t be using older versions that are satisfied by the deployment target.
iOSApplicationExtension_deployment_target: 16.0
iOS_deployment_target: 16.0
Expand Down
271 changes: 151 additions & 120 deletions PICS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"originHash" : "e3a25241397786f0f92600126ae926c27c41f21b0197ca6b9a97681904c02778",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down Expand Up @@ -140,8 +141,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/ResearchKit",
"state" : {
"revision" : "64512d0a0a5cc3e9d5b3fc5217c54f11d0dc044c",
"version" : "2.2.28"
"revision" : "6b28cdf0d06c3d6e96b5585369968b85deac96e0",
"version" : "2.2.29"
}
},
{
Expand Down Expand Up @@ -203,17 +204,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziHealthKit.git",
"state" : {
"revision" : "35628084d3977aa897015b0b0c21cfe4d556f1aa",
"version" : "0.5.2"
}
},
{
"identity" : "spezimockwebservice",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziMockWebService.git",
"state" : {
"revision" : "b18067d3499e630bbd995ef05a296ef8fdd42528",
"version" : "1.0.0"
"revision" : "1e9cb5a6036ac7f4ff37ea1c3ed4898103339ad1",
"version" : "0.5.3"
}
},
{
Expand Down Expand Up @@ -266,8 +258,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "c8ed701b513cf5177118a175d85fbbbcd707ab41",
"version" : "1.3.0"
"revision" : "46989693916f56d1186bd59ac15124caef896560",
"version" : "1.3.1"
}
},
{
Expand Down Expand Up @@ -325,5 +317,5 @@
}
}
],
"version" : 2
"version" : 3
}
8 changes: 5 additions & 3 deletions PICS/Account/AccountSetupHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import SwiftUI


struct AccountSetupHeader: View {
@Environment(Account.self) private var account
@Environment(\._accountSetupState) private var setupState

@Environment(Account.self)
private var account
@Environment(\._accountSetupState)
private var setupState


var body: some View {
VStack {
Expand Down
13 changes: 8 additions & 5 deletions PICS/Account/AccountSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ import SwiftUI


struct AccountSheet: View {
@Environment(\.dismiss) var dismiss

@Environment(Account.self) private var account
@Environment(\.accountRequired) var accountRequired

@Environment(\.dismiss)
private var dismiss

@Environment(Account.self)
private var account
@Environment(\.accountRequired)
private var accountRequired

@State var isInSetup = false
@State var overviewIsEditing = false

Expand Down
116 changes: 69 additions & 47 deletions PICS/Appointment/AppointmentBlock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,95 @@ import Foundation
import SwiftUI

struct Item: Identifiable, Hashable {
let name: String
let id = UUID()
let name: LocalizedStringResource

func hash(into hasher: inout Hasher) {
hasher.combine(id)
hasher.combine(name.key)
}
}

struct AppointmentBlock: View {
var date: String
var time: String
var items = [
Item(name: String(localized: "REQUIRED_ITEMS_1")),
Item(name: String(localized: "REQUIRED_ITEMS_2")),
Item(name: String(localized: "REQUIRED_ITEMS_3")),
Item(name: String(localized: "REQUIRED_ITEMS_4")),
Item(name: String(localized: "REQUIRED_ITEMS_5")),
Item(name: String(localized: "REQUIRED_ITEMS_6")),
Item(name: String(localized: "REQUIRED_ITEMS_7"))
private let date: Date

private let items = [
Item(name: "REQUIRED_ITEMS_1"),
Item(name: "REQUIRED_ITEMS_2"),
Item(name: "REQUIRED_ITEMS_3"),
Item(name: "REQUIRED_ITEMS_4"),
Item(name: "REQUIRED_ITEMS_5"),
Item(name: "REQUIRED_ITEMS_6"),
Item(name: "REQUIRED_ITEMS_7")
]

@State private var multiSelection = Set<UUID>()
@State private var showingSheet = false

@Environment(AppointmentInformation.self) private var appointmentInfo

var body: some View {
Color(UIColor.secondarySystemBackground)
.frame(height: 130)
.cornerRadius(15)
.overlay(
VStack(alignment: .leading) {
VStack(alignment: .center) {
VStack(alignment: .leading) {
HStack {
Text(formattedDate(date))
.foregroundColor(.primary)
.bold()
Spacer()
VStack(alignment: .leading) {
HStack {
Text(date)
.foregroundColor(.primary)
.bold()
Spacer()
Text(time)
.foregroundColor(.primary)
}
Spacer()
HStack {
Spacer()
Button(String(localized: "REQUIRED_ITEMS_HEADING")) {
showingSheet.toggle()
}
.buttonStyle(.bordered)
}
Spacer()
Text(formattedTime(date))
.foregroundColor(.primary)
}
HStack {
Spacer()
Button("REQUIRED_ITEMS_HEADING") {
showingSheet.toggle()
}
.padding()
.foregroundColor(.accentColor)
.buttonStyle(.plain)
}
.sheet(isPresented: $showingSheet) {
NavigationView {
List(items, selection: $multiSelection) {
Text($0.name)
}
.navigationTitle(String(localized: "REQUIRED_ITEMS_HEADING"))
.padding(.top, 6)
}
}
.padding(.vertical, 8)
.sheet(isPresented: $showingSheet) {
NavigationStack {
List(items, selection: $multiSelection) {
Text($0.name)
}
.navigationTitle("REQUIRED_ITEMS_HEADING")
.environment(\.editMode, .constant(.active))
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(String(localized: "CLOSE")) {
Button("CLOSE") {
showingSheet.toggle()
}
.buttonStyle(.bordered)
}
}
}
}
)
}
}

init(date: Date) {
self.date = date
}


private func formattedDate(_ date: Date) -> String {
let formatter = DateFormatter()
formatter.dateFormat = "MMMM dd, yyyy"
return formatter.string(from: date)
}

private func formattedTime(_ date: Date) -> String {
let formatter = DateFormatter()
formatter.dateFormat = "h:mm a"
return formatter.string(from: date)
}
}


#if DEBUG
#Preview {
List {
AppointmentBlock(date: .now.addingTimeInterval(60 * 60))
}
}
#endif
Loading

0 comments on commit 955fd37

Please sign in to comment.