This commit is contained in:
kunfei 2023-09-20 11:21:28 +08:00
parent 56087a361a
commit 543c3548aa
23 changed files with 32 additions and 213 deletions

View File

@ -41,7 +41,7 @@ android {
}
defaultConfig {
applicationId "io.legado.app"
minSdk 24
minSdk 21
targetSdk 33
versionCode 10000 + gitCommits
versionName version
@ -93,16 +93,6 @@ android {
dimension "mode"
manifestPlaceholders.put("APP_CHANNEL_VALUE", "app")
}
google {
dimension "mode"
applicationId "io.legado.play"
manifestPlaceholders.put("APP_CHANNEL_VALUE", "google")
}
lollipop {
dimension "mode"
minSdk 21
manifestPlaceholders.put("APP_CHANNEL_VALUE", "lollipop")
}
}
android.applicationVariants.configureEach { variant ->
@ -219,14 +209,12 @@ dependencies {
implementation(project(path: ':modules:book'))
//JS rhino
appImplementation(project(path: ':modules:rhino1.7.3'))
googleImplementation(project(path: ':modules:rhino1.7.3'))
lollipopImplementation(project(path: ':modules:rhino1.7.3'))
implementation(project(path: ':modules:rhino1.7.3'))
//
implementation('com.squareup.okhttp3:okhttp:4.11.0')
appImplementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
appImplementation 'com.google.protobuf:protobuf-javalite:3.23.4'
implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
implementation 'com.google.protobuf:protobuf-javalite:3.23.4'
//Glide
def glideVersion = "4.15.1"

View File

@ -4,7 +4,6 @@
package io.legado.app.lib.cronet
import androidx.annotation.Keep
import io.legado.app.constant.AppConst
import io.legado.app.constant.AppLog
import io.legado.app.help.http.CookieManager.cookieJarHeader
import io.legado.app.help.http.okHttpClient
@ -22,11 +21,9 @@ import splitties.init.appCtx
internal const val BUFFER_SIZE = 32 * 1024
val cronetEngine: ExperimentalCronetEngine? by lazy {
if (!AppConst.isPlayChannel) {
CronetLoader.preDownload()
}
CronetLoader.preDownload()
val builder = ExperimentalCronetEngine.Builder(appCtx).apply {
if (!AppConst.isPlayChannel && CronetLoader.install()) {
if (CronetLoader.install()) {
setLibraryLoader(CronetLoader)//设置自定义so库加载
}
setStoragePath(appCtx.externalCacheDir?.absolutePath)//设置缓存路径

View File

@ -7,16 +7,13 @@ import android.os.Build
import android.text.TextUtils
import androidx.annotation.Keep
import io.legado.app.BuildConfig
import io.legado.app.constant.AppConst
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.http.Cronet
import io.legado.app.utils.DebugLog
import io.legado.app.utils.printOnDebug
import org.chromium.net.CronetEngine
import org.json.JSONObject
import splitties.init.appCtx
import java.io.*
import java.math.BigInteger
import java.net.HttpURLConnection
@ -64,9 +61,6 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader(), Cronet.LoaderInterfa
}
}
if (AppConst.isPlayChannel) {
return false
}
if (md5.length != 32 || !soFile.exists() || md5 != getFileMD5(soFile)) {
cacheInstall = false
return cacheInstall
@ -80,9 +74,6 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader(), Cronet.LoaderInterfa
* 预加载Cronet
*/
override fun preDownload() {
if (AppConst.isPlayChannel) {
return
}
Coroutine.async {
//md5 = getUrlMd5(md5Url)
if (soFile.exists() && md5 == getFileMD5(soFile)) {
@ -266,7 +257,7 @@ object CronetLoader : CronetEngine.Builder.LibraryLoader(), Cronet.LoaderInterfa
downloadTempFile: File,
destSuccessFile: File
) {
if (download || AppConst.isPlayChannel) {
if (download) {
return
}
download = true

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--suppress XmlUnusedNamespaceDeclaration -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
tools:node="remove" />
<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage"
tools:node="remove" />
</manifest>

View File

@ -1,32 +0,0 @@
[
{
"customOrder": 2,
"enableJs": true,
"enabled": true,
"singleUrl": true,
"sourceGroup": "legado",
"sourceIcon": "http://mmbiz.qpic.cn/mmbiz_png/hpfMV8hEuL2eS6vnCxvTzoOiaCAibV6exBzJWq9xMic9xDg3YXAick87tsfafic0icRwkQ5ibV0bJ84JtSuxhPuEDVquA/0?wx_fmt=png",
"sourceName": "小说拾遗",
"sourceUrl": "snssdk1128://user/profile/562564899806367"
},
{
"customOrder": 3,
"enableJs": true,
"enabled": true,
"singleUrl": true,
"sourceGroup": "legado",
"sourceIcon": "https://cdn.jsdelivr.net/gh/mgz0227/meowcloud/icon.png",
"sourceName": "Meow云",
"sourceUrl": "https://pan.miaogongzi.net"
},
{
"customOrder": 4,
"enableJs": true,
"enabled": true,
"singleUrl": true,
"sourceGroup": "legado",
"sourceIcon": "https://cdn.jsdelivr.net/gh/gedoor/legado@master/app/src/main/res/mipmap-hdpi/ic_launcher.png",
"sourceName": "烏雲净化",
"sourceUrl": "https://www.lanzoux.com/b0bw8jwoh"
}
]

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">阅读Pro</string>
<string name="app_share_description">
Legado (YueDu 3.0) download link\n https://play.google.com/store/apps/details?id=io.legado.play.release
</string>
</resources>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">閱讀Pro</string>
<string name="app_share_description">
Legado (YueDu 3.0) download link\n https://play.google.com/store/apps/details?id=io.legado.play.release
</string>
</resources>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">閱讀Pro</string>
<string name="app_share_description">
Legado (YueDu 3.0) download link\n https://play.google.com/store/apps/details?id=io.legado.play.release
</string>
</resources>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="this_github_url" translatable="false"></string>
<string name="home_page_url" translatable="false"></string>
<string name="contributors_url" translatable="false"></string>
</resources>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">legadoPro</string>
<string name="app_share_description">
Legado (YueDu 3.0) download link\n https://play.google.com/store/apps/details?id=io.legado.play.release
</string>
</resources>

View File

@ -5,7 +5,6 @@ import android.content.pm.PackageManager
import android.provider.Settings
import androidx.annotation.Keep
import io.legado.app.BuildConfig
import io.legado.app.utils.channel
import splitties.init.appCtx
import java.text.SimpleDateFormat
@ -14,8 +13,6 @@ object AppConst {
const val APP_TAG = "Legado"
val isPlayChannel = appCtx.channel == "google"
const val channelIdDownload = "channel_download"
const val channelIdReadAloud = "channel_read_aloud"
const val channelIdWeb = "channel_web"

View File

@ -5,7 +5,13 @@ import io.legado.app.help.CacheManager
import io.legado.app.help.config.AppConfig
import io.legado.app.help.http.CookieManager.cookieJarHeader
import io.legado.app.utils.NetworkUtils
import okhttp3.*
import okhttp3.ConnectionSpec
import okhttp3.Cookie
import okhttp3.CookieJar
import okhttp3.Credentials
import okhttp3.HttpUrl
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import java.net.InetSocketAddress
import java.net.Proxy
import java.util.concurrent.ConcurrentHashMap
@ -89,7 +95,7 @@ val okHttpClient: OkHttpClient by lazy {
}
networkResponse
}
if (!AppConst.isPlayChannel && AppConfig.isCronet) {
if (AppConfig.isCronet) {
if (Cronet.loader?.install() == true) {
Cronet.interceptor?.let {
builder.addInterceptor(it)

View File

@ -2,7 +2,6 @@ package io.legado.app.help.source
import android.os.Handler
import android.os.Looper
import io.legado.app.constant.AppConst
import io.legado.app.data.appDb
import io.legado.app.data.entities.BaseSource
import io.legado.app.data.entities.BookSource
@ -63,7 +62,6 @@ object SourceHelp {
private fun is18Plus(url: String?): Boolean {
url ?: return false
if (AppConst.isPlayChannel) return false
val baseUrl = NetworkUtils.getBaseUrl(url) ?: return false
kotlin.runCatching {
val host = baseUrl.split("//", ".").let {

View File

@ -8,7 +8,6 @@ import android.view.Menu
import android.view.MenuItem
import io.legado.app.R
import io.legado.app.base.BaseActivity
import io.legado.app.constant.AppConst
import io.legado.app.databinding.ActivityAboutBinding
import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.filletBackground
@ -46,7 +45,6 @@ class AboutActivity : BaseActivity<ActivityAboutBinding>() {
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.about, menu)
menu.findItem(R.id.menu_share_it)?.isVisible = !AppConst.isPlayChannel
return super.onCompatCreateOptionsMenu(menu)
}

View File

@ -9,10 +9,8 @@ import androidx.lifecycle.lifecycleScope
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import io.legado.app.R
import io.legado.app.constant.AppConst
import io.legado.app.constant.AppConst.appInfo
import io.legado.app.help.AppUpdate
import io.legado.app.lib.prefs.PreferenceCategory
import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.*
@ -30,12 +28,6 @@ class AboutFragment : PreferenceFragmentCompat() {
addPreferencesFromResource(R.xml.about)
findPreference<Preference>("update_log")?.summary =
"${getString(R.string.version)} ${appInfo.versionName}"
if (AppConst.isPlayChannel) {
findPreference<PreferenceCategory>("lx")?.run {
removePreferenceRecursively("home_page")
removePreferenceRecursively("git")
}
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -45,15 +37,10 @@ class AboutFragment : PreferenceFragmentCompat() {
override fun onPreferenceTreeClick(preference: Preference): Boolean {
when (preference.key) {
"contributors" -> if (!AppConst.isPlayChannel) {
openUrl(R.string.contributors_url)
}
"contributors" -> openUrl(R.string.contributors_url)
"update_log" -> showMdFile(getString(R.string.update_log), "updateLog.md")
"check_update" -> checkUpdate()
"mail" -> requireContext().sendMail(getString(R.string.email))
"sourceRuleSummary" -> openUrl(R.string.source_rule_url)
"git" -> openUrl(R.string.this_github_url)
"home_page" -> openUrl(R.string.home_page_url)
"license" -> showMdFile(getString(R.string.license), "LICENSE.md")
"disclaimer" -> showMdFile(getString(R.string.disclaimer), "disclaimer.md")
"privacyPolicy" -> showMdFile(getString(R.string.privacy_policy), "privacyPolicy.md")

View File

@ -5,7 +5,6 @@ import android.view.View
import android.view.ViewGroup
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.constant.AppConst
import io.legado.app.databinding.DialogUpdateBinding
import io.legado.app.help.AppUpdate
import io.legado.app.lib.theme.primaryColor
@ -53,21 +52,19 @@ class UpdateDialog() : BaseDialogFragment(R.layout.dialog_update) {
.build()
.setMarkdown(binding.textView, updateBody)
}
if (!AppConst.isPlayChannel) {
binding.toolBar.inflateMenu(R.menu.app_update)
binding.toolBar.setOnMenuItemClickListener {
when (it.itemId) {
R.id.menu_download -> {
val url = arguments?.getString("url")
val name = arguments?.getString("name")
if (url != null && name != null) {
Download.start(requireContext(), url, name)
toastOnUi(R.string.download_start)
}
binding.toolBar.inflateMenu(R.menu.app_update)
binding.toolBar.setOnMenuItemClickListener {
when (it.itemId) {
R.id.menu_download -> {
val url = arguments?.getString("url")
val name = arguments?.getString("name")
if (url != null && name != null) {
Download.start(requireContext(), url, name)
toastOnUi(R.string.download_start)
}
}
return@setOnMenuItemClickListener true
}
return@setOnMenuItemClickListener true
}
}

View File

@ -8,7 +8,6 @@ import androidx.documentfile.provider.DocumentFile
import androidx.lifecycle.lifecycleScope
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.AppConst
import io.legado.app.constant.AppLog
import io.legado.app.databinding.ActivityTranslucenceBinding
import io.legado.app.help.config.AppConfig
@ -120,7 +119,7 @@ class FileAssociationActivity :
intent.data?.let { data ->
if (data.isContentScheme()) {
viewModel.dispatchIndent(data)
} else if (!AppConst.isPlayChannel || Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
} else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
PermissionsCompat.Builder()
.addPermissions(*Permissions.Group.STORAGE)
.rationale(R.string.tip_perm_request_storage)

View File

@ -12,7 +12,6 @@ import androidx.documentfile.provider.DocumentFile
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R
import io.legado.app.constant.AppConst
import io.legado.app.constant.PreferKey
import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.help.config.AppConfig
@ -176,10 +175,6 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
selectFolder.launch()
}
}
AppConst.isPlayChannel -> {
binding.tvEmptyMsg.visible()
selectFolder.launch()
}
else -> initRootPath(rootUri.path!!)
}
}

View File

@ -11,7 +11,6 @@ import androidx.fragment.app.activityViewModels
import androidx.preference.ListPreference
import androidx.preference.Preference
import io.legado.app.R
import io.legado.app.constant.AppConst
import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey
import io.legado.app.databinding.DialogEditTextBinding
@ -50,9 +49,6 @@ class OtherConfigFragment : PreferenceFragment(),
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
putPrefBoolean(PreferKey.processText, isProcessTextEnabled())
addPreferencesFromResource(R.xml.pref_config_other)
if (AppConst.isPlayChannel) {
preferenceScreen.removePreferenceRecursively("Cronet")
}
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent)
upPreferenceSummary(PreferKey.preDownloadNum, AppConfig.preDownloadNum.toString())
upPreferenceSummary(PreferKey.threadCount, AppConfig.threadCount.toString())

View File

@ -59,9 +59,6 @@ class ThemeConfigFragment : PreferenceFragment(),
if (Build.VERSION.SDK_INT < 26) {
preferenceScreen.removePreferenceRecursively(PreferKey.launcherIcon)
}
if (!AppConst.isPlayChannel) {
preferenceScreen.removePreferenceRecursively("welcomeStyle")
}
upPreferenceSummary(PreferKey.bgImage, getPrefString(PreferKey.bgImage))
upPreferenceSummary(PreferKey.bgImageN, getPrefString(PreferKey.bgImageN))
upPreferenceSummary(PreferKey.barElevation, AppConfig.elevation.toString())

View File

@ -9,7 +9,6 @@ import androidx.activity.viewModels
import androidx.lifecycle.lifecycleScope
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.AppConst
import io.legado.app.constant.AppLog
import io.legado.app.databinding.ActivityTranslucenceBinding
import io.legado.app.help.IntentData
@ -167,7 +166,7 @@ class HandleFileActivity :
}
private fun getDirActions(onlySys: Boolean = false): ArrayList<SelectItem<Int>> {
return if (onlySys || (AppConst.isPlayChannel && Permissions.isManageExternalStorage())) {
return if (onlySys) {
arrayListOf(SelectItem(getString(R.string.sys_folder_picker), HandleFileContract.DIR))
} else {
arrayListOf(
@ -178,14 +177,10 @@ class HandleFileActivity :
}
private fun getFileActions(): ArrayList<SelectItem<Int>> {
return if (AppConst.isPlayChannel && Permissions.isManageExternalStorage()) {
arrayListOf(SelectItem(getString(R.string.sys_file_picker), HandleFileContract.FILE))
} else {
arrayListOf(
SelectItem(getString(R.string.sys_file_picker), HandleFileContract.FILE),
SelectItem(getString(R.string.app_file_picker), 11)
)
}
return arrayListOf(
SelectItem(getString(R.string.sys_file_picker), HandleFileContract.FILE),
SelectItem(getString(R.string.app_file_picker), 11)
)
}
private fun checkPermissions(success: (() -> Unit)? = null) {

View File

@ -4,10 +4,7 @@
<string name="legado_gzh" translatable="false">开源阅读</string>
<string name="email" translatable="false">gekunfei@live.com</string>
<string name="source_rule_url" translatable="false">https://alanskycn.gitee.io/teachme/</string>
<string name="this_github_url" translatable="false">https://github.com/gedoor/legado</string>
<string name="contributors_url" translatable="false">https://github.com/gedoor/legado/graphs/contributors</string>
<string name="home_page_url" translatable="false">https://gedoor.github.io</string>
<string name="tg_url" translatable="false">https://t.me/legado_channels</string>
<string name="discord_url" translatable="false">https://discord.gg/qDE52P5xGW</string>

View File

@ -41,18 +41,6 @@
android:summary="@string/qq_channel_summary"
app:iconSpaceReserved="false" />
<io.legado.app.lib.prefs.Preference
android:key="mail"
android:summary="@string/email"
android:title="@string/send_mail"
app:iconSpaceReserved="false" />
<io.legado.app.lib.prefs.Preference
android:key="git"
android:summary="@string/this_github_url"
android:title="@string/git_hub"
app:iconSpaceReserved="false" />
<io.legado.app.lib.prefs.Preference
android:key="discord"
android:summary="@string/discord_url"
@ -65,20 +53,6 @@
android:title="TG"
app:iconSpaceReserved="false" />
<io.legado.app.lib.prefs.Preference
android:key="sourceRuleSummary"
android:summary="@string/source_rule_url"
android:title="@string/source_rule_s"
app:iconSpaceReserved="false" />
<io.legado.app.lib.prefs.Preference
android:key="home_page"
android:summary="@string/home_page_url"
android:title="@string/home_page"
app:allowDividerAbove="false"
app:allowDividerBelow="false"
app:iconSpaceReserved="false" />
</io.legado.app.lib.prefs.PreferenceCategory>
<io.legado.app.lib.prefs.PreferenceCategory