任务完成提示调整

This commit is contained in:
chenguilong
2022-08-02 18:13:51 +08:00
parent 156ad42ef4
commit 88b4788427
5 changed files with 75 additions and 39 deletions

View File

@@ -78,6 +78,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
CustomMessageType_Anchor_FansTeam = 90, CustomMessageType_Anchor_FansTeam = 90,
///牌照房小时榜 ///牌照房小时榜
CustomMessageType_Licnese_Hour_Rank = 91, CustomMessageType_Licnese_Hour_Rank = 91,
///任务完成通知
CustomMessageType_Task_Complete = 92,
}; };
@@ -331,6 +333,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubRoomPlayDating){
typedef NS_ENUM(NSUInteger, CustomMessageSubFirstRecharge) { typedef NS_ENUM(NSUInteger, CustomMessageSubFirstRecharge) {
/// 首充完成 /// 首充完成
Custom_Message_Sub_Room_First_Recharge_Reward= 761, Custom_Message_Sub_Room_First_Recharge_Reward= 761,
/// 新用户专享优惠充值完成
Custom_Message_Sub_New_User_Recharge_Reward = 762,
}; };
/// 访客记录 /// 访客记录
@@ -415,6 +419,12 @@ typedef NS_ENUM(NSUInteger, CustomMessageLicneseHourRank) {
Custom_Message_Sub_Licnese_Hour_Rank = 911, Custom_Message_Sub_Licnese_Hour_Rank = 911,
}; };
///first = CustomMessageType_Task_Complete
typedef NS_ENUM(NSUInteger, CustomMessageTaskComplete) {
///任务完成通知
Custom_Message_Sub_TaskComplete = 921,
};
@interface AttachmentModel : NSObject<NIMCustomAttachment> @interface AttachmentModel : NSObject<NIMCustomAttachment>
@property (nonatomic,assign) int first; @property (nonatomic,assign) int first;
@property (nonatomic,assign) int second; @property (nonatomic,assign) int second;

View File

@@ -76,7 +76,6 @@
#import "XPRoomHalfMessageView.h" #import "XPRoomHalfMessageView.h"
#import "XPAcrossRoomPKCountDownView.h" #import "XPAcrossRoomPKCountDownView.h"
#import "XPNewUserRoomGiftView.h" #import "XPNewUserRoomGiftView.h"
#import "XPTaskCompleteTipView.h"
///PK ///PK
#import "XPAnchorFansTeamEntranceView.h" #import "XPAnchorFansTeamEntranceView.h"
#import "XPAnchorFansTeamViewController.h" #import "XPAnchorFansTeamViewController.h"
@@ -134,8 +133,6 @@
@property (nonatomic,assign) BOOL isLoadGreet; @property (nonatomic,assign) BOOL isLoadGreet;
///3s ///3s
@property (nonatomic, strong) dispatch_source_t userGiftTimer; @property (nonatomic, strong) dispatch_source_t userGiftTimer;
///
@property (nonatomic, strong) XPTaskCompleteTipView *taskTipView;
@end @end
@@ -1605,31 +1602,6 @@
}]; }];
} }
#pragma mark -
- (void)handleActivityTaskTip:(AttachmentModel *)attachment {
if (!self.taskTipView.superview) {
[self addSubview:self.taskTipView];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(jumpToTask:)];
[self.taskTipView addGestureRecognizer:tap];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self.taskTipView.superview) {
[self.taskTipView removeFromSuperview];
}
self.taskTipView = nil;
});
}
}
- (void)jumpToTask:(UITapGestureRecognizer *)ges {
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = self.taskTipView.url;
[self.delegate.getCurrentNav pushViewController:webVC animated:YES];
if (self.taskTipView.superview) {
[self.taskTipView removeFromSuperview];
}
self.taskTipView = nil;
}
#pragma mark - Getters And Setters #pragma mark - Getters And Setters
- (XPRoomRankEntranceView *)contributeEnterView { - (XPRoomRankEntranceView *)contributeEnterView {
if (!_contributeEnterView) { if (!_contributeEnterView) {
@@ -1796,11 +1768,4 @@
return _acrossPKCountView; return _acrossPKCountView;
} }
- (XPTaskCompleteTipView *)taskTipView {
if (!_taskTipView) {
_taskTipView = [[XPTaskCompleteTipView alloc] initWithFrame:CGRectMake(0, KScreenHeight - kSafeAreaBottomHeight-60, KScreenWidth, 20)];
}
return _taskTipView;
}
@end @end

View File

@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPTaskCompleteTipView : UIView @interface XPTaskCompleteTipView : UIView
@property (nonatomic, copy) NSString *desc;
@property (nonatomic, copy) NSString *url; @property (nonatomic, copy) NSString *url;
@end @end

View File

@@ -34,10 +34,6 @@
return self; return self;
} }
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
return nil;
}
- (void)initSubViews { - (void)initSubViews {
[self addSubview:self.mainView]; [self addSubview:self.mainView];
[self addSubview:self.nickLabel]; [self addSubview:self.nickLabel];
@@ -60,6 +56,16 @@
}]; }];
} }
- (void)setDesc:(NSString *)desc {
_desc = desc;
if (desc.length) {
self.nickLabel.text = desc;
}
}
- (void)setUrl:(NSString *)url {
_url = url;
}
#pragma mark - getter #pragma mark - getter
- (UIView *)mainView { - (UIView *)mainView {
@@ -69,6 +75,7 @@
_mainView.layer.masksToBounds = YES; _mainView.layer.masksToBounds = YES;
_mainView.layer.borderWidth = 0.5; _mainView.layer.borderWidth = 0.5;
_mainView.layer.borderColor = UIColorFromRGB(0xFFBC51).CGColor; _mainView.layer.borderColor = UIColorFromRGB(0xFFBC51).CGColor;
_mainView.backgroundColor = UIColorFromRGB(0x7A4B00);
} }
return _mainView; return _mainView;
} }

View File

@@ -35,6 +35,7 @@
#import "NewUserGreetModel.h" #import "NewUserGreetModel.h"
#import "FindNewGreetMessageModel.h" #import "FindNewGreetMessageModel.h"
#import "XPTabAnchorCardModel.h" #import "XPTabAnchorCardModel.h"
#import "FirstRechargeModel.h"
///VC ///VC
#import "TabbarViewController.h" #import "TabbarViewController.h"
#import "BaseViewController.h" #import "BaseViewController.h"
@@ -55,6 +56,9 @@
#import "XPHomeLivesViewController.h" #import "XPHomeLivesViewController.h"
#import "XPNewUserRechargeViewController.h" #import "XPNewUserRechargeViewController.h"
#import "XPAnchorCardView.h" #import "XPAnchorCardView.h"
#import "XPNewUserRechargeSucessView.h"
#import "XPTaskCompleteTipView.h"
#import "XPWebViewController.h"
///Present ///Present
#import "MainPresenter.h" #import "MainPresenter.h"
#import "MainProtocol.h" #import "MainProtocol.h"
@@ -83,6 +87,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
@property (nonatomic, assign) BOOL secondLaunchShowAnchorCard; @property (nonatomic, assign) BOOL secondLaunchShowAnchorCard;
/// ///
@property (nonatomic, strong) XPAnchorCardView *anchorCardView; @property (nonatomic, strong) XPAnchorCardView *anchorCardView;
///
@property (nonatomic, strong) XPTaskCompleteTipView *taskTipView;
@end @end
@@ -475,6 +481,18 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
if ([model isKindOfClass:XPMineVisitorUnReadModel.class]) { if ([model isKindOfClass:XPMineVisitorUnReadModel.class]) {
[[NSNotificationCenter defaultCenter] postNotificationName:kVisitorUnReadCountNotificationKey object:model]; [[NSNotificationCenter defaultCenter] postNotificationName:kVisitorUnReadCountNotificationKey object:model];
} }
} else if ([dic[@"first"] intValue] == CustomMessageType_First_Recharge_Reward && [dic[@"second"] intValue] == Custom_Message_Sub_New_User_Recharge_Reward) { //
if ([dic isKindOfClass:[NSDictionary class]]) {
FirstRechargeModel *model = [FirstRechargeModel modelWithDictionary:dic[@"data"]];
XPNewUserRechargeSucessView * firstRechargeView= [[XPNewUserRechargeSucessView alloc] init];
firstRechargeView.rechargeInfo = model;
[TTPopup popupView:firstRechargeView style:TTPopupStyleAlert];
}
} else if ([dic[@"first"] intValue] == CustomMessageType_Task_Complete && [dic[@"second"] intValue] == Custom_Message_Sub_TaskComplete) {///
if ([dic isKindOfClass:[NSDictionary class]]) {
NSDictionary *dict = dic[@"data"];
[self handleActivityTaskTip:dict[@"taskCompleteMsg"] url:dic[@"taskUrl"]];
}
} }
} }
} }
@@ -521,6 +539,33 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
} }
} }
#pragma mark -
- (void)handleActivityTaskTip:(NSString *)msg url:(NSString *)url {
if (!self.taskTipView.superview && url.length) {
[self.view addSubview:self.taskTipView];
self.taskTipView.desc = msg;
self.taskTipView.url = url;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(jumpToTask:)];
[self.taskTipView addGestureRecognizer:tap];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self.taskTipView.superview) {
[self.taskTipView removeFromSuperview];
}
self.taskTipView = nil;
});
}
}
- (void)jumpToTask:(UITapGestureRecognizer *)ges {
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = self.taskTipView.url;
[self.selectedViewController.navigationController pushViewController:webVC animated:YES];
if (self.taskTipView.superview) {
[self.taskTipView removeFromSuperview];
}
self.taskTipView = nil;
}
#pragma mark - XPAnchorCardViewDelegate #pragma mark - XPAnchorCardViewDelegate
- (void)xPAnchorCardViewEnterRoom:(NSString *)roomUid { - (void)xPAnchorCardViewEnterRoom:(NSString *)roomUid {
if (roomUid) { if (roomUid) {
@@ -571,4 +616,11 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
return _anchorCardView; return _anchorCardView;
} }
- (XPTaskCompleteTipView *)taskTipView {
if (!_taskTipView) {
_taskTipView = [[XPTaskCompleteTipView alloc] initWithFrame:CGRectMake(0, KScreenHeight - kSafeAreaBottomHeight-60-20, KScreenWidth, 20)];
}
return _taskTipView;
}
@end @end