Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sobot_android
Sobot_module_Dev
Commits
6cc2e05f
Commit
6cc2e05f
authored
Mar 31, 2023
by
郑娜伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net 1.1.7
parent
ee1c7909
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
20 deletions
+30
-20
build.gradle
sobot_common/build.gradle
+2
-2
build.gradle
sobot_network/build.gradle
+2
-2
sobot-network-publish-mavencentral.gradle
sobot_network/sobot-network-publish-mavencentral.gradle
+1
-1
SobotUploadTask.java
...n/java/com/sobot/network/http/upload/SobotUploadTask.java
+25
-15
No files found.
sobot_common/build.gradle
View file @
6cc2e05f
...
@@ -21,12 +21,12 @@ dependencies {
...
@@ -21,12 +21,12 @@ dependencies {
api
'com.sobot.library:utils:1.1.1'
api
'com.sobot.library:utils:1.1.1'
api
'com.sobot.library:picture:1.1.4'
api
'com.sobot.library:picture:1.1.4'
api
'com.sobot.library:net:1.1.
5
'
api
'com.sobot.library:net:1.1.
7
'
api
'com.sobot.library:gson:1.1.1'
api
'com.sobot.library:gson:1.1.1'
// api 'com.sobot.library:utils:1.1.1'
// api 'com.sobot.library:utils:1.1.1'
// api 'com.sobot.library:picture_x:1.1.4'
// api 'com.sobot.library:picture_x:1.1.4'
// api 'com.sobot.library:net:1.1.
5
'
// api 'com.sobot.library:net:1.1.
7
'
// api 'com.sobot.library:gson:1.1.1'
// api 'com.sobot.library:gson:1.1.1'
}
}
...
...
sobot_network/build.gradle
View file @
6cc2e05f
...
@@ -11,7 +11,7 @@ android {
...
@@ -11,7 +11,7 @@ android {
//这里就是打jar包
//这里就是打jar包
task
makeJar
(
type:
Copy
)
{
task
makeJar
(
type:
Copy
)
{
//删除旧的jar包
//删除旧的jar包
delete
'build/libs/sobot_net_1.1.
6
.jar'
delete
'build/libs/sobot_net_1.1.
7
.jar'
//原地址
//原地址
from
(
'build/intermediates/packaged-classes/release/'
)
from
(
'build/intermediates/packaged-classes/release/'
)
//导出jar包的地址
//导出jar包的地址
...
@@ -19,7 +19,7 @@ android {
...
@@ -19,7 +19,7 @@ android {
//包含的jar包
//包含的jar包
include
(
'classes.jar'
)
include
(
'classes.jar'
)
//重命名jar包为mysdk
//重命名jar包为mysdk
rename
(
'classes.jar'
,
'sobot_net_1.1.
6
.jar'
)
rename
(
'classes.jar'
,
'sobot_net_1.1.
7
.jar'
)
}
}
makeJar
.
dependsOn
(
build
)
makeJar
.
dependsOn
(
build
)
}
}
...
...
sobot_network/sobot-network-publish-mavencentral.gradle
View file @
6cc2e05f
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'net'
//项目名
PUBLISH_ARTIFACT_ID
=
'net'
//项目名
PUBLISH_VERSION
=
'1.1.
6
'
//版本号
PUBLISH_VERSION
=
'1.1.
7
'
//版本号
}
}
...
...
sobot_network/src/main/java/com/sobot/network/http/upload/SobotUploadTask.java
View file @
6cc2e05f
...
@@ -20,7 +20,7 @@ import okhttp3.Call;
...
@@ -20,7 +20,7 @@ import okhttp3.Call;
import
okhttp3.Response
;
import
okhttp3.Response
;
/**
/**
*
上传任务类
* 上传任务类
*/
*/
public
class
SobotUploadTask
<
T
>
implements
Runnable
{
public
class
SobotUploadTask
<
T
>
implements
Runnable
{
private
static
final
String
TAG
=
"SobotUploadTask"
;
private
static
final
String
TAG
=
"SobotUploadTask"
;
...
@@ -101,7 +101,7 @@ public class SobotUploadTask<T> implements Runnable {
...
@@ -101,7 +101,7 @@ public class SobotUploadTask<T> implements Runnable {
// throw new IllegalStateException("you must call SobotUploadTask#save() before SobotUploadTask#start()!");
// throw new IllegalStateException("you must call SobotUploadTask#save() before SobotUploadTask#start()!");
// }
// }
if
(
SobotUpload
.
getInstance
().
getTask
(
progress
.
tag
)
==
null
)
{
if
(
SobotUpload
.
getInstance
().
getTask
(
progress
.
tag
)
==
null
)
{
Log
.
i
(
TAG
,
"you must call SobotUploadTask#save() before SobotUploadTask#start()!"
);
Log
.
i
(
TAG
,
"you must call SobotUploadTask#save() before SobotUploadTask#start()!"
);
}
}
if
(
progress
.
status
!=
SobotProgress
.
WAITING
&&
progress
.
status
!=
SobotProgress
.
LOADING
)
{
if
(
progress
.
status
!=
SobotProgress
.
WAITING
&&
progress
.
status
!=
SobotProgress
.
LOADING
)
{
postOnStart
(
progress
);
postOnStart
(
progress
);
...
@@ -109,7 +109,7 @@ public class SobotUploadTask<T> implements Runnable {
...
@@ -109,7 +109,7 @@ public class SobotUploadTask<T> implements Runnable {
priorityRunnable
=
new
PriorityRunnable
(
progress
.
priority
,
this
);
priorityRunnable
=
new
PriorityRunnable
(
progress
.
priority
,
this
);
executor
.
execute
(
priorityRunnable
);
executor
.
execute
(
priorityRunnable
);
}
else
{
}
else
{
Log
.
w
(
TAG
,
"the task with tag "
+
progress
.
tag
+
" is already in the upload queue, current task status is "
+
progress
.
status
);
Log
.
w
(
TAG
,
"the task with tag "
+
progress
.
tag
+
" is already in the upload queue, current task status is "
+
progress
.
status
);
}
}
return
this
;
return
this
;
}
}
...
@@ -124,7 +124,9 @@ public class SobotUploadTask<T> implements Runnable {
...
@@ -124,7 +124,9 @@ public class SobotUploadTask<T> implements Runnable {
start
();
start
();
}
}
/** 暂停的方法 */
/**
* 暂停的方法
*/
public
void
pause
()
{
public
void
pause
()
{
executor
.
remove
(
priorityRunnable
);
executor
.
remove
(
priorityRunnable
);
if
(
progress
.
status
==
SobotProgress
.
WAITING
)
{
if
(
progress
.
status
==
SobotProgress
.
WAITING
)
{
...
@@ -133,11 +135,13 @@ public class SobotUploadTask<T> implements Runnable {
...
@@ -133,11 +135,13 @@ public class SobotUploadTask<T> implements Runnable {
progress
.
speed
=
0
;
progress
.
speed
=
0
;
progress
.
status
=
SobotProgress
.
PAUSE
;
progress
.
status
=
SobotProgress
.
PAUSE
;
}
else
{
}
else
{
Log
.
w
(
TAG
,
"only the task with status WAITING(1) or LOADING(2) can pause, current status is "
+
progress
.
status
);
Log
.
w
(
TAG
,
"only the task with status WAITING(1) or LOADING(2) can pause, current status is "
+
progress
.
status
);
}
}
}
}
/** 删除一个任务,会删除下载文件 */
/**
* 删除一个任务,会删除下载文件
*/
public
SobotUploadTask
<
T
>
remove
()
{
public
SobotUploadTask
<
T
>
remove
()
{
pause
();
pause
();
// UploadManager.getInstance().delete(progress.tag);
// UploadManager.getInstance().delete(progress.tag);
...
@@ -178,16 +182,22 @@ public class SobotUploadTask<T> implements Runnable {
...
@@ -178,16 +182,22 @@ public class SobotUploadTask<T> implements Runnable {
String
resultStr
=
null
;
String
resultStr
=
null
;
try
{
try
{
resultStr
=
response
.
body
().
string
();
resultStr
=
response
.
body
().
string
();
SobotNetLogUtils
.
i
(
"uploadFile----->:"
+
resultStr
);
SobotNetLogUtils
.
i
(
"uploadFile----->:"
+
resultStr
);
final
SobotUploadModel
result
=
SobotCommonGsonUtil
.
jsonToCommonModel
(
resultStr
);
final
SobotUploadModel
result
=
SobotCommonGsonUtil
.
jsonToCommonModel
(
resultStr
);
if
(
result
!=
null
&&
"1"
.
equals
(
result
.
getCode
())
&&
result
.
getData
()
!=
null
)
{
if
(
result
!=
null
)
{
SobotUploadModelBase
data
=
result
.
getData
();
if
(
"1"
.
equals
(
result
.
getCode
()))
{
UploadFileResult
tmpData
=
SobotCommonGsonUtil
.
obtainUploadFileResult
(
data
.
getMsg
());
if
(
result
.
getData
()
!=
null
)
{
if
(
tmpData
!=
null
&&
!
TextUtils
.
isEmpty
(
tmpData
.
getMsgId
()))
{
SobotUploadModelBase
data
=
result
.
getData
();
// 解析msgid
UploadFileResult
tmpData
=
SobotCommonGsonUtil
.
obtainUploadFileResult
(
data
.
getMsg
());
progress
.
tag
=
tmpData
.
getMsgId
();
if
(
tmpData
!=
null
&&
!
TextUtils
.
isEmpty
(
tmpData
.
getMsgId
()))
{
progress
.
url
=
tmpData
.
getUrl
();
// 解析msgid
postOnFinish
(
progress
,
data
);
progress
.
tag
=
tmpData
.
getMsgId
();
progress
.
url
=
tmpData
.
getUrl
();
postOnFinish
(
progress
,
data
);
}
else
{
postOnError
(
progress
,
new
RuntimeException
(
result
.
getMsg
()));
}
}
}
else
{
}
else
{
postOnError
(
progress
,
new
RuntimeException
(
result
.
getMsg
()));
postOnError
(
progress
,
new
RuntimeException
(
result
.
getMsg
()));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment