Commit c06e7402256d4e56fc523dfefbd6c3b66dc3032e

Authored by 张旭
1 parent 160d309e

设置-跳过片头片尾开关 , 存储变更状态

metaCode/Classes/Main/MinePage/Controller/CNLiveTypeFeedBackViewController.swift
... ... @@ -45,6 +45,7 @@ class CNLiveTypeFeedBackViewController : CNLiveBaseViewController, UITableViewDe
45 45 if _show_type == .setting {
46 46 dataArray.add(["icon":"mine_set_bangding","name":"绑定管理"])
47 47 dataArray.add(["icon":"mine_list_sub_set_privacy","name":"隐私"])
  48 + dataArray.add(["icon":"mine_list_sub_skip","name":"剧集视频跳过片头片尾"])
48 49 dataArray.add(["icon":"mine_list_sub_set_about","name":"关于我们"])
49 50 dataArray.add(["icon":"mine_set_zhuxiao","name":"注销账号"])
50 51 }
... ... @@ -278,20 +279,23 @@ extension CNLiveTypeFeedBackViewController {
278 279 self.navigationController?.pushViewController(CNLiveInputFeedBackViewController.init(show_type: show_type), animated: true)
279 280 }
280 281 if _show_type == .setting {
281   - if indexPath.section == 0 {
  282 + if indexPath.section == 0 {//绑定管理
282 283 if metaAppDelegate.isLogin{
283 284 self.navigationController?.pushViewController(CNLiveMineBindingManagerController.init(), animated: true)
284 285 }else{
285 286 metaAppDelegate.pushLoginVC()
286 287 }
287 288 }
288   - if indexPath.section == 1 {
  289 + if indexPath.section == 1 {//隐私
289 290 self.navigationController?.pushViewController(CNLiveTypeFeedBackViewController.init(show_type: .privacy), animated: true)
290 291 }
291   - if indexPath.section == 2 {
  292 + if indexPath.section == 2 {//剧集视频跳过片头片尾
  293 +
  294 + }
  295 + if indexPath.section == 3 {//关于我们
292 296 self.navigationController?.pushViewController(CNLiveTypeFeedBackViewController.init(show_type: .about), animated: true)
293 297 }
294   - if indexPath.section == 3 {
  298 + if indexPath.section == 4 {//注销账号
295 299 if metaAppDelegate.isLogin{
296 300 self.navigationController?.pushViewController(CNLiveMineSignOutViewController.init(), animated: true)
297 301 }else{
... ...
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
... ... @@ -9,6 +9,11 @@ import Foundation
9 9 import Kingfisher
10 10 import APButton
11 11 import QMUIKit
  12 +
  13 +let CNLiveMineSettingISKipBeginAndEndKey = "CNLiveMineSettingISKipBeginAndEndKey"//默认开启
  14 +let CNLiveMineSettingSkipBeginAndEndFirstSettingKey = "CNLiveMineSettingSkipBeginAndEndFirstSettingKey"//是否设置过跳过片头片尾
  15 +
  16 +
12 17 class MineBodyOneListViewCell : UITableViewCell {
13 18  
14 19 lazy var nameLabel: UILabel = {
... ... @@ -192,6 +197,13 @@ class MineBodyTwoListViewCell : UITableViewCell {
192 197 moreLabel.isHidden = true
193 198 return moreLabel
194 199 }()
  200 + lazy var skipSwitch: UISwitch = {
  201 + let showSwitch = UISwitch.init()
  202 + showSwitch.addTarget(self, action: #selector(switchInAction), for: .valueChanged)
  203 + showSwitch.isHidden = true
  204 + return showSwitch
  205 + }()
  206 +
195 207  
196 208 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
197 209 super.init(style: style, reuseIdentifier: reuseIdentifier)
... ... @@ -205,6 +217,7 @@ class MineBodyTwoListViewCell : UITableViewCell {
205 217 mainView.addSubview(moreBtn)
206 218 mainView.addSubview(descLabel)
207 219 mainView.addSubview(moreLabel)
  220 + mainView.addSubview(skipSwitch)
208 221 mainView.addSubview(avatarView)
209 222  
210 223 setupConstraints()
... ... @@ -233,6 +246,10 @@ class MineBodyTwoListViewCell : UITableViewCell {
233 246 make.height.equalTo(30)
234 247 make.width.equalTo(15)
235 248 }
  249 + skipSwitch.snp.makeConstraints { make in
  250 + make.centerY.equalTo(headerView)
  251 + make.right.equalToSuperview().offset(-15)
  252 + }
236 253 descLabel.snp.makeConstraints { make in
237 254 make.centerY.equalToSuperview().offset(15)
238 255 make.left.equalTo(headerView.snp.right).offset(7)
... ... @@ -241,6 +258,7 @@ class MineBodyTwoListViewCell : UITableViewCell {
241 258 make.centerY.equalTo(headerView)
242 259 make.right.equalTo(moreBtn.snp.left)
243 260 }
  261 +
244 262 avatarView.snp.makeConstraints { make in
245 263 make.centerY.equalToSuperview()
246 264 make.right.equalTo(moreBtn.snp.left).offset(-10)
... ... @@ -290,6 +308,30 @@ class MineBodyTwoListViewCell : UITableViewCell {
290 308 avatarView.isHidden = true
291 309 }
292 310 nameLabel.text = "\(dict["name"] ?? "")"
  311 +
  312 + if show_type == .setting {
  313 + if let name = dict["name"] as? String{
  314 + if name == "剧集视频跳过片头片尾"{
  315 + moreBtn.isHidden = true
  316 + skipSwitch.isHidden = false
  317 + let is_skip = UserDefaults.standard.bool(forKey: CNLiveMineSettingISKipBeginAndEndKey)
  318 + skipSwitch.isOn = is_skip
  319 + }else{
  320 + moreBtn.isHidden = false
  321 + skipSwitch.isHidden = true
  322 + }
  323 + }
  324 +
  325 + }
  326 + }
  327 +
  328 + @objc func switchInAction(sender: UISwitch) {
  329 + print("11111111switch\(sender.isOn)")
  330 + UserDefaults.standard.setValue(sender.isOn, forKey: CNLiveMineSettingISKipBeginAndEndKey)
  331 + UserDefaults.standard.setValue(true, forKey: CNLiveMineSettingSkipBeginAndEndFirstSettingKey)
  332 + UserDefaults.standard.synchronize()
  333 +
  334 +
293 335 }
294 336  
295 337 required init?(coder: NSCoder) {
... ...
metaCode/Classes/Other/AppDelegate.swift
... ... @@ -23,6 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
23 23 var isGift = false//是否忽必烈礼物
24 24 var giftModel:CNLiveHomePageHuBiLieGiftModel?//送礼分享model
25 25 var isLogin = false//是否登录
  26 + var isSkip = false//是否跳过片头片尾
26 27  
27 28 // var orientationLock = UIInterfaceOrientationMask.allButUpsideDown // 默认支持方向
28 29 // func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
... ... @@ -80,6 +81,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
80 81 print("1111:\(CNLiveMCEnvironmentManager.shared.appId_wjj),\(CNLiveMCEnvironmentManager.shared.appKey_wjj),\(wxAppId),\(universalLinkURL)")
81 82 window = UIWindow.init(frame: UIScreen.main.bounds)
82 83 window?.backgroundColor = KVCBackgroupColor
  84 +
  85 +
  86 + let isSetting_skip = UserDefaults.standard.bool(forKey: CNLiveMineSettingSkipBeginAndEndFirstSettingKey)
  87 + if isSetting_skip{
  88 + //设置过 跳过
  89 + let is_skip = UserDefaults.standard.bool(forKey: CNLiveMineSettingISKipBeginAndEndKey)
  90 + self.isSkip = is_skip
  91 + }else{
  92 + //未设置过 跳过,默认开启
  93 + UserDefaults.standard.setValue(true, forKey: CNLiveMineSettingISKipBeginAndEndKey)
  94 + UserDefaults.standard.synchronize()
  95 + self.isSkip = true
  96 + }
  97 +
83 98 let is_login = UserDefaults.standard.bool(forKey: "is_login")
84 99 self.isLogin = is_login
85 100 //CNLiveBaseTabBarViewController.init()
... ...
metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_sub_skip.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_list_sub_skip@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_list_sub_skip@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_sub_skip.imageset/mine_list_sub_skip@2x.png 0 → 100644

2 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_list_sub_skip.imageset/mine_list_sub_skip@3x.png 0 → 100644

3.76 KB