Skip to content

Commit

Permalink
Fixed some bugs. Added compilations. Added 3D touch support
Browse files Browse the repository at this point in the history
  • Loading branch information
dasdom committed Sep 27, 2015
1 parent 4ba9d35 commit 217276a
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 44 deletions.
7 changes: 4 additions & 3 deletions Fojusi Watch Extension/ComplicationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ClockKit

class ComplicationController: NSObject, CLKComplicationDataSource {

// var nextDate = NSDate(timeIntervalSinceNow: 10)
var nextDate: NSDate?

// MARK: - Timeline Configuration

Expand All @@ -37,8 +37,9 @@ class ComplicationController: NSObject, CLKComplicationDataSource {
// Call the handler with the current timeline entry

let timestamp = NSUserDefaults.standardUserDefaults().doubleForKey("timeStamp")
let maxValue = NSUserDefaults.standardUserDefaults().integerForKey("maxValue")
// let maxValue = NSUserDefaults.standardUserDefaults().integerForKey("maxValue")
let date = NSDate(timeIntervalSince1970: timestamp)
nextDate = date

var entry: CLKComplicationTimelineEntry?
switch complication.family {
Expand Down Expand Up @@ -119,7 +120,7 @@ class ComplicationController: NSObject, CLKComplicationDataSource {

func getNextRequestedUpdateDateWithHandler(handler: (NSDate?) -> Void) {
// Call the handler with the date when you would next like to be given the opportunity to update your complication content
handler(nil);
handler(nextDate);
}

// MARK: - Placeholder Templates
Expand Down
4 changes: 2 additions & 2 deletions Fojusi Watch 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.0</string>
<string>1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>7</string>
<key>CLKComplicationPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ComplicationController</string>
<key>CLKComplicationSupportedFamilies</key>
Expand Down
4 changes: 2 additions & 2 deletions Fojusi Watch/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.0</string>
<string>1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>7</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
4 changes: 2 additions & 2 deletions Remaining/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.0</string>
<string>1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>7</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
Expand Down
7 changes: 1 addition & 6 deletions Remaining/Remaining.entitlements
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.de.dasdom.Tomate</string>
</array>
</dict>
<dict/>
</plist>
39 changes: 18 additions & 21 deletions Tomate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@
DevelopmentTeam = Q6PD97MRX4;
SystemCapabilities = {
com.apple.ApplicationGroups.iOS = {
enabled = 1;
enabled = 0;
};
};
};
Expand All @@ -523,7 +523,7 @@
DevelopmentTeam = Q6PD97MRX4;
SystemCapabilities = {
com.apple.ApplicationGroups.iOS = {
enabled = 1;
enabled = 0;
};
};
};
Expand Down Expand Up @@ -713,7 +713,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = de.dasdom.Fojusi.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "88f5ec15-360d-4461-b73a-b2b3fc39f095";
SDKROOT = watchos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4;
Expand All @@ -726,7 +726,8 @@
buildSettings = {
ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Dominik Hauser (Q6PD97MRX4)";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Distribution: Dominik Hauser (Q6PD97MRX4)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_NO_COMMON_BLOCKS = YES;
Expand All @@ -735,7 +736,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = de.dasdom.Fojusi.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "88f5ec15-360d-4461-b73a-b2b3fc39f095";
SDKROOT = watchos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4;
Expand All @@ -758,7 +759,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = de.dasdom.Fojusi.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "22090e06-4512-473f-a1d0-ab71fa954fe1";
SDKROOT = watchos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4;
Expand All @@ -771,8 +772,8 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Dominik Hauser (Q6PD97MRX4)";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Distribution: Dominik Hauser (Q6PD97MRX4)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
Expand All @@ -782,7 +783,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = de.dasdom.Fojusi.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "22090e06-4512-473f-a1d0-ab71fa954fe1";
SDKROOT = watchos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4;
Expand Down Expand Up @@ -874,7 +875,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Tomate/Fojusi.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEFINES_MODULE = NO;
Expand All @@ -884,7 +884,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "de.dasdom.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Fojusi;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "9d775ac9-b1d7-44fd-b8db-51d97ed5a8ec";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -897,17 +897,16 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Tomate/Fojusi.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
DEFINES_MODULE = NO;
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = Tomate/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "de.dasdom.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = Fojusi;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "9d775ac9-b1d7-44fd-b8db-51d97ed5a8ec";
SWIFT_OBJC_BRIDGING_HEADER = "";
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -987,7 +986,6 @@
F2FF2C821AB0A4C50017BF04 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = Remaining/Remaining.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PREPROCESSOR_DEFINITIONS = (
Expand All @@ -1000,25 +998,24 @@
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = "de.dasdom.Fojusi.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "2fac200e-0684-4249-9f93-0968f8e30dc6";
SKIP_INSTALL = YES;
};
name = Debug;
};
F2FF2C831AB0A4C50017BF04 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = Remaining/Remaining.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Distribution: Dominik Hauser (Q6PD97MRX4)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Dominik Hauser (Q6PD97MRX4)";
COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = Remaining/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "de.dasdom.Fojusi.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "2fac200e-0684-4249-9f93-0968f8e30dc6";
SKIP_INSTALL = YES;
};
name = Release;
Expand Down
33 changes: 33 additions & 0 deletions Tomate/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
window!.rootViewController = focusViewController
window!.makeKeyAndVisible()

// Override point for customization after application launch.
var shouldPerformAdditionalDelegateHandling = true

// If a shortcut was launched, display its information and take the appropriate action
if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsShortcutItemKey] as? UIApplicationShortcutItem {

handleShortcut(shortcutItem.type)

// This will block "performActionForShortcutItem:completionHandler" from being called.
shouldPerformAdditionalDelegateHandling = false
}

return true
}

Expand Down Expand Up @@ -65,6 +77,27 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

completionHandler()
}

func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: (Bool) -> Void) {

let handledShortCut = handleShortcut(shortcutItem.type)

completionHandler(handledShortCut)
}

func handleShortcut(shortCut: String) -> Bool {
guard let last = shortCut.componentsSeparatedByString(".").last else { return false }

switch last {
case "Work":
self.focusViewController?.startTimerWithType(.Work)
case "Break":
self.focusViewController?.startTimerWithType(.Break)
default:
return false
}
return true
}

func customizeAppearance() {
UINavigationBar.appearance().tintColor = UIColor.yellowColor()
Expand Down
7 changes: 1 addition & 6 deletions Tomate/Fojusi.entitlements
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.de.dasdom.Tomate</string>
</array>
</dict>
<dict/>
</plist>
20 changes: 18 additions & 2 deletions Tomate/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,28 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>6</string>
<string>7</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationShortcutItems</key>
<array>
<dict>
<key>UIApplicationShortcutItemTitle</key>
<string>Work</string>
<key>UIApplicationShortcutItemType</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).Work</string>
</dict>
<dict>
<key>UIApplicationShortcutItemTitle</key>
<string>Break</string>
<key>UIApplicationShortcutItemType</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).Break</string>
</dict>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand All @@ -33,6 +48,7 @@
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
Expand Down

0 comments on commit 217276a

Please sign in to comment.