APIアクセスのタイムアウトを追加。Chrome Custom Tabsで開けたら2回開かないようにする。

This commit is contained in:
tateisu 2022-02-23 13:24:38 +09:00
parent 48ad3ad55d
commit 12b460bb60
6 changed files with 10 additions and 2 deletions

View File

@ -274,8 +274,10 @@ class App1 : Application() {
Logger.getLogger(OkHttpClient::class.java.name).level = Level.FINE
val apiReadTimeout = max(3, PrefS.spApiReadTimeout.toInt(appPref))
// API用のHTTP設定はキャッシュを使わない
ok_http_client = prepareOkHttp(60, 60)
ok_http_client = prepareOkHttp(apiReadTimeout, apiReadTimeout)
.build()
// ディスクキャッシュ
@ -283,7 +285,7 @@ class App1 : Application() {
val cache = Cache(cacheDir, 30000000L)
// カスタム絵文字用のHTTP設定はキャッシュを使う
ok_http_client2 = prepareOkHttp(60, 60)
ok_http_client2 = prepareOkHttp(apiReadTimeout, apiReadTimeout)
.cache(cache)
.build()

View File

@ -1002,6 +1002,7 @@ val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_sett
sw(PrefB.bpDontUseStreaming, R.string.dont_use_streaming_api)
sw(PrefB.bpDontRefreshOnResume, R.string.dont_refresh_on_activity_resume)
text(PrefS.spMediaReadTimeout, R.string.timeout_for_embed_media_viewer, InputTypeEx.number)
text(PrefS.spApiReadTimeout, R.string.timeout_for_server_api, InputTypeEx.number)
action(R.string.delete_custom_emoji_cache) {
action = {
App1.custom_emoji_cache.delete()

View File

@ -35,6 +35,8 @@ object PrefS {
val spUserAgent = StringPref("UserAgent", "")
val spMediaReadTimeout = StringPref("spMediaReadTimeout", "60")
val spApiReadTimeout = StringPref("spApiReadTimeout", "60")
val spAgreedPrivacyPolicyDigest = StringPref("spAgreedPrivacyPolicyDigest", "")
val spTimeZone = StringPref("TimeZone", "")

View File

@ -163,6 +163,7 @@ fun Activity.openCustomTab(url: String?, pref: SharedPreferences = pref()) {
"com.google.android.apps.chrome.Main"
)
startCustomTabIntent(cn)
return
} catch (ex2: Throwable) {
log.e(ex2, "openCustomTab: missing chrome. retry to other application.")
}

View File

@ -706,6 +706,7 @@
<string name="timeline_font_bold">タイムラインのフォント(太字)(アプリ再起動が必要)</string>
<string name="timeline_font_size">タイムラインのフォントの大きさ\n(単位:sp。空欄でデフォルト。アプリ再起動が必要)\n…\n…</string>
<string name="timeout_for_embed_media_viewer">内蔵メディアビューアのタイムアウト (単位:秒 アプリ再起動(アプリ履歴からの消去)が必要)</string>
<string name="timeout_for_server_api">サーバAPIアクセスのタイムアウト (単位:秒 アプリ再起動(アプリ履歴からの消去)が必要)</string>
<string name="title">名前</string>
<string name="token_exported">アプリデータのエクスポート、インポート、バックアップからの復元などでアクセストークンが他のデバイスでも使われている可能性があります。アクセストークンの更新をおすすめします。</string>
<string name="token_not_specified">アクセストークンを入力してください</string>

View File

@ -791,6 +791,7 @@
<string name="reaction">Reaction</string>
<string name="vote_polls">voting or its result</string>
<string name="timeout_for_embed_media_viewer">Timeout for embedded media viewer (Unit:seconds, app restart(delete from app history) required)</string>
<string name="timeout_for_server_api">Timeout for server API(Unit:seconds, app restart(delete from app history) required)</string>
<string name="link_color">Link color (app restart required)</string>
<string name="missing_closeable_column">Missing closeable column in visible range.</string>
<string name="dont_use_custom_tabs">Don\'t use (Chrome/Firefox) \"Custom Tabs\" when opening links</string>