Compare commits
793 Commits
feature-ca
...
v1.0.27.04
Author | SHA1 | Date | |
---|---|---|---|
34fb580271 | |||
97f8c4440c | |||
fa9d6f9bd6 | |||
a53429dc10 | |||
9666ab780a | |||
7705f703c8 | |||
773d39b125 | |||
b916a4fc56 | |||
4d49d6cfd3 | |||
bb50e501aa | |||
493e0949c8 | |||
46a76653f2 | |||
8d229fb53f | |||
68838f0b59 | |||
e420a71277 | |||
7c406e962d | |||
b8ef50a4b3 | |||
7273df70b7 | |||
943f6966e1 | |||
2a7ec0a716 | |||
a8a87c7b98 | |||
e763cf3d23 | |||
fc88abb23f | |||
a8c89e59b1 | |||
0654f601f4 | |||
09d8980001 | |||
c75c142199 | |||
b93504328e | |||
d4851701d6 | |||
42da40319a | |||
d35e7f007d | |||
3d5f5597cd | |||
a2e219f56f | |||
ec6b6b48a0 | |||
bbf91e2f8f | |||
e1ee626a0c | |||
7ba6cbbb66 | |||
d3be42e76f | |||
bd37541311 | |||
005c518b82 | |||
7d5ce08bfc | |||
fbf327cb9a | |||
ea61501e8b | |||
b10b147ce3 | |||
846bd31938 | |||
620b32aa71 | |||
982a52372f | |||
9320c04c1c | |||
c24c57a493 | |||
71566ba064 | |||
1ed098fd81 | |||
008c2488af | |||
003ca716b9 | |||
4d0ce7a59f | |||
3dcce42309 | |||
3088fd599b | |||
e7af7fe89b | |||
849c92f968 | |||
d63da3fff3 | |||
fe80caa1a3 | |||
fc89927f83 | |||
e0ce797700 | |||
68caefc0a3 | |||
905d13e674 | |||
c458de704b | |||
6a75f4ca2f | |||
8fa2129610 | |||
309575b8ea | |||
6d73900193 | |||
5b1f6042eb | |||
d0d10f13ee | |||
54f3bb166e | |||
892d4943d1 | |||
f6f492b51f | |||
cc5f432f4a | |||
a5e2414a75 | |||
e3b7aed888 | |||
ab45aa5899 | |||
efc2396ecb | |||
54a4aa88a1 | |||
05361c7fdd | |||
ddaf258062 | |||
f7ff6d7aa8 | |||
b3e55be43c | |||
5304120909 | |||
91856b5c21 | |||
0803444d74 | |||
9082f0299d | |||
46b16d5087 | |||
941b5cace7 | |||
9f0995021e | |||
d97ea88a7d | |||
1f9a65a5d2 | |||
66148cd1de | |||
75785c9ce8 | |||
f46a0b3f30 | |||
befbb14aa4 | |||
fb92e40e4d | |||
cea9eba5ab | |||
a3758bb6d7 | |||
341285a1cb | |||
9fe307f716 | |||
a57f10ccdb | |||
9afecbecdb | |||
c0371b3d78 | |||
c59fed5bc5 | |||
bb0a00d5b1 | |||
7ae5373831 | |||
5a9118271a | |||
333e3d1be4 | |||
d1c258cbcf | |||
efc67780bd | |||
24ca9209f8 | |||
eb07460046 | |||
c2d5866566 | |||
c667b1494a | |||
2c2df55704 | |||
2a096a91e0 | |||
d08e5df3c8 | |||
6f30165079 | |||
4db4e1f32b | |||
797abca902 | |||
89f6e01bbc | |||
5270f5a98a | |||
9bfae92ae7 | |||
5621c2d8e3 | |||
922b815ebd | |||
3c7189a260 | |||
54253e7be6 | |||
82f5f56555 | |||
968f862b7b | |||
1797f2ec93 | |||
7e602c0757 | |||
ae9ccbe44d | |||
513c9b94a9 | |||
b511519323 | |||
a9428fdc72 | |||
9ba4f2309f | |||
41f8de1580 | |||
6ca1295c78 | |||
1d37bd9f2a | |||
898cfa2ef1 | |||
95c9ea0da7 | |||
e552e41141 | |||
fb2be3a376 | |||
fe9d6c76d2 | |||
319b717eb9 | |||
12b490e86b | |||
00e47055b4 | |||
e51a98d8c4 | |||
5946a62443 | |||
386a8766ce | |||
4271756bab | |||
ec9da3b512 | |||
a795843d41 | |||
dd288d503b | |||
4507d3e40b | |||
975392d1bf | |||
cb8c7ea388 | |||
1b8b3947be | |||
72ee515ae5 | |||
a60e307273 | |||
ae51257aff | |||
6ceb8b3289 | |||
94616bac47 | |||
acf30851ec | |||
a97f42475c | |||
3c33fca659 | |||
354619c243 | |||
c61af96fcf | |||
25a39d1cbd | |||
6e970443ad | |||
a0583f39bc | |||
34fc3b08e6 | |||
de3b3d2c98 | |||
0e7dd7671a | |||
f7a164de76 | |||
92a0291fcc | |||
618d0f8a43 | |||
02b3d27928 | |||
0c858e753f | |||
832609e873 | |||
6dfce6a158 | |||
814f633bd2 | |||
8e8d172306 | |||
791809daa6 | |||
6978c76fcd | |||
4dba8dfc2f | |||
08e5871bd6 | |||
c6c4afd359 | |||
15a081d47a | |||
7706c919e9 | |||
9917506b5d | |||
3b75b0ce7d | |||
568642ad2f | |||
93a5b59ee7 | |||
b5ff6d1418 | |||
1ebbdfb6ca | |||
86023e46a6 | |||
f62eae55d2 | |||
e051e77856 | |||
21542b729d | |||
19864c0d78 | |||
fb58fe079b | |||
de83f156d8 | |||
295ff25b93 | |||
d6177b10bf | |||
89993895cb | |||
5c9fbbcfb2 | |||
0f5508e3ce | |||
a503d1bc5d | |||
f2c029b6e5 | |||
b5fa441faf | |||
2fbd1045db | |||
872a873d68 | |||
8e4bcb1311 | |||
14d9a998a0 | |||
01783b70ed | |||
976f0c7bec | |||
41e491daef | |||
34a6e1f79f | |||
c5b316415a | |||
d3ba67f33e | |||
52779c112f | |||
1eeaa051db | |||
d6f0297c4f | |||
aa5af22ba5 | |||
a99e114b63 | |||
9db8919345 | |||
d537872c81 | |||
9ec06f7295 | |||
4e99139cfd | |||
619f0810d2 | |||
979346233f | |||
fa0c870f54 | |||
164374b824 | |||
195fa48be3 | |||
74456da621 | |||
d34f166037 | |||
e2feaf9568 | |||
e141834bb4 | |||
38bddb236a | |||
7922806d21 | |||
04dd99c02f | |||
780ada983e | |||
12f2e743c6 | |||
3498507132 | |||
eaf1efd660 | |||
ab0bc4f000 | |||
92cbc38e93 | |||
c0512d5382 | |||
c0c1f9b95d | |||
cd3969174d | |||
3c10644f3c | |||
e863f32b1f | |||
56b001d560 | |||
c310786a69 | |||
60fd11bea1 | |||
27c05665aa | |||
32f392af64 | |||
c9b62b74c0 | |||
b54f7d0523 | |||
d0fc71aeb0 | |||
9d195f7a36 | |||
f4ccc442b3 | |||
5f085790ef | |||
2a15d1c081 | |||
547fad884f | |||
b89a11dcfb | |||
de81b5d37d | |||
411621016b | |||
2d375e31ea | |||
35a453aba7 | |||
d8e647097d | |||
3594019964 | |||
7ea2ce1575 | |||
92dfef2387 | |||
65a0bb5ff8 | |||
3f67718c39 | |||
1b25d821f3 | |||
e5c71bef64 | |||
3cdcec08a7 | |||
e6cf35ee34 | |||
828c913199 | |||
538cc1a530 | |||
3b3994a49a | |||
8d882f0220 | |||
2d3550924d | |||
148f4a680d | |||
994ee6a972 | |||
c80c156b8f | |||
c2b5d152ac | |||
b06b1d8a8a | |||
21fe663add | |||
59086dd84e | |||
448e5f823b | |||
d60bc7fa45 | |||
23e2e83636 | |||
ac9a2349c0 | |||
98597c48a3 | |||
77cd05212d | |||
d8699c2985 | |||
1f1d4fe5e9 | |||
43d70bbf75 | |||
4813e27ae3 | |||
72a8c33a66 | |||
e699df52e3 | |||
18e81b8dd4 | |||
570daa47d3 | |||
36ec1ba5b3 | |||
03e1cfe356 | |||
e707789986 | |||
91cdf6c49a | |||
26cc77fed3 | |||
c9bcece7b4 | |||
718dbdefff | |||
a5e2d96b98 | |||
0bce465eb7 | |||
781e859125 | |||
3e9b69b86a | |||
eaa3e5c349 | |||
29d4367316 | |||
0b8d329ec8 | |||
1c692a7ba0 | |||
b67471be6b | |||
39c6a75d8e | |||
24423f0c92 | |||
edca1ddd8c | |||
c8f7076b12 | |||
72608bd14d | |||
2e56f23391 | |||
869e43f74e | |||
d48886ab1b | |||
12a9e4746c | |||
aa231a86aa | |||
73c9c8e475 | |||
11c36b7a4c | |||
f3eb870b1a | |||
48e81ac85c | |||
1c8ed096f0 | |||
4d3f32a045 | |||
cd94ddbda4 | |||
ab09e554b3 | |||
d62ccdccec | |||
fc62f8c285 | |||
6d5471092e | |||
4bbc033872 | |||
8dc1688905 | |||
cbab31b164 | |||
aef673a1f1 | |||
828cd7eb11 | |||
774fd88516 | |||
e33a4c7fb7 | |||
dbb1a00142 | |||
4a7da8c1d2 | |||
53f266dcb8 | |||
fb26d35bb0 | |||
92b9e4f155 | |||
d40be085fe | |||
041552cc9a | |||
c65baa4337 | |||
56e8c5bf5f | |||
18960c1d02 | |||
f1bb21981a | |||
f598c81b53 | |||
ec7762644b | |||
5500a58c32 | |||
2ba72e3792 | |||
25c416f9bf | |||
9ec9fc2830 | |||
74f6b0ad1e | |||
3fa72f5340 | |||
c0f3b4f3a2 | |||
c6de1fa95a | |||
da9828a295 | |||
e212a32763 | |||
a20217bf39 | |||
336feb4fda | |||
53b103b853 | |||
fd54915399 | |||
157726c4c6 | |||
25272d6d1b | |||
af1163f6e0 | |||
d003f864ce | |||
dd7b226351 | |||
6c2eab86e9 | |||
d806de7d8f | |||
5cb3e578a8 | |||
8f9fbf5d41 | |||
9845f0383a | |||
fb3be848b4 | |||
7d7df17317 | |||
aae08d0688 | |||
9fe5b78cfa | |||
6b028c36af | |||
92c385ff58 | |||
463ee1d5b5 | |||
0a416c95bc | |||
3d09d80007 | |||
fffa15faa3 | |||
d6b972a8ab | |||
d6fd299395 | |||
1953653044 | |||
9faa625d52 | |||
955d8f5401 | |||
1f75a7e781 | |||
2cd8ab7d27 | |||
7e7bb1f43a | |||
a925ef63eb | |||
f8326e7cb5 | |||
02d2598d01 | |||
862ccea879 | |||
031d57e1fd | |||
77b509fd17 | |||
4db5a950f3 | |||
c9327c97e5 | |||
8ff387d54a | |||
11e907d74b | |||
6298711528 | |||
72f1a82650 | |||
b5a46d1be0 | |||
7b15f19895 | |||
14338dc33d | |||
c216c9bd65 | |||
3701fdef97 | |||
59641f0216 | |||
4dbcd2e0ec | |||
6d276fce4c | |||
0f0546ae59 | |||
710361caea | |||
00b81b194f | |||
734db176bf | |||
c23fe9c2bf | |||
79fcd017ab | |||
64292d523f | |||
42ed67e03f | |||
af96d16062 | |||
12c299685b | |||
1182a58cb4 | |||
e04a7e5702 | |||
e9dc6f7fdb | |||
25d1ccc87a | |||
33d28f51d1 | |||
a37f3b8b5b | |||
a57f5e8b2f | |||
beb640ac83 | |||
1b54f07bc3 | |||
fca0588377 | |||
4865948609 | |||
09eb180fc7 | |||
3fab47780b | |||
453cbd7b1c | |||
0bf2326c73 | |||
2985c624ab | |||
32cbc2759e | |||
13c77957fe | |||
f382c8f377 | |||
491bc87251 | |||
b13d7b475b | |||
5e8d9b524b | |||
606f1b5c64 | |||
c4fec14517 | |||
f368ef83ee | |||
357133fa97 | |||
337cdafef3 | |||
bc74e32c10 | |||
a5558de872 | |||
73693c5bbb | |||
2ad9c3c993 | |||
cab74cff17 | |||
a161df2c7b | |||
4def3ffb80 | |||
da2bbeedff | |||
70317f92e2 | |||
bc9ea43cd2 | |||
882957e2f8 | |||
d3766ae31b | |||
641cf4ebb3 | |||
99e6abdad9 | |||
1eb2d23fb9 | |||
98aaca286b | |||
dc1edf7e73 | |||
31405750e6 | |||
6fdfcb888d | |||
3ece2bb173 | |||
b7b75e956f | |||
bf37c33291 | |||
06fb3e8d2f | |||
504be6fbda | |||
df4539a035 | |||
a3e1fd4e91 | |||
f41bb02bae | |||
105a29f311 | |||
3bf6136bc6 | |||
ab24da5f55 | |||
ed0b43eff1 | |||
ab9ae3a481 | |||
d728b1fb6d | |||
12e947ef84 | |||
3fad86e7e3 | |||
fea70011cb | |||
32cdb27f7c | |||
eb4435045b | |||
f1b829cec1 | |||
b248158e62 | |||
83b0ff02e4 | |||
8109314aaf | |||
c4b3446956 | |||
d804d95d78 | |||
234dfe9d64 | |||
c20df8fd81 | |||
19f0b1b28f | |||
481fa0d934 | |||
caca16a957 | |||
602d795909 | |||
800f714f4a | |||
75f569cb79 | |||
0e888537e8 | |||
a3ce15bd9e | |||
40f94e7ace | |||
370dcaf419 | |||
f81f348a3e | |||
4191cafe78 | |||
ae33cbf7ca | |||
fca7c36203 | |||
5fc783ebc2 | |||
98122aeaae | |||
f0d8e2a122 | |||
f815affff9 | |||
fce701090a | |||
d6da2a8a47 | |||
b3e162c8d3 | |||
e5eae93a78 | |||
962dcca6d4 | |||
be56fb721f | |||
ce1c80fd86 | |||
33ef18ef1d | |||
ba61e38c9b | |||
0b0db1a2b1 | |||
a9d73a9f1b | |||
0b5397ec00 | |||
466214b26a | |||
699be4125b | |||
45cc46d6d6 | |||
3f9fcabc2d | |||
65d2bfd844 | |||
4642c2a847 | |||
04186cdd5b | |||
40cc4e0dd1 | |||
95bc4a9f46 | |||
3bf3fd9a46 | |||
83ad11402f | |||
cfeb0588c1 | |||
381e832f3c | |||
6c20a434ed | |||
fc2da3ce57 | |||
a3abed0a03 | |||
db03cdd442 | |||
542975d0ec | |||
ee368d348d | |||
835ea0a9ff | |||
89501d3daa | |||
90c0256766 | |||
c2767486f5 | |||
e2489ef0e3 | |||
b2a4c54565 | |||
bf071ea9e1 | |||
f8a8c0967a | |||
078e4716b4 | |||
4da6667b81 | |||
e2befb11ff | |||
cb0ff334b3 | |||
e536f58ff4 | |||
d9992663d8 | |||
b1a05c5c27 | |||
02cc164635 | |||
35dc94014c | |||
5746b85b27 | |||
740d5f1ddd | |||
a0f92df5b5 | |||
fce96d4976 | |||
dd6c537135 | |||
bcf94e287a | |||
841d0f25f5 | |||
4811dc5ba5 | |||
41af6c799b | |||
e8f63f6114 | |||
d1e8068e51 | |||
6de9b1977c | |||
3c0f54bfd7 | |||
3d2c6a122a | |||
8950658f08 | |||
7a78729a44 | |||
03e5e22fef | |||
aa93ce0b89 | |||
0c365ad049 | |||
3d5c578fef | |||
0a22f0f543 | |||
5bf7b69d79 | |||
d57f84a1d7 | |||
32b2f0ceff | |||
bae871cfa1 | |||
d95fe9fe14 | |||
eb006e4c55 | |||
cb88d0c9ae | |||
3efad736ae | |||
42ad959155 | |||
cdf800c49f | |||
569277572a | |||
19b84571c1 | |||
0812b8339e | |||
b817a0c807 | |||
3da70d7e27 | |||
5e59db85be | |||
77477ff4dd | |||
89026e671c | |||
1c8e7e53a5 | |||
b264427be6 | |||
d5134f972d | |||
e2fd01a6d5 | |||
289cc99bc2 | |||
3d5ebe7e99 | |||
d9964d37a4 | |||
5da39a9c52 | |||
44a162762c | |||
d0f036ec35 | |||
10b928474b | |||
94f3b7c1e4 | |||
fb8b2de115 | |||
0d5d33a365 | |||
c39e91073b | |||
d258474a5a | |||
b0c56feef5 | |||
191472d0c4 | |||
40c666e3d1 | |||
63d600070b | |||
ebdeec6730 | |||
ee2a273d8b | |||
083739e562 | |||
71ccb9c0e5 | |||
4a5f4ca2ca | |||
78ade4a193 | |||
ae14653e72 | |||
01ac2c13e1 | |||
9e471b83d9 | |||
a560d66567 | |||
80b39daaff | |||
fb32388536 | |||
5f92a0c293 | |||
3de009ac43 | |||
b29256f598 | |||
e7cf472a0f | |||
03c59d23b8 | |||
b6f805f0e4 | |||
e23c2469ed | |||
387c799de1 | |||
230dd81342 | |||
47bdfec8c2 | |||
6a844da259 | |||
18bb58d293 | |||
045186b3c8 | |||
b531599893 | |||
1da84508d8 | |||
4c44fab217 | |||
5c3d438a7e | |||
92a8efdee1 | |||
eb1e2ca5f4 | |||
5b1022628c | |||
33f61ac0fa | |||
0b349e102e | |||
81371c5a31 | |||
85a59e11b9 | |||
e24ccc16fa | |||
89a43b1285 | |||
ea8af28828 | |||
8a2c023343 | |||
a86fe76e59 | |||
d703e38c3f | |||
9e93b50860 | |||
9907967a0a | |||
331969cc8d | |||
7157f89245 | |||
163bb3c8da | |||
33f71c62df | |||
365c367cc7 | |||
7ea95e550b | |||
699361e04c | |||
e835821f3c | |||
76d5f6333e | |||
91899a9537 | |||
5591bb3dbf | |||
1adbdf127f | |||
8169f5739c | |||
127c6734f8 | |||
a78ce4f6d4 | |||
22a2628513 | |||
e972d17f1c | |||
e603942b5f | |||
0c4bad406e | |||
791047753d | |||
3784f1f87b | |||
c0162892ef | |||
10d2995429 | |||
b0d8f5d0b6 | |||
a64a49df22 | |||
349de75dfd | |||
1014c26d29 | |||
d1bacf8950 | |||
0595648f4c | |||
23c8b34189 | |||
932be48125 | |||
791eed8a01 | |||
e791210039 | |||
01fa3c1cb3 | |||
9663278916 | |||
1b03f3f31f | |||
a73f2974e1 | |||
bf8ae0f317 | |||
545def36e6 | |||
aaeecc9e53 | |||
16895b5c32 | |||
a68c04001b | |||
1dd70f482f | |||
103423abf7 | |||
569184a507 | |||
e052c6eafe | |||
dad4a28eb8 | |||
7428cde108 | |||
9e40e162ac | |||
27c954ec95 | |||
ec98e5c73c | |||
538b3d88aa | |||
aa4e251295 | |||
32f84dc703 | |||
c8e157b2d6 | |||
9122dd7f3a | |||
41ddeab41a | |||
5ca841de4e | |||
ca6091b90d | |||
5169bc360c | |||
4673f6dc5b | |||
5da6f2b021 | |||
53ce81673b | |||
e991f36853 | |||
211b7812de | |||
70cf27789f | |||
931a513ac5 | |||
c4bf7d3a3b | |||
b9cfcf9c9e | |||
a418f457f5 | |||
83e68c8ee3 | |||
d26066ff84 | |||
4000e1b9dc | |||
02bdb46625 | |||
96737ded5b | |||
6654094480 | |||
0cc25203b1 | |||
9294c8bcdf | |||
8f661337f5 | |||
db6662c980 | |||
2dc7cf28c9 | |||
c9fd6304fd | |||
4d1e4511a3 | |||
449aa69033 | |||
5fa32f1e2b | |||
71bb4b30d2 | |||
8b0cb4c909 | |||
79729e4b30 | |||
7cf9e66a5b | |||
917cff6311 | |||
7c120aa0cc | |||
2c7ce60f42 | |||
e4ebe6e145 | |||
5d0ca3f84c | |||
49dfb2605c | |||
cfddcd79bd | |||
a07a1697c2 | |||
21259e260d | |||
438b392cfc | |||
ac69896f9d | |||
f5263b090a | |||
bde7e35623 | |||
a0488f2c75 | |||
e8f7995b32 | |||
042a0a848d | |||
a98d8537c7 | |||
8ebb4cc70e | |||
fa8fd42e9a | |||
aa94bf27ff | |||
a2524e0a60 | |||
9a9644c3eb | |||
d0f8d55c9f | |||
367d8b844a |
208
.github/workflows/beta_ci.yml
vendored
Normal file
208
.github/workflows/beta_ci.yml
vendored
Normal file
@ -0,0 +1,208 @@
|
||||
name: Pilipala Beta
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- "x-main"
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "**.txt"
|
||||
- ".github/**"
|
||||
- ".idea/**"
|
||||
- "!.github/workflows/**"
|
||||
|
||||
jobs:
|
||||
update_version:
|
||||
name: Read and update version
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
# 定义输出变量 version,以便在其他job中引用
|
||||
new_version: ${{ steps.version.outputs.new_version }}
|
||||
last_commit: ${{ steps.get-last-commit.outputs.last_commit }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref_name }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 获取first parent commit次数
|
||||
id: get-first-parent-commit-count
|
||||
run: |
|
||||
version=$(yq e .version pubspec.yaml | cut -d "+" -f 1)
|
||||
recent_release_tag=$(git tag -l | grep $version | egrep -v "[-|+]" || true)
|
||||
if [[ "x$recent_release_tag" == "x" ]]; then
|
||||
echo "当前版本tag不存在,请手动生成tag."
|
||||
exit 1
|
||||
fi
|
||||
git log --oneline --first-parent $recent_release_tag..HEAD
|
||||
first_parent_commit_count=$(git rev-list --first-parent --count $recent_release_tag..HEAD)
|
||||
echo "count=$first_parent_commit_count" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 获取最后一次提交
|
||||
id: get-last-commit
|
||||
run: |
|
||||
last_commit=$(git log -1 --pretty="%h %s" --first-parent)
|
||||
echo "last_commit=$last_commit" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 更新版本号
|
||||
id: version
|
||||
run: |
|
||||
# 读取版本号
|
||||
VERSION=$(yq e .version pubspec.yaml | cut -d "+" -f 1)
|
||||
|
||||
# 获取GitHub Actions的run_number
|
||||
#RUN_NUMBER=${{ github.run_number }}
|
||||
|
||||
# 构建新版本号
|
||||
NEW_VERSION=$VERSION-beta.${{ steps.get-first-parent-commit-count.outputs.count }}
|
||||
|
||||
# 输出新版本号
|
||||
echo "New version: $NEW_VERSION"
|
||||
|
||||
# 设置新版本号为输出变量
|
||||
echo "new_version=$NEW_VERSION" >>$GITHUB_OUTPUT
|
||||
|
||||
android:
|
||||
name: Build CI (Android)
|
||||
needs: update_version
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref_name }}
|
||||
|
||||
- name: 构建Java环境
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: "zulu"
|
||||
java-version: "17"
|
||||
token: ${{secrets.GIT_TOKEN}}
|
||||
|
||||
- name: 检查缓存
|
||||
uses: actions/cache@v2
|
||||
id: cache-flutter
|
||||
with:
|
||||
path: /root/flutter-sdk
|
||||
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
|
||||
|
||||
- name: 安装Flutter
|
||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.19.6
|
||||
channel: any
|
||||
|
||||
- name: 下载项目依赖
|
||||
run: flutter pub get
|
||||
|
||||
- name: 解码生成 jks
|
||||
run: echo $KEYSTORE_BASE64 | base64 -di > android/app/vvex.jks
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
|
||||
- name: 更新版本号
|
||||
id: version
|
||||
run: |
|
||||
# 更新pubspec.yaml文件中的版本号
|
||||
sed -i "s/version: .*+/version: ${{ needs.update_version.outputs.new_version }}+/g" pubspec.yaml
|
||||
|
||||
- name: flutter build apk
|
||||
run: flutter build apk --release --split-per-abi
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
|
||||
|
||||
- name: 重命名应用
|
||||
run: |
|
||||
for file in build/app/outputs/flutter-apk/app-*.apk; do
|
||||
if [[ $file =~ app-(.?*)release.apk ]]; then
|
||||
new_file_name="build/app/outputs/flutter-apk/Pili-${BASH_REMATCH[1]}v${{ needs.update_version.outputs.new_version }}.apk"
|
||||
mv "$file" "$new_file_name"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: 上传
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Pilipala-Beta
|
||||
path: |
|
||||
build/app/outputs/flutter-apk/Pili-*.apk
|
||||
|
||||
iOS:
|
||||
name: Build CI (iOS)
|
||||
needs: update_version
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref_name }}
|
||||
|
||||
- name: 安装Flutter
|
||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||
uses: subosito/flutter-action@v2.10.0
|
||||
with:
|
||||
cache: true
|
||||
flutter-version: 3.16.5
|
||||
|
||||
- name: 更新版本号
|
||||
id: version
|
||||
run: |
|
||||
# 更新pubspec.yaml文件中的版本号
|
||||
sed -i "" "s/version: .*+/version: ${{ needs.update_version.outputs.new_version }}+/g" pubspec.yaml
|
||||
|
||||
- name: flutter build ipa
|
||||
run: |
|
||||
flutter build ios --release --no-codesign
|
||||
ln -sf ./build/ios/iphoneos Payload
|
||||
zip -r9 app.ipa Payload/runner.app
|
||||
|
||||
- name: 重命名应用
|
||||
run: |
|
||||
DATE=${{ steps.date.outputs.date }}
|
||||
for file in app.ipa; do
|
||||
new_file_name="build/Pili-v${{ needs.update_version.outputs.new_version }}.ipa"
|
||||
mv "$file" "$new_file_name"
|
||||
done
|
||||
|
||||
- name: 上传
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
if-no-files-found: error
|
||||
name: Pilipala-Beta
|
||||
path: |
|
||||
build/Pili-*.ipa
|
||||
|
||||
upload:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs:
|
||||
- update_version
|
||||
- android
|
||||
- iOS
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: Pilipala-Beta
|
||||
path: ./Pilipala-Beta
|
||||
|
||||
- name: 发送到Telegram频道
|
||||
uses: xireiki/channel-post@v1.0.7
|
||||
with:
|
||||
bot_token: ${{ secrets.BOT_TOKEN }}
|
||||
chat_id: ${{ secrets.CHAT_ID }}
|
||||
large_file: true
|
||||
api_id: ${{ secrets.TELEGRAM_API_ID }}
|
||||
api_hash: ${{ secrets.TELEGRAM_API_HASH }}
|
||||
method: sendFile
|
||||
path: Pilipala-Beta/*
|
||||
parse_mode: Markdown
|
||||
context: "*Beta版本: v${{ needs.update_version.outputs.new_version }}*\n更新内容: [${{ needs.update_version.outputs.last_commit }}]"
|
84
.github/workflows/main.yml
vendored
84
.github/workflows/main.yml
vendored
@ -1,84 +0,0 @@
|
||||
name: build_apk
|
||||
|
||||
# action事件触发
|
||||
on:
|
||||
push:
|
||||
# push tag时触发
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
|
||||
# 可以有多个jobs
|
||||
jobs:
|
||||
build_apk:
|
||||
# 运行环境 ubuntu-latest window-latest mac-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# 每个jobs中可以有多个steps
|
||||
steps:
|
||||
- name: 代码迁出
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 构建Java环境
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: "zulu"
|
||||
java-version: "17"
|
||||
token: ${{secrets.GIT_TOKEN}}
|
||||
|
||||
- name: 检查缓存
|
||||
uses: actions/cache@v2
|
||||
id: cache-flutter
|
||||
with:
|
||||
path: /root/flutter-sdk # Flutter SDK 的路径
|
||||
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
|
||||
|
||||
- name: 安装Flutter
|
||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.16.4
|
||||
channel: any
|
||||
|
||||
- name: 下载项目依赖
|
||||
run: flutter pub get
|
||||
|
||||
- name: 解码生成 jks
|
||||
run: echo $KEYSTORE_BASE64 | base64 -di > android/app/vvex.jks
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
|
||||
- name: flutter build apk
|
||||
# 对应 android/app/build.gradle signingConfigs中的配置项
|
||||
run: flutter build apk --release --split-per-abi
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
|
||||
|
||||
- name: 获取版本号
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
|
||||
|
||||
# - name: 获取当前日期
|
||||
# id: date
|
||||
# run: echo "date=$(date +'%m%d')" >>$GITHUB_OUTPUT
|
||||
|
||||
- name: 重命名应用 Pili-arm64-v8a-*.*.*.0101.apk
|
||||
run: |
|
||||
# DATE=${{ steps.date.outputs.date }}
|
||||
for file in build/app/outputs/flutter-apk/app-*-release.apk; do
|
||||
if [[ $file =~ app-(.*)-release.apk ]]; then
|
||||
new_file_name="build/app/outputs/flutter-apk/Pili-${BASH_REMATCH[1]}-${{ steps.version.outputs.version }}.apk"
|
||||
mv "$file" "$new_file_name"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: 构建和发布release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
# release title
|
||||
name: v${{ steps.version.outputs.version }}
|
||||
artifacts: "build/app/outputs/flutter-apk/Pili-*.apk"
|
||||
bodyFile: "change_log/${{steps.version.outputs.version}}.md"
|
||||
token: ${{ secrets.GIT_TOKEN }}
|
||||
allowUpdates: true
|
157
.github/workflows/release_ci.yml
vendored
Normal file
157
.github/workflows/release_ci.yml
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
name: Pilipala Release
|
||||
|
||||
# action事件触发
|
||||
on:
|
||||
push:
|
||||
# push tag时触发
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
# 可以有多个jobs
|
||||
jobs:
|
||||
android:
|
||||
# 运行环境 ubuntu-latest window-latest mac-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# 每个jobs中可以有多个steps
|
||||
steps:
|
||||
- name: 代码迁出
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 构建Java环境
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: "zulu"
|
||||
java-version: "17"
|
||||
token: ${{secrets.GIT_TOKEN}}
|
||||
|
||||
- name: 检查缓存
|
||||
uses: actions/cache@v2
|
||||
id: cache-flutter
|
||||
with:
|
||||
path: /root/flutter-sdk # Flutter SDK 的路径
|
||||
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
|
||||
|
||||
- name: 安装Flutter
|
||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.19.6
|
||||
channel: any
|
||||
|
||||
- name: 下载项目依赖
|
||||
run: flutter pub get
|
||||
|
||||
- name: 解码生成 jks
|
||||
run: echo $KEYSTORE_BASE64 | base64 -di > android/app/vvex.jks
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
|
||||
- name: flutter build apk
|
||||
run: flutter build apk --release --split-per-abi
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
|
||||
|
||||
- name: flutter build apk
|
||||
run: flutter build apk --release
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
|
||||
|
||||
- name: 获取版本号
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
|
||||
|
||||
# - name: 获取当前日期
|
||||
# id: date
|
||||
# run: echo "date=$(date +'%m%d')" >>$GITHUB_OUTPUT
|
||||
|
||||
- name: 重命名应用
|
||||
run: |
|
||||
# DATE=${{ steps.date.outputs.date }}
|
||||
for file in build/app/outputs/flutter-apk/app-*.apk; do
|
||||
if [[ $file =~ app-(.?*)release.apk ]]; then
|
||||
new_file_name="build/app/outputs/flutter-apk/Pili-${BASH_REMATCH[1]}${{ steps.version.outputs.version }}.apk"
|
||||
mv "$file" "$new_file_name"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: 上传
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Pilipala-Release
|
||||
path: |
|
||||
build/app/outputs/flutter-apk/Pili-*.apk
|
||||
|
||||
iOS:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: 代码迁出
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 安装Flutter
|
||||
if: steps.cache-flutter.outputs.cache-hit != 'true'
|
||||
uses: subosito/flutter-action@v2.10.0
|
||||
with:
|
||||
cache: true
|
||||
flutter-version: 3.19.6
|
||||
|
||||
- name: flutter build ipa
|
||||
run: |
|
||||
flutter build ios --release --no-codesign
|
||||
ln -sf ./build/ios/iphoneos Payload
|
||||
zip -r9 app.ipa Payload/runner.app
|
||||
|
||||
- name: 获取版本号
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
|
||||
|
||||
- name: 重命名应用
|
||||
run: |
|
||||
DATE=${{ steps.date.outputs.date }}
|
||||
for file in app.ipa; do
|
||||
new_file_name="build/Pili-${{ steps.version.outputs.version }}.ipa"
|
||||
mv "$file" "$new_file_name"
|
||||
done
|
||||
|
||||
- name: 上传
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
if-no-files-found: error
|
||||
name: Pilipala-Release
|
||||
path: |
|
||||
build/Pili-*.ipa
|
||||
|
||||
upload:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs:
|
||||
- android
|
||||
- iOS
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: Pilipala-Release
|
||||
path: ./Pilipala-Release
|
||||
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install tree -y
|
||||
|
||||
- name: Get version
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
|
||||
|
||||
- name: Upload Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
name: v${{ steps.version.outputs.version }}
|
||||
token: ${{ secrets.GIT_TOKEN }}
|
||||
omitBodyDuringUpdate: true
|
||||
omitNameDuringUpdate: true
|
||||
omitPrereleaseDuringUpdate: true
|
||||
allowUpdates: true
|
||||
artifacts: Pilipala-Release/*
|
106
.gitignore
vendored
106
.gitignore
vendored
@ -21,6 +21,29 @@ migrate_working_dir/
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter repo-specific
|
||||
/bin/cache/
|
||||
/bin/internal/bootstrap.bat
|
||||
/bin/internal/bootstrap.sh
|
||||
/bin/mingit/
|
||||
/dev/benchmarks/mega_gallery/
|
||||
/dev/bots/.recipe_deps
|
||||
/dev/bots/android_tools/
|
||||
/dev/devicelab/ABresults*.json
|
||||
/dev/docs/doc/
|
||||
/dev/docs/api_docs.zip
|
||||
/dev/docs/flutter.docs.zip
|
||||
/dev/docs/lib/
|
||||
/dev/docs/pubspec.yaml
|
||||
/dev/integration_tests/**/xcuserdata
|
||||
/dev/integration_tests/**/Pods
|
||||
/packages/flutter/coverage/
|
||||
version
|
||||
analysis_benchmark.json
|
||||
|
||||
# packages file containing multi-root paths
|
||||
.packages.generated
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
**/ios/Flutter/.last_build_id
|
||||
@ -31,14 +54,83 @@ migrate_working_dir/
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
flutter_*.png
|
||||
linked_*.ds
|
||||
unlinked.ds
|
||||
unlinked_spec.ds
|
||||
|
||||
# Obfuscation related
|
||||
app.*.map.json
|
||||
|
||||
# Android Studio will place build artifacts here
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
# Android related
|
||||
**/android/**/gradle-wrapper.jar
|
||||
.gradle/
|
||||
**/android/captures/
|
||||
**/android/gradlew
|
||||
**/android/gradlew.bat
|
||||
**/android/local.properties
|
||||
**/android/**/GeneratedPluginRegistrant.java
|
||||
**/android/key.properties
|
||||
*.jks
|
||||
|
||||
# iOS/XCode related
|
||||
**/ios/**/*.mode1v3
|
||||
**/ios/**/*.mode2v3
|
||||
**/ios/**/*.moved-aside
|
||||
**/ios/**/*.pbxuser
|
||||
**/ios/**/*.perspectivev3
|
||||
**/ios/**/*sync/
|
||||
**/ios/**/.sconsign.dblite
|
||||
**/ios/**/.tags*
|
||||
**/ios/**/.vagrant/
|
||||
**/ios/**/DerivedData/
|
||||
**/ios/**/Icon?
|
||||
**/ios/**/Pods/
|
||||
**/ios/**/.symlinks/
|
||||
**/ios/**/profile
|
||||
**/ios/**/xcuserdata
|
||||
**/ios/.generated/
|
||||
**/ios/Flutter/.last_build_id
|
||||
**/ios/Flutter/App.framework
|
||||
**/ios/Flutter/Flutter.framework
|
||||
**/ios/Flutter/Flutter.podspec
|
||||
**/ios/Flutter/Generated.xcconfig
|
||||
**/ios/Flutter/ephemeral
|
||||
**/ios/Flutter/app.flx
|
||||
**/ios/Flutter/app.zip
|
||||
**/ios/Flutter/flutter_assets/
|
||||
**/ios/Flutter/flutter_export_environment.sh
|
||||
**/ios/ServiceDefinitions.json
|
||||
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# macOS
|
||||
**/Flutter/ephemeral/
|
||||
**/Pods/
|
||||
**/macos/Flutter/GeneratedPluginRegistrant.swift
|
||||
**/macos/Flutter/ephemeral
|
||||
**/xcuserdata/
|
||||
|
||||
# Windows
|
||||
**/windows/flutter/generated_plugin_registrant.cc
|
||||
**/windows/flutter/generated_plugin_registrant.h
|
||||
**/windows/flutter/generated_plugins.cmake
|
||||
|
||||
# Linux
|
||||
**/linux/flutter/generated_plugin_registrant.cc
|
||||
**/linux/flutter/generated_plugin_registrant.h
|
||||
**/linux/flutter/generated_plugins.cmake
|
||||
|
||||
# Coverage
|
||||
coverage/
|
||||
|
||||
# Symbols
|
||||
app.*.symbols
|
||||
|
||||
# Exceptions to above rules.
|
||||
!**/ios/**/default.mode1v3
|
||||
!**/ios/**/default.mode2v3
|
||||
!**/ios/**/default.pbxuser
|
||||
!**/ios/**/default.perspectivev3
|
||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||
!/dev/ci/**/Gemfile.lock
|
||||
!.vscode/settings.json
|
77
README.md
77
README.md
@ -2,8 +2,6 @@
|
||||
<img width="200" height="200" src="https://github.com/guozhigq/pilipala/blob/main/assets/images/logo/logo_android.png">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div align="center">
|
||||
<h1>PiliPala</h1>
|
||||
<div align="center">
|
||||
@ -11,8 +9,9 @@
|
||||

|
||||

|
||||

|
||||
|
||||
</div>
|
||||
<p>使用Flutter开发的BiliBili第三方客户端</p>
|
||||
<p>使用 Flutter 开发的 BiliBili 第三方客户端</p>
|
||||
|
||||
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/screenshots/510shots_so.png" width="32%" alt="home" />
|
||||
<img src="https://github.com/guozhigq/pilipala/blob/main/assets/screenshots/174shots_so.png" width="32%" alt="home" />
|
||||
@ -23,46 +22,41 @@
|
||||
</div>
|
||||
|
||||
## 开发环境
|
||||
Xcode 13.4 不支持**auto_orientation**,请注释相关代码
|
||||
|
||||
Xcode 13.4 不支持 ```auto_orientation```,请注释相关代码
|
||||
|
||||
```bash
|
||||
[✓] Flutter (Channel stable, 3.16.4, on macOS 14.1.2 23B92 darwin-arm64, locale
|
||||
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.1.2 23B92 darwin-arm64, locale
|
||||
zh-Hans-CN)
|
||||
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
|
||||
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
|
||||
[✓] Chrome - develop for the web
|
||||
[✓] Android Studio (version 2022.3)
|
||||
[✓] VS Code (version 1.85.1)
|
||||
[✓] VS Code (version 1.87.2)
|
||||
[✓] Connected device (3 available)
|
||||
[✓] Network resources
|
||||
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
|
||||
## 技术交流
|
||||
|
||||
Telegram: https://t.me/+lm_oOVmF0RJiODk1
|
||||
QQ频道: https://pd.qq.com/s/365esodk3
|
||||
Telegram: [https://t.me/+1DFtqS6usUM5MDNl](https://t.me/+1DFtqS6usUM5MDNl)
|
||||
|
||||
Telegram Beta 版本:@PiliPala_Beta
|
||||
|
||||
<br/>
|
||||
QQ 频道: https://pd.qq.com/s/365esodk3
|
||||
|
||||
## 功能
|
||||
|
||||
目前着重移动端(Android、iOS),暂时没有适配桌面端、Pad端、手表端等
|
||||
|
||||
<br/>
|
||||
目前着重移动端 (Android、iOS),暂时没有适配桌面端、Pad 端、手表端等
|
||||
|
||||
现有功能及[开发计划](https://github.com/users/guozhigq/projects/5)
|
||||
|
||||
|
||||
- [x] 推荐视频列表(app端)
|
||||
- [x] 推荐视频列表 (app 端)
|
||||
- [x] 最热视频列表
|
||||
- [x] 热门直播
|
||||
- [x] 番剧列表
|
||||
- [x] 屏蔽黑名单内用户视频
|
||||
- [x] 排行榜
|
||||
|
||||
- [x] 用户相关
|
||||
- [x] 粉丝、关注用户、拉黑用户查看
|
||||
@ -72,11 +66,13 @@ QQ频道: https://pd.qq.com/s/365esodk3
|
||||
- [x] 稍后再看
|
||||
- [x] 观看记录
|
||||
- [x] 我的收藏
|
||||
- [x] 黑名单管理
|
||||
|
||||
- [x] 动态相关
|
||||
- [x] 全部、投稿、番剧分类查看
|
||||
- [x] 动态评论查看
|
||||
- [x] 动态评论回复功能
|
||||
- [x] 动态未读标记
|
||||
|
||||
- [x] 视频播放相关
|
||||
- [x] 双击快进/快退
|
||||
@ -85,15 +81,17 @@ QQ频道: https://pd.qq.com/s/365esodk3
|
||||
- [x] 垂直方向上滑全屏、下滑退出全屏
|
||||
- [x] 水平方向手势快进/快退
|
||||
- [x] 全屏方向设置
|
||||
- [x] 倍速选择/长按2倍速
|
||||
- [x] 硬件加速(视机型而定)
|
||||
- [x] 画质选择(高清画质未解锁)
|
||||
- [x] 音质选择(视视频而定)
|
||||
- [x] 解码格式选择(视视频而定)
|
||||
- [x] 倍速选择/长按 2 倍速
|
||||
- [x] 硬件加速 (视机型而定)
|
||||
- [x] 画质选择 (高清画质未解锁)
|
||||
- [x] 音质选择 (视视频而定)
|
||||
- [x] 解码格式选择 (视视频而定)
|
||||
- [x] 弹幕
|
||||
- [ ] 字幕
|
||||
- [x] 字幕
|
||||
- [x] 记忆播放
|
||||
- [x] 视频比例:高度/宽度适应、填充、包含等
|
||||
- [x] 视频快照
|
||||
- [x] 直播弹幕
|
||||
|
||||
- [x] 搜索相关
|
||||
- [x] 热搜
|
||||
@ -103,12 +101,12 @@ QQ频道: https://pd.qq.com/s/365esodk3
|
||||
- [x] 视频搜索排序、按时长筛选
|
||||
|
||||
- [x] 视频详情页相关
|
||||
- [x] 视频选集(分p)切换
|
||||
- [x] 视频选集 (分 p) 切换
|
||||
- [x] 点赞、投币、收藏/取消收藏
|
||||
- [x] 相关视频查看
|
||||
- [x] 评论用户身份标识
|
||||
- [x] 评论(排序)查看、二楼评论查看
|
||||
- [x] 主楼、二楼评论回复功能
|
||||
- [x] 评论 (排序) 查看、二楼评论查看
|
||||
- [x] 主楼、二楼评论/表情回复功能
|
||||
- [x] 评论点赞
|
||||
- [x] 评论笔记图片查看、保存
|
||||
|
||||
@ -116,29 +114,30 @@ QQ频道: https://pd.qq.com/s/365esodk3
|
||||
- [x] 画质、音质、解码方式预设
|
||||
- [x] 图片质量设定
|
||||
- [x] 主题模式:亮色/暗色/跟随系统
|
||||
- [x] 震动反馈(可选)
|
||||
- [x] 震动反馈 (可选)
|
||||
- [x] 高帧率
|
||||
- [x] 自动全屏
|
||||
- [ ] 等等
|
||||
|
||||
<br/>
|
||||
|
||||
## 下载
|
||||
|
||||
可以通过右侧release进行下载或拉取代码到本地进行编译
|
||||
可以通过右侧 Releases 进行下载或拉取代码到本地进行编译
|
||||
|
||||
<br/>
|
||||
### 从 F-Droid 安装
|
||||
|
||||
<a href="https://f-droid.org/packages/com.guozhigq.pilipala">
|
||||
<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-zh-cn.png"
|
||||
alt="Get it on F-Droid"
|
||||
height="80">
|
||||
</a>
|
||||
|
||||
## 声明
|
||||
|
||||
此项目(PiliPala)是个人为了兴趣而开发, 仅用于学习和测试。
|
||||
所用API皆从官方网站收集, 不提供任何破解内容。
|
||||
此项目 (PiliPala) 是个人为了兴趣而开发, 仅用于学习和测试。
|
||||
所用 API 皆从官方网站收集, 不提供任何破解内容。
|
||||
|
||||
感谢使用
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
## 致谢
|
||||
|
||||
- [bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect)
|
||||
@ -146,7 +145,3 @@ QQ频道: https://pd.qq.com/s/365esodk3
|
||||
- [media-kit](https://github.com/media-kit/media-kit)
|
||||
- [dio](https://pub.dev/packages/dio)
|
||||
- 等等
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
@ -58,11 +58,10 @@ android {
|
||||
applicationId "com.guozhigq.pilipala"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
// minSdkVersion flutter.minSdkVersion
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
minSdkVersion 19
|
||||
minSdkVersion 21
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
@ -95,3 +94,14 @@ flutter {
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
}
|
||||
|
||||
ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3]
|
||||
import com.android.build.OutputFile
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def abiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
|
||||
if (abiVersionCode != null) {
|
||||
output.versionCodeOverride = variant.versionCode * 10 + abiVersionCode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
android:fullBackupContent="false"
|
||||
tools:replace="android:allowBackup">
|
||||
<activity
|
||||
android:name="com.ryanheise.audioservice.AudioServiceActivity"
|
||||
android:name="com.guozhigq.pilipala.MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
@ -65,11 +65,13 @@
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<data android:scheme="bilibili" android:host="forward" />
|
||||
<data android:scheme="bilibili" android:host="comment"
|
||||
android:pathPattern="/detail/.*/.*/.*" />
|
||||
@ -221,6 +223,10 @@
|
||||
android:pathPattern="/mobile/video/.*" />
|
||||
<data android:scheme="https" android:host="www.bilibili.com"
|
||||
android:pathPattern="/mobile/video/.*" />
|
||||
<data android:scheme="https" android:host="b23.tv"
|
||||
android:pathPattern="/*" />
|
||||
<data android:scheme="https" android:host="space.bilibili.com"
|
||||
android:pathPattern="/*" />
|
||||
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.guozhigq.pilipala
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
// import io.flutter.embedding.android.FlutterActivity
|
||||
import com.ryanheise.audioservice.AudioServiceActivity;
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
class MainActivity: AudioServiceActivity() {
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.7.10'
|
||||
ext.kotlin_version = '1.9.0'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
BIN
assets/images/coin.png
Normal file
BIN
assets/images/coin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/images/live/default_bg.webp
Normal file
BIN
assets/images/live/default_bg.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
1
assets/images/video/danmu_close.svg
Normal file
1
assets/images/video/danmu_close.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" data-pointer="none" viewBox="0 0 24 24"><path fill-rule="evenodd" d="m8.085 4.891-.999-1.499a1.008 1.008 0 0 1 1.679-1.118l1.709 2.566c.54-.008 1.045-.012 1.515-.012h.13c.345 0 .707.003 1.088.007l1.862-2.59a1.008 1.008 0 0 1 1.637 1.177l-1.049 1.46c.788.02 1.631.046 2.53.078 1.958.069 3.468 1.6 3.74 3.507.088.613.13 2.158.16 3.276l.001.027c.01.333.017.63.025.856a.987.987 0 0 1-1.974.069c-.008-.23-.016-.539-.025-.881v-.002c-.028-1.103-.066-2.541-.142-3.065-.143-1.004-.895-1.78-1.854-1.813-2.444-.087-4.466-.13-6.064-.131-1.598 0-3.619.044-6.063.13a2.037 2.037 0 0 0-1.945 1.748c-.15 1.04-.225 2.341-.225 3.904 0 1.874.11 3.474.325 4.798.154.949.95 1.66 1.91 1.708a97.58 97.58 0 0 0 5.416.139.988.988 0 0 1 0 1.975c-2.196 0-3.61-.047-5.513-.141A4.012 4.012 0 0 1 2.197 17.7c-.236-1.446-.351-3.151-.351-5.116 0-1.64.08-3.035.245-4.184A4.013 4.013 0 0 1 5.92 4.96c.761-.027 1.483-.05 2.164-.069Zm4.436 4.707h-1.32v4.63h2.222v.848h-2.618v1.078h2.431a5.01 5.01 0 0 1 3.575-3.115V9.598h-1.276a8.59 8.59 0 0 0 .748-1.42l-1.089-.384a14.232 14.232 0 0 1-.814 1.804h-1.518l.693-.308a8.862 8.862 0 0 0-.814-1.408l-1.045.352c.297.396.572.847.825 1.364Zm-4.18 3.564.154-1.485h1.98V8.289h-3.2v.979h2.067v1.43H7.483l-.308 3.454h2.277c0 1.166-.044 1.925-.12 2.277-.078.352-.386.528-.936.528-.308 0-.616-.022-.902-.055l.297 1.067.062.004c.285.02.551.04.818.04 1.001-.066 1.562-.418 1.694-1.056.11-.638.176-1.903.176-3.795h-2.2Zm7.458.11v-.858h-1.254v.858H15.8Zm-2.376-.858v.858h-1.199v-.858h1.2Zm-1.199-.946h1.2v-.902h-1.2v.902Zm2.321 0v-.902H15.8v.902h-1.254Zm3.517 10.594a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm-.002-1.502a2.5 2.5 0 0 1-2.217-3.657l3.326 3.398a2.49 2.49 0 0 1-1.109.259Zm2.5-2.5c0 .42-.103.815-.286 1.162l-3.328-3.401a2.5 2.5 0 0 1 3.614 2.239Z" clip-rule="evenodd"></path></svg>
|
After Width: | Height: | Size: 1.8 KiB |
1
assets/images/video/danmu_open.svg
Normal file
1
assets/images/video/danmu_open.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" data-pointer="none" viewBox="0 0 24 24" id="svgcontent" overflow="visible" width="24" height="24" x="597" y="286"><g class="layer" style="pointer-events:all"><title style="pointer-events:inherit">Layer 1</title><path fill-rule="evenodd" d="M11.99,4.83C11.52,4.83 11.01,4.83 10.47,4.84L8.76,2.27A1.01,1.01 0 0 0 7.09,3.39L8.08,4.89C7.4,4.91 6.68,4.93 5.92,4.96A4.01,4.01 0 0 0 2.09,8.4C1.93,9.55 1.85,10.94 1.85,12.58C1.85,14.55 1.96,16.25 2.2,17.7A4.01,4.01 0 0 0 5.96,21.06L6.86,21.11C8.07,21.17 8.67,21.2 10.47,21.2A0.99,0.99 0 0 0 10.47,19.23C8.71,19.23 8.13,19.2 6.97,19.14L6.06,19.09A2.04,2.04 0 0 1 4.15,17.38C3.93,16.06 3.82,14.46 3.82,12.58C3.82,11.02 3.9,9.72 4.05,8.68C4.19,7.7 5.01,6.97 5.99,6.93C8.43,6.85 10.46,6.8 12.05,6.8C13.65,6.8 15.67,6.85 18.12,6.93C19.08,6.97 19.83,7.74 19.97,8.75C20.05,9.27 20.09,10.71 20.11,11.81L20.11,11.81C20.12,12.16 20.13,12.46 20.14,12.69A0.99,0.99 0 1 0 22.11,12.63C22.1,12.4 22.1,12.1 22.09,11.77L22.09,11.74C22.06,10.62 22.01,9.08 21.93,8.47C21.65,6.56 20.14,5.03 18.19,4.96C17.29,4.93 16.44,4.9 15.66,4.88L16.71,3.42A1.01,1.01 0 0 0 15.07,2.24L13.21,4.83C12.83,4.83 12.46,4.83 12.12,4.83L11.99,4.83zM12.51,9.6L11.19,9.6L11.19,14.23L13.41,14.23L13.41,15.08L10.79,15.08L10.79,16.16L13.41,16.16L13.42,16.84C13.78,16.86 14.13,17 14.43,17.24L14.54,17.24L14.54,16.16L17.23,16.16L17.23,15.08L14.53,15.08L14.53,14.23L16.8,14.23L16.8,9.6L15.52,9.6A8.59,8.59 0 0 0 16.27,8.18L15.18,7.8A14.23,14.23 0 0 1 14.37,9.6L12.85,9.6L13.54,9.3A8.86,8.86 0 0 0 12.73,7.89L11.68,8.24C11.98,8.64 12.26,9.09 12.51,9.6zM8.33,13.17L8.48,11.68L10.46,11.68L10.46,8.29L7.26,8.29L7.26,9.27L9.33,9.27L9.33,10.7L7.47,10.7L7.16,14.16L9.44,14.16C9.44,15.32 9.4,16.08 9.32,16.43C9.24,16.79 8.94,16.96 8.39,16.96C8.08,16.96 7.77,16.94 7.48,16.91L7.78,17.97L7.84,17.98C8.13,18 8.39,18.02 8.66,18.02C9.66,17.95 10.22,17.6 10.35,16.96C10.46,16.32 10.53,15.06 10.53,13.17L8.33,13.17zM15.79,13.28L15.79,12.42L14.53,12.42L14.53,13.28L15.79,13.28zM13.41,12.42L13.41,13.28L12.21,13.28L12.21,12.42L13.41,12.42zM12.21,11.47L13.41,11.47L13.41,10.57L12.21,10.57L12.21,11.47zM14.53,11.47L14.53,10.57L15.79,10.57L15.79,11.47L14.53,11.47z" clip-rule="evenodd" id="svg_1"></path><path fill="#000000" fill-rule="evenodd" d="M22.85,14.63A1,1 0 0 0 21.43,14.7L16.34,20.41L14.13,18.13L14.03,18.04L14.02,18.04A1,1 0 0 0 12.7,19.53L15.66,22.57L15.76,22.66L15.76,22.66C16.17,22.98 16.76,22.93 17.12,22.54L22.93,16.03L23.01,15.93L23.01,15.92A1,1 0 0 0 22.85,14.63z" clip-rule="evenodd" id="svg_2"></path></g></svg>
|
After Width: | Height: | Size: 2.5 KiB |
1
assets/loading.json
Normal file
1
assets/loading.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/trail_loading.json
Normal file
1
assets/trail_loading.json
Normal file
File diff suppressed because one or more lines are too long
39
change_log/1.0.17.0125.md
Normal file
39
change_log/1.0.17.0125.md
Normal file
@ -0,0 +1,39 @@
|
||||
## 1.0.17
|
||||
|
||||
|
||||
### 功能
|
||||
+ 视频全屏时隐藏进度条
|
||||
+ 动态内容增加投稿跳转
|
||||
+ 未开启自动播放时点击封面播放
|
||||
+ 弹幕发送标识
|
||||
+ 定时关闭
|
||||
+ 推荐视频卡片拉黑up功能
|
||||
+ 首页tabbar编辑排序
|
||||
|
||||
### 修复
|
||||
+ 连续跳转搜索页未刷新
|
||||
+ 搜索结果为空时页面异常
|
||||
+ 评论区链接解析
|
||||
+ 视频全屏状态栏背景色
|
||||
+ 私信对话气泡位置
|
||||
+ 设置up关注分组样式
|
||||
+ 每次推荐请求数据相同
|
||||
+ iOS代理网络异常
|
||||
+ 双击切换播放状态无声
|
||||
+ 设置自定义倍速白屏
|
||||
+ 免登录查看1080p
|
||||
|
||||
### 优化
|
||||
+ 首页web端推荐观看数展示
|
||||
+ 首页web端推荐接口更新
|
||||
+ 首页样式
|
||||
+ 搜索页跳转
|
||||
+ 弹幕资源优化
|
||||
+ 图片渲染占用内存优化(部分)
|
||||
+ 两次返回退出应用
|
||||
+ schame 补充
|
||||
|
||||
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
16
change_log/1.0.18.0130.md
Normal file
16
change_log/1.0.18.0130.md
Normal file
@ -0,0 +1,16 @@
|
||||
## 1.0.18
|
||||
|
||||
|
||||
### 功能
|
||||
|
||||
|
||||
### 修复
|
||||
|
||||
|
||||
### 优化
|
||||
|
||||
|
||||
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
15
change_log/1.0.19.0131.md
Normal file
15
change_log/1.0.19.0131.md
Normal file
@ -0,0 +1,15 @@
|
||||
## 1.0.19
|
||||
|
||||
|
||||
### 修复
|
||||
+ 视频404、评论加载错误
|
||||
+ bvav转换
|
||||
|
||||
### 优化
|
||||
+ 视频详情页内存占用
|
||||
|
||||
|
||||
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
31
change_log/1.0.20.0303.md
Normal file
31
change_log/1.0.20.0303.md
Normal file
@ -0,0 +1,31 @@
|
||||
## 1.0.20
|
||||
|
||||
|
||||
### 功能
|
||||
+ 评论区增加表情
|
||||
+ 首页渐变背景开关
|
||||
+ 媒体库显示「我的订阅」
|
||||
+ 评论区链接解析
|
||||
+ 默认启动页设置
|
||||
|
||||
### 修复
|
||||
+ 评论区内容重复
|
||||
+ pip相关问题
|
||||
+ 播放多p视频评论不刷新
|
||||
+ 视频评论翻页重复
|
||||
|
||||
### 优化
|
||||
+ url scheme优化
|
||||
+ 图片预览放大
|
||||
+ 图片加载速度
|
||||
+ 视频评论区复制
|
||||
+ 全屏显示视频标题
|
||||
+ 网络异常处理
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
9
change_log/1.0.21.0306.md
Normal file
9
change_log/1.0.21.0306.md
Normal file
@ -0,0 +1,9 @@
|
||||
## 1.0.21
|
||||
|
||||
### 修复
|
||||
+ 推荐视频全屏问题
|
||||
+ 番剧全屏播放时灰屏问题
|
||||
+ 评论回调导致页面卡死问题
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
27
change_log/1.0.22.0430.md
Normal file
27
change_log/1.0.22.0430.md
Normal file
@ -0,0 +1,27 @@
|
||||
## 1.0.22
|
||||
|
||||
### 功能
|
||||
+ 字幕
|
||||
+ 全屏时选集
|
||||
+ 动态转发
|
||||
+ 评论视频并转发
|
||||
+ 收藏夹删除
|
||||
+ 合集显示封面
|
||||
+ 底部导航栏编辑、排序功能
|
||||
+ 历史记录进度条展示
|
||||
+ 直播画质切换
|
||||
+ 排行榜功能
|
||||
+ 视频详情页推荐视频开关
|
||||
+ 显示联合投稿up
|
||||
|
||||
### 修复
|
||||
+ 收藏夹个数错误
|
||||
+ 封面保存权限问题
|
||||
+ 合集最后1p未展示
|
||||
+ up主页关注按钮触发灰屏
|
||||
|
||||
### 优化
|
||||
+ 视频简介查看逻辑
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
14
change_log/1.0.23.0504.md
Normal file
14
change_log/1.0.23.0504.md
Normal file
@ -0,0 +1,14 @@
|
||||
## 1.0.23
|
||||
|
||||
### 功能
|
||||
+ 封面下载
|
||||
|
||||
|
||||
### 修复
|
||||
+ 全屏问题
|
||||
+ 视频播放器灰屏问题
|
||||
+ 评论区点击区域问题
|
||||
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
15
change_log/1.0.23.0505.md
Normal file
15
change_log/1.0.23.0505.md
Normal file
@ -0,0 +1,15 @@
|
||||
## 1.0.23
|
||||
|
||||
### 功能
|
||||
+ 封面下载
|
||||
|
||||
|
||||
### 修复
|
||||
+ 全屏问题
|
||||
+ 视频播放器灰屏问题
|
||||
+ 评论区点击区域问题
|
||||
+ 动态详情跳转异常问题
|
||||
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
23
change_log/1.0.24.0626.md
Normal file
23
change_log/1.0.24.0626.md
Normal file
@ -0,0 +1,23 @@
|
||||
## 1.0.24
|
||||
|
||||
### 功能
|
||||
+ 私信功能
|
||||
+ 回复我的、收到的赞查看
|
||||
+ 新的登录方式
|
||||
+ 全屏选集
|
||||
+ 一键三连
|
||||
+ 按分区搜索
|
||||
|
||||
### 优化
|
||||
+ 页面跳转动画
|
||||
+ 评论区跳转
|
||||
|
||||
### 修复
|
||||
+ 音画不同步问题
|
||||
+ 分集字幕未同步
|
||||
+ 多语言字幕
|
||||
+ 弹幕设置未生效
|
||||
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
39
change_log/1.0.25.1010.md
Normal file
39
change_log/1.0.25.1010.md
Normal file
@ -0,0 +1,39 @@
|
||||
## 1.0.25
|
||||
|
||||
### 功能
|
||||
+ 直播弹幕
|
||||
+ 稍后再看、收藏夹播放全部
|
||||
+ 收藏夹新建、编辑
|
||||
+ 评论删除
|
||||
+ 评论保存为图片
|
||||
+ 动态页滑动切换up
|
||||
+ up投稿筛选充电视频
|
||||
+ 直播tab展示关注up
|
||||
+ up主页专栏展示
|
||||
|
||||
### 优化
|
||||
+ 视频详情页一键三连
|
||||
+ 动态页标识充电视频
|
||||
+ 播放器亮度、音量调整百分比展示
|
||||
+ 封面预览时视频标题可复制
|
||||
+ 竖屏直播布局
|
||||
+ 图片预览
|
||||
+ 专栏渲染优化
|
||||
+ 私信图片查看
|
||||
|
||||
### 修复
|
||||
+ 收藏夹点击异常
|
||||
+ 搜索up异常
|
||||
+ 系统通知已读异常
|
||||
+ [赞了我的]展示错误
|
||||
+ 部分up合集无法打开
|
||||
+ 切换合集视频投币个数未重置
|
||||
+ 搜索条件筛选面板无法滚动
|
||||
+ 部分机型导航条未沉浸
|
||||
+ 专栏图片渲染问题
|
||||
+ 专栏浏览历史记录
|
||||
+ 直播间历史记录
|
||||
|
||||
|
||||
更多更新日志可在Github上查看
|
||||
问题反馈、功能建议请查看「关于」页面。
|
@ -21,6 +21,6 @@
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
<string>12.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -9,16 +9,21 @@ PODS:
|
||||
- Flutter
|
||||
- connectivity_plus (0.0.1):
|
||||
- Flutter
|
||||
- ReachabilitySwift
|
||||
- FlutterMacOS
|
||||
- device_info_plus (0.0.1):
|
||||
- Flutter
|
||||
- Flutter (1.0.0)
|
||||
- flutter_mailer (0.0.1):
|
||||
- Flutter
|
||||
- flutter_volume_controller (0.0.1):
|
||||
- Flutter
|
||||
- fluttertoast (0.0.2):
|
||||
- Flutter
|
||||
- Toast
|
||||
- FMDB (2.7.5):
|
||||
- FMDB/standard (= 2.7.5)
|
||||
- FMDB/standard (2.7.5)
|
||||
- gt3_flutter_plugin (0.0.8):
|
||||
- gt3_flutter_plugin (0.0.9):
|
||||
- Flutter
|
||||
- GT3Captcha-iOS
|
||||
- GT3Captcha-iOS (0.15.8.3)
|
||||
@ -33,9 +38,8 @@ PODS:
|
||||
- path_provider_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- permission_handler_apple (9.1.1):
|
||||
- permission_handler_apple (9.3.0):
|
||||
- Flutter
|
||||
- ReachabilitySwift (5.0.0)
|
||||
- saver_gallery (0.0.1):
|
||||
- Flutter
|
||||
- screen_brightness_ios (0.1.0):
|
||||
@ -49,6 +53,7 @@ PODS:
|
||||
- Flutter
|
||||
- system_proxy (0.0.1):
|
||||
- Flutter
|
||||
- Toast (4.1.0)
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
- volume_controller (0.0.1):
|
||||
@ -65,10 +70,12 @@ DEPENDENCIES:
|
||||
- audio_service (from `.symlinks/plugins/audio_service/ios`)
|
||||
- audio_session (from `.symlinks/plugins/audio_session/ios`)
|
||||
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
|
||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
|
||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_mailer (from `.symlinks/plugins/flutter_mailer/ios`)
|
||||
- flutter_volume_controller (from `.symlinks/plugins/flutter_volume_controller/ios`)
|
||||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||
- gt3_flutter_plugin (from `.symlinks/plugins/gt3_flutter_plugin/ios`)
|
||||
- media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`)
|
||||
- media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`)
|
||||
@ -92,7 +99,7 @@ SPEC REPOS:
|
||||
trunk:
|
||||
- FMDB
|
||||
- GT3Captcha-iOS
|
||||
- ReachabilitySwift
|
||||
- Toast
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
appscheme:
|
||||
@ -104,13 +111,17 @@ EXTERNAL SOURCES:
|
||||
auto_orientation:
|
||||
:path: ".symlinks/plugins/auto_orientation/ios"
|
||||
connectivity_plus:
|
||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||
:path: ".symlinks/plugins/connectivity_plus/darwin"
|
||||
device_info_plus:
|
||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_mailer:
|
||||
:path: ".symlinks/plugins/flutter_mailer/ios"
|
||||
flutter_volume_controller:
|
||||
:path: ".symlinks/plugins/flutter_volume_controller/ios"
|
||||
fluttertoast:
|
||||
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||
gt3_flutter_plugin:
|
||||
:path: ".symlinks/plugins/gt3_flutter_plugin/ios"
|
||||
media_kit_libs_ios_video:
|
||||
@ -153,31 +164,33 @@ SPEC CHECKSUMS:
|
||||
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
||||
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
||||
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
||||
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
|
||||
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||
flutter_mailer: 2ef5a67087bc8c6c4cefd04a178bf1ae2c94cd83
|
||||
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
|
||||
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
gt3_flutter_plugin: bfa1f26e9a09dc00401514be5ed437f964cabf23
|
||||
gt3_flutter_plugin: 5bd2c08d3c19cbb6ee3b08f4358439e54c8ab2ee
|
||||
GT3Captcha-iOS: 5e3b1077834d8a9d6f4d64a447a30af3e14affe6
|
||||
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
|
||||
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
|
||||
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
||||
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
||||
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||
saver_gallery: 2b4e584106fde2407ab51560f3851564963e6b78
|
||||
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
||||
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
|
||||
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
||||
status_bar_control: 7c84146799e6a076315cc1550f78ef53aae3e446
|
||||
system_proxy: bec1a5c5af67dd3e3ebf43979400a8756c04cc44
|
||||
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
|
||||
Toast: ec33c32b8688982cecc6348adeae667c1b9938da
|
||||
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
|
||||
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
|
||||
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
|
||||
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
|
||||
webview_cookie_manager: eaf920722b493bd0f7611b5484771ca53fed03f7
|
||||
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
|
||||
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36
|
||||
|
||||
PODFILE CHECKSUM: 637cd290bed23275b5f5ffcc7eb1e73d0a5fb2be
|
||||
|
||||
|
@ -156,7 +156,7 @@
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1430;
|
||||
LastUpgradeCheck = 1510;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1430"
|
||||
LastUpgradeVersion = "1510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -1,5 +1,6 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
import AVFoundation
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
@ -8,6 +9,14 @@ import Flutter
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
|
||||
// 设置音频会话类别,确保在静音模式下播放音频
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().setCategory(.playback, options: [.duckOthers])
|
||||
} catch {
|
||||
print("Failed to set audio session category: \(error)")
|
||||
}
|
||||
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
}
|
||||
}
|
@ -49,6 +49,8 @@
|
||||
<true/>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>请允许APP保存图片到相册</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>请允许APP保存图片到相册</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>App需要您的同意,才能访问相册</string>
|
||||
<key>NSAppleMusicUsageDescription</key>
|
||||
|
172
lib/common/pages_bottom_sheet.dart
Normal file
172
lib/common/pages_bottom_sheet.dart
Normal file
@ -0,0 +1,172 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
import '../models/common/video_episode_type.dart';
|
||||
|
||||
class EpisodeBottomSheet {
|
||||
final List<dynamic> episodes;
|
||||
final int currentCid;
|
||||
final dynamic dataType;
|
||||
final BuildContext context;
|
||||
final Function changeFucCall;
|
||||
final int? cid;
|
||||
final double? sheetHeight;
|
||||
bool isFullScreen = false;
|
||||
|
||||
EpisodeBottomSheet({
|
||||
required this.episodes,
|
||||
required this.currentCid,
|
||||
required this.dataType,
|
||||
required this.context,
|
||||
required this.changeFucCall,
|
||||
this.cid,
|
||||
this.sheetHeight,
|
||||
this.isFullScreen = false,
|
||||
});
|
||||
|
||||
Widget buildEpisodeListItem(
|
||||
dynamic episode,
|
||||
int index,
|
||||
bool isCurrentIndex,
|
||||
) {
|
||||
Color primary = Theme.of(context).colorScheme.primary;
|
||||
Color onSurface = Theme.of(context).colorScheme.onSurface;
|
||||
|
||||
String title = '';
|
||||
switch (dataType) {
|
||||
case VideoEpidoesType.videoEpisode:
|
||||
title = episode.title;
|
||||
break;
|
||||
case VideoEpidoesType.videoPart:
|
||||
title = episode.pagePart;
|
||||
break;
|
||||
case VideoEpidoesType.bangumiEpisode:
|
||||
title = '第${episode.title}话 ${episode.longTitle!}';
|
||||
break;
|
||||
}
|
||||
return isFullScreen || episode?.cover == null || episode?.cover == ''
|
||||
? ListTile(
|
||||
onTap: () {
|
||||
SmartDialog.showToast('切换至「$title」');
|
||||
changeFucCall.call(episode, index);
|
||||
},
|
||||
dense: false,
|
||||
leading: isCurrentIndex
|
||||
? Image.asset(
|
||||
'assets/images/live.gif',
|
||||
color: primary,
|
||||
height: 12,
|
||||
)
|
||||
: null,
|
||||
title: Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isCurrentIndex ? primary : onSurface,
|
||||
)))
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
SmartDialog.showToast('切换至「$title」');
|
||||
changeFucCall.call(episode, index);
|
||||
},
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 14, right: 14, top: 8, bottom: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
width: 130, height: 75, src: episode?.cover ?? ''),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isCurrentIndex ? primary : onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildTitle() {
|
||||
return AppBar(
|
||||
toolbarHeight: 45,
|
||||
automaticallyImplyLeading: false,
|
||||
centerTitle: false,
|
||||
title: Text(
|
||||
'合集(${episodes.length})',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
actions: !isFullScreen
|
||||
? [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
]
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildShowContent(BuildContext context) {
|
||||
final ItemScrollController itemScrollController = ItemScrollController();
|
||||
int currentIndex = episodes.indexWhere((dynamic e) => e.cid == currentCid);
|
||||
return StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
itemScrollController.jumpTo(index: currentIndex);
|
||||
});
|
||||
return Container(
|
||||
height: sheetHeight,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Column(
|
||||
children: [
|
||||
buildTitle(),
|
||||
Expanded(
|
||||
child: Material(
|
||||
child: PageStorage(
|
||||
bucket: PageStorageBucket(),
|
||||
child: ScrollablePositionedList.builder(
|
||||
itemScrollController: itemScrollController,
|
||||
itemCount: episodes.length + 1,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
bool isLastItem = index == episodes.length;
|
||||
bool isCurrentIndex = currentIndex == index;
|
||||
return isLastItem
|
||||
? SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).padding.bottom + 20,
|
||||
)
|
||||
: buildEpisodeListItem(
|
||||
episodes[index],
|
||||
index,
|
||||
isCurrentIndex,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// The [BuildContext] of the widget that calls the bottom sheet.
|
||||
PersistentBottomSheetController show(BuildContext context) {
|
||||
final PersistentBottomSheetController btmSheetCtr = showBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return buildShowContent(context);
|
||||
},
|
||||
);
|
||||
return btmSheetCtr;
|
||||
}
|
||||
}
|
@ -13,8 +13,8 @@ class Skeleton extends StatelessWidget {
|
||||
var shimmerGradient = LinearGradient(
|
||||
colors: [
|
||||
Colors.transparent,
|
||||
Theme.of(context).colorScheme.background.withAlpha(10),
|
||||
Theme.of(context).colorScheme.background.withAlpha(10),
|
||||
Theme.of(context).colorScheme.surface.withAlpha(10),
|
||||
Theme.of(context).colorScheme.surface.withAlpha(10),
|
||||
Colors.transparent,
|
||||
],
|
||||
stops: const [
|
||||
|
@ -66,7 +66,7 @@ class PBadge extends StatelessWidget {
|
||||
border: Border.all(color: borderColor),
|
||||
),
|
||||
child: Text(
|
||||
text!,
|
||||
text ?? '',
|
||||
style: TextStyle(fontSize: fs ?? fontSize, color: color),
|
||||
),
|
||||
);
|
||||
|
@ -20,7 +20,7 @@ class ContentContainer extends StatelessWidget {
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return SingleChildScrollView(
|
||||
clipBehavior: childClipBehavior ?? Clip.hardEdge,
|
||||
physics: isScrollable ? null : NeverScrollableScrollPhysics(),
|
||||
physics: isScrollable ? null : const NeverScrollableScrollPhysics(),
|
||||
child: ConstrainedBox(
|
||||
constraints: constraints.copyWith(
|
||||
minHeight: constraints.maxHeight,
|
||||
@ -34,7 +34,7 @@ class ContentContainer extends StatelessWidget {
|
||||
child: contentWidget!,
|
||||
)
|
||||
else
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
if (bottomWidget != null) bottomWidget!,
|
||||
],
|
||||
),
|
||||
|
@ -2,16 +2,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
Box setting = GStrorage.setting;
|
||||
Box<dynamic> setting = GStrorage.setting;
|
||||
|
||||
class CustomToast extends StatelessWidget {
|
||||
const CustomToast({super.key, required this.msg});
|
||||
|
||||
final String msg;
|
||||
const CustomToast({Key? key, required this.msg}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double toastOpacity =
|
||||
setting.get(SettingBoxKey.defaultToastOp, defaultValue: 1.0);
|
||||
final double toastOpacity =
|
||||
setting.get(SettingBoxKey.defaultToastOp, defaultValue: 1.0) as double;
|
||||
return Container(
|
||||
margin:
|
||||
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 30),
|
||||
|
@ -1,95 +1,143 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/plugin/pl_gallery/hero_dialog_route.dart';
|
||||
import 'package:pilipala/plugin/pl_gallery/interactiveviewer_gallery.dart';
|
||||
import 'package:pilipala/utils/highlight.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class HtmlRender extends StatelessWidget {
|
||||
String? htmlContent;
|
||||
final int? imgCount;
|
||||
final List? imgList;
|
||||
|
||||
HtmlRender({
|
||||
const HtmlRender({
|
||||
this.htmlContent,
|
||||
this.imgCount,
|
||||
this.imgList,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String? htmlContent;
|
||||
final int? imgCount;
|
||||
final List<String>? imgList;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Html(
|
||||
data: htmlContent,
|
||||
onLinkTap: (url, buildContext, attributes) => {},
|
||||
onLinkTap: (String? url, Map<String, String> buildContext, attributes) {},
|
||||
extensions: [
|
||||
TagExtension(
|
||||
tagsToExtend: {"img"},
|
||||
builder: (extensionContext) {
|
||||
tagsToExtend: <String>{'pre'},
|
||||
builder: (ExtensionContext extensionContext) {
|
||||
final Map<String, dynamic> attributes = extensionContext.attributes;
|
||||
final String lang = attributes['data-lang'] as String;
|
||||
final String code = attributes['codecontent'] as String;
|
||||
List<String> selectedLanguages = [lang.split('@').first];
|
||||
TextSpan? result = highlightExistingText(code, selectedLanguages);
|
||||
if (result == null) {
|
||||
return const Center(child: Text('代码块渲染失败'));
|
||||
}
|
||||
return SelectableText.rich(result);
|
||||
},
|
||||
),
|
||||
TagExtension(
|
||||
tagsToExtend: <String>{'img'},
|
||||
builder: (ExtensionContext extensionContext) {
|
||||
try {
|
||||
Map attributes = extensionContext.attributes;
|
||||
List key = attributes.keys.toList();
|
||||
String? imgUrl = key.contains('src')
|
||||
? attributes['src']
|
||||
: attributes['data-src'];
|
||||
if (imgUrl!.startsWith('//')) {
|
||||
final Map<String, dynamic> attributes =
|
||||
extensionContext.attributes;
|
||||
final List<dynamic> key = attributes.keys.toList();
|
||||
String imgUrl = key.contains('src')
|
||||
? attributes['src'] as String
|
||||
: attributes['data-src'] as String;
|
||||
if (imgUrl.startsWith('//')) {
|
||||
imgUrl = 'https:$imgUrl';
|
||||
}
|
||||
if (imgUrl.startsWith('http://')) {
|
||||
imgUrl = imgUrl.replaceAll('http://', 'https://');
|
||||
}
|
||||
imgUrl = imgUrl.contains('@') ? imgUrl.split('@').first : imgUrl;
|
||||
bool isEmote = imgUrl.contains('/emote/');
|
||||
bool isMall = imgUrl.contains('/mall/');
|
||||
final bool isEmote = imgUrl.contains('/emote/');
|
||||
final bool isMall = imgUrl.contains('/mall/');
|
||||
if (isMall) {
|
||||
return const SizedBox();
|
||||
}
|
||||
// bool inTable =
|
||||
// extensionContext.element!.previousElementSibling == null ||
|
||||
// extensionContext.element!.nextElementSibling == null;
|
||||
// imgUrl = Utils().imageUrl(imgUrl!);
|
||||
// return Image.network(
|
||||
// imgUrl,
|
||||
// width: isEmote ? 22 : null,
|
||||
// height: isEmote ? 22 : null,
|
||||
// );
|
||||
return NetworkImgLayer(
|
||||
width: isEmote ? 22 : Get.size.width - 24,
|
||||
height: isEmote ? 22 : 200,
|
||||
src: imgUrl,
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
HeroDialogRoute<void>(
|
||||
builder: (BuildContext context) =>
|
||||
InteractiveviewerGallery(
|
||||
sources: imgList ?? [imgUrl],
|
||||
initIndex: imgList?.indexOf(imgUrl) ?? 0,
|
||||
itemBuilder: (
|
||||
BuildContext context,
|
||||
int index,
|
||||
bool isFocus,
|
||||
bool enablePageView,
|
||||
) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
if (enablePageView) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
child: Center(
|
||||
child: Hero(
|
||||
tag: imgList?[index] ?? imgUrl,
|
||||
child: CachedNetworkImage(
|
||||
fadeInDuration:
|
||||
const Duration(milliseconds: 0),
|
||||
imageUrl: imgList?[index] ?? imgUrl,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
onPageChanged: (int pageIndex) {},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: CachedNetworkImage(imageUrl: imgUrl),
|
||||
);
|
||||
// return NetworkImgLayer(
|
||||
// width: isEmote ? 22 : Get.size.width - 24,
|
||||
// height: isEmote ? 22 : 200,
|
||||
// src: imgUrl,
|
||||
// );
|
||||
} catch (err) {
|
||||
print(err);
|
||||
return const SizedBox();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
style: {
|
||||
"html": Style(
|
||||
fontSize: FontSize.medium,
|
||||
'html': Style(
|
||||
fontSize: FontSize.large,
|
||||
lineHeight: LineHeight.percent(140),
|
||||
),
|
||||
"body": Style(margin: Margins.zero, padding: HtmlPaddings.zero),
|
||||
"a": Style(
|
||||
'body': Style(margin: Margins.zero, padding: HtmlPaddings.zero),
|
||||
'a': Style(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
textDecoration: TextDecoration.none,
|
||||
),
|
||||
"p": Style(
|
||||
'p': Style(
|
||||
margin: Margins.only(bottom: 10),
|
||||
),
|
||||
"span": Style(
|
||||
fontSize: FontSize.medium,
|
||||
'span': Style(
|
||||
fontSize: FontSize.large,
|
||||
height: Height(1.65),
|
||||
),
|
||||
"div": Style(height: Height.auto()),
|
||||
"li > p": Style(
|
||||
'div': Style(height: Height.auto()),
|
||||
'li > p': Style(
|
||||
display: Display.inline,
|
||||
),
|
||||
"li": Style(
|
||||
'li': Style(
|
||||
padding: HtmlPaddings.only(bottom: 4),
|
||||
textAlign: TextAlign.justify,
|
||||
),
|
||||
"img": Style(margin: Margins.only(top: 4, bottom: 4)),
|
||||
'img': Style(margin: Margins.only(top: 4, bottom: 4)),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -2,12 +2,18 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class HttpError extends StatelessWidget {
|
||||
const HttpError(
|
||||
{required this.errMsg, required this.fn, this.btnText, super.key});
|
||||
const HttpError({
|
||||
required this.errMsg,
|
||||
required this.fn,
|
||||
this.btnText,
|
||||
this.isShowBtn = true,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String? errMsg;
|
||||
final Function()? fn;
|
||||
final String? btnText;
|
||||
final bool isShowBtn;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -22,20 +28,29 @@ class HttpError extends StatelessWidget {
|
||||
"assets/images/error.svg",
|
||||
height: 200,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
errMsg ?? '请求异常',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
fn!();
|
||||
},
|
||||
icon: const Icon(Icons.arrow_forward_outlined, size: 20),
|
||||
label: Text(btnText ?? '点击重试'),
|
||||
)
|
||||
const SizedBox(height: 20),
|
||||
if (isShowBtn)
|
||||
FilledButton.tonal(
|
||||
onPressed: () {
|
||||
fn!();
|
||||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
return Theme.of(context).colorScheme.primary.withAlpha(20);
|
||||
}),
|
||||
),
|
||||
child: Text(
|
||||
btnText ?? '点击重试',
|
||||
style:
|
||||
TextStyle(color: Theme.of(context).colorScheme.primary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -1,11 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import '../../utils/utils.dart';
|
||||
import '../constants.dart';
|
||||
import 'network_img_layer.dart';
|
||||
|
||||
class LiveCard extends StatelessWidget {
|
||||
// ignore: prefer_typing_uninitialized_variables
|
||||
final liveItem;
|
||||
final dynamic liveItem;
|
||||
|
||||
const LiveCard({
|
||||
Key? key,
|
||||
@ -14,7 +14,7 @@ class LiveCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String heroTag = Utils.makeHeroTag(liveItem.roomid);
|
||||
final String heroTag = Utils.makeHeroTag(liveItem.roomid);
|
||||
|
||||
return Card(
|
||||
elevation: 0,
|
||||
@ -23,7 +23,6 @@ class LiveCard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).dividerColor.withOpacity(0.08),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
margin: EdgeInsets.zero,
|
||||
@ -33,15 +32,16 @@ class LiveCard extends StatelessWidget {
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
double maxWidth = boxConstraints.maxWidth;
|
||||
double maxHeight = boxConstraints.maxHeight;
|
||||
child: LayoutBuilder(builder:
|
||||
(BuildContext context, BoxConstraints boxConstraints) {
|
||||
final double maxWidth = boxConstraints.maxWidth;
|
||||
final double maxHeight = boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
children: [
|
||||
Hero(
|
||||
tag: heroTag,
|
||||
child: NetworkImgLayer(
|
||||
src: liveItem.cover,
|
||||
src: liveItem.cover as String,
|
||||
type: 'emote',
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
@ -58,7 +58,7 @@ class LiveCard extends StatelessWidget {
|
||||
// view: liveItem.stat.view,
|
||||
// danmaku: liveItem.stat.danmaku,
|
||||
// duration: liveItem.duration,
|
||||
online: liveItem.online,
|
||||
online: liveItem.online as int,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -90,7 +90,7 @@ class LiveContent extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
liveItem.title,
|
||||
liveItem.title as String,
|
||||
textAlign: TextAlign.start,
|
||||
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500),
|
||||
maxLines: 2,
|
||||
@ -99,7 +99,7 @@ class LiveContent extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Text(
|
||||
liveItem.uname,
|
||||
liveItem.uname as String,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
@ -114,9 +114,9 @@ class LiveContent extends StatelessWidget {
|
||||
}
|
||||
|
||||
class LiveStat extends StatelessWidget {
|
||||
final int? online;
|
||||
const LiveStat({super.key, required this.online});
|
||||
|
||||
const LiveStat({Key? key, required this.online}) : super(key: key);
|
||||
final int? online;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -136,7 +136,7 @@ class LiveStat extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Row(
|
||||
// children: [
|
||||
// StatView(
|
||||
|
@ -1,78 +1,106 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/extension.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import '../../utils/storage.dart';
|
||||
import '../constants.dart';
|
||||
|
||||
Box setting = GStrorage.setting;
|
||||
Box<dynamic> setting = GStrorage.setting;
|
||||
|
||||
class NetworkImgLayer extends StatelessWidget {
|
||||
final String? src;
|
||||
final double? width;
|
||||
final double? height;
|
||||
final double? cacheW;
|
||||
final double? cacheH;
|
||||
final String? type;
|
||||
final Duration? fadeOutDuration;
|
||||
final Duration? fadeInDuration;
|
||||
final int? quality;
|
||||
|
||||
const NetworkImgLayer({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.src,
|
||||
required this.width,
|
||||
required this.height,
|
||||
this.cacheW,
|
||||
this.cacheH,
|
||||
this.type,
|
||||
this.fadeOutDuration,
|
||||
this.fadeInDuration,
|
||||
// 图片质量 默认1%
|
||||
this.quality,
|
||||
}) : super(key: key);
|
||||
this.origAspectRatio,
|
||||
});
|
||||
|
||||
final String? src;
|
||||
final double width;
|
||||
final double height;
|
||||
final String? type;
|
||||
final Duration? fadeOutDuration;
|
||||
final Duration? fadeInDuration;
|
||||
final int? quality;
|
||||
final double? origAspectRatio;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double pr = MediaQuery.of(context).devicePixelRatio;
|
||||
int picQuality = setting.get(SettingBoxKey.defaultPicQa, defaultValue: 10);
|
||||
final int defaultImgQuality = GlobalDataCache().imgQuality;
|
||||
if (src == '' || src == null) {
|
||||
return placeholder(context);
|
||||
}
|
||||
final String imageUrl =
|
||||
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp';
|
||||
int? memCacheWidth, memCacheHeight;
|
||||
double aspectRatio = (width / height).toDouble();
|
||||
|
||||
// double pr = 2;
|
||||
return src != ''
|
||||
void setMemCacheSizes() {
|
||||
if (aspectRatio > 1) {
|
||||
memCacheHeight = height.cacheSize(context);
|
||||
} else if (aspectRatio < 1) {
|
||||
memCacheWidth = width.cacheSize(context);
|
||||
} else {
|
||||
if (origAspectRatio != null && origAspectRatio! > 1) {
|
||||
memCacheWidth = width.cacheSize(context);
|
||||
} else if (origAspectRatio != null && origAspectRatio! < 1) {
|
||||
memCacheHeight = height.cacheSize(context);
|
||||
} else {
|
||||
memCacheWidth = width.cacheSize(context);
|
||||
memCacheHeight = height.cacheSize(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setMemCacheSizes();
|
||||
|
||||
if (memCacheWidth == null && memCacheHeight == null) {
|
||||
memCacheWidth = width.toInt();
|
||||
}
|
||||
|
||||
return src != '' && src != null
|
||||
? ClipRRect(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
borderRadius: BorderRadius.circular(type == 'avatar'
|
||||
? 50
|
||||
: type == 'emote'
|
||||
? 0
|
||||
: StyleString.imgRadius.x),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
borderRadius: BorderRadius.circular(
|
||||
type == 'avatar'
|
||||
? 50
|
||||
: type == 'emote'
|
||||
? 0
|
||||
: StyleString.imgRadius.x,
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl:
|
||||
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? picQuality}q.webp',
|
||||
width: width ?? double.infinity,
|
||||
height: height ?? double.infinity,
|
||||
alignment: Alignment.center,
|
||||
maxWidthDiskCache: ((cacheW ?? width!) * pr).toInt(),
|
||||
// maxHeightDiskCache: (cacheH ?? height!).toInt(),
|
||||
memCacheWidth: ((cacheW ?? width!) * pr).toInt(),
|
||||
// memCacheHeight: (cacheH ?? height!).toInt(),
|
||||
imageUrl: imageUrl,
|
||||
width: width,
|
||||
height: height,
|
||||
memCacheWidth: memCacheWidth,
|
||||
memCacheHeight: memCacheHeight,
|
||||
fit: BoxFit.cover,
|
||||
fadeOutDuration:
|
||||
fadeOutDuration ?? const Duration(milliseconds: 200),
|
||||
fadeOutDuration ?? const Duration(milliseconds: 120),
|
||||
fadeInDuration:
|
||||
fadeInDuration ?? const Duration(milliseconds: 200),
|
||||
// filterQuality: FilterQuality.high,
|
||||
errorWidget: (context, url, error) => placeholder(context),
|
||||
placeholder: (context, url) => placeholder(context),
|
||||
fadeInDuration ?? const Duration(milliseconds: 120),
|
||||
filterQuality: FilterQuality.low,
|
||||
errorWidget: (BuildContext context, String url, Object error) =>
|
||||
placeholder(context),
|
||||
placeholder: (BuildContext context, String url) =>
|
||||
placeholder(context),
|
||||
),
|
||||
)
|
||||
: placeholder(context);
|
||||
}
|
||||
|
||||
Widget placeholder(context) {
|
||||
Widget placeholder(BuildContext context) {
|
||||
return Container(
|
||||
width: width ?? double.infinity,
|
||||
height: height ?? double.infinity,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
width: width,
|
||||
height: height,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.onInverseSurface.withOpacity(0.4),
|
||||
borderRadius: BorderRadius.circular(type == 'avatar'
|
||||
@ -81,14 +109,19 @@ class NetworkImgLayer extends StatelessWidget {
|
||||
? 0
|
||||
: StyleString.imgRadius.x),
|
||||
),
|
||||
child: Center(
|
||||
child: Image.asset(
|
||||
type == 'avatar'
|
||||
? 'assets/images/noface.jpeg'
|
||||
: 'assets/images/loading.png',
|
||||
width: 300,
|
||||
height: 300,
|
||||
)),
|
||||
child: type == 'bg'
|
||||
? const SizedBox()
|
||||
: Center(
|
||||
child: Image.asset(
|
||||
type == 'avatar'
|
||||
? 'assets/images/noface.jpeg'
|
||||
: 'assets/images/loading.png',
|
||||
width: width,
|
||||
height: height,
|
||||
cacheWidth: width.cacheSize(context),
|
||||
cacheHeight: height.cacheSize(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,131 +0,0 @@
|
||||
// ignore_for_file: depend_on_referenced_packages
|
||||
|
||||
import 'dart:math';
|
||||
import 'dart:ui' as ui show Image;
|
||||
|
||||
import 'package:extended_image/extended_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:pull_to_refresh_notification/pull_to_refresh_notification.dart';
|
||||
|
||||
double get maxDragOffset => 100;
|
||||
double hideHeight = maxDragOffset / 2.3;
|
||||
double refreshHeight = maxDragOffset / 1.5;
|
||||
|
||||
class PullToRefreshHeader extends StatelessWidget {
|
||||
const PullToRefreshHeader(
|
||||
this.info,
|
||||
this.lastRefreshTime, {
|
||||
this.color,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
final PullToRefreshScrollNotificationInfo? info;
|
||||
final DateTime? lastRefreshTime;
|
||||
final Color? color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final PullToRefreshScrollNotificationInfo? infos = info;
|
||||
if (infos == null) {
|
||||
return Container();
|
||||
}
|
||||
String text = '';
|
||||
if (infos.mode == PullToRefreshIndicatorMode.armed) {
|
||||
text = 'Release to refresh';
|
||||
} else if (infos.mode == PullToRefreshIndicatorMode.refresh ||
|
||||
infos.mode == PullToRefreshIndicatorMode.snap) {
|
||||
text = 'Loading...';
|
||||
} else if (infos.mode == PullToRefreshIndicatorMode.done) {
|
||||
text = 'Refresh completed.';
|
||||
} else if (infos.mode == PullToRefreshIndicatorMode.drag) {
|
||||
text = 'Pull to refresh';
|
||||
} else if (infos.mode == PullToRefreshIndicatorMode.canceled) {
|
||||
text = 'Cancel refresh';
|
||||
}
|
||||
|
||||
final TextStyle ts = const TextStyle(
|
||||
color: Colors.grey,
|
||||
).copyWith(fontSize: 14);
|
||||
|
||||
final double dragOffset = info?.dragOffset ?? 0.0;
|
||||
|
||||
final DateTime time = lastRefreshTime ?? DateTime.now();
|
||||
final double top = -hideHeight + dragOffset;
|
||||
return Container(
|
||||
height: dragOffset,
|
||||
color: color ?? Colors.transparent,
|
||||
// padding: EdgeInsets.only(top: dragOffset / 3),
|
||||
// padding: EdgeInsets.only(bottom: 5.0),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
left: 0.0,
|
||||
right: 0.0,
|
||||
top: top,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
margin: const EdgeInsets.only(right: 12.0),
|
||||
child: RefreshImage(top, null),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
Text(text, style: ts),
|
||||
Text(
|
||||
'Last updated:${DateFormat('yyyy-MM-dd hh:mm').format(time)}',
|
||||
style: ts.copyWith(fontSize: 14),
|
||||
)
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RefreshImage extends StatelessWidget {
|
||||
const RefreshImage(this.top, Key? key) : super(key: key);
|
||||
|
||||
final double top;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const double imageSize = 30;
|
||||
return ExtendedImage.asset(
|
||||
'assets/flutterCandies_grey.png',
|
||||
width: imageSize,
|
||||
height: imageSize,
|
||||
afterPaintImage: (Canvas canvas, Rect rect, ui.Image image, Paint paint) {
|
||||
final double imageHeight = image.height.toDouble();
|
||||
final double imageWidth = image.width.toDouble();
|
||||
final Size size = rect.size;
|
||||
final double y =
|
||||
(1 - min(top / (refreshHeight - hideHeight), 1)) * imageHeight;
|
||||
|
||||
canvas.drawImageRect(
|
||||
image,
|
||||
Rect.fromLTWH(0.0, y, imageWidth, imageHeight - y),
|
||||
Rect.fromLTWH(rect.left, rect.top + y / imageHeight * size.height,
|
||||
size.width, (imageHeight - y) / imageHeight * size.height),
|
||||
Paint()
|
||||
..colorFilter =
|
||||
const ColorFilter.mode(Color(0xFFea5504), BlendMode.srcIn)
|
||||
..isAntiAlias = false
|
||||
..filterQuality = FilterQuality.low,
|
||||
);
|
||||
|
||||
//canvas.restore();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -3,10 +3,10 @@ import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
class StatDanMu extends StatelessWidget {
|
||||
final String? theme;
|
||||
final int? danmu;
|
||||
final dynamic danmu;
|
||||
final String? size;
|
||||
|
||||
const StatDanMu({Key? key, this.theme, this.danmu, this.size})
|
||||
const StatDanMu({Key? key, this.theme = 'gray', this.danmu, this.size})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
@ -14,24 +14,49 @@ class StatDanMu extends StatelessWidget {
|
||||
Map<String, Color> colorObject = {
|
||||
'white': Colors.white,
|
||||
'gray': Theme.of(context).colorScheme.outline,
|
||||
'black': Theme.of(context).colorScheme.onBackground.withOpacity(0.8),
|
||||
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
||||
};
|
||||
Color color = colorObject[theme]!;
|
||||
return StatIconText(
|
||||
icon: Icons.subtitles_outlined,
|
||||
text: Utils.numFormat(danmu!),
|
||||
color: color,
|
||||
size: size,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StatIconText extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final Color color;
|
||||
final String? size;
|
||||
|
||||
const StatIconText({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.text,
|
||||
required this.color,
|
||||
this.size,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.subtitles_outlined,
|
||||
icon,
|
||||
size: 14,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
Utils.numFormat(danmu!),
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: size == 'medium' ? 12 : 11,
|
||||
color: color,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -3,30 +3,59 @@ import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
class StatView extends StatelessWidget {
|
||||
final String? theme;
|
||||
final int? view;
|
||||
final dynamic view;
|
||||
final String? size;
|
||||
|
||||
const StatView({Key? key, this.theme, this.view, this.size})
|
||||
: super(key: key);
|
||||
const StatView({
|
||||
Key? key,
|
||||
this.theme = 'gray',
|
||||
this.view,
|
||||
this.size,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Map<String, Color> colorObject = {
|
||||
'white': Colors.white,
|
||||
'gray': Theme.of(context).colorScheme.outline,
|
||||
'black': Theme.of(context).colorScheme.onBackground.withOpacity(0.8),
|
||||
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
||||
};
|
||||
Color color = colorObject[theme]!;
|
||||
return StatIconText(
|
||||
icon: Icons.play_circle_outlined,
|
||||
text: Utils.numFormat(view!),
|
||||
color: color,
|
||||
size: size,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StatIconText extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final Color color;
|
||||
final String? size;
|
||||
|
||||
const StatIconText({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.text,
|
||||
required this.color,
|
||||
this.size,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.play_circle_outlined,
|
||||
icon,
|
||||
size: 13,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
Utils.numFormat(view!),
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: size == 'medium' ? 12 : 11,
|
||||
color: color,
|
||||
|
@ -1,129 +1,165 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
import 'package:pilipala/http/search.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/http/constants.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/image_save.dart';
|
||||
import 'package:pilipala/utils/route_push.dart';
|
||||
import 'package:pilipala/utils/url_utils.dart';
|
||||
import '../../http/search.dart';
|
||||
import '../../http/user.dart';
|
||||
import '../../http/video.dart';
|
||||
import '../../utils/utils.dart';
|
||||
import '../constants.dart';
|
||||
import 'badge.dart';
|
||||
import 'network_img_layer.dart';
|
||||
import 'stat/danmu.dart';
|
||||
import 'stat/view.dart';
|
||||
|
||||
// 视频卡片 - 水平布局
|
||||
class VideoCardH extends StatelessWidget {
|
||||
// ignore: prefer_typing_uninitialized_variables
|
||||
final videoItem;
|
||||
final Function()? longPress;
|
||||
final Function()? longPressEnd;
|
||||
final String source;
|
||||
final bool showOwner;
|
||||
final bool showView;
|
||||
final bool showDanmaku;
|
||||
final bool showPubdate;
|
||||
|
||||
const VideoCardH({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.videoItem,
|
||||
this.longPress,
|
||||
this.longPressEnd,
|
||||
this.onPressedFn,
|
||||
this.source = 'normal',
|
||||
this.showOwner = true,
|
||||
this.showView = true,
|
||||
this.showDanmaku = true,
|
||||
this.showPubdate = false,
|
||||
}) : super(key: key);
|
||||
this.showCharge = false,
|
||||
});
|
||||
// ignore: prefer_typing_uninitialized_variables
|
||||
final videoItem;
|
||||
final Function()? onPressedFn;
|
||||
// normal 推荐, later 稍后再看, search 搜索
|
||||
final String source;
|
||||
final bool showOwner;
|
||||
final bool showView;
|
||||
final bool showDanmaku;
|
||||
final bool showPubdate;
|
||||
final bool showCharge;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int aid = videoItem.aid;
|
||||
String bvid = videoItem.bvid;
|
||||
String heroTag = Utils.makeHeroTag(aid);
|
||||
return GestureDetector(
|
||||
onLongPress: () {
|
||||
if (longPress != null) {
|
||||
longPress!();
|
||||
final int aid = videoItem.aid;
|
||||
final String bvid = videoItem.bvid;
|
||||
String type = 'video';
|
||||
try {
|
||||
type = videoItem.type;
|
||||
} catch (_) {}
|
||||
final String heroTag = Utils.makeHeroTag(aid);
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
try {
|
||||
if (type == 'ketang') {
|
||||
SmartDialog.showToast('课堂视频暂不支持播放');
|
||||
return;
|
||||
}
|
||||
if (showCharge && videoItem?.typeid == 33) {
|
||||
final String redirectUrl = await UrlUtils.parseRedirectUrl(
|
||||
'${HttpString.baseUrl}/video/$bvid/');
|
||||
final String lastPathSegment = redirectUrl.split('/').last;
|
||||
if (lastPathSegment.contains('ss')) {
|
||||
RoutePush.bangumiPush(
|
||||
Utils.matchNum(lastPathSegment).first, null);
|
||||
}
|
||||
if (lastPathSegment.contains('ep')) {
|
||||
RoutePush.bangumiPush(
|
||||
null, Utils.matchNum(lastPathSegment).first);
|
||||
}
|
||||
return;
|
||||
}
|
||||
final int cid =
|
||||
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
||||
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
||||
} catch (err) {
|
||||
SmartDialog.showToast(err.toString());
|
||||
}
|
||||
},
|
||||
// onLongPressEnd: (details) {
|
||||
// if (longPressEnd != null) {
|
||||
// longPressEnd!();
|
||||
// }
|
||||
// },
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
try {
|
||||
int cid =
|
||||
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
||||
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
||||
} catch (err) {
|
||||
SmartDialog.showToast(err.toString());
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, boxConstraints) {
|
||||
double width = (boxConstraints.maxWidth -
|
||||
StyleString.cardSpace *
|
||||
6 /
|
||||
MediaQuery.of(context).textScaleFactor) /
|
||||
2;
|
||||
return Container(
|
||||
constraints: const BoxConstraints(minHeight: 88),
|
||||
height: width / StyleString.aspectRatio,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, boxConstraints) {
|
||||
double maxWidth = boxConstraints.maxWidth;
|
||||
double maxHeight = boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
children: [
|
||||
Hero(
|
||||
tag: heroTag,
|
||||
child: NetworkImgLayer(
|
||||
src: videoItem.pic,
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
),
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context,
|
||||
videoItem,
|
||||
SmartDialog.dismiss,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
StyleString.safeSpace, 5, StyleString.safeSpace, 5),
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints boxConstraints) {
|
||||
final double width = (boxConstraints.maxWidth -
|
||||
StyleString.cardSpace *
|
||||
6 /
|
||||
MediaQuery.textScalerOf(context).scale(1.0)) /
|
||||
2;
|
||||
return Container(
|
||||
constraints: const BoxConstraints(minHeight: 88),
|
||||
height: width / StyleString.aspectRatio,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context,
|
||||
BoxConstraints boxConstraints) {
|
||||
final double maxWidth = boxConstraints.maxWidth;
|
||||
final double maxHeight = boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
children: [
|
||||
Hero(
|
||||
tag: heroTag,
|
||||
child: NetworkImgLayer(
|
||||
src: videoItem.pic as String,
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
),
|
||||
),
|
||||
if (videoItem.duration != 0)
|
||||
PBadge(
|
||||
text: Utils.timeFormat(videoItem.duration!),
|
||||
top: null,
|
||||
right: 6.0,
|
||||
bottom: 6.0,
|
||||
left: null,
|
||||
type: 'gray',
|
||||
),
|
||||
// if (videoItem.rcmdReason != null &&
|
||||
// videoItem.rcmdReason.content != '')
|
||||
// pBadge(videoItem.rcmdReason.content, context,
|
||||
// 6.0, 6.0, null, null),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
if (type != 'video')
|
||||
PBadge(
|
||||
text: type,
|
||||
left: 6.0,
|
||||
bottom: 6.0,
|
||||
type: 'primary',
|
||||
),
|
||||
// if (videoItem.rcmdReason != null &&
|
||||
// videoItem.rcmdReason.content != '')
|
||||
// pBadge(videoItem.rcmdReason.content, context,
|
||||
// 6.0, 6.0, null, null),
|
||||
if (showCharge && videoItem?.isChargingSrc)
|
||||
const PBadge(
|
||||
text: '充电专属',
|
||||
right: 6.0,
|
||||
top: 6.0,
|
||||
type: 'primary',
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
VideoContent(
|
||||
videoItem: videoItem,
|
||||
source: source,
|
||||
showOwner: showOwner,
|
||||
showView: showView,
|
||||
showDanmaku: showDanmaku,
|
||||
showPubdate: showPubdate,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
VideoContent(
|
||||
videoItem: videoItem,
|
||||
source: source,
|
||||
showOwner: showOwner,
|
||||
showView: showView,
|
||||
showDanmaku: showDanmaku,
|
||||
showPubdate: showPubdate,
|
||||
onPressedFn: onPressedFn,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -138,6 +174,7 @@ class VideoContent extends StatelessWidget {
|
||||
final bool showView;
|
||||
final bool showDanmaku;
|
||||
final bool showPubdate;
|
||||
final Function()? onPressedFn;
|
||||
|
||||
const VideoContent({
|
||||
super.key,
|
||||
@ -147,6 +184,7 @@ class VideoContent extends StatelessWidget {
|
||||
this.showView = true,
|
||||
this.showDanmaku = true,
|
||||
this.showPubdate = false,
|
||||
this.onPressedFn,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -157,9 +195,9 @@ class VideoContent extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (videoItem.title is String) ...[
|
||||
if (source == 'normal' || source == 'later') ...[
|
||||
Text(
|
||||
videoItem.title,
|
||||
videoItem.title as String,
|
||||
textAlign: TextAlign.start,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
@ -172,9 +210,9 @@ class VideoContent extends StatelessWidget {
|
||||
maxLines: 2,
|
||||
text: TextSpan(
|
||||
children: [
|
||||
for (var i in videoItem.title) ...[
|
||||
for (final i in videoItem.titleList) ...[
|
||||
TextSpan(
|
||||
text: i['text'],
|
||||
text: i['text'] as String,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
letterSpacing: 0.3,
|
||||
@ -216,7 +254,7 @@ class VideoContent extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
videoItem.owner.name,
|
||||
videoItem.owner.name as String,
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
@ -228,75 +266,49 @@ class VideoContent extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
if (showView) ...[
|
||||
StatView(
|
||||
theme: 'gray',
|
||||
view: videoItem.stat.view,
|
||||
),
|
||||
StatView(view: videoItem.stat.view as int),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
if (showDanmaku)
|
||||
StatDanMu(
|
||||
theme: 'gray',
|
||||
danmu: videoItem.stat.danmaku,
|
||||
),
|
||||
|
||||
StatDanMu(danmu: videoItem.stat.danmaku as int),
|
||||
const Spacer(),
|
||||
// SizedBox(
|
||||
// width: 20,
|
||||
// height: 20,
|
||||
// child: IconButton(
|
||||
// tooltip: '稍后再看',
|
||||
// style: ButtonStyle(
|
||||
// padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
// ),
|
||||
// onPressed: () async {
|
||||
// var res =
|
||||
// await UserHttp.toViewLater(bvid: videoItem.bvid);
|
||||
// SmartDialog.showToast(res['msg']);
|
||||
// },
|
||||
// icon: Icon(
|
||||
// Icons.more_vert_outlined,
|
||||
// color: Theme.of(context).colorScheme.outline,
|
||||
// size: 14,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
if (source == 'normal')
|
||||
SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: PopupMenuButton<String>(
|
||||
child: IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
tooltip: '稍后再看',
|
||||
onPressed: () {
|
||||
feedBack();
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
builder: (context) {
|
||||
return MorePanel(videoItem: videoItem);
|
||||
},
|
||||
);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.more_vert_outlined,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
size: 14,
|
||||
),
|
||||
position: PopupMenuPosition.under,
|
||||
// constraints: const BoxConstraints(maxHeight: 35),
|
||||
onSelected: (String type) {},
|
||||
itemBuilder: (BuildContext context) =>
|
||||
<PopupMenuEntry<String>>[
|
||||
PopupMenuItem<String>(
|
||||
onTap: () async {
|
||||
var res = await UserHttp.toViewLater(
|
||||
bvid: videoItem.bvid);
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
value: 'pause',
|
||||
height: 35,
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(Icons.watch_later_outlined, size: 16),
|
||||
SizedBox(width: 6),
|
||||
Text('稍后再看', style: TextStyle(fontSize: 13))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (source == 'later') ...[
|
||||
IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () => onPressedFn?.call(),
|
||||
icon: Icon(
|
||||
Icons.clear_outlined,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
size: 18,
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
@ -305,3 +317,110 @@ class VideoContent extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MorePanel extends StatelessWidget {
|
||||
final dynamic videoItem;
|
||||
const MorePanel({super.key, required this.videoItem});
|
||||
|
||||
Future<dynamic> menuActionHandler(String type) async {
|
||||
switch (type) {
|
||||
case 'block':
|
||||
blockUser();
|
||||
break;
|
||||
case 'watchLater':
|
||||
var res = await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
||||
SmartDialog.showToast(res['msg']);
|
||||
Get.back();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
void blockUser() async {
|
||||
SmartDialog.show(
|
||||
useSystem: true,
|
||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('提示'),
|
||||
content: Text('确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
||||
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => SmartDialog.dismiss(),
|
||||
child: Text(
|
||||
'点错了',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
var res = await VideoHttp.relationMod(
|
||||
mid: videoItem.owner.mid,
|
||||
act: 5,
|
||||
reSrc: 11,
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast(res['msg'] ?? '成功');
|
||||
},
|
||||
child: const Text('确认'),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () async => await menuActionHandler('block'),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.block, size: 19),
|
||||
title: Text(
|
||||
'拉黑up主 「${videoItem.owner.name}」',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () async => await menuActionHandler('watchLater'),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.watch_later_outlined, size: 19),
|
||||
title:
|
||||
Text('添加至稍后再看', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () =>
|
||||
imageSaveDialog(context, videoItem, SmartDialog.dismiss),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.photo_outlined, size: 19),
|
||||
title:
|
||||
Text('查看视频封面', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/common/widgets/badge.dart';
|
||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||
import 'package:pilipala/http/dynamics.dart';
|
||||
import 'package:pilipala/http/search.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/models/common/search_type.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/image_save.dart';
|
||||
import 'package:pilipala/utils/route_push.dart';
|
||||
import '../../models/model_rec_video_item.dart';
|
||||
import 'stat/danmu.dart';
|
||||
import 'stat/view.dart';
|
||||
import '../../http/dynamics.dart';
|
||||
import '../../http/user.dart';
|
||||
import '../../http/video.dart';
|
||||
import '../../utils/id_utils.dart';
|
||||
import '../../utils/utils.dart';
|
||||
import '../constants.dart';
|
||||
import 'badge.dart';
|
||||
import 'network_img_layer.dart';
|
||||
|
||||
// 视频卡片 - 垂直布局
|
||||
class VideoCardV extends StatelessWidget {
|
||||
final dynamic videoItem;
|
||||
final int crossAxisCount;
|
||||
final Function()? longPress;
|
||||
final Function()? longPressEnd;
|
||||
final Function? blockUserCb;
|
||||
|
||||
const VideoCardV({
|
||||
Key? key,
|
||||
required this.videoItem,
|
||||
required this.crossAxisCount,
|
||||
this.longPress,
|
||||
this.longPressEnd,
|
||||
this.blockUserCb,
|
||||
}) : super(key: key);
|
||||
|
||||
bool isStringNumeric(String str) {
|
||||
@ -42,23 +43,11 @@ class VideoCardV extends StatelessWidget {
|
||||
return;
|
||||
}
|
||||
int epId = videoItem.param;
|
||||
SmartDialog.showLoading(msg: '资源获取中');
|
||||
var result = await SearchHttp.bangumiInfo(seasonId: null, epId: epId);
|
||||
if (result['status']) {
|
||||
var bangumiDetail = result['data'];
|
||||
int cid = bangumiDetail.episodes!.first.cid;
|
||||
String bvid = IdUtils.av2bv(bangumiDetail.episodes!.first.aid);
|
||||
SmartDialog.dismiss().then(
|
||||
(value) => Get.toNamed(
|
||||
'/video?bvid=$bvid&cid=$cid&epId=$epId',
|
||||
arguments: {
|
||||
'pic': videoItem.pic,
|
||||
'heroTag': heroTag,
|
||||
'videoType': SearchType.media_bangumi,
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
RoutePush.bangumiPush(
|
||||
null,
|
||||
epId,
|
||||
heroTag: heroTag,
|
||||
);
|
||||
break;
|
||||
case 'av':
|
||||
String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid);
|
||||
@ -71,17 +60,13 @@ class VideoCardV extends StatelessWidget {
|
||||
// 动态
|
||||
case 'picture':
|
||||
try {
|
||||
String dynamicType = 'picture';
|
||||
String uri = videoItem.uri;
|
||||
String id = '';
|
||||
if (videoItem.uri.startsWith('bilibili://article/')) {
|
||||
// https://www.bilibili.com/read/cv27063554
|
||||
dynamicType = 'read';
|
||||
RegExp regex = RegExp(r'\d+');
|
||||
Match match = regex.firstMatch(videoItem.uri)!;
|
||||
String matchedNumber = match.group(0)!;
|
||||
videoItem.param = int.parse(matchedNumber);
|
||||
id = 'cv${videoItem.param}';
|
||||
}
|
||||
if (uri.startsWith('http')) {
|
||||
String path = Uri.parse(uri).path;
|
||||
@ -99,11 +84,10 @@ class VideoCardV extends StatelessWidget {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Get.toNamed('/htmlRender', parameters: {
|
||||
'url': uri,
|
||||
Get.toNamed('/read', parameters: {
|
||||
'title': videoItem.title,
|
||||
'id': id,
|
||||
'dynamicType': dynamicType
|
||||
'id': videoItem.param,
|
||||
'articleType': 'read'
|
||||
});
|
||||
} catch (err) {
|
||||
SmartDialog.showToast(err.toString());
|
||||
@ -125,64 +109,57 @@ class VideoCardV extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String heroTag = Utils.makeHeroTag(videoItem.id);
|
||||
return Card(
|
||||
elevation: 0,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
margin: EdgeInsets.zero,
|
||||
child: GestureDetector(
|
||||
onLongPress: () {
|
||||
if (longPress != null) {
|
||||
longPress!();
|
||||
}
|
||||
},
|
||||
// onLongPressEnd: (details) {
|
||||
// if (longPressEnd != null) {
|
||||
// longPressEnd!();
|
||||
// }
|
||||
// },
|
||||
child: InkWell(
|
||||
onTap: () async => onPushDetail(heroTag),
|
||||
child: Column(
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
double maxWidth = boxConstraints.maxWidth;
|
||||
double maxHeight = boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
children: [
|
||||
Hero(
|
||||
tag: heroTag,
|
||||
child: NetworkImgLayer(
|
||||
src: videoItem.pic,
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
),
|
||||
),
|
||||
if (videoItem.duration != null)
|
||||
if (crossAxisCount == 1) ...[
|
||||
PBadge(
|
||||
bottom: 10,
|
||||
right: 10,
|
||||
text: videoItem.duration,
|
||||
)
|
||||
] else ...[
|
||||
PBadge(
|
||||
bottom: 6,
|
||||
right: 7,
|
||||
size: 'small',
|
||||
type: 'gray',
|
||||
text: videoItem.duration,
|
||||
)
|
||||
],
|
||||
return InkWell(
|
||||
onTap: () async => onPushDetail(heroTag),
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context,
|
||||
videoItem,
|
||||
SmartDialog.dismiss,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Column(
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: StyleString.aspectRatio,
|
||||
child: LayoutBuilder(builder: (context, boxConstraints) {
|
||||
double maxWidth = boxConstraints.maxWidth;
|
||||
double maxHeight = boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
children: [
|
||||
Hero(
|
||||
tag: heroTag,
|
||||
child: NetworkImgLayer(
|
||||
src: videoItem.pic,
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
),
|
||||
),
|
||||
if (videoItem.duration > 0)
|
||||
if (crossAxisCount == 1) ...[
|
||||
PBadge(
|
||||
bottom: 10,
|
||||
right: 10,
|
||||
text: Utils.timeFormat(videoItem.duration),
|
||||
)
|
||||
] else ...[
|
||||
PBadge(
|
||||
bottom: 6,
|
||||
right: 7,
|
||||
size: 'small',
|
||||
type: 'gray',
|
||||
text: Utils.timeFormat(videoItem.duration),
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
VideoContent(videoItem: videoItem, crossAxisCount: crossAxisCount)
|
||||
],
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
VideoContent(
|
||||
videoItem: videoItem,
|
||||
crossAxisCount: crossAxisCount,
|
||||
blockUserCb: blockUserCb,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -191,133 +168,101 @@ class VideoCardV extends StatelessWidget {
|
||||
class VideoContent extends StatelessWidget {
|
||||
final dynamic videoItem;
|
||||
final int crossAxisCount;
|
||||
const VideoContent(
|
||||
{Key? key, required this.videoItem, required this.crossAxisCount})
|
||||
: super(key: key);
|
||||
final Function? blockUserCb;
|
||||
|
||||
const VideoContent({
|
||||
Key? key,
|
||||
required this.videoItem,
|
||||
required this.crossAxisCount,
|
||||
this.blockUserCb,
|
||||
}) : super(key: key);
|
||||
|
||||
Widget _buildBadge(String text, String type, [double fs = 12]) {
|
||||
return PBadge(
|
||||
text: text,
|
||||
stack: 'normal',
|
||||
size: 'small',
|
||||
type: type,
|
||||
fs: fs,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
flex: crossAxisCount == 1 ? 0 : 1,
|
||||
child: Padding(
|
||||
padding: crossAxisCount == 1
|
||||
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
||||
: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
videoItem.title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (videoItem.goto == 'av' && crossAxisCount == 1) ...[
|
||||
const SizedBox(width: 10),
|
||||
WatchLater(
|
||||
size: 32,
|
||||
iconSize: 18,
|
||||
callFn: () async {
|
||||
int aid = videoItem.param;
|
||||
var res =
|
||||
await UserHttp.toViewLater(bvid: IdUtils.av2bv(aid));
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
if (crossAxisCount > 1) ...[
|
||||
const SizedBox(height: 2),
|
||||
VideoStat(
|
||||
videoItem: videoItem,
|
||||
),
|
||||
],
|
||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
if (videoItem.goto == 'bangumi') ...[
|
||||
PBadge(
|
||||
text: videoItem.bangumiBadge,
|
||||
stack: 'normal',
|
||||
size: 'small',
|
||||
type: 'line',
|
||||
fs: 9,
|
||||
)
|
||||
],
|
||||
if (videoItem.rcmdReason != null &&
|
||||
videoItem.rcmdReason.content != '') ...[
|
||||
PBadge(
|
||||
text: videoItem.rcmdReason.content,
|
||||
stack: 'normal',
|
||||
size: 'small',
|
||||
type: 'color',
|
||||
)
|
||||
],
|
||||
if (videoItem.goto == 'picture') ...[
|
||||
const PBadge(
|
||||
text: '动态',
|
||||
stack: 'normal',
|
||||
size: 'small',
|
||||
type: 'line',
|
||||
fs: 9,
|
||||
)
|
||||
],
|
||||
if (videoItem.isFollowed == 1) ...[
|
||||
const PBadge(
|
||||
text: '已关注',
|
||||
stack: 'normal',
|
||||
size: 'small',
|
||||
type: 'color',
|
||||
)
|
||||
],
|
||||
Expanded(
|
||||
flex: crossAxisCount == 1 ? 0 : 1,
|
||||
child: Text(
|
||||
videoItem.owner.name,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (crossAxisCount == 1) ...[
|
||||
Text(
|
||||
' • ',
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
VideoStat(
|
||||
videoItem: videoItem,
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
|
||||
WatchLater(
|
||||
size: 24,
|
||||
iconSize: 14,
|
||||
callFn: () async {
|
||||
int aid = videoItem.param;
|
||||
var res =
|
||||
await UserHttp.toViewLater(bvid: IdUtils.av2bv(aid));
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
),
|
||||
] else ...[
|
||||
const SizedBox(height: 24)
|
||||
]
|
||||
],
|
||||
),
|
||||
return Padding(
|
||||
padding: crossAxisCount == 1
|
||||
? const EdgeInsets.fromLTRB(9, 9, 9, 4)
|
||||
: const EdgeInsets.fromLTRB(5, 8, 5, 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
videoItem.title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (crossAxisCount > 1) ...[
|
||||
const SizedBox(height: 2),
|
||||
VideoStat(videoItem: videoItem, crossAxisCount: crossAxisCount),
|
||||
],
|
||||
),
|
||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
if (videoItem.goto == 'bangumi')
|
||||
_buildBadge(videoItem.bangumiBadge, 'line', 9),
|
||||
if (videoItem.rcmdReason != null)
|
||||
_buildBadge(videoItem.rcmdReason, 'color'),
|
||||
if (videoItem.goto == 'picture') _buildBadge('动态', 'line', 9),
|
||||
if (videoItem.isFollowed == 1) _buildBadge('已关注', 'color'),
|
||||
Expanded(
|
||||
flex: crossAxisCount == 1 ? 0 : 1,
|
||||
child: Text(
|
||||
videoItem.owner.name,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (crossAxisCount == 1) ...[
|
||||
const SizedBox(width: 10),
|
||||
VideoStat(
|
||||
videoItem: videoItem,
|
||||
crossAxisCount: crossAxisCount,
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
if (videoItem.goto == 'av')
|
||||
SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: () {
|
||||
feedBack();
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
builder: (context) {
|
||||
return MorePanel(
|
||||
videoItem: videoItem,
|
||||
blockUserCb: blockUserCb,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.more_vert_outlined,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
size: 14,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -325,73 +270,149 @@ class VideoContent extends StatelessWidget {
|
||||
|
||||
class VideoStat extends StatelessWidget {
|
||||
final dynamic videoItem;
|
||||
final int crossAxisCount;
|
||||
|
||||
const VideoStat({
|
||||
Key? key,
|
||||
required this.videoItem,
|
||||
required this.crossAxisCount,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RichText(
|
||||
maxLines: 1,
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
children: [
|
||||
if (videoItem.stat.view != '-')
|
||||
TextSpan(text: '${videoItem.stat.view}观看'),
|
||||
if (videoItem.stat.danmu != '-')
|
||||
TextSpan(text: ' • ${videoItem.stat.danmu}弹幕'),
|
||||
],
|
||||
),
|
||||
return Row(
|
||||
children: [
|
||||
StatView(view: videoItem.stat.view),
|
||||
const SizedBox(width: 8),
|
||||
StatDanMu(danmu: videoItem.stat.danmu),
|
||||
if (videoItem is RecVideoItemModel) ...<Widget>[
|
||||
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
|
||||
RichText(
|
||||
maxLines: 1,
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
text: Utils.formatTimestampToRelativeTime(videoItem.pubdate)),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
]
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class WatchLater extends StatelessWidget {
|
||||
final double? size;
|
||||
final double? iconSize;
|
||||
final Function? callFn;
|
||||
class MorePanel extends StatelessWidget {
|
||||
final dynamic videoItem;
|
||||
final Function? blockUserCb;
|
||||
const MorePanel({
|
||||
super.key,
|
||||
required this.videoItem,
|
||||
this.blockUserCb,
|
||||
});
|
||||
|
||||
const WatchLater({
|
||||
Key? key,
|
||||
required this.size,
|
||||
required this.iconSize,
|
||||
this.callFn,
|
||||
}) : super(key: key);
|
||||
Future<dynamic> menuActionHandler(String type) async {
|
||||
switch (type) {
|
||||
case 'block':
|
||||
Get.back();
|
||||
blockUser();
|
||||
break;
|
||||
case 'watchLater':
|
||||
var res = await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
||||
SmartDialog.showToast(res['msg']);
|
||||
Get.back();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
void blockUser() async {
|
||||
SmartDialog.show(
|
||||
useSystem: true,
|
||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('提示'),
|
||||
content: Text('确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
||||
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => SmartDialog.dismiss(),
|
||||
child: Text(
|
||||
'点错了',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
var res = await VideoHttp.relationMod(
|
||||
mid: videoItem.owner.mid,
|
||||
act: 5,
|
||||
reSrc: 11,
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (res['status']) {
|
||||
blockUserCb?.call(videoItem.owner.mid);
|
||||
}
|
||||
SmartDialog.showToast(res['msg']);
|
||||
},
|
||||
child: const Text('确认'),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: size,
|
||||
height: size,
|
||||
child: PopupMenuButton<String>(
|
||||
padding: EdgeInsets.zero,
|
||||
tooltip: '稍后再看',
|
||||
icon: Icon(
|
||||
Icons.more_vert_outlined,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
size: iconSize,
|
||||
),
|
||||
position: PopupMenuPosition.under,
|
||||
// constraints: const BoxConstraints(maxHeight: 35),
|
||||
onSelected: (String type) {},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||
PopupMenuItem<String>(
|
||||
onTap: () => callFn!(),
|
||||
value: 'pause',
|
||||
height: 35,
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(Icons.watch_later_outlined, size: 16),
|
||||
SizedBox(width: 6),
|
||||
Text('稍后再看', style: TextStyle(fontSize: 13))
|
||||
],
|
||||
return Container(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () async => await menuActionHandler('block'),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.block, size: 19),
|
||||
title: Text(
|
||||
'拉黑up主 「${videoItem.owner.name}」',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () async => await menuActionHandler('watchLater'),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.watch_later_outlined, size: 19),
|
||||
title:
|
||||
Text('添加至稍后再看', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () =>
|
||||
imageSaveDialog(context, videoItem, SmartDialog.dismiss),
|
||||
minLeadingWidth: 0,
|
||||
leading: const Icon(Icons.photo_outlined, size: 19),
|
||||
title:
|
||||
Text('查看视频封面', style: Theme.of(context).textTheme.titleSmall),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -185,11 +185,11 @@ class Api {
|
||||
static const String searchDefault = '/x/web-interface/wbi/search/default';
|
||||
|
||||
// 搜索关键词
|
||||
static const String serachSuggest =
|
||||
static const String searchSuggest =
|
||||
'https://s.search.bilibili.com/main/suggest';
|
||||
|
||||
// 分类搜索
|
||||
static const String searchByType = '/x/web-interface/search/type';
|
||||
static const String searchByType = '/x/web-interface/wbi/search/type';
|
||||
|
||||
// 记录视频播放进度
|
||||
// https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/video/report.md
|
||||
@ -214,6 +214,9 @@ class Api {
|
||||
// https://api.bilibili.com/x/relation/tags
|
||||
static const String followingsClass = '/x/relation/tags';
|
||||
|
||||
// 搜索follow
|
||||
static const followSearch = '/x/relation/followings/search';
|
||||
|
||||
// 粉丝
|
||||
// vmid 用户id pn 页码 ps 每页个数,最大50 order: desc
|
||||
// order_type 排序规则 最近访问传空,最常访问传 attention
|
||||
@ -230,6 +233,10 @@ class Api {
|
||||
static const String liveRoomInfo =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-room/v2/index/getRoomPlayInfo';
|
||||
|
||||
// 直播间详情 H5
|
||||
static const String liveRoomInfoH5 =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getH5InfoByRoom';
|
||||
|
||||
// 用户信息 需要Wbi签名
|
||||
// https://api.bilibili.com/x/space/wbi/acc/info?mid=503427686&token=&platform=web&web_location=1550101&w_rid=d709892496ce93e3d94d6d37c95bde91&wts=1689301482
|
||||
static const String memberInfo = '/x/space/wbi/acc/info';
|
||||
@ -393,12 +400,24 @@ class Api {
|
||||
'${HttpString.passBaseUrl}/x/passport-login/captcha?source=main_web';
|
||||
|
||||
// web端短信验证码
|
||||
static const String smsCode =
|
||||
static const String webSmsCode =
|
||||
'${HttpString.passBaseUrl}/x/passport-login/web/sms/send';
|
||||
|
||||
// web端验证码登录
|
||||
static const String webSmsLogin =
|
||||
'${HttpString.passBaseUrl}/x/passport-login/web/login/sms';
|
||||
|
||||
// web端密码登录
|
||||
static const String loginInByWebPwd =
|
||||
'${HttpString.passBaseUrl}/x/passport-login/web/login';
|
||||
|
||||
// web端二维码
|
||||
static const String qrCodeApi =
|
||||
'${HttpString.passBaseUrl}/x/passport-login/web/qrcode/generate';
|
||||
|
||||
// 扫码登录
|
||||
static const String loginInByQrcode =
|
||||
'${HttpString.passBaseUrl}/x/passport-login/web/qrcode/poll';
|
||||
|
||||
// app端短信验证码
|
||||
static const String appSmsCode =
|
||||
@ -467,4 +486,113 @@ class Api {
|
||||
/// page_size
|
||||
static const getSeasonDetailApi =
|
||||
'/x/polymer/web-space/seasons_archives_list';
|
||||
|
||||
static const getSeriesDetailApi = '/x/series/archives';
|
||||
|
||||
/// 获取未读动态数
|
||||
static const getUnreadDynamic = '/x/web-interface/dynamic/entrance';
|
||||
|
||||
/// 用户动态主页
|
||||
static const dynamicSpmPrefix = 'https://space.bilibili.com/1/dynamic';
|
||||
|
||||
/// 激活buvid3
|
||||
static const activateBuvidApi = '/x/internal/gaia-gateway/ExClimbWuzhi';
|
||||
|
||||
/// 获取字幕配置
|
||||
static const getSubtitleConfig = '/x/player/v2';
|
||||
|
||||
/// 我的订阅
|
||||
static const userSubFolder = '/x/v3/fav/folder/collected/list';
|
||||
|
||||
/// 我的订阅详情 type 21
|
||||
static const userSeasonList = '/x/space/fav/season/list';
|
||||
|
||||
/// 我的订阅详情 type 11
|
||||
static const userResourceList = '/x/v3/fav/resource/list';
|
||||
|
||||
/// 表情
|
||||
static const emojiList = '/x/emote/user/panel/web';
|
||||
|
||||
/// 已读标记
|
||||
static const String ackSessionMsg =
|
||||
'${HttpString.tUrl}/session_svr/v1/session_svr/update_ack';
|
||||
|
||||
/// 发送私信
|
||||
static const String sendMsg = '${HttpString.tUrl}/web_im/v1/web_im/send_msg';
|
||||
|
||||
/// 排行榜
|
||||
static const String getRankApi = "/x/web-interface/ranking/v2";
|
||||
|
||||
/// 取消订阅
|
||||
static const String cancelSub = '/x/v3/fav/season/unfav';
|
||||
|
||||
/// 动态转发
|
||||
static const String dynamicForwardUrl = '/x/dynamic/feed/create/submit_check';
|
||||
|
||||
/// 创建动态
|
||||
static const String dynamicCreate = '/x/dynamic/feed/create/dyn';
|
||||
|
||||
/// 删除收藏夹
|
||||
static const String delFavFolder = '/x/v3/fav/folder/del';
|
||||
|
||||
/// 搜索结果计数
|
||||
static const String searchCount = '/x/web-interface/wbi/search/all/v2';
|
||||
|
||||
/// 关闭会话
|
||||
static const String removeSession =
|
||||
'${HttpString.tUrl}/session_svr/v1/session_svr/remove_session';
|
||||
|
||||
/// 消息未读数
|
||||
static const String unread = '${HttpString.tUrl}/x/im/web/msgfeed/unread';
|
||||
|
||||
/// 回复我的
|
||||
static const String messageReplyAPi = '/x/msgfeed/reply';
|
||||
|
||||
/// 收到的赞
|
||||
static const String messageLikeAPi = '/x/msgfeed/like';
|
||||
|
||||
/// 系统通知
|
||||
static const String messageSystemAPi =
|
||||
'${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
|
||||
|
||||
/// 系统通知 个人
|
||||
static const String userMessageSystemAPi =
|
||||
'${HttpString.messageBaseUrl}/x/sys-msg/query_user_notify';
|
||||
|
||||
/// 系统通知标记已读
|
||||
static const String systemMarkRead =
|
||||
'${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
|
||||
|
||||
/// 编辑收藏夹
|
||||
static const String editFavFolder = '/x/v3/fav/folder/edit';
|
||||
|
||||
/// 新建收藏夹
|
||||
static const String addFavFolder = '/x/v3/fav/folder/add';
|
||||
|
||||
/// 直播间弹幕信息
|
||||
static const String getDanmuInfo =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getDanmuInfo';
|
||||
|
||||
/// 直播间发送弹幕
|
||||
static const String sendLiveMsg = '${HttpString.liveBaseUrl}/msg/send';
|
||||
|
||||
/// 我的关注 - 正在直播
|
||||
static const String getFollowingLive =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-ucenter/user/following';
|
||||
|
||||
/// 稍后再看&收藏夹视频列表
|
||||
static const String mediaList = '/x/v2/medialist/resource/list';
|
||||
|
||||
/// 用户专栏
|
||||
static const String opusList = '/x/polymer/web-dynamic/v1/opus/feed/space';
|
||||
|
||||
///
|
||||
static const String getViewInfo = '/x/article/viewinfo';
|
||||
|
||||
/// 直播间记录
|
||||
static const String liveRoomEntry =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/roomEntryAction';
|
||||
|
||||
/// 删除评论
|
||||
static const String replyDel = '/x/v2/reply/del';
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/bangumi/list.dart';
|
||||
import '../models/bangumi/list.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class BangumiHttp {
|
||||
static Future bangumiList({int? page}) async {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/user/black.dart';
|
||||
import '../models/user/black.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class BlackHttp {
|
||||
static Future blackList({required int pn, int? ps}) async {
|
||||
@ -28,7 +28,7 @@ class BlackHttp {
|
||||
static Future removeBlack({required int fid}) async {
|
||||
var res = await Request().post(
|
||||
Api.removeBlack,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'act': 6,
|
||||
'csrf': await Request.getCsrf(),
|
||||
'fid': fid,
|
||||
|
17
lib/http/common.dart
Normal file
17
lib/http/common.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'index.dart';
|
||||
|
||||
class CommonHttp {
|
||||
static Future unReadDynamic() async {
|
||||
var res = await Request().get(Api.getUnreadDynamic,
|
||||
data: {'alltype_offset': 0, 'video_offset': '', 'article_offset': 0});
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']['dyn_basic_infos']};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ class HttpString {
|
||||
static const String appBaseUrl = 'https://app.bilibili.com';
|
||||
static const String liveBaseUrl = 'https://api.live.bilibili.com';
|
||||
static const String passBaseUrl = 'https://passport.bilibili.com';
|
||||
static const String messageBaseUrl = 'https://message.bilibili.com';
|
||||
static const String bangumiBaseUrl = 'https://bili.meark.me';
|
||||
static const List<int> validateStatusCodes = [
|
||||
302,
|
||||
304,
|
||||
|
@ -1,9 +1,6 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/danmaku/dm.pb.dart';
|
||||
|
||||
import 'constants.dart';
|
||||
import '../models/danmaku/dm.pb.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class DanmakaHttp {
|
||||
// 获取视频弹幕
|
||||
@ -24,21 +21,23 @@ class DanmakaHttp {
|
||||
);
|
||||
return DmSegMobileReply.fromBuffer(response.data);
|
||||
}
|
||||
|
||||
static Future shootDanmaku({
|
||||
int type = 1,//弹幕类选择(1:视频弹幕 2:漫画弹幕)
|
||||
required int oid,// 视频cid
|
||||
required String msg,//弹幕文本(长度小于 100 字符)
|
||||
int mode = 1,// 弹幕类型(1:滚动弹幕 4:底端弹幕 5:顶端弹幕 6:逆向弹幕(不能使用) 7:高级弹幕 8:代码弹幕(不能使用) 9:BAS弹幕(pool必须为2))
|
||||
int type = 1, //弹幕类选择(1:视频弹幕 2:漫画弹幕)
|
||||
required int oid, // 视频cid
|
||||
required String msg, //弹幕文本(长度小于 100 字符)
|
||||
int mode =
|
||||
1, // 弹幕类型(1:滚动弹幕 4:底端弹幕 5:顶端弹幕 6:逆向弹幕(不能使用) 7:高级弹幕 8:代码弹幕(不能使用) 9:BAS弹幕(pool必须为2))
|
||||
// String? aid,// 稿件avid
|
||||
// String? bvid,// bvid与aid必须有一个
|
||||
required String bvid,
|
||||
int? progress,// 弹幕出现在视频内的时间(单位为毫秒,默认为0)
|
||||
int? color,// 弹幕颜色(默认白色,16777215)
|
||||
int? fontsize,// 弹幕字号(默认25)
|
||||
int? pool,// 弹幕池选择(0:普通池 1:字幕池 2:特殊池(代码/BAS弹幕)默认普通池,0)
|
||||
int? progress, // 弹幕出现在视频内的时间(单位为毫秒,默认为0)
|
||||
int? color, // 弹幕颜色(默认白色,16777215)
|
||||
int? fontsize, // 弹幕字号(默认25)
|
||||
int? pool, // 弹幕池选择(0:普通池 1:字幕池 2:特殊池(代码/BAS弹幕)默认普通池,0)
|
||||
//int? rnd,// 当前时间戳*1000000(若无此项,则发送弹幕冷却时间限制为90s;若有此项,则发送弹幕冷却时间限制为5s)
|
||||
int? colorful,//60001:专属渐变彩色(需要会员)
|
||||
int? checkbox_type,//是否带 UP 身份标识(0:普通;4:带有标识)
|
||||
int? colorful, //60001:专属渐变彩色(需要会员)
|
||||
int? checkbox_type, //是否带 UP 身份标识(0:普通;4:带有标识)
|
||||
// String? csrf,//CSRF Token(位于 Cookie) Cookie 方式必要
|
||||
// String? access_key,// APP 登录 Token APP 方式必要
|
||||
}) async {
|
||||
@ -68,9 +67,6 @@ class DanmakaHttp {
|
||||
var response = await Request().post(
|
||||
Api.shootDanmaku,
|
||||
data: params,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
return {
|
||||
|
@ -1,6 +1,8 @@
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/dynamics/result.dart';
|
||||
import 'package:pilipala/models/dynamics/up.dart';
|
||||
import 'dart:math';
|
||||
import 'package:dio/dio.dart';
|
||||
import '../models/dynamics/result.dart';
|
||||
import '../models/dynamics/up.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class DynamicsHttp {
|
||||
static Future followDynamic({
|
||||
@ -40,6 +42,7 @@ class DynamicsHttp {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
'code': res.data['code'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -67,7 +70,7 @@ class DynamicsHttp {
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.likeDynamic,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'dynamic_id': dynamicId,
|
||||
'up': up,
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -117,4 +120,99 @@ class DynamicsHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future dynamicForward() async {
|
||||
var res = await Request().post(
|
||||
Api.dynamicForwardUrl,
|
||||
queryParameters: {
|
||||
'csrf': await Request.getCsrf(),
|
||||
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
||||
'x-bili-web-req-json': {'spm_id': '333.999'},
|
||||
},
|
||||
data: {
|
||||
'attach_card': null,
|
||||
'scene': 4,
|
||||
'content': {
|
||||
'conetents': [
|
||||
{'raw_text': "2", 'type': 1, 'biz_id': ""}
|
||||
]
|
||||
}
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future dynamicCreate({
|
||||
required int mid,
|
||||
required int scene,
|
||||
int? oid,
|
||||
String? dynIdStr,
|
||||
String? rawText,
|
||||
}) async {
|
||||
DateTime now = DateTime.now();
|
||||
int timestamp = now.millisecondsSinceEpoch ~/ 1000;
|
||||
Random random = Random();
|
||||
int randomNumber = random.nextInt(9000) + 1000;
|
||||
String uploadId = '${mid}_${timestamp}_$randomNumber';
|
||||
|
||||
Map<String, dynamic> webRepostSrc = {
|
||||
'dyn_id_str': dynIdStr ?? '',
|
||||
};
|
||||
|
||||
/// 投稿转发
|
||||
if (scene == 5) {
|
||||
webRepostSrc = {
|
||||
'revs_id': {'dyn_type': 8, 'rid': oid}
|
||||
};
|
||||
}
|
||||
var res = await Request().post(
|
||||
Api.dynamicCreate,
|
||||
queryParameters: {
|
||||
'platform': 'web',
|
||||
'csrf': await Request.getCsrf(),
|
||||
'x-bili-device-req-json': {'platform': 'web', 'device': 'pc'},
|
||||
'x-bili-web-req-json': {'spm_id': '333.999'},
|
||||
},
|
||||
data: {
|
||||
'dyn_req': {
|
||||
'content': {
|
||||
'contents': [
|
||||
{'raw_text': rawText ?? '', 'type': 1, 'biz_id': ''}
|
||||
]
|
||||
},
|
||||
'scene': scene,
|
||||
'attach_card': null,
|
||||
'upload_id': uploadId,
|
||||
'meta': {
|
||||
'app_meta': {'from': 'create.dynamic.web', 'mobi_app': 'web'}
|
||||
}
|
||||
},
|
||||
'web_repost_src': webRepostSrc
|
||||
},
|
||||
options: Options(contentType: 'application/json'),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/fans/result.dart';
|
||||
import '../models/fans/result.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class FanHttp {
|
||||
static Future fans({int? vmid, int? pn, int? ps, String? orderType}) async {
|
||||
|
67
lib/http/fav.dart
Normal file
67
lib/http/fav.dart
Normal file
@ -0,0 +1,67 @@
|
||||
import 'index.dart';
|
||||
|
||||
class FavHttp {
|
||||
/// 编辑收藏夹
|
||||
static Future editFolder({
|
||||
required String title,
|
||||
required String intro,
|
||||
required String mediaId,
|
||||
String? cover,
|
||||
int? privacy,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.editFavFolder,
|
||||
data: {
|
||||
'title': title,
|
||||
'intro': intro,
|
||||
'media_id': mediaId,
|
||||
'cover': cover ?? '',
|
||||
'privacy': privacy ?? 0,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// 新建收藏夹
|
||||
static Future addFolder({
|
||||
required String title,
|
||||
required String intro,
|
||||
String? cover,
|
||||
int? privacy,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.addFavFolder,
|
||||
data: {
|
||||
'title': title,
|
||||
'intro': intro,
|
||||
'cover': cover ?? '',
|
||||
'privacy': privacy ?? 0,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/follow/result.dart';
|
||||
import '../models/follow/result.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class FollowHttp {
|
||||
static Future followings(
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:html/dom.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class HtmlHttp {
|
||||
// article
|
||||
@ -15,7 +15,7 @@ class HtmlHttp {
|
||||
Match match = regex.firstMatch(response.data)!;
|
||||
String matchedString = match.group(0)!;
|
||||
response = await Request().get(
|
||||
'https:$matchedString' + '/',
|
||||
'https:$matchedString/',
|
||||
extra: {'ua': 'pc'},
|
||||
);
|
||||
}
|
||||
|
@ -1,17 +1,21 @@
|
||||
// ignore_for_file: avoid_print
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'dart:math' show Random;
|
||||
import 'package:cookie_jar/cookie_jar.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio/io.dart';
|
||||
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import 'package:pilipala/http/constants.dart';
|
||||
import 'package:pilipala/http/interceptor.dart';
|
||||
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
|
||||
// import 'package:dio_http2_adapter/dio_http2_adapter.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
import '../utils/storage.dart';
|
||||
import '../utils/utils.dart';
|
||||
import 'api.dart';
|
||||
import 'constants.dart';
|
||||
import 'interceptor.dart';
|
||||
|
||||
class Request {
|
||||
static final Request _instance = Request._internal();
|
||||
@ -20,25 +24,29 @@ class Request {
|
||||
factory Request() => _instance;
|
||||
Box setting = GStrorage.setting;
|
||||
static Box localCache = GStrorage.localCache;
|
||||
late dynamic enableSystemProxy;
|
||||
late bool enableSystemProxy;
|
||||
late String systemProxyHost;
|
||||
late String systemProxyPort;
|
||||
static final RegExp spmPrefixExp =
|
||||
RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
|
||||
static String? buvid;
|
||||
|
||||
/// 设置cookie
|
||||
static setCookie() async {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
var cookiePath = await Utils.getCookiePath();
|
||||
var cookieJar = PersistCookieJar(
|
||||
Box setting = GStrorage.setting;
|
||||
final String cookiePath = await Utils.getCookiePath();
|
||||
final PersistCookieJar cookieJar = PersistCookieJar(
|
||||
ignoreExpires: true,
|
||||
storage: FileStorage(cookiePath),
|
||||
);
|
||||
cookieManager = CookieManager(cookieJar);
|
||||
dio.interceptors.add(cookieManager);
|
||||
var cookie = await cookieManager.cookieJar
|
||||
final List<Cookie> cookie = await cookieManager.cookieJar
|
||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||
var userInfo = userInfoCache.get('userInfoCache');
|
||||
final userInfo = userInfoCache.get('userInfoCache');
|
||||
if (userInfo != null && userInfo.mid != null) {
|
||||
var cookie2 = await cookieManager.cookieJar
|
||||
final List<Cookie> cookie2 = await cookieManager.cookieJar
|
||||
.loadForRequest(Uri.parse(HttpString.tUrl));
|
||||
if (cookie2.isEmpty) {
|
||||
try {
|
||||
@ -49,22 +57,27 @@ class Request {
|
||||
}
|
||||
}
|
||||
setOptionsHeaders(userInfo, userInfo != null && userInfo.mid != null);
|
||||
|
||||
if (cookie.isEmpty) {
|
||||
try {
|
||||
await Request().get(HttpString.baseUrl);
|
||||
} catch (e) {
|
||||
log("setCookie, ${e.toString()}");
|
||||
}
|
||||
String baseUrlType = 'default';
|
||||
if (setting.get(SettingBoxKey.enableGATMode, defaultValue: false)) {
|
||||
baseUrlType = 'bangumi';
|
||||
}
|
||||
var cookieString =
|
||||
cookie.map((cookie) => '${cookie.name}=${cookie.value}').join('; ');
|
||||
setBaseUrl(type: baseUrlType);
|
||||
try {
|
||||
await buvidActivate();
|
||||
} catch (e) {
|
||||
log("setCookie, ${e.toString()}");
|
||||
}
|
||||
|
||||
final String cookieString = cookie
|
||||
.map((Cookie cookie) => '${cookie.name}=${cookie.value}')
|
||||
.join('; ');
|
||||
|
||||
dio.options.headers['cookie'] = cookieString;
|
||||
}
|
||||
|
||||
// 从cookie中获取 csrf token
|
||||
static Future<String> getCsrf() async {
|
||||
var cookies = await cookieManager.cookieJar
|
||||
List<Cookie> cookies = await cookieManager.cookieJar
|
||||
.loadForRequest(Uri.parse(HttpString.apiBaseUrl));
|
||||
String token = '';
|
||||
if (cookies.where((e) => e.name == 'bili_jct').isNotEmpty) {
|
||||
@ -73,17 +86,66 @@ class Request {
|
||||
return token;
|
||||
}
|
||||
|
||||
static setOptionsHeaders(userInfo, status) {
|
||||
static Future<String> getBuvid() async {
|
||||
if (buvid != null) {
|
||||
return buvid!;
|
||||
}
|
||||
|
||||
final List<Cookie> cookies = await cookieManager.cookieJar
|
||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||
buvid = cookies.firstWhere((cookie) => cookie.name == 'buvid3').value;
|
||||
if (buvid == null) {
|
||||
try {
|
||||
var result = await Request().get(
|
||||
"${HttpString.apiBaseUrl}/x/frontend/finger/spi",
|
||||
);
|
||||
buvid = result["data"]["b_3"].toString();
|
||||
} catch (e) {
|
||||
// 处理请求错误
|
||||
buvid = '';
|
||||
print("Error fetching buvid: $e");
|
||||
}
|
||||
}
|
||||
|
||||
return buvid!;
|
||||
}
|
||||
|
||||
static setOptionsHeaders(userInfo, bool status) {
|
||||
if (status) {
|
||||
dio.options.headers['x-bili-mid'] = userInfo.mid.toString();
|
||||
dio.options.headers['x-bili-aurora-eid'] =
|
||||
IdUtils.genAuroraEid(userInfo.mid);
|
||||
}
|
||||
dio.options.headers['env'] = 'prod';
|
||||
dio.options.headers['app-key'] = 'android64';
|
||||
dio.options.headers['x-bili-aurora-eid'] = 'UlMFQVcABlAH';
|
||||
dio.options.headers['x-bili-aurora-zone'] = 'sh001';
|
||||
dio.options.headers['referer'] = 'https://www.bilibili.com/';
|
||||
}
|
||||
|
||||
static Future buvidActivate() async {
|
||||
var html = await Request().get(Api.dynamicSpmPrefix);
|
||||
String spmPrefix = spmPrefixExp.firstMatch(html.data)!.group(1)!;
|
||||
Random rand = Random();
|
||||
String rand_png_end = base64.encode(
|
||||
List<int>.generate(32, (_) => rand.nextInt(256)) +
|
||||
List<int>.filled(4, 0) +
|
||||
[73, 69, 78, 68] +
|
||||
List<int>.generate(4, (_) => rand.nextInt(256)));
|
||||
|
||||
String jsonData = json.encode({
|
||||
'3064': 1,
|
||||
'39c8': '${spmPrefix}.fp.risk',
|
||||
'3c43': {
|
||||
'adca': 'Linux',
|
||||
'bfe9': rand_png_end.substring(rand_png_end.length - 50),
|
||||
},
|
||||
});
|
||||
|
||||
await Request().post(Api.activateBuvidApi,
|
||||
data: {'payload': jsonData},
|
||||
options: Options(contentType: 'application/json'));
|
||||
}
|
||||
|
||||
/*
|
||||
* config it and create
|
||||
*/
|
||||
@ -100,30 +162,31 @@ class Request {
|
||||
headers: {},
|
||||
);
|
||||
|
||||
enableSystemProxy =
|
||||
setting.get(SettingBoxKey.enableSystemProxy, defaultValue: false);
|
||||
enableSystemProxy = setting.get(SettingBoxKey.enableSystemProxy,
|
||||
defaultValue: false) as bool;
|
||||
systemProxyHost =
|
||||
localCache.get(LocalCacheKey.systemProxyHost, defaultValue: '');
|
||||
systemProxyPort =
|
||||
localCache.get(LocalCacheKey.systemProxyPort, defaultValue: '');
|
||||
|
||||
dio = Dio(options)
|
||||
dio = Dio(options);
|
||||
|
||||
/// fix 第三方登录 302重定向 跟iOS代理问题冲突
|
||||
..httpClientAdapter = Http2Adapter(
|
||||
ConnectionManager(
|
||||
idleTimeout: const Duration(milliseconds: 10000),
|
||||
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
|
||||
),
|
||||
);
|
||||
/// fix 第三方登录 302重定向 跟iOS代理问题冲突
|
||||
// ..httpClientAdapter = Http2Adapter(
|
||||
// ConnectionManager(
|
||||
// idleTimeout: const Duration(milliseconds: 10000),
|
||||
// onClientCreate: (_, ClientSetting config) =>
|
||||
// config.onBadCertificate = (_) => true,
|
||||
// ),
|
||||
// );
|
||||
|
||||
/// 设置代理
|
||||
if (enableSystemProxy) {
|
||||
dio.httpClientAdapter = IOHttpClientAdapter(
|
||||
createHttpClient: () {
|
||||
final client = HttpClient();
|
||||
final HttpClient client = HttpClient();
|
||||
// Config the client.
|
||||
client.findProxy = (uri) {
|
||||
client.findProxy = (Uri uri) {
|
||||
// return 'PROXY host:port';
|
||||
return 'PROXY $systemProxyHost:$systemProxyPort';
|
||||
};
|
||||
@ -145,7 +208,7 @@ class Request {
|
||||
));
|
||||
|
||||
dio.transformer = BackgroundTransformer();
|
||||
dio.options.validateStatus = (status) {
|
||||
dio.options.validateStatus = (int? status) {
|
||||
return status! >= 200 && status < 300 ||
|
||||
HttpString.validateStatusCodes.contains(status);
|
||||
};
|
||||
@ -156,7 +219,7 @@ class Request {
|
||||
*/
|
||||
get(url, {data, options, cancelToken, extra}) async {
|
||||
Response response;
|
||||
Options options = Options();
|
||||
final Options options = Options();
|
||||
ResponseType resType = ResponseType.json;
|
||||
if (extra != null) {
|
||||
resType = extra!['resType'] ?? ResponseType.json;
|
||||
@ -175,8 +238,14 @@ class Request {
|
||||
);
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
print('get error: $e');
|
||||
return Future.error(await ApiInterceptor.dioError(e));
|
||||
Response errResponse = Response(
|
||||
data: {
|
||||
'message': await ApiInterceptor.dioError(e)
|
||||
}, // 将自定义 Map 数据赋值给 Response 的 data 属性
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(),
|
||||
);
|
||||
return errResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,14 +260,21 @@ class Request {
|
||||
url,
|
||||
data: data,
|
||||
queryParameters: queryParameters,
|
||||
options: options,
|
||||
options:
|
||||
options ?? Options(contentType: Headers.formUrlEncodedContentType),
|
||||
cancelToken: cancelToken,
|
||||
);
|
||||
// print('post success: ${response.data}');
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
print('post error: $e');
|
||||
return Future.error(await ApiInterceptor.dioError(e));
|
||||
Response errResponse = Response(
|
||||
data: {
|
||||
'message': await ApiInterceptor.dioError(e)
|
||||
}, // 将自定义 Map 数据赋值给 Response 的 data 属性
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(),
|
||||
);
|
||||
return errResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,4 +324,17 @@ class Request {
|
||||
}
|
||||
return headerUa;
|
||||
}
|
||||
|
||||
static setBaseUrl({String type = 'default'}) {
|
||||
switch (type) {
|
||||
case 'default':
|
||||
dio.options.baseUrl = HttpString.apiBaseUrl;
|
||||
break;
|
||||
case 'bangumi':
|
||||
dio.options.baseUrl = HttpString.bangumiBaseUrl;
|
||||
break;
|
||||
default:
|
||||
dio.options.baseUrl = HttpString.apiBaseUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
// ignore_for_file: avoid_print
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
// import 'package:get/get.dart' hide Response;
|
||||
import '../utils/storage.dart';
|
||||
|
||||
class ApiInterceptor extends Interceptor {
|
||||
@override
|
||||
@ -21,16 +20,16 @@ class ApiInterceptor extends Interceptor {
|
||||
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
||||
try {
|
||||
if (response.statusCode == 302) {
|
||||
List<String> locations = response.headers['location']!;
|
||||
final List<String> locations = response.headers['location']!;
|
||||
if (locations.isNotEmpty) {
|
||||
if (locations.first.startsWith('https://www.mcbbs.net')) {
|
||||
final uri = Uri.parse(locations.first);
|
||||
final accessKey = uri.queryParameters['access_key'];
|
||||
final mid = uri.queryParameters['mid'];
|
||||
final Uri uri = Uri.parse(locations.first);
|
||||
final String? accessKey = uri.queryParameters['access_key'];
|
||||
final String? mid = uri.queryParameters['mid'];
|
||||
try {
|
||||
Box localCache = GStrorage.localCache;
|
||||
localCache.put(
|
||||
LocalCacheKey.accessKey, {'mid': mid, 'value': accessKey});
|
||||
localCache.put(LocalCacheKey.accessKey,
|
||||
<String, String?>{'mid': mid, 'value': accessKey});
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
@ -46,54 +45,58 @@ class ApiInterceptor extends Interceptor {
|
||||
void onError(DioException err, ErrorInterceptorHandler handler) async {
|
||||
// 处理网络请求错误
|
||||
// handler.next(err);
|
||||
SmartDialog.showToast(
|
||||
await dioError(err),
|
||||
displayType: SmartToastType.onlyRefresh,
|
||||
);
|
||||
String url = err.requestOptions.uri.toString();
|
||||
final excludedPatterns = RegExp(r'heartbeat|seg\.so|online/total');
|
||||
if (!excludedPatterns.hasMatch(url)) {
|
||||
SmartDialog.showToast(
|
||||
await dioError(err),
|
||||
displayType: SmartToastType.onlyRefresh,
|
||||
);
|
||||
}
|
||||
super.onError(err, handler);
|
||||
}
|
||||
|
||||
static Future dioError(DioException error) async {
|
||||
static Future<String> dioError(DioException error) async {
|
||||
switch (error.type) {
|
||||
case DioExceptionType.badCertificate:
|
||||
return '证书有误!';
|
||||
case DioExceptionType.badResponse:
|
||||
return '服务器异常,请稍后重试!';
|
||||
case DioExceptionType.cancel:
|
||||
return "请求已被取消,请重新请求";
|
||||
return '请求已被取消,请重新请求';
|
||||
case DioExceptionType.connectionError:
|
||||
return '连接错误,请检查网络设置';
|
||||
case DioExceptionType.connectionTimeout:
|
||||
return "网络连接超时,请检查网络设置";
|
||||
return '网络连接超时,请检查网络设置';
|
||||
case DioExceptionType.receiveTimeout:
|
||||
return "响应超时,请稍后重试!";
|
||||
return '响应超时,请稍后重试!';
|
||||
case DioExceptionType.sendTimeout:
|
||||
return "发送请求超时,请检查网络设置";
|
||||
return '发送请求超时,请检查网络设置';
|
||||
case DioExceptionType.unknown:
|
||||
var res = await checkConect();
|
||||
return res + " \n 网络异常,请稍后重试!";
|
||||
default:
|
||||
return "Dio异常";
|
||||
final String res = await checkConnect();
|
||||
return '$res,网络异常!';
|
||||
}
|
||||
}
|
||||
|
||||
static Future<dynamic> checkConect() async {
|
||||
final connectivityResult = await (Connectivity().checkConnectivity());
|
||||
if (connectivityResult == ConnectivityResult.mobile) {
|
||||
return 'connected with mobile network';
|
||||
} else if (connectivityResult == ConnectivityResult.wifi) {
|
||||
return 'connected with wifi network';
|
||||
} else if (connectivityResult == ConnectivityResult.ethernet) {
|
||||
// I am connected to a ethernet network.
|
||||
} else if (connectivityResult == ConnectivityResult.vpn) {
|
||||
// I am connected to a vpn network.
|
||||
// Note for iOS and macOS:
|
||||
// There is no separate network interface type for [vpn].
|
||||
// It returns [other] on any device (also simulator)
|
||||
} else if (connectivityResult == ConnectivityResult.other) {
|
||||
// I am connected to a network which is not in the above mentioned networks.
|
||||
} else if (connectivityResult == ConnectivityResult.none) {
|
||||
return 'not connected to any network';
|
||||
static Future<String> checkConnect() async {
|
||||
final List<ConnectivityResult> connectivityResult =
|
||||
await Connectivity().checkConnectivity();
|
||||
if (connectivityResult.contains(ConnectivityResult.mobile)) {
|
||||
return '正在使用移动流量';
|
||||
} else if (connectivityResult.contains(ConnectivityResult.wifi)) {
|
||||
return '正在使用wifi';
|
||||
} else if (connectivityResult.contains(ConnectivityResult.ethernet)) {
|
||||
return '正在使用局域网';
|
||||
} else if (connectivityResult.contains(ConnectivityResult.vpn)) {
|
||||
return '正在使用代理网络';
|
||||
} else if (connectivityResult.contains(ConnectivityResult.bluetooth)) {
|
||||
return '正在使用蓝牙网络';
|
||||
} else if (connectivityResult.contains(ConnectivityResult.other)) {
|
||||
return '正在使用其他网络';
|
||||
} else if (connectivityResult.contains(ConnectivityResult.none)) {
|
||||
return '未连接到任何网络';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
import 'package:pilipala/http/api.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/live/item.dart';
|
||||
import 'package:pilipala/models/live/room_info.dart';
|
||||
import 'package:pilipala/models/live/follow.dart';
|
||||
|
||||
import '../models/live/item.dart';
|
||||
import '../models/live/room_info.dart';
|
||||
import '../models/live/room_info_h5.dart';
|
||||
import 'api.dart';
|
||||
import 'init.dart';
|
||||
|
||||
class LiveHttp {
|
||||
static Future liveList(
|
||||
@ -46,4 +49,114 @@ class LiveHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future liveRoomInfoH5({roomId, qn}) async {
|
||||
var res = await Request().get(Api.liveRoomInfoH5, data: {
|
||||
'room_id': roomId,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': RoomInfoH5Model.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 获取弹幕信息
|
||||
static Future liveDanmakuInfo({roomId}) async {
|
||||
var res = await Request().get(Api.getDanmuInfo, data: {
|
||||
'id': roomId,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 发送弹幕
|
||||
static Future sendDanmaku({roomId, msg}) async {
|
||||
var res = await Request().post(
|
||||
Api.sendLiveMsg,
|
||||
data: {
|
||||
'bubble': 0,
|
||||
'msg': msg,
|
||||
'color': 16777215, // 颜色
|
||||
'mode': 1, // 模式
|
||||
'room_type': 0,
|
||||
'jumpfrom': 71001, // 直播间来源
|
||||
'reply_mid': 0,
|
||||
'reply_attr': 0,
|
||||
'replay_dmid': '',
|
||||
'statistics': {"appId": 100, "platform": 5},
|
||||
'fontsize': 25, // 字体大小
|
||||
'rnd': DateTime.now().millisecondsSinceEpoch ~/ 1000, // 时间戳
|
||||
'roomid': roomId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
'csrf_token': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 我的关注 正在直播
|
||||
static Future liveFollowing({int? pn, int? ps}) async {
|
||||
var res = await Request().get(Api.getFollowingLive, data: {
|
||||
'page': pn,
|
||||
'page_size': ps,
|
||||
'platform': 'web',
|
||||
'ignoreRecord': 1,
|
||||
'hit_ab': true,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': LiveFollowingModel.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 直播历史记录
|
||||
static Future liveRoomEntry({required int roomId}) async {
|
||||
await Request().post(
|
||||
Api.liveRoomEntry,
|
||||
data: {
|
||||
'room_id': roomId,
|
||||
'platform': 'pc',
|
||||
'csrf_token': await Request.getCsrf(),
|
||||
'csrf': await Request.getCsrf(),
|
||||
'visit_id': '',
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'package:crypto/crypto.dart';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:encrypt/encrypt.dart';
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/login/index.dart';
|
||||
import 'package:pilipala/utils/login.dart';
|
||||
import 'package:pilipala/http/constants.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import '../models/login/index.dart';
|
||||
import '../utils/login.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class LoginHttp {
|
||||
static Future queryCaptcha() async {
|
||||
@ -22,32 +22,32 @@ class LoginHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future sendSmsCode({
|
||||
int? cid,
|
||||
required int tel,
|
||||
required String token,
|
||||
required String challenge,
|
||||
required String validate,
|
||||
required String seccode,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.appSmsCode,
|
||||
data: {
|
||||
'cid': cid,
|
||||
'tel': tel,
|
||||
"source": "main_web",
|
||||
'token': token,
|
||||
'challenge': challenge,
|
||||
'validate': validate,
|
||||
'seccode': seccode,
|
||||
},
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
// headers: {'user-agent': ApiConstants.userAgent}
|
||||
),
|
||||
);
|
||||
print(res);
|
||||
}
|
||||
// static Future sendSmsCode({
|
||||
// int? cid,
|
||||
// required int tel,
|
||||
// required String token,
|
||||
// required String challenge,
|
||||
// required String validate,
|
||||
// required String seccode,
|
||||
// }) async {
|
||||
// var res = await Request().post(
|
||||
// Api.appSmsCode,
|
||||
// data: {
|
||||
// 'cid': cid,
|
||||
// 'tel': tel,
|
||||
// "source": "main_web",
|
||||
// 'token': token,
|
||||
// 'challenge': challenge,
|
||||
// 'validate': validate,
|
||||
// 'seccode': seccode,
|
||||
// },
|
||||
// options: Options(
|
||||
// contentType: Headers.formUrlEncodedContentType,
|
||||
// // headers: {'user-agent': ApiConstants.userAgent}
|
||||
// ),
|
||||
// );
|
||||
// print(res);
|
||||
// }
|
||||
|
||||
// web端验证码
|
||||
static Future sendWebSmsCode({
|
||||
@ -61,6 +61,7 @@ class LoginHttp {
|
||||
Map data = {
|
||||
'cid': cid,
|
||||
'tel': tel,
|
||||
"source": "main_web",
|
||||
'token': token,
|
||||
'challenge': challenge,
|
||||
'validate': validate,
|
||||
@ -68,17 +69,50 @@ class LoginHttp {
|
||||
};
|
||||
FormData formData = FormData.fromMap({...data});
|
||||
var res = await Request().post(
|
||||
Api.smsCode,
|
||||
Api.webSmsCode,
|
||||
data: formData,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
print(res);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// web端验证码登录
|
||||
static Future loginInByWebSmsCode() async {}
|
||||
static Future loginInByWebSmsCode({
|
||||
int? cid,
|
||||
required int tel,
|
||||
required int code,
|
||||
required String captchaKey,
|
||||
}) async {
|
||||
// webSmsLogin
|
||||
Map data = {
|
||||
"cid": cid,
|
||||
"tel": tel,
|
||||
"code": code,
|
||||
"source": "main_mini",
|
||||
"keep": 0,
|
||||
"captcha_key": captchaKey,
|
||||
"go_url": HttpString.baseUrl
|
||||
};
|
||||
FormData formData = FormData.fromMap({...data});
|
||||
var res = await Request().post(
|
||||
Api.webSmsLogin,
|
||||
data: formData,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// web端密码登录
|
||||
static Future liginInByWebPwd() async {}
|
||||
@ -115,9 +149,6 @@ class LoginHttp {
|
||||
var res = await Request().post(
|
||||
Api.appSmsCode,
|
||||
data: data,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
print(res);
|
||||
}
|
||||
@ -168,10 +199,82 @@ class LoginHttp {
|
||||
var res = await Request().post(
|
||||
Api.loginInByPwdApi,
|
||||
data: data,
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
);
|
||||
print(res);
|
||||
}
|
||||
|
||||
// web端密码登录
|
||||
static Future loginInByWebPwd({
|
||||
required int username,
|
||||
required String password,
|
||||
required String token,
|
||||
required String challenge,
|
||||
required String validate,
|
||||
required String seccode,
|
||||
}) async {
|
||||
Map data = {
|
||||
'username': username,
|
||||
'password': password,
|
||||
'keep': 0,
|
||||
'token': token,
|
||||
'challenge': challenge,
|
||||
'validate': validate,
|
||||
'seccode': seccode,
|
||||
'source': 'main-fe-header',
|
||||
"go_url": HttpString.baseUrl
|
||||
};
|
||||
FormData formData = FormData.fromMap({...data});
|
||||
var res = await Request().post(
|
||||
Api.loginInByWebPwd,
|
||||
data: formData,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
if (res.data['data']['status'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'code': 1,
|
||||
'data': res.data['data'],
|
||||
'msg': res.data['data']['message'],
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// web端登录二维码
|
||||
static Future getWebQrcode() async {
|
||||
var res = await Request().get(Api.qrCodeApi);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// web端二维码轮询登录状态
|
||||
static Future queryWebQrcodeStatus(String qrcodeKey) async {
|
||||
var res = await Request()
|
||||
.get(Api.loginInByQrcode, data: {'qrcode_key': qrcodeKey});
|
||||
if (res.data['data']['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,21 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/dynamics/result.dart';
|
||||
import 'package:pilipala/models/follow/result.dart';
|
||||
import 'package:pilipala/models/member/archive.dart';
|
||||
import 'package:pilipala/models/member/coin.dart';
|
||||
import 'package:pilipala/models/member/info.dart';
|
||||
import 'package:pilipala/models/member/seasons.dart';
|
||||
import 'package:pilipala/models/member/tags.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
import 'package:pilipala/utils/wbi_sign.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:pilipala/models/member/article.dart';
|
||||
import 'package:pilipala/models/member/like.dart';
|
||||
import '../common/constants.dart';
|
||||
import '../models/dynamics/result.dart';
|
||||
import '../models/follow/result.dart';
|
||||
import '../models/member/archive.dart';
|
||||
import '../models/member/coin.dart';
|
||||
import '../models/member/info.dart';
|
||||
import '../models/member/seasons.dart';
|
||||
import '../models/member/tags.dart';
|
||||
import '../utils/storage.dart';
|
||||
import '../utils/utils.dart';
|
||||
import '../utils/wbi_sign.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class MemberHttp {
|
||||
static Future memberInfo({
|
||||
@ -79,6 +83,8 @@ class MemberHttp {
|
||||
String order = 'pubdate',
|
||||
bool orderAvoided = true,
|
||||
}) async {
|
||||
String dmImgStr = Utils.base64EncodeRandomString(16, 64);
|
||||
String dmCoverImgStr = Utils.base64EncodeRandomString(32, 128);
|
||||
Map params = await WbiSign().makSign({
|
||||
'mid': mid,
|
||||
'ps': ps,
|
||||
@ -88,8 +94,19 @@ class MemberHttp {
|
||||
'order': order,
|
||||
'platform': 'web',
|
||||
'web_location': 1550101,
|
||||
'order_avoided': orderAvoided
|
||||
'order_avoided': orderAvoided,
|
||||
'dm_img_list': '[]',
|
||||
'dm_img_str': dmImgStr.substring(0, dmImgStr.length - 2),
|
||||
'dm_cover_img_str': dmCoverImgStr.substring(0, dmCoverImgStr.length - 2),
|
||||
'dm_img_inter': '{"ds":[],"wh":[0,0,0],"of":[0,0,0]}',
|
||||
...order == 'charge'
|
||||
? {
|
||||
'order': 'pubdate',
|
||||
'special_type': 'charging',
|
||||
}
|
||||
: {}
|
||||
});
|
||||
|
||||
var res = await Request().get(
|
||||
Api.memberArchive,
|
||||
data: params,
|
||||
@ -101,10 +118,13 @@ class MemberHttp {
|
||||
'data': MemberArchiveDataModel.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
Map errMap = {
|
||||
-352: '风控校验失败,请检查登录状态',
|
||||
};
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -123,10 +143,13 @@ class MemberHttp {
|
||||
'data': DynamicsDataModel.fromJson(res.data['data']),
|
||||
};
|
||||
} else {
|
||||
Map errMap = {
|
||||
-352: '风控校验失败,请检查登录状态',
|
||||
};
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -175,13 +198,15 @@ class MemberHttp {
|
||||
|
||||
// 设置分组
|
||||
static Future addUsers(int? fids, String? tagids) async {
|
||||
var res = await Request().post(Api.addUsers, queryParameters: {
|
||||
'fids': fids,
|
||||
'tagids': tagids ?? '0',
|
||||
'csrf': await Request.getCsrf(),
|
||||
}, data: {
|
||||
'cross_domain': true
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.addUsers,
|
||||
data: {
|
||||
'fids': fids,
|
||||
'tagids': tagids ?? '0',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
queryParameters: {'cross_domain': true},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': [], 'msg': '操作成功'};
|
||||
} else {
|
||||
@ -316,7 +341,9 @@ class MemberHttp {
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': MemberSeasonsDataModel.fromJson(res.data['data']['items_lists'])
|
||||
'data': res.data['data']['list']
|
||||
.map<MemberLikeDataModel>((e) => MemberLikeDataModel.fromJson(e))
|
||||
.toList(),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
@ -397,11 +424,14 @@ class MemberHttp {
|
||||
static Future cookieToKey() async {
|
||||
var authCodeRes = await getTVCode();
|
||||
if (authCodeRes['status']) {
|
||||
var res = await Request().post(Api.cookieToKey, queryParameters: {
|
||||
'auth_code': authCodeRes['data'],
|
||||
'build': 708200,
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.cookieToKey,
|
||||
data: {
|
||||
'auth_code': authCodeRes['data'],
|
||||
'build': 708200,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
await qrcodePoll(authCodeRes['data']);
|
||||
if (res.data['code'] == 0) {
|
||||
@ -461,4 +491,133 @@ class MemberHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索follow
|
||||
static Future getfollowSearch({
|
||||
required int mid,
|
||||
required int ps,
|
||||
required int pn,
|
||||
required String name,
|
||||
}) async {
|
||||
Map<String, dynamic> data = {
|
||||
'vmid': mid,
|
||||
'pn': pn,
|
||||
'ps': ps,
|
||||
'order': 'desc',
|
||||
'order_type': 'attention',
|
||||
'gaia_source': 'main_web',
|
||||
'name': name,
|
||||
'web_location': 333.999,
|
||||
};
|
||||
Map params = await WbiSign().makSign(data);
|
||||
var res = await Request().get(Api.followSearch, data: {
|
||||
...data,
|
||||
'w_rid': params['w_rid'],
|
||||
'wts': params['wts'],
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': FollowDataModel.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future getSeriesDetail({
|
||||
required int mid,
|
||||
required int currentMid,
|
||||
required int seriesId,
|
||||
required int pn,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
Api.getSeriesDetailApi,
|
||||
data: {
|
||||
'mid': mid,
|
||||
'series_id': seriesId,
|
||||
'only_normal': true,
|
||||
'sort': 'desc',
|
||||
'pn': pn,
|
||||
'ps': 30,
|
||||
'current_mid': currentMid,
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': MemberSeasonsDataModel.fromJson(res.data['data'])
|
||||
};
|
||||
} catch (err) {
|
||||
print(err);
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future getWWebid({required int mid}) async {
|
||||
var res = await Request().get('https://space.bilibili.com/$mid/article');
|
||||
String? headContent = parse(res.data).head?.outerHtml;
|
||||
final regex = RegExp(
|
||||
r'<script id="__RENDER_DATA__" type="application/json">(.*?)</script>');
|
||||
if (headContent != null) {
|
||||
final match = regex.firstMatch(headContent);
|
||||
if (match != null && match.groupCount >= 1) {
|
||||
final content = match.group(1);
|
||||
String decodedString = Uri.decodeComponent(content!);
|
||||
Map<String, dynamic> map = jsonDecode(decodedString);
|
||||
return {'status': true, 'data': map['access_id']};
|
||||
} else {
|
||||
return {'status': false, 'data': '请检查登录状态'};
|
||||
}
|
||||
}
|
||||
return {'status': false, 'data': '请检查登录状态'};
|
||||
}
|
||||
|
||||
// 获取用户专栏
|
||||
static Future getMemberArticle({
|
||||
required int mid,
|
||||
required int pn,
|
||||
required String wWebid,
|
||||
String? offset,
|
||||
}) async {
|
||||
Map params = await WbiSign().makSign({
|
||||
'host_mid': mid,
|
||||
'page': pn,
|
||||
'offset': offset,
|
||||
'web_location': 333.999,
|
||||
'w_webid': wWebid,
|
||||
});
|
||||
var res = await Request().get(Api.opusList, data: {
|
||||
'host_mid': mid,
|
||||
'page': pn,
|
||||
'offset': offset,
|
||||
'web_location': 333.999,
|
||||
'w_webid': wWebid,
|
||||
'w_rid': params['w_rid'],
|
||||
'wts': params['wts'],
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': MemberArticleDataModel.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'] ?? '请求异常',
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
import 'package:pilipala/http/api.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/msg/account.dart';
|
||||
import 'package:pilipala/models/msg/session.dart';
|
||||
import 'package:pilipala/utils/wbi_sign.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'package:pilipala/models/msg/like.dart';
|
||||
import 'package:pilipala/models/msg/reply.dart';
|
||||
import 'package:pilipala/models/msg/system.dart';
|
||||
import '../models/msg/account.dart';
|
||||
import '../models/msg/session.dart';
|
||||
import '../utils/wbi_sign.dart';
|
||||
import 'api.dart';
|
||||
import 'init.dart';
|
||||
|
||||
class MsgHttp {
|
||||
// 会话列表
|
||||
@ -22,14 +27,22 @@ class MsgHttp {
|
||||
Map signParams = await WbiSign().makSign(params);
|
||||
var res = await Request().get(Api.sessionList, data: signParams);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': SessionDataModel.fromJson(res.data['data']),
|
||||
};
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': SessionDataModel.fromJson(res.data['data']),
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': err.toString(),
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'date': [],
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
@ -42,12 +55,16 @@ class MsgHttp {
|
||||
'mobi_app': 'web',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data']
|
||||
.map<AccountListModel>((e) => AccountListModel.fromJson(e))
|
||||
.toList(),
|
||||
};
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data']
|
||||
.map<AccountListModel>((e) => AccountListModel.fromJson(e))
|
||||
.toList(),
|
||||
};
|
||||
} catch (err) {
|
||||
print('err🔟: $err');
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
@ -86,4 +103,250 @@ class MsgHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 消息标记已读
|
||||
static Future ackSessionMsg({
|
||||
int? talkerId,
|
||||
int? ackSeqno,
|
||||
}) async {
|
||||
String csrf = await Request.getCsrf();
|
||||
Map params = await WbiSign().makSign({
|
||||
'talker_id': talkerId,
|
||||
'session_type': 1,
|
||||
'ack_seqno': ackSeqno,
|
||||
'build': 0,
|
||||
'mobi_app': 'web',
|
||||
'csrf_token': csrf,
|
||||
'csrf': csrf
|
||||
});
|
||||
var res = await Request().get(Api.ackSessionMsg, data: params);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 发送私信
|
||||
static Future sendMsg({
|
||||
required int senderUid,
|
||||
required int receiverId,
|
||||
int? receiverType,
|
||||
int? msgType,
|
||||
dynamic content,
|
||||
}) async {
|
||||
String csrf = await Request.getCsrf();
|
||||
var res = await Request().post(
|
||||
Api.sendMsg,
|
||||
data: {
|
||||
'msg[sender_uid]': senderUid,
|
||||
'msg[receiver_id]': receiverId,
|
||||
'msg[receiver_type]': 1,
|
||||
'msg[msg_type]': 1,
|
||||
'msg[msg_status]': 0,
|
||||
'msg[content]': jsonEncode(content),
|
||||
'msg[timestamp]': DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||
'msg[new_face_version]': 1,
|
||||
'msg[dev_id]': getDevId(),
|
||||
'from_firework': 0,
|
||||
'build': 0,
|
||||
'mobi_app': 'web',
|
||||
'csrf_token': csrf,
|
||||
'csrf': csrf,
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
static String getDevId() {
|
||||
final List<String> b = [
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F'
|
||||
];
|
||||
final List<String> s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split('');
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
if ('-' == s[i] || '4' == s[i]) {
|
||||
continue;
|
||||
}
|
||||
final int randomInt = Random().nextInt(16);
|
||||
if ('x' == s[i]) {
|
||||
s[i] = b[randomInt];
|
||||
} else {
|
||||
s[i] = b[3 & randomInt | 8];
|
||||
}
|
||||
}
|
||||
return s.join();
|
||||
}
|
||||
|
||||
static Future removeSession({
|
||||
int? talkerId,
|
||||
}) async {
|
||||
String csrf = await Request.getCsrf();
|
||||
Map params = await WbiSign().makSign({
|
||||
'talker_id': talkerId,
|
||||
'session_type': 1,
|
||||
'build': 0,
|
||||
'mobi_app': 'web',
|
||||
'csrf_token': csrf,
|
||||
'csrf': csrf
|
||||
});
|
||||
var res = await Request().get(Api.removeSession, data: params);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
static Future unread() async {
|
||||
var res = await Request().get(Api.unread);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 回复我的
|
||||
static Future messageReply({
|
||||
int? id,
|
||||
int? replyTime,
|
||||
}) async {
|
||||
var params = {
|
||||
if (id != null) 'id': id,
|
||||
if (replyTime != null) 'reply_time': replyTime,
|
||||
};
|
||||
var res = await Request().get(Api.messageReplyAPi, data: params);
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': MessageReplyModel.fromJson(res.data['data']),
|
||||
};
|
||||
} catch (err) {
|
||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 收到的赞
|
||||
static Future messageLike({
|
||||
int? id,
|
||||
int? likeTime,
|
||||
}) async {
|
||||
var params = {
|
||||
if (id != null) 'id': id,
|
||||
if (likeTime != null) 'like_time': likeTime,
|
||||
};
|
||||
var res = await Request().get(Api.messageLikeAPi, data: params);
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': MessageLikeModel.fromJson(res.data['data']),
|
||||
};
|
||||
} catch (err) {
|
||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
static Future messageSystem() async {
|
||||
var res = await Request().get(Api.messageSystemAPi, data: {
|
||||
'csrf': await Request.getCsrf(),
|
||||
'page_size': 20,
|
||||
'build': 0,
|
||||
'mobi_app': 'web',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data']['system_notify_list']
|
||||
.map<MessageSystemModel>((e) => MessageSystemModel.fromJson(e))
|
||||
.toList(),
|
||||
};
|
||||
} catch (err) {
|
||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 系统消息标记已读
|
||||
static Future systemMarkRead(int cursor) async {
|
||||
String csrf = await Request.getCsrf();
|
||||
var res = await Request().get(Api.systemMarkRead, data: {
|
||||
'csrf': csrf,
|
||||
'cursor': cursor,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future messageSystemAccount() async {
|
||||
var res = await Request().get(Api.userMessageSystemAPi, data: {
|
||||
'csrf': await Request.getCsrf(),
|
||||
'page_size': 20,
|
||||
'build': 0,
|
||||
'mobi_app': 'web',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data']['system_notify_list']
|
||||
.map<MessageSystemModel>((e) => MessageSystemModel.fromJson(e))
|
||||
.toList(),
|
||||
};
|
||||
} catch (err) {
|
||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
116
lib/http/read.dart
Normal file
116
lib/http/read.dart
Normal file
@ -0,0 +1,116 @@
|
||||
import 'dart:convert';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:pilipala/models/read/opus.dart';
|
||||
import 'package:pilipala/models/read/read.dart';
|
||||
import 'package:pilipala/utils/wbi_sign.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class ReadHttp {
|
||||
static List<String> extractScriptContents(String htmlContent) {
|
||||
RegExp scriptRegExp = RegExp(r'<script>([\s\S]*?)<\/script>');
|
||||
Iterable<Match> matches = scriptRegExp.allMatches(htmlContent);
|
||||
List<String> scriptContents = [];
|
||||
for (Match match in matches) {
|
||||
String scriptContent = match.group(1)!;
|
||||
scriptContents.add(scriptContent);
|
||||
}
|
||||
return scriptContents;
|
||||
}
|
||||
|
||||
// 解析专栏 opus格式
|
||||
static Future parseArticleOpus({required String id}) async {
|
||||
var res = await Request().get('https://www.bilibili.com/opus/$id', extra: {
|
||||
'ua': 'pc',
|
||||
});
|
||||
String? headContent = parse(res.data).head?.outerHtml;
|
||||
var document = parse(headContent);
|
||||
var linkTags = document.getElementsByTagName('link');
|
||||
bool isCv = false;
|
||||
String cvId = '';
|
||||
for (var linkTag in linkTags) {
|
||||
var attributes = linkTag.attributes;
|
||||
if (attributes.containsKey('rel') &&
|
||||
attributes['rel'] == 'canonical' &&
|
||||
attributes.containsKey('data-vue-meta') &&
|
||||
attributes['data-vue-meta'] == 'true') {
|
||||
final String cvHref = linkTag.attributes['href']!;
|
||||
RegExp regex = RegExp(r'cv(\d+)');
|
||||
RegExpMatch? match = regex.firstMatch(cvHref);
|
||||
if (match != null) {
|
||||
cvId = match.group(1)!;
|
||||
} else {
|
||||
print('No match found.');
|
||||
}
|
||||
isCv = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String scriptContent =
|
||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||
int startIndex = scriptContent.indexOf('{');
|
||||
int endIndex = scriptContent.lastIndexOf('};');
|
||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
||||
// 解析JSON字符串为Map
|
||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
||||
return {
|
||||
'status': true,
|
||||
'data': OpusDataModel.fromJson(jsonData),
|
||||
'isCv': isCv,
|
||||
'cvId': cvId,
|
||||
};
|
||||
}
|
||||
|
||||
// 解析专栏 cv格式
|
||||
static Future parseArticleCv({required String id}) async {
|
||||
var res = await Request().get(
|
||||
'https://www.bilibili.com/read/cv$id',
|
||||
extra: {'ua': 'pc'},
|
||||
);
|
||||
String scriptContent =
|
||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||
int startIndex = scriptContent.indexOf('{');
|
||||
int endIndex = scriptContent.lastIndexOf('};');
|
||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
||||
// 解析JSON字符串为Map
|
||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
||||
return {
|
||||
'status': true,
|
||||
'data': ReadDataModel.fromJson(jsonData),
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
static Future getViewInfo({required String id}) async {
|
||||
Map params = await WbiSign().makSign({
|
||||
'id': id,
|
||||
'mobi_app': 'pc',
|
||||
'from': 'web',
|
||||
'gaia_source': 'main_web',
|
||||
'web_location': 333.976,
|
||||
});
|
||||
var res = await Request().get(
|
||||
Api.getViewInfo,
|
||||
data: {
|
||||
'id': id,
|
||||
'mobi_app': 'pc',
|
||||
'from': 'web',
|
||||
'gaia_source': 'main_web',
|
||||
'web_location': 333.976,
|
||||
'w_rid': params['w_rid'],
|
||||
'wts': params['wts'],
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import 'package:pilipala/http/api.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/video/reply/data.dart';
|
||||
import '../models/video/reply/data.dart';
|
||||
import '../models/video/reply/emote.dart';
|
||||
import 'api.dart';
|
||||
import 'init.dart';
|
||||
|
||||
class ReplyHttp {
|
||||
static Future replyList({
|
||||
@ -21,19 +22,14 @@ class ReplyHttp {
|
||||
return {
|
||||
'status': true,
|
||||
'data': ReplyData.fromJson(res.data['data']),
|
||||
'code': 200,
|
||||
};
|
||||
} else {
|
||||
Map errMap = {
|
||||
-400: '请求错误',
|
||||
-404: '无此项',
|
||||
12002: '当前页面评论功能已关闭',
|
||||
12009: '评论主体的type不合法',
|
||||
12061: 'UP主已关闭评论区',
|
||||
};
|
||||
return {
|
||||
'status': false,
|
||||
'date': [],
|
||||
'msg': errMap[res.data['code']] ?? res.data['message'],
|
||||
'code': res.data['code'],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -82,7 +78,7 @@ class ReplyHttp {
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.likeReply,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'type': type,
|
||||
'oid': oid,
|
||||
'rpid': rpid,
|
||||
@ -100,4 +96,44 @@ class ReplyHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future getEmoteList({String? business}) async {
|
||||
var res = await Request().get(Api.emojiList, data: {
|
||||
'business': business ?? 'reply',
|
||||
'web_location': '333.1245',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': EmoteModelData.fromJson(res.data['data']),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'date': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future replyDel({
|
||||
required int type, //replyType
|
||||
required int oid,
|
||||
required int rpid,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.replyDel,
|
||||
queryParameters: {
|
||||
'type': type, //type.index
|
||||
'oid': oid,
|
||||
'rpid': rpid,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': '删除成功'};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/index.dart';
|
||||
import 'package:pilipala/models/bangumi/info.dart';
|
||||
import 'package:pilipala/models/common/search_type.dart';
|
||||
import 'package:pilipala/models/search/hot.dart';
|
||||
import 'package:pilipala/models/search/result.dart';
|
||||
import 'package:pilipala/models/search/suggest.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/models/search/all.dart';
|
||||
import 'package:pilipala/utils/wbi_sign.dart';
|
||||
import '../models/bangumi/info.dart';
|
||||
import '../models/common/search_type.dart';
|
||||
import '../models/search/hot.dart';
|
||||
import '../models/search/result.dart';
|
||||
import '../models/search/suggest.dart';
|
||||
import '../utils/storage.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class SearchHttp {
|
||||
static Box setting = GStrorage.setting;
|
||||
@ -37,7 +38,7 @@ class SearchHttp {
|
||||
|
||||
// 获取搜索建议
|
||||
static Future searchSuggest({required term}) async {
|
||||
var res = await Request().get(Api.serachSuggest,
|
||||
var res = await Request().get(Api.searchSuggest,
|
||||
data: {'term': term, 'main_ver': 'v1', 'highlight': term});
|
||||
if (res.data is String) {
|
||||
Map<String, dynamic> resultMap = json.decode(res.data);
|
||||
@ -74,6 +75,7 @@ class SearchHttp {
|
||||
required page,
|
||||
String? order,
|
||||
int? duration,
|
||||
int? tids,
|
||||
}) async {
|
||||
var reqData = {
|
||||
'search_type': searchType.type,
|
||||
@ -83,9 +85,14 @@ class SearchHttp {
|
||||
'page': page,
|
||||
if (order != null) 'order': order,
|
||||
if (duration != null) 'duration': duration,
|
||||
if (tids != null && tids != -1) 'tids': tids,
|
||||
};
|
||||
var res = await Request().get(Api.searchByType, data: reqData);
|
||||
if (res.data['code'] == 0 && res.data['data']['numPages'] > 0) {
|
||||
if (res.data['code'] == 0) {
|
||||
if (res.data['data']['numPages'] == 0) {
|
||||
// 我想返回数据,使得可以通过data.list 取值,结果为[]
|
||||
return {'status': true, 'data': Data()};
|
||||
}
|
||||
Object data;
|
||||
try {
|
||||
switch (searchType) {
|
||||
@ -122,32 +129,37 @@ class SearchHttp {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['data'] != null && res.data['data']['numPages'] == 0
|
||||
? '没有相关数据'
|
||||
: res.data['message'],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future ab2c({int? aid, String? bvid}) async {
|
||||
static Future<int> ab2c({int? aid, String? bvid}) async {
|
||||
Map<String, dynamic> data = {};
|
||||
if (aid != null) {
|
||||
data['aid'] = aid;
|
||||
} else if (bvid != null) {
|
||||
data['bvid'] = bvid;
|
||||
}
|
||||
var res = await Request().get(Api.ab2c, data: {...data});
|
||||
return res.data['data'].first['cid'];
|
||||
final dynamic res =
|
||||
await Request().get(Api.ab2c, data: <String, dynamic>{...data});
|
||||
if (res.data['code'] == 0) {
|
||||
return res.data['data'].first['cid'];
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static Future bangumiInfo({int? seasonId, int? epId}) async {
|
||||
Map<String, dynamic> data = {};
|
||||
static Future<Map<String, dynamic>> bangumiInfo(
|
||||
{int? seasonId, int? epId}) async {
|
||||
final Map<String, dynamic> data = {};
|
||||
if (seasonId != null) {
|
||||
data['season_id'] = seasonId;
|
||||
} else if (epId != null) {
|
||||
data['ep_id'] = epId;
|
||||
}
|
||||
var res = await Request().get(Api.bangumiInfo, data: {...data});
|
||||
final dynamic res =
|
||||
await Request().get(Api.bangumiInfo, data: <String, dynamic>{...data});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
@ -161,4 +173,48 @@ class SearchHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> ab2cWithPic(
|
||||
{int? aid, String? bvid}) async {
|
||||
Map<String, dynamic> data = {};
|
||||
if (aid != null) {
|
||||
data['aid'] = aid;
|
||||
} else if (bvid != null) {
|
||||
data['bvid'] = bvid;
|
||||
}
|
||||
final dynamic res =
|
||||
await Request().get(Api.ab2c, data: <String, dynamic>{...data});
|
||||
return {
|
||||
'cid': res.data['data'].first['cid'],
|
||||
'pic': res.data['data'].first['first_frame'],
|
||||
};
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> searchCount(
|
||||
{required String keyword}) async {
|
||||
Map<String, dynamic> data = {
|
||||
'keyword': keyword,
|
||||
'web_location': 333.999,
|
||||
};
|
||||
Map params = await WbiSign().makSign(data);
|
||||
final dynamic res = await Request().get(Api.searchCount, data: params);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': SearchAllModel.fromJson(res.data['data']),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': '请求错误 🙅',
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
List<dynamic> list;
|
||||
|
||||
Data({this.list = const []});
|
||||
}
|
||||
|
@ -1,14 +1,20 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/http/api.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/model_hot_video_item.dart';
|
||||
import 'package:pilipala/models/user/fav_detail.dart';
|
||||
import 'package:pilipala/models/user/fav_folder.dart';
|
||||
import 'package:pilipala/models/user/history.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import 'package:pilipala/models/user/stat.dart';
|
||||
import 'package:pilipala/utils/wbi_sign.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'package:pilipala/models/video/later.dart';
|
||||
import '../common/constants.dart';
|
||||
import '../models/model_hot_video_item.dart';
|
||||
import '../models/user/fav_detail.dart';
|
||||
import '../models/user/fav_folder.dart';
|
||||
import '../models/user/history.dart';
|
||||
import '../models/user/info.dart';
|
||||
import '../models/user/stat.dart';
|
||||
import '../models/user/sub_detail.dart';
|
||||
import '../models/user/sub_folder.dart';
|
||||
import 'api.dart';
|
||||
import 'init.dart';
|
||||
|
||||
class UserHttp {
|
||||
static Future<dynamic> userStat({required int mid}) async {
|
||||
@ -56,12 +62,15 @@ class UserHttp {
|
||||
if (res.data['data'] != null) {
|
||||
data = FavFolderData.fromJson(res.data['data']);
|
||||
return {'status': true, 'data': data};
|
||||
} else {
|
||||
return {'status': false, 'msg': '收藏夹为空'};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'] ?? '账号未登录'
|
||||
'msg': res.data['message'],
|
||||
'code': res.data['code'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -110,7 +119,12 @@ class UserHttp {
|
||||
'data': {'list': list, 'count': res.data['data']['count']}
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
'code': res.data['code'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,7 +139,12 @@ class UserHttp {
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': HistoryData.fromJson(res.data['data'])};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
'code': res.data['code'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +153,7 @@ class UserHttp {
|
||||
// 暂停switchStatus传true 否则false
|
||||
var res = await Request().post(
|
||||
Api.pauseHistory,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'switch': switchStatus,
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -153,7 +172,7 @@ class UserHttp {
|
||||
static Future clearHistory() async {
|
||||
var res = await Request().post(
|
||||
Api.clearHistory,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
@ -171,7 +190,7 @@ class UserHttp {
|
||||
}
|
||||
var res = await Request().post(
|
||||
Api.toViewLater,
|
||||
queryParameters: data,
|
||||
data: data,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': 'yeah!稍后再看'};
|
||||
@ -190,7 +209,7 @@ class UserHttp {
|
||||
params[aid != null ? 'aid' : 'viewed'] = aid ?? true;
|
||||
var res = await Request().post(
|
||||
Api.toViewDel,
|
||||
queryParameters: params,
|
||||
data: params,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': 'yeah!成功移除'};
|
||||
@ -222,7 +241,7 @@ class UserHttp {
|
||||
static Future toViewClear() async {
|
||||
var res = await Request().post(
|
||||
Api.toViewClear,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
@ -238,7 +257,7 @@ class UserHttp {
|
||||
static Future delHistory(kid) async {
|
||||
var res = await Request().post(
|
||||
Api.delHistory,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'kid': kid,
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -306,4 +325,216 @@ class UserHttp {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 我的订阅
|
||||
static Future userSubFolder({
|
||||
required int mid,
|
||||
required int pn,
|
||||
required int ps,
|
||||
}) async {
|
||||
var res = await Request().get(Api.userSubFolder, data: {
|
||||
'up_mid': mid,
|
||||
'ps': ps,
|
||||
'pn': pn,
|
||||
'platform': 'web',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': SubFolderModelData.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
'code': res.data['code'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future userSeasonList({
|
||||
required int seasonId,
|
||||
required int pn,
|
||||
required int ps,
|
||||
}) async {
|
||||
var res = await Request().get(Api.userSeasonList, data: {
|
||||
'season_id': seasonId,
|
||||
'ps': ps,
|
||||
'pn': pn,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': SubDetailModelData.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
static Future userResourceList({
|
||||
required int seasonId,
|
||||
required int pn,
|
||||
required int ps,
|
||||
}) async {
|
||||
var res = await Request().get(Api.userResourceList, data: {
|
||||
'media_id': seasonId,
|
||||
'ps': ps,
|
||||
'pn': pn,
|
||||
'keyword': '',
|
||||
'order': 'mtime',
|
||||
'type': 0,
|
||||
'tid': 0,
|
||||
'platform': 'web',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return {
|
||||
'status': true,
|
||||
'data': SubDetailModelData.fromJson(res.data['data'])
|
||||
};
|
||||
} catch (err) {
|
||||
return {'status': false, 'msg': err};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 取消订阅
|
||||
static Future cancelSub({required int seasonId}) async {
|
||||
var res = await Request().post(
|
||||
Api.cancelSub,
|
||||
data: {
|
||||
'platform': 'web',
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 删除文件夹
|
||||
static Future delFavFolder({required int mediaIds}) async {
|
||||
var res = await Request().post(
|
||||
Api.delFavFolder,
|
||||
data: {
|
||||
'media_ids': mediaIds,
|
||||
'platform': 'web',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 稍后再看播放全部
|
||||
// static Future toViewPlayAll({required int oid, required String bvid}) async {
|
||||
// var res = await Request().get(
|
||||
// Api.watchLaterHtml,
|
||||
// data: {
|
||||
// 'oid': oid,
|
||||
// 'bvid': bvid,
|
||||
// },
|
||||
// );
|
||||
// String scriptContent =
|
||||
// extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||
// int startIndex = scriptContent.indexOf('{');
|
||||
// int endIndex = scriptContent.lastIndexOf('};');
|
||||
// String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
||||
// // 解析JSON字符串为Map
|
||||
// Map<String, dynamic> jsonData = json.decode(jsonContent);
|
||||
// // 输出解析后的数据
|
||||
// return {
|
||||
// 'status': true,
|
||||
// 'data': jsonData['resourceList']
|
||||
// .map((e) => MediaVideoItemModel.fromJson(e))
|
||||
// .toList()
|
||||
// };
|
||||
// }
|
||||
|
||||
static List<String> extractScriptContents(String htmlContent) {
|
||||
RegExp scriptRegExp = RegExp(r'<script>([\s\S]*?)<\/script>');
|
||||
Iterable<Match> matches = scriptRegExp.allMatches(htmlContent);
|
||||
List<String> scriptContents = [];
|
||||
for (Match match in matches) {
|
||||
String scriptContent = match.group(1)!;
|
||||
scriptContents.add(scriptContent);
|
||||
}
|
||||
return scriptContents;
|
||||
}
|
||||
|
||||
// 稍后再看列表
|
||||
static Future getMediaList({
|
||||
required int type,
|
||||
required int bizId,
|
||||
required int ps,
|
||||
int? oid,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
Api.mediaList,
|
||||
data: {
|
||||
'mobi_app': 'web',
|
||||
'type': type,
|
||||
'biz_id': bizId,
|
||||
'oid': oid ?? '',
|
||||
'otype': 2,
|
||||
'ps': ps,
|
||||
'direction': false,
|
||||
'desc': true,
|
||||
'sort_field': 1,
|
||||
'tid': 0,
|
||||
'with_current': false,
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data']['media_list'] != null
|
||||
? res.data['data']['media_list']
|
||||
.map<MediaVideoItemModel>(
|
||||
(e) => MediaVideoItemModel.fromJson(e))
|
||||
.toList()
|
||||
: []
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 解析收藏夹视频
|
||||
static Future parseFavVideo({
|
||||
required int mediaId,
|
||||
required int oid,
|
||||
required String bvid,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
'https://www.bilibili.com/list/ml$mediaId',
|
||||
data: {
|
||||
'oid': mediaId,
|
||||
'bvid': bvid,
|
||||
},
|
||||
);
|
||||
String scriptContent =
|
||||
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||
int startIndex = scriptContent.indexOf('{');
|
||||
int endIndex = scriptContent.lastIndexOf('};');
|
||||
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
||||
// 解析JSON字符串为Map
|
||||
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
||||
return {
|
||||
'status': true,
|
||||
'data': jsonData['resourceList']
|
||||
.map<MediaVideoItemModel>((e) => MediaVideoItemModel.fromJson(e))
|
||||
.toList()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,21 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/common/constants.dart';
|
||||
import 'package:pilipala/http/api.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/common/reply_type.dart';
|
||||
import 'package:pilipala/models/home/rcmd/result.dart';
|
||||
import 'package:pilipala/models/model_hot_video_item.dart';
|
||||
import 'package:pilipala/models/model_rec_video_item.dart';
|
||||
import 'package:pilipala/models/user/fav_folder.dart';
|
||||
import 'package:pilipala/models/video/ai.dart';
|
||||
import 'package:pilipala/models/video/play/url.dart';
|
||||
import 'package:pilipala/models/video_detail_res.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:pilipala/utils/wbi_sign.dart';
|
||||
import '../common/constants.dart';
|
||||
import '../models/common/reply_type.dart';
|
||||
import '../models/home/rcmd/result.dart';
|
||||
import '../models/model_hot_video_item.dart';
|
||||
import '../models/model_rec_video_item.dart';
|
||||
import '../models/user/fav_folder.dart';
|
||||
import '../models/video/ai.dart';
|
||||
import '../models/video/play/url.dart';
|
||||
import '../models/video/subTitile/result.dart';
|
||||
import '../models/video_detail_res.dart';
|
||||
import '../utils/recommend_filter.dart';
|
||||
import '../utils/storage.dart';
|
||||
import '../utils/subtitle.dart';
|
||||
import '../utils/wbi_sign.dart';
|
||||
import 'api.dart';
|
||||
import 'init.dart';
|
||||
|
||||
/// res.data['code'] == 0 请求正常返回结果
|
||||
/// res.data['data'] 为结果
|
||||
@ -34,62 +36,77 @@ class VideoHttp {
|
||||
data: {
|
||||
'version': 1,
|
||||
'feed_version': 'V3',
|
||||
'homepage_ver': 1,
|
||||
'ps': ps,
|
||||
'fresh_idx': freshIdx,
|
||||
'fresh_type': 999999
|
||||
'brush': freshIdx,
|
||||
'fresh_type': 4
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
List<RecVideoItemModel> list = [];
|
||||
List<int> blackMidsList =
|
||||
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
||||
for (var i in res.data['data']['item']) {
|
||||
list.add(RecVideoItemModel.fromJson(i));
|
||||
//过滤掉live与ad,以及拉黑用户
|
||||
if (i['goto'] == 'av' &&
|
||||
(i['owner'] != null &&
|
||||
!blackMidsList.contains(i['owner']['mid']))) {
|
||||
RecVideoItemModel videoItem = RecVideoItemModel.fromJson(i);
|
||||
if (!RecommendFilter.filter(videoItem)) {
|
||||
list.add(videoItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {'status': true, 'data': list};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': ''};
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
} catch (err) {
|
||||
return {'status': false, 'data': [], 'msg': err.toString()};
|
||||
}
|
||||
}
|
||||
|
||||
static Future rcmdVideoListApp({int? ps, required int freshIdx}) async {
|
||||
try {
|
||||
var res = await Request().get(
|
||||
Api.recommendListApp,
|
||||
data: {
|
||||
'idx': freshIdx,
|
||||
'flush': '5',
|
||||
'column': '4',
|
||||
'device': 'pad',
|
||||
'device_type': 0,
|
||||
'device_name': 'vivo',
|
||||
'pull': freshIdx == 0 ? 'true' : 'false',
|
||||
'appkey': Constants.appKey,
|
||||
'access_key': localCache
|
||||
.get(LocalCacheKey.accessKey, defaultValue: {})['value'] ??
|
||||
''
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
List<RecVideoItemAppModel> list = [];
|
||||
List<int> blackMidsList =
|
||||
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
||||
for (var i in res.data['data']['items']) {
|
||||
// 屏蔽推广和拉黑用户
|
||||
if (i['card_goto'] != 'ad_av' &&
|
||||
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
|
||||
(i['args'] != null &&
|
||||
!blackMidsList.contains(i['args']['up_mid']))) {
|
||||
list.add(RecVideoItemAppModel.fromJson(i));
|
||||
// 添加额外的loginState变量模拟未登录状态
|
||||
static Future rcmdVideoListApp(
|
||||
{bool loginStatus = true, required int freshIdx}) async {
|
||||
var res = await Request().get(
|
||||
Api.recommendListApp,
|
||||
data: {
|
||||
'idx': freshIdx,
|
||||
'flush': '5',
|
||||
'column': '4',
|
||||
'device': 'pad',
|
||||
'device_type': 0,
|
||||
'device_name': 'vivo',
|
||||
'pull': freshIdx == 0 ? 'true' : 'false',
|
||||
'appkey': Constants.appKey,
|
||||
'access_key': loginStatus
|
||||
? (localCache
|
||||
.get(LocalCacheKey.accessKey, defaultValue: {})['value'] ??
|
||||
'')
|
||||
: ''
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
List<RecVideoItemAppModel> list = [];
|
||||
List<int> blackMidsList =
|
||||
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
||||
for (var i in res.data['data']['items']) {
|
||||
// 屏蔽推广和拉黑用户
|
||||
if (i['card_goto'] != 'ad_av' &&
|
||||
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
|
||||
(i['args'] != null &&
|
||||
!blackMidsList.contains(i['args']['up_mid']))) {
|
||||
RecVideoItemAppModel videoItem = RecVideoItemAppModel.fromJson(i);
|
||||
if (!RecommendFilter.filter(videoItem)) {
|
||||
list.add(videoItem);
|
||||
}
|
||||
}
|
||||
return {'status': true, 'data': list};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': ''};
|
||||
}
|
||||
} catch (err) {
|
||||
return {'status': false, 'data': [], 'msg': err.toString()};
|
||||
return {'status': true, 'data': list};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +128,7 @@ class VideoHttp {
|
||||
}
|
||||
return {'status': true, 'data': list};
|
||||
} else {
|
||||
return {'status': false, 'data': []};
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
} catch (err) {
|
||||
return {'status': false, 'data': [], 'msg': err};
|
||||
@ -134,6 +151,12 @@ class VideoHttp {
|
||||
data['bvid'] = bvid;
|
||||
}
|
||||
|
||||
// 免登录查看1080p
|
||||
if (userInfoCache.get('userInfoCache') == null &&
|
||||
setting.get(SettingBoxKey.p1080, defaultValue: true)) {
|
||||
data['try_look'] = 1;
|
||||
}
|
||||
|
||||
Map params = await WbiSign().makSign({
|
||||
...data,
|
||||
'fourk': 1,
|
||||
@ -142,11 +165,6 @@ class VideoHttp {
|
||||
'web_location': 1550101,
|
||||
});
|
||||
|
||||
// 免登录查看1080p
|
||||
if (userInfoCache.get('userInfoCache') == null &&
|
||||
setting.get(SettingBoxKey.p1080, defaultValue: true)) {
|
||||
data['try_look'] = 1;
|
||||
}
|
||||
try {
|
||||
var res = await Request().get(Api.videoUrl, data: params);
|
||||
if (res.data['code'] == 0) {
|
||||
@ -170,22 +188,15 @@ class VideoHttp {
|
||||
// 视频信息 标题、简介
|
||||
static Future videoIntro({required String bvid}) async {
|
||||
var res = await Request().get(Api.videoIntro, data: {'bvid': bvid});
|
||||
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
||||
if (result.code == 0) {
|
||||
if (res.data['code'] == 0) {
|
||||
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
||||
return {'status': true, 'data': result.data!};
|
||||
} else {
|
||||
Map errMap = {
|
||||
-400: '请求错误',
|
||||
-403: '权限不足',
|
||||
-404: '视频资源失效',
|
||||
62002: '稿件不可见',
|
||||
62004: '稿件审核中',
|
||||
};
|
||||
return {
|
||||
'status': false,
|
||||
'data': null,
|
||||
'code': result.code,
|
||||
'msg': errMap[result.code] ?? '请求异常',
|
||||
'code': res.data['code'],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -196,7 +207,10 @@ class VideoHttp {
|
||||
if (res.data['code'] == 0) {
|
||||
List<HotVideoItemModel> list = [];
|
||||
for (var i in res.data['data']) {
|
||||
list.add(HotVideoItemModel.fromJson(i));
|
||||
HotVideoItemModel videoItem = HotVideoItemModel.fromJson(i);
|
||||
if (!RecommendFilter.filter(videoItem, relatedVideos: true)) {
|
||||
list.add(videoItem);
|
||||
}
|
||||
}
|
||||
return {'status': true, 'data': list};
|
||||
} else {
|
||||
@ -217,10 +231,11 @@ class VideoHttp {
|
||||
// 获取投币状态
|
||||
static Future hasCoinVideo({required String bvid}) async {
|
||||
var res = await Request().get(Api.hasCoinVideo, data: {'bvid': bvid});
|
||||
print('res: $res');
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
return {'status': true, 'data': []};
|
||||
return {'status': false, 'data': []};
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,7 +243,7 @@ class VideoHttp {
|
||||
static Future coinVideo({required String bvid, required int multiply}) async {
|
||||
var res = await Request().post(
|
||||
Api.coinVideo,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'bvid': bvid,
|
||||
'multiply': multiply,
|
||||
'select_like': 0,
|
||||
@ -256,7 +271,7 @@ class VideoHttp {
|
||||
static Future oneThree({required String bvid}) async {
|
||||
var res = await Request().post(
|
||||
Api.oneThree,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'bvid': bvid,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
@ -272,7 +287,7 @@ class VideoHttp {
|
||||
static Future likeVideo({required String bvid, required bool type}) async {
|
||||
var res = await Request().post(
|
||||
Api.likeVideo,
|
||||
queryParameters: {
|
||||
data: {
|
||||
'bvid': bvid,
|
||||
'like': type ? 1 : 2,
|
||||
'csrf': await Request.getCsrf(),
|
||||
@ -288,17 +303,20 @@ class VideoHttp {
|
||||
// (取消)收藏
|
||||
static Future favVideo(
|
||||
{required int aid, String? addIds, String? delIds}) async {
|
||||
var res = await Request().post(Api.favVideo, queryParameters: {
|
||||
'rid': aid,
|
||||
'type': 2,
|
||||
'add_media_ids': addIds ?? '',
|
||||
'del_media_ids': delIds ?? '',
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.favVideo,
|
||||
data: {
|
||||
'rid': aid,
|
||||
'type': 2,
|
||||
'add_media_ids': addIds ?? '',
|
||||
'del_media_ids': delIds ?? '',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
return {'status': false, 'data': []};
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,14 +350,17 @@ class VideoHttp {
|
||||
if (message == '') {
|
||||
return {'status': false, 'data': [], 'msg': '请输入评论内容'};
|
||||
}
|
||||
var res = await Request().post(Api.replyAdd, queryParameters: {
|
||||
'type': type.index,
|
||||
'oid': oid,
|
||||
'root': root == null || root == 0 ? '' : root,
|
||||
'parent': parent == null || parent == 0 ? '' : parent,
|
||||
'message': message,
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.replyAdd,
|
||||
data: {
|
||||
'type': type.index,
|
||||
'oid': oid,
|
||||
'root': root == null || root == 0 ? '' : root,
|
||||
'parent': parent == null || parent == 0 ? '' : parent,
|
||||
'message': message,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
log(res.toString());
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
@ -354,49 +375,64 @@ class VideoHttp {
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
return {'status': true, 'data': []};
|
||||
return {'status': false, 'data': []};
|
||||
}
|
||||
}
|
||||
|
||||
// 操作用户关系
|
||||
static Future relationMod(
|
||||
{required int mid, required int act, required int reSrc}) async {
|
||||
var res = await Request().post(Api.relationMod, queryParameters: {
|
||||
'fid': mid,
|
||||
'act': act,
|
||||
're_src': reSrc,
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.relationMod,
|
||||
data: {
|
||||
'fid': mid,
|
||||
'act': act,
|
||||
're_src': reSrc,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
if (act == 5) {
|
||||
List<int> blackMidsList =
|
||||
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
||||
blackMidsList.add(mid);
|
||||
setting.put(SettingBoxKey.blackMidsList, blackMidsList);
|
||||
}
|
||||
return {'status': true, 'data': res.data['data'], 'msg': '成功'};
|
||||
} else {
|
||||
return {'status': true, 'data': []};
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
// 视频播放进度
|
||||
static Future heartBeat({bvid, cid, progress, realtime}) async {
|
||||
await Request().post(Api.heartBeat, queryParameters: {
|
||||
// 'aid': aid,
|
||||
'bvid': bvid,
|
||||
'cid': cid,
|
||||
// 'epid': '',
|
||||
// 'sid': '',
|
||||
// 'mid': '',
|
||||
'played_time': progress,
|
||||
// 'realtime': realtime,
|
||||
// 'type': '',
|
||||
// 'sub_type': '',
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
await Request().post(
|
||||
Api.heartBeat,
|
||||
data: {
|
||||
// 'aid': aid,
|
||||
'bvid': bvid,
|
||||
'cid': cid,
|
||||
// 'epid': '',
|
||||
// 'sid': '',
|
||||
// 'mid': '',
|
||||
'played_time': progress,
|
||||
// 'realtime': realtime,
|
||||
// 'type': '',
|
||||
// 'sub_type': '',
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 添加追番
|
||||
static Future bangumiAdd({int? seasonId}) async {
|
||||
var res = await Request().post(Api.bangumiAdd, queryParameters: {
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.bangumiAdd,
|
||||
data: {
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': res.data['result']['toast']};
|
||||
} else {
|
||||
@ -406,10 +442,13 @@ class VideoHttp {
|
||||
|
||||
// 取消追番
|
||||
static Future bangumiDel({int? seasonId}) async {
|
||||
var res = await Request().post(Api.bangumiDel, queryParameters: {
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
});
|
||||
var res = await Request().post(
|
||||
Api.bangumiDel,
|
||||
data: {
|
||||
'season_id': seasonId,
|
||||
'csrf': await Request.getCsrf(),
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'msg': res.data['result']['toast']};
|
||||
} else {
|
||||
@ -426,6 +465,8 @@ class VideoHttp {
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
return {'status': false, 'data': null, 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
@ -440,11 +481,64 @@ class VideoHttp {
|
||||
'up_mid': upMid,
|
||||
});
|
||||
var res = await Request().get(Api.aiConclusion, data: params);
|
||||
if (res.data['code'] == 0) {
|
||||
if (res.data['code'] == 0 && res.data['data']['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': AiConclusionModel.fromJson(res.data['data']),
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'data': []};
|
||||
}
|
||||
}
|
||||
|
||||
static Future getSubtitle({int? cid, String? bvid}) async {
|
||||
var res = await Request().get(Api.getSubtitleConfig, data: {
|
||||
'cid': cid,
|
||||
'bvid': bvid,
|
||||
});
|
||||
try {
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': SubTitlteModel.fromJson(res.data['data']),
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['msg']};
|
||||
}
|
||||
} catch (err) {
|
||||
return {'status': false, 'data': [], 'msg': res.data['msg']};
|
||||
}
|
||||
}
|
||||
|
||||
// 视频排行
|
||||
static Future getRankVideoList(int rid) async {
|
||||
try {
|
||||
var rankApi = "${Api.getRankApi}?rid=$rid&type=all";
|
||||
var res = await Request().get(rankApi);
|
||||
if (res.data['code'] == 0) {
|
||||
List<HotVideoItemModel> list = [];
|
||||
List<int> blackMidsList =
|
||||
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
|
||||
for (var i in res.data['data']['list']) {
|
||||
if (!blackMidsList.contains(i['owner']['mid'])) {
|
||||
list.add(HotVideoItemModel.fromJson(i));
|
||||
}
|
||||
}
|
||||
return {'status': true, 'data': list};
|
||||
} else {
|
||||
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||
}
|
||||
} catch (err) {
|
||||
return {'status': false, 'data': [], 'msg': err};
|
||||
}
|
||||
}
|
||||
|
||||
// 获取字幕内容
|
||||
static Future<Map<String, dynamic>> getSubtitleContent(url) async {
|
||||
var res = await Request().get('https:$url');
|
||||
final String content =
|
||||
await SubTitleUtils.convertToWebVTT(res.data['body']);
|
||||
final List body = res.data['body'];
|
||||
return {'content': content, 'body': body};
|
||||
}
|
||||
}
|
||||
|
251
lib/main.dart
251
lib/main.dart
@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
@ -19,30 +20,51 @@ import 'package:pilipala/pages/main/view.dart';
|
||||
import 'package:pilipala/services/service_locator.dart';
|
||||
import 'package:pilipala/utils/app_scheme.dart';
|
||||
import 'package:pilipala/utils/data.dart';
|
||||
import 'package:pilipala/utils/global_data_cache.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:media_kit/media_kit.dart'; // Provides [Player], [Media], [Playlist] etc.
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:pilipala/utils/recommend_filter.dart';
|
||||
import 'package:catcher_2/catcher_2.dart';
|
||||
import './services/loggeer.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
MediaKit.ensureInitialized();
|
||||
SystemChrome.setPreferredOrientations(
|
||||
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown])
|
||||
.then((_) async {
|
||||
await GStrorage.init();
|
||||
await setupServiceLocator();
|
||||
runApp(const MyApp());
|
||||
// 小白条、导航栏沉浸
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
await SystemChrome.setPreferredOrientations(
|
||||
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
|
||||
await GStrorage.init();
|
||||
clearLogs();
|
||||
Request();
|
||||
await Request.setCookie();
|
||||
|
||||
// 异常捕获 logo记录
|
||||
final Catcher2Options releaseConfig = Catcher2Options(
|
||||
SilentReportMode(),
|
||||
[FileHandler(await getLogsPath())],
|
||||
);
|
||||
|
||||
Catcher2(
|
||||
releaseConfig: releaseConfig,
|
||||
runAppFunction: () {
|
||||
runApp(const MyApp());
|
||||
},
|
||||
);
|
||||
|
||||
// 小白条、导航栏沉浸
|
||||
if (Platform.isAndroid) {
|
||||
final androidInfo = await DeviceInfoPlugin().androidInfo;
|
||||
if (androidInfo.version.sdkInt >= 29) {
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
}
|
||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
systemNavigationBarDividerColor: Colors.transparent,
|
||||
statusBarColor: Colors.transparent,
|
||||
));
|
||||
await Request.setCookie();
|
||||
Data.init();
|
||||
GStrorage.lazyInit();
|
||||
PiliSchame.init();
|
||||
});
|
||||
}
|
||||
|
||||
PiliSchame.init();
|
||||
await GlobalDataCache().initialize();
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@ -83,6 +105,39 @@ class MyApp extends StatelessWidget {
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
return AndroidApp(
|
||||
brandColor: brandColor,
|
||||
isDynamicColor: isDynamicColor,
|
||||
currentThemeValue: currentThemeValue,
|
||||
textScale: textScale,
|
||||
);
|
||||
} else {
|
||||
return OtherApp(
|
||||
brandColor: brandColor,
|
||||
currentThemeValue: currentThemeValue,
|
||||
textScale: textScale,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AndroidApp extends StatelessWidget {
|
||||
const AndroidApp({
|
||||
super.key,
|
||||
required this.brandColor,
|
||||
required this.isDynamicColor,
|
||||
required this.currentThemeValue,
|
||||
required this.textScale,
|
||||
});
|
||||
|
||||
final Color brandColor;
|
||||
final bool isDynamicColor;
|
||||
final ThemeType currentThemeValue;
|
||||
final double textScale;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DynamicColorBuilder(
|
||||
builder: ((ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
|
||||
ColorScheme? lightColorScheme;
|
||||
@ -102,64 +157,120 @@ class MyApp extends StatelessWidget {
|
||||
brightness: Brightness.dark,
|
||||
);
|
||||
}
|
||||
// 图片缓存
|
||||
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
|
||||
return GetMaterialApp(
|
||||
title: 'PiLiPaLa',
|
||||
theme: ThemeData(
|
||||
// fontFamily: 'HarmonyOS',
|
||||
colorScheme: currentThemeValue == ThemeType.dark
|
||||
? darkColorScheme
|
||||
: lightColorScheme,
|
||||
useMaterial3: true,
|
||||
pageTransitionsTheme: const PageTransitionsTheme(
|
||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
||||
allowEnterRouteSnapshotting: false,
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
// fontFamily: 'HarmonyOS',
|
||||
colorScheme: currentThemeValue == ThemeType.light
|
||||
? lightColorScheme
|
||||
: darkColorScheme,
|
||||
useMaterial3: true,
|
||||
snackBarTheme: const SnackBarThemeData(
|
||||
actionTextColor: Colors.white,
|
||||
backgroundColor: Colors.black,
|
||||
contentTextStyle: TextStyle(color: Colors.white),
|
||||
elevation: 20,
|
||||
),
|
||||
),
|
||||
localizationsDelegates: const [
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
locale: const Locale("zh", "CN"),
|
||||
supportedLocales: const [Locale("zh", "CN"), Locale("en", "US")],
|
||||
fallbackLocale: const Locale("zh", "CN"),
|
||||
getPages: Routes.getPages,
|
||||
home: const MainApp(),
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return FlutterSmartDialog(
|
||||
toastBuilder: (String msg) => CustomToast(msg: msg),
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaleFactor:
|
||||
MediaQuery.of(context).textScaleFactor * textScale),
|
||||
child: child!,
|
||||
),
|
||||
);
|
||||
},
|
||||
navigatorObservers: [
|
||||
VideoDetailPage.routeObserver,
|
||||
SearchPage.routeObserver,
|
||||
],
|
||||
return BuildMainApp(
|
||||
lightColorScheme: lightColorScheme,
|
||||
darkColorScheme: darkColorScheme,
|
||||
currentThemeValue: currentThemeValue,
|
||||
textScale: textScale,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class OtherApp extends StatelessWidget {
|
||||
const OtherApp({
|
||||
super.key,
|
||||
required this.brandColor,
|
||||
required this.currentThemeValue,
|
||||
required this.textScale,
|
||||
});
|
||||
|
||||
final Color brandColor;
|
||||
final ThemeType currentThemeValue;
|
||||
final double textScale;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BuildMainApp(
|
||||
lightColorScheme: ColorScheme.fromSeed(
|
||||
seedColor: brandColor,
|
||||
brightness: Brightness.light,
|
||||
),
|
||||
darkColorScheme: ColorScheme.fromSeed(
|
||||
seedColor: brandColor,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
currentThemeValue: currentThemeValue,
|
||||
textScale: textScale,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BuildMainApp extends StatelessWidget {
|
||||
const BuildMainApp({
|
||||
super.key,
|
||||
required this.lightColorScheme,
|
||||
required this.darkColorScheme,
|
||||
required this.currentThemeValue,
|
||||
required this.textScale,
|
||||
});
|
||||
|
||||
final ColorScheme lightColorScheme;
|
||||
final ColorScheme darkColorScheme;
|
||||
final ThemeType currentThemeValue;
|
||||
final double textScale;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final SnackBarThemeData snackBarTheme = SnackBarThemeData(
|
||||
actionTextColor: lightColorScheme.primary,
|
||||
backgroundColor: lightColorScheme.secondaryContainer,
|
||||
closeIconColor: lightColorScheme.secondary,
|
||||
contentTextStyle: TextStyle(color: lightColorScheme.secondary),
|
||||
elevation: 20,
|
||||
);
|
||||
|
||||
return GetMaterialApp(
|
||||
title: 'PiliPala',
|
||||
theme: ThemeData(
|
||||
colorScheme: currentThemeValue == ThemeType.dark
|
||||
? darkColorScheme
|
||||
: lightColorScheme,
|
||||
snackBarTheme: snackBarTheme,
|
||||
pageTransitionsTheme: const PageTransitionsTheme(
|
||||
builders: <TargetPlatform, PageTransitionsBuilder>{
|
||||
TargetPlatform.android: ZoomPageTransitionsBuilder(
|
||||
allowEnterRouteSnapshotting: false,
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
colorScheme: currentThemeValue == ThemeType.light
|
||||
? lightColorScheme
|
||||
: darkColorScheme,
|
||||
snackBarTheme: snackBarTheme,
|
||||
),
|
||||
localizationsDelegates: const [
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
locale: const Locale("zh", "CN"),
|
||||
supportedLocales: const [Locale("zh", "CN"), Locale("en", "US")],
|
||||
fallbackLocale: const Locale("zh", "CN"),
|
||||
getPages: Routes.getPages,
|
||||
home: const MainApp(),
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return FlutterSmartDialog(
|
||||
toastBuilder: (String msg) => CustomToast(msg: msg),
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context)
|
||||
.copyWith(textScaler: TextScaler.linear(textScale)),
|
||||
child: child!,
|
||||
),
|
||||
);
|
||||
},
|
||||
navigatorObservers: [
|
||||
VideoDetailPage.routeObserver,
|
||||
SearchPage.routeObserver,
|
||||
],
|
||||
onReady: () async {
|
||||
RecommendFilter();
|
||||
Data.init();
|
||||
setupServiceLocator();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ class BangumiListItemModel {
|
||||
BangumiListItemModel({
|
||||
this.badge,
|
||||
this.badgeType,
|
||||
this.pic,
|
||||
this.cover,
|
||||
// this.firstEp,
|
||||
this.indexShow,
|
||||
@ -50,6 +51,7 @@ class BangumiListItemModel {
|
||||
|
||||
String? badge;
|
||||
int? badgeType;
|
||||
String? pic;
|
||||
String? cover;
|
||||
String? indexShow;
|
||||
int? isFinish;
|
||||
@ -70,6 +72,7 @@ class BangumiListItemModel {
|
||||
BangumiListItemModel.fromJson(Map<String, dynamic> json) {
|
||||
badge = json['badge'] == '' ? null : json['badge'];
|
||||
badgeType = json['badge_type'];
|
||||
pic = json['cover'];
|
||||
cover = json['cover'];
|
||||
indexShow = json['index_show'];
|
||||
isFinish = json['is_finish'];
|
||||
|
93
lib/models/common/action_type.dart
Normal file
93
lib/models/common/action_type.dart
Normal file
@ -0,0 +1,93 @@
|
||||
// 操作类型的枚举值:点赞 不喜欢 收藏 投币 稍后再看 下载封面 后台播放 听视频 分享 下载视频
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
enum ActionType {
|
||||
like,
|
||||
coin,
|
||||
collect,
|
||||
watchLater,
|
||||
share,
|
||||
dislike,
|
||||
downloadCover,
|
||||
copyLink,
|
||||
// backgroundPlay,
|
||||
// listenVideo,
|
||||
// downloadVideo,
|
||||
}
|
||||
|
||||
extension ActionTypeExtension on ActionType {
|
||||
String get value => [
|
||||
'like',
|
||||
'coin',
|
||||
'collect',
|
||||
'watchLater',
|
||||
'share',
|
||||
'dislike',
|
||||
'downloadCover',
|
||||
'copyLink',
|
||||
// 'backgroundPlay',
|
||||
// 'listenVideo',
|
||||
// 'downloadVideo',
|
||||
][index];
|
||||
String get label => [
|
||||
'点赞视频',
|
||||
'投币',
|
||||
'收藏视频',
|
||||
'稍后再看',
|
||||
'视频分享',
|
||||
'不喜欢',
|
||||
'下载封面',
|
||||
'复制链接',
|
||||
// '后台播放',
|
||||
// '听视频',
|
||||
// '下载视频',
|
||||
][index];
|
||||
}
|
||||
|
||||
List<Map> actionMenuConfig = [
|
||||
{
|
||||
'icon': const Icon(Icons.thumb_up_alt_outlined),
|
||||
'label': '点赞视频',
|
||||
'value': ActionType.like,
|
||||
},
|
||||
{
|
||||
'icon': Image.asset(
|
||||
'assets/images/coin.png',
|
||||
width: 26,
|
||||
color: IconTheme.of(Get.context!).color!.withOpacity(0.65),
|
||||
),
|
||||
'label': '投币',
|
||||
'value': ActionType.coin,
|
||||
},
|
||||
{
|
||||
'icon': const Icon(Icons.star_border),
|
||||
'label': '收藏视频',
|
||||
'value': ActionType.collect,
|
||||
},
|
||||
{
|
||||
'icon': const Icon(Icons.watch_later_outlined),
|
||||
'label': '稍后再看',
|
||||
'value': ActionType.watchLater,
|
||||
},
|
||||
{
|
||||
'icon': const Icon(Icons.share),
|
||||
'label': '视频分享',
|
||||
'value': ActionType.share,
|
||||
},
|
||||
{
|
||||
'icon': const Icon(Icons.thumb_down_alt_outlined),
|
||||
'label': '不喜欢',
|
||||
'value': ActionType.dislike,
|
||||
},
|
||||
{
|
||||
'icon': const Icon(Icons.image_outlined),
|
||||
'label': '下载封面',
|
||||
'value': ActionType.downloadCover,
|
||||
},
|
||||
{
|
||||
'icon': const Icon(Icons.link_outlined),
|
||||
'label': '复制链接',
|
||||
'value': ActionType.copyLink,
|
||||
},
|
||||
];
|
9
lib/models/common/dynamic_badge_mode.dart
Normal file
9
lib/models/common/dynamic_badge_mode.dart
Normal file
@ -0,0 +1,9 @@
|
||||
enum DynamicBadgeMode { hidden, point, number }
|
||||
|
||||
extension DynamicBadgeModeDesc on DynamicBadgeMode {
|
||||
String get description => ['隐藏', '红点', '数字'][index];
|
||||
}
|
||||
|
||||
extension DynamicBadgeModeCode on DynamicBadgeMode {
|
||||
int get code => [0, 1, 2][index];
|
||||
}
|
@ -7,5 +7,5 @@ enum DynamicsType {
|
||||
|
||||
extension BusinessTypeExtension on DynamicsType {
|
||||
String get values => ['all', 'video', 'pgc', 'article'][index];
|
||||
String get labels => ['全部', '视频', '追番', '专栏'][index];
|
||||
String get labels => ['全部', '投稿', '番剧', '专栏'][index];
|
||||
}
|
||||
|
12
lib/models/common/gesture_mode.dart
Normal file
12
lib/models/common/gesture_mode.dart
Normal file
@ -0,0 +1,12 @@
|
||||
enum FullScreenGestureMode {
|
||||
/// 从上滑到下
|
||||
fromToptoBottom,
|
||||
|
||||
/// 从下滑到上
|
||||
fromBottomtoTop,
|
||||
}
|
||||
|
||||
extension FullScreenGestureModeExtension on FullScreenGestureMode {
|
||||
String get values => ['fromToptoBottom', 'fromBottomtoTop'][index];
|
||||
String get labels => ['从上往下滑进入全屏', '从下往上滑进入全屏'][index];
|
||||
}
|
4
lib/models/common/index.dart
Normal file
4
lib/models/common/index.dart
Normal file
@ -0,0 +1,4 @@
|
||||
library commonn_model;
|
||||
|
||||
export './business_type.dart';
|
||||
export './gesture_mode.dart';
|
65
lib/models/common/nav_bar_config.dart
Normal file
65
lib/models/common/nav_bar_config.dart
Normal file
@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../pages/dynamics/index.dart';
|
||||
import '../../pages/home/index.dart';
|
||||
import '../../pages/media/index.dart';
|
||||
import '../../pages/rank/index.dart';
|
||||
|
||||
List defaultNavigationBars = [
|
||||
{
|
||||
'id': 0,
|
||||
'icon': const Icon(
|
||||
Icons.home_outlined,
|
||||
size: 21,
|
||||
),
|
||||
'selectIcon': const Icon(
|
||||
Icons.home,
|
||||
size: 21,
|
||||
),
|
||||
'label': "首页",
|
||||
'count': 0,
|
||||
'page': const HomePage(),
|
||||
},
|
||||
{
|
||||
'id': 1,
|
||||
'icon': const Icon(
|
||||
Icons.trending_up,
|
||||
size: 21,
|
||||
),
|
||||
'selectIcon': const Icon(
|
||||
Icons.trending_up_outlined,
|
||||
size: 21,
|
||||
),
|
||||
'label': "排行榜",
|
||||
'count': 0,
|
||||
'page': const RankPage(),
|
||||
},
|
||||
{
|
||||
'id': 2,
|
||||
'icon': const Icon(
|
||||
Icons.motion_photos_on_outlined,
|
||||
size: 21,
|
||||
),
|
||||
'selectIcon': const Icon(
|
||||
Icons.motion_photos_on,
|
||||
size: 21,
|
||||
),
|
||||
'label': "动态",
|
||||
'count': 0,
|
||||
'page': const DynamicsPage(),
|
||||
},
|
||||
{
|
||||
'id': 3,
|
||||
'icon': const Icon(
|
||||
Icons.video_collection_outlined,
|
||||
size: 20,
|
||||
),
|
||||
'selectIcon': const Icon(
|
||||
Icons.video_collection,
|
||||
size: 21,
|
||||
),
|
||||
'label': "媒体库",
|
||||
'count': 0,
|
||||
'page': const MediaPage(),
|
||||
}
|
||||
];
|
222
lib/models/common/rank_type.dart
Normal file
222
lib/models/common/rank_type.dart
Normal file
@ -0,0 +1,222 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pilipala/pages/rank/zone/index.dart';
|
||||
|
||||
enum RandType {
|
||||
all,
|
||||
creation,
|
||||
animation,
|
||||
music,
|
||||
dance,
|
||||
game,
|
||||
knowledge,
|
||||
technology,
|
||||
sport,
|
||||
car,
|
||||
life,
|
||||
food,
|
||||
animal,
|
||||
madness,
|
||||
fashion,
|
||||
entertainment,
|
||||
film,
|
||||
origin,
|
||||
rookie
|
||||
}
|
||||
|
||||
extension RankTypeDesc on RandType {
|
||||
String get description => [
|
||||
'全站',
|
||||
'国创相关',
|
||||
'动画',
|
||||
'音乐',
|
||||
'舞蹈',
|
||||
'游戏',
|
||||
'知识',
|
||||
'科技',
|
||||
'运动',
|
||||
'汽车',
|
||||
'生活',
|
||||
'美食',
|
||||
'动物圈',
|
||||
'鬼畜',
|
||||
'时尚',
|
||||
'娱乐',
|
||||
'影视'
|
||||
][index];
|
||||
|
||||
String get id => [
|
||||
'all',
|
||||
'creation',
|
||||
'animation',
|
||||
'music',
|
||||
'dance',
|
||||
'game',
|
||||
'knowledge',
|
||||
'technology',
|
||||
'sport',
|
||||
'car',
|
||||
'life',
|
||||
'food',
|
||||
'animal',
|
||||
'madness',
|
||||
'fashion',
|
||||
'entertainment',
|
||||
'film'
|
||||
][index];
|
||||
}
|
||||
|
||||
List tabsConfig = [
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '全站',
|
||||
'type': RandType.all,
|
||||
'page': const ZonePage(rid: 0),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '国创相关',
|
||||
'type': RandType.creation,
|
||||
'page': const ZonePage(rid: 168),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '动画',
|
||||
'type': RandType.animation,
|
||||
'page': const ZonePage(rid: 1),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '音乐',
|
||||
'type': RandType.music,
|
||||
'page': const ZonePage(rid: 3),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '舞蹈',
|
||||
'type': RandType.dance,
|
||||
'page': const ZonePage(rid: 129),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '游戏',
|
||||
'type': RandType.game,
|
||||
'page': const ZonePage(rid: 4),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '知识',
|
||||
'type': RandType.knowledge,
|
||||
'page': const ZonePage(rid: 36),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '科技',
|
||||
'type': RandType.technology,
|
||||
'page': const ZonePage(rid: 188),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '运动',
|
||||
'type': RandType.sport,
|
||||
'page': const ZonePage(rid: 234),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '汽车',
|
||||
'type': RandType.car,
|
||||
'page': const ZonePage(rid: 223),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '生活',
|
||||
'type': RandType.life,
|
||||
'page': const ZonePage(rid: 160),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '美食',
|
||||
'type': RandType.food,
|
||||
'page': const ZonePage(rid: 211),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '动物圈',
|
||||
'type': RandType.animal,
|
||||
'page': const ZonePage(rid: 217),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '鬼畜',
|
||||
'type': RandType.madness,
|
||||
'page': const ZonePage(rid: 119),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '时尚',
|
||||
'type': RandType.fashion,
|
||||
'page': const ZonePage(rid: 155),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '娱乐',
|
||||
'type': RandType.entertainment,
|
||||
'page': const ZonePage(rid: 5),
|
||||
},
|
||||
{
|
||||
'icon': const Icon(
|
||||
Icons.live_tv_outlined,
|
||||
size: 15,
|
||||
),
|
||||
'label': '影视',
|
||||
'type': RandType.film,
|
||||
'page': const ZonePage(rid: 181),
|
||||
}
|
||||
];
|
@ -1,7 +1,7 @@
|
||||
// 首页推荐类型
|
||||
enum RcmdType { web, app }
|
||||
enum RcmdType { web, app, notLogin }
|
||||
|
||||
extension RcmdTypeExtension on RcmdType {
|
||||
String get values => ['web', 'app'][index];
|
||||
String get labels => ['web端', 'app端'][index];
|
||||
String get values => ['web', 'app', 'notLogin'][index];
|
||||
String get labels => ['web端', 'app端', '游客模式'][index];
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
enum ReplySortType { time, like, reply }
|
||||
enum ReplySortType { time, like }
|
||||
|
||||
extension ReplySortTypeExtension on ReplySortType {
|
||||
String get titles => ['最新评论', '最热评论', '回复最多'][index];
|
||||
String get labels => ['最新', '最热', '最多回复'][index];
|
||||
String get titles => ['最新评论', '最热评论'][index];
|
||||
String get labels => ['最新', '最热'][index];
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ extension SearchTypeExtension on SearchType {
|
||||
String get label => ['视频', '番剧', '直播间', '用户', '专栏'][index];
|
||||
}
|
||||
|
||||
// 搜索类型为视频、专栏及相簿时
|
||||
// 搜索类型为视频时
|
||||
enum ArchiveFilterType {
|
||||
totalrank,
|
||||
click,
|
||||
@ -44,3 +44,21 @@ extension ArchiveFilterTypeExtension on ArchiveFilterType {
|
||||
String get description =>
|
||||
['默认排序', '播放多', '新发布', '弹幕多', '收藏多', '评论多', '最多喜欢'][index];
|
||||
}
|
||||
|
||||
// 搜索类型为专栏时
|
||||
enum ArticleFilterType {
|
||||
// 综合排序
|
||||
totalrank,
|
||||
// 最新发布
|
||||
pubdate,
|
||||
// 最多点击
|
||||
click,
|
||||
// 最多喜欢
|
||||
attention,
|
||||
// 最多评论
|
||||
scores,
|
||||
}
|
||||
|
||||
extension ArticleFilterTypeExtension on ArticleFilterType {
|
||||
String get description => ['综合排序', '最新发布', '最多点击', '最多喜欢', '最多评论'][index];
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ enum TabType { live, rcmd, hot, bangumi }
|
||||
|
||||
extension TabTypeDesc on TabType {
|
||||
String get description => ['直播', '推荐', '热门', '番剧'][index];
|
||||
String get id => ['live', 'rcmd', 'hot', 'bangumi'][index];
|
||||
}
|
||||
|
||||
List tabsConfig = [
|
||||
|
5
lib/models/common/video_episode_type.dart
Normal file
5
lib/models/common/video_episode_type.dart
Normal file
@ -0,0 +1,5 @@
|
||||
enum VideoEpidoesType {
|
||||
videoEpisode,
|
||||
videoPart,
|
||||
bangumiEpisode,
|
||||
}
|
@ -414,6 +414,8 @@ class DynamicMajorModel {
|
||||
this.none,
|
||||
this.type,
|
||||
this.courses,
|
||||
this.common,
|
||||
this.music,
|
||||
});
|
||||
|
||||
DynamicArchiveModel? archive;
|
||||
@ -429,6 +431,8 @@ class DynamicMajorModel {
|
||||
// MAJOR_TYPE_OPUS 图文/文章
|
||||
String? type;
|
||||
Map? courses;
|
||||
Map? common;
|
||||
Map? music;
|
||||
|
||||
DynamicMajorModel.fromJson(Map<String, dynamic> json) {
|
||||
archive = json['archive'] != null
|
||||
@ -452,6 +456,8 @@ class DynamicMajorModel {
|
||||
json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null;
|
||||
type = json['type'];
|
||||
courses = json['courses'] ?? {};
|
||||
common = json['common'] ?? {};
|
||||
music = json['music'] ?? {};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,18 +2,28 @@ class FollowUpModel {
|
||||
FollowUpModel({
|
||||
this.liveUsers,
|
||||
this.upList,
|
||||
this.liveList,
|
||||
this.myInfo,
|
||||
});
|
||||
|
||||
LiveUsers? liveUsers;
|
||||
List<UpItem>? upList;
|
||||
List<LiveUserItem>? liveList;
|
||||
MyInfo? myInfo;
|
||||
|
||||
FollowUpModel.fromJson(Map<String, dynamic> json) {
|
||||
liveUsers = json['live_users'] != null
|
||||
? LiveUsers.fromJson(json['live_users'])
|
||||
: null;
|
||||
liveList = json['live_users'] != null
|
||||
? json['live_users']['items']
|
||||
.map<LiveUserItem>((e) => LiveUserItem.fromJson(e))
|
||||
.toList()
|
||||
: [];
|
||||
upList = json['up_list'] != null
|
||||
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
|
||||
: [];
|
||||
myInfo = json['my_info'] != null ? MyInfo.fromJson(json['my_info']) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,3 +103,21 @@ class UpItem {
|
||||
uname = json['uname'];
|
||||
}
|
||||
}
|
||||
|
||||
class MyInfo {
|
||||
MyInfo({
|
||||
this.face,
|
||||
this.mid,
|
||||
this.name,
|
||||
});
|
||||
|
||||
String? face;
|
||||
int? mid;
|
||||
String? name;
|
||||
|
||||
MyInfo.fromJson(Map<String, dynamic> json) {
|
||||
face = json['face'];
|
||||
mid = json['mid'];
|
||||
name = json['name'];
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,9 @@ class LatestDataModel {
|
||||
url = json['url'];
|
||||
tagName = json['tag_name'];
|
||||
createdAt = json['created_at'];
|
||||
assets =
|
||||
json['assets'].map<AssetItem>((e) => AssetItem.fromJson(e)).toList();
|
||||
assets = json['assets'] != null
|
||||
? json['assets'].map<AssetItem>((e) => AssetItem.fromJson(e)).toList()
|
||||
: [];
|
||||
body = json['body'];
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
|
||||
part 'result.g.dart';
|
||||
|
||||
@HiveType(typeId: 0)
|
||||
class RecVideoItemAppModel {
|
||||
RecVideoItemAppModel({
|
||||
this.id,
|
||||
@ -27,47 +24,27 @@ class RecVideoItemAppModel {
|
||||
this.adInfo,
|
||||
});
|
||||
|
||||
@HiveField(0)
|
||||
int? id;
|
||||
@HiveField(1)
|
||||
int? aid;
|
||||
@HiveField(2)
|
||||
String? bvid;
|
||||
@HiveField(3)
|
||||
int? cid;
|
||||
@HiveField(4)
|
||||
String? pic;
|
||||
@HiveField(5)
|
||||
RcmdStat? stat;
|
||||
@HiveField(6)
|
||||
String? duration;
|
||||
@HiveField(7)
|
||||
int? duration;
|
||||
String? title;
|
||||
@HiveField(8)
|
||||
int? isFollowed;
|
||||
@HiveField(9)
|
||||
RcmdOwner? owner;
|
||||
@HiveField(10)
|
||||
RcmdReason? rcmdReason;
|
||||
@HiveField(11)
|
||||
String? rcmdReason;
|
||||
String? goto;
|
||||
@HiveField(12)
|
||||
int? param;
|
||||
@HiveField(13)
|
||||
String? uri;
|
||||
@HiveField(14)
|
||||
String? talkBack;
|
||||
// 番剧
|
||||
@HiveField(15)
|
||||
String? bangumiView;
|
||||
@HiveField(16)
|
||||
String? bangumiFollow;
|
||||
@HiveField(17)
|
||||
String? bangumiBadge;
|
||||
|
||||
@HiveField(18)
|
||||
String? cardType;
|
||||
@HiveField(19)
|
||||
Map? adInfo;
|
||||
|
||||
RecVideoItemAppModel.fromJson(Map<String, dynamic> json) {
|
||||
@ -75,19 +52,29 @@ class RecVideoItemAppModel {
|
||||
? json['player_args']['aid']
|
||||
: int.parse(json['param'] ?? '-1');
|
||||
aid = json['player_args'] != null ? json['player_args']['aid'] : -1;
|
||||
bvid = null;
|
||||
bvid = json['player_args'] != null
|
||||
? IdUtils.av2bv(json['player_args']['aid'])
|
||||
: '';
|
||||
cid = json['player_args'] != null ? json['player_args']['cid'] : -1;
|
||||
pic = json['cover'];
|
||||
stat = RcmdStat.fromJson(json);
|
||||
duration = json['cover_right_text'];
|
||||
title = json['title'];
|
||||
isFollowed = 0;
|
||||
// 改用player_args中的duration作为原始数据(秒数)
|
||||
duration =
|
||||
json['player_args'] != null ? json['player_args']['duration'] : -1;
|
||||
//duration = json['cover_right_text'];
|
||||
title = json['title'] ?? '获取标题失败';
|
||||
owner = RcmdOwner.fromJson(json);
|
||||
rcmdReason = json['rcmd_reason_style'] != null
|
||||
? RcmdReason.fromJson(json['rcmd_reason_style'])
|
||||
: null;
|
||||
rcmdReason = json['bottom_rcmd_reason'] ?? json['top_rcmd_reason'];
|
||||
// 由于app端api并不会直接返回与owner的关注状态
|
||||
// 所以借用推荐原因是否为“已关注”、“新关注”等判别关注状态,从而与web端接口等效
|
||||
RegExp regex = RegExp(r'已关注|新关注');
|
||||
isFollowed = regex.hasMatch(rcmdReason ?? '') ? 1 : 0;
|
||||
// 如果是,就无需再显示推荐原因,交由view统一处理即可
|
||||
if (isFollowed == 1) {
|
||||
rcmdReason = null;
|
||||
}
|
||||
goto = json['goto'];
|
||||
param = int.parse(json['param']);
|
||||
param = int.parse(json['param'] ?? '-1');
|
||||
uri = json['uri'];
|
||||
talkBack = json['talk_back'];
|
||||
|
||||
@ -102,18 +89,14 @@ class RecVideoItemAppModel {
|
||||
}
|
||||
}
|
||||
|
||||
@HiveType(typeId: 1)
|
||||
class RcmdStat {
|
||||
RcmdStat({
|
||||
this.view,
|
||||
this.like,
|
||||
this.danmu,
|
||||
});
|
||||
@HiveField(0)
|
||||
String? view;
|
||||
@HiveField(1)
|
||||
String? like;
|
||||
@HiveField(2)
|
||||
String? danmu;
|
||||
|
||||
RcmdStat.fromJson(Map<String, dynamic> json) {
|
||||
@ -122,13 +105,10 @@ class RcmdStat {
|
||||
}
|
||||
}
|
||||
|
||||
@HiveType(typeId: 2)
|
||||
class RcmdOwner {
|
||||
RcmdOwner({this.name, this.mid});
|
||||
|
||||
@HiveField(0)
|
||||
String? name;
|
||||
@HiveField(1)
|
||||
int? mid;
|
||||
|
||||
RcmdOwner.fromJson(Map<String, dynamic> json) {
|
||||
@ -141,13 +121,11 @@ class RcmdOwner {
|
||||
}
|
||||
}
|
||||
|
||||
@HiveType(typeId: 8)
|
||||
class RcmdReason {
|
||||
RcmdReason({
|
||||
this.content,
|
||||
});
|
||||
|
||||
@HiveField(0)
|
||||
String? content;
|
||||
|
||||
RcmdReason.fromJson(Map<String, dynamic> json) {
|
||||
|
@ -1,209 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'result.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class RecVideoItemAppModelAdapter extends TypeAdapter<RecVideoItemAppModel> {
|
||||
@override
|
||||
final int typeId = 0;
|
||||
|
||||
@override
|
||||
RecVideoItemAppModel read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return RecVideoItemAppModel(
|
||||
id: fields[0] as int?,
|
||||
aid: fields[1] as int?,
|
||||
bvid: fields[2] as String?,
|
||||
cid: fields[3] as int?,
|
||||
pic: fields[4] as String?,
|
||||
stat: fields[5] as RcmdStat?,
|
||||
duration: fields[6] as String?,
|
||||
title: fields[7] as String?,
|
||||
isFollowed: fields[8] as int?,
|
||||
owner: fields[9] as RcmdOwner?,
|
||||
rcmdReason: fields[10] as RcmdReason?,
|
||||
goto: fields[11] as String?,
|
||||
param: fields[12] as int?,
|
||||
uri: fields[13] as String?,
|
||||
talkBack: fields[14] as String?,
|
||||
bangumiView: fields[15] as String?,
|
||||
bangumiFollow: fields[16] as String?,
|
||||
bangumiBadge: fields[17] as String?,
|
||||
cardType: fields[18] as String?,
|
||||
adInfo: (fields[19] as Map?)?.cast<dynamic, dynamic>(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, RecVideoItemAppModel obj) {
|
||||
writer
|
||||
..writeByte(20)
|
||||
..writeByte(0)
|
||||
..write(obj.id)
|
||||
..writeByte(1)
|
||||
..write(obj.aid)
|
||||
..writeByte(2)
|
||||
..write(obj.bvid)
|
||||
..writeByte(3)
|
||||
..write(obj.cid)
|
||||
..writeByte(4)
|
||||
..write(obj.pic)
|
||||
..writeByte(5)
|
||||
..write(obj.stat)
|
||||
..writeByte(6)
|
||||
..write(obj.duration)
|
||||
..writeByte(7)
|
||||
..write(obj.title)
|
||||
..writeByte(8)
|
||||
..write(obj.isFollowed)
|
||||
..writeByte(9)
|
||||
..write(obj.owner)
|
||||
..writeByte(10)
|
||||
..write(obj.rcmdReason)
|
||||
..writeByte(11)
|
||||
..write(obj.goto)
|
||||
..writeByte(12)
|
||||
..write(obj.param)
|
||||
..writeByte(13)
|
||||
..write(obj.uri)
|
||||
..writeByte(14)
|
||||
..write(obj.talkBack)
|
||||
..writeByte(15)
|
||||
..write(obj.bangumiView)
|
||||
..writeByte(16)
|
||||
..write(obj.bangumiFollow)
|
||||
..writeByte(17)
|
||||
..write(obj.bangumiBadge)
|
||||
..writeByte(18)
|
||||
..write(obj.cardType)
|
||||
..writeByte(19)
|
||||
..write(obj.adInfo);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is RecVideoItemAppModelAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class RcmdStatAdapter extends TypeAdapter<RcmdStat> {
|
||||
@override
|
||||
final int typeId = 1;
|
||||
|
||||
@override
|
||||
RcmdStat read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return RcmdStat(
|
||||
view: fields[0] as String?,
|
||||
like: fields[1] as String?,
|
||||
danmu: fields[2] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, RcmdStat obj) {
|
||||
writer
|
||||
..writeByte(3)
|
||||
..writeByte(0)
|
||||
..write(obj.view)
|
||||
..writeByte(1)
|
||||
..write(obj.like)
|
||||
..writeByte(2)
|
||||
..write(obj.danmu);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is RcmdStatAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class RcmdOwnerAdapter extends TypeAdapter<RcmdOwner> {
|
||||
@override
|
||||
final int typeId = 2;
|
||||
|
||||
@override
|
||||
RcmdOwner read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return RcmdOwner(
|
||||
name: fields[0] as String?,
|
||||
mid: fields[1] as int?,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, RcmdOwner obj) {
|
||||
writer
|
||||
..writeByte(2)
|
||||
..writeByte(0)
|
||||
..write(obj.name)
|
||||
..writeByte(1)
|
||||
..write(obj.mid);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is RcmdOwnerAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class RcmdReasonAdapter extends TypeAdapter<RcmdReason> {
|
||||
@override
|
||||
final int typeId = 8;
|
||||
|
||||
@override
|
||||
RcmdReason read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return RcmdReason(
|
||||
content: fields[0] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, RcmdReason obj) {
|
||||
writer
|
||||
..writeByte(1)
|
||||
..writeByte(0)
|
||||
..write(obj.content);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is RcmdReasonAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
126
lib/models/live/follow.dart
Normal file
126
lib/models/live/follow.dart
Normal file
@ -0,0 +1,126 @@
|
||||
class LiveFollowingModel {
|
||||
int? count;
|
||||
List<LiveFollowingItemModel>? list;
|
||||
int? liveCount;
|
||||
int? neverLivedCount;
|
||||
List? neverLivedFaces;
|
||||
int? pageSize;
|
||||
String? title;
|
||||
int? totalPage;
|
||||
|
||||
LiveFollowingModel({
|
||||
this.count,
|
||||
this.list,
|
||||
this.liveCount,
|
||||
this.neverLivedCount,
|
||||
this.neverLivedFaces,
|
||||
this.pageSize,
|
||||
this.title,
|
||||
this.totalPage,
|
||||
});
|
||||
|
||||
LiveFollowingModel.fromJson(Map<String, dynamic> json) {
|
||||
count = json['count'];
|
||||
if (json['list'] != null) {
|
||||
list = <LiveFollowingItemModel>[];
|
||||
json['list'].forEach((v) {
|
||||
list!.add(LiveFollowingItemModel.fromJson(v));
|
||||
});
|
||||
}
|
||||
liveCount = json['live_count'];
|
||||
neverLivedCount = json['never_lived_count'];
|
||||
if (json['never_lived_faces'] != null) {
|
||||
neverLivedFaces = <dynamic>[];
|
||||
json['never_lived_faces'].forEach((v) {
|
||||
neverLivedFaces!.add(v);
|
||||
});
|
||||
}
|
||||
pageSize = json['pageSize'];
|
||||
title = json['title'];
|
||||
totalPage = json['totalPage'];
|
||||
}
|
||||
}
|
||||
|
||||
class LiveFollowingItemModel {
|
||||
int? roomId;
|
||||
int? uid;
|
||||
String? uname;
|
||||
String? title;
|
||||
String? face;
|
||||
int? liveStatus;
|
||||
int? recordNum;
|
||||
String? recentRecordId;
|
||||
int? isAttention;
|
||||
int? clipNum;
|
||||
int? fansNum;
|
||||
String? areaName;
|
||||
String? areaValue;
|
||||
String? tags;
|
||||
String? recentRecordIdV2;
|
||||
int? recordNumV2;
|
||||
int? recordLiveTime;
|
||||
String? areaNameV2;
|
||||
String? roomNews;
|
||||
String? watchIcon;
|
||||
String? textSmall;
|
||||
String? roomCover;
|
||||
String? pic;
|
||||
int? parentAreaId;
|
||||
int? areaId;
|
||||
|
||||
LiveFollowingItemModel({
|
||||
this.roomId,
|
||||
this.uid,
|
||||
this.uname,
|
||||
this.title,
|
||||
this.face,
|
||||
this.liveStatus,
|
||||
this.recordNum,
|
||||
this.recentRecordId,
|
||||
this.isAttention,
|
||||
this.clipNum,
|
||||
this.fansNum,
|
||||
this.areaName,
|
||||
this.areaValue,
|
||||
this.tags,
|
||||
this.recentRecordIdV2,
|
||||
this.recordNumV2,
|
||||
this.recordLiveTime,
|
||||
this.areaNameV2,
|
||||
this.roomNews,
|
||||
this.watchIcon,
|
||||
this.textSmall,
|
||||
this.roomCover,
|
||||
this.pic,
|
||||
this.parentAreaId,
|
||||
this.areaId,
|
||||
});
|
||||
|
||||
LiveFollowingItemModel.fromJson(Map<String, dynamic> json) {
|
||||
roomId = json['roomid'];
|
||||
uid = json['uid'];
|
||||
uname = json['uname'];
|
||||
title = json['title'];
|
||||
face = json['face'];
|
||||
liveStatus = json['live_status'];
|
||||
recordNum = json['record_num'];
|
||||
recentRecordId = json['recent_record_id'];
|
||||
isAttention = json['is_attention'];
|
||||
clipNum = json['clipnum'];
|
||||
fansNum = json['fans_num'];
|
||||
areaName = json['area_name'];
|
||||
areaValue = json['area_value'];
|
||||
tags = json['tags'];
|
||||
recentRecordIdV2 = json['recent_record_id_v2'];
|
||||
recordNumV2 = json['record_num_v2'];
|
||||
recordLiveTime = json['record_live_time'];
|
||||
areaNameV2 = json['area_name_v2'];
|
||||
roomNews = json['room_news'];
|
||||
watchIcon = json['watch_icon'];
|
||||
textSmall = json['text_small'];
|
||||
roomCover = json['room_cover'];
|
||||
pic = json['room_cover'];
|
||||
parentAreaId = json['parent_area_id'];
|
||||
areaId = json['area_id'];
|
||||
}
|
||||
}
|
101
lib/models/live/message.dart
Normal file
101
lib/models/live/message.dart
Normal file
@ -0,0 +1,101 @@
|
||||
class LiveMessageModel {
|
||||
// 消息类型
|
||||
final LiveMessageType type;
|
||||
|
||||
// 用户名
|
||||
final String userName;
|
||||
|
||||
// 信息
|
||||
final String? message;
|
||||
|
||||
// 数据
|
||||
final dynamic data;
|
||||
|
||||
final String? face;
|
||||
final int? uid;
|
||||
final Map<String, dynamic>? emots;
|
||||
|
||||
// 颜色
|
||||
final LiveMessageColor color;
|
||||
|
||||
LiveMessageModel({
|
||||
required this.type,
|
||||
required this.userName,
|
||||
required this.message,
|
||||
required this.color,
|
||||
this.data,
|
||||
this.face,
|
||||
this.uid,
|
||||
this.emots,
|
||||
});
|
||||
}
|
||||
|
||||
class LiveSuperChatMessage {
|
||||
final String backgroundBottomColor;
|
||||
final String backgroundColor;
|
||||
final DateTime endTime;
|
||||
final String face;
|
||||
final String message;
|
||||
final String price;
|
||||
final DateTime startTime;
|
||||
final String userName;
|
||||
|
||||
LiveSuperChatMessage({
|
||||
required this.backgroundBottomColor,
|
||||
required this.backgroundColor,
|
||||
required this.endTime,
|
||||
required this.face,
|
||||
required this.message,
|
||||
required this.price,
|
||||
required this.startTime,
|
||||
required this.userName,
|
||||
});
|
||||
}
|
||||
|
||||
enum LiveMessageType {
|
||||
// 普通留言
|
||||
chat,
|
||||
// 醒目留言
|
||||
superChat,
|
||||
//
|
||||
online,
|
||||
// 加入
|
||||
join,
|
||||
// 关注
|
||||
follow,
|
||||
}
|
||||
|
||||
class LiveMessageColor {
|
||||
final int r, g, b;
|
||||
LiveMessageColor(this.r, this.g, this.b);
|
||||
static LiveMessageColor get white => LiveMessageColor(255, 255, 255);
|
||||
static LiveMessageColor numberToColor(int intColor) {
|
||||
var obj = intColor.toRadixString(16);
|
||||
|
||||
LiveMessageColor color = LiveMessageColor.white;
|
||||
if (obj.length == 4) {
|
||||
obj = "00$obj";
|
||||
}
|
||||
if (obj.length == 6) {
|
||||
var R = int.parse(obj.substring(0, 2), radix: 16);
|
||||
var G = int.parse(obj.substring(2, 4), radix: 16);
|
||||
var B = int.parse(obj.substring(4, 6), radix: 16);
|
||||
|
||||
color = LiveMessageColor(R, G, B);
|
||||
}
|
||||
if (obj.length == 8) {
|
||||
var R = int.parse(obj.substring(2, 4), radix: 16);
|
||||
var G = int.parse(obj.substring(4, 6), radix: 16);
|
||||
var B = int.parse(obj.substring(6, 8), radix: 16);
|
||||
//var A = int.parse(obj.substring(0, 2), radix: 16);
|
||||
color = LiveMessageColor(R, G, B);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "#${r.toRadixString(16).padLeft(2, '0')}${g.toRadixString(16).padLeft(2, '0')}${b.toRadixString(16).padLeft(2, '0')}";
|
||||
}
|
||||
}
|
43
lib/models/live/quality.dart
Normal file
43
lib/models/live/quality.dart
Normal file
@ -0,0 +1,43 @@
|
||||
enum LiveQuality {
|
||||
dolby,
|
||||
super4K,
|
||||
origin,
|
||||
bluRay,
|
||||
superHD,
|
||||
smooth,
|
||||
flunt,
|
||||
}
|
||||
|
||||
extension LiveQualityCode on LiveQuality {
|
||||
static final List<int> _codeList = [
|
||||
30000,
|
||||
20000,
|
||||
10000,
|
||||
400,
|
||||
250,
|
||||
150,
|
||||
80,
|
||||
];
|
||||
int get code => _codeList[index];
|
||||
|
||||
static LiveQuality? fromCode(int code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return LiveQuality.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
extension VideoQualityDesc on LiveQuality {
|
||||
static final List<String> _descList = [
|
||||
'杜比',
|
||||
'4K',
|
||||
'原画',
|
||||
'蓝光',
|
||||
'超清',
|
||||
'高清',
|
||||
'流畅',
|
||||
];
|
||||
get description => _descList[index];
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
class RoomInfoModel {
|
||||
RoomInfoModel({
|
||||
this.roomId,
|
||||
this.isPortrait,
|
||||
this.liveStatus,
|
||||
this.liveTime,
|
||||
this.playurlInfo,
|
||||
});
|
||||
int? roomId;
|
||||
bool? isPortrait;
|
||||
int? liveStatus;
|
||||
int? liveTime;
|
||||
PlayurlInfo? playurlInfo;
|
||||
@ -13,6 +15,7 @@ class RoomInfoModel {
|
||||
RoomInfoModel.fromJson(Map<String, dynamic> json) {
|
||||
roomId = json['room_id'];
|
||||
liveStatus = json['live_status'];
|
||||
isPortrait = json['is_portrait'];
|
||||
liveTime = json['live_time'];
|
||||
playurlInfo = PlayurlInfo.fromJson(json['playurl_info']);
|
||||
}
|
||||
|
130
lib/models/live/room_info_h5.dart
Normal file
130
lib/models/live/room_info_h5.dart
Normal file
@ -0,0 +1,130 @@
|
||||
class RoomInfoH5Model {
|
||||
RoomInfoH5Model({
|
||||
this.roomInfo,
|
||||
this.anchorInfo,
|
||||
this.isRoomFeed,
|
||||
this.watchedShow,
|
||||
this.likeInfoV3,
|
||||
this.blockInfo,
|
||||
});
|
||||
|
||||
RoomInfo? roomInfo;
|
||||
AnchorInfo? anchorInfo;
|
||||
int? isRoomFeed;
|
||||
Map? watchedShow;
|
||||
LikeInfoV3? likeInfoV3;
|
||||
Map? blockInfo;
|
||||
|
||||
RoomInfoH5Model.fromJson(Map<String, dynamic> json) {
|
||||
roomInfo = RoomInfo.fromJson(json['room_info']);
|
||||
anchorInfo = AnchorInfo.fromJson(json['anchor_info']);
|
||||
isRoomFeed = json['is_room_feed'];
|
||||
watchedShow = json['watched_show'];
|
||||
likeInfoV3 = LikeInfoV3.fromJson(json['like_info_v3']);
|
||||
blockInfo = json['block_info'];
|
||||
}
|
||||
}
|
||||
|
||||
class RoomInfo {
|
||||
RoomInfo({
|
||||
this.uid,
|
||||
this.roomId,
|
||||
this.title,
|
||||
this.cover,
|
||||
this.description,
|
||||
this.liveStatus,
|
||||
this.liveStartTime,
|
||||
this.areaId,
|
||||
this.areaName,
|
||||
this.parentAreaId,
|
||||
this.parentAreaName,
|
||||
this.online,
|
||||
this.background,
|
||||
this.appBackground,
|
||||
this.liveId,
|
||||
});
|
||||
|
||||
int? uid;
|
||||
int? roomId;
|
||||
String? title;
|
||||
String? cover;
|
||||
String? description;
|
||||
int? liveStatus;
|
||||
int? liveStartTime;
|
||||
int? areaId;
|
||||
String? areaName;
|
||||
int? parentAreaId;
|
||||
String? parentAreaName;
|
||||
int? online;
|
||||
String? background;
|
||||
String? appBackground;
|
||||
String? liveId;
|
||||
|
||||
RoomInfo.fromJson(Map<String, dynamic> json) {
|
||||
uid = json['uid'];
|
||||
roomId = json['room_id'];
|
||||
title = json['title'];
|
||||
cover = json['cover'];
|
||||
description = json['description'];
|
||||
liveStatus = json['liveS_satus'];
|
||||
liveStartTime = json['live_start_time'];
|
||||
areaId = json['area_id'];
|
||||
areaName = json['area_name'];
|
||||
parentAreaId = json['parent_area_id'];
|
||||
parentAreaName = json['parent_area_name'];
|
||||
online = json['online'];
|
||||
background = json['background'];
|
||||
appBackground = json['app_background'];
|
||||
liveId = json['live_id'];
|
||||
}
|
||||
}
|
||||
|
||||
class AnchorInfo {
|
||||
AnchorInfo({
|
||||
this.baseInfo,
|
||||
this.relationInfo,
|
||||
});
|
||||
|
||||
BaseInfo? baseInfo;
|
||||
RelationInfo? relationInfo;
|
||||
|
||||
AnchorInfo.fromJson(Map<String, dynamic> json) {
|
||||
baseInfo = BaseInfo.fromJson(json['base_info']);
|
||||
relationInfo = RelationInfo.fromJson(json['relation_info']);
|
||||
}
|
||||
}
|
||||
|
||||
class BaseInfo {
|
||||
BaseInfo({
|
||||
this.uname,
|
||||
this.face,
|
||||
});
|
||||
|
||||
String? uname;
|
||||
String? face;
|
||||
|
||||
BaseInfo.fromJson(Map<String, dynamic> json) {
|
||||
uname = json['uname'];
|
||||
face = json['face'];
|
||||
}
|
||||
}
|
||||
|
||||
class RelationInfo {
|
||||
RelationInfo({this.attention});
|
||||
|
||||
int? attention;
|
||||
|
||||
RelationInfo.fromJson(Map<String, dynamic> json) {
|
||||
attention = json['attention'];
|
||||
}
|
||||
}
|
||||
|
||||
class LikeInfoV3 {
|
||||
LikeInfoV3({this.totalLikes});
|
||||
|
||||
int? totalLikes;
|
||||
|
||||
LikeInfoV3.fromJson(Map<String, dynamic> json) {
|
||||
totalLikes = json['total_likes'];
|
||||
}
|
||||
}
|
@ -142,7 +142,7 @@ class Stat {
|
||||
|
||||
Stat.fromJson(Map<String, dynamic> json) {
|
||||
view = json["play"];
|
||||
danmaku = json['comment'];
|
||||
danmaku = json['video_review'];
|
||||
}
|
||||
}
|
||||
|
||||
|
46
lib/models/member/article.dart
Normal file
46
lib/models/member/article.dart
Normal file
@ -0,0 +1,46 @@
|
||||
class MemberArticleDataModel {
|
||||
MemberArticleDataModel({
|
||||
this.hasMore,
|
||||
this.items,
|
||||
this.offset,
|
||||
this.updateNum,
|
||||
});
|
||||
|
||||
bool? hasMore;
|
||||
List<MemberArticleItemModel>? items;
|
||||
String? offset;
|
||||
int? updateNum;
|
||||
|
||||
MemberArticleDataModel.fromJson(Map<String, dynamic> json) {
|
||||
hasMore = json['has_more'];
|
||||
items = json['items']
|
||||
.map<MemberArticleItemModel>((e) => MemberArticleItemModel.fromJson(e))
|
||||
.toList();
|
||||
offset = json['offset'];
|
||||
updateNum = json['update_num'];
|
||||
}
|
||||
}
|
||||
|
||||
class MemberArticleItemModel {
|
||||
MemberArticleItemModel({
|
||||
this.content,
|
||||
this.cover,
|
||||
this.jumpUrl,
|
||||
this.opusId,
|
||||
this.stat,
|
||||
});
|
||||
|
||||
String? content;
|
||||
Map? cover;
|
||||
String? jumpUrl;
|
||||
String? opusId;
|
||||
Map? stat;
|
||||
|
||||
MemberArticleItemModel.fromJson(Map<String, dynamic> json) {
|
||||
content = json['content'];
|
||||
cover = json['cover'];
|
||||
jumpUrl = json['jump_url'];
|
||||
opusId = json['opus_id'];
|
||||
stat = json['stat'];
|
||||
}
|
||||
}
|
@ -47,18 +47,23 @@ class Vip {
|
||||
this.status,
|
||||
this.dueDate,
|
||||
this.label,
|
||||
this.nicknameColor,
|
||||
});
|
||||
|
||||
int? type;
|
||||
int? status;
|
||||
int? dueDate;
|
||||
Map? label;
|
||||
int? nicknameColor;
|
||||
|
||||
Vip.fromJson(Map<String, dynamic> json) {
|
||||
type = json['type'];
|
||||
status = json['status'];
|
||||
dueDate = json['due_date'];
|
||||
label = json['label'];
|
||||
nicknameColor = json['nickname_color'] == ''
|
||||
? null
|
||||
: int.parse("0xFF${json['nickname_color'].replaceAll('#', '')}");
|
||||
}
|
||||
}
|
||||
|
||||
|
210
lib/models/member/like.dart
Normal file
210
lib/models/member/like.dart
Normal file
@ -0,0 +1,210 @@
|
||||
class MemberLikeDataModel {
|
||||
MemberLikeDataModel({
|
||||
this.aid,
|
||||
this.videos,
|
||||
this.tid,
|
||||
this.tname,
|
||||
this.pic,
|
||||
this.title,
|
||||
this.pubdate,
|
||||
this.ctime,
|
||||
this.desc,
|
||||
this.state,
|
||||
this.duration,
|
||||
this.redirectUrl,
|
||||
this.rights,
|
||||
this.owner,
|
||||
this.stat,
|
||||
this.dimension,
|
||||
this.cover43,
|
||||
this.bvid,
|
||||
this.interVideo,
|
||||
this.resourceType,
|
||||
this.subtitle,
|
||||
this.enableVt,
|
||||
});
|
||||
|
||||
final int? aid;
|
||||
final int? videos;
|
||||
final int? tid;
|
||||
final String? tname;
|
||||
final String? pic;
|
||||
final String? title;
|
||||
final int? pubdate;
|
||||
final int? ctime;
|
||||
final String? desc;
|
||||
final int? state;
|
||||
final int? duration;
|
||||
final String? redirectUrl;
|
||||
final Rights? rights;
|
||||
final Owner? owner;
|
||||
final Stat? stat;
|
||||
final Dimension? dimension;
|
||||
final String? cover43;
|
||||
final String? bvid;
|
||||
final bool? interVideo;
|
||||
final String? resourceType;
|
||||
final String? subtitle;
|
||||
final int? enableVt;
|
||||
|
||||
factory MemberLikeDataModel.fromJson(Map<String, dynamic> json) =>
|
||||
MemberLikeDataModel(
|
||||
aid: json["aid"],
|
||||
videos: json["videos"],
|
||||
tid: json["tid"],
|
||||
tname: json["tname"],
|
||||
pic: json["pic"],
|
||||
title: json["title"],
|
||||
pubdate: json["pubdate"],
|
||||
ctime: json["ctime"],
|
||||
desc: json["desc"],
|
||||
state: json["state"],
|
||||
duration: json["duration"],
|
||||
redirectUrl: json["redirect_url"],
|
||||
rights: Rights.fromJson(json["rights"]),
|
||||
owner: Owner.fromJson(json["owner"]),
|
||||
stat: Stat.fromJson(json["stat"]),
|
||||
dimension: Dimension.fromJson(json["dimension"]),
|
||||
cover43: json["cover43"],
|
||||
bvid: json["bvid"],
|
||||
interVideo: json["inter_video"],
|
||||
resourceType: json["resource_type"],
|
||||
subtitle: json["subtitle"],
|
||||
enableVt: json["enable_vt"],
|
||||
);
|
||||
}
|
||||
|
||||
class Dimension {
|
||||
Dimension({
|
||||
required this.width,
|
||||
required this.height,
|
||||
required this.rotate,
|
||||
});
|
||||
|
||||
final int width;
|
||||
final int height;
|
||||
final int rotate;
|
||||
|
||||
factory Dimension.fromJson(Map<String, dynamic> json) => Dimension(
|
||||
width: json["width"],
|
||||
height: json["height"],
|
||||
rotate: json["rotate"],
|
||||
);
|
||||
}
|
||||
|
||||
class Owner {
|
||||
Owner({
|
||||
required this.mid,
|
||||
required this.name,
|
||||
required this.face,
|
||||
});
|
||||
|
||||
final int mid;
|
||||
final String name;
|
||||
final String face;
|
||||
|
||||
factory Owner.fromJson(Map<String, dynamic> json) => Owner(
|
||||
mid: json["mid"],
|
||||
name: json["name"],
|
||||
face: json["face"],
|
||||
);
|
||||
}
|
||||
|
||||
class Rights {
|
||||
Rights({
|
||||
required this.bp,
|
||||
required this.elec,
|
||||
required this.download,
|
||||
required this.movie,
|
||||
required this.pay,
|
||||
required this.hd5,
|
||||
required this.noReprint,
|
||||
required this.autoplay,
|
||||
required this.ugcPay,
|
||||
required this.isCooperation,
|
||||
required this.ugcPayPreview,
|
||||
required this.noBackground,
|
||||
required this.arcPay,
|
||||
required this.payFreeWatch,
|
||||
});
|
||||
|
||||
final int bp;
|
||||
final int elec;
|
||||
final int download;
|
||||
final int movie;
|
||||
final int pay;
|
||||
final int hd5;
|
||||
final int noReprint;
|
||||
final int autoplay;
|
||||
final int ugcPay;
|
||||
final int isCooperation;
|
||||
final int ugcPayPreview;
|
||||
final int noBackground;
|
||||
final int arcPay;
|
||||
final int payFreeWatch;
|
||||
|
||||
factory Rights.fromJson(Map<String, dynamic> json) => Rights(
|
||||
bp: json["bp"],
|
||||
elec: json["elec"],
|
||||
download: json["download"],
|
||||
movie: json["movie"],
|
||||
pay: json["pay"],
|
||||
hd5: json["hd5"],
|
||||
noReprint: json["no_reprint"],
|
||||
autoplay: json["autoplay"],
|
||||
ugcPay: json["ugc_pay"],
|
||||
isCooperation: json["is_cooperation"],
|
||||
ugcPayPreview: json["ugc_pay_preview"],
|
||||
noBackground: json["no_background"],
|
||||
arcPay: json["arc_pay"],
|
||||
payFreeWatch: json["pay_free_watch"],
|
||||
);
|
||||
}
|
||||
|
||||
class Stat {
|
||||
Stat({
|
||||
required this.aid,
|
||||
required this.view,
|
||||
required this.danmaku,
|
||||
required this.reply,
|
||||
required this.favorite,
|
||||
required this.coin,
|
||||
required this.share,
|
||||
required this.nowRank,
|
||||
required this.hisRank,
|
||||
required this.like,
|
||||
required this.dislike,
|
||||
required this.vt,
|
||||
required this.vv,
|
||||
});
|
||||
|
||||
final int aid;
|
||||
final int view;
|
||||
final int danmaku;
|
||||
final int reply;
|
||||
final int favorite;
|
||||
final int coin;
|
||||
final int share;
|
||||
final int nowRank;
|
||||
final int hisRank;
|
||||
final int like;
|
||||
final int dislike;
|
||||
final int vt;
|
||||
final int vv;
|
||||
|
||||
factory Stat.fromJson(Map<String, dynamic> json) => Stat(
|
||||
aid: json["aid"],
|
||||
view: json["view"],
|
||||
danmaku: json["danmaku"],
|
||||
reply: json["reply"],
|
||||
favorite: json["favorite"],
|
||||
coin: json["coin"],
|
||||
share: json["share"],
|
||||
nowRank: json["now_rank"],
|
||||
hisRank: json["his_rank"],
|
||||
like: json["like"],
|
||||
dislike: json["dislike"],
|
||||
vt: json["vt"],
|
||||
vv: json["vv"],
|
||||
);
|
||||
}
|
@ -2,18 +2,32 @@ class MemberSeasonsDataModel {
|
||||
MemberSeasonsDataModel({
|
||||
this.page,
|
||||
this.seasonsList,
|
||||
this.seriesList,
|
||||
});
|
||||
|
||||
Map? page;
|
||||
List<MemberSeasonsList>? seasonsList;
|
||||
List<MemberArchiveItem>? seriesList;
|
||||
|
||||
MemberSeasonsDataModel.fromJson(Map<String, dynamic> json) {
|
||||
page = json['page'];
|
||||
seasonsList = json['seasons_list'] != null
|
||||
var tempList1 = json['seasons_list'] != null
|
||||
? json['seasons_list']
|
||||
.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
|
||||
.toList()
|
||||
: [];
|
||||
var tempList2 = json['series_list'] != null
|
||||
? json['series_list']
|
||||
.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
|
||||
.toList()
|
||||
: [];
|
||||
seriesList = json['archives'] != null
|
||||
? json['archives']
|
||||
.map<MemberArchiveItem>((e) => MemberArchiveItem.fromJson(e))
|
||||
.toList()
|
||||
: [];
|
||||
|
||||
seasonsList = [...tempList1, ...tempList2];
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,6 +100,8 @@ class MamberMeta {
|
||||
this.ptime,
|
||||
this.seasonId,
|
||||
this.total,
|
||||
this.seriesId,
|
||||
this.category,
|
||||
});
|
||||
|
||||
String? cover;
|
||||
@ -95,6 +111,8 @@ class MamberMeta {
|
||||
int? ptime;
|
||||
int? seasonId;
|
||||
int? total;
|
||||
int? seriesId;
|
||||
int? category;
|
||||
|
||||
MamberMeta.fromJson(Map<String, dynamic> json) {
|
||||
cover = json['cover'];
|
||||
@ -104,5 +122,7 @@ class MamberMeta {
|
||||
ptime = json['ptime'];
|
||||
seasonId = json['season_id'];
|
||||
total = json['total'];
|
||||
seriesId = json['series_id'];
|
||||
category = json['category'];
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ class HotVideoItemModel {
|
||||
this.dimension,
|
||||
this.shortLinkV2,
|
||||
this.firstFrame,
|
||||
this.cover,
|
||||
this.pubLocation,
|
||||
this.seasontype,
|
||||
this.isOgv,
|
||||
@ -50,6 +51,7 @@ class HotVideoItemModel {
|
||||
Dimension? dimension;
|
||||
String? shortLinkV2;
|
||||
String? firstFrame;
|
||||
String? cover;
|
||||
String? pubLocation;
|
||||
int? seasontype;
|
||||
bool? isOgv;
|
||||
@ -77,6 +79,7 @@ class HotVideoItemModel {
|
||||
dimension = Dimension.fromMap(json['dimension']);
|
||||
shortLinkV2 = json["short_link_v2"];
|
||||
firstFrame = json["first_frame"];
|
||||
cover = json["first_frame"];
|
||||
pubLocation = json["pub_location"];
|
||||
seasontype = json["seasontype"];
|
||||
isOgv = json["isOgv"];
|
||||
|
@ -1,19 +1,12 @@
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
part 'model_owner.g.dart';
|
||||
|
||||
@HiveType(typeId: 3)
|
||||
class Owner {
|
||||
Owner({
|
||||
this.mid,
|
||||
this.name,
|
||||
this.face,
|
||||
});
|
||||
@HiveField(0)
|
||||
|
||||
int? mid;
|
||||
@HiveField(1)
|
||||
String? name;
|
||||
@HiveField(2)
|
||||
String? face;
|
||||
|
||||
Owner.fromJson(Map<String, dynamic> json) {
|
||||
|
@ -1,47 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'model_owner.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class OwnerAdapter extends TypeAdapter<Owner> {
|
||||
@override
|
||||
final int typeId = 3;
|
||||
|
||||
@override
|
||||
Owner read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return Owner(
|
||||
mid: fields[0] as int?,
|
||||
name: fields[1] as String?,
|
||||
face: fields[2] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, Owner obj) {
|
||||
writer
|
||||
..writeByte(3)
|
||||
..writeByte(0)
|
||||
..write(obj.mid)
|
||||
..writeByte(1)
|
||||
..write(obj.name)
|
||||
..writeByte(2)
|
||||
..write(obj.face);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is OwnerAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
@ -1,11 +1,5 @@
|
||||
import 'package:pilipala/utils/utils.dart';
|
||||
|
||||
import './model_owner.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
part 'model_rec_video_item.g.dart';
|
||||
|
||||
@HiveType(typeId: 0)
|
||||
class RecVideoItemModel {
|
||||
RecVideoItemModel({
|
||||
this.id,
|
||||
@ -23,32 +17,19 @@ class RecVideoItemModel {
|
||||
this.rcmdReason,
|
||||
});
|
||||
|
||||
@HiveField(0)
|
||||
int? id = -1;
|
||||
@HiveField(1)
|
||||
String? bvid = '';
|
||||
@HiveField(2)
|
||||
int? cid = -1;
|
||||
@HiveField(3)
|
||||
String? goto = '';
|
||||
@HiveField(4)
|
||||
String? uri = '';
|
||||
@HiveField(5)
|
||||
String? pic = '';
|
||||
@HiveField(6)
|
||||
String? title = '';
|
||||
@HiveField(7)
|
||||
String? duration = '';
|
||||
@HiveField(8)
|
||||
int? duration = -1;
|
||||
int? pubdate = -1;
|
||||
@HiveField(9)
|
||||
Owner? owner;
|
||||
@HiveField(10)
|
||||
Stat? stat;
|
||||
@HiveField(11)
|
||||
int? isFollowed;
|
||||
@HiveField(12)
|
||||
RcmdReason? rcmdReason;
|
||||
String? rcmdReason;
|
||||
|
||||
RecVideoItemModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json["id"];
|
||||
@ -58,51 +39,29 @@ class RecVideoItemModel {
|
||||
uri = json["uri"];
|
||||
pic = json["pic"];
|
||||
title = json["title"];
|
||||
duration = Utils.tampToSeektime(json["duration"]);
|
||||
duration = json["duration"];
|
||||
pubdate = json["pubdate"];
|
||||
owner = Owner.fromJson(json["owner"]);
|
||||
stat = Stat.fromJson(json["stat"]);
|
||||
isFollowed = json["is_followed"] ?? 0;
|
||||
rcmdReason = json["rcmd_reason"] != null
|
||||
? RcmdReason.fromJson(json["rcmd_reason"])
|
||||
: RcmdReason(content: '');
|
||||
rcmdReason = json["rcmd_reason"]?['content'];
|
||||
}
|
||||
}
|
||||
|
||||
@HiveType(typeId: 1)
|
||||
class Stat {
|
||||
Stat({
|
||||
this.view,
|
||||
this.like,
|
||||
this.danmu,
|
||||
});
|
||||
@HiveField(0)
|
||||
String? view;
|
||||
@HiveField(1)
|
||||
int? like;
|
||||
@HiveField(2)
|
||||
int? danmu;
|
||||
|
||||
int? view;
|
||||
int? like;
|
||||
int? danmu;
|
||||
Stat.fromJson(Map<String, dynamic> json) {
|
||||
view = Utils.numFormat(json["view"]);
|
||||
// 无需在model中转换以保留原始数据,在view层处理即可
|
||||
view = json["view"];
|
||||
like = json["like"];
|
||||
danmu = json['danmaku'];
|
||||
}
|
||||
}
|
||||
|
||||
@HiveType(typeId: 2)
|
||||
class RcmdReason {
|
||||
RcmdReason({
|
||||
this.reasonType,
|
||||
this.content,
|
||||
});
|
||||
@HiveField(0)
|
||||
int? reasonType;
|
||||
@HiveField(1)
|
||||
String? content = '';
|
||||
|
||||
RcmdReason.fromJson(Map<String, dynamic> json) {
|
||||
reasonType = json["reason_type"];
|
||||
content = json["content"] ?? '';
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user