File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
java/com/automattic/simplenote Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 8686
8787 <data
8888 android : host =" app.simplenote.com"
89- android : pathPattern =" /account/.*/reset?redirect=simplenote://launch "
89+ android : pathPattern =" /account/.*/reset"
9090 android : scheme =" https" >
9191 </data >
9292
122122 <category android : name =" android.intent.category.DEFAULT" />
123123 <data
124124 android : host =" app.simplenote.com"
125- android : pathPattern =" /account/.*/reset?redirect=simplenote://launch "
125+ android : pathPattern =" /account/.*/reset"
126126 android : scheme =" https" >
127127 </data >
128128 </intent-filter >
Original file line number Diff line number Diff line change @@ -27,8 +27,13 @@ class DeepLinkActivity : AppCompatActivity() {
2727 startActivity(intent)
2828 }
2929 VERIFIED_WEB_SCHEME -> {
30- // New MagicLink
31- startMagicLinkConfirmation(uri)
30+ // Check if this is a password reset URL
31+ if (uri.path?.contains(" /account/" ) == true && uri.path?.contains(" /reset" ) == true ) {
32+ handlePasswordReset(uri)
33+ } else {
34+ // New MagicLink
35+ startMagicLinkConfirmation(uri)
36+ }
3237 }
3338 LOGIN_SCHEME -> {
3439 if (queryParamContainsData(uri.query, USERNAME_KEY_QUERY ) && queryParamContainsData(uri.query, AUTH_CODE_QUERY )) {
@@ -88,6 +93,21 @@ class DeepLinkActivity : AppCompatActivity() {
8893 }
8994 }
9095
96+ private fun handlePasswordReset (uri : Uri ) {
97+ val redirectParam = uri.getQueryParameter(" redirect" )
98+ if (redirectParam == " simplenote://launch" ) {
99+ // Handle the redirect to launch the app
100+ val intent = IntentUtils .maybeAliasedIntent(applicationContext)
101+ intent.addFlags(Intent .FLAG_ACTIVITY_CLEAR_TASK or Intent .FLAG_ACTIVITY_NEW_TASK )
102+ startActivity(intent)
103+ } else {
104+ // Default behavior for reset URLs without redirect
105+ val intent = IntentUtils .maybeAliasedIntent(applicationContext)
106+ intent.addFlags(Intent .FLAG_ACTIVITY_CLEAR_TASK or Intent .FLAG_ACTIVITY_NEW_TASK )
107+ startActivity(intent)
108+ }
109+ }
110+
91111 private fun queryParamContainsData (path : String? , otherString : String ) : Boolean = path?.contains(otherString, true ) == true
92112
93113
You can’t perform that action at this time.
0 commit comments