diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index fb83199f..8d25ff96 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -348,7 +348,6 @@ BFF7C90F257844C900E55F36 /* AltXPC.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = BFF7C904257844C900E55F36 /* AltXPC.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; BFF7C920257844FA00E55F36 /* ALTPluginService.m in Sources */ = {isa = PBXBuildFile; fileRef = BF5C5FCE237DF69100EDD0C6 /* ALTPluginService.m */; }; BFF7C9342578492100E55F36 /* ALTAnisetteData.m in Sources */ = {isa = PBXBuildFile; fileRef = BFB49AA823834CF900D542D9 /* ALTAnisetteData.m */; }; - D504F42628AD72C50014BB5D /* ProgressRing.swift in Sources */ = {isa = PBXBuildFile; fileRef = D504F42528AD72C50014BB5D /* ProgressRing.swift */; }; D52C08EE28AEC37A006C4AE5 /* AppVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52C08ED28AEC37A006C4AE5 /* AppVersion.swift */; }; D533E8B72727841800A9B5DD /* libAppleArchive.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = D533E8B62727841800A9B5DD /* libAppleArchive.tbd */; settings = {ATTRIBUTES = (Weak, ); }; }; D533E8BC2727BBEE00A9B5DD /* libfragmentzip.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D533E8BB2727BBEE00A9B5DD /* libfragmentzip.a */; }; @@ -819,7 +818,6 @@ BFF7EC4C25081E9300BDE521 /* AltStore 8.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "AltStore 8.xcdatamodel"; sourceTree = ""; }; BFFCFA45248835530077BFCE /* AltDaemon.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = AltDaemon.entitlements; sourceTree = ""; }; C9EEAA842DA87A88A870053B /* Pods_AltStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AltStore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D504F42528AD72C50014BB5D /* ProgressRing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressRing.swift; sourceTree = ""; }; D52C08ED28AEC37A006C4AE5 /* AppVersion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppVersion.swift; sourceTree = ""; }; D52E988928D002D30032BE6B /* AltStore 11.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "AltStore 11.xcdatamodel"; sourceTree = ""; }; D533E8B62727841800A9B5DD /* libAppleArchive.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libAppleArchive.tbd; path = usr/lib/libAppleArchive.tbd; sourceTree = SDKROOT; }; @@ -1420,7 +1418,6 @@ BF42345825101C1D006D1EB2 /* WidgetView.swift */, BF98917C250AAC4F002ACF50 /* Countdown.swift */, D55E163528776CB000A627A1 /* ComplicationView.swift */, - D504F42528AD72C50014BB5D /* ProgressRing.swift */, BF989170250AABF4002ACF50 /* Assets.xcassets */, BF989172250AABF4002ACF50 /* Info.plist */, ); @@ -2582,7 +2579,6 @@ BF42345A25101C35006D1EB2 /* WidgetView.swift in Sources */, D55E163728776CB700A627A1 /* ComplicationView.swift in Sources */, BF98917F250AAC4F002ACF50 /* AltWidget.swift in Sources */, - D504F42628AD72C50014BB5D /* ProgressRing.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/AltWidget/ComplicationView.swift b/AltWidget/ComplicationView.swift index 19222926..a4766b67 100644 --- a/AltWidget/ComplicationView.swift +++ b/AltWidget/ComplicationView.swift @@ -23,26 +23,27 @@ struct ComplicationView: View let progress = Double(daysRemaining) / Double(totalDays) - ZStack(alignment: .center) { - ProgressRing(progress: progress) { - if daysRemaining < 0 - { - Text("Expired") - .font(.system(size: 10, weight: .bold)) - } - else - { - VStack(spacing: -1) { - Text("\(daysRemaining)") - .font(.system(size: 20, weight: .bold, design: .rounded)) - - Text(daysRemaining == 1 ? "DAY" : "DAYS") - .font(.caption) - } - .offset(y: -1) + Gauge(value: progress) { + if daysRemaining < 0 + { + Text("Expired") + .font(.system(size: 10, weight: .bold)) + } + else + { + VStack(spacing: -1) { + let fontSize = daysRemaining > 99 ? 18.0 : 20.0 + Text("\(daysRemaining)") + .font(.system(size: fontSize, weight: .bold, design: .rounded)) + + Text(daysRemaining == 1 ? "DAY" : "DAYS") + .font(.caption) } + .fixedSize() + .offset(y: -1) } } + .gaugeStyle(.accessoryCircularCapacity) .unredacted() } } diff --git a/AltWidget/ProgressRing.swift b/AltWidget/ProgressRing.swift deleted file mode 100644 index 4464e20f..00000000 --- a/AltWidget/ProgressRing.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// ProgressRing.swift -// AltWidgetExtension -// -// Created by Riley Testut on 8/17/22. -// Copyright © 2022 Riley Testut. All rights reserved. -// - -import SwiftUI -import WidgetKit - -struct ProgressRing: View -{ - let progress: Double - - private let content: Content - - init(progress: Double, @ViewBuilder content: () -> Content) - { - self.progress = progress - self.content = content() - } - - var body: some View { - ZStack(alignment: .center) { - ring(progress: 1.0) - .opacity(0.3) - - ring(progress: self.progress) - - content - } - } - - @ViewBuilder - private func ring(progress: Double) -> some View { - let strokeStyle = StrokeStyle(lineWidth: 4.0, lineCap: .round, lineJoin: .round) - - Circle() - .inset(by: 2.0) - .trim(from: 0.0, to: progress) - .rotation(Angle(degrees: -90), anchor: .center) - .stroke(style: strokeStyle) - } -} - -struct ProgressRing_Previews: PreviewProvider { - static var previews: some View { - ProgressRing(progress: 0.5) { - EmptyView() - } - .previewContext(WidgetPreviewContext(family: .systemSmall)) - } -}