-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Application-wide in-app browser for all urls (#1674)
* Application-wide in-app browser for all urls * Changelog entries fixed --------- Co-authored-by: Honza <[email protected]>
- Loading branch information
1 parent
d4be4a5
commit af5ed30
Showing
7 changed files
with
26 additions
and
57 deletions.
There are no files selected for viewing
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
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
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
18 changes: 0 additions & 18 deletions
18
ui-lib/src/androidTest/java/co/electriccoin/zcash/ui/screen/about/util/WebBrowserUtilTest.kt
This file was deleted.
Oops, something went wrong.
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
34 changes: 13 additions & 21 deletions
34
ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/about/util/WebBrowserUtil.kt
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 |
---|---|---|
@@ -1,30 +1,22 @@ | ||
package co.electriccoin.zcash.ui.screen.about.util | ||
|
||
import android.content.Intent | ||
import android.app.Activity | ||
import android.net.Uri | ||
import androidx.browser.customtabs.CustomTabsIntent | ||
|
||
object WebBrowserUtil { | ||
const val FLAGS = | ||
Intent.FLAG_ACTIVITY_NO_HISTORY or | ||
Intent.FLAG_ACTIVITY_NEW_TASK or | ||
Intent.FLAG_ACTIVITY_MULTIPLE_TASK | ||
|
||
const val ZCASH_PRIVACY_POLICY_URI = "https://electriccoin.co/zashi-privacy-policy/" // NON-NLS | ||
|
||
/** | ||
* Returns new action view app intent. We assume the a web browser app is installed. | ||
* | ||
* @param url The webpage url to open | ||
* | ||
* @return Intent for launching in a browser app. | ||
*/ | ||
internal fun newActivityIntent(url: String): Intent { | ||
val storeUri = Uri.parse(url) | ||
val storeIntent = Intent(Intent.ACTION_VIEW, storeUri) | ||
|
||
// To properly handle the browser backstack while navigate back to our app | ||
storeIntent.addFlags(FLAGS) | ||
|
||
return storeIntent | ||
internal fun startActivity( | ||
activity: Activity, | ||
url: String | ||
) { | ||
val intent = | ||
CustomTabsIntent.Builder() | ||
.setUrlBarHidingEnabled(true) | ||
.setShowTitle(true) | ||
.setShareState(CustomTabsIntent.SHARE_STATE_OFF) | ||
.build() | ||
intent.launchUrl(activity, Uri.parse(url)) | ||
} | ||
} |
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