| File was renamed from app/src/main/java/com/shsening/autouploadvideos/ActionDouyin.kt |
| | |
| | | package com.shsening.autouploadvideos |
| | | package com.shsening.autouploadvideos.action |
| | | |
| | | |
| | | import android.app.Instrumentation |
| | | import android.content.Context |
| | | import android.os.SystemClock |
| | | import android.os.Handler |
| | | import com.shsening.autouploadvideos.UploadSessionActivity |
| | | import com.shsening.autouploadvideos.utils.Utils |
| | | import com.shsening.autouploadvideos.WebviewUtils |
| | | |
| | | class ActionDouyin (private var fragment:UploadFragment, private var context:Context, private var threadHandler: Handler, private var videoInfo:Utils.VideoUploadTaskInfo){ |
| | | class ActionDouyin (private var activity: UploadSessionActivity, private var threadHandler: Handler, private var videoInfo: Utils.VideoUploadTaskInfo) :PlatformActionInterface{ |
| | | |
| | | |
| | | private var webView = fragment.webView |
| | | private var webView = activity.sessionProfileWebView |
| | | |
| | | |
| | | var jsCode_CheckContentLoaded = """ |
| | |
| | | |
| | | |
| | | private fun updatePostDescription(){ |
| | | WebviewUtils.addValueToInput(webView,"#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-mention-wrapper-LWv5ed > div.editor-container-zRPSAi > div > div > div > div:nth-child(1) > div > div > input",videoInfo.title) |
| | | WebviewUtils.addValueToInput( |
| | | webView, |
| | | "#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-mention-wrapper-LWv5ed > div.editor-container-zRPSAi > div > div > div > div:nth-child(1) > div > div > input", |
| | | videoInfo.title |
| | | ) |
| | | |
| | | WebviewUtils.addValueToDiv(webView,"#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-mention-wrapper-LWv5ed > div.editor-container-zRPSAi > div > div > div > div.outerdocbody.editor-kit-outer-container > div",videoInfo.description) |
| | | WebviewUtils.addValueToDiv( |
| | | webView, |
| | | "#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-mention-wrapper-LWv5ed > div.editor-container-zRPSAi > div > div > div > div.outerdocbody.editor-kit-outer-container > div", |
| | | videoInfo.description |
| | | ) |
| | | |
| | | WebviewUtils.simpleElementClick(webView,"#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-mention-wrapper-LWv5ed > div:nth-child(3) > div > div.activity-list-container-AZzfdV > div:nth-child(1)") |
| | | WebviewUtils.simpleElementClick(webView,"#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-mention-wrapper-LWv5ed > div:nth-child(3) > div > div.activity-list-container-AZzfdV > div:nth-child(2)") |
| | | WebviewUtils.simpleElementClick( |
| | | webView, |
| | | "#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-mention-wrapper-LWv5ed > div:nth-child(3) > div > div.activity-list-container-AZzfdV > div:nth-child(1)" |
| | | ) |
| | | WebviewUtils.simpleElementClick( |
| | | webView, |
| | | "#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-mention-wrapper-LWv5ed > div:nth-child(3) > div > div.activity-list-container-AZzfdV > div:nth-child(2)" |
| | | ) |
| | | |
| | | WebviewUtils.simpleElementClick(webView,"#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.content-upload-new > div > div.recommendContainer-HXvL9W > div.recommendDisplay-ifUYki > div > div:nth-child(1) > div") |
| | | WebviewUtils.simpleElementClick(webView,"#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.download-content-Lci5tL > div > label:nth-child(2)") |
| | | WebviewUtils.simpleElementClick(webView,"#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-settings-WtW_ZW > div.schedule-part-V615Zn > div.row-suTOx_ > label:nth-child(2)") |
| | | WebviewUtils.simpleElementClick( |
| | | webView, |
| | | "#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.content-upload-new > div > div.recommendContainer-HXvL9W > div.recommendDisplay-ifUYki > div > div:nth-child(1) > div" |
| | | ) |
| | | WebviewUtils.simpleElementClick( |
| | | webView, |
| | | "#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.download-content-Lci5tL > div > label:nth-child(2)" |
| | | ) |
| | | WebviewUtils.simpleElementClick( |
| | | webView, |
| | | "#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-settings-WtW_ZW > div.schedule-part-V615Zn > div.row-suTOx_ > label:nth-child(2)" |
| | | ) |
| | | |
| | | addValueToDatePickerInput(true,"#root > div > div > div.content-body-v8tuJQ > div.form-kSES6A > div.publish-settings-WtW_ZW > div.schedule-part-V615Zn > div.row-suTOx_ > div.date-picker-ioPchj > div > div",videoInfo.datetime) |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | fun checkIfContentLoaded() { |
| | | override fun checkIfContentLoaded() { |
| | | webView.postDelayed({ |
| | | webView.evaluateJavascript(jsCode_CheckContentLoaded) { result -> |
| | | if (result == "true") { |
| | |
| | | } |
| | | |
| | | private fun startToPublishVideo(){ |
| | | WebviewUtils.simpleElementClick(webView,jsPath_PublishVideo) |
| | | WebviewUtils.simpleElementClick(webView, jsPath_PublishVideo) |
| | | |
| | | checkVideoPublishFinished() |
| | | } |
| | |
| | | if (result == "true") { |
| | | |
| | | // video published successfully!!! |
| | | fragment.startUploadSingleTask() |
| | | activity.checkAndStartNextTask() |
| | | |
| | | |
| | | } else { |
| | |
| | | |
| | | var dpPanelText = datetimes[0].toString()+"年 "+datetimes[1].toString()+"月"; |
| | | |
| | | var dateRowColum = Utils.getDatePosition(datetimes[0],datetimes[1],datetimes[2])?:return; |
| | | var dateRowColum = Utils.getDatePosition(datetimes[0], datetimes[1], datetimes[2]) ?:return; |
| | | |
| | | val jsCode = """ |
| | | try { |
| | |
| | | |
| | | private fun simulateSwipeAndUploadVideo() { |
| | | val instrumentation = Instrumentation() |
| | | val displayMetrics = context.resources.displayMetrics |
| | | val displayMetrics = activity.resources.displayMetrics |
| | | val width = displayMetrics.widthPixels |
| | | val height = displayMetrics.heightPixels |
| | | |