修复从数据库中读取章节时部分数据项缺失的bug

master^2
fengyuecanzhu 2 years ago
parent a8cf25d6f2
commit 2546c4fa5b
No known key found for this signature in database
GPG Key ID: 04B78AD06A9D6E6C
  1. 11
      app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java
  2. 33
      dynamic/src/main/java/xyz/fycz/dynamic/fix/App250Fix.kt

@ -66,6 +66,7 @@ public class ChapterService extends BaseService {
chapter.setContent(cursor.getString(8));
chapter.setStart(cursor.getInt(9));
chapter.setEnd(cursor.getInt(10));
chapter.setVariable(cursor.getString(11));
chapters.add(chapter);
}
} catch (Exception e) {
@ -95,10 +96,14 @@ public class ChapterService extends BaseService {
if (StringHelper.isEmpty(bookId)) return new ArrayList<>();
return DbManager.getDaoSession().getChapterDao()
.queryBuilder()
.where(ChapterDao.Properties.BookId.eq(bookId))
.orderAsc(ChapterDao.Properties.Number)
.list();
/*String sql = "select * from chapter where book_id = ? order by number";
String sql = "select * from chapter where book_id = ? order by number";
return findChapters(sql, new String[]{bookId});
return findChapters(sql, new String[]{bookId});*/
}
/**

@ -23,18 +23,49 @@ import androidx.viewbinding.ViewBinding
import me.fycz.maple.MapleBridge
import me.fycz.maple.MapleUtils
import me.fycz.maple.MethodReplacement
import xyz.fycz.myreader.greendao.DbManager
import xyz.fycz.myreader.greendao.entity.Chapter
import xyz.fycz.myreader.greendao.gen.ChapterDao
import xyz.fycz.myreader.greendao.service.ChapterService
import xyz.fycz.myreader.ui.activity.BookDetailedActivity
/**
* @author fengyue
* @date 2022/8/11 16:44
*/
@AppFix([243, 244, 245, 246, 250], ["[书籍详情界面]取消书籍简介展开时最大行数限制(无法显示完全)"], "2022-08-11")
@AppFix(
[243, 244, 245, 246, 250],
["[书籍详情界面]取消书籍简介展开时最大行数限制(无法显示完全)",
"修复从数据库中读取章节时部分数据项缺失的bug"],
"2022-08-11"
)
class App250Fix : AppFixHandle {
override fun onFix(key: String): BooleanArray {
return handleFix(
key,
"showMoreDesc" to { fxShowMoreDesc() },
"findBookAllChapterByBookId" to { fxFindBookAllChapterByBookId() },
)
}
private fun fxFindBookAllChapterByBookId() {
MapleUtils.findAndHookMethod(
ChapterService::class.java,
"findBookAllChapterByBookId",
String::class.java,
object : MethodReplacement() {
override fun replaceHookedMethod(param: MapleBridge.MethodHookParam): Any {
val bookId = param.args[0] as String?
if (bookId.isNullOrBlank()) {
return emptyList<Chapter>()
}
return DbManager.getDaoSession().chapterDao
.queryBuilder()
.where(ChapterDao.Properties.BookId.eq(bookId))
.orderAsc(ChapterDao.Properties.Number)
.list()
}
}
)
}

Loading…
Cancel
Save