Skip to content

Commit

Permalink
Allow Dependencies to Use Spezi Foundation 2.0 (#70)
Browse files Browse the repository at this point in the history
# Allow Dependencies to Use Spezi Foundation 2.0

## ♻️ Current situation & Problem
- Dependency resolution fails if a package with Spezi Foundation 2.0 and
1.0 are mixed, despite Spezi LLM only using SpeziAccount and Firebase to
testing purposes.


## ⚙️ Release Notes 
- Tagging a release using Spezi Foundation 2.0

## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
PSchmiedmayer authored Oct 15, 2024
1 parent e53bc15 commit 6633d8a
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ jobs:
with:
coveragereports: 'SpeziLLM-iOS.xcresult SpeziLLM-visionOS.xcresult SpeziLLM-macOS.xcresult TestApp-iOS.xcresult TestApp-iPad.xcresult TestApp-visionOS.xcresult'
secrets:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ let package = Package(
.package(url: "https://github.com/StanfordBDHG/OpenAI", .upToNextMinor(from: "0.2.9")),
.package(url: "https://github.com/StanfordBDHG/llama.cpp", .upToNextMinor(from: "0.3.3")),
.package(url: "https://github.com/StanfordSpezi/Spezi", from: "1.2.1"),
.package(url: "https://github.com/StanfordSpezi/SpeziFoundation", from: "1.0.4"),
.package(url: "https://github.com/StanfordSpezi/SpeziFoundation", from: "2.0.0-beta.3"),
.package(url: "https://github.com/StanfordSpezi/SpeziStorage", from: "1.0.2"),
.package(url: "https://github.com/StanfordSpezi/SpeziOnboarding", from: "1.1.1"),
.package(url: "https://github.com/StanfordSpezi/SpeziChat", .upToNextMinor(from: "0.2.0")),
.package(url: "https://github.com/StanfordSpezi/SpeziChat", .upToNextMinor(from: "0.2.1")),
.package(url: "https://github.com/StanfordSpezi/SpeziViews", from: "1.3.1")
],
targets: [
Expand Down
27 changes: 1 addition & 26 deletions Tests/UITests/TestApp/LLMFog/Account/AccountSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,22 @@ struct AccountSheet: View {
@Environment(\.accountRequired) var accountRequired

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


var body: some View {
NavigationStack {
ZStack {
if account.signedIn && !isInSetup {
AccountOverview(isEditing: $overviewIsEditing)
.onDisappear {
overviewIsEditing = false
}
.toolbar {
if !overviewIsEditing {
closeButton
}
}
AccountOverview(close: .showCloseButton)
} else {
AccountSetup { _ in
dismiss() // we just signed in, dismiss the account setup sheet
} header: {
AccountSetupHeader()
}
.onAppear {
isInSetup = true
}
.toolbar {
if !accountRequired {
closeButton
}
}
}
}
}
}

var closeButton: some ToolbarContent {
ToolbarItem(placement: .cancellationAction) {
Button("CLOSE") {
dismiss()
}
}
}
}
#endif
1 change: 0 additions & 1 deletion Tests/UITests/TestApp/LLMFog/LLMFogChatTestView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ struct LLMFogChatTestView: View {
.accountRequired {
AccountSheet()
}
.verifyRequiredAccountDetails()
#endif
.accentColor(.orange) // Fog Orange
}
Expand Down
10 changes: 0 additions & 10 deletions Tests/UITests/TestApp/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@
}
}
},
"CLOSE" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Close"
}
}
}
},
"LLM_DOWNLOAD_DESCRIPTION" : {
"localizations" : {
"en" : {
Expand Down
16 changes: 8 additions & 8 deletions Tests/UITests/TestApp/TestAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import Foundation
import Spezi
#if os(iOS)
import FirebaseFirestore
import SpeziAccount
import SpeziFirebaseAccount
import SpeziFirebaseAccountStorage
#endif
import SpeziLLM
import SpeziLLMFog
Expand All @@ -33,14 +35,12 @@ class TestAppDelegate: SpeziAppDelegate {
Configuration {
// As SpeziAccount, SpeziFirebase and the firebase-ios-sdk currently don't support visionOS and macOS, perform fog node token authentication only on iOS
#if os(iOS)
AccountConfiguration(configuration: [
.requires(\.userId),
.requires(\.password)
])

FirebaseAccountConfiguration(
authenticationMethods: .emailAndPassword,
emulatorSettings: (host: "localhost", port: 9099) // Use Firebase emulator for development purposes
AccountConfiguration(
service: FirebaseAccountService(providers: [.emailAndPassword], emulatorSettings: (host: "localhost", port: 9099)),
storageProvider: FirestoreAccountStorage(storeIn: Firestore.firestore().collection("users")),
configuration: [
.requires(\.userId)
]
)
#endif

Expand Down
4 changes: 2 additions & 2 deletions Tests/UITests/TestAppUITests/TestAppLLMLocalUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class TestAppLLMLocalUITests: XCTestCase {

// Chat
#if !os(macOS)
try app.textViews["Message Input Textfield"].enter(value: "New Message!", dismissKeyboard: false)
try app.textViews["Message Input Textfield"].enter(value: "New Message!", options: [.disableKeyboardDismiss])
#else
try app.textFields["Message Input Textfield"].enter(value: "New Message!", dismissKeyboard: false)
try app.textFields["Message Input Textfield"].enter(value: "New Message!", options: [.disableKeyboardDismiss])
#endif

XCTAssert(app.buttons["Send Message"].waitForExistence(timeout: 2))
Expand Down
4 changes: 2 additions & 2 deletions Tests/UITests/TestAppUITests/TestAppLLMOpenAIUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ class TestAppLLMOpenAIUITests: XCTestCase {
XCTAssert(app.buttons["Record Message"].isEnabled)

#if !os(macOS)
try app.textViews["Message Input Textfield"].enter(value: "New Message!", dismissKeyboard: false)
try app.textViews["Message Input Textfield"].enter(value: "New Message!", options: [.disableKeyboardDismiss])
#else
try app.textFields["Message Input Textfield"].enter(value: "New Message!", dismissKeyboard: false)
try app.textFields["Message Input Textfield"].enter(value: "New Message!", options: [.disableKeyboardDismiss])
#endif

XCTAssert(app.buttons["Send Message"].waitForExistence(timeout: 2))
Expand Down
28 changes: 19 additions & 9 deletions Tests/UITests/UITests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
2F6D139A28F5F386007C25D6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2F6D139928F5F386007C25D6 /* Assets.xcassets */; };
2F8A431329130A8C005D2B8F /* TestAppLLMOpenAIUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F8A431229130A8C005D2B8F /* TestAppLLMOpenAIUITests.swift */; };
2FA7382C290ADFAA007ACEB9 /* TestApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FA7382B290ADFAA007ACEB9 /* TestApp.swift */; };
2FAD21CB2CBDC82500C9665B /* SpeziFirebaseAccountStorage in Frameworks */ = {isa = PBXBuildFile; platformFilter = ios; productRef = 2FAD21CA2CBDC82500C9665B /* SpeziFirebaseAccountStorage */; };
2FD590522A19E9F000153BE4 /* XCTestExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 2FD590512A19E9F000153BE4 /* XCTestExtensions */; };
63EF9CF02BA7398C001D92D7 /* TestAppTestingSetup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63EF9CEF2BA7398C001D92D7 /* TestAppTestingSetup.swift */; };
9722A5A02B5B5CB20005645E /* SpeziLLM in Frameworks */ = {isa = PBXBuildFile; productRef = 9722A59F2B5B5CB20005645E /* SpeziLLM */; };
Expand Down Expand Up @@ -96,6 +97,7 @@
buildActionMask = 2147483647;
files = (
9722A5A02B5B5CB20005645E /* SpeziLLM in Frameworks */,
2FAD21CB2CBDC82500C9665B /* SpeziFirebaseAccountStorage in Frameworks */,
9770F2912BB3C40C00478571 /* SpeziFirebaseAccount in Frameworks */,
97A36E152B999EA60034D821 /* SpeziLLMFog in Frameworks */,
9722A5A22B5B5CB20005645E /* SpeziLLMLocal in Frameworks */,
Expand Down Expand Up @@ -284,6 +286,7 @@
97A36E142B999EA60034D821 /* SpeziLLMFog */,
9770F2902BB3C40C00478571 /* SpeziFirebaseAccount */,
979D418F2BB3EBD8001953BD /* SpeziAccount */,
2FAD21CA2CBDC82500C9665B /* SpeziFirebaseAccountStorage */,
);
productName = Example;
productReference = 2F6D139228F5F384007C25D6 /* TestApp.app */;
Expand Down Expand Up @@ -318,7 +321,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1410;
LastUpgradeCheck = 1510;
LastUpgradeCheck = 1600;
TargetAttributes = {
2F6D139128F5F384007C25D6 = {
CreatedOnToolsVersion = 14.1;
Expand Down Expand Up @@ -599,6 +602,8 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_INTEROP_MODE = objcxx;
SWIFT_STRICT_CONCURRENCY = complete;
Expand Down Expand Up @@ -640,6 +645,8 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_INTEROP_MODE = objcxx;
SWIFT_STRICT_CONCURRENCY = complete;
Expand All @@ -651,7 +658,6 @@
2F6D13BD28F5F386007C25D6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 637867499T;
Expand All @@ -673,7 +679,6 @@
2F6D13BE28F5F386007C25D6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 637867499T;
Expand Down Expand Up @@ -729,29 +734,34 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordBDHG/XCTestExtensions.git";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.4.13;
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
9770F28F2BB3C40C00478571 /* XCRemoteSwiftPackageReference "SpeziFirebase" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordSpezi/SpeziFirebase";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 1.0.1;
kind = upToNextMajorVersion;
minimumVersion = "2.0.0-beta.4";
};
};
979D418E2BB3EBD8001953BD /* XCRemoteSwiftPackageReference "SpeziAccount" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordSpezi/SpeziAccount";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 1.2.1;
kind = upToNextMajorVersion;
minimumVersion = "2.0.0-beta.8";
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
2FAD21CA2CBDC82500C9665B /* SpeziFirebaseAccountStorage */ = {
isa = XCSwiftPackageProductDependency;
package = 9770F28F2BB3C40C00478571 /* XCRemoteSwiftPackageReference "SpeziFirebase" */;
productName = SpeziFirebaseAccountStorage;
};
2FD590512A19E9F000153BE4 /* XCTestExtensions */ = {
isa = XCSwiftPackageProductDependency;
package = 2FD590502A19E9F000153BE4 /* XCRemoteSwiftPackageReference "XCTestExtensions" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

0 comments on commit 6633d8a

Please sign in to comment.