@@ -40,6 +40,9 @@ class RegistrationPhoneUpdate : Update<RegistrationPhoneModel, RegistrationPhone
4040 event : EnteredNumberValidated
4141 ): Next <RegistrationPhoneModel , RegistrationPhoneEffect > {
4242 val updatedModel = model.phoneNumberValidated(event.result)
43+ if (updatedModel.isRegistrationOngoing) {
44+ return noChange()
45+ }
4346
4447 return if (updatedModel.isEnteredNumberValid)
4548 next(updatedModel.clearPhoneRegistrationResult().switchToProgressMode(), SyncFacilities as RegistrationPhoneEffect )
@@ -52,15 +55,15 @@ class RegistrationPhoneUpdate : Update<RegistrationPhoneModel, RegistrationPhone
5255 model : RegistrationPhoneModel
5356 ): Next <RegistrationPhoneModel , RegistrationPhoneEffect > {
5457 return when (event.result) {
55- FacilitySyncResult .Synced -> dispatch(SearchForExistingUser (model.ongoingRegistrationEntry!! .phoneNumber!! ) as RegistrationPhoneEffect )
58+ FacilitySyncResult .Synced -> dispatch(SearchForExistingUser (model.ongoingRegistrationEntry.phoneNumber!! ) as RegistrationPhoneEffect )
5659 FacilitySyncResult .NetworkError -> next(model.switchToPhoneEntryMode().withRegistrationResult(RegistrationResult .NetworkError ))
5760 FacilitySyncResult .OtherError -> next(model.switchToPhoneEntryMode().withRegistrationResult(RegistrationResult .OtherError ))
5861 }
5962 }
6063
6164 private fun registerOrLoginUser (
6265 model : RegistrationPhoneModel ,
63- result : SearchForExistingUserCompleted . Result
66+ result : SearchUserResult
6467 ): Next <RegistrationPhoneModel , RegistrationPhoneEffect > {
6568 return when (result) {
6669 is SearchUserResult .Found -> saveFoundUserLocally(model, result.uuid, result.status)
@@ -75,7 +78,7 @@ class RegistrationPhoneUpdate : Update<RegistrationPhoneModel, RegistrationPhone
7578 foundUserUuid : UUID ,
7679 foundUserStatus : UserStatus
7780 ): Next <RegistrationPhoneModel , RegistrationPhoneEffect > {
78- val number = model.ongoingRegistrationEntry!! .phoneNumber!!
81+ val number = model.ongoingRegistrationEntry.phoneNumber!!
7982
8083 return if (foundUserStatus is UserStatus .DisapprovedForSyncing )
8184 next(model.switchToPhoneEntryMode(), ShowAccessDeniedScreen (number) as RegistrationPhoneEffect )
0 commit comments