parent
2c9a5f1bb3
commit
72cb6bf89c
@ -1,54 +0,0 @@ |
||||
/* |
||||
* This file is part of FYReader. |
||||
* FYReader is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* FYReader is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with FYReader. If not, see <https://www.gnu.org/licenses/>. |
||||
* |
||||
* Copyright (C) 2020 - 2022 fengyuecanzhu |
||||
*/ |
||||
|
||||
package xyz.fycz.dynamic.fix |
||||
|
||||
import me.fycz.maple.MapleBridge |
||||
import me.fycz.maple.MapleUtils |
||||
import me.fycz.maple.MethodReplacement |
||||
import xyz.fycz.myreader.model.third3.analyzeRule.JsExtensions |
||||
import java.text.SimpleDateFormat |
||||
import java.util.* |
||||
|
||||
/** |
||||
* @author fengyue |
||||
* @date 2022/8/3 12:57 |
||||
*/ |
||||
@AppFix([243, 244, 245, 246, 250], ["修复书源时间格式化bug"], "2022-08-03") |
||||
class App250Fix : AppFixHandle { |
||||
override fun onFix(key: String): BooleanArray { |
||||
return handleFix( |
||||
key, |
||||
"timeFormat" to { fixTimeFormat() }, |
||||
) |
||||
} |
||||
|
||||
fun fixTimeFormat() { |
||||
MapleUtils.findAndHookMethod( |
||||
JsExtensions::class.java, |
||||
"timeFormat", |
||||
Long::class.java, |
||||
object : MethodReplacement() { |
||||
override fun replaceHookedMethod(param: MapleBridge.MethodHookParam): Any { |
||||
val time = param.args[0] as Long |
||||
return SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(Date(time)) |
||||
} |
||||
} |
||||
) |
||||
} |
||||
} |
Loading…
Reference in new issue