5 Commits

Author SHA1 Message Date
eggmanQQQ
5055bf244d 优化登录页逻辑 2024-07-18 11:18:00 +08:00
eggmanQQQ
0855b81097 移除被注释的 debug 代码 2024-07-18 10:50:15 +08:00
eggmanQQQ
157b67e5e0 1. 优化首页语言的播放效果
2. 优化首页收藏行为后,收藏列表的更新效果
3. 修复充值时的 crash
2024-07-17 15:38:37 +08:00
eggmanQQQ
5e097ba6f9 1. 修正登录页 UI 布局和文案
2. 调整首页 tab 关注逻辑
2024-07-17 12:19:18 +08:00
liyuhua
7109bdbd11 音萌商店包版本修改 此commit置顶 1.0.7 2024-04-28 16:30:33 +08:00
14 changed files with 320 additions and 205 deletions

15
Podfile
View File

@@ -11,7 +11,7 @@ target 'yinmeng-ios' do
pod 'MBProgressHUD'
pod 'SVGAPlayer'
pod 'YYText'
pod 'YYWebImage', '~> 1.0.5'
pod 'YYWebImage'
#下拉刷新控件
pod 'MJRefresh'
# 滑动标签栏
@@ -22,26 +22,27 @@ target 'yinmeng-ios' do
#cell
pod 'Reusable'
#约束
pod 'SnapKit', '~> 5.6.0'
pod 'SnapKit'
#获取设备信息
pod 'DeviceKit', '~> 4.0'
pod 'DeviceKit'
pod 'Nuke'
pod "NSObject+Rx"
pod 'Qiniu'
#文字自动滚动
pod 'MarqueeLabel'
pod 'NIMSDK_LITE', '9.6.1'
pod 'NIMSDK_LITE'
pod 'TZImagePickerController'
pod 'LookinServer', :configurations => ['Debug']
#pop动画
pod 'pop', '~> 1.0.12'
pod 'pop'
pod 'FFPopup'
pod 'TXLiteAVSDK_TRTC', '~> 11.4.14530'
pod 'TXLiteAVSDK_TRTC'
pod 'MJExtension'
pod 'QGVAPlayer'
#声网
pod 'AgoraRtcEngine_iOS', '~> 4.2.2'
pod 'AgoraRtcEngine_iOS'
# Pods for yinmeng-ios
end

View File

@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
23116B0A2BDB8CA100F7F97A /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 23116B072BDB812600F7F97A /* PrivacyInfo.xcprivacy */; };
2311D69D2B8DC311001C70AB /* PlanetStarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2311D69C2B8DC311001C70AB /* PlanetStarModel.swift */; };
2311D6A12B8DD649001C70AB /* StarIcon.svga in Resources */ = {isa = PBXBuildFile; fileRef = 2311D6A02B8DD649001C70AB /* StarIcon.svga */; };
2311D6A52B8F0E06001C70AB /* StarGift.svga in Resources */ = {isa = PBXBuildFile; fileRef = 2311D6A42B8F0E06001C70AB /* StarGift.svga */; };
@@ -192,6 +193,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
23116B072BDB812600F7F97A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
2311D69C2B8DC311001C70AB /* PlanetStarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlanetStarModel.swift; sourceTree = "<group>"; };
2311D6A02B8DD649001C70AB /* StarIcon.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = StarIcon.svga; sourceTree = "<group>"; };
2311D6A42B8F0E06001C70AB /* StarGift.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = StarGift.svga; sourceTree = "<group>"; };
@@ -247,7 +249,6 @@
23630BCE2BADA7D9003AD25D /* SendGiftSendNumView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendGiftSendNumView.swift; sourceTree = "<group>"; };
23630BD02BADA900003AD25D /* SendGiftSendNumCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendGiftSendNumCell.swift; sourceTree = "<group>"; };
23630BD22BADA9FF003AD25D /* SendGiftSendNumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendGiftSendNumModel.swift; sourceTree = "<group>"; };
2368ECE02BC521B200EDF4C9 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
238F418C2BBAB08A008564B8 /* YinUserInfoHeadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YinUserInfoHeadView.swift; sourceTree = "<group>"; };
238F418E2BBAC7BF008564B8 /* YinUserInfoHeadItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YinUserInfoHeadItemView.swift; sourceTree = "<group>"; };
238F41932BBBDCBE008564B8 /* YinUserInfoMoreCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YinUserInfoMoreCell.swift; sourceTree = "<group>"; };
@@ -1198,7 +1199,6 @@
E884E85E2B6900C500ADE6EE /* AppDelegate.swift */,
E884E8642B6900C500ADE6EE /* Main.storyboard */,
2311D6DC2B9204EF001C70AB /* logoBg.png */,
2368ECE02BC521B200EDF4C9 /* PrivacyInfo.xcprivacy */,
2311D6D82B920442001C70AB /* yinLogo.png */,
2311D6DA2B920478001C70AB /* textLogo.png */,
23EE96F92BA1A3A200475D69 /* YinSpeak.svga */,
@@ -1209,6 +1209,7 @@
E884E8672B6900C600ADE6EE /* Assets.xcassets */,
E884E8692B6900C600ADE6EE /* LaunchScreen.storyboard */,
E884E86C2B6900C600ADE6EE /* Info.plist */,
23116B072BDB812600F7F97A /* PrivacyInfo.xcprivacy */,
);
path = "yinmeng-ios";
sourceTree = "<group>";
@@ -1381,6 +1382,7 @@
E884E8582B6900C500ADE6EE /* Frameworks */,
E884E8592B6900C500ADE6EE /* Resources */,
0486212FDC8E85876369464E /* [CP] Embed Pods Frameworks */,
342A0E7CD92CA856FA58E3A4 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@@ -1430,6 +1432,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
23116B0A2BDB8CA100F7F97A /* PrivacyInfo.xcprivacy in Resources */,
23EE96FA2BA1A3A300475D69 /* YinSpeak.svga in Resources */,
2311D6D92B920442001C70AB /* yinLogo.png in Resources */,
E884E86B2B6900C600ADE6EE /* LaunchScreen.storyboard in Resources */,
@@ -1464,6 +1467,23 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
342A0E7CD92CA856FA58E3A4 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios-resources.sh\"\n";
showEnvVarsInLog = 0;
};
65A9458CEC329A8AC9C7F88D /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -1815,7 +1835,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "yinmeng-ios/yinmeng-ios.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 48UCG35Q9W;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
@@ -1837,7 +1857,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = "linyudan.yinmeng-ios";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -1859,7 +1879,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "yinmeng-ios/yinmeng-ios.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 48UCG35Q9W;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
@@ -1881,7 +1901,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = "linyudan.yinmeng-ios";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E884E85A2B6900C500ADE6EE"
BuildableName = "yinmeng-ios.app"
BlueprintName = "yinmeng-ios"
ReferencedContainer = "container:yinmeng-ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E884E85A2B6900C500ADE6EE"
BuildableName = "yinmeng-ios.app"
BlueprintName = "yinmeng-ios"
ReferencedContainer = "container:yinmeng-ios.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E884E85A2B6900C500ADE6EE"
BuildableName = "yinmeng-ios.app"
BlueprintName = "yinmeng-ios"
ReferencedContainer = "container:yinmeng-ios.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "265D86DA-810F-46B5-8843-7CF61C036487"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
uuid = "B72A7630-2547-456B-951B-4C7FD280A268"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
breakpointStackSelectionBehavior = "1"
scope = "1"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "A13339C1-73DD-4996-91B1-602150B243F2"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "yinmeng-ios/Modules/Chat/VM/ChatViewModel.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "329"
endingLineNumber = "329"
landmarkName = "onRecvMessages(_:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@@ -11,59 +11,76 @@ import NSObject_Rx
import NIMSDK
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
UIApplication.shared.applicationIconBadgeNumber = 0
self.window = UIWindow.init(frame: UIScreen.main.bounds)
self.window?.backgroundColor = UIColor.white
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
loadNIMSDK()
loginStateListener()
showLoginPage()
loadNIMSDK()
loginStateListener()
return true
}
private func loginStateListener() {
AuthViewModel.authVM.appClientConfig()
///
AuthViewModel.authVM.checkUserIsLogin()
AuthViewModel.authVM.loginSuccess.subscribe(onNext: { result in
print("是否登录成功\(result)")
AuthViewModel.authVM.loginSuccess.subscribe(onNext: { [weak self] result in
guard let strongSelf = self else { return }
if result == true {
///tabbar
self.window?.rootViewController = BaseTabBarViewController()
let uid = AuthManager.userUid
if uid > 0 {
UserViewModel.userVM.getUserInfo(uid: uid)
}
strongSelf.showTabbar()
// MARK: 使
if NIMSDK.shared().loginManager.isLogined() == false {
if let uid = LoginTokenConfig.config.getAccountInfo()?.uid, let token = LoginTokenConfig.config.getAccountInfo()?.netEaseToken {
if let uid = LoginTokenConfig.config.getAccountInfo()?.uid,
let token = LoginTokenConfig.config.getAccountInfo()?.netEaseToken {
NIMSDK.shared().loginManager.login("\(uid)", token: token) { error in
print("aaa")
guard let error else {
// strongSelf.showTabbar()
return
}
print("login error: \(String(describing: error))")
// strongSelf.showLoginPage()
}
} else {
///
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
// strongSelf.showLoginPage()
}
}
} else {
// strongSelf.showTabbar()
}
} else {
///
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
strongSelf.showLoginPage()
}
}).disposed(by: rx.disposeBag)
UserViewModel.userVM.selfInfo.subscribe(onNext: { result in
UserViewModel.userVM.selfInfo.subscribe(onNext: { [weak self] result in
guard let strongSelf = self else { return }
if result.nick?.count ?? 0 <= 0 || result.avatar?.count ?? 0 <= 0 {
let fillVC = AuthFillDataVC()
fillVC.modalPresentationStyle = .fullScreen
self.window?.rootViewController = fillVC
strongSelf.window?.rootViewController = fillVC
}
}).disposed(by: rx.disposeBag)
}
private func showLoginPage() {
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
}
private func showTabbar() {
///tabbar
self.window?.rootViewController = BaseTabBarViewController()
}
private func loadNIMSDK() {
let opt = NIMSDKOption(appKey: AppKeys.nimAppid)
opt.apnsCername = "yinmeng_anps"

View File

@@ -80,8 +80,6 @@ class AuthLaunchVC: BaseViewController, HiddenNavigationBarProtocol {
make.bottom.equalTo(stackView.snp.top).offset(-56)
}
//
appleView.snp.makeConstraints { make in
make.width.equalTo(47)
make.height.equalTo(70)
@@ -135,7 +133,7 @@ class AuthLaunchVC: BaseViewController, HiddenNavigationBarProtocol {
private lazy var phoneLoginBtn: UIButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage.gradient([ThemeColor(hexStr: "#FF60FD"), ThemeColor(hexStr: "#8974FF"), ThemeColor(hexStr: "#69EBFF")], radius: 0), for: .normal)
button.setTitle("手机号登录", for: .normal)
button.setTitle("手机号或账号登录", for: .normal)
button.setTitleColor(UIColor.white, for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
button.layer.masksToBounds = true

View File

@@ -113,6 +113,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
phonetextFiled.snp.makeConstraints { make in
make.top.bottom.equalTo(phoneNumView)
make.left.equalTo(phoneNumView).offset(82)
make.right.equalTo(phoneNumView)
}
codeView.snp.makeConstraints { make in
@@ -123,7 +124,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
codetextFiled.snp.makeConstraints { make in
make.left.equalTo(codeView).offset(20)
make.top.bottom.equalTo(codeView)
make.right.equalTo(codeView)
}
sepView.snp.makeConstraints { make in
@@ -150,7 +151,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
idTextFiled.snp.makeConstraints { make in
make.left.equalTo(idView).offset(20)
make.top.bottom.equalTo(idView)
make.top.bottom.right.equalTo(idView)
}
pwdView.snp.makeConstraints { make in
@@ -161,7 +162,7 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
pwdTextFiled.snp.makeConstraints { make in
make.left.equalTo(pwdView).offset(20)
make.top.bottom.equalTo(pwdView)
make.top.bottom.right.equalTo(pwdView)
}
forgetBtn.snp.makeConstraints { make in
@@ -175,8 +176,6 @@ class AuthLoginVC: BaseViewController, HiddenNavigationBarProtocol {
make.height.equalTo(52)
make.top.equalTo(phoneView.snp.bottom).offset(44)
}
}

View File

@@ -20,28 +20,34 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
requestData()
requsetFansListData()
requestFansListData()
}
override func viewDidLoad() {
super.viewDidLoad()
setUILayout()
requestData()
requsetFansListData()
setUILayout()
requestData()
requestFansListData()
displayGuide()
userInfoBtn.addTarget(self, action: #selector(userInfoBtnAction), for: .touchUpInside)
}
func displayGuide() {
if (UserDefaults.standard.value(forKey:"kIsShowGuide") != nil){return}
UserDefaults.standard.setValue("yes", forKey: "kIsShowGuide")
let guideVeiw = HomeVoiceGuideView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight))
keyWindow.addSubview(guideVeiw)
}
@objc func userInfoBtnAction(){
let userInfoView:HomeVoiceUserInfoView = HomeVoiceUserInfoView.init(frame: .zero)
userInfoView.clickBtnBlock = {[weak self] (type,uid) in
guard let weakSelf = self else {
guard let self = self else {
return
}
if type == 3{
let vc = UserPayViewController()
weakSelf.navigationController?.pushViewController(vc, animated: true)
self.navigationController?.pushViewController(vc, animated: true)
return
}
}
@@ -53,10 +59,12 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
}
}
func requsetFansListData(){
func requestFansListData(){
let uid = "\(AuthManager.userUid)"
RequestGet(path: "fans/following", parma: ["uid":uid,"pageNo":"1","pageSize":"50"]) { data in
RequestGet(path: "fans/following", parma: ["uid":uid,"pageNo":"1","pageSize":"50"]) { [weak self] data in
guard let self else {
return
}
if let list = Deserialized<HomeVoiceModel>.toArray(with: data) {
self.followView.modelList = list
}
@@ -65,9 +73,9 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
}
}
func setUILayout(){
view.addSubview(backgroundView)
view.addSubview(scrollView)
scrollView.addSubview(topLogoIcon)
scrollView.addSubview(searchView)
scrollView.addSubview(chooseItemVeiw)
@@ -77,10 +85,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
scrollView.addSubview(publishView)
scrollView.addSubview(bgPlayMusicView)
backgroundView.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}
@@ -131,6 +135,7 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
make.width.equalTo(ScreenWidth-28)
make.height.equalTo(144)
}
publishView.superview?.layoutIfNeeded()
scrollView.contentSize = CGSize(width: ScreenWidth, height: publishView.frame.origin.y + publishView.frame.size.height)
let margin:CGFloat = (ScreenWidth - 90 * 3 - 28)/4
@@ -151,10 +156,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
let x = ScreenWidth - 28 - 44 - 3
followView.frame = CGRect(x:x , y: 3, width: 44, height: 418)
chooseTypeView.chooseTypeBlock = {[weak self] type in
guard let weakSelf = self else {
return
@@ -181,10 +182,18 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
}
let userInfoView:HomeVoiceUserInfoView = HomeVoiceUserInfoView.init(frame: .zero)
userInfoView.clickBtnBlock = {[weak self] (type,uid) in
guard let self else {
return
}
let session = NIMSession(uid, type: .P2P)
let chatVC = ChatVC.init(session: session)
self?.navigationController?.pushViewController(chatVC, animated: true)
self.navigationController?.pushViewController(chatVC, animated: true)
}
userInfoView.followActionBlock = { [weak self] (isFollow, value) in
guard let self else {
return
}
self.requestFansListData()
}
userInfoView.model = model
userInfoView.type = 0
@@ -211,7 +220,7 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
navigationController?.present(searchVC, animated: true, completion: nil)
}
@objc func clickLongTapAction(sender:UIPanGestureRecognizer){
let i = (sender.view?.tag ?? 100) - 100
_ = (sender.view?.tag ?? 100) - 100
if sender.state == .began{
location = sender.view?.center
}else if sender.state == .changed{
@@ -223,7 +232,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
sender.view?.center = CGPoint(x: x, y: y)
sender.setTranslation(.zero, in: self.view)
}else{
guard let centerPoint = sender.view?.center else{return}
let point = CGPoint(x: centerPoint.x + 14, y: centerPoint.y+136)
@@ -239,7 +247,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
if let location = self.location{
sender.view?.center = location
}
}
}
@@ -255,31 +262,38 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
let chatVC = ChatVC.init(session: session)
self?.navigationController?.pushViewController(chatVC, animated: true)
}
userInfoView.followActionBlock = { [weak self] (isFollow, value) in
guard let self else {
return
}
self.requestFansListData()
}
userInfoView.type = 0
userInfoView.model = view.model
self.view.addSubview(userInfoView)
userInfoView.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}
}
@objc func changeItemAction(){
requestData()
makeRotationAnim(view: changeItemView.leftIconView)
}
func makeRotationAnim(view: UIView) {
// 1.
let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
// 2.
rotationAnim.fromValue = 0 //
rotationAnim.toValue = Double.pi * 2 //
rotationAnim.repeatCount = 2 //
rotationAnim.duration = 0.5
rotationAnim.autoreverses = false // ,NO
rotationAnim.isRemovedOnCompletion = true //truefalse
view.layer.add(rotationAnim, forKey: nil) // view
}
func makeRotationAnim(view: UIView) {
// 1.
let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
// 2.
rotationAnim.fromValue = 0 //
rotationAnim.toValue = Double.pi * 2 //
rotationAnim.repeatCount = 2 //
rotationAnim.duration = 0.5
rotationAnim.autoreverses = false // ,NO
rotationAnim.isRemovedOnCompletion = true //truefalse
view.layer.add(rotationAnim, forKey: nil) // view
}
func requestData(){
RequestGet(path: "voiceShow/listRandom", parma: ["gender":gender]) { data in
guard let dic = data as? [String : Any]else {
@@ -296,7 +310,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
let view:HomeVoicePlayMusicItemView = self.itemViewList[i]
let model = list[i]
view.model = model
}
}
}
@@ -308,8 +321,8 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
@objc func chooseItemAction(){
chooseItemVeiw.isChoose = !chooseItemVeiw.isChoose
chooseTypeView.isHidden = !chooseItemVeiw.isChoose
}
var gender = ""
private lazy var backgroundView:UIImageView = {
let _backgroundView = UIImageView()
@@ -347,8 +360,6 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
let _userInfoBtn = UIButton()
_userInfoBtn.setBackgroundImage(UIImage(named: "yin_home_voice_user_info_bg"), for: .normal)
_userInfoBtn.setImage(UIImage(named: "yin_home_voice_user_info_icon"), for: .normal)
return _userInfoBtn
}()
var chooseTypeView:HomeVoiceChooseTypeView = {

View File

@@ -10,14 +10,24 @@ import Nuke
typealias ClickPublishBlock = ()->Void
typealias PlayVoiceEndBlock = ()->Void
class HomeVoicePublishView: UIView {
var clickPublishBlock:ClickPublishBlock?
var playVoiceEndBlock:PlayVoiceEndBlock?
var currentAngle: CGFloat = 0.0
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
loadSVGA()
let tap = UITapGestureRecognizer(target: self, action: #selector(publishViewAction))
publishView.addGestureRecognizer(tap)
}
func setUILayout(){
addSubview(backgroundView)
addSubview(discView)
@@ -56,42 +66,69 @@ class HomeVoicePublishView: UIView {
make.height.equalTo(52)
make.right.equalTo(-20)
}
}
func loadSVGA() {
discParser.parse(withNamed: "RecordPlayer", in: Bundle.main) {[weak self] videoItem in
self?.discView.videoItem = videoItem
self?.discView.loops = 100000;
self?.discView.clearsAfterStop = false
guard let self else {
return
}
self.discView.videoItem = videoItem
self.discView.loops = 100000;
self.discView.clearsAfterStop = false
} failureBlock: { error in
}
publishParser.parse(withNamed: "PublishVoice", in: Bundle.main) {[weak self] videoItem in
self?.publishView.videoItem = videoItem
self?.publishView.loops = 100000;
self?.publishView.startAnimation()
guard let self else {
return
}
self.publishView.videoItem = videoItem
self.publishView.loops = 100000;
self.publishView.startAnimation()
} failureBlock: { error in
}
let tap = UITapGestureRecognizer(target: self, action: #selector(publishViewAction))
publishView.addGestureRecognizer(tap)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc func publishViewAction(){
guard let _clickPublishBlock = self.clickPublishBlock else {
return
}
_clickPublishBlock()
if playBtn.isSelected{
if playBtn.isSelected {
discView.stopAnimation()
playBtn.isSelected = false
PlayVoiceManager.shared.stopPlayVoice()
}
}
func playAvatarAnimation() {
let rotation = CABasicAnimation(keyPath: "transform.rotation")
rotation.fromValue = currentAngle
rotation.toValue = currentAngle + Double.pi * 2
rotation.duration = 4
rotation.repeatCount = Float.infinity
avatarView.layer.add(rotation, forKey: "rotationAnimation")
}
func stopAvatarAnimation() {
if let presentationLayer = avatarView.layer.presentation() {
let currentTransform = presentationLayer.transform
//
avatarView.layer.removeAnimation(forKey: "rotationAnimation")
//
avatarView.layer.transform = currentTransform
currentAngle = atan2(currentTransform.m12, currentTransform.m11)
} else {
avatarView.layer.removeAnimation(forKey: "rotationAnimation")
}
}
@objc func playBtnAction(){
guard let _model = self.model else {
HUDTool.show(with: "把头像拖至唱片机才可播放")
@@ -101,9 +138,11 @@ class HomeVoicePublishView: UIView {
if (self.playBtn.isSelected){
discView.startAnimation()
PlayVoiceManager.shared.downloadVoice(url: _model.userVoice)
playAvatarAnimation()
return
}
discView.stopAnimation()
stopAvatarAnimation()
PlayVoiceManager.shared.stopPlayVoice()
}
@@ -111,6 +150,7 @@ class HomeVoicePublishView: UIView {
avatarView.image = nil
model = nil
discView.stopAnimation()
stopAvatarAnimation()
PlayVoiceManager.shared.stopPlayVoice()
}
@@ -173,6 +213,7 @@ class HomeVoicePublishView: UIView {
}
Nuke.loadImage(with: _model.avatar, into:avatarView)
discView.startAnimation()
playAvatarAnimation()
PlayVoiceManager.shared.downloadVoice(url: _model.userVoice)
playBtn.isSelected = true
}

View File

@@ -10,10 +10,12 @@ import Nuke
typealias ClickBtnBlock = (_ type: Int ,_ uid:String)->Void
typealias FollowBlockType = (_ isFollow: Bool, _ value: Int) -> Void
class HomeVoiceUserInfoView: UIView {
var clickBtnBlock:ClickBtnBlock?
var followActionBlock: FollowBlockType?
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
@@ -151,7 +153,6 @@ class HomeVoiceUserInfoView: UIView {
if let _clickBtnBlock = clickBtnBlock,let uid = self.model?.uid{
_clickBtnBlock(3,"\(uid)")
}
return
}
self.attentionBtn.isSelected = !self.attentionBtn.isSelected
@@ -160,14 +161,20 @@ class HomeVoiceUserInfoView: UIView {
guard let getUid = uid else{return}
let params = ["uid":"\(AuthManager.userUid)","ticket":AuthManager.ticket,"type":type,"likedUid":"\(getUid)"] as [String : Any]
RequestPost(path: "fans/like", parma: params) { data in
RequestPost(path: "fans/like", parma: params) { [weak self] data in
guard let self else { return }
if let _followAction = followActionBlock {
_followAction(self.attentionBtn.isSelected, 1)
}
if(self.attentionBtn.isSelected){
HUDTool.show(with: "关注成功")
}else{
HUDTool.show(with: "取消关注成功")
}
} fail: { code, data in
self.attentionBtn.isSelected = !self.attentionBtn.isSelected
HUDTool.show(with: data)
}
}
@objc func chatBtnAction(){

View File

@@ -19,8 +19,10 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
}
func requestData(){
RequestGet(path: "chargeprod/list", parma: ["channelType":"8"]) { data in
RequestGet(path: "chargeprod/list", parma: ["channelType":"8"]) { [weak self] data in
guard let self else {
return
}
if let list = Deserialized<UserPayViewModel>.toArray(with: data) {
for (i,view) in self.viewList.enumerated() {
if i < list.count{
@@ -31,15 +33,15 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
}else{
view.isHidden = true
}
}
}
} fail: { code, data in
print(code)
}
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { data in
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { [weak self] data in
guard let self else {
return
}
if let model = Deserialized<UserPayViewModel>.toModel(with: data) {
self.pricView.text = model.diamonds
}
@@ -160,6 +162,7 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
let y = publishBtn.y + publishBtn.frame.height
self.scrollView.contentSize = CGSize(width: ScreenWidth, height: y)
}
@objc func publishBtnAction(){
guard let chargeProdId = self.chooseModel?.chargeProdId else{
return
@@ -169,65 +172,65 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
let ticket = AuthManager.ticket
let deviceInfo = UIDevice.current.identifierForVendor?.uuidString ?? ""
let clientIp = "0.0.0.0"
RequestPost(path: "storeKitV2/placeOrder", parma: ["chargeProdId":chargeProdId,"uid":uid,"ticket":ticket,"deviceInfo":deviceInfo]) { data in
RequestPost(path: "storeKitV2/placeOrder", parma: ["chargeProdId":chargeProdId,"uid":uid,"ticket":ticket,"deviceInfo":deviceInfo]) { [weak self] data in
guard let self else {
return
}
if let _data = data as? [String:Any],let recordId = _data["recordId"] as? String,let appAccountToken = _data["appAccountToken"] as? String{
self.initiatePaymentAction(recordId: recordId, appAccountToken: appAccountToken)
}else{
HUDTool.show(with: "购买失败")
MBProgressHUD.hide(for: keyWindow, animated: true)
}
} fail: { code, data in
HUDTool.show(with: data)
MBProgressHUD.hide(for: keyWindow, animated: true)
}
}
deinit{
NotificationCenter.default.removeObserver(self)
}
func initiatePaymentAction(recordId:String,appAccountToken:String) {
self.orderId = recordId
if #available(iOS 15.0, *) {
UserPayViewManager.shared._ConditionBlock = {[weak self] (state , result) in
if state == .Pay || state == .Start || state == .VerifiedServer{
ScreenWidth
}else if state == .Unowned{
HUDTool.show(with: "出现未知错误,请重新尝试")
MBProgressHUD.hide(for: keyWindow , animated: true)
}else{
HUDTool.show(with: "购买失败")
MBProgressHUD.hide(for: keyWindow, animated: true)
guard let self else {
return
}
if state == .VerifiedServer{
if let data = result,let transactionId = data["transactionId"]{
self?.paySuccess(transactionId:"\(transactionId)")
DispatchQueue.main.async {
if state == .Pay || state == .Start || state == .VerifiedServer{
// ScreenWidth
}else if state == .Unowned{
HUDTool.show(with: "出现未知错误,请重新尝试")
MBProgressHUD.hide(for: keyWindow , animated: true)
}else{
HUDTool.show(with: "购买失败")
MBProgressHUD.hide(for: keyWindow, animated: true)
}
if state == .VerifiedServer{
if let data = result,let transactionId = data["transactionId"]{
self.paySuccess(transactionId:"\(transactionId)")
}else{
HUDTool.show(with: "购买失败")
MBProgressHUD.hide(for: keyWindow, animated: true)
}
}
}
}
Task {
do {
try await UserPayViewManager.shared._demandCommodityThing(productId: self.chooseModel?.chargeProdId ?? "", uuid: appAccountToken)
}catch{
}
}
} else {
HUDTool.show(with: "充值失败。当前仅支持运行iOS15及以上系统的手机进行充值请升级系统版本后重试。")
}
}
func paySuccess(transactionId:String){
let uid = "\(AuthManager.userUid)"
let ticket = AuthManager.ticket
@@ -236,33 +239,28 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
if #available(iOS 15.0, *) {
Task {
try await UserPayViewManager.shared._verifyBusinessAccomplish(transaction: transactionId)
await UserPayViewManager.shared._verifyBusinessAccomplish(transaction: transactionId)
self.orderId = ""
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { data in
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { [weak self] data in
guard let self else {
return
}
if let model = Deserialized<UserPayViewModel>.toModel(with: data) {
self.pricView.text = model.diamonds
}
} fail: { code, data in
print(code)
}
}
}
} fail: { code, data in
if code == 1444{
Task {
if #available(iOS 15.0, *) {
try await UserPayViewManager.shared._verifyBusinessAccomplish(transaction: transactionId)
await UserPayViewManager.shared._verifyBusinessAccomplish(transaction: transactionId)
} else {
// Fallback on earlier versions
}
}
}
HUDTool.show(with: data)

View File

@@ -15,28 +15,20 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
super.viewDidLoad()
yin_initUI()
requestData()
}
func requestData(){
RequestGet(path: "home/recommendUsers", parma: ["pageNum":"\(self.page)","pageSize":"60"]) { data in
if let list = Deserialized<PlanetStarModel>.toArray(with: data) {
var dataList:[PlanetStarModel] = []
guard list.isEmpty else {
for i in 0..<12 {
if i < list.count{
dataList.append(list[i])
}
}
self.dataArray = dataList
self.dealWithViewData()
return
}
self.page = 1
@@ -52,19 +44,13 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
} fail: { code, data in
}
}
func dealWithViewData(){
self.bgRadiusView.dataList = dataArray
}
private func yin_initUI(){
view.addSubview(backgroundView)
view.addSubview(bgRadiusView)
bgRadiusView.frame = self.view.frame
@@ -74,7 +60,6 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
make.edges.equalTo(self.view)
}
bgRadiusView.refreshBlcok = {[weak self] (uid,type,name) in
if type == 0{
self?.page = (self?.page ?? 1) + 1
@@ -123,6 +108,7 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
}
return
}
let popUpView = PlanetStarPopUpView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight))
self?.view.addSubview(popUpView)
popUpView.textView.text = text
@@ -159,14 +145,10 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
}
}
}
}
}
}
func showPayVC(){
let popUpView = PlanetStarPopUpView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight))
self.view.addSubview(popUpView)
@@ -178,8 +160,8 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
let vc = UserPayViewController()
self?.navigationController?.pushViewController(vc, animated: true)
}
}
let activityView:UIActivityIndicatorView = UIActivityIndicatorView(style: .medium)
var giftModel:PlanetStarModel?
private lazy var backgroundView:UIImageView = {
@@ -188,6 +170,7 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
_backgroundView.isUserInteractionEnabled = true
return _backgroundView
}()
private var bgRadiusView:PlanetStarClickItemView = {
let _bgRadiusView = PlanetStarClickItemView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth , height: ScreenHeight))
@@ -196,8 +179,6 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
}()
private var dataArray:[PlanetStarModel] = []
}

View File

@@ -397,7 +397,7 @@ class YinUserInfoHeadView: UIView{
}()
private lazy var arrowView:UIButton = {
let _arrowView = UIButton.getCustomBtn(image: UIImage(named: "yin_mine_header_arrow"))
_arrowView.isHidden = true
return _arrowView
}()