jsdw_ios/QuickLocation/Section/Home/SignIn/SignInVC.swift

56 lines
1.5 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// SignInVC.swift
// QuickLocation
//
// Created by on 2026/6/17.
//
import UIKit
import RxSwift
import RxCocoa
import CoreLocation
class SignInVC: BaseViewController {
fileprivate var rootView: SignInView!
///
var currentCoordinate: CLLocationCoordinate2D?
override func loadView() {
rootView = SignInView(frame: UIScreen.main.bounds)
view = rootView
}
override func viewDidLoad() {
super.viewDidLoad()
requestSignInInfo()
rootView.signInLottieView.rx.tapGesture.subscribe(onNext: { [weak self] _ in
guard let c = self?.currentCoordinate else { return }
MQTTService.shared.reportSignIn(lat: c.latitude, lon: c.longitude, addr: "")
DLToast.show(text: "签到成功") {
self?.requestSignInInfo()
}
}).disposed(by: disposeBag)
}
// MARK: - API
private func requestSignInInfo() {
DLToast.showLoading()
UserService.signInInfo().subscribe(onNext: { response in
guard let model = response.model else { return }
self.rootView.setupData(model)
}, onError: { _ in }).disposed(by: disposeBag)
}
init(currentUserCoord: CLLocationCoordinate2D?) {
self.currentCoordinate = currentUserCoord
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}