Commit 47fe547d by ludi

完成老玩家回归直播间检测弹窗

parent d0ddacdf
Showing with 166 additions and 4 deletions
......@@ -31,4 +31,22 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface FUSLiveSyncRightResultRecallShowModel : FUSBaseModel
/// 是否可完成回归大礼包资格(-1:不可完成、1:允许完成)
@property (nonatomic, assign) NSInteger recallShow;
/// 在直播間觀看超過指定时长(秒)
@property (nonatomic, assign) NSInteger recallOnlineTime;
/// 在直播間發言数量超過指定条数
@property (nonatomic, assign) NSInteger recallSendSpeak;
/// 展示类型 -1:无 1:首充储值 2:用户回归
@property (nonatomic, assign) NSInteger showChargeType;
-(void)fus_updateShowTime;
-(BOOL)fus_checkCanShow;
@end
NS_ASSUME_NONNULL_END
......@@ -6,6 +6,8 @@
//
#import "FUSAccountAgentcodeVerifyModel.h"
#import <FUSFoundation/FUSFoundation-Swift.h>
#import <FUSCommon/FUSCommon-Swift.h>
@implementation FUSAccountAgentcodeVerifyInfoModel
......@@ -15,3 +17,29 @@
@implementation FUSAccountAgentcodeVerifyModel
@end
@implementation FUSLiveSyncRightResultRecallShowModel
- (void)fus_updateShowTime{
[[NSUserDefaults standardUserDefaults] setDouble:[[NSDate date] timeIntervalSince1970] forKey:FUSSwiftCacheDataStoreKey.liveSyncRightResultRecallShowTimeInterval];
}
- (BOOL)fus_checkCanShow{
if (self.recallShow != 1) {
return NO;
}
NSTimeInterval lastShowTime = [[NSUserDefaults standardUserDefaults] doubleForKey:FUSSwiftCacheDataStoreKey.liveSyncRightResultRecallShowTimeInterval];
if (lastShowTime > 1) {
NSDate *lasShowDate = [NSDate dateWithTimeIntervalSince1970:lastShowTime];
if ([lasShowDate fus_oc_isSameWithUnit:NSCalendarUnitDay otherDate:[NSDate date]]) {
return YES;
}
}
else {
// 没有记录过,那么就是没弹过
return YES;
}
return NO;
}
@end
......@@ -50,6 +50,11 @@ import RxSwift
get{ FUSSwiftCacheDataShare.share.userFirstChargeAlertInfo.value }
set{ FUSSwiftCacheDataShare.share.userFirstChargeAlertInfo.accept(newValue) }
}
/// 回归大礼包资格 实际上就是在userFirstChargeAlertInfo里面截取的,因为两次业务时间过于久远,就不动上面的了
@objc public var oc_liveSyncRightResultRecallShowModel: FUSLiveSyncRightResultRecallShowModel {
get{ FUSSwiftCacheDataShare.share.liveSyncRightResultRecallShowModel.value }
set{ FUSSwiftCacheDataShare.share.liveSyncRightResultRecallShowModel.accept(newValue) }
}
/// 等级数据 OC
@objc public var oc_levelModelList: [FUSLevelDataModel]?{
get{ FUSSwiftCacheDataShare.share.levelModelList.value }
......@@ -86,6 +91,8 @@ import RxSwift
public let rechargeDataModelDict: BehaviorRelay<[String: FUSRechargeDataModel]> = .init(value: [:])
/// 用户首充信息弹窗的资料
public let userFirstChargeAlertInfo = BehaviorRelay<[String: Any]>(value: [:])
/// 回归大礼包资格 实际上就是在userFirstChargeAlertInfo里面截取的,因为两次业务时间过于久远,就不动上面的了
public let liveSyncRightResultRecallShowModel: BehaviorRelay<FUSLiveSyncRightResultRecallShowModel> = .init(value: .init())
/// 等级数据
public let levelModelList: BehaviorRelay<[FUSLevelDataModel]?> = .init(value: nil)
/// 用户一些设置
......@@ -346,11 +353,13 @@ import RxSwift
@objc public static let inviteUserInfo: Int = 11033
}
/// 本地存储的key
class FUSSwiftCacheDataStoreKey{
@objcMembers public class FUSSwiftCacheDataStoreKey: NSObject{
///用户背包未读道具的存储
static let backpackUnreadGetTimeKey = "CacheData_store_backpackUnreadGetTime"
///用户提示有新座驾的显示提示那个时间
static let showUseCarTipsDateKey = "CacheData_store_showUseCarTipsDateKey"
/// 记录回归大礼包弹出的时间
@objc static public let liveSyncRightResultRecallShowTimeInterval = "CacheData_store_liveSyncRightResultRecallShowTimeInterval"
}
......
......@@ -170,3 +170,17 @@ public extension Date {
return df
}
}
extension NSDate{
@objc public func fus_oc_isSame(unit: NSCalendar.Unit, otherDate: NSDate) -> Bool {
let swiftDate: Date = self as Date
let swiftOtherDate: Date = otherDate as Date
let componentsList: [Calendar.Component] = [.year, .month, .day, .hour, .minute, .second]
let unitList: [NSCalendar.Unit] = [.year, .month, .day, .hour, .minute, .second]
guard let unitIndex = unitList.firstIndex(of: unit)
else { return false}
let component = componentsList[unitIndex]
return swiftDate.fus_isSame(component: component, otherDate: swiftOtherDate)
}
}
......@@ -96,6 +96,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 首冲图标
+(UIImage *)fus_liveFirstChargeImage_normal;
/// 回归大礼包图标
+(UIImage *)fus_liveRecallGiftPackageImage_normal;
/// 客服动画
+ (NSArray<UIImage *> *)fus_service;
......
......@@ -252,6 +252,11 @@
NSArray *array = [self fus_animationImages:@"live_first_charge_btn_anim_" mainBundle:NO needCache:YES];
return [UIImage animatedImageWithImages:array duration:5];
}
/// 回归大礼包图标
+(UIImage *)fus_liveRecallGiftPackageImage_normal{
NSArray *array = [self fus_animationImages:@"live_recall_gift_package_btn_anim_" mainBundle:NO needCache:YES];
return [UIImage animatedImageWithImages:array duration:5];
}
/// 弹窗背景图
+ (NSArray<UIImage *> *)fus_service {
......
......@@ -2129,7 +2129,7 @@
// 是否有资格参与首充 1=有,0=没有
BOOL isQualifications = [firstCharge[@"isQualifications"] boolValue];
[FUSSwiftCacheDataShare share].oc_userFirstChargeAlertInfo = dataDict;
[FUSSwiftCacheDataShare share].oc_liveSyncRightResultRecallShowModel = [FUSLiveSyncRightResultRecallShowModel fus_modelWithDict:dataDict];
if (success) {
success(isQualifications,firstCharge);
}
......
......@@ -11,6 +11,7 @@
#import "FUSLiveShareToChatView.h"
#import "FUSLiveHelper.h"
#import <FUSCommon/FUSCommon-Swift.h>
@implementation FUSLiveBottomToolManager
......@@ -128,6 +129,9 @@
image = nil;
} else {
image = [UIImage fus_liveFirstChargeImage_normal];
if ([FUSSwiftCacheDataShare share].oc_liveSyncRightResultRecallShowModel.showChargeType == 2) {
image = [UIImage fus_liveRecallGiftPackageImage_normal];
}
}
break;
case FUSLiveBottomToolTypeRoomScope:
......
......@@ -468,6 +468,9 @@
[self.firstChargeBtn setImage:image forState:UIControlStateHighlighted];
} else {
image = [UIImage fus_liveFirstChargeImage_normal];
if ([FUSSwiftCacheDataShare share].oc_liveSyncRightResultRecallShowModel.showChargeType == 2) {
image = [UIImage fus_liveRecallGiftPackageImage_normal];
}
[self.firstChargeBtn setImage:image forState:UIControlStateNormal];
btn = self.firstChargeBtn;
......
......@@ -29,6 +29,9 @@
// */
//@property (nonatomic, strong) FUSGiftView *giftView;
/// 发送消息的次数
@property (nonatomic, assign) NSInteger sendTextCount;
/**
push 推出控制器回调,并返回控制器
*/
......
......@@ -25,6 +25,9 @@
#import "FUSBottomOptionalView.h"
#import "FUSLiveShareToChatView.h"
#import <FUSFoundation/FUSFoundation-Swift.h>
#import <FUSCommon/FUSCommon-Swift.h>
@interface FUSLiveChatInputHelper ()
@property (nonatomic, assign) BOOL isBeautyFace;
......@@ -56,7 +59,7 @@
[self registerReceiptNotification];
// [self createTimer];
// [self createTimer];
}
return self;
}
......@@ -68,6 +71,7 @@
{
[[NSNotificationCenter defaultCenter]removeObserver:self];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(recieveReceiptNotification:) name:STR(ROOM_CID_TEXT) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
// 处理消息回执通知方法
......@@ -102,6 +106,25 @@
}
}
-(void)fus_keyboardWillHide:(NSNotification *)notifi{
if (self.sendTextCount >= 10) {
// 发送超过10次。触发pingfen
// TODO: 看看pingfen什么时候做
NSDictionary *keyBoardInfo = [notifi userInfo];
CGFloat duration = [[keyBoardInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
}
// 发送超过n次,触发回归大礼包
FUSLiveSyncRightResultRecallShowModel *recallModel = [FUSSwiftCacheDataShare share].oc_liveSyncRightResultRecallShowModel;
if (self.sendTextCount > recallModel.recallSendSpeak) {
if ([recallModel fus_checkCanShow]) {
[recallModel fus_updateShowTime];
[[FUSLiveHelper shareInstance].currentFunctionView fus_showFirstChargeView:YES];
}
}
}
#pragma mark - chatInputView delegate
/**
......@@ -137,7 +160,7 @@
}
NSString *livingType = @"0";
MJWeakSelf
[FUSLiveHttpHelper fus_sendMessageWithMessage:message isBullet:isBullets roomId:[FUSLiveHelper shareInstance].roomInfoModel.roomId liveType:livingType atUid:uid liveChatModel:liveChatModel barrageType:barrageType success:^(NSDictionary *cvDict) {
// 更新变化数据
......@@ -148,6 +171,21 @@
[FUSEventTrack logEventWithName:@"chated_other"];
weakSelf.sendTextCount++;
if (weakSelf.sendTextCount == 10 && [FUSKeyboardShowHelper sharedInstance].isShow == NO) {
// 发送超过10次。触发pingfen
// TODO: 看看什么时候加pingfen
}
// 发送超过n次,触发回归大礼包
FUSLiveSyncRightResultRecallShowModel *recallModel = [FUSSwiftCacheDataShare share].oc_liveSyncRightResultRecallShowModel;
if (weakSelf.sendTextCount > recallModel.recallSendSpeak && [FUSKeyboardShowHelper sharedInstance].isShow == NO) {
if ([recallModel fus_checkCanShow]) {
[recallModel fus_updateShowTime];
[[FUSLiveHelper shareInstance].currentFunctionView fus_showFirstChargeView:YES];
}
}
// 记录文字链发送的次数
if ([[FUSCacheDataShare shareStore].userDetailInfo.isnew boolValue]) {
......
......@@ -1716,6 +1716,9 @@
image = nil;
} else {
image = [UIImage fus_liveFirstChargeImage_normal];
if ([FUSSwiftCacheDataShare share].oc_liveSyncRightResultRecallShowModel.showChargeType == 2) {
image = [UIImage fus_liveRecallGiftPackageImage_normal];
}
}
break;
case FUSLiveChatToolTypeRoomScope:
......
......@@ -299,6 +299,8 @@ UIGestureRecognizerDelegate
// 观众进入直播间计时
@property (nonatomic, strong) NSTimer *enterRoomTimer;
@property (nonatomic, assign) NSInteger enterRoomInterval;
@property (nonatomic, assign) BOOL userRatingDidShowed;
@property (nonatomic, assign) BOOL recallWellcomeDidShowed;
// 直播时长view
@property (nonatomic, strong) FUSLiveTimeRecordView *liveTimeRecordView;
......@@ -4503,6 +4505,8 @@ UIGestureRecognizerDelegate
_enterRoomTimer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(countEnterRoomTimer) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:_enterRoomTimer forMode:NSDefaultRunLoopMode];
_enterRoomInterval = 1;
_userRatingDidShowed = NO;
_recallWellcomeDidShowed = NO;
}
[self fus_updateTreasureBoxListIconType:1];
......@@ -4521,6 +4525,35 @@ UIGestureRecognizerDelegate
_enterRoomTimer = nil;
}
if (_enterRoomInterval >= 10 * 60 &&
self.isKeyboard == NO &&
self.userRatingDidShowed == NO) {
// 观看超过10分钟触发pingfen,正在打字的时候会影响
// TODO: pingfen看看什么时候做
self.userRatingDidShowed = YES;
}
// 触发回归大礼包
FUSLiveSyncRightResultRecallShowModel *recallModel = [FUSSwiftCacheDataShare share].oc_liveSyncRightResultRecallShowModel;
if (_enterRoomInterval > recallModel.recallOnlineTime &&
self.isKeyboard == NO &&
self.recallWellcomeDidShowed == NO) {
if ([recallModel fus_checkCanShow]) {
[recallModel fus_updateShowTime];
[self fus_showFirstChargeView:true];
}
self.recallWellcomeDidShowed = YES;
}
if (_enterRoomInterval > 3 * 60 &&
self.userRatingDidShowed == YES &&
self.recallWellcomeDidShowed == YES) {
[_enterRoomTimer invalidate];
_enterRoomTimer = nil;
}
_enterRoomInterval += 1;
}
......@@ -4839,6 +4872,7 @@ UIGestureRecognizerDelegate
}
[_chatInputHelper cancelTimerTaskAndDeleteTimer];
_chatInputHelper.sendTextCount = 0;
[_gameCatalogueView fus_dismissFromSuperView];
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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