Skip to content

Commit

Permalink
update: error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ultranity committed Jan 20, 2021
1 parent 76f8c48 commit aa1068b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class ReFreshFunction : Function<Observable<Throwable>, ObservableSource<*>> {
private var client_id: String? = "MOBrBDS8blbauoSck0ZfDbtuzpyT"
private var client_secret: String? = "lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj"
private val TOKEN_ERROR = "Error occurred at the OAuth process"
private val TOKEN_ERROR_2 = "Invalid refresh token"
private var oAuthSecureService: OAuthSecureService? = null
private var i = 0
private val maxRetries = 3
Expand All @@ -77,6 +78,21 @@ class ReFreshFunction : Function<Observable<Throwable>, ObservableSource<*>> {
return@Function Observable.error<Any>(throwable)
} else if (throwable is HttpException) {
if (throwable.response()!!.code() == 400) {
if (throwable.message().contains(TOKEN_ERROR))
Toasty.info(
PxEZApp.instance,
PxEZApp.instance.getString(R.string.token_expired),
Toast.LENGTH_SHORT
).show()
if (throwable.message().contains(TOKEN_ERROR_2))
{
Toasty.info(
PxEZApp.instance,
PxEZApp.instance.getString(R.string.login_expired),
Toast.LENGTH_SHORT
).show()
return@Function Observable.error<Any>(throwable)
}
retryCount++
Log.d("init","400 retryCount $retryCount refreshing $refreshing")
if (refreshing && retryCount <= maxRetries-1)
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Pix-EzViewer</string>
<string name="app_features">"Some features hidden in the menu or long press, and more by intuition attempt\n"</string>
<string name="app_help">
"0. This is a free app. If you paid for it, please immediately ask for a refund and make a negative comment! \n"
Expand Down Expand Up @@ -239,7 +238,7 @@
<string name="welcomePR">If you want and have the ability to help improve this application, submit PR to us!</string>
<string name="donate">Donate</string>
<string name="sample_title">Sample: click auto set</string>
<string name="hide_downloaded_detail"><![CDATA[Retrieve the current default download path and sub-folders, supporting the use of python scripts to get more Gallery pid record on PC, provided as a convenience <a href ="https://wwa.lanzous.com/iQB4Rigc7yh"> PC packaged program here</a>]]> </string>
<string name="hide_downloaded_detail">Retrieve the current default download path and sub-folders, supporting the use of python scripts to get more Gallery pid record on PC, provided as a convenience <a href ="https://wwa.lanzous.com/iQB4Rigc7yh"> PC packaged program here</a> </string>
<string name="hide_downloaded_summary">Hide download function can record additional non-native:</string>
<string name="selectAll">Select all</string>
<string name="sortPic">Sort / filter</string>
Expand All @@ -259,4 +258,6 @@
<string name="mirror_link_view">Use mirror website when viewing</string>
<string name="icon_draw_by">Drawing by:你主人(探姬);HK流星(MD) </string>
<string name="set_mirror">Click to set the mirror website</string>
<string name="login_expired">Login expired, please login again</string>
<string name="token_expired">Token expired, please wait for refreshing</string>
</resources>
6 changes: 3 additions & 3 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Pix-EzViewer</string>
<string name="app_features">"一部の機能は、メニューや長押しに隠された、そしてより直感試行によって\n"</string>
<string name="app_help">
"0. このアプリケーションは無料です。お支払いいただいた場合は、すぐに払い戻しをリクエストし、否定的なレビューを行ってください!\ n"
Expand Down Expand Up @@ -239,7 +238,7 @@
<string name="welcomePR">あなたがしたいと、このアプリケーションを改善するための能力を持っている場合は、PRを歓迎しました</string>
<string name="donate">寄付</string>
<string name="sample_title">サンプル:クリック自動設定</string>
<string name="hide_downloaded_detail"><![CDATA[現在のデフォルトのダウンロードパスとサブフォルダを取得し、より多くを得るためにPythonスクリプトの使用をサポートしているギャラリーは利便<a hrefの="https://wwa.lanzous.com/iQB4Rigc7yh"> PCパッケージ提供</a>、レコードをPID ]]> </string>
<string name="hide_downloaded_detail">現在のデフォルトのダウンロードパスとサブフォルダを取得し、より多くを得るためにPythonスクリプトの使用をサポートしているギャラリーは利便<a hrefの="https://wwa.lanzous.com/iQB4Rigc7yh"> PCパッケージ提供</a>、レコードをPID </string>
<string name="hide_downloaded_summary">隠すダウンロード機能は、追加の非ネイティブ記録することができます:</string>
<string name="selectAll">すべて選択</string>
<string name="sortPic">ソート/フィルタ</string>
Expand All @@ -257,7 +256,8 @@
<string name="params_desc">{time}/{ILLUSTID}_p{part}{type}を含むオリジナルのパラメータ</string>
<string name="mirror_link_download">ダウンロード時にミラーを有効にします</string>
<string name="mirror_link_view">閲覧時にイメージを有効にします</string>
<string name="i_pximg_net">i.pximg.net</string>
<string name="icon_draw_by">描画:你主人(探姬);HK流星(MD)</string>
<string name="set_mirror">クリックしてミラーステーションを設定します</string>
<string name="login_expired">ログインが異常です、またログインしてください</string>
<string name="token_expired">ID情報が期限切れになったら、さわやかにお待ちください</string>
</resources>
5 changes: 3 additions & 2 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Pix-EzViewer</string>
<string name="app_features">"部分功能隱藏於菜單或長按後,多按直覺嘗試\n"</string>
<string name="app_help">
"0. 本應用是免費應用,如果您付費購買,請立即請求退款並打差評!\n"
Expand Down Expand Up @@ -239,7 +238,7 @@
<string name="welcomePR">如果你希望且有能力幫助改進這個應用,歡迎PR</string>
<string name="donate">捐贈</string>
<string name="sample_title">Sample:點擊自動設置</string>
<string name="hide_downloaded_detail">默認檢索當前下載路徑及子文件夾,使用配套python腳本可獲取更多圖庫pid記錄,方便起見提供<a href ="https://wwa.lanzous.com/iQB4Rigc7yh">PC打包藍奏雲</a> </string>
<string name="hide_downloaded_detail">默認檢索當前下載路徑及子文件夾,使用配套python腳本可獲取更多圖庫pid記錄,方便起見提供 </string>
<string name="hide_downloaded_summary">隱藏已下載功能可以附加非本機記錄:</string>
<string name="selectAll">全選</string>
<string name="sortPic">排序/篩選</string>
Expand All @@ -259,4 +258,6 @@
<string name="mirror_link_view">瀏覽時啟用鏡像</string>
<string name="icon_draw_by">你主人(探姬);HK流星(MD)繪製</string>
<string name="set_mirror">點擊可設置鏡像站</string>
<string name="login_expired">登錄狀態異常,請重新登錄</string>
<string name="token_expired">身份信息過期,請等待刷新</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,6 @@
<string name="i_pximg_net" translatable="false">i.pximg.net</string>
<string name="icon_draw_by">你主人(探姬);HK流星(MD)绘制</string>
<string name="set_mirror">点击可设置镜像站</string>
<string name="login_expired">登录过期,请重新登录</string>
<string name="token_expired">身份信息过期,请等待刷新</string>
</resources>

0 comments on commit aa1068b

Please sign in to comment.