diff --git a/CHANGELOG.md b/CHANGELOG.md index f268646e..84200bfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 1.4.0.10 + +New: + +* Alarm tab icon is now a generic sounds icon +* Sleep sounds player now shows an animated playing state +* Sleep sound options that have changed will now stick / saved + reloaded + +Fixes: + +* Sounds tab will now update within same session if sleep sounds is feature flipped on +* Prevent sounds sub nav tabs from being activated simulatenously, causing both UI to load +* Saving alarms will now properly refresh the view +* No connect / error state in sleep sounds will properly be displayed + ## 1.4.0.9 New: diff --git a/SenseWidget/Info.plist b/SenseWidget/Info.plist index ab136697..4868b4a2 100644 --- a/SenseWidget/Info.plist +++ b/SenseWidget/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1.4.0.9 + 1.4.0.10 NSExtension NSExtensionMainStoryboard diff --git a/SleepModel/Base.lproj/Main.storyboard b/SleepModel/Base.lproj/Main.storyboard index 157dfb36..8a016804 100644 --- a/SleepModel/Base.lproj/Main.storyboard +++ b/SleepModel/Base.lproj/Main.storyboard @@ -2654,7 +2654,7 @@ - + @@ -3934,66 +3934,66 @@ - + - + - + - + - + - + - + - - + + - + - + - + @@ -4072,36 +4072,36 @@ - + - + - + @@ -4131,7 +4131,7 @@ - + @@ -4195,7 +4195,7 @@ - + @@ -4222,7 +4222,7 @@ - + @@ -5003,6 +5003,14 @@ + @@ -5012,7 +5020,7 @@ - + @@ -5062,7 +5070,7 @@ - + @@ -5091,7 +5099,7 @@ - + @@ -5106,16 +5114,8 @@ - - + diff --git a/SleepModel/HEMAlarmListViewController.h b/SleepModel/HEMAlarmListViewController.h index 56d96636..67bf32fc 100644 --- a/SleepModel/HEMAlarmListViewController.h +++ b/SleepModel/HEMAlarmListViewController.h @@ -3,10 +3,11 @@ #import "HEMBaseController.h" @class HEMDeviceService; +@class HEMSubNavigationView; @interface HEMAlarmListViewController : HEMBaseController -@property (nonatomic, assign) BOOL hasSubNav; +@property (nonatomic, weak) HEMSubNavigationView* subNav; @property (nonatomic, strong) HEMDeviceService* deviceService; - (IBAction)addNewAlarm:(id)sender; diff --git a/SleepModel/HEMAlarmListViewController.m b/SleepModel/HEMAlarmListViewController.m index d19bba86..7e18b9eb 100644 --- a/SleepModel/HEMAlarmListViewController.m +++ b/SleepModel/HEMAlarmListViewController.m @@ -22,6 +22,7 @@ #import "HEMNoAlarmCell.h" #import "HEMActivityIndicatorView.h" #import "HEMBaseController+Protected.h" +#import "HEMSubNavigationView.h" NS_ENUM(NSUInteger) { LoadingStateRowCount = 0, @@ -166,8 +167,8 @@ - (void)reloadData { if ([self.alarms isEqualToArray:cachedAlarms]) { if ([self isLoading]) { self.loading = NO; - [self.collectionView reloadData]; } + [self.collectionView reloadData]; return; } @@ -471,8 +472,11 @@ - (CGSize)collectionView:(UICollectionView *)collectionView } - (void)scrollViewDidScroll:(UIScrollView *)scrollView { - if (![self hasSubNav]) { - [[self shadowView] updateVisibilityWithContentOffset:[scrollView contentOffset].y]; + CGFloat yOffset = [scrollView contentOffset].y; + if (![[self subNav] hasControls]) { + [[self shadowView] updateVisibilityWithContentOffset:yOffset]; + } else { + [[[self subNav] shadowView] updateVisibilityWithContentOffset:yOffset]; } } diff --git a/SleepModel/HEMSleepSoundPlayerPresenter.m b/SleepModel/HEMSleepSoundPlayerPresenter.m index bc0ed707..7deb759b 100644 --- a/SleepModel/HEMSleepSoundPlayerPresenter.m +++ b/SleepModel/HEMSleepSoundPlayerPresenter.m @@ -193,6 +193,7 @@ - (void)loadData { [self setLoading:YES]; [self setPlayerState:HEMSleepSoundPlayerStateWaiting]; + [[self collectionView] reloadData]; dispatch_group_t dataGroup = dispatch_group_create(); @@ -211,8 +212,8 @@ - (void)loadData { __strong typeof(weakSelf) strongSelf = weakSelf; [strongSelf setLoading:NO]; [strongSelf configurePlayerStateFromStatus:[[strongSelf soundState] status]]; - [[strongSelf collectionView] reloadData]; [strongSelf startMonitoring]; + [[strongSelf collectionView] reloadData]; }); } @@ -225,7 +226,9 @@ - (void)loadState:(void(^)(void))completion { } - (void)configurePlayerStateFromStatus:(SENSleepSoundStatus*)status { - if ([self isSenseOffline]) { + if (!status) { + [self setPlayerState:HEMSleepSoundPlayerStateError]; + } else if ([self isSenseOffline]) { [self reloadDataWithPlayerState:HEMSleepSoundPlayerStateSenseOffline]; } else if (![[self service] isEnabled:[self soundState]]) { [self reloadDataWithPlayerState:HEMSleepSoundPlayerStatePrereqNotMet]; diff --git a/SleepModel/HEMSleepSoundViewController.h b/SleepModel/HEMSleepSoundViewController.h index 4e33d85c..f6ecbaa3 100644 --- a/SleepModel/HEMSleepSoundViewController.h +++ b/SleepModel/HEMSleepSoundViewController.h @@ -11,10 +11,12 @@ @class SENSleepSounds; @class HEMDeviceService; +@class HEMSubNavigationView; @interface HEMSleepSoundViewController : HEMBaseController @property (nonatomic, assign, getter=isCancellable) BOOL cancellable; @property (nonatomic, strong) HEMDeviceService* deviceService; +@property (nonatomic, weak) HEMSubNavigationView* subNav; @end diff --git a/SleepModel/HEMSleepSoundViewController.m b/SleepModel/HEMSleepSoundViewController.m index 2e92cf4b..1c9b6b32 100644 --- a/SleepModel/HEMSleepSoundViewController.m +++ b/SleepModel/HEMSleepSoundViewController.m @@ -18,6 +18,7 @@ #import "HEMSleepSoundDurationsPresenter.h" #import "HEMSleepSoundVolumePresenter.h" #import "HEMAudioService.h" +#import "HEMSubNavigationView.h" @interface HEMSleepSoundViewController () @@ -61,6 +62,9 @@ - (void)viewWillAppear:(BOOL)animated { action:@selector(dismiss)]; [[self navigationItem] setLeftBarButtonItem:cancelItem]; } + if ([[self subNav] hasControls]) { + [[self playerPresenter] bindWithShadowView:[[self subNav] shadowView]]; + } } #pragma mark - Actions diff --git a/SleepModel/HEMSoundsContainerViewController.m b/SleepModel/HEMSoundsContainerViewController.m index e18ab5b6..b831ec30 100644 --- a/SleepModel/HEMSoundsContainerViewController.m +++ b/SleepModel/HEMSoundsContainerViewController.m @@ -105,12 +105,16 @@ - (void)pairWithSenseFrom:(HEMSoundsContentPresenter*)presenter { [self presentViewController:nav animated:YES completion:nil]; } -- (void)loadAlarmsFrom:(__unused HEMSoundsContentPresenter *)presenter thenLaunchNewAlarm:(BOOL)showNewAlarm { +- (void)loadAlarmsFrom:(__unused HEMSoundsContentPresenter *)presenter + thenLaunchNewAlarm:(BOOL)showNewAlarm { DDLogVerbose(@"show alarms view"); if (![self alarmVC]) { HEMAlarmListViewController* alarmVC = [HEMMainStoryboard instantiateAlarmListViewController]; [self setAlarmVC:alarmVC]; } + + [[self alarmVC] setSubNav:[self subNav]]; + [self showSoundViewOf:[self alarmVC] completion:^{ if (showNewAlarm) { [[self alarmVC] addNewAlarm:nil]; @@ -122,6 +126,7 @@ - (void)loadSleepSounds:(__unused SENSleepSounds *)sleepSounds from:(__unused HE DDLogVerbose(@"show sleep sounds view"); HEMSleepSoundViewController* soundVC = [HEMMainStoryboard instantiateSleepSoundViewController]; [soundVC setDeviceService:[self deviceService]]; + [soundVC setSubNav:[self subNav]]; [self showSoundViewOf:soundVC completion:nil]; } diff --git a/SleepModel/HEMSoundsContentPresenter.m b/SleepModel/HEMSoundsContentPresenter.m index 955bc9e5..8c7f6b69 100644 --- a/SleepModel/HEMSoundsContentPresenter.m +++ b/SleepModel/HEMSoundsContentPresenter.m @@ -110,18 +110,24 @@ - (void)listenForDeviceChanges { object:nil]; } +- (BOOL)shouldReload { + return [self deviceError] + || ![[[self deviceService] devices] hasPairedSense] + || ![self availableSleepSounds]; +} + #pragma mark - Presenter events - (void)didAppear { [super didAppear]; - if ([self deviceError] || ![[[self deviceService] devices] hasPairedSense]) { + if ([self shouldReload]) { [self reload]; } } - (void)didComeBackFromBackground { [super didComeBackFromBackground]; - if ([self deviceError] || ![[[self deviceService] devices] hasPairedSense]) { + if ([self shouldReload]) { [self reload]; } } @@ -276,6 +282,7 @@ - (void)reload { - (void)displayDeviceError { if (![[self subNav] hasControls]) { + [[self delegate] unloadContentControllersFrom:self]; [[self errorCollectionView] setHidden:NO]; [[self errorCollectionView] setDelegate:self]; [[self errorCollectionView] setDataSource:self]; diff --git a/SleepModel/HEMSubNavigationView.m b/SleepModel/HEMSubNavigationView.m index 87a0f2c2..04aaf772 100644 --- a/SleepModel/HEMSubNavigationView.m +++ b/SleepModel/HEMSubNavigationView.m @@ -105,6 +105,7 @@ - (void)reset { - (void)addControl:(UIControl*)control { id existingControl = [self viewWithTag:[control tag]]; if (!existingControl) { + [control setExclusiveTouch:YES]; [control addTarget:self action:@selector(select:) forControlEvents:UIControlEventTouchUpInside]; [self setControlCount:[self controlCount] + 1]; [self addSubview:control]; diff --git a/SleepModel/Sense-Info.plist b/SleepModel/Sense-Info.plist index 9888ae11..7a6a1674 100644 --- a/SleepModel/Sense-Info.plist +++ b/SleepModel/Sense-Info.plist @@ -34,7 +34,7 @@ CFBundleVersion - 1.4.0.9 + 1.4.0.10 LSRequiresIPhoneOS NSAppTransportSecurity