diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index f57bcc2d..1ee760f6 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -37,7 +37,6 @@ B343F885295F7C5D002B1159 /* tlv.c in Sources */ = {isa = PBXBuildFile; fileRef = B343F87B295F7C5D002B1159 /* tlv.c */; }; B343F895295F7FAC002B1159 /* libfragmentzip.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B343F894295F7F9B002B1159 /* libfragmentzip.a */; }; B376FE3E29258C8900E18883 /* OSLog+SideStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B376FE3D29258C8900E18883 /* OSLog+SideStore.swift */; }; - B3919A52292DBE5400519575 /* ProgressRing.swift in Sources */ = {isa = PBXBuildFile; fileRef = D504F42528AD72C50014BB5D /* ProgressRing.swift */; }; B39575F5284F29E20080B4FF /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B39575F4284F29E20080B4FF /* Roxas.framework */; }; B39F16132918D7C5002E9404 /* Consts.swift in Sources */ = {isa = PBXBuildFile; fileRef = B39F16122918D7C5002E9404 /* Consts.swift */; }; B39F16152918D7DA002E9404 /* Consts+Proxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B39F16142918D7DA002E9404 /* Consts+Proxy.swift */; }; @@ -820,7 +819,6 @@ BFF7C906257844C900E55F36 /* AltXPCProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AltXPCProtocol.h; sourceTree = ""; }; 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 = ""; }; - 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; }; @@ -978,6 +976,13 @@ name = Products; sourceTree = ""; }; + B33FFB8F295F8CF2002259E6 /* Recovered References */ = { + isa = PBXGroup; + children = ( + ); + name = "Recovered References"; + sourceTree = ""; + }; B343F848295F6321002B1159 /* Products */ = { isa = PBXGroup; children = ( @@ -1414,7 +1419,6 @@ BF42345825101C1D006D1EB2 /* WidgetView.swift */, BF98917C250AAC4F002ACF50 /* Countdown.swift */, D55E163528776CB000A627A1 /* ComplicationView.swift */, - D504F42528AD72C50014BB5D /* ProgressRing.swift */, BF989170250AABF4002ACF50 /* Assets.xcassets */, BF989172250AABF4002ACF50 /* Info.plist */, ); @@ -1503,6 +1507,7 @@ BFD247852284BB3300981D42 /* Frameworks */, B3146EC6284F580500BBC3FD /* Roxas.xcodeproj */, BFD2476B2284B9A500981D42 /* Products */, + B33FFB8F295F8CF2002259E6 /* Recovered References */, ); sourceTree = ""; }; @@ -2407,7 +2412,6 @@ BF42345A25101C35006D1EB2 /* WidgetView.swift in Sources */, D55E163728776CB700A627A1 /* ComplicationView.swift in Sources */, BF98917F250AAC4F002ACF50 /* AltWidget.swift in Sources */, - B3919A52292DBE5400519575 /* ProgressRing.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/AltWidget/ComplicationView.swift b/AltWidget/ComplicationView.swift index 5c0a4c1c..08ccd62d 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)) - } -}