Compare commits

..
8 Commits
Author SHA1 Message Date
zeng ebbf12f9c4 1 2026-06-09 15:24:24 +08:00
zeng 5a82e3c074 1 2026-06-09 14:45:21 +08:00
zeng 2ac2e2249b 1 2026-06-09 14:35:13 +08:00
zeng aa526639c6 1 2026-06-09 14:29:16 +08:00
zeng df25f94035 1 2026-06-09 14:24:12 +08:00
zeng 1f431d633f 1 2026-06-09 14:05:16 +08:00
zeng c327c68f3e Merge branch 'main' of https://git.qinjiu8.com/zengjx/AppleParty
# Conflicts:
#	.DS_Store
2026-06-09 13:52:24 +08:00
zeng e519f1b94b 1 2026-06-09 13:51:25 +08:00
7 changed files with 72 additions and 10 deletions

No files matched your search

Vendored
BIN
View File
Binary file not shown.
@@ -199,12 +199,17 @@ extension APInAppPurchseVC {
// 检查内购品项是否后台已经创建过
if iapList.isNotEmpty {
let pids = iaps.map { $0.productId }
let vendorIds = Set(iapList.map { $0.vendorId })
let warns = pids.filter { vendorIds.contains($0) }
let existsIAPs = Dictionary(uniqueKeysWithValues: iapList.map { ($0.vendorId, $0) })
let warns = pids.filter { existsIAPs[$0] != nil }
if warns.isNotEmpty {
NSAlert.show("‼️警告:已经存在相同商品id的品项!请检查:\(warns)。\n⚠️提示:如果继续上传,将会覆盖已有品项的信息!")
NSAlert.show("‼️警告:已经存在相同商品id的品项!请检查:\(warns)。\n⚠️提示:将仅保留元数据缺失和未上传的品项。")
}
newIAPs = iaps.filter {
guard let existsIAP = existsIAPs[$0.productId] else {
return true
}
return existsIAP.iTunesConnectStatus == .missingMetadata
}
newIAPs = iaps.filter { !vendorIds.contains($0.productId) }
}
// 检查商品同名,苹果后台不允许存在同名
@@ -623,6 +623,11 @@ extension APUploadIAPListVC {
// 3、查看是否存在订阅商品,不存在就创建,存在就更新
let subs = subscriptions.filter({ $0.attributes?.productID == product.productId })
if let sub = subs.first {
if let state = sub.attributes?.state, state != .missingMetadata {
ascAPI.addMessage("订阅商品已经存在:\(product.productId),当前状态:\(state.rawValue),跳过更新信息...")
return
}
ascAPI.addMessage("订阅商品已经存在:\(product.productId) ,开始更新信息中...")
// 0. 审核备注如果原来有值,而新字段无值,则使用原值
var product = product
@@ -129,9 +129,12 @@ class APWebLoginVC: NSViewController {
}
func closeView() {
guard let window = view.window, let parent = window.sheetParent
else { return }
guard let window = view.window else { return }
if let parent = window.sheetParent {
parent.endSheet(window)
} else {
window.close()
}
}
}
@@ -27,6 +27,7 @@ public class AppleWebLoginCore: NSObject, WKUIDelegate, WKNavigationDelegate {
let contentController = WKUserContentController()
let configuration = WKWebViewConfiguration()
configuration.defaultWebpagePreferences.allowsContentJavaScript = true
configuration.preferences.javaScriptCanOpenWindowsAutomatically = true
configuration.userContentController = contentController
configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
configuration.websiteDataStore = .nonPersistent()
@@ -36,6 +37,7 @@ public class AppleWebLoginCore: NSObject, WKUIDelegate, WKNavigationDelegate {
configuration: configuration
)
associatedWebView.isHidden = true
associatedWebView.customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1 Safari/605.1.15"
super.init()
@@ -52,7 +54,6 @@ public class AppleWebLoginCore: NSObject, WKUIDelegate, WKNavigationDelegate {
let dataPopulationTimer = Timer(timeInterval: 1, repeats: true) { [weak self] _ in
guard let self else { return }
removeUnwantedElements()
populateData()
}
RunLoop.main.add(dataPopulationTimer, forMode: .common)
@@ -124,4 +125,16 @@ public class AppleWebLoginCore: NSObject, WKUIDelegate, WKNavigationDelegate {
}
}
}
public func webView(
_ webView: WKWebView,
createWebViewWith configuration: WKWebViewConfiguration,
for navigationAction: WKNavigationAction,
windowFeatures: WKWindowFeatures
) -> WKWebView? {
if navigationAction.targetFrame == nil {
webView.load(navigationAction.request)
}
return nil
}
}
+17 -3
View File
@@ -10,6 +10,8 @@ import Cocoa
class APRootWC: NSWindowController {
private var loginWindowController: NSWindowController?
override func windowDidLoad() {
super.windowDidLoad()
setupUI()
@@ -57,10 +59,22 @@ class APRootWC: NSWindowController {
if #available(macOS 11.0, *) {
self?.window?.subtitle = UserCenter.shared.accountEmail
}
self?.loginWindowController = nil
}
let pannel = NSPanel(contentViewController: vc)
pannel.setFrame(NSRect(origin: .zero, size: NSSize(width: 550, height: 450)), display: true)
window?.beginSheet(pannel, completionHandler: nil)
vc.cancelHandle = { [weak self] in
self?.loginWindowController = nil
}
let loginWindow = NSWindow(contentViewController: vc)
loginWindow.title = "App Store Connect"
loginWindow.styleMask = [.titled, .closable, .miniaturizable, .resizable]
loginWindow.minSize = NSSize(width: 900, height: 680)
loginWindow.setFrame(NSScreen.main?.visibleFrame ?? NSRect(x: 0, y: 0, width: 1280, height: 800), display: true)
let loginWC = NSWindowController(window: loginWindow)
loginWindowController = loginWC
loginWC.showWindow(self)
loginWindow.makeKeyAndOrderFront(self)
}
}
@@ -15,7 +15,29 @@ extension NSAlert {
static func show(_ content: String, title: String = "提示") {
let alert = NSAlert()
alert.messageText = title
if content.count > 300 || content.contains("\n") {
let scrollView = NSScrollView(frame: NSRect(x: 0, y: 0, width: 560, height: 260))
scrollView.hasVerticalScroller = true
scrollView.hasHorizontalScroller = false
scrollView.borderType = .bezelBorder
let textView = NSTextView(frame: scrollView.bounds)
textView.autoresizingMask = [.width]
textView.isEditable = false
textView.isSelectable = true
textView.drawsBackground = false
textView.textContainerInset = NSSize(width: 8, height: 8)
textView.textContainer?.widthTracksTextView = true
textView.textContainer?.containerSize = NSSize(width: scrollView.bounds.width, height: CGFloat.greatestFiniteMagnitude)
textView.string = content
textView.font = NSFont.systemFont(ofSize: 13)
scrollView.documentView = textView
alert.informativeText = "内容较长,请在下方滚动查看。"
alert.accessoryView = scrollView
} else {
alert.informativeText = content
}
alert.runModal()
}
}