Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Enaium committed Oct 2, 2021
1 parent f266023 commit 50ae6ac
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 26 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "1.7"
versionName "1.7.1"

multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
14 changes: 2 additions & 12 deletions app/src/main/java/cn/enaium/banl/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,14 @@ class MainActivity : AppCompatActivity() {
return httpRequest.end("time/heartbeat")
|| httpRequest.end("api/client/session.renewal")
|| httpRequest.end("api/client/notice.list")
|| httpRequest.end("api/client/user.info")
|| httpRequest.has("user.token.oauth.login")//新版登录信息
}

override fun handleRequest(
httpRequest: FullHttpRequest,
pipeline: HttpProxyInterceptPipeline
) {

httpRequest.clear()

if (httpRequest.end("time/heartbeat")) {
Expand All @@ -237,8 +238,6 @@ class MainActivity : AppCompatActivity() {
pipeline: HttpProxyInterceptPipeline
): Boolean {
return httpRequest.end("api/client/can_pay")
|| httpRequest.end("api/client/user.info")
|| httpRequest.has("api/external/user.token.oauth.login")//新版登录信息
}

override fun handleResponse(
Expand All @@ -250,11 +249,6 @@ class MainActivity : AppCompatActivity() {
httpResponse.setContent("""{code":0,"message":"ok","is_adult":1,"server_message":""}""")
log("充值不限制成功")
}

if (httpRequest.end("api/client/user.info")
|| httpRequest.has("api/external/user.token.oauth.login")) {
httpResponse.setContent("""{"realname_verified":1,"code":0,"uname":"${config.getUname()}"}""")
}
}
})
}
Expand Down Expand Up @@ -362,10 +356,6 @@ class MainActivity : AppCompatActivity() {
return getInt("port", 25560)
}

private fun SharedPreferences.getUname(): String {
return getString("uname", "不限制登录成功")!!
}

private fun SharedPreferences.isOpenCheckUpdate(): Boolean {
return getBoolean("openCheckUpdate", true)
}
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/cn/enaium/banl/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ class SettingsActivity : AppCompatActivity() {
val config = getSharedPreferences("config", MODE_PRIVATE)
val configEdit = config.edit()

val unameEditText = findViewById<EditText>(R.id.uname)
val hostEditText = findViewById<EditText>(R.id.host)
val portHostEditText = findViewById<EditText>(R.id.port)

hostEditText.setText(config.getString("host", "127.0.0.1"))
portHostEditText.setText(config.getInt("port", 25560).toString())
unameEditText.setText(config.getString("uname", "不限制登录成功"))

val outError = findViewById<CheckBox>(R.id.outError)
outError.isChecked = config.getBoolean("outError", false)
Expand Down Expand Up @@ -62,7 +60,6 @@ class SettingsActivity : AppCompatActivity() {
return@setOnClickListener
}

configEdit.putString("uname", unameEditText.text.toString())
configEdit.putString("host", host)
configEdit.putInt("port", port)//先检测是否为short再转为int
configEdit.apply()
Expand Down
10 changes: 0 additions & 10 deletions app/src/main/res/layout/settings_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@
android:text="@string/check_for_updates_when_opening_the_program"/>
</LinearLayout>


<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/infoUsername"
android:textSize="24dp"/>
<EditText android:id="@+id/uname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/username"/>

<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
Expand Down

0 comments on commit 50ae6ac

Please sign in to comment.