| | |
| | | 13A0A8AA2C74740800DF08B6 /* NoticeCenterVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13A0A8A72C74740800DF08B6 /* NoticeCenterVC.swift */; }; |
| | | 13A0A8AE2C74757200DF08B6 /* MessageTCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13A0A8AD2C74757200DF08B6 /* MessageTCell.xib */; }; |
| | | 13A0A8AF2C74757200DF08B6 /* MessageTCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13A0A8AC2C74757200DF08B6 /* MessageTCell.swift */; }; |
| | | 13A0EAA62D57132200ABC2F6 /* UpdateVersionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13A0EAA52D57132200ABC2F6 /* UpdateVersionView.swift */; }; |
| | | 13A0EAA82D57134300ABC2F6 /* UpdateVersionView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13A0EAA72D57134300ABC2F6 /* UpdateVersionView.xib */; }; |
| | | 13A379FC2C75B7280038D5C8 /* BindAccountVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13A379FB2C75B7280038D5C8 /* BindAccountVC.xib */; }; |
| | | 13A379FD2C75B7280038D5C8 /* BindAccountVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13A379FA2C75B7280038D5C8 /* BindAccountVC.swift */; }; |
| | | 13A37A002C75C1DE0038D5C8 /* LevelVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13A379FE2C75C1DE0038D5C8 /* LevelVC.swift */; }; |
| | |
| | | 13E160212C6CB8930027F781 /* CommentListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E1601E2C6CB8930027F781 /* CommentListVC.swift */; }; |
| | | 13E4ECEE2C80778A0095AD04 /* PlanGuide_2_VC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E4ECEC2C80778A0095AD04 /* PlanGuide_2_VC.swift */; }; |
| | | 13E4ECEF2C80778A0095AD04 /* PlanGuide_2_VC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13E4ECED2C80778A0095AD04 /* PlanGuide_2_VC.xib */; }; |
| | | 13E5C9832D5C50F400671533 /* VideoPlayVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E5C9822D5C50F400671533 /* VideoPlayVC.swift */; }; |
| | | 13E5C9852D5D97E400671533 /* bg_water.mov in Resources */ = {isa = PBXBuildFile; fileRef = 13E5C9842D5D97E400671533 /* bg_water.mov */; }; |
| | | 13E7FAC22C9D1644009432D4 /* NoticeBtn.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E7FAC12C9D1644009432D4 /* NoticeBtn.swift */; }; |
| | | 13EA70012C75F880005DF280 /* IdCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13EA70002C75F880005DF280 /* IdCardView.swift */; }; |
| | | 13EA70042C75FA16005DF280 /* WalletRechargeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13EA70022C75FA16005DF280 /* WalletRechargeVC.swift */; }; |
| | |
| | | 13A0A8A72C74740800DF08B6 /* NoticeCenterVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeCenterVC.swift; sourceTree = "<group>"; }; |
| | | 13A0A8AC2C74757200DF08B6 /* MessageTCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageTCell.swift; sourceTree = "<group>"; }; |
| | | 13A0A8AD2C74757200DF08B6 /* MessageTCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MessageTCell.xib; sourceTree = "<group>"; }; |
| | | 13A0EAA52D57132200ABC2F6 /* UpdateVersionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateVersionView.swift; sourceTree = "<group>"; }; |
| | | 13A0EAA72D57134300ABC2F6 /* UpdateVersionView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UpdateVersionView.xib; sourceTree = "<group>"; }; |
| | | 13A379FA2C75B7280038D5C8 /* BindAccountVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BindAccountVC.swift; sourceTree = "<group>"; }; |
| | | 13A379FB2C75B7280038D5C8 /* BindAccountVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BindAccountVC.xib; sourceTree = "<group>"; }; |
| | | 13A379FE2C75C1DE0038D5C8 /* LevelVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LevelVC.swift; sourceTree = "<group>"; }; |
| | |
| | | 13E1601F2C6CB8930027F781 /* CommentListVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CommentListVC.xib; sourceTree = "<group>"; }; |
| | | 13E4ECEC2C80778A0095AD04 /* PlanGuide_2_VC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlanGuide_2_VC.swift; sourceTree = "<group>"; }; |
| | | 13E4ECED2C80778A0095AD04 /* PlanGuide_2_VC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PlanGuide_2_VC.xib; sourceTree = "<group>"; }; |
| | | 13E5C9822D5C50F400671533 /* VideoPlayVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoPlayVC.swift; sourceTree = "<group>"; }; |
| | | 13E5C9842D5D97E400671533 /* bg_water.mov */ = {isa = PBXFileReference; lastKnownFileType = video.quicktime; path = bg_water.mov; sourceTree = "<group>"; }; |
| | | 13E7FAC12C9D1644009432D4 /* NoticeBtn.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeBtn.swift; sourceTree = "<group>"; }; |
| | | 13EA70002C75F880005DF280 /* IdCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdCardView.swift; sourceTree = "<group>"; }; |
| | | 13EA70022C75FA16005DF280 /* WalletRechargeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletRechargeVC.swift; sourceTree = "<group>"; }; |
| | |
| | | 132C7EF42C8FE9A800A4CA18 /* TCell */, |
| | | 13D256B52C6C68EB006FC2D7 /* View */, |
| | | 137ABE372C6B6641003A91C5 /* WebVC.swift */, |
| | | 13A0EAA52D57132200ABC2F6 /* UpdateVersionView.swift */, |
| | | 13A0EAA72D57134300ABC2F6 /* UpdateVersionView.xib */, |
| | | ); |
| | | path = Other; |
| | | sourceTree = "<group>"; |
| | |
| | | children = ( |
| | | 13BF65D72C80402500E20F0E /* bg_movie.mov */, |
| | | 137ECAD22C783C2000C338BE /* bg.mov */, |
| | | 13E5C9842D5D97E400671533 /* bg_water.mov */, |
| | | ); |
| | | path = mov; |
| | | sourceTree = "<group>"; |
| | |
| | | 13985DC02C69E0A00046B6DC /* CCell */, |
| | | 13985DBB2C69DDDC0046B6DC /* View */, |
| | | 13985DB92C69B8ED0046B6DC /* HomeVC.swift */, |
| | | 13E5C9822D5C50F400671533 /* VideoPlayVC.swift */, |
| | | ); |
| | | path = Home; |
| | | sourceTree = "<group>"; |
| | |
| | | 132EB01D2C6B32B200990429 /* RegisterVC.xib in Resources */, |
| | | 13C9DDD42C8EE8EB0008946B /* apngb-animated-level-7.png in Resources */, |
| | | 137ECAD32C783C2000C338BE /* bg.mov in Resources */, |
| | | 13E5C9852D5D97E400671533 /* bg_water.mov in Resources */, |
| | | 1336EFA92C6DEC6B0075E070 /* PaymentOrderResultTopView.xib in Resources */, |
| | | 1331391A2C742A0C009E179E /* UserProfileVC.xib in Resources */, |
| | | 135C2A712C7F033300CC2A67 /* CLPlayer.bundle in Resources */, |
| | |
| | | 138995432C943AA700BC7F78 /* static-level-2.png in Resources */, |
| | | 13C834F12D12D37700B08AE2 /* BlackUserTCell.xib in Resources */, |
| | | 134803D72C76E3E000F4FDDA /* WatchHistoryVC.xib in Resources */, |
| | | 13A0EAA82D57134300ABC2F6 /* UpdateVersionView.xib in Resources */, |
| | | 1377768E2C6AFD25004FF994 /* LoginVC.xib in Resources */, |
| | | 134CC7E02C73283700EAEFB7 /* PavilionSearchVC.xib in Resources */, |
| | | 13C5838C2C86A4770071BCBE /* apngb-animated-level-4.png in Resources */, |
| | |
| | | 135C2A692C7F033300CC2A67 /* CLPlayerContentPanelCell.swift in Sources */, |
| | | 139C16602C6A0FBB00A924D9 /* TestLeftRightCollectionViewFlowLayout.swift in Sources */, |
| | | 1306028D2C917D3E0019ECDE /* TreeTeskEnergyExchangeRecordTCell.swift in Sources */, |
| | | 13A0EAA62D57132200ABC2F6 /* UpdateVersionView.swift in Sources */, |
| | | 13985DC72C69E9550046B6DC /* CourseVC.swift in Sources */, |
| | | 13A379FD2C75B7280038D5C8 /* BindAccountVC.swift in Sources */, |
| | | 135C2A6A2C7F033300CC2A67 /* CLPlayerContentPanelHeadView.swift in Sources */, |
| | |
| | | 1336EFA72C6DEC640075E070 /* PaymentOrderResultTopView.swift in Sources */, |
| | | 1324A64C2C80706700AA5098 /* PlanGuide_1_VC.swift in Sources */, |
| | | 13CBCCE32C747C3D00C67701 /* NoticeCenterUserRepeaceDetailVC.swift in Sources */, |
| | | 13E5C9832D5C50F400671533 /* VideoPlayVC.swift in Sources */, |
| | | 135C2A672C7F033300CC2A67 /* CLFullScreenLeftController.swift in Sources */, |
| | | 13C9DDCE2C8EE1F20008946B /* Home_Style_5_TCell.swift in Sources */, |
| | | 138FE0DE2C757B2A00A964E8 /* BindPhone_1_VC.swift in Sources */, |
| | |
| | | CODE_SIGN_IDENTITY = "Apple Development"; |
| | | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
| | | CODE_SIGN_STYLE = Manual; |
| | | CURRENT_PROJECT_VERSION = 8; |
| | | CURRENT_PROJECT_VERSION = 12; |
| | | DEVELOPMENT_TEAM = ""; |
| | | "DEVELOPMENT_TEAM[sdk=iphoneos*]" = M9T3KVL537; |
| | | ENABLE_USER_SCRIPT_SANDBOXING = NO; |
| | |
| | | "$(inherited)", |
| | | "@executable_path/Frameworks", |
| | | ); |
| | | MARKETING_VERSION = 1.0.1; |
| | | MARKETING_VERSION = 1.0.3; |
| | | OTHER_LDFLAGS = ( |
| | | "$(inherited)", |
| | | "-ObjC", |
| | |
| | | CODE_SIGN_IDENTITY = "Apple Development"; |
| | | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; |
| | | CODE_SIGN_STYLE = Manual; |
| | | CURRENT_PROJECT_VERSION = 8; |
| | | CURRENT_PROJECT_VERSION = 12; |
| | | DEVELOPMENT_TEAM = ""; |
| | | "DEVELOPMENT_TEAM[sdk=iphoneos*]" = M9T3KVL537; |
| | | ENABLE_USER_SCRIPT_SANDBOXING = NO; |
| | |
| | | "$(inherited)", |
| | | "@executable_path/Frameworks", |
| | | ); |
| | | MARKETING_VERSION = 1.0.1; |
| | | MARKETING_VERSION = 1.0.3; |
| | | OTHER_LDFLAGS = ( |
| | | "$(inherited)", |
| | | "-ObjC", |
| | |
| | | |
| | | |
| | | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
| | | removeLaunchScreenCacheIfNeeded() |
| | | WeChatTools.register(appid: WeChatAPPID, link: "https://app.xqzhihui.com/app/") |
| | | return true |
| | | } |
| | |
| | | |
| | | func onResp(_ resp: BaseResp) { |
| | | |
| | | } |
| | | |
| | | func removeLaunchScreenCacheIfNeeded() { |
| | | let filePath = NSHomeDirectory() + "/Library/SplashBoard" |
| | | |
| | | if FileManager.default.fileExists(atPath: filePath) { |
| | | do { |
| | | try FileManager.default.removeItem(atPath: filePath) |
| | | print("清除LaunchScreen缓存成功") |
| | | } catch { |
| | | print("清除LaunchScreen缓存失败") |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | { |
| | | "images" : [ |
| | | { |
| | | "idiom" : "universal", |
| | | "scale" : "1x" |
| | | }, |
| | | { |
| | | "filename" : "icon_guide_more@2x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "2x" |
| | | }, |
| | | { |
| | | "filename" : "icon_guide_more@3x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "3x" |
| | | } |
| | | ], |
| | | "info" : { |
| | | "author" : "xcode", |
| | | "version" : 1 |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | extension UIButton { |
| | | func localGradientColor(cornerRadius:Double,bounds:CGRect? = nil){ |
| | | func localGradientColor(cornerRadius:Double,bounds:CGRect? = nil,clear:Bool = false){ |
| | | self.layer.sublayers?.removeAll(where: {$0 is CAGradientLayer}) |
| | | self.jq_gradientColor(colorArr: [UIColor(hexStr: "#8EA47A").cgColor,UIColor(hexStr: "#AFCA98").cgColor], cornerRadius: cornerRadius, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 1, y: 0), bounds: bounds) |
| | | self.jq_gradientColor(colorArr: [UIColor(hexStr: "#8EA47A").cgColor,UIColor(hexStr: "#AFCA98").cgColor], cornerRadius: cornerRadius, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 1, y: 0), bounds: bounds,clear: clear) |
| | | } |
| | | |
| | | public func openCountDown(_ t:Int = 59,defultTitle:String = "获取验证码"){ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | let isSimulator: Bool = { |
| | | #if targetEnvironment(simulator) |
| | | return true |
| | | #else |
| | | return false |
| | | #endif |
| | | }() |
| | |
| | | case .level_1:return "亲爱的家人,生命之树的种子已植入这片沃土,请以农夫的心态用心浇灌,为你加油哦。" |
| | | case .level_2:return "恭喜您,种子发芽了,爱的旅程已经开始,为你加油!" |
| | | case .level_3:return "幼苗拔地而起,智慧俏然萌发,前方的道路,更加的明亮,继续努力吧!" |
| | | case .level_4:return "树苗任成长,内心变得更加的柔软包容。未来正在向你招手。" |
| | | case .level_4:return "树苗正在成长,内心变得更加的柔软包容。未来正在向你招手。" |
| | | case .level_5:return "小树扎下了深深的根,离爱的梦想越来越近,继续坚持吧。" |
| | | case .level_6:return "大树已枝繁叶茂,自由的伸展,你的努力成就了这份美好,未来将更加的璀璨。" |
| | | case .level_7:return "智慧之花即将绽放,满载着希望与能量,前路无限的可能!" |
| | |
| | | case .level_10:return oss_domain + "/xinquan/8b0303829a6547f5a16c5232883b94cc.wav" |
| | | } |
| | | } |
| | | |
| | | mutating func updateLevel(){ |
| | | |
| | | let raw = self.rawValue + 1 |
| | | let raw_1 = max(1,min(10, raw)) |
| | | self = TreeLevel(rawValue: raw_1)! |
| | | } |
| | | } |
| | | |
| | | enum TreeTeskDetailType:Int{ |
| | |
| | | import MJRefresh |
| | | import SDWebImage |
| | | import CoreTelephony |
| | | import AVKit |
| | | |
| | | let SetBGMSuccess_Noti = Notification.Name.init("SetBGMSuccess_Noti") |
| | | let ToShowTree_Noti = Notification.Name.init("ToShowTree_Noti") |
| | |
| | | } |
| | | |
| | | |
| | | if AudioPlayer.getSharedInstance().scenePlayer?.timeControlStatus == .paused && UserDefaultSettingViewModel.getSetting()?.sceneMusicModel != nil{ |
| | | if (AudioPlayer.getSharedInstance().scenePlayer?.timeControlStatus == .paused && UserDefaultSettingViewModel.getSetting()?.sceneMusicModel != nil) && UserViewModel.getSceneSwitch(){ |
| | | AudioPlayer.getSharedInstance().playSceneAt(UserDefaultSettingViewModel.getSetting()!.sceneMusicModel!.audioFile) |
| | | } |
| | | |
| | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | DispatchQueue.main.asyncAfter(delay: 3.0) { |
| | | self.checkNewVersion() |
| | | } |
| | | |
| | | titleItems.removeAll() |
| | | |
| | | timer = Timer.scheduledTimer(timeInterval: 30, target: self, selector: #selector(autoUpdate), userInfo: nil, repeats: true) |
| | |
| | | titleItems.append(TitleItem(title: "每日疗愈", subTitle: "Daily Meditation")) |
| | | titleItems.append(TitleItem(title: "私人订制", subTitle: "Private Customization",hasMore: true)) |
| | | titleItems.append(TitleItem(title: "新手冥想指南", subTitle: "Meditation guide")) |
| | | |
| | | |
| | | |
| | | tableView.mj_header = MJRefreshNormalHeader(refreshingBlock: { |
| | | self.getData() |
| | |
| | | weakSelf.present(vc, animated: true) |
| | | } |
| | | } |
| | | |
| | | DispatchQueue.main.async { |
| | | self?.getBGMData() |
| | | self?.tableView.mj_header?.beginRefreshing() |
| | | } |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | topMenuView.resetTopImage() |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | } |
| | | |
| | | NotificationCenter.default.rx.notification(SetBGMSuccess_Noti).take(until: self.rx.deallocated).subscribe(onNext: {data in |
| | | self.topMenuView.resetTopImage() |
| | | self.getBGMData() |
| | | }).disposed(by: disposeBag) |
| | | |
| | | |
| | | NotificationCenter.default.rx.notification(LoginSuccess_Noti).take(until: self.rx.deallocated).subscribe(onNext: {data in |
| | | self.getBGMData() |
| | | }).disposed(by: disposeBag) |
| | | |
| | | NotificationCenter.default.rx.notification(LoginQuit_Noti).take(until: self.rx.deallocated).subscribe(onNext: {data in |
| | | self.getBGMData() |
| | | }).disposed(by: disposeBag) |
| | | |
| | | |
| | | |
| | | NotificationCenter.default.rx.notification(PlantGuideQuit_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | |
| | | if let m = data.data{ |
| | | self.viewModel.meditationList.removeAll() |
| | | self.titleItems.removeAll() |
| | | self.titleItems.append(TitleItem(title: "每日疗愈", subTitle: "Daily Meditation")) |
| | | if self.viewModel.todyModel?.isShow == 1{ |
| | | self.titleItems.append(TitleItem(title: "泉疗愈微电影", subTitle: "Spring Healing Microfilm")) |
| | | }else{ |
| | | self.titleItems.append(TitleItem(title: "每日疗愈", subTitle: "Daily Meditation")) |
| | | } |
| | | |
| | | self.titleItems.append(TitleItem(title: "私人订制", subTitle: "Private Customization",hasMore: true)) |
| | | self.titleItems.append(TitleItem(title: "新手冥想指南", subTitle: "Meditation guide")) |
| | | self.titleItems.append(TitleItem(title: "新手冥想指南", subTitle: "Meditation guide",hasMore: true)) |
| | | |
| | | |
| | | self.viewModel.meditationList = m |
| | |
| | | } |
| | | |
| | | private func getBGMData(){ |
| | | Services.quryUserSceneMusic().subscribe(onNext: {data in |
| | | if var userDefaultSettingModel = UserDefaultSettingViewModel.getSetting(){ |
| | | userDefaultSettingModel.sceneMusicModel = data.data |
| | | UserDefaultSettingViewModel.saveSetting(userDefaultSettingModel) |
| | | |
| | | if AudioPlayer.getSharedInstance().bgmPlayer != nil && PayMusicVC.getCurrentStatus() != .pause{ |
| | | AudioPlayer.getSharedInstance().bgmPlayer?.play() |
| | | return |
| | | if UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true{ |
| | | Services.getBGM().subscribe(onNext: {[weak self]data in |
| | | if let m = data.data,let model = m.first{ |
| | | if var userDefaultSettingModel = UserDefaultSettingViewModel.getSetting(){ |
| | | userDefaultSettingModel.sceneMusicModel = model |
| | | UserDefaultSettingViewModel.saveSetting(userDefaultSettingModel) |
| | | self?.updateBGMData(userDefaultSettingModel: userDefaultSettingModel) |
| | | self?.topMenuView.resetTopImage() |
| | | } |
| | | } |
| | | |
| | | if AudioPlayer.getSharedInstance().scenePlayer == nil || AudioPlayer.getSharedInstance().scenePlayer?.timeControlStatus == .paused{ |
| | | AudioPlayer.getSharedInstance().playSceneAt(userDefaultSettingModel.sceneMusicModel!.audioFile) |
| | | }).disposed(by: disposeBag) |
| | | }else{ |
| | | Services.quryUserSceneMusic().subscribe(onNext: {data in |
| | | if var userDefaultSettingModel = UserDefaultSettingViewModel.getSetting(){ |
| | | userDefaultSettingModel.sceneMusicModel = data.data |
| | | UserDefaultSettingViewModel.saveSetting(userDefaultSettingModel) |
| | | self.updateBGMData(userDefaultSettingModel: userDefaultSettingModel) |
| | | self.topMenuView.resetTopImage() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | |
| | | if let imageUrl = userDefaultSettingModel.sceneMusicModel?.imageUrl,imageUrl.isEmpty == false{ |
| | | self.topMenuView.image_top.sd_setImage(with: URL(string: imageUrl.jq_urlEncoded())) |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | private func updateBGMData(userDefaultSettingModel:UserDefaultSettingModel){ |
| | | if AudioPlayer.getSharedInstance().bgmPlayer != nil && PayMusicVC.getCurrentStatus() != .pause{ |
| | | AudioPlayer.getSharedInstance().bgmPlayer?.play() |
| | | return |
| | | } |
| | | |
| | | if (AudioPlayer.getSharedInstance().scenePlayer == nil || AudioPlayer.getSharedInstance().scenePlayer?.timeControlStatus == .paused) && UserViewModel.getSceneSwitch(){ |
| | | AudioPlayer.getSharedInstance().playSceneAt(userDefaultSettingModel.sceneMusicModel!.audioFile) |
| | | } |
| | | } |
| | | |
| | | @objc func autoUpdate() { |
| | |
| | | Services.getTopdayMedita().subscribe(onNext: { [weak self] data in |
| | | guard let self = self else { return } |
| | | self.viewModel.todyModel = data.data |
| | | self.tableView.reloadRows(at: [IndexPath(row: 0, section: 0)], with: .none) |
| | | |
| | | if data.data?.isShow == 1{ |
| | | self.titleItems[0] = TitleItem(title: "泉疗愈微电影", subTitle: "Spring Healing Microfilm") |
| | | }else{ |
| | | self.titleItems[0] = TitleItem(title: "每日疗愈", subTitle: "Daily Meditation") |
| | | } |
| | | |
| | | |
| | | // self.tableView.reloadRows(at: [IndexPath(row: 0, section: 0)], with: .none) |
| | | // self.tableView.reloadRows(at: [IndexPath(row: 1, section: 0)], with: .none) |
| | | self.tableView.reloadData() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | |
| | | nav.modalPresentationStyle = .fullScreen |
| | | present(nav, animated: true) |
| | | break |
| | | case 202: |
| | | let vc = WebVC(type: .guide) |
| | | vc.title = "泉疗愈" |
| | | push(vc: vc) |
| | | default: |
| | | let topTitle = titleItems[sender.tag - 200].title |
| | | let m = viewModel.meditationList[sender.tag - 200 - 3] |
| | |
| | | let vc = HomeItemListVC(topTitle: topTitle, id: id,showType: .vertical) |
| | | push(vc: vc) |
| | | } |
| | | } |
| | | } |
| | | |
| | | private func checkNewVersion(){ |
| | | JQTool.checkVersion(appid: AppleID){ stat, model, url in |
| | | let version = UserDefaults.standard.value(forKey: "ignoreVersion") as? String |
| | | if stat && version != model?.version ?? "1.0.0"{ |
| | | DispatchQueue.main.async { |
| | | if let m = model{ |
| | | UpdateVersionView.show(model:m) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| | | |
| | | if indexPath.section == 0{ |
| | | guard let m = viewModel.todyModel, let detailId = m.clientMeditationVO?.id else { |
| | | alert(msg: "平台暂未设置今日疗愈") |
| | | guard let m = viewModel.todyModel else { |
| | | alert(msg: "平台暂未设置今日疗愈");return |
| | | } |
| | | |
| | | //停止播放背景音 |
| | | AudioPlayer.getSharedInstance().pauseScene() |
| | | |
| | | if m.isShow == 1{ |
| | | if let videoUrl = m.meditationVideo?.videoUrl.jq_urlEncoded(){ |
| | | let videoPlayVC = VideoPlayVC(playUrl: videoUrl,titleL: m.meditationVideo?.title ?? "") |
| | | videoPlayVC.modalPresentationStyle = .fullScreen |
| | | push(vc: videoPlayVC) |
| | | } |
| | | return |
| | | } |
| | | |
| | | |
| | | |
| | | let audioPlayer = AudioPlayer.getSharedInstance() |
| | | let isSameMeditation = audioPlayer.meditationModel?.id == m.meditationId |
| | | let isPaused = audioPlayer.bgmPlayer?.timeControlStatus == .paused |
| | |
| | | } |
| | | } else { |
| | | // 游客模式都能播放 |
| | | Services.getMeditationDetail(id: detailId).subscribe(onNext: { [weak self] data in |
| | | guard let self = self, let m = data.data else { return } |
| | | if let detailId = m.clientMeditationVO?.id{ |
| | | Services.getMeditationDetail(id: detailId).subscribe(onNext: { [weak self] data in |
| | | guard let self = self, let m = data.data else { return } |
| | | |
| | | if m.chargeType == .payment{ |
| | | if UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true{ |
| | | sceneDelegate?.needLogin();return |
| | | }else if m.isBuy == .no{ |
| | | let vc = PaymentOrderVC(museItemModel: m, type: .muse, showType: DisplayType.horizontal) |
| | | jq_push(vc: vc);return |
| | | if m.chargeType == .payment{ |
| | | if UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true{ |
| | | sceneDelegate?.needLogin();return |
| | | }else if m.isBuy == .no{ |
| | | let vc = PaymentOrderVC(museItemModel: m, type: .muse, showType: DisplayType.horizontal) |
| | | jq_push(vc: vc);return |
| | | } |
| | | } |
| | | } |
| | | |
| | | if m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip != .yes{ |
| | | let vipCenterVC = VIPCenterVC() |
| | | jq_push(vc: vipCenterVC) |
| | | return |
| | | } |
| | | if m.chargeType == .vipFree && UserViewModel.getAvatarInfo().isVip != .yes{ |
| | | let vipCenterVC = VIPCenterVC() |
| | | jq_push(vc: vipCenterVC) |
| | | return |
| | | } |
| | | |
| | | if audioPlayer.meditationModel?.id == m.id && audioPlayer.bgmPlayer?.timeControlStatus == .playing { |
| | | return |
| | | } |
| | | audioPlayer.playBGMAt(firstPlayIndex: 0, model: m, delegate: self) |
| | | PayMusicVC.show(model: m, isHidden: false) |
| | | self.viewModel.todyModel?.playAtMe = true |
| | | DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { |
| | | self.tableView.reloadData() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | if audioPlayer.meditationModel?.id == m.id && audioPlayer.bgmPlayer?.timeControlStatus == .playing { |
| | | return |
| | | } |
| | | audioPlayer.playBGMAt(firstPlayIndex: 0, model: m, delegate: self) |
| | | PayMusicVC.show(model: m, isHidden: false) |
| | | self.viewModel.todyModel?.playAtMe = true |
| | | DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { |
| | | self.tableView.reloadData() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| | | if indexPath.section == 0 && indexPath.row == 0{ |
| | | //每日疗愈 |
| | | //每日疗愈 & 泉疗愈微电影 |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_Home_Style_1_TCell") as! Home_Style_1_TCell |
| | | if let m = viewModel.todyModel,m.id != 0{ |
| | | cell.setTodayMeditationModel(m) |
| | |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| | | if indexPath.section == 0 || indexPath.section == 1 || indexPath.section == 2{ |
| | | if indexPath.section == 0 || indexPath.section == 1{ |
| | | return JQ_ScreenW * 0.551 |
| | | }else if indexPath.section == 2{ |
| | | return 0 |
| | | }else{ |
| | | let index = indexPath.section - 3 |
| | | let m = viewModel.meditationList[index] |
| | |
| | | |
| | | if section == 1{ |
| | | headerView.btn_more.setImage(UIImage(named: "btn_more"), for: .normal) |
| | | }else if section == 2{ |
| | | headerView.btn_more.setImage(UIImage(named: "icon_guide_more"), for: .normal) |
| | | }else{ |
| | | headerView.btn_more.setImage(UIImage(named: "icon_exchange"), for: .normal) |
| | | } |
| | |
| | | view_data.isHidden = true |
| | | }else{ |
| | | view_data.isHidden = false |
| | | img_cover.sd_setImage(with: URL(string: model.imageUrl.jq_urlEncoded())) |
| | | |
| | | let turple = Date.jq_formateToTime_tuple(model.time) |
| | | let minute = (turple.hour * 60 + turple.minute) |
| | | let second = turple.second |
| | | if model.isShow == 0{ |
| | | img_cover.sd_setImage(with: URL(string: model.imageUrl.jq_urlEncoded())) |
| | | |
| | | label_title.text = "\(model.clientMeditationVO!.meditationTitle) | \(String(format: "%.2ld:%.2ld", minute,second))" |
| | | label_joinNum.text = "\(model.clientMeditationVO!.realLearnedNum + model.clientMeditationVO!.virtualLearnedNum)人已参加学习" |
| | | let turple = Date.jq_formateToTime_tuple(model.time) |
| | | let minute = (turple.hour * 60 + turple.minute) |
| | | let second = turple.second |
| | | |
| | | label_title.text = "\(model.clientMeditationVO!.meditationTitle) | \(String(format: "%.2ld:%.2ld", minute,second))" |
| | | label_joinNum.text = "\(model.clientMeditationVO!.realLearnedNum + model.clientMeditationVO!.virtualLearnedNum)人已参加学习" |
| | | } |
| | | |
| | | if model.isShow == 1{ |
| | | img_cover.sd_setImage(with: URL(string: model.meditationVideo?.imageUrl.jq_urlEncoded())) |
| | | let turple = Date.jq_formateToTime_tuple(model.meditationVideo?.videoSecond ?? 0) |
| | | let minute = (turple.hour * 60 + turple.minute) |
| | | let second = turple.second |
| | | label_title.text = "\(model.meditationVideo?.title ?? "") | \(String(format: "%.2ld:%.2ld", minute,second))" |
| | | label_joinNum.text = "" |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | class BackgroundVoiceVC: BaseVC { |
| | | |
| | | @IBOutlet weak var slider_voice: UISlider! |
| | | // @IBOutlet weak var slider_voice: UISlider! |
| | | @IBOutlet weak var collectionView: UICollectionView! |
| | | |
| | | @IBOutlet weak var sceneSwitch: UISwitch! |
| | | |
| | | private var items = [BGMModel]() |
| | | private var settingModel = UserDefaultSettingViewModel.getSetting() |
| | | private var audioPlayer = AudioPlayer.getSharedInstance() |
| | |
| | | // audioPlayer.masterPlayer?.play() |
| | | // audioPlayer.bgmPlayer?.play() |
| | | }else{ |
| | | audioPlayer.playScene() |
| | | if sceneSwitch.isOn{ |
| | | audioPlayer.playScene() |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | super.viewDidLoad() |
| | | title = "泉疗愈" |
| | | |
| | | sceneSwitch.isOn = UserViewModel.getSceneSwitch() |
| | | |
| | | yy_popBlock = { [weak self] in |
| | | if self?.needPopRoot ?? false{ |
| | | if JQ_currentNavigationController().viewControllers.first is PlanGuideVC{ |
| | |
| | | } |
| | | } |
| | | |
| | | slider_voice.isEnabled = false |
| | | slider_voice.value = Float(settingModel?.volume ?? 0.5) |
| | | slider_voice.addTarget(self, action: #selector(volumeChange(_:)), for: .valueChanged) |
| | | // slider_voice.isEnabled = false |
| | | // slider_voice.value = Float(settingModel?.volume ?? 0.5) |
| | | Services.getBGM().subscribe(onNext: {[unowned self]data in |
| | | if let m = data.data{ |
| | | self.items = m |
| | | self.slider_voice.isEnabled = true |
| | | // self.slider_voice.isEnabled = true |
| | | self.collectionView.reloadData() |
| | | |
| | | DispatchQueue.main.asyncAfter(delay: 0.8) { |
| | |
| | | v1.jq_borderColor = .white |
| | | v1.jq_cornerRadius = 8.5 |
| | | |
| | | slider_voice.setThumbImage(v1.qmui_snapshotLayerImage(), for: .normal) |
| | | slider_voice.setThumbImage(v1.qmui_snapshotLayerImage(), for: .highlighted) |
| | | // slider_voice.setThumbImage(v1.qmui_snapshotLayerImage(), for: .normal) |
| | | // slider_voice.setThumbImage(v1.qmui_snapshotLayerImage(), for: .highlighted) |
| | | |
| | | collectionView.collectionViewLayout = TestLeftRightCollectionViewFlowLayout(width: JQ_ScreenW, height: 213.5) |
| | | collectionView.delegate = self |
| | |
| | | Services.saveUserSceneMusic(id: items[index.row].id).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | weakSelf.settingModel?.sceneMusicModel = weakSelf.items[index.row] |
| | | weakSelf.settingModel?.volume = Double(weakSelf.slider_voice.value) |
| | | UserDefaultSettingViewModel.saveSetting(weakSelf.settingModel!) |
| | | UserViewModel.setSceneSwitch(state: weakSelf.sceneSwitch.isOn) |
| | | alertSuccess(msg: "设置成功") |
| | | }).disposed(by: disposeBag) |
| | | |
| | |
| | | } |
| | | |
| | | needPopRoot = true |
| | | NotificationCenter.default.post(name: SetBGMSuccess_Noti, object: items[index.row]) |
| | | DispatchQueue.main.asyncAfter(delay: 1.0) { |
| | | NotificationCenter.default.post(name: SetBGMSuccess_Noti, object: self.items[index.row]) |
| | | } |
| | | |
| | | if !(UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true){ |
| | | DispatchQueue.main.asyncAfter(delay: 0.6) { |
| | | NotificationCenter.default.post(name: PlantGuideQuit_Noti, object: self.items[index.row]) |
| | | self.navigationController?.popViewController() |
| | | } |
| | | }else{ |
| | | DispatchQueue.main.asyncAfter(delay: 0.6) { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @objc func volumeChange(_ slider:UISlider){ |
| | | tempPlayer?.volume = slider.value |
| | | } |
| | | |
| | | deinit{ |
| | |
| | | guard let URL = URL(string: model.audioFile.jq_urlEncoded()) else { return } |
| | | |
| | | tempPlayer = AVPlayer(url: URL) |
| | | tempPlayer?.volume = slider_voice.value |
| | | // tempPlayer?.volume = slider_voice.value |
| | | tempPlayer!.play() |
| | | isPlaying = true |
| | | collectionView.reloadData() |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> |
| | | <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> |
| | | <device id="retina6_12" orientation="portrait" appearance="light"/> |
| | | <dependencies> |
| | | <deployment identifier="iOS"/> |
| | | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/> |
| | | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/> |
| | | <capability name="Safe area layout guides" minToolsVersion="9.0"/> |
| | | <capability name="System colors in document resources" minToolsVersion="11.0"/> |
| | | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| | |
| | | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BackgroundVoiceVC" customModule="XQMuse" customModuleProvider="target"> |
| | | <connections> |
| | | <outlet property="collectionView" destination="IMe-2Z-Saj" id="GI4-46-ag9"/> |
| | | <outlet property="slider_voice" destination="XVQ-J7-Tg5" id="W8U-bw-7Jr"/> |
| | | <outlet property="sceneSwitch" destination="jxM-uN-5wv" id="Jv2-IN-xTN"/> |
| | | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| | | </connections> |
| | | </placeholder> |
| | |
| | | </constraints> |
| | | </imageView> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="场景音" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7p2-Gb-yaE"> |
| | | <rect key="frame" x="44" y="76.333333333333329" width="49" height="19.333333333333329"/> |
| | | <rect key="frame" x="44" y="76.333333333333329" width="47.666666666666657" height="19.333333333333329"/> |
| | | <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> |
| | | <nil key="textColor"/> |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" minimumValueImage="icon_voice_close" maximumValueImage="icon_voice_open" translatesAutoresizingMaskIntoConstraints="NO" id="XVQ-J7-Tg5"> |
| | | <rect key="frame" x="19" y="124" width="355" height="31"/> |
| | | <color key="minimumTrackTintColor" red="0.71372549019607845" green="0.86274509803921573" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <color key="maximumTrackTintColor" red="0.90588235294117647" green="0.90588235294117647" blue="0.90588235294117647" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <color key="thumbTintColor" red="0.6588235294" green="0.76078431369999999" blue="0.57254901960000004" alpha="1" colorSpace="calibratedRGB"/> |
| | | </slider> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_voice_screen" translatesAutoresizingMaskIntoConstraints="NO" id="ZGI-tV-gLQ"> |
| | | <rect key="frame" x="12" y="209" width="23" height="21"/> |
| | | <rect key="frame" x="12" y="146" width="23" height="21"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="21" id="OSc-3a-P1R"/> |
| | | <constraint firstAttribute="width" constant="23" id="bTF-XN-OLg"/> |
| | | </constraints> |
| | | </imageView> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="场景音" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZnS-y1-db2"> |
| | | <rect key="frame" x="44" y="210" width="49" height="19.333333333333343"/> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="场景" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZnS-y1-db2"> |
| | | <rect key="frame" x="44" y="147" width="32" height="19.333333333333343"/> |
| | | <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> |
| | | <nil key="textColor"/> |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="IMe-2Z-Saj"> |
| | | <rect key="frame" x="0.0" y="264" width="393" height="213"/> |
| | | <rect key="frame" x="0.0" y="201" width="393" height="213"/> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="213" id="4CB-qd-H66"/> |
| | |
| | | <action selector="setttingAction:" destination="-1" eventType="touchUpInside" id="bI1-rh-Ktb"/> |
| | | </connections> |
| | | </button> |
| | | <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="jxM-uN-5wv"> |
| | | <rect key="frame" x="330" y="70.666666666666671" width="51" height="31"/> |
| | | <color key="onTintColor" red="0.70980392156862748" green="0.85490196078431369" blue="0.56470588235294117" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | </switch> |
| | | </subviews> |
| | | <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | |
| | | <constraint firstItem="Gih-WP-NcR" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="7r2-Zs-FBJ"/> |
| | | <constraint firstItem="ZGI-tV-gLQ" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="12" id="G3X-bD-2Gu"/> |
| | | <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="IMe-2Z-Saj" secondAttribute="trailing" id="IdZ-ZE-nOO"/> |
| | | <constraint firstItem="XVQ-J7-Tg5" firstAttribute="top" secondItem="Pah-Qd-T99" secondAttribute="bottom" constant="28" id="K9R-8K-MOY"/> |
| | | <constraint firstItem="7p2-Gb-yaE" firstAttribute="leading" secondItem="Pah-Qd-T99" secondAttribute="trailing" constant="10" id="KYH-xL-Rr0"/> |
| | | <constraint firstItem="Pah-Qd-T99" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="17" id="Mri-34-XFC"/> |
| | | <constraint firstItem="jxM-uN-5wv" firstAttribute="centerY" secondItem="Pah-Qd-T99" secondAttribute="centerY" id="O18-1q-JU6"/> |
| | | <constraint firstItem="IMe-2Z-Saj" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="OCp-XE-yX3"/> |
| | | <constraint firstItem="IMe-2Z-Saj" firstAttribute="top" secondItem="ZGI-tV-gLQ" secondAttribute="bottom" constant="34" id="Rdt-Kx-OGp"/> |
| | | <constraint firstItem="ZGI-tV-gLQ" firstAttribute="top" secondItem="XVQ-J7-Tg5" secondAttribute="bottom" constant="55" id="Sx4-E7-NCS"/> |
| | | <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Fex-hD-lXe" secondAttribute="trailing" constant="45" id="a6x-Od-xK0"/> |
| | | <constraint firstItem="ZnS-y1-db2" firstAttribute="leading" secondItem="ZGI-tV-gLQ" secondAttribute="trailing" constant="9" id="b96-6e-A8B"/> |
| | | <constraint firstItem="7p2-Gb-yaE" firstAttribute="centerY" secondItem="Pah-Qd-T99" secondAttribute="centerY" id="c3z-R4-piy"/> |
| | | <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="XVQ-J7-Tg5" secondAttribute="trailing" constant="21" id="cCS-Wo-sPO"/> |
| | | <constraint firstItem="Gih-WP-NcR" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="d4Q-ah-QB0"/> |
| | | <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Gih-WP-NcR" secondAttribute="trailing" id="ghz-t0-2on"/> |
| | | <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="jxM-uN-5wv" secondAttribute="trailing" constant="14" id="i5o-9Y-IAX"/> |
| | | <constraint firstItem="ZnS-y1-db2" firstAttribute="centerY" secondItem="ZGI-tV-gLQ" secondAttribute="centerY" id="jfb-sk-rwP"/> |
| | | <constraint firstItem="Pah-Qd-T99" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="14" id="lY0-v3-RAo"/> |
| | | <constraint firstItem="XVQ-J7-Tg5" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="21" id="mOo-uy-aLe"/> |
| | | <constraint firstItem="Fex-hD-lXe" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="45" id="pUr-9f-1wN"/> |
| | | <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="Fex-hD-lXe" secondAttribute="bottom" constant="34" id="tCV-91-mmJ"/> |
| | | <constraint firstItem="ZGI-tV-gLQ" firstAttribute="top" secondItem="Pah-Qd-T99" secondAttribute="bottom" constant="50" id="y15-cK-U7B"/> |
| | | </constraints> |
| | | <point key="canvasLocation" x="139.69465648854961" y="20.422535211267608"/> |
| | | </view> |
| | |
| | | <resources> |
| | | <image name="bg_voice_top" width="390" height="297"/> |
| | | <image name="icon_music" width="20" height="20"/> |
| | | <image name="icon_voice_close" width="19" height="17"/> |
| | | <image name="icon_voice_open" width="19" height="16"/> |
| | | <image name="icon_voice_screen" width="23" height="21"/> |
| | | <systemColor name="systemBackgroundColor"> |
| | | <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
New file |
| | |
| | | // |
| | | // VideoPlayVC.swift |
| | | // XQMuse |
| | | // |
| | | // Created by 无故事王国 on 2025/2/12. |
| | | // |
| | | |
| | | import UIKit |
| | | |
| | | |
| | | class VideoPlayVC: BaseVC { |
| | | |
| | | private var playUrl:String! |
| | | |
| | | private(set) lazy var player: CLPlayer = { |
| | | let p = CLPlayer(frame: .zero) { config in |
| | | config.topBarHiddenStyle = .never |
| | | // config.isHiddenMorePanel = true |
| | | config.image.max = UIImage(named: "video_max") |
| | | config.image.min = UIImage(named: "video_min") |
| | | config.image.pause = UIImage(named: "video_pause") |
| | | config.image.play = UIImage(named: "video_play") |
| | | config.color.progressFinished = UIColor(hexStr: "#B7DC90") |
| | | config.color.progress = .white |
| | | config.color.progressBuffer = UIColor(hexStr: "#B7DC90").withAlphaComponent(0.75) |
| | | config.image.thumb = UIImage.jq_image(color: UIColor(hexStr: "#B7DC90"), size: CGSize(width: 6.5, height: 6.5), corners: .allCorners, radius: 3.25) |
| | | config.rotateStyle = .all |
| | | } |
| | | return p |
| | | }() |
| | | |
| | | init(playUrl:String,titleL:String) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.playUrl = playUrl |
| | | self.title = titleL |
| | | |
| | | } |
| | | |
| | | @MainActor required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | override func viewWillAppear(_ animated: Bool) { |
| | | super.viewWillAppear(animated) |
| | | (navigationItem.leftBarButtonItem?.customView as? UIButton)?.setImage(UIImage(named: "btn_back")?.withTintColor(.white), for: .normal) |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | view.backgroundColor = .black |
| | | |
| | | if #available(iOS 15.0, *) { |
| | | let scrollBar = UINavigationBarAppearance() |
| | | scrollBar.configureWithOpaqueBackground() |
| | | scrollBar.backgroundEffect = nil |
| | | scrollBar.shadowColor = nil |
| | | scrollBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] |
| | | scrollBar.backgroundColor = .black |
| | | |
| | | let standardBar = UINavigationBarAppearance() |
| | | standardBar.configureWithOpaqueBackground() |
| | | standardBar.backgroundEffect = nil |
| | | standardBar.shadowColor = nil |
| | | standardBar.shadowImage = nil |
| | | standardBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] |
| | | standardBar.backgroundColor = .black |
| | | |
| | | self.navigationController?.navigationBar.scrollEdgeAppearance = scrollBar //顶部透明 |
| | | self.navigationController?.navigationBar.standardAppearance = standardBar |
| | | }else { |
| | | self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] |
| | | self.navigationController?.navigationBar.isTranslucent = true |
| | | self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) |
| | | self.navigationController?.navigationBar.shadowImage = UIImage() |
| | | } |
| | | |
| | | view.addSubview(player) |
| | | player.snp.makeConstraints { make in |
| | | make.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 0, bottom: UIDevice.jq_safeEdges.bottom, right: 0)) |
| | | } |
| | | player.url = URL(string: playUrl) |
| | | player.delegate = self |
| | | player.play() |
| | | } |
| | | } |
| | | |
| | | extension VideoPlayVC:CLPlayerDelegate{ |
| | | |
| | | } |
| | |
| | | import UIKit |
| | | import JQTools |
| | | import RxSwift |
| | | import AVFoundation |
| | | |
| | | enum ImageFromType { |
| | | case local |
| | |
| | | private var defaultItems = [HomeTopMenuItem]() |
| | | private var clouse:((HomeTopMenuItem)->Void)? |
| | | |
| | | private var aVPlayerLayer:AVPlayerLayer? |
| | | |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | | |
| | | image_top.layer.masksToBounds = true |
| | | image_top.image = UIImage(named: "home_top_bg") |
| | | menu_height.constant = 119 |
| | | menu_collectionView.delegate = self |
| | |
| | | defaultItems.append(HomeTopMenuItem(title: "清业疗愈", image: "icon_quiet", imageFrom: .local)) |
| | | defaultItems.append(HomeTopMenuItem(title: "亲子疗愈", image: "icon_parent-child", imageFrom: .local)) |
| | | menu_collectionView.reloadData() |
| | | |
| | | NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: nil, queue: nil) { [weak self] data in |
| | | self?.aVPlayerLayer?.player?.seek(to: .zero) |
| | | self?.aVPlayerLayer?.player?.play() |
| | | } |
| | | |
| | | if let url = Bundle.main.url(forResource: "bg_water", withExtension: "mov"){ |
| | | setPlayer(url: url) |
| | | } |
| | | |
| | | } |
| | | |
| | | func resetTopImage(){ |
| | | if let imgUrl = UserDefaultSettingViewModel.getSetting()?.sceneMusicModel?.imageUrl.jq_urlEncoded(){ |
| | | var needLocalVideo = false |
| | | if let imgUrl = UserDefaultSettingViewModel.getSetting()?.sceneMusicModel?.imageUrl.jq_urlEncoded(),imgUrl.isEmpty == false{ |
| | | image_top.sd_setImage(with: URL(string: imgUrl)) |
| | | } |
| | | }else{ |
| | | image_top.image = UIImage(named: "home_top_bg") |
| | | needLocalVideo = true |
| | | } |
| | | |
| | | if let model = UserDefaultSettingViewModel.getSetting()?.sceneMusicModel{ |
| | | |
| | | aVPlayerLayer?.player?.pause() |
| | | aVPlayerLayer?.removeFromSuperlayer() |
| | | aVPlayerLayer = nil |
| | | |
| | | if model.backName?.isEmpty ?? true && model.imageUrl.isEmpty == false{ |
| | | image_top.sd_setImage(with: URL(string: model.imageUrl.jq_urlEncoded())) |
| | | } |
| | | |
| | | if let videoUrl = model.backUrl,videoUrl.isEmpty == false{ |
| | | setPlayer(url: URL(string: videoUrl)!) |
| | | return |
| | | } |
| | | |
| | | if needLocalVideo{ |
| | | if let url = Bundle.main.url(forResource: "bg_water", withExtension: "mov"){ |
| | | setPlayer(url: url) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private func setPlayer(url:URL){ |
| | | |
| | | let player = AVPlayer(url: url) |
| | | player.play() |
| | | player.isMuted = true |
| | | |
| | | if aVPlayerLayer == nil{ |
| | | aVPlayerLayer = AVPlayerLayer() |
| | | aVPlayerLayer = AVPlayerLayer(player: player) |
| | | aVPlayerLayer?.frame = image_top.frame |
| | | aVPlayerLayer?.videoGravity = .resizeAspectFill |
| | | self.layer.addSublayer(aVPlayerLayer!) |
| | | } |
| | | } |
| | | |
| | | func resetItems(_ items:[HomeTopMenuItem]){ |
| | | defaultItems.removeAll() |
| | | defaultItems = items |
| | |
| | | |
| | | getData() |
| | | queryNotice() |
| | | |
| | | Services.getTurn(progress: false).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data,m == true{ |
| | | weakSelf.view_otherGradient.isHidden = false |
| | | weakSelf.view_loveRanking.isHidden = false |
| | | weakSelf.btn_jump.isHidden = false |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | if !isSimulator{ |
| | | Services.getTurn(progress: false).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data,m == true{ |
| | | weakSelf.view_otherGradient.isHidden = false |
| | | weakSelf.view_loveRanking.isHidden = false |
| | | weakSelf.btn_jump.isHidden = false |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | |
| | | override func viewDidAppear(_ animated: Bool) { |
| | |
| | | self.view_bottomImage.isHidden = true |
| | | Services.getCommissionRule().subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | self.img_footerqrCode.sd_setImage(with: URL(string: m.qrCode)) |
| | | self.img_qrCode.sd_setImage(with: URL(string: m.qrCode)) |
| | | self.img_poster.sd_setImage(with: URL(string: m.poster)) |
| | | self.img_footerqrCode.sd_setImage(with: URL(string: m.qrCode.jq_urlEncoded())) |
| | | self.img_qrCode.sd_setImage(with: URL(string: m.qrCode.jq_urlEncoded())) |
| | | self.img_poster.sd_setImage(with: URL(string: m.poster.jq_urlEncoded())) |
| | | self.label_role.attributedText = NSAttributedString.convertHtml(m.rules) |
| | | } |
| | | |
| | |
| | | super.viewDidLoad() |
| | | title = "注销账号" |
| | | |
| | | Services.getTurn(progress: false).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data,m == true{ |
| | | weakSelf.label_content.attributedText = AttributedStringbuilder.build().add(string: "请认真阅读并理解,注销账号将产生以下后果:\n", withFont: .systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.6),lineSpace: 10) |
| | | .add(string: "1、账号信息、第三方授权、认证身份将被清空和取消;\n2、所有使用、收藏、关注列表和购买记录将被清空;\n3、账户中所有的余额将被清空;\n4、账户对应的会员身份与权益将被取消;\n5、您在平台发布的内容将做匿名处理。\n\n", withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.6), lineSpace: 7) |
| | | .add(string: "一经确认,以上内容将无法恢复,请谨慎考虑后决定。\n\n", withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.6),lineSpace: 7) |
| | | .add(string: "根据相关法律法规,注销泉疗愈账号并不代表注销前的账号行为和相关责任得到豁免或减轻。", withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.6),lineSpace: 7).mutableAttributedString |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | if !isSimulator{ |
| | | Services.getTurn(progress: false).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data,m == true{ |
| | | weakSelf.label_content.attributedText = AttributedStringbuilder.build().add(string: "请认真阅读并理解,注销账号将产生以下后果:\n", withFont: .systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.6),lineSpace: 10) |
| | | .add(string: "1、账号信息、第三方授权、认证身份将被清空和取消;\n2、所有使用、收藏、关注列表和购买记录将被清空;\n3、账户中所有的余额将被清空;\n4、账户对应的会员身份与权益将被取消;\n5、您在平台发布的内容将做匿名处理。\n\n", withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.6), lineSpace: 7) |
| | | .add(string: "一经确认,以上内容将无法恢复,请谨慎考虑后决定。\n\n", withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.6),lineSpace: 7) |
| | | .add(string: "根据相关法律法规,注销泉疗愈账号并不代表注销前的账号行为和相关责任得到豁免或减轻。", withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.6),lineSpace: 7).mutableAttributedString |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | label_content.attributedText = AttributedStringbuilder.build().add(string: "请认真阅读并理解,注销账号将产生以下后果:\n", withFont: .systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.6),lineSpace: 10) |
| | | .add(string: "1、账号信息、第三方授权、认证身份将被清空和取消;\n2、所有使用、收藏、关注列表将被清空;\n3、账户对应的会员身份与权益将被取消;\n4、您在平台发布的内容将做匿名处理。\n\n", withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.6), lineSpace: 7) |
| | |
| | | @IBOutlet weak var btn_logout: UIButton! |
| | | @IBOutlet weak var btn_dispel: TapBtn! |
| | | @IBOutlet weak var label_version: UILabel! |
| | | |
| | | @IBOutlet weak var btn_newVersion: UIButton! |
| | | private var model:VersionResultModel? |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "设置" |
| | | btn_newVersion.isHidden = true |
| | | navigationController?.navigationBar.standardAppearance.backgroundColor = .white |
| | | navigationController?.navigationBar.scrollEdgeAppearance?.backgroundColor = .white |
| | | |
| | |
| | | btn_logout.isHidden = UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true |
| | | btn_dispel.isHidden = UserViewModel.getLoginInfo()?.accessToken.isEmpty ?? true |
| | | |
| | | if let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { |
| | | label_version.text = JQTool.currentVersion() |
| | | label_version.text = JQTool.currentVersion() |
| | | |
| | | JQTool.checkVersion(appid: AppleID) { state, model, url in |
| | | if state{ |
| | | DispatchQueue.main.async { |
| | | self.btn_newVersion.isHidden = false |
| | | self.model = model |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | override func setUI() { |
| | | super.setUI() |
| | | view.backgroundColor = UIColor(hexString: "#fafafa") |
| | | btn_newVersion.jq_cornerRadius = 13.5 |
| | | } |
| | | |
| | | @IBAction func bindPhoneAction(_ sender: TapBtn) { |
| | |
| | | } |
| | | |
| | | @IBAction func checkVersion(_ sender: TapBtn) { |
| | | JQTool.checkVersion(appid: AppleID) { stat, model, url in |
| | | if stat{ |
| | | CommonAlertView.show(title: "版本更新", content: "发现新版本,是否更新?") { s in |
| | | if let u = url, s == true{ |
| | | UIApplication.shared.open(u) |
| | | } |
| | | } |
| | | }else{ |
| | | alert(msg: "当前已是最新版本") |
| | | } |
| | | } |
| | | // JQTool.checkVersion(appid: AppleID) { stat, model, url in |
| | | // if stat{ |
| | | // CommonAlertView.show(title: "版本更新", content: "发现新版本,是否更新?") { s in |
| | | // if let u = url, s == true{ |
| | | // UIApplication.shared.open(u) |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // alert(msg: "当前已是最新版本") |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | @IBAction func newVersionAction(_ sender: Any) { |
| | | if let m = model{ |
| | | UIApplication.shared.open(URL(string: m.trackViewUrl)!) |
| | | } |
| | | } |
| | | |
| | | @IBAction func exchangeAccountAction(_ sender: UIButton) { |
| | | // CommonAlertView.show(title: "提示", content: "是否切换当前账号?") {[weak self] s in |
| | | // if s{ |
| | |
| | | <outlet property="btn_dispel" destination="ta8-pP-aEf" id="cYz-J5-XFi"/> |
| | | <outlet property="btn_exchange" destination="yK9-0E-44J" id="Dlg-Zq-IOs"/> |
| | | <outlet property="btn_logout" destination="7uR-yB-LEb" id="scc-Tc-lfH"/> |
| | | <outlet property="btn_newVersion" destination="nBN-e1-f9Z" id="ebr-3x-9xh"/> |
| | | <outlet property="label_version" destination="IK1-Xd-41F" id="pKX-Sr-qOw"/> |
| | | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| | | </connections> |
| | |
| | | <nil key="textColor"/> |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nBN-e1-f9Z"> |
| | | <rect key="frame" x="294" y="10.666666666666686" width="56" height="27"/> |
| | | <color key="backgroundColor" red="0.74509803921568629" green="0.95294117647058818" blue="0.98039215686274506" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" constant="56" id="4Qc-gb-Wby"/> |
| | | <constraint firstAttribute="height" constant="27" id="zro-Rn-iwJ"/> |
| | | </constraints> |
| | | <fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/> |
| | | <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> |
| | | <state key="normal" title="新版本"> |
| | | <color key="titleColor" red="0.12941176469999999" green="0.63529411759999999" blue="0.70980392160000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | </state> |
| | | <connections> |
| | | <action selector="newVersionAction:" destination="-1" eventType="touchUpInside" id="GyW-mu-wXJ"/> |
| | | </connections> |
| | | </button> |
| | | </subviews> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | | <constraints> |
| | |
| | | <constraint firstItem="IK1-Xd-41F" firstAttribute="centerY" secondItem="gMu-uO-B2v" secondAttribute="centerY" id="hp3-w7-pnw"/> |
| | | <constraint firstItem="gMu-uO-B2v" firstAttribute="leading" secondItem="UeB-2r-ZNF" secondAttribute="leading" constant="11.5" id="lHO-Pt-WQF"/> |
| | | <constraint firstItem="gMu-uO-B2v" firstAttribute="centerY" secondItem="UeB-2r-ZNF" secondAttribute="centerY" id="nLT-wN-42F"/> |
| | | <constraint firstItem="nBN-e1-f9Z" firstAttribute="centerY" secondItem="UeB-2r-ZNF" secondAttribute="centerY" id="qGs-e8-P4j"/> |
| | | <constraint firstItem="Fcf-aE-CQR" firstAttribute="leading" secondItem="nBN-e1-f9Z" secondAttribute="trailing" constant="10" id="r3L-Jh-jeQ"/> |
| | | <constraint firstAttribute="height" constant="48" id="wXm-em-1ey"/> |
| | | </constraints> |
| | | <connections> |
| | |
| | | productList.insert("com.XQmuse.non.renewable.sub.quarter.1") |
| | | productList.insert("com.XQmuse.non.renewable.sub.month.1") |
| | | |
| | | // Services.getTurn(progress: false).subscribe(onNext: {[weak self]data in |
| | | // guard let weakSelf = self else { return } |
| | | // if let m = data.data,m == true{ |
| | | // weakSelf.isShowMore = m |
| | | // Services.getVipPrice().subscribe(onNext: { data in |
| | | // if let m = data.data{ |
| | | // weakSelf.vipContentModel = m |
| | | // weakSelf.collectionView.reloadData() |
| | | // } |
| | | // }).disposed(by: weakSelf.disposeBag) |
| | | // } |
| | | // }).disposed(by: disposeBag) |
| | | |
| | | if !isSimulator{ |
| | | Services.getTurn(progress: false).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data,m == true{ |
| | | weakSelf.isShowMore = m |
| | | Services.getVipPrice().subscribe(onNext: { data in |
| | | if let m = data.data{ |
| | | weakSelf.vipContentModel = m |
| | | weakSelf.collectionView.reloadData() |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | collectionView.delegate = self |
| | | collectionView.dataSource = self |
| | |
| | | } |
| | | |
| | | let transactionId = purchaseResult?.transaction_id ?? "" |
| | | let origintransactionId = purchaseResult?.original_transaction_id ?? "" |
| | | let receipt = SwiftyStoreKit.localReceiptData?.base64EncodedString() ?? "" |
| | | |
| | | showHUD("正在查询购买结果") |
| | | Services.placeOrderApple(amount: product.price.doubleValue, balanceFlag: .no, orderFrom: 3, transactionIdentifier: transactionId, vipType: weakSelf.selectIndex + 1).subscribe(onNext: { data in |
| | | showHUD("正在查询购买结果") |
| | | let observable = Observable<Int>.interval(RxTimeInterval.seconds(5), scheduler: MainScheduler.instance) |
| | | observable.subscribe { event in |
| | | if event.element == 10{ |
| | | alertError(msg: "订单异常,请联系客服") |
| | | weakSelf.timeLoopDisposeBag = DisposeBag() |
| | | return |
| | | Services.queryPlaceOrderApple(transactionId: transactionId, receipt: receipt).subscribe(onNext: {data in |
| | | hiddenHUD() |
| | | alertSuccess(msg: "购买成功") |
| | | NotificationCenter.default.post(name: UpdateUserProfile_Noti, object: nil, userInfo: nil) |
| | | DispatchQueue.main.asyncAfter(delay: 1.0) { |
| | | weakSelf.navigationController?.popViewController() |
| | | } |
| | | Services.getUserDetail(showProgress: false).subscribe(onNext: {data in |
| | | if data.data?.vipExpireTime != oldVipExpireTime{ |
| | | hiddenHUD() |
| | | alertSuccess(msg: "购买成功") |
| | | weakSelf.timeLoopDisposeBag = DisposeBag() |
| | | NotificationCenter.default.post(name: UpdateUserProfile_Noti, object: nil, userInfo: nil) |
| | | DispatchQueue.main.asyncAfter(delay: 1.0) { |
| | | weakSelf.navigationController?.popViewController() |
| | | } |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | }.disposed(by: weakSelf.timeLoopDisposeBag) |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | |
| | | // let observable = Observable<Int>.interval(RxTimeInterval.seconds(5), scheduler: MainScheduler.instance) |
| | | // observable.subscribe { event in |
| | | // if event.element == 10{ |
| | | // alertError(msg: "订单异常,请联系客服") |
| | | // weakSelf.timeLoopDisposeBag = DisposeBag() |
| | | // return |
| | | // } |
| | | // Services.getUserDetail(showProgress: false).subscribe(onNext: {data in |
| | | // if data.data?.vipExpireTime != oldVipExpireTime{ |
| | | // hiddenHUD() |
| | | // alertSuccess(msg: "购买成功") |
| | | // weakSelf.timeLoopDisposeBag = DisposeBag() |
| | | // NotificationCenter.default.post(name: UpdateUserProfile_Noti, object: nil, userInfo: nil) |
| | | // DispatchQueue.main.asyncAfter(delay: 1.0) { |
| | | // weakSelf.navigationController?.popViewController() |
| | | // } |
| | | // } |
| | | // }).disposed(by: weakSelf.disposeBag) |
| | | // }.disposed(by: weakSelf.timeLoopDisposeBag) |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | } errorClouse: { error in |
| | |
| | | import JQTools |
| | | import StoreKit |
| | | import RxSwift |
| | | import SwiftyStoreKit |
| | | |
| | | class WalletRechargeVC: BaseVC { |
| | | |
| | |
| | | super.viewDidLoad() |
| | | title = "疗愈币充值" |
| | | |
| | | Services.getTurn(progress: false).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data,m == true{ |
| | | weakSelf.isShowMore = m |
| | | weakSelf.tap_other.isHidden = false |
| | | weakSelf.tap_other_title.text = "支".appending("付").appending("宝") |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | if !isSimulator{ |
| | | Services.getTurn(progress: false).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data,m == true{ |
| | | weakSelf.isShowMore = m |
| | | weakSelf.tap_other.isHidden = false |
| | | weakSelf.tap_other_title.text = "支".appending("付").appending("宝") |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | |
| | | btn_handle.isEnabled = false |
| | |
| | | InPurchaseManager.purchaseProduct(ID: product.productIdentifier, applicationUsername: userId.string) {[weak self] result in |
| | | guard let weakSelf = self else { return } |
| | | if result.status == 0{ |
| | | let transactionId = result.receipt?.in_app.first?.original_transaction_id ?? "" |
| | | let transactionId = result.receipt?.in_app.first?.transaction_id ?? "" |
| | | Services.placeOrderApple(amount: product.price.doubleValue, balanceFlag: .no, orderFrom: 4, transactionIdentifier: transactionId, vipType: nil).subscribe(onNext: { data in |
| | | showHUD("正在查询购买结果") |
| | | let observable = Observable<Int>.interval(RxTimeInterval.seconds(5), scheduler: MainScheduler.instance) |
| | |
| | | var audioFileName: String = "" |
| | | var id: Int = 0 |
| | | var imageUrl: String = "" |
| | | |
| | | var backName:String? |
| | | var backUrl:String? |
| | | } |
| | | |
| | | struct ItemTypeModel:HandyJSON{ |
| | |
| | | var startPlayTime: String = "" |
| | | var time:Int = 0 |
| | | |
| | | var isShow:Int = 0 // 0 每日疗愈,1:展示微电影 |
| | | var meditationVideo:ToDayMeditationVideoModel? |
| | | |
| | | var playAtMe:Bool = false |
| | | } |
| | | |
| | | struct ToDayMeditationVideoModel:HandyJSON{ |
| | | var imageUrl:String = "" |
| | | var title:String = "" |
| | | var videoUrl:String = "" |
| | | var videoSecond:Int = 0 |
| | | } |
| | | |
| | | struct MeditationListModel:HandyJSON{ |
| | | var clientMeditationCategoryVO:MeditationTitleModel? |
| | | var clientMeditationVOList = [MeditationModel]() |
| | |
| | | .append(key: "vipType", value: vipType) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | | class func queryPlaceOrderApple(transactionId:String,receipt:String)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | params.interface(url: "/order/client/order/order/queryPlaceOrderApple") |
| | | .append(key: "transactionId", value: transactionId) |
| | | .append(key: "receipt", value: receipt) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | } |
| | | |
| | | /// 疗愈馆 |
| | |
| | | } |
| | | } |
| | | |
| | | static func getSceneSwitch()->Bool{ |
| | | if let scenestate = UserDefaults.standard.value(forKey: "sceneSwitch") as? Bool{ |
| | | return scenestate |
| | | }else{ |
| | | return true |
| | | } |
| | | } |
| | | |
| | | static func setSceneSwitch(state:Bool){ |
| | | UserDefaults.standard.set(state, forKey: "sceneSwitch") |
| | | UserDefaults.standard.synchronize() |
| | | } |
| | | |
| | | static func getToken()->String?{ |
| | | return UserDefaults.standard.object(forKey: "_userToken") as? String |
| | | } |
New file |
| | |
| | | // |
| | | // UpdateVersionView.swift |
| | | // XQMuse |
| | | // |
| | | // Created by 无故事王国 on 2025/2/8. |
| | | // |
| | | |
| | | import UIKit |
| | | import JQTools |
| | | |
| | | class UpdateVersionView: UIView,JQNibView{ |
| | | |
| | | @IBOutlet weak var view_content: UIView! |
| | | @IBOutlet weak var label_content: UILabel! |
| | | |
| | | @IBOutlet weak var btn_update: UIButton! |
| | | @IBOutlet weak var btn_last: UIButton! |
| | | |
| | | private var model:VersionResultModel? |
| | | |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | | view_content.transform = .init(scaleX: 0.1, y: 0.1) |
| | | alpha = 0 |
| | | } |
| | | |
| | | static func show(model:VersionResultModel){ |
| | | let updateVersionView = UpdateVersionView.jq_loadNibView() |
| | | updateVersionView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | updateVersionView.model = model |
| | | sceneDelegate?.window?.addSubview(updateVersionView) |
| | | updateVersionView.label_content.attributedText = AttributedStringbuilder.build().add(string: model.releaseNotes, withFont: .systemFont(ofSize: 14, weight: .medium), withColor: .black.withAlphaComponent(0.8), lineSpace: 5).mutableAttributedString |
| | | |
| | | UIView.animate(withDuration: 0.5) { |
| | | updateVersionView.view_content.transform = .init(scaleX: 1.0, y: 1.0) |
| | | updateVersionView.alpha = 1 |
| | | } completion: { _ in |
| | | |
| | | } |
| | | } |
| | | |
| | | override func layoutSubviews() { |
| | | super.layoutSubviews() |
| | | view_content.jq_cornerRadius = 10 |
| | | btn_last.jq_cornerRadius = 20 |
| | | |
| | | btn_last.jq_borderWidth = 1 |
| | | btn_last.jq_borderColor = UIColor(hexString: "#8EA47A") |
| | | |
| | | btn_update.jq_gradientNibColor(colorArr: [UIColor(hexStr: "#8EA47A").cgColor,UIColor(hexStr: "#AFCA98").cgColor], cornerRadius: 20) |
| | | } |
| | | |
| | | @IBAction func lastAction(_ sender: UIButton) { |
| | | UIView.animate(withDuration: 0.5) { |
| | | self.view_content.transform = .init(scaleX: 0.1, y: 0.1) |
| | | self.alpha = 0 |
| | | } completion: { _ in |
| | | self.removeFromSuperview() |
| | | } |
| | | UserDefaults.standard.set(model?.version, forKey: "ignoreVersion") |
| | | UserDefaults.standard.synchronize() |
| | | } |
| | | |
| | | @IBAction func updateNowAction(_ sender: UIButton) { |
| | | if let u = model?.trackViewUrl{ |
| | | UIApplication.shared.open(URL(string: u)!) |
| | | } |
| | | UIView.animate(withDuration: 0.5) { |
| | | self.view_content.transform = .init(scaleX: 0.1, y: 0.1) |
| | | self.alpha = 0 |
| | | } completion: { _ in |
| | | self.removeFromSuperview() |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> |
| | | <device id="retina6_12" orientation="portrait" appearance="light"/> |
| | | <dependencies> |
| | | <deployment identifier="iOS"/> |
| | | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/> |
| | | <capability name="Safe area layout guides" minToolsVersion="9.0"/> |
| | | <capability name="System colors in document resources" minToolsVersion="11.0"/> |
| | | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| | | </dependencies> |
| | | <objects> |
| | | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> |
| | | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| | | <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="UpdateVersionView" customModule="XQMuse" customModuleProvider="target"> |
| | | <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> |
| | | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
| | | <subviews> |
| | | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PGv-Lo-hmt"> |
| | | <rect key="frame" x="45" y="337" width="303" height="203"/> |
| | | <subviews> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="有新版本啦!" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pFh-vK-dcL"> |
| | | <rect key="frame" x="102.33333333333334" y="24" width="98.333333333333343" height="21"/> |
| | | <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/> |
| | | <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bv3-ml-sW4"> |
| | | <rect key="frame" x="21" y="76" width="261" height="17"/> |
| | | <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> |
| | | <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dZK-5B-M7s"> |
| | | <rect key="frame" x="172" y="133" width="98" height="40"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" constant="98" id="JFh-3s-X5k"/> |
| | | <constraint firstAttribute="height" constant="40" id="PNI-PX-gZf"/> |
| | | </constraints> |
| | | <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> |
| | | <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> |
| | | <state key="normal" title="立即更新"/> |
| | | <connections> |
| | | <action selector="updateNowAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="WbS-jl-nMz"/> |
| | | </connections> |
| | | </button> |
| | | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yw3-29-UGQ"> |
| | | <rect key="frame" x="32" y="133" width="98" height="40"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" constant="98" id="ZxV-i9-xs3"/> |
| | | <constraint firstAttribute="height" constant="40" id="hjX-iy-LTz"/> |
| | | </constraints> |
| | | <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> |
| | | <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> |
| | | <state key="normal" title="下次再说"> |
| | | <color key="titleColor" red="0.55686274509803924" green="0.64313725490196072" blue="0.47843137254901957" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | </state> |
| | | <connections> |
| | | <action selector="lastAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="fNN-8D-2nV"/> |
| | | </connections> |
| | | </button> |
| | | </subviews> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | | <constraints> |
| | | <constraint firstItem="pFh-vK-dcL" firstAttribute="top" secondItem="PGv-Lo-hmt" secondAttribute="top" constant="24" id="0ZX-Bg-Hxs"/> |
| | | <constraint firstItem="Bv3-ml-sW4" firstAttribute="leading" secondItem="PGv-Lo-hmt" secondAttribute="leading" constant="21" id="Bof-au-rcb"/> |
| | | <constraint firstAttribute="trailing" secondItem="Bv3-ml-sW4" secondAttribute="trailing" constant="21" id="DWf-jT-gKp"/> |
| | | <constraint firstItem="Bv3-ml-sW4" firstAttribute="top" secondItem="pFh-vK-dcL" secondAttribute="bottom" constant="31" id="IN4-dD-Zji"/> |
| | | <constraint firstItem="yw3-29-UGQ" firstAttribute="leading" secondItem="PGv-Lo-hmt" secondAttribute="leading" constant="32" id="gs6-yQ-NM7"/> |
| | | <constraint firstItem="dZK-5B-M7s" firstAttribute="top" secondItem="Bv3-ml-sW4" secondAttribute="bottom" constant="40" id="hNw-Jy-om7"/> |
| | | <constraint firstItem="dZK-5B-M7s" firstAttribute="centerY" secondItem="yw3-29-UGQ" secondAttribute="centerY" id="hk8-Bg-FZv"/> |
| | | <constraint firstAttribute="bottom" secondItem="dZK-5B-M7s" secondAttribute="bottom" constant="30" id="q8k-Mv-H7D"/> |
| | | <constraint firstAttribute="trailing" secondItem="dZK-5B-M7s" secondAttribute="trailing" constant="33" id="v3G-EY-SYd"/> |
| | | <constraint firstItem="pFh-vK-dcL" firstAttribute="centerX" secondItem="PGv-Lo-hmt" secondAttribute="centerX" id="zY0-ym-N99"/> |
| | | </constraints> |
| | | </view> |
| | | </subviews> |
| | | <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/> |
| | | <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <constraints> |
| | | <constraint firstItem="PGv-Lo-hmt" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="45" id="4JV-Fj-FPm"/> |
| | | <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="PGv-Lo-hmt" secondAttribute="trailing" constant="45" id="65S-ov-g1e"/> |
| | | <constraint firstItem="PGv-Lo-hmt" firstAttribute="centerY" secondItem="vUN-kp-3ea" secondAttribute="centerY" id="oID-WN-WHi"/> |
| | | <constraint firstItem="PGv-Lo-hmt" firstAttribute="centerX" secondItem="vUN-kp-3ea" secondAttribute="centerX" id="xcy-8U-O11"/> |
| | | </constraints> |
| | | <connections> |
| | | <outlet property="btn_last" destination="yw3-29-UGQ" id="6j7-2T-KB1"/> |
| | | <outlet property="btn_update" destination="dZK-5B-M7s" id="pGW-sM-5iT"/> |
| | | <outlet property="label_content" destination="Bv3-ml-sW4" id="hgV-lI-uNo"/> |
| | | <outlet property="view_content" destination="PGv-Lo-hmt" id="UVT-8w-0o2"/> |
| | | </connections> |
| | | <point key="canvasLocation" x="138" y="20"/> |
| | | </view> |
| | | </objects> |
| | | <resources> |
| | | <systemColor name="systemBackgroundColor"> |
| | | <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | | </systemColor> |
| | | </resources> |
| | | </document> |
| | |
| | | } |
| | | } |
| | | |
| | | @IBAction func customAction(_ sender: UIButton) { |
| | | PlanGuidePromptView.show {[weak self] type in |
| | | switch type { |
| | | case .seeOther: |
| | | let vc = PlanGuide_1_VC() |
| | | self?.jq_push(vc: vc) |
| | | case .toSeting: |
| | | let vc = BackgroundVoiceVC(isFromFist: self?.isFromFist ?? false) |
| | | vc.hidesBottomBarWhenPushed = true |
| | | JQ_currentNavigationController().pushViewController(vc) |
| | | } |
| | | } |
| | | } |
| | | @IBAction func customAction(_ sender: UIButton) { |
| | | let vc = PlanGuide_1_VC() |
| | | jq_push(vc: vc) |
| | | // PlanGuidePromptView.show {[weak self] type in |
| | | // switch type { |
| | | // case .seeOther: |
| | | // let vc = PlanGuide_1_VC() |
| | | // self?.jq_push(vc: vc) |
| | | // case .toSeting: |
| | | // let vc = BackgroundVoiceVC(isFromFist: self?.isFromFist ?? false) |
| | | // vc.hidesBottomBarWhenPushed = true |
| | | // JQ_currentNavigationController().pushViewController(vc) |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | deinit{ |
| | | |
| | |
| | | label_title.font = Def_FlyFlowerSong(fontSize: 35) |
| | | label_title.textColor = UIColor(hexString: "#35662D") |
| | | |
| | | label_subTitle.attributedText = AttributedStringbuilder.build().add(string: "请您遵从本心\n回答以下问题\n挑选您喜欢的空间环境\n为您定制专属您的\n心泉·冥想空间", withFont: Def_SourceHanSerif_Regular(fontSize: 19), withColor: UIColor(hexString: "#404040")!, lineSpace: 23).mutableAttributedString |
| | | label_subTitle.attributedText = AttributedStringbuilder.build().add(string: "请您遵从本心\n回答以下问题\n挑选您喜欢的空间环境\n为您定制专属您的\n泉疗愈空间", withFont: Def_SourceHanSerif_Regular(fontSize: 19), withColor: UIColor(hexString: "#404040")!, lineSpace: 23).mutableAttributedString |
| | | label_subTitle.textAlignment = .center |
| | | |
| | | label_info.attributedText = AttributedStringbuilder.build().add(string: "懂您才可以更好的帮助您", withFont: Def_SourceHanSerif_Regular(fontSize: 18), withColor: UIColor(hexString: "#404040")!, lineSpace: 23).underLine(color: UIColor(hexString: "#404040")!).mutableAttributedString |
| | |
| | | 回答以下问题 |
| | | 挑选您喜欢的空间环境 |
| | | 为您定制专属您的 |
| | | 心泉·冥想空间</string> |
| | | 泉疗愈空间</string> |
| | | <fontDescription key="fontDescription" type="system" pointSize="17"/> |
| | | <nil key="textColor"/> |
| | | <nil key="highlightedColor"/> |
| | |
| | | |
| | | private var treeInfoModel:TreeInfoModel? |
| | | |
| | | private var ruleView:TreeTeskFirstRuleView? |
| | | |
| | | private var maxLevel:TreeLevel? |
| | | private var currentLevel:TreeLevel? |
| | | |
| | | private lazy var voicePlayer:AVPlayer = { |
| | | let p = AVPlayer() |
| | | return p |
| | |
| | | if settingModel!.userFirstOpenTreeTask{ |
| | | DispatchQueue.main.asyncAfter(delay: 0.5) { |
| | | let h = (JQ_ScreenW - 90) * 0.8766 |
| | | TreeTeskFirstRuleView.show(title: "生命之树", content:"亲爱的家人,生命之树的种子已植入这片沃土,请以农夫的心态用心浇灌,为你加油哦。",textAlignment: .left,height: h,textTopOffset: 22) |
| | | self.ruleView = TreeTeskFirstRuleView.show(title: "生命之树", content:"亲爱的家人,生命之树的种子已植入这片沃土,请以农夫的心态用心浇灌,为你加油哦。",textAlignment: .left,height: h,textTopOffset: 22) |
| | | self.voicePlayer.replaceCurrentItem(with: AVPlayerItem(url: URL(string: TreeLevel.level_1.sound)!)) |
| | | self.voicePlayer.play() |
| | | self.ruleView?.setEnableBtn(state: false) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private func getTreeData(){ |
| | | |
| | | //缓存的树苗信息 |
| | |
| | | if let m = data.data{ |
| | | self.taskListView.setTreeInfoModel(m) |
| | | self.treeInfoModel = m |
| | | if self.currentLevel == nil{ |
| | | self.currentLevel = m.treeLevelType |
| | | } |
| | | self.updateTreeInfo() |
| | | self.updateAni(false) |
| | | try? self.cacheTreeInfoModel.save(m) |
| | |
| | | } |
| | | |
| | | private func updateTreeInfo(){ |
| | | btn_seedingAgain.isHidden = treeInfoModel!.treeLevelType != .level_10 |
| | | btn_seedingAgain.isHidden = currentLevel != .level_10 |
| | | |
| | | icon_energy.text = String(format: "当前能量值:%ld", treeInfoModel!.energyValue) |
| | | setProgress(current: treeInfoModel!.growthValue, total: treeInfoModel!.nextLevel) |
| | |
| | | |
| | | @IBAction func sowAgainAction(_ sender: UIButton) { |
| | | Services.sowAgain().subscribe(onNext: {[weak self] _ in |
| | | self?.currentLevel = nil |
| | | self?.getTreeData() |
| | | |
| | | if self?.treeInfoModel?.treeLevelType == .level_10{ |
| | | if let soundURL = URL(string:TreeLevel.level_1.sound){ |
| | | self?.voicePlayer.replaceCurrentItem(with: AVPlayerItem(url: soundURL)) |
| | | self?.voicePlayer.play() |
| | | } |
| | | let h = (JQ_ScreenW - 90) * 0.7729 |
| | | self?.ruleView = TreeTeskFirstRuleView.show(title: "生命之树", content:TreeLevel.level_1.titleContent,textAlignment: .center,height: h,textTopOffset: 57,clickClouse: { |
| | | |
| | | }) |
| | | |
| | | if let soundURL = URL(string:TreeLevel.level_1.sound){ |
| | | self?.voicePlayer.replaceCurrentItem(with: AVPlayerItem(url: soundURL)) |
| | | self?.voicePlayer.play() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | |
| | | if currentItem?.url == notifiUrl?.url{ |
| | | self?.player.seek(to: CMTime.zero) |
| | | self?.player.play() |
| | | } |
| | | |
| | | //播放音频完成 |
| | | if let voiceUrl = (self?.voicePlayer.currentItem?.asset as? AVURLAsset){ |
| | | if voiceUrl.url == notifiUrl?.url{ |
| | | self?.ruleView?.setEnableBtn(state: true) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private func next(){ |
| | | currentLevel?.updateLevel() |
| | | guard let currentL = currentLevel else {return} |
| | | guard let maxL = maxLevel else {return} |
| | | if currentL.rawValue > maxL.rawValue{return} |
| | | |
| | | |
| | | let h = (JQ_ScreenW - 90) * 0.7729 |
| | | ruleView = TreeTeskFirstRuleView.show(title: "生命之树", content:currentL.titleContent,textAlignment: .center,height: h,textTopOffset: 57,clickClouse: {[weak self] () in |
| | | if currentL.rawValue != maxL.rawValue || currentL != TreeLevel.level_10{ |
| | | self?.next() |
| | | } |
| | | }) |
| | | |
| | | if let soundURL = URL(string:currentL.sound){ |
| | | voicePlayer.replaceCurrentItem(with: AVPlayerItem(url: soundURL)) |
| | | voicePlayer.play() |
| | | } |
| | | |
| | | ruleView?.setEnableBtn(state: false) |
| | | |
| | | updateAni() |
| | | getTreeData() |
| | | updateTreeInfo() |
| | | } |
| | | |
| | | //能量明细 |
| | | @IBAction func energyDetailAction(_ sender: TapBtn) { |
| | | guard sceneDelegate!.checkisLoginState() else {return} |
| | |
| | | if let m = data.data{ |
| | | sender.isUserInteractionEnabled = true |
| | | if m.isNext{ |
| | | weakSelf.maxLevel = m.treeLevelType |
| | | weakSelf.treeInfoModel!.treeLevelType = m.treeLevelType |
| | | |
| | | let h = (JQ_ScreenW - 90) * 0.7729 |
| | | TreeTeskFirstRuleView.show(title: "什么之树", content:weakSelf.treeInfoModel!.treeLevelType.titleContent,textAlignment: .center,height: h,textTopOffset: 57) |
| | | |
| | | if let soundURL = URL(string:weakSelf.treeInfoModel?.treeLevelType.sound){ |
| | | weakSelf.voicePlayer.replaceCurrentItem(with: AVPlayerItem(url: soundURL)) |
| | | weakSelf.voicePlayer.play() |
| | | } |
| | | weakSelf.next() |
| | | } |
| | | |
| | | weakSelf.updateAni() |
| | | weakSelf.getTreeData() |
| | | |
| | | weakSelf.treeInfoModel?.growthValue = m.growthValue |
| | | weakSelf.treeInfoModel?.energyValue = 0 |
| | | weakSelf.treeInfoModel?.nextLevel = m.nextLevel |
| | | weakSelf.updateTreeInfo() |
| | | |
| | | NotificationCenter.default.post(name: UpdateUserProfile_Noti, object: nil) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | |
| | | } |
| | | |
| | | private func updateAni(_ needAni:Bool = true){ |
| | | let treeLevel = treeInfoModel?.treeLevelType ?? .level_1 |
| | | guard let treeLevel = currentLevel else {return} |
| | | |
| | | guard let animateUrl = Bundle.main.url(forResource: treeLevel.aniResource, withExtension: "png") else {return} |
| | | guard let staticDroopUrl = Bundle.main.url(forResource: treeLevel.staticDroopResource, withExtension: "png") else {return} |
| | |
| | | // @IBOutlet weak var cons_hei: NSLayoutConstraint! |
| | | @IBOutlet weak var cons_textTop: NSLayoutConstraint! |
| | | private var settingModel = UserDefaultSettingViewModel.getSetting() |
| | | private var clickClouse:(()->Void)? |
| | | |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | |
| | | view_container.jq_cornerRadius = 14 |
| | | } |
| | | |
| | | static func show(title:String,content:String,textAlignment:NSTextAlignment,height:Double,textTopOffset:Double){ |
| | | @discardableResult |
| | | static func show(title:String,content:String,textAlignment:NSTextAlignment,height:Double,textTopOffset:Double,clickClouse: (()->Void)? = nil)->TreeTeskFirstRuleView{ |
| | | let ruleView = TreeTeskFirstRuleView.jq_loadNibView() |
| | | ruleView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | ruleView.clickClouse = clickClouse |
| | | |
| | | ruleView.label_title.text = title |
| | | ruleView.label_content.attributedText = AttributedStringbuilder.build().add(string:content, withFont: .systemFont(ofSize: 14), withColor: .black.withAlphaComponent(0.59), lineSpace: 7).mutableAttributedString |
| | |
| | | ruleView.alpha = 1.0 |
| | | ruleView.view_container.transform = .init(scaleX: 1.0, y: 1.0) |
| | | } |
| | | return ruleView |
| | | } |
| | | |
| | | @IBAction func completeAction(_ sender: UIButton) { |
| | |
| | | self.settingModel?.userFirstOpenTreeTask = false |
| | | UserDefaultSettingViewModel.saveSetting(self.settingModel!) |
| | | } |
| | | clickClouse?() |
| | | } |
| | | |
| | | override func layoutSubviews() { |
| | | super.layoutSubviews() |
| | | btn_complete.localGradientColor(cornerRadius: 20,bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW - 85 * 2, height: 40)) |
| | | } |
| | | |
| | | func setEnableBtn(state:Bool){ |
| | | btn_complete.isEnabled = state |
| | | if state{ |
| | | btn_complete.localGradientColor(cornerRadius: 20,bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW - 85 * 2, height: 40)) |
| | | }else{ |
| | | btn_complete.jq_gradientColor(colorArr: [UIColor(hexString: "#CDCDCD")!.cgColor,UIColor(hexString: "#CDCDCD")!.cgColor], cornerRadius: 20, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 1, y: 0), bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW - 85 * 2, height: 40),clear: true) |
| | | } |
| | | |
| | | } |
| | | |
| | | // override func layoutSubviews() { |
| | | // super.layoutSubviews() |
| | | /*btn_complete.localGradientColor(cornerRadius: 20,bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW - 85 * 2, height: 40))*/ |
| | | // } |
| | | } |