Commit fbc1b8de authored by Mazy's avatar Mazy

optimize mine logic

parent e97306ac
...@@ -158,6 +158,7 @@ class ZTPurchaseManager: NSObject { ...@@ -158,6 +158,7 @@ class ZTPurchaseManager: NSObject {
print("Restore Success: \(results.restoredPurchases)") print("Restore Success: \(results.restoredPurchases)")
if let product = results.restoredPurchases.last { if let product = results.restoredPurchases.last {
if product.needsFinishTransaction {
let receiptData = SwiftyStoreKit.localReceiptData let receiptData = SwiftyStoreKit.localReceiptData
let receiptString = receiptData?.base64EncodedString(options: []) ?? "" let receiptString = receiptData?.base64EncodedString(options: []) ?? ""
print("receiptString: \(receiptString)") print("receiptString: \(receiptString)")
...@@ -175,17 +176,15 @@ class ZTPurchaseManager: NSObject { ...@@ -175,17 +176,15 @@ class ZTPurchaseManager: NSObject {
guard let status = data["status"] as? Bool, status == true else { guard let status = data["status"] as? Bool, status == true else {
return return
} }
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
print("Purchase Success: \(product.productId)") print("Purchase Success: \(product.productId)")
SwiftyStoreKit.finishTransaction(product.transaction)
success() success()
}) { (error) in }) { (error) in
innerHud.hide(animated: true) innerHud.hide(animated: true)
} }
} }
}
} else { } else {
MBProgressHUD.showError("没有商品可恢复") MBProgressHUD.showError("没有商品可恢复")
print("Nothing to Restore") print("Nothing to Restore")
......
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
if (Member) { if (Member) {
_gongNengLabel.text = kLocalizedString(@"mine_unlocked"); _gongNengLabel.text = kLocalizedString(@"mine_unlocked");
_timeLabel.text = kLocalizedString(@"mine_free_used"); _timeLabel.text = kLocalizedString(@"mine_free_used");
// _xuFeiButton.hidden = YES; _xuFeiButton.hidden = YES;
}else{ }else{
_gongNengLabel.text = kLocalizedString(@"mine_premium_services_locked"); _gongNengLabel.text = kLocalizedString(@"mine_premium_services_locked");
_timeLabel.text = kLocalizedString(@"mine_unlock_more_services"); _timeLabel.text = kLocalizedString(@"mine_unlock_more_services");
...@@ -197,10 +197,20 @@ ...@@ -197,10 +197,20 @@
_nicknameLabel.text = userInfo.nickname; _nicknameLabel.text = userInfo.nickname;
} }
}else{ }else{
if (Member) {
_gongNengLabel.text = kLocalizedString(@"mine_unlocked");
_timeLabel.text = kLocalizedString(@"mine_free_used");
_nicknameLabel.text = kLocalizedString(@"mine_sign"); // [[data Read] objectForKey:@"NickName"]; _nicknameLabel.text = kLocalizedString(@"mine_sign"); // [[data Read] objectForKey:@"NickName"];
_xuFeiButton.hidden = true;
}else{
_gongNengLabel.text = kLocalizedString(@"mine_premium_services_locked"); _gongNengLabel.text = kLocalizedString(@"mine_premium_services_locked");
_timeLabel.text = kLocalizedString(@"mine_unlock_more_services"); _timeLabel.text = kLocalizedString(@"mine_unlock_more_services");
[_xuFeiButton setTitle:kLocalizedString(@"mine_unlock") forState:(UIControlStateNormal)]; [_xuFeiButton setTitle:kLocalizedString(@"mine_unlock") forState:(UIControlStateNormal)];
_xuFeiButton.hidden = false;
}
// _gongNengLabel.text = kLocalizedString(@"mine_premium_services_locked");
// _timeLabel.text = kLocalizedString(@"mine_unlock_more_services");
// [_xuFeiButton setTitle:kLocalizedString(@"mine_unlock") forState:(UIControlStateNormal)];
} }
if ([userInfo.uid isEqual: @""]) { if ([userInfo.uid isEqual: @""]) {
......
...@@ -156,7 +156,7 @@ appName = "Family Mapp"; ...@@ -156,7 +156,7 @@ appName = "Family Mapp";
"mine_sign"="Sign in"; "mine_sign"="Sign in";
"mine_click_nickname"="Click name to edit"; "mine_click_nickname"="Click name to edit";
"mine_unlock_more_services"="Unlock to access Premium services"; "mine_unlock_more_services"="Unlock to access Premium services";
"mine_unlock"="Unlocked"; "mine_unlock"="Unlock";
"mine_userID"="User ID"; "mine_userID"="User ID";
"mine_track"="My track"; "mine_track"="My track";
"mine_emergenry_contacts"="Emergency contacts"; "mine_emergenry_contacts"="Emergency contacts";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment