null check PushTargetMessenger
This commit is contained in:
parent
a62a7a4a84
commit
9b832e1285
|
@ -12,6 +12,7 @@ import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
@ -85,24 +86,24 @@ public class UnifiedPushBroker {
|
||||||
service.sendPresencePacket(account, presence);
|
service.sendPresencePacket(account, presence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Transport> renewUnifiedPushEndpoints() {
|
public void renewUnifiedPushEndpoints() {
|
||||||
return renewUnifiedPushEndpoints(null);
|
renewUnifiedPushEndpoints(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Transport> renewUnifiedPushEndpoints(final PushTargetMessenger pushTargetMessenger) {
|
public Optional<Transport> renewUnifiedPushEndpoints(@Nullable final PushTargetMessenger pushTargetMessenger) {
|
||||||
final Optional<Transport> transportOptional = getTransport();
|
final Optional<Transport> transportOptional = getTransport();
|
||||||
if (transportOptional.isPresent()) {
|
if (transportOptional.isPresent()) {
|
||||||
final Transport transport = transportOptional.get();
|
final Transport transport = transportOptional.get();
|
||||||
if (transport.account.isEnabled()) {
|
if (transport.account.isEnabled()) {
|
||||||
renewUnifiedEndpoint(transportOptional.get(), pushTargetMessenger);
|
renewUnifiedEndpoint(transportOptional.get(), pushTargetMessenger);
|
||||||
} else {
|
} else {
|
||||||
if (pushTargetMessenger.messenger != null) {
|
if (pushTargetMessenger != null && pushTargetMessenger.messenger != null) {
|
||||||
sendRegistrationDelayed(pushTargetMessenger.messenger,"account is disabled");
|
sendRegistrationDelayed(pushTargetMessenger.messenger,"account is disabled");
|
||||||
}
|
}
|
||||||
Log.d(Config.LOGTAG, "skipping UnifiedPush endpoint renewal. Account is disabled");
|
Log.d(Config.LOGTAG, "skipping UnifiedPush endpoint renewal. Account is disabled");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pushTargetMessenger.messenger != null) {
|
if (pushTargetMessenger != null && pushTargetMessenger.messenger != null) {
|
||||||
sendRegistrationDelayed(pushTargetMessenger.messenger,"no transport selected");
|
sendRegistrationDelayed(pushTargetMessenger.messenger,"no transport selected");
|
||||||
}
|
}
|
||||||
Log.d(Config.LOGTAG, "skipping UnifiedPush endpoint renewal. No transport selected");
|
Log.d(Config.LOGTAG, "skipping UnifiedPush endpoint renewal. No transport selected");
|
||||||
|
|
Loading…
Reference in a new issue