Skip to content
Open
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
11 changes: 8 additions & 3 deletions Mac/Preferences/General/GeneralPrefencesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ private extension GeneralPreferencesViewController {
let defaultBrowser = MacWebBrowser.default

let defaultBrowserFormat = NSLocalizedString("System Default (%@)", comment: "Default browser item title format")
let defaultBrowserTitle = String(format: defaultBrowserFormat, defaultBrowser.name!)
let defaultBrowserTitle = String(format: defaultBrowserFormat, defaultBrowser.name ?? "")
let item = NSMenuItem(title: defaultBrowserTitle, action: nil, keyEquivalent: "")
let icon = defaultBrowser.icon!
let icon = defaultBrowser.icon ?? NSWorkspace.shared.icon(for: UTType.applicationBundle)
icon.size = NSSize(width: 16.0, height: 16.0)
item.image = icon

Expand All @@ -163,7 +163,12 @@ private extension GeneralPreferencesViewController {
menu.addItem(item)
}

defaultBrowserPopup.selectItem(at: defaultBrowserPopup.indexOfItem(withRepresentedObject: AppDefaults.shared.defaultBrowserID))
if let savedID = AppDefaults.shared.defaultBrowserID {
let index = defaultBrowserPopup.indexOfItem(withRepresentedObject: savedID)
defaultBrowserPopup.selectItem(at: index == -1 ? 0 : index)
} else {
defaultBrowserPopup.selectItem(at: 0)
}
}

func updateNotificationSettings() {
Expand Down
2 changes: 1 addition & 1 deletion Modules/RSWeb/Sources/RSWeb/MacWebBrowser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import UniformTypeIdentifiers

/// The filesystem URL of the default web browser.
private class var defaultBrowserURL: URL? {
return NSWorkspace.shared.urlForApplication(toOpen: URL(string: "https:///")!)
return NSWorkspace.shared.urlForApplication(toOpen: URL(string: "https://apple.com/")!)
}

/// The user's default web browser.
Expand Down