Commit f0a5dfcc cgx

调整接口、修复unity没有声音bug(系统坑)

1 个父辈 9241fef3
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
D051032F282A4E9200560A0D /* fse.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = D051032D282A4E9200560A0D /* fse.mp3 */; }; D051032F282A4E9200560A0D /* fse.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = D051032D282A4E9200560A0D /* fse.mp3 */; };
D0534F092835D90400F8892E /* DSNaviBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0534F082835D90400F8892E /* DSNaviBarViewController.m */; }; D0534F092835D90400F8892E /* DSNaviBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0534F082835D90400F8892E /* DSNaviBarViewController.m */; };
D053BEE9280F9E310028CCFC /* CloseAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D053BEE8280F9E310028CCFC /* CloseAlertView.m */; }; D053BEE9280F9E310028CCFC /* CloseAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D053BEE8280F9E310028CCFC /* CloseAlertView.m */; };
D05416F7288A57BD0035060B /* AVAudioSession+SXAudioSession.m in Sources */ = {isa = PBXBuildFile; fileRef = D05416F6288A57BD0035060B /* AVAudioSession+SXAudioSession.m */; };
D054CCB52830DE5600420DC4 /* NoisePlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D054CCB42830DE5600420DC4 /* NoisePlayerManager.m */; }; D054CCB52830DE5600420DC4 /* NoisePlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D054CCB42830DE5600420DC4 /* NoisePlayerManager.m */; };
D054CCB82830E3AC00420DC4 /* NoisePlayItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D054CCB72830E3AC00420DC4 /* NoisePlayItem.m */; }; D054CCB82830E3AC00420DC4 /* NoisePlayItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D054CCB72830E3AC00420DC4 /* NoisePlayItem.m */; };
D055BEB928250D3400BC11A4 /* CourseCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEB828250D3400BC11A4 /* CourseCollectionCell.m */; }; D055BEB928250D3400BC11A4 /* CourseCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D055BEB828250D3400BC11A4 /* CourseCollectionCell.m */; };
...@@ -421,6 +422,8 @@ ...@@ -421,6 +422,8 @@
D0534F082835D90400F8892E /* DSNaviBarViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSNaviBarViewController.m; sourceTree = "<group>"; }; D0534F082835D90400F8892E /* DSNaviBarViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSNaviBarViewController.m; 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>"; };
D05416F5288A57BD0035060B /* AVAudioSession+SXAudioSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AVAudioSession+SXAudioSession.h"; sourceTree = "<group>"; };
D05416F6288A57BD0035060B /* AVAudioSession+SXAudioSession.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AVAudioSession+SXAudioSession.m"; sourceTree = "<group>"; };
D054CCB32830DE5600420DC4 /* NoisePlayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NoisePlayerManager.h; sourceTree = "<group>"; }; D054CCB32830DE5600420DC4 /* NoisePlayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NoisePlayerManager.h; sourceTree = "<group>"; };
D054CCB42830DE5600420DC4 /* NoisePlayerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NoisePlayerManager.m; sourceTree = "<group>"; }; D054CCB42830DE5600420DC4 /* NoisePlayerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NoisePlayerManager.m; sourceTree = "<group>"; };
D054CCB62830E3AC00420DC4 /* NoisePlayItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NoisePlayItem.h; sourceTree = "<group>"; }; D054CCB62830E3AC00420DC4 /* NoisePlayItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NoisePlayItem.h; sourceTree = "<group>"; };
...@@ -1105,6 +1108,8 @@ ...@@ -1105,6 +1108,8 @@
D09BF336280E605900E5F06C /* NSObject+Extras.m */, D09BF336280E605900E5F06C /* NSObject+Extras.m */,
D0A245F4283DB12100FB49AA /* WKWebView+Extras.h */, D0A245F4283DB12100FB49AA /* WKWebView+Extras.h */,
D0A245F5283DB12100FB49AA /* WKWebView+Extras.m */, D0A245F5283DB12100FB49AA /* WKWebView+Extras.m */,
D05416F5288A57BD0035060B /* AVAudioSession+SXAudioSession.h */,
D05416F6288A57BD0035060B /* AVAudioSession+SXAudioSession.m */,
); );
path = Category; path = Category;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2415,6 +2420,7 @@ ...@@ -2415,6 +2420,7 @@
D0FAC41D281B817D00D4B859 /* GKPhotoBrowser.m in Sources */, D0FAC41D281B817D00D4B859 /* GKPhotoBrowser.m in Sources */,
D024CE89287D59FF00FB4320 /* SRMusicView.m in Sources */, D024CE89287D59FF00FB4320 /* SRMusicView.m in Sources */,
D07A4B2A280EA6B600BA0EC0 /* UserInfoTableView.m in Sources */, D07A4B2A280EA6B600BA0EC0 /* UserInfoTableView.m in Sources */,
D05416F7288A57BD0035060B /* AVAudioSession+SXAudioSession.m in Sources */,
D0930F122801124E006B497A /* BaseNaviController.m in Sources */, D0930F122801124E006B497A /* BaseNaviController.m in Sources */,
D0878F4F280C087E005F1B7F /* LoginController.m in Sources */, D0878F4F280C087E005F1B7F /* LoginController.m in Sources */,
D07A657D28158A1900C15AF6 /* DsWebController.m in Sources */, D07A657D28158A1900C15AF6 /* DsWebController.m in Sources */,
...@@ -2605,7 +2611,7 @@ ...@@ -2605,7 +2611,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements; CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 6; CURRENT_PROJECT_VERSION = 7;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW; DEVELOPMENT_TEAM = 4NDZ6UX8PW;
...@@ -2687,7 +2693,7 @@ ...@@ -2687,7 +2693,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 = 6; CURRENT_PROJECT_VERSION = 7;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW; DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
...@@ -2828,7 +2834,7 @@ ...@@ -2828,7 +2834,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 = 6; CURRENT_PROJECT_VERSION = 7;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW; DEVELOPMENT_TEAM = 4NDZ6UX8PW;
......
//
// AVAudioSession+SXAudioSession.h
// DreamSleep
//
// Created by peter on 2022/7/22.
//
#import <AVFAudio/AVFAudio.h>
NS_ASSUME_NONNULL_BEGIN
@interface AVAudioSession (SXAudioSession)
@end
NS_ASSUME_NONNULL_END
//
// AVAudioSession+SXAudioSession.m
// DreamSleep
//
// Created by peter on 2022/7/22.
//
#import "AVAudioSession+SXAudioSession.h"
@implementation AVAudioSession (SXAudioSession)
/*
解决以下报错,导致unity游戏没有声音
-[AVAudioSession setActive:withOptions:error:]:
Deactivating an audio session that has running I/O.
All I/O should be stopped or paused prior to deactivating the audio session.
*/
- (BOOL)setActive:(BOOL)active withOptions:(AVAudioSessionSetActiveOptions)options error:(NSError * _Nullable __autoreleasing *)outError {
return YES;
}
@end
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#import "SleepReadyController.h" #import "SleepReadyController.h"
#import "ReadyListController.h" #import "ReadyListController.h"
@interface AISleepCoachController () <WKNavigationDelegate, WKScriptMessageHandler, DsWebControllerDelegate, RelaxTrainControllerDelegate> @interface AISleepCoachController () <WKNavigationDelegate, WKScriptMessageHandler, DsWebControllerDelegate>
@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;
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
[self.aiWebView loadRequest:self.request]; [self.aiWebView loadRequest:self.request];
} }
#pragma mark - DsWebControllerDelegate && RelaxTrainControllerDelegate && SleepReadyControllerDelegate #pragma mark - DsWebControllerDelegate && SleepReadyControllerDelegate
- (void)reloadAIPage { - (void)reloadAIPage {
[self.aiWebView reload]; [self.aiWebView reload];
} }
...@@ -213,7 +213,6 @@ ...@@ -213,7 +213,6 @@
case 5: // 练习腹式呼吸法 case 5: // 练习腹式呼吸法
{ {
RelaxTrainController *relaxVC = [RelaxTrainController new]; RelaxTrainController *relaxVC = [RelaxTrainController new];
relaxVC.refreshDelegate = self;
relaxVC.params = bodyDic; relaxVC.params = bodyDic;
[self.navigationController pushViewController:relaxVC animated:YES]; [self.navigationController pushViewController:relaxVC animated:YES];
} }
......
...@@ -10,14 +10,8 @@ ...@@ -10,14 +10,8 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol RelaxTrainControllerDelegate <NSObject>
/// 刷新AI睡眠教练页面
- (void)reloadAIPage;
@end
/// 放松训练、腹式呼吸法页面 /// 放松训练、腹式呼吸法页面
@interface RelaxTrainController : DSBaseViewController @interface RelaxTrainController : DSBaseViewController
@property (nonatomic, weak) id<RelaxTrainControllerDelegate> refreshDelegate;
/// title和step参数 /// title和step参数
@property (nonatomic, strong) NSDictionary *params; @property (nonatomic, strong) NSDictionary *params;
/// 安睡准备完成后传递过来的数据 /// 安睡准备完成后传递过来的数据
......
...@@ -90,12 +90,26 @@ ...@@ -90,12 +90,26 @@
#pragma mark - Actions #pragma mark - Actions
- (void)backAction { - (void)backAction {
[super backAction]; // 安睡准备进来的、点击开始播放、没有完成播放点击返回
[self.bodyView stopAudio]; if (self.bodyView.isSleepReady == YES && self.bodyView.isStartPlay == YES && self.bodyView.isShowScoreAlert == NO) {
if (self.refreshDelegate && [self.refreshDelegate respondsToSelector:@selector(reloadAIPage)]) { [DSProgressHUD showProgressHUDWithInfo:@""];
[self.refreshDelegate reloadAIPage]; [RelaxTrainRequestModel userCurTaskStateWithParams:self.params isReady:NO completion:^(RelaxTrainRequestModel * _Nonnull requestModel) {
[DSProgressHUD dissmissProgressHUD];
if (requestModel.resCode == DSResCodeSuccess) {
// 停止播放
[self.bodyView stopAudio];
// 刷新AI睡眠教练
[[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateAICoach object:nil];
[super backAction];
}
}];
} else {
// 停止播放
[self.bodyView stopAudio];
// 刷新AI睡眠教练
[[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateAICoach object:nil];
[super backAction];
} }
[self.navigationController popViewControllerAnimated:YES];
} }
#pragma mark - RelaxBodyViewDelegate #pragma mark - RelaxBodyViewDelegate
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "RelaxTrainModel.h" #import "RelaxTrainModel.h"
#import "RelaxTrainRequestModel.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
...@@ -29,6 +30,11 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -29,6 +30,11 @@ NS_ASSUME_NONNULL_BEGIN
/// 是否是安睡准备跳转过来的标识 /// 是否是安睡准备跳转过来的标识
@property (nonatomic, assign) BOOL isSleepReady; @property (nonatomic, assign) BOOL isSleepReady;
/// 用于标识是否开始播放
@property (nonatomic, assign) BOOL isStartPlay;
/// 用于标识是否完成播放
@property (nonatomic, assign) BOOL isShowScoreAlert;
/// 页面退出时停止音频播放 /// 页面退出时停止音频播放
- (void)stopAudio; - (void)stopAudio;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#import "RelaxTrainModel.h" #import "RelaxTrainModel.h"
#import <FSAudioController.h> #import <FSAudioController.h>
#import "RelaxTrainCell.h" #import "RelaxTrainCell.h"
#import "RelaxTrainRequestModel.h"
#import "DSSlider.h" #import "DSSlider.h"
@interface RelaxBodyView () <UIGestureRecognizerDelegate, UICollectionViewDelegate, UICollectionViewDataSource> @interface RelaxBodyView () <UIGestureRecognizerDelegate, UICollectionViewDelegate, UICollectionViewDataSource>
...@@ -28,7 +27,6 @@ ...@@ -28,7 +27,6 @@
@property (nonatomic, strong) NSArray *relaxList; @property (nonatomic, strong) NSArray *relaxList;
@property (nonatomic, assign) NSInteger curIndex; @property (nonatomic, assign) NSInteger curIndex;
@property (nonatomic, assign) BOOL isUpdateTask; @property (nonatomic, assign) BOOL isUpdateTask;
@property (nonatomic, assign) BOOL isShowScoreAlert;
@end @end
@implementation RelaxBodyView { @implementation RelaxBodyView {
...@@ -335,15 +333,18 @@ ...@@ -335,15 +333,18 @@
case kFsAudioStreamPlaying: case kFsAudioStreamPlaying:
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO; [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
DSLog(@"播放ing..."); DSLog(@"播放ing...");
weakSelf.isStartPlay = YES;
// 更新腹式呼吸放松法任务状态 // AI睡眠教练每日计划进来的:更新腹式呼吸放松法任务状态
@synchronized (weakSelf) { if (weakSelf.isSleepReady == NO) {
if (weakSelf.isUpdateTask == NO) { @synchronized (weakSelf) {
[RelaxTrainRequestModel userCurTaskStateWithParams:weakSelf.updateParams isReady:weakSelf.isSleepReady completion:^(RelaxTrainRequestModel * _Nonnull requestModel) { if (weakSelf.isUpdateTask == NO) {
if (requestModel.resCode == DSResCodeSuccess) { [RelaxTrainRequestModel userCurTaskStateWithParams:weakSelf.updateParams isReady:NO completion:^(RelaxTrainRequestModel * _Nonnull requestModel) {
weakSelf.isUpdateTask = YES; if (requestModel.resCode == DSResCodeSuccess) {
} weakSelf.isUpdateTask = YES;
}]; }
}];
}
} }
} }
...@@ -357,10 +358,15 @@ ...@@ -357,10 +358,15 @@
// 回调只弹1次从安睡准备进来任务完成弹框 // 回调只弹1次从安睡准备进来任务完成弹框
if (weakSelf.isSleepReady) { if (weakSelf.isSleepReady) {
if (weakSelf.isShowScoreAlert == NO) { if (weakSelf.isShowScoreAlert == NO) {
weakSelf.isShowScoreAlert = YES; // 更新任务状态
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(showScoreAlertView)]) { [RelaxTrainRequestModel userCurTaskStateWithParams:weakSelf.updateParams isReady:YES completion:^(RelaxTrainRequestModel * _Nonnull requestModel) {
[weakSelf.delegate showScoreAlertView]; if (requestModel.resCode == DSResCodeSuccess) {
} weakSelf.isShowScoreAlert = YES;
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(showScoreAlertView)]) {
[weakSelf.delegate showScoreAlertView];
}
}
}];
} }
} }
break; break;
......
...@@ -57,7 +57,8 @@ ...@@ -57,7 +57,8 @@
[_dialplateIV dk_setImagePicker:DKImagePickerWithNames(@"pic_zhunbei_biaopan", @"dk_pic_zhunbei_biaopan", @"pic_zhunbei_biaopan")]; [_dialplateIV dk_setImagePicker:DKImagePickerWithNames(@"pic_zhunbei_biaopan", @"dk_pic_zhunbei_biaopan", @"pic_zhunbei_biaopan")];
[self addSubview:_dialplateIV]; [self addSubview:_dialplateIV];
_percentLabel = [[UILabel alloc] initWithFrame:self.bounds]; _percentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 160, 60)];
_percentLabel.center = _dialplateIV.center;
_percentLabel.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite); _percentLabel.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, DkTitleColor, DSWhite);
_percentLabel.textAlignment = NSTextAlignmentCenter; _percentLabel.textAlignment = NSTextAlignmentCenter;
_percentLabel.font = BoldFont(34.0); _percentLabel.font = BoldFont(34.0);
......
...@@ -86,12 +86,6 @@ ...@@ -86,12 +86,6 @@
[self.audioListView reloadData]; [self.audioListView reloadData];
} }
#pragma mark - Actions
- (void)backAction {
[super backAction];
[self.navigationController popViewControllerAnimated:YES];
}
- (void)unlockAction { - (void)unlockAction {
// 开始第一节 // 开始第一节
if ([LoginUtils getUserLoginData]) { if ([LoginUtils getUserLoginData]) {
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
} }
- (void)backAction { - (void)backAction {
if (self.navigationController.viewControllers.count > 0) {
[self.navigationController popViewControllerAnimated:YES];
}
} }
- (void)setIsNeedUpdateStatusBarStyle:(BOOL)isNeedUpdateStatusBarStyle { - (void)setIsNeedUpdateStatusBarStyle:(BOOL)isNeedUpdateStatusBarStyle {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!