Swiftformat fixes

This commit is contained in:
Arkadiusz Fal
2024-05-16 18:28:32 +02:00
parent 4b21cd48e3
commit 7741e531f4
28 changed files with 57 additions and 65 deletions

View File

@@ -111,12 +111,13 @@ extension VideosAPI {
func shareURL(_ item: ContentItem, frontendURLString: String? = nil, time: CMTime? = nil) -> URL? {
var urlComponents: URLComponents?
if let frontendURLString,
let frontendURL = URL(string: frontendURLString) {
let frontendURL = URL(string: frontendURLString)
{
urlComponents = URLComponents(URL: frontendURL, resolvingAgainstBaseURL: false)
} else if let instanceComponents = account?.instance?.urlComponents {
urlComponents = instanceComponents
}
guard var urlComponents else {
return nil
}

View File

@@ -22,7 +22,7 @@ struct BrowsingSettingsGroupImporter {
}
if let favorites = json["favorites"].array {
favorites.forEach { favoriteJSON in
for favoriteJSON in favorites {
if let jsonString = favoriteJSON.rawString(options: []),
let item = FavoriteItem.bridge.deserialize(jsonString)
{
@@ -32,7 +32,7 @@ struct BrowsingSettingsGroupImporter {
}
if let widgetsFavorites = json["widgetsSettings"].array {
widgetsFavorites.forEach { widgetJSON in
for widgetJSON in widgetsFavorites {
let dict = widgetJSON.dictionaryValue.mapValues { json in json.stringValue }
if let item = WidgetSettingsBridge().deserialize(dict) {
FavoritesModel.shared.updateWidgetSettings(item)

View File

@@ -56,7 +56,7 @@ struct LocationsSettingsGroupImporter {
}
if let accounts = json["accounts"].array {
accounts.forEach { accountJSON in
for accountJSON in accounts {
let dict = accountJSON.dictionaryValue.mapValues { json in json.stringValue }
if let account = AccountsBridge().deserialize(dict),
includedAccountsIDs.contains(account.id)

View File

@@ -26,7 +26,7 @@ struct QualitySettingsGroupImporter {
}
if let qualityProfiles = json["qualityProfiles"].array {
qualityProfiles.forEach { qualityProfileJSON in
for qualityProfileJSON in qualityProfiles {
let dict = qualityProfileJSON.dictionaryValue.mapValues { json in json.stringValue }
if let item = QualityProfileBridge().deserialize(dict) {
QualityProfilesModel.shared.update(item, item)

View File

@@ -6,7 +6,7 @@ struct RecentlyOpenedImporter {
func performImport() {
if let recentlyOpened = json["recentlyOpened"].array {
recentlyOpened.forEach { recentlyOpenedJSON in
for recentlyOpenedJSON in recentlyOpened {
let dict = recentlyOpenedJSON.dictionaryValue.mapValues { json in json.stringValue }
if let item = RecentItemBridge().deserialize(dict) {
RecentsModel.shared.add(item)

View File

@@ -147,7 +147,7 @@ struct OpenVideosModel {
if prepending {
videos.reverse()
}
videos.forEach { video in
for video in videos {
player.enqueueVideo(video, play: false, prepending: prepending, loadDetails: false)
}
}

View File

@@ -60,21 +60,21 @@ class Stream: Equatable, Hashable, Identifiable {
var bitrate: Int {
switch self {
case .hd2160p60, .hd2160p50, .hd2160p48, .hd2160p30:
return 56000000 // 56 Mbit/s
return 56_000_000 // 56 Mbit/s
case .hd1440p60, .hd1440p50, .hd1440p48, .hd1440p30:
return 24000000 // 24 Mbit/s
return 24_000_000 // 24 Mbit/s
case .hd1080p60, .hd1080p50, .hd1080p48, .hd1080p30:
return 12000000 // 12 Mbit/s
return 12_000_000 // 12 Mbit/s
case .hd720p60, .hd720p50, .hd720p48, .hd720p30:
return 9500000 // 9.5 Mbit/s
return 9_500_000 // 9.5 Mbit/s
case .sd480p30:
return 4000000 // 4 Mbit/s
return 4_000_000 // 4 Mbit/s
case .sd360p30:
return 1500000 // 1.5 Mbit/s
return 1_500_000 // 1.5 Mbit/s
case .sd240p30:
return 1000000 // 1 Mbit/s
return 1_000_000 // 1 Mbit/s
case .sd144p30:
return 600000 // 0.6 Mbit/s
return 600_000 // 0.6 Mbit/s
case .unknown:
return 0
}

View File

@@ -114,7 +114,7 @@ struct URLBookmarkModel {
func refreshAll() {
logger.info("refreshing all bookmarks")
allURLs.forEach { url in
for url in allURLs {
if loadBookmark(url) != nil {
logger.info("bookmark for \(url) exists")
} else {