diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index e0d2c1ee..c446af68 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 146567E229B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 146567E129B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m */; }; 146567E529B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 146567E429B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m */; }; 14B65C6529BECD8A00EC02EF /* XPMineMomentTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */; }; + 14B65C6B29BF439E00EC02EF /* home_living.svga in Resources */ = {isa = PBXBuildFile; fileRef = 14B65C6A29BF439E00EC02EF /* home_living.svga */; }; 14C1F15429B86DF0000A960F /* XPMineMoreTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15329B86DF0000A960F /* XPMineMoreTableViewCell.m */; }; 14C1F15729B874FB000A960F /* XPMineMoreItemTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15629B874FB000A960F /* XPMineMoreItemTableViewCell.m */; }; 14C1F15A29B876EC000A960F /* XPMineMoreItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15929B876EC000A960F /* XPMineMoreItemModel.m */; }; @@ -1313,6 +1314,7 @@ 146567E429B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFindNewFriendTableViewCell.m; sourceTree = ""; }; 14B65C6329BECD8A00EC02EF /* XPMineMomentTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMomentTableViewCell.h; sourceTree = ""; }; 14B65C6429BECD8A00EC02EF /* XPMineMomentTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineMomentTableViewCell.m; sourceTree = ""; }; + 14B65C6A29BF439E00EC02EF /* home_living.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = home_living.svga; sourceTree = ""; }; 14C1F15229B86DF0000A960F /* XPMineMoreTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMoreTableViewCell.h; sourceTree = ""; }; 14C1F15329B86DF0000A960F /* XPMineMoreTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineMoreTableViewCell.m; sourceTree = ""; }; 14C1F15529B874FB000A960F /* XPMineMoreItemTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineMoreItemTableViewCell.h; sourceTree = ""; }; @@ -7556,6 +7558,7 @@ E8A1E45C276220B100B294CA /* Sources */ = { isa = PBXGroup; children = ( + 14B65C6A29BF439E00EC02EF /* home_living.svga */, E887531529BB1B4F0017A41A /* candy_tree.mp4 */, E839806729027D4A0084BFC8 /* room_wish_gift_sendCelebrate.svga */, E897AC0228AF9DDE003B3587 /* sailing_prize_cowry.svga */, @@ -9349,6 +9352,7 @@ E8A1E461276220DA00B294CA /* candyTree.svga in Resources */, E80EC82528ACD84000D133C5 /* emoji_61@2x.png in Resources */, E80EC81528ACD84000D133C5 /* emoji_145@2x.png in Resources */, + 14B65C6B29BF439E00EC02EF /* home_living.svga in Resources */, E80EC85428ACD84000D133C5 /* emoji_165@2x.png in Resources */, E80EC88728ACD84000D133C5 /* emoji_29@2x.png in Resources */, E80EC83728ACD84000D133C5 /* emoji_112@2x.png in Resources */, diff --git a/xplan-ios/Assets.xcassets/Home/home_chat.imageset/Contents.json b/xplan-ios/Assets.xcassets/Home/home_chat.imageset/Contents.json new file mode 100644 index 00000000..95d852fd --- /dev/null +++ b/xplan-ios/Assets.xcassets/Home/home_chat.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "home_chat@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "home_chat@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Home/home_chat.imageset/home_chat@2x.png b/xplan-ios/Assets.xcassets/Home/home_chat.imageset/home_chat@2x.png new file mode 100644 index 00000000..64151ad1 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/home_chat.imageset/home_chat@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Home/home_chat.imageset/home_chat@3x.png b/xplan-ios/Assets.xcassets/Home/home_chat.imageset/home_chat@3x.png new file mode 100644 index 00000000..e84cb958 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Home/home_chat.imageset/home_chat@3x.png differ diff --git a/xplan-ios/Main/Home/View/XPFindNewFriendTableViewCell.h b/xplan-ios/Main/Home/View/XPFindNewFriendTableViewCell.h index f0e0dbc9..6471cec1 100644 --- a/xplan-ios/Main/Home/View/XPFindNewFriendTableViewCell.h +++ b/xplan-ios/Main/Home/View/XPFindNewFriendTableViewCell.h @@ -10,10 +10,17 @@ @class HomeRecommendRoomModel; NS_ASSUME_NONNULL_BEGIN +@protocol XPFindNewFriendTableViewCellDelegate + + +@end + @interface XPFindNewFriendTableViewCell : UITableViewCell @property (nonatomic, strong) HomeRecommendRoomModel *roomInfo; +@property (nonatomic, weak) id delegate; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Home/View/XPFindNewFriendTableViewCell.m b/xplan-ios/Main/Home/View/XPFindNewFriendTableViewCell.m index 874ca24b..d42dd416 100644 --- a/xplan-ios/Main/Home/View/XPFindNewFriendTableViewCell.m +++ b/xplan-ios/Main/Home/View/XPFindNewFriendTableViewCell.m @@ -8,6 +8,8 @@ #import "XPFindNewFriendTableViewCell.h" /// Third #import +#import +#import /// Tool #import "NetImageView.h" #import "ThemeColor.h" @@ -33,7 +35,12 @@ /// 签名 @property (nonatomic, strong) UILabel *signLabel; /// 直播中/和Ta聊 -@property (nonatomic, strong) XPButton *livingBtn; +@property (nonatomic, strong) SVGAPlayer *livingView; +@property (nonatomic, strong) UIImageView *chatImageView; + +@property (nonatomic, strong) UILabel *statusLabel; + +@property (nonatomic, strong) UIStackView *statusStackView; @end @@ -59,6 +66,14 @@ [self initSubViews]; [self initSubViewConstraints]; + + SVGAParser *parser = [[SVGAParser alloc] init]; + [parser parseWithNamed:@"home_living" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { + if (videoItem != nil) { + self.livingView.videoItem = videoItem; + [self.livingView startAnimation]; + } + } failureBlock:nil]; } return self; } @@ -71,14 +86,16 @@ [self.bgView addSubview:self.nameStackView]; [self.bgView addSubview:self.constellationStackView]; [self.bgView addSubview:self.signLabel]; - [self.bgView addSubview:self.livingBtn]; + [self.bgView addSubview:self.livingView]; + [self.bgView addSubview:self.chatImageView]; + [self.bgView addSubview:self.statusLabel]; [self.nameStackView addArrangedSubview:self.nobleImageView]; [self.nameStackView addArrangedSubview:self.nickLabel]; [self.constellationStackView addArrangedSubview:self.sexBtn]; [self.constellationStackView addArrangedSubview:self.constellationLabel]; - + } - (void)initSubViewConstraints { @@ -125,9 +142,19 @@ make.bottom.mas_equalTo(self.avatarImageView.mas_bottom).offset(-4); }]; - [self.livingBtn mas_makeConstraints:^(MASConstraintMaker *make) { + [self.livingView mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-15); - make.centerY.mas_equalTo(self.bgView); + make.centerY.mas_equalTo(self.bgView).mas_offset(-8); + make.size.mas_equalTo(CGSizeMake(20, 20)); + }]; + + [self.chatImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.livingView); + }]; + + [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.livingView.mas_bottom).offset(2); + make.centerX.mas_equalTo(self.livingView); }]; } @@ -141,8 +168,9 @@ [self.sexBtn setTitle:@"22" forState:UIControlStateNormal]; self.constellationLabel.text = @"巨蟹座"; self.signLabel.text = @"我是个默认的个性签名"; - [self.livingBtn setTitle:@"直播中" forState:UIControlStateNormal]; - [self.livingBtn setImage:[UIImage imageNamed:@"home_living"] forState:UIControlStateNormal]; + self.livingView.hidden = NO; + self.statusLabel.text = @"直播中"; +// self.statusLabel.text = @"和TA聊"; } - (UIView *)bgView { @@ -252,15 +280,42 @@ return _signLabel; } -- (XPButton *)livingBtn { - if (!_livingBtn) { - _livingBtn = [XPButton buttonWithType:UIButtonTypeCustom]; - _livingBtn.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightRegular]; - [_livingBtn setTitleColor:[ThemeColor textThirdColor] forState:UIControlStateNormal]; - _livingBtn.imagePosition = XPButtonImagePositionTop; - _livingBtn.imageTitleSpace = 5; +- (SVGAPlayer *)livingView { + if (!_livingView) { + _livingView = [[SVGAPlayer alloc] init]; + _livingView.hidden = YES; } - return _livingBtn; + return _livingView; +} + +- (UIImageView *)chatImageView { + if (!_chatImageView) { + _chatImageView = [[UIImageView alloc] init]; + _chatImageView.contentMode = UIViewContentModeScaleAspectFit; + _chatImageView.image = [UIImage imageNamed:@"home_chat"]; + _chatImageView.hidden = YES; + } + return _chatImageView; +} + +- (UILabel *)statusLabel { + if (!_statusLabel) { + _statusLabel = [[UILabel alloc] init]; + _statusLabel.textColor = [ThemeColor textThirdColor]; + _statusLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightRegular]; + } + return _statusLabel; +} + +- (UIStackView *)statusStackView { + if (!_statusStackView) { + _statusStackView = [[UIStackView alloc] init]; + _statusStackView.axis = UILayoutConstraintAxisVertical; + _statusStackView.distribution = UIStackViewDistributionFill; + _statusStackView.alignment = UIStackViewAlignmentFill; + _statusStackView.spacing = 5; + } + return _statusStackView; } @end diff --git a/xplan-ios/Main/Home/View/XPFindNewFriendViewController.m b/xplan-ios/Main/Home/View/XPFindNewFriendViewController.m index d6eabd5a..d55634e6 100644 --- a/xplan-ios/Main/Home/View/XPFindNewFriendViewController.m +++ b/xplan-ios/Main/Home/View/XPFindNewFriendViewController.m @@ -19,13 +19,14 @@ ///VC #import "XPWebViewController.h" #import "XPRoomViewController.h" +#import "SessionViewController.h" ///Model #import "HomeRecommendRoomModel.h" ///P #import "XPHomePresenter.h" #import "XPHomeProtocol.h" -@interface XPFindNewFriendViewController () +@interface XPFindNewFriendViewController () ///列表 @property (nonatomic,strong) UITableView *tableView; @property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView); @@ -110,6 +111,10 @@ }]; } +#pragma mark - XPFindNewFriendTableViewCellDelegate + + + #pragma mark - XPHomeProtocol - (void)getHomeRecommendRoomListSuccess:(NSArray *)list state:(BOOL)state { if (state == 0) { @@ -153,10 +158,8 @@ if (self.dataSource.count > 0) { HomeRecommendRoomModel * model = [self.dataSource safeObjectAtIndex1:indexPath.row]; XPFindNewFriendTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPFindNewFriendTableViewCell class])]; - if (cell == nil) { - cell = [[XPFindNewFriendTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPFindNewFriendTableViewCell class])]; - } cell.roomInfo = model; + cell.delegate = self; return cell; } XPHomeListEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeListEmptyTableViewCell class])]; @@ -170,9 +173,15 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (self.dataSource.count > 0) { HomeRecommendRoomModel * model = [self.dataSource safeObjectAtIndex1:indexPath.row]; - if (model.uid.integerValue > 0) { + if (model.roomUid.integerValue > 0) { [XPRoomViewController openRoom:model.uid fromNick:model.title fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self]; } + /// 跳聊天 +// NSString * sessionId = [NSString stringWithFormat:@"%@",model.uid]; +// NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P]; +// SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session]; +// [self.navigationController pushViewController:sessionVC animated:YES]; + } } diff --git a/xplan-ios/Main/Home/View/XPPartyListViewController.m b/xplan-ios/Main/Home/View/XPPartyListViewController.m index 312b533e..8cc50ca6 100644 --- a/xplan-ios/Main/Home/View/XPPartyListViewController.m +++ b/xplan-ios/Main/Home/View/XPPartyListViewController.m @@ -16,6 +16,7 @@ #import "ThemeColor.h" ///View #import "XPPartyListCollectionViewCell.h" +#import "XPHomeListEmptyCollectionViewCell.h" ///P #import "XPHomePresenter.h" #import "XPHomeProtocol.h" @@ -164,14 +165,18 @@ #pragma mark - UICollectionViewDelegate - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - return self.dataSource.count; + return self.dataSource.count > 0 ? self.dataSource.count : 1; } - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - XPPartyListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class]) forIndexPath:indexPath]; - HomeRecommendRoomModel *model = [self.dataSource safeObjectAtIndex1:indexPath.row]; - cell.roomModel = model; - return cell; + if (self.dataSource.count > 0) { + XPPartyListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class]) forIndexPath:indexPath]; + HomeRecommendRoomModel *model = [self.dataSource safeObjectAtIndex1:indexPath.row]; + cell.roomModel = model; + return cell; + } + XPHomeListEmptyCollectionViewCell * emptyCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeListEmptyCollectionViewCell class]) forIndexPath:indexPath]; + return emptyCell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { @@ -217,6 +222,7 @@ _collectionView.delegate = self; _collectionView.dataSource = self; [_collectionView registerClass:[XPPartyListCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class])]; + [_collectionView registerClass:[XPHomeListEmptyCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPHomeListEmptyCollectionViewCell class])]; } return _collectionView; } diff --git a/xplan-ios/Sources/home_living.svga b/xplan-ios/Sources/home_living.svga new file mode 100644 index 00000000..b02c6d92 Binary files /dev/null and b/xplan-ios/Sources/home_living.svga differ