Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Commit

Permalink
Issue 2543: added languageAndMaybeCountryMatch overload that accepts …
Browse files Browse the repository at this point in the history
…KillswitchLocales as an input
  • Loading branch information
Michelle Wong authored and liuche committed Jul 13, 2019
1 parent e8ade57 commit 21bf217
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/main/java/org/mozilla/tv/firefox/ext/Locale.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.mozilla.tv.firefox.ext

import org.mozilla.tv.firefox.architecture.KillswitchLocales
import java.util.Locale


Expand All @@ -17,3 +18,10 @@ fun Locale.languageAndMaybeCountryMatch(allowedLocales: Array<out Locale>?): Boo
return@any languageMatches && countryMatches
}
}

fun Locale.languageAndMaybeCountryMatch(allowedLocales: KillswitchLocales): Boolean {
return when (allowedLocales) {
is KillswitchLocales.All -> true
is KillswitchLocales.ActiveIn -> this.languageAndMaybeCountryMatch(allowedLocales.locales)
}
}

0 comments on commit 21bf217

Please sign in to comment.