Skip to content

Make TcfEuV2's IsServiceSpecific not a condition for encoding Vendors…#93

Open
shawjef3 wants to merge 2 commits intoIABTechLab:masterfrom
shawjef3:tcfeuv2-encoding
Open

Make TcfEuV2's IsServiceSpecific not a condition for encoding Vendors…#93
shawjef3 wants to merge 2 commits intoIABTechLab:masterfrom
shawjef3:tcfeuv2-encoding

Conversation

@shawjef3
Copy link
Copy Markdown

…Allowed or VendorsDisclosed.

TcfEuV2#encodeSection() now uses the same criteria as iabtcf-java's TCStringEncoder to determine if a segment should be encoded.

TCF 2.3 makes VendorsDisclosed required, and so its encoding should not be conditional on IsServiceSpecific.

I made additional changes to reduce the amount of whitespace.

TcfEuV2#encodeSection() no longer creates an intermediate collection.

…Allowed or VendorsDisclosed.

TcfEuV2#encodeSection() now uses the same criteria as iabtcf-java's TCStringEncoder to determine
if a segment should be encoded.

TCF 2.3 makes VendorsDisclosed required, and so its encoding should not be conditional on
IsServiceSpecific.

I made additional changes to reduce the amount of whitespace.

TcfEuV2#encodeSection() no longer creates an intermediate collection.
@shawjef3
Copy link
Copy Markdown
Author

This is for #83.

@yuzawa-san
Copy link
Copy Markdown
Contributor

i have ported a similar change into the beta/4.X branch in d14a86b

Copy link
Copy Markdown

@HeinzBaumann HeinzBaumann left a comment

Choose a reason for hiding this comment

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

LGTM

@shawjef3
Copy link
Copy Markdown
Author

@yuzawa-san @HeinzBaumann are either of you able to merge this? I don't have permission.

@lamrowena
Copy link
Copy Markdown
Collaborator

@shawjef3 similar change was included in the 4.X branch which was merged, could you test that branch?

@shawjef3
Copy link
Copy Markdown
Author

@lamrowena The 4.x branch looks good. I used the following test. It would be good to merge and publish this anyway. Some people might not have the luxury of upgrading their JVM.

@Test
public void testIsServiceSpecific() {
  final TcfEuV2 tcfEuV2 = new TcfEuV2();
  tcfEuV2.setFieldValue(TcfEuV2Field.IS_SERVICE_SPECIFIC, false);
  final IntegerSet expectedVendorsDisclosed = new IntegerSet();
  expectedVendorsDisclosed.add(1);
  tcfEuV2.setFieldValue(TcfEuV2Field.VENDORS_DISCLOSED, expectedVendorsDisclosed);
  final IntegerSet expectedVendorsAllowed = new IntegerSet();
  expectedVendorsAllowed.add(2);
  tcfEuV2.setFieldValue(TcfEuV2Field.VENDORS_ALLOWED, expectedVendorsAllowed);
  final String encoded = tcfEuV2.encode();
  final TcfEuV2 decoded = new TcfEuV2(encoded);
  Assertions.assertEquals(expectedVendorsDisclosed, decoded.getVendorsDisclosed());
  Assertions.assertEquals(expectedVendorsAllowed, decoded.getVendorsAllowed());
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants