private void checkQueue() { StomtCreation stomtCreation = StomtOfflineQueue <StomtCreation> .pop(); if (stomtCreation != null) { Debug.Log("Send queued Stomt: " + stomtCreation); this.SendStomt(stomtCreation); return; } StomtSubscription stomtSubscription = StomtOfflineQueue <StomtSubscription> .pop(); if (stomtSubscription != null) { Debug.Log("Send queued Subscription: " + stomtSubscription); this.SendSubscription(stomtSubscription); return; } StomtTrack stomtTrack = StomtOfflineQueue <StomtTrack> .pop(); if (stomtTrack != null) { Debug.Log("Send queued Track: " + stomtTrack); this.SendTrack(stomtTrack); return; } }
private void SubmitSubscription() { if (!string.IsNullOrEmpty(_EmailInput.text)) { StomtSubscription subscription = new StomtSubscription(); subscription.message = this._api.lang.getString("SDK_SUBSCRIBE_GET_NOTIFIED"); if (this.useEmailOnSubscribe) { subscription.email = this._EmailInput.text; } else { subscription.phone = this._EmailInput.text; } this._api.SendSubscription(subscription); } }
public void SendSubscription(StomtSubscription subscription, Action <LitJsonStomt.JsonData> callbackSuccess = null, Action <HttpWebResponse> callbackError = null) { var url = string.Format("{0}/authentication/subscribe", restServerURL); GetPOSTResponse(url, subscription.ToString(), (response) => { StomtConfig.Subscribed = true; var track = this.initStomtTrack(); track.event_category = "auth"; track.event_action = "subscribed"; this.SendTrack(track); if (callbackSuccess != null) { callbackSuccess(response); } }, callbackError, () => { // save and send later StomtOfflineQueue <StomtSubscription> .add(subscription); }); }