Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f67578371 | ||
|
|
37f2227093 | ||
|
|
1833c0bde5 |
10
.idea/deploymentTargetDropDown.xml
generated
10
.idea/deploymentTargetDropDown.xml
generated
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_2_API_30.avd" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_2_API_31.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2022-01-08T14:40:03.455241Z" />
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2022-01-11T07:37:11.839392Z" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -2,7 +2,7 @@
|
||||
*Pupil, Hitomi.la viewer for Android*
|
||||
|
||||

|
||||
[](https://github.com/tom5079/Pupil/releases/download/5.2.11/Pupil-v5.2.11.apk)
|
||||
[](https://github.com/tom5079/Pupil/releases/download/5.2.12/Pupil-v5.2.12.apk)
|
||||
[](https://discord.gg/Stj4b5v)
|
||||
|
||||
# Features
|
||||
|
||||
@@ -38,7 +38,7 @@ android {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 31
|
||||
versionCode 69
|
||||
versionName "5.2.11"
|
||||
versionName "5.2.12"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 69,
|
||||
"versionName": "5.2.11",
|
||||
"versionName": "5.2.12",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -93,7 +93,7 @@ fun reloadWebView() {
|
||||
webViewReady = false
|
||||
webViewFailed = false
|
||||
|
||||
evaluationContext.cancelChildren()
|
||||
evaluationContext.cancelChildren(CancellationException("reload"))
|
||||
|
||||
runCatching {
|
||||
URL(
|
||||
|
||||
@@ -56,7 +56,7 @@ suspend fun WebView.evaluate(script: String): String = coroutineScope {
|
||||
|
||||
}
|
||||
} catch (e: CancellationException) {
|
||||
continue
|
||||
if (e.message != "reload") result = "null"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ suspend fun WebView.evaluatePromise(
|
||||
flow.first().second
|
||||
}
|
||||
} catch (e: CancellationException) {
|
||||
continue
|
||||
if (e.message != "reload") result = "null"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package xyz.quaver.pupil.hitomi
|
||||
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import java.util.*
|
||||
|
||||
suspend fun doSearch(query: String, sortByPopularity: Boolean = false) : Set<Int> = coroutineScope {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package xyz.quaver.pupil.hitomi
|
||||
|
||||
import android.util.Log
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.decodeFromString
|
||||
@@ -37,9 +38,22 @@ data class Suggestion(val s: String, val t: Int, val u: String, val n: String)
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
suspend fun getSuggestionsForQuery(query: String) : List<Suggestion> {
|
||||
val result = webView.evaluatePromise("get_suggestions_for_query('$query')")
|
||||
val result = webView.evaluatePromise(
|
||||
"get_suggestions_for_query('$query', ++search_serial)",
|
||||
then = """
|
||||
.then(r => {
|
||||
let [results, results_serial] = r;
|
||||
console.log(results_serial, r, search_serial);
|
||||
if (search_serial !== results_serial) {
|
||||
Callback.onResult(%uid, '[]');
|
||||
} else {
|
||||
Callback.onResult(%uid, JSON.stringify(results));
|
||||
}
|
||||
});
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
return Json.decodeFromString<List<List<Suggestion>?>>(result)[0] ?: return emptyList()
|
||||
return Json.decodeFromString(result) ?: return emptyList()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
|
||||
Reference in New Issue
Block a user