Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Commit e528c1c

Browse files
committed
自动上传热补丁包
1 parent 1827d75 commit e528c1c

File tree

9 files changed

+78
-14
lines changed

9 files changed

+78
-14
lines changed

‎.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/channel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ meizu
44
huawei
55
yinyongbao
66
pp
7-
DEV
87
fir

‎build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ buildscript {
88
maven { url 'https://maven.aliyun.com/repository/public' }
99
maven { url 'http://raedev.io:8081/repository/maven-public/' }
1010
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
11+
maven { url "https://plugins.gradle.org/m2/" }
1112
google()
1213
jcenter()
1314
}
@@ -19,6 +20,8 @@ buildscript {
1920
classpath 'com.meituan.android.walle:plugin:1.1.6'
2021
// greenDAO
2122
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
23+
// SDK HTTP上传文件,用不到可以注释掉
24+
classpath "gradle.plugin.io.github.http-builder-ng:http-plugin:0.1.1"
2225
}
2326
}
2427

‎module-home/src/main/java/com/rae/cnblogs/home/fragment/HotSearchFragment.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public class HotSearchFragment extends BasicFragment implements HotSearchContrac
3636

3737
@BindView(R2.id.tv_hot_search)
3838
TextView mHotSearchView;
39+
@BindView(R2.id.ll_hot_search)
40+
View mHotSearchLayout;
3941
@BindView(R2.id.recycler_view_hot_search)
4042
RecyclerView mHotSearchRecyclerView;
4143

@@ -96,7 +98,7 @@ public void onItemClick(Context context, String item) {
9698
}
9799

98100
private void setHotSearchLayoutVisibility(int visibility) {
99-
mHotSearchView.setVisibility(visibility);
101+
mHotSearchLayout.setVisibility(visibility);
100102
mHotSearchRecyclerView.setVisibility(visibility);
101103
}
102104

‎module-home/src/main/res/layout/fm_hot_search.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
android:layout_height="wrap_content" />
4444

4545
<LinearLayout
46+
android:id="@+id/ll_hot_search"
4647
android:layout_width="match_parent"
4748
android:layout_height="wrap_content"
4849
android:orientation="horizontal">

‎module-sdk/build.gradle

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: 'com.android.library'
22
// greenDAO 数据库插件
33
apply plugin: 'org.greenrobot.greendao'
4+
apply plugin: "io.github.http-builder-ng.http-plugin"
45

56
android {
67
compileSdkVersion rootProject.ext.android.compileSdkVersion
@@ -31,6 +32,61 @@ android {
3132
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
3233
}
3334

35+
// 更新补丁包
36+
37+
task updateHotfixPatch() {
38+
group 'hotfix'
39+
description 'cnblogs sdk hotfix'
40+
dependsOn 'dexPatch'
41+
doLast {
42+
String dexPath = buildDir.getAbsolutePath() + '\\intermediates\\dex\\patch\\out\\classes.dex'
43+
URL url = new URL(rootProject.ext.account.uploadUrl)
44+
String boundary = UUID.randomUUID().toString()
45+
// Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("192.168.1.7", 8888))
46+
HttpURLConnection conn = (HttpURLConnection) url.openConnection()
47+
conn.setDoOutput(true)
48+
conn.setDoInput(true)
49+
conn.setUseCaches(false)
50+
conn.setRequestMethod("POST")
51+
conn.setRequestProperty("Connection", "Keep-Alive")
52+
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)")
53+
conn.setRequestProperty("Charsert", "UTF-8")
54+
conn.setRequestProperty("Accept", "*/*")
55+
conn.setRequestProperty("cache-control", "no-cache")
56+
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary)
57+
DataOutputStream out = new DataOutputStream(conn.getOutputStream())
58+
out.writeBytes('--' + boundary + '\r\n')
59+
out.writeBytes('Content-Disposition: form-data; name="file"; filename="classes.dex"\r\n')
60+
out.writeBytes("Content-Type: application/octet-stream\r\n\r\n")
61+
BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file(dexPath)))
62+
byte[] buffer = new byte[1024]
63+
while (true) {
64+
int len = inputStream.read(buffer)
65+
if (len <= 0) break
66+
out.write(buffer, 0, len)
67+
}
68+
out.writeBytes('\r\n--' + boundary + '\r\n')
69+
inputStream.close()
70+
int statusCode = conn.getResponseCode()
71+
println "[cnblogs-sdk-hotfix]: [POST] [" + statusCode + "] " + conn.getURL()
72+
InputStream resInputStream = statusCode == 200 ? conn.getInputStream() : conn.getErrorStream()
73+
BufferedReader stream = new BufferedReader(new InputStreamReader(resInputStream))
74+
while (true) {
75+
String line = stream.readLine()
76+
if (line == null) break
77+
println "[cnblogs-sdk-hotfix]: " + line
78+
}
79+
if(statusCode == 200)
80+
println('[cnblogs-sdk-hotfix]: POST HOTFIX PATCH SUCCESSFUL')
81+
else
82+
println('[cnblogs-sdk-hotfix]: POST HOTFIX PATCH FAILED!')
83+
84+
85+
stream.close()
86+
}
87+
}
88+
89+
3490
dependencies {
3591
implementation fileTree(dir: 'libs', include: ['*.jar'])
3692
androidTestImplementation('com.github.raee:runit:1.0.0', {

‎module-sdk/src/main/java/com/rae/cnblogs/sdk/DefaultCnblogsApiProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public IRaeServerApi getRaeServerApi() {
9696

9797
@Override
9898
public String getDownloadUrl() {
99-
return "http://img.raeblog.com/cnblogs/patch/hotfix.dex";
99+
return "http://img.raeblog.com/cnblogs/patch/hotfix.dex?t=" + System.currentTimeMillis();
100100
}
101101

102102
@NonNull

‎module-sdk/src/patch/java/com/rae/cnblogs/sdk/PatchCnblogsApiProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public PatchCnblogsApiProvider(Context applicationContext) {
1515

1616
@Override
1717
public int getApiVersion() {
18-
return 3;
18+
return 1;
1919
}
2020

2121
@NonNull

‎properties.gradle

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,22 @@ ext {
1212
keyPassword : properties.getProperty("keystore.password", "cnblogs"),
1313
storePassword : properties.getProperty("keystore.storePassword", "cnblogs"),
1414
// 友盟
15-
umengAppKey : properties.getProperty("umengAppKey", "you_key"),
15+
umengAppKey : properties.getProperty("umengAppKey", "替换成你的配置"),
1616
// 腾讯Bugly
17-
buglyAppId : properties.getProperty("buglyAppId", "you_key"),
17+
buglyAppId : properties.getProperty("buglyAppId", "替换成你的配置"),
1818
// 友盟
19-
leancloudAppId : properties.getProperty("leancloudAppId", "you_key"),
20-
leancloudAppKey: properties.getProperty("leancloudAppKey", "you_key"),
19+
leancloudAppId : properties.getProperty("leancloudAppId", "替换成你的配置"),
20+
leancloudAppKey: properties.getProperty("leancloudAppKey", "替换成你的配置"),
2121
// 微信分享
22-
wechatAppId : properties.getProperty("wechatAppId", "you_key"),
23-
wechatAppSecret: properties.getProperty("wechatAppSecret", "you_key"),
22+
wechatAppId : properties.getProperty("wechatAppId", "替换成你的配置"),
23+
wechatAppSecret: properties.getProperty("wechatAppSecret", "替换成你的配置"),
2424
// 微博分享
25-
weiboAppId : properties.getProperty("weiboAppId", "you_key"),
26-
weiboAppSecret : properties.getProperty("weiboAppSecret", "you_key"),
25+
weiboAppId : properties.getProperty("weiboAppId", "替换成你的配置"),
26+
weiboAppSecret : properties.getProperty("weiboAppSecret", "替换成你的配置"),
2727
// QQ分享
28-
qqAppId : properties.getProperty("qqAppId", "you_key"),
29-
qqAppSecret : properties.getProperty("qqAppSecret", "you_key")
28+
qqAppId : properties.getProperty("qqAppId", "替换成你的配置"),
29+
qqAppSecret : properties.getProperty("qqAppSecret", "替换成你的配置"),
30+
// SDK补丁包上传地址
31+
uploadUrl : properties.getProperty("uploadUrl", "替换成你的配置")
3032
]
3133
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /