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

Cleanup for handover #62

Merged
merged 9 commits into from
Mar 19, 2024
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
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 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)
}

Check warning on line 18 in PICS/Appointment/AppointmentBlock.swift

View check run for this annotation

Codecov / codecov/patch

PICS/Appointment/AppointmentBlock.swift#L15-L18

Added lines #L15 - L18 were not covered by tests
}

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
Loading