update 更新获取配置
This commit is contained in:
@@ -46,30 +46,28 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.yameida.worktool.activity.LoginActivity"
|
android:name="org.yameida.worktool.activity.LoginActivity"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.yameida.worktool.activity.SettingsActivity"
|
android:name="org.yameida.worktool.activity.SettingsActivity"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.yameida.worktool.activity.BrowserActivity"
|
android:name="org.yameida.worktool.activity.BrowserActivity"
|
||||||
android:windowSoftInputMode="adjustUnspecified|stateHidden"
|
android:windowSoftInputMode="adjustUnspecified|stateHidden"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.yameida.worktool.activity.FloatViewGuideActivity"
|
android:name="org.yameida.worktool.activity.FloatViewGuideActivity"
|
||||||
android:windowSoftInputMode="adjustUnspecified|stateHidden"
|
android:windowSoftInputMode="adjustUnspecified|stateHidden"
|
||||||
android:launchMode="singleInstance"
|
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.yameida.worktool.activity.AccessibilityGuideActivity"
|
android:name="org.yameida.worktool.activity.AccessibilityGuideActivity"
|
||||||
android:windowSoftInputMode="adjustUnspecified|stateHidden"
|
android:windowSoftInputMode="adjustUnspecified|stateHidden"
|
||||||
android:launchMode="singleInstance"
|
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
</activity>
|
</activity>
|
||||||
<service
|
<service
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ object Constant {
|
|||||||
set(value) {
|
set(value) {
|
||||||
SPUtils.getInstance().put("qaUrl", value)
|
SPUtils.getInstance().put("qaUrl", value)
|
||||||
}
|
}
|
||||||
|
var openCallback: Int
|
||||||
|
get() = SPUtils.getInstance().getInt("openCallback", 0)
|
||||||
|
set(value) {
|
||||||
|
SPUtils.getInstance().put("openCallback", value)
|
||||||
|
}
|
||||||
var host: String
|
var host: String
|
||||||
get() = SPUtils.getInstance().getString("host", DEFAULT_HOST)
|
get() = SPUtils.getInstance().getString("host", DEFAULT_HOST)
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -46,6 +51,8 @@ object Constant {
|
|||||||
|
|
||||||
fun getCheckUpdateUrl() = "${getBaseUrl()}/appUpdate/checkUpdate"
|
fun getCheckUpdateUrl() = "${getBaseUrl()}/appUpdate/checkUpdate"
|
||||||
|
|
||||||
|
fun getMyConfig() = "${getBaseUrl()}/robot/robotInfo/get?robotId=$robotId"
|
||||||
|
|
||||||
fun getRobotUpdateUrl() = "${getBaseUrl()}/robot/robotInfo/update"
|
fun getRobotUpdateUrl() = "${getBaseUrl()}/robot/robotInfo/update"
|
||||||
|
|
||||||
fun getTestUrl() = "${getBaseUrl()}/test"
|
fun getTestUrl() = "${getBaseUrl()}/test"
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.os.Bundle
|
|||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.widget.CompoundButton
|
import android.widget.CompoundButton
|
||||||
import androidx.appcompat.app.AlertDialog
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.blankj.utilcode.util.*
|
import com.blankj.utilcode.util.*
|
||||||
import com.umeng.analytics.MobclickAgent
|
import com.umeng.analytics.MobclickAgent
|
||||||
@@ -43,7 +42,7 @@ class ListenActivity : AppCompatActivity() {
|
|||||||
initView()
|
initView()
|
||||||
initAccessibility()
|
initAccessibility()
|
||||||
initOverlays()
|
initOverlays()
|
||||||
UpdateUtil.checkUpdate()
|
HttpUtil.checkUpdate()
|
||||||
PermissionUtils.permission("android.permission.READ_EXTERNAL_STORAGE").request()
|
PermissionUtils.permission("android.permission.READ_EXTERNAL_STORAGE").request()
|
||||||
registerReceiver(openWsReceiver, IntentFilter(Constant.WEWORK_NOTIFY))
|
registerReceiver(openWsReceiver, IntentFilter(Constant.WEWORK_NOTIFY))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class SettingsActivity : AppCompatActivity() {
|
|||||||
setContentView(R.layout.activity_settings)
|
setContentView(R.layout.activity_settings)
|
||||||
|
|
||||||
initView()
|
initView()
|
||||||
|
initData()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@@ -101,6 +102,10 @@ class SettingsActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun initData() {
|
||||||
|
HttpUtil.getMyConfig()
|
||||||
|
}
|
||||||
|
|
||||||
private fun showReplyStrategyDialog() {
|
private fun showReplyStrategyDialog() {
|
||||||
val strategyArray = arrayOf("只读消息不回调", "仅私聊和群聊@机器人回调", "私聊群聊全部回调")
|
val strategyArray = arrayOf("只读消息不回调", "仅私聊和群聊@机器人回调", "私聊群聊全部回调")
|
||||||
QMUIDialog.CheckableDialogBuilder(this)
|
QMUIDialog.CheckableDialogBuilder(this)
|
||||||
|
|||||||
18
app/src/main/java/org/yameida/worktool/model/MyConfigBean.kt
Normal file
18
app/src/main/java/org/yameida/worktool/model/MyConfigBean.kt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package org.yameida.worktool.model
|
||||||
|
|
||||||
|
data class MyConfigBean(
|
||||||
|
//QA类型 0未配置 1第三方QA 2微信对话平台
|
||||||
|
var openCallback: Int? = null,
|
||||||
|
|
||||||
|
//第三方QA回调地址
|
||||||
|
var callbackUrl: String? = null,
|
||||||
|
|
||||||
|
//回复策略 -1只读消息不回调 0仅私聊和群聊@机器人回调 1私聊群聊全部回调
|
||||||
|
var replyAll: Int? = null,
|
||||||
|
|
||||||
|
//key校验 0未开启 1开启
|
||||||
|
var robotKeyCheck: Int? = null,
|
||||||
|
|
||||||
|
//通讯加密 0不加密 1加密
|
||||||
|
var encryptType: Int? = null
|
||||||
|
)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.yameida.worktool.model.network;
|
||||||
|
|
||||||
|
import org.yameida.worktool.model.MyConfigBean;
|
||||||
|
|
||||||
|
public class GetMyConfigResult {
|
||||||
|
|
||||||
|
public Integer code;
|
||||||
|
public String message;
|
||||||
|
public MyConfigBean data;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -139,6 +139,7 @@ object WeworkOperationImpl {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 在房间内转发消息
|
* 在房间内转发消息
|
||||||
|
* @see WeworkMessageBean.RELAY_MESSAGE
|
||||||
* @param titleList 房间名称
|
* @param titleList 房间名称
|
||||||
* @param receivedName 原始消息的发送者姓名
|
* @param receivedName 原始消息的发送者姓名
|
||||||
* @param originalContent 原始消息的内容
|
* @param originalContent 原始消息的内容
|
||||||
@@ -169,7 +170,6 @@ object WeworkOperationImpl {
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
LogUtils.d("开始转发")
|
LogUtils.d("开始转发")
|
||||||
sleep(1000)
|
|
||||||
if (relaySelectTarget(nameList, extraText)) {
|
if (relaySelectTarget(nameList, extraText)) {
|
||||||
LogUtils.d("$title: 转发成功")
|
LogUtils.d("$title: 转发成功")
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ import model.UpdateConfig
|
|||||||
import org.yameida.worktool.Constant
|
import org.yameida.worktool.Constant
|
||||||
import org.yameida.worktool.R
|
import org.yameida.worktool.R
|
||||||
import org.yameida.worktool.model.network.CheckUpdateResult
|
import org.yameida.worktool.model.network.CheckUpdateResult
|
||||||
|
import org.yameida.worktool.model.network.GetMyConfigResult
|
||||||
import update.UpdateAppUtils
|
import update.UpdateAppUtils
|
||||||
|
|
||||||
object UpdateUtil {
|
object HttpUtil {
|
||||||
|
|
||||||
fun checkUpdate() {
|
fun checkUpdate() {
|
||||||
OkGo.get<String>(Constant.getCheckUpdateUrl())
|
OkGo.get<String>(Constant.getCheckUpdateUrl())
|
||||||
@@ -61,4 +62,41 @@ object UpdateUtil {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getMyConfig() {
|
||||||
|
if (Constant.robotId.isBlank()) {
|
||||||
|
ToastUtils.showLong("请先填写机器人ID")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
OkGo.get<String>(Constant.getMyConfig())
|
||||||
|
.execute(object : StringCallback() {
|
||||||
|
override fun onSuccess(response: Response<String>) {
|
||||||
|
try {
|
||||||
|
val commonResult =
|
||||||
|
GsonUtils.fromJson(
|
||||||
|
response.body(),
|
||||||
|
GetMyConfigResult::class.java
|
||||||
|
)
|
||||||
|
if (commonResult.code != 200) {
|
||||||
|
return onError(response)
|
||||||
|
}
|
||||||
|
LogUtils.i(commonResult.data)
|
||||||
|
commonResult.data?.apply {
|
||||||
|
Constant.qaUrl = this.callbackUrl ?: ""
|
||||||
|
Constant.openCallback = this.openCallback ?: 0
|
||||||
|
Constant.replyStrategy = (this.replyAll ?: 0) + 1
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
LogUtils.e(e)
|
||||||
|
onError(response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(response: Response<String>) {
|
||||||
|
ToastUtils.showLong("获取配置失败 请检查机器人ID")
|
||||||
|
LogUtils.e("获取配置失败 请检查机器人ID")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@
|
|||||||
android:id="@+id/et_channel"
|
android:id="@+id/et_channel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="请输入申请的链接号"
|
android:hint="请输入申请的机器人ID"
|
||||||
android:textColor="@color/color_999999"
|
android:textColor="@color/color_999999"
|
||||||
android:textSize="@dimen/setting_end_font_size" />
|
android:textSize="@dimen/setting_end_font_size" />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user