Commit ee637f38 cgx

完成均衡舒压和4-7-8页面(本地音频文件)

1 个父辈 e520aa3c
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
D0506B1528051ED400229278 /* SafeSleepModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1428051ED400229278 /* SafeSleepModel.m */; }; D0506B1528051ED400229278 /* SafeSleepModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1428051ED400229278 /* SafeSleepModel.m */; };
D0506B1828054ECD00229278 /* SafeHelperCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */; }; D0506B1828054ECD00229278 /* SafeHelperCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */; };
D0506B1B2805500E00229278 /* SafeHelperCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */; }; D0506B1B2805500E00229278 /* SafeHelperCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */; };
D051032E282A4E9200560A0D /* instant_eternity.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = D051032C282A4E9200560A0D /* instant_eternity.mp3 */; };
D051032F282A4E9200560A0D /* fse.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = D051032D282A4E9200560A0D /* fse.mp3 */; };
D053BEE9280F9E310028CCFC /* CloseAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D053BEE8280F9E310028CCFC /* CloseAlertView.m */; }; D053BEE9280F9E310028CCFC /* CloseAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D053BEE8280F9E310028CCFC /* CloseAlertView.m */; };
D055BEB928250D3400BC11A4 /* CourseCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEB828250D3400BC11A4 /* CourseCollectionCell.m */; }; D055BEB928250D3400BC11A4 /* CourseCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEB828250D3400BC11A4 /* CourseCollectionCell.m */; };
D055BEBC28250E8F00BC11A4 /* CourseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEBB28250E8F00BC11A4 /* CourseModel.m */; }; D055BEBC28250E8F00BC11A4 /* CourseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEBB28250E8F00BC11A4 /* CourseModel.m */; };
...@@ -255,6 +257,8 @@ ...@@ -255,6 +257,8 @@
D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeHelperCollectionView.m; sourceTree = "<group>"; }; D0506B1728054ECD00229278 /* SafeHelperCollectionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeHelperCollectionView.m; sourceTree = "<group>"; };
D0506B192805500E00229278 /* SafeHelperCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SafeHelperCollectionViewCell.h; sourceTree = "<group>"; }; D0506B192805500E00229278 /* SafeHelperCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SafeHelperCollectionViewCell.h; sourceTree = "<group>"; };
D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeHelperCollectionViewCell.m; sourceTree = "<group>"; }; D0506B1A2805500E00229278 /* SafeHelperCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SafeHelperCollectionViewCell.m; sourceTree = "<group>"; };
D051032C282A4E9200560A0D /* instant_eternity.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = instant_eternity.mp3; sourceTree = "<group>"; };
D051032D282A4E9200560A0D /* fse.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = fse.mp3; sourceTree = "<group>"; };
D053BEE7280F9E310028CCFC /* CloseAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CloseAlertView.h; sourceTree = "<group>"; }; D053BEE7280F9E310028CCFC /* CloseAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CloseAlertView.h; sourceTree = "<group>"; };
D053BEE8280F9E310028CCFC /* CloseAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CloseAlertView.m; sourceTree = "<group>"; }; D053BEE8280F9E310028CCFC /* CloseAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CloseAlertView.m; sourceTree = "<group>"; };
D055BEB728250D3400BC11A4 /* CourseCollectionCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CourseCollectionCell.h; sourceTree = "<group>"; }; D055BEB728250D3400BC11A4 /* CourseCollectionCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CourseCollectionCell.h; sourceTree = "<group>"; };
...@@ -611,6 +615,8 @@ ...@@ -611,6 +615,8 @@
D04567A827F6D018009F0A82 /* Resource */ = { D04567A827F6D018009F0A82 /* Resource */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D051032D282A4E9200560A0D /* fse.mp3 */,
D051032C282A4E9200560A0D /* instant_eternity.mp3 */,
D020CE1E280D915D00E7E82F /* invite_friend.webp */, D020CE1E280D915D00E7E82F /* invite_friend.webp */,
D0C09ED428007D9100709D4C /* 478_lottie.json */, D0C09ED428007D9100709D4C /* 478_lottie.json */,
D0C09ED528007D9100709D4C /* 478normal_lottie.json */, D0C09ED528007D9100709D4C /* 478normal_lottie.json */,
...@@ -1383,10 +1389,12 @@ ...@@ -1383,10 +1389,12 @@
D0B5ECB127F2D9E0003EDFE3 /* Assets.xcassets in Resources */, D0B5ECB127F2D9E0003EDFE3 /* Assets.xcassets in Resources */,
D04B3DBD27F6F8090022F8DF /* Profile.storyboard in Resources */, D04B3DBD27F6F8090022F8DF /* Profile.storyboard in Resources */,
D046FE1628100342000295AC /* TencentOpenApi_IOS_Bundle.bundle in Resources */, D046FE1628100342000295AC /* TencentOpenApi_IOS_Bundle.bundle in Resources */,
D051032F282A4E9200560A0D /* fse.mp3 in Resources */,
D046FE1328100342000295AC /* README.txt in Resources */, D046FE1328100342000295AC /* README.txt in Resources */,
D0C09EDA28007D9100709D4C /* relax_lottie.json in Resources */, D0C09EDA28007D9100709D4C /* relax_lottie.json in Resources */,
D0CFD3D027FB3B920002982B /* launcher@3x.png in Resources */, D0CFD3D027FB3B920002982B /* launcher@3x.png in Resources */,
D08F79DB281A1838000D99DD /* TZImagePickerController.bundle in Resources */, D08F79DB281A1838000D99DD /* TZImagePickerController.bundle in Resources */,
D051032E282A4E9200560A0D /* instant_eternity.mp3 in Resources */,
D0C09ED928007D9100709D4C /* 478normal_lottie.json in Resources */, D0C09ED928007D9100709D4C /* 478normal_lottie.json in Resources */,
D0B5ECAF27F2D9DE003EDFE3 /* Main.storyboard in Resources */, D0B5ECAF27F2D9DE003EDFE3 /* Main.storyboard in Resources */,
D0CFD3D127FB3B920002982B /* launcher.png in Resources */, D0CFD3D127FB3B920002982B /* launcher.png in Resources */,
......
...@@ -14,8 +14,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -14,8 +14,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface BreatheController : UIViewController @interface BreatheController : UIViewController
// 动画样式 // 动画样式
@property (nonatomic, assign) LottieStyle style; @property (nonatomic, assign) LottieStyle style;
// 音频URL
@property (nonatomic, strong) NSURL *audioFileURL;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
@property (nonatomic, strong) DOUAudioStreamer *audioStreamer; @property (nonatomic, strong) DOUAudioStreamer *audioStreamer;
@property (nonatomic, strong) NSTimer *controlTimer; @property (nonatomic, strong) NSTimer *controlTimer;
@property (nonatomic, assign) NSInteger minuteTime; @property (nonatomic, assign) NSInteger minuteTime;
@property (nonatomic,assign) NSInteger playDuration; @property (nonatomic, assign) NSInteger playDuration;
@end @end
@implementation BreatheController @implementation BreatheController
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
self.minuteDatas = @[@"1",@"2",@"3",@"4",@"5"]; self.minuteDatas = @[@"1",@"2",@"3",@"4",@"5"];
self.rotateLottieFile = self.style == LottieStyleBalance ? @"relax_normal_lottie.json" : @"478normal_lottie.json"; self.rotateLottieFile = self.style == LottieStyleBalance ? @"relax_normal_lottie.json" : @"478normal_lottie.json";
self.zoomLottieFile = self.style == LottieStyleBalance ? @"relax_lottie.json" : @"478_lottie.json"; self.zoomLottieFile = self.style == LottieStyleBalance ? @"relax_lottie.json" : @"478_lottie.json";
self.audioFileURL = [NSURL URLWithString:@"https://img2.ydniu.com/audio/1641783843905_LhE13l.mp3"];
[self initView]; [self initView];
} }
...@@ -175,8 +174,6 @@ ...@@ -175,8 +174,6 @@
- (void)timerAction:(NSTimer *)timer { - (void)timerAction:(NSTimer *)timer {
self.playDuration--; self.playDuration--;
DSLog(@"playDuration:%ld", self.playDuration);
if (self.playDuration % 5 == 0 && self.playDuration >= 0) { if (self.playDuration % 5 == 0 && self.playDuration >= 0) {
AudioServicesPlaySystemSound(1520); AudioServicesPlaySystemSound(1520);
} }
...@@ -247,26 +244,18 @@ ...@@ -247,26 +244,18 @@
self.minuteTime = [[self.minuteDatas objectAtIndex:row] integerValue]; self.minuteTime = [[self.minuteDatas objectAtIndex:row] integerValue];
} }
- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component { - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
return 35; UILabel *lab = [UILabel labWithTextColor:BrandColor font:SysFont(18)];
} lab.frame = CGRectMake(0.0, 0.0, 70, 35);
lab.textAlignment = NSTextAlignmentCenter;
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component { lab.text = self.minuteDatas[row];
return 70;
}
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
NSString *titleString = [self.minuteDatas objectAtIndex:row];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:titleString];
NSRange range = [titleString rangeOfString:titleString];
[attributedString addAttribute:NSForegroundColorAttributeName value:BrandColor range:range];
[attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:range];
if (@available(iOS 14.0, *)) { if (@available(iOS 14.0, *)) {
pickerView.subviews[1].backgroundColor = DSClearColor; pickerView.subviews[1].backgroundColor = DSClearColor;
} }
return attributedString; return lab;
} }
#pragma mark - lazy
- (BreathTextView *)breathTextView { - (BreathTextView *)breathTextView {
if (!_breathTextView) { if (!_breathTextView) {
CGFloat height = 61; CGFloat height = 61;
...@@ -332,7 +321,8 @@ static void *kStatusKVOKey1 = &kStatusKVOKey1; ...@@ -332,7 +321,8 @@ static void *kStatusKVOKey1 = &kStatusKVOKey1;
- (DOUAudioStreamer *)audioStreamer { - (DOUAudioStreamer *)audioStreamer {
if (!_audioStreamer) { if (!_audioStreamer) {
Track *track = [[Track alloc] init]; Track *track = [[Track alloc] init];
track.audioFileURL = self.audioFileURL; NSString *audioName = self.style == LottieStyleBalance ? @"instant_eternity" : @"fse";
track.audioFileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:audioName ofType:@"mp3"]];
_audioStreamer = [DOUAudioStreamer streamerWithAudioFile:track]; _audioStreamer = [DOUAudioStreamer streamerWithAudioFile:track];
_audioStreamer.volume = 1; _audioStreamer.volume = 1;
[_audioStreamer addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:kStatusKVOKey1]; [_audioStreamer addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:kStatusKVOKey1];
......
...@@ -17,6 +17,10 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -17,6 +17,10 @@ NS_ASSUME_NONNULL_BEGIN
/// 音频列表数据 /// 音频列表数据
@property (nonatomic, strong) NSArray *subAudioListData; @property (nonatomic, strong) NSArray *subAudioListData;
/// 睡眠-放松训练-即刻放松音频接口(均衡舒压、4-7-8呼吸法音频),暂时不调用
/// @param completion completion
+ (NSURLSessionDataTask *)queryRelaxRightNowAudioWithCompletion:(void (^)(SafeSleepRequestModel *requestModel))completion;
/// 获取舒眠课程、助眠音乐列表数据 /// 获取舒眠课程、助眠音乐列表数据
/// @param subID 6:舒眠课程,18:助眠音乐 /// @param subID 6:舒眠课程,18:助眠音乐
/// @isHome isHome YES:主页横向列表数据,NO:查看所有课程列表数据 /// @isHome isHome YES:主页横向列表数据,NO:查看所有课程列表数据
......
...@@ -11,6 +11,21 @@ ...@@ -11,6 +11,21 @@
@implementation SafeSleepRequestModel @implementation SafeSleepRequestModel
+ (NSURLSessionDataTask *)queryRelaxRightNowAudioWithCompletion:(void (^)(SafeSleepRequestModel *requestModel))completion {
NSString *api = @"query_relax_right_now_audio";
NSString *argStr = [NSString stringWithFormat:@"query{%@}", api];
SafeSleepRequestModel * requestModel = [[SafeSleepRequestModel alloc] init];
return [self httpPostBodyRequestWithAPI:api params:@{@"query" : argStr} view:nil hasNetActivity:YES loadingInfo:nil hasFailInfo:YES success:^(NSDictionary *apiDic) {
requestModel.resCode = DSResCodeSuccess;
DSLog(@"睡眠-放松训练-即刻放松音频接口dataDic:%@", apiDic);
completion(requestModel);
} failure:^(id failure) {
requestModel.resCode = DSResCodeNetFail;
requestModel.errorInfo = failure;
completion(requestModel);
}];
}
+ (NSURLSessionDataTask *)getCourseListDataWithSubID:(int)subID isHome:(BOOL)isHome completion:(void (^)(SafeSleepRequestModel *requestModel))completion { + (NSURLSessionDataTask *)getCourseListDataWithSubID:(int)subID isHome:(BOOL)isHome completion:(void (^)(SafeSleepRequestModel *requestModel))completion {
NSString *api = @"query_relax_meditation_type"; NSString *api = @"query_relax_meditation_type";
NSString *argStr = [NSString stringWithFormat:@"query{%@(sub_id:%d,is_home:%@)}", api, subID, isHome ? @"true" : @"false"]; NSString *argStr = [NSString stringWithFormat:@"query{%@(sub_id:%d,is_home:%@)}", api, subID, isHome ? @"true" : @"false"];
......
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!