Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1736226e
authored
Mar 05, 2020
by
pye52
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into test
parents
a31bb7f8
e5889123
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
21 deletions
+32
-21
app/build.gradle
+11
-7
app/src/main/java/com/bgycc/smartcanteen/App.kt
+12
-5
app/src/main/java/com/bgycc/smartcanteen/action/LogAction.kt
+3
-3
build.gradle
+5
-5
gradle/wrapper/gradle-wrapper.properties
+1
-1
No files found.
app/build.gradle
View file @
1736226e
...
...
@@ -58,6 +58,10 @@ android {
}
}
}
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
}
dependencies
{
...
...
@@ -68,13 +72,13 @@ dependencies {
implementation
"org.java-websocket:Java-WebSocket:1.4.0"
implementation
'org.greenrobot:eventbus:3.1.1'
implementation
'com.github.salomonbrys.kotson:kotson:2.5.0'
implementation
'com.blankj:utilcode:1.2
5.9
'
implementation
'com.squareup.okhttp3:okhttp:3.12.1'
implementation
'com.squareup.okhttp3:logging-interceptor:3.1
0.
0'
implementation
'com.squareup.retrofit2:retrofit:2.
6.2
'
implementation
'com.squareup.retrofit2:converter-gson:2.
6.0
'
implementation
'com.squareup.retrofit2:converter-scalars:2.
6.0
'
testImplementation
'junit:junit:4.1
2
'
implementation
'com.blankj:utilcode:1.2
6.0
'
implementation
'com.squareup.okhttp3:okhttp:3.12.1
0
'
implementation
'com.squareup.okhttp3:logging-interceptor:3.1
2.1
0'
implementation
'com.squareup.retrofit2:retrofit:2.
7.1
'
implementation
'com.squareup.retrofit2:converter-gson:2.
7.1
'
implementation
'com.squareup.retrofit2:converter-scalars:2.
7.1
'
testImplementation
'junit:junit:4.1
3
'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
}
app/src/main/java/com/bgycc/smartcanteen/App.kt
View file @
1736226e
package
com.bgycc.smartcanteen
import
android.Manifest
import
android.app.ActivityManager
import
android.app.Application
import
android.content.Context
...
...
@@ -10,18 +9,20 @@ import com.bgycc.smartcanteen.helper.TTSHelper
import
com.bgycc.smartcanteen.helper.TimerHelper
import
com.bgycc.smartcanteen.helper.WifiHelpler
import
com.bgycc.smartcanteen.manager.NetworkManager
import
com.bgycc.smartcanteen.util.LogUtil
import
com.bgycc.smartcanteen.module.Device
import
com.bgycc.smartcanteen.util.LogUtil
import
com.blankj.utilcode.constant.PermissionConstants
import
com.blankj.utilcode.util.CrashUtils
import
com.blankj.utilcode.util.LogUtils
import
com.blankj.utilcode.util.PermissionUtils
import
java.
lang.Exception
import
java.
io.File
import
kotlin.system.exitProcess
class
App
:
Application
()
{
companion
object
{
private
lateinit
var
sDefault
:
App
private
const
val
LOG_DIR
=
"log"
private
val
sInstances
=
HashMap
<
String
,
App
>()
private
var
sVersionName
=
"0.0.0"
private
var
sVersionCode
=
0
...
...
@@ -96,7 +97,12 @@ class App : Application() {
private
fun
initLog
()
{
LogUtil
.
setEnable
(
BuildConfig
.
DEBUG
)
val
config
=
LogUtils
.
getConfig
()
config
.
saveDays
=
7
val
logDir
:
String
=
applicationContext
.
filesDir
.
absolutePath
+
File
.
separator
+
LOG_DIR
CrashUtils
.
init
(
logDir
)
LogUtils
.
getConfig
()
.
setDir
(
logDir
)
.
setLog2FileSwitch
(
true
)
.
setBorderSwitch
(
false
)
.
saveDays
=
7
}
}
\ No newline at end of file
app/src/main/java/com/bgycc/smartcanteen/action/LogAction.kt
View file @
1736226e
...
...
@@ -46,7 +46,7 @@ object LogAction : Action(ActionEnum.LOG_PULL.name) {
val
logZipFile
=
File
(
PathUtils
.
getExternalAppCachePath
(),
"upload/log.zip"
)
val
logUploadDir
=
File
(
PathUtils
.
getExternalAppCachePath
(),
"upload/log"
)
FileUtils
.
delete
(
logZipFile
)
FileUtils
.
delete
Dir
(
logUploadDir
)
FileUtils
.
delete
(
logUploadDir
)
logUploadDir
.
mkdirs
()
val
logDir
=
when
(
type
)
{
...
...
@@ -56,11 +56,11 @@ object LogAction : Action(ActionEnum.LOG_PULL.name) {
FileUtils
.
listFilesInDir
(
logDir
)
?.
forEach
{
val
date
=
Date
(
it
.
lastModified
())
if
(
date
>=
startTime
&&
date
<=
endTime
)
{
FileUtils
.
copy
File
(
it
,
File
(
logUploadDir
,
it
.
name
))
FileUtils
.
copy
(
it
,
File
(
logUploadDir
,
it
.
name
))
}
}
ZipUtils
.
zipFile
(
logUploadDir
,
logZipFile
)
FileUtils
.
delete
Dir
(
logUploadDir
)
FileUtils
.
delete
(
logUploadDir
)
MainHttpClient
.
uploadLog
(
logZipFile
,
"$type${formatSrc.format(startTime)}${formatSrc.format(endTime)}${App.getDeviceSN()}.zip"
)
}
catch
(
e
:
Exception
)
{}
state
=
State
.
INITED
...
...
build.gradle
View file @
1736226e
...
...
@@ -3,11 +3,11 @@
buildscript
{
ext
.
kotlin_version
=
'1.3.61'
repositories
{
maven
{
url
'https://maven.aliyun.com/repository/google'
}
maven
{
url
'https://maven.aliyun.com/repository/jcenter'
}
jcenter
()
google
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:3.
4.2
'
classpath
'com.android.tools.build:gradle:3.
6.1
'
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath
"org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
...
...
@@ -17,8 +17,8 @@ buildscript {
allprojects
{
repositories
{
maven
{
url
'https://maven.aliyun.com/repository/google'
}
maven
{
url
'https://maven.aliyun.com/repository/jcenter'
}
jcenter
()
google
()
}
}
...
...
gradle/wrapper/gradle-wrapper.properties
View file @
1736226e
...
...
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-5.
1.1
-all.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-5.
6.4
-all.zip
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