Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Dangerfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ func checkDescriptionSection() {

func commentDescriptionSection(desc: String) {
let count = desc.trimmingCharacters(in: .whitespacesAndNewlines).count
if count == 0 {
if count == 0 { // swiftlint:disable:this empty_count
Copy link
Contributor Author

@NicolasCombe5555 NicolasCombe5555 Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule does not make sense here because count is an Int

I bumped into this because my git pre-push hook wasn't allowing me to push.

Let me know if I should revert this since its unrelated.

fail("""
Details needed! Your description section is empty. Adding a bit more context will make reviews smoother.
""")
Expand Down
17 changes: 10 additions & 7 deletions focus-ios/OpenInFocus/ActionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ extension NSItemProvider {
}
}

class ActionViewController: SLComposeServiceViewController {
private var isKlar: Bool { return (Bundle.main.infoDictionary!["CFBundleIdentifier"] as! String).contains("Klar") }
final class ActionViewController: SLComposeServiceViewController {
private var isKlar: Bool {
guard let string = Bundle.main.infoDictionary?["CFBundleIdentifier"] as? String else { return false }
Copy link
Contributor Author

@NicolasCombe5555 NicolasCombe5555 Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this duplicated so adding the file in the same PR.

I was thinking of making an extension on Bundle since its duplicated but wasn't sure where, I don't think its a big deal.

Let me know if otherwise where should I add it.

return string.contains("Klar")
}
private var urlScheme: String { return isKlar ? "firefox-klar" : "firefox-focus" }

override func isContentValid() -> Bool { return true }
Expand Down Expand Up @@ -97,21 +100,21 @@ class ActionViewController: SLComposeServiceViewController {
}

private func handleUrl(_ url: NSURL) {
// From http://stackoverflow.com/questions/24297273/openurl-not-work-in-action-extension
// From https://stackoverflow.com/questions/24297273/openurl-not-work-in-action-extension
var responder = self as UIResponder?
let selectorOpenURL = sel_registerName("openURL:")
while responder != nil {
while let currentResponder = responder {
if #available(iOS 18.0, *) {
if let application = responder as? UIApplication {
application.open(url as URL, options: [:], completionHandler: nil)
}
} else {
if responder!.responds(to: selectorOpenURL) {
responder!.callSelector(selector: selectorOpenURL, object: url, delay: 0)
if currentResponder.responds(to: selectorOpenURL) {
currentResponder.callSelector(selector: selectorOpenURL, object: url, delay: 0)
}
}

responder = responder!.next
responder = currentResponder.next
}
finish()
}
Expand Down
7 changes: 5 additions & 2 deletions focus-ios/Widgets/Widgets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ struct FocusWidgets_Previews: PreviewProvider {

fileprivate extension String {
static var appNameForBundle: String {
var isKlar: Bool { return (Bundle.main.infoDictionary!["CFBundleIdentifier"] as! String).contains("Klar") }
var isKlar: Bool {
guard let string = Bundle.main.infoDictionary?["CFBundleIdentifier"] as? String else { return false }
return string.contains("Klar")
}
return isKlar ? "Klar" : "Focus"
}
// Quick Action - Small Size - Gallery View
Expand Down Expand Up @@ -100,7 +103,7 @@ fileprivate extension Bool {
}

fileprivate extension URL {
static let deepLinkURL = URL(string: "firefox-focus://widget")!
static let deepLinkURL = URL(string: "firefox-focus://widget")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

34 accepts URL?

}

fileprivate extension View {
Expand Down