123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wobjc-missing-property-synthesis"
- #import <Availability.h>
- #undef weak_delegate
- #if __has_feature(objc_arc_weak) && \
- (TARGET_OS_IPHONE || __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8)
- #define weak_delegate weak
- #else
- #define weak_delegate unsafe_unretained
- #endif
- #import <TargetConditionals.h>
- #if TARGET_OS_IPHONE
- #import <UIKit/UIKit.h>
- #define IVERSION_USE_STOREKIT 1
- #define IVERSION_EXTERN UIKIT_EXTERN
- #else
- #import <Cocoa/Cocoa.h>
- #define IVERSION_EXTERN APPKIT_EXTERN
- #endif
- #if defined(IVERSION_USE_STOREKIT) && IVERSION_USE_STOREKIT
- #import <StoreKit/StoreKit.h>
- #endif
- extern NSString *const iVersionErrorDomain;
- IVERSION_EXTERN NSString *const iVersionInThisVersionTitleKey;
- IVERSION_EXTERN NSString *const iVersionUpdateAvailableTitleKey;
- IVERSION_EXTERN NSString *const iVersionVersionLabelFormatKey;
- IVERSION_EXTERN NSString *const iVersionOKButtonKey;
- IVERSION_EXTERN NSString *const iVersionIgnoreButtonKey;
- IVERSION_EXTERN NSString *const iVersionRemindButtonKey;
- IVERSION_EXTERN NSString *const iVersionDownloadButtonKey;
- typedef NS_ENUM(NSUInteger, iVersionErrorCode)
- {
- iVersionErrorBundleIdDoesNotMatchAppStore = 1,
- iVersionErrorApplicationNotFoundOnAppStore,
- iVersionErrorOSVersionNotSupported
- };
- typedef NS_ENUM(NSInteger, iVersionUpdatePriority)
- {
- iVersionUpdatePriorityDefault = 0,
- iVersionUpdatePriorityLow = 1,
- iVersionUpdatePriorityMedium = 2,
- iVersionUpdatePriorityHigh = 3
- };
- @interface NSString(iVersion)
- - (NSComparisonResult)compareVersion:(NSString *)version;
- - (NSComparisonResult)compareVersionDescending:(NSString *)version;
- @end
- @protocol iVersionDelegate <NSObject>
- @optional
- - (BOOL)iVersionShouldCheckForNewVersion;
- - (void)iVersionDidNotDetectNewVersion;
- - (void)iVersionVersionCheckDidFailWithError:(NSError *)error;
- - (void)iVersionDidDetectNewVersion:(NSString *)version details:(NSString *)versionDetails;
- - (BOOL)iVersionShouldDisplayNewVersion:(NSString *)version details:(NSString *)versionDetails;
- - (BOOL)iVersionShouldDisplayCurrentVersionDetails:(NSString *)versionDetails;
- - (void)iVersionUserDidAttemptToDownloadUpdate:(NSString *)version;
- - (void)iVersionUserDidRequestReminderForUpdate:(NSString *)version;
- - (void)iVersionUserDidIgnoreUpdate:(NSString *)version;
- - (BOOL)iVersionShouldOpenAppStore;
- - (void)iVersionDidPresentStoreKitModal;
- - (void)iVersionDidDismissStoreKitModal;
- @end
- @interface iVersion : NSObject
- + (iVersion *)sharedInstance;
- @property (nonatomic, assign) NSUInteger appStoreID;
- @property (nonatomic, copy) NSString *applicationVersion;
- @property (nonatomic, copy) NSString *applicationBundleID;
- @property (nonatomic, copy) NSString *appStoreCountry;
- @property (nonatomic, assign) BOOL showOnFirstLaunch;
- @property (nonatomic, assign) BOOL groupNotesByVersion;
- @property (nonatomic, assign) float checkPeriod;
- @property (nonatomic, assign) float remindPeriod;
- @property (nonatomic, copy) NSString *inThisVersionTitle;
- @property (nonatomic, copy) NSString *updateAvailableTitle;
- @property (nonatomic, copy) NSString *versionLabelFormat;
- @property (nonatomic, copy) NSString *okButtonLabel;
- @property (nonatomic, copy) NSString *ignoreButtonLabel;
- @property (nonatomic, copy) NSString *remindButtonLabel;
- @property (nonatomic, copy) NSString *downloadButtonLabel;
- @property (nonatomic, copy) NSString *versionDetailsDefault;
- @property (nonatomic, assign) iVersionUpdatePriority updatePriority;
- @property (nonatomic, assign) BOOL useUIAlertControllerIfAvailable;
- @property (nonatomic, assign) BOOL useAllAvailableLanguages;
- @property (nonatomic, assign) BOOL onlyPromptIfMainWindowIsAvailable;
- @property (nonatomic, assign) BOOL useAppStoreDetailsIfNoPlistEntryFound;
- @property (nonatomic, assign) BOOL checkAtLaunch;
- @property (nonatomic, assign) BOOL verboseLogging;
- @property (nonatomic, assign) BOOL previewMode;
- @property (nonatomic, copy) NSString *remoteVersionsPlistURL;
- @property (nonatomic, copy) NSString *localVersionsPlistPath;
- @property (nonatomic, copy) NSString *ignoredVersion;
- @property (nonatomic, strong) NSDate *lastChecked;
- @property (nonatomic, strong) NSDate *lastReminded;
- @property (nonatomic, strong) NSURL *updateURL;
- @property (nonatomic, assign) BOOL viewedVersionDetails;
- @property (nonatomic, weak_delegate) id<iVersionDelegate> delegate;
- - (BOOL)openAppPageInAppStore;
- - (void)checkIfNewVersion;
- - (NSString *)versionDetails;
- - (BOOL)shouldCheckForNewVersion;
- - (void)checkForNewVersion;
- - (NSString *)localizedStringForKey:(NSString *)key withDefault:(NSString *)defaultString;
- @end
- #pragma clang diagnostic pop
|