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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="deploymentTargetDropDown">
|
<component name="deploymentTargetDropDown">
|
||||||
<targetSelectedWithDropDown>
|
<runningDeviceTargetSelectedWithDropDown>
|
||||||
<Target>
|
<Target>
|
||||||
<type value="QUICK_BOOT_TARGET" />
|
<type value="RUNNING_DEVICE_TARGET" />
|
||||||
<deviceKey>
|
<deviceKey>
|
||||||
<Key>
|
<Key>
|
||||||
<type value="VIRTUAL_DEVICE_PATH" />
|
<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>
|
</Key>
|
||||||
</deviceKey>
|
</deviceKey>
|
||||||
</Target>
|
</Target>
|
||||||
</targetSelectedWithDropDown>
|
</runningDeviceTargetSelectedWithDropDown>
|
||||||
<timeTargetWasSelectedWithDropDown value="2022-01-08T14:40:03.455241Z" />
|
<timeTargetWasSelectedWithDropDown value="2022-01-11T07:37:11.839392Z" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
*Pupil, Hitomi.la viewer for Android*
|
*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)
|
[](https://discord.gg/Stj4b5v)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
versionCode 69
|
versionCode 69
|
||||||
versionName "5.2.11"
|
versionName "5.2.12"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 69,
|
"versionCode": 69,
|
||||||
"versionName": "5.2.11",
|
"versionName": "5.2.12",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ fun reloadWebView() {
|
|||||||
webViewReady = false
|
webViewReady = false
|
||||||
webViewFailed = false
|
webViewFailed = false
|
||||||
|
|
||||||
evaluationContext.cancelChildren()
|
evaluationContext.cancelChildren(CancellationException("reload"))
|
||||||
|
|
||||||
runCatching {
|
runCatching {
|
||||||
URL(
|
URL(
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ suspend fun WebView.evaluate(script: String): String = coroutineScope {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (e: CancellationException) {
|
} catch (e: CancellationException) {
|
||||||
continue
|
if (e.message != "reload") result = "null"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ suspend fun WebView.evaluatePromise(
|
|||||||
flow.first().second
|
flow.first().second
|
||||||
}
|
}
|
||||||
} catch (e: CancellationException) {
|
} catch (e: CancellationException) {
|
||||||
continue
|
if (e.message != "reload") result = "null"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package xyz.quaver.pupil.hitomi
|
package xyz.quaver.pupil.hitomi
|
||||||
|
|
||||||
import android.util.Log
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.coroutineScope
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
suspend fun doSearch(query: String, sortByPopularity: Boolean = false) : Set<Int> = coroutineScope {
|
suspend fun doSearch(query: String, sortByPopularity: Boolean = false) : Set<Int> = coroutineScope {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package xyz.quaver.pupil.hitomi
|
package xyz.quaver.pupil.hitomi
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
import kotlinx.serialization.ExperimentalSerializationApi
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.decodeFromString
|
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)
|
@OptIn(ExperimentalSerializationApi::class)
|
||||||
suspend fun getSuggestionsForQuery(query: String) : List<Suggestion> {
|
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)
|
@OptIn(ExperimentalSerializationApi::class)
|
||||||
|
|||||||
Reference in New Issue
Block a user