hyperdevs-team / poeditor-android-gradle-plugin

Gradle plug-in that enables importing PoEditor localized strings directly to an Android project
Apache License 2.0
51 stars 26 forks source link

Multiple tags intersection doesn't work #69

Closed bogdanzurac closed 1 year ago

bogdanzurac commented 1 year ago

SW details (please complete the following information):

Summary and background of the bug Tags intersection doesn't work when specifying a list of tags. The plugin just pulls in all strings, not an intersection of the tags as it's supposed to.

I assume this is caused by the way the tags are being sent using Retrofit. They should be sent as tags : ["tagA", "tagB"] (https://poeditor.com/docs/api#projects_export_example_1_button). I haven't been able to check it, but I assume currently they are being sent as tags : tagA, tagB

Steps to reproduce Steps to reproduce the behavior:

  1. Set up 2 strings on the PoEditor web app using 3 tags (string 1 being added to tags A & B, string 2 being added to tags A & C)
  2. Set up the plugin config to pull in tags A & B
  3. Run the import

Expected behavior Only string 1 should be pulled.

Current behavior Currently both strings are pulled.

bogdanzurac commented 1 year ago

Actually, the tags are currently sent as multiple form url encoded args. Taken from the @ Field annotation JavaDoc:

image

So from our example above, they end up being sent in the request body as:

tags=tagA
tags=tagB

instead of tags=["tagA", "tagB"]

Basically, the list of tags needs to be encoded first as a JSON string array and then sent as the tags field instead of just a list of strings.

bogdanzurac commented 1 year ago

I've tried a fix for this in #70. Haven't tested it as I'm not familiar with the testing procedure in this repo. Please double check the changes before merging.

adriangl commented 1 year ago

Hi @bogdanzurac! Thanks for the insight about the bug, I'll take a look to the PR. Thanks a lot for the contribution! ;)

adriangl commented 1 year ago

The fix will be released in version 3.4.2 ;)