-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
2,927 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
grammar-kotlin-parser-test/src/commonMain/resources/testdata/Issue29.kt.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.kickstarter.libs.utils | ||
|
||
import android.content.Context | ||
import android.net.Uri | ||
import androidx.browser.customtabs.CustomTabsIntent | ||
import androidx.core.content.ContextCompat | ||
import com.kickstarter.R | ||
|
||
object UrlUtils { | ||
|
||
private const val KEY_REF = "ref" | ||
|
||
fun appendPath(baseUrl: String, path: String): String { | ||
val uriBuilder = Uri.parse(baseUrl).buildUpon() | ||
uriBuilder.appendEncodedPath(path) | ||
|
||
return uriBuilder.build().toString() | ||
} | ||
|
||
fun appendQueryParameter(baseUrl: String, key: String, value: String): String { | ||
val uriBuilder = Uri.parse(baseUrl).buildUpon() | ||
uriBuilder.appendQueryParameter(key, value) | ||
|
||
return uriBuilder.build().toString() | ||
} | ||
|
||
fun appendRefTag(baseUrl: String, tag: String): String { | ||
return appendQueryParameter(baseUrl, KEY_REF, tag) | ||
} | ||
|
||
fun baseCustomTabsIntent(context: Context): CustomTabsIntent { | ||
val builder = CustomTabsIntent.Builder() | ||
|
||
builder.setShowTitle(true) | ||
builder.setToolbarColor(ContextCompat.getColor(context, R.color.primary)) | ||
|
||
return builder.build() | ||
} | ||
|
||
fun refTag(url: String): String? { | ||
return Uri.parse(url).getQueryParameter(KEY_REF) | ||
} | ||
} |
Oops, something went wrong.