Commit 9bbde2ef cgx

优化H5页面

1 个父辈 10ab82db
...@@ -1383,7 +1383,7 @@ ...@@ -1383,7 +1383,7 @@
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "$(inherited)/**"; HEADER_SEARCH_PATHS = "$(inherited)/**";
INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist; INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Dev"; INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-冥想解压助眠健康养生";
INFOPLIST_KEY_NSCameraUsageDescription = "APP需要访问您的相机。"; INFOPLIST_KEY_NSCameraUsageDescription = "APP需要访问您的相机。";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
...@@ -1504,7 +1504,7 @@ ...@@ -1504,7 +1504,7 @@
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = "$(inherited)/**"; HEADER_SEARCH_PATHS = "$(inherited)/**";
INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist; INFOPLIST_FILE = DreamSleep/DSConfig/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Dev"; INFOPLIST_KEY_CFBundleDisplayName = "小梦睡眠-Beta";
INFOPLIST_KEY_NSCameraUsageDescription = "APP需要访问您的相机。"; INFOPLIST_KEY_NSCameraUsageDescription = "APP需要访问您的相机。";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#import "HeaderDataModel.h" #import "HeaderDataModel.h"
#import "DsMiddleView.h" #import "DsMiddleView.h"
#import "ThreeMinuteController.h" #import "ThreeMinuteController.h"
#import "PrivacyViewController.h"
@interface HomeHeaderView () <CWCarouselDatasource, CWCarouselDelegate> @interface HomeHeaderView () <CWCarouselDatasource, CWCarouselDelegate>
// 轮播图 // 轮播图
...@@ -95,7 +94,7 @@ ...@@ -95,7 +94,7 @@
} }
break; break;
case 8: { // 进入睡眠评测页面 case 8: { // 进入睡眠评测页面
[self.ds_viewController.navigationController pushViewController:[[PrivacyViewController alloc] initWithTitle:@"睡眠评测" link:[NSURL URLWithString:model.info_url] isDetail:YES] animated:YES]; [self.ds_viewController.navigationController pushViewController:[[DsWebController alloc] initWithTitle:@"睡眠评测" link:model.info_url] animated:YES];
} }
break; break;
default: default:
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
#pragma mark - UITextViewDelegate #pragma mark - UITextViewDelegate
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction { - (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction {
NSString *title = [URL.absoluteString isEqualToString:UserServiceAgreement] ? @"用户服务协议" : @"隐私政策"; NSString *title = [URL.absoluteString isEqualToString:UserServiceAgreement] ? @"用户服务协议" : @"隐私政策";
[self.ds_viewController.navigationController pushViewController:[[PrivacyViewController alloc] initWithTitle:title link:URL isDetail:YES] animated:YES]; [self.ds_viewController.navigationController pushViewController:[[DsWebController alloc] initWithTitle:title link:URL.absoluteString] animated:YES];
return NO; return NO;
} }
......
...@@ -9,14 +9,8 @@ ...@@ -9,14 +9,8 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/// 隐私政策弹框及详情控制器(H页面,需要改名封装) /// 隐私政策弹框控制器
@interface PrivacyViewController : UIViewController @interface PrivacyViewController : UIViewController
/// 隐私政策详情控制器初始化
/// @param title title
/// @param link h5链接
/// @param isDetail YES:详情
- (instancetype)initWithTitle:(NSString *)title link:(NSURL *)link isDetail:(BOOL)isDetail;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -7,55 +7,25 @@ ...@@ -7,55 +7,25 @@
#import "PrivacyViewController.h" #import "PrivacyViewController.h"
#import "PrivacyView.h" #import "PrivacyView.h"
#import <WebKit/webKit.h>
@interface PrivacyViewController () @interface PrivacyViewController ()
@property (nonatomic, strong) PrivacyView *policyView; @property (nonatomic, strong) PrivacyView *policyView;
@property (nonatomic, strong) UIView *maskView; @property (nonatomic, strong) UIView *maskView;
@property (nonatomic, copy) NSString *naviTitle;
@property (nonatomic, strong) NSURL *link;
@property (nonatomic, assign) BOOL isDetail;
@property (nonatomic, strong) WKWebView *webView;
// 黑夜模式遮罩(到时候提取出来,全局通用)
@property (nonatomic, strong) UIView *darkMaskView;
@end @end
@implementation PrivacyViewController @implementation PrivacyViewController
- (instancetype)initWithTitle:(NSString *)title link:(NSURL *)link isDetail:(BOOL)isDetail {
if (self = [super init]) {
self.naviTitle = title;
self.link = link;
self.isDetail = isDetail;
}
return self;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = DSWhite; self.view.backgroundColor = DSWhite;
if (self.isDetail) {
self.title = self.naviTitle;
[self.view addSubview:self.webView];
} else {
[self showPrivacyView]; [self showPrivacyView];
}
if (self.isDetail) {
self.darkMaskView.hidden = ![self.dk_manager.themeVersion isEqualToString:DKThemeVersionNight];
}
}
- (void)dealloc {
[self.maskView removeFromSuperview];
} }
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
self.navigationController.navigationBarHidden = !self.isDetail; self.navigationController.navigationBarHidden = YES;
} }
#pragma mark - 关闭侧滑 #pragma mark - 关闭侧滑
...@@ -63,19 +33,14 @@ ...@@ -63,19 +33,14 @@
return NO; return NO;
} }
#pragma mark - H5页面导航栏为默认模式 #pragma mark - 导航栏为NaviStyleUndef
- (NaviStyle)navigationBarStyle { - (NaviStyle)navigationBarStyle {
return self.isDetail ? NaviStyleDefault : NaviStyleUndef; return NaviStyleUndef;
} }
#pragma mark - 设置状态栏文字颜色 #pragma mark - 设置状态栏文字颜色
- (UIStatusBarStyle)preferredStatusBarStyle { - (UIStatusBarStyle)preferredStatusBarStyle {
if (self.isDetail) {
// 导航栏显示不会执行以下代码
return UIStatusBarStyleLightContent;
} else {
return [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent; return [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent;
}
} }
- (void)showPrivacyView { - (void)showPrivacyView {
...@@ -96,28 +61,4 @@ ...@@ -96,28 +61,4 @@
self.maskView.hidden = NO; self.maskView.hidden = NO;
} }
- (WKWebView *)webView {
if (!_webView) {
_webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight(0))];
_webView.backgroundColor = DSWhite;
_webView.scrollView.showsVerticalScrollIndicator = NO;
_webView.scrollView.showsHorizontalScrollIndicator = NO;
_webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
NSURLRequest *request = [NSURLRequest requestWithURL:self.link];
[_webView loadRequest:request];
}
return _webView;
}
- (UIView *)darkMaskView {
if (!_darkMaskView) {
_darkMaskView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
_darkMaskView.backgroundColor = ColorFromHex(0x6B7485);
_darkMaskView.alpha = .5;
_darkMaskView.userInteractionEnabled = NO;
[self.view addSubview:_darkMaskView];
}
return _darkMaskView;
}
@end @end
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#import "AccountController.h" #import "AccountController.h"
#import "SystemSetController.h" #import "SystemSetController.h"
#import "InviteController.h" #import "InviteController.h"
#import "PrivacyViewController.h"
#import "ProfileAlertView.h" #import "ProfileAlertView.h"
@interface ProfileController () @interface ProfileController ()
...@@ -90,7 +89,7 @@ ...@@ -90,7 +89,7 @@
break; break;
case 4: // 关于我们 case 4: // 关于我们
{ {
[self.navigationController pushViewController:[[PrivacyViewController alloc] initWithTitle:@"关于我们" link:[NSURL URLWithString:AboutUS] isDetail:YES] animated:YES]; [self.navigationController pushViewController:[[DsWebController alloc] initWithTitle:@"关于我们" link:AboutUS] animated:YES];
} }
break; break;
case 5: // 前往小程序 case 5: // 前往小程序
...@@ -112,7 +111,7 @@ ...@@ -112,7 +111,7 @@
break; break;
case 8: // CBTI case 8: // CBTI
{ {
[self.navigationController pushViewController:[[PrivacyViewController alloc] initWithTitle:@"失眠的认知行为疗法(CBTI)" link:[NSURL URLWithString:MYCBTI] isDetail:YES] animated:YES]; [self.navigationController pushViewController:[[DsWebController alloc] initWithTitle:@"失眠的认知行为疗法(CBTI)" link:MYCBTI] animated:YES];
} }
break;; break;;
default: default:
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
// //
#import "SystemSetController.h" #import "SystemSetController.h"
#import "PrivacyViewController.h"
#import "SetTableView.h" #import "SetTableView.h"
@interface SystemSetController () <SetTableViewDelegate> @interface SystemSetController () <SetTableViewDelegate>
...@@ -34,12 +33,12 @@ ...@@ -34,12 +33,12 @@
switch (indexPath.row) { switch (indexPath.row) {
case 1: // 用户协议 case 1: // 用户协议
{ {
[self.navigationController pushViewController:[[PrivacyViewController alloc] initWithTitle:@"用户服务协议" link:[NSURL URLWithString:UserServiceAgreement] isDetail:YES] animated:YES]; [self.navigationController pushViewController:[[DsWebController alloc] initWithTitle:@"用户服务协议" link:UserServiceAgreement] animated:YES];
} }
break; break;
case 2: // 隐私政策 case 2: // 隐私政策
{ {
[self.navigationController pushViewController:[[PrivacyViewController alloc] initWithTitle:@"隐私政策" link:[NSURL URLWithString:PrivacyPolicy] isDetail:YES] animated:YES]; [self.navigationController pushViewController:[[DsWebController alloc] initWithTitle:@"隐私政策" link:PrivacyPolicy] animated:YES];
} }
break; break;
default: default:
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#import "LoginController.h" #import "LoginController.h"
#import "LoginView.h" #import "LoginView.h"
#import "PrivacyViewController.h"
#import <AuthenticationServices/AuthenticationServices.h> #import <AuthenticationServices/AuthenticationServices.h>
#import "UserRequestModel.h" #import "UserRequestModel.h"
...@@ -96,12 +95,12 @@ ...@@ -96,12 +95,12 @@
break; break;
case 4: // 许可协议 case 4: // 许可协议
{ {
[self.navigationController pushViewController:[[PrivacyViewController alloc] initWithTitle:@"用户服务协议" link:[NSURL URLWithString:UserServiceAgreement] isDetail:YES] animated:YES]; [self.navigationController pushViewController:[[DsWebController alloc] initWithTitle:@"用户服务协议" link:UserServiceAgreement] animated:YES];
} }
break; break;
case 5: // 隐私保护指引 case 5: // 隐私保护指引
{ {
[self.navigationController pushViewController:[[PrivacyViewController alloc] initWithTitle:@"隐私政策" link:[NSURL URLWithString:PrivacyPolicy] isDetail:YES] animated:YES]; [self.navigationController pushViewController:[[DsWebController alloc] initWithTitle:@"隐私政策" link:PrivacyPolicy] animated:YES];
} }
break; break;
default: default:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!