public void CheckVersion(Action onVersionMatch, Action onVersionMismatch, bool runCallbackOnUIThread = false) { if (!TsumTsumWebHelper.CanPerformWebRequest(this)) { return; } TsumTsumWebHelper.PerformPostRequest( "requestType=version", (result) => { string retrievedVersion = result[TsumTsumWebHelper.DATA_KEY]; if (!string.IsNullOrEmpty(retrievedVersion)) { if (VERSION == retrievedVersion) { RunCallback(onVersionMatch, runCallbackOnUIThread); } else { RunCallback(onVersionMismatch, runCallbackOnUIThread); } } else { Log.Error(TAG, $"Empty or null result from ({TsumTsumWebHelper.DATA_KEY}), from json: {result.ToString()}"); } }, () => { RunCallback(onVersionMismatch, runCallbackOnUIThread); } ); }
public void SendNotification(string senderName, Action onNotificationSendSuccess, Action onNotificationSendFailed) { if (!TsumTsumWebHelper.CanPerformWebRequest(this)) { return; } if (string.IsNullOrEmpty(senderName)) { return; } TsumTsumWebHelper.PerformPostRequest( $"requestType=notification&appcode=ttht_vTOz_598b7075b7141&senderName={senderName}", (result) => { Boolean succeeded = result[TsumTsumWebHelper.DATA_KEY]; if (succeeded) { onNotificationSendSuccess(); } else { onNotificationSendFailed(); } }, onNotificationSendFailed ); }
public void CheckAppCode(string appcode, Action onAppcodeVerified, Action onAppcodeDenied, bool runCallbackOnUIThread = false) { if (!TsumTsumWebHelper.CanPerformWebRequest(this)) { return; } TsumTsumWebHelper.PerformPostRequest( $"requestType=verify&appcode={appcode}", (result) => { Boolean succeeded = result[TsumTsumWebHelper.DATA_KEY]; if (succeeded) { RunCallback(onAppcodeVerified, runCallbackOnUIThread); } else { RunCallback(onAppcodeDenied, runCallbackOnUIThread); } }, () => { RunCallback(onAppcodeDenied, runCallbackOnUIThread); } ); }