Skip to content

Commit

Permalink
Merge pull request #623 from hello/jimmy/4s
Browse files Browse the repository at this point in the history
Fixes the DFU UI for 4s (tiny little devices)
  • Loading branch information
jimmymlu authored Jul 13, 2016
2 parents 9aea684 + e802794 commit c0214b8
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 5 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 1.5.0.5

New:

* Pill card in device settings supports firmware vers. and firmware update

Fixes:

* BLE operations no longer fail after successful DFU
* Fix the DFU UI for the 4s

## 1.5.0.4

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.5.0.4</string>
<string>1.5.0.5</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
Expand Down
1 change: 1 addition & 0 deletions SleepModel/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,7 @@
<outlet property="illustrationImageView" destination="5uT-BC-XAm" id="HSr-Ja-gxC"/>
<outlet property="progressView" destination="ST5-FI-gDl" id="Np1-BA-khc"/>
<outlet property="statusLabel" destination="kIU-nQ-75k" id="apK-CU-25q"/>
<outlet property="statusLabelBottomConstraint" destination="MUU-uJ-c1I" id="aIa-EA-vpr"/>
<outlet property="titleLabel" destination="iKf-lG-EBv" id="K7T-WT-ttj"/>
<segue destination="Anl-Dh-kQO" kind="show" identifier="scan" id="dke-JQ-E1a"/>
</connections>
Expand Down
4 changes: 3 additions & 1 deletion SleepModel/HEMPillDfuPresenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithDeviceService:(HEMDeviceService*)deviceService;
- (void)bindWithTitleLabel:(UILabel*)titleLabel descriptionLabel:(UILabel*)descriptionLabel;
- (void)bindWithActionButton:(UIButton*)actionButton;
- (void)bindWithProgressView:(UIProgressView*)progressView statusLabel:(UILabel*)statusLabel;
- (void)bindWithProgressView:(UIProgressView*)progressView
statusLabel:(UILabel*)statusLabel
statusBottomConstraint:(NSLayoutConstraint*)bottomConstraint;
- (void)bindWithCancelButton:(UIButton*)cancelButton;
- (void)bindWithHelpButton:(UIButton*)helpButton;
- (void)bindWithIllustrationView:(UIImageView*)illustrationView
Expand Down
13 changes: 12 additions & 1 deletion SleepModel/HEMPillDfuPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ typedef NS_ENUM(NSInteger, HEMPillDfuErrorCode) {

static NSString* const HEMPillDfuErrorDomain = @"is.hello.app.pill.dfu";
static NSInteger const HEMPillDfuBLECheckAttempts = 10;

static CGFloat const HEMPillDfuSuccessDelay = 2.0f;
static CGFloat const HEMPillDfuWaveAnimeDuration = 2.0f;
static CGFloat const HEMPIllDfuStatus4sBottomMargin = 10.0f;

@interface HEMPillDfuPresenter()

Expand All @@ -39,6 +41,7 @@ @interface HEMPillDfuPresenter()
@property (nonatomic, weak) UIButton* helpButton;
@property (nonatomic, weak) UIProgressView* progressView;
@property (nonatomic, weak) UIImageView* illustrationView;
@property (nonatomic, weak) NSLayoutConstraint* statusBottomConstraint;
@property (nonatomic, strong) CALayer* waveLayer;
@property (nonatomic, strong) CALayer* illustrationBgLayer;
@property (nonatomic, assign, getter=isUpdating) BOOL updating;
Expand Down Expand Up @@ -92,15 +95,23 @@ - (void)bindWithIllustrationView:(UIImageView*)illustrationView
[self setIllustrationView:illustrationView];
}

- (void)bindWithProgressView:(UIProgressView*)progressView statusLabel:(UILabel*)statusLabel {
- (void)bindWithProgressView:(UIProgressView*)progressView
statusLabel:(UILabel*)statusLabel
statusBottomConstraint:(NSLayoutConstraint*)bottomConstraint {
[progressView setHidden:[self pillToDfu] == nil];
[progressView setProgress:0.0f];
[progressView setProgressTintColor:[UIColor tintColor]];
[progressView setTrackTintColor:[[UIColor grey3] colorWithAlphaComponent:0.5f]];
[statusLabel setHidden:[self pillToDfu] == nil];
[statusLabel setText:[self statusForState:HEMDeviceDfuStateNotStarted]];

if (bottomConstraint) {
[bottomConstraint setConstant:HEMPIllDfuStatus4sBottomMargin];
}

[self setProgressView:progressView];
[self setStatusLabel:statusLabel];
[self setStatusBottomConstraint:bottomConstraint];
}

- (void)bindWithCancelButton:(UIButton*)cancelButton {
Expand Down
4 changes: 3 additions & 1 deletion SleepModel/HEMSleepPillDfuViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ @interface HEMSleepPillDfuViewController () <
@property (weak, nonatomic) IBOutlet UILabel *descriptionLabel;
@property (weak, nonatomic) IBOutlet UIImageView *illustrationImageView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *illustrationBottomConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *statusLabelBottomConstraint;
@property (weak, nonatomic) IBOutlet HEMActionButton *continueButton;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
@property (weak, nonatomic) IBOutlet UIProgressView *progressView;
Expand Down Expand Up @@ -59,7 +60,8 @@ - (void)configurePresenter {
descriptionLabel:[self descriptionLabel]];
[dfuPresenter bindWithActionButton:[self continueButton]];
[dfuPresenter bindWithProgressView:[self progressView]
statusLabel:[self statusLabel]];
statusLabel:[self statusLabel]
statusBottomConstraint:[self statusLabelBottomConstraint]];
[dfuPresenter setErrorDelegate:self];
[dfuPresenter setDfuDelegate:self];
[dfuPresenter bindWithCancelButton:[self cancelButton]];
Expand Down
2 changes: 1 addition & 1 deletion SleepModel/Sense-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.5.0.4</string>
<string>1.5.0.5</string>
<key>FacebookAppID</key>
<string>372438546161587</string>
<key>FacebookDisplayName</key>
Expand Down

0 comments on commit c0214b8

Please sign in to comment.