@Test public void addRepeat_sendsAddRepeatPromptAnalyticsEvent() { viewModel.addRepeat(true); verify(analytics, only()).logEvent(AnalyticsEvents.ADD_REPEAT, "Prompt", "formIdentifierHash"); }
public void addRepeat(boolean fromPrompt) { if (formController == null) { return; } if (jumpBackIndex != null) { jumpBackIndex = null; analytics.logEvent(ADD_REPEAT, "Inline", formController.getCurrentFormIdentifierHash()); } else if (fromPrompt) { analytics.logEvent(ADD_REPEAT, "Prompt", formController.getCurrentFormIdentifierHash()); } else { analytics.logEvent(ADD_REPEAT, "Hierarchy", formController.getCurrentFormIdentifierHash()); } formController.newRepeat(); if (!formController.indexIsInFieldList()) { try { formController.stepToNextScreenEvent(); } catch (JavaRosaException exception) { error.setValue(exception.getCause().getMessage()); } } }
FormEntryViewModel extends ViewModel implements RequiresFormController { public void addRepeat(boolean fromPrompt) { if (formController == null) { return; } if (jumpBackIndex != null) { jumpBackIndex = null; analytics.logEvent(ADD_REPEAT, "Inline", formController.getCurrentFormIdentifierHash()); } else if (fromPrompt) { analytics.logEvent(ADD_REPEAT, "Prompt", formController.getCurrentFormIdentifierHash()); } else { analytics.logEvent(ADD_REPEAT, "Hierarchy", formController.getCurrentFormIdentifierHash()); } formController.newRepeat(); if (!formController.indexIsInFieldList()) { try { formController.stepToNextScreenEvent(); } catch (JavaRosaException exception) { error.setValue(exception.getCause().getMessage()); } } } }
FormEntryViewModel extends ViewModel implements RequiresFormController { public void addRepeat(boolean fromPrompt) { if (formController == null) { return; } if (jumpBackIndex != null) { jumpBackIndex = null; analytics.logEvent(ADD_REPEAT, "Inline", formController.getCurrentFormIdentifierHash()); } else if (fromPrompt) { analytics.logEvent(ADD_REPEAT, "Prompt", formController.getCurrentFormIdentifierHash()); } else { analytics.logEvent(ADD_REPEAT, "Hierarchy", formController.getCurrentFormIdentifierHash()); } formController.newRepeat(); if (!formController.indexIsInFieldList()) { try { formController.stepToNextScreenEvent(); } catch (JavaRosaException exception) { error.setValue(exception.getCause().getMessage()); } } } @SuppressWarnings("WeakerAccess")  FormEntryViewModel(Analytics analytics); }
FormEntryViewModel extends ViewModel implements RequiresFormController { public void addRepeat(boolean fromPrompt) { if (formController == null) { return; } if (jumpBackIndex != null) { jumpBackIndex = null; analytics.logEvent(ADD_REPEAT, "Inline", formController.getCurrentFormIdentifierHash()); } else if (fromPrompt) { analytics.logEvent(ADD_REPEAT, "Prompt", formController.getCurrentFormIdentifierHash()); } else { analytics.logEvent(ADD_REPEAT, "Hierarchy", formController.getCurrentFormIdentifierHash()); } formController.newRepeat(); if (!formController.indexIsInFieldList()) { try { formController.stepToNextScreenEvent(); } catch (JavaRosaException exception) { error.setValue(exception.getCause().getMessage()); } } } @SuppressWarnings("WeakerAccess")  FormEntryViewModel(Analytics analytics); @Override void formLoaded(@NotNull FormController formController); @Nullable FormIndex getCurrentIndex(); LiveData<String> getError(); @SuppressWarnings("WeakerAccess") void promptForNewRepeat(); void jumpToNewRepeat(); void addRepeat(boolean fromPrompt); void cancelRepeatPrompt(); void errorDisplayed(); boolean canAddRepeat(); }
FormEntryViewModel extends ViewModel implements RequiresFormController { public void addRepeat(boolean fromPrompt) { if (formController == null) { return; } if (jumpBackIndex != null) { jumpBackIndex = null; analytics.logEvent(ADD_REPEAT, "Inline", formController.getCurrentFormIdentifierHash()); } else if (fromPrompt) { analytics.logEvent(ADD_REPEAT, "Prompt", formController.getCurrentFormIdentifierHash()); } else { analytics.logEvent(ADD_REPEAT, "Hierarchy", formController.getCurrentFormIdentifierHash()); } formController.newRepeat(); if (!formController.indexIsInFieldList()) { try { formController.stepToNextScreenEvent(); } catch (JavaRosaException exception) { error.setValue(exception.getCause().getMessage()); } } } @SuppressWarnings("WeakerAccess")  FormEntryViewModel(Analytics analytics); @Override void formLoaded(@NotNull FormController formController); @Nullable FormIndex getCurrentIndex(); LiveData<String> getError(); @SuppressWarnings("WeakerAccess") void promptForNewRepeat(); void jumpToNewRepeat(); void addRepeat(boolean fromPrompt); void cancelRepeatPrompt(); void errorDisplayed(); boolean canAddRepeat();  }