Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Remove the ignore flag that prevented the update after deleting an item
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Nov 4, 2019
1 parent c5abf5f commit 2912b99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public class BookmarksView extends FrameLayout implements BookmarksStore.Bookmar
private BookmarksBinding mBinding;
private Accounts mAccounts;
private BookmarkAdapter mBookmarkAdapter;
private boolean mIgnoreNextListener;
private ArrayList<BookmarksCallback> mBookmarksViewListeners;
private CustomLinearLayoutManager mLayoutManager;

Expand Down Expand Up @@ -113,9 +112,6 @@ private void initialize(Context aContext) {
mBinding.setIsSignedIn(mAccounts.isSignedIn());
mBinding.setIsSyncEnabled(mAccounts.isEngineEnabled(SyncEngine.Bookmarks.INSTANCE));

updateBookmarks();
SessionStore.get().getBookmarkStore().addListener(this);

setVisibility(GONE);

setOnTouchListener((v, event) -> {
Expand Down Expand Up @@ -147,14 +143,14 @@ public void onClick(@NonNull View view, @NonNull Bookmark item) {
public void onDelete(@NonNull View view, @NonNull Bookmark item) {
mBinding.bookmarksList.requestFocusFromTouch();

mIgnoreNextListener = true;
SessionStore.get().getBookmarkStore().deleteBookmarkById(item.getGuid());
mBookmarkAdapter.removeItem(item);
if (mBookmarkAdapter.itemCount() == 0) {
mBinding.setIsEmpty(true);
mBinding.setIsLoading(false);
mBinding.executePendingBindings();
}

SessionStore.get().getBookmarkStore().deleteBookmarkById(item.getGuid());
}

@Override
Expand Down Expand Up @@ -322,19 +318,11 @@ private void updateLayout() {

@Override
public void onBookmarksUpdated() {
if (mIgnoreNextListener) {
mIgnoreNextListener = false;
return;
}
updateBookmarks();
}

@Override
public void onBookmarkAdded() {
if (mIgnoreNextListener) {
mIgnoreNextListener = false;
return;
}
updateBookmarks();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public class HistoryView extends FrameLayout implements HistoryStore.HistoryList
private HistoryBinding mBinding;
private Accounts mAccounts;
private HistoryAdapter mHistoryAdapter;
private boolean mIgnoreNextListener;
private ArrayList<HistoryCallback> mHistoryViewListeners;

public HistoryView(Context aContext) {
Expand Down Expand Up @@ -116,9 +115,6 @@ private void initialize(Context aContext) {
mBinding.setIsSignedIn(mAccounts.isSignedIn());
mBinding.setIsSyncEnabled(mAccounts.isEngineEnabled(SyncEngine.History.INSTANCE));

updateHistory();
SessionStore.get().getHistoryStore().addListener(this);

setVisibility(GONE);

setOnTouchListener((v, event) -> {
Expand Down Expand Up @@ -150,14 +146,14 @@ public void onClick(View view, VisitInfo item) {
public void onDelete(View view, VisitInfo item) {
mBinding.historyList.requestFocusFromTouch();

mIgnoreNextListener = true;
SessionStore.get().getHistoryStore().deleteHistory(item.getUrl(), item.getVisitTime());
mHistoryAdapter.removeItem(item);
if (mHistoryAdapter.itemCount() == 0) {
mBinding.setIsEmpty(true);
mBinding.setIsLoading(false);
mBinding.executePendingBindings();
}

SessionStore.get().getHistoryStore().deleteHistory(item.getUrl(), item.getVisitTime());
}

@Override
Expand Down Expand Up @@ -365,10 +361,6 @@ private void updateLayout() {

@Override
public void onHistoryUpdated() {
if (mIgnoreNextListener) {
mIgnoreNextListener = false;
return;
}
updateHistory();
}
}

1 comment on commit 2912b99

@community-tc-integration
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitting the task to Taskcluster failed. Details

Taskcluster-GitHub attempted to create a task for this event with the following scopes:

[
  "assume:repo:github.com/MozillaReality/FirefoxReality:pull-request",
  "queue:route:statuses",
  "queue:scheduler-id:taskcluster-github"
]

The expansion of these scopes is not sufficient to create the task, leading to the following:

Client ID static/taskcluster/github does not have sufficient scopes and is missing the following scopes:

{
  "AnyOf": [
    {
      "AnyOf": [
        "queue:create-task:highest:aws-provisioner-v1/github-worker",
        "queue:create-task:very-high:aws-provisioner-v1/github-worker",
        "queue:create-task:high:aws-provisioner-v1/github-worker",
        "queue:create-task:medium:aws-provisioner-v1/github-worker",
        "queue:create-task:low:aws-provisioner-v1/github-worker",
        "queue:create-task:very-low:aws-provisioner-v1/github-worker",
        "queue:create-task:lowest:aws-provisioner-v1/github-worker"
      ]
    },
    {
      "AnyOf": [
        "queue:create-task:aws-provisioner-v1/github-worker",
        {
          "AllOf": [
            "queue:define-task:aws-provisioner-v1/github-worker",
            "queue:task-group-id:taskcluster-github/OUxy8LSWSHur7yZyObU7KQ",
            "queue:schedule-task:taskcluster-github/OUxy8LSWSHur7yZyObU7KQ/OUxy8LSWSHur7yZyObU7KQ"
          ]
        }
      ]
    }
  ]
}

This request requires the client to satisfy the following scope expression:

{
  "AllOf": [
    "queue:route:statuses",
    {
      "AnyOf": [
        {
          "AllOf": [
            "queue:scheduler-id:taskcluster-github",
            {
              "AnyOf": [
                "queue:create-task:highest:aws-provisioner-v1/github-worker",
                "queue:create-task:very-high:aws-provisioner-v1/github-worker",
                "queue:create-task:high:aws-provisioner-v1/github-worker",
                "queue:create-task:medium:aws-provisioner-v1/github-worker",
                "queue:create-task:low:aws-provisioner-v1/github-worker",
                "queue:create-task:very-low:aws-provisioner-v1/github-worker",
                "queue:create-task:lowest:aws-provisioner-v1/github-worker"
              ]
            }
          ]
        },
        {
          "AnyOf": [
            "queue:create-task:aws-provisioner-v1/github-worker",
            {
              "AllOf": [
                "queue:define-task:aws-provisioner-v1/github-worker",
                "queue:task-group-id:taskcluster-github/OUxy8LSWSHur7yZyObU7KQ",
                "queue:schedule-task:taskcluster-github/OUxy8LSWSHur7yZyObU7KQ/OUxy8LSWSHur7yZyObU7KQ"
              ]
            }
          ]
        }
      ]
    }
  ]
}

  • method: createTask
  • errorCode: InsufficientScopes
  • statusCode: 403
  • time: 2019-11-04T21:24:24.118Z

Please sign in to comment.