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

Delegate for latest version installed and check for how long current app has been released #99

Merged
merged 5 commits into from Nov 14, 2016

Conversation

steviki
Copy link
Contributor

@steviki steviki commented Nov 11, 2016

This PR adds

  • a delegate method to SirenDelegate to notify when the check finished and the latest version is already installed.
  • a property showAlertAfterCurrentVersionHasBeenReleasedForDays which can be set to a number of days and the update alert then only shows up if the current version has already been released for the set number of days.

Copy link
Owner

@ArtSabintsev ArtSabintsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additions looks great, but I have some stylistic changes that I'd like to be implemented.

@@ -538,12 +557,19 @@ fileprivate extension Siren {
return url
}

func daysSince(lastVersionCheckPerformed lastCheckDate: Date) -> Int {
func daysSince(_ date: Date) -> Int {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do me a favor and rename the method's so their signature looks as follows:

func days(since date:)

return components.day!
}

func daysSince(dateString: String) -> Int? {
let dateformatter = DateFormatter()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DateFormatter's, at least the ObjC Foundation NSDaeFormatter is notoriously expensive to initialize. Can we place the dateFormatter initialization and basic (non-dateString) configuration in a static func?

return components.day!
}

func daysSince(dateString: String) -> Int? {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do me a favor and rename the method's so their signature looks as follows:

func days(since dateString:)

@steviki
Copy link
Contributor Author

steviki commented Nov 14, 2016

All feedback addressed.

@ArtSabintsev
Copy link
Owner

Looks good! Will merge and may make one stylistic tweak. I'll post back here when this is available via CocoaPods (should be soon)

@ArtSabintsev ArtSabintsev merged commit 432a22f into ArtSabintsev:master Nov 14, 2016
@ArtSabintsev
Copy link
Owner

This is now available in Siren 1.1.0. Thanks for this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants