Commit b178d6f1 authored by Steven杜宇's avatar Steven杜宇

Merge branch 'youhua-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into youhua-dev

parents 7829efe4 b1f52ff4
...@@ -41,7 +41,7 @@ platform :ios do ...@@ -41,7 +41,7 @@ platform :ios do
# 显示git当前分支最新submit id # 显示git当前分支最新submit id
sh "git rev-parse HEAD" sh "git rev-parse HEAD"
# 更新pod第三方库 # 更新pod第三方库
cocoapods(use_bundle_exec: true) # cocoapods(use_bundle_exec: true)
# 先清空打包路径下的文件 # 先清空打包路径下的文件
sh "pwd" sh "pwd"
......
This diff is collapsed.
//
// YHStatusAdvantageVC.swift
// galaxy
//
// Created by davidhuangA on 2024/7/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import WebKit
/*
身份优势
*/
class YHStatusAdvantageVC: YHBaseViewController, WKUIDelegate, WKNavigationDelegate {
var webview = WKWebView()
var progBar = UIProgressView()
var url = "https://cdn-public.galaxy-immi.com/app/pic/sfys.png"
lazy var noNetWorkTipsView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("无网络", kNotNetWorkBgName)
view.topMargin = 222
view.backgroundColor = .white
view.isHidden = true
return view
}()
//是否曾今有过网络
private var isNetWorkOkBefore : Bool = false
override func viewDidLoad() {
super.viewDidLoad()
gk_navBarAlpha = 1.0
gk_navLineHidden = false
gk_navTitle = "身份优势"
NotificationCenter.default.addObserver(self, selector: #selector(updateNetWorkUI), name: .reachabilityChanged, object: nil)
view.backgroundColor = .white
//获取导航栏高度
let navHeight = self.navigationController?.navigationBar.frame.height
//获取状态栏高度
let statusHeight = k_Height_statusBar()
// 创建wkwebview
webview = WKWebView(frame: CGRect(x: 0, y: statusHeight + navHeight!, width: self.view.frame.width, height: self.view.frame.height - statusHeight - navHeight! - 59 - k_Height_safeAreaInsetsBottom()))
webview.navigationDelegate = self
// 创建网址
let url = NSURL(string: url)
// 创建请求
let request = NSURLRequest(url: url! as URL)
// 加载请求
webview.load(request as URLRequest)
// 添加wkwebview
self.view.addSubview(webview)
webview.snp.makeConstraints { make in
make.top.equalToSuperview().offset(-20)
make.left.right.bottom.equalToSuperview()
}
webview.scrollView.contentInsetAdjustmentBehavior = .never
// 加载网页的进度条
progBar = UIProgressView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 30))
progBar.progress = 0.0
progBar.tintColor = UIColor.brandMainColor
webview.addSubview(progBar)
// 监听网页加载的进度
webview.addObserver(self, forKeyPath: "estimatedProgress", options: .new, context: nil)
view.addSubview(noNetWorkTipsView)
self.noNetWorkTipsView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
}
updateNetWorkStatusUI(needReload: false)
}
deinit {
webview.removeObserver(self, forKeyPath: "estimatedProgress")
NotificationCenter.default.removeObserver(self)
}
}
// MARK: - 内部方法
private extension YHStatusAdvantageVC {
func addRightItems() {
let rightButtonItem = UIBarButtonItem(image: UIImage(named: "share_item")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(share))
gk_navRightBarButtonItem = rightButtonItem
gk_navItemRightSpace = 16
}
@objc func share() {
if !YHNetworkStatusManager.shared.isNetWorkOK {
YHHUD.flash(message: "网络不可用,请检查网络设置")
return
}
// YHShareManager.shared.sendLinkContent("", "", , link: self.url)
// YHShareManager.shared.sendLinkContent(link: "https://www.baidu.com/")
YHShareManager.shared.sendLinkContent("Nick哥:我是标题", "Nick哥-这是分享描述", UIImage(named: "AppIcon") ?? UIImage(), link: "https://www.baidu.com/") //todo : for test hjl
// YHShareManager.shared.sendMiniProgram(path: <#T##String#>, name: <#T##String#>)
// if YHLoginManager.shared.isLogin() {
// if vcTitle == "香港身份测评码" {
// guard let url = URL(string: url) else {
// return
// }
// let task = URLSession.shared.dataTask(with: url) { data, response, error in
// DispatchQueue.main.async {
// guard let data = data, error == nil else { return }
// let image = UIImage(data: data)
// if let image = image {
// YHShareManager.shared.sendImageContent(image)
// }
// }
// }
// task.resume()
// } else {
// guard let url = URL(string: self.model.img_url) else {
// return
// }
// let task = URLSession.shared.dataTask(with: url) { data, response, error in
// DispatchQueue.main.async {
// guard let data = data, error == nil else { return }
// let image = UIImage(data: data)
// if let image = image {
// YHShareManager.shared.sendLinkContent(self.model.title, "", image, link: self.url)
// }
// }
// }
// task.resume()
// }
// } else {
// YHOneKeyLoginManager.shared.oneKeyLogin()
// }
}
@objc func updateNetWorkUI() {
updateNetWorkStatusUI(needReload: true)
}
func updateNetWorkStatusUI(needReload:Bool) {
DispatchQueue.main.async {
if YHNetworkStatusManager.shared.isNetWorkOK {
if needReload && self.isNetWorkOkBefore == false {
self.webview.stopLoading()
let targetUrl = NSURL(string: self.url)
let request = NSURLRequest(url: targetUrl! as URL)
self.webview.load(request as URLRequest)
}
self.isNetWorkOkBefore = true
}
if self.isNetWorkOkBefore == false {
self.view.bringSubviewToFront(self.noNetWorkTipsView)
self.noNetWorkTipsView.isHidden = YHNetworkStatusManager.shared.isNetWorkOK
} else {
self.noNetWorkTipsView.isHidden = true
}
}
}
// MARK: - webview function
@objc func toBack() {
if webview.canGoBack {
webview.goBack()
}
}
@objc func toForward() {
if webview.canGoForward {
webview.goForward()
}
}
}
// MARK: - WKNavigationDelegate
extension YHStatusAdvantageVC {
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "estimatedProgress" {
self.progBar.alpha = 1.0
progBar.setProgress(Float(webview.estimatedProgress), animated: true)
//进度条的值最大为1.0
if(self.webview.estimatedProgress >= 1.0) {
UIView.animate(withDuration: 0.3, delay: 0.1, options: .curveEaseInOut, animations: { () -> Void in
self.progBar.alpha = 0.0
}, completion: { (finished:Bool) -> Void in
self.progBar.progress = 0
})
}
}
}
override class func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
// addRightItems()
}
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
// 实现非安全链接的跳转。如果目标主视图不为空,则允许导航
if !(navigationAction.targetFrame?.isMainFrame != nil) {
webview.load(navigationAction.request)
}
return nil
}
func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
// 修复弹窗弹出的问题
let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (_) -> Void in
completionHandler()
}))
self.present(alert, animated: true, completion: nil)
}
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
printLog("\(error.localizedDescription)")
}
}
//
// YHInvitationWithGiftsViewController.swift
// galaxy
//
// Created by EDY on 2024/7/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHInvitationWithGiftsViewController: YHBaseViewController {
var tableView: UITableView!
var bottomViewForShare: YHInvitationWithGiftsShareBottomView!
lazy var headView : YHInvitationWithGiftsHeadView = {
let headView = YHInvitationWithGiftsHeadView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 666))
return headView
}()
override func viewDidLoad() {
super.viewDidLoad()
setView()
loadData()
}
}
extension YHInvitationWithGiftsViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withClass: YHInvitationWithGiftsFirstTableViewCell.self)
return cell
} else {
let cell = tableView.dequeueReusableCell(withClass: YHInvitationWithGiftsSecondTableViewCell.self)
return cell
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
return 209
} else if indexPath.row == 1 {
return 673
}
return 0
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.01
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
}
extension YHInvitationWithGiftsViewController {
func getData() {
}
func updateDataSource() {
}
func setView() {
view.backgroundColor = .contentBkgColor
tableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.contentInsetAdjustmentBehavior = .never
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.showsHorizontalScrollIndicator = false
tableView.showsVerticalScrollIndicator = false
tableView.dataSource = self
tableView.delegate = self
tableView.tableHeaderView = headView
tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 0.01))
tableView.register(cellWithClass: YHInvitationWithGiftsFirstTableViewCell.self)
tableView.register(cellWithClass: YHInvitationWithGiftsSecondTableViewCell.self)
return tableView
}()
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.bottom.equalTo(-98)
}
bottomViewForShare = {
let view = YHInvitationWithGiftsShareBottomView()
return view
}()
view.addSubview(bottomViewForShare)
bottomViewForShare.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(98)
}
}
func loadData() {
}
}
//
// YHInvitationNumberItemView.swift
// galaxy
//
// Created by EDY on 2024/7/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHInvitationNumberItemView: UIView {
var leftImageView: UIImageView!
var rightImageView: UIImageView!
var titleLabel: UILabel!
var bottomLabel: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
leftImageView = {
let view = UIImageView()
view.image = UIImage(named: "invitation_with_gifts_number_left")
return view
}()
addSubview(leftImageView)
leftImageView.snp.makeConstraints { make in
make.left.equalToSuperview()
make.width.height.equalTo(19)
make.top.equalTo(24)
}
rightImageView = {
let view = UIImageView()
view.image = UIImage(named: "invitation_with_gifts_number_right")
return view
}()
addSubview(rightImageView)
rightImageView.snp.makeConstraints { make in
make.right.equalToSuperview()
make.width.height.equalTo(19)
make.top.equalTo(24)
}
titleLabel = {
let view = UILabel()
view.text = "38"
view.font = UIFont.PFSC_M(ofSize: 24)
view.textColor = UIColor.mainTextColor
view.textAlignment = .center
return view
}()
addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.top.equalTo(15)
make.left.right.equalToSuperview()
make.height.equalTo(33)
}
bottomLabel = {
let view = UILabel()
view.text = "已注册"
view.font = UIFont.PFSC_M(ofSize: 12)
view.textColor = UIColor.yhGreyColor
view.textAlignment = .center
return view
}()
addSubview(bottomLabel)
bottomLabel.snp.makeConstraints { make in
make.top.equalTo(47)
make.left.right.equalToSuperview()
make.height.equalTo(17)
}
}
}
class YHInvitationPeopleItemView: UIView {
var titleLabel: UILabel!
var bgImageView: UIImageView!
override init(frame: CGRect) {
super.init(frame: frame)
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
self.backgroundColor = UIColor(hex: 0xebf4fe)
titleLabel = {
let view = UILabel()
view.text = "12"
view.font = UIFont.PFSC_M(ofSize: 12)
view.textColor = UIColor.mainTextColor70
view.textAlignment = .left
return view
}()
addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.top.equalTo(10)
make.left.equalTo(10)
make.height.equalTo(17)
make.right.equalToSuperview()
}
bgImageView = {
let view = UIImageView()
view.isHidden = true
view.isUserInteractionEnabled = true
view.image = UIImage(named: "invitation_with_gifts_people_true")
return view
}()
addSubview(bgImageView)
bgImageView.snp.makeConstraints { make in
make.width.height.equalTo(14)
make.center.equalToSuperview()
}
}
}
//
// YHInvitationWithGiftsFirstTableViewCell.swift
// galaxy
//
// Created by EDY on 2024/7/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHInvitationWithGiftsFirstTableViewCell: UITableViewCell {
var centerImageView: UIImageView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
setupUI()
}
func setupUI() {
self.backgroundColor = UIColor(hex: 0xededed)
centerImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "invitation_with_gifts_first")
return imageView
}()
contentView.addSubview(centerImageView)
centerImageView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(12)
make.right.equalTo(-12)
make.height.equalTo(193)
}
}
}
//
// YHInvitationWithGiftsHeadView.swift
// galaxy
//
// Created by EDY on 2024/7/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHInvitationWithGiftsHeadView: UIView {
var centerImageView: UIImageView!
var bottomImageView: UIImageView!
override init(frame: CGRect) {
super.init(frame: frame)
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
self.backgroundColor = UIColor(hex: 0xededed)
centerImageView = {
let view = UIImageView()
view.image = UIImage(named: "invitation_with_gifts_head")
return view
}()
addSubview(centerImageView)
centerImageView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(510)
}
bottomImageView = {
let view = UIImageView()
view.image = UIImage(named: "invitation_with_gifts_head_bottom")
return view
}()
addSubview(bottomImageView)
bottomImageView.snp.makeConstraints { make in
make.height.equalTo(262)
make.left.equalTo(12)
make.right.equalTo(-12)
make.bottom.equalTo(-8)
}
}
func updateAllViews() {
}
}
//
// YHInvitationWithGiftsShareBottomView.swift
// galaxy
//
// Created by EDY on 2024/7/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHInvitationWithGiftsShareBottomView: UIView {
static let viewH : CGFloat = 98.0
override init(frame: CGRect) {
super.init(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: YHBasicInfoFillBottomView.viewH))
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
typealias Block = (Int) -> ()
var block: Block?
var saveButton: UIButton!
}
private extension YHInvitationWithGiftsShareBottomView {
func setupUI() {
saveButton = {
let button = UIButton(type: .custom)
button.adjustsImageWhenHighlighted = false
button.setBackgroundImage(UIImage(named: "invitation_with_gifts_share"), for: .normal)
button.addTarget(self, action: #selector(save), for: .touchUpInside)
return button
}()
addSubview(saveButton)
saveButton.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.height.equalTo(58)
make.width.equalTo(343)
make.top.equalTo(5)
}
}
@objc func save() {
block?(0)
}
}
...@@ -52,8 +52,8 @@ private extension YHHomeKingKongBlockView { ...@@ -52,8 +52,8 @@ private extension YHHomeKingKongBlockView {
if let tag = gestureRecognizer.view?.tag { if let tag = gestureRecognizer.view?.tag {
switch tag { switch tag {
case 0: case 0:
let vc = YHOtherServiceViewController() //身份优势
vc.classID = 3 let vc = YHStatusAdvantageVC()
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
case 1: case 1:
let vc = YHOtherServiceViewController() let vc = YHOtherServiceViewController()
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_first@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_first@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_head@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_head@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_head_bottom@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_head_bottom@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_number_left@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_number_left@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_number_right@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_number_right@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_people_false@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_people_false@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_people_true@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_people_true@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_second_left@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_second_left@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_second_line@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_second_line@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_second_number_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_second_number_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_second_right@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_second_right@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_second_title@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_second_title@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_share@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_share@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment