cashapp / paraphrase

A Gradle plugin that generates type-safe formatters for Android string resources in the ICU message format.
Apache License 2.0
165 stars 5 forks source link

Model token formats supported in newer Android API levels #45

Open JakeWharton opened 1 year ago

JakeWharton commented 1 year ago

If you use these types, we should emit @RequiresApi(29/30) on the resulting functions.

drewhamilton commented 1 year ago

DateFormat.getInstanceForSkeleton has been around since API 24. Does MessageFormat just not use it in APIs 24-29?

drewhamilton commented 1 year ago

Can confirm a literal :: is printed on APIs 24-29.

JakeWharton commented 1 year ago

Yeah I was just going on the docs. I did not test anything.

drewhamilton commented 1 year ago

We'll need to check whether the resource containing :: has OS level variants. E.g. if somebody has:

values/strings.xml:
  <string name="foo">{date, date, yyyy-MM-dd}</string>

values-v30/strings.xml:
  <string name="foo">{date, date, ::yyyy-MM-dd}</string>

then they shouldn't get a @RequiresApi annotation.