青少年模式和 弹框设置青少年的view

This commit is contained in:
fengshuo
2021-09-22 18:30:15 +08:00
committed by zu
parent d12bf88484
commit 2afb85e8d7
28 changed files with 1245 additions and 2 deletions

View File

@@ -104,6 +104,15 @@
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308826E89BE000B90D4F /* LoginPhoneViewController.m */; };
E872308D26E89DAA00B90D4F /* LoginInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308C26E89DAA00B90D4F /* LoginInputView.m */; };
E872309326E8D31500B90D4F /* LoginVerifCodeView.m in Sources */ = {isa = PBXBuildFile; fileRef = E872309226E8D31500B90D4F /* LoginVerifCodeView.m */; };
E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CA426FB088600DA9178 /* XPMineTeenagerViewController.m */; };
E88B5CA826FB089C00DA9178 /* XPMineTeenagePwdViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CA726FB089C00DA9178 /* XPMineTeenagePwdViewController.m */; };
E88B5CAD26FB16A800DA9178 /* XPMineTeenagerDesView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CAC26FB16A800DA9178 /* XPMineTeenagerDesView.m */; };
E88B5CB026FB1C6500DA9178 /* XPMineTeenagerPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CAF26FB1C6500DA9178 /* XPMineTeenagerPresenter.m */; };
E88B5CB226FB1CFF00DA9178 /* XPMineTeenagerProtocol.h in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CB126FB1CC100DA9178 /* XPMineTeenagerProtocol.h */; };
E88B5CB526FB20B800DA9178 /* XPMineTeenagerPwdView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CB426FB20B800DA9178 /* XPMineTeenagerPwdView.m */; };
E88B5CB826FB325200DA9178 /* XPMineTeenagerPwdPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CB726FB325200DA9178 /* XPMineTeenagerPwdPresenter.m */; };
E88B5CBA26FB329C00DA9178 /* XPMineTeenagerPwdProtocol.h in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CB926FB327500DA9178 /* XPMineTeenagerPwdProtocol.h */; };
E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88B5CBC26FB3BDF00DA9178 /* XPTeenagerAlertView.m */; };
E8AC720D26F435F5007D6E91 /* UIImageView+LoadImage.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AC720C26F435F5007D6E91 /* UIImageView+LoadImage.m */; };
E8AC721026F43955007D6E91 /* UIImageConstant.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AC720F26F43955007D6E91 /* UIImageConstant.m */; };
E8AC721326F46ADD007D6E91 /* XPMineSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8AC721226F46ADD007D6E91 /* XPMineSettingViewController.m */; };
@@ -329,6 +338,22 @@
E872308C26E89DAA00B90D4F /* LoginInputView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginInputView.m; sourceTree = "<group>"; };
E872309126E8D31500B90D4F /* LoginVerifCodeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginVerifCodeView.h; sourceTree = "<group>"; };
E872309226E8D31500B90D4F /* LoginVerifCodeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginVerifCodeView.m; sourceTree = "<group>"; };
E88B5CA326FB088600DA9178 /* XPMineTeenagerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagerViewController.h; sourceTree = "<group>"; };
E88B5CA426FB088600DA9178 /* XPMineTeenagerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineTeenagerViewController.m; sourceTree = "<group>"; };
E88B5CA626FB089C00DA9178 /* XPMineTeenagePwdViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagePwdViewController.h; sourceTree = "<group>"; };
E88B5CA726FB089C00DA9178 /* XPMineTeenagePwdViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineTeenagePwdViewController.m; sourceTree = "<group>"; };
E88B5CAB26FB16A800DA9178 /* XPMineTeenagerDesView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagerDesView.h; sourceTree = "<group>"; };
E88B5CAC26FB16A800DA9178 /* XPMineTeenagerDesView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineTeenagerDesView.m; sourceTree = "<group>"; };
E88B5CAE26FB1C6500DA9178 /* XPMineTeenagerPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagerPresenter.h; sourceTree = "<group>"; };
E88B5CAF26FB1C6500DA9178 /* XPMineTeenagerPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineTeenagerPresenter.m; sourceTree = "<group>"; };
E88B5CB126FB1CC100DA9178 /* XPMineTeenagerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagerProtocol.h; sourceTree = "<group>"; };
E88B5CB326FB20B800DA9178 /* XPMineTeenagerPwdView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagerPwdView.h; sourceTree = "<group>"; };
E88B5CB426FB20B800DA9178 /* XPMineTeenagerPwdView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineTeenagerPwdView.m; sourceTree = "<group>"; };
E88B5CB626FB325200DA9178 /* XPMineTeenagerPwdPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagerPwdPresenter.h; sourceTree = "<group>"; };
E88B5CB726FB325200DA9178 /* XPMineTeenagerPwdPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineTeenagerPwdPresenter.m; sourceTree = "<group>"; };
E88B5CB926FB327500DA9178 /* XPMineTeenagerPwdProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineTeenagerPwdProtocol.h; sourceTree = "<group>"; };
E88B5CBB26FB3BDF00DA9178 /* XPTeenagerAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPTeenagerAlertView.h; sourceTree = "<group>"; };
E88B5CBC26FB3BDF00DA9178 /* XPTeenagerAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTeenagerAlertView.m; sourceTree = "<group>"; };
E8AC720B26F435F5007D6E91 /* UIImageView+LoadImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImageView+LoadImage.h"; sourceTree = "<group>"; };
E8AC720C26F435F5007D6E91 /* UIImageView+LoadImage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+LoadImage.m"; sourceTree = "<group>"; };
E8AC720E26F43955007D6E91 /* UIImageConstant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIImageConstant.h; sourceTree = "<group>"; };
@@ -865,6 +890,30 @@
path = CustomView;
sourceTree = "<group>";
};
E88B5CA926FB15B900DA9178 /* Teenager */ = {
isa = PBXGroup;
children = (
E88B5CA326FB088600DA9178 /* XPMineTeenagerViewController.h */,
E88B5CA426FB088600DA9178 /* XPMineTeenagerViewController.m */,
E88B5CA626FB089C00DA9178 /* XPMineTeenagePwdViewController.h */,
E88B5CA726FB089C00DA9178 /* XPMineTeenagePwdViewController.m */,
);
path = Teenager;
sourceTree = "<group>";
};
E88B5CAA26FB168200DA9178 /* Teenager */ = {
isa = PBXGroup;
children = (
E88B5CAB26FB16A800DA9178 /* XPMineTeenagerDesView.h */,
E88B5CAC26FB16A800DA9178 /* XPMineTeenagerDesView.m */,
E88B5CB326FB20B800DA9178 /* XPMineTeenagerPwdView.h */,
E88B5CB426FB20B800DA9178 /* XPMineTeenagerPwdView.m */,
E88B5CBB26FB3BDF00DA9178 /* XPTeenagerAlertView.h */,
E88B5CBC26FB3BDF00DA9178 /* XPTeenagerAlertView.m */,
);
path = Teenager;
sourceTree = "<group>";
};
E8AC720A26F435AF007D6E91 /* UIImageView */ = {
isa = PBXGroup;
children = (
@@ -944,6 +993,7 @@
E824545526F5E51900BE8163 /* XPMineVerifIdentityViewController.m */,
E824545F26F5F4E400BE8163 /* XPMineResetPayPwdViewController.h */,
E824546026F5F4E400BE8163 /* XPMineResetPayPwdViewController.m */,
E88B5CA926FB15B900DA9178 /* Teenager */,
);
path = View;
sourceTree = "<group>";
@@ -967,6 +1017,10 @@
E824545B26F5EEBA00BE8163 /* XPMineVerifIdentityPresenter.m */,
E824546226F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.h */,
E824546326F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m */,
E88B5CAE26FB1C6500DA9178 /* XPMineTeenagerPresenter.h */,
E88B5CAF26FB1C6500DA9178 /* XPMineTeenagerPresenter.m */,
E88B5CB626FB325200DA9178 /* XPMineTeenagerPwdPresenter.h */,
E88B5CB726FB325200DA9178 /* XPMineTeenagerPwdPresenter.m */,
);
path = Presenter;
sourceTree = "<group>";
@@ -982,6 +1036,8 @@
E824545226F5CE9C00BE8163 /* XPMineModifPayProtocol.h */,
E824545D26F5EEFD00BE8163 /* XPMineVerifIdentityProtocol.h */,
E824546526F5FF5100BE8163 /* XPMineResetPayPasswordProtocol.h */,
E88B5CB126FB1CC100DA9178 /* XPMineTeenagerProtocol.h */,
E88B5CB926FB327500DA9178 /* XPMineTeenagerPwdProtocol.h */,
);
path = Protocol;
sourceTree = "<group>";
@@ -989,6 +1045,7 @@
E8E70D7F26F2F39000F03460 /* SubViews */ = {
isa = PBXGroup;
children = (
E88B5CAA26FB168200DA9178 /* Teenager */,
E8E70D8126F2F51A00F03460 /* XPMineHeadView.h */,
E8E70D8226F2F51A00F03460 /* XPMineHeadView.m */,
E8E70D8426F2F55C00F03460 /* XPMineAccountView.h */,
@@ -1151,6 +1208,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E88B5CBA26FB329C00DA9178 /* XPMineTeenagerPwdProtocol.h in Sources */,
E88B5CB226FB1CFF00DA9178 /* XPMineTeenagerProtocol.h in Sources */,
E824546626F5FF6000BE8163 /* XPMineResetPayPasswordProtocol.h in Sources */,
E824545E26F5EF2200BE8163 /* XPMineVerifIdentityProtocol.h in Sources */,
E824545326F5CEAD00BE8163 /* XPMineModifPayProtocol.h in Sources */,
@@ -1166,6 +1225,7 @@
E8E70D7E26F2F19D00F03460 /* Api+Mine.m in Sources */,
E824543D26F58C3A00BE8163 /* XPLoginBindSuccessView.m in Sources */,
E81C27A226EF23490031E639 /* XPEnum.h in Sources */,
E88B5CB526FB20B800DA9178 /* XPMineTeenagerPwdView.m in Sources */,
E81C279826EB3AC40031E639 /* LoginForgetPasswordProtocol.h in Sources */,
E82109B026F1D83500FC3319 /* LoginBindPhonePresent.m in Sources */,
E8B825C726EA0D9A009E8E9F /* LoginVerifCodeProtocol.h in Sources */,
@@ -1177,6 +1237,7 @@
E8AC723D26F4B6AA007D6E91 /* XPLoginBindPhoneResultViewController.m in Sources */,
189DD73E26E21C3F00AB55B1 /* YYUtility.m in Sources */,
E8E70D8926F2F58F00F03460 /* XPMineMatchTableViewCell.m in Sources */,
E88B5CA826FB089C00DA9178 /* XPMineTeenagePwdViewController.m in Sources */,
E81C279626EB39CC0031E639 /* LoginForgetPasswordPresent.m in Sources */,
E8B825B726E9A7D8009E8E9F /* BaseObject.m in Sources */,
E8AC723526F49939007D6E91 /* XPMineNotificaPresenter.m in Sources */,
@@ -1214,6 +1275,7 @@
18E7B1B726E8B2D10064BC9B /* Api+Main.m in Sources */,
E824546126F5F4E400BE8163 /* XPMineResetPayPwdViewController.m in Sources */,
E8B825C226EA00DF009E8E9F /* LoginVerifCodePresent.m in Sources */,
E88B5CB026FB1C6500DA9178 /* XPMineTeenagerPresenter.m in Sources */,
18E7B1B226E8AF980064BC9B /* MainPresenter.m in Sources */,
E81366F626F0C0DF0076364C /* LoginFullInfoPresenter.m in Sources */,
189DD67E26E1FD8900AB55B1 /* UIImage+Utils.m in Sources */,
@@ -1223,6 +1285,7 @@
E824543526F57D6E00BE8163 /* XPLoginVerifBindPhoneViewController.m in Sources */,
E8B825CD26EA18C8009E8E9F /* ThemeColor.m in Sources */,
E8AC720D26F435F5007D6E91 /* UIImageView+LoadImage.m in Sources */,
E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */,
E8CEA03D26EA3DE500644B44 /* LoginPasswordPresent.m in Sources */,
E8E70D7726F2F15100F03460 /* XPMineViewController.m in Sources */,
E8AC722C26F49580007D6E91 /* XPMineNotificaViewController.m in Sources */,
@@ -1233,10 +1296,12 @@
E81366E726F0A49E0076364C /* NSString+Regex.m in Sources */,
189DD56526DE465A00AB55B1 /* LoginViewController.m in Sources */,
E824544B26F5BBB800BE8163 /* XPMineModifPayPwdViewController.m in Sources */,
E88B5CAD26FB16A800DA9178 /* XPMineTeenagerDesView.m in Sources */,
E824545126F5CE6E00BE8163 /* XPMineModifPayPwdPresenter.m in Sources */,
E8AC723A26F49AAE007D6E91 /* XPMineNotifyStatus.m in Sources */,
18E7B33226F317A20064BC9B /* XPWebViewController.m in Sources */,
E8AC721C26F4720B007D6E91 /* XPMineSettingPresent.m in Sources */,
E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */,
18C17A5D26F338F300C48E11 /* XplanFBFlutterViewContainer.m in Sources */,
E8B825BF26E9E57D009E8E9F /* LoginTicketInfo.m in Sources */,
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */,
@@ -1258,6 +1323,7 @@
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */,
18E7B29026EA0E6B0064BC9B /* FlutterBoost+Xplan.m in Sources */,
189DD75926E6003C00AB55B1 /* Api.m in Sources */,
E88B5CB826FB325200DA9178 /* XPMineTeenagerPwdPresenter.m in Sources */,
189DD53F26DE255600AB55B1 /* main.m in Sources */,
E872308D26E89DAA00B90D4F /* LoginInputView.m in Sources */,
189DD58F26DF97E700AB55B1 /* LoginPresenter.m in Sources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mine_teeager_alter_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mine_teeager_alter_close@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mine_teenager_parents_mode_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mine_teenager_parents_mode_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -18,6 +18,7 @@ typedef NS_ENUM(NSUInteger, URLType) {
kFAQURL,///帮助
kIdentityURL,///实名认证
kGameBindAccountURL,
kNurseryURL,///护苗计划
};
NSString * const URLWithType(URLType type);

View File

@@ -18,6 +18,7 @@ NSString * const URLWithType(URLType type) {
@(kFAQURL) : @"modules/rule/guide.html ",//
@(kIdentityURL):@"modules/identity/new.html",//
@(kGameBindAccountURL):@"modules/game/bindAccount.html",///
@(kNurseryURL):@"activity/cleanNet/index.html",
};
NSString * url = [dic objectForKey:@(type)];

View File

@@ -61,6 +61,16 @@ NS_ASSUME_NONNULL_BEGIN
oldPasswd:(NSString *)oldPasswd
uid:(NSString *)uid
ticket:(NSString *)ticket;
/// 开启关闭家长模式
/// @param complection 完成
/// @param password 密码
/// @param status 状态 0 开启 1 关闭
/// @param uid 用户的uid
+ (void)openOrCloseParentModelWithComplection:(HttpRequestHelperCompletion)complection
password:(NSString *)password
status:(NSNumber *)status
uid:(NSString *)uid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -62,4 +62,14 @@
+ (void)modifPayPasswordWithComplection:(HttpRequestHelperCompletion)complection newPasswd:(NSString *)newPasswd oldPasswd:(NSString *)oldPasswd uid:(NSString *)uid ticket:(NSString *)ticket {
[self makeRequest:@"user/paymentPasswd/modify" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, newPasswd,oldPasswd,uid,ticket, nil];
}
///
/// @param complection
/// @param password
/// @param status 0 1
/// @param uid uid
+ (void)openOrCloseParentModelWithComplection:(HttpRequestHelperCompletion)complection password:(NSString *)password status:(NSNumber *)status uid:(NSString *)uid {
[self makeRequest:@"user/openOrClose" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, password,status,uid, nil];
}
@end

View File

@@ -0,0 +1,17 @@
//
// XPMineTeenagerPresenter.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMineTeenagerPresenter : BaseMvpPresenter
// 获取用户信息
- (void)getUserInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,32 @@
//
// XPMineTeenagerPresenter.m
// xplan-ios
//
// Created by on 2021/9/22.
//
#import "XPMineTeenagerPresenter.h"
///Api
#import "Api+Mine.h"
///Tool
#import "AccountInfoStorage.h"
///Model
#import "UserInfoModel.h"
///P
#import "XPMineTeenagerProtocol.h"
@implementation XPMineTeenagerPresenter
//
- (void)getUserInfo {
NSString * uid = [[AccountInfoStorage instance] getUid];
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
[[self getView] onGetUserInfoSuccess:infoModel];
} fail:^(NSInteger code, NSString * _Nullable msg) {
}] uid:uid];
}
@end

View File

@@ -0,0 +1,21 @@
//
// XPMineTeenagerPwdPresenter.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMineTeenagerPwdPresenter : BaseMvpPresenter
/// 开启关闭青少年模式
/// @param password 密码
/// @param status 开启 或者关闭
- (void)openOrCloseParentWithPassowrd:(NSString *)password status:(BOOL)status;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
//
// XPMineTeenagerPwdPresenter.m
// xplan-ios
//
// Created by on 2021/9/22.
//
#import "XPMineTeenagerPwdPresenter.h"
#import "Api+Mine.h"
///Tool
#import "AccountInfoStorage.h"
#import "DESEncrypt.h"
#import "XPConstant.h"
///P
#import "XPMineTeenagerPwdProtocol.h"
@implementation XPMineTeenagerPwdPresenter
///
/// @param password
/// @param status
- (void)openOrCloseParentWithPassowrd:(NSString *)password status:(BOOL)status {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * newpasswordDes = [DESEncrypt encryptUseDES:password key:KeyWithType(KeyType_PasswordEncode)];
[Api openOrCloseParentModelWithComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] openOrCloseParentSuccessStatus:status];
} fail:^(NSInteger code, NSString * _Nullable msg) {
}] password:newpasswordDes status:@(status) uid:uid];
}
@end

View File

@@ -0,0 +1,18 @@
//
// XPMineTeenagerProtocol.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class UserInfoModel;
@protocol XPMineTeenagerProtocol <NSObject>
///获取用户信息成功
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// XPMineTeenagerPwdProtocol.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol XPMineTeenagerPwdProtocol <NSObject>
///开启关闭青少年模式
- (void)openOrCloseParentSuccessStatus:(BOOL)status;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,17 @@
//
// XPMineTeenagerDesView.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPMineTeenagerDesView : UIView
///显示标题
@property (nonatomic,copy) NSString *title;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,79 @@
//
// XPMineTeenagerDesView.m
// xplan-ios
//
// Created by on 2021/9/22.
//
#import "XPMineTeenagerDesView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
@interface XPMineTeenagerDesView ()
///
@property (nonatomic,strong) UIView * circleView;
///
@property (nonatomic,strong) UILabel *titleLabel;
@end
@implementation XPMineTeenagerDesView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.circleView];
[self addSubview:self.titleLabel];
}
- (void)initSubViewConstraints {
[self.circleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(0);
make.centerY.mas_equalTo(self);;
make.size.mas_equalTo(CGSizeMake(4, 4));
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.circleView.mas_right).offset(10);
make.centerY.mas_equalTo(self.circleView);
}];
}
#pragma mark - Getters And Setters
- (void)setTitle:(NSString *)title {
_title = title;
if (_title.length > 0) {
self.titleLabel.text = _title;
}
}
- (UIView *)circleView {
if (!_circleView) {
_circleView = [[UIView alloc] init];
_circleView.backgroundColor = ThemeColor.disableButtonColor;
_circleView.layer.cornerRadius = 2;
_circleView.layer.masksToBounds = YES;
}
return _circleView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:13];
_titleLabel.textColor = [ThemeColor disableButtonTextColor];
}
return _titleLabel;
}
@end

View File

@@ -0,0 +1,30 @@
//
// XPMineTeenagerPwdView.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPMineTeenagerPwdView : UIView
///
@property (nonatomic,copy,readonly) NSString *code;
@property (nonatomic, strong, readonly) UITextField *bgTf;
@property (nonatomic, strong) void (^returnBlock)(NSString *pwStr);
- (instancetype)initWithFrame:(CGRect)frame withNum:(NSInteger)num;
- (void)clearPassword;
@end
@interface XPTeenagerPasswordLabel : UILabel
- (instancetype)initWithFrame:(CGRect)frame;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,120 @@
//
// XPMineTeenagerPwdView.m
// xplan-ios
//
// Created by on 2021/9/22.
//
#import "XPMineTeenagerPwdView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
@interface XPMineTeenagerPwdView ()
@property (nonatomic,copy) NSString *code;
@property (nonatomic, strong) UITextField *bgTf;
@property (nonatomic, strong) NSMutableArray *lbArray;
@end
@implementation XPMineTeenagerPwdView
-(instancetype)initWithFrame:(CGRect)frame
withNum:(NSInteger)num{
self=[super initWithFrame:frame];
if (self) {
self.lbArray = [NSMutableArray array];
self.bgTf = [[UITextField alloc] initWithFrame:CGRectMake(0, 0,1 , 1)];
self.bgTf.textColor = [ThemeColor mainTextColor];
self.bgTf.tintColor = [UIColor clearColor];
[self.bgTf addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
self.bgTf.keyboardType = UIKeyboardTypeNumberPad;
[self.bgTf becomeFirstResponder];
[self addSubview:self.bgTf];
CGFloat itemWidth = 45;
CGFloat itemHeight = 45;
CGFloat itemSpace = 11;
for (int i = 0; i < num; i++) {
XPTeenagerPasswordLabel *codeLab = [[XPTeenagerPasswordLabel alloc] initWithFrame:CGRectMake(itemSpace * (i+1) + itemWidth * i, 0, itemWidth, itemHeight)];
codeLab.tag = 100 + i;
[self addSubview:codeLab];
[self.lbArray addObject:codeLab];
}
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
[self addGestureRecognizer:tap];
UILabel * label = [self.lbArray lastObject];
if (label) {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(label.mas_right);
make.height.mas_equalTo(itemHeight);
}];
}
}
return self;
}
- (void)tapAction:(UITapGestureRecognizer *)sender {
if (self.bgTf.canBecomeFirstResponder) {
[self.bgTf becomeFirstResponder];
}
}
- (void)textFieldDidChange:(UITextField *)textField {
if (textField.text.length > self.lbArray.count) {
textField.text = [textField.text substringToIndex:self.lbArray.count];
}
if (_returnBlock != nil) {
_returnBlock(textField.text);
}
self.code = textField.text;
if (textField.text.length >= 5) {
[textField resignFirstResponder];
}
for (UILabel *pwLab in self.lbArray) {
if (pwLab.tag < (100 + textField.text.length)) {
NSRange range = NSMakeRange(pwLab.tag-100, 1);
pwLab.text = [textField.text substringWithRange:range];
}else{
pwLab.text = @"";
}
}
}
- (void)clearPassword {
self.bgTf.text = @"";
for (UILabel *pwLab in self.lbArray) {
if (pwLab.tag < (100 + self.bgTf.text.length)) {
NSRange range = NSMakeRange(pwLab.tag-100, 1);
pwLab.text = [self.bgTf.text substringWithRange:range];
}else{
pwLab.text = @"";
}
}
}
- (void)dealloc {
self.bgTf.delegate = nil;
}
@end
@implementation XPTeenagerPasswordLabel
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [ThemeColor appCellBackgroundColor];
self.layer.cornerRadius = 8;
self.layer.masksToBounds = YES;
self.textColor = [ThemeColor mainTextColor];
self.textAlignment = NSTextAlignmentCenter;
}
return self;
}
@end

View File

@@ -0,0 +1,26 @@
//
// XPTeenagerAlertView.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//青少年模式弹框
#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;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,164 @@
//
// XPTeenagerAlertView.m
// xplan-ios
//
// Created by on 2021/9/22.
//
#import "XPTeenagerAlertView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "UIImage+Utils.h"
#import "UIButton+EnlargeTouchArea.h"
@interface XPTeenagerAlertView ()
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *textLabel;
@property (nonatomic, strong) UIButton *teeagersButton;
@property (nonatomic, strong) UIButton *closeButton;
@end
@implementation XPTeenagerAlertView
#pragma mark lifeCycle
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initViews];
[self initConstraints];
}
return self;
}
- (void)initViews {
[self addSubview:self.bgView];
[self addSubview:self.closeButton];
[self.bgView addSubview:self.iconImageView];
[self.bgView addSubview:self.titleLabel];
[self.bgView addSubview:self.textLabel];
[self.bgView addSubview:self.teeagersButton];
}
- (void)initConstraints {
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.right.mas_equalTo(self).inset(10);
make.width.height.mas_equalTo(25);
}];
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(15);
make.width.mas_equalTo(120);
make.height.mas_equalTo(80);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.iconImageView.mas_bottom).offset(5);
make.left.right.mas_equalTo(self.bgView).inset(35);
make.height.mas_equalTo(20);
}];
[self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(10);
make.left.right.mas_equalTo(self.bgView).inset(35);
}];
[self.teeagersButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.bgView);
make.bottom.mas_equalTo(-20);
make.width.mas_equalTo(160);
make.height.mas_equalTo(40);
}];
}
#pragma mark Event Response
- (void)onClickCloseButtonAction:(UIButton *)closeButton {
if (self.delegate && [self.delegate respondsToSelector:@selector(hiddeView)]) {
[self.delegate hiddeView];
}
}
- (void)onClickTeeagersButtonAction:(UIButton *)teeagersButton {
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickTeenagerButtonAction:)]) {
[self.delegate didClickTeenagerButtonAction:teeagersButton];
}
}
#pragma mark Getters and Setters
- (UIView *)bgView {
if (!_bgView) {
_bgView = [[UIView alloc] init];
_bgView.backgroundColor = [UIColor whiteColor];
_bgView.layer.cornerRadius = 8;
_bgView.layer.masksToBounds = YES;
}
return _bgView;
}
- (UIButton *)closeButton {
if (!_closeButton) {
_closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_closeButton setImage:[UIImage imageNamed:@"mine_teeager_alter_close"] forState:UIControlStateNormal];
[_closeButton addTarget:self action:@selector(onClickCloseButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_closeButton setEnlargeEdgeWithTop:15 right:15 bottom:15 left:15];
}
return _closeButton;
}
- (UIImageView *)iconImageView {
if (!_iconImageView) {
_iconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_teenager_parents_mode_icon"]];
}
return _iconImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Bold" size:16];
_titleLabel.textColor = [ThemeColor mainTextColor];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.text = @"青少年保护";
}
return _titleLabel;
}
- (UILabel *)textLabel {
if (!_textLabel) {
_textLabel = [[UILabel alloc] init];
_textLabel.font = [UIFont systemFontOfSize:13];
_textLabel.textColor = [ThemeColor secondTextColor];
_textLabel.numberOfLines = 0;
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:3]; //
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"为呵护青少年健康成长,音游推出“青少年模式”,该模式下针对青少年推送精选优化的内容。"];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [attributedString length])];
_textLabel.attributedText = attributedString;
}
return _textLabel;
}
- (UIButton *)teeagersButton {
if (!_teeagersButton) {
_teeagersButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_teeagersButton setTitle:@"设置青少年模式" forState:UIControlStateNormal];
_teeagersButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
[_teeagersButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_teeagersButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
[_teeagersButton addTarget:self action:@selector(onClickTeeagersButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_teeagersButton.layer setCornerRadius:19];
_teeagersButton.layer.masksToBounds = YES;
}
return _teeagersButton;
}
@end

View File

@@ -0,0 +1,28 @@
//
// XPMineTeenagePwdViewController.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@protocol XPMineTeenagePwdViewControllerDelegate <NSObject>
///改变状态成功
- (void)didChangeTeenagerStatus:(BOOL)status;
@end
@interface XPMineTeenagePwdViewController : MvpViewController
///是否是开启青少年模式
@property (nonatomic,assign) BOOL isOpen;
///代理
@property (nonatomic,assign) id<XPMineTeenagePwdViewControllerDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,223 @@
//
// XPMineTeenagePwdViewController.m
// xplan-ios
//
// Created by on 2021/9/22.
//
#import "XPMineTeenagePwdViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
///Tool
#import "ThemeColor.h"
#import "UIImage+Utils.h"
///View
#import "XPMineTeenagerPwdView.h"
///P
#import "XPMineTeenagerPwdProtocol.h"
#import "XPMineTeenagerPwdPresenter.h"
@interface XPMineTeenagePwdViewController ()<XPMineTeenagerPwdProtocol>
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic, strong) UILabel *subTitleLabel;
///
@property (nonatomic, strong) UIButton *completeButton;
///
@property (nonatomic, strong) XPMineTeenagerPwdView *codeView;
///
@property (nonatomic, strong) XPMineTeenagerPwdView *againCodeView;
///
@property (nonatomic,assign) BOOL isAgain;
@end
@implementation XPMineTeenagePwdViewController
- (XPMineTeenagerPwdPresenter *)createPresenter {
return [[XPMineTeenagerPwdPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
[self initEvents];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing:YES];
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.stackView];
[self.view addSubview:self.codeView];
[self.view addSubview:self.againCodeView];
[self.view addSubview:self.completeButton];
[self.stackView addArrangedSubview:self.titleLabel];
[self.stackView addArrangedSubview:self.subTitleLabel];
}
- (void)initSubViewConstraints {
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(20);
make.left.right.mas_equalTo(self.view);
}];
[self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(self.view).offset(156);
}];
[self.againCodeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.codeView);
}];
[self.completeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.codeView.mas_bottom).offset(102);
make.left.right.mas_equalTo(self.view).inset(25);
make.centerX.mas_equalTo(self.view);
make.height.mas_equalTo(46);
}];
}
- (void)initEvents {
@weakify(self);
[[self.completeButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
@strongify(self);
if (self.isOpen) {
if (self.isAgain) {
if (self.againCodeView.code.length == 4) {
if (![self.codeView.code isEqualToString:self.againCodeView.code]) {
[self showErrorToast:@"两次输入密码不一致"];
} else {
[self.presenter openOrCloseParentWithPassowrd:self.codeView.code status:1];
}
} else {
[self showErrorToast:@"请输入正确的密码"];
}
} else {
if (self.codeView.code.length == 4) {
self.isAgain = YES;
} else {
[self showErrorToast:@"请输入正确的密码"];
}
}
} else {
if (self.codeView.code.length == 4) {
[self.presenter openOrCloseParentWithPassowrd:self.codeView.code status:0];
} else {
[self showErrorToast:@"请输入正确的密码"];
}
}
}];
}
#pragma mark -XPMineTeenagerPwdProtocol
- (void)openOrCloseParentSuccessStatus:(BOOL)status {
if (status) {
[self showSuccessToast:@"开启青少年模式成功"];
} else {
[self showSuccessToast:@"关闭青少年模式成功"];
}
if (self.delegate && [self.delegate respondsToSelector:@selector(didChangeTeenagerStatus:)]) {
[self.delegate didChangeTeenagerStatus:status];
}
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - Getters And Setters
- (void)setIsOpen:(BOOL)isOpen {
_isOpen = isOpen;
if (_isOpen) {
self.titleLabel.text = @"设置密码";
self.subTitleLabel.hidden = NO;
[self.completeButton setTitle:@"下一步" forState:UIControlStateNormal];
} else {
self.titleLabel.text = @"关闭青少年模式的密码";
self.subTitleLabel.hidden = YES;
[self.completeButton setTitle:@"完成" forState:UIControlStateNormal];
}
}
- (void)setIsAgain:(BOOL)isAgain {
_isAgain = isAgain;
if (_isAgain) {
[UIView animateWithDuration:0.5 animations:^{
self.subTitleLabel.text = @"我们将不提供找回密码服务请您牢记已设置的密码";
self.codeView.hidden = YES;
self.againCodeView.hidden = NO;
[self.againCodeView.bgTf becomeFirstResponder];
[self.completeButton setTitle:@"完成" forState:UIControlStateNormal];
}];
}
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentFill;
_stackView.spacing = 15;
}
return _stackView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
_titleLabel.textColor = [ThemeColor mainTextColor];
}
return _titleLabel;
}
- (UILabel *)subTitleLabel {
if (!_subTitleLabel) {
_subTitleLabel = [[UILabel alloc] init];
_subTitleLabel.text = @"设置青少年模式的开启和关闭的数字密码";
_subTitleLabel.font = [UIFont systemFontOfSize:13];
_subTitleLabel.textAlignment = NSTextAlignmentCenter;
_subTitleLabel.textColor = [ThemeColor secondTextColor];
}
return _subTitleLabel;
}
- (XPMineTeenagerPwdView *)codeView {
if (!_codeView) {
_codeView = [[XPMineTeenagerPwdView alloc] initWithFrame:CGRectZero withNum:4];
}
return _codeView;
}
- (XPMineTeenagerPwdView *)againCodeView {
if (!_againCodeView) {
_againCodeView = [[XPMineTeenagerPwdView alloc] initWithFrame:CGRectZero withNum:4];
_againCodeView.hidden = YES;
}
return _againCodeView;
}
- (UIButton *)completeButton {
if (!_completeButton) {
_completeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_completeButton setTitle:@"下一步" forState:UIControlStateNormal];
[_completeButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
_completeButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
_completeButton.layer.cornerRadius = 45/2;
_completeButton.userInteractionEnabled = YES;
_completeButton.layer.masksToBounds= YES;
[_completeButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
}
return _completeButton;
}
@end

View File

@@ -0,0 +1,17 @@
//
// XPMineTeenagerViewController.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/22.
//
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@class UserInfoModel;
@interface XPMineTeenagerViewController : MvpViewController
///
@property (nonatomic,strong) UserInfoModel *userInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,264 @@
//
// XPMineTeenagerViewController.m
// xplan-ios
//
// Created by on 2021/9/22.
//
#import "XPMineTeenagerViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <YYText/YYLabel.h>
#import <ReactiveObjC/ReactiveObjC.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "XPHtmlUrl.h"
#import "UIImage+Utils.h"
///Model
#import "UserInfoModel.h"
///View
#import "XPMineTeenagerDesView.h"
///P
#import "XPMineTeenagerProtocol.h"
#import "XPMineTeenagerPresenter.h"
///VC
#import "XPWebViewController.h"
#import "XPMineTeenagePwdViewController.h"
@interface XPMineTeenagerViewController ()<XPMineTeenagerProtocol, XPMineTeenagePwdViewControllerDelegate>
///
@property (nonatomic, strong) UIImageView *topImageView;
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic,strong) XPMineTeenagerDesView *dominatorView;
///
@property (nonatomic,strong) XPMineTeenagerDesView *searchView;
///
@property (nonatomic,strong) XPMineTeenagerDesView *rechargeView;
///
@property (nonatomic,strong) XPMineTeenagerDesView *limitView;
///
@property (nonatomic, strong) YYLabel *watchButton;
///
@property (nonatomic, strong) UIButton *openParentBtn;
@end
@implementation XPMineTeenagerViewController
- (XPMineTeenagerPresenter *)createPresenter {
return [[XPMineTeenagerPresenter alloc] init];;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
[self initEvents];
}
#pragma mark - Private Method
- (void)initSubViews {
self.title = @"青少年模式";
[self.view addSubview:self.topImageView];
[self.view addSubview:self.titleLabel];
[self.view addSubview:self.stackView];
[self.view addSubview:self.openParentBtn];
[self.view addSubview:self.watchButton];
[self.stackView addArrangedSubview:self.dominatorView];
[self.stackView addArrangedSubview:self.searchView];
[self.stackView addArrangedSubview:self.rechargeView];
[self.stackView addArrangedSubview:self.limitView];
}
- (void)initSubViewConstraints {
[self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(30);
make.centerX.mas_equalTo(self.view);
make.size.mas_equalTo(CGSizeMake(120, 80));
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(self.topImageView.mas_bottom).offset(20);
make.width.mas_equalTo(200);
make.height.mas_equalTo(60);
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(80);
make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_equalTo(30);
}];
[self.watchButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(-60 - kSafeAreaBottomHeight);
make.centerX.mas_equalTo(self.view);
make.size.mas_equalTo(CGSizeMake(200, 12));
}];
[self.openParentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.watchButton.mas_top).offset(-22);
make.left.right.mas_equalTo(self.view).inset(38);
make.height.mas_equalTo(46);
make.centerX.mas_equalTo(self.view);
}];
}
- (void)initEvents {
@weakify(self);
///
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
[self.watchButton addGestureRecognizer:tap];
[[tap rac_gestureSignal] subscribeNext:^(__kindof UIGestureRecognizer * _Nullable x) {
@strongify(self);
[self goToWebview:URLWithType(kNurseryURL)];
}];
///
[[self.openParentBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
@strongify(self);
XPMineTeenagePwdViewController * teenagerPwdVC = [[XPMineTeenagePwdViewController alloc] init];
teenagerPwdVC.delegate = self;
teenagerPwdVC.isOpen = !self.userInfo.parentMode;
[self.navigationController pushViewController:teenagerPwdVC animated:YES];
}];
}
///j
- (void)loadUserInfo {
[self.presenter getUserInfo];
}
- (void)goToWebview:(NSString *)url {
XPWebViewController *webView = [[XPWebViewController alloc] init];
webView.url = url;
[self.navigationController pushViewController:webView animated:YES];
}
#pragma mark - XPMineTeenagerProtocol
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
self.userInfo = userInfo;
}
#pragma mark - XPMineTeenagePwdViewControllerDelegate
///
- (void)didChangeTeenagerStatus:(BOOL)status {
UserInfoModel * userInfo = self.userInfo;
userInfo.parentMode = status;
self.userInfo = userInfo;
}
#pragma mark - Getters And Setters
- (void)setUserInfo:(UserInfoModel *)userInfo {
_userInfo = userInfo;
if (_userInfo) {
if (_userInfo.parentMode) {
[self.openParentBtn setTitle:@"关闭青少年模式" forState:UIControlStateNormal];
} else {
[self.openParentBtn setTitle:@"开启青少年模式" forState:UIControlStateNormal];
}
}
}
- (UIImageView *)topImageView {
if (!_topImageView) {
_topImageView = [[UIImageView alloc] init];
_topImageView.image = [UIImage imageNamed:@"mine_teenager_parents_mode_icon"];
}
return _topImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"开启青少年模式\n将会获得以下服务";
_titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
_titleLabel.numberOfLines = 2;
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [ThemeColor mainTextColor];
}
return _titleLabel;
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentFill;
_stackView.spacing = 27;
}
return _stackView;
}
- (XPMineTeenagerDesView *)dominatorView {
if (!_dominatorView) {
_dominatorView = [[XPMineTeenagerDesView alloc] init];
_dominatorView.title = @"针对青少年推送精选优化的内容";
}
return _dominatorView;
}
- (XPMineTeenagerDesView *)searchView {
if (!_searchView) {
_searchView = [[XPMineTeenagerDesView alloc] init];
_searchView.title = @"其它用户将无法通过搜索找到该账号";
}
return _searchView;
}
- (XPMineTeenagerDesView *)rechargeView {
if (!_rechargeView) {
_rechargeView = [[XPMineTeenagerDesView alloc] init];
_rechargeView.title =@"限制使用钻石充值功能";
}
return _rechargeView;
}
- (XPMineTeenagerDesView *)limitView {
if (!_limitView) {
_limitView = [[XPMineTeenagerDesView alloc] init];
_limitView.title = @"每天限玩保护";
}
return _limitView;
}
- (UIButton *)openParentBtn {
if (!_openParentBtn) {
_openParentBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_openParentBtn setTitle:@"开启青少年模式" forState:UIControlStateNormal];
[_openParentBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
_openParentBtn.titleLabel.font = [UIFont systemFontOfSize:15];
_openParentBtn.layer.masksToBounds = YES;
_openParentBtn.layer.cornerRadius = 23;
[_openParentBtn setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
[_openParentBtn setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
}
return _openParentBtn;
}
- (YYLabel *)watchButton {
if (!_watchButton) {
_watchButton = [[YYLabel alloc] init];
_watchButton.font = [UIFont systemFontOfSize:12];
NSString * name = [NSString stringWithFormat:@"《%@护苗计划》",AppName];
NSString *str = [NSString stringWithFormat:@"%@%@", @"查看", name];
NSRange range1 = [str rangeOfString:@"查看"];
NSRange range = [str rangeOfString:name];
NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:str];
[attStr addAttribute:NSForegroundColorAttributeName value:[ThemeColor appMainColor] range:range];
[attStr addAttribute:NSForegroundColorAttributeName value:[ThemeColor textThirdColor] range:range1];
_watchButton.attributedText = attStr;
_watchButton.textAlignment = NSTextAlignmentCenter;
}
return _watchButton;
}
@end

View File

@@ -24,8 +24,10 @@
#import "XPMineHeadView.h"
///VC
#import "XPMineSettingViewController.h"
#import "XPMineTeenagerViewController.h"
#import "XPWebViewController.h"
@interface XPMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineProtocol, XPMineMatchTableViewCellDelegate, XPMineHeadViewDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
@@ -53,7 +55,7 @@
}
- (void)viewDidLoad {
[super viewDidLoad];
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
}
@@ -110,7 +112,11 @@
[self pushWebViewWIthUrl:URLWithType(kGameBindAccountURL)];
break;
case XPMineItemType_Teenager_Mode:
#warning to do
{
XPMineTeenagerViewController * vc = [[XPMineTeenagerViewController alloc] init];
vc.userInfo = self.userInfo;
[self.navigationController pushViewController:vc animated:YES];
}
break;
case XPMineItemType_Real_Name_Authentic:
[self pushWebViewWIthUrl:URLWithType(kIdentityURL)];