Browse Source

Show app version update prompt if on older version.

pull/113/head
Abhishek 2 years ago
parent
commit
6b6c67be5c
  1. 3
      Clocker/Dependencies/iVersion/iVersion.h
  2. 1
      Clocker/Dependencies/iVersion/iVersion.m
  3. 1
      Clocker/Preferences/About/AboutViewController.swift
  4. 30
      Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

3
Clocker/Dependencies/iVersion/iVersion.h

@ -142,6 +142,9 @@ typedef NS_ENUM(NSInteger, iVersionUpdatePriority)
@property (nonatomic, strong) NSDate *lastReminded; @property (nonatomic, strong) NSDate *lastReminded;
@property (nonatomic, strong) NSURL *updateURL; @property (nonatomic, strong) NSURL *updateURL;
@property (nonatomic, assign) BOOL viewedVersionDetails; @property (nonatomic, assign) BOOL viewedVersionDetails;
@property (nonatomic, copy) NSDictionary *remoteVersionsDict;
- (NSString *)versionDetailsSince:(NSString *)lastVersion inDict:(NSDictionary *)dict;
//manually control behaviour //manually control behaviour
@property (NS_NONATOMIC_IOSONLY, readonly) BOOL openAppPageInAppStore; @property (NS_NONATOMIC_IOSONLY, readonly) BOOL openAppPageInAppStore;

1
Clocker/Dependencies/iVersion/iVersion.m

@ -98,7 +98,6 @@ static NSString *mostRecentVersionInDict(NSDictionary *dictionary)
@interface iVersion () @interface iVersion ()
@property (nonatomic, copy) NSDictionary *remoteVersionsDict;
@property (nonatomic, strong) NSError *downloadError; @property (nonatomic, strong) NSError *downloadError;
@property (nonatomic, copy) NSString *versionDetails; @property (nonatomic, copy) NSString *versionDetails;
@property (nonatomic, strong) id visibleLocalAlert; @property (nonatomic, strong) id visibleLocalAlert;

1
Clocker/Preferences/About/AboutViewController.swift

@ -10,6 +10,7 @@ struct AboutUsConstants {
static let TwitterLink = "https://twitter.com/clocker_support/?ref=ClockerApp" static let TwitterLink = "https://twitter.com/clocker_support/?ref=ClockerApp"
static let TwitterFollowIntentLink = "https://twitter.com/intent/follow?screen_name=clocker_support" static let TwitterFollowIntentLink = "https://twitter.com/intent/follow?screen_name=clocker_support"
static let AppStoreLink = "macappstore://itunes.apple.com/us/app/clocker/id1056643111?action=write-review" static let AppStoreLink = "macappstore://itunes.apple.com/us/app/clocker/id1056643111?action=write-review"
static let AppStoreUpdateLink = "macappstore://itunes.apple.com/us/app/clocker/id1056643111"
static let CrowdInLocalizationLink = "https://crwd.in/clocker" static let CrowdInLocalizationLink = "https://crwd.in/clocker"
static let FAQsLink = "https://abhishekbanthia.com/clocker/faq" static let FAQsLink = "https://abhishekbanthia.com/clocker/faq"
} }

30
Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

@ -39,7 +39,6 @@ class AppFeedbackWindowController: NSWindowController {
@IBOutlet var emailField: NSTextField! @IBOutlet var emailField: NSTextField!
@IBOutlet var feedbackTextView: NSTextView! @IBOutlet var feedbackTextView: NSTextView!
@IBOutlet var progressIndicator: NSProgressIndicator! @IBOutlet var progressIndicator: NSProgressIndicator!
@IBOutlet var quickCommentsLabel: PointingHandCursorButton! @IBOutlet var quickCommentsLabel: PointingHandCursorButton!
public weak var appFeedbackWindowDelegate: AppFeedbackWindowControllerDelegate? public weak var appFeedbackWindowDelegate: AppFeedbackWindowControllerDelegate?
private var themeDidChangeNotification: NSObjectProtocol? private var themeDidChangeNotification: NSObjectProtocol?
@ -270,9 +269,20 @@ class AppFeedbackWindowController: NSWindowController {
contactBox.title = "Contact Information (Optional)".localized() contactBox.title = "Contact Information (Optional)".localized()
accessoryInfo.stringValue = "Contact fields are optional! Your contact information will let us contact you in case we need more information or can help!".localized() accessoryInfo.stringValue = "Contact fields are optional! Your contact information will let us contact you in case we need more information or can help!".localized()
let range = NSRange(location: 9, length: 16) let versionUpdateInstance = iVersion.sharedInstance()
quickCommentsLabel.title = "Tweet to @Clocker_Support if you have a quick comment!" let string = versionUpdateInstance?.versionDetails(since: versionUpdateInstance?.applicationVersion,
setUnderline(for: quickCommentsLabel, range: range) inDict: versionUpdateInstance?.remoteVersionsDict)
if string != nil {
let range = NSRange(location: 37, length: 13)
quickCommentsLabel.title = "📣 An improved Clocker experience is now available!"
quickCommentsLabel.tag = 0
setUnderline(for: quickCommentsLabel, range: range)
} else {
let range = NSRange(location: 9, length: 16)
quickCommentsLabel.title = "Tweet to @Clocker_Support if you have a quick comment!"
setUnderline(for: quickCommentsLabel, range: range)
quickCommentsLabel.tag = 100
}
[accessoryInfo].forEach { $0?.textColor = Themer.shared().mainTextColor() } [accessoryInfo].forEach { $0?.textColor = Themer.shared().mainTextColor() }
@ -304,15 +314,11 @@ class AppFeedbackWindowController: NSWindowController {
underlinedButton.attributedTitle = originalText underlinedButton.attributedTitle = originalText
} }
@IBAction func navigateToSupportTwitter(_: Any) { @IBAction func navigateToSupportTwitter(_ sender: NSButton) {
guard let twitterURL = URL(string: AboutUsConstants.TwitterLink), let link = sender.tag == 100 ? AboutUsConstants.TwitterLink : AboutUsConstants.AppStoreUpdateLink
let countryCode = Locale.autoupdatingCurrent.regionCode else { return } guard let url = URL(string: link) else { return }
NSWorkspace.shared.open(twitterURL)
// Log this NSWorkspace.shared.open(url)
let custom: [String: Any] = ["Country": countryCode]
Logger.log(object: custom, for: "Opened Twitter")
} }
} }

Loading…
Cancel
Save