Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
2ac9369d
Commit
2ac9369d
authored
Mar 02, 2022
by
liusheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理vip过期
parent
f1e1acbe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
7 deletions
+26
-7
app/src/main/java/com/ccwangluo/accelerator/ui/home/AccelertorFragment.kt
...a/com/ccwangluo/accelerator/ui/home/AccelertorFragment.kt
+4
-1
app/src/main/java/com/ccwangluo/accelerator/utils/AcceleratorUtils.kt
.../java/com/ccwangluo/accelerator/utils/AcceleratorUtils.kt
+11
-1
core/src/main/java/com/github/shadowsocks/bg/AuthManager.kt
core/src/main/java/com/github/shadowsocks/bg/AuthManager.kt
+9
-4
core/src/main/java/com/github/shadowsocks/http/LineConfig.kt
core/src/main/java/com/github/shadowsocks/http/LineConfig.kt
+2
-1
No files found.
app/src/main/java/com/ccwangluo/accelerator/ui/home/AccelertorFragment.kt
View file @
2ac9369d
...
...
@@ -241,7 +241,10 @@ class AccelertorFragment : XPageFragment() {
binding
.
btnQuick
.
isEnabled
=
false
startAnim
()
}
else
{
MemberDialog
(
this
@AccelertorFragment
).
show
<
MemberDialog
>()
//MemberDialog(this@AccelertorFragment).show<MemberDialog>()
//TODO 测试
binding
.
btnQuick
.
isEnabled
=
false
startAnim
()
}
}
}
else
{
...
...
app/src/main/java/com/ccwangluo/accelerator/utils/AcceleratorUtils.kt
View file @
2ac9369d
...
...
@@ -57,6 +57,10 @@ object AcceleratorUtils {
}
var
vipExpireListener
:
()
->
Unit
=
{
->
}
fun
getGameList
(
xPageFragment
:
XPageFragment
,
callback
:
(
Boolean
)
->
Unit
)
{
game
?.
let
{
callback
(
true
)
...
...
@@ -191,6 +195,8 @@ object AcceleratorUtils {
}
}
fun
stopAccelerator
()
{
Core
.
stopService
()
}
...
...
@@ -200,7 +206,11 @@ object AcceleratorUtils {
AcceleratorUtils
.
state
=
state
stateListener
(
state
,
getAccTime
(),
null
)
if
(
state
==
BaseService
.
State
.
Stopped
&&
!
msg
.
isNullOrBlank
())
{
ToastUtils
.
show
(
msg
)
if
(
"vip到期"
.
equals
(
msg
)){
}
else
{
ToastUtils
.
show
(
msg
)
}
}
}
...
...
core/src/main/java/com/github/shadowsocks/bg/AuthManager.kt
View file @
2ac9369d
package
com.github.shadowsocks.bg
import
android.os.Build
import
android.util.Log
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.database.ProfileManager
...
...
@@ -89,16 +90,18 @@ object AuthManager {
suspend
fun
initAuthProfile
(
profile
:
Profile
)
{
withContext
(
Dispatchers
.
IO
)
{
getLineConfig
()
?.
let
{
if
(
it
.
code
!=
200
)
{
return
@withContext
}
else
if
(
it
.
code
==
1001
){
//vip过期
if
(
it
.
code
==
1001
){
//vip过期
throw
AuthException
(
it
.
error
)
}
else
if
(
it
.
code
!=
200
)
{
throw
AuthException
(
it
.
error
)
}
profile
.
host
=
it
.
data
.
host
profile
.
token
=
it
.
data
.
token
profile
.
remotePort
=
it
.
data
.
port
Timber
.
d
(
"start vpn with games: ${profile.individual}, profileId: ${profile.id}, route: ${profile.route}"
)
ProfileManager
.
updateProfile
(
profile
)
}
?:
let
{
throw
AuthException
(
"未知错误"
)
}
}
}
...
...
@@ -166,6 +169,8 @@ object AuthManager {
val
response
:
Response
=
call
.
execute
()
if
(
response
.
isSuccessful
)
{
val
string
=
response
.
body
?.
string
()
Log
.
e
(
"postSync"
,
"=====url:"
+
HttpConfig
.
baseUrl
+
url
)
Log
.
e
(
"postSync"
,
"=====result:"
+
string
)
println
(
string
)
val
type
=
object
:
TypeToken
<
T
>()
{}.
type
return
gson
.
fromJson
(
string
,
type
)
...
...
core/src/main/java/com/github/shadowsocks/http/LineConfig.kt
View file @
2ac9369d
...
...
@@ -2,7 +2,8 @@ package com.github.shadowsocks.http
data class
LineConfig
(
val
code
:
Int
,
val
`data`
:
Data
val
`data`
:
Data
,
val
error
:
String
)
data class
Data
(
...
...
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