Skip to content

Commit cb63620

Browse files
committed
升级版本至1.0.1, 升级XUpdate的版本
1 parent 9fc9131 commit cb63620

File tree

10 files changed

+39
-38
lines changed

10 files changed

+39
-38
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ allprojects {
3737
2.然后在dependencies添加:
3838

3939
```
40-
implementation 'com.github.xuexiangjys:XUpdate:2.0.6'
41-
implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-easy:1.0.0'
40+
implementation 'com.github.xuexiangjys:XUpdate:2.0.9'
41+
implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-easy:1.0.1'
4242
// 如果需要使用断点续传下载功能的话添加该依赖(可选)
43-
implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-downloader-aria:1.0.0'
43+
implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-downloader-aria:1.0.1'
4444
```
4545

4646
3.自定义初始化配置(可选)

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ dependencies {
9292
androidTestImplementation deps.runner
9393
androidTestImplementation deps.espresso.core
9494

95-
implementation 'com.github.xuexiangjys:XUpdate:2.0.6'
96-
// implementation project(':xupdate-easy')
97-
// implementation project(':xupdate-downloader-aria')
98-
implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-easy:1.0.0'
99-
implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-downloader-aria:1.0.0'
95+
implementation 'com.github.xuexiangjys:XUpdate:2.0.9'
96+
implementation project(':xupdate-easy')
97+
implementation project(':xupdate-downloader-aria')
98+
// implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-easy:1.0.0'
99+
// implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-downloader-aria:1.0.0'
100100

101101
implementation 'com.arialyy.aria:core:3.8.15'
102102
implementation deps.androidx.multidex

app/src/main/java/com/xuexiang/xupdateapi/fragment/EasyUpdateFragment.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ public void noNewVersion(Throwable throwable) {
137137

138138
@MemoryCache
139139
private UpdateEntity getUpdateEntityFromAssets() {
140-
return new DefaultUpdateParser().parseJson(ResourceUtils.readStringFromAssert("update_test.json"));
140+
try {
141+
return new DefaultUpdateParser().parseJson(ResourceUtils.readStringFromAssert("update_test.json"));
142+
} catch (Exception e) {
143+
e.printStackTrace();
144+
}
145+
return null;
141146
}
142147
}

app/src/main/java/com/xuexiang/xupdateapi/utils/sdkinit/XBasicLibInit.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919

2020
import android.app.Application;
2121

22-
import com.xuexiang.xupdateapi.MyApp;
23-
import com.xuexiang.xupdateapi.core.BaseActivity;
24-
import com.xuexiang.xupdateapi.utils.XToastUtils;
2522
import com.xuexiang.xaop.XAOP;
26-
import com.xuexiang.xpage.AppPageConfig;
2723
import com.xuexiang.xpage.PageConfig;
2824
import com.xuexiang.xrouter.launcher.XRouter;
2925
import com.xuexiang.xui.XUI;
26+
import com.xuexiang.xupdateapi.MyApp;
27+
import com.xuexiang.xupdateapi.core.BaseActivity;
28+
import com.xuexiang.xupdateapi.utils.XToastUtils;
3029
import com.xuexiang.xutil.XUtil;
3130
import com.xuexiang.xutil.common.StringUtils;
3231

@@ -74,13 +73,7 @@ private static void initXUtil(Application application) {
7473
*/
7574
private static void initXPage(Application application) {
7675
PageConfig.getInstance()
77-
//页面注册
78-
.setPageConfiguration(context -> {
79-
//自动注册页面,是编译时自动生成的,build一下就出来了
80-
return AppPageConfig.getInstance().getPages();
81-
})
8276
.debug(MyApp.isDebug() ? "PageLog" : null)
83-
.enableWatcher(MyApp.isDebug())
8477
.setContainActivityClazz(BaseActivity.class)
8578
.init(application);
8679
}

app/x-library-simple.gradle

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ project.configurations.each { configuration ->
88
if (configuration.name == "implementation") {
99
//为Project加入X-Library依赖
1010
//XUI框架
11-
configuration.dependencies.add(getProject().dependencies.create('com.github.xuexiangjys:XUI:1.1.5'))
11+
configuration.dependencies.add(getProject().dependencies.create('com.github.xuexiangjys:XUI:1.1.7'))
1212
configuration.dependencies.add(getProject().dependencies.create(deps.androidx.appcompat))
1313
configuration.dependencies.add(getProject().dependencies.create(deps.androidx.recyclerview))
1414
configuration.dependencies.add(getProject().dependencies.create(deps.androidx.design))
@@ -18,31 +18,23 @@ project.configurations.each { configuration ->
1818
//XAOP切片,版本号前带x的是支持androidx的版本
1919
configuration.dependencies.add(getProject().dependencies.create('com.github.xuexiangjys.XAOP:xaop-runtime:1.1.0'))
2020
//XPage
21-
configuration.dependencies.add(getProject().dependencies.create('com.github.xuexiangjys.XPage:xpage-lib:3.0.3'))
21+
configuration.dependencies.add(getProject().dependencies.create('com.github.xuexiangjys.XPage:xpage-lib:3.1.1'))
2222
configuration.dependencies.add(getProject().dependencies.create(deps.butterknife.runtime))
2323
//XRouter
2424
configuration.dependencies.add(getProject().dependencies.create('com.github.xuexiangjys.XRouter:xrouter-runtime:1.0.1'))
2525
}
2626

2727
if (configuration.name == "annotationProcessor") {
2828
//XPage
29-
configuration.dependencies.add(getProject().dependencies.create('com.github.xuexiangjys.XPage:xpage-compiler:3.0.3'))
29+
configuration.dependencies.add(getProject().dependencies.create('com.github.xuexiangjys.XPage:xpage-compiler:3.1.1'))
3030
configuration.dependencies.add(getProject().dependencies.create(deps.butterknife.compiler))
3131
//XRouter
3232
configuration.dependencies.add(getProject().dependencies.create('com.github.xuexiangjys.XRouter:xrouter-compiler:1.0.1'))
3333
}
3434

3535
if (configuration.name == "debugImplementation") {
3636
//内存泄漏监测leak
37-
configuration.dependencies.add(getProject().dependencies.create('com.squareup.leakcanary:leakcanary-android:1.6.3'))
38-
}
39-
if (configuration.name == "releaseImplementation") {
40-
//内存泄漏监测leak
41-
configuration.dependencies.add(getProject().dependencies.create('com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'))
42-
}
43-
if (configuration.name == "testImplementation") {
44-
//内存泄漏监测leak
45-
configuration.dependencies.add(getProject().dependencies.create('com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'))
37+
configuration.dependencies.add(getProject().dependencies.create('com.squareup.leakcanary:leakcanary-android:2.6'))
4638
}
4739
}
4840

versions.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ versions.rxbinding = "2.2.0"
2424
versions.butterknife = "10.1.0"
2525
versions.runner = "1.2.0"
2626
versions.gson = "2.8.5"
27-
versions.okhttp3 = "3.14.9"
27+
versions.okhttp3 = "3.12.12"
2828

2929
def deps = [:]
3030

xupdate-downloader-aria/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies {
3636
implementation deps.androidx.appcompat
3737
implementation 'com.arialyy.aria:core:3.8.15'
3838
compileOnly project(':xupdate-easy')
39-
compileOnly 'com.github.xuexiangjys:XUpdate:2.0.6'
39+
compileOnly 'com.github.xuexiangjys:XUpdate:2.0.9'
4040
}
4141

4242
apply from: "../JitPackUpload.gradle"

xupdate-easy/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies {
3636
implementation deps.androidx.appcompat
3737
implementation deps.gson
3838
implementation deps.okhttp3
39-
compileOnly 'com.github.xuexiangjys:XUpdate:2.0.6'
39+
compileOnly 'com.github.xuexiangjys:XUpdate:2.0.9'
4040
implementation 'com.zhy:okhttputils:2.6.2'
4141
}
4242

xupdate-easy/src/main/java/com/xuexiang/xupdate/easy/init/Utils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private Utils() {
3434
throw new UnsupportedOperationException("u can't instantiate me...");
3535
}
3636

37-
public static Application getApplicationByReflect() {
37+
static Application getApplicationByReflect() {
3838
try {
3939
@SuppressLint("PrivateApi")
4040
Class<?> activityThread = Class.forName("android.app.ActivityThread");
@@ -64,7 +64,9 @@ public static Application getApplicationByReflect() {
6464
* @param <T>
6565
* @return 类型强转结果
6666
*/
67-
public static <T> T cast(final Object object, Class<T> clazz) {
67+
static <T> T cast(final Object object, Class<T> clazz) {
6868
return clazz != null && clazz.isInstance(object) ? (T) object : null;
6969
}
70+
71+
7072
}

xupdate-easy/src/main/java/com/xuexiang/xupdate/easy/service/OkHttpUpdateHttpServiceImpl.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
import androidx.annotation.NonNull;
2121

22+
import com.google.gson.Gson;
2223
import com.xuexiang.xupdate.logs.UpdateLog;
2324
import com.xuexiang.xupdate.proxy.IUpdateHttpService;
24-
import com.xuexiang.xupdate.utils.UpdateUtils;
2525
import com.zhy.http.okhttp.OkHttpUtils;
2626
import com.zhy.http.okhttp.callback.FileCallBack;
2727
import com.zhy.http.okhttp.callback.StringCallback;
@@ -115,7 +115,7 @@ public void asyncPost(@NonNull String url, @NonNull Map<String, Object> params,
115115
if (mIsPostJson) {
116116
requestCall = OkHttpUtils.postString()
117117
.url(url)
118-
.content(UpdateUtils.toJson(params))
118+
.content(toJson(params))
119119
.mediaType(MediaType.parse("application/json; charset=utf-8"))
120120
.build();
121121
} else {
@@ -189,5 +189,14 @@ private Map<String, String> transform(Map<String, Object> params) {
189189
return map;
190190
}
191191

192+
/**
193+
* 把 单个指定类型的对象 转换为 JSON 字符串
194+
*
195+
* @param src 序列化的对象
196+
* @return JSON 字符串
197+
*/
198+
private static String toJson(Object src) {
199+
return new Gson().toJson(src);
200+
}
192201

193202
}

0 commit comments

Comments
 (0)