Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes + design tweaks #556

Merged
merged 8 commits into from
Apr 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion SenseWidget/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.0.9</string>
<string>1.4.0.10</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
Expand Down
74 changes: 37 additions & 37 deletions SleepModel/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion SleepModel/HEMAlarmListViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 7 additions & 3 deletions SleepModel/HEMAlarmListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#import "HEMNoAlarmCell.h"
#import "HEMActivityIndicatorView.h"
#import "HEMBaseController+Protected.h"
#import "HEMSubNavigationView.h"

NS_ENUM(NSUInteger) {
LoadingStateRowCount = 0,
Expand Down Expand Up @@ -166,8 +167,8 @@ - (void)reloadData {
if ([self.alarms isEqualToArray:cachedAlarms]) {
if ([self isLoading]) {
self.loading = NO;
[self.collectionView reloadData];
}
[self.collectionView reloadData];
return;
}

Expand Down Expand Up @@ -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];
}
}

Expand Down
7 changes: 5 additions & 2 deletions SleepModel/HEMSleepSoundPlayerPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ - (void)loadData {

[self setLoading:YES];
[self setPlayerState:HEMSleepSoundPlayerStateWaiting];
[[self collectionView] reloadData];

dispatch_group_t dataGroup = dispatch_group_create();

Expand All @@ -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];
});
}

Expand All @@ -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];
Expand Down
2 changes: 2 additions & 0 deletions SleepModel/HEMSleepSoundViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions SleepModel/HEMSleepSoundViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#import "HEMSleepSoundDurationsPresenter.h"
#import "HEMSleepSoundVolumePresenter.h"
#import "HEMAudioService.h"
#import "HEMSubNavigationView.h"

@interface HEMSleepSoundViewController () <HEMSleepSoundPlayerDelegate, HEMListDelegate>

Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion SleepModel/HEMSoundsContainerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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];
}

Expand Down
11 changes: 9 additions & 2 deletions SleepModel/HEMSoundsContentPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions SleepModel/HEMSubNavigationView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion SleepModel/Sense-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.0.9</string>
<string>1.4.0.10</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down