Fixed some null checks

This commit is contained in:
Sylvain Berfini 2020-09-16 10:44:59 +02:00
parent 05b272fcb8
commit 3215ecc328
14 changed files with 31 additions and 31 deletions

View file

@ -78,12 +78,12 @@ class AccountLoginViewModel(accountCreator: AccountCreator) : AbstractPhoneViewM
private var proxyConfigToCheck: ProxyConfig? = null
private val coreListener = object : CoreListenerStub() {
override fun onRegistrationStateChanged(
core: Core,
cfg: ProxyConfig,
state: RegistrationState,
message: String?
) {
override fun onRegistrationStateChanged(
core: Core,
cfg: ProxyConfig,
state: RegistrationState,
message: String
) {
if (cfg == proxyConfigToCheck) {
Log.i("[Assistant] [Account Login] Registration state is $state: $message")
waitForServerAnswer.value = false

View file

@ -65,7 +65,7 @@ class GenericLoginViewModel(private val accountCreator: AccountCreator) : ViewMo
core: Core,
cfg: ProxyConfig,
state: RegistrationState,
message: String?
message: String
) {
if (cfg == proxyConfigToCheck) {
Log.i("[Assistant] [Generic Login] Registration state is $state: $message")

View file

@ -33,9 +33,9 @@ class QrCodeViewModel : ViewModel() {
val showSwitchCamera = MutableLiveData<Boolean>()
private val listener = object : CoreListenerStub() {
override fun onQrcodeFound(core: Core, result: String) {
override fun onQrcodeFound(core: Core, result: String?) {
Log.i("[QR Code] Found [$result]")
qrCodeFoundEvent.postValue(Event(result))
if (result != null) qrCodeFoundEvent.postValue(Event(result))
}
}

View file

@ -38,7 +38,7 @@ class RemoteProvisioningViewModel : ViewModel() {
val fetchSuccessfulEvent = MutableLiveData<Event<Boolean>>()
private val listener = object : CoreListenerStub() {
override fun onConfiguringStatus(core: Core, status: ConfiguringState, message: String?) {
override fun onConfiguringStatus(core: Core, status: ConfiguringState, message: String) {
fetchInProgress.value = false
when (status) {
ConfiguringState.Successful -> {

View file

@ -50,7 +50,7 @@ class ControlsFadingViewModel : ViewModel() {
core: Core,
call: Call,
state: Call.State,
message: String?
message: String
) {
if (state == Call.State.StreamsRunning || state == Call.State.Updating || state == Call.State.UpdatedByRemote) {
val isVideoCall = coreContext.isVideoCallOrConferenceActive()

View file

@ -106,7 +106,7 @@ class ControlsViewModel : ViewModel() {
core: Core,
call: Call,
state: Call.State,
message: String?
message: String
) {
if (state == Call.State.StreamsRunning) isVideoUpdateInProgress.value = false

View file

@ -34,7 +34,7 @@ class StatisticsListViewModel : ViewModel() {
core: Core,
call: Call,
state: Call.State,
message: String?
message: String
) {
if (state == Call.State.End || state == Call.State.Error) {
val newList = arrayListOf<CallStatisticsViewModel>()

View file

@ -47,7 +47,7 @@ class StatusViewModel : StatusViewModel() {
core: Core,
call: Call,
on: Boolean,
authenticationToken: String
authenticationToken: String?
) {
if (call.currentParams.mediaEncryption == MediaEncryption.ZRTP && !call.authenticationTokenVerified) {
showZrtpDialogEvent.value = Event(call)
@ -60,7 +60,7 @@ class StatusViewModel : StatusViewModel() {
core: Core,
call: Call,
state: Call.State,
message: String?
message: String
) {
if (call == core.currentCall) {
updateEncryptionInfo(call)

View file

@ -39,19 +39,19 @@ class DevicesListViewModel(private val chatRoom: ChatRoom) : ViewModel() {
val participants = MutableLiveData<ArrayList<DevicesListGroupViewModel>>()
private val listener = object : ChatRoomListenerStub() {
override fun onParticipantDeviceAdded(chatRoom: ChatRoom?, eventLog: EventLog?) {
override fun onParticipantDeviceAdded(chatRoom: ChatRoom, eventLog: EventLog) {
updateParticipants()
}
override fun onParticipantDeviceRemoved(chatRoom: ChatRoom?, eventLog: EventLog?) {
override fun onParticipantDeviceRemoved(chatRoom: ChatRoom, eventLog: EventLog) {
updateParticipants()
}
override fun onParticipantAdded(chatRoom: ChatRoom?, eventLog: EventLog?) {
override fun onParticipantAdded(chatRoom: ChatRoom, eventLog: EventLog) {
updateParticipants()
}
override fun onParticipantRemoved(chatRoom: ChatRoom?, eventLog: EventLog?) {
override fun onParticipantRemoved(chatRoom: ChatRoom, eventLog: EventLog) {
updateParticipants()
}
}

View file

@ -70,19 +70,19 @@ class GroupInfoViewModel(val chatRoom: ChatRoom?) : ErrorReportingViewModel() {
}
}
override fun onSubjectChanged(chatRoom: ChatRoom?, eventLog: EventLog?) {
override fun onSubjectChanged(chatRoom: ChatRoom, eventLog: EventLog) {
subject.value = chatRoom?.subject
}
override fun onParticipantAdded(chatRoom: ChatRoom?, eventLog: EventLog?) {
override fun onParticipantAdded(chatRoom: ChatRoom, eventLog: EventLog) {
updateParticipants()
}
override fun onParticipantRemoved(chatRoom: ChatRoom?, eventLog: EventLog?) {
override fun onParticipantRemoved(chatRoom: ChatRoom, eventLog: EventLog) {
updateParticipants()
}
override fun onParticipantAdminStatusChanged(chatRoom: ChatRoom?, eventLog: EventLog?) {
override fun onParticipantAdminStatusChanged(chatRoom: ChatRoom, eventLog: EventLog) {
val admin = chatRoom?.me?.isAdmin ?: false
isMeAdmin.value = admin
meAdminChangedEvent.value = Event(admin)

View file

@ -42,8 +42,8 @@ class ImdnViewModel(private val chatMessage: ChatMessage) : ViewModel() {
private val listener = object : ChatMessageListenerStub() {
override fun onParticipantImdnStateChanged(
message: ChatMessage?,
state: ParticipantImdnState?
message: ChatMessage,
state: ParticipantImdnState
) {
updateParticipantsLists()
}

View file

@ -80,7 +80,7 @@ class DialerViewModel : LogsUploadViewModel() {
core: Core,
call: Call,
state: Call.State,
message: String?
message: String
) {
atLeastOneCall.value = core.callsNb > 0
}

View file

@ -54,7 +54,7 @@ class SideMenuViewModel : ViewModel() {
core: Core,
cfg: ProxyConfig,
state: RegistrationState,
message: String?
message: String
) {
if (coreContext.core.proxyConfigList.size != accounts.value?.size) {
// Only refresh the list if a proxy has been added or removed

View file

@ -110,10 +110,10 @@ class NotificationsManager(private val context: Context) {
private val listener: CoreListenerStub = object : CoreListenerStub() {
override fun onCallStateChanged(
core: Core?,
call: Call?,
state: Call.State?,
message: String?
core: Core,
call: Call,
state: Call.State,
message: String
) {
if (call == null) return
Log.i("[Notifications Manager] Call state changed [$state]")