generated from StanfordBDHG/SwiftPackageTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation catalogs for all targets (#26)
# Add documentation catalogs for all targets ## ♻️ Current situation & Problem This PR adds documentation catalogs for all targets and upgrades all dependencies to their latest 1.0 releases. ## ⚙️ Release Notes * Add documentation catalogs for all targets. * Upgrade all dependencies to their latest 1.0 releases. * Fixed an issue where Account association was removed when no network coverage is available ## 📝 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
Showing
15 changed files
with
302 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
Sources/SpeziFirebaseAccount/SpeziFirebaseAccount.docc/SpeziFirebaseAccount.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# ``SpeziFirebaseAccount`` | ||
|
||
<!-- | ||
This source file is part of the Stanford Spezi open-source project | ||
SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
SPDX-License-Identifier: MIT | ||
--> | ||
|
||
Firebase Auth support for SpeziAccount. | ||
|
||
## Overview | ||
|
||
This Module adds support for Firebase Auth for SpeziAccount by implementing a respective | ||
[AccountService](https://swiftpackageindex.com/stanfordspezi/speziaccount/documentation/speziaccount/accountservice). | ||
|
||
The `FirebaseAccountConfiguration` can, e.g., be used to to connect to the Firebase Auth emulator: | ||
``` | ||
class ExampleAppDelegate: SpeziAppDelegate { | ||
override var configuration: Configuration { | ||
Configuration { | ||
FirebaseAccountConfiguration(emulatorSettings: (host: "localhost", port: 9099)) | ||
// ... | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Topics | ||
|
||
### Firebase Account | ||
|
||
- ``FirebaseAccountConfiguration`` | ||
- ``FirebaseAuthAuthenticationMethods`` | ||
|
||
### Account Keys | ||
|
||
- ``FirebaseEmailVerifiedKey`` | ||
- ``SpeziAccount/AccountValues/isEmailVerified`` | ||
- ``SpeziAccount/AccountKeys/isEmailVerified`` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...eAccountStorage/SpeziFirebaseAccountStorage.docc/SpeziFirebaseAccountStorage.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# ``SpeziFirebaseAccountStorage`` | ||
|
||
<!-- | ||
This source file is part of the Stanford Spezi open-source project | ||
SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
SPDX-License-Identifier: MIT | ||
--> | ||
|
||
Store additional account details directly in Firestore. | ||
|
||
## Overview | ||
|
||
Certain account services, like the account services provided by Firebase, can only store certain account details. | ||
The ``FirestoreAccountStorage`` can be used to store additional account details, that are not supported out of the box by your account services, | ||
inside Firestore in a custom user collection. | ||
|
||
For more detailed information, refer to the documentation of ``FirestoreAccountStorage``. | ||
|
||
### Example | ||
|
||
Once you have [AccountConfiguration](https://swiftpackageindex.com/stanfordspezi/speziaccount/documentation/speziaccount/initial-setup#Account-Configuration) | ||
and the [FirebaseAccountConfiguration](https://swiftpackageindex.com/stanfordspezi/spezifirebase/documentation/spezifirebaseaccount/firebaseaccountconfiguration) | ||
set up, you can adopt the [AccountStorageConstraint](https://swiftpackageindex.com/stanfordspezi/speziaccount/documentation/speziaccount/accountstorageconstraint) | ||
protocol to provide a custom storage for SpeziAccount. | ||
|
||
|
||
```swift | ||
import FirebaseFirestore | ||
import Spezi | ||
import SpeziAccount | ||
import SpeziFirebaseAccountStorage | ||
|
||
|
||
actor ExampleStandard: Standard, AccountStorageConstraint { | ||
// Define the collection where you want to store your additional user data, ... | ||
static var collection: CollectionReference { | ||
Firestore.firestore().collection("users") | ||
} | ||
|
||
// ... define and initialize the `FirestoreAccountStorage` dependency ... | ||
@Dependency private var accountStorage = FirestoreAccountStorage(storedIn: Self.collection) | ||
|
||
|
||
// ... and forward all implementations of `AccountStorageConstraint` to the `FirestoreAccountStorage`. | ||
|
||
public func create(_ identifier: AdditionalRecordId, _ details: SignupDetails) async throws { | ||
try await accountStorage.create(identifier, details) | ||
} | ||
|
||
public func load(_ identifier: AdditionalRecordId, _ keys: [any AccountKey.Type]) async throws -> PartialAccountDetails { | ||
try await accountStorage.load(identifier, keys) | ||
} | ||
|
||
public func modify(_ identifier: AdditionalRecordId, _ modifications: AccountModifications) async throws { | ||
try await accountStorage.modify(identifier, modifications) | ||
} | ||
|
||
public func clear(_ identifier: AdditionalRecordId) async { | ||
await accountStorage.clear(identifier) | ||
} | ||
|
||
public func delete(_ identifier: AdditionalRecordId) async throws { | ||
try await accountStorage.delete(identifier) | ||
} | ||
} | ||
``` | ||
|
||
## Topics | ||
|
||
### Storage | ||
|
||
- ``FirestoreAccountStorage`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.