|
@@ -6,11 +6,10 @@
|
|
|
//
|
|
|
|
|
|
class TSMineVC: TSBaseVC {
|
|
|
-
|
|
|
lazy var navBarView: TSBaseNavContentBarView = {
|
|
|
let navBarView = TSBaseNavContentBarView()
|
|
|
- let titleImageView = UIImageView.createImageView(imageName: "nav_title_setting",contentMode: .scaleToFill)
|
|
|
-
|
|
|
+ let titleImageView = UIImageView.createImageView(imageName: "nav_title_setting", contentMode: .scaleToFill)
|
|
|
+
|
|
|
navBarView.barView.addSubview(titleImageView)
|
|
|
titleImageView.snp.makeConstraints { make in
|
|
|
make.centerY.equalToSuperview()
|
|
@@ -18,25 +17,22 @@ class TSMineVC: TSBaseVC {
|
|
|
}
|
|
|
return navBarView
|
|
|
}()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
lazy var vipBgImageView: UIImageView = {
|
|
|
- let vipBgImageView = UIImageView.createImageView(imageName: "noVip_big_bg",contentMode:.scaleToFill)
|
|
|
+ let vipBgImageView = UIImageView.createImageView(imageName: "noVip_big_bg", contentMode: .scaleToFill)
|
|
|
vipBgImageView.isUserInteractionEnabled = true
|
|
|
return vipBgImageView
|
|
|
}()
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
lazy var vipTimeLabel: UILabel = {
|
|
|
- let vipTimeLabel = UILabel.createLabel(text: "Limited Time Discount",font: .font(size: 14),textColor: .lesserText)
|
|
|
+ let vipTimeLabel = UILabel.createLabel(text: "Limited Time Discount", font: .font(size: 14), textColor: .lesserText)
|
|
|
return vipTimeLabel
|
|
|
}()
|
|
|
-
|
|
|
+
|
|
|
lazy var upgradeBtn: UIButton = {
|
|
|
- let upgradeBtn = TSViewTool.createNormalSubmitBtn(title: "Upgrade".localized) { [weak self] in
|
|
|
+ let upgradeBtn = TSViewTool.createNormalSubmitBtn(title: "Upgrade".localized) { [weak self] in
|
|
|
guard let self = self else { return }
|
|
|
- TSPurchaseVC.show(target: self) {[weak self] in
|
|
|
+ TSPurchaseVC.show(target: self) { [weak self] in
|
|
|
guard let self = self else { return }
|
|
|
updateVipView()
|
|
|
}
|
|
@@ -45,7 +41,7 @@ class TSMineVC: TSBaseVC {
|
|
|
upgradeBtn.titleLabel?.font = .font(size: 14)
|
|
|
return upgradeBtn
|
|
|
}()
|
|
|
-
|
|
|
+
|
|
|
lazy var headerView: UIView = {
|
|
|
let headerView = UIView()
|
|
|
headerView.frame = CGRect(x: 0, y: 0, width: k_ScreenWidth, height: 88)
|
|
@@ -54,21 +50,21 @@ class TSMineVC: TSBaseVC {
|
|
|
make.top.equalTo(0)
|
|
|
make.leading.trailing.bottom.equalTo(0)
|
|
|
}
|
|
|
-
|
|
|
- let liveImageView = UIImageView.createImageView(imageName: "dmanagepro")
|
|
|
+
|
|
|
+ let liveImageView = UIImageView.createImageView(imageName: "Dmanager_pro")
|
|
|
vipBgImageView.addSubview(liveImageView)
|
|
|
liveImageView.snp.makeConstraints { make in
|
|
|
make.leading.equalTo(16)
|
|
|
make.top.equalTo(19)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
vipBgImageView.addSubview(vipTimeLabel)
|
|
|
vipTimeLabel.snp.makeConstraints { make in
|
|
|
make.leading.equalTo(16)
|
|
|
make.bottom.equalTo(-19)
|
|
|
make.height.equalTo(14.0)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
vipBgImageView.addSubview(upgradeBtn)
|
|
|
upgradeBtn.snp.makeConstraints { make in
|
|
|
make.width.equalTo(86)
|
|
@@ -76,140 +72,153 @@ class TSMineVC: TSBaseVC {
|
|
|
make.trailing.equalTo(-29)
|
|
|
make.centerY.equalToSuperview()
|
|
|
}
|
|
|
-
|
|
|
|
|
|
return headerView
|
|
|
}()
|
|
|
-
|
|
|
-
|
|
|
- lazy var simpleTableView:TSSimpleTableView = {
|
|
|
+
|
|
|
+ lazy var simpleTableView: TSSimpleTableView = {
|
|
|
let simpleTableView = TSSimpleTableView()
|
|
|
simpleTableView.reuseClass = ["TSMineCell"]
|
|
|
simpleTableView.dataArray = dataArray
|
|
|
simpleTableView.tableView.tableHeaderView = headerView
|
|
|
return simpleTableView
|
|
|
}()
|
|
|
-
|
|
|
-
|
|
|
- lazy var dataArray:[TSBasicSectionModel] = {
|
|
|
+
|
|
|
+ lazy var dataArray: [TSBasicSectionModel] = {
|
|
|
var dataArray = [TSBasicSectionModel]()
|
|
|
let sectionModel = TSBasicSectionModel()
|
|
|
dataArray.append(sectionModel)
|
|
|
-
|
|
|
+
|
|
|
sectionModel.addSubItemModel(
|
|
|
TSBasicItemModel.createItemModel(
|
|
|
- leftTitle: "Rate us".localized,
|
|
|
- rightViewStyle: 0,
|
|
|
- rightString: "",
|
|
|
- rightIsHave: true,
|
|
|
- height: 80,
|
|
|
- rectCorner:.allCorners,
|
|
|
- tapBlock: {[weak self] itemModel, index, view in
|
|
|
-
|
|
|
- guard let self = self else { return }
|
|
|
- let appStoreLink = "itms-apps://itunes.apple.com/app/id\(TSConfig.appid)"
|
|
|
- if let url = URL(string: appStoreLink + "?action=write-review"),
|
|
|
- UIApplication.shared.canOpenURL(url) {
|
|
|
- UIApplication.shared.open(url)
|
|
|
- }
|
|
|
- }))
|
|
|
-
|
|
|
+ leftTitle: "Update".localized,
|
|
|
+ rightViewStyle: 0,
|
|
|
+ rightString: "",
|
|
|
+ rightIsHave: true,
|
|
|
+ height: 80,
|
|
|
+ rectCorner: .allCorners,
|
|
|
+ tapBlock: { [weak self] _, _, _ in
|
|
|
+ let httpAppStoreLink = "https://apps.apple.com/app/id\(TSConfig.appid)"
|
|
|
+ guard let appStoreURL = URL(string: httpAppStoreLink) else { return }
|
|
|
+
|
|
|
+ if UIApplication.shared.canOpenURL(appStoreURL) {
|
|
|
+ UIApplication.shared.open(appStoreURL, options: [:], completionHandler: nil)
|
|
|
+ }
|
|
|
+ }))
|
|
|
+
|
|
|
sectionModel.addSubItemModel(
|
|
|
TSBasicItemModel.createItemModel(
|
|
|
- leftTitle: "Share us".localized,
|
|
|
- rightViewStyle: 0,
|
|
|
- rightString: "",
|
|
|
- rightIsHave: true,
|
|
|
- height: 80,
|
|
|
- rectCorner:.allCorners,
|
|
|
- tapBlock: {[weak self] itemModel, index, view in
|
|
|
- guard let self = self else { return }
|
|
|
+ leftTitle: "Rate us".localized,
|
|
|
+ rightViewStyle: 0,
|
|
|
+ rightString: "",
|
|
|
+ rightIsHave: true,
|
|
|
+ height: 80,
|
|
|
+ rectCorner: .allCorners,
|
|
|
+ tapBlock: { [weak self] _, _, _ in
|
|
|
+
|
|
|
+ guard let self = self else { return }
|
|
|
+ let appStoreLink = "itms-apps://itunes.apple.com/app/id\(TSConfig.appid)"
|
|
|
+ if let url = URL(string: appStoreLink + "?action=write-review"),
|
|
|
+ UIApplication.shared.canOpenURL(url) {
|
|
|
+ UIApplication.shared.open(url)
|
|
|
+ }
|
|
|
+ }))
|
|
|
+
|
|
|
+ sectionModel.addSubItemModel(
|
|
|
+ TSBasicItemModel.createItemModel(
|
|
|
+ leftTitle: "Share us".localized,
|
|
|
+ rightViewStyle: 0,
|
|
|
+ rightString: "",
|
|
|
+ rightIsHave: true,
|
|
|
+ height: 80,
|
|
|
+ rectCorner: .allCorners,
|
|
|
+ tapBlock: { [weak self] _, _, _ in
|
|
|
+ guard let self = self else { return }
|
|
|
|
|
|
- let httpAppStoreLink = "https://apps.apple.com/app/id\(TSConfig.appid)"
|
|
|
- let text = ""
|
|
|
- let url = URL(string: httpAppStoreLink)!
|
|
|
- let image = UIImage(named: "App-Icon")!
|
|
|
- let vc = UIActivityViewController(activityItems: [image, text, url], applicationActivities: nil)
|
|
|
- vc.completionWithItemsHandler = { activity, value, _, error in
|
|
|
- if let type = activity, type == .copyToPasteboard {
|
|
|
- UIPasteboard.general.string = httpAppStoreLink
|
|
|
+ let httpAppStoreLink = "https://apps.apple.com/app/id\(TSConfig.appid)"
|
|
|
+ let text = ""
|
|
|
+ let url = URL(string: httpAppStoreLink)!
|
|
|
+ let image = UIImage(named: "App-Icon")!
|
|
|
+ let vc = UIActivityViewController(activityItems: [image, text, url], applicationActivities: nil)
|
|
|
+ vc.completionWithItemsHandler = { activity, _, _, _ in
|
|
|
+ if let type = activity, type == .copyToPasteboard {
|
|
|
+ UIPasteboard.general.string = httpAppStoreLink
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if UIDevice.isPad {
|
|
|
- if let popover = vc.popoverPresentationController {
|
|
|
- popover.sourceView = self.view // 设置锚点视图
|
|
|
- popover.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0) // 设置弹窗位置为屏幕中心
|
|
|
- popover.permittedArrowDirections = [] // 禁止箭头指向
|
|
|
+
|
|
|
+ if UIDevice.isPad {
|
|
|
+ if let popover = vc.popoverPresentationController {
|
|
|
+ popover.sourceView = self.view // 设置锚点视图
|
|
|
+ popover.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0) // 设置弹窗位置为屏幕中心
|
|
|
+ popover.permittedArrowDirections = [] // 禁止箭头指向
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- self.present(vc, animated: true)
|
|
|
-
|
|
|
- }))
|
|
|
-
|
|
|
+
|
|
|
+ self.present(vc, animated: true)
|
|
|
+
|
|
|
+ }))
|
|
|
+
|
|
|
sectionModel.addSubItemModel(
|
|
|
TSBasicItemModel.createItemModel(
|
|
|
- leftTitle: "Privacy Policy".localized,
|
|
|
- rightViewStyle: 0,
|
|
|
- rightString: "",
|
|
|
- rightIsHave: true,
|
|
|
- height: 80,
|
|
|
- rectCorner:.allCorners,
|
|
|
- tapBlock: {[weak self] itemModel, index, view in
|
|
|
- guard let self = self else { return }
|
|
|
- let vc = TSBusinessWebVC(urlType: .privacy)
|
|
|
- vc.hidesBottomBarWhenPushed = true
|
|
|
- navigationController?.pushViewController(vc, animated: true)
|
|
|
- }))
|
|
|
-
|
|
|
+ leftTitle: "Privacy Policy".localized,
|
|
|
+ rightViewStyle: 0,
|
|
|
+ rightString: "",
|
|
|
+ rightIsHave: true,
|
|
|
+ height: 80,
|
|
|
+ rectCorner: .allCorners,
|
|
|
+ tapBlock: { [weak self] _, _, _ in
|
|
|
+ guard let self = self else { return }
|
|
|
+ let vc = TSBusinessWebVC(urlType: .privacy)
|
|
|
+ vc.hidesBottomBarWhenPushed = true
|
|
|
+ navigationController?.pushViewController(vc, animated: true)
|
|
|
+ }))
|
|
|
+
|
|
|
sectionModel.addSubItemModel(
|
|
|
TSBasicItemModel.createItemModel(
|
|
|
- leftTitle: "Terms of Service".localized,
|
|
|
- rightViewStyle: 0,
|
|
|
- rightString: "",
|
|
|
- rightIsHave: true,
|
|
|
- height: 80,
|
|
|
- rectCorner:.allCorners,
|
|
|
- tapBlock: {[weak self] itemModel, index, view in
|
|
|
- guard let self = self else { return }
|
|
|
- let vc = TSBusinessWebVC(urlType: .terms)
|
|
|
- vc.hidesBottomBarWhenPushed = true
|
|
|
- navigationController?.pushViewController(vc, animated: true)
|
|
|
- }))
|
|
|
-
|
|
|
+ leftTitle: "Terms of Service".localized,
|
|
|
+ rightViewStyle: 0,
|
|
|
+ rightString: "",
|
|
|
+ rightIsHave: true,
|
|
|
+ height: 80,
|
|
|
+ rectCorner: .allCorners,
|
|
|
+ tapBlock: { [weak self] _, _, _ in
|
|
|
+ guard let self = self else { return }
|
|
|
+ let vc = TSBusinessWebVC(urlType: .terms)
|
|
|
+ vc.hidesBottomBarWhenPushed = true
|
|
|
+ navigationController?.pushViewController(vc, animated: true)
|
|
|
+ }))
|
|
|
+
|
|
|
sectionModel.addSubItemModel(
|
|
|
TSBasicItemModel.createItemModel(
|
|
|
- leftTitle: "About us".localized,
|
|
|
- rightViewStyle: 0,
|
|
|
- rightString: appVersion(),
|
|
|
- rightIsHave: false,
|
|
|
- height: 80,
|
|
|
- rectCorner:.allCorners,
|
|
|
- tapBlock: {[weak self] itemModel, index, view in
|
|
|
- guard let self = self else { return }
|
|
|
+ leftTitle: "About us".localized,
|
|
|
+ rightViewStyle: 0,
|
|
|
+ rightString: appVersion(),
|
|
|
+ rightIsHave: false,
|
|
|
+ height: 80,
|
|
|
+ rectCorner: .allCorners,
|
|
|
+ tapBlock: { [weak self] _, _, _ in
|
|
|
+ guard let self = self else { return }
|
|
|
+
|
|
|
+ #if DEBUG
|
|
|
+ let vc = TSPurchaseVC()
|
|
|
+ vc.hidesBottomBarWhenPushed = true
|
|
|
+ kPresentModalVC(target: self, modelVC: vc)
|
|
|
+ #endif
|
|
|
+
|
|
|
+ }))
|
|
|
|
|
|
-#if DEBUG
|
|
|
- let vc = TSPurchaseVC()
|
|
|
- vc.hidesBottomBarWhenPushed = true
|
|
|
- kPresentModalVC(target: self, modelVC: vc)
|
|
|
-#endif
|
|
|
-
|
|
|
- }))
|
|
|
-
|
|
|
return dataArray
|
|
|
-
|
|
|
+
|
|
|
}()
|
|
|
-
|
|
|
+
|
|
|
override func createView() {
|
|
|
-
|
|
|
setViewBgImageNamed(named: "view_main_bg")
|
|
|
-
|
|
|
+
|
|
|
navBarContentView.addSubview(navBarView)
|
|
|
navBarView.snp.makeConstraints { make in
|
|
|
make.edges.equalToSuperview()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
contentView.addSubview(simpleTableView.tableView)
|
|
|
simpleTableView.tableView.snp.makeConstraints { make in
|
|
|
make.leading.equalTo(16)
|
|
@@ -218,22 +227,22 @@ class TSMineVC: TSBaseVC {
|
|
|
make.bottom.equalTo(0)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
override func viewWillAppear(_ animated: Bool) {
|
|
|
updateVipView()
|
|
|
}
|
|
|
-
|
|
|
- func updateVipView(){
|
|
|
+
|
|
|
+ func updateVipView() {
|
|
|
vipTimeLabel.text = PurchaseManager.default.expiredDateString
|
|
|
- vipBgImageView.image = UIImage(named: PurchaseManager.default.isVip ? "vip_big_bg" : "noVip_big_bg")
|
|
|
-
|
|
|
+ vipBgImageView.image = UIImage(named: PurchaseManager.default.isVip ? "vip_big_bg" : "noVip_big_bg")
|
|
|
+
|
|
|
if PurchaseManager.default.isVip {
|
|
|
vipTimeLabel.text = "Due Date: \(PurchaseManager.default.expiredDateString)"
|
|
|
- vipBgImageView.image = UIImage(named: "vip_big_bg")
|
|
|
+ vipBgImageView.image = UIImage(named: "vip_big_bg")
|
|
|
upgradeBtn.isHidden = true
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
vipTimeLabel.text = "Limited Time Discount"
|
|
|
- vipBgImageView.image = UIImage(named:"noVip_big_bg")
|
|
|
+ vipBgImageView.image = UIImage(named: "noVip_big_bg")
|
|
|
upgradeBtn.isHidden = false
|
|
|
}
|
|
|
}
|