diff --git a/PocketTrailer/AdvancedSettingsViewController.swift b/PocketTrailer/AdvancedSettingsViewController.swift
index 21735c4c..bf9575a1 100644
--- a/PocketTrailer/AdvancedSettingsViewController.swift
+++ b/PocketTrailer/AdvancedSettingsViewController.swift
@@ -103,7 +103,7 @@ final class AdvancedSettingsViewController: UITableViewController, PickerViewCon
valueDisplayed: { Settings.assignedItemDirectHandlingPolicy.placementName },
optionSelected: { [weak self] originalIndex, section, setting in
guard let self else { return }
- let v = PickerViewController.Info(title: setting.title, values: Section.assignmentPlacementLabels, selectedIndex: Settings.assignedItemDirectHandlingPolicy.assignmentPolictMenuIndex, sourceIndexPath: IndexPath(row: originalIndex, section: section.rawValue))
+ let v = PickerViewController.Info(title: setting.title, values: Section.assignmentPlacementLabels, selectedIndex: Settings.assignedItemDirectHandlingPolicy.assignmentPolicyMenuIndex, sourceIndexPath: IndexPath(row: originalIndex, section: section.rawValue))
performSegue(withIdentifier: "showPicker", sender: v)
}),
Setting(section: .Display,
@@ -112,7 +112,7 @@ final class AdvancedSettingsViewController: UITableViewController, PickerViewCon
valueDisplayed: { Settings.assignedItemTeamHandlingPolicy.placementName },
optionSelected: { [weak self] originalIndex, section, setting in
guard let self else { return }
- let v = PickerViewController.Info(title: setting.title, values: Section.assignmentPlacementLabels, selectedIndex: Settings.assignedItemTeamHandlingPolicy.assignmentPolictMenuIndex, sourceIndexPath: IndexPath(row: originalIndex, section: section.rawValue))
+ let v = PickerViewController.Info(title: setting.title, values: Section.assignmentPlacementLabels, selectedIndex: Settings.assignedItemTeamHandlingPolicy.assignmentPolicyMenuIndex, sourceIndexPath: IndexPath(row: originalIndex, section: section.rawValue))
performSegue(withIdentifier: "showPicker", sender: v)
}),
Setting(section: .Display,
@@ -449,7 +449,7 @@ final class AdvancedSettingsViewController: UITableViewController, PickerViewCon
valueDisplayed: { Settings.assignedDirectReviewHandlingPolicy.placementName },
optionSelected: { [weak self] originalIndex, section, setting in
guard let self else { return }
- let v = PickerViewController.Info(title: setting.title, values: Section.assignmentPlacementLabels, selectedIndex: Settings.assignedDirectReviewHandlingPolicy.assignmentPolictMenuIndex, sourceIndexPath: IndexPath(row: originalIndex, section: section.rawValue))
+ let v = PickerViewController.Info(title: setting.title, values: Section.assignmentPlacementLabels, selectedIndex: Settings.assignedDirectReviewHandlingPolicy.assignmentPolicyMenuIndex, sourceIndexPath: IndexPath(row: originalIndex, section: section.rawValue))
performSegue(withIdentifier: "showPicker", sender: v)
}),
Setting(section: .Reviews,
@@ -458,7 +458,7 @@ final class AdvancedSettingsViewController: UITableViewController, PickerViewCon
valueDisplayed: { Settings.assignedTeamReviewHandlingPolicy.placementName },
optionSelected: { [weak self] originalIndex, section, setting in
guard let self else { return }
- let v = PickerViewController.Info(title: setting.title, values: Section.assignmentPlacementLabels, selectedIndex: Settings.assignedTeamReviewHandlingPolicy.assignmentPolictMenuIndex, sourceIndexPath: IndexPath(row: originalIndex, section: section.rawValue))
+ let v = PickerViewController.Info(title: setting.title, values: Section.assignmentPlacementLabels, selectedIndex: Settings.assignedTeamReviewHandlingPolicy.assignmentPolicyMenuIndex, sourceIndexPath: IndexPath(row: originalIndex, section: section.rawValue))
performSegue(withIdentifier: "showPicker", sender: v)
}),
Setting(section: .Reviews,
diff --git a/Shared/Enums.swift b/Shared/Enums.swift
index 95353e98..911fc2c5 100644
--- a/Shared/Enums.swift
+++ b/Shared/Enums.swift
@@ -258,7 +258,7 @@ enum Section: CaseIterable, Equatable {
}
}
- var assignmentPolictMenuIndex: Int {
+ var assignmentPolicyMenuIndex: Int {
switch self {
case .mine:
return 0
@@ -273,11 +273,11 @@ enum Section: CaseIterable, Equatable {
init(assignmentPolicyMenuIndex: Int) {
switch assignmentPolicyMenuIndex {
- case Section.mine.assignmentPolictMenuIndex:
+ case Section.mine.assignmentPolicyMenuIndex:
self = .mine
- case Section.participated.assignmentPolictMenuIndex:
+ case Section.participated.assignmentPolicyMenuIndex:
self = .participated
- case Section.mentioned.assignmentPolictMenuIndex:
+ case Section.mentioned.assignmentPolicyMenuIndex:
self = .mentioned
default:
self = .hidden(cause: .unknown)
diff --git a/Shared/ListableItem.swift b/Shared/ListableItem.swift
index c52d9a78..d4d03368 100644
--- a/Shared/ListableItem.swift
+++ b/Shared/ListableItem.swift
@@ -327,11 +327,11 @@ class ListableItem: DataItem, Listable {
return true
case .mineAndParticipated:
- let preConditionSection = preferredSection(takingItemConditionIntoAccount: false, settings: settings)
+ let preConditionSection = highestPreferredSection(takingItemConditionIntoAccount: false, settings: settings)
return preConditionSection == .mine || preConditionSection == .participated
case .mine:
- let preConditionSection = preferredSection(takingItemConditionIntoAccount: false, settings: settings)
+ let preConditionSection = highestPreferredSection(takingItemConditionIntoAccount: false, settings: settings)
return preConditionSection == .mine
case .nothing:
@@ -349,10 +349,12 @@ class ListableItem: DataItem, Listable {
return false
case .me:
- return section == settings.assignedItemDirectHandlingPolicy
+ let policy = settings.assignedItemDirectHandlingPolicy
+ return policy.visible && section == policy
case .myTeam:
- return section == settings.assignedItemTeamHandlingPolicy
+ let policy = settings.assignedItemTeamHandlingPolicy
+ return policy.visible && section == policy
}
}
@@ -460,7 +462,7 @@ class ListableItem: DataItem, Listable {
nil
}
- private func preferredSection(takingItemConditionIntoAccount: Bool, settings: Settings.Cache) -> Section {
+ private func highestPreferredSection(takingItemConditionIntoAccount: Bool, settings: Settings.Cache) -> Section {
if takingItemConditionIntoAccount {
if condition == ItemCondition.merged.rawValue {
return .merged
@@ -478,34 +480,42 @@ class ListableItem: DataItem, Listable {
return .mine
}
- if shouldGo(to: .participated, settings: settings) || commentedByMe || reviewedByMe {
- return .participated
- }
+ var targetSection = Section.all
- if shouldGo(to: .mentioned, settings: settings) {
- return .mentioned
+ if targetSection.sectionIndex > Section.participated.sectionIndex,
+ shouldGo(to: .participated, settings: settings) || commentedByMe || reviewedByMe {
+ targetSection = .participated
}
- if let section = preferredSectionBasedOnReviewAssignment {
- return section
+ if targetSection.sectionIndex > Section.mentioned.sectionIndex,
+ shouldGo(to: .mentioned, settings: settings) {
+ targetSection = .mentioned
}
- if let section = settings.preferredMovePolicySection,
+ if let potentialSection = settings.preferredMovePolicySection,
+ potentialSection.sectionIndex < targetSection.sectionIndex,
contains(terms: ["@\(apiServer.userName.orEmpty)"]) {
- return section
+ targetSection = potentialSection
}
- if let section = settings.preferredTeamMentionPolicy,
+ if let potentialSection = settings.preferredTeamMentionPolicy,
+ potentialSection.sectionIndex < targetSection.sectionIndex,
contains(terms: apiServer.teams.compactMap(\.calculatedReferral)) {
- return section
+ targetSection = potentialSection
}
- if let section = settings.newItemInOwnedRepoMovePolicy,
+ if let potentialSection = settings.newItemInOwnedRepoMovePolicy,
+ potentialSection.sectionIndex < targetSection.sectionIndex,
repo.isMine {
- return section
+ targetSection = potentialSection
+ }
+
+ if let potentialSection = preferredSectionBasedOnReviewAssignment,
+ potentialSection.sectionIndex < targetSection.sectionIndex {
+ targetSection = potentialSection
}
- return .all
+ return targetSection
}
func canBadge(in targetSection: Section? = nil, settings: Settings.Cache) -> Bool {
@@ -516,7 +526,7 @@ class ListableItem: DataItem, Listable {
}
if targetSection == .closed || targetSection == .merged {
- return preferredSection(takingItemConditionIntoAccount: false, settings: settings).shouldBadgeComments(settings: settings)
+ return highestPreferredSection(takingItemConditionIntoAccount: false, settings: settings).shouldBadgeComments(settings: settings)
}
return true
@@ -628,8 +638,8 @@ class ListableItem: DataItem, Listable {
?? shouldHideBecauseOfInclusionRules(settings: settings) {
targetSection = .hidden(cause: cause)
} else {
- targetSection = preferredSection(takingItemConditionIntoAccount: true, settings: settings)
-
+ targetSection = highestPreferredSection(takingItemConditionIntoAccount: true, settings: settings)
+
if targetSection.visible, let cause
= shouldHideBecauseOfRepoDisplayPolicy(targetSection: targetSection)
?? shouldHideBecauseOfRedStatuses(in: targetSection, settings: settings) {
diff --git a/Trailer.xcodeproj/project.pbxproj b/Trailer.xcodeproj/project.pbxproj
index 3ce9b744..0698cbdb 100644
--- a/Trailer.xcodeproj/project.pbxproj
+++ b/Trailer.xcodeproj/project.pbxproj
@@ -1627,7 +1627,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1716;
+ CURRENT_PROJECT_VERSION = 1718;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -1653,7 +1653,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
- MARKETING_VERSION = 1.8.10;
+ MARKETING_VERSION = 1.8.11;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "-D DEBUG";
SWIFT_ENFORCE_EXCLUSIVE_ACCESS = "debug-only";
@@ -1691,7 +1691,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1716;
+ CURRENT_PROJECT_VERSION = 1718;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES;
@@ -1715,7 +1715,7 @@
);
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
- MARKETING_VERSION = 1.8.10;
+ MARKETING_VERSION = 1.8.11;
SEPARATE_STRIP = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_DISABLE_SAFETY_CHECKS = YES;
diff --git a/Trailer/PreferencesWindow.swift b/Trailer/PreferencesWindow.swift
index 849af360..3731017a 100644
--- a/Trailer/PreferencesWindow.swift
+++ b/Trailer/PreferencesWindow.swift
@@ -702,8 +702,8 @@ final class PreferencesWindow: NSWindow, NSWindowDelegate, NSTableViewDelegate,
autoRemoveMergedItems.integerValue = Settings.autoRemoveMergedItems
autoRemoveClosedItems.integerValue = Settings.autoRemoveClosedItems
- assignedItemDirectHandlingPolicy.selectItem(at: Settings.assignedItemDirectHandlingPolicy.assignmentPolictMenuIndex)
- assignedItemTeamHandlingPolicy.selectItem(at: Settings.assignedItemTeamHandlingPolicy.assignmentPolictMenuIndex)
+ assignedItemDirectHandlingPolicy.selectItem(at: Settings.assignedItemDirectHandlingPolicy.assignmentPolicyMenuIndex)
+ assignedItemTeamHandlingPolicy.selectItem(at: Settings.assignedItemTeamHandlingPolicy.assignmentPolicyMenuIndex)
defaultOpenApp.stringValue = Settings.defaultAppForOpeningItems
defaultOpenLinks.stringValue = Settings.defaultAppForOpeningWeb
@@ -724,10 +724,10 @@ final class PreferencesWindow: NSWindow, NSWindowDelegate, NSTableViewDelegate,
hotkeyOptionModifier.integerValue = Settings.hotkeyOptionModifier.asInt
hotkeyShiftModifier.integerValue = Settings.hotkeyShiftModifier.asInt
- let assignedDirectMenuIndex = Settings.assignedDirectReviewHandlingPolicy.assignmentPolictMenuIndex
+ let assignedDirectMenuIndex = Settings.assignedDirectReviewHandlingPolicy.assignmentPolicyMenuIndex
assignedDirectReviewHandlingPolicy.select(assignedDirectReviewHandlingPolicy.item(at: assignedDirectMenuIndex))
- let assignedTeamMenuIndex = Settings.assignedTeamReviewHandlingPolicy.assignmentPolictMenuIndex
+ let assignedTeamMenuIndex = Settings.assignedTeamReviewHandlingPolicy.assignmentPolicyMenuIndex
assignedTeamReviewHandlingPolicy.select(assignedTeamReviewHandlingPolicy.item(at: assignedTeamMenuIndex))
enableHotkeySegments()
diff --git a/Trailer/PreferencesWindow.xib b/Trailer/PreferencesWindow.xib
index 582f57f8..35054011 100644
--- a/Trailer/PreferencesWindow.xib
+++ b/Trailer/PreferencesWindow.xib
@@ -57,7 +57,7 @@
-
+
@@ -1738,15 +1738,15 @@ You can also use "state:" with unread/open/closed/merged/snoozed/draft/conflict
-
+
@@ -1757,15 +1757,17 @@ You can also use "state:" with unread/open/closed/merged/snoozed/draft/conflict
-
+