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