Ejemplo n.º 1
0
    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);
        }
    }
Ejemplo n.º 2
0
 private void GetSocialSignIn()
 {
     GetSocial.WhenInitialized(OnGetSocialInitialized);
 }