Skip to content

Commit

Permalink
[bot] AutoMerging: merge all upstream's changes:
Browse files Browse the repository at this point in the history
* 'main' of https://github.com/pppscn/SmsForwarder:
  优化:发送通道`webhook`支持HTTP基本认证 【格式:http://username:password@domain.com/uri】 pppscn#175 优化:发送通道`企业微信应用`获取access_token失败时记录错误日志 优化:发送通道`短信`发送权限未授权/仅当无网络启用时记录错误日志
  修复:邮箱发送通道收件地址不支持逗号分隔Bug(已支持逗号/分号)
  优化:测试发送通道/转发规则时创建子线程运行 & 异常捕获
  优化:发送通道`Telegram`代理主机名支持域名解析 pppscn#172
  新增:远程查配置接口增加卡槽信息与备注 pppscn#174
  修复:发送通道`Telegram`启用Socks5支持用户密码鉴权 pppscn#172
  • Loading branch information
github-actions[bot] committed Jul 1, 2022
2 parents 3c3009b + f142f8d commit ab2da5a
Show file tree
Hide file tree
Showing 33 changed files with 472 additions and 423 deletions.
11 changes: 9 additions & 2 deletions app/src/main/java/com/idormy/sms/forwarder/entity/SimInfo.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
package com.idormy.sms.forwarder.entity

import com.google.gson.annotations.SerializedName
import java.io.Serializable

//SIM卡信息
data class SimInfo(
//运营商信息:中国移动 中国联通 中国电信
@SerializedName("carrier_name")
var mCarrierName: CharSequence? = null,
//卡槽ID,SimSerialNumber
//集成电路卡识别码即SIM卡卡号
@SerializedName("icc_id")
var mIccId: CharSequence? = null,
//卡槽id:-1=没插入、 0=卡槽1 、1=卡槽2
@SerializedName("sim_slot_index")
var mSimSlotIndex: Int = 0,
//号码
@SerializedName("number")
var mNumber: CharSequence? = null,
//城市
//国家代码
@SerializedName("country_iso")
var mCountryIso: CharSequence? = null,
//SIM的 Subscription Id (SIM插入顺序)
@SerializedName("subscription_id")
var mSubscriptionId: Int = 0,
) : Serializable {
override fun toString(): String {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment

import android.os.Looper
import android.util.Log
import android.view.LayoutInflater
import android.view.View
Expand Down Expand Up @@ -627,7 +628,16 @@ class RulesEditFragment : BaseFragment<FragmentRulesEditBinding?>(), View.OnClic
}

override fun onSuccess(sender: Sender) {
SendUtils.sendMsgSender(msgInfo, rule, sender, 0L)
Thread {
try {
SendUtils.sendMsgSender(msgInfo, rule, sender, 0L)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
}
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -183,10 +184,19 @@ class BarkFragment : BaseFragment<FragmentSendersBarkBinding?>(), View.OnClickLi
}
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
BarkUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
BarkUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -158,10 +159,19 @@ class DingtalkFragment : BaseFragment<FragmentSendersDingtalkBinding?>(), View.O
when (v.id) {
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
DingtalkUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
DingtalkUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -212,10 +213,19 @@ class EmailFragment : BaseFragment<FragmentSendersEmailBinding?>(), View.OnClick
}
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
EmailUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
EmailUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -157,10 +158,19 @@ class FeishuFragment : BaseFragment<FragmentSendersFeishuBinding?>(), View.OnCli
}
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
FeishuUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
FeishuUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -156,10 +157,19 @@ class GotifyFragment : BaseFragment<FragmentSendersGotifyBinding?>(), View.OnCli
}
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
GotifyUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
GotifyUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -176,10 +177,19 @@ class PushplusFragment : BaseFragment<FragmentSendersPushplusBinding?>(), View.O
}
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
PushplusUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
PushplusUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -138,10 +139,19 @@ class ServerchanFragment : BaseFragment<FragmentSendersServerchanBinding?>(), Vi
when (v.id) {
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
ServerchanUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
ServerchanUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -164,10 +165,19 @@ class SmsFragment : BaseFragment<FragmentSendersSmsBinding?>(), View.OnClickList
when (v.id) {
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
SmsUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
SmsUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -164,10 +165,19 @@ class TelegramFragment : BaseFragment<FragmentSendersTelegramBinding?>(), View.O
when (v.id) {
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
TelegramUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
TelegramUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.idormy.sms.forwarder.fragment.senders

import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -150,10 +151,19 @@ class WebhookFragment : BaseFragment<FragmentSendersWebhookBinding?>(), View.OnC
when (v.id) {
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
WebhookUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
WebhookUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.idormy.sms.forwarder.fragment.senders

import android.annotation.SuppressLint
import android.os.Looper
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
Expand Down Expand Up @@ -155,10 +156,19 @@ class WeworkAgentFragment : BaseFragment<FragmentSendersWeworkAgentBinding?>(),
when (v.id) {
R.id.btn_test -> {
mCountDownHelper?.start()
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
WeworkAgentUtils.sendMsg(settingVo, msgInfo)
Thread {
try {
val settingVo = checkSetting()
Log.d(TAG, settingVo.toString())
val msgInfo = MsgInfo("sms", getString(R.string.test_phone_num), getString(R.string.test_sender_sms), Date(), getString(R.string.test_sim_info))
WeworkAgentUtils.sendMsg(settingVo, msgInfo)
} catch (e: Exception) {
e.printStackTrace()
if (Looper.myLooper() == null) Looper.prepare()
XToastUtils.error(e.message.toString())
Looper.loop()
}
}.start()
return
}
R.id.btn_del -> {
Expand Down
Loading

0 comments on commit ab2da5a

Please sign in to comment.