diff --git a/BeatTime.xcodeproj/project.pbxproj b/BeatTime.xcodeproj/project.pbxproj index 4248a7f..f23b63d 100644 --- a/BeatTime.xcodeproj/project.pbxproj +++ b/BeatTime.xcodeproj/project.pbxproj @@ -964,7 +964,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = VNLK894MAE; INFOPLIST_FILE = "$(SRCROOT)/Widget iOS/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 14.5; @@ -973,7 +973,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime.BeatTimeWidgetiOS; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -989,7 +989,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = VNLK894MAE; INFOPLIST_FILE = "$(SRCROOT)/Widget iOS/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 14.5; @@ -998,7 +998,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime.BeatTimeWidgetiOS; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -1066,7 +1066,7 @@ buildSettings = { ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_ASSET_PATHS = "\"WatchOS WatchKit Extension/Preview Content\""; DEVELOPMENT_TEAM = VNLK894MAE; ENABLE_PREVIEWS = YES; @@ -1076,7 +1076,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -1092,7 +1092,7 @@ buildSettings = { ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_ASSET_PATHS = "\"WatchOS WatchKit Extension/Preview Content\""; DEVELOPMENT_TEAM = VNLK894MAE; ENABLE_PREVIEWS = YES; @@ -1102,7 +1102,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -1120,11 +1120,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = VNLK894MAE; IBSC_MODULE = BeatTimeWatchOS_WatchKit_Extension; INFOPLIST_FILE = "$(SRCROOT)/WatchOS WatchKit App/Info.plist"; - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime.watchkitapp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; @@ -1141,11 +1141,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = VNLK894MAE; IBSC_MODULE = BeatTimeWatchOS_WatchKit_Extension; INFOPLIST_FILE = "$(SRCROOT)/WatchOS WatchKit App/Info.plist"; - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime.watchkitapp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; @@ -1161,9 +1161,9 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = VNLK894MAE; - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime; PRODUCT_NAME = BeatTime; SDKROOT = iphoneos; @@ -1175,9 +1175,9 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = VNLK894MAE; - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime; PRODUCT_NAME = BeatTime; SDKROOT = iphoneos; @@ -1193,7 +1193,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_ASSET_PATHS = "\"iOS/Preview Content\""; DEVELOPMENT_TEAM = VNLK894MAE; ENABLE_PREVIEWS = YES; @@ -1203,7 +1203,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -1219,7 +1219,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_ASSET_PATHS = "\"iOS/Preview Content\""; DEVELOPMENT_TEAM = VNLK894MAE; ENABLE_PREVIEWS = YES; @@ -1229,7 +1229,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.1; + MARKETING_VERSION = 1.2; PRODUCT_BUNDLE_IDENTIFIER = org.mulot.beattime; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; diff --git a/BeatTime.xcodeproj/project.xcworkspace/xcuserdata/mulot.xcuserdatad/UserInterfaceState.xcuserstate b/BeatTime.xcodeproj/project.xcworkspace/xcuserdata/mulot.xcuserdatad/UserInterfaceState.xcuserstate index 2b460b1..c375470 100644 Binary files a/BeatTime.xcodeproj/project.xcworkspace/xcuserdata/mulot.xcuserdatad/UserInterfaceState.xcuserstate and b/BeatTime.xcodeproj/project.xcworkspace/xcuserdata/mulot.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/BeatTime/BeatTime.swift b/BeatTime/BeatTime.swift index b4384da..32a9594 100644 --- a/BeatTime/BeatTime.swift +++ b/BeatTime/BeatTime.swift @@ -45,8 +45,38 @@ class BeatTime: NSObject { if let beattime = Double(beats) { if (beattime >= 0 && beattime <= 1000) { - seconds = beattime / 1000 * 86400 - BeatTime.UTCplus1Offset - return(Date(timeIntervalSinceReferenceDate: seconds)) + seconds = beattime / 1000 * 86400 + let date = Date() + let calendar = Calendar.current + var dateComponents = DateComponents() + dateComponents.year = calendar.component(.year, from: date) + dateComponents.month = calendar.component(.month, from: date) + dateComponents.day = calendar.component(.day, from: date) + dateComponents.timeZone = TimeZone(abbreviation: "CET") + dateComponents.hour = 1 // UTC+1 Offset + dateComponents.minute = 0 + /* + if (TimeZone.autoupdatingCurrent.isDaylightSavingTime()) { + print("Daylight On") + } + else { + print("Daylight Off") + } + */ + + if let someDateTime = calendar.date(from: dateComponents) { + //let secondsSinceRefDate = someDateTime.timeIntervalSinceReferenceDate + BeatTime.UTCplus1Offset + seconds + let secondsSinceRefDate = someDateTime.timeIntervalSinceReferenceDate + seconds + /* + print("Start Date: \(someDateTime)") + print("Date converted: \(Date(timeIntervalSinceReferenceDate: secondsSinceRefDate))") + print("Date ref: ", Date(timeIntervalSinceReferenceDate: Date.timeIntervalSinceReferenceDate)) + print("beats converted seconds: \(seconds) hours: \(Int(seconds/3600)) minutes: \(Int(seconds)%3600/60)") + print("seconds since Ref UTC Date: \(Date.timeIntervalSinceReferenceDate)") + print("converted seconds since Ref UTC Date: \(secondsSinceRefDate)\n") + */ + return(Date(timeIntervalSinceReferenceDate: secondsSinceRefDate)) + } } } return(Date()) diff --git a/README.md b/README.md index 481c11b..5f0f590 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,9 @@ Apps are coded in Swift language using AppKit/Cocoa (macOS), SwiftUI, WidgetKit, For more information about Swatch Internet Time: https://en.wikipedia.org/wiki/Swatch_Internet_Time -What's New in version 1.1: -- Fix a bug in converting Beats to local time -- Beats time font size adapts to screen size -- Circle gradients following the local sun light -- Option to disable the back circle and to chose its color -- Circle animations +What's New in version 1.2: +- Extra large complications for Apple Watch +- Corner complication for Apple Watch +- Fix dayligth issue in .beats to local time convert mode Buy Me A Coffee diff --git a/WatchOS WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json b/WatchOS WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json index ffee51b..4fe3b34 100644 --- a/WatchOS WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/WatchOS WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -30,6 +30,13 @@ "scale" : "3x", "size" : "29x29" }, + { + "idiom" : "watch", + "role" : "notificationCenter", + "scale" : "2x", + "size" : "33x33", + "subtype" : "45mm" + }, { "filename" : "BeatTime App Icon-WatchOS-80.png", "idiom" : "watch", @@ -46,6 +53,13 @@ "size" : "44x44", "subtype" : "40mm" }, + { + "idiom" : "watch", + "role" : "appLauncher", + "scale" : "2x", + "size" : "46x46", + "subtype" : "41mm" + }, { "filename" : "BeatTime App Icon-WatchOS-100.png", "idiom" : "watch", @@ -54,6 +68,13 @@ "size" : "50x50", "subtype" : "44mm" }, + { + "idiom" : "watch", + "role" : "appLauncher", + "scale" : "2x", + "size" : "51x51", + "subtype" : "45mm" + }, { "filename" : "BeatTime App Icon-WatchOS-172.png", "idiom" : "watch", @@ -78,6 +99,13 @@ "size" : "108x108", "subtype" : "44mm" }, + { + "idiom" : "watch", + "role" : "quickLook", + "scale" : "2x", + "size" : "117x117", + "subtype" : "45mm" + }, { "filename" : "BeatTime App Icon-WatchOS-1024.png", "idiom" : "watch-marketing", diff --git a/WatchOS WatchKit Extension/BeatTimeApp.swift b/WatchOS WatchKit Extension/BeatTimeApp.swift index f817a60..e3055df 100644 --- a/WatchOS WatchKit Extension/BeatTimeApp.swift +++ b/WatchOS WatchKit Extension/BeatTimeApp.swift @@ -91,7 +91,7 @@ struct ConvertView: View { VStack { HStack { Picker(selection: $selection[0], label: Text(".beats")) { - ForEach(0.. CLKComplicationTemplate? { - var beatProvider = CLKSimpleTextProvider( + let beatProvider = CLKSimpleTextProvider( text: "@" + beatTime, shortText: beatTime) switch complication.family { case .circularSmall: // Create a template from the circular small family. - return CLKComplicationTemplateCircularSmallSimpleText(textProvider: beatProvider) + return CLKComplicationTemplateCircularSmallRingText(textProvider: beatProvider, fillFraction: (Float(beatTime)!/1000), ringStyle: CLKComplicationRingStyle.closed) case .modularSmall: // Create a template from the modular small family. return CLKComplicationTemplateModularSmallRingText(textProvider: beatProvider, fillFraction: (Float(beatTime)!/1000), ringStyle: CLKComplicationRingStyle.closed) @@ -25,22 +25,31 @@ extension ComplicationController { let dateProvider = CLKSimpleTextProvider( text: "Local time " + DateFormatter.localizedString(from: Date(), dateStyle: .none, timeStyle: .short), shortText: DateFormatter.localizedString(from: Date(), dateStyle: .none, timeStyle: .short)) - return CLKComplicationTemplateModularLargeStandardBody(headerTextProvider: CLKSimpleTextProvider(text: "@Beats"), body1TextProvider: beatProvider, body2TextProvider: dateProvider) + return CLKComplicationTemplateModularLargeStandardBody(headerTextProvider: CLKSimpleTextProvider(text: ".Beats"), body1TextProvider: beatProvider, body2TextProvider: dateProvider) case .utilitarianSmall: // Create a template from the utilitarian small family. - beatProvider = CLKSimpleTextProvider( - text: "@" + beatTime, - shortText: "@") return CLKComplicationTemplateUtilitarianSmallRingText(textProvider: beatProvider, fillFraction: (Float(beatTime)!/1000), ringStyle: CLKComplicationRingStyle.closed) case .utilitarianSmallFlat: // Create a template from the utilitarian small flat family. return CLKComplicationTemplateUtilitarianSmallFlat(textProvider: beatProvider) case .graphicCircular: // Create a template from the graphic Circular family. + //beatProvider = CLKSimpleTextProvider(text: beatTime) return CLKComplicationTemplateGraphicCircularClosedGaugeText(gaugeProvider: CLKSimpleGaugeProvider(style: CLKGaugeProviderStyle.fill, gaugeColor: gaugeColor, fillFraction: (Float(beatTime)!/1000)), centerTextProvider: beatProvider) case .graphicRectangular: // Create a template from the graphic Rectangular family. - return CLKComplicationTemplateGraphicRectangularTextGauge(headerTextProvider: CLKSimpleTextProvider(text: "@Beats"), body1TextProvider: beatProvider, gaugeProvider: CLKSimpleGaugeProvider(style: CLKGaugeProviderStyle.fill, gaugeColor: gaugeColor, fillFraction: (Float(beatTime)!/1000))) + return CLKComplicationTemplateGraphicRectangularTextGauge(headerTextProvider: CLKSimpleTextProvider(text: ".Beats"), body1TextProvider: beatProvider, gaugeProvider: CLKSimpleGaugeProvider(style: CLKGaugeProviderStyle.fill, gaugeColor: gaugeColor, fillFraction: (Float(beatTime)!/1000))) + case .graphicCorner: + // Create a template from the graphic Corner family. + return CLKComplicationTemplateGraphicCornerGaugeText(gaugeProvider: CLKSimpleGaugeProvider(style: CLKGaugeProviderStyle.fill, gaugeColor: gaugeColor, fillFraction: (Float(beatTime)!/1000)), outerTextProvider: beatProvider) + case .extraLarge: + // Create a template from the extra large watch face. + //beatProvider = CLKSimpleTextProvider(text: beatTime) + return CLKComplicationTemplateExtraLargeRingText(textProvider: beatProvider, fillFraction: (Float(beatTime)!/1000), ringStyle: CLKComplicationRingStyle.closed) + case .graphicExtraLarge: + // Create a template from the graphic extra large watch face. + //beatProvider = CLKSimpleTextProvider(text: beatTime) + return CLKComplicationTemplateGraphicExtraLargeCircularClosedGaugeText(gaugeProvider: CLKSimpleGaugeProvider(style: CLKGaugeProviderStyle.fill, gaugeColor: gaugeColor, fillFraction: (Float(beatTime)!/1000)), centerTextProvider: beatProvider) default: return nil } @@ -55,7 +64,7 @@ class ComplicationController: NSObject, CLKComplicationDataSource { func getComplicationDescriptors(handler: @escaping ([CLKComplicationDescriptor]) -> Void) { let descriptors = [ - CLKComplicationDescriptor(identifier: "org.mulot.beattime.BeatTimeWatchOS", displayName: "Beats Time", supportedFamilies: [.circularSmall, .modularSmall, .modularLarge, .utilitarianSmall, .utilitarianSmallFlat, .graphicCircular, .graphicRectangular]), + CLKComplicationDescriptor(identifier: "org.mulot.beattime.BeatTimeWatchOS", displayName: "Beats Time", supportedFamilies: [.circularSmall, .modularSmall, .modularLarge, .utilitarianSmall, .utilitarianSmallFlat, .graphicCircular, .graphicRectangular, .graphicCorner, .extraLarge, .graphicExtraLarge]), // Multiple complication support can be added here with more descriptors ]