@@ -551,46 +551,47 @@ static synchronized void start(final Context context, final String userId,
551551 }
552552 return ;
553553 }
554- // Reduce latency by running the rest of the start call in a background thread.
555- Util .executeAsyncTask (true , new AsyncTask <Void , Void , Void >() {
556- @ Override
557- protected Void doInBackground (Void ... params ) {
558- initializedMessageTemplates = true ;
559- MessageTemplates .register (Leanplum .getContext ());
560554
561- LeanplumInternal .setStartedInBackground (actuallyInBackground );
555+ initializedMessageTemplates = true ;
556+ MessageTemplates .register (Leanplum .getContext ());
562557
563- final Map <String , ?> validAttributes = LeanplumInternal .validateAttributes (attributes ,
564- "userAttributes" , true );
565- LeanplumInternal .setCalledStart (true );
558+ LeanplumInternal .setStartedInBackground (actuallyInBackground );
566559
567- if ( validAttributes != null ) {
568- LeanplumInternal . getUserAttributeChanges (). add ( validAttributes );
569- }
560+ final Map < String , ?> validAttributes = LeanplumInternal . validateAttributes ( attributes ,
561+ "userAttributes" , true );
562+ LeanplumInternal . setCalledStart ( true );
570563
571- RequestOld .loadToken ();
572- VarCache .setSilent (true );
573- VarCache .loadDiffs ();
574- VarCache .setSilent (false );
575- LeanplumInbox .getInstance ().load ();
576-
577- // Setup class members.
578- VarCache .onUpdate (new CacheUpdateBlock () {
579- @ Override
580- public void updateCache () {
581- triggerVariablesChanged ();
582- if (RequestOld .numPendingDownloads () == 0 ) {
583- triggerVariablesChangedAndNoDownloadsPending ();
584- }
585- }
586- });
587- RequestOld .onNoPendingDownloads (new RequestOld .NoPendingDownloadsCallback () {
588- @ Override
589- public void noPendingDownloads () {
590- triggerVariablesChangedAndNoDownloadsPending ();
591- }
592- });
564+ if (validAttributes != null ) {
565+ LeanplumInternal .getUserAttributeChanges ().add (validAttributes );
566+ }
567+
568+ RequestOld .loadToken ();
569+ VarCache .setSilent (true );
570+ VarCache .loadDiffs ();
571+ VarCache .setSilent (false );
572+ LeanplumInbox .getInstance ().load ();
573+
574+ // Setup class members.
575+ VarCache .onUpdate (new CacheUpdateBlock () {
576+ @ Override
577+ public void updateCache () {
578+ triggerVariablesChanged ();
579+ if (RequestOld .numPendingDownloads () == 0 ) {
580+ triggerVariablesChangedAndNoDownloadsPending ();
581+ }
582+ }
583+ });
584+ RequestOld .onNoPendingDownloads (new RequestOld .NoPendingDownloadsCallback () {
585+ @ Override
586+ public void noPendingDownloads () {
587+ triggerVariablesChangedAndNoDownloadsPending ();
588+ }
589+ });
593590
591+ // Reduce latency by running the rest of the start call in a background thread.
592+ Util .executeAsyncTask (true , new AsyncTask <Void , Void , Void >() {
593+ @ Override
594+ protected Void doInBackground (Void ... params ) {
594595 try {
595596 startHelper (userId , validAttributes , actuallyInBackground );
596597 } catch (Throwable t ) {
0 commit comments