Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bannedbook committed Aug 3, 2020
1 parent da8ce90 commit 1c71094
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ buildscript {
compileSdkVersion = 29
buildToolsVersion = '29.0.3'
desugarLibsVersion = '1.0.5'
versionCode = 443
versionName = '5.0.6.11R'
versionCode = 445
versionName = '5.0.6.12R'
resConfigs = ['ar', 'es', 'fa', 'fr', 'ja', 'ko', 'ru', 'tr', 'zh-rCN', 'zh-rTW']
}

Expand Down
6 changes: 4 additions & 2 deletions core/src/main/java/com/github/shadowsocks/database/Profile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ data class Profile(
@Query("SELECT * FROM `Profile` WHERE `host` = :host LIMIT 1")
fun getByHost(host: String): Profile?

@Query("SELECT * FROM `Profile` WHERE `host` = :host and `remotePort` = :port LIMIT 1")
fun getByHostAndPort(host: String,port:Int): Profile?

@Query("SELECT * FROM `Profile` WHERE `Subscription` != 2 ORDER BY `userOrder`")
fun listActive(): List<Profile>

Expand Down Expand Up @@ -382,8 +385,7 @@ data class Profile(
profile.method = method
}
}

fun isSameAs(other: Profile): Boolean = other.host == host
fun isSameAs(other: Profile): Boolean = other.host == host && other.remotePort == remotePort
fun updateWith(other: Profile){
if (!isSameAs(other))return
host = other.host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object ProfileManager {

@Throws(SQLException::class)
fun createProfile(profile: Profile = Profile()): Profile {
var existOne=PrivateDatabase.profileDao.getByHost(profile.host)
val existOne=PrivateDatabase.profileDao.getByHostAndPort(profile.host,profile.remotePort)
if (existOne==null) {
profile.id = 0
profile.userOrder = PrivateDatabase.profileDao.nextOrder() ?: 0
Expand All @@ -60,9 +60,9 @@ object ProfileManager {
}
else {
existOne.updateWith(profile)
return profile
updateProfile(existOne)
return existOne
}

}

fun deletSSRSubProfiles(profiles: List<Profile>) {
Expand Down
2 changes: 1 addition & 1 deletion gitupdate.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ git pull origin master
git add -A
git commit -m "update"
git push origin master
git tag -a v5.0.6.11 -m "release v5.0.6.11"
git tag -a v5.0.6.12 -m "release v5.0.6.12"
git push origin --tags
pause

0 comments on commit 1c71094

Please sign in to comment.