Commit 4436c8ba cgx

修复选择完成白噪音之后并开始播放,切换到其他栏目就会被强制终止bug

1 个父辈 bfdcabe8
...@@ -31,6 +31,8 @@ FOUNDATION_EXTERN NSString * const WXLoginAuthNoti; ...@@ -31,6 +31,8 @@ FOUNDATION_EXTERN NSString * const WXLoginAuthNoti;
FOUNDATION_EXTERN NSString * const HasUpdateUserDataNoti; FOUNDATION_EXTERN NSString * const HasUpdateUserDataNoti;
// 刷新主页通知 // 刷新主页通知
FOUNDATION_EXTERN NSString * const NeedUpdateHomePage; FOUNDATION_EXTERN NSString * const NeedUpdateHomePage;
// 需要暂停所有白噪音播放
FOUNDATION_EXTERN NSString * const NeedPauseAllNoise;
// 首页白噪音播放列表变化通知 // 首页白噪音播放列表变化通知
FOUNDATION_EXTERN NSString * const NoisePlaylistHasChange; FOUNDATION_EXTERN NSString * const NoisePlaylistHasChange;
// 首页白噪音定时器被点击通知 // 首页白噪音定时器被点击通知
......
...@@ -22,6 +22,7 @@ NSString * const ExpireTime2 = @"06:00:00"; ...@@ -22,6 +22,7 @@ NSString * const ExpireTime2 = @"06:00:00";
NSString * const WXLoginAuthNoti = @"wxLoginAuthNoti"; NSString * const WXLoginAuthNoti = @"wxLoginAuthNoti";
NSString * const HasUpdateUserDataNoti = @"hasUpdateUserDataNoti"; NSString * const HasUpdateUserDataNoti = @"hasUpdateUserDataNoti";
NSString * const NeedUpdateHomePage = @"NeedUpdateHomePageNoti"; NSString * const NeedUpdateHomePage = @"NeedUpdateHomePageNoti";
NSString * const NeedPauseAllNoise = @"NeedPauseAllNoiseNoti";
NSString * const NoisePlaylistHasChange = @"NoisePlaylistHasChangeNoti"; NSString * const NoisePlaylistHasChange = @"NoisePlaylistHasChangeNoti";
NSString * const NoiseTimingDidClick = @"NoiseTimingDidClickNoti"; NSString * const NoiseTimingDidClick = @"NoiseTimingDidClickNoti";
NSString * const ExitCoaxSleep = @"ExitCoaxSleepNoti"; NSString * const ExitCoaxSleep = @"ExitCoaxSleepNoti";
......
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
} }
}]; }];
[[NSNotificationCenter defaultCenter] postNotificationName:NeedPauseAllNoise object:nil];
[DataStatisticsUtil event:RelaxTrain attributes:@{@"data":@"腹式放松法页面"}]; [DataStatisticsUtil event:RelaxTrain attributes:@{@"data":@"腹式放松法页面"}];
} }
......
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
// 监听息屏页面点击播放、上一首、下一首点击通知,用于更新当前播放列表正在播放的音频UI状态 // 监听息屏页面点击播放、上一首、下一首点击通知,用于更新当前播放列表正在播放的音频UI状态
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateListNoti:) name:RemoteCommandCenterDidClick object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateListNoti:) name:RemoteCommandCenterDidClick object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:NeedPauseAllNoise object:nil];
NSString *eventID = self.courseType == CourseTypeSafe ? Meditation_Click : Relax_Music_Click; NSString *eventID = self.courseType == CourseTypeSafe ? Meditation_Click : Relax_Music_Click;
NSString *entranceName = self.courseType == CourseTypeSafe ? @"首页-舒眠课程" : @"首页-助眠音乐"; NSString *entranceName = self.courseType == CourseTypeSafe ? @"首页-舒眠课程" : @"首页-助眠音乐";
if (self.entrance == EntranceCourseList) { if (self.entrance == EntranceCourseList) {
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
[self.view addSubview:self.headView]; [self.view addSubview:self.headView];
[self.view addSubview:self.bodyView]; [self.view addSubview:self.bodyView];
[[NSNotificationCenter defaultCenter] postNotificationName:NeedPauseAllNoise object:nil];
} }
#pragma mark - 品牌模式 #pragma mark - 品牌模式
......
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
// 监听主页需要刷新数据通知 // 监听主页需要刷新数据通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needUpdate) name:NeedUpdateHomePage object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needUpdate) name:NeedUpdateHomePage object:nil];
// 监听需要暂停所有白噪音
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseAllNoise) name:NeedPauseAllNoise object:nil];
} }
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
...@@ -89,14 +91,13 @@ ...@@ -89,14 +91,13 @@
[self.homeTV.headerView controllerWillDisAppear]; [self.homeTV.headerView controllerWillDisAppear];
} }
- (void)viewDidDisappear:(BOOL)animated { - (void)pauseAllNoise {
[super viewDidDisappear:animated];
[[NoisePlayerManager sharedNoisePlayerManager] pauseAll]; [[NoisePlayerManager sharedNoisePlayerManager] pauseAll];
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:NeedUpdateHomePage object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:NeedUpdateHomePage object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NeedPauseAllNoise object:nil];
} }
#pragma mark - 先放大,再缩小 #pragma mark - 先放大,再缩小
......
...@@ -194,6 +194,8 @@ ...@@ -194,6 +194,8 @@
// 跳转到登录页面 // 跳转到登录页面
[LoginUtils jumpToLoginControllerWithTarget:self.ds_viewController]; [LoginUtils jumpToLoginControllerWithTarget:self.ds_viewController];
} }
[[NSNotificationCenter defaultCenter] postNotificationName:NeedPauseAllNoise object:nil];
} }
@end @end
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!