Skip to content

Commit

Permalink
Fix AndroidUnicodeUtils getting removed by proguard
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Jul 19, 2019
1 parent 6deb588 commit aa4dd9e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@
import java.text.Normalizer;
import java.util.Locale;

import com.facebook.proguard.annotations.DoNotStrip;

// TODO: use com.facebook.common.locale.Locales.getApplicationLocale() as the current locale,
// rather than the device locale. This is challenging because getApplicationLocale() is only
// available via DI.
@DoNotStrip
public class AndroidUnicodeUtils {
@DoNotStrip
public static int localeCompare(String left, String right) {
Collator collator = Collator.getInstance();
return collator.compare(left, right);
}

@DoNotStrip
public static String dateFormat(double unixtimeMs, boolean formatDate, boolean formatTime) {
DateFormat format;
if (formatDate && formatTime) {
Expand All @@ -34,6 +39,7 @@ public static String dateFormat(double unixtimeMs, boolean formatDate, boolean f
return format.format((long) unixtimeMs).toString();
}

@DoNotStrip
public static String convertToCase(String input, int targetCase, boolean useCurrentLocale) {
// These values must match CaseConversion in PlatformUnicode.h
final int targetUppercase = 0;
Expand All @@ -52,6 +58,7 @@ public static String convertToCase(String input, int targetCase, boolean useCurr
}
}

@DoNotStrip
public static String normalize(String input, int form) {
// Values must match NormalizationForm in PlatformUnicode.h.
final int formC = 0;
Expand Down

0 comments on commit aa4dd9e

Please sign in to comment.