1
This commit is contained in:
parent
05e80f50e2
commit
d5a6e44f49
@ -28,11 +28,13 @@ class SPLoginViewController: SPViewController {
|
|||||||
|
|
||||||
private lazy var faceBookButton: UIButton = {
|
private lazy var faceBookButton: UIButton = {
|
||||||
let button = createButton(title: "Login with Facebook", titleColor: .colorFFFFFF(), icon: UIImage(named: "facebook_icon_01"), background: .color0866FF())
|
let button = createButton(title: "Login with Facebook", titleColor: .colorFFFFFF(), icon: UIImage(named: "facebook_icon_01"), background: .color0866FF())
|
||||||
|
button.addTarget(self, action: #selector(handleFaceBookButton), for: .touchUpInside)
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private lazy var appleButton: UIButton = {
|
private lazy var appleButton: UIButton = {
|
||||||
let button = createButton(title: "Login with Apple", titleColor: .color333333(), icon: UIImage(named: "apple_icon_01"), background: .colorFFFFFF())
|
let button = createButton(title: "Login with Apple", titleColor: .color333333(), icon: UIImage(named: "apple_icon_01"), background: .colorFFFFFF())
|
||||||
|
button.addTarget(self, action: #selector(handleAppleButton), for: .touchUpInside)
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -109,6 +111,21 @@ class SPLoginViewController: SPViewController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension SPLoginViewController {
|
||||||
|
@objc private func handleFaceBookButton() {
|
||||||
|
thirdLogin(type: .faceBook)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc private func handleAppleButton() {
|
||||||
|
thirdLogin(type: .apple)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func thirdLogin(type: SPLoginManager.LoginType) {
|
||||||
|
SPLoginManager.manager.thirdLogin(type: type, presentingViewController: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
extension SPLoginViewController {
|
extension SPLoginViewController {
|
||||||
|
|
||||||
private func _setupUI() {
|
private func _setupUI() {
|
||||||
|
@ -53,7 +53,7 @@ class JXIAPManager: NSObject {
|
|||||||
let id = "00000000-0000-0000-0000-000000000000"
|
let id = "00000000-0000-0000-0000-000000000000"
|
||||||
guard let orderId = orderId else { return nil }
|
guard let orderId = orderId else { return nil }
|
||||||
var string = ""
|
var string = ""
|
||||||
for i in 0..<orderId.length {
|
for i in 0..<orderId.length() {
|
||||||
if i == 12 || i == 16 || i == 20 || i == 24 {
|
if i == 12 || i == 16 || i == 20 || i == 24 {
|
||||||
string.insert("-", at: string.startIndex)
|
string.insert("-", at: string.startIndex)
|
||||||
}
|
}
|
||||||
@ -61,12 +61,12 @@ class JXIAPManager: NSObject {
|
|||||||
string.insert(s, at: string.startIndex)
|
string.insert(s, at: string.startIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
let length = id.length
|
let length = id.length()
|
||||||
let stringLength = string.length
|
let stringLength = string.length()
|
||||||
|
|
||||||
if stringLength <= length {
|
if stringLength <= length {
|
||||||
let range = NSRange(location: length - string.length, length: string.length)
|
let range = NSRange(location: length - string.length(), length: string.length())
|
||||||
return id.ocString.replacingCharacters(in: range, with: string)
|
return id.ocString().replacingCharacters(in: range, with: string)
|
||||||
} else {
|
} else {
|
||||||
return string
|
return string
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ class JXIAPManager: NSObject {
|
|||||||
// 要购买商品,开个小票
|
// 要购买商品,开个小票
|
||||||
let payment = SKMutablePayment(product: product)
|
let payment = SKMutablePayment(product: product)
|
||||||
payment.applicationUsername = applicationUsername
|
payment.applicationUsername = applicationUsername
|
||||||
tmLog(message: payment.applicationUsername)
|
spLog(message: payment.applicationUsername)
|
||||||
|
|
||||||
self.payment = payment
|
self.payment = payment
|
||||||
// 去收银台排队,准备购买
|
// 去收银台排队,准备购买
|
||||||
|
Loading…
x
Reference in New Issue
Block a user