Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support to multiple consent instance #20089

Merged
merged 5 commits into from Dec 28, 2018

Conversation

zhouyx
Copy link
Contributor

@zhouyx zhouyx commented Dec 27, 2018

As agreed, we decide to completely remove support to multiple consent instance/prompt. All such use case could be satisfied using CMP approach.

Copy link
Contributor

@torch2424 torch2424 left a comment

Choose a reason for hiding this comment

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

Great work on the refactor! Super stoked you did this! I had a few questions, and concerns, but overall looks like a great start 😄 Thank you!

this.consentInstanceIdDepr_ = consentInstanceId;
this.init_();
}

/**
* Register the policy instance
* Example policy config format:
* {
* "waitFor": {
* "consentABC": [], // Can't support array now.
* // All items will be treated as an empty array
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move around these comments now that we removed the bottom consent? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I wanted to completely remove the support to waitFor. However, I can't do that now because it may break some of the existing usage. I'll create a follow up PR to support the new format and migrate later.

Promise.all(initPromises).then(() => {
instance.startTimeout(this.ampdoc_.win);
/**
*
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty comment block 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol. added

}

/**
*
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra comment line 😄

this.consentInstanceIdDepr_ = consentInstanceId;
this.init_();
}

/**
* Register the policy instance
* Example policy config format:
* {
* "waitFor": {
* "consentABC": [], // Can't support array now.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we now only have one consent, does this format still make sense? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replied here #20089 (comment)

Copy link
Contributor

@torch2424 torch2424 left a comment

Choose a reason for hiding this comment

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

My apologies for mentioning the Unblock vs. Enable, we half-committed, and after discussing offline, let's just go back to unblock 😂

Other than that, everything LGTM to me. As you mentioned, I looked over the tests, I think they all look good (syntactically), and I couldn't think of more cases to test. Looks all well tested 😮 unless there was something specific you wanted me to look at? Let me know 😄

});
}

/**
* Wait for policy instance to be ready.
* Wait for policy instance to be registered.
* @param {string} policyId
* @return {!Promise}
*/
whenPolicyInstanceReady_(policyId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Can we renamed this is registered as well? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed to whenPolicyInstanceRegistered_

}
return this.whenPolicyInstanceReady_(policyId).then(() => {
return this.instances_[policyId].getReadyPromise().then(() => {
return this.instances_[policyId].shouldBlock();
return this.instances_[policyId].shouldEnable();
Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed offline, let's just keep this as unblock, my apologies 😢

Copy link
Contributor Author

Choose a reason for hiding this comment

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

haha it's a great point! and I enjoy reading the article a lot! It's just blocking/unblocking the build of other AMP components sound better to me in this very specific use case.

* Caller need to make sure that policy status has resolved
* @return {boolean}
*/
shouldBlock() {
shouldEnable() {
Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed offline, let's just keep this as unblock, my apologies 😢

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed back to shouldUnblock

Copy link
Contributor

@torch2424 torch2424 left a comment

Choose a reason for hiding this comment

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

LGTM 😄 Just one comment 👍


describes.realWin('ConsentStateManager', {amp: 1}, env => {

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: too many newlines 😄

@zhouyx zhouyx merged commit 0c1eb79 into ampproject:master Dec 28, 2018
slocka pushed a commit to skimhub/amphtml that referenced this pull request Jan 7, 2019
* consent policy do not support multi instances

* sync and nit

* address comment1

* address comment2

* remove new lines
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
* consent policy do not support multi instances

* sync and nit

* address comment1

* address comment2

* remove new lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants