Partially fixed bug not showing "Add user to contact list?" - Alert
This commit is contained in:
		@@ -101,14 +101,17 @@ public class ContactSearchScene {
 | 
				
			|||||||
			final var alert = new Alert(AlertType.CONFIRMATION);
 | 
								final var alert = new Alert(AlertType.CONFIRMATION);
 | 
				
			||||||
			alert.setTitle("Add Contact to Contact List");
 | 
								alert.setTitle("Add Contact to Contact List");
 | 
				
			||||||
			alert.setHeaderText("Add the user " + contact.getName() + " to your contact list?");
 | 
								alert.setHeaderText("Add the user " + contact.getName() + " to your contact list?");
 | 
				
			||||||
			alert.showAndWait().filter(btn -> btn == ButtonType.OK).ifPresent(btn -> {
 | 
								// Normally, this would be total BS (we are already on the FX Thread), however
 | 
				
			||||||
 | 
								// it could be proven that the creation of this dialog wrapped in
 | 
				
			||||||
 | 
								// Platform.runLater is less error-prone than without it
 | 
				
			||||||
 | 
								Platform.runLater(() -> alert.showAndWait().filter(btn -> btn == ButtonType.OK).ifPresent(btn -> {
 | 
				
			||||||
				final var event = new ContactOperation(contact, ElementOperation.ADD);
 | 
									final var event = new ContactOperation(contact, ElementOperation.ADD);
 | 
				
			||||||
				// Sends the event to the server
 | 
									// Sends the event to the server
 | 
				
			||||||
				eventBus.dispatch(new SendEvent(event));
 | 
									eventBus.dispatch(new SendEvent(event));
 | 
				
			||||||
				// Updates the UI
 | 
									// Updates the UI
 | 
				
			||||||
				eventBus.dispatch(event);
 | 
									eventBus.dispatch(event);
 | 
				
			||||||
				logger.log(Level.INFO, "Added contact " + contact);
 | 
									logger.log(Level.INFO, "Added contact " + contact);
 | 
				
			||||||
			});
 | 
								}));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user