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