diff --git a/app/src/main/kotlin/net/primal/android/profile/details/ProfileDetailsScreen.kt b/app/src/main/kotlin/net/primal/android/profile/details/ProfileDetailsScreen.kt index cc5f1943..a3f3a7c6 100644 --- a/app/src/main/kotlin/net/primal/android/profile/details/ProfileDetailsScreen.kt +++ b/app/src/main/kotlin/net/primal/android/profile/details/ProfileDetailsScreen.kt @@ -668,6 +668,8 @@ private fun UserProfileDetails( val context = LocalContext.current val uiScope = rememberCoroutineScope() val keyCopiedText = stringResource(id = R.string.settings_keys_key_copied) + val protocolPrefix = "http" + val protocolPrefixReplacement = "https://" Column( modifier = Modifier @@ -715,17 +717,23 @@ private fun UserProfileDetails( } if (state.profileDetails?.website?.isNotEmpty() == true) { + val websiteWithProtocol = if (state.profileDetails.website.startsWith(protocolPrefix, true)) { + state.profileDetails.website + } else { + protocolPrefixReplacement + state.profileDetails.website + } + UserWebsiteText( website = state.profileDetails.website, onClick = { try { - localUriHandler.openUri(state.profileDetails.website) + localUriHandler.openUri(websiteWithProtocol) } catch (error: ActivityNotFoundException) { Timber.w(error) uiScope.launch { Toast.makeText( context, - "App not found that could open ${state.profileDetails.website}.", + "App not found that could open $websiteWithProtocol.", Toast.LENGTH_SHORT, ).show() }