mirror of
https://github.com/pppscn/SmsForwarder
synced 2024-11-02 03:40:26 +00:00
bark新增指定推送消息图标
This commit is contained in:
parent
8b5d626c40
commit
8a79c56fa2
@ -465,6 +465,8 @@ public class SenderActivity extends AppCompatActivity {
|
||||
if (senderModel != null) editTextBarkName.setText(senderModel.getName());
|
||||
final EditText editTextBarkServer = view1.findViewById(R.id.editTextBarkServer);
|
||||
if (barkSettingVo != null) editTextBarkServer.setText(barkSettingVo.getServer());
|
||||
final EditText editTextBarkIcon = view1.findViewById(R.id.editTextBarkIcon);
|
||||
if (barkSettingVo != null) editTextBarkIcon.setText(barkSettingVo.getIcon());
|
||||
|
||||
Button buttonBarkOk = view1.findViewById(R.id.buttonBarkOk);
|
||||
Button buttonBarkDel = view1.findViewById(R.id.buttonBarkDel);
|
||||
@ -484,7 +486,8 @@ public class SenderActivity extends AppCompatActivity {
|
||||
newSenderModel.setType(TYPE_BARK);
|
||||
newSenderModel.setStatus(STATUS_ON);
|
||||
BarkSettingVo barkSettingVoNew = new BarkSettingVo(
|
||||
editTextBarkServer.getText().toString()
|
||||
editTextBarkServer.getText().toString(),
|
||||
editTextBarkIcon.getText().toString()
|
||||
);
|
||||
newSenderModel.setJsonSetting(JSON.toJSONString(barkSettingVoNew));
|
||||
SenderUtil.addSender(newSenderModel);
|
||||
@ -495,7 +498,8 @@ public class SenderActivity extends AppCompatActivity {
|
||||
senderModel.setType(TYPE_BARK);
|
||||
senderModel.setStatus(STATUS_ON);
|
||||
BarkSettingVo barkSettingVoNew = new BarkSettingVo(
|
||||
editTextBarkServer.getText().toString()
|
||||
editTextBarkServer.getText().toString(),
|
||||
editTextBarkIcon.getText().toString()
|
||||
);
|
||||
senderModel.setJsonSetting(JSON.toJSONString(barkSettingVoNew));
|
||||
SenderUtil.updateSender(senderModel);
|
||||
@ -516,9 +520,10 @@ public class SenderActivity extends AppCompatActivity {
|
||||
});
|
||||
buttonBarkTest.setOnClickListener(view -> {
|
||||
String barkServer = editTextBarkServer.getText().toString();
|
||||
String barkIcon = editTextBarkIcon.getText().toString();
|
||||
if (!barkServer.isEmpty()) {
|
||||
try {
|
||||
SenderBarkMsg.sendMsg(0, handler, barkServer, getString(R.string.test_phone_num), getString(R.string.test_sms), getString(R.string.test_group_name));
|
||||
SenderBarkMsg.sendMsg(0, handler, barkServer, barkIcon, getString(R.string.test_phone_num), getString(R.string.test_sms), getString(R.string.test_group_name));
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(SenderActivity.this, getString(R.string.failed_to_fwd) + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||
e.printStackTrace();
|
||||
|
@ -7,12 +7,14 @@ import lombok.Data;
|
||||
@Data
|
||||
public class BarkSettingVo implements Serializable {
|
||||
private String server;
|
||||
private String icon;
|
||||
|
||||
public BarkSettingVo() {
|
||||
}
|
||||
|
||||
public BarkSettingVo(String server) {
|
||||
public BarkSettingVo(String server, String icon) {
|
||||
this.server = server;
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class SendUtil {
|
||||
BarkSettingVo barkSettingVo = JSON.parseObject(senderModel.getJsonSetting(), BarkSettingVo.class);
|
||||
if (barkSettingVo != null) {
|
||||
try {
|
||||
SenderBarkMsg.sendMsg(logId, handError, barkSettingVo.getServer(), smsVo.getMobile(), smsVo.getSmsVoForSend(), senderModel.getName());
|
||||
SenderBarkMsg.sendMsg(logId, handError, barkSettingVo.getServer(), barkSettingVo.getIcon(), smsVo.getMobile(), smsVo.getSmsVoForSend(), senderModel.getName());
|
||||
} catch (Exception e) {
|
||||
LogUtil.updateLog(logId, 0, e.getMessage());
|
||||
Log.e(TAG, "senderSendMsg: SenderBarkMsg error " + e.getMessage());
|
||||
|
@ -28,7 +28,7 @@ public class SenderBarkMsg extends SenderBaseMsg {
|
||||
|
||||
static final String TAG = "SenderBarkMsg";
|
||||
|
||||
public static void sendMsg(final long logId, final Handler handError, String barkServer, String from, String content, String groupName) throws Exception {
|
||||
public static void sendMsg(final long logId, final Handler handError, String barkServer, String barkIcon, String from, String content, String groupName) throws Exception {
|
||||
Log.i(TAG, "sendMsg barkServer:" + barkServer + " from:" + from + " content:" + content);
|
||||
|
||||
if (barkServer == null || barkServer.isEmpty()) {
|
||||
@ -42,6 +42,9 @@ public class SenderBarkMsg extends SenderBaseMsg {
|
||||
barkServer += "/" + URLEncoder.encode(content, "UTF-8");
|
||||
barkServer += "?isArchive=1"; //自动保存
|
||||
barkServer += "&group=" + URLEncoder.encode(groupName, "UTF-8"); //增加支持分组
|
||||
if (!barkIcon.isEmpty()) {
|
||||
barkServer += "&icon=" + URLEncoder.encode(barkIcon, "UTF-8"); //指定推送消息图标
|
||||
}
|
||||
int isCode = content.indexOf("验证码");
|
||||
int isPassword = content.indexOf("动态密码");
|
||||
if (isCode != -1 || isPassword != -1) {
|
||||
|
@ -56,6 +56,29 @@
|
||||
tools:ignore="LabelFor" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_bark_icon" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextBarkIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints=""
|
||||
android:ems="14"
|
||||
android:inputType="text"
|
||||
android:text=""
|
||||
tools:ignore="LabelFor" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -9,6 +9,7 @@
|
||||
<string name="confirm">Confirm</string>
|
||||
<string name="all">All</string>
|
||||
<string name="select">Select</string>
|
||||
<string name="clone">Clone Settings</string>
|
||||
<string name="setting">Settings</string>
|
||||
<string name="about">About</string>
|
||||
<string name="rule_setting">Rule Setting</string>
|
||||
@ -104,6 +105,7 @@
|
||||
<string name="new_sender">New Sender</string>
|
||||
<string name="set_bark_name">Bark Group Name</string>
|
||||
<string name="set_bark_server">Bark-Server, e.g. https://bark.bms.ink/XXXXXXXX/</string>
|
||||
<string name="set_bark_icon">Bark-Icon (optional), e.g. http://day.app/assets/images/avatar.jpg</string>
|
||||
<string name="set_name">Name</string>
|
||||
<string name="dingding_token">Token e.g. the XXXXXX part of https://oapi.dingtalk.com/robot/send?access_token=XXXXXX</string>
|
||||
<string name="dingding_secret">Secret (optional)</string>
|
||||
@ -161,7 +163,7 @@
|
||||
<string name="calling">Incoming telegram</string>
|
||||
<string name="unsupport">Your phone does not support this setting</string>
|
||||
<string name="isIgnored">Set successfully!</string>
|
||||
<!--SenderBaseMsg-->
|
||||
<!--Other-->
|
||||
<string name="version_now">v1.0</string>
|
||||
<string name="linkweb">https://github.com/pppscn/SmsForwarder</string>
|
||||
<string name="linkweb2">https://gitee.com/pp/SmsForwarder</string>
|
||||
@ -171,4 +173,21 @@
|
||||
<string name="mu_rule_tips">多重匹配规则示例:\n \n 并且 是 手机号 相等 10086\n 或者 是 手机号 相等 10011\n 并且 是 短信内容 包含 欠费\n \n 以上规则表示:收到短信,并且(手机号是10086 或者 手机号是10010),并且 短信内容 包含 欠费 时转发短信\n 注意:每行开始的空格代表层级,太过复杂的多重规则可能导致内存占用很大!</string>
|
||||
<string name="post">POST</string>
|
||||
<string name="get">GET</string>
|
||||
<!--CloneActivity-->
|
||||
<string name="local_ip">Local IP:</string>
|
||||
<string name="operating_instruction">Operation instructions: \n1. Please keep the old and new phones in the same WiFi network, and do not turn on isolation \n2.The old mobile phone directly click "send" button, get "server IP" \n3. After filling in "Server IP" for the new mobile phone, click "Receive" button \n [note], the sender and forwarding rules will be completely covered after the new mobile phone receives!</string>
|
||||
<string name="send">Send</string>
|
||||
<string name="stop">Stop</string>
|
||||
<string name="old_mobile_phone">I\'m the old phone</string>
|
||||
<string name="receive">Receive</string>
|
||||
<string name="new_mobile_phone">I\'m the new phone</string>
|
||||
<string name="server_ip">Server IP: </string>
|
||||
<string name="point">.</string>
|
||||
<string name="invalid_ip">Please enter a valid IP address</string>
|
||||
<string name="server_has_started">The server is started successfully</string>
|
||||
<string name="server_has_stopped">The server has been stopped</string>
|
||||
<string name="sender_cannot_receive">This mobile phone is the sender and cannot receive files.</string>
|
||||
<string name="no_wifi_network">If the Wifi network is not connected, the one-click cloning function cannot be used.</string>
|
||||
<string name="invalid_server_ip">Please enter a valid server IP address</string>
|
||||
<string name="download_failed">Download Failed</string>
|
||||
</resources>
|
||||
|
@ -9,6 +9,7 @@
|
||||
<string name="confirm">确认</string>
|
||||
<string name="all">全部</string>
|
||||
<string name="select">选择</string>
|
||||
<string name="clone">一键克隆</string>
|
||||
<string name="setting">设置</string>
|
||||
<string name="about">关于</string>
|
||||
<string name="rule_setting">设置转发规则</string>
|
||||
@ -104,6 +105,7 @@
|
||||
<string name="new_sender">添加发送方</string>
|
||||
<string name="set_bark_name">设置分组名称</string>
|
||||
<string name="set_bark_server">设置Bark-Server地址,示例:https://bark.bms.ink/XXXXXXXX/</string>
|
||||
<string name="set_bark_icon">设置推送消息图标(可选),示例:http://day.app/assets/images/avatar.jpg</string>
|
||||
<string name="set_name">设置名称</string>
|
||||
<string name="dingding_token">设置Token 例如 https://oapi.dingtalk.com/robot/send?access_token=XXXXXX 中的 XXXXXX</string>
|
||||
<string name="dingding_secret">加签 Secret (没有可不填)</string>
|
||||
@ -171,4 +173,20 @@
|
||||
<string name="mu_rule_tips">多重匹配规则示例:\n \n 并且 是 手机号 相等 10086\n 或者 是 手机号 相等 10011\n 并且 是 短信内容 包含 欠费\n \n 以上规则表示:收到短信,并且(手机号是10086 或者 手机号是10010),并且 短信内容 包含 欠费 时转发短信\n 注意:每行开始的空格代表层级,太过复杂的多重规则可能导致内存占用很大!</string>
|
||||
<string name="post">POST</string>
|
||||
<string name="get">GET</string>
|
||||
<string name="local_ip">本机IP:</string>
|
||||
<string name="operating_instruction">操作说明:\n1.请保持新旧手机在同一个WiFi网络下,且没有开启隔离\n2.旧手机直接点【发送】按钮,获取到【服务端IP】\n3.新手机填写【服务端IP】后,点【接收】按钮\n【注意】新手机接收后,发送方、转发规则将完全被覆盖!</string>
|
||||
<string name="send">发送</string>
|
||||
<string name="stop">停止</string>
|
||||
<string name="old_mobile_phone">我是旧手机</string>
|
||||
<string name="receive">接收</string>
|
||||
<string name="new_mobile_phone">我是新手机</string>
|
||||
<string name="server_ip">服务端IP:</string>
|
||||
<string name="point">.</string>
|
||||
<string name="invalid_ip">请输入合法的IP地址</string>
|
||||
<string name="server_has_started">服务端已启动</string>
|
||||
<string name="server_has_stopped">服务端已停止</string>
|
||||
<string name="sender_cannot_receive">本手机是发送端,不可接收文件,请先停止服务端!</string>
|
||||
<string name="no_wifi_network">未接入Wifi网络,不可使用一键克隆功能!</string>
|
||||
<string name="invalid_server_ip">请输入服务端IP</string>
|
||||
<string name="download_failed">下载文件失败</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user