动态完成了

This commit is contained in:
fengshuo
2022-08-18 16:39:14 +08:00
parent 30d4e2f354
commit 0ac8ac5b51
37 changed files with 1739 additions and 9 deletions

View File

@@ -932,6 +932,16 @@
E8AA6EF227DF1E97009B4C2B /* XPRoomTopicPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AA6EF127DF1E97009B4C2B /* XPRoomTopicPresenter.m */; };
E8AB633328AE51470023B0D2 /* XPSailingPrizeView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB633228AE51470023B0D2 /* XPSailingPrizeView.m */; };
E8AB633628AE54A40023B0D2 /* XPSailingPrizeCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB633528AE54A40023B0D2 /* XPSailingPrizeCollectionViewCell.m */; };
E8AB630D28ADD8C60023B0D2 /* XPMonentTopicContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB630C28ADD8C60023B0D2 /* XPMonentTopicContainerViewController.m */; };
E8AB631028ADD92D0023B0D2 /* XPMonentsTopicRecommondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB630F28ADD92D0023B0D2 /* XPMonentsTopicRecommondViewController.m */; };
E8AB631328ADDCF20023B0D2 /* XPMonentsTopicHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB631228ADDCF20023B0D2 /* XPMonentsTopicHeaderView.m */; };
E8AB631628ADE2D20023B0D2 /* XPMonentsTopicLatestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB631528ADE2D20023B0D2 /* XPMonentsTopicLatestViewController.m */; };
E8AB631928ADE2F40023B0D2 /* XPMonentsTopicRecommendPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB631828ADE2F40023B0D2 /* XPMonentsTopicRecommendPresenter.m */; };
E8AB631C28ADE30E0023B0D2 /* XPMonentsTopicLatestPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB631B28ADE30E0023B0D2 /* XPMonentsTopicLatestPresenter.m */; };
E8AB632428AE10310023B0D2 /* XPMoentsTopicListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB632328AE10310023B0D2 /* XPMoentsTopicListViewController.m */; };
E8AB632728AE13210023B0D2 /* XPMonentsTopicListPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB632628AE13210023B0D2 /* XPMonentsTopicListPresenter.m */; };
E8AB632C28AE19600023B0D2 /* XPMonentsMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB632B28AE19600023B0D2 /* XPMonentsMineViewController.m */; };
E8AB632F28AE19DE0023B0D2 /* XPMonentMinePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AB632E28AE19DE0023B0D2 /* XPMonentMinePresenter.m */; };
E8AC721026F43955007D6E91 /* UIImageConstant.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AC720F26F43955007D6E91 /* UIImageConstant.m */; };
E8AC721326F46ADD007D6E91 /* XPMineSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AC721226F46ADD007D6E91 /* XPMineSettingViewController.m */; };
E8AC721626F46B06007D6E91 /* XPMineSettingTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AC721526F46B06007D6E91 /* XPMineSettingTableViewCell.m */; };
@@ -2853,6 +2863,30 @@
E8AB633228AE51470023B0D2 /* XPSailingPrizeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSailingPrizeView.m; sourceTree = "<group>"; };
E8AB633428AE54A40023B0D2 /* XPSailingPrizeCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSailingPrizeCollectionViewCell.h; sourceTree = "<group>"; };
E8AB633528AE54A40023B0D2 /* XPSailingPrizeCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSailingPrizeCollectionViewCell.m; sourceTree = "<group>"; };
E8AB630B28ADD8C60023B0D2 /* XPMonentTopicContainerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentTopicContainerViewController.h; sourceTree = "<group>"; };
E8AB630C28ADD8C60023B0D2 /* XPMonentTopicContainerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentTopicContainerViewController.m; sourceTree = "<group>"; };
E8AB630E28ADD92D0023B0D2 /* XPMonentsTopicRecommondViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsTopicRecommondViewController.h; sourceTree = "<group>"; };
E8AB630F28ADD92D0023B0D2 /* XPMonentsTopicRecommondViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsTopicRecommondViewController.m; sourceTree = "<group>"; };
E8AB631128ADDCF20023B0D2 /* XPMonentsTopicHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsTopicHeaderView.h; sourceTree = "<group>"; };
E8AB631228ADDCF20023B0D2 /* XPMonentsTopicHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsTopicHeaderView.m; sourceTree = "<group>"; };
E8AB631428ADE2D20023B0D2 /* XPMonentsTopicLatestViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsTopicLatestViewController.h; sourceTree = "<group>"; };
E8AB631528ADE2D20023B0D2 /* XPMonentsTopicLatestViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsTopicLatestViewController.m; sourceTree = "<group>"; };
E8AB631728ADE2F40023B0D2 /* XPMonentsTopicRecommendPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsTopicRecommendPresenter.h; sourceTree = "<group>"; };
E8AB631828ADE2F40023B0D2 /* XPMonentsTopicRecommendPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsTopicRecommendPresenter.m; sourceTree = "<group>"; };
E8AB631A28ADE30E0023B0D2 /* XPMonentsTopicLatestPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsTopicLatestPresenter.h; sourceTree = "<group>"; };
E8AB631B28ADE30E0023B0D2 /* XPMonentsTopicLatestPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsTopicLatestPresenter.m; sourceTree = "<group>"; };
E8AB632028ADE5720023B0D2 /* XPMonentsTopicRecommendProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsTopicRecommendProtocol.h; sourceTree = "<group>"; };
E8AB632128ADE5880023B0D2 /* XPMonentsTopicLatestProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsTopicLatestProtocol.h; sourceTree = "<group>"; };
E8AB632228AE10310023B0D2 /* XPMoentsTopicListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMoentsTopicListViewController.h; sourceTree = "<group>"; };
E8AB632328AE10310023B0D2 /* XPMoentsTopicListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMoentsTopicListViewController.m; sourceTree = "<group>"; };
E8AB632528AE13210023B0D2 /* XPMonentsTopicListPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsTopicListPresenter.h; sourceTree = "<group>"; };
E8AB632628AE13210023B0D2 /* XPMonentsTopicListPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsTopicListPresenter.m; sourceTree = "<group>"; };
E8AB632928AE15070023B0D2 /* XPMonentsTopicListProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsTopicListProtocol.h; sourceTree = "<group>"; };
E8AB632A28AE19600023B0D2 /* XPMonentsMineViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsMineViewController.h; sourceTree = "<group>"; };
E8AB632B28AE19600023B0D2 /* XPMonentsMineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsMineViewController.m; sourceTree = "<group>"; };
E8AB632D28AE19DE0023B0D2 /* XPMonentMinePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentMinePresenter.h; sourceTree = "<group>"; };
E8AB632E28AE19DE0023B0D2 /* XPMonentMinePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentMinePresenter.m; sourceTree = "<group>"; };
E8AB633028AE19FA0023B0D2 /* XPMonentsMineProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsMineProtocol.h; sourceTree = "<group>"; };
E8AC720E26F43955007D6E91 /* UIImageConstant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIImageConstant.h; sourceTree = "<group>"; };
E8AC720F26F43955007D6E91 /* UIImageConstant.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIImageConstant.m; sourceTree = "<group>"; };
E8AC721126F46ADD007D6E91 /* XPMineSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineSettingViewController.h; sourceTree = "<group>"; };
@@ -5520,6 +5554,10 @@
E81A65432835121000F55894 /* XPMonentsInteractiveProtocol.h */,
E8541036286443D8005CFD9F /* XPMonentsDetailProtocol.h */,
E818E34C286ECAD8005EDF68 /* XPMonentsPublishProtocol.h */,
E8AB632028ADE5720023B0D2 /* XPMonentsTopicRecommendProtocol.h */,
E8AB632128ADE5880023B0D2 /* XPMonentsTopicLatestProtocol.h */,
E8AB632928AE15070023B0D2 /* XPMonentsTopicListProtocol.h */,
E8AB633028AE19FA0023B0D2 /* XPMonentsMineProtocol.h */,
);
path = Protocol;
sourceTree = "<group>";
@@ -5541,6 +5579,14 @@
E85410342864155A005CFD9F /* XPMonentDetailPresenter.m */,
E818E349286ECABF005EDF68 /* XPMonentsPublishPresenter.h */,
E818E34A286ECABF005EDF68 /* XPMonentsPublishPresenter.m */,
E8AB631728ADE2F40023B0D2 /* XPMonentsTopicRecommendPresenter.h */,
E8AB631828ADE2F40023B0D2 /* XPMonentsTopicRecommendPresenter.m */,
E8AB631A28ADE30E0023B0D2 /* XPMonentsTopicLatestPresenter.h */,
E8AB631B28ADE30E0023B0D2 /* XPMonentsTopicLatestPresenter.m */,
E8AB632528AE13210023B0D2 /* XPMonentsTopicListPresenter.h */,
E8AB632628AE13210023B0D2 /* XPMonentsTopicListPresenter.m */,
E8AB632D28AE19DE0023B0D2 /* XPMonentMinePresenter.h */,
E8AB632E28AE19DE0023B0D2 /* XPMonentMinePresenter.m */,
);
path = Presenter;
sourceTree = "<group>";
@@ -5564,6 +5610,16 @@
E852D73A286317F0001465ED /* XPMonentsDetailViewController.m */,
E818E346286ECA4B005EDF68 /* XPMonentsPublishViewController.h */,
E818E347286ECA4B005EDF68 /* XPMonentsPublishViewController.m */,
E8AB630B28ADD8C60023B0D2 /* XPMonentTopicContainerViewController.h */,
E8AB630C28ADD8C60023B0D2 /* XPMonentTopicContainerViewController.m */,
E8AB630E28ADD92D0023B0D2 /* XPMonentsTopicRecommondViewController.h */,
E8AB630F28ADD92D0023B0D2 /* XPMonentsTopicRecommondViewController.m */,
E8AB631428ADE2D20023B0D2 /* XPMonentsTopicLatestViewController.h */,
E8AB631528ADE2D20023B0D2 /* XPMonentsTopicLatestViewController.m */,
E8AB632228AE10310023B0D2 /* XPMoentsTopicListViewController.h */,
E8AB632328AE10310023B0D2 /* XPMoentsTopicListViewController.m */,
E8AB632A28AE19600023B0D2 /* XPMonentsMineViewController.h */,
E8AB632B28AE19600023B0D2 /* XPMonentsMineViewController.m */,
);
path = View;
sourceTree = "<group>";
@@ -7749,6 +7805,8 @@
E8B9842F28AB90200022D026 /* XPMoentsTopicListView.m */,
E8B9843428ABA8B40022D026 /* XPMonentPublishSuccessView.h */,
E8B9843528ABA8B40022D026 /* XPMonentPublishSuccessView.m */,
E8AB631128ADDCF20023B0D2 /* XPMonentsTopicHeaderView.h */,
E8AB631228ADDCF20023B0D2 /* XPMonentsTopicHeaderView.m */,
);
path = SubViews;
sourceTree = "<group>";
@@ -8694,6 +8752,7 @@
E824545E26F5EF2200BE8163 /* XPMineVerifIdentityProtocol.h in Sources */,
E824545326F5CEAD00BE8163 /* XPMineModifPayProtocol.h in Sources */,
E84BF7D7277C6E2100EF8877 /* XPRoomRoleViewController.m in Sources */,
E8AB631328ADDCF20023B0D2 /* XPMonentsTopicHeaderView.m in Sources */,
9B86D886281942D200494FCD /* SocialMicroView.m in Sources */,
E8664ED027E42238000171BA /* XPRoomPKTimePickerView.m in Sources */,
E824544826F5945300BE8163 /* XPMinePayPwdProtocol.h in Sources */,
@@ -8767,6 +8826,7 @@
9BEE3D1727858E5700C83219 /* XPNobleAuthorityDescView.m in Sources */,
E8834E3227FFD64F0029CCC1 /* GuildAuthModel.m in Sources */,
E82325F9274E2E42003A3332 /* Api+UserCard.m in Sources */,
E8AB632F28AE19DE0023B0D2 /* XPMonentMinePresenter.m in Sources */,
9BD9A17C27A0EE24004186FE /* XPMineVisitorViewController.m in Sources */,
E82109B026F1D83500FC3319 /* LoginBindPhonePresent.m in Sources */,
E81C1B1F27705F7A0020D1E4 /* XPArrangeMicViewController.m in Sources */,
@@ -8821,6 +8881,7 @@
E8AC723D26F4B6AA007D6E91 /* XPLoginBindPhoneResultViewController.m in Sources */,
E800806527FD37A20055A8AB /* XPGuildHeaderView.m in Sources */,
9B2A12D52783EEC700CED41B /* XPNobleCenterTableHeadView.m in Sources */,
E8AB632728AE13210023B0D2 /* XPMonentsTopicListPresenter.m in Sources */,
9BEE3D11278584FE00C83219 /* XPNobleCenterEmptyView.m in Sources */,
E8D55C9D28113218006935A5 /* MessageMenuModel.m in Sources */,
9BCF585F27995363008401A4 /* XPSkillCardSelectPropView.m in Sources */,
@@ -8940,11 +9001,13 @@
E88C72912828EA4E0047FB2B /* Music+CoreDataProperties.m in Sources */,
E84BF7CA277AF79D00EF8877 /* XPRoomSettingTagCell.m in Sources */,
9BE9F0F927FED12D00667200 /* XPAnchorFansPrivilegeModel.m in Sources */,
E8AB631628ADE2D20023B0D2 /* XPMonentsTopicLatestViewController.m in Sources */,
E8B846CF26FDD96100A777FE /* XPMineRechageHeadView.m in Sources */,
E852D74728633E92001465ED /* MonentsCommentReplyModel.m in Sources */,
186A534926FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m in Sources */,
E8B3E80C2848BA40009746AB /* NewUserGreetModel.m in Sources */,
E81C27AE26EF39AB0031E639 /* AppDelegate+ThirdConfig.m in Sources */,
E8AB631028ADD92D0023B0D2 /* XPMonentsTopicRecommondViewController.m in Sources */,
E877A7F127842B2F00EFACED /* XPRoomDatingWebAlertView.m in Sources */,
E80016382804140D00D6D17A /* XPMineGuildIncomeStatisViewController.m in Sources */,
E8E859C728264C2300EE4857 /* HTTPRedirectResponse.m in Sources */,
@@ -9052,6 +9115,7 @@
E81C27A026EEF83D0031E639 /* XPHtmlUrl.m in Sources */,
E8F1558D28124D5200EE8C06 /* MessageConentAudioView.m in Sources */,
E8E20BDB281645300033B688 /* SessionInfoViewController.m in Sources */,
E8AB631C28ADE30E0023B0D2 /* XPMonentsTopicLatestPresenter.m in Sources */,
E8E859CA28264C2300EE4857 /* WebSocket.m in Sources */,
E8098CB4282E97550090B9F0 /* XPMineBlackListPresenter.m in Sources */,
E8E859CC28264C2300EE4857 /* MultipartFormDataParser.m in Sources */,
@@ -9113,6 +9177,7 @@
9B92A3662798132600AD168F /* XPSkillCardTypeView.m in Sources */,
9B1B72B828003772003FACE9 /* XPAnchorPKPresenter.m in Sources */,
E8EE827D272B9A2300A17217 /* XPRoomSendTextView.m in Sources */,
E8AB631928ADE2F40023B0D2 /* XPMonentsTopicRecommendPresenter.m in Sources */,
9BD63FAE277EE97A006EB744 /* XPReleaseRadioPresenter.m in Sources */,
9B1FC3D827E49C36006EFFE0 /* XPMineDressBubbleCollectionViewCell.m in Sources */,
9BE01AEA2893CB4400B50299 /* XPDressSearchViewController.m in Sources */,
@@ -9266,6 +9331,7 @@
E8AC723A26F49AAE007D6E91 /* XPMineNotifyStatus.m in Sources */,
18E7B33226F317A20064BC9B /* XPWebViewController.m in Sources */,
E8AEAEF927141CA30017FCE0 /* RoomHeaderView.m in Sources */,
E8AB632428AE10310023B0D2 /* XPMoentsTopicListViewController.m in Sources */,
E8098CAA282E03B40090B9F0 /* XPMonentsRecommendPresenter.m in Sources */,
9B1B729828002147003FACE9 /* XPMineFansTeamPresenter.m in Sources */,
E86507E8281A8212006951B0 /* ContentTweetModel.m in Sources */,
@@ -9311,6 +9377,7 @@
18486213271EA9DA005FC5DC /* RtcManager.m in Sources */,
E8D34D5628080393009C4835 /* XPMineDataGiftCollectionViewCell.m in Sources */,
186A536926FC6F2E00D67B2C /* XPShareView.m in Sources */,
E8AB632C28AE19600023B0D2 /* XPMonentsMineViewController.m in Sources */,
E87AE8C1284E184300CAFBB3 /* RoomNewUserGreetModel.m in Sources */,
9BC5C91C277C8A7B007C8719 /* XPReleaseRadioViewController.m in Sources */,
186A534C26FC6ED900D67B2C /* TTAlertView.m in Sources */,
@@ -9330,6 +9397,7 @@
E87AE7FC277AAC450037823A /* XPRoomTagPresenter.m in Sources */,
E878894C273A607C00BF1D57 /* XPGiftUserCollectionViewCell.m in Sources */,
181D7F212727D9DB00B7C059 /* SocialStageView.m in Sources */,
E8AB630D28ADD8C60023B0D2 /* XPMonentTopicContainerViewController.m in Sources */,
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */,
9BFE0D8E2898C8C300F53C24 /* XPAnchorCardSkillCollectionViewCell.m in Sources */,
E8998D852859B4FA00C68558 /* XPMineUserInfoGiftView.m in Sources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "monents_topic_camera@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "monents_topic_camera@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -123,6 +123,38 @@ NS_ASSUME_NONNULL_BEGIN
/// @param content 内容
/// @param resList 发布的图片
+ (void)monentsPublish:(HttpRequestHelperCompletion)completion uid:(NSString *)uid type:(NSString *)type worldId:(NSString *)worldId content:(NSString *)content resList:(NSArray *)resList;
/// 获取动态话题最新记录
/// @param completion 完成
/// @param uid 用户的uid
/// @param dynamicId 下一页动态的id
/// @param types l类型
/// @param worldId 话题的id
/// @param pageSize 一页多少个
+ (void)monentsTopicLatestList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid dynamicId:(NSString *)dynamicId types:(NSString *)types worldId:(NSString *)worldId pageSize:(NSString *)pageSize;
/// 获取动态话题推荐记录
/// @param completion 完成
/// @param uid 用户的uid
/// @param dynamicId 下一页动态的id
/// @param types l类型
/// @param worldId 话题的id
/// @param pageSize 一页多少个
+ (void)monentsTopicRecommendList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid dynamicId:(NSString *)dynamicId types:(NSString *)types worldId:(NSString *)worldId pageSize:(NSString *)pageSize;
/// 获取动态话题详情
/// @param completion 完成
/// @param worldId 话题id
/// @param uid 用户uid
+ (void)monentsTopicDetailInfo:(HttpRequestHelperCompletion)completion worldId:(NSString *)worldId uid:(NSString *)uid;
/// 获取动态话题列表
/// @param completion 完成
/// @param uid uid
/// @param page 当前的页数
/// @param pageSize 一页多少个
/// @param worldTypeId 类型
+ (void)moentsTopicList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize worldTypeId:(NSString *)worldTypeId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -178,4 +178,61 @@
[HttpRequestHelper postSkillCard:@"dynamic/publish" params:dic.toJSONString completion:completion];
}
///
/// @param completion
/// @param uid uid
/// @param dynamicId id
/// @param types l
/// @param worldId id
/// @param pageSize
+ (void)monentsTopicLatestList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid dynamicId:(NSString *)dynamicId types:(NSString *)types worldId:(NSString *)worldId pageSize:(NSString *)pageSize {
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic setValue:uid forKey:@"uid"];
[dic setValue:types forKey:@"types"];
[dic setValue:worldId forKey:@"worldId"];
[dic setValue:pageSize forKey:@"pageSize"];
if (dynamicId.length > 0) {
[dic setValue:dynamicId forKey:@"dynamicId"];
}
[HttpRequestHelper request:@"dynamic/latestList" method:HttpRequestHelperMethodPOST params:dic completion:completion];
}
///
/// @param completion
/// @param uid uid
/// @param dynamicId id
/// @param types l
/// @param worldId id
/// @param pageSize
+ (void)monentsTopicRecommendList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid dynamicId:(NSString *)dynamicId types:(NSString *)types worldId:(NSString *)worldId pageSize:(NSString *)pageSize {
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic setValue:uid forKey:@"uid"];
[dic setValue:types forKey:@"types"];
[dic setValue:worldId forKey:@"worldId"];
[dic setValue:pageSize forKey:@"pageSize"];
if (dynamicId.length > 0) {
[dic setValue:dynamicId forKey:@"dynamicId"];
}
[HttpRequestHelper request:@"dynamic/listV2" method:HttpRequestHelperMethodPOST params:dic completion:completion];
}
///
/// @param completion
/// @param worldId id
/// @param uid uid
+ (void)monentsTopicDetailInfo:(HttpRequestHelperCompletion)completion worldId:(NSString *)worldId uid:(NSString *)uid{
[self makeRequest:@"world/detail" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,worldId, uid, nil];
}
///
/// @param completion
/// @param uid uid
/// @param page
/// @param pageSize
/// @param worldTypeId
+ (void)moentsTopicList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize worldTypeId:(NSString *)worldTypeId {
[self makeRequest:@"world/list" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, page, pageSize, worldTypeId, nil];
}
@end

View File

@@ -10,7 +10,7 @@
@implementation MonentsTopicModel
+ (NSDictionary *)replacedKeyFromPropertyName {
return @{@"tid":@"id", @"desc":@"description"};
return @{@"tId":@"id", @"desc":@"description"};
}
@end

View File

@@ -0,0 +1,21 @@
//
// XPMonentMinePresenter.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMonentMinePresenter : BaseMvpPresenter
/// 动态点赞
/// @param dynamicId 动态id
/// @param status yes 点赞 NO 取消
/// @param likedUid 点赞人的uid
/// @param worldId 话题的id
- (void)likeMonent:(NSString *)dynamicId status:(BOOL)status likedUid:(NSString *)likedUid worldId:(NSString *)worldId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,28 @@
//
// XPMonentMinePresenter.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentMinePresenter.h"
#import "Api+Monents.h"
#import "XPMonentsMineProtocol.h"
#import "AccountInfoStorage.h"
@implementation XPMonentMinePresenter
///
/// @param dynamicId id
/// @param status yes NO
/// @param likedUid uid
/// @param worldId id
- (void)likeMonent:(NSString *)dynamicId status:(BOOL)status likedUid:(NSString *)likedUid worldId:(NSString *)worldId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * statusStr = status ? @"1" : @"0";
[Api monentsLike:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] likeMonentsSuccess:dynamicId status:status];
} showLoading:YES] dynamicId:dynamicId uid:uid status:statusStr likedUid:likedUid worldId:worldId];
}
@end

View File

@@ -0,0 +1,23 @@
//
// XPMonentsTopicLatestPresenter.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMonentsTopicLatestPresenter : BaseMvpPresenter
- (void)getMonentsTopicLatestList:(NSString *)dynamicId worldId:(NSString *)worldId state:(int)state;
/// 动态点赞
/// @param dynamicId 动态id
/// @param status yes 点赞 NO 取消
/// @param likedUid 点赞人的uid
/// @param worldId 话题的id
- (void)likeMonent:(NSString *)dynamicId status:(BOOL)status likedUid:(NSString *)likedUid worldId:(NSString *)worldId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,37 @@
//
// XPMonentsTopicLatestPresenter.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentsTopicLatestPresenter.h"
#import "Api+Monents.h"
#import "AccountInfoStorage.h"
#import "MonentsListInfoModel.h"
#import "XPMonentsTopicLatestProtocol.h"
@implementation XPMonentsTopicLatestPresenter
- (void)getMonentsTopicLatestList:(NSString *)dynamicId worldId:(NSString *)worldId state:(int)state {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api monentsTopicRecommendList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
MonentsListInfoModel * model = [MonentsListInfoModel modelWithDictionary:data.data];
[[self getView] getMonentsTopicLatestListSuccess:model state:state];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getMonentsTopicLatestListFail:msg state:state];
}] uid:uid dynamicId:dynamicId types:@"0,2" worldId:worldId pageSize:@"20"];
}
///
/// @param dynamicId id
/// @param status yes NO
/// @param likedUid uid
/// @param worldId id
- (void)likeMonent:(NSString *)dynamicId status:(BOOL)status likedUid:(NSString *)likedUid worldId:(NSString *)worldId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * statusStr = status ? @"1" : @"0";
[Api monentsLike:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] likeMonentsSuccess:dynamicId status:status];
} showLoading:YES] dynamicId:dynamicId uid:uid status:statusStr likedUid:likedUid worldId:worldId];
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPMonentsTopicListPresenter.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMonentsTopicListPresenter : BaseMvpPresenter
- (void)getMoentsTopicList:(int)page pageSize:(int)pageSize state:(int)state;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,28 @@
//
// XPMonentsTopicListPresenter.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentsTopicListPresenter.h"
#import "Api+Monents.h"
#import "AccountInfoStorage.h"
#import "MonentsTopicModel.h"
#import "XPMonentsTopicListProtocol.h"
@implementation XPMonentsTopicListPresenter
- (void)getMoentsTopicList:(int)page pageSize:(int)pageSize state:(int)state {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * pageStr = [NSString stringWithFormat:@"%d", page];
NSString * pageSizeStr = [NSString stringWithFormat:@"%d", pageSize];
[Api moentsTopicList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray * array = [MonentsTopicModel modelsWithArray:data.data[@"records"]];
[[self getView] getMonentsTopicListSuccess:array state:state];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getMoentsTopicFail:msg state:state];
}] uid:uid page:pageStr pageSize:pageSizeStr worldTypeId:@"0"];
}
@end

View File

@@ -0,0 +1,23 @@
//
// XPMonentsTopicRecommendPresenter.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMonentsTopicRecommendPresenter : BaseMvpPresenter
- (void)getMonentsTopicRecommendList:(NSString *)dynamicId worldId:(NSString *)worldId state:(int)state;
/// 动态点赞
/// @param dynamicId 动态id
/// @param status yes 点赞 NO 取消
/// @param likedUid 点赞人的uid
/// @param worldId 话题的id
- (void)likeMonent:(NSString *)dynamicId status:(BOOL)status likedUid:(NSString *)likedUid worldId:(NSString *)worldId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,37 @@
//
// XPMonentsTopicRecommendPresenter.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentsTopicRecommendPresenter.h"
#import "Api+Monents.h"
#import "AccountInfoStorage.h"
#import "MonentsListInfoModel.h"
#import "XPMonentsTopicRecommendProtocol.h"
@implementation XPMonentsTopicRecommendPresenter
- (void)getMonentsTopicRecommendList:(NSString *)dynamicId worldId:(NSString *)worldId state:(int)state {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api monentsTopicRecommendList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
MonentsListInfoModel * model = [MonentsListInfoModel modelWithDictionary:data.data];
[[self getView] getMonentsTopicRecommendListSuccess:model state:state];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getMonentsTopicRecommendListFail:msg state:state];
}] uid:uid dynamicId:dynamicId types:@"0,2" worldId:worldId pageSize:@"20"];
}
///
/// @param dynamicId id
/// @param status yes NO
/// @param likedUid uid
/// @param worldId id
- (void)likeMonent:(NSString *)dynamicId status:(BOOL)status likedUid:(NSString *)likedUid worldId:(NSString *)worldId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * statusStr = status ? @"1" : @"0";
[Api monentsLike:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] likeMonentsSuccess:dynamicId status:status];
} showLoading:YES] dynamicId:dynamicId uid:uid status:statusStr likedUid:likedUid worldId:worldId];
}
@end

View File

@@ -0,0 +1,17 @@
//
// XPMonentsMineProtocol.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol XPMonentsMineProtocol <NSObject>
///点赞/取消动态成功
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,21 @@
//
// XPMonentsTopicLatestProtocol.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MonentsListInfoModel;
@protocol XPMonentsTopicLatestProtocol <NSObject>
- (void)getMonentsTopicLatestListSuccess:(MonentsListInfoModel *)info state:(int)state;
- (void)getMonentsTopicLatestListFail:(NSString *)msg state:(int)state;
///点赞/取消动态成功
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status;;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,18 @@
//
// XPMonentsTopicListProtocol.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol XPMonentsTopicListProtocol <NSObject>
- (void)getMonentsTopicListSuccess:(NSArray *)list state:(int)state;
- (void)getMoentsTopicFail:(NSString *)message state:(int)state;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,22 @@
//
// XPMonentsTopicRecommendProtocol.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MonentsListInfoModel;
@protocol XPMonentsTopicRecommendProtocol <NSObject>
- (void)getMonentsTopicRecommendListSuccess:(MonentsListInfoModel *)info state:(int)state;
- (void)getMonentsTopicRecommendListFail:(NSString *)msg state:(int)state;
///点赞/取消动态成功
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status;;
@end
NS_ASSUME_NONNULL_END

View File

@@ -14,6 +14,7 @@
#import "NetImageView.h"
#import "XPMonentsLayoutConfig.h"
#import "SDPhotoBrowser.h"
#import "XCCurrentVCStackManager.h"
///Model
#import "MonentsInfoModel.h"
///View
@@ -23,6 +24,7 @@
#import "XPMoentsTopicView.h"
#import "XPMonentsContentView.h"
#import "XPMonentsLayoutConfig.h"
#import "XPMonentTopicContainerViewController.h"
@interface XPMonentsTableViewCell ()<XPMonentsTooBarViewDelegate, XPMonentsTooBarViewDelegate, XPMonentsPhotoViewDelegate, SDPhotoBrowserDelegate>
/// stackView
@property (nonatomic,strong) UIView * backView;
@@ -121,6 +123,15 @@
[browser show];
}
#pragma mark - Event Response
- (void)didTapTopicRecognizer {
if (self.monentsInfo.worldId > 0) {
XPMonentTopicContainerViewController * topicListVC = [[XPMonentTopicContainerViewController alloc] init];
topicListVC.worldId = [NSString stringWithFormat:@"%lld", self.monentsInfo.worldId];
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:topicListVC animated:YES];
}
}
#pragma mark - Getters And Setters
- (void)setMonentsInfo:(MonentsInfoModel *)monentsInfo {
_monentsInfo = monentsInfo;
@@ -194,6 +205,8 @@
- (XPMoentsTopicView *)topicView {
if (!_topicView) {
_topicView = [[XPMoentsTopicView alloc] init];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapTopicRecognizer)];
[_topicView addGestureRecognizer:tap];
}
return _topicView;
}

View File

@@ -8,9 +8,21 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class MonentsTopicModel;
@class MonentsTopicModel,XPMonentsRecommendHeaderView ;
@protocol XPMonentsRecommendHeaderViewDelegate <NSObject>
///选中了某个item
- (void)xPMonentsRecommendHeaderView:(XPMonentsRecommendHeaderView *)view didSelectItem:(MonentsTopicModel *)info;
///查看更多
- (void)xPMonentsRecommendHeaderView:(XPMonentsRecommendHeaderView *)view didClickMoreTopic:(UIButton *)sender;
@end
@interface XPMonentsRecommendHeaderView : UIView
@property (nonatomic,strong) NSArray<MonentsTopicModel *> *topicList;
///代理
@property (nonatomic,weak) id<XPMonentsRecommendHeaderViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -80,9 +80,21 @@
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
if (self.topicList.count > 0) {
MonentsTopicModel * topicInfo = [self.topicList objectAtIndex:indexPath.row];
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsRecommendHeaderView:didSelectItem:)]) {
[self.delegate xPMonentsRecommendHeaderView:self didSelectItem:topicInfo];
}
}
}
#pragma mark - Event Response
- (void)arrowButtonAction:(UIButton *)sender {
//TODO:
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsRecommendHeaderView:didClickMoreTopic:)]) {
[self.delegate xPMonentsRecommendHeaderView:self didClickMoreTopic:sender];
}
}
#pragma mark - Getters And Setters

View File

@@ -0,0 +1,17 @@
//
// XPMonentsTopicHeaderView.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class MonentsTopicModel;
@interface XPMonentsTopicHeaderView : UIView
///
@property (nonatomic,strong) MonentsTopicModel *topicInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,116 @@
//
// XPMonentsTopicHeaderView.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentsTopicHeaderView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "NetImageView.h"
///Model
#import "MonentsTopicModel.h"
@interface XPMonentsTopicHeaderView ()
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UILabel *descLabel;
@property (nonatomic,strong) NetImageView *logoImageView;
@property (nonatomic,strong) UIView * alphaView;
@end
@implementation XPMonentsTopicHeaderView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.logoImageView];
[self addSubview:self.alphaView];
[self addSubview:self.titleLabel];
[self addSubview:self.descLabel];
}
- (void)initSubViewConstraints {
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.alphaView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self).offset(kNavigationHeight + 10);
make.left.mas_equalTo(self).offset(30);
}];
[self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLabel);
make.right.mas_equalTo(self).offset(-10);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
}];
}
#pragma mark - Getters And Setters
- (void)setTopicInfo:(MonentsTopicModel *)topicInfo {
_topicInfo = topicInfo;
if (_topicInfo) {
self.logoImageView.imageUrl = _topicInfo.icon;
self.titleLabel.text = _topicInfo.name;
self.descLabel.text = _topicInfo.desc;
}
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:18];
_titleLabel.textColor = [UIColor whiteColor];
}
return _titleLabel;
}
- (UILabel *)descLabel {
if (!_descLabel) {
_descLabel = [[UILabel alloc] init];
_descLabel.font = [UIFont systemFontOfSize:14];
_descLabel.textColor = [UIColor whiteColor];
_descLabel.numberOfLines = 2;
}
return _descLabel;
}
- (NetImageView *)logoImageView {
if (!_logoImageView) {
_logoImageView = [[NetImageView alloc] init];
_logoImageView.userInteractionEnabled = YES;
_logoImageView.layer.masksToBounds = YES;
_logoImageView.contentMode = UIViewContentModeScaleAspectFill;
}
return _logoImageView;
}
- (UIView *)alphaView {
if (!_alphaView) {
_alphaView = [[UIView alloc] init];
_alphaView.backgroundColor = [UIColor blackColor];
_alphaView.alpha = 0.5;
}
return _alphaView;
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPMoentsTopicListViewController.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMoentsTopicListViewController : MvpViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,165 @@
//
// XPMoentsTopicListViewController.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMoentsTopicListViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <MJRefresh/MJRefresh.h>
///Tool
#import "ThemeColor.h"
///Model
#import "MonentsTopicModel.h"
///View
#import "XPMonentTopicContainerViewController.h"
///P
#import "XPMonentsTopicListPresenter.h"
#import "XPMonentsTopicListProtocol.h"
@interface XPMoentsTopicListViewController ()<UITableViewDelegate, UITableViewDataSource, XPMonentsTopicListProtocol>
@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong) NSMutableArray *datasource;
@property (nonatomic,assign) int page;
@end
@implementation XPMoentsTopicListViewController
- (__kindof id)createPresenter {
return [[XPMonentsTopicListPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initHeaderAndFooterRrfresh];
[self initSubViews];
[self initSubViewConstraints];
}
- (void)initHeaderAndFooterRrfresh {
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
header.stateLabel.textColor = [ThemeColor secondTextColor];
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
self.tableView.mj_header = header;
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
footer.stateLabel.textColor = [ThemeColor secondTextColor];
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
self.tableView.mj_footer = footer;
[self headerRefresh];
}
- (void)headerRefresh {
self.page = 1;
[self.presenter getMoentsTopicList:self.page pageSize:20 state:0];
}
- (void)footerRefresh {
self.page++;
[self.presenter getMoentsTopicList:self.page pageSize:20 state:1];
}
#pragma mark - Private Method
- (void)initSubViews {
self.title = @"更多话题";
[self.view addSubview:self.tableView];
}
- (void)initSubViewConstraints {
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 50;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class])];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([UITableViewCell class])];
}
MonentsTopicModel * topicModel = [self.datasource objectAtIndex:indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"#%@", topicModel.name];
cell.textLabel.textColor = [ThemeColor mainTextColor];
cell.textLabel.font = [UIFont systemFontOfSize:13];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.datasource.count > 0) {
MonentsTopicModel * topicModel = [self.datasource objectAtIndex:indexPath.row];
XPMonentTopicContainerViewController * topicVC = [[XPMonentTopicContainerViewController alloc] init];
topicVC.worldId = topicModel.tId;
[self.navigationController pushViewController:topicVC animated:YES];
}
}
#pragma mark - XPMonentsTopicListProtocol
- (void)getMonentsTopicListSuccess:(NSArray *)list state:(int)state {
if (state == 0) {
[self.tableView.mj_header endRefreshing];
[self.datasource removeAllObjects];
} else {
if (list.count <= 0) {
[self showErrorToast:@"没有更多数据了"];
}
[self.tableView.mj_footer endRefreshing];
}
if (list.count > 0) {
[self.datasource addObjectsFromArray:list];
}
[self.tableView reloadData];
}
- (void)getMoentsTopicFail:(NSString *)message state:(int)state {
if (state == 0) {
[self.tableView.mj_header endRefreshing];
} else {
[self.tableView.mj_footer endRefreshing];
}
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
_tableView.backgroundColor = [UIColor clearColor];
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass([UITableViewCell class])];
}
return _tableView;
}
- (NSMutableArray *)datasource {
if (!_datasource) {
_datasource = [NSMutableArray array];
}
return _datasource;
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPMonentTopicContainerViewController.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMonentTopicContainerViewController : BaseViewController
@property (nonatomic,copy) NSString *worldId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,235 @@
//
// XPMonentTopicContainerViewController.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentTopicContainerViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <JXCategoryView/JXCategoryView.h>
#import <JXPagingView/JXPagerView.h>
#import <JXPagingView/JXPagerListRefreshView.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "Api+Monents.h"
#import "AccountInfoStorage.h"
///Model
#import "MonentsTopicModel.h"
///View
#import "XPMonentsTopicRecommondViewController.h"
#import "XPMonentsTopicLatestViewController.h"
#import "XPMonentsTopicHeaderView.h"
#import "XPMonentsPublishViewController.h"
@interface XPMonentTopicContainerViewController ()<JXPagerViewDelegate,JXCategoryViewDelegate>
@property (nonatomic,strong) JXCategoryTitleView *categoryView;
@property (nonatomic,strong) JXCategoryIndicatorLineView *lineView;
@property (nonatomic,strong) JXPagerView *pagerView;
@property (nonatomic,strong) NSArray<NSString *> *titles;
@property (nonatomic,strong) XPMonentsTopicRecommondViewController *recommendVC;
@property (nonatomic,strong) XPMonentsTopicLatestViewController *latestVC;
@property (nonatomic,strong) XPMonentsTopicHeaderView *headerView;
@property (nonatomic,strong) UIButton *backButton;
@property (nonatomic,strong) UIButton *enterTopicButton;
@property (nonatomic,strong) MonentsTopicModel *topicInfo;
@end
@implementation XPMonentTopicContainerViewController
- (BOOL)isHiddenNavBar {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self requestTopicDetail];
[self initSubViews];
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
self.pagerView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight - 50);
}
- (void)initSubViews {
[self.view addSubview:self.pagerView];
[self.view addSubview:self.backButton];
[self.view addSubview:self.enterTopicButton];
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view);
make.top.mas_equalTo(statusbarHeight);
make.height.width.mas_equalTo(44);
}];
[self.enterTopicButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(50);
make.left.right.bottom.mas_equalTo(self.view);
}];
}
- (void)requestTopicDetail {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api monentsTopicDetailInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
MonentsTopicModel * info = [MonentsTopicModel modelWithDictionary:data.data];
self.topicInfo = info;
self.headerView.topicInfo = info;
} else if(code == 7903) {
[self.navigationController popViewControllerAnimated:YES];
} else {
[self showErrorToast:msg];
}
} worldId:self.worldId uid:uid];
}
#pragma mark - JXPagerViewDelegate
- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
return self.headerView;
}
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
return 150 + kNavigationHeight;
}
- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
return 46;
}
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
return self.categoryView;
}
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
return self.titles.count;
}
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
if (index == 0) {
return self.recommendVC;
} else {
return self.latestVC;
}
}
#pragma mark - Event Response
- (void)backButtonAction:(UIButton *)sender {
[self.navigationController popViewControllerAnimated:YES];
}
- (void)enterTopicButtonAction:(UIButton *)sender {
XPMonentsPublishViewController * publishVC = [[XPMonentsPublishViewController alloc] init];
self.topicInfo.worldName = self.topicInfo.name;
self.topicInfo.worldId = self.topicInfo.tId;
publishVC.topicInfo = self.topicInfo;
[self.navigationController pushViewController:publishVC animated:YES];
}
#pragma mark - Getters And Setters
- (void)setWorldId:(NSString *)worldId {
_worldId = worldId;
self.recommendVC.worldId = _worldId;
self.latestVC.worldId = _worldId;
}
- (JXCategoryTitleView *)categoryView {
if (!_categoryView) {
_categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 46)];
_categoryView.titles = self.titles;
_categoryView.backgroundColor = [UIColor whiteColor];
_categoryView.delegate = self;
_categoryView.titleSelectedColor = [ThemeColor mainTextColor];
_categoryView.titleColor = [ThemeColor secondTextColor];
_categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:18];
_categoryView.titleFont = [UIFont systemFontOfSize:15];
_categoryView.titleColorGradientEnabled = YES;
_categoryView.titleLabelZoomEnabled = NO;
_categoryView.indicators = @[self.lineView];
_categoryView.contentScrollView = self.pagerView.listContainerView.scrollView;
_categoryView.averageCellSpacingEnabled = NO;
_categoryView.contentEdgeInsetLeft = 20;
_categoryView.contentEdgeInsetRight = 20;
_categoryView.cellSpacing = 30;
}
return _categoryView;
}
- (JXCategoryIndicatorLineView *)lineView {
if (!_lineView) {
_lineView = [[JXCategoryIndicatorLineView alloc] init];
_lineView.indicatorColor = [ThemeColor appMainColor];
_lineView.indicatorWidth = 9;
_lineView.indicatorHeight = 4;
_lineView.verticalMargin = 2;
}
return _lineView;
}
- (JXPagerView *)pagerView {
if (!_pagerView) {
_pagerView = [[JXPagerListRefreshView alloc] initWithDelegate:self];
_pagerView.listContainerView.scrollView.backgroundColor = UIColor.clearColor;
_pagerView.pinSectionHeaderVerticalOffset = (NSInteger) kNavigationHeight;
}
return _pagerView;
}
- (NSArray<NSString *> *)titles {
if (!_titles) {
_titles = @[@"推荐", @"最新"];
}
return _titles;
}
- (XPMonentsTopicHeaderView *)headerView {
if (!_headerView) {
_headerView = [[XPMonentsTopicHeaderView alloc] init];
}
return _headerView;
}
- (XPMonentsTopicLatestViewController *)latestVC {
if (!_latestVC) {
_latestVC = [[XPMonentsTopicLatestViewController alloc] init];
}
return _latestVC;
}
- (XPMonentsTopicRecommondViewController *)recommendVC {
if (!_recommendVC) {
_recommendVC = [[XPMonentsTopicRecommondViewController alloc] init];
}
return _recommendVC;
}
- (UIButton *)backButton {
if (!_backButton) {
_backButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_backButton setImage:[UIImage imageNamed:@"home_search_white_back"] forState:UIControlStateNormal];
[_backButton setImage:[UIImage imageNamed:@"home_search_white_back"] forState:UIControlStateSelected];
[_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _backButton;
}
- (UIButton *)enterTopicButton {
if (!_enterTopicButton) {
_enterTopicButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_enterTopicButton setTitle:@"参与话题" forState:UIControlStateNormal];
[_enterTopicButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_enterTopicButton.titleLabel.font = [UIFont systemFontOfSize:15];
[_enterTopicButton setBackgroundColor:[ThemeColor appMainColor]];
[_enterTopicButton setImage:[UIImage imageNamed:@"monents_topic_camera"] forState:UIControlStateNormal];
[_enterTopicButton addTarget:self action:@selector(enterTopicButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _enterTopicButton;
}
@end

View File

@@ -0,0 +1,17 @@
//
// XPMonentsMineViewController.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@class MonentsInfoModel;
@interface XPMonentsMineViewController : MvpViewController
@property (nonatomic,strong) NSArray<MonentsInfoModel *>*dynamicInfo;
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,157 @@
//
// XPMonentsMineViewController.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentsMineViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <MJRefresh/MJRefresh.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "XPMonentsLayoutConfig.h"
///Model
#import "MonentsListInfoModel.h"
///P
#import "XPMonentMinePresenter.h"
#import "XPMonentsMineProtocol.h"
///View
#import "XPMonentsTableViewCell.h"
#import "XPMonentsEmptyTableViewCell.h"
@interface XPMonentsMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMonentsTableViewCellDelegate, XPMonentsMineProtocol>
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSMutableArray<MonentsInfoModel *> *datasource;
///
@property (nonatomic,assign) BOOL hasNoMoreData;
///
@property (nonatomic,strong) MonentsListInfoModel *listInfo;
@end
@implementation XPMonentsMineViewController
- (__kindof id)createPresenter {
return [[XPMonentMinePresenter alloc] init];
}
- (BOOL)isHiddenNavBar {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.tableView];
}
- (void)initSubViewConstraints {
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count > 0 ? self.datasource.count : 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row];
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
return monentInfo.rowHeight;
}
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
cell.delegate = self;
cell.monentsInfo = monentsInfo;
return cell;
}
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
return cell;
}
#pragma mark - XPMonentsTableViewCellDelegate
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
}
#pragma mark - XPMonentsMineProtocol
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.dynamicId isEqualToString:dynamicId]) {
if (status) {
obj.isLike += 1;
} else {
obj.isLike -= 1;
}
*stop = YES;
}
}];
[self.tableView reloadData];
}
#pragma mark - JXPagingViewListViewDelegate
- (UIScrollView *)listScrollView {
return self.tableView;
}
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
self.scrollCallback = callback;
}
- (UIView *)listView {
return self.view;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
self.scrollCallback(scrollView);
}
#pragma mark - Getters And Setters
- (void)setDynamicInfo:(NSArray<MonentsInfoModel *> *)dynamicInfo {
[self.datasource addObjectsFromArray:dynamicInfo];
[self.tableView reloadData];
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
}
return _tableView;
}
- (NSMutableArray<MonentsInfoModel *> *)datasource {
if (!_datasource) {
_datasource = [NSMutableArray array];
}
return _datasource;
}
@end

View File

@@ -8,9 +8,9 @@
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@class MonentsTopicModel;
@interface XPMonentsPublishViewController : MvpViewController
@property (nonatomic,strong, nullable) MonentsTopicModel *topicInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -63,7 +63,6 @@
@property (nonatomic,strong) NSMutableArray *originAssets;
///
@property (nonatomic,strong) NSArray *uploadImageList;
@property (nonatomic,strong) MonentsTopicModel *topicInfo;
///
@property (nonatomic,assign) int imageCount;
@end
@@ -328,7 +327,6 @@
#pragma mark - XPMonentsPublishTopicViewDelegate
- (void)xPMonentsPublishTopicView:(XPMonentsPublishTopicView *)view didClickCloseButton:(UIButton *)sender {
self.topicInfo = nil;
self.addTopicView.topicInfo = self.topicInfo;
}
- (void)xPMonentsPublishTopicView:(XPMonentsPublishTopicView *)view didClickChooseTopic:(UIButton *)sender {
@@ -342,7 +340,6 @@
- (void)xPMoentsTopicListView:(XPMoentsTopicListView *)view didSelectItem:(MonentsTopicModel *)topicInfo {
[TTPopup dismiss];
self.topicInfo = topicInfo;
self.addTopicView.topicInfo = topicInfo;
}
#pragma mark - XPMonentsPublishProtocol
@@ -383,6 +380,10 @@
- (void)publicButtonAction:(UIButton *)sender {
[self.view endEditing:YES];
if (self.topicInfo.worldId.length <= 0) {
[self showErrorToast:@"请选择一个话题"];
return;
}
if (self.textView.text.length > 0) {
if (self.uploadImageList.count > 0) {
[self showLoading];
@@ -399,6 +400,11 @@
}
#pragma mark - Getters And Setters
- (void)setTopicInfo:(MonentsTopicModel *)topicInfo {
_topicInfo = topicInfo;
self.addTopicView.topicInfo = _topicInfo;
}
- (UIView *)navView {
if (!_navView) {
_navView = [[UIView alloc] init];

View File

@@ -15,6 +15,7 @@
#import "XPMonentsLayoutConfig.h"
///Model
#import "MonentsInfoModel.h"
#import "MonentsTopicModel.h"
///P
#import "XPMonentsRecommendPresenter.h"
#import "XPMonentsRecommendProtocol.h"
@@ -23,8 +24,10 @@
#import "XPMonentsEmptyTableViewCell.h"
#import "XPMonentsRecommendHeaderView.h"
#import "XPMonentsDetailViewController.h"
#import "XPMonentTopicContainerViewController.h"
#import "XPMoentsTopicListViewController.h"
@interface XPMonentsRecommendViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsRecommendProtocol, XPMonentsTableViewCellDelegate>
@interface XPMonentsRecommendViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsRecommendProtocol, XPMonentsTableViewCellDelegate,XPMonentsRecommendHeaderViewDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
///
@@ -140,6 +143,18 @@
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
}
#pragma mark - XPMonentsRecommendHeaderViewDelegate
- (void)xPMonentsRecommendHeaderView:(XPMonentsRecommendHeaderView *)view didSelectItem:(MonentsTopicModel *)info {
XPMonentTopicContainerViewController * topicVC = [[XPMonentTopicContainerViewController alloc] init];
topicVC.worldId = info.tId;
[self.navigationController pushViewController:topicVC animated:YES];
}
- (void)xPMonentsRecommendHeaderView:(XPMonentsRecommendHeaderView *)view didClickMoreTopic:(UIButton *)sender {
XPMoentsTopicListViewController * topicListVC = [[XPMoentsTopicListViewController alloc] init];
[self.navigationController pushViewController:topicListVC animated:YES];
}
#pragma mark -JXCategoryListContainerViewDelegate
- (UIView *)listView {
return self.view;
@@ -223,6 +238,7 @@
- (XPMonentsRecommendHeaderView *)headerView {
if (!_headerView) {
_headerView = [[XPMonentsRecommendHeaderView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 80)];
_headerView.delegate = self;
}
return _headerView;
}

View File

@@ -0,0 +1,17 @@
//
// XPMonentsTopicLatestViewController.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import "MvpViewController.h"
#import <JXPagingView/JXPagerView.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPMonentsTopicLatestViewController : MvpViewController<JXPagerViewListViewDelegate>
@property (nonatomic,copy) NSString *worldId;
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,214 @@
//
// XPMonentsTopicLatestViewController.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentsTopicLatestViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <MJRefresh/MJRefresh.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "XPMonentsLayoutConfig.h"
///Model
#import "MonentsListInfoModel.h"
///P
#import "XPMonentsTopicLatestPresenter.h"
#import "XPMonentsTopicLatestProtocol.h"
///View
#import "XPMonentsTableViewCell.h"
#import "XPMonentsEmptyTableViewCell.h"
@interface XPMonentsTopicLatestViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsTopicLatestProtocol, XPMonentsTableViewCellDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSMutableArray<MonentsInfoModel *> *datasource;
///
@property (nonatomic,assign) BOOL hasNoMoreData;
///
@property (nonatomic,strong) MonentsListInfoModel *listInfo;
@end
@implementation XPMonentsTopicLatestViewController
- (BOOL)isHiddenNavBar {
return YES;
}
- (__kindof id)createPresenter {
return [[XPMonentsTopicLatestPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initHeaderAndFooterRrfresh];
[self initSubViews];
[self initSubViewConstraints];
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.tableView];
}
- (void)initSubViewConstraints {
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
}
#pragma mark -
- (void)initHeaderAndFooterRrfresh {
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
header.stateLabel.textColor = [ThemeColor secondTextColor];
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
self.tableView.mj_header = header;
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
footer.stateLabel.textColor = [ThemeColor secondTextColor];
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
self.tableView.mj_footer = footer;
[self headerRefresh];
}
#pragma mark - fangfa
- (void)headerRefresh {
[self.presenter getMonentsTopicLatestList:@"" worldId:self.worldId state:0];
}
- (void)footerRefresh {
if (self.hasNoMoreData) {
[self showErrorToast:@"没有更多数据了"];
[self.tableView.mj_footer endRefreshing];
return;
}
[self.presenter getMonentsTopicLatestList:self.listInfo.nextDynamicId worldId:self.worldId state:1];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count > 0 ? self.datasource.count : 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row];
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
return monentInfo.rowHeight;
}
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
cell.delegate = self;
cell.monentsInfo = monentsInfo;
return cell;
}
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
return cell;
}
#pragma mark - XPMonentsTableViewCellDelegate
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
}
#pragma mark - JXPagingViewListViewDelegate
- (UIScrollView *)listScrollView {
return self.tableView;
}
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
self.scrollCallback = callback;
}
- (UIView *)listView {
return self.view;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
self.scrollCallback(scrollView);
}
#pragma mark - XPMonentsTopicLatestProtocol
- (void)getMonentsTopicLatestListSuccess:(MonentsListInfoModel *)listInfo state:(int)state{
self.listInfo = listInfo;
if (state == 0) {
[self.datasource removeAllObjects];
}
if (listInfo.dynamicList.count > 0) {
[self.datasource addObjectsFromArray:listInfo.dynamicList];
}
if (state == 0) {
self.hasNoMoreData = NO;
[self.tableView.mj_header endRefreshing];
} else {
if (listInfo.dynamicList.count > 0) {
self.hasNoMoreData = NO;
} else {
self.hasNoMoreData = YES;
}
[self.tableView.mj_footer endRefreshing];
}
[self.tableView reloadData];
}
- (void)getMonentsTopicLatestListFail:(NSString *)msg state:(int)state {
if (state == 0) {
[self.tableView.mj_header endRefreshing];
} else {
[self.tableView.mj_footer endRefreshing];
}
}
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.dynamicId isEqualToString:dynamicId]) {
if (status) {
obj.isLike += 1;
} else {
obj.isLike -= 1;
}
*stop = YES;
}
}];
[self.tableView reloadData];
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
}
return _tableView;
}
- (NSMutableArray<MonentsInfoModel *> *)datasource {
if (!_datasource) {
_datasource = [NSMutableArray array];
}
return _datasource;
}
@end

View File

@@ -0,0 +1,18 @@
//
// XPMonentsTopicRecommondViewController.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/18.
//
#import "MvpViewController.h"
#import <JXPagingView/JXPagerView.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPMonentsTopicRecommondViewController : MvpViewController<JXPagerViewListViewDelegate>
@property (nonatomic,strong) NSString *worldId;
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,213 @@
//
// XPMonentsTopicRecommondViewController.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentsTopicRecommondViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <MJRefresh/MJRefresh.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "XPMonentsLayoutConfig.h"
///Model
#import "MonentsListInfoModel.h"
///P
#import "XPMonentsTopicRecommendPresenter.h"
#import "XPMonentsTopicRecommendProtocol.h"
///View
#import "XPMonentsTableViewCell.h"
#import "XPMonentsEmptyTableViewCell.h"
@interface XPMonentsTopicRecommondViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsTopicRecommendProtocol, XPMonentsTableViewCellDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSMutableArray<MonentsInfoModel *> *datasource;
///
@property (nonatomic,assign) BOOL hasNoMoreData;
///
@property (nonatomic,strong) MonentsListInfoModel *listInfo;
@end
@implementation XPMonentsTopicRecommondViewController
- (BOOL)isHiddenNavBar {
return YES;
}
- (__kindof id)createPresenter {
return [[XPMonentsTopicRecommendPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initHeaderAndFooterRrfresh];
[self initSubViews];
[self initSubViewConstraints];
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.tableView];
}
- (void)initSubViewConstraints {
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
}
#pragma mark -
- (void)initHeaderAndFooterRrfresh {
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
header.stateLabel.textColor = [ThemeColor secondTextColor];
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
self.tableView.mj_header = header;
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
footer.stateLabel.textColor = [ThemeColor secondTextColor];
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
self.tableView.mj_footer = footer;
[self headerRefresh];
}
#pragma mark - fangfa
- (void)headerRefresh {
[self.presenter getMonentsTopicRecommendList:@"" worldId:self.worldId state:0];
}
- (void)footerRefresh {
if (self.hasNoMoreData) {
[self showErrorToast:@"没有更多数据了"];
[self.tableView.mj_footer endRefreshing];
return;
}
[self.presenter getMonentsTopicRecommendList:self.listInfo.nextDynamicId worldId:self.worldId state:1];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count > 0 ? self.datasource.count : 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row];
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
return monentInfo.rowHeight;
}
return KScreenHeight - kNavigationHeight - 49 - kSafeAreaBottomHeight;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
cell.delegate = self;
cell.monentsInfo = monentsInfo;
return cell;
}
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
return cell;
}
#pragma mark - XPMonentsTableViewCellDelegate
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
}
#pragma mark - JXPagingViewListViewDelegate
- (UIScrollView *)listScrollView {
return self.tableView;
}
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
self.scrollCallback = callback;
}
- (UIView *)listView {
return self.view;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
self.scrollCallback(scrollView);
}
#pragma mark - XPMonentsRecommendProtocol
- (void)getMonentsTopicRecommendListSuccess:(MonentsListInfoModel *)listInfo state:(int)state {
self.listInfo = listInfo;
if (state == 0) {
[self.datasource removeAllObjects];
}
if (listInfo.dynamicList.count > 0) {
[self.datasource addObjectsFromArray:listInfo.dynamicList];
}
if (state == 0) {
self.hasNoMoreData = NO;
[self.tableView.mj_header endRefreshing];
} else {
if (listInfo.dynamicList.count > 0) {
self.hasNoMoreData = NO;
} else {
self.hasNoMoreData = YES;
}
[self.tableView.mj_footer endRefreshing];
}
[self.tableView reloadData];
}
- (void)getMonentsTopicRecommendListFail:(NSString *)msg state:(int)state {
if (state == 0) {
[self.tableView.mj_header endRefreshing];
} else {
[self.tableView.mj_footer endRefreshing];
}
}
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.dynamicId isEqualToString:dynamicId]) {
if (status) {
obj.isLike += 1;
} else {
obj.isLike -= 1;
}
*stop = YES;
}
}];
[self.tableView reloadData];
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPMonentsTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
[_tableView registerClass:[XPMonentsEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
}
return _tableView;
}
- (NSMutableArray<MonentsInfoModel *> *)datasource {
if (!_datasource) {
_datasource = [NSMutableArray array];
}
return _datasource;
}
@end