Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.ui.platform.UriHandler
import com.flipcash.core.R
import com.getcode.manager.BottomBarAction
import com.getcode.manager.BottomBarManager
import com.getcode.util.resources.R as ResourcesR
import java.net.IDN

/**
Expand Down Expand Up @@ -95,29 +94,25 @@ private fun asciiHost(host: String): String {
}

/**
* Runs [open] straight away for a first-party link, and otherwise asks first: "You're leaving
* Flipcash", naming the host, with Cancel as the primary button and Open Link as the secondary.
* Runs [open] straight away for a first-party link, and otherwise asks first: "You're Leaving
* Flipcash", naming the host, with Open Website as the primary button and Cancel as the secondary.
*
* Only for links someone else wrote, such as a chat message. A link the app opens on purpose
* (terms, a token's socials) goes straight to the browser.
*/
fun openWithExternalLinkCheck(context: Context, url: String, open: () -> Unit) {
when (val destination = classifyLink(url)) {
LinkDestination.FirstParty -> open()
is LinkDestination.External -> BottomBarManager.showAlert(
is LinkDestination.External -> BottomBarManager.showInfo(
title = context.getString(R.string.prompt_title_externalLink),
message = context.getString(R.string.prompt_description_externalLink, destination.host),
actions = listOf(
BottomBarAction(
text = context.getString(ResourcesR.string.action_cancel),
style = BottomBarManager.BottomBarButtonStyle.Filled,
),
BottomBarAction(
text = context.getString(R.string.action_openLink),
style = BottomBarManager.BottomBarButtonStyle.Text,
text = context.getString(R.string.action_openWebsite),
onClick = open,
),
),
showCancel = true,
)
}
}
Expand Down
6 changes: 3 additions & 3 deletions apps/flipcash/core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,10 @@
<string name="subtitle_noSocialAccounts">No social accounts linked</string>
<string name="prompt_title_unlinkSocialAccount">Unlink Account?</string>
<string name="prompt_description_unlinkSocialAccount">This social account will be removed from your profile.</string>
<string name="prompt_title_externalLink">You\'re leaving Flipcash</string>
<string name="prompt_title_externalLink">You\'re Leaving Flipcash</string>
<!-- %1$s is the link's host. -->
<string name="prompt_description_externalLink">This link opens %1$s. Flipcash will never ask for your Access Key on a website</string>
<string name="action_openLink">Open Link</string>
<string name="prompt_description_externalLink">This will open %1$s. Never share your Access Key with a website</string>
<string name="action_openWebsite">Open Website</string>
<string name="action_unlinkAccount">Unlink Account</string>

<string name="title_verificationFlow">Verify Your Phone Number And Email To Continue</string>
Expand Down
Loading