a.java 2.79 KB
package com.instabug.library.d.a;

import android.content.Context;
import android.content.IntentFilter;
import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager;
import com.instabug.library.a.c;
import com.instabug.library.a.c.b;
import com.instabug.library.e.d;
import com.instabug.library.u;
import com.instabug.library.util.InstabugSDKLogger;
import java.util.List;
import rx.functions.Action1;

public class a
  implements com.instabug.library.a.a.a, com.instabug.library.a.c.a
{
  private static a b = null;
  com.instabug.library.internal.module.a a;
  private Context c;
  private Handler d;
  private a e;
  private LocalBroadcastManager f;
  private com.instabug.library.a.a g;
  private c h;
  private boolean i = false;
  private boolean j = false;
  private boolean k = false;
  
  private a(Context paramContext)
  {
    this.c = paramContext;
    this.a = new com.instabug.library.internal.module.a();
    this.f = LocalBroadcastManager.getInstance(this.c);
  }
  
  public static a a(Context paramContext)
  {
    if (b == null) {
      b = new a(paramContext);
    }
    return b;
  }
  
  private void e()
  {
    this.i = false;
    if ((this.d != null) && (this.e != null)) {
      this.d.removeCallbacks(this.e);
    }
  }
  
  private void f()
  {
    this.h = new c(this);
    this.f.registerReceiver(this.h, new IntentFilter("Session state changed"));
  }
  
  public void a()
  {
    InstabugSDKLogger.v(this, "initializing SynchronizationManager");
    this.d = new Handler();
    this.e = new a((byte)0);
    if (u.a().s() != 0L)
    {
      f();
      this.k = true;
    }
    this.g = new com.instabug.library.a.a(this);
    this.f.registerReceiver(this.g, new IntentFilter("User last contact at changed"));
  }
  
  public void a(c.b paramb)
  {
    InstabugSDKLogger.d(this, "SessionStateChanged: " + paramb);
    if (paramb == c.b.c) {
      e();
    }
    while (this.j) {
      return;
    }
    b();
  }
  
  public void b()
  {
    this.i = true;
    this.d.post(this.e);
  }
  
  public void c()
  {
    InstabugSDKLogger.d(this, "LastContactedAtChanged");
    if (!this.k)
    {
      InstabugSDKLogger.d(this, "Register session state receivers");
      this.k = true;
      f();
    }
    if ((u.a().t()) && (!this.j))
    {
      e();
      b();
    }
  }
  
  public void d()
  {
    e();
    this.d = null;
    this.e = null;
    this.f.unregisterReceiver(this.g);
    this.g = null;
    this.f.unregisterReceiver(this.h);
    this.h = null;
    this.k = false;
  }
  
  final class a
    implements Runnable
  {
    private a() {}
    
    public final void run()
    {
      a.a(a.this, new Action1() {});
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/instabug/library/d/a/a.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */