Skip to content

Instantly share code, notes, and snippets.

@pranay1494
Last active June 20, 2020 11:52
Show Gist options
  • Save pranay1494/1483cebd4137dc1270789ad1bcff0405 to your computer and use it in GitHub Desktop.
Save pranay1494/1483cebd4137dc1270789ad1bcff0405 to your computer and use it in GitHub Desktop.
ext {
listOfDeepLinkUrls = new ArrayList<String>()
listOfDeepLinkUrls.add("/home")
locales = ["en", "ar","es","hi-IN"]
}
ext.generateData = { host, listOfDeepLinkUrls, locales,listOfDomains ->
String links = ""
listOfDeepLinkUrls.each{ item ->
links += data(item,host)
locales.each{ locale ->
listOfDomains.each { domain ->
links += data("/"+locale.replace("_","-")+item,domain)
}
}
}
return links
}
static def data(String path, String host) {
return http(path,host) + https(path,host)
}
static def http(String path, String host) {
return "\n" +
" <data\n" +
" android:host=\"$host\"\n" +
" android:pathPrefix=\"$path\"\n" +
" android:scheme=\"http\"/>\n"
}
static def https(String path, String host) {
return "\n" +
" <data\n" +
" android:host=\"$host\"\n" +
" android:pathPrefix=\"$path\"\n" +
" android:scheme=\"https\"/>\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment