Skip to content

Commit

Permalink
Merge pull request #163 from hugeBlack/swift
Browse files Browse the repository at this point in the history
Fix #160 and settings view being too wide on iPad
  • Loading branch information
whoeevee authored Jun 2, 2024
2 parents 400a289 + fb5b1d9 commit b424e35
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/EeveeSpotify/Lyrics/Helpers/LyricsHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LyricsHelper {
lyricLines = lines.map { line in

let match = line.firstMatch(
"\\[(?<minute>\\d{2}):(?<seconds>\\d{2}\\.\\d{2})\\] ?(?<content>.*)"
"\\[(?<minute>\\d{2}):(?<seconds>\\d{2}\\.?\\d*)\\] ?(?<content>.*)"
)!

var captures: [String: String] = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ extension UserDefaults {
static var lyricsSource: LyricsSource {
get {
if let rawValue = defaults.object(forKey: lyricsSourceKey) as? Int {
return LyricsSource(rawValue: rawValue)!
if let source = LyricsSource(rawValue: rawValue) {
return source
} else {
return .lrclib
}

}

return .lrclib
Expand Down
2 changes: 1 addition & 1 deletion Sources/EeveeSpotify/Tweak.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ProfileSettingsSectionHook: ClassHook<NSObject> {
"RootSettingsViewController"
)!

let eeveeSettingsController = EeveeSettingsViewController()
let eeveeSettingsController = EeveeSettingsViewController(rootSettingsController.view.bounds)
eeveeSettingsController.title = "EeveeSpotify"

rootSettingsController.navigationController!.pushViewController(
Expand Down
12 changes: 11 additions & 1 deletion Sources/EeveeSpotify/Views/EeveeSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import SwiftUI
import UIKit

class EeveeSettingsViewController: UIViewController {

let frame: CGRect
init(_ frame: CGRect) {
self.frame = frame
super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func conforms(to aProtocol: Protocol) -> Bool {

Expand All @@ -24,7 +34,7 @@ class EeveeSettingsViewController: UIViewController {
super.viewDidLoad()

let hostingController = UIHostingController(rootView: EeveeSettingsView())
hostingController.view.frame = view.bounds
hostingController.view.frame = frame

view.addSubview(hostingController.view)
addChild(hostingController)
Expand Down

0 comments on commit b424e35

Please sign in to comment.