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
20e4023c
Commit
20e4023c
authored
Jan 12, 2020
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up
parent
4126b313
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
core/src/main/java/com/github/shadowsocks/database/ProfileManager.kt
...in/java/com/github/shadowsocks/database/ProfileManager.kt
+1
-0
core/src/main/java/com/github/shadowsocks/subscription/SubscriptionService.kt
...om/github/shadowsocks/subscription/SubscriptionService.kt
+7
-1
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
.../src/main/java/com/github/shadowsocks/ProfilesFragment.kt
+6
-0
No files found.
core/src/main/java/com/github/shadowsocks/database/ProfileManager.kt
View file @
20e4023c
...
...
@@ -42,6 +42,7 @@ object ProfileManager {
fun
onAdd
(
profile
:
Profile
)
fun
onRemove
(
profileId
:
Long
)
fun
onCleared
()
fun
reloadProfiles
()
}
var
listener
:
Listener
?
=
null
...
...
core/src/main/java/com/github/shadowsocks/subscription/SubscriptionService.kt
View file @
20e4023c
...
...
@@ -25,6 +25,7 @@ import android.app.NotificationManager
import
android.app.Service
import
android.content.Intent
import
android.os.IBinder
import
android.util.Log
import
android.widget.Toast
import
androidx.annotation.RequiresApi
import
androidx.core.app.NotificationCompat
...
...
@@ -154,7 +155,11 @@ class SubscriptionService : Service() {
Profile
.
parseJson
(
JsonStreamParser
(
json
.
bufferedReader
()).
asSequence
().
single
(),
feature
)
{
subscriptions
.
computeCompat
(
it
.
name
to
it
.
formattedAddress
)
{
_
,
oldProfile
->
when
(
oldProfile
?.
subscription
)
{
Profile
.
SubscriptionStatus
.
Active
->
oldProfile
// skip dup subscription
Profile
.
SubscriptionStatus
.
Active
->
{
Log
.
w
(
"SubscriptionService"
,
"Duplicate profiles detected. Please use different profile "
+
"names and/or address:port for better subscription support."
)
oldProfile
}
Profile
.
SubscriptionStatus
.
Obsolete
->
{
oldProfile
.
password
=
it
.
password
oldProfile
.
method
=
it
.
method
...
...
@@ -175,6 +180,7 @@ class SubscriptionService : Service() {
}
profiles
?.
forEach
{
profile
->
if
(
toUpdate
.
contains
(
profile
.
id
))
ProfileManager
.
updateProfile
(
profile
)
}
ProfileManager
.
listener
?.
reloadProfiles
()
}
override
fun
onDestroy
()
{
...
...
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
View file @
20e4023c
...
...
@@ -431,6 +431,12 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
profiles
.
clear
()
notifyDataSetChanged
()
}
override
fun
reloadProfiles
()
{
profiles
.
clear
()
ProfileManager
.
getActiveProfiles
()
?.
let
{
profiles
.
addAll
(
it
)
}
notifyDataSetChanged
()
}
}
private
var
selectedItem
:
ProfileViewHolder
?
=
null
...
...
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