Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions DESIGN_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ holds `private final UI ui`, and all `executeJs` calls go through
`ui.getElement()` or `ui.getPage()`. Follow the `Page` / `History`
pattern. Enforce single-instance creation in the constructor if needed.

If the facade hands out a stateful handle (e.g.
`Geolocation.watchPosition()` returning a `GeolocationWatcher`), make the
handle's constructor **package-private** so application code cannot bypass
the facade.
If a feature hands out a stateful handle (e.g. `Geolocation.watchPosition()`
returning a `GeolocationWatcher`), make the handle's constructor
**package-private** so application code cannot bypass the entry point.

### Keep internal mutators off user-facing classes

Expand Down
14 changes: 0 additions & 14 deletions flow-server/src/main/java/com/vaadin/flow/component/UI.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import tools.jackson.databind.node.BaseJsonNode;

import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.geolocation.Geolocation;
import com.vaadin.flow.component.internal.JavaScriptNavigationStateRenderer;
import com.vaadin.flow.component.internal.UIInternalUpdater;
import com.vaadin.flow.component.internal.UIInternals;
Expand Down Expand Up @@ -136,8 +135,6 @@ public class UI extends Component

private final Page page;

private final Geolocation geolocation;

/*
* Despite section 6 of RFC 4122, this particular use of UUID *is* adequate
* for security capabilities. Type 4 UUIDs contain 122 bits of random data,
Expand Down Expand Up @@ -168,7 +165,6 @@ protected UI(UIInternalUpdater internalsHandler) {
Component.setElement(this, Element.get(getNode()));
pushConfiguration = new PushConfigurationImpl(this);
page = new Page(this);
geolocation = new Geolocation(this);
}

/**
Expand Down Expand Up @@ -951,16 +947,6 @@ public Page getPage() {
return page;
}

/**
* Returns the {@link Geolocation} facade for this UI, used to read the end
* user's physical location from the browser.
*
* @return the Geolocation facade
*/
public Geolocation getGeolocation() {
return geolocation;
}

/**
* Updates this UI to show the view corresponding to the given navigation
* target.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private record AvailabilityDetail(

@Override
public CompletableFuture<GeolocationOutcome> get(
@Nullable GeolocationOptions options) {
GeolocationOptions options) {
CompletableFuture<GeolocationOutcome> future = new CompletableFuture<>();
ui.getElement()
.executeJs("return window.Vaadin.Flow.geolocation.get($0)",
Expand All @@ -98,8 +98,7 @@ public CompletableFuture<GeolocationOutcome> get(
}

@Override
public WatchHandle startWatch(Component owner,
@Nullable GeolocationOptions options,
public WatchHandle startWatch(Component owner, GeolocationOptions options,
SerializableConsumer<GeolocationResult> onUpdate) {
return new BrowserWatchHandle(owner, options, onUpdate);
}
Expand Down Expand Up @@ -154,8 +153,7 @@ private final class BrowserWatchHandle implements WatchHandle {
private @Nullable DomListenerRegistration errorListener;
private boolean active = true;

BrowserWatchHandle(Component owner,
@Nullable GeolocationOptions options,
BrowserWatchHandle(Component owner, GeolocationOptions options,
SerializableConsumer<GeolocationResult> onUpdate) {
this.owner = owner;
Element el = owner.getElement();
Expand Down
Loading
Loading