Created
March 18, 2021 14:49
-
-
Save kayahanbaskeser/6dc4958c3ea8df844e0b864aa38d5876 to your computer and use it in GitHub Desktop.
CheckIapAvailability update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void CheckIapAvailability() | |
{ | |
iapClient = Iap.GetIapClient(); | |
ITask<EnvReadyResult> task = iapClient.EnvReady; | |
task.AddOnSuccessListener((result) => | |
{ | |
Debug.Log($"{TAG}: checkIapAvailabity SUCCESS"); | |
iapAvailable = true; | |
OnCheckIapAvailabilitySuccess?.Invoke(); | |
}).AddOnFailureListener(exception => | |
{ | |
Debug.Log($"{TAG}: Error on checkIapAvailabity"); | |
IapApiException iapApiException = exception.AsIapApiException(); | |
Status status = iapApiException.Status; | |
if (status.HasResolution()) | |
{ | |
status.StartResolutionForResult( | |
intent => { | |
iapAvailable = true; | |
Debug.Log($"{TAG}: checkIapAvailabity SUCCESS"); | |
OnCheckIapAvailabilitySuccess?.Invoke(); | |
}, | |
ex => | |
{ | |
Debug.Log($"{TAG}: Error on checkIapAvailabity2"); | |
iapClient = null; | |
iapAvailable = false; | |
OnCheckIapAvailabilityFailure?.Invoke(exception); | |
}); | |
} else | |
{ | |
Debug.Log($"{TAG}: Error on checkIapAvailabity3"); | |
iapClient = null; | |
iapAvailable = false; | |
OnCheckIapAvailabilityFailure?.Invoke(exception); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment