Skip to content

Commit

Permalink
Fix deeplinking in sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
noties committed Feb 5, 2021
1 parent b8cb4d1 commit 50b3168
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Please visit [documentation] web-site for reference


## Consulting
Paid consulting is available. Please Reach me out at [markwon+consulting[at]noties.io](mailto:[email protected])
Paid consulting is available. Please reach me out at [markwon+consulting[at]noties.io](mailto:[email protected])
to discuss your idea or a project

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sealed class Deeplink {
// https://noties.io/Markwon/app/sample/ID
// https://noties.io/Markwon/app/search?a=core
val segments = data.pathSegments
if (segments.size == 3
if (segments.size >= 3
&& "Markwon" == segments[0]
&& "app" == segments[1]) {
when (segments[2]) {
Expand All @@ -41,6 +41,8 @@ sealed class Deeplink {
}
}
else -> null
}.also {
Debug.i("parsed: $it")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.Window
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import io.noties.debug.Debug
import io.noties.markwon.app.App
import io.noties.markwon.app.sample.ui.SampleFragment
import io.noties.markwon.app.sample.ui.SampleListFragment
Expand All @@ -21,6 +22,7 @@ class MainActivity : FragmentActivity() {

// process deeplink if we are not restored
val deeplink = Deeplink.parse(intent.data)

val deepLinkFragment: Fragment? = if (deeplink != null) {
when (deeplink) {
is Deeplink.Sample -> App.sampleManager.sample(deeplink.id)
Expand Down

0 comments on commit 50b3168

Please sign in to comment.