File tree Expand file tree Collapse file tree 4 files changed +20
-10
lines changed
java/com/mrepol742/webappp Expand file tree Collapse file tree 4 files changed +20
-10
lines changed Original file line number Diff line number Diff line change 3232
3333 <category android : name =" android.intent.category.LAUNCHER" />
3434 </intent-filter >
35+
36+ <intent-filter android : autoVerify =" true" >
37+ <action android : name =" android.intent.action.VIEW" />
38+
39+ <category android : name =" android.intent.category.DEFAULT" />
40+ <category android : name =" android.intent.category.BROWSABLE" />
41+
42+ <data android : host =" www.melvinjonesrepol.com" android : scheme =" https" />
43+ </intent-filter >
3544 </activity >
3645 </application >
3746
Original file line number Diff line number Diff line change 1- html {
1+ html , body {
22 height : 100% ;
33 margin : 0 ;
44}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import com.mrepol742.webappp.utils.DynamicShortcut
1919
2020
2121class MainActivity : ComponentActivity () {
22- private val allowedDomain = " www. melvinjonesrepol.com"
22+ private val allowedDomain = " melvinjonesrepol.com"
2323 private var currentUrl: String = " https://$allowedDomain "
2424 private val shortcuts = listOf (
2525 " /projects" to " My Projects" ,
@@ -61,13 +61,12 @@ class MainActivity : ComponentActivity() {
6161 override fun onResume () {
6262 super .onResume()
6363
64- val urlFromIntent = when (intent?.action) {
65- Intent .ACTION_VIEW -> intent.getStringExtra(" url" )
66- else -> null
67- }
64+ val urlFromData = intent?.data?.toString()
65+ val urlFromExtra = intent?.getStringExtra(" url" )
66+ val url = urlFromData ? : urlFromExtra
6867
69- if (! urlFromIntent .isNullOrEmpty()) {
70- currentUrl = urlFromIntent
68+ if (! url .isNullOrEmpty()) {
69+ currentUrl = url
7170 webViewState.value?.loadUrl(currentUrl)
7271 }
7372 }
Original file line number Diff line number Diff line change @@ -97,8 +97,10 @@ class SecureWebViewClient(
9797 }
9898 " http" , " https" -> {
9999 val host = uri.host ? : return false
100- val allowedDomainRegex = Regex (" (^|\\ .)${Regex .escape(allowedDomain)} $" , RegexOption .IGNORE_CASE )
101- if (allowedDomainRegex.matches(host)) {
100+ val allowedDomainRegex = Regex (" ^(.*\\ .)?${Regex .escape(allowedDomain)} $" )
101+ val isAllowed = allowedDomainRegex.matches(host)
102+
103+ if (isAllowed) {
102104 false // load in WebView
103105 } else {
104106 openInCustomTab(uri)
You can’t perform that action at this time.
0 commit comments