Compare commits
6
Commits
c327c68f3e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebbf12f9c4 | ||
|
|
5a82e3c074 | ||
|
|
2ac2e2249b | ||
|
|
aa526639c6 | ||
|
|
df25f94035 | ||
|
|
1f431d633f |
No files matched your search
@@ -199,12 +199,17 @@ extension APInAppPurchseVC {
|
|||||||
// 检查内购品项是否后台已经创建过
|
// 检查内购品项是否后台已经创建过
|
||||||
if iapList.isNotEmpty {
|
if iapList.isNotEmpty {
|
||||||
let pids = iaps.map { $0.productId }
|
let pids = iaps.map { $0.productId }
|
||||||
let vendorIds = Set(iapList.map { $0.vendorId })
|
let existsIAPs = Dictionary(uniqueKeysWithValues: iapList.map { ($0.vendorId, $0) })
|
||||||
let warns = pids.filter { vendorIds.contains($0) }
|
let warns = pids.filter { existsIAPs[$0] != nil }
|
||||||
if warns.isNotEmpty {
|
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、查看是否存在订阅商品,不存在就创建,存在就更新
|
// 3、查看是否存在订阅商品,不存在就创建,存在就更新
|
||||||
let subs = subscriptions.filter({ $0.attributes?.productID == product.productId })
|
let subs = subscriptions.filter({ $0.attributes?.productID == product.productId })
|
||||||
if let sub = subs.first {
|
if let sub = subs.first {
|
||||||
|
if let state = sub.attributes?.state, state != .missingMetadata {
|
||||||
|
ascAPI.addMessage("订阅商品已经存在:\(product.productId),当前状态:\(state.rawValue),跳过更新信息...")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ascAPI.addMessage("订阅商品已经存在:\(product.productId) ,开始更新信息中...")
|
ascAPI.addMessage("订阅商品已经存在:\(product.productId) ,开始更新信息中...")
|
||||||
// 0. 审核备注如果原来有值,而新字段无值,则使用原值
|
// 0. 审核备注如果原来有值,而新字段无值,则使用原值
|
||||||
var product = product
|
var product = product
|
||||||
|
|||||||
@@ -129,9 +129,12 @@ class APWebLoginVC: NSViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func closeView() {
|
func closeView() {
|
||||||
guard let window = view.window, let parent = window.sheetParent
|
guard let window = view.window else { return }
|
||||||
else { return }
|
if let parent = window.sheetParent {
|
||||||
parent.endSheet(window)
|
parent.endSheet(window)
|
||||||
|
} else {
|
||||||
|
window.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -27,6 +27,7 @@ public class AppleWebLoginCore: NSObject, WKUIDelegate, WKNavigationDelegate {
|
|||||||
let contentController = WKUserContentController()
|
let contentController = WKUserContentController()
|
||||||
let configuration = WKWebViewConfiguration()
|
let configuration = WKWebViewConfiguration()
|
||||||
configuration.defaultWebpagePreferences.allowsContentJavaScript = true
|
configuration.defaultWebpagePreferences.allowsContentJavaScript = true
|
||||||
|
configuration.preferences.javaScriptCanOpenWindowsAutomatically = true
|
||||||
configuration.userContentController = contentController
|
configuration.userContentController = contentController
|
||||||
configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
|
configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
|
||||||
configuration.websiteDataStore = .nonPersistent()
|
configuration.websiteDataStore = .nonPersistent()
|
||||||
@@ -36,6 +37,7 @@ public class AppleWebLoginCore: NSObject, WKUIDelegate, WKNavigationDelegate {
|
|||||||
configuration: configuration
|
configuration: configuration
|
||||||
)
|
)
|
||||||
associatedWebView.isHidden = true
|
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()
|
super.init()
|
||||||
|
|
||||||
@@ -52,7 +54,6 @@ public class AppleWebLoginCore: NSObject, WKUIDelegate, WKNavigationDelegate {
|
|||||||
|
|
||||||
let dataPopulationTimer = Timer(timeInterval: 1, repeats: true) { [weak self] _ in
|
let dataPopulationTimer = Timer(timeInterval: 1, repeats: true) { [weak self] _ in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
removeUnwantedElements()
|
|
||||||
populateData()
|
populateData()
|
||||||
}
|
}
|
||||||
RunLoop.main.add(dataPopulationTimer, forMode: .common)
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,8 @@ import Cocoa
|
|||||||
|
|
||||||
class APRootWC: NSWindowController {
|
class APRootWC: NSWindowController {
|
||||||
|
|
||||||
|
private var loginWindowController: NSWindowController?
|
||||||
|
|
||||||
override func windowDidLoad() {
|
override func windowDidLoad() {
|
||||||
super.windowDidLoad()
|
super.windowDidLoad()
|
||||||
setupUI()
|
setupUI()
|
||||||
@@ -57,10 +59,22 @@ class APRootWC: NSWindowController {
|
|||||||
if #available(macOS 11.0, *) {
|
if #available(macOS 11.0, *) {
|
||||||
self?.window?.subtitle = UserCenter.shared.accountEmail
|
self?.window?.subtitle = UserCenter.shared.accountEmail
|
||||||
}
|
}
|
||||||
|
self?.loginWindowController = nil
|
||||||
}
|
}
|
||||||
let pannel = NSPanel(contentViewController: vc)
|
vc.cancelHandle = { [weak self] in
|
||||||
pannel.setFrame(NSRect(origin: .zero, size: NSSize(width: 550, height: 450)), display: true)
|
self?.loginWindowController = nil
|
||||||
window?.beginSheet(pannel, completionHandler: 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 = "提示") {
|
static func show(_ content: String, title: String = "提示") {
|
||||||
let alert = NSAlert()
|
let alert = NSAlert()
|
||||||
alert.messageText = title
|
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.informativeText = content
|
||||||
|
}
|
||||||
alert.runModal()
|
alert.runModal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user