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.
Upgrade to SpeziAccount 0.5.0 with account edit and removal support (#8)
# Upgrade to upcoming SpeziAccount release ## ♻️ Current situation & Problem We currently support the current and latest version of `SpeziAccount` (0.3.0). The next version of `SpeziAccount` heavily refactors the exposed API. ## 💡 Proposed solution This PR makes sure SpeziFirebase is ready for the upgrade version of `SpeziAccount`. ## ⚙️ Release Notes * Ensure compatibility with the upcoming release of `SpeziAccount` * Ability to change user information * Ability to delete user account * Improved error message reporting and fixed some spelling mistakes ## ➕ Additional Information The upgrade to the new version of `SpeziAccount` requires only minor changes in `SpeziFirebase` itself. We did some refactoring were we moved all `FIRAuth` operations into the AccountService itself. Consequentially, the `FirebaseAccountConfiguration` itself got a lot simpler. ### Breaking Changes The following breaking changes are induced due to the new structure of `SpeziAccount`. * `FirebaseAccountConfiguration` is no longer injected as an environment object into the SwiftUI environment. Access the account information using the new, generalized `Account` environment object. ### Related PRs * StanfordSpezi/SpeziAccount#7 ### Testing Tests were added and adjusted. ### Reviewer Nudging Look at the changes in `FirebaseAccountConfiguration` and the `FirebaseEmailPasswordAccountService`. ### 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
17 changed files
with
1,029 additions
and
357 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
51 changes: 51 additions & 0 deletions
51
Sources/SpeziFirebaseAccount/AccountValues/FirebaseEmailVerifiedKey.swift
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,51 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open-source project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import Foundation | ||
import SpeziAccount | ||
import SwiftUI | ||
|
||
|
||
/// Flag indicating if the firebase account has a verified email address. | ||
/// | ||
/// - Important: This key is read-only and cannot be modified. | ||
public struct FirebaseEmailVerifiedKey: AccountKey { | ||
public typealias Value = Bool | ||
public static var name: LocalizedStringResource = "E-Mail Verified" | ||
public static var category: AccountKeyCategory = .other | ||
public static var initialValue: InitialValue<Bool> = .default(false) | ||
} | ||
|
||
|
||
extension AccountKeys { | ||
/// The email-verified ``FirebaseEmailVerifiedKey`` metatype. | ||
public var isEmailVerified: FirebaseEmailVerifiedKey.Type { | ||
FirebaseEmailVerifiedKey.self | ||
} | ||
} | ||
|
||
|
||
extension AccountValues { | ||
/// Access if the user's email of their firebase account is verified. | ||
public var isEmailVerified: Bool { | ||
storage[FirebaseEmailVerifiedKey.self] ?? false | ||
} | ||
} | ||
|
||
|
||
extension FirebaseEmailVerifiedKey { | ||
public struct DataEntry: DataEntryView { | ||
public typealias Key = FirebaseEmailVerifiedKey | ||
|
||
public var body: some View { | ||
Text("The FirebaseEmailVerifiedKey cannot be set!") | ||
} | ||
|
||
public init(_ value: Binding<Value>) {} | ||
} | ||
} |
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.