Test blili open app
This commit is contained in:
parent
e6aabd75b6
commit
2b1dbb5c7d
|
|
@ -168,7 +168,7 @@ public class API {
|
|||
|
||||
private boolean isManyRequest(String result) {
|
||||
if (!result.contains("Too Many Requests")) return false;
|
||||
Init.show("洗洗睡吧,Too Many Requests。");
|
||||
Utils.notify("洗洗睡吧,Too Many Requests。");
|
||||
oauth.clean().save();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ public class API {
|
|||
shareToken = new JSONObject(result).getString("share_token");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Init.show("來晚啦,該分享已失效。");
|
||||
Utils.notify("來晚啦,該分享已失效。");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -537,7 +537,7 @@ public class API {
|
|||
frame.addView(image, params);
|
||||
dialog = new AlertDialog.Builder(Init.getActivity()).setView(frame).setOnCancelListener(this::dismiss).setOnDismissListener(this::dismiss).show();
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
Init.show("請使用阿里雲盤 App 掃描二維碼");
|
||||
Utils.notify("請使用阿里雲盤 App 掃描二維碼");
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
|
@ -553,7 +553,7 @@ public class API {
|
|||
|
||||
private void setToken(String value) {
|
||||
SpiderDebug.log("Token:" + value);
|
||||
Init.show("Token:" + value);
|
||||
Utils.notify("Token:" + value);
|
||||
user.setRefreshToken(value);
|
||||
refreshAccessToken();
|
||||
stopService();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.github.catvod.spider;
|
|||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.Uri;
|
||||
|
|
@ -259,7 +260,19 @@ public class Bili extends Spider {
|
|||
private void getQRCode() {
|
||||
String json = OkHttp.string("https://passport.bilibili.com/x/passport-login/web/qrcode/generate?source=main-mini");
|
||||
Data data = Resp.objectFrom(json).getData();
|
||||
Init.run(() -> showQRCode(data));
|
||||
Init.run(() -> openApp(data));
|
||||
}
|
||||
|
||||
private void openApp(Data data) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(data.getUrl()));
|
||||
Init.getActivity().startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
showQRCode(data);
|
||||
} finally {
|
||||
Init.execute(() -> startService(data));
|
||||
}
|
||||
}
|
||||
|
||||
private void showQRCode(Data data) {
|
||||
|
|
@ -273,8 +286,7 @@ public class Bili extends Spider {
|
|||
frame.addView(image, params);
|
||||
dialog = new AlertDialog.Builder(Init.getActivity()).setView(frame).setOnCancelListener(this::cancel).setOnDismissListener(this::dismiss).show();
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
Init.show("請使用 BiliBili App 掃描二維碼");
|
||||
Init.execute(() -> startService(data));
|
||||
Utils.notify("請使用 BiliBili App 掃描二維碼");
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
|
@ -299,7 +311,7 @@ public class Bili extends Spider {
|
|||
String[] splits = Uri.parse(url).getQuery().split("&");
|
||||
for (String split : splits) cookie.append(split).append(";");
|
||||
FileUtil.write(getUserCache(), this.cookie = cookie.toString());
|
||||
Init.show("請重新進入播放頁");
|
||||
Utils.notify("請重新進入播放頁");
|
||||
stopService();
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
f33f311e3cf29b98ec542f1b3492dbc8
|
||||
39ac2b741e8107753d27d46f56bcddca
|
||||
|
|
|
|||
Loading…
Reference in New Issue