访客记录小圆点角标
This commit is contained in:
@@ -204,6 +204,7 @@
|
||||
9BD9A17C27A0EE24004186FE /* XPMineVisitorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD9A17B27A0EE24004186FE /* XPMineVisitorViewController.m */; };
|
||||
9BD9A18027A0EFC7004186FE /* XPMineVisitorTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD9A17F27A0EFC7004186FE /* XPMineVisitorTableViewCell.m */; };
|
||||
9BD9A18427A0F128004186FE /* XPMineVisitorItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD9A18327A0F128004186FE /* XPMineVisitorItemModel.m */; };
|
||||
9BD9A18727A120FD004186FE /* XPMineVisitorUnReadModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BD9A18627A120FD004186FE /* XPMineVisitorUnReadModel.m */; };
|
||||
E80487652717DDD9008595F2 /* XPRoomMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = E80487642717DDD9008595F2 /* XPRoomMenuItem.m */; };
|
||||
E80CBDE627D0C1CF001E1EC2 /* HomeMenuSourceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E80CBDE527D0C1CF001E1EC2 /* HomeMenuSourceModel.m */; };
|
||||
E80CBDEA27D0C53F001E1EC2 /* XPWeakTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = E80CBDE927D0C53F001E1EC2 /* XPWeakTimer.m */; };
|
||||
@@ -942,6 +943,8 @@
|
||||
9BD9A17F27A0EFC7004186FE /* XPMineVisitorTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineVisitorTableViewCell.m; sourceTree = "<group>"; };
|
||||
9BD9A18227A0F128004186FE /* XPMineVisitorItemModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineVisitorItemModel.h; sourceTree = "<group>"; };
|
||||
9BD9A18327A0F128004186FE /* XPMineVisitorItemModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineVisitorItemModel.m; sourceTree = "<group>"; };
|
||||
9BD9A18527A120FD004186FE /* XPMineVisitorUnReadModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineVisitorUnReadModel.h; sourceTree = "<group>"; };
|
||||
9BD9A18627A120FD004186FE /* XPMineVisitorUnReadModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineVisitorUnReadModel.m; sourceTree = "<group>"; };
|
||||
B66633E061B1B34177CD011C /* Pods-xplan-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.release.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.release.xcconfig"; sourceTree = "<group>"; };
|
||||
CACF623970097D653132D69A /* Pods_xplan_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_xplan_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E80487632717DDD9008595F2 /* XPRoomMenuItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMenuItem.h; sourceTree = "<group>"; };
|
||||
@@ -2868,6 +2871,8 @@
|
||||
children = (
|
||||
9BD9A18227A0F128004186FE /* XPMineVisitorItemModel.h */,
|
||||
9BD9A18327A0F128004186FE /* XPMineVisitorItemModel.m */,
|
||||
9BD9A18527A120FD004186FE /* XPMineVisitorUnReadModel.h */,
|
||||
9BD9A18627A120FD004186FE /* XPMineVisitorUnReadModel.m */,
|
||||
);
|
||||
path = Visitor;
|
||||
sourceTree = "<group>";
|
||||
@@ -4718,6 +4723,7 @@
|
||||
9BBC028E2786FA060007C24B /* NobleCardModel.m in Sources */,
|
||||
E8E70D7E26F2F19D00F03460 /* Api+Mine.m in Sources */,
|
||||
E8E5E19427C36BA600F457D8 /* XPHomeBannerTableViewCell.m in Sources */,
|
||||
9BD9A18727A120FD004186FE /* XPMineVisitorUnReadModel.m in Sources */,
|
||||
E824543D26F58C3A00BE8163 /* XPLoginBindSuccessView.m in Sources */,
|
||||
E8A6C29527CF441200AC7442 /* XPHomeAttentionCollectionViewCell.m in Sources */,
|
||||
E8EEB8F726FC2673007C6EBA /* UserPhoto.m in Sources */,
|
||||
|
@@ -15,6 +15,7 @@ UIKIT_EXTERN NSString * const kWeChatNumber;
|
||||
UIKIT_EXTERN NSString * const kTeenagerAlertDatekey;
|
||||
UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
|
||||
UIKIT_EXTERN NSString * const kRoomReleaseRadioNotificationKey;
|
||||
UIKIT_EXTERN NSString * const kVisitorUnReadCountNotificationKey;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, KeyType) {
|
||||
KeyType_PasswordEncode,///密码 des 加密的
|
||||
|
@@ -16,6 +16,8 @@ NSString * const kRoomGiftEffectUpdateNotificationKey = @"RoomGiftEffectUpdateNo
|
||||
NSString * const kRoomRoomSettingNotificationKey = @"kRoomRoomSettingNotificationKey";
|
||||
NSString * const kHomeMoreScrollPageKey = @"kHomeMoreScrollPageKey";
|
||||
NSString * const kRoomReleaseRadioNotificationKey = @"kRoomReleaseRadioNotificationKey";
|
||||
NSString * const kVisitorUnReadCountNotificationKey = @"kVisitorUnReadCountNotificationKey";
|
||||
|
||||
///在里面进行判断当前环境是什么
|
||||
NSString * const KeyWithType(KeyType type) {
|
||||
BOOL isRelase = NO;
|
||||
|
@@ -44,6 +44,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
|
||||
CustomMessageType_RoomPlay_Dating = 72,
|
||||
///首充奖励
|
||||
CustomMessageType_First_Recharge_Reward = 76,
|
||||
///访客记录
|
||||
CustomMessageType_First_VisitorRecord = 78,
|
||||
///贵族VIP
|
||||
CustomMessageType_Noble_VIP = 85,
|
||||
///个播房观众点击空坑位,房主收到请求上麦提示
|
||||
@@ -230,6 +232,12 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubNobleVIP) {
|
||||
Custom_Message_Sub_AllRoom_Noble_LevelUp_Suspend = 856,
|
||||
};
|
||||
|
||||
/// 访客记录
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageSubVisitorRecord) {
|
||||
/// 访客记录
|
||||
Custom_Message_Sub_Visitor_Record = 781,
|
||||
};
|
||||
|
||||
@interface AttachmentModel : NSObject<NIMCustomAttachment>
|
||||
@property (nonatomic,assign) int first;
|
||||
@property (nonatomic,assign) int second;
|
||||
|
18
xplan-ios/Main/Mine/Model/Visitor/XPMineVisitorUnReadModel.h
Normal file
18
xplan-ios/Main/Mine/Model/Visitor/XPMineVisitorUnReadModel.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// XPMineVisitorUnReadModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/1/26.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPMineVisitorUnReadModel : NSObject
|
||||
|
||||
@property (nonatomic, assign) NSInteger visitNum;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
xplan-ios/Main/Mine/Model/Visitor/XPMineVisitorUnReadModel.m
Normal file
12
xplan-ios/Main/Mine/Model/Visitor/XPMineVisitorUnReadModel.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// XPMineVisitorUnReadModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/1/26.
|
||||
//
|
||||
|
||||
#import "XPMineVisitorUnReadModel.h"
|
||||
|
||||
@implementation XPMineVisitorUnReadModel
|
||||
|
||||
@end
|
@@ -42,6 +42,9 @@ typedef NS_ENUM(NSInteger, XPMineItemType) {
|
||||
@property (nonatomic,assign) XPMineItemType type;
|
||||
///圆角
|
||||
@property (nonatomic, assign) UIRectCorner cornerType;
|
||||
///未读消息
|
||||
@property (nonatomic, assign) NSInteger unReadCount;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -79,6 +79,8 @@
|
||||
visitorItem.itemName = @"访客记录";
|
||||
visitorItem.itemImageName = @"mine_normal_visitor";
|
||||
visitorItem.type = XPMineItemType_Visitor;
|
||||
BaseViewController *vc = [self getView];
|
||||
visitorItem.unReadCount = [vc.tabBarItem.badgeValue integerValue];
|
||||
|
||||
NSArray * array = @[myRoomItem,teenagerItem, myDressUp, inviteFriend, visitorItem, realNameItem];
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#import "XPMineMenuTableViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <YYText/YYText.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
@@ -25,7 +26,10 @@
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///箭头
|
||||
@property (nonatomic,strong) UIButton *arrowButton;
|
||||
|
||||
///分割线
|
||||
@property (nonatomic,strong) UIView * partLineView;
|
||||
//访客记录未读数量
|
||||
@property (nonatomic, strong) UILabel *unReadLabel;
|
||||
@end
|
||||
|
||||
@implementation XPMineMenuTableViewCell
|
||||
@@ -49,6 +53,7 @@
|
||||
|
||||
[self.stackView addArrangedSubview:self.logoImageView];
|
||||
[self.stackView addArrangedSubview:self.titleLabel];
|
||||
[self.stackView addArrangedSubview:self.unReadLabel];
|
||||
[self.stackView addArrangedSubview:self.arrowButton];
|
||||
}
|
||||
|
||||
@@ -66,6 +71,13 @@
|
||||
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(24, 24));
|
||||
}];
|
||||
|
||||
[self.unReadLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.titleLabel.mas_right).mas_offset(5);
|
||||
make.height.mas_equalTo(15);
|
||||
make.centerY.mas_equalTo(self.logoImageView.mas_centerY);
|
||||
make.width.mas_equalTo(15);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)applyRoundCorners:(UIRectCorner)corners radius:(CGFloat)radius
|
||||
@@ -76,6 +88,23 @@
|
||||
self.backView.layer.mask = maskLayer;
|
||||
}
|
||||
|
||||
- (NSAttributedString *)attributedStringWithLineSpace:(CGFloat)lineSpace str:(NSString *)str{
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
|
||||
NSMutableAttributedString *title = [[NSMutableAttributedString alloc] initWithString:str attributes:@{NSForegroundColorAttributeName : UIColorFromRGB(0xffffff), NSFontAttributeName: [UIFont systemFontOfSize:11]}];
|
||||
[attributedString appendAttributedString:title];
|
||||
attributedString.yy_alignment = NSTextAlignmentCenter;
|
||||
return attributedString;
|
||||
}
|
||||
|
||||
- (CGFloat)getWidthWithContent:(NSString *)content height:(CGFloat)height font:(CGFloat)font{
|
||||
|
||||
CGRect rect = [content boundingRectWithSize:CGSizeMake(999, height)
|
||||
options:NSStringDrawingUsesLineFragmentOrigin
|
||||
attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:font]}
|
||||
context:nil];
|
||||
return rect.size.width;
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setItemModel:(XPMineItemModel *)itemModel {
|
||||
_itemModel = itemModel;
|
||||
@@ -85,6 +114,24 @@
|
||||
if (itemModel.cornerType) {
|
||||
[self applyRoundCorners:itemModel.cornerType radius:10];
|
||||
}
|
||||
[self.titleLabel sizeToFit];
|
||||
if (itemModel.unReadCount) {
|
||||
self.unReadLabel.hidden = NO;
|
||||
} else {
|
||||
self.unReadLabel.hidden = YES;
|
||||
}
|
||||
|
||||
self.unReadLabel.attributedText = [self attributedStringWithLineSpace:10 str:[NSString stringWithFormat:@"%zd", itemModel.unReadCount]];
|
||||
CGFloat width = [self getWidthWithContent:[NSString stringWithFormat:@"%zd", itemModel.unReadCount] height:15 font:11];
|
||||
if (itemModel.unReadCount < 10) {
|
||||
width = 7;
|
||||
}
|
||||
[self.unReadLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.titleLabel.mas_right).mas_offset(5);
|
||||
make.height.mas_equalTo(15);
|
||||
make.centerY.mas_equalTo(self.logoImageView.mas_centerY);
|
||||
make.width.mas_equalTo(width + 8);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,4 +182,26 @@
|
||||
return _arrowButton;
|
||||
}
|
||||
|
||||
- (UIView *)partLineView {
|
||||
if (!_partLineView) {
|
||||
_partLineView = [[UIView alloc] init];
|
||||
_partLineView.backgroundColor = [ThemeColor dividerColor];
|
||||
}
|
||||
return _partLineView;
|
||||
}
|
||||
|
||||
- (UILabel *)unReadLabel {
|
||||
if (!_unReadLabel) {
|
||||
_unReadLabel = [[UILabel alloc] init];
|
||||
_unReadLabel.font = [UIFont systemFontOfSize:11];
|
||||
_unReadLabel.textColor = [UIColor whiteColor];
|
||||
_unReadLabel.backgroundColor = UIColorFromRGB(0xFF5B55);
|
||||
_unReadLabel.layer.cornerRadius = 7.5;
|
||||
_unReadLabel.layer.masksToBounds = YES;
|
||||
_unReadLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[_unReadLabel sizeToFit];
|
||||
}
|
||||
return _unReadLabel ;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -14,9 +14,11 @@
|
||||
#import "XPHtmlUrl.h"
|
||||
#import "UIButton+EnlargeTouchArea.h"
|
||||
#import "StatisticsServiceHelper.h"
|
||||
#import "XPConstant.h"
|
||||
///Model
|
||||
#import "XPMineItemModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "XPMineVisitorUnReadModel.h"
|
||||
///P
|
||||
#import "XPMineProtocol.h"
|
||||
#import "XPMinePresent.h"
|
||||
@@ -64,6 +66,11 @@
|
||||
|
||||
@implementation XPMineViewController
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
@@ -72,6 +79,13 @@
|
||||
return [[XPMinePresent alloc] init];;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onVisitorUnReadCountUpdate:) name:kVisitorUnReadCountNotificationKey object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initSubViews];
|
||||
@@ -221,6 +235,12 @@
|
||||
break;
|
||||
case XPMineItemType_Visitor:
|
||||
{
|
||||
[self.tabBarItem setBadgeValue:nil];
|
||||
for (XPMineItemModel * model in self.datasource) {
|
||||
if (model.type == XPMineItemType_Visitor) {
|
||||
model.unReadCount = 0;
|
||||
}
|
||||
}
|
||||
XPMineVisitorViewController *visitorVC = [[XPMineVisitorViewController alloc] init];
|
||||
[self.navigationController pushViewController:visitorVC animated:YES];
|
||||
}
|
||||
@@ -348,6 +368,24 @@
|
||||
[self pushViewControllerWithType:item.type];
|
||||
}
|
||||
|
||||
#pragma mark - NSNotification
|
||||
- (void)onVisitorUnReadCountUpdate:(NSNotification *)noti {
|
||||
XPMineVisitorUnReadModel *model = (XPMineVisitorUnReadModel *)noti.object;
|
||||
if (model.visitNum > 0) {
|
||||
[self.tabBarItem setBadgeValue:[NSString stringWithFormat:@"%ld", model.visitNum]];
|
||||
} else {
|
||||
[self.tabBarItem setBadgeValue:nil];
|
||||
}
|
||||
|
||||
for (int i = 0; i<self.datasource.count; i++) {
|
||||
XPMineItemModel * item = [self.datasource objectAtIndex:i];
|
||||
if (item.type == XPMineItemType_Visitor) {
|
||||
item.unReadCount = model.visitNum;
|
||||
}
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
|
@@ -10,11 +10,13 @@
|
||||
///Model
|
||||
#import "AttachmentModel.h"
|
||||
#import "NobleLevelUpModel.h"
|
||||
#import "XPMineVisitorUnReadModel.h"
|
||||
//View
|
||||
#import "XPNobleUpgradeLevelView.h"
|
||||
#import "XPNobleUpgradeLevelView.h"
|
||||
//Tool
|
||||
#import "TTPopup.h"
|
||||
#import "XPConstant.h"
|
||||
|
||||
@interface XPGlobalMessageManager ()<NIMSystemNotificationManagerDelegate>
|
||||
|
||||
@@ -55,6 +57,12 @@
|
||||
// 青少年模式下,房间在线时长达到上限
|
||||
if ([dic[@"second"] integerValue] == 481) {
|
||||
}
|
||||
} else if ([dic[@"first"] integerValue] == CustomMessageType_First_VisitorRecord){//访客记录数量更新提示
|
||||
AttachmentModel *attachment = [AttachmentModel modelWithJSON:notification.content];
|
||||
XPMineVisitorUnReadModel *model = [XPMineVisitorUnReadModel modelWithJSON:attachment.data];
|
||||
if ([model isKindOfClass:XPMineVisitorUnReadModel.class]) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kVisitorUnReadCountNotificationKey object:model];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (notification.receiverType == NIMSessionTypeTeam) {
|
||||
|
Reference in New Issue
Block a user