Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d5678b46
由
cgx
编写于
2022-10-21 18:13:41 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
完成睡前故事列表页面
1 个父辈
7a6344f5
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
457 行增加
和
12 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Basement/Category/UIImage+Extras.m
DreamSleep/DreamSleep/Class/HomeModule/Home/View/HomeHeaderView.m
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryCell.h
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryCell.m
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryController.h
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryController.m
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryView.h
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryView.m
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/StoryPlayController.h
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/StoryPlayController.m
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/StoryPlayView.h
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/StoryPlayView.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
d5678b4
...
...
@@ -240,6 +240,10 @@
D0C50B4227FD39C800DC68F0 /* UIViewController+FullScreenModal.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C50B4127FD39C800DC68F0 /* UIViewController+FullScreenModal.m */; };
D0C50B4627FD66FB00DC68F0 /* DSConstUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C50B4527FD66FB00DC68F0 /* DSConstUtil.m */; };
D0C50B4F27FD832300DC68F0 /* LeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C50B4E27FD832300DC68F0 /* LeadView.m */; };
D0CCB091290289BF00B81141 /* SleepStoryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0CCB090290289BF00B81141 /* SleepStoryCell.m */; };
D0CCB094290289E200B81141 /* SleepStoryView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0CCB093290289E200B81141 /* SleepStoryView.m */; };
D0CCB09D2902A2E800B81141 /* StoryPlayController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0CCB09C2902A2E800B81141 /* StoryPlayController.m */; };
D0CCB0A02902A49D00B81141 /* StoryPlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0CCB09F2902A49D00B81141 /* StoryPlayView.m */; };
D0D00199282C9402004EAFA1 /* NoiseView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D00198282C9402004EAFA1 /* NoiseView.m */; };
D0D3826728124E8A005BB219 /* FeedbackController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D3826628124E8A005BB219 /* FeedbackController.m */; };
D0D4107C2844B8DB00009638 /* DailyTaskController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D4107B2844B8DB00009638 /* DailyTaskController.m */; };
...
...
@@ -780,6 +784,14 @@
D0C50B4527FD66FB00DC68F0 /* DSConstUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSConstUtil.m; sourceTree = "<group>"; };
D0C50B4D27FD832300DC68F0 /* LeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LeadView.h; sourceTree = "<group>"; };
D0C50B4E27FD832300DC68F0 /* LeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LeadView.m; sourceTree = "<group>"; };
D0CCB08F290289BF00B81141 /* SleepStoryCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SleepStoryCell.h; sourceTree = "<group>"; };
D0CCB090290289BF00B81141 /* SleepStoryCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SleepStoryCell.m; sourceTree = "<group>"; };
D0CCB092290289E200B81141 /* SleepStoryView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SleepStoryView.h; sourceTree = "<group>"; };
D0CCB093290289E200B81141 /* SleepStoryView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SleepStoryView.m; sourceTree = "<group>"; };
D0CCB09B2902A2E800B81141 /* StoryPlayController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StoryPlayController.h; sourceTree = "<group>"; };
D0CCB09C2902A2E800B81141 /* StoryPlayController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StoryPlayController.m; sourceTree = "<group>"; };
D0CCB09E2902A49D00B81141 /* StoryPlayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StoryPlayView.h; sourceTree = "<group>"; };
D0CCB09F2902A49D00B81141 /* StoryPlayView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StoryPlayView.m; sourceTree = "<group>"; };
D0D00197282C9402004EAFA1 /* NoiseView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NoiseView.h; sourceTree = "<group>"; };
D0D00198282C9402004EAFA1 /* NoiseView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NoiseView.m; sourceTree = "<group>"; };
D0D3826528124E8A005BB219 /* FeedbackController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FeedbackController.h; sourceTree = "<group>"; };
...
...
@@ -1593,8 +1605,16 @@
D078280D28FE616200C8D612 /* SleepStory */ = {
isa = PBXGroup;
children = (
D0CCB09E2902A49D00B81141 /* StoryPlayView.h */,
D0CCB09F2902A49D00B81141 /* StoryPlayView.m */,
D0CCB08F290289BF00B81141 /* SleepStoryCell.h */,
D0CCB090290289BF00B81141 /* SleepStoryCell.m */,
D0CCB092290289E200B81141 /* SleepStoryView.h */,
D0CCB093290289E200B81141 /* SleepStoryView.m */,
D06381A228D012420074515B /* SleepStoryController.h */,
D06381A328D012420074515B /* SleepStoryController.m */,
D0CCB09B2902A2E800B81141 /* StoryPlayController.h */,
D0CCB09C2902A2E800B81141 /* StoryPlayController.m */,
);
path = SleepStory;
sourceTree = "<group>";
...
...
@@ -2785,6 +2805,7 @@
D00291892816CD4500C0573B /* DsCacheUtils.m in Sources */,
D07DAC902810546A0067A1BF /* DSImagePickerController.m in Sources */,
D0E3564928F56115007190EE /* BaseTableViewCell.m in Sources */,
D0CCB091290289BF00B81141 /* SleepStoryCell.m in Sources */,
D0FE45C828FFCC640020710A /* ArticleModel.m in Sources */,
D070A78E28DF02DE0039C5A7 /* DynamicViewModel.m in Sources */,
D0A1C49228C2084B000975DC /* ArticleRequestModel.m in Sources */,
...
...
@@ -2857,6 +2878,7 @@
D0A3E10028E530330046EC84 /* InformCancelAlertView.m in Sources */,
D054CCB52830DE5600420DC4 /* NoisePlayerManager.m in Sources */,
D0874BBF2816E61000CECB3C /* RescuePlanView.m in Sources */,
D0CCB09D2902A2E800B81141 /* StoryPlayController.m in Sources */,
D07DACA42810557D0067A1BF /* CGGeometry+RSKImageCropper.m in Sources */,
D09D0E96280D3FE9008DEDAB /* NSDate+Extras.m in Sources */,
D0878F4C280BEFF9005F1B7F /* UILabel+YBAttributeTextTapAction.m in Sources */,
...
...
@@ -2872,6 +2894,7 @@
D01DC957287023C20035B78B /* RankHeadView.m in Sources */,
D06F2C5128F6AEC50023921E /* PersonDynViewModel.m in Sources */,
D0D5BB0D286D7A8D00D0507E /* TaskGroupModel.m in Sources */,
D0CCB0A02902A49D00B81141 /* StoryPlayView.m in Sources */,
D0E3564028F55B50007190EE /* PraiseListController.m in Sources */,
D003140628FD449E00E01A6A /* MessageCenterViewModel.m in Sources */,
D0FE45C528FF862F0020710A /* MyDynamicListResultModel.m in Sources */,
...
...
@@ -2909,6 +2932,7 @@
D0FAC421281B817D00D4B859 /* GKPhotoView.m in Sources */,
D037B1162875635F00236753 /* ArcPath.swift in Sources */,
D091E66E283F29D100D3279E /* ScoreDetailController.m in Sources */,
D0CCB094290289E200B81141 /* SleepStoryView.m in Sources */,
D00A63572824C42300AFFEAA /* DSNetworkCache.m in Sources */,
D0A72E42282B8BA600EED7BE /* CourseMusicCell.m in Sources */,
D02B7E5C28E2A28500218EF7 /* ComDynamicCell.m in Sources */,
...
...
DreamSleep/DreamSleep/Basement/Category/UIImage+Extras.m
查看文件 @
d5678b4
...
...
@@ -207,12 +207,13 @@
+
(
UIImage
*
)
addImage
:(
UIImage
*
)
img1
withImg
:(
UIImage
*
)
img2
{
CGFloat
img2W
=
img2
.
size
.
width
>
img1
.
size
.
width
?
img1
.
size
.
width
-
10
:
img2
.
size
.
width
;
CGFloat
img2H
=
(
img2
.
size
.
height
>
img1
.
size
.
height
)
?
img1
.
size
.
height
-
10
:
img2
.
size
.
height
;
CGFloat
iconW_H
=
MIN
(
img2W
,
img2H
);
UIGraphicsBeginImageContext
(
img1
.
size
);
// 加上这句就不模糊了
UIGraphicsBeginImageContextWithOptions
(
img1
.
size
,
NO
,
[
UIScreen
mainScreen
].
scale
);
[
img1
drawInRect
:
CGRectMake
(
0
,
0
,
img1
.
size
.
width
,
img1
.
size
.
height
)];
[
img2
drawInRect
:
CGRectMake
((
img1
.
size
.
width
-
i
mg2W
)
/
2
,
(
img1
.
size
.
height
-
img2H
)
/
2
,
img2W
,
img2
H
)];
[
img2
drawInRect
:
CGRectMake
((
img1
.
size
.
width
-
i
conW_H
)
/
2
,
(
img1
.
size
.
height
-
iconW_H
)
/
2
,
iconW_H
,
iconW_
H
)];
UIImage
*
compoundImg
=
UIGraphicsGetImageFromCurrentImageContext
();
UIGraphicsEndImageContext
();
return
compoundImg
;
...
...
DreamSleep/DreamSleep/Class/HomeModule/Home/View/HomeHeaderView.m
查看文件 @
d5678b4
...
...
@@ -165,6 +165,7 @@
if
(
!
_storyView
)
{
CGFloat
height
=
40
;
WS
(
weakSelf
);
#warning -待开发...
_storyView
=
[[
UIButton
alloc
]
initWithFrame
:
CGRectMake
(
15
,
self
.
height
-
height
,
kScreenWidth
-
30
,
40
)];
[
_storyView
setTitle
:
@"睡前故事"
forState
:
UIControlStateNormal
];
[
_storyView
setTitleColor
:
MainTextColor
forState
:
UIControlStateNormal
];
...
...
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryCell.h
0 → 100644
查看文件 @
d5678b4
//
// SleepStoryCell.h
// DreamSleep
//
// Created by peter on 2022/10/21.
//
#import "BaseTableViewCell.h"
#import "SubAudioModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface
SleepStoryCell
:
BaseTableViewCell
@property
(
nonatomic
,
strong
)
SubAudioModel
*
storyModel
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryCell.m
0 → 100644
查看文件 @
d5678b4
//
// SleepStoryCell.m
// DreamSleep
//
// Created by peter on 2022/10/21.
//
#import "SleepStoryCell.h"
@interface
SleepStoryCell
()
@property
(
nonatomic
,
strong
)
UIImageView
*
audioIV
;
@property
(
nonatomic
,
strong
)
UILabel
*
audioLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
audioDescLab
;
@property
(
nonatomic
,
strong
)
UIImageView
*
timeIcon
;
@property
(
nonatomic
,
strong
)
UILabel
*
playTimeLab
;
@property
(
nonatomic
,
strong
)
UIButton
*
playBtn
;
@end
@implementation
SleepStoryCell
-
(
instancetype
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
[
self
.
contentView
addSubview
:
self
.
audioIV
];
[
self
.
contentView
addSubview
:
self
.
audioLab
];
[
self
.
contentView
addSubview
:
self
.
audioDescLab
];
[
self
.
contentView
addSubview
:
self
.
timeIcon
];
[
self
.
contentView
addSubview
:
self
.
playTimeLab
];
[
self
.
contentView
addSubview
:
self
.
playBtn
];
[
self
.
audioIV
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
left
.
equalTo
(
self
.
contentView
).
offset
(
15
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
76
,
90
));
}];
[
self
.
audioLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
audioIV
);
make
.
left
.
equalTo
(
self
.
audioIV
.
mas_right
).
offset
(
12
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
15
);
}];
[
self
.
audioDescLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
contentView
).
offset
(
45
);
make
.
left
.
equalTo
(
self
.
audioLab
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
62
);
}];
[
self
.
timeIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
audioLab
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
14
,
14
));
make
.
bottom
.
equalTo
(
self
.
audioIV
).
offset
(
-
2
);
}];
[
self
.
playTimeLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
timeIcon
.
mas_right
).
offset
(
8
);
make
.
centerY
.
equalTo
(
self
.
timeIcon
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
84
);
}];
[
self
.
playBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
bottom
.
equalTo
(
self
.
contentView
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
15
);
}];
}
return
self
;
}
-
(
void
)
setStoryModel
:(
SubAudioModel
*
)
storyModel
{
_storyModel
=
storyModel
;
[
self
.
audioIV
yy_setImageWithURL
:[
NSURL
URLWithString
:
storyModel
.
audio_pic
]
placeholder
:[
UIImage
defaultPlaceholderWithSize
:
CGSizeMake
(
76
,
90
)]];
self
.
audioLab
.
text
=
storyModel
.
audio_name
;
self
.
audioDescLab
.
text
=
storyModel
.
audio_desc
;
self
.
playTimeLab
.
text
=
storyModel
.
play_time
;
}
#pragma mark - lazy
-
(
UIImageView
*
)
audioIV
{
if
(
!
_audioIV
)
{
_audioIV
=
[
UIImageView
new
];
_audioIV
.
dk_alphaPicker
=
DKAlphaPickerWithAlphas
(
1
,
.
5
,
1
);
[
_audioIV
cornerRadius
:
12
];
}
return
_audioIV
;
}
-
(
UILabel
*
)
audioLab
{
if
(
!
_audioLab
)
{
_audioLab
=
[
UILabel
labWithFont
:
BoldFont
(
16
)];
_audioLab
.
dk_textColorPicker
=
DKColorPickerWithKey
(
Dk_TITLE
);
}
return
_audioLab
;
}
-
(
UILabel
*
)
audioDescLab
{
if
(
!
_audioDescLab
)
{
_audioDescLab
=
[
UILabel
labWithFont
:
SysFont
(
14
)];
_audioDescLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
SubTitleColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
}
return
_audioDescLab
;
}
-
(
UIImageView
*
)
timeIcon
{
if
(
!
_timeIcon
)
{
_timeIcon
=
[[
UIImageView
alloc
]
dk_initWithImagePicker
:
DKImagePickerWithNames
(
@"muse_time_icon"
,
@"dk_muse_time_icon"
,
@"muse_time_icon"
)];
}
return
_timeIcon
;
}
-
(
UILabel
*
)
playTimeLab
{
if
(
!
_playTimeLab
)
{
_playTimeLab
=
[
UILabel
labWithFont
:
SysFont
(
12
)];
_playTimeLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
SmallTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
3
),
DSWhite
);
}
return
_playTimeLab
;
}
-
(
UIButton
*
)
playBtn
{
if
(
!
_playBtn
)
{
_playBtn
=
[
UIButton
btnWithTitle
:
@"播放"
font
:
BoldFont
(
16
)];
[
_playBtn
dk_setTitleColorPicker
:
DKColorPickerWithKey
(
Sub_Navi_TITLE
)
forState
:
UIControlStateNormal
];
_playBtn
.
size
=
(
CGSizeMake
(
64
,
34
));
[
_playBtn
cornerRadius
:
17
];
CGPoint
start
=
CGPointMake
(
0
,
0
.
5
);
CGPoint
end
=
CGPointMake
(
0
.
5
,
0
.
5
);
UIView
*
normal_tmp_view
=
[
_playBtn
genGradientWithStart
:
start
end
:
end
colors
:
@[(
__bridge
id
)
ColorFromHex
(
0x9BE3EC
).
CGColor
,
(
__bridge
id
)
ColorFromHex
(
0x62C3D5
).
CGColor
]
locations
:
@[
@
(
0
),
@
(
1
.
0
f
)]];
UIView
*
dk_tmp_view
=
[
_playBtn
genGradientWithStart
:
start
end
:
end
colors
:
@[(
__bridge
id
)
ColorFromHex
(
0x77A6AE
).
CGColor
,
(
__bridge
id
)
ColorFromHex
(
0x45A4B5
).
CGColor
]
locations
:
@[
@
(
0
),
@
(
1
.
0
f
)]];
[
_playBtn
dk_setBackgroundImage
:
DKImagePickerWithImages
([
normal_tmp_view
snapshotImage
],
[
dk_tmp_view
snapshotImage
],
[
normal_tmp_view
snapshotImage
])
forState
:
UIControlStateNormal
];
}
return
_playBtn
;
}
@end
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryController.h
查看文件 @
d5678b4
...
...
@@ -6,10 +6,11 @@
//
#import <UIKit/UIKit.h>
#import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface
SleepStoryController
:
UI
ViewController
@interface
SleepStoryController
:
Base
ViewController
@end
...
...
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryController.m
查看文件 @
d5678b4
...
...
@@ -6,30 +6,59 @@
//
#import "SleepStoryController.h"
#import "StoryPlayController.h"
#import "SafeSleepRequestModel.h"
#import "SleepStoryView.h"
@interface
SleepStoryController
()
@interface
SleepStoryController
()
<
SleepStoryViewDelegate
>
@property
(
nonatomic
,
strong
)
SleepStoryView
*
sleepStoryView
;
@end
@implementation
SleepStoryController
-
(
void
)
loadView
{
self
.
view
=
self
.
sleepStoryView
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
navigationItem
.
title
=
@"睡前故事"
;
self
.
view
.
backgroundColor
=
DSWhite
;
self
.
navigationItem
.
title
=
@"睡前故事"
;
}
-
(
void
)
fireHandler
{
[
super
fireHandler
];
[
self
getSleepStoryListData
];
}
#pragma mark - SleepStoryViewDelegate
-
(
void
)
getSleepStoryListData
{
[
SafeSleepRequestModel
queryRelaxMeditationAudiosWithTypeID
:
501
completion
:
^
(
SafeSleepRequestModel
*
_Nonnull
requestModel
)
{
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
if
(
self
.
sleepStoryView
.
dataSource
.
dataArray
.
count
==
0
&&
requestModel
.
subAudioListData
.
count
==
0
)
{
[
self
updateDefalutView
:
DefaultTypeEmpty
info
:
@""
];
[
self
.
sleepStoryView
updateList
:@[]];
}
else
{
[
self
.
sleepStoryView
updateList
:
requestModel
.
subAudioListData
];
}
}
else
{
[
DSProgressHUD
showToast
:
requestModel
.
errMessage
];
}
}];
}];
}
-
(
void
)
didSelectStoryItem
:
(
SubAudioModel
*
)
audioModel
{
StoryPlayController
*
playVC
=
[
StoryPlayController
new
];
playVC
.
audioModel
=
audioModel
;
[
self
presentViewController
:
playVC
animated
:
YES
completion
:
nil
];
}
#pragma mark - 品牌模式
-
(
NaviStyle
)
navigationBarStyle
{
return
NaviStyleDefault
;
#pragma mark - lazy
-
(
SleepStoryView
*
)
sleepStoryView
{
if
(
!
_sleepStoryView
)
{
_sleepStoryView
=
[[
SleepStoryView
alloc
]
initWithDelegate
:
self
];
}
return
_sleepStoryView
;
}
@end
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryView.h
0 → 100644
查看文件 @
d5678b4
//
// SleepStoryView.h
// DreamSleep
//
// Created by peter on 2022/10/21.
//
#import <UIKit/UIKit.h>
#import "SleepStoryCell.h"
NS_ASSUME_NONNULL_BEGIN
@protocol
SleepStoryViewDelegate
<
NSObject
>
-
(
void
)
getSleepStoryListData
;
-
(
void
)
didSelectStoryItem
:(
SubAudioModel
*
)
audioModel
;
@end
@interface
SleepStoryView
:
UIView
@property
(
nonatomic
,
strong
)
DSDataSource
*
dataSource
;
@property
(
nonatomic
,
weak
)
id
<
SleepStoryViewDelegate
>
delegate
;
-
(
instancetype
)
initWithDelegate
:(
id
<
SleepStoryViewDelegate
>
)
delegate
;
-
(
void
)
updateList
:(
NSArray
*
)
dataList
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/SleepStoryView.m
0 → 100644
查看文件 @
d5678b4
//
// SleepStoryView.m
// DreamSleep
//
// Created by peter on 2022/10/21.
//
#import "SleepStoryView.h"
@interface
SleepStoryView
()
<
UITableViewDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
storyListView
;
@end
@implementation
SleepStoryView
-
(
instancetype
)
initWithDelegate
:(
id
<
SleepStoryViewDelegate
>
)
delegate
{
if
(
self
=
[
super
init
])
{
self
.
delegate
=
delegate
;
[
self
.
dataSource
addDataArray
:@[]];
self
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
}
return
self
;
}
#pragma mark - public
-
(
void
)
updateList
:(
NSArray
*
)
dataList
{
if
(
dataList
&&
dataList
.
count
)
{
[
self
.
dataSource
addDataArray
:
dataList
];
[
self
.
storyListView
reloadData
];
}
[
self
.
storyListView
.
mj_header
endRefreshing
];
}
#pragma mark - UITableViewDelegate
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
return
105
;
}
-
(
void
)
tableView
:(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
SubAudioModel
*
model
=
self
.
dataSource
.
dataArray
[
indexPath
.
row
];
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
didSelectStoryItem
:)])
{
[
self
.
delegate
didSelectStoryItem
:
model
];
}
}
#pragma mark - lazy
-
(
DSDataSource
*
)
dataSource
{
if
(
!
_dataSource
)
{
CellConfigureBlock
cellBlock
=
^
(
SleepStoryCell
*
cell
,
SubAudioModel
*
model
,
NSIndexPath
*
indexPath
)
{
cell
.
storyModel
=
model
;
};
_dataSource
=
[[
DSDataSource
alloc
]
initWithIdentifier
:
NSStringFromClass
([
SleepStoryCell
class
])
datas
:@[]
isSection
:
YES
configureBlock
:
cellBlock
];
UITableView
*
storyListView
=
[[
UITableView
alloc
]
initWithFrame
:
CGRectZero
style
:
UITableViewStylePlain
];
storyListView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
storyListView
.
delegate
=
self
;
storyListView
.
dataSource
=
_dataSource
;
storyListView
.
showsVerticalScrollIndicator
=
NO
;
storyListView
.
backgroundColor
=
DSClearColor
;
storyListView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
[
storyListView
registerClass
:[
SleepStoryCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
SleepStoryCell
class
])];
storyListView
.
tableFooterView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
10
,
15
)];
[
self
addSubview
:
storyListView
];
self
.
storyListView
=
storyListView
;
[
self
.
storyListView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
edges
.
equalTo
(
self
);
}];
WS
(
weakSelf
);
storyListView
.
mj_header
=
[
DSGifHeader
headerWithRefreshingBlock
:
^
{
if
(
weakSelf
.
delegate
&&
[
weakSelf
.
delegate
respondsToSelector
:
@selector
(
getSleepStoryListData
)])
{
[
weakSelf
.
delegate
getSleepStoryListData
];
}
}];
[
storyListView
.
mj_header
beginRefreshing
];
}
return
_dataSource
;
}
@end
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/StoryPlayController.h
0 → 100644
查看文件 @
d5678b4
//
// StoryPlayController.h
// DreamSleep
//
// Created by peter on 2022/10/21.
//
#import <UIKit/UIKit.h>
#import "SubAudioModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 故事播放页面
@interface
StoryPlayController
:
UIViewController
@property
(
nonatomic
,
strong
)
SubAudioModel
*
audioModel
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/StoryPlayController.m
0 → 100644
查看文件 @
d5678b4
//
// StoryPlayController.m
// DreamSleep
//
// Created by peter on 2022/10/21.
//
#import "StoryPlayController.h"
#import "StoryPlayView.h"
@interface
StoryPlayController
()
<
StoryPlayViewDelegate
>
@property
(
nonatomic
,
strong
)
StoryPlayView
*
storyPlayView
;
@end
@implementation
StoryPlayController
-
(
void
)
loadView
{
self
.
view
=
self
.
storyPlayView
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
}
#pragma mark - StoryPlayViewDelegate
-
(
void
)
stopAudioAndDismiss
{
// if (self.streamState == kFsAudioStreamPlaying) {
// [self.audioStream pause];
// }
// [self.audioStream stop];
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
#pragma mark - lazy
-
(
StoryPlayView
*
)
storyPlayView
{
if
(
!
_storyPlayView
)
{
_storyPlayView
=
[[
StoryPlayView
alloc
]
initWithDelegate
:
self
];
}
return
_storyPlayView
;
}
#pragma mark - 设置状态栏文字颜色
-
(
UIStatusBarStyle
)
preferredStatusBarStyle
{
return
[
self
.
dk_manager
.
themeVersion
isEqualToString
:
DKThemeVersionNormal
]
?
UIStatusBarStyleDefault
:
UIStatusBarStyleLightContent
;
}
@end
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/StoryPlayView.h
0 → 100644
查看文件 @
d5678b4
//
// StoryPlayView.h
// DreamSleep
//
// Created by peter on 2022/10/21.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol
StoryPlayViewDelegate
<
NSObject
>
/// 停止音频播放并且退出当前页
-
(
void
)
stopAudioAndDismiss
;
@end
@interface
StoryPlayView
:
UIView
@property
(
nonatomic
,
weak
)
id
<
StoryPlayViewDelegate
>
delegate
;
-
(
instancetype
)
initWithDelegate
:(
id
<
StoryPlayViewDelegate
>
)
delegate
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/HomeModule/SleepStory/StoryPlayView.m
0 → 100644
查看文件 @
d5678b4
//
// StoryPlayView.m
// DreamSleep
//
// Created by peter on 2022/10/21.
//
#import "StoryPlayView.h"
@interface
StoryPlayView
()
@property
(
nonatomic
,
strong
)
UIButton
*
dismissBtn
;
@end
@implementation
StoryPlayView
-
(
instancetype
)
initWithDelegate
:(
id
<
StoryPlayViewDelegate
>
)
delegate
{
if
(
self
=
[
super
init
])
{
self
.
delegate
=
delegate
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
[
self
addSubview
:
self
.
dismissBtn
];
#warning 待开发...
}
return
self
;
}
#pragma mark - private
-
(
void
)
dismiss
{
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
stopAudioAndDismiss
)])
{
[
self
.
delegate
stopAudioAndDismiss
];
}
}
#pragma mark - lazy
-
(
UIButton
*
)
dismissBtn
{
if
(
!
_dismissBtn
)
{
_dismissBtn
=
[[
UIButton
alloc
]
initWithFrame
:
CGRectMake
(
15
,
kStatusBarHeight
+
19
,
30
,
30
)];
[
_dismissBtn
dk_setImage
:
DKImagePickerWithNames
(
@"home_close"
,
@"dk_home_close"
,
@"home_close"
)
forState
:
UIControlStateNormal
];
[
_dismissBtn
addTarget
:
self
action
:
@selector
(
dismiss
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
return
_dismissBtn
;
}
@end
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论