Commit ccb8400c by pierce

首页修改

parent 0ecf0d15
...@@ -44,6 +44,8 @@ public protocol GDMomentModuleSwiftRouter: GDMomentModuleRouter { ...@@ -44,6 +44,8 @@ public protocol GDMomentModuleSwiftRouter: GDMomentModuleRouter {
/// - cancel: 是否取消 /// - cancel: 是否取消
/// - Returns: /// - Returns:
func likeMoment(with feedid: String?, commentid: String?, cancel: Bool) -> Single<JSON> func likeMoment(with feedid: String?, commentid: String?, cancel: Bool) -> Single<JSON>
func getFollowMomentList(with time: String, page: Int) -> Single<GDFollowMomentModel>
} }
public enum GDMomentType: Int { public enum GDMomentType: Int {
...@@ -159,3 +161,7 @@ public final class GDZoneContentMomentSpanModel: BaseModel { ...@@ -159,3 +161,7 @@ public final class GDZoneContentMomentSpanModel: BaseModel {
public var start: Int = 0 public var start: Int = 0
public var end: Int = 0 public var end: Int = 0
} }
public final class GDFollowMomentModel: BaseModel {
public var data: [GDMomentPlazaMomentModel] = []
}
...@@ -28,8 +28,8 @@ public let GDlog = XCGLogger(identifier: "xiuse.log.identifier", includeDefaultD ...@@ -28,8 +28,8 @@ public let GDlog = XCGLogger(identifier: "xiuse.log.identifier", includeDefaultD
public struct GDAppConfig { public struct GDAppConfig {
/// 版本 /// 版本
public static let gd_versionCode = "42000" public static let gd_versionCode = "43001"
public static let gd_version = "42.0.0.0" public static let gd_version = "42.0.0.1"
public static var realVersion: String { Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""} public static var realVersion: String { Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""}
/// App ID /// App ID
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
2FE4E790F30682BA15DC9333 /* Pods_GDMoment.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77A7D696349B5F762D1AD0E1 /* Pods_GDMoment.framework */; }; 2FE4E790F30682BA15DC9333 /* Pods_GDMoment.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77A7D696349B5F762D1AD0E1 /* Pods_GDMoment.framework */; };
BEA8EA802BECB09200162AD6 /* GDMomentPlazaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEA8EA7F2BECB09200162AD6 /* GDMomentPlazaView.swift */; };
BEA8EA942BECBED100162AD6 /* GDMomentFollowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEA8EA892BECBED100162AD6 /* GDMomentFollowView.swift */; };
BEA8EA952BECBED100162AD6 /* GDMomentFollowViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEA8EA8B2BECBED100162AD6 /* GDMomentFollowViewModel.swift */; };
BECDD3E32B67B67F00EE3649 /* GDMoment.h in Headers */ = {isa = PBXBuildFile; fileRef = BECDD3E22B67B67F00EE3649 /* GDMoment.h */; settings = {ATTRIBUTES = (Public, ); }; }; BECDD3E32B67B67F00EE3649 /* GDMoment.h in Headers */ = {isa = PBXBuildFile; fileRef = BECDD3E22B67B67F00EE3649 /* GDMoment.h */; settings = {ATTRIBUTES = (Public, ); }; };
BECDD3F32B67B6C700EE3649 /* GDMoment.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BECDD3F22B67B6C700EE3649 /* GDMoment.xcassets */; }; BECDD3F32B67B6C700EE3649 /* GDMoment.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BECDD3F22B67B6C700EE3649 /* GDMoment.xcassets */; };
BECDD3FD2B67BA2C00EE3649 /* GDMomentManagerAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECDD3F62B67BA2C00EE3649 /* GDMomentManagerAPI.swift */; }; BECDD3FD2B67BA2C00EE3649 /* GDMomentManagerAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = BECDD3F62B67BA2C00EE3649 /* GDMomentManagerAPI.swift */; };
...@@ -61,6 +64,9 @@ ...@@ -61,6 +64,9 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
5A51A8D062A2B56751E28398 /* Pods-GDMoment.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GDMoment.release.xcconfig"; path = "Target Support Files/Pods-GDMoment/Pods-GDMoment.release.xcconfig"; sourceTree = "<group>"; }; 5A51A8D062A2B56751E28398 /* Pods-GDMoment.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GDMoment.release.xcconfig"; path = "Target Support Files/Pods-GDMoment/Pods-GDMoment.release.xcconfig"; sourceTree = "<group>"; };
77A7D696349B5F762D1AD0E1 /* Pods_GDMoment.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GDMoment.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 77A7D696349B5F762D1AD0E1 /* Pods_GDMoment.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GDMoment.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BEA8EA7F2BECB09200162AD6 /* GDMomentPlazaView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GDMomentPlazaView.swift; sourceTree = "<group>"; };
BEA8EA892BECBED100162AD6 /* GDMomentFollowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDMomentFollowView.swift; sourceTree = "<group>"; };
BEA8EA8B2BECBED100162AD6 /* GDMomentFollowViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDMomentFollowViewModel.swift; sourceTree = "<group>"; };
BECDD3DF2B67B67F00EE3649 /* GDMoment.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GDMoment.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BECDD3DF2B67B67F00EE3649 /* GDMoment.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GDMoment.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BECDD3E22B67B67F00EE3649 /* GDMoment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GDMoment.h; sourceTree = "<group>"; }; BECDD3E22B67B67F00EE3649 /* GDMoment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GDMoment.h; sourceTree = "<group>"; };
BECDD3ED2B67B6A500EE3649 /* GDMomentBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GDMomentBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; BECDD3ED2B67B6A500EE3649 /* GDMomentBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GDMomentBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
...@@ -152,6 +158,39 @@ ...@@ -152,6 +158,39 @@
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
BEA8EA842BECBED100162AD6 /* Model */ = {
isa = PBXGroup;
children = (
);
path = Model;
sourceTree = "<group>";
};
BEA8EA8A2BECBED100162AD6 /* View */ = {
isa = PBXGroup;
children = (
BEA8EA892BECBED100162AD6 /* GDMomentFollowView.swift */,
);
path = View;
sourceTree = "<group>";
};
BEA8EA8C2BECBED100162AD6 /* ViewModel */ = {
isa = PBXGroup;
children = (
BEA8EA8B2BECBED100162AD6 /* GDMomentFollowViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
};
BEA8EA8D2BECBED100162AD6 /* Follow */ = {
isa = PBXGroup;
children = (
BEA8EA842BECBED100162AD6 /* Model */,
BEA8EA8A2BECBED100162AD6 /* View */,
BEA8EA8C2BECBED100162AD6 /* ViewModel */,
);
path = Follow;
sourceTree = "<group>";
};
BECDD3D52B67B67F00EE3649 = { BECDD3D52B67B67F00EE3649 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -299,8 +338,10 @@ ...@@ -299,8 +338,10 @@
BECDD44F2B67BB7900EE3649 /* View */ = { BECDD44F2B67BB7900EE3649 /* View */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
BEA8EA8D2BECBED100162AD6 /* Follow */,
BECDD4502B67BB7900EE3649 /* Cell */, BECDD4502B67BB7900EE3649 /* Cell */,
BECDD4552B67BB7900EE3649 /* GDMomentPlazaController.swift */, BECDD4552B67BB7900EE3649 /* GDMomentPlazaController.swift */,
BEA8EA7F2BECB09200162AD6 /* GDMomentPlazaView.swift */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -826,14 +867,17 @@ ...@@ -826,14 +867,17 @@
BECDD47B2B67BB7A00EE3649 /* GDMessageMomentDetailUserCell.swift in Sources */, BECDD47B2B67BB7A00EE3649 /* GDMessageMomentDetailUserCell.swift in Sources */,
BECDD4F42B67BE8000EE3649 /* GDZoneContentMomentCommentCell.swift in Sources */, BECDD4F42B67BE8000EE3649 /* GDZoneContentMomentCommentCell.swift in Sources */,
BECDD46B2B67BB7A00EE3649 /* GDTopicDetailModel.swift in Sources */, BECDD46B2B67BB7A00EE3649 /* GDTopicDetailModel.swift in Sources */,
BEA8EA952BECBED100162AD6 /* GDMomentFollowViewModel.swift in Sources */,
BECDD46D2B67BB7A00EE3649 /* GDTopicDetailMomentListCell.swift in Sources */, BECDD46D2B67BB7A00EE3649 /* GDTopicDetailMomentListCell.swift in Sources */,
BECDD4EF2B67BE8000EE3649 /* GDZoneContentMomentViewModel.swift in Sources */, BECDD4EF2B67BE8000EE3649 /* GDZoneContentMomentViewModel.swift in Sources */,
BECDD4F22B67BE8000EE3649 /* GDZoneConetntMomentCommentModel.swift in Sources */, BECDD4F22B67BE8000EE3649 /* GDZoneConetntMomentCommentModel.swift in Sources */,
BECDD46E2B67BB7A00EE3649 /* GDMomentPlazaViewModel.swift in Sources */, BECDD46E2B67BB7A00EE3649 /* GDMomentPlazaViewModel.swift in Sources */,
BECDD4722B67BB7A00EE3649 /* GDMomentPlazaTopicDetailCell.swift in Sources */, BECDD4722B67BB7A00EE3649 /* GDMomentPlazaTopicDetailCell.swift in Sources */,
BEA8EA802BECB09200162AD6 /* GDMomentPlazaView.swift in Sources */,
BECDD3FE2B67BA2C00EE3649 /* GDMomentManagerProvider.swift in Sources */, BECDD3FE2B67BA2C00EE3649 /* GDMomentManagerProvider.swift in Sources */,
BECDD4F52B67BE8000EE3649 /* GDZoneContentMomentImageCell.swift in Sources */, BECDD4F52B67BE8000EE3649 /* GDZoneContentMomentImageCell.swift in Sources */,
BECDD47A2B67BB7A00EE3649 /* GDMessageMomentDetailController.swift in Sources */, BECDD47A2B67BB7A00EE3649 /* GDMessageMomentDetailController.swift in Sources */,
BEA8EA942BECBED100162AD6 /* GDMomentFollowView.swift in Sources */,
BECDD4022B67BA2C00EE3649 /* GDMomentModule.swift in Sources */, BECDD4022B67BA2C00EE3649 /* GDMomentModule.swift in Sources */,
BECDD4752B67BB7A00EE3649 /* GDMomentImageBrowserView.swift in Sources */, BECDD4752B67BB7A00EE3649 /* GDMomentImageBrowserView.swift in Sources */,
BECDD4F32B67BE8000EE3649 /* GDZoneContentMomentCommentView.swift in Sources */, BECDD4F32B67BE8000EE3649 /* GDZoneContentMomentCommentView.swift in Sources */,
......
...@@ -795,3 +795,22 @@ extension GDMomentPlazaMomentModel: NetworkArrType { ...@@ -795,3 +795,22 @@ extension GDMomentPlazaMomentModel: NetworkArrType {
} }
} }
extension GDFollowMomentModel: NetworkModelType {
public static func createFrom(_ json: JSON) -> Self {
let model = GDFollowMomentModel()
model.data = json["data"].arrayValue.map({ dataJson in
GDMomentPlazaMomentModel.createFrom(dataJson)
}).map({ dataModel in
dataModel.isfollow = true
return dataModel
})
return model as! Self
}
}
//
// GDMomentFollowViewModel.swift
// TealiveSwift
//
// Created by Jim Chan on 2020/6/29.
// Copyright © 2020 YAZHAI Inc. All rights reserved.
//
import UIKit
import RxSwift
import RxCocoa
import Moya
import RealmSwift
import GDToolBox
import GDRouter
struct GDMomentFollowViewModelUDKey {
/// 关注的动态拉取的最新时间
static let followerMomentTime = "GDMomemtPlazafollowerMomentTime_"
}
class GDMomentFollowViewModel: BaseViewModel, ViewModelType {
// MARK: Public
var uid: String
let isMyFollow = BehaviorRelay<Bool>(value: false)
// MARK: Init
init(with uid: String) {
self.uid = uid
if self.uid == GDRouter.UserRouter?.uid {
isMyFollow.accept(true)
}
super.init()
}
// MARK: ViewModelType
struct Input {
let headRefreshAction: Driver<MJRefreshState>
let footRefreshAction: Driver<MJRefreshState>
let isOnDisplaying: Driver<Bool>
}
struct Output {
let refreshState: Driver<MJRefreshState>
}
// 页数
var loadMomentData = false
var momentPage = 1
let momentData = BehaviorRelay<[GDMomentPlazaMomentModel]>(value: [])
let momentRefreshState = BehaviorRelay<MJRefreshState>(value: .idle)
let refreshState = BehaviorRelay<MJRefreshState>(value: .idle)
/// 输入输出绑定转换
/// - Parameter input:
/// - Returns:
func transform(input: Input) -> Output {
let headRefreshSubject = PublishSubject<MJRefreshState>()
let footRefreshSubject = PublishSubject<MJRefreshState>()
// 下拉刷新
input.headRefreshAction.filter({ $0 == .refreshing }).drive(onNext: {[weak self] (state) in
guard let self = self else { return }
GDStatistics.track(.focusPushToRefresh)
self.requestMoment(with: 1)
GDStatistics.track(.myPageFollowPushToRefresh)
}).disposed(by: disposeBag)
input.footRefreshAction.filter({ $0 == .refreshing }).drive(onNext: {[weak self] (state) in
guard let self = self else { return }
GDStatistics.track(.focusPullToLoadMore)
self.requestMoment(with: self.momentPage + 1)
GDStatistics.track(.myPageFollowPullToLoadMore)
}).disposed(by: disposeBag)
let shouldReload = BehaviorRelay<Bool>(value: false)
// 订阅关注变化通知
GDNotification.listenTo(.followUserChange)
.map { _ in true }
.bind(to: shouldReload)
.disposed(by: disposeBag)
// 只要回到界面就进行刷新
Observable.combineLatest(input.isOnDisplaying.asObservable(), shouldReload.asObservable())
.subscribe(onNext: { (isOnDisplay, shouldReload) in
if (isOnDisplay && shouldReload) || isOnDisplay {
// 刷新数据
self.requestMoment(with: 1)
}
}).disposed(by: disposeBag)
// 请求错误处理
requsetError.subscribe(onNext: { error in
headRefreshSubject.onNext(.idle)
footRefreshSubject.onNext(.idle)
GDlog.error(error.code)
}).disposed(by: disposeBag)
GDRouter.UserRouter?.user.map { $0.uid }.distinctUntilChanged().skip(1).subscribe(onNext: {[weak self] uid in
if let uid = uid {
self?.uid = uid
self?.requestMoment(with: 1)
}
}).disposed(by: disposeBag)
return Output(refreshState: refreshState.asDriver())
}
override func setupViewModel() {
super.setupViewModel()
}
func requestMoment(with page: Int) {
// 只在非游客模式下请求
//TODO:游客模式: added By Pidan
// guard UserCenter.shared.isVisitor.value == false else { return }
guard loadMomentData == true else { return }
momentPage = page
var newestMomentTime = ""
if let recordTime = UserDefaults.standard.object(forKey: GDMomentFollowViewModelUDKey.followerMomentTime) as? String {
newestMomentTime = recordTime
}
GDMomentHttpHelper.shared.getFollowMomentList(with: newestMomentTime, page: momentPage).subscribe {[weak self] data in
guard let self = self else { return }
if data.data.count == 0 {
self.momentRefreshState.accept(.noMoreData)
} else {
self.momentRefreshState.accept(.idle)
}
if page == 1 {
self.momentData.accept(data.data)
if let time = data.data.first?.sendtime {
// 记录第一条的时间
UserDefaults.standard.setValue(time, forKey: GDMomentFollowViewModelUDKey.followerMomentTime + (GDRouter.UserRouter?.uid ?? ""))
}
} else {
var oldData = self.momentData.value
oldData.append(contentsOf: data.data)
self.momentData.accept(oldData)
}
} onFailure: {[weak self] error in
self?.momentRefreshState.accept(.idle)
}.disposed(by: disposeBag)
}
private var isLiking = false
func likeMoment(with model: GDMomentPlazaMomentModel) {
guard isLiking == false else { return }
var cancel = false
if model.isup.value == true {
cancel = true
}
GDMomentHttpHelper.shared.likeMoment(with: model.feedid, commentid: nil, cancel: cancel).subscribe {[weak self] json in
self?.isLiking = false
guard let self = self else { return }
let data = self.momentData.value
if let index = data.firstIndex(where: { $0.feedid == model.feedid }) {
if cancel {
data[index].isup.accept(false)
data[index].up.accept(data[index].up.value - 1)
} else {
data[index].likeActionUpdate = true
data[index].isup.accept(true)
data[index].up.accept(data[index].up.value + 1)
}
// self.momentsData.accept(data)
}
} onFailure: {[weak self] error in
self?.isLiking = false
guard let error = error as? GDMoyaError else {
FTIndicator.showToastMessage(GDMoyaError.networkError().msg)
return
}
FTIndicator.showToastMessage(error.msg)
}.disposed(by: disposeBag)
}
func checkMoment(with fid: String, feedid: String, success: ((Int) -> Void)?, failure: ((String, Int) -> Void)?) {
GDMomentHttpHelper.shared.checkMoment(with: fid, feedid: feedid).subscribe { json in
// 0=等待审核 1=审核通过 -1=审核未通过 -2=已被删除
let state = json["data"]["state"].intValue
success?(state)
} onFailure: { error in
guard let error = error as? GDMoyaError else {
failure?(GDMoyaError.networkError().msg, GDMoyaError.networkError().code)
return
}
failure?(error.msg, error.code)
}.disposed(by: disposeBag)
}
func deleteMoment(with feedid: String) {
FTIndicator.showProgress(withMessage: nil)
GDMomentHttpHelper.shared.deleteMoment(with: feedid).subscribe {[weak self] json in
FTIndicator.dismissProgress()
delay(0.5) {
FTIndicator.dismissProgress()
}
guard let self = self else { return }
var data = self.momentData.value
data.removeAll { $0.feedid == feedid }
self.momentData.accept(data)
} onFailure: { error in
FTIndicator.dismissProgress()
delay(0.5) {
FTIndicator.dismissProgress()
}
guard let error = error as? GDMoyaError else {
FTIndicator.showToastMessage(GDMoyaError.networkError().msg)
return
}
FTIndicator.showToastMessage(error.msg)
}.disposed(by: disposeBag)
}
/// 关注
func follow(_ uid: String, in feedid: String) {
GDRouter.UserZone?.follow(uid: uid).subscribe(onSuccess: {[weak self] (_) in
FTIndicator.showToastMessage("关注成功")
guard let self = self else { return }
let data = self.momentData.value
if let index = data.firstIndex(where: { $0.feedid == feedid }) {
data[index].isfollow = true
self.momentData.accept(data)
}
}, onFailure: { [weak self] (error) in
if let error = error as? GDMoyaError {
FTIndicator.showToastMessage(error.msg)
guard let self = self else { return }
if error.code == -11022 {
// 已经关注过该人
let data = self.momentData.value
if let index = data.firstIndex(where: { $0.feedid == feedid }) {
data[index].isfollow = true
self.momentData.accept(data)
}
}
} else {
FTIndicator.showToastMessage(GDMoyaError.networkError().msg)
}
}).disposed(by: disposeBag)
}
}
...@@ -136,6 +136,10 @@ class GDTopicDetailViewController: BaseViewController { ...@@ -136,6 +136,10 @@ class GDTopicDetailViewController: BaseViewController {
tableView.automaticallyAdjustsScrollIndicatorInsets = false tableView.automaticallyAdjustsScrollIndicatorInsets = false
} }
if #available(iOS 15.0, *) {
tableView.sectionHeaderTopPadding = 0
}
tableView.register(GDTopicDetailMomentListCell.self, forCellReuseIdentifier: reuseIdentifier) tableView.register(GDTopicDetailMomentListCell.self, forCellReuseIdentifier: reuseIdentifier)
self.view.addSubview(tableView) self.view.addSubview(tableView)
......
...@@ -144,6 +144,10 @@ import Bifrost ...@@ -144,6 +144,10 @@ import Bifrost
return GDMomentHttpHelper.shared.likeMoment(with: feedid, commentid: commentid, cancel: cancel) return GDMomentHttpHelper.shared.likeMoment(with: feedid, commentid: commentid, cancel: cancel)
} }
public func getFollowMomentList(with time: String, page: Int) -> Single<GDFollowMomentModel> {
GDMomentHttpHelper.shared.getFollowMomentList(with: time, page: page)
}
} }
extension GDMomentModule: GDRouterProtocol { extension GDMomentModule: GDRouterProtocol {
......
...@@ -144,4 +144,10 @@ class GDMomentHttpHelper { ...@@ -144,4 +144,10 @@ class GDMomentHttpHelper {
.request(.getAliossAuth) .request(.getAliossAuth)
.mapToModel(type: GDAliOSSModel.self) .mapToModel(type: GDAliOSSModel.self)
} }
func getFollowMomentList(with time: String, page: Int) -> Single<GDFollowMomentModel> {
momentProvider
.request(.getFollowMomentList(time: time, page: page, size: 20))
.mapToModel(type: GDFollowMomentModel.self)
}
} }
...@@ -42,6 +42,8 @@ enum GDMomentAPI { ...@@ -42,6 +42,8 @@ enum GDMomentAPI {
case getTopicDatail(tid: String) case getTopicDatail(tid: String)
/// 获取话题对应动态列表 /// 获取话题对应动态列表
case getTopicMomentList(tid: String, type: String, page: Int, size: Int) case getTopicMomentList(tid: String, type: String, page: Int, size: Int)
/// 获取关注主播的动态
case getFollowMomentList(time: String, page: Int, size: Int)
} }
extension GDMomentAPI: TargetType { extension GDMomentAPI: TargetType {
...@@ -120,6 +122,10 @@ extension GDMomentAPI: TargetType { ...@@ -120,6 +122,10 @@ extension GDMomentAPI: TargetType {
params["pageSize"] = 20 params["pageSize"] = 20
case let .createNewTopic(topicName): case let .createNewTopic(topicName):
params["feedTopicName"] = topicName params["feedTopicName"] = topicName
case let .getFollowMomentList(time, page, size):
params["time"] = time
params["page"] = page
params["size"] = size
} }
return params return params
} }
...@@ -156,6 +162,8 @@ extension GDMomentAPI: TargetType { ...@@ -156,6 +162,8 @@ extension GDMomentAPI: TargetType {
return "/feed/searchFeedTopic.html" return "/feed/searchFeedTopic.html"
case .createNewTopic: case .createNewTopic:
return "/feed/addFeedTopic.html" return "/feed/addFeedTopic.html"
case .getFollowMomentList:
return "/feed/follow.html"
} }
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
A2DB4E144D6FECC8B07E0D4E /* Pods_GDPersonalModule.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9BBAACE21BB804914CEBE3 /* Pods_GDPersonalModule.framework */; }; A2DB4E144D6FECC8B07E0D4E /* Pods_GDPersonalModule.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9BBAACE21BB804914CEBE3 /* Pods_GDPersonalModule.framework */; };
BE79DF1D2B68E37A0096B023 /* GDFollowMomentModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE79DF1C2B68E37A0096B023 /* GDFollowMomentModel.swift */; };
BE8041BE2B5B7B0800E2FCB4 /* GDPersonalModule.h in Headers */ = {isa = PBXBuildFile; fileRef = BE8041BD2B5B7B0800E2FCB4 /* GDPersonalModule.h */; settings = {ATTRIBUTES = (Public, ); }; }; BE8041BE2B5B7B0800E2FCB4 /* GDPersonalModule.h in Headers */ = {isa = PBXBuildFile; fileRef = BE8041BD2B5B7B0800E2FCB4 /* GDPersonalModule.h */; settings = {ATTRIBUTES = (Public, ); }; };
BE8041D52B5B7D2000E2FCB4 /* GDPersonalModuleSwiftLoadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8041CE2B5B7D2000E2FCB4 /* GDPersonalModuleSwiftLoadFile.m */; }; BE8041D52B5B7D2000E2FCB4 /* GDPersonalModuleSwiftLoadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8041CE2B5B7D2000E2FCB4 /* GDPersonalModuleSwiftLoadFile.m */; };
BE8041D62B5B7D2000E2FCB4 /* GDPersonalBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE8041CF2B5B7D2000E2FCB4 /* GDPersonalBundle.swift */; }; BE8041D62B5B7D2000E2FCB4 /* GDPersonalBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE8041CF2B5B7D2000E2FCB4 /* GDPersonalBundle.swift */; };
...@@ -69,7 +68,6 @@ ...@@ -69,7 +68,6 @@
23F12DF6A13863492FD551EB /* Pods-GDPersonalModule.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GDPersonalModule.release.xcconfig"; path = "Target Support Files/Pods-GDPersonalModule/Pods-GDPersonalModule.release.xcconfig"; sourceTree = "<group>"; }; 23F12DF6A13863492FD551EB /* Pods-GDPersonalModule.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GDPersonalModule.release.xcconfig"; path = "Target Support Files/Pods-GDPersonalModule/Pods-GDPersonalModule.release.xcconfig"; sourceTree = "<group>"; };
3BD5B3D2658920EA2B92331B /* Pods-GDPersonalModule.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GDPersonalModule.debug.xcconfig"; path = "Target Support Files/Pods-GDPersonalModule/Pods-GDPersonalModule.debug.xcconfig"; sourceTree = "<group>"; }; 3BD5B3D2658920EA2B92331B /* Pods-GDPersonalModule.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GDPersonalModule.debug.xcconfig"; path = "Target Support Files/Pods-GDPersonalModule/Pods-GDPersonalModule.debug.xcconfig"; sourceTree = "<group>"; };
8B9BBAACE21BB804914CEBE3 /* Pods_GDPersonalModule.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GDPersonalModule.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8B9BBAACE21BB804914CEBE3 /* Pods_GDPersonalModule.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GDPersonalModule.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BE79DF1C2B68E37A0096B023 /* GDFollowMomentModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GDFollowMomentModel.swift; sourceTree = "<group>"; };
BE8041BA2B5B7B0800E2FCB4 /* GDPersonalModule.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GDPersonalModule.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BE8041BA2B5B7B0800E2FCB4 /* GDPersonalModule.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GDPersonalModule.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BE8041BD2B5B7B0800E2FCB4 /* GDPersonalModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GDPersonalModule.h; sourceTree = "<group>"; }; BE8041BD2B5B7B0800E2FCB4 /* GDPersonalModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GDPersonalModule.h; sourceTree = "<group>"; };
BE8041C82B5B7C8B00E2FCB4 /* GDPersonalBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GDPersonalBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; BE8041C82B5B7C8B00E2FCB4 /* GDPersonalBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GDPersonalBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
...@@ -466,7 +464,6 @@ ...@@ -466,7 +464,6 @@
BE8042562B5B7FAF00E2FCB4 /* Follower */ = { BE8042562B5B7FAF00E2FCB4 /* Follower */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
BE79DF1C2B68E37A0096B023 /* GDFollowMomentModel.swift */,
BEEDDC4C2B5BB14F00AD9FEA /* ViewModel */, BEEDDC4C2B5BB14F00AD9FEA /* ViewModel */,
BE8042DC2B5B830500E2FCB4 /* FollowAnchorModel.swift */, BE8042DC2B5B830500E2FCB4 /* FollowAnchorModel.swift */,
BE8042572B5B7FAF00E2FCB4 /* FollowTableViewCell.swift */, BE8042572B5B7FAF00E2FCB4 /* FollowTableViewCell.swift */,
...@@ -916,7 +913,6 @@ ...@@ -916,7 +913,6 @@
BE80428A2B5B7FB000E2FCB4 /* GDMyPageFansModel.swift in Sources */, BE80428A2B5B7FB000E2FCB4 /* GDMyPageFansModel.swift in Sources */,
BE80428F2B5B7FB000E2FCB4 /* GDAuthVideoPlayController.swift in Sources */, BE80428F2B5B7FB000E2FCB4 /* GDAuthVideoPlayController.swift in Sources */,
BE8042D02B5B7FB100E2FCB4 /* GDMyPageModuleDailySignCell.swift in Sources */, BE8042D02B5B7FB100E2FCB4 /* GDMyPageModuleDailySignCell.swift in Sources */,
BE79DF1D2B68E37A0096B023 /* GDFollowMomentModel.swift in Sources */,
BE8042CC2B5B7FB100E2FCB4 /* GDMyPageFunctionModel.swift in Sources */, BE8042CC2B5B7FB100E2FCB4 /* GDMyPageFunctionModel.swift in Sources */,
BE80428B2B5B7FB000E2FCB4 /* GDMyPageFansCell.swift in Sources */, BE80428B2B5B7FB000E2FCB4 /* GDMyPageFansCell.swift in Sources */,
BE8041D92B5B7D2000E2FCB4 /* GDPersonalAPI.swift in Sources */, BE8041D92B5B7D2000E2FCB4 /* GDPersonalAPI.swift in Sources */,
......
//
// GDFollowMomentModel.swift
// TealiveSwift
//
// Created by Jim Chan on 2021/6/23.
// Copyright © 2021 YAZHAI Inc. All rights reserved.
//
import UIKit
import GDToolBox
import GDRouter
class GDFollowMomentModel: BaseModel, NetworkModelType {
var data: [GDMomentPlazaMomentModel] = []
static func createFrom(_ json: JSON) -> Self {
let model = GDFollowMomentModel()
model.data = json["data"].arrayValue.map({ dataJson in
GDMomentPlazaMomentModel.createFrom(dataJson)
}).map({ dataModel in
dataModel.isfollow = true
return dataModel
})
return model as! Self
}
}
...@@ -185,7 +185,7 @@ class FollowViewModel: BaseViewModel, ViewModelType { ...@@ -185,7 +185,7 @@ class FollowViewModel: BaseViewModel, ViewModelType {
newestMomentTime = recordTime newestMomentTime = recordTime
} }
GDPersonalHttpHelper.shared.getFollowMomentList(with: newestMomentTime, page: momentPage).subscribe {[weak self] data in GDRouter.Moment?.getFollowMomentList(with: newestMomentTime, page: momentPage).subscribe {[weak self] data in
guard let self = self else { return } guard let self = self else { return }
if data.data.count == 0 { if data.data.count == 0 {
......
...@@ -53,8 +53,6 @@ enum GDPersonalAPI { ...@@ -53,8 +53,6 @@ enum GDPersonalAPI {
case resetPassword(phone: String, verifyCode: String, pwd: String) case resetPassword(phone: String, verifyCode: String, pwd: String)
// 更改密码 // 更改密码
case changePassword(oldpwd: String, newPwd: String) case changePassword(oldpwd: String, newPwd: String)
/// 获取关注主播的动态
case getFollowMomentList(time: String, page: Int, size: Int)
} }
extension GDPersonalAPI: TargetType { extension GDPersonalAPI: TargetType {
...@@ -107,8 +105,6 @@ extension GDPersonalAPI: TargetType { ...@@ -107,8 +105,6 @@ extension GDPersonalAPI: TargetType {
return "/account/user/findpwdcap.html" return "/account/user/findpwdcap.html"
case .resetPassword: case .resetPassword:
return "/account/user/resetpassword.html" return "/account/user/resetpassword.html"
case .getFollowMomentList:
return "/feed/follow.html"
} }
} }
...@@ -159,10 +155,6 @@ extension GDPersonalAPI: TargetType { ...@@ -159,10 +155,6 @@ extension GDPersonalAPI: TargetType {
params["phone"] = phone params["phone"] = phone
params["verifycode"] = verifyCode params["verifycode"] = verifyCode
params["password"] = pwd params["password"] = pwd
case let .getFollowMomentList(time, page, size):
params["time"] = time
params["page"] = page
params["size"] = size
case .getSocialAccountInfo: case .getSocialAccountInfo:
break break
case .requestInviteCodeInfo: case .requestInviteCodeInfo:
......
...@@ -165,10 +165,4 @@ class GDPersonalHttpHelper { ...@@ -165,10 +165,4 @@ class GDPersonalHttpHelper {
.request(.resetPassword(phone: phone, verifyCode: verifyCode, pwd: pwd)) .request(.resetPassword(phone: phone, verifyCode: verifyCode, pwd: pwd))
.mapToJSON() .mapToJSON()
} }
func getFollowMomentList(with time: String, page: Int) -> Single<GDFollowMomentModel> {
personalProvider
.request(.getFollowMomentList(time: time, page: page, size: 20))
.mapToModel(type: GDFollowMomentModel.self)
}
} }
...@@ -27,9 +27,9 @@ class GDTabBarViewModel: BaseViewModel, ViewModelType { ...@@ -27,9 +27,9 @@ class GDTabBarViewModel: BaseViewModel, ViewModelType {
// Tabbar 数据 // Tabbar 数据
let elements: BehaviorRelay<[GDTabBarModel]> = BehaviorRelay<[GDTabBarModel]>(value: let elements: BehaviorRelay<[GDTabBarModel]> = BehaviorRelay<[GDTabBarModel]>(value:
[ [
GDTabBarModel.create(.moment),
GDTabBarModel.create(.message), GDTabBarModel.create(.message),
GDTabBarModel.create(.friend), GDTabBarModel.create(.friend),
GDTabBarModel.create(.moment),
GDTabBarModel.create(.me) GDTabBarModel.create(.me)
]) ])
...@@ -43,7 +43,7 @@ class GDTabBarViewModel: BaseViewModel, ViewModelType { ...@@ -43,7 +43,7 @@ class GDTabBarViewModel: BaseViewModel, ViewModelType {
override init() { override init() {
super.init() super.init()
// 默认选中 // 默认选中
select(.message) select(.moment)
} }
......
...@@ -615,7 +615,7 @@ ...@@ -615,7 +615,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.2;
PRODUCT_BUNDLE_IDENTIFIER = "Tech-TT.TealiveModule1"; PRODUCT_BUNDLE_IDENTIFIER = "Tech-TT.TealiveModule1";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
...@@ -707,7 +707,7 @@ ...@@ -707,7 +707,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.2;
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) -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";
PRODUCT_BUNDLE_IDENTIFIER = "Tech-TT.TealiveModule1"; PRODUCT_BUNDLE_IDENTIFIER = "Tech-TT.TealiveModule1";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
......
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