Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f20edd04
由
cgx
编写于
2022-05-09 22:09:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
完成定时播放功能
1 个父辈
f283b9c3
全部展开
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
263 行增加
和
2 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Class/HomeModule/BreathingMethod/BreatheController.m
DreamSleep/DreamSleep/Class/HomeModule/Home/MusicPlayerController.m
DreamSleep/DreamSleep/Class/HomeModule/Home/MusicPlayerView.h
DreamSleep/DreamSleep/Class/HomeModule/Home/MusicPlayerView.m
DreamSleep/DreamSleep/Class/HomeModule/Home/TimingView.h
DreamSleep/DreamSleep/Class/HomeModule/Home/TimingView.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
f20edd0
...
@@ -153,6 +153,7 @@
...
@@ -153,6 +153,7 @@
D0E660022807B5AE006562F2 /* SafeSleepRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E660002807B5AE006562F2 /* SafeSleepRequestModel.m */; };
D0E660022807B5AE006562F2 /* SafeSleepRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E660002807B5AE006562F2 /* SafeSleepRequestModel.m */; };
D0E660052807D02C006562F2 /* UserRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E660042807D02C006562F2 /* UserRequestModel.m */; };
D0E660052807D02C006562F2 /* UserRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E660042807D02C006562F2 /* UserRequestModel.m */; };
D0E6600828080F97006562F2 /* SystemSetController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E6600728080F97006562F2 /* SystemSetController.m */; };
D0E6600828080F97006562F2 /* SystemSetController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E6600728080F97006562F2 /* SystemSetController.m */; };
D0E6F1FD28290128004150E5 /* TimingView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E6F1FC28290128004150E5 /* TimingView.m */; };
D0F808F52803D4E70097899F /* Track.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808F32803D4E70097899F /* Track.m */; };
D0F808F52803D4E70097899F /* Track.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808F32803D4E70097899F /* Track.m */; };
D0F808FE280421C20097899F /* ThreeMinuteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808FD280421C20097899F /* ThreeMinuteController.m */; };
D0F808FE280421C20097899F /* ThreeMinuteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F808FD280421C20097899F /* ThreeMinuteController.m */; };
D0F8090428042A0B0097899F /* SafeSleepCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F8090328042A0B0097899F /* SafeSleepCell.m */; };
D0F8090428042A0B0097899F /* SafeSleepCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0F8090328042A0B0097899F /* SafeSleepCell.m */; };
...
@@ -456,6 +457,8 @@
...
@@ -456,6 +457,8 @@
D0E660042807D02C006562F2 /* UserRequestModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserRequestModel.m; sourceTree = "<group>"; };
D0E660042807D02C006562F2 /* UserRequestModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserRequestModel.m; sourceTree = "<group>"; };
D0E6600628080F97006562F2 /* SystemSetController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemSetController.h; sourceTree = "<group>"; };
D0E6600628080F97006562F2 /* SystemSetController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemSetController.h; sourceTree = "<group>"; };
D0E6600728080F97006562F2 /* SystemSetController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SystemSetController.m; sourceTree = "<group>"; };
D0E6600728080F97006562F2 /* SystemSetController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SystemSetController.m; sourceTree = "<group>"; };
D0E6F1FB28290128004150E5 /* TimingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TimingView.h; sourceTree = "<group>"; };
D0E6F1FC28290128004150E5 /* TimingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TimingView.m; sourceTree = "<group>"; };
D0F808F32803D4E70097899F /* Track.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Track.m; sourceTree = "<group>"; };
D0F808F32803D4E70097899F /* Track.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Track.m; sourceTree = "<group>"; };
D0F808F42803D4E70097899F /* Track.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Track.h; sourceTree = "<group>"; };
D0F808F42803D4E70097899F /* Track.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Track.h; sourceTree = "<group>"; };
D0F808FC280421C20097899F /* ThreeMinuteController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreeMinuteController.h; sourceTree = "<group>"; };
D0F808FC280421C20097899F /* ThreeMinuteController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreeMinuteController.h; sourceTree = "<group>"; };
...
@@ -1068,6 +1071,8 @@
...
@@ -1068,6 +1071,8 @@
D0F9AC5D282660CC00FD7A3B /* MusicPlayerView.m */,
D0F9AC5D282660CC00FD7A3B /* MusicPlayerView.m */,
D0AE1E3328281B6F008CEF27 /* TimerProxy.h */,
D0AE1E3328281B6F008CEF27 /* TimerProxy.h */,
D0AE1E3428281B6F008CEF27 /* TimerProxy.m */,
D0AE1E3428281B6F008CEF27 /* TimerProxy.m */,
D0E6F1FB28290128004150E5 /* TimingView.h */,
D0E6F1FC28290128004150E5 /* TimingView.m */,
);
);
path = Home;
path = Home;
sourceTree = "<group>";
sourceTree = "<group>";
...
@@ -1558,6 +1563,7 @@
...
@@ -1558,6 +1563,7 @@
D0930F1A2801874B006B497A /* UIViewController+Swizzling.m in Sources */,
D0930F1A2801874B006B497A /* UIViewController+Swizzling.m in Sources */,
D01C9D6728167F9D00163567 /* InfoModifyAlertView.m in Sources */,
D01C9D6728167F9D00163567 /* InfoModifyAlertView.m in Sources */,
D0BB9AA728164DFB00DB209E /* NickNameController.m in Sources */,
D0BB9AA728164DFB00DB209E /* NickNameController.m in Sources */,
D0E6F1FD28290128004150E5 /* TimingView.m in Sources */,
D08F79DF281A1838000D99DD /* TZPhotoPreviewCell.m in Sources */,
D08F79DF281A1838000D99DD /* TZPhotoPreviewCell.m in Sources */,
D0F808FE280421C20097899F /* ThreeMinuteController.m in Sources */,
D0F808FE280421C20097899F /* ThreeMinuteController.m in Sources */,
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */,
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */,
...
...
DreamSleep/DreamSleep/Class/HomeModule/BreathingMethod/BreatheController.m
查看文件 @
f20edd0
...
@@ -235,11 +235,11 @@
...
@@ -235,11 +235,11 @@
}
}
#pragma mark - UIPickerViewDataSource && UIPickerViewDelegate
#pragma mark - UIPickerViewDataSource && UIPickerViewDelegate
-
(
NSInteger
)
numberOfComponentsInPickerView
:
(
UIPickerView
*
)
pickerView
{
-
(
NSInteger
)
numberOfComponentsInPickerView
:
(
UIPickerView
*
)
pickerView
{
return
1
;
return
1
;
}
}
-
(
NSInteger
)
pickerView
:
(
UIPickerView
*
)
pickerView
numberOfRowsInComponent
:
(
NSInteger
)
component
{
-
(
NSInteger
)
pickerView
:
(
UIPickerView
*
)
pickerView
numberOfRowsInComponent
:
(
NSInteger
)
component
{
return
self
.
minuteDatas
.
count
;
return
self
.
minuteDatas
.
count
;
}
}
...
...
DreamSleep/DreamSleep/Class/HomeModule/Home/MusicPlayerController.m
查看文件 @
f20edd0
...
@@ -201,6 +201,12 @@
...
@@ -201,6 +201,12 @@
}
}
}
}
-
(
void
)
timerHasCountDone
{
if
(
self
.
streamState
==
kFsAudioStreamPlaying
)
{
[
self
.
audioStream
pause
];
}
}
#pragma mark - 隐藏导航栏
#pragma mark - 隐藏导航栏
-
(
BOOL
)
isShowNavigationBar
{
-
(
BOOL
)
isShowNavigationBar
{
return
YES
;
return
YES
;
...
...
DreamSleep/DreamSleep/Class/HomeModule/Home/MusicPlayerView.h
查看文件 @
f20edd0
...
@@ -24,6 +24,9 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -24,6 +24,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 上一首、播放、下一首事件
/// 上一首、播放、下一首事件
/// @param item item
/// @param item item
-
(
void
)
playControlActionWithItem
:(
UIButton
*
)
item
;
-
(
void
)
playControlActionWithItem
:(
UIButton
*
)
item
;
/// 定时器设置时间已经到了
-
(
void
)
timerHasCountDone
;
@end
@end
/// 音频播放页面
/// 音频播放页面
...
@@ -31,6 +34,8 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -31,6 +34,8 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
weak
)
id
<
MusicPlayerViewDelegate
>
delegate
;
@property
(
nonatomic
,
weak
)
id
<
MusicPlayerViewDelegate
>
delegate
;
@property
(
nonatomic
,
strong
)
SubAudioModel
*
audioModel
;
/// 播放状态
/// 播放状态
@property
(
nonatomic
,
assign
)
BOOL
isPlaying
;
@property
(
nonatomic
,
assign
)
BOOL
isPlaying
;
/// 音频播放模式
/// 音频播放模式
...
...
DreamSleep/DreamSleep/Class/HomeModule/Home/MusicPlayerView.m
查看文件 @
f20edd0
此文件的差异被折叠,
点击展开。
DreamSleep/DreamSleep/Class/HomeModule/Home/TimingView.h
0 → 100644
查看文件 @
f20edd0
//
// TimingView.h
// DreamSleep
//
// Created by peter on 2022/5/9.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef
void
(
^
TimingBlock
)(
NSInteger
index
,
NSArray
*
minuteDatas
);
/// 首页和音频播放界面定时弹框
@interface
TimingView
:
UIView
@property
(
nonatomic
,
copy
)
TimingBlock
timingBlock
;
-
(
instancetype
)
initWithSureBlock
:(
TimingBlock
)
block
;
/// 显示定时器
-
(
void
)
display
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/HomeModule/Home/TimingView.m
0 → 100644
查看文件 @
f20edd0
//
// TimingView.m
// DreamSleep
//
// Created by peter on 2022/5/9.
//
#import "TimingView.h"
@interface
TimingView
()
<
UIPickerViewDataSource
,
UIPickerViewDelegate
>
@property
(
nonatomic
,
strong
)
UIView
*
bgView
;
@property
(
nonatomic
,
strong
)
UIButton
*
closeBtn
;
@property
(
nonatomic
,
strong
)
UILabel
*
titleLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
audioTimeLab
;
@property
(
nonatomic
,
strong
)
UIPickerView
*
timePickerView
;
@property
(
nonatomic
,
strong
)
UILabel
*
minuteLab
;
@property
(
nonatomic
,
strong
)
UIButton
*
cancelBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
sureBtn
;
@property
(
nonatomic
,
strong
)
UIView
*
lineView
;
@property
(
nonatomic
,
strong
)
NSArray
*
minuteDatas
;
@property
(
nonatomic
,
assign
)
NSInteger
currentTimeIndex
;
@property
(
nonatomic
,
assign
)
NSInteger
sureIndex
;
@end
@implementation
TimingView
-
(
instancetype
)
initWithSureBlock
:(
TimingBlock
)
block
{
if
(
self
=
[
super
initWithFrame
:[
UIScreen
mainScreen
].
bounds
])
{
_currentTimeIndex
=
0
;
_timingBlock
=
block
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
ColorFromHex
(
0x6F7587
),
DSClearColor
,
DSWhite
);
self
.
backgroundColor
=
[
self
.
backgroundColor
colorWithAlphaComponent
:
0
.
6
];
NSMutableArray
*
tmpArr
=
[
NSMutableArray
array
];
for
(
int
i
=
1
;
i
<
121
;
i
++
)
{
[
tmpArr
addObject
:[
NSString
stringWithFormat
:
@"%d"
,
i
]];
}
self
.
minuteDatas
=
[
tmpArr
copy
];
[
self
addSubview
:
self
.
bgView
];
[
self
.
bgView
addSubview
:
self
.
titleLab
];
[
self
.
bgView
addSubview
:
self
.
closeBtn
];
[
self
.
bgView
addSubview
:
self
.
audioTimeLab
];
[
self
.
bgView
addSubview
:
self
.
timePickerView
];
[
self
.
bgView
addSubview
:
self
.
minuteLab
];
[
self
.
bgView
addSubview
:
self
.
cancelBtn
];
[
self
.
bgView
addSubview
:
self
.
sureBtn
];
[
self
.
bgView
addSubview
:
self
.
lineView
];
[
self
.
bgView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
size
.
mas_equalTo
(
CGSizeMake
(
280
,
236
));
make
.
center
.
equalTo
(
self
);
}];
[
self
.
titleLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerX
.
equalTo
(
self
.
bgView
);
make
.
top
.
equalTo
(
self
.
bgView
).
offset
(
20
);
}];
[
self
.
closeBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerY
.
equalTo
(
self
.
titleLab
);
make
.
top
.
equalTo
(
self
.
bgView
).
offset
(
15
);
make
.
right
.
equalTo
(
self
.
bgView
).
offset
(
-
15
);
}];
[
self
.
audioTimeLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
bgView
).
offset
(
63
);
make
.
top
.
equalTo
(
self
.
bgView
).
offset
(
97
);
}];
[
self
.
timePickerView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
audioTimeLab
.
mas_right
);
make
.
right
.
equalTo
(
self
.
minuteLab
.
mas_left
);
make
.
top
.
equalTo
(
self
.
titleLab
.
mas_bottom
).
offset
(
22
);
make
.
bottom
.
equalTo
(
self
.
sureBtn
.
mas_top
).
offset
(
-
22
);
}];
[
self
.
minuteLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerY
.
equalTo
(
self
.
audioTimeLab
);
make
.
right
.
equalTo
(
self
.
bgView
).
offset
(
-
63
);
}];
[
self
.
cancelBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
bgView
);
make
.
bottom
.
equalTo
(
self
.
bgView
);
make
.
height
.
equalTo
(
@64
);
}];
[
self
.
sureBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
right
.
equalTo
(
self
.
bgView
);
make
.
bottom
.
equalTo
(
self
.
bgView
);
make
.
size
.
equalTo
(
self
.
cancelBtn
);
make
.
left
.
equalTo
(
self
.
cancelBtn
.
mas_right
);
}];
[
self
.
lineView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerX
.
equalTo
(
self
.
bgView
);
make
.
centerY
.
equalTo
(
self
.
sureBtn
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
1
,
40
));
}];
}
return
self
;
}
#pragma mark - Actions
-
(
void
)
display
{
[
DSKeyWindow
addSubview
:
self
];
self
.
hidden
=
NO
;
[
self
.
timePickerView
selectRow
:
self
.
sureIndex
inComponent
:
0
animated
:
YES
];
}
-
(
void
)
dismissTimingView
{
self
.
hidden
=
YES
;
}
-
(
void
)
sureAction
{
[
self
dismissTimingView
];
self
.
sureIndex
=
self
.
currentTimeIndex
;
if
(
self
.
timingBlock
)
{
self
.
timingBlock
(
self
.
sureIndex
,
self
.
minuteDatas
);
}
}
#pragma mark - UIPickerViewDataSource && UIPickerViewDelegate
-
(
NSInteger
)
numberOfComponentsInPickerView
:
(
UIPickerView
*
)
pickerView
{
return
1
;
}
-
(
NSInteger
)
pickerView
:
(
UIPickerView
*
)
pickerView
numberOfRowsInComponent
:
(
NSInteger
)
component
{
return
self
.
minuteDatas
.
count
;
}
-
(
void
)
pickerView
:
(
UIPickerView
*
)
pickerView
didSelectRow
:
(
NSInteger
)
row
inComponent
:
(
NSInteger
)
component
{
self
.
currentTimeIndex
=
row
;
}
-
(
UIView
*
)
pickerView
:
(
UIPickerView
*
)
pickerView
viewForRow
:
(
NSInteger
)
row
forComponent
:
(
NSInteger
)
component
reusingView
:
(
UIView
*
)
view
{
UILabel
*
lab
=
[
UILabel
labWithTextColor
:
BrandColor
font
:
SysFont
(
16
)];
lab
.
frame
=
CGRectMake
(
0
.
0
,
0
.
0
,
70
,
35
);
lab
.
textAlignment
=
NSTextAlignmentCenter
;
lab
.
text
=
self
.
minuteDatas
[
row
];
if
(
@available
(
iOS
14
.
0
,
*
))
{
pickerView
.
subviews
[
1
].
backgroundColor
=
DSClearColor
;
}
return
lab
;
}
#pragma mark - lazy
-
(
UIView
*
)
bgView
{
if
(
!
_bgView
)
{
_bgView
=
[
UIView
new
];
_bgView
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
TabBarBG
);
[
_bgView
cornerRadius
:
24
];
}
return
_bgView
;
}
-
(
UILabel
*
)
titleLab
{
if
(
!
_titleLab
)
{
_titleLab
=
[
UILabel
dkLabWithText
:
@"设置时间"
font
:
BoldFont
(
16
)];
_titleLab
.
textAlignment
=
NSTextAlignmentCenter
;
}
return
_titleLab
;
}
-
(
UIButton
*
)
closeBtn
{
if
(
!
_closeBtn
)
{
_closeBtn
=
[
UIButton
new
];
[
_closeBtn
dk_setImage
:
DKImagePickerWithNames
(
@"home_close"
,
@"dk_home_close"
,
@"home_close"
)
forState
:
UIControlStateNormal
];
[
_closeBtn
addTarget
:
self
action
:
@selector
(
dismissTimingView
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
return
_closeBtn
;
}
-
(
UILabel
*
)
audioTimeLab
{
if
(
!
_audioTimeLab
)
{
_audioTimeLab
=
[
UILabel
dkLabWithText
:
@"音频时长"
font
:
SysFont
(
15
)];
_audioTimeLab
.
textAlignment
=
NSTextAlignmentCenter
;
}
return
_audioTimeLab
;
}
-
(
UIPickerView
*
)
timePickerView
{
if
(
!
_timePickerView
)
{
_timePickerView
=
[
UIPickerView
new
];
_timePickerView
.
delegate
=
self
;
_timePickerView
.
dataSource
=
self
;
}
return
_timePickerView
;
}
-
(
UILabel
*
)
minuteLab
{
if
(
!
_minuteLab
)
{
_minuteLab
=
[
UILabel
dkLabWithText
:
@"分钟"
font
:
SysFont
(
15
)];
_minuteLab
.
textAlignment
=
NSTextAlignmentCenter
;
}
return
_minuteLab
;
}
-
(
UIButton
*
)
cancelBtn
{
if
(
!
_cancelBtn
)
{
_cancelBtn
=
[
UIButton
dkBtnTitle
:
@"取消设置"
font
:
SysFont
(
15
)];
[
_cancelBtn
dk_setTitleColorPicker
:
DKColorPickerWithKey
(
TEXT
)
forState
:
UIControlStateNormal
];
[
_cancelBtn
addTarget
:
self
action
:
@selector
(
dismissTimingView
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
return
_cancelBtn
;
}
-
(
UIButton
*
)
sureBtn
{
if
(
!
_sureBtn
)
{
_sureBtn
=
[
UIButton
btnWithTitle
:
@"确定"
titleColor
:
BrandColor
font
:
SysFont
(
15
)];
[
_sureBtn
addTarget
:
self
action
:
@selector
(
sureAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
return
_sureBtn
;
}
-
(
UIView
*
)
lineView
{
if
(
!
_lineView
)
{
_lineView
=
[
UIView
new
];
_lineView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
ColorFromHex
(
0xE6E6E6
),
DarkColor
,
DSWhite
);
}
return
_lineView
;
}
@end
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论