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

Restructure Application, Improve Performance, and Fix Logout Logic #10

Merged
merged 3 commits into from
Mar 25, 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
112 changes: 80 additions & 32 deletions OwnYourData.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

93 changes: 0 additions & 93 deletions TemplateApplication/AddDataView.swift

This file was deleted.

127 changes: 0 additions & 127 deletions TemplateApplication/AddRecordInstructView.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import SwiftUI


struct ClinicalTrialsView: View {
var body: some View {
if let url = URL(string: "https://www.cancer.gov/about-cancer/treatment/clinical-trials/search") {
Expand Down
22 changes: 22 additions & 0 deletions TemplateApplication/ClinicalTrials/WebView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// This source file is part of the Stanford CardinalKit Template Application project
//
// SPDX-FileCopyrightText: 2023 Stanford University
//
// SPDX-License-Identifier: MIT
//

import SafariServices
import SwiftUI


struct WebView: UIViewControllerRepresentable {
var url: URL


func makeUIViewController(context: Context) -> SFSafariViewController {
SFSafariViewController(url: url)
}

func updateUIViewController(_ safariViewController: SFSafariViewController, context: Context) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import PDFKit
import SwiftUI


struct DocumentGalleryView: View {
struct DocumentGallery: View {
@EnvironmentObject var documentManager: DocumentManager
@State var documentScanner = false

Expand Down Expand Up @@ -49,6 +49,6 @@ struct DocumentGalleryView: View {

struct DocumentGalleryView_Previews: PreviewProvider {
static var previews: some View {
DocumentGalleryView()
DocumentGallery()
}
}
31 changes: 15 additions & 16 deletions TemplateApplication/Documents/DocumentManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,19 @@ class DocumentManager: ObservableObject {
}
}


init() {
var documentURLs: [URL] {
guard let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else {
return
return []
}

let ownYourDataDirectory = documentDirectory.appending(path: "OwnYourData")


var documents: [PDFDocument] = []
do {
let items = try FileManager.default.contentsOfDirectory(at: ownYourDataDirectory, includingPropertiesForKeys: nil)
for item in items {
if let document = PDFDocument(url: item) {
documents.append(document)
}
}
self.documents = documents
} catch {
return
return (try? FileManager.default.contentsOfDirectory(at: ownYourDataDirectory, includingPropertiesForKeys: nil)) ?? []
}


init() {
self.documents = documentURLs.compactMap { documentURL in
PDFDocument(url: documentURL)
}
}

Expand Down Expand Up @@ -76,4 +69,10 @@ class DocumentManager: ObservableObject {
}
}
}

func removeAllDocuments() {
for documentURL in documentURLs {
try? FileManager.default.removeItem(at: documentURL)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public enum StorageKeys {


// MARK: - Name
/// The name of the currently signed in user
public static let userName = "user.name"
/// The first name of the currently signed in user
public static let firstName = "user.firstName"
/// The laste name of the currently signed in user
public static let lastName = "user.lastName"
/// The email of the currently signed in user
public static let email = "user.email"
}
63 changes: 0 additions & 63 deletions TemplateApplication/HealthRecordView.swift

This file was deleted.

Loading