private void GetReferralData() { GetSocial.GetReferralData( referralData => { var logMessage = String.Empty; if (referralData != null) { logMessage += string.Format("Token: {0}\n", referralData.Token); logMessage += string.Format("Referrer user id: {0}\n", referralData.ReferrerUserId); logMessage += string.Format("Referrer channel: {0}\n", referralData.ReferrerChannelId); logMessage += string.Format("Is first match: {0}\n", referralData.IsFirstMatch); logMessage += string.Format("Is guarateed match: {0}\n", referralData.IsGuaranteedMatch); logMessage += "Referral Link params:\n" + referralData.ReferralLinkParams.ToDebugString(); } else { logMessage += "No referral data retrieved"; } _console.LogD("Referral data: \n" + logMessage); }, error => _console.LogE(string.Format("Failed to get referral data: {0}", error.Message)) ); }
private void OnApplicationPause(bool pauseStatus) { if (!pauseStatus) { GetSocial.WhenInitialized(() => { if (_latestChatId != null) { ShowChat(); } else { GetSocial.GetReferralData( data => { var referralToken = ""; var message = "Referral data: " + data; string promoCode = null; if (data == null) { message = "No referral data"; } else { promoCode = data.ReferralLinkParams.ContainsKey(LinkParams.KeyPromoCode) ? data.ReferralLinkParams[LinkParams.KeyPromoCode] : null; referralToken = data.Token; } if (!referralToken.Equals(_latestReferralData)) { // show popup only if chat is not shown if (_latestChatId == null) { if (promoCode != null) { message += "\n\nPROMO CODE: " + promoCode; } var popup = new MNPopup("Referral Data", message); popup.AddAction("OK", () => { }); if (promoCode != null) { popup.AddAction("Claim Promo Code", () => PromoCodesSection.ClaimPromoCode(promoCode)); } popup.Show(); } _console.LogD(message); _latestReferralData = referralToken; } }, error => _console.LogE("Failed to get referral data: " + error.Message) ); } }); } else { GetSocialUi.CloseView(false); } }