diff --git a/ReaderHive.xcodeproj/project.pbxproj b/ReaderHive.xcodeproj/project.pbxproj index 10b8f2d..e52e55b 100644 --- a/ReaderHive.xcodeproj/project.pbxproj +++ b/ReaderHive.xcodeproj/project.pbxproj @@ -3037,7 +3037,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.lssj.ReaderHive; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -3082,7 +3082,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.lssj.ReaderHive; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/ReaderHive.xcodeproj/xcshareddata/xcschemes/NotificationService.xcscheme b/ReaderHive.xcodeproj/xcshareddata/xcschemes/NotificationService.xcscheme index 84723fe..58d4ead 100644 --- a/ReaderHive.xcodeproj/xcshareddata/xcschemes/NotificationService.xcscheme +++ b/ReaderHive.xcodeproj/xcshareddata/xcschemes/NotificationService.xcscheme @@ -56,8 +56,7 @@ debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES" - launchAutomaticallySubstyle = "2" - notificationPayloadFile = "Example/watchOSSample/SampleWatchAppWatchKitExtension/PushNotificationPayload.apns"> + launchAutomaticallySubstyle = "2"> 0 { - self.categoryView.isHidden = false - self.categoryView.text = text - } else if let text = model?.category?.first, text.count > 0 { - self.categoryView.isHidden = false - self.categoryView.text = text - } else { - self.categoryView.isHidden = true - } if model?.tag_type == .new { markImageView.isHidden = false @@ -33,6 +24,14 @@ class NRNovelGenresCell: UICollectionViewCell { } else { markImageView.isHidden = true } + + updateCategory() + } + } + + var category: String? { + didSet { + updateCategory() } } @@ -74,6 +73,21 @@ class NRNovelGenresCell: UICollectionViewCell { fatalError("init(coder:) has not been implemented") } + private func updateCategory() { + if let text = self.category { + self.categoryView.isHidden = false + self.categoryView.text = text + } else if let text = model?.categoryList?.first?.name, text.count > 0 { + self.categoryView.isHidden = false + self.categoryView.text = text + } else if let text = model?.category?.first, text.count > 0 { + self.categoryView.isHidden = false + self.categoryView.text = text + } else { + self.categoryView.isHidden = true + } + } + } extension NRNovelGenresCell { diff --git a/ReaderHive/Class/Explore/VC/NRNovelGenresViewController.swift b/ReaderHive/Class/Explore/VC/NRNovelGenresViewController.swift index f400c22..adcf487 100644 --- a/ReaderHive/Class/Explore/VC/NRNovelGenresViewController.swift +++ b/ReaderHive/Class/Explore/VC/NRNovelGenresViewController.swift @@ -110,6 +110,7 @@ extension NRNovelGenresViewController: UICollectionViewDelegate, UICollectionVie func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! NRNovelGenresCell cell.model = self.dataArr[indexPath.row] + cell.category = self.model?.name return cell } diff --git a/ReaderHive/Class/Me/V/NRMeHeaderView.swift b/ReaderHive/Class/Me/V/NRMeHeaderView.swift index e1442ce..439f051 100644 --- a/ReaderHive/Class/Me/V/NRMeHeaderView.swift +++ b/ReaderHive/Class/Me/V/NRMeHeaderView.swift @@ -11,8 +11,7 @@ import YYCategories import HWPanModal class NRMeHeaderView: UITableViewHeaderFooterView { - -// var contentHeight: CGFloat = 200 + var userInfo: NRUserInfo? { didSet { @@ -68,19 +67,29 @@ class NRMeHeaderView: UITableViewHeaderFooterView { let button = UIButton(type: .custom, primaryAction: UIAction(handler: { [weak self] _ in guard let self = self else { return } UIPasteboard.general.string = NRLoginManager.manager.userInfo?.customer_id - NRToast.show(text: "Success") + NRToast.show(text: "Success".localized) })) button.setImage(UIImage(named: "copy_icon_01"), for: .normal) return button }() private lazy var loginButton: UIButton = { - let button = UIButton(type: .custom, primaryAction: UIAction(handler: { [weak self] _ in + var configuration = UIButton.Configuration.plain() + configuration.attributedTitle = AttributedString("Log in".localized, attributes: AttributeContainer([ + .font : UIFont.font(ofSize: 14, weight: .medium), + .foregroundColor : UIColor.F_9710_D + ])) + configuration.contentInsets = .init(top: 0, leading: 20, bottom: 0, trailing: 20) + + let button = UIButton(configuration: configuration, primaryAction: UIAction(handler: { [weak self] _ in guard let self = self else { return } let view = NRLoginView() view.present(in: nil) })) - button.setImage(UIImage(named: "login_button"), for: .normal) + button.layer.cornerRadius = 18 + button.layer.masksToBounds = true + button.layer.borderWidth = 1 + button.layer.borderColor = UIColor.F_9710_D.cgColor return button }() @@ -168,6 +177,7 @@ extension NRMeHeaderView { loginButton.snp.makeConstraints { make in make.centerY.equalTo(avatarImageView) make.right.equalToSuperview().offset(-16) + make.height.equalTo(36) } stackView.snp.makeConstraints { make in diff --git a/ReaderHive/Class/Me/V/NRNovelHistoryCell.swift b/ReaderHive/Class/Me/V/NRNovelHistoryCell.swift index 7feed39..f52f86f 100644 --- a/ReaderHive/Class/Me/V/NRNovelHistoryCell.swift +++ b/ReaderHive/Class/Me/V/NRNovelHistoryCell.swift @@ -63,7 +63,7 @@ class NRNovelHistoryCell: UICollectionViewCell { let isCollect = !(self.model?.is_collect ?? false) Task { - await NRNovelAPI.requestCollect(isCollect: isCollect, id: self.model?.id ?? "") + await NRNovelAPI.requestCollect(isCollect: isCollect, id: self.model?.id ?? "", chapterId: self.model?.short_play_video_id) } }), for: .touchUpInside) diff --git a/ReaderHive/Class/Me/VC/NRMeViewController.swift b/ReaderHive/Class/Me/VC/NRMeViewController.swift index b4a090f..7230e37 100644 --- a/ReaderHive/Class/Me/VC/NRMeViewController.swift +++ b/ReaderHive/Class/Me/VC/NRMeViewController.swift @@ -10,17 +10,7 @@ import SnapKit class NRMeViewController: NRViewController { - private lazy var dataArr: [NRMeItem] = { - let arr = [ - NRMeItem(type: .history, icon: UIImage(named: "history_icon_01"), title: "History".localized), - NRMeItem(type: .wallet, icon: UIImage(named: "wallet_icon_01"), title: "My Wallet".localized), -// NRMeItem(type: .language, icon: UIImage(named: "language_icon_01"), title: "Language".localized), - NRMeItem(type: .feedback, icon: UIImage(named: "feedback_icon_01"), title: "Feedback".localized), - NRMeItem(type: .settings, icon: UIImage(named: "settings_icon_02"), title: "Settings".localized), - NRMeItem(type: .about, icon: UIImage(named: "about_icon_01"), title: "About".localized), - ] - return arr - }() + private lazy var dataArr: [NRMeItem] = [] private lazy var tableView: NRTableView = { let tableView = NRTableView(frame: .zero, style: .insetGrouped) @@ -43,6 +33,7 @@ class NRMeViewController: NRViewController { NotificationCenter.default.addObserver(self, selector: #selector(userInfoUpdateNotification), name: NRLoginManager.userInfoUpdateNotification, object: nil) nr_setupUI() + reloadDataArr() } @@ -60,7 +51,7 @@ class NRMeViewController: NRViewController { } @objc private func userInfoUpdateNotification() { - self.tableView.reloadData() + reloadDataArr() } } @@ -136,3 +127,22 @@ extension NRMeViewController: UITableViewDelegate, UITableViewDataSource { } } } + + +extension NRMeViewController { + + private func reloadDataArr() { + var dataArr: [NRMeItem] = [] + dataArr.append(NRMeItem(type: .history, icon: UIImage(named: "history_icon_01"), title: "History".localized)) + dataArr.append(NRMeItem(type: .wallet, icon: UIImage(named: "wallet_icon_01"), title: "My Wallet".localized)) +// dataArr.append(NRMeItem(type: .language, icon: UIImage(named: "language_icon_01"), title: "Language".localized)) + dataArr.append(NRMeItem(type: .feedback, icon: UIImage(named: "feedback_icon_01"), title: "Feedback".localized)) + if NRLoginManager.manager.userInfo?.is_tourist == false { + dataArr.append(NRMeItem(type: .settings, icon: UIImage(named: "settings_icon_02"), title: "Settings".localized)) + } + dataArr.append(NRMeItem(type: .about, icon: UIImage(named: "about_icon_01"), title: "About".localized)) + self.dataArr = dataArr + self.tableView.reloadData() + } + +} diff --git a/ReaderHive/Class/Me/VC/NRSettingViewController.swift b/ReaderHive/Class/Me/VC/NRSettingViewController.swift index cab17c1..f237045 100644 --- a/ReaderHive/Class/Me/VC/NRSettingViewController.swift +++ b/ReaderHive/Class/Me/VC/NRSettingViewController.swift @@ -118,12 +118,12 @@ extension NRSettingViewController { private func getDataArr() -> [NRMeItem] { if NRLoginManager.manager.userInfo?.is_tourist == true { return [ - NRMeItem(type: .myUnlocks, title: "My Unlocks".localized), +// NRMeItem(type: .myUnlocks, title: "My Unlocks".localized), ] } else { return [ NRMeItem(type: .accountDeletion, title: "Account Deletion".localized), - NRMeItem(type: .myUnlocks, title: "My Unlocks".localized), +// NRMeItem(type: .myUnlocks, title: "My Unlocks".localized), ] } } diff --git a/ReaderHive/Class/MyList/VC/NRMyListNovelViewController.swift b/ReaderHive/Class/MyList/VC/NRMyListNovelViewController.swift index 0f39af6..70570f4 100644 --- a/ReaderHive/Class/MyList/VC/NRMyListNovelViewController.swift +++ b/ReaderHive/Class/MyList/VC/NRMyListNovelViewController.swift @@ -149,7 +149,7 @@ extension NRMyListNovelViewController { await NRNovelAPI.requestCollect(isCollect: false, id: id, chapterId: model.short_play_video_id) - await self.requestDataArr(page: 1) +// await self.requestDataArr(page: 1) } } diff --git a/ReaderHive/Class/Novel/VC/NRNovelDetailCatalogViewController.swift b/ReaderHive/Class/Novel/VC/NRNovelDetailCatalogViewController.swift index 7086b4a..1c9ec00 100644 --- a/ReaderHive/Class/Novel/VC/NRNovelDetailCatalogViewController.swift +++ b/ReaderHive/Class/Novel/VC/NRNovelDetailCatalogViewController.swift @@ -147,6 +147,7 @@ extension NRNovelDetailCatalogViewController: UITableViewDelegate, UITableViewDa let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! NRNovelCatalogCell cell.model = model + cell.nr_isSelected = model.id == self.novelModel?.progress?.short_play_video_id return cell } @@ -183,7 +184,14 @@ extension NRNovelDetailCatalogViewController: UITableViewDelegate, UITableViewDa let vc = NRNovelReaderViewController() vc.novelId = novelId vc.targetCatalogModel = model - self.navigationController?.pushViewController(vc, animated: true) + + var vcArr = self.navigationController?.viewControllers + vcArr?.removeLast() + vcArr?.append(vc) + + self.navigationController?.setViewControllers(vcArr ?? [], animated: true) + +// self.navigationController?.pushViewController(vc, animated: true) } } diff --git a/ReaderHive/Class/Novel/VC/NRNovelDetailViewController.swift b/ReaderHive/Class/Novel/VC/NRNovelDetailViewController.swift index ebaf445..0154feb 100644 --- a/ReaderHive/Class/Novel/VC/NRNovelDetailViewController.swift +++ b/ReaderHive/Class/Novel/VC/NRNovelDetailViewController.swift @@ -23,6 +23,8 @@ class NRNovelDetailViewController: NRViewController { private var navigationStyleScale: CGFloat = 0 + private lazy var isViewDidAppear = false + lazy var coverBgImageView: NRImageView = { let imageView = NRImageView() imageView.nr_addEffectView(style: .dark) @@ -79,16 +81,14 @@ class NRNovelDetailViewController: NRViewController { nr_setupUI() - Task { - await self.viewModel.requestDetailData() - self.coverBgImageView.nr_setImage(self.viewModel.novelModel?.image_url) - self.headerView.model = self.viewModel.novelModel - - await self.viewModel.requestRecommandData() - self.recommandVC.dataArr = self.viewModel.recommandDataArr ?? [] - } + updateHeaderViewHeight() + + Task { + await updateData() + } + } override func viewWillAppear(_ animated: Bool) { @@ -97,6 +97,18 @@ class NRNovelDetailViewController: NRViewController { updateNavigationStyle() } + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + if !isViewDidAppear { + isViewDidAppear = true + } else { + Task { + await updateData() + } + } + } + override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { if self.recommandListView == object as? UIScrollView { if keyPath == "contentSize" { @@ -249,3 +261,16 @@ extension NRNovelDetailViewController { } } + +extension NRNovelDetailViewController { + private func updateData() async { + + await self.viewModel.requestDetailData() + self.coverBgImageView.nr_setImage(self.viewModel.novelModel?.image_url) + self.headerView.model = self.viewModel.novelModel + + await self.viewModel.requestRecommandData() + self.recommandVC.dataArr = self.viewModel.recommandDataArr ?? [] + + } +} diff --git a/ReaderHive/Delegate/AppDelegate.swift b/ReaderHive/Delegate/AppDelegate.swift index 4b4233d..621ba6e 100644 --- a/ReaderHive/Delegate/AppDelegate.swift +++ b/ReaderHive/Delegate/AppDelegate.swift @@ -56,7 +56,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } NRIapManager.manager.preloadingProducts() - NRTool.sceneDelegate?.retryHandleOpenAppMessage() } } diff --git a/ReaderHive/Delegate/SceneDelegate.swift b/ReaderHive/Delegate/SceneDelegate.swift index d9a84c0..f64b4d9 100644 --- a/ReaderHive/Delegate/SceneDelegate.swift +++ b/ReaderHive/Delegate/SceneDelegate.swift @@ -17,6 +17,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = (scene as? UIWindowScene) else { return } + NotificationCenter.default.addObserver(self, selector: #selector(networkStatusDidChangeNotification), name: NRNetworkReachableManager.networkStatusDidChangeNotification, object: nil) + NRTool.sceneDelegate = self NRTool.windowScene = windowScene @@ -101,7 +103,11 @@ extension SceneDelegate { NRStatAPI.nr_requestStatOnLine() } - + @objc private func networkStatusDidChangeNotification() { + guard NRNetworkReachableManager.manager.isReachable == true else { return } + handleOnLine() + self.retryHandleOpenAppMessage() + } } diff --git a/ReaderHive/Source/Assets.xcassets/Image/login_button.imageset/Contents.json b/ReaderHive/Source/Assets.xcassets/Image/login_button.imageset/Contents.json deleted file mode 100644 index ad8c567..0000000 --- a/ReaderHive/Source/Assets.xcassets/Image/login_button.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "登录@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "登录@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ReaderHive/Source/Assets.xcassets/Image/login_button.imageset/登录@2x.png b/ReaderHive/Source/Assets.xcassets/Image/login_button.imageset/登录@2x.png deleted file mode 100644 index 396cd8e..0000000 Binary files a/ReaderHive/Source/Assets.xcassets/Image/login_button.imageset/登录@2x.png and /dev/null differ diff --git a/ReaderHive/Source/Assets.xcassets/Image/login_button.imageset/登录@3x.png b/ReaderHive/Source/Assets.xcassets/Image/login_button.imageset/登录@3x.png deleted file mode 100644 index 8163144..0000000 Binary files a/ReaderHive/Source/Assets.xcassets/Image/login_button.imageset/登录@3x.png and /dev/null differ diff --git a/ReaderHive/Source/en.lproj/Localizable.strings b/ReaderHive/Source/en.lproj/Localizable.strings index d8b420f..3e027a8 100644 --- a/ReaderHive/Source/en.lproj/Localizable.strings +++ b/ReaderHive/Source/en.lproj/Localizable.strings @@ -152,6 +152,7 @@ "Claim Now" = "Claim Now"; "Later" = "Later"; "Default" = "Default"; +"Log in" = "Log in"; "retain_alert_text" = "Unlock every show you love!"; "logout_alert_text" = "Are you sure you want to log out?";