Skip to content

Commit

Permalink
fix: fix microsoft login issue on iOS after config branch merges
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed Nov 19, 2024
1 parent 2cb5828 commit e68abc7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Core/Core/Configuration/Config/MicrosoftConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import Foundation

private enum MicrosoftKeys: String {
case enabled = "ENABLED"
case appID = "APP_ID"
case clientID = "CLIENT_ID"
}

public final class MicrosoftConfig: NSObject {
public var enabled: Bool = false
private(set) var appID: String?
private(set) var clientID: String?

private var requiredKeysAvailable: Bool {
return appID != nil
return clientID != nil
}

init(dictionary: [String: AnyObject]) {
appID = dictionary[MicrosoftKeys.appID.rawValue] as? String
clientID = dictionary[MicrosoftKeys.clientID.rawValue] as? String
super.init()
enabled = requiredKeysAvailable && dictionary[MicrosoftKeys.enabled.rawValue] as? Bool == true
}
Expand Down
4 changes: 2 additions & 2 deletions Core/Core/Providers/SocialAuth/MicrosoftAuthProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ public final class MicrosoftAuthProvider {
}

private func createClientApplication() throws -> MSALPublicClientApplication {
guard let config = Container.shared.resolve(ConfigProtocol.self), let appID = config.microsoft.appID else {
guard let config = Container.shared.resolve(ConfigProtocol.self), let clientID = config.microsoft.clientID else {
throw SocialAuthError.error(text: "Configuration error")
}
let configuration = MSALPublicClientApplicationConfig(clientId: appID)
let configuration = MSALPublicClientApplicationConfig(clientId: clientID)

do {
return try MSALPublicClientApplication(configuration: configuration)
Expand Down
1 change: 1 addition & 0 deletions Core/Core/SwiftGen/Assets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public enum CoreAssets {
public static let noAvatar = ImageAsset(name: "noAvatar")
public static let removePhoto = ImageAsset(name: "removePhoto")
public static let iconApple = ImageAsset(name: "icon_apple")
public static let iconFacebook = ImageAsset(name: "icon_facebook")
public static let iconFacebookWhite = ImageAsset(name: "icon_facebook_white")
public static let iconGoogleWhite = ImageAsset(name: "icon_google_white")
public static let iconMicrosoftWhite = ImageAsset(name: "icon_microsoft_white")
Expand Down
2 changes: 1 addition & 1 deletion Core/CoreTests/Configuration/ConfigTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ConfigTests: XCTestCase {
let config = Config(properties: properties)

XCTAssertTrue(config.microsoft.enabled)
XCTAssertEqual(config.microsoft.appID, "appId")
XCTAssertEqual(config.microsoft.clientID, "appId")
}

func testAppleConfigInitialization() {
Expand Down

0 comments on commit e68abc7

Please sign in to comment.