Skip to content

Commit f045c3e

Browse files
committed
feat(build): upgrade tinkerPatch to 1.1.5
1 parent b2db7e4 commit f045c3e

File tree

3 files changed

+11
-47
lines changed

3 files changed

+11
-47
lines changed

app/src/main/java/com/tinkerpatch/easy_sample/FetchPatchHandler.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

app/src/main/java/com/tinkerpatch/easy_sample/SampleApplication.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,16 @@ public void attachBaseContext(Context base) {
6161
MultiDex.install(base);
6262
}
6363

64-
65-
/**
66-
* 由于在onCreate替换真正的Application,
67-
* 我们建议在onCreate初始化TinkerPatch,而不是attachBaseContext
68-
*/
6964
@Override
7065
public void onCreate() {
7166
super.onCreate();
72-
// 我们可以从这里获得Tinker加载过程的信息
67+
initTinker();
68+
}
69+
70+
/**
71+
* 我们需要确保至少在主进程和patch进程中初始化 TinkerPatch
72+
*/
73+
private void initTinker() {
7374
if (BuildConfig.TINKER_ENABLE) {
7475
tinkerApplicationLike = TinkerPatchApplicationLike.getTinkerPatchApplicationLike();
7576

@@ -82,13 +83,13 @@ public void onCreate() {
8283
// 获取当前的补丁版本
8384
Log.d(TAG, "current patch version is " + TinkerPatch.with().getPatchVersion());
8485

85-
// 每隔3个小时去访问后台时候有更新,通过handler实现轮训的效果
86-
new FetchPatchHandler().fetchPatchWithInterval(3);
86+
// 每隔3个小时去访问后台时候有更新, 通过 handler 实现轮询的效果
87+
// 默认 setFetchPatchIntervalByHours 只是设置调用的频率限制,并没有去轮询
88+
TinkerPatch.with().startPoll(3);
8789
}
8890
}
8991

9092

91-
9293
/**
9394
* 在这里给出TinkerPatch的所有接口解释
9495
* 更详细的解释请参考:http://tinkerpatch.com/Docs/api

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ org.gradle.jvmargs=-Xmx1536m
1616
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1717
# org.gradle.parallel=true
1818

19-
TINKERPATCH_VERSION=1.1.4
19+
TINKERPATCH_VERSION=1.1.5
2020
ANDRESGUARD_VERSION=1.2.2

0 commit comments

Comments
 (0)