mirror of
https://github.com/pppscn/SmsForwarder
synced 2025-08-19 17:27:42 +08:00
新增:pushplus增加标题模板
优化:发送通道测试内容统一
This commit is contained in:
parent
fdad4471a8
commit
c011f6f811
@ -52,6 +52,7 @@ import com.idormy.sms.forwarder.model.vo.QYWXAppSettingVo;
|
|||||||
import com.idormy.sms.forwarder.model.vo.QYWXGroupRobotSettingVo;
|
import com.idormy.sms.forwarder.model.vo.QYWXGroupRobotSettingVo;
|
||||||
import com.idormy.sms.forwarder.model.vo.ServerChanSettingVo;
|
import com.idormy.sms.forwarder.model.vo.ServerChanSettingVo;
|
||||||
import com.idormy.sms.forwarder.model.vo.SmsSettingVo;
|
import com.idormy.sms.forwarder.model.vo.SmsSettingVo;
|
||||||
|
import com.idormy.sms.forwarder.model.vo.SmsVo;
|
||||||
import com.idormy.sms.forwarder.model.vo.TelegramSettingVo;
|
import com.idormy.sms.forwarder.model.vo.TelegramSettingVo;
|
||||||
import com.idormy.sms.forwarder.model.vo.WebNotifySettingVo;
|
import com.idormy.sms.forwarder.model.vo.WebNotifySettingVo;
|
||||||
import com.idormy.sms.forwarder.sender.SenderBarkMsg;
|
import com.idormy.sms.forwarder.sender.SenderBarkMsg;
|
||||||
@ -76,7 +77,6 @@ import com.idormy.sms.forwarder.view.StepBar;
|
|||||||
import com.umeng.analytics.MobclickAgent;
|
import com.umeng.analytics.MobclickAgent;
|
||||||
|
|
||||||
import java.net.Proxy;
|
import java.net.Proxy;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -508,7 +508,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
String atMobiles = editTextDingdingAtMobiles.getText().toString().trim();
|
String atMobiles = editTextDingdingAtMobiles.getText().toString().trim();
|
||||||
Boolean atAll = switchDingdingAtAll.isChecked();
|
Boolean atAll = switchDingdingAtAll.isChecked();
|
||||||
try {
|
try {
|
||||||
SenderDingdingMsg.sendMsg(0, handler, token, secret, atMobiles, atAll, R.string.test_content + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderDingdingMsg.sendMsg(0, handler, null, token, secret, atMobiles, atAll, smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -647,7 +648,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SenderMailMsg.sendEmail(0, handler, protocol, host, port, ssl, fromEmail, nickname, pwd, toEmail, title, R.string.test_content + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderMailMsg.sendEmail(0, handler, null, protocol, host, port, ssl, fromEmail, nickname, pwd, toEmail, smsVo.getTitleForSend(title), smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -772,7 +774,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
String barkIcon = editTextBarkIcon.getText().toString().trim();
|
String barkIcon = editTextBarkIcon.getText().toString().trim();
|
||||||
if (CommonUtil.checkUrl(barkServer, false)) {
|
if (CommonUtil.checkUrl(barkServer, false)) {
|
||||||
try {
|
try {
|
||||||
SenderBarkMsg.sendMsg(0, handler, barkServer, barkIcon, getString(R.string.test_phone_num), getString(R.string.test_sms), getString(R.string.test_group_name));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderBarkMsg.sendMsg(0, handler, null, barkServer, barkIcon, getString(R.string.test_phone_num), smsVo.getSmsVoForSend(), getString(R.string.test_group_name));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -885,7 +888,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SenderWebNotifyMsg.sendMsg(0, handler, webServer, webParams, secret, method, "SmsForwarder Title", R.string.test_content + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderWebNotifyMsg.sendMsg(0, handler, null, webServer, webParams, secret, method, smsVo.getMobile(), smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -983,7 +987,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SenderQyWxGroupRobotMsg.sendMsg(0, handler, webHook, "SmsForwarder Title", R.string.test_content + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderQyWxGroupRobotMsg.sendMsg(0, handler, null, webHook, smsVo.getMobile(), smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1120,7 +1125,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SenderQyWxAppMsg.sendMsg(0, handler, senderModel, QYWXAppSettingVoNew, R.string.test_content + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderQyWxAppMsg.sendMsg(0, handler, null, senderModel, QYWXAppSettingVoNew, smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1216,7 +1222,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SenderServerChanMsg.sendMsg(0, handler, serverChanServer, getString(R.string.test_phone_num), getString(R.string.test_sms));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderServerChanMsg.sendMsg(0, handler, null, serverChanServer, smsVo.getMobile(), smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1405,8 +1412,9 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
String method = radioGroupTelegramMethod.getCheckedRadioButtonId() == R.id.radioTelegramMethodGet ? "GET" : "POST";
|
String method = radioGroupTelegramMethod.getCheckedRadioButtonId() == R.id.radioTelegramMethodGet ? "GET" : "POST";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
TelegramSettingVo telegramSettingVoNew = new TelegramSettingVo(apiToken, chatId, proxyTypeId, proxyHost, proxyPort, proxyAuthenticator, proxyUsername, proxyPassword, method);
|
TelegramSettingVo telegramSettingVoNew = new TelegramSettingVo(apiToken, chatId, proxyTypeId, proxyHost, proxyPort, proxyAuthenticator, proxyUsername, proxyPassword, method);
|
||||||
SenderTelegramMsg.sendMsg(0, handler, telegramSettingVoNew, getString(R.string.test_phone_num), getString(R.string.test_sms), telegramSettingVoNew.getMethod());
|
SenderTelegramMsg.sendMsg(0, handler, null, telegramSettingVoNew, smsVo.getMobile(), smsVo.getSmsVoForSend(), telegramSettingVoNew.getMethod());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1520,7 +1528,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SenderSmsMsg.sendMsg(0, handler, simSlot, mobiles, onlyNoNetwork, getString(R.string.test_phone_num), getString(R.string.test_sms));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderSmsMsg.sendMsg(0, handler, simSlot, mobiles, onlyNoNetwork, smsVo.getMobile(), smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1620,7 +1629,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SenderFeishuMsg.sendMsg(0, handler, webHook, secret, getString(R.string.test_phone_num), new Date(), getString(R.string.test_sms));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderFeishuMsg.sendMsg(0, handler, null, webHook, secret, smsVo.getMobile(), new Date(), smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1656,6 +1666,7 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
final EditText editTextPushPlusWebhook = view1.findViewById(R.id.editTextPushPlusWebhook);
|
final EditText editTextPushPlusWebhook = view1.findViewById(R.id.editTextPushPlusWebhook);
|
||||||
final EditText editTextPushPlusCallbackUrl = view1.findViewById(R.id.editTextPushPlusCallbackUrl);
|
final EditText editTextPushPlusCallbackUrl = view1.findViewById(R.id.editTextPushPlusCallbackUrl);
|
||||||
final EditText editTextPushPlusValidTime = view1.findViewById(R.id.editTextPushPlusValidTime);
|
final EditText editTextPushPlusValidTime = view1.findViewById(R.id.editTextPushPlusValidTime);
|
||||||
|
final EditText editTextPushPlusTitle = view1.findViewById(R.id.editTextPushPlusTitle);
|
||||||
|
|
||||||
if (pushPlusSettingVo != null) {
|
if (pushPlusSettingVo != null) {
|
||||||
editTextPushPlusToken.setText(pushPlusSettingVo.getToken());
|
editTextPushPlusToken.setText(pushPlusSettingVo.getToken());
|
||||||
@ -1665,6 +1676,7 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
editTextPushPlusWebhook.setText(pushPlusSettingVo.getWebhook());
|
editTextPushPlusWebhook.setText(pushPlusSettingVo.getWebhook());
|
||||||
editTextPushPlusCallbackUrl.setText(pushPlusSettingVo.getCallbackUrl());
|
editTextPushPlusCallbackUrl.setText(pushPlusSettingVo.getCallbackUrl());
|
||||||
editTextPushPlusValidTime.setText(pushPlusSettingVo.getValidTime());
|
editTextPushPlusValidTime.setText(pushPlusSettingVo.getValidTime());
|
||||||
|
editTextPushPlusTitle.setText(pushPlusSettingVo.getTitleTemplate());
|
||||||
}
|
}
|
||||||
|
|
||||||
Button buttonPushPlusOk = view1.findViewById(R.id.buttonPushPlusOk);
|
Button buttonPushPlusOk = view1.findViewById(R.id.buttonPushPlusOk);
|
||||||
@ -1691,7 +1703,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
editTextPushPlusChannel.getText().toString().trim(),
|
editTextPushPlusChannel.getText().toString().trim(),
|
||||||
editTextPushPlusWebhook.getText().toString().trim(),
|
editTextPushPlusWebhook.getText().toString().trim(),
|
||||||
editTextPushPlusCallbackUrl.getText().toString().trim(),
|
editTextPushPlusCallbackUrl.getText().toString().trim(),
|
||||||
editTextPushPlusValidTime.getText().toString().trim()
|
editTextPushPlusValidTime.getText().toString().trim(),
|
||||||
|
editTextPushPlusTitle.getText().toString().trim()
|
||||||
);
|
);
|
||||||
if (TextUtils.isEmpty(pushPlusSettingVoNew.getToken())) {
|
if (TextUtils.isEmpty(pushPlusSettingVoNew.getToken())) {
|
||||||
Toast.makeText(SenderActivity.this, R.string.invalid_token, Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, R.string.invalid_token, Toast.LENGTH_LONG).show();
|
||||||
@ -1730,6 +1743,10 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
buttonPushPlusTest.setOnClickListener(view -> {
|
buttonPushPlusTest.setOnClickListener(view -> {
|
||||||
|
|
||||||
|
String title = editTextPushPlusTitle.getText().toString().trim();
|
||||||
|
if (title.isEmpty()) title = "SmsForwarder Title";
|
||||||
|
|
||||||
PushPlusSettingVo pushPlusSettingVoNew = new PushPlusSettingVo(
|
PushPlusSettingVo pushPlusSettingVoNew = new PushPlusSettingVo(
|
||||||
editTextPushPlusToken.getText().trim(),
|
editTextPushPlusToken.getText().trim(),
|
||||||
editTextPushPlusTopic.getText().toString().trim(),
|
editTextPushPlusTopic.getText().toString().trim(),
|
||||||
@ -1737,7 +1754,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
editTextPushPlusChannel.getText().toString().trim(),
|
editTextPushPlusChannel.getText().toString().trim(),
|
||||||
editTextPushPlusWebhook.getText().toString().trim(),
|
editTextPushPlusWebhook.getText().toString().trim(),
|
||||||
editTextPushPlusCallbackUrl.getText().toString().trim(),
|
editTextPushPlusCallbackUrl.getText().toString().trim(),
|
||||||
editTextPushPlusValidTime.getText().toString().trim()
|
editTextPushPlusValidTime.getText().toString().trim(),
|
||||||
|
title
|
||||||
);
|
);
|
||||||
|
|
||||||
if (TextUtils.isEmpty(pushPlusSettingVoNew.getToken())) {
|
if (TextUtils.isEmpty(pushPlusSettingVoNew.getToken())) {
|
||||||
@ -1746,12 +1764,41 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SenderPushPlusMsg.sendMsg(0, handler, pushPlusSettingVoNew, "SmsForwarder", getString(R.string.test_content) + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderPushPlusMsg.sendMsg(0, handler, null, pushPlusSettingVoNew, smsVo.getTitleForSend(title), smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Button buttonInsertSender = view1.findViewById(R.id.bt_insert_sender);
|
||||||
|
buttonInsertSender.setOnClickListener(view -> {
|
||||||
|
editTextPushPlusTitle.setFocusable(true);
|
||||||
|
editTextPushPlusTitle.requestFocus();
|
||||||
|
CommonUtil.insertOrReplaceText2Cursor(editTextPushPlusTitle, "{{来源号码}}");
|
||||||
|
});
|
||||||
|
|
||||||
|
Button buttonInsertExtra = view1.findViewById(R.id.bt_insert_extra);
|
||||||
|
buttonInsertExtra.setOnClickListener(view -> {
|
||||||
|
editTextPushPlusTitle.setFocusable(true);
|
||||||
|
editTextPushPlusTitle.requestFocus();
|
||||||
|
CommonUtil.insertOrReplaceText2Cursor(editTextPushPlusTitle, "{{卡槽信息}}");
|
||||||
|
});
|
||||||
|
|
||||||
|
Button buttonInsertTime = view1.findViewById(R.id.bt_insert_time);
|
||||||
|
buttonInsertTime.setOnClickListener(view -> {
|
||||||
|
editTextPushPlusTitle.setFocusable(true);
|
||||||
|
editTextPushPlusTitle.requestFocus();
|
||||||
|
CommonUtil.insertOrReplaceText2Cursor(editTextPushPlusTitle, "{{接收时间}}");
|
||||||
|
});
|
||||||
|
|
||||||
|
Button buttonInsertDeviceName = view1.findViewById(R.id.bt_insert_device_name);
|
||||||
|
buttonInsertDeviceName.setOnClickListener(view -> {
|
||||||
|
editTextPushPlusTitle.setFocusable(true);
|
||||||
|
editTextPushPlusTitle.requestFocus();
|
||||||
|
CommonUtil.insertOrReplaceText2Cursor(editTextPushPlusTitle, "{{设备名称}}");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//Gotify
|
//Gotify
|
||||||
@ -1861,7 +1908,8 @@ public class SenderActivity extends AppCompatActivity {
|
|||||||
GotifySettingVo gotifySettingVoNew = new GotifySettingVo(webServer, title, priority);
|
GotifySettingVo gotifySettingVoNew = new GotifySettingVo(webServer, title, priority);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SenderGotifyMsg.sendMsg(0, handler, gotifySettingVoNew, title, R.string.test_content + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
|
SmsVo smsVo = new SmsVo(getString(R.string.test_phone_num), getString(R.string.test_sender_sms), new Date(), getString(R.string.test_sim_info));
|
||||||
|
SenderGotifyMsg.sendMsg(0, handler, null, gotifySettingVoNew, smsVo.getTitleForSend(title), smsVo.getSmsVoForSend());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -13,11 +13,12 @@ public class PushPlusSettingVo implements Serializable {
|
|||||||
private String webhook;
|
private String webhook;
|
||||||
private String callbackUrl;
|
private String callbackUrl;
|
||||||
private String validTime;
|
private String validTime;
|
||||||
|
private String titleTemplate;
|
||||||
|
|
||||||
public PushPlusSettingVo() {
|
public PushPlusSettingVo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PushPlusSettingVo(String token, String topic, String template, String channel, String webhook, String callbackUrl, String validTime) {
|
public PushPlusSettingVo(String token, String topic, String template, String channel, String webhook, String callbackUrl, String validTime, String titleTemplate) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.topic = topic;
|
this.topic = topic;
|
||||||
this.template = template;
|
this.template = template;
|
||||||
@ -25,5 +26,6 @@ public class PushPlusSettingVo implements Serializable {
|
|||||||
this.webhook = webhook;
|
this.webhook = webhook;
|
||||||
this.callbackUrl = callbackUrl;
|
this.callbackUrl = callbackUrl;
|
||||||
this.validTime = validTime;
|
this.validTime = validTime;
|
||||||
|
this.titleTemplate = titleTemplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,17 @@ public class SmsVo implements Serializable {
|
|||||||
this.simInfo = simInfo;
|
this.simInfo = simInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
|
public String getTitleForSend() {
|
||||||
|
return getTitleForSend("", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
|
public String getTitleForSend(String titleTemplate) {
|
||||||
|
return getTitleForSend(titleTemplate, "");
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
public String getTitleForSend(String titleTemplate, String regexReplace) {
|
public String getTitleForSend(String titleTemplate, String regexReplace) {
|
||||||
if (titleTemplate == null || titleTemplate.isEmpty()) titleTemplate = "{{来源号码}}";
|
if (titleTemplate == null || titleTemplate.isEmpty()) titleTemplate = "{{来源号码}}";
|
||||||
@ -47,6 +58,16 @@ public class SmsVo implements Serializable {
|
|||||||
return RegexReplace(regexReplace, titleForSend);
|
return RegexReplace(regexReplace, titleForSend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
|
public String getSmsVoForSend() {
|
||||||
|
return getSmsVoForSend("", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
|
public String getSmsVoForSend(String ruleSmsTemplate) {
|
||||||
|
return getSmsVoForSend(ruleSmsTemplate, "");
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
public String getSmsVoForSend(String ruleSmsTemplate, String regexReplace) {
|
public String getSmsVoForSend(String ruleSmsTemplate, String regexReplace) {
|
||||||
String deviceMark = SettingUtil.getAddExtraDeviceMark().trim();
|
String deviceMark = SettingUtil.getAddExtraDeviceMark().trim();
|
||||||
|
@ -234,6 +234,104 @@
|
|||||||
tools:ignore="LabelFor" />
|
tools:ignore="LabelFor" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_sms_template"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/title_template"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:text="@string/custom_templates_tips"
|
||||||
|
android:textSize="10sp"
|
||||||
|
tools:ignore="SmallSp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/editTextPushPlusTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:gravity="start|top"
|
||||||
|
android:inputType="text"
|
||||||
|
android:minLines="1"
|
||||||
|
android:text=""
|
||||||
|
tools:ignore="LabelFor,TextFields" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bt_insert_sender"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/colorBlueGrey"
|
||||||
|
android:text="@string/insert_sender"
|
||||||
|
tools:ignore="ButtonStyle,NestedWeights" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bt_insert_extra"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/colorBlueGrey"
|
||||||
|
android:text="@string/insert_extra"
|
||||||
|
tools:ignore="ButtonStyle,NestedWeights" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bt_insert_time"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/colorBlueGrey"
|
||||||
|
android:text="@string/insert_time"
|
||||||
|
tools:ignore="ButtonStyle,NestedWeights" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bt_insert_device_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/colorBlueGrey"
|
||||||
|
android:text="@string/insert_device_name"
|
||||||
|
tools:ignore="ButtonStyle,NestedWeights" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user