Skip to content

Commit

Permalink
Fixes for review assignment display dropdowns, some extra sync logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsochantaris committed Aug 10, 2023
1 parent 7e515f4 commit 4cac963
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
13 changes: 13 additions & 0 deletions Shared/V4API.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ extension API {
if !servers.isEmpty {
group.addTask { @MainActor in
await GraphQL.fetchAllAuthoredPrs(from: servers)
Logging.log("Fetching authored PRs phase complete")
}
}
if !repos.isEmpty {
group.addTask { @MainActor in
await GraphQL.fetchAllSubscribedPrs(from: repos)
Logging.log("Fetching subscribed PRs phase complete")
}
}
}
Expand All @@ -76,6 +78,7 @@ extension API {
group.addTask { @MainActor in
let prs = PullRequest.statusCheckBatch(in: moc)
try await GraphQL.update(for: prs, steps: [.statuses])
Logging.log("Status fetch phase complete")
}
} else {
for p in PullRequest.allItems(in: moc) {
Expand All @@ -89,37 +92,44 @@ extension API {
group.addTask { @MainActor in
let rp = PullRequest.reactionCheckBatch(in: moc)
try await GraphQL.update(for: rp, steps: [.reactions])
Logging.log("PR reactions fetch phase complete")
}
}
try await group.waitForAll()
}

try await GraphQL.update(for: newOrUpdatedPrs, steps: steps)
Logging.log("PR extras fetch phase complete")

let reviews = Review.newOrUpdatedItems(in: moc, fromSuccessfulSyncOnly: true)
try await GraphQL.updateComments(for: reviews)
Logging.log("Review comment fetch phase complete")
}

let issueTask = Task {
await withTaskGroup(of: Void.self) { group in
if !servers.isEmpty {
group.addTask { @MainActor in
await GraphQL.fetchAllAuthoredIssues(from: servers)
Logging.log("Fetching authored issues phase complete")
}
}
if !repos.isEmpty {
group.addTask { @MainActor in
await GraphQL.fetchAllSubscribedIssues(from: repos)
Logging.log("Fetching subscribed issues phase complete")
}
}
}

let newOrUpdatedIssues = Issue.newOrUpdatedItems(in: moc, fromSuccessfulSyncOnly: true)
try await GraphQL.update(for: newOrUpdatedIssues, steps: steps)
Logging.log("Issue extras fetch phase complete")

if Settings.notifyOnItemReactions {
let ri = Issue.reactionCheckBatch(in: moc)
try await GraphQL.update(for: ri, steps: [.reactions])
Logging.log("Issue reaction fetch phase complete")
}
}

Expand All @@ -135,6 +145,9 @@ extension API {
}
}
try await GraphQL.updateReactions(for: comments)
Logging.log("Comment reaction fetch phase complete")
}

Logging.log("V4 API phase complete")
}
}
8 changes: 4 additions & 4 deletions Trailer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1688;
CURRENT_PROJECT_VERSION = 1690;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -1634,7 +1634,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.8.5;
MARKETING_VERSION = 1.8.6;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "-D DEBUG";
SWIFT_ENFORCE_EXCLUSIVE_ACCESS = "debug-only";
Expand Down Expand Up @@ -1672,7 +1672,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1688;
CURRENT_PROJECT_VERSION = 1690;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES;
Expand All @@ -1696,7 +1696,7 @@
);
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.8.5;
MARKETING_VERSION = 1.8.6;
SEPARATE_STRIP = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_DISABLE_SAFETY_CHECKS = YES;
Expand Down
11 changes: 6 additions & 5 deletions Trailer/PreferencesWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -398,19 +398,15 @@ final class PreferencesWindow: NSWindow, NSWindowDelegate, NSTableViewDelegate,
}

@IBAction private func assignedDirectReviewHandlingPolicySelected(_ sender: NSPopUpButton) {
let previousShouldSync = (API.shouldSyncReviews || API.shouldSyncReviewAssignments)
let index = sender.index(of: sender.selectedItem!)
Settings.assignedDirectReviewHandlingPolicy = Placement(menuIndex: index).assignmentPolicyRawValue
deferredUpdateTimer.push()
showOptionalReviewAssignmentWarning(previousSync: previousShouldSync)
}

@IBAction private func assignedTeamReviewHandlingPolicySelected(_ sender: NSPopUpButton) {
let previousShouldSync = (API.shouldSyncReviews || API.shouldSyncReviewAssignments)
let index = sender.index(of: sender.selectedItem!)
Settings.assignedTeamReviewHandlingPolicy = Placement(menuIndex: index).assignmentPolicyRawValue
deferredUpdateTimer.push()
showOptionalReviewAssignmentWarning(previousSync: previousShouldSync)
}

@IBAction private func draftHandlingPolicy(_ sender: NSPopUpButton) {
Expand Down Expand Up @@ -537,6 +533,7 @@ final class PreferencesWindow: NSWindow, NSWindowDelegate, NSTableViewDelegate,
notifyOnAllReviewDismissals.toolTip = Settings.notifyOnAllReviewDismissalsHelp
notifyOnReviewAssignments.toolTip = Settings.notifyOnReviewAssignmentsHelp
assignedDirectReviewHandlingPolicy.toolTip = Settings.assignedDirectReviewHandlingPolicyHelp
assignedTeamReviewHandlingPolicy.toolTip = Settings.assignedTeamReviewHandlingPolicyHelp
supportReviews.toolTip = Settings.displayReviewsOnItemsHelp
showRequestedTeamReviews.toolTip = Settings.showRequestedTeamReviewsHelp
notifyOnItemReactions.toolTip = Settings.notifyOnItemReactionsHelp
Expand Down Expand Up @@ -683,7 +680,11 @@ final class PreferencesWindow: NSWindow, NSWindowDelegate, NSTableViewDelegate,
hotkeyOptionModifier.integerValue = Settings.hotkeyOptionModifier ? 1 : 0
hotkeyShiftModifier.integerValue = Settings.hotkeyShiftModifier ? 1 : 0

assignedDirectReviewHandlingPolicy.select(assignedDirectReviewHandlingPolicy.item(at: Settings.assignedDirectReviewHandlingPolicy))
let assignedDirectMenuIndex = Placement(fromAssignmentPolicyRawValue: Settings.assignedDirectReviewHandlingPolicy)?.menuIndex ?? 0
assignedDirectReviewHandlingPolicy.select(assignedDirectReviewHandlingPolicy.item(at: assignedDirectMenuIndex))

let assignedTeamMenuIndex = Placement(fromAssignmentPolicyRawValue: Settings.assignedTeamReviewHandlingPolicy)?.menuIndex ?? 0
assignedTeamReviewHandlingPolicy.select(assignedTeamReviewHandlingPolicy.item(at: assignedTeamMenuIndex))

enableHotkeySegments()

Expand Down
6 changes: 3 additions & 3 deletions Trailer/PreferencesWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Tu3-cb-beM">
<rect key="frame" x="14" y="7" width="66" height="32"/>
<rect key="frame" x="13" y="7" width="66" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="push" title="Test" bezelStyle="rounded" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="QdL-bA-0NX">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
Expand Down Expand Up @@ -258,7 +258,7 @@ Token</string>
</connections>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="q1S-M3-nh6">
<rect key="frame" x="237" y="52" width="130" height="17"/>
<rect key="frame" x="236" y="52" width="130" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="inline" title="Existing Tokens" bezelStyle="inline" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OhE-A7-jdY">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
Expand Down Expand Up @@ -1523,7 +1523,7 @@ You can also use "state:" with unread/open/closed/merged/snoozed/draft/conflict
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<box fixedFrame="YES" boxType="custom" borderType="none" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="49Q-X3-TvK">
<rect key="frame" x="75" y="64" width="749" height="301"/>
<rect key="frame" x="74" y="64" width="749" height="301"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<view key="contentView" id="Hr7-ca-s5X">
<rect key="frame" x="0.0" y="0.0" width="749" height="301"/>
Expand Down

0 comments on commit 4cac963

Please sign in to comment.