Commit c71c6e1a by pierce

fixed bugs

parent 7c8d210f
Showing with 358 additions and 1072 deletions
......@@ -53,10 +53,13 @@
+ (nullable NSArray<UIImage *> *)animatedImageArrayNamed:(NSString * __nonnull)name {
NSMutableArray *images = [NSMutableArray array];
NSBundle *bundle = [self.class bundle];
for (NSInteger i = 0; i < 100; i++) {
UIImage *image = [self imageWithContentFile:[NSString stringWithFormat:@"%@%zd",name,i] inBundle:[self.class bundle]];
UIImage *image = [self imageWithContentFile:[NSString stringWithFormat:@"%@%zd",name,i] inBundle:bundle];
if (image) {
[images addObject:image];
} else if (i != 0) {
break;
}
}
return images;
......@@ -64,8 +67,9 @@
+ (nullable UIImage *)animatedImageWithContentFile:(NSString *)name count:(NSInteger)count duration:(NSTimeInterval)duration {
NSMutableArray *images = [NSMutableArray array];
NSBundle *bundle = [self.class bundle];
for (NSInteger i = 0; i < count; i++) {
UIImage *image = [self imageWithContentFile:[NSString stringWithFormat:@"%@%zd",name,i] inBundle:[self.class bundle]];
UIImage *image = [self imageWithContentFile:[NSString stringWithFormat:@"%@%zd",name,i] inBundle:bundle];
if (image) {
[images addObject:image];
}
......
......@@ -461,7 +461,8 @@ public struct UserModel : Convertable {
public enum GDUserCenterAction {
case login(uuid: String, pwd: String, phone: String, uid: String, token: String)
case setUserInfo(username: String? = nil,
case setUserInfo(uid: String?,
username: String? = nil,
avatar: String? = nil,
phone: String? = nil,
activebonds: String? = nil,
......
......@@ -13,6 +13,7 @@
BE05B41C2BF38DB300FB71E4 /* GDResourcePropModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B4192BF38DB300FB71E4 /* GDResourcePropModel.swift */; };
BE05B4232BF393B700FB71E4 /* GDLevelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B41F2BF393B300FB71E4 /* GDLevelModel.swift */; };
BE05B4242BF393B700FB71E4 /* GDMotorDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B4202BF393B700FB71E4 /* GDMotorDataModel.swift */; };
BE4CFBDE2BFF5BB90043389D /* GDDataManagerBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE4CFBDD2BFF5BB90043389D /* GDDataManagerBundle.swift */; };
BE6F41F12B46CC6E0058C826 /* GDChatGiftModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6F41EF2B46CC6E0058C826 /* GDChatGiftModel.swift */; };
BE6F41F22B46CC6E0058C826 /* GDResourceCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6F41F02B46CC6E0058C826 /* GDResourceCenter.swift */; };
BE6F41FC2B47B70A0058C826 /* GDDataManagerModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6F41FA2B47B70A0058C826 /* GDDataManagerModule.swift */; };
......@@ -309,6 +310,7 @@
BE05B4192BF38DB300FB71E4 /* GDResourcePropModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDResourcePropModel.swift; sourceTree = "<group>"; };
BE05B41F2BF393B300FB71E4 /* GDLevelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLevelModel.swift; sourceTree = "<group>"; };
BE05B4202BF393B700FB71E4 /* GDMotorDataModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDMotorDataModel.swift; sourceTree = "<group>"; };
BE4CFBDD2BFF5BB90043389D /* GDDataManagerBundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDDataManagerBundle.swift; sourceTree = "<group>"; };
BE6F41EF2B46CC6E0058C826 /* GDChatGiftModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDChatGiftModel.swift; sourceTree = "<group>"; };
BE6F41F02B46CC6E0058C826 /* GDResourceCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDResourceCenter.swift; sourceTree = "<group>"; };
BE6F41FA2B47B70A0058C826 /* GDDataManagerModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDDataManagerModule.swift; sourceTree = "<group>"; };
......@@ -679,6 +681,7 @@
BE6F41F92B47B70A0058C826 /* Module */ = {
isa = PBXGroup;
children = (
BE4CFBDD2BFF5BB90043389D /* GDDataManagerBundle.swift */,
BE6F41FA2B47B70A0058C826 /* GDDataManagerModule.swift */,
BE6F41FB2B47B70A0058C826 /* GDDataManagerModuleSwiftLoadFile.m */,
);
......@@ -1518,6 +1521,7 @@
BEABC74B29A0CB0E0043716F /* GDDataManagerProvider.swift in Sources */,
BE05B41C2BF38DB300FB71E4 /* GDResourcePropModel.swift in Sources */,
BEABC76029A0DB210043716F /* GDDataManagerPlugin.swift in Sources */,
BE4CFBDE2BFF5BB90043389D /* GDDataManagerBundle.swift in Sources */,
BEABC711299F72470043716F /* GDDataManagerAPI.swift in Sources */,
BE6F41FD2B47B70A0058C826 /* GDDataManagerModuleSwiftLoadFile.m in Sources */,
BEE945A529A0F16A006632C7 /* GDDataManager.swift in Sources */,
......
//
// GDDataManagerBundle.swift
// GDDataManagerBundle
//
// Created by pierce on 2024/1/15.
//
import UIKit
import GDRouter
@objcMembers public class GDDataManagerBundle: ModuleBundle {
static let shared = GDDataManagerBundle()
@objc public override class func bundle() -> Bundle? {
if self.shared.bundle == nil {
self.shared.bundle = self.bundle(withName: "GDDataManagerBundle")
}
return self.shared.bundle
}
}
......@@ -161,7 +161,7 @@ extension GDDataManagerModule: GDRouterProtocol {
}
public var bundle: Bundle { .main }
public var bundle: Bundle { GDDataManagerBundle.bundle() ?? .main }
}
extension GDDataManagerModule: BifrostModuleProtocol {
......
......@@ -18,8 +18,8 @@ class GDPrizeViewController: GDWebViewController {
self.currentWebUrl = GDPersonalWebURL.livePrizePage
self.viewRequest(url: GDPersonalWebURL.livePrizePage)
self.showCloseWhenGoBackEnable = false
self.showBackBtn = false
self.showCloseWhenGoBackEnable = true
self.showBackBtn = true
self.navigationController?.navigationItem.setLeftBarButtonItems(nil, animated: false)
self.title = "奖励"
......
......@@ -79,7 +79,6 @@
BE05B3712BF35F2300FB71E4 /* GDLiveChatModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2072BF35F2200FB71E4 /* GDLiveChatModel.swift */; };
BE05B3722BF35F2300FB71E4 /* GDLiveGagModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2082BF35F2200FB71E4 /* GDLiveGagModel.swift */; };
BE05B3732BF35F2300FB71E4 /* GDLiveJoinEffectModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2092BF35F2200FB71E4 /* GDLiveJoinEffectModel.swift */; };
BE05B3742BF35F2300FB71E4 /* GDLiveTimeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B20A2BF35F2200FB71E4 /* GDLiveTimeModel.swift */; };
BE05B3752BF35F2300FB71E4 /* GDLiveWishListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B20B2BF35F2200FB71E4 /* GDLiveWishListModel.swift */; };
BE05B3762BF35F2300FB71E4 /* GDUserInfoCardModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B20C2BF35F2200FB71E4 /* GDUserInfoCardModel.swift */; };
BE05B3822BF35F2300FB71E4 /* GDLiveFontSizeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2272BF35F2200FB71E4 /* GDLiveFontSizeView.swift */; };
......@@ -143,9 +142,6 @@
BE05B3EA2BF35F2400FB71E4 /* GDLiveAnchorInviteHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2D52BF35F2200FB71E4 /* GDLiveAnchorInviteHeaderView.swift */; };
BE05B3EB2BF35F2400FB71E4 /* GDLiveAnchorInviteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2D62BF35F2200FB71E4 /* GDLiveAnchorInviteView.swift */; };
BE05B3EC2BF35F2400FB71E4 /* GDLiveAnchorInviteViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2D82BF35F2200FB71E4 /* GDLiveAnchorInviteViewModel.swift */; };
BE05B3EF2BF35F2400FB71E4 /* GDLiveTimeDetailCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2DE2BF35F2200FB71E4 /* GDLiveTimeDetailCell.swift */; };
BE05B3F02BF35F2400FB71E4 /* GDLiveTimeDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2DF2BF35F2200FB71E4 /* GDLiveTimeDetailView.swift */; };
BE05B3F12BF35F2400FB71E4 /* GDLiveTimeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2E12BF35F2200FB71E4 /* GDLiveTimeView.swift */; };
BE05B3F22BF35F2400FB71E4 /* GDLiveLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2E32BF35F2200FB71E4 /* GDLiveLoadingView.swift */; };
BE05B3F32BF35F2400FB71E4 /* GDLiveAdminManageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2E52BF35F2200FB71E4 /* GDLiveAdminManageCell.swift */; };
BE05B3F42BF35F2400FB71E4 /* GDLiveAdminManageController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE05B2E62BF35F2200FB71E4 /* GDLiveAdminManageController.swift */; };
......@@ -812,7 +808,6 @@
BE05B2072BF35F2200FB71E4 /* GDLiveChatModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveChatModel.swift; sourceTree = "<group>"; };
BE05B2082BF35F2200FB71E4 /* GDLiveGagModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveGagModel.swift; sourceTree = "<group>"; };
BE05B2092BF35F2200FB71E4 /* GDLiveJoinEffectModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveJoinEffectModel.swift; sourceTree = "<group>"; };
BE05B20A2BF35F2200FB71E4 /* GDLiveTimeModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveTimeModel.swift; sourceTree = "<group>"; };
BE05B20B2BF35F2200FB71E4 /* GDLiveWishListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveWishListModel.swift; sourceTree = "<group>"; };
BE05B20C2BF35F2200FB71E4 /* GDUserInfoCardModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDUserInfoCardModel.swift; sourceTree = "<group>"; };
BE05B2272BF35F2200FB71E4 /* GDLiveFontSizeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveFontSizeView.swift; sourceTree = "<group>"; };
......@@ -876,9 +871,6 @@
BE05B2D52BF35F2200FB71E4 /* GDLiveAnchorInviteHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveAnchorInviteHeaderView.swift; sourceTree = "<group>"; };
BE05B2D62BF35F2200FB71E4 /* GDLiveAnchorInviteView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveAnchorInviteView.swift; sourceTree = "<group>"; };
BE05B2D82BF35F2200FB71E4 /* GDLiveAnchorInviteViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveAnchorInviteViewModel.swift; sourceTree = "<group>"; };
BE05B2DE2BF35F2200FB71E4 /* GDLiveTimeDetailCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveTimeDetailCell.swift; sourceTree = "<group>"; };
BE05B2DF2BF35F2200FB71E4 /* GDLiveTimeDetailView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveTimeDetailView.swift; sourceTree = "<group>"; };
BE05B2E12BF35F2200FB71E4 /* GDLiveTimeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveTimeView.swift; sourceTree = "<group>"; };
BE05B2E32BF35F2200FB71E4 /* GDLiveLoadingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveLoadingView.swift; sourceTree = "<group>"; };
BE05B2E52BF35F2200FB71E4 /* GDLiveAdminManageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveAdminManageCell.swift; sourceTree = "<group>"; };
BE05B2E62BF35F2200FB71E4 /* GDLiveAdminManageController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDLiveAdminManageController.swift; sourceTree = "<group>"; };
......@@ -2054,7 +2046,6 @@
BE05B2072BF35F2200FB71E4 /* GDLiveChatModel.swift */,
BE05B2082BF35F2200FB71E4 /* GDLiveGagModel.swift */,
BE05B2092BF35F2200FB71E4 /* GDLiveJoinEffectModel.swift */,
BE05B20A2BF35F2200FB71E4 /* GDLiveTimeModel.swift */,
BE05B20B2BF35F2200FB71E4 /* GDLiveWishListModel.swift */,
BE05B20C2BF35F2200FB71E4 /* GDUserInfoCardModel.swift */,
);
......@@ -2423,24 +2414,6 @@
path = Invite;
sourceTree = "<group>";
};
BE05B2E02BF35F2200FB71E4 /* DetailView */ = {
isa = PBXGroup;
children = (
BE05B2DE2BF35F2200FB71E4 /* GDLiveTimeDetailCell.swift */,
BE05B2DF2BF35F2200FB71E4 /* GDLiveTimeDetailView.swift */,
);
path = DetailView;
sourceTree = "<group>";
};
BE05B2E22BF35F2200FB71E4 /* LiveTimeView */ = {
isa = PBXGroup;
children = (
BE05B2E02BF35F2200FB71E4 /* DetailView */,
BE05B2E12BF35F2200FB71E4 /* GDLiveTimeView.swift */,
);
path = LiveTimeView;
sourceTree = "<group>";
};
BE05B2E42BF35F2200FB71E4 /* LoadingView */ = {
isa = PBXGroup;
children = (
......@@ -2540,7 +2513,6 @@
BE05B2B82BF35F2200FB71E4 /* GiftPanelView */,
BE05B2D02BF35F2200FB71E4 /* HeadView */,
BE05B2DA2BF35F2200FB71E4 /* Invite */,
BE05B2E22BF35F2200FB71E4 /* LiveTimeView */,
BE05B2E42BF35F2200FB71E4 /* LoadingView */,
BE05B2EC2BF35F2200FB71E4 /* Management */,
BE05B2EE2BF35F2200FB71E4 /* MentionMeView */,
......@@ -4131,7 +4103,6 @@
BEB255462BEE4C6700844AC6 /* GDShowRoomModule.swift in Sources */,
BE05B3F62BF35F2400FB71E4 /* GDLiveKickoutManageView.swift in Sources */,
BE05B3D12BF35F2400FB71E4 /* GDGiftDrawAreaView.swift in Sources */,
BE05B3F12BF35F2400FB71E4 /* GDLiveTimeView.swift in Sources */,
BE05B3272BF35F2200FB71E4 /* GDLiveOfficialEndView.swift in Sources */,
BE05B3E32BF35F2400FB71E4 /* GDLiveHeatBroadcastView.swift in Sources */,
BE05B4112BF35F2400FB71E4 /* GDLiveHotRankViewModel.swift in Sources */,
......@@ -4147,7 +4118,6 @@
BE05B33C2BF35F2200FB71E4 /* GDPKHomeCell.swift in Sources */,
BE05B3D32BF35F2400FB71E4 /* GDGiftPanelCell.swift in Sources */,
BE05B3932BF35F2300FB71E4 /* GDLiveCloseAlertView.swift in Sources */,
BE05B3742BF35F2300FB71E4 /* GDLiveTimeModel.swift in Sources */,
BE05B3D52BF35F2400FB71E4 /* GDGiftPanelDrawView.swift in Sources */,
BE05B3902BF35F2300FB71E4 /* GDLiveBarrageOptionView.swift in Sources */,
BE05B3512BF35F2200FB71E4 /* GDLiveAnchorStartThemeCell.swift in Sources */,
......@@ -4206,10 +4176,8 @@
BE05B3662BF35F2200FB71E4 /* GDLiveEnterRoomTipsView.swift in Sources */,
BE05B3E52BF35F2400FB71E4 /* GDLiveOnlineUserView.swift in Sources */,
BE05B34B2BF35F2200FB71E4 /* GDPKInvitePopupViewModel.swift in Sources */,
BE05B3F02BF35F2400FB71E4 /* GDLiveTimeDetailView.swift in Sources */,
BE05B32F2BF35F2200FB71E4 /* GDPKPunishView.swift in Sources */,
BE05B4262BF39DCA00FB71E4 /* GDBarrageModel.swift in Sources */,
BE05B3EF2BF35F2400FB71E4 /* GDLiveTimeDetailCell.swift in Sources */,
BE05B3762BF35F2300FB71E4 /* GDUserInfoCardModel.swift in Sources */,
BE05B34C2BF35F2200FB71E4 /* GDPKInviteRefusedPopupView.swift in Sources */,
BE05B3682BF35F2200FB71E4 /* GDLiveAudienceController.swift in Sources */,
......
......@@ -541,17 +541,18 @@ class GDLiveOnlineUserModel: BaseModel {
self.userList.accept(newUserList)
}).disposed(by: disposeBag)
GDShowRoomSocketPublisher.addTime.subscribe(onNext: {[weak self] json in
guard let self = self else { return }
let realuid = json["uid"].stringValue
let rankNum = json["ranknum"].stringValue
let userlist = self.userList.value
if let index = userlist.firstIndex(where: { $0.realuid == realuid }) {
userlist[index].ranknum.accept(rankNum.intValue)
}
}).disposed(by: disposeBag)
//TODO:直播时间: added By Pidan
// GDShowRoomSocketPublisher.addTime.subscribe(onNext: {[weak self] json in
// guard let self = self else { return }
// let realuid = json["uid"].stringValue
// let rankNum = json["ranknum"].stringValue
//
// let userlist = self.userList.value
// if let index = userlist.firstIndex(where: { $0.realuid == realuid }) {
// userlist[index].ranknum.accept(rankNum.intValue)
// }
//
// }).disposed(by: disposeBag)
// 直播间角色变化
GDShowRoomSocketPublisher.userRoleChange.currentRoom().subscribe(onNext: { (model) in
......
......@@ -83,8 +83,8 @@ class GDLiveFunctionView: BaseView {
// makeWatchTimeView()
//TODO:直播间活动: added By Pidan
// makeActivityView()
makeLiveTimeView()
//TODO:直播时间: added By Pidan
// makeLiveTimeView()
if GDLiveHelper.shared.role.value == .anchor {
makeAnchorInviteView()
......@@ -150,8 +150,9 @@ class GDLiveFunctionView: BaseView {
lazy var giftEffectView = GDGiftEffectView()
/// 进场特效 View
private lazy var entranceEffectView = GDLiveEntranceEffectView()
/// 直播间时间倒计时View
private let liveTimeView = GDLiveTimeView(frame: .zero)
//TODO:直播时间: added By Pidan
// /// 直播间时间倒计时View
// private let liveTimeView = GDLiveTimeView(frame: .zero)
/// 弹出 View
//TODO:直播间热力榜: added By Pidan
......@@ -164,7 +165,8 @@ class GDLiveFunctionView: BaseView {
// private var fansGroupView: GDLiveFansGroupView?
//TODO:直播间守护: added By Pidan
// private var guardianListView: GDLiveGuardianListView?
private var liveTimeDetailView: GDLiveTimeDetailView?
//TODO:直播时间: added By Pidan
// private var liveTimeDetailView: GDLiveTimeDetailView?
//TODO:直播间守护: added By Pidan
// private var becomeGuardView: GDLiveGuaridanSuccessView?
//TODO:战队: added By Pidan
......@@ -653,38 +655,39 @@ class GDLiveFunctionView: BaseView {
// }
// }
private func makeLiveTimeView() {
self.contentView.addSubview(liveTimeView)
liveTimeView.snp.makeConstraints { (make) in
make.left.equalToSuperview().offset(4)
make.top.equalTo(headView.snp.bottom).offset(12)
make.width.equalTo(60)
make.height.equalTo(30)
}
liveTimeView.clickHandler = {[weak self] in
guard GDRouter.UserRouter?.isVisitor.value == false else {
GDLiveHelper.shared.shareRoomid.accept(GDLiveHelper.shared.roomid.value)
GDRouter.LoginRouter?.showVisitorLoginView(vc: GDLiveHelper.shared.liveVC, showPhoneLogin: false)
return
}
guard let self = self else { return }
guard self.liveTimeDetailView?.superview == nil else {
return
}
self.liveTimeDetailView?.removeFromSuperview()
self.liveTimeDetailView = GDLiveTimeDetailView()
GDLiveHelper.shared.liveVC?.setupIsToggleViewOnShow(onShow: true)
self.liveTimeDetailView?.show(on: self)
self.liveTimeDetailView?.dismissHandler = {
GDLiveHelper.shared.liveVC?.setupIsToggleViewOnShow(onShow: false)
}
}
}
//TODO:直播时间: added By Pidan
// private func makeLiveTimeView() {
// self.contentView.addSubview(liveTimeView)
//
// liveTimeView.snp.makeConstraints { (make) in
// make.left.equalToSuperview().offset(4)
// make.top.equalTo(headView.snp.bottom).offset(12)
// make.width.equalTo(60)
// make.height.equalTo(30)
// }
//
// liveTimeView.clickHandler = {[weak self] in
// guard GDRouter.UserRouter?.isVisitor.value == false else {
// GDLiveHelper.shared.shareRoomid.accept(GDLiveHelper.shared.roomid.value)
// GDRouter.LoginRouter?.showVisitorLoginView(vc: GDLiveHelper.shared.liveVC, showPhoneLogin: false)
// return
// }
// guard let self = self else { return }
// guard self.liveTimeDetailView?.superview == nil else {
// return
// }
//
// self.liveTimeDetailView?.removeFromSuperview()
// self.liveTimeDetailView = GDLiveTimeDetailView()
//
// GDLiveHelper.shared.liveVC?.setupIsToggleViewOnShow(onShow: true)
// self.liveTimeDetailView?.show(on: self)
// self.liveTimeDetailView?.dismissHandler = {
// GDLiveHelper.shared.liveVC?.setupIsToggleViewOnShow(onShow: false)
// }
// }
//
// }
private func makeAnchorInviteView() {
anchorInviteView = GDLiveAnchorInviteView()
......@@ -692,7 +695,9 @@ class GDLiveFunctionView: BaseView {
anchorInviteView?.snp.makeConstraints { (make) in
make.left.equalToSuperview()
make.top.equalTo(liveTimeView.snp.bottom).offset(12)
//TODO:直播时间: added By Pidan
// make.top.equalTo(liveTimeView.snp.bottom).offset(12)
make.top.equalTo(headView.snp.bottom).offset(12)
make.width.equalTo(anchorInviteView?.width ?? 0)
make.height.equalTo(anchorInviteView?.height ?? 0)
}
......@@ -1041,32 +1046,32 @@ class GDLiveFunctionView: BaseView {
}
}).disposed(by: disposeBag)
GDShowRoomSocketPublisher.addTime.subscribe(onNext: {[weak self] json in
guard let self = self else { return }
let bonds = json["bonds"].stringValue
let changeBonds = json["changebonds"].stringValue
if bonds.intValue > 0 {
self.viewModel.roomModel.value.livebonds = bonds
}
if changeBonds.intValue > 0 {
self.ticketAddBtn.setTitle("+\(changeBonds)", for: .normal)
self.ticketAddBtn.isHidden = false
self.ticketAddBtn.alpha = 1
UIView.animate(withDuration: 1, delay: 0, options: .layoutSubviews) {[weak self] in
self?.ticketAddBtn.transform = .init(translationX: 0, y: -20)
self?.ticketAddBtn.alpha = 0
} completion: {[weak self] (_) in
self?.ticketAddBtn.transform = .identity
self?.ticketAddBtn.isHidden = true
self?.ticketAddAnimating = false
}
}
}).disposed(by: disposeBag)
//TODO:直播时间: added By Pidan
// GDShowRoomSocketPublisher.addTime.subscribe(onNext: {[weak self] json in
// guard let self = self else { return }
// let bonds = json["bonds"].stringValue
// let changeBonds = json["changebonds"].stringValue
//
// if bonds.intValue > 0 {
// self.viewModel.roomModel.value.livebonds = bonds
// }
//
// if changeBonds.intValue > 0 {
// self.ticketAddBtn.setTitle("+\(changeBonds)", for: .normal)
//
// self.ticketAddBtn.isHidden = false
// self.ticketAddBtn.alpha = 1
// UIView.animate(withDuration: 1, delay: 0, options: .layoutSubviews) {[weak self] in
// self?.ticketAddBtn.transform = .init(translationX: 0, y: -20)
// self?.ticketAddBtn.alpha = 0
// } completion: {[weak self] (_) in
// self?.ticketAddBtn.transform = .identity
// self?.ticketAddBtn.isHidden = true
// self?.ticketAddAnimating = false
// }
// }
//
// }).disposed(by: disposeBag)
//TODO:战队: added By Pidan
// GDSocketPublisher.FightTeam.enterShow.subscribe(onNext: {[weak self] json in
......
//
// GDLiveTimeModel.swift
// TealiveSwift
//
// Created by Jim Chan on 2021/4/23.
// Copyright © 2021 YAZHAI Inc. All rights reserved.
//
import UIKit
import GDToolBox
class GDLiveTimeRequestModel: BaseModel, NetworkModelType {
static func createFrom(_ json: JSON) -> Self {
let model = GDLiveTimeRequestModel()
model.list = json["list"].arrayValue.map { GDLiveTimeModel.createFrom($0) }
model.isBlackAnchor = json["isActivityLiveBenefitsBlacklist"].boolValue
return model as! Self
}
var list: [GDLiveTimeModel] = []
var isBlackAnchor: Bool = false
}
final class GDLiveTimeModel: BaseModel, NetworkArrType {
var uid: String?
var face: String?
// 0未使用 1正在使用 2已经使用
var state: Int = 0
var time: Int = 0
var bonds: String?
static func createFrom(_ json: JSON) -> GDLiveTimeModel {
let model = GDLiveTimeModel()
model.uid = json["uid"].stringValue
model.face = json["face"].stringValue
model.state = json["state"].intValue
model.time = json["time"].intValue
model.bonds = json["bonds"].stringValue
return model
}
static func createArrFrom(_ json: JSON) -> [GDLiveTimeModel] {
return json["list"].arrayValue.map { GDLiveTimeModel.createFrom($0) }
}
}
......@@ -62,7 +62,7 @@ class GDBeautyPanelView: BaseView {
/// 滤镜强度参数数值
let filterStrengthLabel = UILabel(frame: .zero)
/// 滤镜强度SliderView
let filterStrengthSliderView = UISlider(frame: CGRect(x: 32, y: 48, width: GDScreen.width - 64, height: 10))
let filterStrengthSliderView = UISlider(frame: CGRect(x: 32, y: 48, width: GDScreen.width - 64, height: 30))
/// 搭建背景按钮
private func makeBgButton() {
......@@ -142,7 +142,7 @@ class GDBeautyPanelView: BaseView {
private let paramsReuseIdentifier = "GDBeautyParamCell"
private func makeBeautyParamsAdjustView() {
beautyParamsSliderView.trackHeight = 4.0
beautyParamsSliderView.trackHeight = 5.0
beautyParamsSliderView.minimumTrackTintColor = .white
beautyParamsSliderView.maximumTrackTintColor = .init(white: 1, alpha: 0.2)
beautyParamsSliderView.setThumbImage(GDShowRoomBundle.imageNamed("live_beauty_setting_slider_button"), for: .normal)
......@@ -179,7 +179,7 @@ class GDBeautyPanelView: BaseView {
beautyParamsSliderView.snp.makeConstraints { (make) in
make.left.equalToSuperview().offset(32)
make.right.equalToSuperview().offset(-32)
make.height.equalTo(10)
make.height.equalTo(20)
make.top.equalToSuperview().offset(48)
}
......@@ -223,7 +223,7 @@ class GDBeautyPanelView: BaseView {
filterStrengthSliderView.snp.makeConstraints { (make) in
make.left.equalToSuperview().offset(32)
make.right.equalToSuperview().offset(-32)
make.height.equalTo(10)
make.height.equalTo(30)
make.top.equalToSuperview().offset(48)
}
......
......@@ -147,7 +147,7 @@ class GDGiftEffectView: BaseView {
}
// 校验礼物数据
if model.giftmd5v2?.count ?? 0 > 0 && model.giftmd5v2 != GDRouter.DataRouter?.giftMd5 {
if model.giftmd5v3?.count ?? 0 > 0 && model.giftmd5v3 != GDRouter.DataRouter?.giftMd5 {
// 礼物需要更新
GDRouter.DataRouter?.checkLiveGiftData(from: .server, completionHandler: nil)
}
......@@ -192,21 +192,22 @@ class GDGiftEffectView: BaseView {
self?.addGiftEffect(model)
}).disposed(by: disposeBag)
GDShowRoomSocketPublisher.addTime.subscribe(onNext: {[weak self] json in
delay(1) {
let gid = json["gid"].stringValue
if let giftModel = GDRouter.DataRouter?.liveGiftDict.value[gid] {
let model = GDGiftEffectModel()
model.giftModel = giftModel
self?.addGiftEffect(model)
}
}
}).disposed(by: disposeBag)
//TODO:直播时间: added By Pidan
// GDShowRoomSocketPublisher.addTime.subscribe(onNext: {[weak self] json in
//
// delay(1) {
// let gid = json["gid"].stringValue
//
// if let giftModel = GDRouter.DataRouter?.liveGiftDict.value[gid] {
//
// let model = GDGiftEffectModel()
// model.giftModel = giftModel
//
// self?.addGiftEffect(model)
// }
// }
//
// }).disposed(by: disposeBag)
GDShowRoomSocketPublisher.richLevelUp.subscribe(onNext: {[weak self] model in
......
......@@ -36,6 +36,7 @@ class GDGiftEffectModel: BaseModel, GDSocketModelType {
var giftModel: GDGiftModel?
var giftmd5 : String?
var giftmd5v2 : String?
var giftmd5v3 : String?
var giftnum : String?
var msgId : String?
var num : String?
......@@ -81,6 +82,7 @@ class GDGiftEffectModel: BaseModel, GDSocketModelType {
model.gid = json["gid"].stringValue
model.giftmd5 = json["giftmd5"].stringValue
model.giftmd5v2 = json["giftmd5v2"].stringValue
model.giftmd5v3 = json["giftmd5v3"].stringValue
model.giftnum = json["giftnum"].stringValue
model.msgId = json["msgId"].stringValue
model.num = json["num"].stringValue
......
......@@ -14,6 +14,8 @@ import GDRouter
class GDGiftPanelCell: UICollectionViewCell {
static var highlightImages:[UIImage]?
let disposeBag = DisposeBag()
var reuseDisposeBag = DisposeBag()
......@@ -102,9 +104,12 @@ class GDGiftPanelCell: UICollectionViewCell {
highlightImageView.isHidden = false
highlightImageView.animationRepeatCount = 0
highlightImageView.animationDuration = 1.0
highlightImageView.animationImages = GDShowRoomBundle.animatedImageArrayNamed("live_gift_panel_highlight_bg_")?.map({ image in
return image.resizableImage(withCapInsets: .init(top: 5, left: 5, bottom: 5, right: 5), resizingMode: .stretch)
})
if GDGiftPanelCell.highlightImages == nil {
GDGiftPanelCell.highlightImages = GDShowRoomBundle.animatedImageArrayNamed("live_gift_panel_highlight_bg_")?.map({ image in
return image.resizableImage(withCapInsets: .init(top: 5, left: 5, bottom: 5, right: 5), resizingMode: .stretch)
})
}
highlightImageView.animationImages = GDGiftPanelCell.highlightImages
self.addSubview(highlightImageView)
}
......
......@@ -148,6 +148,9 @@ class GDGiftPanelSendButton: BaseView {
}
}, repeats: true)
if let timer = aniTimer {
RunLoop.main.add(timer, forMode: .common)
}
}
func stopSendAnimation() {
......
......@@ -89,7 +89,7 @@ class GDGIftPanelViewModel: BaseViewModel, ViewModelType {
for tabData in giftTab {
if let giftList = tabData.giftList {
if let giftList = tabData.giftList?.filter({ $0.gid != nil }) {
// 存储数据
if let tid = tabData.tid {
var dict = self.tabDataSourceDict.value
......
//
// GDLiveTimeDetailCell.swift
// TealiveSwift
//
// Created by Jim Chan on 2021/4/24.
// Copyright © 2021 YAZHAI Inc. All rights reserved.
//
import UIKit
import GDToolBox
class GDLiveTimeDetailCell: BaseCollectionViewCell {
private let clockIconView = UIImageView(image: nil)
let leftLineView = UIView(frame: .zero)
let rightLineView = UIView(frame: .zero)
let timeLabel = UILabel(frame: .zero)
private let lineView = UIView(frame: .zero)
private let bondsLabel = UILabel(frame: .zero)
private let faceImageView = UIImageView(frame: .zero)
override func makeUI() {
super.makeUI()
self.contentView.addSubview(leftLineView)
self.contentView.addSubview(rightLineView)
clockIconView.contentMode = .scaleAspectFit
self.contentView.addSubview(clockIconView)
timeLabel.font = .gd_pingfang(9)
timeLabel.textColor = .hexColor("7FFFF4")
timeLabel.textAlignment = .center
self.contentView.addSubview(timeLabel)
bondsLabel.font = .gd_pingfang(10)
bondsLabel.textColor = .hexColor("02ABA4")
self.contentView.addSubview(bondsLabel)
faceImageView.layer.borderWidth = 1
faceImageView.layer.cornerRadius = 30 / 2.0
faceImageView.layer.masksToBounds = true
self.contentView.addSubview(faceImageView)
clockIconView.snp.makeConstraints { (make) in
make.top.equalToSuperview().offset(8)
make.centerX.equalToSuperview()
make.width.height.equalTo(self.snp.width).multipliedBy(0.73)
}
timeLabel.snp.makeConstraints { (make) in
make.centerX.equalTo(clockIconView)
make.centerY.equalTo(clockIconView).offset(2)
}
bondsLabel.snp.makeConstraints { (make) in
make.top.equalTo(clockIconView.snp.bottom).offset(4)
make.centerX.equalToSuperview()
}
faceImageView.snp.makeConstraints { (make) in
make.centerX.equalToSuperview()
make.top.equalTo(bondsLabel.snp.bottom).offset(8)
make.width.height.equalTo(30)
}
leftLineView.snp.makeConstraints { (make) in
make.width.equalToSuperview().multipliedBy(0.5)
make.left.equalToSuperview()
make.centerY.equalTo(clockIconView)
make.height.equalTo(5)
}
rightLineView.snp.makeConstraints { (make) in
make.width.equalToSuperview().multipliedBy(0.5)
make.right.equalToSuperview()
make.centerY.equalTo(clockIconView)
make.height.equalTo(5)
}
}
// MARK: Method
func setup(with model: GDLiveTimeModel) {
reuseDisposeBag = DisposeBag()
faceImageView.cancelDownload()
faceImageView.image = nil
faceImageView.setWebImage(model.face)
bondsLabel.text = nil
if model.uid == GDLiveHelper.shared.roomid.value {
clockIconView.snp.remakeConstraints { (make) in
make.top.equalToSuperview().offset(8)
make.centerX.equalToSuperview()
make.width.equalTo(self.snp.width).multipliedBy(0.73)
make.height.equalTo(clockIconView.snp.width).multipliedBy(0.5)
}
if model.state == 1 {
// 使用中
timeLabel.isHidden = false
leftLineView.backgroundColor = .hexColor("2BF5E5")
rightLineView.backgroundColor = .hexColor("EBF1F0")
clockIconView.image = GDShowRoomBundle.imageNamed("live_time_base_bg")
faceImageView.layer.borderColor = UIColor.gd_main.cgColor
} else if model.state == 2 {
// 已经使用
timeLabel.isHidden = true
leftLineView.backgroundColor = .hexColor("2BF5E5")
rightLineView.backgroundColor = .hexColor("2BF5E5")
clockIconView.image = GDShowRoomBundle.imageNamed("live_time_base_finish_bg")
faceImageView.layer.borderColor = UIColor.gd_main.cgColor
}
bondsLabel.text = "基础任务"
faceImageView.isHidden = true
} else {
clockIconView.snp.remakeConstraints { (make) in
make.top.equalToSuperview().offset(8)
make.centerX.equalToSuperview()
make.width.height.equalTo(self.snp.width).multipliedBy(0.73)
}
faceImageView.isHidden = false
if model.state == 0 {
// 未使用
timeLabel.isHidden = true
leftLineView.backgroundColor = .hexColor("EBF1F0")
rightLineView.backgroundColor = .hexColor("EBF1F0")
clockIconView.image = GDShowRoomBundle.imageNamed("live_time_icon_not_start")
faceImageView.layer.borderColor = UIColor.lightGray.cgColor
} else if model.state == 1 {
// 使用中
timeLabel.isHidden = false
leftLineView.backgroundColor = .hexColor("2BF5E5")
rightLineView.backgroundColor = .hexColor("EBF1F0")
clockIconView.image = GDShowRoomBundle.imageNamed("live_time_icon_counting")
faceImageView.layer.borderColor = UIColor.gd_main.cgColor
} else if model.state == 2 {
// 已经使用
timeLabel.isHidden = true
leftLineView.backgroundColor = .hexColor("2BF5E5")
rightLineView.backgroundColor = .hexColor("2BF5E5")
clockIconView.image = GDShowRoomBundle.imageNamed("live_time_icon_finish")
faceImageView.layer.borderColor = UIColor.gd_main.cgColor
}
if GDLiveHelper.shared.role.value == .anchor {
bondsLabel.text = "\(model.bonds ?? "0")\(GDAppConfig.gd_coinName)"
}
}
}
}
//
// GDLiveTimeDetailView.swift
// TealiveSwift
//
// Created by Jim Chan on 2021/4/24.
// Copyright © 2021 YAZHAI Inc. All rights reserved.
//
import UIKit
import GDToolBox
class GDLiveTimeDetailView: BaseView {
var dismissHandler: EmptyClosure?
// MARK: Init
init() {
super.init(frame: GDScreen.frame)
setupSocketListener()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: UI
override func makeUI() {
super.makeUI()
makeBgButton()
makeBgView()
makeContentView()
}
/// 背景 View
let bgView = UIView(frame: CGRect(x: 0,
y: 0,
width: 300,
height: 180))
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
/// 搭建背景按钮
private func makeBgButton() {
let bgBtn = UIButton(type: .custom)
bgBtn.frame = self.bounds
bgBtn.setTitle(nil, for: .normal)
self.addSubview(bgBtn)
bgBtn.rx.tap.subscribe(onNext: {[weak self] (_) in
self?.dismiss()
}).disposed(by: disposeBag)
}
/// 搭建背景 View
private func makeBgView() {
bgView.layer.masksToBounds = true
bgView.backgroundColor = .clear
self.addSubview(bgView)
// // 添加遮罩
// let bezierPath = UIBezierPath(roundedRect: bgView.bounds, byRoundingCorners: [.topLeft, .topRight] , cornerRadii: CGSize(width: 20, height: 20))
// let maskLayer = CAShapeLayer()
// maskLayer.path = bezierPath.cgPath
// bgView.layer.mask = maskLayer
//
// // 添加模糊层
// let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .dark))
// blurView.frame = bgView.bounds
// bgView.addSubview(blurView)
}
private let reuseIdentifier = "GDLiveTimeDetailCell"
private func makeContentView() {
let bgImageView = UIImageView(image: GDShowRoomBundle.imageNamed("live_time_bg"))
bgImageView.contentMode = .scaleToFill
bgView.addSubview(bgImageView)
let titleLabel = UILabel(frame: .zero)
titleLabel.text = "完成加时,获得奖励"
titleLabel.font = .gd_pingfang(14)
bgView.addSubview(titleLabel)
if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
layout.itemSize = .init(width: (bgView.width - 16) / 5.0, height: 130)
layout.scrollDirection = .horizontal
layout.minimumLineSpacing = 0
layout.minimumInteritemSpacing = 0
}
collectionView.showsVerticalScrollIndicator = false
collectionView.showsHorizontalScrollIndicator = false
collectionView.backgroundColor = .clear
collectionView.register(GDLiveTimeDetailCell.self, forCellWithReuseIdentifier: reuseIdentifier)
collectionView.rx.setDelegate(self).disposed(by: disposeBag)
bgView.addSubview(collectionView)
bgImageView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
titleLabel.snp.makeConstraints { (make) in
make.top.equalToSuperview().offset(20)
make.centerX.equalToSuperview()
}
collectionView.snp.makeConstraints { (make) in
make.top.equalTo(titleLabel.snp.bottom).offset(16)
make.left.equalToSuperview().offset(8)
make.right.equalToSuperview().offset(-8)
make.bottom.equalToSuperview().offset(-8)
}
}
// MARK: Data
override func bindViewModel() {
super.bindViewModel()
GDLiveHelper.shared.refreshLivingTime()
GDLiveHelper.shared.addTimeUserList.bind(to: collectionView.rx.items(cellIdentifier: reuseIdentifier, cellType: GDLiveTimeDetailCell.self)) { index, element, cell in
cell.setup(with: element)
GDLiveHelper.shared.addTime.map { time in
if element.uid == GDLiveHelper.shared.roomid.value {
let hour = (time / 60) / 60
let min = (time / 60) % 60
let sec = time % 60
return "\(String(NSString(format: "%.2ld", hour))):\(String(NSString(format: "%.2ld", min))):\(String(NSString(format: "%.2ld", sec)))"
} else {
let min = time / 60
let sec = time % 60
return "\(String(NSString(format: "%.2ld", min))):\(String(NSString(format: "%.2ld", sec)))"
}
}.bind(to: cell.timeLabel.rx.text).disposed(by: cell.reuseDisposeBag)
cell.leftLineView.isHidden = false
cell.rightLineView.isHidden = false
if index == 0 {
cell.leftLineView.isHidden = true
}
if index == GDLiveHelper.shared.addTimeUserList.value.count - 1 {
cell.rightLineView.isHidden = true
}
}.disposed(by: disposeBag)
collectionView.rx.observe(CGSize.self, "contentSize").distinctUntilChanged().subscribe(onNext: {[weak self] contentSize in
guard let self = self else { return }
if contentSize?.width ?? 0 < self.collectionView.width {
let insetLeft = (self.collectionView.width - (contentSize?.width ?? 0)) / 2.0
self.collectionView.contentInset = .init(top: 0, left: insetLeft, bottom: 0, right: 0)
} else {
self.collectionView.contentInset = .zero
}
}).disposed(by: disposeBag)
// 滚动到collectionView中间位置
GDLiveHelper.shared.addTimeUserList.delay(.milliseconds(50), scheduler: MainScheduler.instance).subscribe(onNext: {[weak self] list in
guard let self = self else { return }
if var index = list.firstIndex(where: { $0.state == 1 }) {
if index + 1 < GDLiveHelper.shared.addTimeUserList.value.count {
index += 1
}
self.collectionView.scrollToItem(at: .init(row: Int(index), section: 0), at: .centeredHorizontally, animated: true)
}
}).disposed(by: disposeBag)
}
private func setupSocketListener() {
GDShowRoomSocketPublisher.giftChange.subscribe(onNext: { model in
if model.rtime != -1 {
GDLiveHelper.shared.refreshLivingTime()
}
}).disposed(by: disposeBag)
}
// MARK: Method
func show(on view: UIView, animate: Bool = true) {
guard self.superview == nil else { return }
view.addSubview(self)
if animate {
bgView.y = self.height
bgView.centerX = self.width / 2.0
UIView.animate(withDuration: 0.15) {
self.bgView.centerY = self.height / 2.0
self.backgroundColor = .init(white: 0, alpha: 0.5)
}
} else {
bgView.y = self.height - bgView.height
}
}
func dismiss(animate: Bool = true) {
if animate {
dismissHandler?()
UIView.animate(withDuration: 0.15, animations: {
self.bgView.y = self.height
self.backgroundColor = .clear
}) { (_) in
self.removeFromSuperview()
}
} else {
self.removeFromSuperview()
dismissHandler?()
}
}
}
extension GDLiveTimeDetailView: UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let model = GDLiveHelper.shared.addTimeUserList.value[indexPath.row]
if model.uid == GDLiveHelper.shared.roomid.value {
return .init(width: ((bgView.width - 16) / 5.0) * 2, height: 130)
} else {
return .init(width: (bgView.width - 16) / 5.0, height: 130)
}
}
}
//
// GDLiveTimeView.swift
// TealiveSwift
//
// Created by Jim Chan on 2021/4/23.
// Copyright © 2021 YAZHAI Inc. All rights reserved.
//
import UIKit
import GDToolBox
class GDLiveTimeView: BaseView {
var clickHandler: EmptyClosure?
// MARK: UI
private let bgImageView = UIImageView(image: GDShowRoomBundle.imageNamed("live_time_remain_bg"))
private let hourLabel = UILabel(frame: .zero)
private let minLabel = UILabel(frame: .zero)
private let secLabel = UILabel(frame: .zero)
override func makeUI() {
super.makeUI()
self.addSubview(bgImageView)
minLabel.textColor = .hexColor("7FFFF4")
minLabel.font = .gd_pingfang(10)
minLabel.text = "00"
self.addSubview(minLabel)
let label1 = UILabel(frame: .zero)
label1.text = ":"
label1.textColor = .hexColor("7FFFF4")
label1.font = .gd_pingfang(10)
self.addSubview(label1)
let label2 = UILabel(frame: .zero)
label2.text = ":"
label2.textColor = .hexColor("7FFFF4")
label2.font = .gd_pingfang(10)
self.addSubview(label2)
hourLabel.textColor = .hexColor("7FFFF4")
hourLabel.font = .gd_pingfang(10)
hourLabel.text = "00"
self.addSubview(hourLabel)
secLabel.textColor = .hexColor("7FFFF4")
secLabel.font = .gd_pingfang(10)
secLabel.text = "00"
self.addSubview(secLabel)
bgImageView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
minLabel.snp.makeConstraints { (make) in
make.center.equalToSuperview()
}
label1.snp.makeConstraints { (make) in
make.right.equalTo(minLabel.snp.left)
make.centerY.equalToSuperview()
}
label2.snp.makeConstraints { (make) in
make.left.equalTo(minLabel.snp.right)
make.centerY.equalToSuperview()
}
hourLabel.snp.makeConstraints { (make) in
make.right.equalTo(label1.snp.left)
make.centerY.equalToSuperview()
}
secLabel.snp.makeConstraints { (make) in
make.left.equalTo(label2.snp.right)
make.centerY.equalToSuperview()
}
}
// MARK: Data
override func bindViewModel() {
super.bindViewModel()
GDLiveHelper.shared.totalAddTime.subscribe(onNext: {[weak self] time in
if time == 0 {
self?.isHidden = true
} else {
self?.isHidden = false
let hour = time / (60 * 60)
let min = (time / 60) % 60
let sec = time % 60
self?.hourLabel.text = String(NSString(format: "%.2ld", hour))
self?.minLabel.text = String(NSString(format: "%.2ld", min))
self?.secLabel.text = String(NSString(format: "%.2ld", sec))
}
}).disposed(by: disposeBag)
self.addGestureRecognizer(UITapGestureRecognizer(actionBlock: {[weak self] (_) in
self?.clickHandler?()
}))
}
}
......@@ -75,7 +75,7 @@ class GDLiveFunctionViewModel: BaseViewModel, ViewModelType {
guard isValidString(roomModel.value.roomid) else { return }
GDShowRoomHttpHelper.shared.getLiveWishListData(for: roomModel.value.roomid).subscribe {[weak self] list in
self?.wishListData.accept(list)
} onError: { error in
} onFailure: { error in
GDlog.verbose()
}.disposed(by: self.disposeBag)
}
......
{
"images": [
{
"idiom": "universal",
"scale": "1x"
},
{
"filename": "live_time_base_bg.png",
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
\ No newline at end of file
{
"images": [
{
"idiom": "universal",
"scale": "1x"
},
{
"filename": "live_time_base_finish_bg.png",
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
\ No newline at end of file
{
"images": [
{
"idiom": "universal",
"scale": "1x"
},
{
"filename": "live_time_bg.png",
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
\ No newline at end of file
{
"images": [
{
"idiom": "universal",
"scale": "1x"
},
{
"filename": "live_time_icon_counting.png",
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
\ No newline at end of file
{
"images": [
{
"idiom": "universal",
"scale": "1x"
},
{
"filename": "live_time_icon_finish.png",
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
\ No newline at end of file
{
"images": [
{
"idiom": "universal",
"scale": "1x"
},
{
"filename": "live_time_icon_not_start.png",
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
\ No newline at end of file
{
"images": [
{
"idiom": "universal",
"scale": "1x"
},
{
"filename": "live_time_remain_bg.png",
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
\ No newline at end of file
{
"images": [
{
"idiom": "universal",
"scale": "1x"
},
{
"filename": "live_watch_time_guorou_icon.png",
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
\ No newline at end of file
{
"images": [
{
"idiom": "universal",
"scale": "1x"
},
{
"filename": "live_watch_time_huoyue_icon.png",
"idiom": "universal",
"scale": "2x"
},
{
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
\ No newline at end of file
......@@ -417,11 +417,12 @@ class GDShowRoomHttpHelper {
.mapToJSON()
}
func getLiveTimeCardInfo(for roomid: String) -> Single<GDLiveTimeRequestModel> {
showRoomProvider
.request(.getTimeCardInfo(roomid: roomid))
.mapToModel(type: GDLiveTimeRequestModel.self)
}
//TODO:直播时间: added By Pidan
// func getLiveTimeCardInfo(for roomid: String) -> Single<GDLiveTimeRequestModel> {
// showRoomProvider
// .request(.getTimeCardInfo(roomid: roomid))
// .mapToModel(type: GDLiveTimeRequestModel.self)
// }
/// 重连直播间
/// - Parameters:
......
......@@ -220,12 +220,13 @@ struct GDShowRoomSocketPublisher {
static let someoneBecomeGuard: Observable<JSON> = GDSocketCenter.publisher
.listenTo(GDShowRoomSocketCID.someoneBecomeGuard)
.mapToJSON()
// 收到延时卡变化
static let addTime: Observable<JSON> = GDSocketCenter.publisher
.listenTo(GDShowRoomSocketCID.addTime)
.mapToJSON()
/// 延时卡时间刷新
static let addTimeRefresh: Observable<JSON> = GDSocketCenter.publisher.listenTo(GDShowRoomSocketCID.addTimeRefresh).mapToJSON()
//TODO:直播时间: added By Pidan
// // 收到延时卡变化
// static let addTime: Observable<JSON> = GDSocketCenter.publisher
// .listenTo(GDShowRoomSocketCID.addTime)
// .mapToJSON()
// /// 延时卡时间刷新
// static let addTimeRefresh: Observable<JSON> = GDSocketCenter.publisher.listenTo(GDShowRoomSocketCID.addTimeRefresh).mapToJSON()
/// 心愿单数据变化socket
static let wishListDataChange: Observable<JSON> = GDSocketCenter.publisher.listenTo(GDShowRoomSocketCID.wishListDataChange).mapToJSON()
//TODO:珍爱团: added By Pidan
......
......@@ -318,6 +318,9 @@ class GDUserCenter: BaseViewModel {
if uid != "" && token != "" {
autoLogin = true // 允许自动登录
var user = GDUserCenter.shared.user.value
if user.uid != uid {
user = UserModel.getHistoryUser(uid: uid) ?? UserModel()
}
user.uuid = uuid
user.pwd = pwd
user.phone = phone
......@@ -326,8 +329,13 @@ class GDUserCenter: BaseViewModel {
GDUserCenter.shared.user.accept(user)
user.addToHistoryUser() // 保存或更新历史记录
}
case .setUserInfo(username: let username, avatar: let avatar, phone: let phone, activebonds: let activebonds, addr: let addr, age: let age, birth: let birth, bonds: let bonds, constellation: let constellation, diamond: let diamond, gold: let gold, isnew: let isnew, lev: let lev, level: let level, money: let money, nickname: let nickname, onlineTime: let onlineTime, roomId: let roomId, sex: let sex, showTime: let showTime, showNearby: let showNearby, invflag: let invflag, height: let height, weight: let weight, familyId: let familyId, family: let family, boss: let boss, fans: let fans, follows: let follows, let rich, let isNewUser, let createtime, let isPwd, let gorgeousNumber, let payDescription):
case .setUserInfo(uid: let uid, username: let username, avatar: let avatar, phone: let phone, activebonds: let activebonds, addr: let addr, age: let age, birth: let birth, bonds: let bonds, constellation: let constellation, diamond: let diamond, gold: let gold, isnew: let isnew, lev: let lev, level: let level, money: let money, nickname: let nickname, onlineTime: let onlineTime, roomId: let roomId, sex: let sex, showTime: let showTime, showNearby: let showNearby, invflag: let invflag, height: let height, weight: let weight, familyId: let familyId, family: let family, boss: let boss, fans: let fans, follows: let follows, let rich, let isNewUser, let createtime, let isPwd, let gorgeousNumber, let payDescription):
var user = GDUserCenter.shared.user.value
guard let uid = uid else { return }
/// 如果传进来的数据不是当前的账户,则不刷新
if user.uid != uid {
user = UserModel.getHistoryUser(uid: uid) ?? UserModel()
}
user.username = username == nil ? user.username : username!
user.avatar = avatar == nil ? user.avatar : avatar!
user.phone = phone == nil ? user.phone : phone!
......@@ -1162,6 +1170,9 @@ extension GDUserCenter {
switch result.code {
case 1:
// 用户id
let uid : String = result.json["user"]["uid"].stringValue
// 用户名
let username : String = result.json["user"]["nickname"].stringValue
......@@ -1263,7 +1274,7 @@ extension GDUserCenter {
let payDescription = result.json["extend"]["payDescription"].stringValue
GDUserCenter.reduce(action: .setUserInfo(username: username, avatar: avatar, phone: phone, activebonds: activebonds, addr: addr, age: age, birth: birth, bonds: bonds, constellation: constellation, diamond: diamond, gold: gold, isnew: isnew, lev: lev, level: level, money: money, nickname: nickname, onlineTime: onlineTime, roomId: roomId, sex: sex, showTime: showTime, showNearby: showNearby, invflag: invflag, height: height, weight: weight, familyId: familyId, family: family, boss: boss, fans: fans, follows: follows, rich: rich, isNewUser: isNewUser, createtime: createTime, isPwd: isPwd, gorgeousNumber: gorgeousNumber, payDescription: payDescription))
GDUserCenter.reduce(action: .setUserInfo(uid:uid, username: username, avatar: avatar, phone: phone, activebonds: activebonds, addr: addr, age: age, birth: birth, bonds: bonds, constellation: constellation, diamond: diamond, gold: gold, isnew: isnew, lev: lev, level: level, money: money, nickname: nickname, onlineTime: onlineTime, roomId: roomId, sex: sex, showTime: showTime, showNearby: showNearby, invflag: invflag, height: height, weight: weight, familyId: familyId, family: family, boss: boss, fans: fans, follows: follows, rich: rich, isNewUser: isNewUser, createtime: createTime, isPwd: isPwd, gorgeousNumber: gorgeousNumber, payDescription: payDescription))
single(.success(()))
default:
single(.failure(GDMoyaError(code: result.code, msg: result.msg)))
......
......@@ -20,6 +20,7 @@
BE352D0B299CE1D000FE07AB /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE352CE8299CD00900FE07AB /* Accelerate.framework */; };
BE352D0C299CE1D800FE07AB /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE352D02299CDFFA00FE07AB /* CoreMotion.framework */; };
BE377A842BF4C6C00067A973 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE377A832BF4C6C00067A973 /* CoreGraphics.framework */; };
BE4CFBE22BFF5DF20043389D /* GDDataManagerBundle.bundle in Embed PlugIns */ = {isa = PBXBuildFile; fileRef = BE4CFBDF2BFF5DE70043389D /* GDDataManagerBundle.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BE51BA652B5006F000D11735 /* GDBaseBussiness.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEDB6DD22B4FDE4A000B2451 /* GDBaseBussiness.framework */; };
BE51BA682B5006F400D11735 /* GDDataManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE6F41F52B47AD990058C826 /* GDDataManager.framework */; };
BE51BA6A2B5006F700D11735 /* GDLoginAndRegistModule.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB7BC4B2B4D72E000B3D9B1 /* GDLoginAndRegistModule.framework */; };
......@@ -58,6 +59,7 @@
dstPath = "";
dstSubfolderSpec = 7;
files = (
BE4CFBE22BFF5DF20043389D /* GDDataManagerBundle.bundle in Embed PlugIns */,
BE05B1772BF35EAA00FB71E4 /* GDShowRoomBundle.bundle in Embed PlugIns */,
BE854AE12BEF62FD0043F6BA /* GDShowRoomListBundle.bundle in Embed PlugIns */,
BE02A06D2BDBBDE100F79652 /* GDTeenagerBundle.bundle in Embed PlugIns */,
......@@ -108,6 +110,7 @@
BE352D0E299CE1E800FE07AB /* Router.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Router.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BE377A832BF4C6C00067A973 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
BE4AC9072B45681C0062EF42 /* GDUserInfoManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = GDUserInfoManager.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BE4CFBDF2BFF5DE70043389D /* GDDataManagerBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; path = GDDataManagerBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
BE595D35299E19C600F40C46 /* GDDataManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = GDDataManager.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BE595D39299E19CB00F40C46 /* GDDataManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = GDDataManager.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BE595D3C299E19D900F40C46 /* HostManager.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = HostManager.framework; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -223,6 +226,7 @@
8C945B4FCAACDD2D17AF8C17 /* Frameworks */ = {
isa = PBXGroup;
children = (
BE4CFBDF2BFF5DE70043389D /* GDDataManagerBundle.bundle */,
BE377A832BF4C6C00067A973 /* CoreGraphics.framework */,
BE05B4272BF45F8200FB71E4 /* GDShowRoomModule.framework */,
BE05B1702BF35E9400FB71E4 /* GDShowRoomBundle.bundle */,
......@@ -750,7 +754,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.0;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS -Xllvm -enable-bcfobf -Xllvm -enable-cffobf -Xllvm -enable-subobf -Xllvm -enable-strcry -Xllvm -enable-splitobf -Xllvm -bcf_prob=30 -Xllvm -bcf_loop=2";
OTHER_SWIFT_FLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.ft.chat.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment