• This repository has been archived on 22/Nov/2020
  • Stars
    star
    2,600
  • Rank 17,623 (Top 0.4 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 12 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Notify users when a new version of your app is available and prompt them to upgrade.

After 6 years of Harpy and 4 years of Siren, I have decided to deprecate Harpy in favor of Siren. Why? Siren is written in Swift and has a feature set that is superior to that of Harpy. More information can be found on this Medium post. The repository will live on, however, there will be no further updates and no transfers of the codebase at this time.


Harpy

Notify users when a new version of your app is available and prompt them to upgrade.

Build Status

CocoaPods Carthage Compatible CocoaPods


About

Harpy checks a user's currently installed version of your iOS app against the version that is currently available in the App Store. If a new version is available, an alert can be presented to the user informing them of the newer version, and giving them the option to update the application.

Harpy is built to work with the Semantic Versioning system.

  • Semantic Versioning is a three number versioning system (e.g., 1.0.0)
  • Harpy also supports two-number versioning (e.g., 1.0)
  • Harpy also supports four-number versioning (e.g., 1.0.0.0)
  • Harpy only works with numbers.

Swift Support

Harpy was ported to Swift by myself and Aaron Brager. We've called the new project Siren.

Features

  • CocoaPods Support
  • Carthage Support
  • Localized for 40+ languages (See Localization)
  • Pre-Update Device Compatibility Check (See Device Compatibility)
  • Three types of alerts (see Screenshots & Alert Types)
  • Optional delegate methods (see Optional Delegate section)
  • Unit Tests!

Screenshots

  • The left picture forces the user to update the app.
  • The center picture gives the user the option to update the app.
  • The right picture gives the user the option to skip the current update.
  • These options are controlled by the HarpyAlertType enum that is found in Harpy.h.

Installation Instructions

CocoaPods

pod 'Harpy'

Carthage

github "ArtSabintsev/Harpy"

Manual

Copy the 'Harpy' folder into your Xcode project. It contains the Harpy.h and Harpy.m files.

Setup

  1. Import Harpy.h into your AppDelegate or Pre-Compiler Header (.pch)
  2. In your AppDelegate, optionally set the alertType.
  3. In your AppDelegate, call only one of the checkVersion methods, as all three perform a check on your application's first launch. Use either:
    • checkVersion in application:didFinishLaunchingWithOptions:
    • checkVersionDaily in applicationDidBecomeActive:.
    • checkVersionWeekly in applicationDidBecomeActive:.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

	// Present Window before calling Harpy
	[self.window makeKeyAndVisible];

	// Set the UIViewController that will present an instance of UIAlertController
	[[Harpy sharedInstance] setPresentingViewController:_window.rootViewController];

    // (Optional) Set the Delegate to track what a user clicked on, or to use a custom UI to present your message.
        [[Harpy sharedInstance] setDelegate:self];

    // (Optional) When this is set, the alert will only show up if the current version has already been released for X days.
    // By default, this value is set to 1 (day) to avoid an issue where Apple updates the JSON faster than the app binary propogates to the App Store.
        [[Harpy sharedInstance] setShowAlertAfterCurrentVersionHasBeenReleasedForDays:3];

	// (Optional) The tintColor for the alertController
	[[Harpy sharedInstance] setAlertControllerTintColor:@"<#alert_controller_tint_color#>"];

	// (Optional) Set the App Name for your app
	[[Harpy sharedInstance] setAppName:@"<#app_name#>"];

	/* (Optional) Set the Alert Type for your app
	 By default, Harpy is configured to use HarpyAlertTypeOption */
	[[Harpy sharedInstance] setAlertType:<#alert_type#>];

	/* (Optional) If your application is not available in the U.S. App Store, you must specify the two-letter
	 country code for the region in which your applicaiton is available. */
	[[Harpy sharedInstance] setCountryCode:@"<#country_code#>"];

	/* (Optional) Overrides system language to predefined language.
	 Please use the HarpyLanguage constants defined in Harpy.h. */
	[[Harpy sharedInstance] setForceLanguageLocalization:<#HarpyLanguageConstant#>];

        /* (Optional): Delays the update prompt by a specific number of days. By default,
	this value is set to 1 day to avoid an issue where Apple updates the JSON faster than the app binary propogates to the App Store.*/
        [[Harpy sharedInstance] setShowAlertAfterCurrentVersionHasBeenReleasedForDays:<#Int#>];

	// Perform check for new version of your app
	[[Harpy sharedInstance] checkVersion];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {

	/*
	 Perform daily check for new version of your app
	 Useful if user returns to you app from background after extended period of time
 	 Place in applicationDidBecomeActive:

 	 Also, performs version check on first launch.
 	*/
	[[Harpy sharedInstance] checkVersionDaily];

	/*
	 Perform weekly check for new version of your app
	 Useful if you user returns to your app from background after extended period of time
	 Place in applicationDidBecomeActive:

	 Also, performs version check on first launch.
	 */
	[[Harpy sharedInstance] checkVersionWeekly];

}

- (void)applicationWillEnterForeground:(UIApplication *)application {
	/*
	 Perform check for new version of your app
	 Useful if user returns to you app from background after being sent tot he App Store,
	 but doesn't update their app before coming back to your app.

 	 ONLY USE THIS IF YOU ARE USING *HarpyAlertTypeForce*

 	 Also, performs version check on first launch.
 	*/
	[[Harpy sharedInstance] checkVersion];
}

And you're all set!

Differentiated Alerts for Patch, Minor, and Major Updates

If you would like to set a different type of alert for revision, patch, minor, and/or major updates, simply add one or all of the following optional lines to your setup before calling any of the checkVersion methods:

	/* By default, Harpy is configured to use HarpyAlertTypeOption for all version updates */
	[[Harpy sharedInstance] setPatchUpdateAlertType:<#alert_type#>];
	[[Harpy sharedInstance] setMinorUpdateAlertType:<#alert_type#>];
	[[Harpy sharedInstance] setMajorUpdateAlertType:<#alert_type#>];
	[[Harpy sharedInstance] setRevisionUpdateAlertType:<#alert_type#>];

Optional Delegate and Delegate Methods

If you'd like to handle or track the end-user's behavior, four delegate methods have been made available to you:

	// User presented with update dialog
	- (void)harpyDidShowUpdateDialog;

	// User did click on button that launched App Store.app
	- (void)harpyUserDidLaunchAppStore;

	// User did click on button that skips version update
	- (void)harpyUserDidSkipVersion;

	// User did click on button that cancels update dialog
	- (void)harpyUserDidCancel;

If you would like to use your own UI, please use the following delegate method to obtain the localized update message if a new version is available:

- (void)harpyDidDetectNewVersionWithoutAlert:(NSString *)message;

Localization

Harpy is localized for

  • Arabic
  • Armenian
  • Basque
  • Chinese (Simplified and Traditional)
  • Croatian
  • Czech
  • Danish
  • Dutch
  • English
  • Estonian
  • Finnish
  • French
  • German
  • Greek
  • Hebrew
  • Hungarian
  • Indonesian
  • Italian
  • Japanese
  • Korean
  • Latvian
  • Lithuanian
  • Malay
  • Norwegian (BokmΓ₯l)
  • Persian (Iran, Afghanistan, Persian)
  • Polish
  • Portuguese (Brazil and Portugal)
  • Russian
  • Serbian (Cyrillic and Latin)
  • Slovenian
  • Spanish
  • Swedish
  • Thai
  • Turkish
  • Ukrainian
  • Urdu
  • Vietnamese

You may want the update dialog to always appear in a certain language, ignoring iOS's language setting (e.g. apps released in a specific country).

You can enable it like this:

[[Harpy sharedInstance] setForceLanguageLocalization<#HarpyLanguageConstant#>];

Device Compatibility

If an app update is available, Harpy checks to make sure that the version of iOS on the user's device is compatible the one that is required by the app update. For example, if a user has iOS 9 installed on their device, but the app update requires iOS 10, an alert will not be shown. This takes care of the false positive case regarding app updating.

Testing Harpy

Temporarily change the version string in Xcode (within the .xcodeproj) to an older version than the one that's currently available in the App Store. Afterwards, build and run your app, and you should see the alert.

If you currently don't have an app in the store, change your bundleID to one that is already in the store. In the sample app packaged with this library, we use the App Store Connect app's bundleID: com.apple.itunesconnect.mobile.

Important Note on App Store Submissions

The App Store reviewer will not see the alert.

Phased Releases

In 2017, Apple announced the ability to rollout app updates gradually (a.k.a. Phased Releases). Harpy will continue to work as it has in the past, presenting an update modal to all users. If you opt-in to a phased rollout for a specific version, you will need to remotely disable Harpy until the rollout is done.

Created and maintained by

Arthur Ariel Sabintsev

More Repositories

1

Siren

Notify users when a new version of your app is available and prompt them to upgrade.
Swift
4,140
star
2

FontBlaster

Programmatically load custom fonts into your iOS, macOS and tvOS app.
Swift
1,135
star
3

Zephyr

Effortlessly synchronize UserDefaults over iCloud.
Swift
899
star
4

Guitar

A Cross-Platform String and Regular Expression Library written in Swift.
Swift
660
star
5

Solarized-Dark-for-Xcode

Solarized Dark Theme for Xcode. Compatible with all modern versions of Xcode since 2013!
Shell
366
star
6

UIFloatLabelTextField

A subclassed UITextField that follows the Float Label UI design pattern.
Objective-C
323
star
7

Magic

A Swift alternative for Objective-C's DLog macro.
Ruby
283
star
8

UIFloatLabelTextView

A subclassed UITextView that follows the Float Label UI design pattern.
Objective-C
174
star
9

Freedom

The Freedom to Open URLs in Third-Party Browsers on iOS with Custom UIActivity Subclasses.
Swift
86
star
10

Asynchronous-Freeloader

Multithreaded Asynchronous Image Downloader
Objective-C
22
star
11

Cognac

An Alluring, Dark, and Muted Theme For Your Favorite Text Editor.
16
star
12

Cognac-Xcode

An Alluring, Dark, and Muted Theme For Xcode.
Shell
14
star
13

GitFame

A Swift CLI script that logs your GitHub Stars and Forks.
Makefile
13
star
14

MaterialSwitch

A Material Design inspired switch for iOS
Swift
12
star
15

UIDevice-SupportedDevices

An Objective-C category on UIDevice that returns devices based on the supportedDevices key in the JSON results returned in an iTunes Lookup API call.
Objective-C
12
star
16

UIView-AutoLayoutView

A small Objective-C category on UIView that creates a UIView object that is ready to be used in programmatic AutoLayout.
Objective-C
9
star
17

UIColor-ColorWithHexAndAlpha

A category on UIColor that enables you to use hex values to create UIColor objects.
Objective-C
8
star
18

iOSDevCampDC-2018

My talk on Scaling iOS Architecture for iOSDevCampDC 2018.
5
star
19

Panhandler

Remind your active users to rate and review your iOS app
Objective-C
5
star
20

Cognac-iTerm

An Alluring, Dark, and Muted Syntax Theme For iTerm2.
3
star
21

Cognac-VSCode

An Alluring, Dark, and Muted Syntax Theme For Visual Studio Code.
3
star
22

artsabintsev.github.io

My Homepage.
CSS
2
star
23

NSDate-DateFromBSONObjectID

Convert MongoDB's BSON ObjectID to NSDate
Objective-C
2
star
24

Swift-3-CocoaHeads-DC-Talk

My talk on Swift 3 at CocoaHeads DC on July 7, 2016.
Swift
2
star
25

iOSDevCampDC-2017

My Talk on Open Source Software Development for iOSDevCampDC 2017.
2
star
26

cocoaheads-ukraine-2017

My Talk on Open Source Software Development for CocoaHeads Ukraine #13 in 2017
1
star
27

Apple-Watch-WatchKit-CocoaHeads-DC-Talk-

Keynote, PDF, and Sample Project for my WatchKit Talk.
Swift
1
star
28

Cognac-Terminal

An Alluring, Dark, and Muted Theme For The macOS Terminal.
1
star
29

Simple-Class-Portraits

A simple addon for World of Warcraft.
Lua
1
star