diff --git a/Thimra.xcodeproj/project.pbxproj b/Thimra.xcodeproj/project.pbxproj index 29db02f..f59e295 100644 --- a/Thimra.xcodeproj/project.pbxproj +++ b/Thimra.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 1BCF943F2DBB62FB008AEBE9 /* FacebookBasics in Frameworks */ = {isa = PBXBuildFile; productRef = 1BCF943E2DBB62FB008AEBE9 /* FacebookBasics */; }; + 1BCF94412DBB62FB008AEBE9 /* FacebookCore in Frameworks */ = {isa = PBXBuildFile; productRef = 1BCF94402DBB62FB008AEBE9 /* FacebookCore */; }; + 1BCF94432DBB62FB008AEBE9 /* FacebookLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 1BCF94422DBB62FB008AEBE9 /* FacebookLogin */; }; 510C67DE404B0A4C9F4E89C3 /* Pods_Thimra.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EF2D7FDB1FE86E5CD9908162 /* Pods_Thimra.framework */; }; /* End PBXBuildFile section */ @@ -43,7 +46,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1BCF94432DBB62FB008AEBE9 /* FacebookLogin in Frameworks */, 510C67DE404B0A4C9F4E89C3 /* Pods_Thimra.framework in Frameworks */, + 1BCF94412DBB62FB008AEBE9 /* FacebookCore in Frameworks */, + 1BCF943F2DBB62FB008AEBE9 /* FacebookBasics in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -134,6 +140,9 @@ ); mainGroup = 1DBC40502DA4EDFC0093FCB0; minimizedProjectReferenceProxies = 1; + packageReferences = ( + 1BCF943D2DBB62FB008AEBE9 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */, + ); preferredProjectObjectVersion = 77; productRefGroup = 1DBC405A2DA4EDFC0093FCB0 /* Products */; projectDirPath = ""; @@ -434,6 +443,35 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 1BCF943D2DBB62FB008AEBE9 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/facebook/facebook-ios-sdk"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 14.1.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 1BCF943E2DBB62FB008AEBE9 /* FacebookBasics */ = { + isa = XCSwiftPackageProductDependency; + package = 1BCF943D2DBB62FB008AEBE9 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */; + productName = FacebookBasics; + }; + 1BCF94402DBB62FB008AEBE9 /* FacebookCore */ = { + isa = XCSwiftPackageProductDependency; + package = 1BCF943D2DBB62FB008AEBE9 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */; + productName = FacebookCore; + }; + 1BCF94422DBB62FB008AEBE9 /* FacebookLogin */ = { + isa = XCSwiftPackageProductDependency; + package = 1BCF943D2DBB62FB008AEBE9 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */; + productName = FacebookLogin; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 1DBC40512DA4EDFC0093FCB0 /* Project object */; } diff --git a/Thimra.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Thimra.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..70800b1 --- /dev/null +++ b/Thimra.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "ca3cf5f8f83d297b47d2cb0edff3e06f294951e2e06fa55cfc82831103499b2a", + "pins" : [ + { + "identity" : "facebook-ios-sdk", + "kind" : "remoteSourceControl", + "location" : "https://github.com/facebook/facebook-ios-sdk", + "state" : { + "revision" : "c19607d535864533523d1f437c84035e5fb101cf", + "version" : "14.1.0" + } + } + ], + "version" : 3 +} diff --git a/Thimra/AppDelegate/AppDelegate+OpenApp.swift b/Thimra/AppDelegate/AppDelegate+OpenApp.swift new file mode 100644 index 0000000..72b0282 --- /dev/null +++ b/Thimra/AppDelegate/AppDelegate+OpenApp.swift @@ -0,0 +1,28 @@ +// +// AppDelegate+OpenApp.swift +// Thimra +// +// Created by 佳尔 on 2025/4/25. +// + +import UIKit + + + +extension SceneDelegate { + + ///URL打开APP + func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { + + } + + ///UniversalLink 打开app + func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { + guard let webpageURL = userActivity.webpageURL else { return } + + guard let query = webpageURL.query else { return } + + spLog(message: query) + } + +} diff --git a/Thimra/Base/Controller/SPViewController.swift b/Thimra/Base/Controller/SPViewController.swift index 12ca2fd..cfcb71b 100644 --- a/Thimra/Base/Controller/SPViewController.swift +++ b/Thimra/Base/Controller/SPViewController.swift @@ -23,14 +23,14 @@ class SPViewController: UIViewController, JYPageChildContollerProtocol { private(set) var isViewDidLoad = false private(set) var isDidAppear = false - private(set) lazy var _bgImageView: UIImageView = { + private(set) lazy var bgImageView: UIImageView = { let imageView = UIImageView(image: UIImage(named: "main_bg_image_01")) imageView.isUserInteractionEnabled = true return imageView; }() ///头部渐变色 - private lazy var toGradientView: SPGradientView = { + private lazy var topGradientView: SPGradientView = { let view = SPGradientView() view.colors = [UIColor.color290D0F().cgColor, UIColor.color230E11().cgColor, UIColor.color181115().cgColor, UIColor.color121317(alpha: 0).cgColor] view.startPoint = .init(x: 0.5, y: 0) @@ -44,8 +44,19 @@ class SPViewController: UIViewController, JYPageChildContollerProtocol { self.isViewDidLoad = true self.edgesForExtendedLayout = [] + view.addSubview(topGradientView) + view.addSubview(bgImageView) - setBgImageView() + topGradientView.snp.makeConstraints { make in + make.left.right.top.equalToSuperview() + make.height.equalTo(kSPStatusbarHeight + 420) + } + + bgImageView.snp.makeConstraints { make in + make.left.right.top.equalToSuperview() + } + + setBackgroundView() if let navi = navigationController { if navi.visibleViewController == self { @@ -56,15 +67,11 @@ class SPViewController: UIViewController, JYPageChildContollerProtocol { } } - func setBgImageView() { - self.view.backgroundColor = .backgroundColor() - - self.view.addSubview(toGradientView) - - toGradientView.snp.makeConstraints { make in - make.left.right.top.equalToSuperview() - make.height.equalTo(kSPStatusbarHeight + 420) - } + func setBackgroundView(isShowGradient: Bool = true, bgImage: UIImage? = UIImage(named: "main_bg_image_01"), backgroundColor: UIColor = UIColor.backgroundColor()) { + topGradientView.isHidden = !isShowGradient + bgImageView.isHidden = isShowGradient + bgImageView.image = bgImage + view.backgroundColor = backgroundColor } override func viewDidAppear(_ animated: Bool) { diff --git a/Thimra/Base/Extension/Dictionary+SPAdd.swift b/Thimra/Base/Extension/Dictionary+SPAdd.swift new file mode 100644 index 0000000..2d39b31 --- /dev/null +++ b/Thimra/Base/Extension/Dictionary+SPAdd.swift @@ -0,0 +1,23 @@ +// +// Dictionary+SPAdd.swift +// Thimra +// +// Created by 佳尔 on 2025/4/25. +// + +import UIKit + +extension Dictionary { + + func toJsonString() -> String? { + do { + let data = try JSONSerialization.data(withJSONObject: self) + let jsonStr = String(data: data, encoding: .utf8) + return jsonStr + } catch { + + } + return nil + } + +} diff --git a/Thimra/Base/Extension/String+SPAdd.swift b/Thimra/Base/Extension/String+SPAdd.swift index f41c0d6..38c0f0a 100644 --- a/Thimra/Base/Extension/String+SPAdd.swift +++ b/Thimra/Base/Extension/String+SPAdd.swift @@ -20,7 +20,7 @@ extension String: SmartCodable { static func timeZone() -> String { let timeZone = NSTimeZone.local as NSTimeZone - let timeZoneAbbreviation = timeZone.name.length() > 0 ? timeZone.name : "Unknown" +// let timeZoneAbbreviation = timeZone.name.length() > 0 ? timeZone.name : "Unknown" let timeZoneSecondsFromGMT = timeZone.secondsFromGMT / 3600 return String(format: "GMT+0%d:00", timeZoneSecondsFromGMT) } diff --git a/Thimra/Base/Extension/UIColor+SPAdd.swift b/Thimra/Base/Extension/UIColor+SPAdd.swift index ea4b39c..410ff49 100644 --- a/Thimra/Base/Extension/UIColor+SPAdd.swift +++ b/Thimra/Base/Extension/UIColor+SPAdd.swift @@ -192,5 +192,17 @@ extension UIColor { static func colorE6334B(alpha: CGFloat = 1) -> UIColor { return color(hex: 0xE6334B, alpha: alpha) } + + static func color0866FF(alpha: CGFloat = 1) -> UIColor { + return color(hex: 0x0866FF, alpha: alpha) + } + + static func color333333(alpha: CGFloat = 1) -> UIColor { + return color(hex: 0x333333, alpha: alpha) + } + + static func colorB0B0B3(alpha: CGFloat = 1) -> UIColor { + return color(hex: 0xB0B0B3, alpha: alpha) + } } diff --git a/Thimra/Base/Networking/Base/SPURLPath.swift b/Thimra/Base/Networking/Base/SPURLPath.swift index a9c50b6..57d5124 100644 --- a/Thimra/Base/Networking/Base/SPURLPath.swift +++ b/Thimra/Base/Networking/Base/SPURLPath.swift @@ -20,11 +20,13 @@ let SPBaseURL = "https://api-thimratv.thimratv.com" let SPURLPathPrefix = "/0a2c5b02" let SPWebBaseURL = "https://www.thimratv.com" +let SPCampaignWebURL = "https://campaign.thimratv.com" #else let SPBaseURL = "https://api-thimratv.thimratv.com" let SPURLPathPrefix = "/0a2c5b02" let SPWebBaseURL = "https://www.thimratv.com" +let SPCampaignWebURL = "https://campaign.thimratv.com" #endif @@ -41,5 +43,8 @@ let SPPersoInforDisclosureWebUrl = SPWebBaseURL + "/persoInfor_disclosure" ///全国青少年互联网文明公约 let SPCivizatioConventionWebUrl = SPWebBaseURL + "/civizatio_convention" +///反馈首页 +let SPFeedBackHomeWebUrl = SPCampaignWebURL + "/pages/leave/index" + diff --git a/Thimra/Base/WebView/SPWebView.swift b/Thimra/Base/WebView/SPWebView.swift index 2696bec..86c8c36 100644 --- a/Thimra/Base/WebView/SPWebView.swift +++ b/Thimra/Base/WebView/SPWebView.swift @@ -13,7 +13,7 @@ class SPWebView: WKWebView { weak var delegate: SPWebViewDelegate? private(set) var scriptMessageHandlerArray: [SPWebViewMessageName] = [ - WebMessageGetUserInfo, + WebMessageAPP, ] diff --git a/Thimra/Base/WebView/SPWebViewController+ScriptMessage.swift b/Thimra/Base/WebView/SPWebViewController+ScriptMessage.swift index d722a37..ab5ede8 100644 --- a/Thimra/Base/WebView/SPWebViewController+ScriptMessage.swift +++ b/Thimra/Base/WebView/SPWebViewController+ScriptMessage.swift @@ -10,8 +10,8 @@ import WebKit typealias SPWebViewMessageName = String -///获取用户信息 -let WebMessageGetUserInfo: SPWebViewMessageName = "getUserInfo" +///APP交互 +let WebMessageAPP: SPWebViewMessageName = "js2app" extension SPWebViewController { diff --git a/Thimra/Base/WebView/SPWebViewController.swift b/Thimra/Base/WebView/SPWebViewController.swift index 865a152..ad397a4 100644 --- a/Thimra/Base/WebView/SPWebViewController.swift +++ b/Thimra/Base/WebView/SPWebViewController.swift @@ -29,17 +29,15 @@ class SPWebViewController: SPViewController { super.viewDidLoad() // self.edgesForExtendedLayout = .top configNavigationBack() - + + setBackgroundView(isShowGradient: false, bgImage: nil) + _setupUI() if let url = urlStr { self.load(urlString: url) } } - - override func setBgImageView() { - self.view.backgroundColor = .backgroundColor() - } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) @@ -79,7 +77,37 @@ extension SPWebViewController: SPWebViewDelegate { spLog(message: error) } + func webViewDidFinishLoad(_ webView: SPWebView) { + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in + self?.receiveDataFromNative() + } + + } + func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { _webViewUserContentController(didReceive: message) } } + +extension SPWebViewController { + + func receiveDataFromNative() { + let dic = [ + "token" : SPLoginManager.manager.token?.token ?? "", + "time_zone" : String.timeZone(), + "lang" : SPLocalizedManager.shared.currentLocalizedKey, + "type" : "ios", + "theme" : "theme_1", + ] + + if let json = dic.toJsonString() { + let js = "receiveDataFromNative(\(json))" + self.webView.evaluateJavaScript(js) { _, error in + + } + } + + } + +} diff --git a/Thimra/Class/Explore/Controller/SPAllShortViewController.swift b/Thimra/Class/Explore/Controller/SPAllShortViewController.swift index 9d44e00..89b7d25 100644 --- a/Thimra/Class/Explore/Controller/SPAllShortViewController.swift +++ b/Thimra/Class/Explore/Controller/SPAllShortViewController.swift @@ -111,7 +111,7 @@ class SPAllShortViewController: SPViewController { override func viewDidLoad() { super.viewDidLoad() - self.view.backgroundColor = .clear + setBackgroundView(isShowGradient: false, bgImage: nil, backgroundColor: .clear) requestCategoryList() requestDataArr(page: 1, completer: nil) @@ -122,19 +122,10 @@ class SPAllShortViewController: SPViewController { override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() - let widht: CGFloat = 100 - let height = self.tagView.tagHeight - let x = self.tagView.width - widht - let y = self.tagView.height - height -// openGradientLayer.frame = CGRect(x: x, y: y, width: widht, height: height) openGradientLayer.frame = self.tagView.bounds } - override func setBgImageView() { - - } - override func handleHeaderRefresh(_ completer: (() -> Void)?) { requestDataArr(page: 1) { [weak self] in self?.collectionView.sp_endHeaderRefreshing() diff --git a/Thimra/Class/Login/Controller/SPLoginViewController.swift b/Thimra/Class/Login/Controller/SPLoginViewController.swift new file mode 100644 index 0000000..fff9098 --- /dev/null +++ b/Thimra/Class/Login/Controller/SPLoginViewController.swift @@ -0,0 +1,149 @@ +// +// SPLoginViewController.swift +// Thimra +// +// Created by 佳尔 on 2025/4/25. +// + +import UIKit + +class SPLoginViewController: SPViewController { + + private lazy var logoImageView: UIImageView = { + let imageView = UIImageView(image: UIImage(named: "login_logo_icon_01")) + return imageView + }() + + private lazy var nameImageView: UIImageView = { + let imageView = UIImageView(image: UIImage(named: "login_logo_icon_02")) + return imageView + }() + + private lazy var stackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [faceBookButton, appleButton]) + stackView.axis = .vertical + stackView.spacing = 18 + return stackView + }() + + private lazy var faceBookButton: UIButton = { + let button = createButton(title: "Login with Facebook", titleColor: .colorFFFFFF(), icon: UIImage(named: "facebook_icon_01"), background: .color0866FF()) + return button + }() + + private lazy var appleButton: UIButton = { + let button = createButton(title: "Login with Apple", titleColor: .color333333(), icon: UIImage(named: "apple_icon_01"), background: .colorFFFFFF()) + return button + }() + + private lazy var agreementLabel: YYLabel = { + let agreementStr = "kLoginAgreementText".localized + let userAgreementStr = "User Agreement".localized + let privacyPolicy = "Privacy Policy".localized + let range1 = agreementStr.ocString().range(of: userAgreementStr) + let range2 = agreementStr.ocString().range(of: privacyPolicy) + + let text = NSMutableAttributedString(string: agreementStr) + text.font = .fontMedium(ofSize: 10) + text.color = .colorB0B0B3() + + text.setTextHighlight(range1, color: .colorFFFFFF(), backgroundColor: nil) { [weak self] _, _, _, _ in + guard let self = self else { return } + let vc = SPWebViewController() + vc.urlStr = SPUserAgreementWebUrl + self.navigationController?.pushViewController(vc, animated: true) + } + + text.setTextHighlight(range2, color: .colorFFFFFF(), backgroundColor: nil) { [weak self] _, _, _, _ in + guard let self = self else { return } + let vc = SPWebViewController() + vc.urlStr = SPPrivacyPolicyWebUrl + self.navigationController?.pushViewController(vc, animated: true) + } + + let textContainer = YYTextContainer(size: CGSize(width: kSPScreenWidth - 150, height: 100)) + + let layout = YYTextLayout(container: textContainer, text: text) + + let label = YYLabel() + label.textLayout = layout + label.textAlignment = .center + label.numberOfLines = 0 + return label + }() + + override func viewDidLoad() { + super.viewDidLoad() + self.edgesForExtendedLayout = .top + setBackgroundView(isShowGradient: false) + + configNavigationBack() + + _setupUI() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.navigationController?.setNavigationBarHidden(false, animated: true) + + setNavigationNormalStyle(backgroundColor: .clear, isTranslucent: true) + } + + + private func createButton(title: String, titleColor: UIColor, icon: UIImage?, background: UIColor) -> UIButton { + let button = JXButton(type: .custom) + button.setBackgroundImage(UIImage(color: background), for: .normal) + button.setTitle(title, for: .normal) + button.setTitleColor(titleColor, for: .normal) + button.jx_font = .fontMedium(ofSize: 14) + button.space = 12 + button.setImage(icon, for: .normal) + button.layer.cornerRadius = 8 + button.layer.masksToBounds = true + button.snp.makeConstraints { make in + make.height.equalTo(48) + } + return button + } + + +} + +extension SPLoginViewController { + + private func _setupUI() { + view.addSubview(logoImageView) + view.addSubview(nameImageView) + view.addSubview(stackView) + view.addSubview(agreementLabel) +// view.addSubview(faceBookButton) + + logoImageView.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.top.equalToSuperview().offset(kSPStatusbarHeight + kSPMainW(120)) + } + + nameImageView.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.top.equalTo(logoImageView.snp.bottom).offset(24) + } + + stackView.snp.makeConstraints { make in + make.left.equalToSuperview().offset(37) + make.centerX.equalToSuperview() + make.top.equalTo(nameImageView.snp.bottom).offset(40) + } + + let size = agreementLabel.textLayout?.textBoundingSize ?? .zero + + agreementLabel.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.size.equalTo(size) +// make.right.lessThanOrEqualToSuperview().offset(-50) + make.bottom.equalToSuperview().offset(-(kSPTabbarSafeBottomMargin + 20)) + } + + + } + +} diff --git a/Thimra/Class/Mine/Controller/SPAboutUsViewController.swift b/Thimra/Class/Mine/Controller/SPAboutUsViewController.swift index 515f60d..23d614d 100644 --- a/Thimra/Class/Mine/Controller/SPAboutUsViewController.swift +++ b/Thimra/Class/Mine/Controller/SPAboutUsViewController.swift @@ -38,7 +38,7 @@ class SPAboutUsViewController: SPViewController { override func viewDidLoad() { super.viewDidLoad() self.title = "About Us".localized - + setBackgroundView(isShowGradient: false, bgImage: nil) _setupUI() } @@ -47,10 +47,6 @@ class SPAboutUsViewController: SPViewController { self.navigationController?.setNavigationBarHidden(false, animated: true) setNavigationNormalStyle() } - - override func setBgImageView() { - self.view.backgroundColor = .backgroundColor() - } } diff --git a/Thimra/Class/Mine/Controller/SPMineViewController.swift b/Thimra/Class/Mine/Controller/SPMineViewController.swift index 5545a76..400c32c 100644 --- a/Thimra/Class/Mine/Controller/SPMineViewController.swift +++ b/Thimra/Class/Mine/Controller/SPMineViewController.swift @@ -12,6 +12,7 @@ class SPMineViewController: SPViewController { private lazy var dataArr: [SPMineItem] = { let arr = [ // SPMineItem(type: .language, iconImage: UIImage(named: "language_icon_01"), title: "Language".localized), + SPMineItem(type: .feedBack, iconImage: UIImage(named: "feed_back_icon_01"), title: "FeedBack".localized), SPMineItem(type: .privacyPolicy, iconImage: UIImage(named: "privacy_policy_icon_01"), title: "Privacy Policy".localized), SPMineItem(type: .userAgreement, iconImage: UIImage(named: "user_agreement_icon_01"), title: "User Agreement".localized), SPMineItem(type: .aboutUs, iconImage: UIImage(named: "about_us_icon_01"), title: "About Us".localized), @@ -40,7 +41,7 @@ class SPMineViewController: SPViewController { override func viewDidLoad() { super.viewDidLoad() - + setBackgroundView(isShowGradient: false) requestData() _setupUI() @@ -102,22 +103,27 @@ extension SPMineViewController: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let item = dataArr[indexPath.row] switch item.type { - case .privacyPolicy: - let vc = SPWebViewController() - vc.urlStr = SPPrivacyPolicyWebUrl - self.navigationController?.pushViewController(vc, animated: true) - - case .userAgreement: - let vc = SPWebViewController() - vc.urlStr = SPUserAgreementWebUrl - self.navigationController?.pushViewController(vc, animated: true) - - case .aboutUs: - let vc = SPAboutUsViewController() - self.navigationController?.pushViewController(vc, animated: true) - - default: - break + case .privacyPolicy: + let vc = SPWebViewController() + vc.urlStr = SPPrivacyPolicyWebUrl + self.navigationController?.pushViewController(vc, animated: true) + + case .userAgreement: + let vc = SPWebViewController() + vc.urlStr = SPUserAgreementWebUrl + self.navigationController?.pushViewController(vc, animated: true) + + case .aboutUs: + let vc = SPAboutUsViewController() + self.navigationController?.pushViewController(vc, animated: true) + + case .feedBack: + let vc = SPWebViewController() + vc.urlStr = SPFeedBackHomeWebUrl + self.navigationController?.pushViewController(vc, animated: true) + + default: + break } } } diff --git a/Thimra/Class/Mine/Model/SPMineItem.swift b/Thimra/Class/Mine/Model/SPMineItem.swift index cfa0b98..0bf08a8 100644 --- a/Thimra/Class/Mine/Model/SPMineItem.swift +++ b/Thimra/Class/Mine/Model/SPMineItem.swift @@ -29,6 +29,8 @@ struct SPMineItem { case informationSharing ///收集个人信息明示清单 case persoInforDisclosure + ///反馈 + case feedBack } diff --git a/Thimra/Class/Mine/View/SPMineHeaderView.swift b/Thimra/Class/Mine/View/SPMineHeaderView.swift index 814cc46..a986783 100644 --- a/Thimra/Class/Mine/View/SPMineHeaderView.swift +++ b/Thimra/Class/Mine/View/SPMineHeaderView.swift @@ -122,8 +122,11 @@ class SPMineHeaderView: UIView { } @objc private func handleLoginButton() { + let vc = SPLoginViewController() + let nav = SPNavigationController(rootViewController: vc) + nav.modalPresentationStyle = .fullScreen - + self.viewController?.present(nav, animated: true) } } diff --git a/Thimra/Class/MyList/Controller/SPCollectListViewController.swift b/Thimra/Class/MyList/Controller/SPCollectListViewController.swift index 57654a5..6d9e77c 100644 --- a/Thimra/Class/MyList/Controller/SPCollectListViewController.swift +++ b/Thimra/Class/MyList/Controller/SPCollectListViewController.swift @@ -46,14 +46,13 @@ class SPCollectListViewController: SPMyListChildViewController { override func viewDidLoad() { super.viewDidLoad() - + setBackgroundView(isShowGradient: false, bgImage: nil, backgroundColor: .clear) requestDataList(page: 1, completer: nil) _setupUI() } - override func setBgImageView() { } override func handleHeaderRefresh(_ completer: (() -> Void)?) { diff --git a/Thimra/Class/MyList/Controller/SPPlayHistoryViewController.swift b/Thimra/Class/MyList/Controller/SPPlayHistoryViewController.swift index abe8d0e..34621aa 100644 --- a/Thimra/Class/MyList/Controller/SPPlayHistoryViewController.swift +++ b/Thimra/Class/MyList/Controller/SPPlayHistoryViewController.swift @@ -48,11 +48,11 @@ class SPPlayHistoryViewController: SPMyListChildViewController { requestDataList(page: 1, completer: nil) + setBackgroundView(isShowGradient: false, bgImage: nil, backgroundColor: .clear) _setupUI() } - override func setBgImageView() { } override func handleHeaderRefresh(_ completer: (() -> Void)?) { diff --git a/Thimra/Libs/Login/SPLoginManager+Apple.swift b/Thimra/Libs/Login/SPLoginManager+Apple.swift new file mode 100644 index 0000000..b074e0f --- /dev/null +++ b/Thimra/Libs/Login/SPLoginManager+Apple.swift @@ -0,0 +1,70 @@ +// +// SPLoginManager+Apple.swift +// Thimra +// +// Created by 佳尔 on 2025/4/25. +// + +import UIKit +import AuthenticationServices + + +extension SPLoginManager { + + ///苹果登录 + func appleSignLogin(completer: ((_ model: SPThirdSignModel?) -> Void)?) { + // self.signAppleHandle = completer + + let appleIDProvider = ASAuthorizationAppleIDProvider() + let request = appleIDProvider.createRequest() + request.requestedScopes = [.fullName, .email] + + let authorizationController = ASAuthorizationController(authorizationRequests: [request]) + authorizationController.delegate = self + authorizationController.presentationContextProvider = self + authorizationController.performRequests() + } +} + +//MARK:-------------- ASAuthorizationControllerDelegate -------------- +extension SPLoginManager: ASAuthorizationControllerDelegate { + + func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) { + if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential { + + let userIdentifier = appleIDCredential.user + let fullName = appleIDCredential.fullName + let email = appleIDCredential.email + + let model = SPThirdSignModel() + model.userID = userIdentifier + model.givenName = fullName?.givenName + model.familyName = fullName?.familyName + model.name = fullName?.nickname + model.email = email + + spLog(message: userIdentifier) + spLog(message: fullName) + spLog(message: email) + +// if let signAppleHandle = signAppleHandle { +// signAppleHandle(model) +// } + } + } + + func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) { +// if let signAppleHandle = signAppleHandle { +// signAppleHandle(nil) +// } + } + +} + +extension SPLoginManager: ASAuthorizationControllerPresentationContextProviding { + + func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor { + return SPAPPTool.getKeyWindow()! + } + +} diff --git a/Thimra/Libs/Login/SPLoginManager+Facebook.swift b/Thimra/Libs/Login/SPLoginManager+Facebook.swift new file mode 100644 index 0000000..a8a5ee7 --- /dev/null +++ b/Thimra/Libs/Login/SPLoginManager+Facebook.swift @@ -0,0 +1,15 @@ +// +// SPLoginManager+Facebook.swift +// Thimra +// +// Created by 佳尔 on 2025/4/25. +// + +import UIKit + +//https://developers.facebook.com/docs/facebook-login/ios?checkpoint_src=any +extension SPLoginManager { + + + +} diff --git a/Thimra/Libs/Login/SPLoginManager.swift b/Thimra/Libs/Login/SPLoginManager.swift index 0b94fc3..1e20b25 100644 --- a/Thimra/Libs/Login/SPLoginManager.swift +++ b/Thimra/Libs/Login/SPLoginManager.swift @@ -9,6 +9,12 @@ import UIKit class SPLoginManager: NSObject { + enum LoginType: Int { + case apple + case faceBook + + } + static let manager = SPLoginManager() private(set) var token: SPTokenModel? @@ -27,6 +33,19 @@ class SPLoginManager: NSObject { UserDefaults.jx_setObject(token, forKey: kSPLoginTokenDefaultsKey) } + ///第三方登录 + func thirdLogin(type: LoginType, presentingViewController: UIViewController) { + + switch type { + case .apple: + appleSignLogin { model in + + } + default: + break + } + + } } diff --git a/Thimra/Libs/Login/SPThirdSignModel.swift b/Thimra/Libs/Login/SPThirdSignModel.swift new file mode 100644 index 0000000..8076b92 --- /dev/null +++ b/Thimra/Libs/Login/SPThirdSignModel.swift @@ -0,0 +1,24 @@ +// +// SPThirdSignModel.swift +// Thimra +// +// Created by 佳尔 on 2025/4/25. +// + +import UIKit + +class SPThirdSignModel: NSObject { + + var token: String? + + var userID: String? + var email: String? + var name: String? + //姓 + var familyName: String? + //名 + var givenName: String? + + var avatar: String? + +} diff --git a/Thimra/Source/Assets.xcassets/icon/apple_icon_01.imageset/Contents.json b/Thimra/Source/Assets.xcassets/icon/apple_icon_01.imageset/Contents.json new file mode 100644 index 0000000..6a4d508 --- /dev/null +++ b/Thimra/Source/Assets.xcassets/icon/apple_icon_01.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Vector@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Vector@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Thimra/Source/Assets.xcassets/icon/apple_icon_01.imageset/Vector@2x.png b/Thimra/Source/Assets.xcassets/icon/apple_icon_01.imageset/Vector@2x.png new file mode 100644 index 0000000..b4ac09b Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/apple_icon_01.imageset/Vector@2x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/apple_icon_01.imageset/Vector@3x.png b/Thimra/Source/Assets.xcassets/icon/apple_icon_01.imageset/Vector@3x.png new file mode 100644 index 0000000..bb26c1d Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/apple_icon_01.imageset/Vector@3x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/facebook_icon_01.imageset/Contents.json b/Thimra/Source/Assets.xcassets/icon/facebook_icon_01.imageset/Contents.json new file mode 100644 index 0000000..6a4d508 --- /dev/null +++ b/Thimra/Source/Assets.xcassets/icon/facebook_icon_01.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Vector@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Vector@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Thimra/Source/Assets.xcassets/icon/facebook_icon_01.imageset/Vector@2x.png b/Thimra/Source/Assets.xcassets/icon/facebook_icon_01.imageset/Vector@2x.png new file mode 100644 index 0000000..e029be0 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/facebook_icon_01.imageset/Vector@2x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/facebook_icon_01.imageset/Vector@3x.png b/Thimra/Source/Assets.xcassets/icon/facebook_icon_01.imageset/Vector@3x.png new file mode 100644 index 0000000..102639a Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/facebook_icon_01.imageset/Vector@3x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/feed_back_icon_01.imageset/Contents.json b/Thimra/Source/Assets.xcassets/icon/feed_back_icon_01.imageset/Contents.json new file mode 100644 index 0000000..5c4d3b1 --- /dev/null +++ b/Thimra/Source/Assets.xcassets/icon/feed_back_icon_01.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Thimra/Source/Assets.xcassets/icon/feed_back_icon_01.imageset/Frame@2x.png b/Thimra/Source/Assets.xcassets/icon/feed_back_icon_01.imageset/Frame@2x.png new file mode 100644 index 0000000..e8c51cc Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/feed_back_icon_01.imageset/Frame@2x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/feed_back_icon_01.imageset/Frame@3x.png b/Thimra/Source/Assets.xcassets/icon/feed_back_icon_01.imageset/Frame@3x.png new file mode 100644 index 0000000..9051d50 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/feed_back_icon_01.imageset/Frame@3x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/login_logo_icon_01.imageset/APP图标 2@2x.png b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_01.imageset/APP图标 2@2x.png new file mode 100644 index 0000000..75a3c54 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_01.imageset/APP图标 2@2x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/login_logo_icon_01.imageset/APP图标 2@3x.png b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_01.imageset/APP图标 2@3x.png new file mode 100644 index 0000000..c170c77 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_01.imageset/APP图标 2@3x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/login_logo_icon_01.imageset/Contents.json b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_01.imageset/Contents.json new file mode 100644 index 0000000..bd1be6e --- /dev/null +++ b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_01.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "APP图标 2@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "APP图标 2@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Thimra/Source/Assets.xcassets/icon/login_logo_icon_02.imageset/Contents.json b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_02.imageset/Contents.json new file mode 100644 index 0000000..c4e326a --- /dev/null +++ b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_02.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Thimra@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Thimra@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Thimra/Source/Assets.xcassets/icon/login_logo_icon_02.imageset/Thimra@2x.png b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_02.imageset/Thimra@2x.png new file mode 100644 index 0000000..7705287 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_02.imageset/Thimra@2x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/login_logo_icon_02.imageset/Thimra@3x.png b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_02.imageset/Thimra@3x.png new file mode 100644 index 0000000..364f598 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/login_logo_icon_02.imageset/Thimra@3x.png differ diff --git a/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/Contents.json b/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/Contents.json index 36577cc..1057d71 100644 --- a/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/Contents.json +++ b/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "bg@2x.png", + "filename" : "背景@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "bg@3x.png", + "filename" : "背景@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/bg@2x.png b/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/bg@2x.png deleted file mode 100644 index 31058f2..0000000 Binary files a/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/bg@2x.png and /dev/null differ diff --git a/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/bg@3x.png b/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/bg@3x.png deleted file mode 100644 index 31c4553..0000000 Binary files a/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/bg@3x.png and /dev/null differ diff --git a/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/背景@2x.png b/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/背景@2x.png new file mode 100644 index 0000000..6683069 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/背景@2x.png differ diff --git a/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/背景@3x.png b/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/背景@3x.png new file mode 100644 index 0000000..d68b92a Binary files /dev/null and b/Thimra/Source/Assets.xcassets/image/main_bg_image_01.imageset/背景@3x.png differ diff --git a/Thimra/Source/en.lproj/Localizable.strings b/Thimra/Source/en.lproj/Localizable.strings index 2dd8f65..c5966eb 100644 --- a/Thimra/Source/en.lproj/Localizable.strings +++ b/Thimra/Source/en.lproj/Localizable.strings @@ -20,6 +20,7 @@ "Episodes" = "Episodes"; "Save" = "Save"; "Added" = "Added"; +"FeedBack" = "FeedBack"; "Language" = "Language"; "Privacy Policy" = "Privacy Policy"; "User Agreement" = "User Agreement"; @@ -52,3 +53,7 @@ "Log in" = "Log in"; + +"kLoginAgreementText" = "By continuing, you agree to the User Agreement and Privacy Policy"; + +