Skip to content

Commit c21bdd0

Browse files
author
chenenyu
committed
v0.7.0
1. fix RouteOptions reset() bug. 2. Add friendly notice when initializing failed.
1 parent 658a324 commit c21bdd0

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

VERSION.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# router gradle plugin version
22
GRADLE_PLUGIN_VERSION=0.3.0
33
# router library version
4-
ROUTER_VERSION=0.6.0
4+
ROUTER_VERSION=0.7.0
55
# compiler library version
66
COMPILER_VERSION=0.3.0
77
# annotation library version

router/src/main/java/com/chenenyu/router/RealRouter.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,42 @@ private void reset() {
5656
/**
5757
* Init route table.
5858
*/
59-
void initMapping(Context context) {
59+
synchronized void initMapping() {
6060
if (initialized) {
6161
RLog.e("Initialized mapping.");
6262
return;
6363
} else {
6464
initialized = true;
6565
}
66-
String packageName = context.getPackageName();
67-
String fullTableName = null;
66+
67+
String[] modules;
6868
try {
6969
Class<?> configClz = Class.forName("com.chenenyu.router.RouterBuildConfig");
7070
Field allModules = configClz.getField("ALL_MODULES");
7171
String modules_name = (String) allModules.get(configClz);
72-
String[] modules = modules_name.split(",");
72+
modules = modules_name.split(",");
73+
} catch (ClassNotFoundException e) {
74+
RLog.e("Have you applied plugin 'com.chenenyu.router' in your application module?", e);
75+
return;
76+
} catch (Exception e) {
77+
e.printStackTrace();
78+
return;
79+
}
7380

81+
try {
82+
String fullTableName;
7483
for (String moduleName : modules) {
7584
fullTableName = "com.chenenyu.router." + capitalize(moduleName) + "RouteTable";
7685
Class<?> moduleRouteTable = Class.forName(fullTableName);
7786
Constructor constructor = moduleRouteTable.getConstructor();
7887
RouteTable instance = (RouteTable) constructor.newInstance();
7988
instance.handleActivityTable(mapping);
8089
}
81-
82-
RLog.i("RouteTable", mapping.toString());
8390
} catch (Exception e) {
84-
RLog.e(e.getMessage());
91+
e.printStackTrace();
8592
}
93+
94+
RLog.i("RouteTable", mapping.toString());
8695
}
8796

8897
private String capitalize(CharSequence self) {

router/src/main/java/com/chenenyu/router/RouteOptions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,6 @@ public void reset() {
8585
bundle = null;
8686
enterAnim = 0;
8787
exitAnim = 0;
88+
skipInterceptors = false;
8889
}
8990
}

router/src/main/java/com/chenenyu/router/Router.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class Router {
1818
private static List<RouteInterceptor> mRouteInterceptors = new ArrayList<>();
1919

2020
public static void initialize(Context context) {
21-
RealRouter.get().initMapping(context);
21+
RealRouter.get().initMapping();
2222
}
2323

2424
public static void openLog() {

0 commit comments

Comments
 (0)