From 6909860a10ee3caa907d57f17759caf5eb06485b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A3=E7=BA=AC?= Date: Tue, 3 Mar 2020 16:58:31 +0800 Subject: [PATCH] Bugfix : #795 PathReplaceService will be executed repeatedly when use `build(String path)` --- .../alibaba/android/arouter/launcher/ARouter.java | 2 +- .../alibaba/android/arouter/launcher/_ARouter.java | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/ARouter.java b/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/ARouter.java index aa9d3d7e..53160288 100644 --- a/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/ARouter.java +++ b/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/ARouter.java @@ -149,7 +149,7 @@ public Postcard build(String path) { */ @Deprecated public Postcard build(String path, String group) { - return _ARouter.getInstance().build(path, group); + return _ARouter.getInstance().build(path, group, false); } /** diff --git a/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java b/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java index ab826475..ba73af5c 100644 --- a/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java +++ b/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java @@ -181,7 +181,7 @@ protected Postcard build(String path) { if (null != pService) { path = pService.forString(path); } - return build(path, extractGroup(path)); + return build(path, extractGroup(path), true); } } @@ -203,13 +203,15 @@ protected Postcard build(Uri uri) { /** * Build postcard by path and group */ - protected Postcard build(String path, String group) { + protected Postcard build(String path, String group, Boolean afterReplace) { if (TextUtils.isEmpty(path) || TextUtils.isEmpty(group)) { throw new HandlerException(Consts.TAG + "Parameter is invalid!"); } else { - PathReplaceService pService = ARouter.getInstance().navigation(PathReplaceService.class); - if (null != pService) { - path = pService.forString(path); + if (!afterReplace) { + PathReplaceService pService = ARouter.getInstance().navigation(PathReplaceService.class); + if (null != pService) { + path = pService.forString(path); + } } return new Postcard(path, group); }