青少年弹框
This commit is contained in:
@@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface XPConstant : NSObject
|
||||
|
||||
UIKIT_EXTERN NSString * const kWeChatNumber;
|
||||
UIKIT_EXTERN NSString * const kTeenagerAlertDatekey;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, KeyType) {
|
||||
KeyType_PasswordEncode,///密码 des 加密的
|
||||
|
@@ -10,6 +10,7 @@
|
||||
@implementation XPConstant
|
||||
|
||||
NSString * const kWeChatNumber = @"yinyoucc";
|
||||
NSString * const kTeenagerAlertDatekey = @"kTeenagerAlertDatekey";
|
||||
|
||||
///在里面进行判断当前环境是什么
|
||||
NSString * const KeyWithType(KeyType type) {
|
||||
|
@@ -25,9 +25,9 @@
|
||||
NSString * newpasswordDes = [DESEncrypt encryptUseDES:password key:KeyWithType(KeyType_PasswordEncode)];
|
||||
[Api openOrCloseParentModel:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] openOrCloseParentSuccessStatus:status];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
|
||||
}] password:newpasswordDes status:@(status) uid:uid];
|
||||
} showLoading:YES] password:newpasswordDes status:@(status) uid:uid];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -8,19 +8,10 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPTeenagerAlertViewDelegate <NSObject>
|
||||
|
||||
///隐藏view
|
||||
- (void)hiddeView;
|
||||
///点击了去设置青年模式
|
||||
- (void)didClickTeenagerButtonAction:(UIButton *)button;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPTeenagerAlertView : UIView
|
||||
/** */
|
||||
@property (nonatomic,weak) id<XPTeenagerAlertViewDelegate> delegate;
|
||||
|
||||
///push 操作的控制器
|
||||
@property (nonatomic,weak) UIViewController * controller;;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -12,6 +12,9 @@
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "UIButton+EnlargeTouchArea.h"
|
||||
#import "TTPopup.h"
|
||||
|
||||
#import "XPMineTeenagerViewController.h"
|
||||
|
||||
@interface XPTeenagerAlertView ()
|
||||
@property (nonatomic, strong) UIView *bgView;
|
||||
@@ -23,7 +26,8 @@
|
||||
@end
|
||||
|
||||
@implementation XPTeenagerAlertView
|
||||
#pragma mark lifeCycle
|
||||
#pragma mark lifeCycle
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
@@ -82,15 +86,13 @@
|
||||
|
||||
#pragma mark Event Response
|
||||
- (void)onClickCloseButtonAction:(UIButton *)closeButton {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(hiddeView)]) {
|
||||
[self.delegate hiddeView];
|
||||
}
|
||||
[TTPopup dismiss];
|
||||
}
|
||||
|
||||
- (void)onClickTeeagersButtonAction:(UIButton *)teeagersButton {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickTeenagerButtonAction:)]) {
|
||||
[self.delegate didClickTeenagerButtonAction:teeagersButton];
|
||||
}
|
||||
[TTPopup dismiss];
|
||||
XPMineTeenagerViewController * teenagerVC = [[XPMineTeenagerViewController alloc] init];
|
||||
[self.controller.navigationController pushViewController:teenagerVC animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark Getters and Setters
|
||||
@@ -125,7 +127,7 @@
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Bold" size:16];
|
||||
_titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
_titleLabel.textColor = [ThemeColor alertTitleColor];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_titleLabel.text = @"青少年保护";
|
||||
}
|
||||
@@ -136,11 +138,11 @@
|
||||
if (!_textLabel) {
|
||||
_textLabel = [[UILabel alloc] init];
|
||||
_textLabel.font = [UIFont systemFontOfSize:13];
|
||||
_textLabel.textColor = [ThemeColor secondTextColor];
|
||||
_textLabel.textColor = [ThemeColor textThirdColor];
|
||||
_textLabel.numberOfLines = 0;
|
||||
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
[paragraphStyle setLineSpacing:3]; //设置行间距
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"为呵护青少年健康成长,音游推出“青少年模式”,该模式下针对青少年推送精选优化的内容。"];
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"为呵护青少年健康成长,%@推出“青少年模式”,该模式下针对青少年推送精选优化的内容。", AppName]];
|
||||
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [attributedString length])];
|
||||
_textLabel.attributedText = attributedString;
|
||||
}
|
||||
|
@@ -135,11 +135,10 @@
|
||||
}
|
||||
|
||||
#pragma mark - XPMineTeenagePwdViewControllerDelegate
|
||||
///
|
||||
- (void)didChangeTeenagerStatus:(BOOL)status {
|
||||
UserInfoModel * userInfo = self.userInfo;
|
||||
userInfo.parentMode = status;
|
||||
self.userInfo = userInfo;
|
||||
userInfo.parentMode = status;
|
||||
self.userInfo = userInfo;
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)openParentBtnAction:(UIButton *)sender {
|
||||
|
@@ -15,6 +15,8 @@
|
||||
#import "UIImage+Utils.h"
|
||||
#import "XCHUDTool.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "TTPopup.h"
|
||||
#import "XPConstant.h"
|
||||
///Model
|
||||
#import "AccountModel.h"
|
||||
///VC
|
||||
@@ -29,6 +31,7 @@
|
||||
#import "SessionListViewController.h"
|
||||
#import "XPHomeContainerViewController.h"
|
||||
#import "XPMiniRoomView.h"
|
||||
#import "XPTeenagerAlertView.h"
|
||||
///Present
|
||||
#import "MainPresenter.h"
|
||||
#import "MainProtocol.h"
|
||||
@@ -95,6 +98,7 @@
|
||||
return;
|
||||
}
|
||||
[self initTabs:YES];
|
||||
[self showTeenagerAlertView:userInfo];
|
||||
}
|
||||
|
||||
#pragma mark - BaseMvpProtocol
|
||||
@@ -210,4 +214,18 @@
|
||||
[self.view addSubview:[XPMiniRoomView shareMiniRoomView]];
|
||||
}
|
||||
|
||||
#pragma mark - 青少年模式
|
||||
- (void)showTeenagerAlertView:(UserInfoModel *)userInfo {
|
||||
if (!userInfo || userInfo.uid <=0) return; ///用户信息为空 不处理
|
||||
if (userInfo.parentMode) return;// 开启了青少年模式的话 就不用处理
|
||||
NSString * teenagerKey = [NSString stringWithFormat:@"%@_%ld", kTeenagerAlertDatekey, userInfo.uid];
|
||||
NSDate * oldDate = [[NSUserDefaults standardUserDefaults] objectForKey:teenagerKey];
|
||||
BOOL isSameDay = [[NSCalendar currentCalendar] isDateInToday:oldDate];
|
||||
if (isSameDay) return;
|
||||
XPTeenagerAlertView * teenagerView = [[XPTeenagerAlertView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth - 45, 260)];
|
||||
teenagerView.controller = self;
|
||||
[TTPopup popupView:teenagerView style:TTPopupStyleAlert];
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:teenagerKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user