public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) return; this.restoreCallback = restoreCallback; native.CallStatic("Restore"); }
private async void restoreAsync(InAppPurchaseRestoreCallbackMethod restoreCallback) #endif { #if WINDOWS_PHONE WinRTPlugin.Dispatcher.BeginInvoke(delegate() #else await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate() #endif { foreach (var inAppID in InAppIDs) { #if WINDOWS_PHONE if (testing) { var testProductID = wp8TestListingInformation.ProductListings[inAppID.ID].ProductId; restoreCallback(inAppID.ID, wp8TestLicenseInformation.ProductLicenses[testProductID].IsActive && !wp8TestLicenseInformation.ProductLicenses[testProductID].IsConsumable); } else { restoreCallback(inAppID.ID, licenseInformation.ProductLicenses[inAppID.ID].IsActive && !licenseInformation.ProductLicenses[inAppID.ID].IsConsumable); } #else restoreCallback(inAppID.ID, licenseInformation.ProductLicenses[inAppID.ID].IsActive && inAppID.Type != InAppPurchaseTypes.Consumable); #endif } }); }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) { return; } restoreAsync(restoreCallback); }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) return; foreach (var inAppID in InAppIDs) { restoreCallback(inAppID.ID, true); } }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) { return; } this.restoreCallback = restoreCallback; native.CallStatic("Restore"); }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) { return; } this.restoreCallback = restoreCallback; RestoreInAppPurchase(native); }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) { return; } foreach (var inAppID in InAppIDs) { restoreCallback(inAppID.ID, true); } }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { #if !IOS_DISABLE_APPLE_IAP if (restoreCallback == null) { return; } this.restoreCallback = restoreCallback; RestoreInAppPurchase(native); #endif }
/// <summary> /// Use to restore purchased items. /// NOTE: This will check the IAP server for existing items owned by the user. /// </summary> /// <param name="restoreCallback">The callback that fires when done.</param> public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoringProducts || buyingProduct) { Debug.LogError("You must wait for the last restore, buy or consume to finish!"); if (restoreCallback != null) { restoreCallback(null, false); } return; } restoringProducts = true; this.restoreCallback = restoreCallback; plugin.Restore(async_RestoreCallback); }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) return; restoreAsync(restoreCallback); }
private void restoreAsync(InAppPurchaseRestoreCallbackMethod restoreCallback)
/// <summary> /// Use to restore purchased items. /// NOTE: This will check the IAP server for existing items owned by the user. /// </summary> /// <param name="restoreCallback">The callback that fires when done.</param> public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoringProducts || buyingProduct) { Debug.LogError("You must wait for the last restore, buy or consume to finish!"); if (restoreCallback != null) restoreCallback(null, false); return; } restoringProducts = true; this.restoreCallback = restoreCallback; plugin.Restore(async_RestoreCallback); }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) return; this.restoreCallback = restoreCallback; RestoreInAppPurchase(native); }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { Native.Restore(restoreCallback); }
private async void restoreAsync(InAppPurchaseRestoreCallbackMethod restoreCallback) #endif { #if WINDOWS_PHONE WinRTPlugin.Dispatcher.BeginInvoke(delegate() #else await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate() #endif { foreach (var inAppID in InAppIDs) { #if WINDOWS_PHONE if (testing) { var testProductID = wp8TestListingInformation.ProductListings[inAppID.ID].ProductId; ReignServices.InvokeOnUnityThread(delegate { restoreCallback(inAppID.ID, wp8TestLicenseInformation.ProductLicenses[testProductID].IsActive && !wp8TestLicenseInformation.ProductLicenses[testProductID].IsConsumable); }); } else { ReignServices.InvokeOnUnityThread(delegate { restoreCallback(inAppID.ID, licenseInformation.ProductLicenses[inAppID.ID].IsActive && !licenseInformation.ProductLicenses[inAppID.ID].IsConsumable); }); } #else ReignServices.InvokeOnUnityThread(delegate { restoreCallback(inAppID.ID, licenseInformation.ProductLicenses[inAppID.ID].IsActive && inAppID.Type != InAppPurchaseTypes.Consumable); }); #endif } }); }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) return; int id = Common.getpid(); string windowGroup = id.ToString(); uint reqID = 0; if (paymentservice_get_existing_purchases_request(!testing, windowGroup, ref reqID) != 0) { foreach (var inAppID in InAppIDs) { restoreCallback(inAppID.ID, false); } return; } // wait for event var recoveredApps = new List<string>(); while (true) { IntPtr _event = IntPtr.Zero; Common.bps_get_event(ref _event, -1);// wait here for next event if (_event != IntPtr.Zero) { if (paymentservice_get_domain() == Common.bps_event_get_domain(_event)) { if (paymentservice_event_get_response_code(_event) == 0) { for (int i = 0; i != InAppIDs.Length; ++i) { IntPtr inAppIDPtr = paymentservice_event_get_digital_good_sku(_event, (uint)i); string inAppID = Marshal.PtrToStringAnsi(inAppIDPtr); if (Common.bps_event_get_code(_event) == 0) { // purchased recoveredApps.Add(inAppID); } else { // already purchased recoveredApps.Add(inAppID); } } } else { IntPtr errorPtr = paymentservice_event_get_error_text(_event); Debug.LogError(Marshal.PtrToStringAnsi(errorPtr)); foreach (var inAppID in InAppIDs) { restoreCallback(inAppID.ID, false); } return; } foreach (var inAppID in InAppIDs) { bool found = false; foreach (var app2 in recoveredApps) { if (inAppID.ID == app2) { found = true; break; } } restoreCallback(inAppID.ID, found && inAppID.Type != InAppPurchaseTypes.Consumable); } return; } } } }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { if (restoreCallback == null) { return; } int id = Common.getpid(); string windowGroup = id.ToString(); uint reqID = 0; if (paymentservice_get_existing_purchases_request(!testing, windowGroup, ref reqID) != 0) { foreach (var inAppID in InAppIDs) { restoreCallback(inAppID.ID, false); } return; } // wait for event var recoveredApps = new List <string>(); while (true) { IntPtr _event = IntPtr.Zero; Common.bps_get_event(ref _event, -1); // wait here for next event if (_event != IntPtr.Zero) { if (paymentservice_get_domain() == Common.bps_event_get_domain(_event)) { if (paymentservice_event_get_response_code(_event) == 0) { for (int i = 0; i != InAppIDs.Length; ++i) { IntPtr inAppIDPtr = paymentservice_event_get_digital_good_sku(_event, (uint)i); string inAppID = Marshal.PtrToStringAnsi(inAppIDPtr); if (Common.bps_event_get_code(_event) == 0) { // purchased recoveredApps.Add(inAppID); } else { // already purchased recoveredApps.Add(inAppID); } } } else { IntPtr errorPtr = paymentservice_event_get_error_text(_event); Debug.LogError(Marshal.PtrToStringAnsi(errorPtr)); foreach (var inAppID in InAppIDs) { restoreCallback(inAppID.ID, false); } return; } foreach (var inAppID in InAppIDs) { bool found = false; foreach (var app2 in recoveredApps) { if (inAppID.ID == app2) { found = true; break; } } restoreCallback(inAppID.ID, found && inAppID.Type != InAppPurchaseTypes.Consumable); } return; } } } }
/// <summary> /// Dumy method. /// </summary> /// <param name="restoreCallback"></param> public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { // do nothing... }
public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback) { #if !IOS_DISABLE_APPLE_IAP if (restoreCallback == null) return; this.restoreCallback = restoreCallback; RestoreInAppPurchase(native); #endif }