Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bannedbook committed Jun 14, 2020
1 parent b031d38 commit 210d01c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ buildscript {
junitVersion = '4.13'
androidTestVersion = '1.2.0'
androidEspressoVersion = '3.2.0'
versionCode = 5000898
versionName = '5.1.13-nightly'
versionCode = 5000908
versionName = '5.1.14-nightly'
resConfigs = ['ar', 'es', 'fa', 'fr', 'ja', 'ko', 'ru', 'tr', 'zh-rCN', 'zh-rTW']
}

Expand Down
13 changes: 6 additions & 7 deletions core/src/main/java/com/github/shadowsocks/bg/ProxyTestService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,19 @@ import android.app.Service
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.util.Log
import androidx.core.os.bundleOf
import com.github.shadowsocks.BootReceiver
import com.github.shadowsocks.Core
import com.github.shadowsocks.acl.Acl
import com.github.shadowsocks.bg.BaseService.Interface
import com.github.shadowsocks.core.R
import com.github.shadowsocks.net.HostsFile
import com.github.shadowsocks.preference.DataStore
import com.github.shadowsocks.utils.Action
import com.github.shadowsocks.utils.Key
import com.github.shadowsocks.utils.printLog
import com.github.shadowsocks.utils.readableMessage
import com.google.firebase.analytics.FirebaseAnalytics
import kotlinx.coroutines.*
import org.bannedbook.app.service.NativeCall
import com.github.shadowsocks.bg.BaseService.Interface
import java.io.*
import java.io.IOException
import java.net.UnknownHostException

/**
Expand Down Expand Up @@ -113,5 +109,8 @@ class ProxyTestService : ProxyService(), Interface {
}
return Service.START_NOT_STICKY
}

override fun startRunner() {
this as Context
startService(Intent(this, javaClass))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ object ProfileManager {
profile.id=existOne.id
profile.tx=existOne.tx
profile.rx=existOne.rx
profile.elapsed=existOne.elapsed
updateProfile(profile)
}
return profile
Expand Down Expand Up @@ -208,9 +209,11 @@ object ProfileManager {
@Throws(IOException::class)
fun getProfile(id: Long): Profile? = try {
PrivateDatabase.profileDao[id]
} catch (ex: SQLiteCantOpenDatabaseException) {
throw IOException(ex)
} catch (ex: SQLException) {
}
// catch (ex: SQLiteCantOpenDatabaseException) {
// throw IOException(ex)
// }
catch (ex: SQLException) {
printLog(ex)
null
}
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.1.13 -m "release v5.1.13"
git tag -a v5.1.14 -m "release v5.1.14"
git push origin --tags
pause
19 changes: 11 additions & 8 deletions mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
var viewHolder = profilesList.findViewHolderForAdapterPosition(i)
if(viewHolder==null)continue
viewHolder = viewHolder as ProfileViewHolder
if (viewHolder.item.isBuiltin() || viewHolder.item.isBuiltin2()) {
if ( (viewHolder.item.isBuiltin() || viewHolder.item.isBuiltin2()) && viewHolder.item.id<3) {
viewHolder.populateUnifiedNativeAdView(nativeAd!!, nativeAdView!!)
// might be in the middle of a layout after scrolling, need to wait
withContext(Dispatchers.Main) { profilesAdapter.notifyItemChanged(i) }
Expand Down Expand Up @@ -272,7 +272,8 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
}

fun attach() {
if (adHost != null /*|| !item.isBuiltin()*/) return
if (adHost != null) return
if (!item.isBuiltin() && !item.isBuiltin2()) return
if (nativeAdView == null) {
nativeAdView = layoutInflater.inflate(R.layout.ad_unified, adContainer, false) as UnifiedNativeAdView
AdLoader.Builder(context, getString(R.string.native_adUnitId)).apply {
Expand Down Expand Up @@ -642,11 +643,9 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
element.elapsed = 0
}
profilesAdapter.notifyDataSetChanged()

for (k in 0 until profilesAdapter.profiles.size) {
try {
Log.e("tcping", "$k")
GlobalScope.launch {
GlobalScope.launch {
try {
profilesAdapter.profiles[k].elapsed = Core.tcping(profilesAdapter.profiles[k].host, profilesAdapter.profiles[k].remotePort)
ProfileManager.updateProfile(profilesAdapter.profiles[k])
Log.e("tcping", "$k - " + profilesAdapter.profiles[k].elapsed)
Expand All @@ -655,8 +654,8 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
profilesAdapter.refreshId(profilesAdapter.profiles[k].id)
}
}
catch(e:IndexOutOfBoundsException){}
}
catch(e:IndexOutOfBoundsException){}
}
true
}
Expand Down Expand Up @@ -734,7 +733,11 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
while (Core.tcping("127.0.0.1", DataStore.portProxy) < 0 || Core.tcping("127.0.0.1", VpnEncrypt.HTTP_PROXY_PORT) < 0) {
Log.e("starting", "$k try $ttt ...")
if (ttt == 5) {
activity?.runOnUiThread() {Core.alertMessage(activity.getString(R.string.toast_test_interrupted,profilesAdapter.profiles[k].name),activity)}
try {
activity?.runOnUiThread{Core.alertMessage(activity.getString(R.string.toast_test_interrupted,profilesAdapter.profiles[k].name),activity)}
}catch (e:Exception){
activity?.runOnUiThread{Core.alertMessage("Server:"+profilesAdapter.profiles[k].name+" or previous one caused the test to be interrupted, please check/remove them.",activity)}
}
Log.e("realTestProfiles","Server: "+profilesAdapter.profiles[k].name+" or the one before it caused the test to be interrupted.")
Core.stopService()
return@launch
Expand Down

0 comments on commit 210d01c

Please sign in to comment.