Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 93cfbaff
由
cgx
编写于
2022-08-12 18:20:35 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
修复倒计时显示问题
1 个父辈
2a30144c
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
30 行增加
和
68 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Basement/Category/NSString+Extras.h
DreamSleep/DreamSleep/Basement/Category/NSString+Extras.m
DreamSleep/DreamSleep/Class/AISleepModule/SleepReady/View/XLCircleProgress.m
DreamSleep/DreamSleep/Class/HomeModule/Course/View/MusicPlayerView.m
DreamSleep/DreamSleep/Class/HomeModule/Home/View/TimingView.h
DreamSleep/DreamSleep/Class/HomeModule/Home/View/TimingView.m
DreamSleep/DreamSleep/Class/HomeModule/WhiteNoise/View/NoisePlayBar.m
DreamSleep/DreamSleep/Class/HomeModule/WhiteNoise/View/NoisePlayView.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
93cfbaf
...
@@ -1094,8 +1094,6 @@
...
@@ -1094,8 +1094,6 @@
D0C50B3E27FD381000DC68F0 /* UIView+Extras.m */,
D0C50B3E27FD381000DC68F0 /* UIView+Extras.m */,
D027EE2E27FB52DA004BBA61 /* UIImage+Extras.h */,
D027EE2E27FB52DA004BBA61 /* UIImage+Extras.h */,
D027EE2F27FB52DA004BBA61 /* UIImage+Extras.m */,
D027EE2F27FB52DA004BBA61 /* UIImage+Extras.m */,
D0C50B4027FD39C800DC68F0 /* UIViewController+FullScreenModal.h */,
D0C50B4127FD39C800DC68F0 /* UIViewController+FullScreenModal.m */,
D0F80905280431100097899F /* UILabel+Extras.h */,
D0F80905280431100097899F /* UILabel+Extras.h */,
D0F80906280431100097899F /* UILabel+Extras.m */,
D0F80906280431100097899F /* UILabel+Extras.m */,
D0506B0A280503A800229278 /* UIButton+Extras.h */,
D0506B0A280503A800229278 /* UIButton+Extras.h */,
...
@@ -1110,6 +1108,8 @@
...
@@ -1110,6 +1108,8 @@
D0A245F5283DB12100FB49AA /* WKWebView+Extras.m */,
D0A245F5283DB12100FB49AA /* WKWebView+Extras.m */,
D05416F5288A57BD0035060B /* AVAudioSession+SXAudioSession.h */,
D05416F5288A57BD0035060B /* AVAudioSession+SXAudioSession.h */,
D05416F6288A57BD0035060B /* AVAudioSession+SXAudioSession.m */,
D05416F6288A57BD0035060B /* AVAudioSession+SXAudioSession.m */,
D0C50B4027FD39C800DC68F0 /* UIViewController+FullScreenModal.h */,
D0C50B4127FD39C800DC68F0 /* UIViewController+FullScreenModal.m */,
);
);
path = Category;
path = Category;
sourceTree = "<group>";
sourceTree = "<group>";
...
@@ -1570,14 +1570,14 @@
...
@@ -1570,14 +1570,14 @@
D0AE1E3428281B6F008CEF27 /* TimerProxy.m */,
D0AE1E3428281B6F008CEF27 /* TimerProxy.m */,
D0C50B4427FD66FB00DC68F0 /* DSConstUtil.h */,
D0C50B4427FD66FB00DC68F0 /* DSConstUtil.h */,
D0C50B4527FD66FB00DC68F0 /* DSConstUtil.m */,
D0C50B4527FD66FB00DC68F0 /* DSConstUtil.m */,
D0B5ECC627F2E97A003EDFE3 /* MacroFuncUtil.h */,
D0B5ECC727F2E97A003EDFE3 /* MacroFuncUtil.m */,
D043A8BA287EC71400226176 /* RingingTools.h */,
D043A8BA287EC71400226176 /* RingingTools.h */,
D043A8BB287EC71400226176 /* RingingTools.m */,
D043A8BB287EC71400226176 /* RingingTools.m */,
D0B5ECD627F2F1B0003EDFE3 /* ServerAPIUtil.h */,
D0B5ECD627F2F1B0003EDFE3 /* ServerAPIUtil.h */,
D0B5ECD727F2F1B0003EDFE3 /* ServerAPIUtil.m */,
D0B5ECD727F2F1B0003EDFE3 /* ServerAPIUtil.m */,
D0B5ECD327F2F0B2003EDFE3 /* AdaptationUtil.h */,
D0B5ECD327F2F0B2003EDFE3 /* AdaptationUtil.h */,
D0B5ECD427F2F0B2003EDFE3 /* AdaptationUtil.m */,
D0B5ECD427F2F0B2003EDFE3 /* AdaptationUtil.m */,
D0B5ECC627F2E97A003EDFE3 /* MacroFuncUtil.h */,
D0B5ECC727F2E97A003EDFE3 /* MacroFuncUtil.m */,
);
);
path = Utils;
path = Utils;
sourceTree = "<group>";
sourceTree = "<group>";
...
...
DreamSleep/DreamSleep/Basement/Category/NSString+Extras.h
查看文件 @
93cfbaf
...
@@ -34,6 +34,10 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -34,6 +34,10 @@ NS_ASSUME_NONNULL_BEGIN
/// 转义特殊字符
/// 转义特殊字符
/// @param oriStr oriStr
/// @param oriStr oriStr
+
(
NSString
*
)
transferSpecialCharacters
:(
NSString
*
)
oriStr
;
+
(
NSString
*
)
transferSpecialCharacters
:(
NSString
*
)
oriStr
;
/// 获取格式化时间
/// @param time time(单位:s)
+
(
NSString
*
)
getFormatTime
:(
NSInteger
)
time
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Basement/Category/NSString+Extras.m
查看文件 @
93cfbaf
...
@@ -54,4 +54,10 @@
...
@@ -54,4 +54,10 @@
return
@""
;
return
@""
;
}
}
+
(
NSString
*
)
getFormatTime
:(
NSInteger
)
time
{
NSInteger
minutes
=
time
/
60
;
NSInteger
seconds
=
time
%
60
;
return
[
NSString
stringWithFormat
:
@"%02ld:%02ld"
,
minutes
,
seconds
];
}
@end
@end
DreamSleep/DreamSleep/Class/AISleepModule/SleepReady/View/XLCircleProgress.m
查看文件 @
93cfbaf
...
@@ -83,25 +83,10 @@
...
@@ -83,25 +83,10 @@
return
;
return
;
}
}
_countTime
--
;
_countTime
--
;
NSString
*
countDownStr
=
[
self
formattimewithtimeinterval
:
_countTime
];
_percentLabel
.
text
=
[
NSString
getFormatTime
:
_countTime
];
_percentLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
countDownStr
];
_circle
.
progress
=
(
double
)(
_totalTime
-
_countTime
)
/
(
double
)(
_totalTime
);
_circle
.
progress
=
(
double
)(
_totalTime
-
_countTime
)
/
(
double
)(
_totalTime
);
}
}
-
(
NSString
*
)
formattimewithtimeinterval
:
(
NSTimeInterval
)
timeinterval
{
int
minute
=
0
,
hour
=
0
,
secend
=
timeinterval
;
minute
=
(
secend
%
3600
)
/
60
;
hour
=
secend
/
3600
;
secend
=
secend
%
60
;
if
(
hour
==
0
)
{
return
[
NSString
stringWithFormat
:
@"%02d:%02d"
,
minute
,
secend
];
}
else
if
(
minute
==
0
){
return
[
NSString
stringWithFormat
:
@"%02d"
,
secend
];
}
else
{
return
[
NSString
stringWithFormat
:
@"%02d:%02d:%02d"
,
hour
,
minute
,
secend
];
}
}
#pragma mark - Setter
#pragma mark - Setter
-
(
void
)
setProgress
:
(
float
)
progress
{
-
(
void
)
setProgress
:
(
float
)
progress
{
_progress
=
progress
;
_progress
=
progress
;
...
...
DreamSleep/DreamSleep/Class/HomeModule/Course/View/MusicPlayerView.m
查看文件 @
93cfbaf
...
@@ -38,8 +38,8 @@
...
@@ -38,8 +38,8 @@
-
(
instancetype
)
initWithFrame
:
(
CGRect
)
frame
{
-
(
instancetype
)
initWithFrame
:
(
CGRect
)
frame
{
if
(
self
=
[
super
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
kScreenHeight
)])
{
if
(
self
=
[
super
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
kScreenHeight
)])
{
self
.
minuteIndex
=
0
;
self
.
minuteIndex
=
19
;
self
.
countTime
=
60
;
self
.
countTime
=
60
*
20
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
self
.
dk_backgroundColorPicker
=
DKColorPickerWithKey
(
VCViewBG
);
[
self
buildInterface
];
[
self
buildInterface
];
...
@@ -123,7 +123,7 @@
...
@@ -123,7 +123,7 @@
[
self
.
timeCloseBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
timeCloseBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
bottom
.
equalTo
(
self
.
mas_bottom
).
offset
(
-
36
);
make
.
bottom
.
equalTo
(
self
.
mas_bottom
).
offset
(
-
36
);
make
.
right
.
equalTo
(
self
.
mas_right
).
offset
(
-
23
);
make
.
right
.
equalTo
(
self
.
mas_right
).
offset
(
-
23
);
make
.
width
.
equalTo
(
@
8
0
);
make
.
width
.
equalTo
(
@
10
0
);
make
.
height
.
equalTo
(
@60
);
make
.
height
.
equalTo
(
@60
);
}];
}];
}
}
...
@@ -241,21 +241,6 @@
...
@@ -241,21 +241,6 @@
return
self
.
playModeBtn
.
tag
;
return
self
.
playModeBtn
.
tag
;
}
}
#pragma mark - others
-
(
NSString
*
)
formattimewithtimeinterval
:
(
NSTimeInterval
)
timeinterval
{
int
minute
=
0
,
hour
=
0
,
secend
=
timeinterval
;
minute
=
(
secend
%
3600
)
/
60
;
hour
=
secend
/
3600
;
secend
=
secend
%
60
;
if
(
hour
==
0
)
{
return
[
NSString
stringWithFormat
:
@"%02d:%02d"
,
minute
,
secend
];
}
else
if
(
minute
==
0
){
return
[
NSString
stringWithFormat
:
@"%02d"
,
secend
];
}
else
{
return
[
NSString
stringWithFormat
:
@"%02d:%02d:%02d"
,
hour
,
minute
,
secend
];
}
}
#pragma mark - lazy
#pragma mark - lazy
-
(
UIButton
*
)
dismissBtn
{
-
(
UIButton
*
)
dismissBtn
{
if
(
!
_dismissBtn
)
{
if
(
!
_dismissBtn
)
{
...
@@ -403,7 +388,7 @@
...
@@ -403,7 +388,7 @@
}
cancel
:
^
{
}
cancel
:
^
{
[
weakSelf
.
timer
setFireDate
:[
NSDate
distantFuture
]];
[
weakSelf
.
timer
setFireDate
:[
NSDate
distantFuture
]];
[
weakSelf
.
timeCloseBtn
setTitle
:
@""
forState
:
UIControlStateNormal
];
[
weakSelf
.
timeCloseBtn
setTitle
:
@""
forState
:
UIControlStateNormal
];
}];
}
defalutIndex
:
self
.
minuteIndex
];
}
}
return
_timingView
;
return
_timingView
;
}
}
...
@@ -421,9 +406,7 @@
...
@@ -421,9 +406,7 @@
return
;
return
;
}
}
weakSelf
.
countTime
--
;
weakSelf
.
countTime
--
;
NSString
*
countDownStr
=
[
weakSelf
formattimewithtimeinterval
:
weakSelf
.
countTime
];
[
weakSelf
.
timeCloseBtn
setTitle
:[
NSString
stringWithFormat
:
@"%@/%@"
,
[
NSString
getFormatTime
:
weakSelf
.
countTime
],
[
NSString
getFormatTime
:
weakSelf
.
totalTime
]]
forState
:
UIControlStateNormal
];
NSString
*
totalTimeStr
=
[
weakSelf
formattimewithtimeinterval
:
weakSelf
.
totalTime
];
[
weakSelf
.
timeCloseBtn
setTitle
:[
NSString
stringWithFormat
:
@"%@/%@"
,
countDownStr
,
totalTimeStr
]
forState
:
UIControlStateNormal
];
}];
}];
[[
NSRunLoop
currentRunLoop
]
addTimer
:
_timer
forMode
:
NSRunLoopCommonModes
];
[[
NSRunLoop
currentRunLoop
]
addTimer
:
_timer
forMode
:
NSRunLoopCommonModes
];
}
}
...
...
DreamSleep/DreamSleep/Class/HomeModule/Home/View/TimingView.h
查看文件 @
93cfbaf
...
@@ -19,7 +19,7 @@ typedef void(^CancelBlock)(void);
...
@@ -19,7 +19,7 @@ typedef void(^CancelBlock)(void);
/// 取消block
/// 取消block
@property
(
nonatomic
,
copy
)
CancelBlock
cancelBlock
;
@property
(
nonatomic
,
copy
)
CancelBlock
cancelBlock
;
-
(
instancetype
)
initWithSureBlock
:(
TimingBlock
)
timingBlock
cancel
:(
CancelBlock
)
cancelBlock
;
-
(
instancetype
)
initWithSureBlock
:(
TimingBlock
)
timingBlock
cancel
:(
CancelBlock
)
cancelBlock
defalutIndex
:(
NSInteger
)
defalutIndex
;
/// 显示定时器
/// 显示定时器
-
(
void
)
display
;
-
(
void
)
display
;
...
...
DreamSleep/DreamSleep/Class/HomeModule/Home/View/TimingView.m
查看文件 @
93cfbaf
...
@@ -24,9 +24,10 @@
...
@@ -24,9 +24,10 @@
@implementation
TimingView
@implementation
TimingView
-
(
instancetype
)
initWithSureBlock
:(
TimingBlock
)
timingBlock
cancel
:(
CancelBlock
)
cancelBlock
{
-
(
instancetype
)
initWithSureBlock
:(
TimingBlock
)
timingBlock
cancel
:(
CancelBlock
)
cancelBlock
defalutIndex
:(
NSInteger
)
defalutIndex
{
if
(
self
=
[
super
initWithFrame
:[
UIScreen
mainScreen
].
bounds
])
{
if
(
self
=
[
super
initWithFrame
:[
UIScreen
mainScreen
].
bounds
])
{
_currentTimeIndex
=
0
;
_currentTimeIndex
=
defalutIndex
;
_sureIndex
=
defalutIndex
;
_timingBlock
=
timingBlock
;
_timingBlock
=
timingBlock
;
_cancelBlock
=
cancelBlock
;
_cancelBlock
=
cancelBlock
;
...
...
DreamSleep/DreamSleep/Class/HomeModule/WhiteNoise/View/NoisePlayBar.m
查看文件 @
93cfbaf
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
[
self
.
timeLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
timeLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
bottom
.
equalTo
(
self
);
make
.
top
.
bottom
.
equalTo
(
self
);
make
.
right
.
equalTo
(
self
.
playBtn
.
mas_left
).
offset
(
-
12
);
make
.
right
.
equalTo
(
self
.
playBtn
.
mas_left
).
offset
(
-
12
);
make
.
width
.
equalTo
(
@1
0
0
);
make
.
width
.
equalTo
(
@1
2
0
);
}];
}];
[
self
.
playBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
playBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerY
.
equalTo
(
self
);
make
.
centerY
.
equalTo
(
self
);
...
@@ -65,8 +65,8 @@
...
@@ -65,8 +65,8 @@
[
self
addGestureRecognizer
:
tap
];
[
self
addGestureRecognizer
:
tap
];
}
}
self
.
minuteIndex
=
0
;
self
.
minuteIndex
=
9
;
self
.
countTime
=
60
;
self
.
countTime
=
60
*
(
self
.
minuteIndex
+
1
)
;
// 添加对单例对象白噪音播放列表变化通知
// 添加对单例对象白噪音播放列表变化通知
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
noisePlaylistHasChange
:
)
name
:
NoisePlaylistHasChange
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
noisePlaylistHasChange
:
)
name
:
NoisePlaylistHasChange
object
:
nil
];
...
@@ -179,7 +179,7 @@
...
@@ -179,7 +179,7 @@
}
cancel
:
^
{
}
cancel
:
^
{
[
weakSelf
.
timer
setFireDate
:[
NSDate
distantFuture
]];
[
weakSelf
.
timer
setFireDate
:[
NSDate
distantFuture
]];
weakSelf
.
timeLab
.
text
=
@""
;
weakSelf
.
timeLab
.
text
=
@""
;
}];
}
defalutIndex
:
self
.
minuteIndex
];
}
}
return
_timingView
;
return
_timingView
;
}
}
...
@@ -196,28 +196,11 @@
...
@@ -196,28 +196,11 @@
return
;
return
;
}
}
weakSelf
.
countTime
--
;
weakSelf
.
countTime
--
;
NSString
*
countDownStr
=
[
weakSelf
formattimewithtimeinterval
:
weakSelf
.
countTime
];
weakSelf
.
timeLab
.
text
=
[
NSString
stringWithFormat
:
@"%@/%@"
,
[
NSString
getFormatTime
:
weakSelf
.
countTime
],
[
NSString
getFormatTime
:
weakSelf
.
totalTime
]];
NSString
*
totalTimeStr
=
[
weakSelf
formattimewithtimeinterval
:
weakSelf
.
totalTime
];
weakSelf
.
timeLab
.
text
=
[
NSString
stringWithFormat
:
@"%@/%@"
,
countDownStr
,
totalTimeStr
];
}];
}];
[[
NSRunLoop
currentRunLoop
]
addTimer
:
_timer
forMode
:
NSRunLoopCommonModes
];
[[
NSRunLoop
currentRunLoop
]
addTimer
:
_timer
forMode
:
NSRunLoopCommonModes
];
}
}
return
_timer
;
return
_timer
;
}
}
#pragma mark - others
-
(
NSString
*
)
formattimewithtimeinterval
:
(
NSTimeInterval
)
timeinterval
{
int
minute
=
0
,
hour
=
0
,
secend
=
timeinterval
;
minute
=
(
secend
%
3600
)
/
60
;
hour
=
secend
/
3600
;
secend
=
secend
%
60
;
if
(
hour
==
0
)
{
return
[
NSString
stringWithFormat
:
@"%02d:%02d"
,
minute
,
secend
];
}
else
if
(
minute
==
0
){
return
[
NSString
stringWithFormat
:
@"%02d"
,
secend
];
}
else
{
return
[
NSString
stringWithFormat
:
@"%02d:%02d:%02d"
,
hour
,
minute
,
secend
];
}
}
@end
@end
DreamSleep/DreamSleep/Class/HomeModule/WhiteNoise/View/NoisePlayView.m
查看文件 @
93cfbaf
...
@@ -183,7 +183,7 @@
...
@@ -183,7 +183,7 @@
if
(
!
_oneClickBtn
)
{
if
(
!
_oneClickBtn
)
{
_oneClickBtn
=
[
UIButton
btnWithTitle
:
@""
titleColor
:
DSWhite
font
:
BoldFont
(
16
)
bgColor
:
BrandColor
];
_oneClickBtn
=
[
UIButton
btnWithTitle
:
@""
titleColor
:
DSWhite
font
:
BoldFont
(
16
)
bgColor
:
BrandColor
];
[
_oneClickBtn
addTarget
:
self
action
:
@selector
(
oneClickAction
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_oneClickBtn
addTarget
:
self
action
:
@selector
(
oneClickAction
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_oneClickBtn
cornerRadius
:
2
2
];
[
_oneClickBtn
cornerRadius
:
2
0
];
[
_oneClickBtn
setTitle
:
@"一键开启"
forState
:
UIControlStateNormal
];
[
_oneClickBtn
setTitle
:
@"一键开启"
forState
:
UIControlStateNormal
];
[
_oneClickBtn
setTitle
:
@"一键暂停"
forState
:
UIControlStateSelected
];
[
_oneClickBtn
setTitle
:
@"一键暂停"
forState
:
UIControlStateSelected
];
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论