Prevent duplicate approve reviews + redesign bottom bar; bump to 2.9
Build iOS App / Build .ipa and publish source (push) Successful in 22s
Build iOS App / Build .ipa and publish source (push) Successful in 22s
- Approve: rapid taps fired multiple submitReview calls that each appended a review, stacking duplicate entries. Add a busy guard (skip while one is in flight) and dedupe reviews per user so the latest replaces earlier ones; disable the review menu while submitting. - Bottom bar: replace the full-width bar with a floating frosted-glass pill inset from the edges (like SideStore), with a highlighted capsule behind the active tab. Bump to 2.9.
This commit is contained in:
1 parent
ed22fbc351
commit
5e9ee9e5cf
3 files changed
+40
-14
No files matched your search
@@ -187,7 +187,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 19;
|
CURRENT_PROJECT_VERSION = 20;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = "GiteaPR";
|
INFOPLIST_KEY_CFBundleDisplayName = "GiteaPR";
|
||||||
@@ -197,7 +197,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 2.8;
|
MARKETING_VERSION = 2.9;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.bueso.giteapr;
|
PRODUCT_BUNDLE_IDENTIFIER = com.bueso.giteapr;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 19;
|
CURRENT_PROJECT_VERSION = 20;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = "GiteaPR";
|
INFOPLIST_KEY_CFBundleDisplayName = "GiteaPR";
|
||||||
@@ -221,7 +221,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 2.8;
|
MARKETING_VERSION = 2.9;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.bueso.giteapr;
|
PRODUCT_BUNDLE_IDENTIFIER = com.bueso.giteapr;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
|||||||
@@ -102,7 +102,11 @@ struct PRDetailView: View {
|
|||||||
.toolbar {
|
.toolbar {
|
||||||
if prIsOpen {
|
if prIsOpen {
|
||||||
ToolbarItem(placement: .primaryAction) { mergeButton }
|
ToolbarItem(placement: .primaryAction) { mergeButton }
|
||||||
ToolbarItem(placement: .primaryAction) { reviewMenu }
|
ToolbarItem(placement: .primaryAction) {
|
||||||
|
// Disable while a review submission is in flight so rapid
|
||||||
|
// taps can't stack duplicate reviews.
|
||||||
|
reviewMenu.disabled(vm.busyMessage != nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,29 +134,43 @@ struct PRDetailView: View {
|
|||||||
.background(Color(.secondarySystemBackground))
|
.background(Color(.secondarySystemBackground))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Bottom tab bar: full-width frosted-glass bar at the standard iOS tab
|
/// Bottom tab bar: a floating, frosted-glass pill inset from the screen
|
||||||
/// bar height, sitting flush above the home indicator — matching Apple
|
/// edges (like the SideStore tab bar), with a highlighted capsule behind
|
||||||
/// Music's tab bar (not a floating capsule with space below it).
|
/// the active tab. Icon + text per tab.
|
||||||
private var bottomTabBar: some View {
|
private var bottomTabBar: some View {
|
||||||
HStack {
|
HStack(spacing: 4) {
|
||||||
ForEach(DetailTab.allCases) { tab in
|
ForEach(DetailTab.allCases) { tab in
|
||||||
Button {
|
Button {
|
||||||
selectedTab = tab
|
selectedTab = tab
|
||||||
} label: {
|
} label: {
|
||||||
VStack(spacing: 2) {
|
VStack(spacing: 2) {
|
||||||
Image(systemName: tab.icon)
|
Image(systemName: tab.icon)
|
||||||
.font(.system(size: 22))
|
.font(.system(size: 20, weight: .medium))
|
||||||
Text(tab.rawValue)
|
Text(tab.rawValue)
|
||||||
.font(.caption2)
|
.font(.caption2.weight(.medium))
|
||||||
}
|
}
|
||||||
.foregroundColor(selectedTab == tab ? .accentColor : .secondary)
|
.foregroundColor(selectedTab == tab ? .accentColor : .secondary)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
|
.padding(.vertical, 6)
|
||||||
|
.background(
|
||||||
|
selectedTab == tab
|
||||||
|
? AnyShapeStyle(.ultraThinMaterial)
|
||||||
|
: AnyShapeStyle(.clear)
|
||||||
|
)
|
||||||
|
.clipShape(Capsule())
|
||||||
}
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.top, 8)
|
.padding(.horizontal, 6)
|
||||||
.padding(.bottom, 4)
|
.padding(.vertical, 6)
|
||||||
.background(.bar)
|
.background(
|
||||||
|
Capsule()
|
||||||
|
.fill(.regularMaterial)
|
||||||
|
.shadow(color: .black.opacity(0.15), radius: 10, y: 4)
|
||||||
|
)
|
||||||
|
.padding(.horizontal, 20)
|
||||||
|
.padding(.bottom, 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var reviewMenu: some View {
|
private var reviewMenu: some View {
|
||||||
|
|||||||
@@ -113,12 +113,20 @@ final class PRDetailViewModel: ObservableObject {
|
|||||||
|
|
||||||
func submitReview(state: String, comment: String?) async {
|
func submitReview(state: String, comment: String?) async {
|
||||||
guard let client = SettingsStore.shared.client() else { return }
|
guard let client = SettingsStore.shared.client() else { return }
|
||||||
|
// Guard against concurrent submissions: rapid taps on Approve used to
|
||||||
|
// fire several requests that each appended a review, stacking
|
||||||
|
// duplicate entries. Skip if one is already in flight.
|
||||||
|
guard busyMessage == nil else { return }
|
||||||
busyMessage = "Submitting…"
|
busyMessage = "Submitting…"
|
||||||
defer { busyMessage = nil }
|
defer { busyMessage = nil }
|
||||||
do {
|
do {
|
||||||
let r = try await client.submitReview(owner: owner, repo: repo.name,
|
let r = try await client.submitReview(owner: owner, repo: repo.name,
|
||||||
number: prNumber, state: state,
|
number: prNumber, state: state,
|
||||||
comment: comment)
|
comment: comment)
|
||||||
|
// A user's latest review replaces their earlier ones (Gitea stores
|
||||||
|
// one review per user per PR). Drop any prior review by this user
|
||||||
|
// so we don't render duplicates.
|
||||||
|
reviews.removeAll { $0.user?.login == r.user?.login }
|
||||||
reviews.append(r)
|
reviews.append(r)
|
||||||
} catch {
|
} catch {
|
||||||
errorMessage = error.localizedDescription
|
errorMessage = error.localizedDescription
|
||||||
|
|||||||
Reference in new issue
Block a user