update 文案和日志调整;微盘图片重试;图片压缩率调整
This commit is contained in:
@@ -203,7 +203,8 @@ class SettingsAdvanceActivity : AppCompatActivity() {
|
||||
val text = builder.editText.text
|
||||
if (text != null) {
|
||||
dialog.dismiss()
|
||||
Constant.weworkMP = text.toString().trim()
|
||||
val username = text.toString().trim()
|
||||
Constant.weworkMP = if (username.endsWith("@app")) username else "$username@app"
|
||||
} else {
|
||||
ToastUtils.showLong("请勿为空!")
|
||||
}
|
||||
|
||||
@@ -399,8 +399,10 @@ object WeworkOperationImpl {
|
||||
message: WeworkMessageBean,
|
||||
titleList: List<String>,
|
||||
objectName: String,
|
||||
extraText: String? = null
|
||||
extraText: String? = null,
|
||||
maxRetryCount: Int? = null
|
||||
): Boolean {
|
||||
val retryCount = maxRetryCount ?: 2
|
||||
val startTime = System.currentTimeMillis()
|
||||
goHomeTab("工作台")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "微盘", exact = true)
|
||||
@@ -443,21 +445,33 @@ object WeworkOperationImpl {
|
||||
return true
|
||||
} else {
|
||||
LogUtils.e("微盘文件转发失败: $objectName")
|
||||
if (retryCount > 0) {
|
||||
return pushMicroDiskImage(message, titleList, objectName, extraText, retryCount - 1)
|
||||
}
|
||||
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "微盘文件转发失败: $objectName", startTime, listOf(), titleList)
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
LogUtils.e("微盘未搜索到相关图片: $objectName")
|
||||
if (retryCount > 0) {
|
||||
return pushMicroDiskImage(message, titleList, objectName, extraText, retryCount - 1)
|
||||
}
|
||||
uploadCommandResult(message, ExecCallbackBean.ERROR_TARGET, "微盘未搜索到相关图片: $objectName", startTime, listOf(), titleList)
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
LogUtils.e("未找到微盘内搜索")
|
||||
if (retryCount > 0) {
|
||||
return pushMicroDiskImage(message, titleList, objectName, extraText, retryCount - 1)
|
||||
}
|
||||
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到微盘内搜索", startTime, listOf(), titleList)
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
LogUtils.e("未找到微盘")
|
||||
if (retryCount > 0) {
|
||||
return pushMicroDiskImage(message, titleList, objectName, extraText, retryCount - 1)
|
||||
}
|
||||
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到微盘", startTime, listOf(), titleList)
|
||||
return false
|
||||
}
|
||||
@@ -533,8 +547,7 @@ object WeworkOperationImpl {
|
||||
receivedContent: String,
|
||||
originalContent: String,
|
||||
fileUrl: String,
|
||||
extraText: String? = null,
|
||||
maxRetryCount: Int? = null
|
||||
extraText: String? = null
|
||||
): Boolean {
|
||||
val startTime = System.currentTimeMillis()
|
||||
if (IWWAPIUtil.sendMicroProgram(fileUrl, originalContent, objectName, receivedContent)) {
|
||||
@@ -630,7 +643,7 @@ object WeworkOperationImpl {
|
||||
extraText: String? = null,
|
||||
maxRetryCount: Int? = null
|
||||
): Boolean {
|
||||
val retryCount = maxRetryCount ?: 1
|
||||
val retryCount = maxRetryCount ?: 2
|
||||
val startTime = System.currentTimeMillis()
|
||||
if (!PermissionUtils.isGrantedDrawOverlays()) {
|
||||
LogUtils.e("未打开悬浮窗权限")
|
||||
@@ -781,8 +794,7 @@ object WeworkOperationImpl {
|
||||
receivedContent: String,
|
||||
originalContent: String,
|
||||
fileUrl: String,
|
||||
extraText: String? = null,
|
||||
maxRetryCount: Int? = null
|
||||
extraText: String? = null
|
||||
): Boolean {
|
||||
val startTime = System.currentTimeMillis()
|
||||
if (IWWAPIUtil.sendLink(fileUrl, originalContent, objectName, receivedContent)) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.tencent.wework.api.model.WWMediaLink
|
||||
import com.tencent.wework.api.model.WWMediaMiniProgram
|
||||
import org.yameida.worktool.Constant
|
||||
import org.yameida.worktool.R
|
||||
import org.yameida.worktool.service.log
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -52,9 +53,10 @@ object IWWAPIUtil {
|
||||
miniProgram.path = webpageUrl
|
||||
miniProgram.title = title
|
||||
|
||||
log("小程序: ${miniProgram.appId} ${miniProgram.username} ${miniProgram.title}")
|
||||
val bitmap = (Utils.getApp().getDrawable(R.mipmap.ic_launcher) as BitmapDrawable).bitmap
|
||||
val stream = ByteArrayOutputStream()
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 0, stream)
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 75, stream)
|
||||
miniProgram.hdImageData = stream.toByteArray()
|
||||
if (imageUrl != null) {
|
||||
LogUtils.i("下载开始 $imageUrl")
|
||||
@@ -73,7 +75,7 @@ object IWWAPIUtil {
|
||||
LogUtils.i("文件存储本地成功 $filePath")
|
||||
val bitmap = ImageUtils.bytes2Bitmap(File(filePath).readBytes())
|
||||
val stream = ByteArrayOutputStream()
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 0, stream)
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 75, stream)
|
||||
miniProgram.hdImageData = stream.toByteArray()
|
||||
} else {
|
||||
LogUtils.e("文件存储本地失败 $filePath")
|
||||
|
||||
@@ -490,7 +490,7 @@
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="企微绑定的小程序UserName"
|
||||
android:text="应用绑的小程序原始Id(gh_xxx)"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="@dimen/setting_end_font_size" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user