Skip to content
This repository has been archived by the owner on Oct 15, 2018. It is now read-only.

Commit

Permalink
Add notification reschedule. Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamazz committed Jul 22, 2015
1 parent c10fa61 commit 6dfc210
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Gulps WatchKit App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3</string>
<string>1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>13</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
4 changes: 2 additions & 2 deletions Gulps WatchKit Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.3</string>
<string>1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>13</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
43 changes: 28 additions & 15 deletions Gulps/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import UIKit
import DPMeterView
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -10,9 +9,34 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

EntryHandler.bootstrapRealm()

DPMeterView.appearance().trackTintColor = .lightGray()
DPMeterView.appearance().progressTintColor = .mainColor()
setupAppearance()

Settings.registerDefaults()

let userDefaults = NSUserDefaults.groupUserDefaults()
if (!userDefaults.boolForKey(Settings.General.OnboardingShown.key())) {
loadOnboardingInterface()
} else {
loadMainInterface()
checkVersion()
}

return true
}

func checkVersion() {
let userDefaults = NSUserDefaults.groupUserDefaults()
let current = userDefaults.integerForKey("BUNDLE_VERSION")
if let versionString = NSBundle.mainBundle().infoDictionary?["CFBundleVersion"] as? String, let version = versionString.toInt() {
if current < 13 {
NotificationHelper.rescheduleNotifications()
}
userDefaults.setInteger(version, forKey: "BUNDLE_VERSION")
userDefaults.synchronize()
}
}

func setupAppearance() {
Globals.actionSheetAppearance()

UITabBar.appearance().tintColor = .mainColor()
Expand All @@ -24,17 +48,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

UINavigationBar.appearance().barTintColor = .mainColor()
UINavigationBar.appearance().tintColor = .whiteColor()

Settings.registerDefaults()

let userDefaults = NSUserDefaults.groupUserDefaults()
if (!userDefaults.boolForKey(Settings.General.OnboardingShown.key())) {
loadOnboardingInterface()
} else {
loadMainInterface()
}

return true
}

func loadOnboardingInterface() {
Expand Down
4 changes: 2 additions & 2 deletions Gulps/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3</string>
<string>1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>13</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIAppFonts</key>
Expand Down
10 changes: 10 additions & 0 deletions Gulps/Support/NotificationHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import UIKit

class NotificationHelper {

/// Version 1.4 introduces a new sound. Users from previous versions need to reschedule the local notifications
class func rescheduleNotifications() {
let userDefaults = NSUserDefaults.groupUserDefaults()
if (!userDefaults.boolForKey(Settings.Notification.On.key())) {
return
}
unscheduleNotifications()
registerNotifications()
}

class func registerNotifications() {
let userDefaults = NSUserDefaults.groupUserDefaults()
if (!userDefaults.boolForKey(Settings.Notification.On.key())) {
Expand Down
4 changes: 2 additions & 2 deletions GulpsToday/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.3</string>
<string>1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>13</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def common_pods
pod 'AMPopTip', '~> 0.7'
pod 'UICountingLabel', '~> 1.2'
pod 'JTCalendar', git: 'https://github.com/andreamazz/JTCalendar', branch: 'develop'
pod 'BAFluidView', git: 'https://github.com/antiguab/BAFluidView', branch: '0.1.5'
pod 'BAFluidView', '~> 0.1.5'
pod 'BubbleTransition'
# pod 'BEMSimpleLineGraph'
end
Expand Down

0 comments on commit 6dfc210

Please sign in to comment.