d.java 3.11 KB
package com.instabug.library.e.a;

import android.content.Context;
import com.instabug.library.e.a;
import com.instabug.library.e.a.a;
import com.instabug.library.e.c;
import com.instabug.library.e.c.a;
import com.instabug.library.e.c.b;
import com.instabug.library.e.c.c;
import com.instabug.library.e.c.d;
import com.instabug.library.model.e;
import com.instabug.library.model.e.a;
import com.instabug.library.util.InstabugSDKLogger;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import org.json.JSONException;
import rx.Observable;
import rx.Subscriber;

public class d
{
  private static d a;
  private a b = new a();
  
  public static d a()
  {
    if (a == null) {
      a = new d();
    }
    return a;
  }
  
  public void a(final Context paramContext, com.instabug.library.model.d paramd, final c.a<String, Throwable> parama)
    throws JSONException, IOException
  {
    InstabugSDKLogger.d(this, "Reporting issue");
    c localc = this.b.a(paramContext, c.b.a, c.d.b);
    localc.a(paramd.c());
    this.b.a(localc).subscribe(new Subscriber()
    {
      public final void onCompleted()
      {
        InstabugSDKLogger.d(this, "reportIssue request completed");
      }
      
      public final void onError(Throwable paramAnonymousThrowable)
      {
        InstabugSDKLogger.d(this, "reportIssue request got error: " + paramAnonymousThrowable.getMessage());
        parama.a(paramAnonymousThrowable);
      }
      
      public final void onStart()
      {
        InstabugSDKLogger.d(this, "reportIssue request started");
      }
    });
  }
  
  public void b(Context paramContext, final com.instabug.library.model.d paramd, final c.a<Boolean, com.instabug.library.model.d> parama)
    throws JSONException, FileNotFoundException
  {
    InstabugSDKLogger.d(this, "Uploading issue attachments");
    Observable[] arrayOfObservable = new Observable[paramd.b().size()];
    int i = 0;
    while (i < arrayOfObservable.length)
    {
      e locale = (e)paramd.b().get(i);
      c localc = this.b.a(paramContext, c.b.b, c.d.b, a.a.b);
      localc.a("issue_occurrence_id", locale.c());
      localc.a("file_type", locale.b().toString());
      localc.a(new c.c("file", locale.d(), locale.e(), locale.a()));
      arrayOfObservable[i] = this.b.a(localc);
      i += 1;
    }
    Observable.merge(arrayOfObservable, 1).subscribe(new Subscriber()
    {
      public final void onCompleted()
      {
        InstabugSDKLogger.d(this, "uploadIssueAttachment request completed");
        if (paramd.b().size() == 0) {
          parama.b(Boolean.valueOf(true));
        }
      }
      
      public final void onError(Throwable paramAnonymousThrowable)
      {
        InstabugSDKLogger.d(this, "uploadIssueAttachment request got error: " + paramAnonymousThrowable.getMessage());
        parama.a(paramd);
      }
      
      public final void onStart()
      {
        InstabugSDKLogger.d(this, "uploadIssueAttachment request started");
      }
    });
  }
}


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