Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic type support #60

Merged
merged 10 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CubeTime.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
230CB290279C07C7008E475E /* SVGKit in Frameworks */ = {isa = PBXBuildFile; productRef = 230CB28F279C07C7008E475E /* SVGKit */; };
230CB292279C07C7008E475E /* SVGKitSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 230CB291279C07C7008E475E /* SVGKitSwift */; };
2319F8B9276872F200644EB3 /* TimeTrend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2319F8B8276872F200644EB3 /* TimeTrend.swift */; };
2324160E2828F5AB0066B3C2 /* SessionBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2324160D2828F5AB0066B3C2 /* SessionBar.swift */; };
2337E6882767619D00438F43 /* StatsDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2337E6872767619D00438F43 /* StatsDetail.swift */; };
233FE7B6274F109600C6F1DF /* Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 233FE7B5274F109600C6F1DF /* Helper.swift */; };
2359689327A367A0003ED9E1 /* StopwatchManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2359689227A367A0003ED9E1 /* StopwatchManager.swift */; };
Expand Down Expand Up @@ -90,6 +91,7 @@
23034724278BD22600553A7D /* TimeDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeDetail.swift; sourceTree = "<group>"; };
23034728278C32CC00553A7D /* RecursiveSansLnrSt-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "RecursiveSansLnrSt-Regular.ttf"; sourceTree = "<group>"; };
2319F8B8276872F200644EB3 /* TimeTrend.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeTrend.swift; sourceTree = "<group>"; };
2324160D2828F5AB0066B3C2 /* SessionBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionBar.swift; sourceTree = "<group>"; };
2337E6872767619D00438F43 /* StatsDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatsDetail.swift; sourceTree = "<group>"; };
233FE7B5274F109600C6F1DF /* Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Helper.swift; sourceTree = "<group>"; };
2354882227642E2800FE8D7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -247,6 +249,7 @@
239C7E6F2781511300943AF2 /* Onboarding.swift */,
235CDA0227A786D800F48C89 /* Updates.swift */,
233FE7B5274F109600C6F1DF /* Helper.swift */,
2324160D2828F5AB0066B3C2 /* SessionBar.swift */,
23D01FE227A4AA5D0019FCE5 /* Splash.storyboard */,
7D7C45C42751DE2C0073885C /* 3rdparty-Bridging-Header.h */,
23DE3BDE274DDBE300254D29 /* Assets.xcassets */,
Expand Down Expand Up @@ -496,6 +499,7 @@
237B35502761995F00CC39BF /* SettingsCard.swift in Sources */,
7D78FF8E276087AF008BB82E /* BottomTabsView.swift in Sources */,
23DE3BDB274DDBE200254D29 /* CubeTimeApp.swift in Sources */,
2324160E2828F5AB0066B3C2 /* SessionBar.swift in Sources */,
7D7DDF2327955AFF00362DE9 /* PenButton.swift in Sources */,
23E647C62775B2AC00561780 /* TimeDistribution.swift in Sources */,
235CDA0327A786D800F48C89 /* Updates.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"object": {
"pins": [
{
"package": "CocoaLumberjack",
"repositoryURL": "https://github.com/CocoaLumberjack/CocoaLumberjack.git",
"state": {
"branch": null,
"revision": "80ada1f753b0d53d9b57c465936a7c4169375002",
"version": "3.7.4"
}
},
{
"package": "SVGKit",
"repositoryURL": "https://github.com/SVGKit/SVGKit",
"state": {
"branch": "3.x",
"revision": "e9bc636845fb4d6d5d8e25a9bd08e75c5cf92de9",
"version": null
}
},
{
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
"state": {
"branch": null,
"revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7",
"version": "1.4.2"
}
}
]
},
"version": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand Down
134 changes: 0 additions & 134 deletions CubeTime.xcodeproj/xcshareddata/xcschemes/txmer.xcscheme

This file was deleted.

2 changes: 2 additions & 0 deletions CubeTime/CubeTimeApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ struct CubeTime: App {
// accessibility
gsKeys.hapBool.rawValue: true,
gsKeys.hapType.rawValue: UIImpactFeedbackGenerator.FeedbackStyle.rigid.rawValue,
gsKeys.forceAppZoom.rawValue: false,
gsKeys.appZoom.rawValue: 3,
gsKeys.scrambleSize.rawValue: 18,
gsKeys.gestureDistance.rawValue: 50,

Expand Down
38 changes: 27 additions & 11 deletions CubeTime/Helper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,33 @@ struct AnimatingFontSize: AnimatableModifier {
}


@available(iOS 15, *)
struct ScaledCustomFont: ViewModifier {
@Environment(\.sizeCategory) var sizeCategory

var name: String
var size: CGFloat
var sf: Bool
var weight: Font.Weight?

func body(content: Content) -> some View {
let scaledSize = UIFontMetrics.default.scaledValue(for: size)
if sf {
return content.font(.system(size: scaledSize, weight: weight ?? .regular, design: .default))
} else {
return content.font(.custom(name, size: scaledSize))
}
}
}

@available(iOS 15, *)
extension View {
func scaledCustomFont(name: String, size: CGFloat, sf: Bool, weight: Font.Weight?) -> some View {
return self.modifier(ScaledCustomFont(name: name, size: size, sf: sf, weight: weight))
}
}



func formatSolveTime(secs: Double, dp: Int) -> String {
if secs < 60 {
Expand Down Expand Up @@ -383,18 +410,7 @@ func timeFromStr(_ formattedTime: String) -> Double? {
}

class SetValues {


static let tabBarHeight = 50
static let marginLeftRight = 16
static let paddingIcons = 14
static let spacingIcons = 20
static let marginBottom = 16
static let iconFontSize = CGFloat(22)

static let hasBottomBar = ((UIApplication.shared.connectedScenes.first as? UIWindowScene)?.windows.first?.safeAreaInsets.bottom)! > 0

// static let hasBottomBar = UIApplication.shared.windows[0].safeAreaInsets.bottom > 0 /// deprecated
}

class TimerTextColours {
Expand Down
Loading