diff --git a/Source/App/AppConfiguration+Data.swift b/Source/App/AppConfiguration+Data.swift index a654084457..d33ef71926 100644 --- a/Source/App/AppConfiguration+Data.swift +++ b/Source/App/AppConfiguration+Data.swift @@ -18,9 +18,10 @@ extension AppConfiguration { } static func from(_ data: Data) -> AppConfiguration? { - guard let object = try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) else { return nil } - let configuration = object as? AppConfiguration - if configuration == nil { Log.unexpected(.missingValue, "Configuration could not be unarchived") } + guard let configuration = try? NSKeyedUnarchiver.unarchivedObject(ofClass: AppConfiguration.self, from: data) else { + Log.unexpected(.missingValue, "Configuration could not be unarchived") + return nil + } return configuration } } diff --git a/Source/Controller/BlobViewController.swift b/Source/Controller/BlobViewController.swift index 414c634983..743c40a4e4 100644 --- a/Source/Controller/BlobViewController.swift +++ b/Source/Controller/BlobViewController.swift @@ -58,6 +58,10 @@ class BlobViewController: ContentViewController { forgetBlobCompletion() Task { @MainActor [weak self] in + guard let blob = self?.blob else { + return + } + // cached image if let uiImage = Caches.blobs.image(for: blob) { self?.imageView.image = uiImage diff --git a/Source/Controller/LaunchViewController.swift b/Source/Controller/LaunchViewController.swift index 4624fc8023..ba424e02e7 100644 --- a/Source/Controller/LaunchViewController.swift +++ b/Source/Controller/LaunchViewController.swift @@ -82,7 +82,7 @@ class LaunchViewController: UIViewController { } // if no configuration then onboard - guard var configuration = appConfiguration else { + guard let configuration = appConfiguration else { launchIntoOnboarding() return } diff --git a/Source/Controller/ThreadViewController.swift b/Source/Controller/ThreadViewController.swift index d98a9c014c..d3191b6dfd 100644 --- a/Source/Controller/ThreadViewController.swift +++ b/Source/Controller/ThreadViewController.swift @@ -351,7 +351,6 @@ class ThreadViewController: ContentViewController { let post = Post(attributedText: text, root: self.rootKey, branches: [self.branchKey]) let images = self.galleryView.images let draftStore = draftStore - let textValue = AttributedString(text) Task.detached(priority: .userInitiated) { do { let messageID = try await Bots.current.publish(post, with: images) diff --git a/Source/Onboarding/Steps/JoinOnboardingStep.swift b/Source/Onboarding/Steps/JoinOnboardingStep.swift index ab17fbc912..1a97eae62e 100644 --- a/Source/Onboarding/Steps/JoinOnboardingStep.swift +++ b/Source/Onboarding/Steps/JoinOnboardingStep.swift @@ -34,7 +34,7 @@ import CrashReporting } Task { [weak self] in - var context: Onboarding.Context? + let context: Onboarding.Context? do { context = try await Onboarding.createProfile(from: data) diff --git a/Source/UI/Identity/ImageMetadataView.swift b/Source/UI/Identity/ImageMetadataView.swift index 4a3aaa873b..2e859d1361 100644 --- a/Source/UI/Identity/ImageMetadataView.swift +++ b/Source/UI/Identity/ImageMetadataView.swift @@ -67,7 +67,7 @@ fileprivate class ImageLoader: ObservableObject { await MainActor.run { [weak self] in guard let metadata = metadata, metadata.link != .null else { - isLoading = false + self?.isLoading = false return } diff --git a/Source/UI/ManageAliasView.swift b/Source/UI/ManageAliasView.swift index fdfead6d9b..05db00795a 100644 --- a/Source/UI/ManageAliasView.swift +++ b/Source/UI/ManageAliasView.swift @@ -19,7 +19,7 @@ struct RoomAlias: Identifiable { var authorID: Int64 var alias: String { - var components = string.replacingOccurrences(of: "https://", with: "") + let components = string.replacingOccurrences(of: "https://", with: "") .replacingOccurrences(of: "http://", with: "") .components(separatedBy: ".") return components.joined(separator: ".")