Compare commits

...

9 Commits

Author SHA1 Message Date
Xwite
5e30ee582a Bump cronet from 123.0.6312.80 to 126.0.6478.40
- Changes in the [Git log](https://chromium.googlesource.com/chromium/src/+log/123.0.6312.80..126.0.6478.40)
2024-06-10 01:35:21 +00:00
Horis
5acfe9be68 优化 2024-06-09 19:26:29 +08:00
Horis
e081b4b470 优化 2024-06-09 12:34:53 +08:00
Horis
2f2ba9a751 优化 2024-06-09 11:50:36 +08:00
Horis
c53e789762 优化 2024-06-05 11:04:34 +08:00
Horis
2e757ee105 优化 2024-06-04 22:38:45 +08:00
Horis
17416e06f6 优化 2024-06-04 15:21:39 +08:00
Horis
916adb7f8e 优化
#3969 #3970
2024-06-04 15:09:07 +08:00
Horis
1ba9ce009e 优化
#3968
2024-06-04 09:02:01 +08:00
18 changed files with 106 additions and 48 deletions

View File

@ -1,20 +1,19 @@
# -------- Config Path: base/android/proguard/chromium_code.flags -------- # -------- Config Path: base/android/proguard/shared_with_cronet.flags --------
# Copyright 2016 The Chromium Authors # Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
# Contains flags that can be safely shared with Cronet, and thus would be # Contains flags that we want to apply not only to Chromium APKs, but also to
# appropriate for third-party apps to include. # third-party apps that bundle the Cronet library.
# Allow unused native methods to be removed, but prevent renaming on those that are kept. # WARNING: rules in this file are applied to entire third-party APKs, not just
-keepclasseswithmembernames,includedescriptorclasses,allowaccessmodification class !cr_allowunused,** { # Chromium code. They MUST be scoped appropriately to avoid side effects on app
native <methods>; # code that we do not own.
}
# Use assumevalues block instead of assumenosideeffects block because Google3 proguard cannot parse # Use assumevalues block instead of assumenosideeffects block because Google3
# assumenosideeffects blocks which overwrite return value. # proguard cannot parse assumenosideeffects blocks which overwrite return
# chromium_code.flags rather than remove_logging.flags so that it's included # value. Keep this in shared_with_cronet.flags rather than remove_logging.flags
# in cronet. # so that it's included in cronet.
-assumevalues class org.chromium.base.Log { -assumevalues class org.chromium.base.Log {
static boolean isDebug() return false; static boolean isDebug() return false;
} }
@ -37,21 +36,10 @@
public static **[] values(); public static **[] values();
} }
# -identifiernamestring doesn't keep the module impl around, we have to
# explicitly keep it.
-if @org.chromium.components.module_installer.builder.ModuleInterface interface *
-keep,allowobfuscation,allowaccessmodification class !cr_allowunused,** extends <1> {
<init>();
}
# Required to remove fields until b/274802355 is resolved. # Required to remove fields until b/274802355 is resolved.
-assumevalues class !cr_allowunused,** { -assumevalues class !cr_allowunused,** {
final org.chromium.base.ThreadUtils$ThreadChecker * return _NONNULL_; final org.chromium.base.ThreadUtils$ThreadChecker * return _NONNULL_;
} }
# TODO(agrieve): Remove once we start to use Android U SDK.
-dontwarn android.window.BackEvent
-dontwarn android.window.OnBackAnimationCallback
# -------- Config Path: build/android/chromium_annotations.flags -------- # -------- Config Path: build/android/chromium_annotations.flags --------
# Copyright 2022 The Chromium Authors # Copyright 2022 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
@ -113,6 +101,22 @@
-identifiernamestring class * { -identifiernamestring class * {
@org.chromium.build.annotations.IdentifierNameString *; @org.chromium.build.annotations.IdentifierNameString *;
} }
# Mark fields with this to help R8 figure out that they cannot be null.
# Use assumevalues in addition to assumenosideeffects block because Google3 proguard cannot parse
# assumenosideeffects blocks which overwrite return value.
-assumevalues class ** {
@org.chromium.build.annotations.AssumeNonNull *** *(...) return _NONNULL_;
}
-assumenosideeffects class ** {
@org.chromium.build.annotations.AssumeNonNull *** *(...);
}
-assumevalues class ** {
@org.chromium.build.annotations.AssumeNonNull *** * return _NONNULL_;
}
-assumenosideeffects class ** {
@org.chromium.build.annotations.AssumeNonNull *** *;
}
# -------- Config Path: components/cronet/android/cronet_impl_common_proguard.cfg -------- # -------- Config Path: components/cronet/android/cronet_impl_common_proguard.cfg --------
# Proguard config for apps that depend on cronet_impl_common_java.jar. # Proguard config for apps that depend on cronet_impl_common_java.jar.
@ -227,3 +231,10 @@
-keepclasseswithmembers,includedescriptorclasses,allowaccessmodification class ** { -keepclasseswithmembers,includedescriptorclasses,allowaccessmodification class ** {
@org.jni_zero.CalledByNativeUnchecked <methods>; @org.jni_zero.CalledByNativeUnchecked <methods>;
} }
# Allow unused native methods to be removed, but prevent renaming on those that
# are kept.
# TODO(crbug.com/315973491): Restrict the broad scope of this rule.
-keepclasseswithmembernames,includedescriptorclasses,allowaccessmodification class ** {
native <methods>;
}

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
{"arm64-v8a":"bbf2c50d1ebf0763d451b08e290a3244","armeabi-v7a":"ecb872f7b1b5342f4d7c36262bec0600","x86":"4da4832b89e2412d808c5b1ecdc24e3d","x86_64":"62080f051db02ed0e939affb39ce67fb","version":"123.0.6312.80"} {"x86":"c980ef740340f2f161d23946b00ca03c","arm64-v8a":"3fc14191ca1d0493dfe17e4a43cf78c3","armeabi-v7a":"2112441600d567f257f004804f09c0d3","x86_64":"a1bb5c7e8c40eae18533b8026c1cbbec","version":"126.0.6478.40"}

View File

@ -13,6 +13,7 @@
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
**2024/02/27** **2024/02/27**
* 更新cronet: 126.0.6478.40
* 更新cronet: 123.0.6312.80 * 更新cronet: 123.0.6312.80
* 更新cronet: 123.0.6312.40 * 更新cronet: 123.0.6312.40

View File

@ -27,6 +27,15 @@ open class BaseViewModel(application: Application) : AndroidViewModel(applicatio
return Coroutine.async(scope, context, start, executeContext, block) return Coroutine.async(scope, context, start, executeContext, block)
} }
fun <T> executeLazy(
scope: CoroutineScope = viewModelScope,
context: CoroutineContext = Dispatchers.IO,
executeContext: CoroutineContext = Dispatchers.Main,
block: suspend CoroutineScope.() -> T
): Coroutine<T> {
return Coroutine.async(scope, context, CoroutineStart.LAZY, executeContext, block)
}
fun <R> submit( fun <R> submit(
scope: CoroutineScope = viewModelScope, scope: CoroutineScope = viewModelScope,
context: CoroutineContext = Dispatchers.IO, context: CoroutineContext = Dispatchers.IO,

View File

@ -188,6 +188,7 @@ class ContentProcessor private constructor(
mContent = mContent.replace('\u00A0', ' ') mContent = mContent.replace('\u00A0', ' ')
} }
val contents = arrayListOf<String>() val contents = arrayListOf<String>()
val paragraphIndent = ReadBookConfig.paragraphIndent
mContent.split("\n").forEach { str -> mContent.split("\n").forEach { str ->
val paragraph = str.trim { val paragraph = str.trim {
it.code <= 0x20 || it == ' ' it.code <= 0x20 || it == ' '
@ -196,10 +197,14 @@ class ContentProcessor private constructor(
if (contents.isEmpty() && includeTitle) { if (contents.isEmpty() && includeTitle) {
contents.add(paragraph) contents.add(paragraph)
} else { } else {
contents.add("${ReadBookConfig.paragraphIndent}$paragraph") contents.add("$paragraphIndent$paragraph")
} }
} }
} }
if (contents.isEmpty()) {
contents.add("${paragraphIndent}加载正文失败")
contents.add("${paragraphIndent}内容处理后为空")
}
return BookContent(sameTitleRemoved, contents, effectiveReplaceRules) return BookContent(sameTitleRemoved, contents, effectiveReplaceRules)
} }

View File

@ -7,7 +7,6 @@ import android.net.wifi.WifiManager
import android.os.Build import android.os.Build
import android.os.PowerManager import android.os.PowerManager
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseService import io.legado.app.base.BaseService
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
@ -23,6 +22,7 @@ import io.legado.app.utils.postEvent
import io.legado.app.utils.printOnDebug import io.legado.app.utils.printOnDebug
import io.legado.app.utils.sendToClip import io.legado.app.utils.sendToClip
import io.legado.app.utils.servicePendingIntent import io.legado.app.utils.servicePendingIntent
import io.legado.app.utils.startForegroundServiceCompat
import io.legado.app.utils.startService import io.legado.app.utils.startService
import io.legado.app.utils.stopService import io.legado.app.utils.stopService
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
@ -45,7 +45,7 @@ class WebService : BaseService() {
fun startForeground(context: Context) { fun startForeground(context: Context) {
val intent = Intent(context, WebService::class.java) val intent = Intent(context, WebService::class.java)
ContextCompat.startForegroundService(context, intent) context.startForegroundServiceCompat(intent)
} }
fun stop(context: Context) { fun stop(context: Context) {
@ -94,7 +94,13 @@ class WebService : BaseService() {
val addressList = NetworkUtils.getLocalIPAddress() val addressList = NetworkUtils.getLocalIPAddress()
notificationList.clear() notificationList.clear()
if (addressList.any()) { if (addressList.any()) {
notificationList.addAll(addressList.map { address -> getString(R.string.http_ip, address.hostAddress, getPort()) }) notificationList.addAll(addressList.map { address ->
getString(
R.string.http_ip,
address.hostAddress,
getPort()
)
})
hostAddress = notificationList.first() hostAddress = notificationList.first()
} else { } else {
hostAddress = getString(R.string.network_connection_unavailable) hostAddress = getString(R.string.network_connection_unavailable)
@ -154,7 +160,13 @@ class WebService : BaseService() {
httpServer?.start() httpServer?.start()
webSocketServer?.start(1000 * 30) // 通信超时设置 webSocketServer?.start(1000 * 30) // 通信超时设置
notificationList.clear() notificationList.clear()
notificationList.addAll(addressList.map { address -> getString(R.string.http_ip, address.hostAddress, getPort()) }) notificationList.addAll(addressList.map { address ->
getString(
R.string.http_ip,
address.hostAddress,
getPort()
)
})
hostAddress = notificationList.first() hostAddress = notificationList.first()
isRun = true isRun = true
postEvent(EventBus.WEB_SERVICE, hostAddress) postEvent(EventBus.WEB_SERVICE, hostAddress)

View File

@ -13,6 +13,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.data.appDb
import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.databinding.DialogEditTextBinding
import io.legado.app.help.config.AppConfig import io.legado.app.help.config.AppConfig
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
@ -22,7 +23,14 @@ import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.book.import.BaseImportBookActivity import io.legado.app.ui.book.import.BaseImportBookActivity
import io.legado.app.ui.file.HandleFileContract import io.legado.app.ui.file.HandleFileContract
import io.legado.app.ui.widget.SelectActionBar import io.legado.app.ui.widget.SelectActionBar
import io.legado.app.utils.* import io.legado.app.utils.ArchiveUtils
import io.legado.app.utils.FileDoc
import io.legado.app.utils.gone
import io.legado.app.utils.isContentScheme
import io.legado.app.utils.isUri
import io.legado.app.utils.launch
import io.legado.app.utils.putPrefInt
import io.legado.app.utils.visible
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
@ -175,6 +183,7 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
selectFolder.launch() selectFolder.launch()
} }
} }
else -> initRootPath(rootUri.path!!) else -> initRootPath(rootUri.path!!)
} }
} }
@ -291,7 +300,9 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
override fun startRead(fileDoc: FileDoc) { override fun startRead(fileDoc: FileDoc) {
if (!ArchiveUtils.isArchive(fileDoc.name)) { if (!ArchiveUtils.isArchive(fileDoc.name)) {
startReadBook(fileDoc.toString()) appDb.bookDao.getBookByFileName(fileDoc.name)?.let {
startReadBook(it.bookUrl)
}
} else { } else {
onArchiveFileClick(fileDoc) onArchiveFileClick(fileDoc)
} }

View File

@ -170,7 +170,11 @@ class RemoteBookActivity : BaseImportBookActivity<RemoteBookViewModel>(),
private fun upPath() { private fun upPath() {
binding.tvGoBack.isEnabled = viewModel.dirList.isNotEmpty() binding.tvGoBack.isEnabled = viewModel.dirList.isNotEmpty()
var path = "books" + File.separator var path = if (viewModel.isDefaultWebdav) {
"books" + File.separator
} else {
File.separator
}
viewModel.dirList.forEach { viewModel.dirList.forEach {
path = path + it.filename + File.separator path = path + it.filename + File.separator
} }

View File

@ -90,14 +90,17 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
}.flowOn(Dispatchers.IO) }.flowOn(Dispatchers.IO)
private var remoteBookWebDav: RemoteBookWebDav? = null private var remoteBookWebDav: RemoteBookWebDav? = null
var isDefaultWebdav = false
fun initData(onSuccess: () -> Unit) { fun initData(onSuccess: () -> Unit) {
execute { execute {
isDefaultWebdav = false
appDb.serverDao.get(AppConfig.remoteServerId)?.getWebDavConfig()?.let { appDb.serverDao.get(AppConfig.remoteServerId)?.getWebDavConfig()?.let {
val authorization = Authorization(it) val authorization = Authorization(it)
remoteBookWebDav = RemoteBookWebDav(it.url, authorization, AppConfig.remoteServerId) remoteBookWebDav = RemoteBookWebDav(it.url, authorization, AppConfig.remoteServerId)
return@execute return@execute
} }
isDefaultWebdav = true
remoteBookWebDav = AppWebDav.defaultBookWebDav remoteBookWebDav = AppWebDav.defaultBookWebDav
?: throw NoStackTraceException("webDav没有配置") ?: throw NoStackTraceException("webDav没有配置")
}.onError { }.onError {
@ -108,7 +111,7 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
} }
fun loadRemoteBookList(path: String?, loadCallback: (loading: Boolean) -> Unit) { fun loadRemoteBookList(path: String?, loadCallback: (loading: Boolean) -> Unit) {
execute { executeLazy {
val bookWebDav = remoteBookWebDav val bookWebDav = remoteBookWebDav
?: throw NoStackTraceException("没有配置webDav") ?: throw NoStackTraceException("没有配置webDav")
dataCallback?.clear() dataCallback?.clear()
@ -122,7 +125,7 @@ class RemoteBookViewModel(application: Application) : BaseViewModel(application)
loadCallback.invoke(true) loadCallback.invoke(true)
}.onFinally { }.onFinally {
loadCallback.invoke(false) loadCallback.invoke(false)
} }.start()
} }
fun addToBookshelf(remoteBooks: HashSet<RemoteBook>, finally: () -> Unit) { fun addToBookshelf(remoteBooks: HashSet<RemoteBook>, finally: () -> Unit) {

View File

@ -278,7 +278,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
if (textPos.compare(selectEnd) <= 0) { if (textPos.compare(selectEnd) <= 0) {
selectStart.upData(pos = textPos) selectStart.upData(pos = textPos)
upSelectedStart( upSelectedStart(
if (textPos.columnIndex < textLine.columns.lastIndex) textColumn.start else textColumn.end, if (textPos.columnIndex < textLine.columns.size) textColumn.start else textColumn.end,
textLine.lineBottom + relativeOffset, textLine.lineBottom + relativeOffset,
textLine.lineTop + relativeOffset textLine.lineTop + relativeOffset
) )
@ -318,7 +318,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
selectEndMoveIndex(selectStart) selectEndMoveIndex(selectStart)
selectStart.upData(textPos) selectStart.upData(textPos)
upSelectedStart( upSelectedStart(
if (textPos.columnIndex < textLine.columns.lastIndex) textColumn.start else textColumn.end, if (textPos.columnIndex < textLine.columns.size) textColumn.start else textColumn.end,
textLine.lineBottom + relativeOffset, textLine.lineBottom + relativeOffset,
textLine.lineTop + relativeOffset textLine.lineTop + relativeOffset
) )
@ -498,7 +498,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
val textLine = relativePage(relativePagePos).getLine(lineIndex) val textLine = relativePage(relativePagePos).getLine(lineIndex)
val textColumn = textLine.getColumn(charIndex) val textColumn = textLine.getColumn(charIndex)
upSelectedStart( upSelectedStart(
if (charIndex < textLine.columns.lastIndex) textColumn.start else textColumn.end, if (charIndex < textLine.columns.size) textColumn.start else textColumn.end,
textLine.lineBottom + relativeOffset(relativePagePos), textLine.lineBottom + relativeOffset(relativePagePos),
textLine.lineTop + relativeOffset(relativePagePos) textLine.lineTop + relativeOffset(relativePagePos)
) )
@ -534,7 +534,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
} }
private fun upSelectChars() { private fun upSelectChars() {
if (!selectStart.isSelected() || !selectEnd.isSelected()) { if (!selectStart.isSelected() && !selectEnd.isSelected()) {
return return
} }
val last = if (callBack.isScroll) 2 else 0 val last = if (callBack.isScroll) 2 else 0
@ -621,7 +621,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
if (column is TextColumn) { if (column is TextColumn) {
when { when {
compareStart == 0 -> { compareStart == 0 -> {
if (textPos.columnIndex < textLine.columns.lastIndex) { if (textPos.columnIndex < textLine.columns.size) {
builder.append(column.charData) builder.append(column.charData)
} }
if ( if (

View File

@ -154,8 +154,8 @@ class ScrollPageDelegate(readView: ReadView) : PageDelegate(readView) {
*/ */
private fun calcNextPageOffset(): Int { private fun calcNextPageOffset(): Int {
val visibleHeight = ChapterProvider.visibleHeight val visibleHeight = ChapterProvider.visibleHeight
val book = ReadBook.book!! val book = ReadBook.book
if (book.isImage) { if (book == null || book.isImage) {
return -visibleHeight return -visibleHeight
} }
val visiblePage = readView.getCurVisiblePage() val visiblePage = readView.getCurVisiblePage()
@ -170,8 +170,8 @@ class ScrollPageDelegate(readView: ReadView) : PageDelegate(readView) {
private fun calcPrevPageOffset(): Int { private fun calcPrevPageOffset(): Int {
val visibleHeight = ChapterProvider.visibleHeight val visibleHeight = ChapterProvider.visibleHeight
val book = ReadBook.book!! val book = ReadBook.book
if (book.isImage) { if (book == null || book.isImage) {
return visibleHeight return visibleHeight
} }
val visiblePage = readView.getCurVisiblePage() val visiblePage = readView.getCurVisiblePage()

View File

@ -42,7 +42,7 @@ android.defaults.buildfeatures.shaders=false
# and none from the library's dependencies, thereby reducing the size of the R class for that library. # and none from the library's dependencies, thereby reducing the size of the R class for that library.
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
# https://chromiumdash.appspot.com/releases?platform=Android # https://chromiumdash.appspot.com/releases?platform=Android
CronetVersion=123.0.6312.80 CronetVersion=126.0.6478.40
CronetMainVersion=123.0.0.0 CronetMainVersion=126.0.0.0
android.injected.testOnly=false android.injected.testOnly=false
android.nonFinalResIds=true android.nonFinalResIds=true

View File

@ -106,11 +106,13 @@ public class PackageDocumentReader extends PackageDocumentBase {
NodeList originItemElements = manifestElement NodeList originItemElements = manifestElement
.getElementsByTagNameNS(NAMESPACE_OPF, OPFTags.item); .getElementsByTagNameNS(NAMESPACE_OPF, OPFTags.item);
for (int i = 0; i < originItemElements.getLength(); i++) { for (int i = 0; i < originItemElements.getLength(); i++) {
Element itemElement = (Element) originItemElements.item(i); Element itemElement = (Element) originItemElements.item(i).cloneNode(false);
fixedElements.add(itemElement);
String href = DOMUtil.getAttribute(itemElement, NAMESPACE_OPF, OPFAttributes.href); String href = DOMUtil.getAttribute(itemElement, NAMESPACE_OPF, OPFAttributes.href);
String resolvedHref = packagePath.resolve(href).toString();
itemElement.setAttribute("href", resolvedHref);
fixedElements.add(itemElement);
try { try {
href = URLDecoder.decode(packagePath.resolve(href).toString(), Constants.CHARACTER_ENCODING); href = URLDecoder.decode(resolvedHref, Constants.CHARACTER_ENCODING);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
Log.e(TAG, e.getMessage()); Log.e(TAG, e.getMessage());
} }
@ -177,7 +179,7 @@ public class PackageDocumentReader extends PackageDocumentBase {
.getAttribute(itemElement, NAMESPACE_OPF, OPFAttributes.href); .getAttribute(itemElement, NAMESPACE_OPF, OPFAttributes.href);
try { try {
href = URLDecoder.decode(packagePath.resolve(href).toString(), Constants.CHARACTER_ENCODING); href = URLDecoder.decode(href, Constants.CHARACTER_ENCODING);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
Log.e(TAG, e.getMessage()); Log.e(TAG, e.getMessage());
} }