Skip to content

Commit

Permalink
Add support for ObjC interface and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Dec 17, 2024
1 parent 4008400 commit d6aa95c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
21 changes: 19 additions & 2 deletions LineSDK/LineSDKObjC/Login/LineSDKLoginManagerParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ public class LineSDKLoginManagerParameters: NSObject {
get { return _value.promptBotID }
set { _value.promptBotID = newValue }
}


public var initialWebAuthenticationMethod: LineSDKLoginManagerWebAuthenticationMethod {
get { return LineSDKLoginManagerWebAuthenticationMethod(_value.initialWebAuthenticationMethod) }
set { _value.initialWebAuthenticationMethod = newValue._value }
}

public var preferredWebPageLanguage: String? {
get { return _value.preferredWebPageLanguage?.rawValue }
set { _value.preferredWebPageLanguage = newValue.map { .init(rawValue: $0) } }
}

public var IDTokenNonce: String? {
get { return _value.IDTokenNonce }
set { _value.IDTokenNonce = newValue }
Expand All @@ -67,3 +72,15 @@ public class LineSDKLoginManagerBotPrompt: NSObject {

public var rawValue: String { return _value.rawValue }
}

@objcMembers
public class LineSDKLoginManagerWebAuthenticationMethod: NSObject {

let _value: LoginManager.WebAuthenticationMethod
init(_ value: LoginManager.WebAuthenticationMethod) { _value = value }

public static let email = LineSDKLoginManagerWebAuthenticationMethod(.email)
public static let qrCode = LineSDKLoginManagerWebAuthenticationMethod(.qrCode)

public var rawValue: String { return _value.rawValue }
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ - (void)testLoginManagerParametersInterface {
param.preferredWebPageLanguage = @"ja";
param.IDTokenNonce = @"test";
param.promptBotID = @"@abc123";

param.initialWebAuthenticationMethod = [LineSDKLoginManagerWebAuthenticationMethod qrCode];

XCTAssertTrue([param onlyWebLogin]);
XCTAssertTrue([[param.botPromptStyle rawValue] isEqualToString: @"normal"]);
XCTAssertTrue([param.preferredWebPageLanguage isEqualToString: @"ja"]);
XCTAssertTrue([param.IDTokenNonce isEqualToString: @"test"]);
XCTAssertTrue([[param.initialWebAuthenticationMethod rawValue] isEqualToString:@"qrCode"]);
}

- (void)testLoginResultInterface {
Expand Down

0 comments on commit d6aa95c

Please sign in to comment.