// // PhotoBrowserControllerEvent.swift // Crush // // Created by Leon on 2025/9/23. // extension PhotoBrowserController{ func reloadStatesByModel(model:PhotoBrowserModel?){ guard let browserModel = model else{return} if type == .roleMine{ let unlockPrice = browserModel.aiAlbum.unlockPrice if let lockStatus = browserModel.aiAlbum.lockStatus{ titleLockIcon.isHidden = lockStatus == .unlock }else{ titleLockIcon.isHidden = true } setDefaultEntry.isHidden = false let isDefault = browserModel.aiAlbum.isDefault.boolValue setDefaultEntry.setupIsDefault(isDefault) rolePhotoUnlockEntry.setupCoinUnlock(coin: unlockPrice) if isDefault{ rolePhotoUnlockEntry.isHidden = true }else{ rolePhotoUnlockEntry.isHidden = false } }else if type == .chatBackgroundSet{ guard let background = browserModel.chatBackground else{return} if background.isDefault.boolValue{ // 隐藏导航栏more 删除 moreButton?.isHidden = true }else{ moreButton?.isHidden = false } setDefaultEntry.isHidden = background.isSelected.boolValue setBackgroundDisableButton.isHidden = !background.isSelected.boolValue }else if type == .roleOthersInAlbum{ guard let album = browserModel.aiAlbum else{return} getCurrentZoomView(byModel: browserModel)?.scrollView.isScrollEnabled = true if let lockStatus = album.lockStatus, lockStatus == .locked{ // 🚩分支: 已上锁 roleOthersContainer?.isHidden = false bottomCommonOperateContainer?.isHidden = true likeView?.isHidden = true titleunlockedIcon.isHidden = true getCurrentZoomView(byModel: browserModel)?.scrollView.isScrollEnabled = false let price = browserModel.aiAlbum.unlockPrice let attributeString = StyleButton.getUnlockAttributeTitleByCoin(coin: price, string: "unlock") iconUnlockButton?.setAttributedTitle(attributeString, for: .normal) }else{ // 🚩分支: 可看的图片 roleOthersContainer?.isHidden = true bottomCommonOperateContainer?.isHidden = false likeView?.isHidden = false if album.lockStatus == .unlock{ // 🔓上锁的图片已解锁, 导航栏解锁标志显示 titleunlockedIcon.isHidden = false }else{ // 普通图片 titleunlockedIcon.isHidden = true } likeView?.bind(aiAlbum: album) } } else if type == .roleOthersInIm{ guard let model = browserModel.sessionModel else{ return } bottomGradientContainer.isHidden = true let price = model.baseRemoteInfo?.customAttachment?.unlockPrice ?? 0 if price > 0{ roleOthersContainer?.isHidden = false let attributeString = StyleButton.getUnlockAttributeTitleByCoin(coin: price, string: "unlock") iconUnlockButton?.setAttributedTitle(attributeString, for: .normal) }else{ roleOthersContainer?.isHidden = true } } } }