Skip to content

Commit

Permalink
Merge branch 'dev' into sjmarf/favorite-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf authored Jan 16, 2024
2 parents 7f875c8 + e4ca276 commit 6c7f273
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Mlem/Enums/Settings/PostSortType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ enum PostSortType: String, Codable, CaseIterable, Identifiable {
case .topHour:
return "Top of the last hour"
case .topSixHour:
return "Top of the last six hours"
return "Top of the last 6 hours"
case .topTwelveHour:
return "Top of the last twelve hours"
return "Top of the last 12 hours"
case .topDay:
return "Top of today"
case .topWeek:
Expand Down Expand Up @@ -164,9 +164,9 @@ extension PostSortType: SettingsOptions {
case .topHour:
return "Hour"
case .topSixHour:
return "Six Hours"
return "6 Hours"
case .topTwelveHour:
return "Twelve Hours"
return "12 Hours"
case .topDay:
return "Day"
case .topWeek:
Expand Down
12 changes: 8 additions & 4 deletions Mlem/Logic/URLHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ class URLHandler {
guard let scheme = url.scheme, scheme.hasPrefix("http") else {
return .init(result: .systemAction, action: .error("This type of link is not currently supported 😞"))
}

Task { @MainActor in
let viewController = SFSafariViewController(url: url, configuration: .default)
UIApplication.shared.firstKeyWindow?.rootViewController?.topMostViewController().present(viewController, animated: true)
let openLinksInBrowser = UserDefaults.standard.bool(forKey: "openLinksInBrowser")
if openLinksInBrowser {
UIApplication.shared.open(url)
} else {
Task { @MainActor in
let viewController = SFSafariViewController(url: url, configuration: .default)
UIApplication.shared.firstKeyWindow?.rootViewController?.topMostViewController().present(viewController, animated: true)
}
}

return .init(result: .handled, action: nil)
Expand Down
4 changes: 2 additions & 2 deletions Mlem/Views/Shared/Comments/Comment Item Logic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ extension CommentItem {

// upvote
let (upvoteText, upvoteImg) = hierarchicalComment.commentView.myVote == .upvote ?
("Undo upvote", Icons.upvoteSquareFill) :
("Undo Upvote", Icons.upvoteSquareFill) :
("Upvote", Icons.upvoteSquare)
ret.append(MenuFunction.standardMenuFunction(
text: upvoteText,
Expand All @@ -166,7 +166,7 @@ extension CommentItem {

// downvote
let (downvoteText, downvoteImg) = hierarchicalComment.commentView.myVote == .downvote ?
("Undo downvote", Icons.downvoteSquareFill) :
("Undo Downvote", Icons.downvoteSquareFill) :
("Downvote", Icons.downvoteSquare)
ret.append(MenuFunction.standardMenuFunction(
text: downvoteText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct GeneralSettingsView: View {
@AppStorage("upvoteOnSave") var upvoteOnSave: Bool = false

@AppStorage("showSettingsIcons") var showSettingsIcons: Bool = false
@AppStorage("openLinksInBrowser") var openLinksInBrowser: Bool = false

@EnvironmentObject var appState: AppState

Expand All @@ -30,6 +31,11 @@ struct GeneralSettingsView: View {
var body: some View {
List {
Section {
SwitchableSettingsItem(
settingPictureSystemName: Icons.browser,
settingName: "Open Links in Browser",
isTicked: $openLinksInBrowser
)
SelectableSettingsItem(
settingIconSystemName: Icons.haptics,
settingName: "Haptic Level",
Expand Down

0 comments on commit 6c7f273

Please sign in to comment.