diff --git a/app/release/SmsForwarder_release_20210312_1.6.1.apk b/app/release/SmsForwarder_release_20210312_1.6.1.apk
new file mode 100644
index 00000000..21c379a7
Binary files /dev/null and b/app/release/SmsForwarder_release_20210312_1.6.1.apk differ
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
index 591213aa..50b71be6 100644
--- a/app/release/output-metadata.json
+++ b/app/release/output-metadata.json
@@ -10,9 +10,9 @@
{
"type": "SINGLE",
"filters": [],
- "versionCode": 16,
- "versionName": "1.6.0",
- "outputFile": "SmsForwarder_release_20210312_1.6.0.apk"
+ "versionCode": 17,
+ "versionName": "1.6.1",
+ "outputFile": "SmsForwarder_release_20210312_1.6.1.apk"
}
]
}
\ No newline at end of file
diff --git a/app/src/main/java/com/idormy/sms/forwarder/FrontService.java b/app/src/main/java/com/idormy/sms/forwarder/FrontService.java
index 7755c8c3..772643ee 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/FrontService.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/FrontService.java
@@ -30,7 +30,7 @@ public class FrontService extends Service {
if (romType == OSUtils.ROM_TYPE.MIUI_ROM) {
builder.setContentTitle("短信转发器");
}
- builder.setContentText("根据规则转发到钉钉/微信/邮箱/bark/webhook等");
+ builder.setContentText("根据规则转发到钉钉/微信/邮箱/bark/Server酱/webhook等");
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity
(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
diff --git a/app/src/main/java/com/idormy/sms/forwarder/SenderActivity.java b/app/src/main/java/com/idormy/sms/forwarder/SenderActivity.java
index 2f62f3f7..b2e2b0ce 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/SenderActivity.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/SenderActivity.java
@@ -27,12 +27,14 @@ import com.idormy.sms.forwarder.model.vo.DingDingSettingVo;
import com.idormy.sms.forwarder.model.vo.EmailSettingVo;
import com.idormy.sms.forwarder.model.vo.QYWXAppSettingVo;
import com.idormy.sms.forwarder.model.vo.QYWXGroupRobotSettingVo;
+import com.idormy.sms.forwarder.model.vo.ServerChanSettingVo;
import com.idormy.sms.forwarder.model.vo.WebNotifySettingVo;
import com.idormy.sms.forwarder.sender.SenderBarkMsg;
import com.idormy.sms.forwarder.sender.SenderDingdingMsg;
import com.idormy.sms.forwarder.sender.SenderMailMsg;
import com.idormy.sms.forwarder.sender.SenderQyWxAppMsg;
import com.idormy.sms.forwarder.sender.SenderQyWxGroupRobotMsg;
+import com.idormy.sms.forwarder.sender.SenderServerChanMsg;
import com.idormy.sms.forwarder.sender.SenderUtil;
import com.idormy.sms.forwarder.sender.SenderWebNotifyMsg;
import com.umeng.analytics.MobclickAgent;
@@ -48,6 +50,7 @@ import static com.idormy.sms.forwarder.model.SenderModel.TYPE_DINGDING;
import static com.idormy.sms.forwarder.model.SenderModel.TYPE_EMAIL;
import static com.idormy.sms.forwarder.model.SenderModel.TYPE_QYWX_APP;
import static com.idormy.sms.forwarder.model.SenderModel.TYPE_QYWX_GROUP_ROBOT;
+import static com.idormy.sms.forwarder.model.SenderModel.TYPE_SERVER_CHAN;
import static com.idormy.sms.forwarder.model.SenderModel.TYPE_WEB_NOTIFY;
public class SenderActivity extends AppCompatActivity {
@@ -121,6 +124,9 @@ public class SenderActivity extends AppCompatActivity {
case TYPE_QYWX_APP:
setQYWXApp(senderModel);
break;
+ case TYPE_SERVER_CHAN:
+ setServerChan(senderModel);
+ break;
default:
Toast.makeText(SenderActivity.this, "异常的发送方类型,自动删除!", Toast.LENGTH_LONG).show();
if (senderModel != null) {
@@ -199,6 +205,9 @@ public class SenderActivity extends AppCompatActivity {
case TYPE_QYWX_APP:
setQYWXApp(null);
break;
+ case TYPE_SERVER_CHAN:
+ setServerChan(null);
+ break;
default:
Toast.makeText(SenderActivity.this, "暂不支持这种转发!", Toast.LENGTH_LONG).show();
break;
@@ -528,6 +537,97 @@ public class SenderActivity extends AppCompatActivity {
});
}
+ private void setServerChan(final SenderModel senderModel) {
+ ServerChanSettingVo serverchanSettingVo = null;
+ //try phrase json setting
+ if (senderModel != null) {
+ String jsonSettingStr = senderModel.getJsonSetting();
+ if (jsonSettingStr != null) {
+ serverchanSettingVo = JSON.parseObject(jsonSettingStr, ServerChanSettingVo.class);
+ }
+ }
+
+ final AlertDialog.Builder alertDialog71 = new AlertDialog.Builder(SenderActivity.this);
+ View view1 = View.inflate(SenderActivity.this, R.layout.alert_dialog_setview_serverchan, null);
+
+ final EditText editTextServerChanName = view1.findViewById(R.id.editTextServerChanName);
+ if (senderModel != null) editTextServerChanName.setText(senderModel.getName());
+ final EditText editTextServerChanSendKey = view1.findViewById(R.id.editTextServerChanSendKey);
+ if (serverchanSettingVo != null)
+ editTextServerChanSendKey.setText(serverchanSettingVo.getSendKey());
+
+ Button buttonServerChanOk = view1.findViewById(R.id.buttonServerChanOk);
+ Button buttonServerChanDel = view1.findViewById(R.id.buttonServerChanDel);
+ Button buttonServerChanTest = view1.findViewById(R.id.buttonServerChanTest);
+ alertDialog71
+ .setTitle(R.string.setserverchantitle)
+ .setIcon(R.mipmap.serverchan)
+ .setView(view1)
+ .create();
+ final AlertDialog show = alertDialog71.show();
+
+ buttonServerChanOk.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+
+ if (senderModel == null) {
+ SenderModel newSenderModel = new SenderModel();
+ newSenderModel.setName(editTextServerChanName.getText().toString());
+ newSenderModel.setType(TYPE_SERVER_CHAN);
+ newSenderModel.setStatus(STATUS_ON);
+ ServerChanSettingVo serverchanSettingVoNew = new ServerChanSettingVo(
+ editTextServerChanSendKey.getText().toString()
+ );
+ newSenderModel.setJsonSetting(JSON.toJSONString(serverchanSettingVoNew));
+ SenderUtil.addSender(newSenderModel);
+ initSenders();
+ adapter.add(senderModels);
+ } else {
+ senderModel.setName(editTextServerChanName.getText().toString());
+ senderModel.setType(TYPE_SERVER_CHAN);
+ senderModel.setStatus(STATUS_ON);
+ ServerChanSettingVo serverchanSettingVoNew = new ServerChanSettingVo(
+ editTextServerChanSendKey.getText().toString()
+ );
+ senderModel.setJsonSetting(JSON.toJSONString(serverchanSettingVoNew));
+ SenderUtil.updateSender(senderModel);
+ initSenders();
+ adapter.update(senderModels);
+ }
+
+ show.dismiss();
+
+ }
+ });
+ buttonServerChanDel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (senderModel != null) {
+ SenderUtil.delSender(senderModel.getId());
+ initSenders();
+ adapter.del(senderModels);
+ }
+ show.dismiss();
+ }
+ });
+ buttonServerChanTest.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ String serverchanServer = editTextServerChanSendKey.getText().toString();
+ if (!serverchanServer.isEmpty()) {
+ try {
+ SenderServerChanMsg.sendMsg(handler, serverchanServer, "19999999999", "【京东】验证码为387481(切勿将验证码告知他人),请在页面中输入完成验证,如有问题请点击 ihelp.jd.com 联系京东客服");
+ } catch (Exception e) {
+ Toast.makeText(SenderActivity.this, "发送失败:" + e.getMessage(), Toast.LENGTH_LONG).show();
+ e.printStackTrace();
+ }
+ } else {
+ Toast.makeText(SenderActivity.this, "Server酱·Turbo版的 SendKey 不能为空", Toast.LENGTH_LONG).show();
+ }
+ }
+ });
+ }
+
private void setWebNotify(final SenderModel senderModel) {
WebNotifySettingVo webNotifySettingVo = null;
//try phrase json setting
@@ -853,7 +953,6 @@ public class SenderActivity extends AppCompatActivity {
super.onDestroy();
}
-
@Override
protected void onResume() {
super.onResume();
diff --git a/app/src/main/java/com/idormy/sms/forwarder/model/SenderModel.java b/app/src/main/java/com/idormy/sms/forwarder/model/SenderModel.java
index 204d2c2d..6c9ba179 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/model/SenderModel.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/model/SenderModel.java
@@ -12,7 +12,7 @@ public class SenderModel {
public static final int TYPE_WEB_NOTIFY = 3;
public static final int TYPE_QYWX_GROUP_ROBOT = 4;
public static final int TYPE_QYWX_APP = 5;
- public static final int TYPE_MESSAGE = 6;
+ public static final int TYPE_SERVER_CHAN = 6;
private Long id;
private String name;
private int status;
@@ -46,10 +46,10 @@ public class SenderModel {
return R.mipmap.qywx;
case (TYPE_QYWX_APP):
return R.mipmap.qywxapp;
- case (TYPE_MESSAGE):
- return R.mipmap.sms;
+ case (TYPE_SERVER_CHAN):
+ return R.mipmap.serverchan;
default:
- return R.mipmap.ic_launcher;
+ return R.mipmap.sms;
}
}
@@ -107,10 +107,10 @@ public class SenderModel {
return R.mipmap.qywx;
case (TYPE_QYWX_APP):
return R.mipmap.qywxapp;
- case (TYPE_MESSAGE):
- return R.mipmap.sms;
+ case (TYPE_SERVER_CHAN):
+ return R.mipmap.serverchan;
default:
- return R.mipmap.ic_launcher;
+ return R.mipmap.sms;
}
}
diff --git a/app/src/main/java/com/idormy/sms/forwarder/model/vo/ServerChanSettingVo.java b/app/src/main/java/com/idormy/sms/forwarder/model/vo/ServerChanSettingVo.java
new file mode 100644
index 00000000..c71b9b43
--- /dev/null
+++ b/app/src/main/java/com/idormy/sms/forwarder/model/vo/ServerChanSettingVo.java
@@ -0,0 +1,22 @@
+package com.idormy.sms.forwarder.model.vo;
+
+import java.io.Serializable;
+
+public class ServerChanSettingVo implements Serializable {
+ private String send_key;
+
+ public ServerChanSettingVo() {
+ }
+
+ public ServerChanSettingVo(String send_key) {
+ this.send_key = send_key;
+ }
+
+ public String getSendKey() {
+ return send_key;
+ }
+
+ public void setSendKey(String send_key) {
+ this.send_key = send_key;
+ }
+}
diff --git a/app/src/main/java/com/idormy/sms/forwarder/sender/SendUtil.java b/app/src/main/java/com/idormy/sms/forwarder/sender/SendUtil.java
index d7fb88a1..8d2fde3a 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/sender/SendUtil.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/sender/SendUtil.java
@@ -13,6 +13,7 @@ import com.idormy.sms.forwarder.model.vo.DingDingSettingVo;
import com.idormy.sms.forwarder.model.vo.EmailSettingVo;
import com.idormy.sms.forwarder.model.vo.QYWXAppSettingVo;
import com.idormy.sms.forwarder.model.vo.QYWXGroupRobotSettingVo;
+import com.idormy.sms.forwarder.model.vo.ServerChanSettingVo;
import com.idormy.sms.forwarder.model.vo.SmsVo;
import com.idormy.sms.forwarder.model.vo.WebNotifySettingVo;
import com.idormy.sms.forwarder.utils.LogUtil;
@@ -25,6 +26,7 @@ import static com.idormy.sms.forwarder.model.SenderModel.TYPE_DINGDING;
import static com.idormy.sms.forwarder.model.SenderModel.TYPE_EMAIL;
import static com.idormy.sms.forwarder.model.SenderModel.TYPE_QYWX_APP;
import static com.idormy.sms.forwarder.model.SenderModel.TYPE_QYWX_GROUP_ROBOT;
+import static com.idormy.sms.forwarder.model.SenderModel.TYPE_SERVER_CHAN;
import static com.idormy.sms.forwarder.model.SenderModel.TYPE_WEB_NOTIFY;
public class SendUtil {
@@ -184,6 +186,20 @@ public class SendUtil {
}
break;
+ case TYPE_SERVER_CHAN:
+ //try phrase json setting
+ if (senderModel.getJsonSetting() != null) {
+ ServerChanSettingVo serverChanSettingVo = JSON.parseObject(senderModel.getJsonSetting(), ServerChanSettingVo.class);
+ if (serverChanSettingVo != null) {
+ try {
+ SenderServerChanMsg.sendMsg(handError, serverChanSettingVo.getSendKey(), smsVo.getMobile(), smsVo.getSmsVoForSend());
+ } catch (Exception e) {
+ Log.e(TAG, "senderSendMsg: SenderServerChanMsg error " + e.getMessage());
+ }
+ }
+ }
+ break;
+
default:
break;
}
diff --git a/app/src/main/java/com/idormy/sms/forwarder/sender/SenderServerChanMsg.java b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderServerChanMsg.java
new file mode 100644
index 00000000..5144861f
--- /dev/null
+++ b/app/src/main/java/com/idormy/sms/forwarder/sender/SenderServerChanMsg.java
@@ -0,0 +1,79 @@
+package com.idormy.sms.forwarder.sender;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+
+import java.io.IOException;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+
+import static com.idormy.sms.forwarder.SenderActivity.NOTIFY;
+
+public class SenderServerChanMsg {
+
+ static String TAG = "SenderServerChanMsg";
+
+ public static void sendMsg(final Handler handError, String sendKey, String title, String desp) throws Exception {
+ Log.i(TAG, "sendMsg sendKey:" + sendKey + " title:" + title + " desp:" + desp);
+
+ if (sendKey == null || sendKey.isEmpty()) {
+ return;
+ }
+
+ //特殊处理避免标题重复
+ desp = desp.replaceFirst("^" + title + "(.*)", "").trim();
+
+ String sendUrl = "https://sctapi.ftqq.com/" + sendKey + ".send";
+
+ OkHttpClient client = new OkHttpClient().newBuilder().build();
+ MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM)
+ .addFormDataPart("title", title)
+ .addFormDataPart("desp", desp);
+
+ RequestBody body = builder.build();
+ Request request = new Request.Builder().url(sendUrl).method("POST", body).build();
+ Call call = client.newCall(request);
+ call.enqueue(new Callback() {
+ @Override
+ public void onFailure(Call call, final IOException e) {
+ Log.d(TAG, "onFailure:" + e.getMessage());
+
+ if (handError != null) {
+ Message msg = new Message();
+ msg.what = NOTIFY;
+ Bundle bundle = new Bundle();
+ bundle.putString("DATA", "发送失败:" + e.getMessage());
+ msg.setData(bundle);
+ handError.sendMessage(msg);
+ }
+
+ }
+
+ @Override
+ public void onResponse(Call call, Response response) throws IOException {
+ final String responseStr = response.body().string();
+ Log.d(TAG, "Code:" + response.code() + responseStr);
+
+ if (handError != null) {
+ Message msg = new Message();
+ msg.what = NOTIFY;
+ Bundle bundle = new Bundle();
+ bundle.putString("DATA", "发送状态:" + responseStr);
+ msg.setData(bundle);
+ handError.sendMessage(msg);
+ Log.d(TAG, "Response:" + response.code() + responseStr);
+ }
+
+ }
+ });
+ }
+
+}
diff --git a/app/src/main/res/layout/alert_dialog_setview_serverchan.xml b/app/src/main/res/layout/alert_dialog_setview_serverchan.xml
new file mode 100644
index 00000000..26daa1ff
--- /dev/null
+++ b/app/src/main/res/layout/alert_dialog_setview_serverchan.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/serverchan.png b/app/src/main/res/mipmap-hdpi/serverchan.png
new file mode 100644
index 00000000..bdb70ff2
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/serverchan.png differ
diff --git a/app/src/main/res/mipmap-mdpi/serverchan.png b/app/src/main/res/mipmap-mdpi/serverchan.png
new file mode 100644
index 00000000..cf674353
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/serverchan.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/serverchan.png b/app/src/main/res/mipmap-xhdpi/serverchan.png
new file mode 100644
index 00000000..efbf465e
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/serverchan.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/serverchan.png b/app/src/main/res/mipmap-xxhdpi/serverchan.png
new file mode 100644
index 00000000..14301721
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/serverchan.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/serverchan.png b/app/src/main/res/mipmap-xxxhdpi/serverchan.png
new file mode 100644
index 00000000..8e8a2e5f
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/serverchan.png differ
diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml
index da1deefc..765cf215 100644
--- a/app/src/main/res/values/array.xml
+++ b/app/src/main/res/values/array.xml
@@ -7,5 +7,6 @@
- 转发到Webhook
- 转发到企业微信群机器人
- 转发到企业微信应用消息
+ - 转发到Server酱·Turbo版
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b1dfec18..5054fb5b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -12,6 +12,7 @@
设置企业微信群机器人
设置企业微信应用
设置Bark
+ 设置Server酱·Turbo版
检查更新
设置
关于
diff --git a/app/version.gradle b/app/version.gradle
index 39063da7..58d44903 100644
--- a/app/version.gradle
+++ b/app/version.gradle
@@ -1,4 +1,4 @@
ext {
- appVersionCode = 16
- appVersionName = "1.6.0"
+ appVersionCode = 17
+ appVersionName = "1.6.1"
}
\ No newline at end of file
diff --git a/psd/xxxhdpi.psd b/psd/xxxhdpi.psd
index 36750f07..3a8e7c76 100644
Binary files a/psd/xxxhdpi.psd and b/psd/xxxhdpi.psd differ