Skip to content

Commit

Permalink
a3.5-buggy
Browse files Browse the repository at this point in the history
  • Loading branch information
varun764 committed Feb 17, 2022
0 parents commit 4f1f3e0
Show file tree
Hide file tree
Showing 272 changed files with 20,093 additions and 0 deletions.
26 changes: 26 additions & 0 deletions CardinalKit-Example/CardinalKit-Example.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:cs342.page.link</string>
</array>
<key>com.apple.developer.default-data-protection</key>
<string>NSFileProtectionComplete</string>
<key>com.apple.developer.healthkit</key>
<true/>
<key>com.apple.developer.healthkit.access</key>
<array>
<string>health-records</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)edu.stanford.cs342.sample-study</string>
</array>
</dict>
</plist>
1,014 changes: 1,014 additions & 0 deletions CardinalKit-Example/CardinalKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "CardinalKit Example.app"
BlueprintName = "CardinalKit_Example"
ReferencedContainer = "container:CardinalKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACE41AFB9204008FA782"
BuildableName = "CardinalKit_Tests.xctest"
BlueprintName = "CardinalKit_Tests"
ReferencedContainer = "container:CardinalKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8F758C3207C24BE3F051DB5E9AFB3F14"
BuildableName = "CardinalKit.framework"
BlueprintName = "CardinalKit"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "CardinalKit Example.app"
BlueprintName = "CardinalKit_Example"
ReferencedContainer = "container:CardinalKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACE41AFB9204008FA782"
BuildableName = "CardinalKit_Tests.xctest"
BlueprintName = "CardinalKit_Tests"
ReferencedContainer = "container:CardinalKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "CardinalKit Example.app"
BlueprintName = "CardinalKit_Example"
ReferencedContainer = "container:CardinalKit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "CardinalKit Example.app"
BlueprintName = "CardinalKit_Example"
ReferencedContainer = "container:CardinalKit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"object": {
"pins": [
{
"package": "CareKit",
"repositoryURL": "https://github.com/carekit-apple/CareKit",
"state": {
"branch": "main",
"revision": "4936c622d55d876ccf43d7a4f4fa6acdf4db6747",
"version": null
}
},
{
"package": "FHIRModels",
"repositoryURL": "https://github.com/apple/FHIRModels.git",
"state": {
"branch": null,
"revision": "c91e5bb74397136f79656bebdfda76a523d3e88c",
"version": "0.3.2"
}
}
]
},
"version": 1
}
46 changes: 46 additions & 0 deletions CardinalKit-Example/CardinalKit/AppDelegate+CardinalKit.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// AppDelegate+CardinalKit.swift
//
// Created for the CardinalKit Framework.
// Copyright © 2019 Stanford University. All rights reserved.
//

import Foundation
import ResearchKit
import Firebase
import CardinalKit

// Extensions add new functionality to an existing class, structure, enumeration, or protocol type.
// https://docs.swift.org/swift-book/LanguageGuide/Extensions.html
extension AppDelegate {

/**
Handle special CardinalKit logic for when the app is launched.
*/
func CKAppLaunch() {

// (1) lock the app and prompt for passcode before continuing
// CKLockApp()

// (2) setup the CardinalKit SDK
var options = CKAppOptions()
options.networkDeliveryDelegate = CKAppNetworkManager()
options.networkReceiverDelegate = CKAppNetworkManager()
CKApp.configure(options)

// (3) if we have already logged in
if CKStudyUser.shared.isLoggedIn {
CKStudyUser.shared.save()

// (4) then start the requested HK data collection (if any).
let manager = CKHealthKitManager.shared
manager.getHealthAuthorization { (success, error) in
if let error = error {
print(error)
}
}
}
CKStudyUser.shared.save()
}

}
111 changes: 111 additions & 0 deletions CardinalKit-Example/CardinalKit/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//
// AppDelegate.swift
//
// Created for the CardinalKit Framework.
// Copyright © 2019 Stanford University. All rights reserved.
//
import UIKit
import Firebase
import ResearchKit

// import facebook
import FBSDKCoreKit

import GoogleSignIn

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

// (1) initialize Firebase SDK
FirebaseApp.configure()

// (2) check if this is the first time
// that the app runs!
cleanIfFirstRun()

// (3) initialize CardinalKit API
CKAppLaunch()

let config = CKPropertyReader(file: "CKConfiguration")
UIView.appearance(whenContainedInInstancesOf: [ORKTaskViewController.self]).tintColor = config.readColor(query: "Tint Color")

// Fix transparent navbar in iOS 15
if #available(iOS 15, *) {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
}

// Set up FB Sign In
FBSDKCoreKit.ApplicationDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions
)

return true
}


// Set up Google Sign In
@available(iOS 9.0, *)
func application(_ application: UIApplication, open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any])
-> Bool {

ApplicationDelegate.shared.application(
application,
open: url,
sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
annotation: options[UIApplication.OpenURLOptionsKey.annotation]
)

return GIDSignIn.sharedInstance.handle(url)
}

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

}

// Extensions add new functionality to an existing class, structure, enumeration, or protocol type.
// https://docs.swift.org/swift-book/LanguageGuide/Extensions.html
extension AppDelegate {

/**
The first time that our app runs we have to make sure that :
(1) no passcode remains stored in the keychain &
(2) we are fully signed out from Firebase.

This step is required as an edge-case, since
keychain items persist after uninstallation.
*/
fileprivate func cleanIfFirstRun() {
if !UserDefaults.standard.bool(forKey: Constants.prefFirstRunWasMarked) {
if ORKPasscodeViewController.isPasscodeStoredInKeychain() {
ORKPasscodeViewController.removePasscodeFromKeychain()
}
try? Auth.auth().signOut()
UserDefaults.standard.set(true, forKey: Constants.prefFirstRunWasMarked)
}
}

}




Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// CareTeamViewControllerRepresentable.swift
// CardinalKit_Example
//
// Created by Santiago Gutierrez on 12/21/20.
// Copyright © 2020 CocoaPods. All rights reserved.
//

import SwiftUI
import UIKit
import CareKit

struct CareTeamViewControllerRepresentable: UIViewControllerRepresentable {

typealias UIViewControllerType = UIViewController

func updateUIViewController(_ taskViewController: UIViewController, context: Context) {}
func makeUIViewController(context: Context) -> UIViewController {
let manager = CKCareKitManager.shared

let viewController = OCKContactsListViewController(storeManager: manager.synchronizedStoreManager)
viewController.title = "Care Team"

return UINavigationController(rootViewController: viewController)
}

}
Loading

0 comments on commit 4f1f3e0

Please sign in to comment.