How to use a if/else to click on IOS button if it appears on the Screen

Hi every time I install a new version of an app on IOS devices it shows a message and the user has to click on “Allow” to keep the flow


I tried to do a restriction like this:
Boolean Allow = driver.findElements(By.xpath("//[@id=‘Allow’]")).size()<0;
if (Allow.TRUE) {
new WebDriverWait(driver, 30, esperandogif).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//
[@text=‘Allow’]"))).click();
else {
driver.findElement(By.xpath("//[@text=‘Cadastre-se com seu e-mail pessoal’]")).click();
driver.findElement(By.xpath("//
[@placeholder=‘Email’]")).sendKeys(“ashutosh@ashutosh.com.br”);
driver.swipe(165, 759, 175, 534, 1234);
driver.findElement(By.xpath("//[@placeholder=‘Senha’]")).sendKeys(“lucasmoreira”);
driver.findElement(By.xpath("//
[@placeholder=‘Confirmer Senha’]")).sendKeys(“lucazmoreira”);
driver.swipe(309, 856, 390, 406, 888);
driver.findElement(By.xpath("//[@placeholder=‘Nome e Sobrenome’]")).sendKeys(“teste”);
driver.findElement(By.xpath("//
[@placeholder=‘CPF’]")).sendKeys(“12345678901”);
driver.swipe(168, 946, 334, 615, 2240);
driver.findElement(By.xpath("//[@placeholder=‘Data de Nascimento (dd/mm/aaaa)’]")).click();
try{Thread.sleep(threadSleep);} catch(Exception ignore){}
//driver.findElement(By.xpath("//
[@text=‘2018’]")).click();
// driver.findElement(By.xpath("//[@text=‘2020’]")).click();
driver.findElement(By.xpath("//
[@id=‘Feito’]")).click();
driver.swipe(84, 887, 259, 493, 1461);
driver.findElement(By.xpath("//[@placeholder=‘Telefone’]")).sendKeys(“99999999999”);
driver.swipe(450, 812, 500, 640, 1292);
driver.findElement(By.xpath("//
[@id=‘Cadastrar’]")).click();
System.out.println(“report URL : " + driver.getCapabilities().getCapability(“reportUrl”));
driver.quit();
}
But it’s not working. If it doesn’t show up on the screen the code fails and it doesn’t click on driver.findElement(By.xpath(”//*[@text=‘Cadastre-se com seu e-mail pessoal’]")).click();

How can I do that restriction?

I fixed this just removing if (Allow.TRUE) and changing to if (Allow)