修复bark-server升级到2.0后的兼容性问题

This commit is contained in:
pppscn 2021-02-26 17:09:39 +08:00
parent 6d89e25d38
commit fc42c5eec6
4 changed files with 6 additions and 13 deletions

View File

@ -14,8 +14,8 @@ android {
applicationId "com.idormy.sms.forwarder"
minSdkVersion 23
targetSdkVersion 28
versionCode 6
versionName "1.2.0"
versionCode 7
versionName "1.2.1"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {

Binary file not shown.

View File

@ -10,9 +10,9 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 6,
"versionName": "1.2.0",
"outputFile": "SmsForwarder_release_20210219_1.2.0.apk"
"versionCode": 7,
"versionName": "1.2.1",
"outputFile": "SmsForwarder_release_20210226_1.2.1.apk"
}
]
}

View File

@ -6,8 +6,6 @@ import android.util.Log;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -31,7 +29,6 @@ public class SenderBarkMsg {
}
barkServer += URLEncoder.encode(from, "UTF-8");
String body = "短信内容:" + content + "\n转发时间" + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
barkServer += "/" + URLEncoder.encode(content, "UTF-8");
barkServer += "?isArchive=1"; //自动保存
int isCode = content.indexOf("验证码");
@ -46,11 +43,7 @@ public class SenderBarkMsg {
}
OkHttpClient client = new OkHttpClient();
final Request request = new Request.Builder()
.url(barkServer)
.addHeader("Content-Type", "application/json; charset=utf-8")
.get()
.build();
final Request request = new Request.Builder().url(barkServer).get().build();
Call call = client.newCall(request);
call.enqueue(new Callback() {
@Override