Skip to content

Commit

Permalink
Fixes #104
Browse files Browse the repository at this point in the history
  • Loading branch information
ggeorgovassilis committed Mar 6, 2024
1 parent 1181649 commit aa0b00f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import superstartrek.client.activities.PopupViewImpl;
import superstartrek.client.eventbus.Events;
import superstartrek.client.screentemplates.ScreenTemplates;

public class AppInstallPromptViewImpl extends PopupViewImpl<AppInstallPromptPresenter> implements AppInstallPromptView {
Expand All @@ -20,10 +21,8 @@ protected String getContentForHtmlPanel(ScreenTemplates templates) {
protected void decorateWidget(ScreenTemplates templates, Element element) {
super.decorateWidget(templates, element);
element.setId("app-install-prompt");
//TODO: switch to ui handler
addDomHandler((event) -> {
Element e = event.getNativeEvent().getEventTarget().cast();
switch (e.getId()) {
presenter.getApplication().eventBus.addHandler(Events.INTERACTION, tag -> {
switch (tag) {
case "install-yes":
presenter.userClickedInstallButton();
break;
Expand All @@ -34,6 +33,6 @@ protected void decorateWidget(ScreenTemplates templates, Element element) {
presenter.userDoesntWantToInstallAppEver();
break;
}
}, ClickEvent.getType());
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import java.util.HashSet;
import java.util.Set;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.DomEvent;
import superstartrek.client.activities.BaseScreen;
import superstartrek.client.eventbus.Events;
import superstartrek.client.screentemplates.ScreenTemplates;

public class SettingsScreenImpl extends BaseScreen<SettingsPresenter> implements SettingsScreen {
Expand Down Expand Up @@ -39,7 +41,6 @@ public SettingsScreenImpl(SettingsPresenter p) {
eNavDefault = getElementById("nav-default");
eNavBottom = getElementById("nav-bottom");
addDomHandler((event) -> handleChange(event), ChangeEvent.getType());
addDomHandler((event) -> handleClick(event), ClickEvent.getType());
uiScales.add(eSmall);
uiScales.add(eMedium);
uiScales.add(eLarge);
Expand All @@ -66,18 +67,13 @@ protected void handleChange(DomEvent<?> event) {
}
}

protected void handleClick(DomEvent<?> event) {
NativeEvent ne = event.getNativeEvent();
Element e = ne.getEventTarget().cast();

if (eCheckForUpdates.isOrHasChild(e)) {
presenter.onCheckForUpdatesButtonClicked();
}
}

@Override
protected void decorateScreen(ScreenTemplates templates, Element element) {
element.setInnerHTML(templates.settingsScreen().getText());
presenter.getApplication().eventBus.addHandler(Events.INTERACTION, tag->{
if ("cmd_check_for_updates_2".equals(tag))
presenter.onCheckForUpdatesButtonClicked();
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<button id="install-yes">Add to home screen</button>
<button id="install-no">Not now</button>
<button id="install-never">Don't ask again</button>
<button id="install-yes" data-uih>Add to home screen</button>
<button id="install-no" data-uih>Not now</button>
<button id="install-never" data-uih>Don't ask again</button>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h1>Settings</h1>
</section>

<section class="setting">
<button id="cmd_check_for_updates_2" class="full-width">Check for updates</button>
<button id="cmd_check_for_updates_2" data-uih class="full-width">Check for updates</button>
</section>

</div>
Expand Down

0 comments on commit aa0b00f

Please sign in to comment.