Merge pull request #4246 from heckj/some-concurrency-warning-fixes
a suite of small concurrency warning fixes
This commit is contained in:
commit
ca89214903
|
@ -20,6 +20,14 @@ public typealias RSImage = UIImage
|
||||||
|
|
||||||
public extension RSImage {
|
public extension RSImage {
|
||||||
|
|
||||||
|
#if os(macOS)
|
||||||
|
static let maxScreenScale = CGFloat(2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if os(iOS)
|
||||||
|
static let maxScreenScale = CGFloat(3)
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Create a colored image from the source image using a specified color.
|
/// Create a colored image from the source image using a specified color.
|
||||||
///
|
///
|
||||||
/// - Parameter color: The color with which to fill the mask image.
|
/// - Parameter color: The color with which to fill the mask image.
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
//
|
|
||||||
// RSScreen.swift
|
|
||||||
// RSCore
|
|
||||||
//
|
|
||||||
// Created by Maurice Parker on 4/11/19.
|
|
||||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#if os(macOS)
|
|
||||||
import AppKit
|
|
||||||
|
|
||||||
public class RSScreen {
|
|
||||||
public static var maxScreenScale = CGFloat(2)
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if os(iOS)
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
public class RSScreen {
|
|
||||||
public static var maxScreenScale = CGFloat(3)
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -71,6 +71,7 @@ struct AppAssets {
|
||||||
|
|
||||||
static let legacyArticleExtractorProgress4 = NSImage(named: "legacyArticleExtractorProgress4")
|
static let legacyArticleExtractorProgress4 = NSImage(named: "legacyArticleExtractorProgress4")
|
||||||
|
|
||||||
|
@MainActor
|
||||||
static let folderImage: IconImage = {
|
static let folderImage: IconImage = {
|
||||||
let image = NSImage(systemSymbolName: "folder", accessibilityDescription: nil)!
|
let image = NSImage(systemSymbolName: "folder", accessibilityDescription: nil)!
|
||||||
let preferredColor = NSColor(named: "AccentColor")!
|
let preferredColor = NSColor(named: "AccentColor")!
|
||||||
|
@ -96,6 +97,7 @@ struct AppAssets {
|
||||||
|
|
||||||
static let refreshImage = NSImage(systemSymbolName: "arrow.clockwise", accessibilityDescription: nil)!
|
static let refreshImage = NSImage(systemSymbolName: "arrow.clockwise", accessibilityDescription: nil)!
|
||||||
|
|
||||||
|
@MainActor
|
||||||
static let searchFeedImage: IconImage = {
|
static let searchFeedImage: IconImage = {
|
||||||
return IconImage(NSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true, isBackgroundSupressed: true)
|
return IconImage(NSImage(named: NSImage.smartBadgeTemplateName)!, isSymbol: true, isBackgroundSupressed: true)
|
||||||
}()
|
}()
|
||||||
|
@ -108,6 +110,7 @@ struct AppAssets {
|
||||||
|
|
||||||
static let starOpenImage = NSImage(systemSymbolName: "star", accessibilityDescription: nil)!
|
static let starOpenImage = NSImage(systemSymbolName: "star", accessibilityDescription: nil)!
|
||||||
|
|
||||||
|
@MainActor
|
||||||
static let starredFeedImage: IconImage = {
|
static let starredFeedImage: IconImage = {
|
||||||
let image = NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)!
|
let image = NSImage(systemSymbolName: "star.fill", accessibilityDescription: nil)!
|
||||||
let preferredColor = NSColor(named: "StarColor")!
|
let preferredColor = NSColor(named: "StarColor")!
|
||||||
|
@ -121,6 +124,7 @@ struct AppAssets {
|
||||||
|
|
||||||
static let timelineStarUnselected = NSImage(named: "timelineStar")?.tinted(with: starColor)
|
static let timelineStarUnselected = NSImage(named: "timelineStar")?.tinted(with: starColor)
|
||||||
|
|
||||||
|
@MainActor
|
||||||
static let todayFeedImage: IconImage = {
|
static let todayFeedImage: IconImage = {
|
||||||
let image = NSImage(systemSymbolName: "sun.max.fill", accessibilityDescription: nil)!
|
let image = NSImage(systemSymbolName: "sun.max.fill", accessibilityDescription: nil)!
|
||||||
let preferredColor = NSColor.orange
|
let preferredColor = NSColor.orange
|
||||||
|
@ -128,6 +132,7 @@ struct AppAssets {
|
||||||
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
return IconImage(coloredImage, isSymbol: true, isBackgroundSupressed: true, preferredColor: preferredColor.cgColor)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@MainActor
|
||||||
static let unreadFeedImage: IconImage = {
|
static let unreadFeedImage: IconImage = {
|
||||||
let image = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)!
|
let image = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)!
|
||||||
let preferredColor = NSColor(named: "AccentColor")!
|
let preferredColor = NSColor(named: "AccentColor")!
|
||||||
|
|
|
@ -10,6 +10,14 @@ import AppKit
|
||||||
import Account
|
import Account
|
||||||
import os.log
|
import os.log
|
||||||
|
|
||||||
|
// asserts that OSLog is a sendable type
|
||||||
|
// @preconcurrency import os.log _should_ resolve the warning in this scenario, but does
|
||||||
|
// not due to a bug (in Swift 5.10)
|
||||||
|
#if swift(>=6.0)
|
||||||
|
#warning("Reevaluate whether this Sendable decoration is still needed for OSLog.")
|
||||||
|
#endif
|
||||||
|
extension OSLog: @unchecked Sendable { }
|
||||||
|
|
||||||
struct ErrorHandler {
|
struct ErrorHandler {
|
||||||
|
|
||||||
private static let log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Account")
|
private static let log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Account")
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
struct ArticleTheme: Equatable {
|
struct ArticleTheme: Equatable, Sendable {
|
||||||
|
|
||||||
static let defaultTheme = ArticleTheme()
|
static let defaultTheme = ArticleTheme()
|
||||||
static let nnwThemeSuffix = ".nnwtheme"
|
static let nnwThemeSuffix = ".nnwtheme"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public struct ArticleThemePlist: Codable, Equatable {
|
public struct ArticleThemePlist: Codable, Equatable, Sendable {
|
||||||
public var name: String
|
public var name: String
|
||||||
public var themeIdentifier: String
|
public var themeIdentifier: String
|
||||||
public var creatorHomePage: String
|
public var creatorHomePage: String
|
||||||
|
|
|
@ -27,7 +27,7 @@ extension RSImage {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension IconImage {
|
extension IconImage {
|
||||||
static var appIcon: IconImage? = {
|
static let appIcon: IconImage? = {
|
||||||
if let image = RSImage.appIconImage {
|
if let image = RSImage.appIconImage {
|
||||||
return IconImage(image)
|
return IconImage(image)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ extension RSImage {
|
||||||
}
|
}
|
||||||
|
|
||||||
static func scaledForIcon(_ data: Data) -> RSImage? {
|
static func scaledForIcon(_ data: Data) -> RSImage? {
|
||||||
let scaledMaxPixelSize = Int(ceil(CGFloat(RSImage.maxIconSize) * RSScreen.maxScreenScale))
|
let scaledMaxPixelSize = Int(ceil(CGFloat(RSImage.maxIconSize) * maxScreenScale))
|
||||||
guard var cgImage = RSImage.scaleImage(data, maxPixelSize: scaledMaxPixelSize) else {
|
guard var cgImage = RSImage.scaleImage(data, maxPixelSize: scaledMaxPixelSize) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue