Skip to content

Commit

Permalink
v2.0.3
Browse files Browse the repository at this point in the history
1. 增加是否记住密码、信任设备的勾选项
2. 切换账号从双点确认改为单击确认切换
3. 修复和完善一些Bug和体验的问题
  • Loading branch information
iHTCboy committed Apr 9, 2022
1 parent 045fd40 commit d3fb04c
Show file tree
Hide file tree
Showing 23 changed files with 129 additions and 635 deletions.
24 changes: 12 additions & 12 deletions AppleParty.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
6D8F182B27F07E97001A30BF /* AppListView */,
6D8F183027F07E97001A30BF /* EmailToolView */,
6D8F183427F07E97001A30BF /* QRcodeView */,
6D8F183127F07E97001A30BF /* SettingView */,
6D8F183127F07E97001A30BF /* AppSettingView */,
6D8F184227F07E97001A30BF /* Shared */,
6D8F187A27F0AC74001A30BF /* Vendors */,
6D8F183327F07E97001A30BF /* SparkleUpdate */,
Expand Down Expand Up @@ -357,6 +357,8 @@
6D3ECCE927F1D6C6005E4597 /* IAPCharge.swift */,
6D3ECCE727F1D6BB005E4597 /* IAPModel.swift */,
6D3ECCDD27F1D027005E4597 /* XMLModel.swift */,
6D8F187D27F0AC83001A30BF /* TierStemParser.swift */,
6D8F187E27F0AC83001A30BF /* XLSXParser.swift */,
);
path = Models;
sourceTree = "<group>";
Expand Down Expand Up @@ -384,15 +386,14 @@
6D8F182B27F07E97001A30BF /* AppListView */ = {
isa = PBXGroup;
children = (
6D3ECCDC27F1D00B005E4597 /* Models */,
6D8F183227F07E97001A30BF /* InAppPurchseView */,
6D3ECCD127F1CAC5005E4597 /* ScreenShotsView */,
6D8F182D27F07E97001A30BF /* APAppListVC.swift */,
6D8F185E27F08161001A30BF /* AppList.storyboard */,
6D8F186527F081ED001A30BF /* APAppListAdapter.swift */,
6D8F186127F081D3001A30BF /* APAppListCell.swift */,
6D8F186227F081D3001A30BF /* APAppListCell.xib */,
6D8F186727F08201001A30BF /* APAppListModel.swift */,
6D8F183227F07E97001A30BF /* InAppPurchseView */,
6D3ECCD127F1CAC5005E4597 /* ScreenShotsView */,
);
path = AppListView;
sourceTree = "<group>";
Expand All @@ -409,13 +410,13 @@
path = EmailToolView;
sourceTree = "<group>";
};
6D8F183127F07E97001A30BF /* SettingView */ = {
6D8F183127F07E97001A30BF /* AppSettingView */ = {
isa = PBXGroup;
children = (
6D59A22D27F31E7000C7D8F5 /* APSettingVC.swift */,
6D59A22E27F31E7000C7D8F5 /* APSettingVC.xib */,
);
path = SettingView;
path = AppSettingView;
sourceTree = "<group>";
};
6D8F183227F07E97001A30BF /* InAppPurchseView */ = {
Expand All @@ -430,6 +431,7 @@
6D584B5727F20A8000924BFE /* APInAppPurchseCell.swift */,
6D584B5527F20A4D00924BFE /* APInappPurchseCell.xib */,
6D59A21A27F2D49000C7D8F5 /* DragView.swift */,
6D3ECCDC27F1D00B005E4597 /* Models */,
);
path = InAppPurchseView;
sourceTree = "<group>";
Expand Down Expand Up @@ -537,8 +539,6 @@
children = (
6D8F188627F0ACA5001A30BF /* GDataXMLNode.h */,
6D8F188727F0ACA5001A30BF /* GDataXMLNode.m */,
6D8F187D27F0AC83001A30BF /* TierStemParser.swift */,
6D8F187E27F0AC83001A30BF /* XLSXParser.swift */,
6D8F188027F0AC83001A30BF /* XMLManager.swift */,
);
path = ITMS;
Expand Down Expand Up @@ -1077,7 +1077,7 @@
CODE_SIGN_ENTITLEMENTS = AppleParty/AppleParty.entitlements;
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2022.04.07;
CURRENT_PROJECT_VERSION = 2022.04.09;
DEVELOPMENT_TEAM = "";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AppleParty/Info.plist;
Expand All @@ -1090,7 +1090,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 2.0.2;
MARKETING_VERSION = 2.0.3;
PRODUCT_BUNDLE_IDENTIFIER = cn.com.37iOS.AppleParty;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1111,7 +1111,7 @@
CODE_SIGN_ENTITLEMENTS = AppleParty/AppleParty.entitlements;
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2022.04.07;
CURRENT_PROJECT_VERSION = 2022.04.09;
DEVELOPMENT_TEAM = "";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AppleParty/Info.plist;
Expand All @@ -1124,7 +1124,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 2.0.2;
MARKETING_VERSION = 2.0.3;
PRODUCT_BUNDLE_IDENTIFIER = cn.com.37iOS.AppleParty;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@
<connections>
<outlet property="appNameView" destination="RWS-I4-Hj5" id="B2s-1y-ClK"/>
<outlet property="outlineView" destination="Yd4-ve-MqM" id="gzd-Pc-XWm"/>
<outlet property="outputIAPListBtn" destination="DoY-Xj-sox" id="evc-Ck-z2C"/>
</connections>
</viewController>
<customObject id="LWD-js-20w" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
Expand Down
11 changes: 8 additions & 3 deletions AppleParty/AppListView/InAppPurchseView/APInAppPurchseVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class APInAppPurchseVC: NSViewController {

var iapList: [IAPList.IAP] = []

@IBOutlet weak var outputIAPListBtn: NSButton!
@IBOutlet weak var appNameView: NSTextField!
@IBOutlet weak var outlineView: NSOutlineView!

Expand Down Expand Up @@ -81,7 +82,7 @@ class APInAppPurchseVC: NSViewController {
data.append(contentsOf: iaps.data(using: .utf8) ?? Data())
try data.write(to: filePath!)
} catch {
// failed to write file (bad permissions, bad filename etc.)
NSAlert.show("导出失败:\(error.localizedDescription)")
}
}
}
Expand All @@ -107,7 +108,8 @@ extension APInAppPurchseVC {
func fetchIAPs() {
APClient.iaps(appid: currentApp!.adamId).request(showLoading: true, inView: self.view) { [weak self] result, response, error in
guard let err = error else {
let iapL = IAPList(body:result, app: (self?.currentApp!)!)
guard let app = self?.currentApp else { return } //请求过程关闭页面可能导致为空
let iapL = IAPList(body:result, app: app)
self?.iapList = iapL.iapList
self?.outlineView.reloadData()
self?.updateRowInfo()
Expand All @@ -122,6 +124,7 @@ extension APInAppPurchseVC {
return
}

outputIAPListBtn.isEnabled = false
let group = DispatchGroup()
for i in 0..<self.iapList.count {
group.enter()
Expand All @@ -139,6 +142,7 @@ extension APInAppPurchseVC {
}
}
group.notify(queue: .main) {
self.outputIAPListBtn.isEnabled = true
self.outlineView.reloadData()
}
}
Expand All @@ -159,7 +163,8 @@ extension APInAppPurchseVC {
let dps = xlsx[4]
let types = xlsx[5]
let scrs = xlsx[6]
let langs = (xlsx.count >= 8 && xlsx[7].count > 0 ) ? xlsx[7] : [String](repeating: "zh-Hans", count: ids.count)
// 如果没有填写,默认用简中
let langs = xlsx[7].count > 0 ? xlsx[7].map { $0.count > 0 ? $0 : "zh-Hans" } : [String](repeating: "zh-Hans", count: ids.count)

// 检查行数
guard ids.count == names.count, pris.count == levs.count, dps.count == types.count, types.count == ids.count, names.count == langs.count else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct XLSXParser {
return column.filter { (value) -> Bool in
value == "语言"
}.isNotEmpty
}.first ?? []
}.first ?? xlsx[7]

return [pris.filter({ $0 != "金额" }),
prods.filter({ $0 != "Product ID" }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class APSettingVC: NSViewController {
}
}

@IBOutlet weak var trusDeviceBtn: NSButton!
@IBOutlet weak var sPasswordBtn: NSButton!
@IBOutlet weak var clearCacheBtn: NSButton!

Expand Down Expand Up @@ -46,6 +47,7 @@ class APSettingVC: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
title = "App设置"
trusDeviceBtn.state = InfoCenter.shared.trusDevice ? .on : .off
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<connections>
<outlet property="clearCacheBtn" destination="CIQ-yY-qAH" id="Mk4-R7-k6m"/>
<outlet property="sPasswordBtn" destination="OeI-Rx-XtW" id="qOB-78-ZuO"/>
<outlet property="trusDeviceBtn" destination="nK7-5f-UIm" id="bjH-fk-npo"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
Expand Down
2 changes: 2 additions & 0 deletions AppleParty/LoginView/APLogin2FAVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class APLogin2FAVC: NSViewController {
@IBOutlet weak var voiceCodeBtn: NSButton!
@IBOutlet weak var phoneCodeView: NSTextField!
@IBOutlet weak var tipsWarningView: NSTextField!
@IBOutlet weak var trusDeviceBtn: NSButton!
@IBOutlet weak var indicatorView: NSProgressIndicator!
@IBOutlet weak var verifyBtn: NSButton!

Expand All @@ -31,6 +32,7 @@ class APLogin2FAVC: NSViewController {
super.viewDidLoad()
phoneCodeView.delegate = self
fetchPhoneList()
trusDeviceBtn.state = InfoCenter.shared.trusDevice ? .on : .off
}

@IBAction func clickedCancelBtn(_ sender: NSButton) {
Expand Down
14 changes: 14 additions & 0 deletions AppleParty/LoginView/APLogin2FAVC.xib
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<outlet property="phoneListBtn" destination="YPd-lO-U4e" id="Sg5-Hb-iUb"/>
<outlet property="sendCodeBtn" destination="rx9-Oh-Gtq" id="cYT-hl-Kc7"/>
<outlet property="tipsWarningView" destination="ijo-CH-sfg" id="PLO-uS-eBh"/>
<outlet property="trusDeviceBtn" destination="8SV-WX-fvn" id="kyK-aJ-vJK"/>
<outlet property="verifyBtn" destination="E5o-kz-kvG" id="kcn-Ez-LwY"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
<outlet property="voiceCodeBtn" destination="kff-Qr-scI" id="khK-sS-hCc"/>
Expand Down Expand Up @@ -151,6 +152,17 @@ DQ
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8SV-WX-fvn">
<rect key="frame" x="283" y="20" width="80" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="mX6-l7-rZj"/>
<constraint firstAttribute="width" constant="78" id="vDy-Dk-GSE"/>
</constraints>
<buttonCell key="cell" type="check" title="信任设备" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="VBA-AP-I7T">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" size="13" name="STSongti-SC-Regular"/>
</buttonCell>
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="BiF-4T-JA0" secondAttribute="bottom" constant="15" id="1Fq-AL-3Ws"/>
Expand All @@ -159,6 +171,8 @@ DQ
<constraint firstAttribute="trailing" secondItem="rx9-Oh-Gtq" secondAttribute="trailing" constant="60" id="Euw-SM-wUx"/>
<constraint firstItem="YPd-lO-U4e" firstAttribute="leading" secondItem="vqk-uI-9AU" secondAttribute="trailing" constant="10" id="G4u-U5-hRW"/>
<constraint firstItem="vqk-uI-9AU" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="60" id="Kat-r9-QXI"/>
<constraint firstItem="8SV-WX-fvn" firstAttribute="centerY" secondItem="E5o-kz-kvG" secondAttribute="centerY" id="Pfn-8j-tgF"/>
<constraint firstItem="E5o-kz-kvG" firstAttribute="leading" secondItem="8SV-WX-fvn" secondAttribute="trailing" constant="8" id="Q3C-bW-QSW"/>
<constraint firstAttribute="trailing" secondItem="kff-Qr-scI" secondAttribute="trailing" constant="60" id="Sxo-QH-rVU"/>
<constraint firstAttribute="trailing" secondItem="npy-jX-GQb" secondAttribute="trailing" constant="60" id="WBf-2q-NVj"/>
<constraint firstItem="npy-jX-GQb" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="60" id="WxQ-Kb-Jj4"/>
Expand Down
31 changes: 22 additions & 9 deletions AppleParty/LoginView/APLoginVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class APLoginVC: NSViewController {
@IBOutlet weak var tableView: NSTableView!

@IBOutlet weak var tipsWarningView: NSTextField!
@IBOutlet weak var autoLoginBtn: NSButton!
@IBOutlet weak var indicatorView: NSProgressIndicator!
@IBOutlet weak var loginBtn: NSButton!

Expand All @@ -29,12 +30,10 @@ class APLoginVC: NSViewController {
passwordView.delegate = self
tipsWarningView.maximumNumberOfLines = 5

tableView.delegate = self
tableView.dataSource = self

// 最近登录的账号
let name = UserCenter.shared.loginedUser.appleid
let pwd = UserCenter.shared.loginedUser.password
let user = UserCenter.shared.loginedUser
let name = user.appleid
let pwd = user.password
guard name.count > 0, pwd.count > 0 else { return }
accountView.stringValue = name
passwordView.stringValue = pwd
Expand All @@ -54,6 +53,11 @@ class APLoginVC: NSViewController {


@IBAction func showAccountHistoryList(_ sender: Any) {
if historyBox.isHidden {
tableView.delegate = self
tableView.dataSource = self
tableView.reloadData()
}
historyBox.isHidden = !historyBox.isHidden
}

Expand Down Expand Up @@ -88,8 +92,11 @@ extension APLoginVC {
case .notAuthorized:
self?.showTips("Apple ID 或密码不正确")
case .twoStepOrFactor:
// 账号密码正确
UserCenter.shared.loginedUser = User(appleid: account, password: pwd)
// 保存账号密码
if self?.autoLoginBtn.state == .on {
UserCenter.shared.isAutoLogin = true
UserCenter.shared.loginedUser = User(appleid: account, password: pwd)
}
// 双重认证
let vc = APLogin2FAVC()
vc.cancelHandle = { [weak self] in
Expand All @@ -111,8 +118,11 @@ extension APLoginVC {
let code = response?.statusCode
// 登陆态有效
if code == 200 {
// 账号密码正确
UserCenter.shared.loginedUser = User(appleid: account, password: pwd)
// 保存账号密码
if self?.autoLoginBtn.state == .on {
UserCenter.shared.isAutoLogin = true
UserCenter.shared.loginedUser = User(appleid: account, password: pwd)
}
self?.validateSession()
} else {
self?.showTips("\(code ?? 0),\(error.debugDescription)")
Expand Down Expand Up @@ -140,6 +150,8 @@ extension APLoginVC {
}

func trusDevice() {
guard InfoCenter.shared.trusDevice else { return}

APClient.trusDevice(isTrus: true).request { result, response, error in
if response?.statusCode == 204 {
debugPrint("信任设备成功~")
Expand All @@ -166,6 +178,7 @@ extension APLoginVC {
func viewEnabled(_ isEnabled: Bool) {
showTips("")
loginBtn.isEnabled = isEnabled
historyBox.isHidden = true
isEnabled ? indicatorView.stopAnimation(nil) : indicatorView.startAnimation(nil)
}

Expand Down
Loading

0 comments on commit d3fb04c

Please sign in to comment.