Skip to content

Commit

Permalink
Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
xurei committed Oct 22, 2020
1 parent 8d8b42d commit cda753f
Showing 1 changed file with 25 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ public void run() {
try {
if (senderId != null) {
FirebaseInstanceId.getInstance().deleteToken(senderId, FCM_VALUE);
}
else {
} else {
FirebaseInstanceId.getInstance().deleteInstanceId();
}

Expand Down Expand Up @@ -303,33 +302,32 @@ public void run() {
private Task<String> getToken(final String senderId) {
if (senderId == null) {
return FirebaseInstanceId.getInstance()
.getInstanceId()
.continueWithTask(new Continuation<InstanceIdResult, Task<String>>() {
@Override
public Task<String> then(@NonNull Task<InstanceIdResult> task) throws Exception {
if (!task.isSuccessful()) {
return Tasks.forException(task.getException());
}
InstanceIdResult result = task.getResult();
return Tasks.forResult(task.getResult().getToken());
}
});
}
else {
.getInstanceId()
.continueWithTask(
new Continuation<InstanceIdResult, Task<String>>() {
@Override
public Task<String> then(@NonNull Task<InstanceIdResult> task) throws Exception {
if (!task.isSuccessful()) {
return Tasks.forException(task.getException());
}
InstanceIdResult result = task.getResult();
return Tasks.forResult(task.getResult().getToken());
}
});
} else {
final TaskCompletionSource<String> task = new TaskCompletionSource<String>();
new Thread(
new Runnable() {
@Override
public void run() {
try {
task.setResult(FirebaseInstanceId.getInstance().getToken(senderId, FCM_VALUE));
}
catch (IOException e) {
task.setException(e);
}
}
})
.start();
new Runnable() {
@Override
public void run() {
try {
task.setResult(FirebaseInstanceId.getInstance().getToken(senderId, FCM_VALUE));
} catch (IOException e) {
task.setException(e);
}
}
})
.start();
return task.getTask();
}
}
Expand Down

0 comments on commit cda753f

Please sign in to comment.