Commit 3fb98513 by ludi

完成信息页面四个按钮的提示

parent 2da22bdc
......@@ -72,6 +72,9 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)fus_setValueWithDict:(NSDictionary *)dict;
/// 两个模型是否相等,从属性上来说
-(BOOL)fus_modelEqual:(FUSBaseModel *)model;
/**
* 打印类的JSON字符串
*/
......
......@@ -178,6 +178,10 @@
return array;
}
- (BOOL)fus_modelEqual:(FUSBaseModel *)model{
return [self modelIsEqual:model];
}
#pragma mark - (在子类中实现)自定义的嵌套model, json 字段 映射到 自定义的属性名
//嵌套的 model
+ (NSDictionary *)modelContainerPropertyGenericClass {
......
......@@ -90,6 +90,10 @@
});
}
- (void)fus_hideCloseBtn{
self.closeBtn.hidden = YES;
}
#pragma mark - 初始化参数
- (void)initUI{
......
......@@ -50,6 +50,7 @@
00A36A592C1D9FD6004D28FA /* FUSLeftPopScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A36A582C1D9FD6004D28FA /* FUSLeftPopScrollView.m */; };
00A44A5D2C2BC14E003FDF44 /* FUSSingleLiveRecordV2TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A44A5C2C2BC14E003FDF44 /* FUSSingleLiveRecordV2TableViewCell.m */; };
00A44A602C2C04FC003FDF44 /* FUSChatIntimacyV2View.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A44A5F2C2C04FC003FDF44 /* FUSChatIntimacyV2View.m */; };
00A44A632C2C4345003FDF44 /* FUSUserTradeRemindModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 00A44A622C2C4345003FDF44 /* FUSUserTradeRemindModel.m */; };
00B48E072C213CCD001E4872 /* FUSSettingInitDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 00B48E062C213CCD001E4872 /* FUSSettingInitDataModel.m */; };
BE02D73D2C255ECA006FD462 /* FUSLiveFunctionViewHalfWebManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE02D73C2C255ECA006FD462 /* FUSLiveFunctionViewHalfWebManager.swift */; };
BE02EA292C21C3360092264C /* VELPictureInPictureController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE02EA282C21C3360092264C /* VELPictureInPictureController.m */; };
......@@ -1480,6 +1481,8 @@
00A44A5C2C2BC14E003FDF44 /* FUSSingleLiveRecordV2TableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSSingleLiveRecordV2TableViewCell.m; sourceTree = "<group>"; };
00A44A5E2C2C04FC003FDF44 /* FUSChatIntimacyV2View.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSChatIntimacyV2View.h; sourceTree = "<group>"; };
00A44A5F2C2C04FC003FDF44 /* FUSChatIntimacyV2View.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSChatIntimacyV2View.m; sourceTree = "<group>"; };
00A44A612C2C4345003FDF44 /* FUSUserTradeRemindModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSUserTradeRemindModel.h; sourceTree = "<group>"; };
00A44A622C2C4345003FDF44 /* FUSUserTradeRemindModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSUserTradeRemindModel.m; sourceTree = "<group>"; };
00B48E052C213CCD001E4872 /* FUSSettingInitDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSSettingInitDataModel.h; sourceTree = "<group>"; };
00B48E062C213CCD001E4872 /* FUSSettingInitDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSSettingInitDataModel.m; sourceTree = "<group>"; };
00B8649F2C2AF52B0061F6FF /* FuSiLive.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FuSiLive.entitlements; sourceTree = "<group>"; };
......@@ -3898,6 +3901,8 @@
children = (
00A36A502C1D8A68004D28FA /* FUSHomeNovaListModel.h */,
00A36A512C1D8A69004D28FA /* FUSHomeNovaListModel.m */,
00A44A612C2C4345003FDF44 /* FUSUserTradeRemindModel.h */,
00A44A622C2C4345003FDF44 /* FUSUserTradeRemindModel.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -9966,6 +9971,7 @@
BED0F8CE2C0C49C80017B285 /* FUSBaofangAddNewsFeedCell.m in Sources */,
BED0F94F2C0C49C90017B285 /* FUSSettingTableView.m in Sources */,
BE0397D32C134566003EB21B /* Keyframe.swift in Sources */,
00A44A632C2C4345003FDF44 /* FUSUserTradeRemindModel.m in Sources */,
BED0FA4E2C0C49C90017B285 /* FUSGlobalGiftAnimation.m in Sources */,
BE03980D2C134566003EB21B /* StrokeNode.swift in Sources */,
BED0FB312C0C49CA0017B285 /* NSBundle+TZImagePicker.m in Sources */,
......
......@@ -15,6 +15,7 @@
#import "FUSCheckInModel.h"
#import "FUSHomeLanguageGetlistModel.h"
#import "FUSBaoFangBroadcastModel.h"
#import "FUSUserTradeRemindModel.h"
@interface FUSBaoFangHttpHelper : NSObject
......@@ -305,4 +306,10 @@ typedef enum : NSUInteger {
/// @param failure 1
+(void)fus_requestHomeVestFollowGetlistType:(NSInteger)type success:(void(^)(NSMutableArray<FUSBaoFangAnchorModel *> *modelList, FUSBaoFangAnchorModel *recommendModel))success failure:(void(^)(NSString *msg,int code))failure;
/// 获取用户数据交易提醒
/// @param success 1
/// @param failure 0
+(void)fus_requestUserTradeRemindGetSuccess:(void(^)(FUSUserTradeRemindModel *model))success failure:(void(^)(NSString *msg,int code))failure;
@end
......@@ -930,4 +930,17 @@
}];
}
+ (void)fus_requestUserTradeRemindGetSuccess:(void (^)(FUSUserTradeRemindModel *))success failure:(void (^)(NSString *, int))failure{
[FUSHttpHelper postRequestBinaryWithUrl:URL_USER_TRADE_REMIND_GET params:nil success:^(NSDictionary * _Nullable dataDict, int code) {
FUSUserTradeRemindModel *resModel = [FUSUserTradeRemindModel fus_modelWithDict:dataDict];
[FUSCacheDataShare shareStore].userTradeRemindModel = resModel;
success(resModel);
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) {
failure(FAILURE_MESSAGE, code);
}
}];
}
@end
......@@ -19,6 +19,7 @@
#import "FUSBannerDataModel.h"
#import "FUSLangAreaCountryModel.h"
#import "FUSSettingInitDataModel.h"
#import "FUSUserTradeRemindModel.h"
@interface FUSCacheDataShare : NSObject
......@@ -103,6 +104,10 @@
// 以下两个参数只有海外有,用于记录一件拉起app的参数
@property (nonatomic,strong) NSString *agentCode;
@property (nonatomic,strong) NSString *bindType;
/// 获取用户数据交易提醒
@property (nonatomic, strong) FUSUserTradeRemindModel *userTradeRemindModel;
#pragma mark -- 相关方法
// 是否已经加载
......
......@@ -197,5 +197,19 @@
return _areaCountryInfo;
}
- (void)setUserTradeRemindModel:(FUSUserTradeRemindModel *)userTradeRemindModel{
BOOL didUpdate = NO;
if ((_userTradeRemindModel == nil) != (userTradeRemindModel == nil)) {
didUpdate = YES;
}else if (userTradeRemindModel != nil) {
didUpdate = YES;
// 宽松判断,如果需要严格判断,打开下面的注释
// if (![_userTradeRemindModel fus_modelEqual:userTradeRemindModel]) {
// didUpdate = YES;
// }
}
_userTradeRemindModel = userTradeRemindModel;
[[NSNotificationCenter defaultCenter] postNotificationName:FUS_USER_TRADE_REMIND_CHANGE_NOTIFICATION object:userTradeRemindModel];
}
@end
......@@ -252,3 +252,6 @@
// 连麦移除自己
#define FUS_LINKMIC_DELE_SELF @"FUS_LINKMIC_DELE_SELF"
// 获取用户数据交易提醒
#define FUS_USER_TRADE_REMIND_CHANGE_NOTIFICATION @"FUS_USER_TRADE_REMIND_CHANGE_NOTIFICATION"
......@@ -1256,3 +1256,5 @@
#define URL_HOME_NOVA_RADIO_GET_ALL DNS_FUS_API(@"/home/nova/radio/getAll")
// Fusi-获取已关注房间列表
#define URL_HOME_VEST_FOLLOW_GETLIST DNS_FUS_API(@"/home/vest/follow/getlist")
// 获取用户数据交易提醒
#define URL_USER_TRADE_REMIND_GET DNS_FUS_API(@"/user/trade/remind/get")
......@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
#import "FUSUserTradeRemindModel.h"
NS_ASSUME_NONNULL_BEGIN
......@@ -33,6 +34,8 @@ typedef NS_ENUM(NSInteger, FUSMessageFunctionColumnClicked) {
@property (nonatomic, weak) id<FUSMessageFunctionColumnViewDelegate> delegate;
@property (nonatomic, strong) FUSUserTradeRemindModel *model;
+(CGFloat)fus_viewHeight;
@end
......
......@@ -13,6 +13,7 @@
@interface FUSMessageFunctionColumnView ()
@property (nonatomic, strong) NSMutableArray *viewList;
@property (nonatomic, strong) NSMutableArray *badgeLabelsList;
@end
......@@ -43,6 +44,22 @@
[self addSubview:tempBgView];
[tempBgView addTarget:self action:@selector(fus_functionBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside];
UILabel *tempBadgeLabel = [[UILabel alloc] init];
tempBadgeLabel.backgroundColor = [UIColor redColor];
tempBadgeLabel.font = [UIFont fus_themeBoldFont:10];
tempBadgeLabel.textColor = [UIColor whiteColor];
tempBadgeLabel.layer.cornerRadius = 14 / 2.0f;
tempBadgeLabel.layer.masksToBounds = YES;
tempBadgeLabel.tag = [typeNum integerValue];
tempBadgeLabel.hidden = YES;
[tempBgView addSubview:tempBadgeLabel];
[tempBadgeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.offset(-2);
make.right.offset(2);
make.height.offset(14);
make.width.greaterThanOrEqualTo(@(14));
}];
UIImageView *tempIconImgView = [[UIImageView alloc] init];
tempIconImgView.contentMode = UIViewContentModeScaleAspectFit;
[tempBgView addSubview:tempIconImgView];
......@@ -62,6 +79,7 @@
make.bottom.offset(-8);
}];
[self.badgeLabelsList addObject:tempBadgeLabel];
[self.viewList addObject:tempBgView];
switch ([typeNum integerValue]) {
......@@ -108,12 +126,61 @@
}
#pragma mark --- getter and setter
- (void)setModel:(FUSUserTradeRemindModel *)model{
_model = model;
for (UILabel *tempBadgeLabel in self.badgeLabelsList) {
tempBadgeLabel.hidden = YES;
switch (tempBadgeLabel.tag) {
case FUSMessageFunctionColumnClickedDiamond:{
if (model.gemRemindSum > 0) {
tempBadgeLabel.hidden = NO;
tempBadgeLabel.text = [NSString stringWithFormat:@" %ld ",model.gemRemindSum];
}
}
break;
case FUSMessageFunctionColumnClickedDew:{
if (model.chipRemindSum > 0) {
tempBadgeLabel.hidden = NO;
tempBadgeLabel.text = [NSString stringWithFormat:@" %ld ",model.chipRemindSum];
}
}
break;
case FUSMessageFunctionColumnClickedFire:{
if (model.bondsRemindSum > 0) {
tempBadgeLabel.hidden = NO;
tempBadgeLabel.text = [NSString stringWithFormat:@" %ld ",model.bondsRemindSum];
}
}
break;
case FUSMessageFunctionColumnClickedInvitationAndFollow:
case FUSMessageFunctionColumnClickedInvitation:
case FUSMessageFunctionColumnClickedFollow:{
if (model.inviteRemindSum > 0) {
tempBadgeLabel.hidden = NO;
//特殊处理,这个有的话也只显示一个圆点
tempBadgeLabel.text = @"";
}
}
break;
default:
break;
}
}
}
- (NSMutableArray *)viewList{
if (!_viewList) {
_viewList = [[NSMutableArray alloc] init];
}
return _viewList;
}
- (NSMutableArray *)badgeLabelsList{
if (!_badgeLabelsList) {
_badgeLabelsList = [[NSMutableArray alloc] init];
}
return _badgeLabelsList;
}
#pragma mark --- other
+ (CGFloat)fus_viewHeight{
......
......@@ -13,10 +13,12 @@
#import "FUSIntimateFriendTableView.h"
#import "FUSSegmentControlView.h"
#import <Masonry/Masonry.h>
#import "FUSCacheDataShare.h"
#import "FUSBaoFangHttpHelper.h"
// 导入通知框架
#import <UserNotifications/UserNotifications.h>
@interface FUSMessageView ()<UIScrollViewDelegate>
@interface FUSMessageView ()<UIScrollViewDelegate, FUSMessageFunctionColumnViewDelegate>
@property (nonatomic, strong) UIView *naviView;
@property (nonatomic, strong) UIButton *serviceBtn;
......@@ -24,7 +26,7 @@
@property (nonatomic, strong) UIStackView *headerStackView;
@property (nonatomic, strong) UIView *notificationRemindView;
@property (nonatomic, strong) UIView *functionColumnView;
@property (nonatomic, strong) FUSMessageFunctionColumnView *functionColumnView;
@property (nonatomic, strong) FUSSegmentControlView *segCtrlView;
@property (nonatomic, strong) UIScrollView *scrollView;
......@@ -34,6 +36,9 @@
/// 是用户点击关闭了通知提醒
@property (nonatomic, assign) BOOL isUserCloseNotificationRemind;
/// 四个红点的提醒
@property (nonatomic, strong) FUSUserTradeRemindModel *tradeRemindModel;
@end
@implementation FUSMessageView
......@@ -58,14 +63,7 @@
- (void)fus_viewWillShow{
[super fus_viewWillShow];
// FUSWeakSelf(weakself);
// [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:UNAuthorizationOptionBadge|UNAuthorizationOptionSound|UNAuthorizationOptionAlert completionHandler:^(BOOL granted, NSError * _Nullable error) {
// if (!weakself.isUserCloseNotificationRemind) {
// dispatch_sync(dispatch_get_main_queue(), ^{
// weakself.notificationRemindView.hidden = !granted;
// });
// }
// }];
[self fus_loadUserTradeRemind];
}
-(void)fus_createUI{
......@@ -160,6 +158,7 @@
// 功能面板
self.functionColumnView = [[FUSMessageFunctionColumnView alloc] init];
self.functionColumnView.delegate = self;
[self.headerStackView addArrangedSubview:self.functionColumnView];
[self.functionColumnView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.offset([FUSMessageFunctionColumnView fus_viewHeight]);
......@@ -239,7 +238,30 @@
}];
}
#pragma mark --- network
-(void)fus_loadUserTradeRemind{
FUSWeakSelf(weakself);
[FUSBaoFangHttpHelper fus_requestUserTradeRemindGetSuccess:^(FUSUserTradeRemindModel *model) {
weakself.tradeRemindModel = model;
[weakself fus_reloadMessageFunctionColumnUI];
} failure:^(NSString *msg, int code) {
}];
}
#pragma mark --- method
-(void)fus_reloadMessageFunctionColumnUI{
self.functionColumnView.model = self.tradeRemindModel;
// FUSUserTradeRemindModel *model = [[FUSUserTradeRemindModel alloc] init];
// model.gemRemindSum = 2;
// model.chipRemindSum = 20;
// model.bondsRemindSum = 99999999999;
// model.inviteRemindSum = 1;
// self.functionColumnView.model = model;
}
-(void)fus_reloadnotificationRemindTips{
FUSWeakSelf(weakself);
[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
......@@ -251,6 +273,43 @@
}];
}
#pragma mark --- FUSMessageFunctionColumnViewDelegate
-(void)fus_messageFunctionColumnViewDidClicked:(FUSMessageFunctionColumnClicked)clicked{
//这四个东西的红点遵循以下规则:
// 1.前三个有表现数值
// 2.最后一个只有红点
// 3.tabar是前三个与私信消息的相加
// 4.如果前三个与私信消息相加等于0,然后有红点,则tabbar显示红点
NSString *urlStr = @"";
switch (clicked) {
case FUSMessageFunctionColumnClickedDiamond:
urlStr = [FUSCacheDataShare shareStore].settingInitDataModel.fusiConfig.gemTradeAddress;
self.tradeRemindModel.gemRemindSum = 0;
break;
case FUSMessageFunctionColumnClickedDew:
urlStr = [FUSCacheDataShare shareStore].settingInitDataModel.fusiConfig.chipTradeAddress;
self.tradeRemindModel.chipRemindSum = 0;
break;
case FUSMessageFunctionColumnClickedFire:
urlStr = [FUSCacheDataShare shareStore].settingInitDataModel.fusiConfig.bondsTradeAddress;
self.tradeRemindModel.bondsRemindSum = 0;
break;
case FUSMessageFunctionColumnClickedInvitationAndFollow:
case FUSMessageFunctionColumnClickedInvitation:
case FUSMessageFunctionColumnClickedFollow:
urlStr = [FUSCacheDataShare shareStore].settingInitDataModel.fusiConfig.inviteTradeAddress;
self.tradeRemindModel.inviteRemindSum = 0;
break;
default:
break;
}
FUSWKWebViewController *vc = [[FUSWKWebViewController alloc] init];
vc.hiddenNavRightBtns = YES;
vc.webUrlString = urlStr;
[self.parentController.navigationController pushViewController:vc animated:YES];
[self fus_reloadMessageFunctionColumnUI];
}
#pragma mark --- observer
-(void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti{
[self fus_reloadnotificationRemindTips];
......
//
// FUSUserTradeRemindModel.h
// FuSiLive
//
// Created by aaa on 2024/6/26.
//
#import "FUSBaseModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 获取用户数据交易提醒
@interface FUSUserTradeRemindModel : FUSBaseModel
/// 萤火变化提醒数量
@property (nonatomic, assign) NSInteger bondsRemindSum;
/// 宝石变化提醒数量
@property (nonatomic, assign) NSInteger gemRemindSum;
/// 露水变化提醒数量
@property (nonatomic, assign) NSInteger chipRemindSum;
/// 邀请变化提醒数量
@property (nonatomic, assign) NSInteger inviteRemindSum;
@end
NS_ASSUME_NONNULL_END
//
// FUSUserTradeRemindModel.m
// FuSiLive
//
// Created by aaa on 2024/6/26.
//
#import "FUSUserTradeRemindModel.h"
@implementation FUSUserTradeRemindModel
@end
......@@ -56,19 +56,19 @@
- (void)fus_initial {
self.backgroundColor = [UIColor colorWithHex:@"#252230"];
self.backgroundColor = [UIColor fus_textInputBackgroundGrayColor];
self.layer.cornerRadius = 8;
self.layer.masksToBounds = YES;
self.mainTipLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, 0, self.width - 24, self.height / 2)];
self.mainTipLabel.textColor = [UIColor colorWithHex:@"#CCCCCC"];
self.mainTipLabel.textColor = [UIColor fus_textColorRich];
self.mainTipLabel.numberOfLines = 0;
self.mainTipLabel.font = [UIFont fus_themeFont:12];
[self addSubview:self.mainTipLabel];
self.subTipLabel = [[UILabel alloc] initWithFrame:self.mainTipLabel.frame];
self.subTipLabel.textColor = [UIColor colorWithHex:@"#808080"];
self.subTipLabel.textColor = [UIColor fus_textColorLight];
self.subTipLabel.font = [UIFont fus_themeFont:12];
self.subTipLabel.numberOfLines = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment