Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d9481f95
由
cgx
编写于
2022-06-02 13:12:09 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
对接AI睡眠教练H5页面
1 个父辈
79c635e9
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
375 行增加
和
66 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Basement/H5/DsWebController.m
DreamSleep/DreamSleep/Basement/Utils/DSConstUtil.h
DreamSleep/DreamSleep/Basement/Utils/DSConstUtil.m
DreamSleep/DreamSleep/Basement/Utils/ServerAPIUtil.h
DreamSleep/DreamSleep/Class/AISleepModule/AISleepCoachController.m
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainController.m
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainModel.h
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainModel.m
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainRequestModel.h
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainRequestModel.m
DreamSleep/DreamSleep/Class/AISleepModule/SomeProxy.h
DreamSleep/DreamSleep/Class/AISleepModule/SomeProxy.m
DreamSleep/DreamSleep/Class/HomeModule/Course/Controller/CourseDetailController.m
DreamSleep/DreamSleep/Class/HomeModule/Home/View/HomeHeaderView.m
DreamSleep/DreamSleep/Class/ProfileModule/Me/ProfileController.m
DreamSleep/DreamSleep/Class/ProfileModule/Me/ProfileHeaderView.m
DreamSleep/DreamSleep/Class/ProfileModule/Me/ProfileTableView.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
d9481f9
...
@@ -179,6 +179,9 @@
...
@@ -179,6 +179,9 @@
D0D4107F2844D38400009638 /* RankModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D4107E2844D38400009638 /* RankModel.m */; };
D0D4107F2844D38400009638 /* RankModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D4107E2844D38400009638 /* RankModel.m */; };
D0D69ED3282360F100A0D5EB /* LookAllController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D69ED2282360F100A0D5EB /* LookAllController.m */; };
D0D69ED3282360F100A0D5EB /* LookAllController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D69ED2282360F100A0D5EB /* LookAllController.m */; };
D0D69ED628236E0800A0D5EB /* SafeSleepListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D69ED528236E0800A0D5EB /* SafeSleepListController.m */; };
D0D69ED628236E0800A0D5EB /* SafeSleepListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D69ED528236E0800A0D5EB /* SafeSleepListController.m */; };
D0D96FDF2848457900461839 /* RelaxTrainRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D96FDE2848457900461839 /* RelaxTrainRequestModel.m */; };
D0D96FE22848493700461839 /* RelaxTrainModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D96FE12848493700461839 /* RelaxTrainModel.m */; };
D0D96FE52848698F00461839 /* SomeProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D96FE32848698E00461839 /* SomeProxy.m */; };
D0DB33A528204E7C00E15914 /* FirstLeadAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0DB33A428204E7C00E15914 /* FirstLeadAlertView.m */; };
D0DB33A528204E7C00E15914 /* FirstLeadAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0DB33A428204E7C00E15914 /* FirstLeadAlertView.m */; };
D0DB33A828224D5100E15914 /* PromotionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0DB33A728224D5100E15914 /* PromotionModel.m */; };
D0DB33A828224D5100E15914 /* PromotionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0DB33A728224D5100E15914 /* PromotionModel.m */; };
D0DF90AE2814390000FC0F64 /* BannerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0DF90AD2814390000FC0F64 /* BannerModel.m */; };
D0DF90AE2814390000FC0F64 /* BannerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0DF90AD2814390000FC0F64 /* BannerModel.m */; };
...
@@ -554,6 +557,12 @@
...
@@ -554,6 +557,12 @@
D0D69ED528236E0800A0D5EB /* SafeSleepListController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeSleepListController.m; sourceTree = "<group>"; };
D0D69ED528236E0800A0D5EB /* SafeSleepListController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeSleepListController.m; sourceTree = "<group>"; };
D0D7480328118D0B00036379 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
D0D7480328118D0B00036379 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
D0D7480428118D0B00036379 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
D0D7480428118D0B00036379 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
D0D96FDD2848457900461839 /* RelaxTrainRequestModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RelaxTrainRequestModel.h; sourceTree = "<group>"; };
D0D96FDE2848457900461839 /* RelaxTrainRequestModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RelaxTrainRequestModel.m; sourceTree = "<group>"; };
D0D96FE02848493700461839 /* RelaxTrainModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RelaxTrainModel.h; sourceTree = "<group>"; };
D0D96FE12848493700461839 /* RelaxTrainModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RelaxTrainModel.m; sourceTree = "<group>"; };
D0D96FE32848698E00461839 /* SomeProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SomeProxy.m; sourceTree = "<group>"; };
D0D96FE42848698F00461839 /* SomeProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SomeProxy.h; sourceTree = "<group>"; };
D0DB33A328204E7C00E15914 /* FirstLeadAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirstLeadAlertView.h; sourceTree = "<group>"; };
D0DB33A328204E7C00E15914 /* FirstLeadAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirstLeadAlertView.h; sourceTree = "<group>"; };
D0DB33A428204E7C00E15914 /* FirstLeadAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirstLeadAlertView.m; sourceTree = "<group>"; };
D0DB33A428204E7C00E15914 /* FirstLeadAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirstLeadAlertView.m; sourceTree = "<group>"; };
D0DB33A628224D5100E15914 /* PromotionModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PromotionModel.h; sourceTree = "<group>"; };
D0DB33A628224D5100E15914 /* PromotionModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PromotionModel.h; sourceTree = "<group>"; };
...
@@ -788,11 +797,17 @@
...
@@ -788,11 +797,17 @@
D04567AC27F6D0BA009F0A82 /* AISleepModule */ = {
D04567AC27F6D0BA009F0A82 /* AISleepModule */ = {
isa = PBXGroup;
isa = PBXGroup;
children = (
children = (
D0D96FE42848698F00461839 /* SomeProxy.h */,
D0D96FE32848698E00461839 /* SomeProxy.m */,
D04B3DB427F6F7430022F8DF /* AISleepCoach.storyboard */,
D04B3DB427F6F7430022F8DF /* AISleepCoach.storyboard */,
D04B3DB927F6F7940022F8DF /* AISleepCoachController.h */,
D04B3DB927F6F7940022F8DF /* AISleepCoachController.h */,
D04B3DBA27F6F7940022F8DF /* AISleepCoachController.m */,
D04B3DBA27F6F7940022F8DF /* AISleepCoachController.m */,
D030C1B6284775930014946F /* RelaxTrainController.h */,
D030C1B6284775930014946F /* RelaxTrainController.h */,
D030C1B7284775930014946F /* RelaxTrainController.m */,
D030C1B7284775930014946F /* RelaxTrainController.m */,
D0D96FDD2848457900461839 /* RelaxTrainRequestModel.h */,
D0D96FDE2848457900461839 /* RelaxTrainRequestModel.m */,
D0D96FE02848493700461839 /* RelaxTrainModel.h */,
D0D96FE12848493700461839 /* RelaxTrainModel.m */,
);
);
path = AISleepModule;
path = AISleepModule;
sourceTree = "<group>";
sourceTree = "<group>";
...
@@ -1756,6 +1771,7 @@
...
@@ -1756,6 +1771,7 @@
D0B5ECD527F2F0B2003EDFE3 /* AdaptationUtil.m in Sources */,
D0B5ECD527F2F0B2003EDFE3 /* AdaptationUtil.m in Sources */,
D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */,
D070509A28071BAF006D72E1 /* DSNetworkTool.m in Sources */,
D01814D127FFCBAF00583D4E /* CWCarousel.m in Sources */,
D01814D127FFCBAF00583D4E /* CWCarousel.m in Sources */,
D0D96FE22848493700461839 /* RelaxTrainModel.m in Sources */,
D0B5ECB727F2D9E0003EDFE3 /* main.m in Sources */,
D0B5ECB727F2D9E0003EDFE3 /* main.m in Sources */,
D0BE53742845B27E007F15B3 /* DailyTaskModel.m in Sources */,
D0BE53742845B27E007F15B3 /* DailyTaskModel.m in Sources */,
D07DACA62810557D0067A1BF /* RSKTouchView.m in Sources */,
D07DACA62810557D0067A1BF /* RSKTouchView.m in Sources */,
...
@@ -1777,6 +1793,7 @@
...
@@ -1777,6 +1793,7 @@
D0E660022807B5AE006562F2 /* SafeSleepRequestModel.m in Sources */,
D0E660022807B5AE006562F2 /* SafeSleepRequestModel.m in Sources */,
D0D4107C2844B8DB00009638 /* DailyTaskController.m in Sources */,
D0D4107C2844B8DB00009638 /* DailyTaskController.m in Sources */,
D0E6600828080F97006562F2 /* SystemSetController.m in Sources */,
D0E6600828080F97006562F2 /* SystemSetController.m in Sources */,
D0D96FE52848698F00461839 /* SomeProxy.m in Sources */,
D091BBB72808F9DA00487A50 /* BreathTextView.m in Sources */,
D091BBB72808F9DA00487A50 /* BreathTextView.m in Sources */,
D08F79E1281A1838000D99DD /* TZLocationManager.m in Sources */,
D08F79E1281A1838000D99DD /* TZLocationManager.m in Sources */,
D04B3DBB27F6F7940022F8DF /* AISleepCoachController.m in Sources */,
D04B3DBB27F6F7940022F8DF /* AISleepCoachController.m in Sources */,
...
@@ -1837,6 +1854,7 @@
...
@@ -1837,6 +1854,7 @@
D09BF337280E605900E5F06C /* NSObject+Extras.m in Sources */,
D09BF337280E605900E5F06C /* NSObject+Extras.m in Sources */,
D055BEC528252B8900BC11A4 /* AudioDetailHeaderView.m in Sources */,
D055BEC528252B8900BC11A4 /* AudioDetailHeaderView.m in Sources */,
D07DACA72810557D0067A1BF /* UIApplication+RSKImageCropper.m in Sources */,
D07DACA72810557D0067A1BF /* UIApplication+RSKImageCropper.m in Sources */,
D0D96FDF2848457900461839 /* RelaxTrainRequestModel.m in Sources */,
D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */,
D027EE2927FB51D0004BBA61 /* DSGifHeader.m in Sources */,
D030C1B8284775930014946F /* RelaxTrainController.m in Sources */,
D030C1B8284775930014946F /* RelaxTrainController.m in Sources */,
D049679D2834E1AB00FB81E5 /* ProfileHeaderView.m in Sources */,
D049679D2834E1AB00FB81E5 /* ProfileHeaderView.m in Sources */,
...
@@ -2046,7 +2064,7 @@
...
@@ -2046,7 +2064,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION =
4
;
CURRENT_PROJECT_VERSION =
5
;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO;
ENABLE_BITCODE = NO;
EXCLUDED_ARCHS = "";
EXCLUDED_ARCHS = "";
...
@@ -2116,7 +2134,7 @@
...
@@ -2116,7 +2134,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements;
CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION =
4
;
CURRENT_PROJECT_VERSION =
5
;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
FRAMEWORK_SEARCH_PATHS = (
...
@@ -2247,7 +2265,7 @@
...
@@ -2247,7 +2265,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements;
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION =
4
;
CURRENT_PROJECT_VERSION =
5
;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
FRAMEWORK_SEARCH_PATHS = (
...
...
DreamSleep/DreamSleep/Basement/H5/DsWebController.m
查看文件 @
d9481f9
...
@@ -8,8 +8,9 @@
...
@@ -8,8 +8,9 @@
#import "DsWebController.h"
#import "DsWebController.h"
#import <WebKit/webKit.h>
#import <WebKit/webKit.h>
#import "DsMaskView.h"
#import "DsMaskView.h"
#import "SomeProxy.h"
@interface
DsWebController
()
<
WKNavigationDelegate
>
@interface
DsWebController
()
<
WKNavigationDelegate
,
WKScriptMessageHandler
>
@property
(
nonatomic
,
copy
)
NSString
*
naviTitle
;
@property
(
nonatomic
,
copy
)
NSString
*
naviTitle
;
@property
(
nonatomic
,
strong
)
NSURL
*
linkUrl
;
@property
(
nonatomic
,
strong
)
NSURL
*
linkUrl
;
@property
(
nonatomic
,
assign
)
BOOL
isShowNavi
;
@property
(
nonatomic
,
assign
)
BOOL
isShowNavi
;
...
@@ -56,6 +57,7 @@
...
@@ -56,6 +57,7 @@
}
}
-
(
void
)
dealloc
{
-
(
void
)
dealloc
{
[
self
.
webView
.
configuration
.
userContentController
removeScriptMessageHandlerForName
:
@"AppModel"
];
[
self
.
webView
removeObserver
:
self
forKeyPath
:
@"estimatedProgress"
];
[
self
.
webView
removeObserver
:
self
forKeyPath
:
@"estimatedProgress"
];
}
}
...
@@ -69,6 +71,11 @@
...
@@ -69,6 +71,11 @@
return
!
self
.
isShowNavi
;
return
!
self
.
isShowNavi
;
}
}
#pragma mark - H5页面导航栏为默认模式
-
(
NaviStyle
)
navigationBarStyle
{
return
NaviStyleDefault
;
}
#pragma mark - WKWebView的监听方法
#pragma mark - WKWebView的监听方法
-
(
void
)
observeValueForKeyPath
:
(
NSString
*
)
keyPath
ofObject
:
(
id
)
object
change
:
(
NSDictionary
<
NSKeyValueChangeKey
,
id
>
*
)
change
context
:
(
void
*
)
context
{
-
(
void
)
observeValueForKeyPath
:
(
NSString
*
)
keyPath
ofObject
:
(
id
)
object
change
:
(
NSDictionary
<
NSKeyValueChangeKey
,
id
>
*
)
change
context
:
(
void
*
)
context
{
if
([
keyPath
isEqualToString
:
@"estimatedProgress"
])
{
if
([
keyPath
isEqualToString
:
@"estimatedProgress"
])
{
...
@@ -97,10 +104,33 @@
...
@@ -97,10 +104,33 @@
self
.
exceptionView
.
hidden
=
NO
;
self
.
exceptionView
.
hidden
=
NO
;
}
}
#pragma mark - WKScriptMessageHandler
-
(
void
)
userContentController
:
(
WKUserContentController
*
)
userContentController
didReceiveScriptMessage
:
(
WKScriptMessage
*
)
message
{
if
([
message
.
name
isEqualToString
:
@"AppModel"
])
{
NSDictionary
*
bodyDic
=
message
.
body
;
int
type
=
[
bodyDic
[
@"type"
]
intValue
];
DSLog
(
@"bodyDic:%@"
,
bodyDic
);
if
(
type
==
88
)
{
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
}
}
#pragma mark - lazy
#pragma mark - lazy
-
(
WKWebView
*
)
webView
{
-
(
WKWebView
*
)
webView
{
if
(
!
_webView
)
{
if
(
!
_webView
)
{
_webView
=
[[
WKWebView
alloc
]
init
];
// 进行配置控制器
WKWebViewConfiguration
*
configuration
=
[[
WKWebViewConfiguration
alloc
]
init
];
// 实例化对象
configuration
.
userContentController
=
[
WKUserContentController
new
];
// 调用JS方法
[
configuration
.
userContentController
addScriptMessageHandler
:[[
SomeProxy
alloc
]
initObject
:
self
]
name
:
@"AppModel"
];
// 进行偏好设置
WKPreferences
*
preferences
=
[
WKPreferences
new
];
preferences
.
javaScriptCanOpenWindowsAutomatically
=
NO
;
preferences
.
javaScriptEnabled
=
YES
;
configuration
.
preferences
=
preferences
;
_webView
=
[[
WKWebView
alloc
]
initWithFrame
:
CGRectZero
configuration
:
configuration
];
_webView
.
navigationDelegate
=
self
;
_webView
.
navigationDelegate
=
self
;
_webView
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
_webView
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
_webView
.
scrollView
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
_webView
.
scrollView
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
...
@@ -132,15 +162,10 @@
...
@@ -132,15 +162,10 @@
weakSelf
.
progressView
.
hidden
=
NO
;
weakSelf
.
progressView
.
hidden
=
NO
;
weakSelf
.
progressView
.
progress
=
0
;
weakSelf
.
progressView
.
progress
=
0
;
weakSelf
.
exceptionView
.
hidden
=
YES
;
weakSelf
.
exceptionView
.
hidden
=
YES
;
[
weakSelf
.
webView
loadRequest
:
s
elf
.
request
];
[
weakSelf
.
webView
loadRequest
:
weakS
elf
.
request
];
}
superView
:
self
.
view
];
}
superView
:
self
.
view
];
}
}
return
_exceptionView
;
return
_exceptionView
;
}
}
#pragma mark - H5页面导航栏为默认模式
-
(
NaviStyle
)
navigationBarStyle
{
return
NaviStyleDefault
;
}
@end
@end
DreamSleep/DreamSleep/Basement/Utils/DSConstUtil.h
查看文件 @
d9481f9
...
@@ -10,8 +10,6 @@
...
@@ -10,8 +10,6 @@
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
// 用户服务协议和隐私政策
// 用户服务协议和隐私政策
FOUNDATION_EXTERN
NSString
*
const
UserServiceAgreement
;
FOUNDATION_EXTERN
NSString
*
const
PrivacyPolicy
;
FOUNDATION_EXTERN
NSString
*
const
PrivacyStatement
;
FOUNDATION_EXTERN
NSString
*
const
PrivacyStatement
;
FOUNDATION_EXTERN
NSString
*
const
FirstShowPrivacy
;
FOUNDATION_EXTERN
NSString
*
const
FirstShowPrivacy
;
...
@@ -20,11 +18,6 @@ FOUNDATION_EXTERN NSString * const IsFirstGuide;
...
@@ -20,11 +18,6 @@ FOUNDATION_EXTERN NSString * const IsFirstGuide;
// 首次启动APP进入主页弹框
// 首次启动APP进入主页弹框
FOUNDATION_EXTERN
NSString
*
const
IsFirstAlert
;
FOUNDATION_EXTERN
NSString
*
const
IsFirstAlert
;
// 关于我们
FOUNDATION_EXTERN
NSString
*
const
AboutUS
;
// 失眠的认知行为疗法
FOUNDATION_EXTERN
NSString
*
const
MYCBTI
;
// 主题模式自动切换标记
// 主题模式自动切换标记
FOUNDATION_EXTERN
NSString
*
const
ThemeAutoSwitch
;
FOUNDATION_EXTERN
NSString
*
const
ThemeAutoSwitch
;
FOUNDATION_EXTERN
NSString
*
const
StartTime1
;
FOUNDATION_EXTERN
NSString
*
const
StartTime1
;
...
...
DreamSleep/DreamSleep/Basement/Utils/DSConstUtil.m
查看文件 @
d9481f9
...
@@ -7,17 +7,12 @@
...
@@ -7,17 +7,12 @@
#import "DSConstUtil.h"
#import "DSConstUtil.h"
NSString
*
const
UserServiceAgreement
=
@"https://www.cbti.cn/sleep/user/agreement"
;
NSString
*
const
PrivacyPolicy
=
@"https://www.cbti.cn/sleep/user/privacy"
;
NSString
*
const
PrivacyStatement
=
@"欢迎来到小梦睡眠,我们依据最新的监管要求更新了用户服务协议和隐私政策,请您知悉:
\n
1.为提供相关基本功能及服务,我们会在您同意的前提下收集和使用必要的信息。
\n
2.使用本产品的过程中会请求相关权限,您可以选择是否授权该权限,也可以在隐私政策中了解详情。
\n
3.为确保相关功能服务的正常运行,您需要授权小梦睡眠APP获取设备Mac地址,您有权不同意该授权。
\n
4.未经您许可,小梦睡眠APP不会从第三方获取、提供或共享您的信息。
\n
可以点击阅读小梦睡眠APP用户服务协议和隐私政策的全部内容,感谢您的支持,欢迎问题反馈。"
;
NSString
*
const
PrivacyStatement
=
@"欢迎来到小梦睡眠,我们依据最新的监管要求更新了用户服务协议和隐私政策,请您知悉:
\n
1.为提供相关基本功能及服务,我们会在您同意的前提下收集和使用必要的信息。
\n
2.使用本产品的过程中会请求相关权限,您可以选择是否授权该权限,也可以在隐私政策中了解详情。
\n
3.为确保相关功能服务的正常运行,您需要授权小梦睡眠APP获取设备Mac地址,您有权不同意该授权。
\n
4.未经您许可,小梦睡眠APP不会从第三方获取、提供或共享您的信息。
\n
可以点击阅读小梦睡眠APP用户服务协议和隐私政策的全部内容,感谢您的支持,欢迎问题反馈。"
;
NSString
*
const
FirstShowPrivacy
=
@"FirstShowPrivacy"
;
NSString
*
const
FirstShowPrivacy
=
@"FirstShowPrivacy"
;
NSString
*
const
IsFirstGuide
=
@"isFirstGuide"
;
NSString
*
const
IsFirstGuide
=
@"isFirstGuide"
;
NSString
*
const
IsFirstAlert
=
@"isFirstAlert"
;
NSString
*
const
IsFirstAlert
=
@"isFirstAlert"
;
NSString
*
const
AboutUS
=
@"https://www.cbti.cn/sleep/user/about"
;
NSString
*
const
MYCBTI
=
@"https://www.cbti.cn/sleep/ssmian/cbti"
;
NSString
*
const
ThemeAutoSwitch
=
@"themeAutoSwitch"
;
NSString
*
const
ThemeAutoSwitch
=
@"themeAutoSwitch"
;
NSString
*
const
StartTime1
=
@"21:00:00"
;
NSString
*
const
StartTime1
=
@"21:00:00"
;
NSString
*
const
ExpireTime1
=
@"23:59:59"
;
NSString
*
const
ExpireTime1
=
@"23:59:59"
;
...
...
DreamSleep/DreamSleep/Basement/Utils/ServerAPIUtil.h
查看文件 @
d9481f9
...
@@ -14,9 +14,17 @@
...
@@ -14,9 +14,17 @@
// AI睡眠教练接口地址
// AI睡眠教练接口地址
#define AICoachURL [NSString stringWithFormat:@"%@/%@", ServerURL, @"sleep/ai/sleep_aicocah"]
#define AICoachURL [NSString stringWithFormat:@"%@/%@", ServerURL, @"sleep/ai/sleep_aicocah"]
// 我的睡眠报告地址
// 我的睡眠报告地址
#define MySleepReportURL [
ServerURL stringByAppendingPathComponent:
@"sleep/ssmian/sleep_diary?step=10"]
#define MySleepReportURL [
NSString stringWithFormat:@"%@/%@", ServerURL,
@"sleep/ssmian/sleep_diary?step=10"]
// 我的睡眠评测
// 我的睡眠评测
#define MySleepReviewURL [ServerURL stringByAppendingPathComponent:@"sleep/ssmian/history_report?type_id=101&step=10"]
#define MySleepReviewURL [NSString stringWithFormat:@"%@/%@", ServerURL, @"sleep/ssmian/history_report?type_id=101&step=10"]
// CBTI
#define MYCBTI [NSString stringWithFormat:@"%@/%@", ServerURL, @"sleep/ssmian/cbti"]
// 关于我们
#define AboutUS [NSString stringWithFormat:@"%@/%@", ServerURL, @"sleep/user/about"]
// 用户协议
#define UserServiceAgreement [NSString stringWithFormat:@"%@/%@", ServerURL, @"sleep/user/agreement"]
// 隐私政策
#define PrivacyPolicy [NSString stringWithFormat:@"%@/%@", ServerURL, @"sleep/user/privacy"]
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
...
...
DreamSleep/DreamSleep/Class/AISleepModule/AISleepCoachController.m
查看文件 @
d9481f9
...
@@ -8,12 +8,15 @@
...
@@ -8,12 +8,15 @@
#import "AISleepCoachController.h"
#import "AISleepCoachController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WebKit.h>
#import <JavaScriptCore/JavaScriptCore.h>
#import <JavaScriptCore/JavaScriptCore.h>
#import "RelaxTrainController.h"
#import "SomeProxy.h"
#import "ThreeMinuteController.h"
@interface
AISleepCoachController
()
<
WKNavigationDelegate
,
WKScriptMessageHandler
,
WKUIDelegate
>
@interface
AISleepCoachController
()
<
WKNavigationDelegate
,
WKScriptMessageHandler
>
@property
(
strong
,
nonatomic
)
WKWebView
*
aiWebView
;
@property
(
strong
,
nonatomic
)
WKWebView
*
aiWebView
;
@property
(
strong
,
nonatomic
)
NSMutableURLRequest
*
request
;
@property
(
strong
,
nonatomic
)
NSMutableURLRequest
*
request
;
@property
(
strong
,
nonatomic
)
UIProgressView
*
progressView
;
@property
(
strong
,
nonatomic
)
UIProgressView
*
progressView
;
@property
(
nonatomic
,
strong
)
ExceptionDefaultView
*
exceptionView
;
@property
(
strong
,
nonatomic
)
ExceptionDefaultView
*
exceptionView
;
@end
@end
@implementation
AISleepCoachController
@implementation
AISleepCoachController
...
@@ -30,6 +33,7 @@
...
@@ -30,6 +33,7 @@
}
}
-
(
void
)
dealloc
{
-
(
void
)
dealloc
{
[
self
.
aiWebView
.
configuration
.
userContentController
removeScriptMessageHandlerForName
:
@"AppModel"
];
[
self
.
aiWebView
removeObserver
:
self
forKeyPath
:
@"estimatedProgress"
];
[
self
.
aiWebView
removeObserver
:
self
forKeyPath
:
@"estimatedProgress"
];
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
name
:
NeedUpdateAICoach
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
name
:
NeedUpdateAICoach
object
:
nil
];
}
}
...
@@ -58,6 +62,8 @@
...
@@ -58,6 +62,8 @@
}
else
{
}
else
{
[
self
.
aiWebView
removeMask
];
[
self
.
aiWebView
removeMask
];
}
}
[
self
.
aiWebView
reload
];
}
}
#pragma mark - 登录成功后刷新
#pragma mark - 登录成功后刷新
...
@@ -82,6 +88,11 @@
...
@@ -82,6 +88,11 @@
}
}
}
}
-
(
void
)
touchesBegan
:
(
NSSet
<
UITouch
*>
*
)
touches
withEvent
:
(
UIEvent
*
)
event
{
RelaxTrainController
*
relaxVC
=
[
RelaxTrainController
new
];
[
self
.
navigationController
pushViewController
:
relaxVC
animated
:
YES
];
}
#pragma mark - WKWebView的监听方法
#pragma mark - WKWebView的监听方法
-
(
void
)
observeValueForKeyPath
:
(
NSString
*
)
keyPath
ofObject
:
(
id
)
object
change
:
(
NSDictionary
<
NSKeyValueChangeKey
,
id
>
*
)
change
context
:
(
void
*
)
context
{
-
(
void
)
observeValueForKeyPath
:
(
NSString
*
)
keyPath
ofObject
:
(
id
)
object
change
:
(
NSDictionary
<
NSKeyValueChangeKey
,
id
>
*
)
change
context
:
(
void
*
)
context
{
if
([
keyPath
isEqualToString
:
@"estimatedProgress"
])
{
if
([
keyPath
isEqualToString
:
@"estimatedProgress"
])
{
...
@@ -95,11 +106,13 @@
...
@@ -95,11 +106,13 @@
#pragma mark - WKNavigationDelegate
#pragma mark - WKNavigationDelegate
-
(
void
)
webView
:
(
WKWebView
*
)
webView
decidePolicyForNavigationAction
:
(
nonnull
WKNavigationAction
*
)
navigationAction
decisionHandler
:
(
nonnull
void
(
^
)(
WKNavigationActionPolicy
))
decisionHandler
{
-
(
void
)
webView
:
(
WKWebView
*
)
webView
decidePolicyForNavigationAction
:
(
nonnull
WKNavigationAction
*
)
navigationAction
decisionHandler
:
(
nonnull
void
(
^
)(
WKNavigationActionPolicy
))
decisionHandler
{
NSString
*
url
=
navigationAction
.
request
.
URL
.
absoluteString
;
NSString
*
url
=
navigationAction
.
request
.
URL
.
absoluteString
;
DSLog
(
@"跳转链接:%@"
,
url
);
if
([
url
isEqualToString
:
AICoachURL
])
{
if
([
url
isEqualToString
:
AICoachURL
])
{
decisionHandler
(
WKNavigationActionPolicyAllow
);
decisionHandler
(
WKNavigationActionPolicyAllow
);
}
else
{
}
else
{
// 开启新的webview页面加载
// 开启新的webview页面加载
[
self
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWithLink
:
url
isShowNavi
:
YES
]
animated
:
YES
];
[
self
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWithLink
:
url
isShowNavi
:
NO
]
animated
:
YES
];
decisionHandler
(
WKNavigationActionPolicyCancel
);
decisionHandler
(
WKNavigationActionPolicyCancel
);
}
}
}
}
...
@@ -127,22 +140,42 @@
...
@@ -127,22 +140,42 @@
-
(
void
)
userContentController
:
(
WKUserContentController
*
)
userContentController
didReceiveScriptMessage
:
(
WKScriptMessage
*
)
message
{
-
(
void
)
userContentController
:
(
WKUserContentController
*
)
userContentController
didReceiveScriptMessage
:
(
WKScriptMessage
*
)
message
{
if
([
message
.
name
isEqualToString
:
@"AppModel"
])
{
if
([
message
.
name
isEqualToString
:
@"AppModel"
])
{
NSDictionary
*
bodyDic
=
message
.
body
;
NSDictionary
*
bodyDic
=
message
.
body
;
DSLog
(
@"bodyDic:%@"
,
bodyDic
);
int
type
=
[
bodyDic
[
@"type"
]
intValue
];
int
type
=
[
bodyDic
[
@"type"
]
intValue
];
if
(
type
==
1
)
{
// 未登录点击开启
DSLog
(
@"bodyDic:%@"
,
bodyDic
);
[
self
startOpen
];
switch
(
type
)
{
case
1
:
// 未登录点击开启
// 注入js代码用于强制刷新小梦睡眠
{
// NSString *jsCallBack = @"window.parent.location.reload()";
[
self
startOpen
];
// [self.aiWebView evaluateJavaScript:jsCallBack completionHandler:^(id _Nullable result, NSError * _Nullable error) {
}
// [self.aiWebView loadRequest:self.request];
break
;
// DSLog(@"注入成功...");
case
2
:
// 登录点击开启-开启我的页面里面的AI睡眠教练
// if (error) {
{
// DSLog(@"err is %@", error.domain);
// }
}
// }];
break
;
case
3
:
// 轻拍哄睡
{
[
self
.
navigationController
pushViewController
:[
ThreeMinuteController
new
]
animated
:
YES
];
}
break
;
case
4
:
// 安心记事本
{
[
DSProgressHUD
showToast
:
@"该功能未来会被替换"
];
}
break
;
default
:
break
;
}
}
// 注入js代码用于强制刷新小梦睡眠
// NSString *jsCallBack = @"window.parent.location.reload()";
// [self.aiWebView evaluateJavaScript:jsCallBack completionHandler:^(id _Nullable result, NSError * _Nullable error) {
// [self.aiWebView loadRequest:self.request];
// DSLog(@"注入成功...");
// if (error) {
// DSLog(@"err is %@", error.domain);
// }
// }];
}
}
}
}
...
@@ -154,7 +187,7 @@
...
@@ -154,7 +187,7 @@
// 实例化对象
// 实例化对象
configuration
.
userContentController
=
[
WKUserContentController
new
];
configuration
.
userContentController
=
[
WKUserContentController
new
];
// 调用JS方法
// 调用JS方法
[
configuration
.
userContentController
addScriptMessageHandler
:
self
name
:
@"AppModel"
];
[
configuration
.
userContentController
addScriptMessageHandler
:
[[
SomeProxy
alloc
]
initObject
:
self
]
name
:
@"AppModel"
];
// 进行偏好设置
// 进行偏好设置
WKPreferences
*
preferences
=
[
WKPreferences
new
];
WKPreferences
*
preferences
=
[
WKPreferences
new
];
...
@@ -163,9 +196,8 @@
...
@@ -163,9 +196,8 @@
configuration
.
preferences
=
preferences
;
configuration
.
preferences
=
preferences
;
// 初始化WKWebView
// 初始化WKWebView
_aiWebView
=
[[
WKWebView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
kScreenHeight
-
kTabBarHeight
)
configuration
:
configuration
];
_aiWebView
=
[[
WKWebView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
kScreenHeight
-
kTabBarHeight
)
configuration
:
configuration
];
_aiWebView
.
backgroundColor
=
DSWhite
;
_aiWebView
.
backgroundColor
=
DSWhite
;
_aiWebView
.
UIDelegate
=
self
;
_aiWebView
.
hidden
=
YES
;
_aiWebView
.
hidden
=
YES
;
_aiWebView
.
scrollView
.
bounces
=
NO
;
_aiWebView
.
scrollView
.
bounces
=
NO
;
[
_aiWebView
addObserver
:
self
forKeyPath
:
@"estimatedProgress"
options
:
NSKeyValueObservingOptionNew
context
:
nil
];
[
_aiWebView
addObserver
:
self
forKeyPath
:
@"estimatedProgress"
options
:
NSKeyValueObservingOptionNew
context
:
nil
];
...
@@ -197,7 +229,7 @@
...
@@ -197,7 +229,7 @@
weakSelf
.
progressView
.
hidden
=
NO
;
weakSelf
.
progressView
.
hidden
=
NO
;
weakSelf
.
progressView
.
progress
=
0
;
weakSelf
.
progressView
.
progress
=
0
;
weakSelf
.
exceptionView
.
hidden
=
YES
;
weakSelf
.
exceptionView
.
hidden
=
YES
;
[
weakSelf
.
aiWebView
loadRequest
:
s
elf
.
request
];
[
weakSelf
.
aiWebView
loadRequest
:
weakS
elf
.
request
];
}
superView
:
self
.
view
];
}
superView
:
self
.
view
];
}
}
return
_exceptionView
;
return
_exceptionView
;
...
...
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainController.m
查看文件 @
d9481f9
...
@@ -6,9 +6,12 @@
...
@@ -6,9 +6,12 @@
//
//
#import "RelaxTrainController.h"
#import "RelaxTrainController.h"
#import "RelaxTrainRequestModel.h"
@interface
RelaxTrainController
()
@interface
RelaxTrainController
()
@property
(
nonatomic
,
strong
)
UIImageView
*
bgIV
;
@property
(
nonatomic
,
strong
)
UILabel
*
cusTitleLab
;
@property
(
nonatomic
,
strong
)
NSArray
*
listArr
;
@end
@end
@implementation
RelaxTrainController
@implementation
RelaxTrainController
...
@@ -16,15 +19,66 @@
...
@@ -16,15 +19,66 @@
-
(
void
)
viewDidLoad
{
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
super
viewDidLoad
];
/*
self
.
view
.
backgroundColor
=
DSWhite
;
https://lanhuapp.com/url/f7vOH-utG5Q
[
self
.
view
addSubview
:
self
.
bgIV
];
[
self
.
view
addSubview
:
self
.
dsNaviBar
];
公司wifi 密码aolei@yidingniu.com
[
self
.
view
addSubview
:
self
.
dkBackBtn
];
[
self
.
dkBackBtn
dk_setImage
:
DKImagePickerWithNames
(
@"cus_back_icon"
,
@"cus_back_icon"
,
@"dk_cus_back_icon"
)
forState
:
UIControlStateNormal
];
2、练习腹式呼吸法功能接口:
[
self
.
view
addSubview
:
self
.
cusTitleLab
];
query_relax_audio_list
user_cur_task_state
[
RelaxTrainRequestModel
queryRelaxAudioListWithCompletion
:
^
(
RelaxTrainRequestModel
*
_Nonnull
requestModel
)
{
*/
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
if
(
requestModel
.
trainAudioList
.
count
)
{
self
.
listArr
=
requestModel
.
trainAudioList
;
RelaxTrainModel
*
currentModel
=
requestModel
.
trainAudioList
.
firstObject
;
[
self
.
bgIV
setImageWithURL
:[
NSURL
URLWithString
:
currentModel
.
bg_url
]
placeholderImage
:[
UIImage
imageNamed
:
@"basicPlaceholder"
]];
self
.
cusTitleLab
.
text
=
currentModel
.
audio_name
;
}
}
}];
[
RelaxTrainRequestModel
userCurTaskStateWithParams
:@{
@"title"
:
@"腹式呼吸放松法"
,
@"step"
:
@2
}
completion
:
^
(
RelaxTrainRequestModel
*
_Nonnull
requestModel
)
{
}];
CGFloat
iv_h
=
kScreenWidth
*
1233
/
1125
.
0
;
[
self
.
bgIV
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
left
.
right
.
equalTo
(
self
.
view
);
make
.
height
.
equalTo
(
@
(
iv_h
));
}];
[
self
.
cusTitleLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerX
.
equalTo
(
self
.
dsNaviBar
);
make
.
bottom
.
equalTo
(
self
.
dsNaviBar
).
offset
(
-
9
);
}];
}
#pragma mark - Actions
-
(
void
)
backAction
{
[
super
backAction
];
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
#pragma mark - lazy
-
(
UIImageView
*
)
bgIV
{
if
(
!
_bgIV
)
{
_bgIV
=
[
UIImageView
new
];
}
return
_bgIV
;
}
-
(
UILabel
*
)
cusTitleLab
{
if
(
!
_cusTitleLab
)
{
_cusTitleLab
=
[
UILabel
labWithTextColor
:
MainTextColor
font
:
BoldFont
(
18
)];
_cusTitleLab
.
textAlignment
=
NSTextAlignmentCenter
;
}
return
_cusTitleLab
;
}
-
(
NSArray
*
)
listArr
{
if
(
!
_listArr
)
{
_listArr
=
[
NSArray
array
];
}
return
_listArr
;
}
}
@end
@end
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainModel.h
0 → 100644
查看文件 @
d9481f9
//
// RelaxTrainModel.h
// DreamSleep
//
// Created by peter on 2022/6/2.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 放松训练数据model
@interface
RelaxTrainModel
:
NSObject
/// 音频id
@property
(
nonatomic
,
assign
)
int
audio_id
;
/// 播放背景图
@property
(
nonatomic
,
copy
)
NSString
*
bg_url
;
/// 音频封面
@property
(
nonatomic
,
copy
)
NSString
*
audio_img
;
/// 音频名称
@property
(
nonatomic
,
copy
)
NSString
*
audio_name
;
/// 音频播放链接
@property
(
nonatomic
,
copy
)
NSString
*
audio_url
;
/// 是否推荐(1:推荐,0:不推荐)
@property
(
nonatomic
,
copy
)
NSString
*
is_recommend
;
/// 描述信息
@property
(
nonatomic
,
copy
)
NSString
*
audio_desc
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainModel.m
0 → 100644
查看文件 @
d9481f9
//
// RelaxTrainModel.m
// DreamSleep
//
// Created by peter on 2022/6/2.
//
#import "RelaxTrainModel.h"
@implementation
RelaxTrainModel
+
(
nullable
NSDictionary
<
NSString
*
,
id
>
*
)
modelCustomPropertyMapper
{
return
@{
@"audio_id"
:
@"id"
};
}
@end
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainRequestModel.h
0 → 100644
查看文件 @
d9481f9
//
// RelaxTrainRequestModel.h
// DreamSleep
//
// Created by peter on 2022/6/2.
//
#import "DSNetworkTool.h"
#import "RelaxTrainModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface
RelaxTrainRequestModel
:
DSNetworkTool
/// 训练音频列表
@property
(
nonatomic
,
strong
)
NSArray
*
trainAudioList
;
/// 获取放松音频列表数据
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
queryRelaxAudioListWithCompletion
:(
void
(
^
)(
RelaxTrainRequestModel
*
requestModel
))
completion
;
/// 睡眠-AI教练任务更新操作步骤接口
/// @param params @{@"title":xxx, @"step":xxx}
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
userCurTaskStateWithParams
:(
NSDictionary
*
)
params
completion
:(
void
(
^
)(
RelaxTrainRequestModel
*
requestModel
))
completion
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/AISleepModule/RelaxTrainRequestModel.m
0 → 100644
查看文件 @
d9481f9
//
// RelaxTrainRequestModel.m
// DreamSleep
//
// Created by peter on 2022/6/2.
//
#import "RelaxTrainRequestModel.h"
@implementation
RelaxTrainRequestModel
+
(
NSURLSessionDataTask
*
)
queryRelaxAudioListWithCompletion
:(
void
(
^
)(
RelaxTrainRequestModel
*
requestModel
))
completion
{
RelaxTrainRequestModel
*
requestModel
=
[[
RelaxTrainRequestModel
alloc
]
init
];
NSString
*
api
=
@"query_relax_audio_list"
;
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"query{%@}"
,
api
];
return
[
self
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
YES
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"获取放松音频列表数据接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
NSArray
*
resultArr
=
apiDic
[
@"result"
];
NSMutableArray
*
tmpArr
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
audioDic
in
resultArr
)
{
RelaxTrainModel
*
trainModel
=
[
RelaxTrainModel
yy_modelWithDictionary
:
audioDic
];
[
tmpArr
addObject
:
trainModel
];
}
requestModel
.
trainAudioList
=
[
tmpArr
copy
];
completion
(
requestModel
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
requestModel
.
resCode
=
DSResCodeNetFail
;
requestModel
.
errorInfo
=
failureInfo
;
completion
(
requestModel
);
}];
}
+
(
NSURLSessionDataTask
*
)
userCurTaskStateWithParams
:(
NSDictionary
*
)
params
completion
:(
void
(
^
)(
RelaxTrainRequestModel
*
requestModel
))
completion
{
RelaxTrainRequestModel
*
requestModel
=
[[
RelaxTrainRequestModel
alloc
]
init
];
NSString
*
api
=
@"user_cur_task_state"
;
NSString
*
title
=
params
[
@"title"
];
int
step
=
[
params
[
@"step"
]
intValue
];
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"mutation{%@(title:
\"
%@
\"
,step:%d)}"
,
api
,
title
,
step
];
return
[
self
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
YES
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"睡眠-AI教练任务更新操作步骤接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
completion
(
requestModel
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
requestModel
.
resCode
=
DSResCodeNetFail
;
requestModel
.
errorInfo
=
failureInfo
;
completion
(
requestModel
);
}];
}
@end
DreamSleep/DreamSleep/Class/AISleepModule/SomeProxy.h
0 → 100644
查看文件 @
d9481f9
//
// SomeProxy.h
// test1
//
// Created by Xu小波 on 2020/3/24.
// Copyright © 2020 Xu小波. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <WebKit/WebKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface
SomeProxy
:
NSProxy
<
WKScriptMessageHandler
>
-
(
instancetype
)
initObject
:
(
id
)
obj
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/AISleepModule/SomeProxy.m
0 → 100644
查看文件 @
d9481f9
//
// SomeProxy.m
// test1
//
// Created by Xu小波 on 2020/3/24.
// Copyright © 2020 Xu小波. All rights reserved.
//
#import "SomeProxy.h"
#import <WebKit/WebKit.h>
@interface
SomeProxy
()
@property
(
nonatomic
,
weak
)
id
obj
;
@end
@implementation
SomeProxy
-
(
void
)
dealloc
{
DSLog
(
@"SomeProxy - dealloc"
);
}
-
(
instancetype
)
initObject
:
(
id
)
obj
{
self
.
obj
=
obj
;
return
self
;
}
-
(
void
)
forwardInvocation
:
(
NSInvocation
*
)
invocation
{
if
([
self
.
obj
respondsToSelector
:
invocation
.
selector
])
{
[
invocation
invokeWithTarget
:
self
.
obj
];
}
}
-
(
nullable
NSMethodSignature
*
)
methodSignatureForSelector
:
(
SEL
)
sel
{
return
[
self
.
obj
methodSignatureForSelector
:
sel
];
}
@end
DreamSleep/DreamSleep/Class/HomeModule/Course/Controller/CourseDetailController.m
查看文件 @
d9481f9
...
@@ -13,8 +13,8 @@
...
@@ -13,8 +13,8 @@
@interface
CourseDetailController
()
<
UITableViewDelegate
,
UITableViewDataSource
>
@interface
CourseDetailController
()
<
UITableViewDelegate
,
UITableViewDataSource
>
@property
(
nonatomic
,
strong
)
UITableView
*
audioListView
;
@property
(
nonatomic
,
strong
)
UITableView
*
audioListView
;
@property
(
nonatomic
,
strong
)
NSArray
*
subAudioArr
;
@property
(
nonatomic
,
strong
)
NSArray
*
subAudioArr
;
@property
(
nonatomic
,
strong
)
UIButton
*
unlockBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
unlockBtn
;
@end
@end
@implementation
CourseDetailController
@implementation
CourseDetailController
...
...
DreamSleep/DreamSleep/Class/HomeModule/Home/View/HomeHeaderView.m
查看文件 @
d9481f9
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
BannerModel
*
model
=
self
.
bannerDatas
[
index
];
BannerModel
*
model
=
self
.
bannerDatas
[
index
];
switch
(
model
.
banner_id
)
{
switch
(
model
.
banner_id
)
{
case
13
:
{
// 进入失眠拯救计划页面
case
13
:
{
// 进入失眠拯救计划页面
[
self
.
ds_viewController
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWith
Title
:
@"失眠拯救计划"
link
:
model
.
info_url
]
animated
:
YES
];
[
self
.
ds_viewController
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWith
Link
:
model
.
info_url
isShowNavi
:
NO
]
animated
:
YES
];
}
}
break
;
break
;
case
11
:
{
// 切换到AI睡眠教练标签
case
11
:
{
// 切换到AI睡眠教练标签
...
@@ -90,12 +90,11 @@
...
@@ -90,12 +90,11 @@
}
}
break
;
break
;
case
10
:
{
// 进入三分钟即刻入睡页面
case
10
:
{
// 进入三分钟即刻入睡页面
ThreeMinuteController
*
threeVC
=
[[
ThreeMinuteController
alloc
]
init
];
[
self
.
ds_viewController
.
navigationController
pushViewController
:[
ThreeMinuteController
new
]
animated
:
YES
];
[
self
.
ds_viewController
.
navigationController
pushViewController
:
threeVC
animated
:
YES
];
}
}
break
;
break
;
case
8
:
{
// 进入睡眠评测页面
case
8
:
{
// 进入睡眠评测页面
[
self
.
ds_viewController
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWith
Title
:
@"睡眠评测"
link
:
model
.
info_url
]
animated
:
YES
];
[
self
.
ds_viewController
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWith
Link
:
model
.
info_url
isShowNavi
:
NO
]
animated
:
YES
];
}
}
break
;
break
;
default
:
default
:
...
...
DreamSleep/DreamSleep/Class/ProfileModule/Me/ProfileController.m
查看文件 @
d9481f9
...
@@ -112,12 +112,12 @@
...
@@ -112,12 +112,12 @@
break
;
break
;
case
4
:
// 我的睡眠报告
case
4
:
// 我的睡眠报告
{
{
[
self
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWithLink
:
MySleepReportURL
isShowNavi
:
YES
]
animated
:
YES
];
[
self
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWithLink
:
MySleepReportURL
isShowNavi
:
NO
]
animated
:
YES
];
}
}
break
;
break
;
case
5
:
// 我的睡眠评测
case
5
:
// 我的睡眠评测
{
{
[
self
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWithLink
:
MySleepReviewURL
isShowNavi
:
YES
]
animated
:
YES
];
[
self
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWithLink
:
MySleepReviewURL
isShowNavi
:
NO
]
animated
:
YES
];
}
}
break
;
break
;
default
:
default
:
...
...
DreamSleep/DreamSleep/Class/ProfileModule/Me/ProfileHeaderView.m
查看文件 @
d9481f9
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
make
.
top
.
equalTo
(
self
.
titleLab
.
mas_bottom
).
offset
(
4
);
make
.
top
.
equalTo
(
self
.
titleLab
.
mas_bottom
).
offset
(
4
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
95
,
35
));
make
.
size
.
mas_equalTo
(
CGSizeMake
(
95
,
35
));
}];
}];
#warning 监听用户是否点击了开启
self
.
openAIBtn
.
hidden
=
YES
;
self
.
openAIBtn
.
hidden
=
YES
;
self
.
reportReviewsView
.
hidden
=
NO
;
self
.
reportReviewsView
.
hidden
=
NO
;
self
.
scoreCountLab
.
text
=
[
NSString
stringWithFormat
:
@"我的积分:%d"
,
model
.
total_points
];
self
.
scoreCountLab
.
text
=
[
NSString
stringWithFormat
:
@"我的积分:%d"
,
model
.
total_points
];
...
...
DreamSleep/DreamSleep/Class/ProfileModule/Me/ProfileTableView.m
查看文件 @
d9481f9
...
@@ -213,7 +213,7 @@
...
@@ -213,7 +213,7 @@
#pragma mark - Action
#pragma mark - Action
-
(
void
)
tapCBTIAction
{
-
(
void
)
tapCBTIAction
{
[
self
.
ds_viewController
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWith
Title
:
@"失眠的认知行为疗法(CBTI)"
link
:
MYCBTI
]
animated
:
YES
];
[
self
.
ds_viewController
.
navigationController
pushViewController
:[[
DsWebController
alloc
]
initWith
Link
:
MYCBTI
isShowNavi
:
NO
]
animated
:
YES
];
}
}
#pragma mark - ProfileHeaderViewDelegate
#pragma mark - ProfileHeaderViewDelegate
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论