Skip to content

Commit

Permalink
fix: 修复携带host形式的URL地址跳转问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wzbos committed Oct 26, 2020
1 parent 1ae88ad commit ea1b7c8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ siteUrl=https://github.com/wzbos/Android-Rudolph-Router
gitUrl=https://github.com/wzbos/Android-Rudolph-Router.git
licenseName=The Apache Software License, Version 2.0
licenseUrl=http://www.apache.org/licenses/LICENSE-2.0.txt
rudolph_version=2.0.1
rudolph_version=2.0.2
developerId=wzbos
developerName=zongbo.wu
developerEmail=[email protected]
3 changes: 2 additions & 1 deletion rudolph/src/main/java/cn/wzbos/android/rudolph/Rudolph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ object Rudolph {
val tables: MutableList<IRouteTable> = ArrayList()
for (className in list) {
try {
RLog.i(TAG, "init Router: $className")
val clazz = Class.forName("cn.wzbos.android.rudolph.routes.$className")
if (IRouteTable::class.java.isAssignableFrom(clazz)) {
val iRouteTable = clazz.newInstance() as IRouteTable
iRouteTable.register()
tables.add(iRouteTable)
}
} catch (e: ClassNotFoundException) {
} catch (e: Exception) {
RLog.e(TAG, "初始化\"$className\"组件失败,请检查包名是否正确!", e)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cn.wzbos.android.rudolph.router

import android.net.Uri
import android.os.Bundle
import android.os.Parcelable
import android.text.TextUtils
Expand Down Expand Up @@ -251,23 +252,7 @@ abstract class RouteBuilder<B : RouteBuilder<B, R>?, R : Router<*>?> : IRouteBui

val path: String
get() {
val n = rawUrl!!.indexOf("://")
val stx: Int
val etx: Int
if (n > -1) {
stx = n + 3
etx = rawUrl!!.indexOf("?", stx)
} else {
stx = 0
etx = rawUrl!!.indexOf("?")
}
val path: String
path = if (etx > -1) {
rawUrl!!.substring(stx, etx)
} else {
rawUrl!!.substring(stx)
}
return path
return Uri.parse(rawUrl).path
}

private val segments: List<String>
Expand Down

0 comments on commit ea1b7c8

Please sign in to comment.