예제 #1
0
        private void HandleRegisterSuccess(GuestControllerResult <LogInResponse> result, IEnumerable <Disney.Mix.SDK.Internal.GuestControllerDomain.MarketingItem> marketing, Action <IRegisterResult> callback)
        {
            IList <IInvalidProfileItemError> profileItemErrors = null;

            try
            {
                if (!result.Success)
                {
                    callback(new RegisterResult(success: false, null, null));
                    return;
                }
                IRegisterResult registerResult = GuestControllerErrorParser.GetRegisterResult(result.Response.error);
                if (registerResult != null)
                {
                    callback(registerResult);
                    return;
                }
                profileItemErrors = GuestControllerErrorParser.GetRegisterProfileItemErrors(result.Response.error);
                if (result.Response.data == null)
                {
                    if (result.Response.error != null && profileItemErrors == null)
                    {
                        logger.Critical("Received unhandled error exception" + JsonParser.ToJson(result.Response.error));
                    }
                    callback(new RegisterResult(success: false, null, profileItemErrors));
                    return;
                }
                LogInData loginData = result.Response.data;
                if (loginData.displayName == null || loginData.etag == null || loginData.profile == null || loginData.token == null || loginData.token.access_token == null)
                {
                    logger.Critical("Invalid login data:" + JsonParser.ToJson(loginData));
                    callback(new RegisterResult(success: false, null, profileItemErrors));
                    return;
                }
                loginData.profile.status = GuestControllerErrorParser.GetAccountStatusCode(result.Response.error, loginData.profile.status);
                string countryCode = GuestControllerUtils.GetCountryCode(loginData.profile);
                database.StoreSession(loginData.token.swid, loginData.token.access_token, loginData.token.refresh_token, loginData.displayName.displayName, loginData.profile.firstName, loginData.etag, loginData.profile.ageBand, loginData.displayName.proposedDisplayName, loginData.displayName.proposedStatus, loginData.profile.status, updateLastProfileRefreshTime: true, countryCode);
                mixSessionStarter.Start(loginData.token.swid, loginData.token.access_token, delegate
                {
                    HandleMixSessionStartSuccess(profileItemErrors, loginData.token.swid, loginData.profile, loginData.displayName, marketing, callback);
                }, delegate
                {
                    callback(new RegisterResult(success: false, null, profileItemErrors));
                });
            }
            catch (CorruptionException ex)
            {
                logger.Fatal("Corruption detected during registration: " + ex);
                callback(new RegisterCorruptionDetectedResult());
            }
            catch (Exception ex2)
            {
                logger.Critical("Unhandled exception: " + ex2);
                callback(new RegisterResult(success: false, null, profileItemErrors));
            }
        }
예제 #2
0
 private void UpdateProfile(Profile profile)
 {
     if (profile != null)
     {
         DateOfBirth         = GuestControllerUtils.ParseDateTime(logger, profile.dateOfBirth);
         AgeBandKey          = profile.ageBand;
         AgeBandAssumed      = profile.ageBandAssumed;
         Email               = profile.email;
         EmailVerified       = profile.emailVerified;
         FirstName           = profile.firstName;
         LastName            = profile.lastName;
         MiddleName          = profile.middleName;
         ParentEmail         = profile.parentEmail;
         ParentEmailVerified = profile.parentEmailVerified;
         Username            = profile.username;
         LanguagePreference  = profile.languagePreference;
         CountryCode         = GuestControllerUtils.GetCountryCode(profile);
         AccountStatus       = AccountStatusFactory.Create(profile.status);
         IsAdultVerified     = profile.isAdultVerified;
     }
 }
예제 #3
0
        private void StoreSession(string swid, string accessToken, string refreshToken, string etag, Disney.Mix.SDK.Internal.GuestControllerDomain.DisplayName displayName, Profile profile)
        {
            string countryCode = GuestControllerUtils.GetCountryCode(profile);

            database.StoreSession(swid, accessToken, refreshToken, displayName.displayName, profile.firstName, etag, profile.ageBand, displayName.proposedDisplayName, displayName.proposedStatus, profile.status, updateLastProfileRefreshTime: true, countryCode);
        }