apkfuckery/com.discord/smali/com/bugsnag/android/Notification.smali
2019-02-04 21:05:16 +01:00

234 lines
6.7 KiB
Smali

.class Lcom/bugsnag/android/Notification;
.super Ljava/lang/Object;
.source "Notification.java"
# interfaces
.implements Lcom/bugsnag/android/JsonStream$Streamable;
# instance fields
.field private final config:Lcom/bugsnag/android/Configuration;
.field private final errorFiles:Ljava/util/Collection;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Collection",
"<",
"Ljava/io/File;",
">;"
}
.end annotation
.end field
.field private final errors:Ljava/util/Collection;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Collection",
"<",
"Lcom/bugsnag/android/Error;",
">;"
}
.end annotation
.end field
# direct methods
.method constructor <init>(Lcom/bugsnag/android/Configuration;)V
.locals 1
.param p1, "config" # Lcom/bugsnag/android/Configuration;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.end param
.prologue
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lcom/bugsnag/android/Notification;->config:Lcom/bugsnag/android/Configuration;
new-instance v0, Ljava/util/LinkedList;
invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V
iput-object v0, p0, Lcom/bugsnag/android/Notification;->errors:Ljava/util/Collection;
new-instance v0, Ljava/util/LinkedList;
invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V
iput-object v0, p0, Lcom/bugsnag/android/Notification;->errorFiles:Ljava/util/Collection;
return-void
.end method
# virtual methods
.method addError(Lcom/bugsnag/android/Error;)V
.locals 1
.param p1, "error" # Lcom/bugsnag/android/Error;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.end param
.prologue
iget-object v0, p0, Lcom/bugsnag/android/Notification;->errors:Ljava/util/Collection;
invoke-interface {v0, p1}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
return-void
.end method
.method addError(Ljava/io/File;)V
.locals 1
.param p1, "errorFile" # Ljava/io/File;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.end param
.prologue
iget-object v0, p0, Lcom/bugsnag/android/Notification;->errorFiles:Ljava/util/Collection;
invoke-interface {v0, p1}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
return-void
.end method
.method deliver()I
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/bugsnag/android/HttpClient$NetworkException;,
Lcom/bugsnag/android/HttpClient$BadResponseException;
}
.end annotation
.prologue
iget-object v0, p0, Lcom/bugsnag/android/Notification;->config:Lcom/bugsnag/android/Configuration;
invoke-virtual {v0}, Lcom/bugsnag/android/Configuration;->getNotifyEndpoint()Ljava/lang/String;
move-result-object v0
invoke-static {v0, p0}, Lcom/bugsnag/android/HttpClient;->post(Ljava/lang/String;Lcom/bugsnag/android/JsonStream$Streamable;)V
iget-object v0, p0, Lcom/bugsnag/android/Notification;->errors:Ljava/util/Collection;
invoke-interface {v0}, Ljava/util/Collection;->size()I
move-result v0
iget-object v1, p0, Lcom/bugsnag/android/Notification;->errorFiles:Ljava/util/Collection;
invoke-interface {v1}, Ljava/util/Collection;->size()I
move-result v1
add-int/2addr v0, v1
return v0
.end method
.method public toStream(Lcom/bugsnag/android/JsonStream;)V
.locals 4
.param p1, "writer" # Lcom/bugsnag/android/JsonStream;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.end param
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-virtual {p1}, Lcom/bugsnag/android/JsonStream;->beginObject()Lcom/bugsnag/android/JsonWriter;
const-string v2, "apiKey"
invoke-virtual {p1, v2}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v2
iget-object v3, p0, Lcom/bugsnag/android/Notification;->config:Lcom/bugsnag/android/Configuration;
iget-object v3, v3, Lcom/bugsnag/android/Configuration;->apiKey:Ljava/lang/String;
invoke-virtual {v2, v3}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
const-string v2, "notifier"
invoke-virtual {p1, v2}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v2
invoke-static {}, Lcom/bugsnag/android/Notifier;->getInstance()Lcom/bugsnag/android/Notifier;
move-result-object v3
invoke-virtual {v2, v3}, Lcom/bugsnag/android/JsonStream;->value(Lcom/bugsnag/android/JsonStream$Streamable;)V
const-string v2, "events"
invoke-virtual {p1, v2}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v2
invoke-virtual {v2}, Lcom/bugsnag/android/JsonStream;->beginArray()Lcom/bugsnag/android/JsonWriter;
iget-object v2, p0, Lcom/bugsnag/android/Notification;->errors:Ljava/util/Collection;
invoke-interface {v2}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
move-result-object v2
:goto_0
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v3
if-eqz v3, :cond_0
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/bugsnag/android/Error;
.local v0, "error":Lcom/bugsnag/android/Error;
invoke-virtual {p1, v0}, Lcom/bugsnag/android/JsonStream;->value(Lcom/bugsnag/android/JsonStream$Streamable;)V
goto :goto_0
.end local v0 # "error":Lcom/bugsnag/android/Error;
:cond_0
iget-object v2, p0, Lcom/bugsnag/android/Notification;->errorFiles:Ljava/util/Collection;
invoke-interface {v2}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
move-result-object v2
:goto_1
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v3
if-eqz v3, :cond_1
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/io/File;
.local v1, "errorFile":Ljava/io/File;
invoke-virtual {p1, v1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/io/File;)V
goto :goto_1
.end local v1 # "errorFile":Ljava/io/File;
:cond_1
invoke-virtual {p1}, Lcom/bugsnag/android/JsonStream;->endArray()Lcom/bugsnag/android/JsonWriter;
invoke-virtual {p1}, Lcom/bugsnag/android/JsonStream;->endObject()Lcom/bugsnag/android/JsonWriter;
return-void
.end method