Skip to content

Commit 5720434

Browse files
committed
we need to pass in the account to follow current pattern for mockabliity for testing
1 parent 670c1a3 commit 5720434

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/PushNotification/PushNotificationManager.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public class PushNotificationManager: NSObject {
276276

277277
Task {
278278
do {
279-
try await self.fetchAndStoreNotificationTypes(restClient: restClient)
279+
try await self.fetchAndStoreNotificationTypes(restClient: restClient, account: user)
280280
} catch {
281281
SFSDKCoreLogger.e(Self.self, message: "Get Notification Types Error: \(error.localizedDescription)")
282282
}
@@ -360,10 +360,12 @@ public class PushNotificationManager: NSObject {
360360
///
361361
/// - Parameters:
362362
/// - restClient: The `RestClient` to use for the API call.
363+
/// - account: The user account to associate notification types with.
363364
/// - Throws: An error if the types cannot be retrieved from server or cache.
364-
@objc(fetchAndStoreNotificationTypesWithRestClient:completionHandler:)
365-
public func fetchAndStoreNotificationTypes(restClient: RestClient = RestClient.shared) async throws {
366-
guard let account = UserAccountManager.shared.currentUserAccount else {
365+
@objc(fetchAndStoreNotificationTypesWithRestClient:account:completionHandler:)
366+
public func fetchAndStoreNotificationTypes(restClient: RestClient = RestClient.shared,
367+
account: UserAccount? = UserAccountManager.shared.currentUserAccount) async throws {
368+
guard let account = account else {
367369
throw PushNotificationManagerError.currentUserNotDetected
368370
}
369371

0 commit comments

Comments
 (0)