Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static PekkoRouteHolder get(Context context) {
return context.get(KEY);
}

public void push(Uri.Path beforeMatch, Uri.Path afterMatch, String pathToPush) {
public synchronized void push(Uri.Path beforeMatch, Uri.Path afterMatch, String pathToPush) {
// Only accept the suggested 'pathToPush' if:
// - either this is the first match, or
// - the unmatched part of the path from the previous match is what the current match
Expand All @@ -50,26 +50,26 @@ public void push(Uri.Path beforeMatch, Uri.Path afterMatch, String pathToPush) {
lastWasMatched = true;
}

public void didNotMatch() {
public synchronized void didNotMatch() {
lastWasMatched = false;
}

public void pushIfNotCompletelyMatched(String pathToPush) {
public synchronized void pushIfNotCompletelyMatched(String pathToPush) {
if (lastUnmatchedPath != null && !lastUnmatchedPath.isEmpty()) {
route.append(pathToPush);
}
}

public String route() {
public synchronized String route() {
return lastWasMatched ? route.toString() : null;
}

public void save() {
public synchronized void save() {
savedStates.add(new State(lastUnmatchedPath, route));
route = new StringBuilder(route);
}

public void restore() {
public synchronized void restore() {
State popped = savedStates.pollLast();
if (popped != null) {
lastUnmatchedPath = popped.lastUnmatchedPath;
Expand Down
Loading