Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2699893581 | ||
|
|
21914a0bd7 | ||
|
|
d83667682d | ||
|
|
a5dc01f589 | ||
|
|
fb497cebfe | ||
|
|
9ffaba4358 | ||
|
|
be85307fe8 | ||
|
|
b55961bd83 | ||
|
|
f4911394ba | ||
|
|
42cf11358e | ||
|
|
6e6ed07890 | ||
|
|
22327bf33e | ||
|
|
57d8bc3311 | ||
|
|
6589799a2a | ||
|
|
7d6370163b | ||
|
|
9a5d63b7fc | ||
|
|
2d872a57ee | ||
|
|
f9c0850acd | ||
|
|
994ec732a4 | ||
|
|
b44770c77f | ||
|
|
7ea836e249 | ||
|
|
16d2401e38 | ||
|
|
259dc4c7cc | ||
|
|
3bcd67b8fb | ||
|
|
648d9103b7 | ||
|
|
faac434d33 | ||
|
|
f558cc49f7 | ||
|
|
5add227e55 | ||
|
|
4519a5d174 | ||
|
|
095bed4482 | ||
|
|
07dc95b639 | ||
|
|
edc3ebcff1 | ||
|
|
0f7055ca5b | ||
|
|
f426321e15 | ||
|
|
70d5cb3e2b | ||
|
|
15e4dca984 | ||
|
|
3a7221d71b | ||
|
|
e8cb3afb34 | ||
|
|
2b7a580001 | ||
|
|
b5d327581b | ||
|
|
c0ca45e949 | ||
|
|
4acc107d3a | ||
|
|
1070dba0ae | ||
|
|
7ae5d48767 | ||
|
|
e5c05fac48 | ||
|
|
f7c4b94546 | ||
|
|
a58af97216 | ||
|
|
3759a9703a | ||
|
|
2d3ed191fd | ||
|
|
425817b896 | ||
|
|
aaf3be2f7b | ||
|
|
bc810c80d6 | ||
|
|
e7a6f6f921 | ||
|
|
26542abc4d | ||
|
|
46fd7f40d4 | ||
|
|
40eaa80f4b | ||
|
|
ea8f93061d | ||
|
|
2ec2593704 | ||
|
|
c4949c7794 | ||
|
|
7572a0da5a | ||
|
|
678b9c3184 | ||
|
|
2900b18cce | ||
|
|
580e78afab | ||
|
|
ace430abe6 | ||
|
|
54c6089bdc | ||
|
|
8b308abfb8 | ||
|
|
53696970a7 | ||
|
|
18e2d8ad5e | ||
|
|
46cf9ad4ad | ||
|
|
a11f560183 | ||
|
|
23fbde6df4 | ||
|
|
512e4988d2 | ||
|
|
eb41a5e529 | ||
|
|
cefc126ffe | ||
|
|
29286efbd4 | ||
|
|
ea30ad5974 | ||
|
|
5f30cca79b | ||
|
|
d76cf4457e | ||
|
|
88d58f4344 | ||
|
|
93819b3afd | ||
|
|
7b438db34f | ||
|
|
f526d797f8 | ||
|
|
05f7b07449 | ||
|
|
ddf7c66933 | ||
|
|
715a52b291 | ||
|
|
660adb4a6f | ||
|
|
e47a1e0bf2 | ||
|
|
7b2044d2a4 | ||
|
|
1d3c961c3c | ||
|
|
dc59a1270f | ||
|
|
7452efa047 | ||
|
|
8517f74c6d | ||
|
|
637a62ea21 | ||
|
|
16f270fb9f | ||
|
|
c4f016c912 | ||
|
|
e63bc44055 | ||
|
|
99c8e14773 | ||
|
|
d84fb51f6f | ||
|
|
a8309ffaf5 | ||
|
|
fd97ba3ae9 | ||
|
|
305e62746c | ||
|
|
bf57de9d96 | ||
|
|
07e52d2a83 | ||
|
|
36a0450c1d | ||
|
|
f49e8134dd | ||
|
|
a54037270b | ||
|
|
4a6b091496 | ||
|
|
03addf41c7 | ||
|
|
9440855bf2 | ||
|
|
d53b1b94e5 | ||
|
|
16ebf7bb11 | ||
|
|
c8e7194a94 | ||
|
|
c6527fc57a | ||
|
|
bf906479d8 | ||
|
|
938512f826 | ||
|
|
bbc068b889 | ||
|
|
0ae9fd44d2 | ||
|
|
d266b9f55b | ||
|
|
57691fcd99 | ||
|
|
8cd41aae27 | ||
|
|
8ac3efeedc | ||
|
|
642c80779a | ||
|
|
17d43fcb7e | ||
|
|
6bc67dd303 | ||
|
|
2926225133 | ||
|
|
8fe078cc29 | ||
|
|
b721a52584 | ||
|
|
e7eeb0bacd | ||
|
|
710abb1206 | ||
|
|
82c3efba07 | ||
|
|
12a3b50e35 | ||
|
|
48884bc2de | ||
|
|
d02689fc67 | ||
|
|
9751b18c54 | ||
|
|
f6a4ca42b1 | ||
|
|
0f2d6bfa9b | ||
|
|
84a7b930a8 | ||
|
|
7549ecbf45 | ||
|
|
99f6150bdc | ||
|
|
dab8aec81c | ||
|
|
b0ddacbe89 | ||
|
|
530923640c | ||
|
|
c977d2ed86 | ||
|
|
8459d10dc7 | ||
|
|
60836ec5ec | ||
|
|
20cd4affee | ||
|
|
120c3ca52f | ||
|
|
455dadd30d | ||
|
|
01534caf13 | ||
|
|
4186081fdc | ||
|
|
88a7a9b6b1 | ||
|
|
b4267d8d8b | ||
|
|
fdac63a299 | ||
|
|
0a210b6e09 | ||
|
|
945308dfbc | ||
|
|
aa285f90ae | ||
|
|
64bf12718a | ||
|
|
dd9677ea3b | ||
|
|
ea60df592f | ||
|
|
c140aa32b6 | ||
|
|
9d6cf369d6 | ||
|
|
41c124e042 | ||
|
|
eca962ad68 | ||
|
|
89c653e613 | ||
|
|
964ed2d129 | ||
|
|
6a1287d1b0 | ||
|
|
d3f4abc50e | ||
|
|
20da1b6461 | ||
|
|
044947d4ae | ||
|
|
a2c0851ac7 | ||
|
|
7e136faea5 | ||
|
|
309b1e70e6 | ||
|
|
e2399c257d | ||
|
|
c892b51ff8 | ||
|
|
8b3a0d22be | ||
|
|
f4fe9294f0 | ||
|
|
67a2b76e41 | ||
|
|
499e406c5d | ||
|
|
90ccf18fbf | ||
|
|
7f57447e57 | ||
|
|
10beb9935f | ||
|
|
5fc2e1247b | ||
|
|
67d4e97582 | ||
|
|
abeadd858e | ||
|
|
5a737ce38d | ||
|
|
97f1b530b2 | ||
|
|
f1393ae707 | ||
|
|
0c274617cb | ||
|
|
f33a8c3829 | ||
|
|
c243645124 | ||
|
|
4655678481 | ||
|
|
cec8ddeeee | ||
|
|
8d987a02aa | ||
|
|
a6d87d570f | ||
|
|
f3b07be01f | ||
|
|
07f23ba927 | ||
|
|
7a7e96388b | ||
|
|
73d91f7268 | ||
|
|
6371296b28 | ||
|
|
cdeadf9d6d | ||
|
|
c332acb2c1 | ||
|
|
0d68f1a24b | ||
|
|
1666ea88fc | ||
|
|
ff163a31bf | ||
|
|
73d469dc8d | ||
|
|
d0226ab4cc | ||
|
|
3d1b07f11c | ||
|
|
f98d7c26dc | ||
|
|
c5fca74e39 | ||
|
|
f79ad3dabc | ||
|
|
c5ebfa5021 | ||
|
|
534a966ee8 | ||
|
|
7484596fb4 | ||
|
|
1637752b02 | ||
|
|
4ce424d4db | ||
|
|
916af88c53 | ||
|
|
b21776c517 | ||
|
|
6bb128e38a | ||
|
|
8b2694efb7 | ||
|
|
f853132e9b | ||
|
|
39e8d5513a | ||
|
|
6feadf73dd | ||
|
|
d683c48338 | ||
|
|
4a684b0bec | ||
|
|
6d7768e904 | ||
|
|
a645c4530f | ||
|
|
4d61462290 | ||
|
|
877ce8d008 | ||
|
|
fbff91774e | ||
|
|
53fb072373 | ||
|
|
f30f1f47d5 | ||
|
|
d8b0e89c6c | ||
|
|
a353f13ebb | ||
|
|
0d3415441f | ||
|
|
860d509d0f | ||
|
|
c86fdec8e6 | ||
|
|
ca6fedd05c | ||
|
|
07209a79de | ||
|
|
4132416f0d | ||
|
|
e62d5741c2 | ||
|
|
81dca20b17 | ||
|
|
f203f63c36 | ||
|
|
26cd218ec0 | ||
|
|
e402a0376a | ||
|
|
bac202d4ec | ||
|
|
bb8d856d17 | ||
|
|
42075291ce | ||
|
|
32b128fe40 | ||
|
|
df63ab5f91 | ||
|
|
88e3670493 | ||
|
|
eceeed8290 | ||
|
|
caa9c80d44 | ||
|
|
7e76e47d77 | ||
|
|
ba76c9c17e | ||
|
|
9555c6fa76 | ||
|
|
c37a6f5c27 | ||
|
|
b5af71d798 | ||
|
|
8f609fa900 | ||
|
|
5329154121 | ||
|
|
3a9187d795 | ||
|
|
e4e23e8017 | ||
|
|
9638ad4f06 | ||
|
|
c8de700460 | ||
|
|
e0f746b5ae | ||
|
|
9efcc36e15 | ||
|
|
918a7e64bd | ||
|
|
7f6874b791 | ||
|
|
1731462b41 | ||
|
|
654d50cd1b | ||
|
|
f631dd5c7b | ||
|
|
4c5558fa29 | ||
|
|
2892abc7a8 | ||
|
|
529385bc5b | ||
|
|
e3bb5d0fb5 | ||
|
|
2da930cd41 | ||
|
|
f41983a7b6 | ||
|
|
198791ca27 | ||
|
|
5b02ed9b0b | ||
|
|
760bad821b | ||
|
|
b8b2aab9bb | ||
|
|
a2b08606f1 | ||
|
|
5d40bd6f8e | ||
|
|
91639d887f | ||
|
|
6d234672b8 | ||
|
|
4e22b53907 | ||
|
|
f389e315a6 | ||
|
|
7f54c02a1c | ||
|
|
eaaa2b97b4 | ||
|
|
d1362f2ea3 | ||
|
|
2c56c78467 | ||
|
|
ec928c943d | ||
|
|
53bfba0320 | ||
|
|
847c3e85fa | ||
|
|
c96b4afcc7 | ||
|
|
4c741b9ac9 | ||
|
|
6b184c49ad | ||
|
|
6991b99ea9 | ||
|
|
0cc2b4e368 | ||
|
|
c51f834636 | ||
|
|
9a567ff5d0 | ||
|
|
bb420542ef | ||
|
|
14ec13a2e6 | ||
|
|
bf2b038632 | ||
|
|
b2fa6bb3a9 | ||
|
|
53166d9bba | ||
|
|
1560e44d36 | ||
|
|
1dbc8847b1 | ||
|
|
8bbfd1007d | ||
|
|
851e117381 | ||
|
|
2e31a7fbdb | ||
|
|
f3316160fb | ||
|
|
48b92ed2a6 | ||
|
|
4d075095ad | ||
|
|
9c1985bab3 | ||
|
|
e11e1a0d5b | ||
|
|
f202797954 | ||
|
|
f1ee7586f9 | ||
|
|
6cc74488a3 | ||
|
|
dbf9760780 | ||
|
|
6de1e41628 | ||
|
|
9977aac9f6 | ||
|
|
eb4995da86 | ||
|
|
dffff47a9f | ||
|
|
96cc982e01 | ||
|
|
116ab4fcfb | ||
|
|
c9c0249d4f | ||
|
|
85833f91e3 | ||
|
|
b76498852e | ||
|
|
e75b0e51d9 | ||
|
|
6b746bc0b3 | ||
|
|
dd31a59524 | ||
|
|
ca75b44d3b | ||
|
|
d9a9a310a8 | ||
|
|
8ece8cc14d | ||
|
|
425a83faec | ||
|
|
f034b313b3 | ||
|
|
b600cbdc34 | ||
|
|
ad3fce5b17 | ||
|
|
25604657b6 | ||
|
|
996ff027e5 | ||
|
|
71c595df15 | ||
|
|
70d00b7d62 | ||
|
|
e8828d8658 | ||
|
|
e08f6ee73c | ||
|
|
f12460e83a | ||
|
|
baef12a26d | ||
|
|
79400dd2b1 | ||
|
|
4409849143 | ||
|
|
3d77756da0 | ||
|
|
d45dac4587 | ||
|
|
38292bcbcc | ||
|
|
8b8cf9cd7a | ||
|
|
7c969cbe93 | ||
|
|
3283cc447e | ||
|
|
810ba74e75 | ||
|
|
5e1a20c5de | ||
|
|
975c59a114 | ||
|
|
51fcf04b0b | ||
|
|
d921347d73 | ||
|
|
5e25b542fb | ||
|
|
9b4ef98a3d | ||
|
|
8a862439cc | ||
|
|
6719953cf1 | ||
|
|
2bf73eb961 | ||
|
|
fe5d711fea | ||
|
|
33c8aaf36f | ||
|
|
d5366b10fa | ||
|
|
50d07fd31f | ||
|
|
792d64a33a | ||
|
|
adc9550e58 | ||
|
|
0638b9f133 | ||
|
|
05531e0bc5 | ||
|
|
44ec2270f2 | ||
|
|
ffd4f474ed | ||
|
|
2c22780c91 | ||
|
|
1d03d09119 | ||
|
|
404647c4cb | ||
|
|
c0b464ae36 | ||
|
|
e8185e0f9c | ||
|
|
0592c42df0 | ||
|
|
87a50c494f | ||
|
|
8257d7b41d | ||
|
|
77e471d671 | ||
|
|
92f5e6e77c | ||
|
|
4b7be60c27 | ||
|
|
e9abbf256e | ||
|
|
002d8c7430 | ||
|
|
346c7a027d | ||
|
|
7313e2d1c4 | ||
|
|
a34a8136c2 | ||
|
|
3b76dca8f1 | ||
|
|
30682bf8f5 | ||
|
|
e7b83326d0 | ||
|
|
ef55bd2719 | ||
|
|
0c29785a7e | ||
|
|
a5b67d4923 | ||
|
|
34a4df96fc | ||
|
|
eeacbbb979 | ||
|
|
2a010e2643 | ||
|
|
c25785ccf4 | ||
|
|
050fc2b29e | ||
|
|
e1e8fa410a | ||
|
|
becf21b7ea | ||
|
|
9c3f2f44da | ||
|
|
793541474a | ||
|
|
94f9ad6cc4 | ||
|
|
9a89d4c44c | ||
|
|
b99ffa0395 | ||
|
|
f926dc28be | ||
|
|
5b92d477e2 | ||
|
|
df561cc582 | ||
|
|
da60aeb71b | ||
|
|
684f4867c3 | ||
|
|
82a7846e6d | ||
|
|
a9199661a4 | ||
|
|
d07fc29a96 | ||
|
|
066919259c | ||
|
|
a094ba7d5c | ||
|
|
76a9485f0b | ||
|
|
413ef66701 | ||
|
|
1e91a53a8a | ||
|
|
0db7e51d69 | ||
|
|
cdf7f75058 | ||
|
|
84e4151f42 | ||
|
|
3a9729de06 | ||
|
|
93e8882433 | ||
|
|
56a49e323a | ||
|
|
de97703128 | ||
|
|
f820d19f55 | ||
|
|
a2094e9953 | ||
|
|
e5000f6502 | ||
|
|
9d63c50a2d | ||
|
|
ee90951945 | ||
|
|
8ed87d0739 | ||
|
|
1ebac0df21 | ||
|
|
a4e6025607 | ||
|
|
6ef03b8921 | ||
|
|
fdd6c87a31 | ||
|
|
89bfc845f6 | ||
|
|
9af5c0e0f4 | ||
|
|
8e92b21d60 | ||
|
|
9882d9d1c9 | ||
|
|
55275e48de | ||
|
|
3da896d369 | ||
|
|
745aa61466 | ||
|
|
2672144dbe | ||
|
|
ccbad4be1b | ||
|
|
dad3b86ba7 | ||
|
|
cfb81fc530 | ||
|
|
56afde24db | ||
|
|
88fdc1b503 | ||
|
|
338cd20132 | ||
|
|
ad38a09052 | ||
|
|
078e010c54 | ||
|
|
4ae4a7366a | ||
|
|
bfefc53040 | ||
|
|
f8af04ba4b | ||
|
|
e8a572032a | ||
|
|
5ef300b4a4 | ||
|
|
5e3275e547 | ||
|
|
5a55beee7b | ||
|
|
b8e52e2117 | ||
|
|
541f824909 | ||
|
|
4e763be6ec | ||
|
|
afaa00d635 | ||
|
|
1aa03edf6e | ||
|
|
cafada6ede | ||
|
|
36e0127e2b | ||
|
|
0af369bf23 | ||
|
|
a133f7d82d | ||
|
|
f66b8affb1 | ||
|
|
45ab233d01 | ||
|
|
676617ef19 | ||
|
|
af3baa99b8 | ||
|
|
33abefdd14 | ||
|
|
1cbebd0c9e | ||
|
|
245942ff14 | ||
|
|
608a08d2e8 | ||
|
|
fbb0d7090b | ||
|
|
40c890e644 | ||
|
|
35cf4255a6 | ||
|
|
0da47c409f | ||
|
|
541f582ac1 | ||
|
|
191bc33fa3 | ||
|
|
31168d9ed8 | ||
|
|
468c41c526 | ||
|
|
bc684b6ae3 | ||
|
|
399ec8d108 | ||
|
|
1820710f06 | ||
|
|
51d86148e8 | ||
|
|
e8f973531b | ||
|
|
4a01cf0608 | ||
|
|
929a057e1e | ||
|
|
d24a18023d | ||
|
|
4d8085a0db | ||
|
|
8c3ca2161d | ||
|
|
26720dead0 | ||
|
|
cda7e81485 | ||
|
|
0cffb26dfc | ||
|
|
d21e4aa830 | ||
|
|
a5dfe0c586 | ||
|
|
00f4745d46 | ||
|
|
062e7cef24 | ||
|
|
efc710d796 | ||
|
|
fd2d20af94 | ||
|
|
51065d1b57 | ||
|
|
6a60ce07e9 | ||
|
|
7c8f9a6662 | ||
|
|
ed61f470f7 | ||
|
|
a89d8ac229 | ||
|
|
3c8e7d13e0 | ||
|
|
7d2e4c1e8c | ||
|
|
4fbf90654e | ||
|
|
077af85181 | ||
|
|
1b77a8dd8b | ||
|
|
28071a10b5 | ||
|
|
1a6e3bf214 | ||
|
|
16db19fac7 | ||
|
|
c533e7832b | ||
|
|
0cd33ddada | ||
|
|
140d405aa9 | ||
|
|
ceeef6324e | ||
|
|
f850be1eca | ||
|
|
28c5b01596 | ||
|
|
59f5b5ede3 | ||
|
|
8db8083e32 | ||
|
|
a2c3f36065 | ||
|
|
0483e67026 | ||
|
|
872fafbb50 | ||
|
|
4d57d72980 | ||
|
|
77f5d5cf05 | ||
|
|
5e6dfb18f7 | ||
|
|
fe8b7ec5b3 | ||
|
|
f6503dc367 | ||
|
|
491782a88e | ||
|
|
13fb52478f | ||
|
|
15125159bb | ||
|
|
614069e342 | ||
|
|
48350ff175 | ||
|
|
3d3f1e0ff0 | ||
|
|
6abf511ef4 | ||
|
|
fffa136b3f | ||
|
|
8c4c554a1c | ||
|
|
5c1e542dab | ||
|
|
766290a2a3 | ||
|
|
3706bc5936 | ||
|
|
351e39826b | ||
|
|
808217d41e | ||
|
|
1c8f75ec88 | ||
|
|
296f8b2363 | ||
|
|
4960b9e2ec | ||
|
|
3bba3c5689 | ||
|
|
297b2e0826 | ||
|
|
9ed8a67c5c | ||
|
|
b8ad99b2a1 | ||
|
|
68cec1659a | ||
|
|
a7264e506a | ||
|
|
90d17604fc | ||
|
|
77a86da984 | ||
|
|
41becae272 | ||
|
|
21640e4264 | ||
|
|
1366dc0996 | ||
|
|
c6129ffc31 | ||
|
|
d018e9b577 | ||
|
|
496ec53f8a | ||
|
|
b9e0065aad | ||
|
|
a4798c3cf9 | ||
|
|
7a335515f6 | ||
|
|
a8457a748a | ||
|
|
bb7fa61c33 | ||
|
|
5d8d832e99 | ||
|
|
0bb215a803 | ||
|
|
173920d9eb | ||
|
|
1fb5ce87ea | ||
|
|
43deedd994 | ||
|
|
2d72afe1f0 | ||
|
|
a90c795891 | ||
|
|
1e32b6e875 | ||
|
|
0f454b562d | ||
|
|
db86a723a5 | ||
|
|
c0818b056d |
No files matched your search
@@ -0,0 +1,3 @@
|
||||
.buildozer
|
||||
.buildozer-downloads
|
||||
.gradle
|
||||
@@ -0,0 +1,32 @@
|
||||
## PR Checklist
|
||||
|
||||
<!-- For the checkbox formatting to work properly, make sure there are no spaces on either side of the "x" -->
|
||||
|
||||
Please check all that apply to this PR using "x":
|
||||
|
||||
- [ ] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
|
||||
- [ ] I have checked that this PR does not introduce a breaking change
|
||||
- [ ] This PR introduces breaking changes and I have provided a detailed explanation below
|
||||
|
||||
## PR Type
|
||||
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
- [ ] Bugfix
|
||||
- [ ] Feature
|
||||
- [ ] Code style update (formatting)
|
||||
- [ ] Refactoring (no functional changes)
|
||||
- [ ] Documentation changes
|
||||
- [ ] Other - Please describe:
|
||||
|
||||
## Fixes
|
||||
|
||||
Issue Number:
|
||||
|
||||
## What is the current behavior?
|
||||
|
||||
## What is the new behavior?
|
||||
|
||||
## Other information
|
||||
|
||||
<!-- If this PR contains a breaking change, please describe the impact and solution strategy for existing applications below. -->
|
||||
@@ -0,0 +1,55 @@
|
||||
<!--
|
||||
Thanks for reporting an issue to LBRY and helping us improve!
|
||||
|
||||
To make it possible for us to help you, please fill out below information carefully.
|
||||
|
||||
Before reporting any issues, please make sure that you're using the latest version.
|
||||
|
||||
We are also available on live chat at https://chat.lbry.com
|
||||
-->
|
||||
|
||||
|
||||
## The Issue
|
||||
|
||||
### Steps to reproduce
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### Expected behaviour
|
||||
Tell us what should happen
|
||||
|
||||
### Actual behaviour
|
||||
Tell us what happens instead
|
||||
|
||||
|
||||
## System Configuration
|
||||
- Device:
|
||||
- Android version:
|
||||
|
||||
|
||||
## Anything Else
|
||||
<!-- Include anything else that does not fit into the above sections -->
|
||||
|
||||
|
||||
## Screenshots
|
||||
<!-- If a screenshot would help explain the bug, please include one or two here -->
|
||||
|
||||
## Internal Use
|
||||
|
||||
### Acceptance Criteria
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### Definition of Done
|
||||
- [ ] Tested against acceptance criteria
|
||||
- [ ] Tested against the assumptions of the user story
|
||||
- [ ] The project builds without errors
|
||||
- [ ] Unit tests are written and passing
|
||||
- [ ] Tests on devices/browsers listed in the issue have passed
|
||||
- [ ] QA performed & issues resolved
|
||||
- [ ] Refactoring completed
|
||||
- [ ] Any configuration or build changes documented
|
||||
- [ ] Documentation updated
|
||||
- [ ] Peer Code Review performed
|
||||
@@ -1,4 +1,6 @@
|
||||
.buildozer
|
||||
.buildozer-downloads
|
||||
.gradle
|
||||
app/node_modules/
|
||||
bin
|
||||
buildozer.spec
|
||||
@@ -6,4 +8,10 @@ build.log
|
||||
recipes/**/*.pyc
|
||||
src/main/assets/index.android.bundle
|
||||
src/main/assets/index.android.bundle.meta
|
||||
*.log
|
||||
.vagrant
|
||||
|
||||
lbry-android.keystore
|
||||
p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json
|
||||
.gitsecret/keys/random_seed
|
||||
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
stages:
|
||||
- build
|
||||
- build2
|
||||
- deploy
|
||||
- release
|
||||
|
||||
build arm64 apk:
|
||||
stage: build
|
||||
image: lbry/android-base:latest
|
||||
before_script:
|
||||
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- git submodule sync --recursive
|
||||
- git submodule update --init --force --recursive
|
||||
artifacts:
|
||||
paths:
|
||||
- bin/browser-*-release__arm64.apk
|
||||
expire_in: 1 week
|
||||
script:
|
||||
- export PATH=/usr/bin:$PATH
|
||||
- echo "$PGP_PRIVATE_KEY" | gpg --batch --import
|
||||
- cd app
|
||||
- npm install
|
||||
- cd ..
|
||||
- wget -q 'https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
|
||||
- tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
|
||||
- rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- cp -f $CI_PROJECT_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
- cp -f $CI_PROJECT_DIR/scripts/mangled-glibc-syscalls__arm64.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm64/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
|
||||
- rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
|
||||
- git secret reveal
|
||||
- mv buildozer.spec.arm64.ci buildozer.spec
|
||||
- "./release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered"
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release__arm64.apk
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk /dev/null
|
||||
|
||||
build arm apk:
|
||||
stage: build2
|
||||
image: lbry/android-base:latest
|
||||
before_script:
|
||||
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- git submodule sync --recursive
|
||||
- git submodule update --init --force --recursive
|
||||
artifacts:
|
||||
paths:
|
||||
- bin/browser-*-release__arm.apk
|
||||
expire_in: 1 week
|
||||
script:
|
||||
- export PATH=/usr/bin:$PATH
|
||||
- echo "$PGP_PRIVATE_KEY" | gpg --batch --import
|
||||
- cd app
|
||||
- npm install
|
||||
- cd ..
|
||||
- wget -q 'https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
|
||||
- tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
|
||||
- rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- cp -f $CI_PROJECT_DIR/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle.arm $CI_PROJECT_DIR/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle
|
||||
- cp -f $CI_PROJECT_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
- cp -f $CI_PROJECT_DIR/scripts/mangled-glibc-syscalls.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
|
||||
- rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
|
||||
- git secret reveal
|
||||
- mv buildozer.spec.arm.ci buildozer.spec
|
||||
- "./release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered"
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release__arm.apk
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk /dev/null
|
||||
|
||||
deploy build.lbry.io:
|
||||
image: python:latest
|
||||
stage: deploy
|
||||
dependencies:
|
||||
- build arm apk
|
||||
- build arm64 apk
|
||||
before_script:
|
||||
- pip install awscli
|
||||
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- export BUILD_APK_FILENAME__32=browser-$BUILD_VERSION-release__arm.apk
|
||||
- export BUILD_APK_FILENAME__64=browser-$BUILD_VERSION-release__arm64.apk
|
||||
script:
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME__64 s3://build.lbry.io/android/build-${CI_PIPELINE_IID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME__64
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME__32 s3://build.lbry.io/android/build-${CI_PIPELINE_IID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME__32
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME__64 s3://build.lbry.io/android/push.apk
|
||||
|
||||
release apk:
|
||||
image: python:latest
|
||||
stage: release
|
||||
only:
|
||||
- tags
|
||||
dependencies:
|
||||
- build arm apk
|
||||
- build arm64 apk
|
||||
before_script:
|
||||
- pip install awscli githubrelease
|
||||
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- export BUILD_APK_FILENAME__32=browser-$BUILD_VERSION-release__arm.apk
|
||||
- export BUILD_APK_FILENAME__64=browser-$BUILD_VERSION-release__arm64.apk
|
||||
script:
|
||||
- githubrelease release lbryio/lbry-android create $CI_COMMIT_TAG --publish bin/$BUILD_APK_FILENAME__64 bin/$BUILD_APK_FILENAME__32
|
||||
- githubrelease release lbryio/lbry-android edit $CI_COMMIT_TAG --draft
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME__64 s3://build.lbry.io/android/latest.apk
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "app"]
|
||||
path = app
|
||||
url = https://github.com/lbryio/lbry-react-native
|
||||
Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
lbry-android.keystore:
|
||||
p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
install:
|
||||
- deactivate
|
||||
- export PATH=/usr/bin:$PATH
|
||||
- sudo dpkg --add-architecture i386
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get -qq install build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 npm nodejs
|
||||
- sudo pip install --upgrade cython==0.25.2 pip setuptools
|
||||
- git clone https://github.com/akinwale/buildozer.git
|
||||
- cd app
|
||||
- npm config set registry="http://registry.npmjs.org/"
|
||||
- npm install --silent --save react@16.2.0 react-native@0.52.0 react-native-video@2.0.0
|
||||
- cd ..
|
||||
- cd buildozer
|
||||
- sudo python setup.py install
|
||||
- cd ..
|
||||
- mv buildozer.spec.travis buildozer.spec
|
||||
- mkdir -p cd ~/.buildozer/android/platform/
|
||||
- wget 'https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip' -P ~/.buildozer/android/platform/
|
||||
- wget 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/
|
||||
- wget 'https://dl.google.com/android/repository/android-23_r02.zip' -P ~/.buildozer/android/platform/
|
||||
- wget 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P ~/.buildozer/android/platform/
|
||||
- unzip -qq ~/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip -d ~/.buildozer/android/platform/
|
||||
- tar -xf ~/.buildozer/android/platform/android-sdk_r23-linux.tgz -C ~/.buildozer/android/platform/
|
||||
- mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
|
||||
- unzip -qq ~/.buildozer/android/platform/android-23_r02.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-6.0 ~/.buildozer/android/platform/android-sdk-23/platforms/android-23
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- unzip -qq ~/.buildozer/android/platform/build-tools_r26.0.1-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-8.0.0 ~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.1
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses
|
||||
- echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
script:
|
||||
- ./build.sh | grep -Fv -e 'working:' -e 'copy' --line-buffered
|
||||
- cp bin/*.apk /dev/null
|
||||
@@ -0,0 +1,137 @@
|
||||
## Linux Build Instructions
|
||||
|
||||
This app has currently only been built on Ubuntu 14.04, 16.04, 17.10, and 18.04, but these instructions, or an analog of them, should work on most Linux or macOS environments. An abridged version of these instructions is available at [QUICKSTART.md](QUICKSTART.md).
|
||||
|
||||
For instructions on how to build using a Docker image, please see [DOCKER.md](DOCKER.md).
|
||||
|
||||
### Install Prerequisites
|
||||
|
||||
#### Requirements
|
||||
* JDK 1.8
|
||||
* Android SDK
|
||||
* Crystax Android NDK
|
||||
* Buildozer
|
||||
* Node.js
|
||||
* npm
|
||||
* yarn
|
||||
|
||||
#### apt Packages
|
||||
Install all apt packages required by running the following commands:
|
||||
```
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get -y update
|
||||
sudo apt-get install -y curl ca-certificates software-properties-common gpg-agent wget
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa -y && \
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
sudo apt-get -y update && apt-get -y install autoconf autogen automake libtool libffi-dev \
|
||||
build-essential python3.7 python3.7-dev python3.7-venv python3-pip ccache git libncurses5:i386 libstdc++6:i386 \
|
||||
libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
|
||||
python-pip openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 yarn gawk nodejs npm
|
||||
```
|
||||
Alternatively, the JDK available from http://www.oracle.com/technetwork/java/javase/downloads/index.html can be installed instead of the `openjdk-8-jdk` package.
|
||||
|
||||
#### Install Cython and Setuptools
|
||||
```
|
||||
sudo -H pip install --upgrade cython==0.28.1 setuptools
|
||||
```
|
||||
|
||||
#### Install buildozer
|
||||
A forked version of `buildozer` needs to be installed in order to copy the React Native UI source files into the corresponding directories.
|
||||
```
|
||||
git clone https://github.com/lbryio/buildozer.git
|
||||
cd buildozer && python2.7 setup.py install && cd ..
|
||||
```
|
||||
|
||||
#### Create buildozer.spec
|
||||
Assuming `lbry-android` as the current working folder:
|
||||
* Copy `buildozer.spec.sample` to `buildozer.spec` in the `lbry-android` folder. Running `buildozer init` instead will create a new `buildozer.spec` file.
|
||||
* Update `buildozer.spec` settings to match your environment. The basic recommended settings are outlined below.
|
||||
|
||||
|
||||
| Setting | Description |
|
||||
|:------------------- |:-----------------------------|
|
||||
| title | application title |
|
||||
| package.name | package name (e.g. browser) |
|
||||
| package.domain | package domain (e.g. io.lbry) |
|
||||
| source.dir | the location of the application main.py |
|
||||
| version | application version |
|
||||
| requirements | the Python module requirements for building the application |
|
||||
| services | list of Android background services and their corresponding Python entry points |
|
||||
| android.permissions | Android manifest permissions required by the application. This should be set to `INTERNET` at the very least to enable internet connectivity |
|
||||
| android.api | Android API version (Should be at least 23 for Gradle build support) |
|
||||
| android.sdk | Android SDK version (Should be at least 23 for Gradle build support) |
|
||||
| android.ndk | Android NDK version (not required when using crystax Android NDK) |
|
||||
| android.ndk_path | Android NDK path. This should be set to the crystax Android NDK path) |
|
||||
| android.sdk_path | Android SDK path. This should be set to the path where the Android SDK is manually set up (if not set up in the `.buildozer` path). |
|
||||
| p4a.source_dir | Path to the python-for-android repository folder. Currently set to the included `p4a` folder |
|
||||
| p4a.local_recipes | Path to a folder containing python_for_android recipes to be used in the build. The included `recipes` folder includes recipes for a successful build |
|
||||
|
||||
#### Create google-services.json
|
||||
The `google-services.json` file is required for the build to be successful due to the Firebase implementation. Simply copy the provided sample file into the same destination folder.
|
||||
```
|
||||
cd lbry-android
|
||||
cp p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json
|
||||
```
|
||||
|
||||
#### Setup Android SDK for buildozer
|
||||
Download the Android SDK, platform and build tools archives.
|
||||
* Android API 23 SDK - https://dl.google.com/android/android-sdk_r23-linux.tgz
|
||||
* Android API 28 platform - https://dl.google.com/android/repository/platform-28_r06.zip
|
||||
* Android build tools 26.0.2 - https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip
|
||||
|
||||
Create the `.buildozer` path (and the `android` sub-path) in your home folder if it doesn't already exist.
|
||||
`mkdir ~/.buildozer`
|
||||
`mkdir ~/.buildozer/android`
|
||||
|
||||
Extract the API 23 SDK to the `~/.buildozer/android` path and rename the extracted folder.
|
||||
```
|
||||
tar -xf android-sdk_r23-linux.tgz ~/.buildozer/android/platform/
|
||||
mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
|
||||
```
|
||||
|
||||
Extract the API 28 platform archive into the `android-sdk-23` folder and rename the extracted folder.
|
||||
```
|
||||
unzip ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||
mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-9 ~/.buildozer/android/platform/android-sdk-23/platforms/android-2
|
||||
```
|
||||
|
||||
Extract the build tools 26.0.2 build tools into the `android-sdk-23` folder and rename the extracted folder.
|
||||
```
|
||||
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
unzip ~/.buildozer/android/platform/build-tools_r26.0.2-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.2
|
||||
```
|
||||
|
||||
Finally, create the Android SDK license file. This prevents being prompted to accept the SDK license during the build process.
|
||||
```
|
||||
mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses
|
||||
echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
```
|
||||
|
||||
#### Setup Crystax Android NDK for buildozer
|
||||
* Download the Crystax Android NDK from https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz and extract. Remember to update `android.ndk_path` in your `buildozer.spec` to the path of the extracted Crystax NDK archive.
|
||||
* Copy `build-target-python.sh` from the `scripts` folder in the cloned `lbry-android` repository to the `crystax-ndk-10.3.2/build/tools/` folder.
|
||||
* Copy `mangled-glibc-syscalls.h` from the `scripts` folder in the cloned `lbry-android` repository to the `crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/` folder.
|
||||
* Delete the `android-9` folder in `crystax-ndk-10.3.2/platforms`, and create a symbolic link named `android-9` to the `android-21` folder.
|
||||
|
||||
#### Build and Deploy
|
||||
Run `npm install -g react-native-cli` to install React Native CLI tools.
|
||||
|
||||
Initialise git submodules by running `git submodule update --init --recursive` in the `lbry-android` folder.
|
||||
|
||||
Run `npm i` in the `lbry-android/app` folder to install the necessary modules required by the React Native user interface, and then run `./bundle.sh`.
|
||||
|
||||
Run `./build.sh` in `lbry-android` to build the APK. The output can be found in the `bin` subdirectory.
|
||||
|
||||
To build and deploy, you can run `./deploy.sh`. This requires a connected device or a running Android emulator.
|
||||
|
||||
#### Development
|
||||
If you already installed `Android SDK` and `adb`
|
||||
|
||||
* Run `adb reverse tcp:8081 tcp:8081`
|
||||
* Then go to the `lbry-android/app` folder and run `npm start`
|
||||
|
||||
Note: You need to have your device connected with USB debugging.
|
||||
|
||||
Once the bundler is ready, run the LBRY Browser app on your device and then shake the device violently until you see the React Native dev menu. You can enable "Live Reloading" and "Hot Reloading" from this menu, so any changes you make to the React Native code will be visible as you save. This will only reload React Native Javascript files. Native Java code needs to be redeployed by running the command `./deploy.sh`
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
# lbry-android development environment inside docker
|
||||
|
||||
[scripts/lbry-android.sh](scripts/lbry-android.sh) is a bash script to create a
|
||||
docker container for lbry-android development.
|
||||
|
||||
This is a hybrid approach where the apk is built inside docker, but you run
|
||||
Android Studio, `adb`, and the app hot-reload bundler, directly on your host.
|
||||
|
||||
## Features
|
||||
|
||||
* Clones lbry-android source code to a directory on the host, and mounts it
|
||||
inside the container.
|
||||
* Installs all build dependencies inside the container, leaving your host
|
||||
computer clean.
|
||||
* Mounted `.buildozer` directory to save container space. (Docker containers
|
||||
should stay under 10GB, and `.buildozer` is too big, so it has to stay in a
|
||||
mounted host directory instead.)
|
||||
* The biggest downloads are cached in `.buildozer-downloads` directory so you
|
||||
can easily remove `.buildozer` and not have to re-download the large cryostax
|
||||
NDK more than once.
|
||||
* Instructions for installing on a real Android device, and for setting up
|
||||
hot-reload.
|
||||
* Only a handful of commands to go from zero->hero.
|
||||
|
||||
## Requirements
|
||||
|
||||
Install all of the following on your host computer:
|
||||
|
||||
* Tested on Linux x86_64 with BASH.
|
||||
* [Install Android Studio](https://developer.android.com/studio/).
|
||||
* The normal install auto-creates a directory in `$HOME/Android/Sdk` to store
|
||||
SDK downloads in your home directory.
|
||||
* [Install nodejs](https://nodejs.org/en/download/package-manager/).
|
||||
* [Install yarn](https://yarnpkg.com/lang/en/docs/install).
|
||||
* [Install Docker](https://docs.docker.com/install/).
|
||||
* Install `sudo` and give your user account access to run `sudo docker`.
|
||||
|
||||
## Install
|
||||
|
||||
Clone `lbry-android`:
|
||||
|
||||
```
|
||||
LBRY_GIT=$HOME/git/vendor/lbryio/
|
||||
mkdir -p $LBRY_GIT
|
||||
git clone https://github.com/lbryio/lbry-android.git $LBRY_GIT/lbry-android
|
||||
cd $LBRY_GIT/lbry-android
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Install a bash alias to the [scripts/lbry-android.sh](scripts/lbry-android.sh)
|
||||
script:
|
||||
|
||||
```
|
||||
echo "alias lbry-android=$LBRY_GIT/lbry-android/scripts/lbry-android.sh" >> $HOME/.bashrc
|
||||
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
* First create the base docker image:
|
||||
|
||||
```
|
||||
lbry-android docker-build
|
||||
```
|
||||
|
||||
(If anytime you change the docker build scripts in the [scripts](scripts)
|
||||
subdirectory, you should rebuild the image again.)
|
||||
|
||||
* Setup buildozer and install dependencies:
|
||||
|
||||
```
|
||||
lbry-android setup
|
||||
```
|
||||
|
||||
* Build the apk:
|
||||
|
||||
```
|
||||
lbry-android build
|
||||
```
|
||||
|
||||
The apk will be built and end up in the `lbry-android/bin/` subdirectory.
|
||||
|
||||
## Running on a real Android device
|
||||
|
||||
Once you have the apk built, you can install it on a real Android device to
|
||||
start testing.
|
||||
|
||||
Follow the Android documentation for [enabling USB
|
||||
debugging](https://developer.android.com/studio/command-line/adb#Enabling) on
|
||||
your device.
|
||||
|
||||
Once you have enabled debugging, do the following:
|
||||
|
||||
* Plug your device into a USB port on the host computer.
|
||||
* Run:
|
||||
|
||||
```~/Android/Sdk/platform-tools/adb devices```
|
||||
|
||||
* ADB should list your device like so:
|
||||
|
||||
```
|
||||
[ryan@t440s lbry-android]$ adb devices
|
||||
List of devices attached
|
||||
HT71R0000000 device
|
||||
```
|
||||
|
||||
* The first time you connect, you should see a modal dialog on the device
|
||||
asking to confirm the host id. You must approve it, or adb will fail to
|
||||
connect.
|
||||
|
||||
* If after trying several times, adb is still not connecting to your device,
|
||||
and adb lists your device as `unauthorized`, you may need to [follow this
|
||||
advice](https://stackoverflow.com/a/38380384/56560) and delete your
|
||||
`$HOME/.android` directory.
|
||||
|
||||
* Install the apk (whatever the current version is called) to the device:
|
||||
|
||||
```
|
||||
~/Android/Sdk/platform-tools/adb install ./bin/browser-0.7.5-debug.apk
|
||||
```
|
||||
|
||||
* Open the app on your device, and follow the initial steps to get to the main
|
||||
lbry-android browser page.
|
||||
|
||||
* Create a tcp tunnel over the adb bridge, for the app to handle live-reload:
|
||||
|
||||
```
|
||||
~/Android/Sdk/platform-tools/adb reverse tcp:8081 tcp:8081
|
||||
```
|
||||
|
||||
* Start the live-reload server on the host:
|
||||
|
||||
```
|
||||
cd app/
|
||||
yarn install
|
||||
yarn start
|
||||
```
|
||||
|
||||
* With your device currently running the lbry-android app, shake the device
|
||||
from side to side, and a menu will appear. Choose `Enable Hot Reloading`.
|
||||
|
||||
* The app should reload itself.
|
||||
|
||||
* Now make a change to the source code to test hot reload. From the host, open
|
||||
up the main page view source code: `app/src/component/uriBar/view.js`. Find
|
||||
the line that reads `Search movies, music, and more` (This is the main search
|
||||
bar at the top of the app.) - Change some of the text and save the file.
|
||||
|
||||
* If hot-reload is working, within a few seconds the phone should reload the
|
||||
page automatically and show the change that you made.
|
||||
|
||||
* If the hot-reload does not work, try closing the app (dismiss the window from
|
||||
the tab overview, via android square button) and reload the app.
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
# Introduction
|
||||
The purpose of this guide is to help whomever is interested in running the LBRY Android application from scratch on their device, but they're main computing platform is not Linux but macOS.
|
||||
|
||||
## Estimated build time
|
||||
25 - 40 minutes (depending on Internet connection speeds)
|
||||
|
||||
## What do you need?
|
||||
* A computer running the latest OS
|
||||
* Internet access to download modules and packages
|
||||
* At least 15GB of free disk space
|
||||
* Docker
|
||||
* Patience
|
||||
|
||||
## Step 1/6
|
||||
Create an application on [Firebase](https://console.firebase.google.com). In the **Android package name** field, input `io.lbry.browser`. Download the resulting `google-services.json` file and keep it safe, you'll be needing it later.
|
||||
|
||||
## Step 2/6
|
||||
Start the docker application and paste all of these lines into Terminal:
|
||||
|
||||
```bash
|
||||
docker run -it lbry/android-base:latest /bin/bash
|
||||
wget "https://www.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz" -P ~/.buildozer/android/
|
||||
tar -xvf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
|
||||
rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
git clone https://github.com/lbryio/lbry-android
|
||||
cd lbry-android
|
||||
git submodule update --init --recursive
|
||||
cp buildozer.spec.sample buildozer.spec
|
||||
cd app;npm i;cd ..
|
||||
cp scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
cp scripts/mangled-glibc-syscalls.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
|
||||
cd p4a/pythonforandroid/bootstraps/lbry/build/templates
|
||||
apt install nano -y
|
||||
```
|
||||
|
||||
## Step 3/6
|
||||
Copy the contents of the `google-services.json` you downloaded earlier and paste them into Terminal after running the next command:
|
||||
|
||||
```bash
|
||||
nano google-services.json
|
||||
```
|
||||
|
||||
Type `^X` to save and exit.
|
||||
|
||||
## Step 4/6
|
||||
Paste more lines and I guess check your email, this will take some time:
|
||||
|
||||
```bash
|
||||
cd /lbry-android/app
|
||||
./bundle.sh
|
||||
cd ..
|
||||
buildozer android debug
|
||||
```
|
||||
|
||||
When the build is complete, you should see a message like: `[INFO]: # APK renamed to browser-0.7.3-debug.apk`. You will need this filename for the next step.
|
||||
|
||||
## Step 5/6
|
||||
In a separate Terminal window:
|
||||
|
||||
```bash
|
||||
docker ps # get container name
|
||||
docker cp CONTAINER_NAME:/lbry-android/bin/STEP_4_FILENAME ~/Desktop/ # copies STEP_4_FILENAME to your Desktop
|
||||
```
|
||||
|
||||
## Step 6/6
|
||||
- Download [Android File Transfer](https://www.android.com/filetransfer) and install it.
|
||||
- On your Android device, install [File Explorer](https://play.google.com/store/apps/details?id=com.mauriciotogneri.fileexplorer).
|
||||
- Plug in your Android device and swipe down from the top into the "USB for file transfer" settings (or similar name on your device) and make sure "Transfer files" is selected.
|
||||
- Open **Android File Transfer** on your computer and drag and drop `STEP_4_FILENAME` from your Desktop to the `Downloads` folder on the Android device.
|
||||
- Back on the Android device, navigate to `STEP_4_FILENAME` in the `Downloads` folder and tap it to begin installation.
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
FROM thyrlian/android-sdk
|
||||
|
||||
## Dependencies to run as root:
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get -y update && \
|
||||
apt-get install -y \
|
||||
curl ca-certificates software-properties-common gpg-agent wget \
|
||||
python3.7 python3.7-dev python3-pip python2.7 python2.7-dev python3.7-venv \
|
||||
python-pip zlib1g-dev m4 zlib1g:i386 libc6-dev-i386 gawk nodejs npm unzip openjdk-8-jdk \
|
||||
autoconf autogen automake libtool libffi-dev build-essential \
|
||||
ccache git libncurses5:i386 libstdc++6:i386 \
|
||||
libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 && \
|
||||
npm install -g yarn react-native-cli && \
|
||||
pip2 install --upgrade cython setuptools && \
|
||||
pip2 install git+https://github.com/lbryio/buildozer.git@master && \
|
||||
ln -s /src/scripts/build-docker.sh /usr/local/bin/build && \
|
||||
adduser lbry-android --gecos GECOS --shell /bin/bash --disabled-password --home /home/lbry-android && \
|
||||
mkdir /home/lbry-android/.npm-packages && \
|
||||
echo "prefix=/home/lbry-android/.npm-packages" > /home/lbry-android/.npmrc && \
|
||||
chown -R lbry-android:lbry-android /home/lbry-android && \
|
||||
mkdir /src && \
|
||||
chown lbry-android:lbry-android /src && \
|
||||
mkdir /dist && \
|
||||
chown lbry-android:lbry-android /dist
|
||||
|
||||
## Further setup done by lbry-android user:
|
||||
USER lbry-android
|
||||
|
||||
COPY scripts/docker-build.sh /home/lbry-android/bin/build
|
||||
COPY scripts/docker-setup.sh /home/lbry-android/bin/setup
|
||||
CMD ["/home/lbry-android/bin/build"]
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2018 LBRY Inc
|
||||
Copyright (c) 2017-2019 LBRY Inc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
# Introduction
|
||||
If you would like to contribute to the Android app, but find the build documentation a little daunting, this guide lets you copy-paste your way to a successful APK build.
|
||||
|
||||
### Estimated build time
|
||||
25 - 40 minutes (depending on Internet connection speeds)
|
||||
|
||||
### What do you need?
|
||||
* A computer running [Ubuntu 18.04](https://ubuntu.com/download/desktop)
|
||||
* Internet access to download modules and packages.
|
||||
* At least 15GB of free disk space.
|
||||
* Alternatively, Docker. You can skip steps 1 through 5 if you make use of the `lbry/android-base` Docker base image. Scroll down to [Fast Track](#Fast-Track) at the bottom of the page if you would prefer to use Docker.
|
||||
|
||||
### Step 1 of 10
|
||||
Install all the apt packages required by running the following commands. You can copy-paste this directly to your terminal.
|
||||
```
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get -y update
|
||||
sudo apt-get install -y curl ca-certificates software-properties-common gpg-agent wget
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa -y && \
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
sudo apt-get -y update && apt-get -y install autoconf autogen automake libtool libffi-dev \
|
||||
build-essential python3.7 python3.7-dev python3.7-venv python3-pip ccache git libncurses5:i386 libstdc++6:i386 \
|
||||
libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
|
||||
python-pip openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 yarn gawk nodejs npm
|
||||
```
|
||||
|
||||
### Step 2 of 10
|
||||
Install a couple of packages using the Python package installer
|
||||
```
|
||||
sudo -H pip install --upgrade cython==0.28.1 setuptools
|
||||
```
|
||||
|
||||
### Step 3 of 10
|
||||
Install [buildozer](https://github.com/lbryio/buildozer.git), a tool for creating the apk package using the python for android toolchain.
|
||||
```
|
||||
git clone https://github.com/lbryio/buildozer.git
|
||||
cd buildozer && python2.7 setup.py install && cd ..
|
||||
```
|
||||
|
||||
### Step 4 of 10
|
||||
The Android SDK needs to be setup for buildozer. This requires creating a few directories and downloading a number of files. Run the following commands to create the buildozer directory, download the required archives and extract them into their proper destination folders.
|
||||
|
||||
```
|
||||
mkdir -p ~/.buildozer/android/platform
|
||||
wget 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/ && \
|
||||
wget 'https://dl.google.com/android/repository/platform-28_r06.zip' -P ~/.buildozer/android/platform/ && \
|
||||
wget 'https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip' -P ~/.buildozer/android/platform/
|
||||
tar -xvf ~/.buildozer/android/platform/android-sdk_r23-linux.tgz -C ~/.buildozer/android/platform/ && \
|
||||
mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23 && \
|
||||
unzip ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms && \
|
||||
mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-9 ~/.buildozer/android/platform/android-sdk-23/platforms/android-28 && \
|
||||
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools && \
|
||||
unzip ~/.buildozer/android/platform/build-tools_r26.0.2-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools && \
|
||||
mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses && \
|
||||
echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
```
|
||||
|
||||
### Step 5 of 10
|
||||
Install the react-native-cli npm package.
|
||||
```
|
||||
sudo npm install -g react-native-cli
|
||||
```
|
||||
|
||||
### Step 6 of 10
|
||||
Install the Crystax NDK which is required for building Python 3.7 for the mobile app, and a number of native C / C++ modules and packages used by the app. Run the following commands to download and extract the NDK.
|
||||
```
|
||||
wget 'https://www.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/ && \
|
||||
tar -xvf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/ && \
|
||||
rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9 && \
|
||||
ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
```
|
||||
|
||||
### Step 7 of 10
|
||||
Clone the [lbryio/lbry-android git repository](https://github.com/lbryio/lbry-android), initialise submodules and create your `buildozer.spec` and `google-services.json` files. The provided `buildozer.spec.sample` contains defaults provided you followed steps 1 through 5 exactly as described. You can also customise the spec file if you want to. The `google-services.sample.json` can be used to ensure the build completes successfully.
|
||||
```
|
||||
git clone https://github.com/lbryio/lbry-android
|
||||
cd lbry-android
|
||||
git submodule update --init --recursive
|
||||
cp buildozer.spec.sample buildozer.spec
|
||||
cp p4a/pythonforandroid/bootstraps/lbry/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/templates/google-services.json
|
||||
```
|
||||
|
||||
### Step 8 of 10
|
||||
Install the npm packages required for the app's React Native code, and create the React Native app bundle.
|
||||
```
|
||||
cd app
|
||||
npm install
|
||||
./bundle.sh
|
||||
cd ..
|
||||
```
|
||||
|
||||
### Step 9 of 10
|
||||
Copy a couple of required files from the repository for the build to be successful.
|
||||
```
|
||||
cp scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
cp scripts/mangled-glibc-syscalls.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
|
||||
```
|
||||
|
||||
### Step 10 of 10
|
||||
If you made it this far, you're finally ready to build the package! You just have to run a single command to generate the APK.
|
||||
```
|
||||
buildozer android debug
|
||||
```
|
||||
|
||||
### Fast Track {#Fast-Track}
|
||||
Install Docker and start a container using the `lbry/android-base` image, which is about 1.72GB in size. Run the following commands for Ubuntu and then follow steps 6 through 10 in the container's bash prompt.
|
||||
```
|
||||
sudo apt-get install docker-ce
|
||||
docker run -it lbry/android-base:latest /bin/bash
|
||||
```
|
||||
|
||||
**Pro Tip:** You can also make use of Docker to run your builds on macOS or Windows.
|
||||
@@ -1,75 +1,33 @@
|
||||
[](https://travis-ci.org/lbryio/lbry-android)
|
||||
## 64-bit Ubuntu 16.04 LTS build instructions
|
||||
# LBRY Android
|
||||
[](https://ci.lbry.tech/lbry/lbry-android/commits/master)
|
||||
[](https://github.com/lbryio/lbry-android/blob/master/LICENSE)
|
||||
|
||||
### Install Prerequisites
|
||||
|
||||
#### Requirements
|
||||
* JDK 1.8
|
||||
* Android SDK
|
||||
* Android NDK
|
||||
* Buildozer
|
||||
|
||||
#### Apt Packages
|
||||
Based on the quickstart instructions at http://buildozer.readthedocs.io/en/latest/installation.html
|
||||
```
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386
|
||||
```
|
||||
Alternatively, the JDK available from http://www.oracle.com/technetwork/java/javase/downloads/index.html can be installed instead of the `openjdk-8-jdk` package.
|
||||
|
||||
**Additional package for building libgmp**
|
||||
```
|
||||
sudo apt-get install m4
|
||||
```
|
||||
|
||||
**Additional package for the pycrypto recipe**
|
||||
|
||||
This had to be installed due to an error regarding the `<gnu/stubs.h>` include not found.
|
||||
```
|
||||
sudo apt-get install libc6-dev-i386
|
||||
```
|
||||
An Android browser and wallet for the [LBRY](https://lbry.com) network. This app bundles [lbrynet-daemon](https://github.com/lbryio/lbry) as a background service with a UI layer built with React Native. The APK is built using buildozer and the Gradle build tool.
|
||||
|
||||
|
||||
#### Install Cython
|
||||
```
|
||||
sudo pip install --upgrade cython==0.25.2
|
||||
```
|
||||
|
||||
#### Install buildozer
|
||||
```
|
||||
git clone https://github.com/kivy/buildozer.git
|
||||
cd buildozer
|
||||
sudo python2.7 setup.py install
|
||||
```
|
||||
|
||||
#### Create buildozer.spec
|
||||
Assuming `lbrydroid` as the current working folder:
|
||||
* Copy `buildozer.spec.sample` to `buildozer.spec` in the `lbry-android` folder. Running `buildozer init` instead will create a new `buildozer.spec` file.
|
||||
* Update `buildozer.spec` settings to match your environment. Basic recommended settings are outlined below.
|
||||
<img src="https://spee.ch/@lbry:3f/android-08-homepage.gif" alt="LBRY Android GIF" width="384px" />
|
||||
|
||||
|
||||
| Setting | Description |
|
||||
|:------------------- |:-----------------------------|
|
||||
| title | application title |
|
||||
| package.name | package name (eg. lbrynet) |
|
||||
| package.domain | package domain (eg. io.lbry) |
|
||||
| source.dir | the location of the application main.py |
|
||||
| version | application version |
|
||||
| requirements | the module requirements for building the application |
|
||||
| services | list of Android background services and their corresponding Python entry points |
|
||||
| android.permissions | Android manifest permissions required by the application. This should be set to `INTERNET` at the very least to enable internet connectivity |
|
||||
| android.api | Android API version (21 and 24 have been tested to result in a successful build) |
|
||||
| android.sdk | Android SDK version (21 and 24 have been tested to result in a successful build) |
|
||||
| android.ndk | Android NDK version (13b has been tested to result in a successful build) |
|
||||
| android.ndk_path | Android NDK path. buildozer will automatically download this if not set |
|
||||
| android.sdk_path | Android SDK path. buildozer will automatically download this if not set |
|
||||
| p4a.source_dir | Path to the python-for-android repository folder. Currently set to the included `p4a` folder |
|
||||
| p4a.local_recipes | Path to a folder containing python_for_android recipes to be used in the build. The included `recipes` folder includes recipes for a successful build |
|
||||
## Installation
|
||||
The minimum supported Android version is 5.0 Lollipop. There are two ways to install:
|
||||
|
||||
#### Build and deploy the APK
|
||||
Run `buildozer android debug` to build a debug APK, or `buildozer android release` to build a release APK.
|
||||
1. Via the Google Play Store. Anyone can join the [open beta](https://play.google.com/apps/testing/io.lbry.browser) in order to install the app from the Play Store.
|
||||
1. Direct APK install available at [http://build.lbry.io/android/latest.apk](http://build.lbry.io/android/latest.apk). You will need to enable installation from third-party sources on your device in order to install from this source.
|
||||
|
||||
To deploy and run the APK on a connected Android device, you can run `buildozer android debug deploy run`.
|
||||
## Usage
|
||||
The app can be launched by opening **LBRY Browser** from the device's app drawer or via the shortcut on the home screen if that was created upon installation.
|
||||
|
||||
Run `buildozer android clean` to clean the package if you intend to rebuild.
|
||||
## Running from Source
|
||||
The app is built from source via [Buildozer](https://github.com/kivy/buildozer). After cloning the repository, copy `buildozer.spec.sample` to `buildozer.spec` and modify this file as necessary for your environment. Please see [BUILD.md](BUILD.md) for detailed build instructions.
|
||||
|
||||
## Contributing
|
||||
Contributions to this project are welcome, encouraged, and compensated. For more details, see https://lbry.io/faq/contributing
|
||||
|
||||
## License
|
||||
This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
||||
|
||||
## Security
|
||||
We take security seriously. Please contact security@lbry.com regarding any security issues. Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it.
|
||||
|
||||
## Contact
|
||||
The primary contact for this project is [@akinwale](https://github.com/akinwale) (akinwale@lbry.com)
|
||||
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
echoed=false
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "ubuntu/bionic64"
|
||||
#config.disksize.size = "20GB"
|
||||
|
||||
config.vm.provider "virtualbox" do |v|
|
||||
host = RbConfig::CONFIG['host_os']
|
||||
|
||||
# Give VM 1/4 system memory & access to all cpu cores on the host
|
||||
if host =~ /darwin/
|
||||
cpus = `sysctl -n hw.ncpu`.to_i
|
||||
# sysctl returns Bytes and we need to convert to MB
|
||||
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
|
||||
elsif host =~ /linux/
|
||||
cpus = `nproc`.to_i
|
||||
# meminfo shows KB and we need to convert to MB
|
||||
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
|
||||
else
|
||||
cpus = `wmic cpu get NumberOfCores`.split("\n")[2].to_i
|
||||
mem = `wmic OS get TotalVisibleMemorySize`.split("\n")[2].to_i / 1024 /4
|
||||
end
|
||||
|
||||
mem = mem / 1024 / 4
|
||||
mem = [mem, 2048].max # Minimum 2048
|
||||
|
||||
if echoed === false
|
||||
echoed=true
|
||||
puts("Memory", mem)
|
||||
puts("CPUs", cpus)
|
||||
end
|
||||
|
||||
#v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/home_vagrant_lbry-android", "1"]
|
||||
#v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
|
||||
v.customize ["modifyvm", :id, "--memory", mem]
|
||||
v.customize ["modifyvm", :id, "--cpus", cpus]
|
||||
end
|
||||
|
||||
config.vm.synced_folder "./", "/home/vagrant/lbry-android"
|
||||
|
||||
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
dpkg --add-architecture i386
|
||||
apt-get update
|
||||
apt-get install -y libssl-dev
|
||||
apt-get install -y python3.6 python3.6-dev python3-pip autoconf libffi-dev pkg-config libtool build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 python-pip
|
||||
pip install -f --upgrade setuptools pyopenssl
|
||||
git clone https://github.com/lbryio/buildozer.git
|
||||
cd buildozer
|
||||
python2.7 setup.py install
|
||||
cd ../
|
||||
rm -rf ./buildozer
|
||||
|
||||
# Install additonal buildozer dependencies
|
||||
sudo apt-get install cython
|
||||
|
||||
# Install node
|
||||
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
|
||||
export HOME=/home/vagrant
|
||||
|
||||
cp $HOME/lbry-android/buildozer.spec.vagrant $HOME/lbry-android/buildozer.spec
|
||||
|
||||
mkdir -p cd $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P $HOME/.buildozer/android/
|
||||
wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P $HOME/.buildozer/android/platform/
|
||||
tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C $HOME/.buildozer/android/
|
||||
rm $HOME/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
|
||||
ln -s $HOME/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 $HOME/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
cp -f $HOME/lbry-android/scripts/build-target-python.sh $HOME/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
rm -rf $HOME/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
tar -xf $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz -C $HOME/.buildozer/android/platform/
|
||||
rm $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz
|
||||
mv $HOME/.buildozer/android/platform/android-sdk-linux $HOME/.buildozer/android/platform/android-sdk-23
|
||||
unzip -qq $HOME/.buildozer/android/platform/android-23_r02.zip -d $HOME/.buildozer/android/platform/android-sdk-23/platforms
|
||||
rm $HOME/.buildozer/android/platform/platform-27_r01.zip
|
||||
mv $HOME/.buildozer/android/platform/android-sdk-23/platforms/android-8.1.0 $HOME/.buildozer/android/platform/android-sdk-23/platforms/android-27
|
||||
mkdir -p $HOME/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
unzip -qq $HOME/.buildozer/android/platform/build-tools_r26.0.1-linux.zip -d $HOME/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
rm $HOME/.buildozer/android/platform/build-tools_r26.0.1-linux.zip
|
||||
mv $HOME/.buildozer/android/platform/android-sdk-23/build-tools/android-8.0.0 $HOME/.buildozer/android/platform/android-sdk-23/build-tools/26.0.1
|
||||
mkdir -p $HOME/.buildozer/android/platform/android-sdk-23/licenses
|
||||
|
||||
rm -rf $HOME/.buildozer/android/platform/android-sdk-23/tools
|
||||
# https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
|
||||
wget -q https://dl.google.com/android/repository/tools_r25.2.5-linux.zip
|
||||
unzip -o -q ./tools_r25.2.5-linux.zip -d $HOME/.buildozer/android/platform/android-sdk-23/
|
||||
rm sdk-tools-linux-3859397.zip
|
||||
|
||||
echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > $HOME/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
|
||||
sudo chown -r vagrant $HOME
|
||||
|
||||
echo "Installing React Native via NPM..."
|
||||
sudo npm install -g react-native-cli
|
||||
SHELL
|
||||
end
|
||||
Submodule
+1
Submodule app added at a127e14a0f.
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
react-native bundle --platform android --dev false --entry-file src/index.js --bundle-output ../src/main/assets/index.android.bundle --assets-dest ../src/main/res/
|
||||
@@ -1,3 +0,0 @@
|
||||
import LBRYApp from './src/index';
|
||||
|
||||
export default LBRYApp;
|
||||
Generated
-10579
File diff suppressed because it is too large.
Load diff
@@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "LBRYApp",
|
||||
"version": "0.0.1",
|
||||
"private": "true",
|
||||
"scripts": {
|
||||
"start": "node node_modules/react-native/local-cli/cli.js start",
|
||||
"postinstall": "cp ./patch/ReactNativeRenderer-dev.js.patch ./node_modules/react-native/Libraries/Renderer/ReactNativeRenderer-dev.js; rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"lbry-redux": "lbryio/lbry-redux#common-components-refactor",
|
||||
"react": "16.2.0",
|
||||
"react-native": "0.52.0",
|
||||
"react-native-vector-icons": "^4.5.0",
|
||||
"react-native-video": "2.0.0",
|
||||
"react-navigation": "^1.0.3",
|
||||
"react-navigation-redux-helpers": "^1.0.1",
|
||||
"react-redux": "^5.0.3",
|
||||
"redux": "^3.6.0",
|
||||
"redux-logger": "3.0.6",
|
||||
"redux-persist": "^4.8.0",
|
||||
"redux-persist-transform-compress": "^4.2.0",
|
||||
"redux-persist-transform-filter": "0.0.10",
|
||||
"redux-thunk": "^2.2.0"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,108 +0,0 @@
|
||||
import React from 'react';
|
||||
import DiscoverPage from '../page/discover';
|
||||
import FilePage from '../page/file';
|
||||
import SettingsPage from '../page/settings';
|
||||
import SplashScreen from '../page/splash';
|
||||
import { addNavigationHelpers, DrawerNavigator, StackNavigator } from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
import { addListener } from '../utils/redux';
|
||||
import { AppState, BackHandler, NativeModules } from 'react-native';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import Feather from 'react-native-vector-icons/Feather';
|
||||
import discoverStyle from '../styles/discover';
|
||||
import { makeSelectClientSetting } from '../redux/selectors/settings';
|
||||
|
||||
const discoverStack = StackNavigator({
|
||||
Discover: {
|
||||
screen: DiscoverPage,
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
title: 'Discover',
|
||||
headerLeft: <Feather name="menu" size={24} style={discoverStyle.drawerHamburger} onPress={() => navigation.navigate('DrawerOpen')} />
|
||||
})
|
||||
},
|
||||
File: {
|
||||
screen: FilePage,
|
||||
navigationOptions: {
|
||||
header: null,
|
||||
drawerLockMode: 'locked-closed'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
headerMode: 'screen',
|
||||
});
|
||||
|
||||
const drawer = DrawerNavigator({
|
||||
Discover: { screen: discoverStack },
|
||||
Settings: {
|
||||
screen: SettingsPage,
|
||||
headerMode: 'screen'
|
||||
}
|
||||
}, {
|
||||
drawerWidth: 300,
|
||||
headerMode: 'none'
|
||||
});
|
||||
|
||||
export const AppNavigator = new StackNavigator({
|
||||
Splash: {
|
||||
screen: SplashScreen
|
||||
},
|
||||
Main: {
|
||||
screen: drawer
|
||||
}
|
||||
}, {
|
||||
headerMode: 'none'
|
||||
});
|
||||
|
||||
class AppWithNavigationState extends React.Component {
|
||||
componentWillMount() {
|
||||
AppState.addEventListener('change', this._handleAppStateChange);
|
||||
BackHandler.addEventListener('hardwareBackPress', function() {
|
||||
const { dispatch, navigation, nav } = this.props;
|
||||
if (nav.routes.length === 2 && nav.routes[1].routeName === 'Main') {
|
||||
if (nav.routes[1].routes[0].routes[0].index > 0) {
|
||||
dispatch({ type: 'Navigation/BACK' });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
AppState.removeEventListener('change', this._handleAppStateChange);
|
||||
BackHandler.removeEventListener('hardwareBackPress');
|
||||
}
|
||||
|
||||
_handleAppStateChange = (nextAppState) => {
|
||||
const { keepDaemonRunning } = this.props;
|
||||
if (AppState.currentState &&
|
||||
AppState.currentState.match(/inactive|background/) &&
|
||||
NativeModules.DaemonServiceControl) {
|
||||
if (!keepDaemonRunning) {
|
||||
// terminate the daemon background service when is suspended / inactive
|
||||
NativeModules.DaemonServiceControl.stopService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { dispatch, nav } = this.props;
|
||||
return (
|
||||
<AppNavigator
|
||||
navigation={addNavigationHelpers({
|
||||
dispatch,
|
||||
state: nav,
|
||||
addListener,
|
||||
})}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
nav: state.nav,
|
||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state)
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(AppWithNavigationState);
|
||||
@@ -1,7 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import FeaturedCategory from './view';
|
||||
|
||||
const select = state => ({});
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(select, perform)(FeaturedCategory);
|
||||
@@ -1,27 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Text, View } from 'react-native';
|
||||
import { normalizeURI } from 'lbry-redux';
|
||||
import FileItem from '../fileItem';
|
||||
import discoverStyle from '../../styles/discover';
|
||||
|
||||
class FeaturedCategory extends React.PureComponent {
|
||||
render() {
|
||||
const { category, names, categoryLink, navigation } = this.props;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Text style={discoverStyle.categoryName}>{category}</Text>
|
||||
{names &&
|
||||
names.map(name => (
|
||||
<FileItem
|
||||
style={discoverStyle.fileItem}
|
||||
key={name}
|
||||
uri={normalizeURI(name)}
|
||||
navigation={navigation} />
|
||||
))}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default FeaturedCategory;
|
||||
@@ -1,23 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectFileInfoForUri,
|
||||
makeSelectDownloadingForUri,
|
||||
makeSelectLoadingForUri,
|
||||
makeSelectCostInfoForUri
|
||||
} from 'lbry-redux';
|
||||
import { doPurchaseUri, doStartDownload } from '../../redux/actions/file';
|
||||
import FileDownloadButton from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
downloading: makeSelectDownloadingForUri(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
loading: makeSelectLoadingForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
purchaseUri: uri => dispatch(doPurchaseUri(uri)),
|
||||
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint))
|
||||
});
|
||||
|
||||
export default connect(select, perform)(FileDownloadButton);
|
||||
@@ -1,80 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Text, View, TouchableOpacity } from 'react-native';
|
||||
import fileDownloadButtonStyle from '../../styles/fileDownloadButton';
|
||||
|
||||
class FileDownloadButton extends React.PureComponent {
|
||||
componentWillReceiveProps(nextProps) {
|
||||
//this.checkAvailability(nextProps.uri);
|
||||
this.restartDownload(nextProps);
|
||||
}
|
||||
|
||||
restartDownload(props) {
|
||||
const { downloading, fileInfo, uri, restartDownload } = props;
|
||||
|
||||
if (
|
||||
!downloading &&
|
||||
fileInfo &&
|
||||
!fileInfo.completed &&
|
||||
fileInfo.written_bytes !== false &&
|
||||
fileInfo.written_bytes < fileInfo.total_bytes
|
||||
) {
|
||||
restartDownload(uri, fileInfo.outpoint);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
fileInfo,
|
||||
downloading,
|
||||
uri,
|
||||
purchaseUri,
|
||||
costInfo,
|
||||
loading,
|
||||
doPause,
|
||||
style,
|
||||
} = this.props;
|
||||
|
||||
const openFile = () => {
|
||||
//openInShell(fileInfo.download_path);
|
||||
//doPause();
|
||||
};
|
||||
|
||||
if (loading || downloading) {
|
||||
const progress =
|
||||
fileInfo && fileInfo.written_bytes ? fileInfo.written_bytes / fileInfo.total_bytes * 100 : 0,
|
||||
label = fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...';
|
||||
|
||||
return (
|
||||
<View style={[style, fileDownloadButtonStyle.container]}>
|
||||
<View style={{ width: `${progress}%`, backgroundColor: '#ff0000', position: 'absolute', left: 0, top: 0 }}></View>
|
||||
<Text style={fileDownloadButtonStyle.text}>{label}</Text>
|
||||
</View>
|
||||
);
|
||||
} else if (fileInfo === null && !downloading) {
|
||||
if (!costInfo) {
|
||||
return (
|
||||
<View style={[style, fileDownloadButtonStyle.container]}>
|
||||
<Text>Fetching cost info...</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<TouchableOpacity style={[style, fileDownloadButtonStyle.container]} onPress={() => {
|
||||
purchaseUri(uri);
|
||||
}}>
|
||||
<Text style={fileDownloadButtonStyle.text}>Download</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
} else if (fileInfo && fileInfo.download_path) {
|
||||
return (
|
||||
<TouchableOpacity style={[style, fileDownloadButtonStyle.container]} onPress={() => openFile()}>
|
||||
<Text style={fileDownloadButtonStyle.text}>Open</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export default FileDownloadButton;
|
||||
@@ -1,26 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doResolveUri,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectMetadataForUri,
|
||||
makeSelectFileInfoForUri,
|
||||
makeSelectIsUriResolving,
|
||||
selectRewardContentClaimIds
|
||||
} from 'lbry-redux';
|
||||
import { selectShowNsfw } from '../../redux/selectors/settings';
|
||||
import FileItem from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||
obscureNsfw: !selectShowNsfw(state)
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(FileItem);
|
||||
@@ -1,76 +0,0 @@
|
||||
import React from 'react';
|
||||
import { normalizeURI } from 'lbry-redux';
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
import { Text, View, TouchableOpacity } from 'react-native';
|
||||
import FileItemMedia from '../fileItemMedia';
|
||||
import FilePrice from '../filePrice';
|
||||
import NsfwOverlay from '../nsfwOverlay';
|
||||
import discoverStyle from '../../styles/discover';
|
||||
|
||||
class FileItem extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.resolve(this.props);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
this.resolve(nextProps);
|
||||
}
|
||||
|
||||
resolve(props) {
|
||||
const { isResolvingUri, resolveUri, claim, uri } = props;
|
||||
|
||||
if (!isResolvingUri && claim === undefined && uri) {
|
||||
resolveUri(uri);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
claim,
|
||||
fileInfo,
|
||||
metadata,
|
||||
isResolvingUri,
|
||||
rewardedContentClaimIds,
|
||||
style,
|
||||
navigation
|
||||
} = this.props;
|
||||
|
||||
const uri = normalizeURI(this.props.uri);
|
||||
const title = metadata && metadata.title ? metadata.title : uri;
|
||||
const thumbnail = metadata && metadata.thumbnail ? metadata.thumbnail : null;
|
||||
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
|
||||
const isRewardContent = claim && rewardedContentClaimIds.includes(claim.claim_id);
|
||||
const channelName = claim ? claim.channel_name : null;
|
||||
|
||||
let description = '';
|
||||
if (isResolvingUri && !claim) {
|
||||
description = 'Loading...';
|
||||
} else if (metadata && metadata.description) {
|
||||
description = metadata.description;
|
||||
} else if (claim === null) {
|
||||
description = 'This address contains no content.';
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={style}>
|
||||
<TouchableOpacity style={discoverStyle.container} onPress={() => {
|
||||
navigation.navigate('File', { uri: uri });
|
||||
}
|
||||
}>
|
||||
<FileItemMedia title={title} thumbnail={thumbnail} blurRadius={obscureNsfw ? 15 : 0} resizeMode="cover" />
|
||||
<FilePrice uri={uri} style={discoverStyle.filePriceContainer} textStyle={discoverStyle.filePriceText} />
|
||||
<Text style={discoverStyle.fileItemName}>{title}</Text>
|
||||
{channelName &&
|
||||
<Text style={discoverStyle.channelName}>{channelName}</Text>}
|
||||
</TouchableOpacity>
|
||||
{obscureNsfw && <NsfwOverlay onPress={() => navigation.navigate('Settings')} />}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default FileItem;
|
||||
@@ -1,7 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import FileItemMedia from './view';
|
||||
|
||||
const select = state => ({});
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(select, perform)(FileItemMedia);
|
||||
@@ -1,59 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Text, Image, View } from 'react-native';
|
||||
import fileItemMediaStyle from '../../styles/fileItemMedia';
|
||||
|
||||
class FileItemMedia extends React.PureComponent {
|
||||
static AUTO_THUMB_STYLES = [
|
||||
fileItemMediaStyle.autothumbPurple,
|
||||
fileItemMediaStyle.autothumbRed,
|
||||
fileItemMediaStyle.autothumbPink,
|
||||
fileItemMediaStyle.autothumbIndigo,
|
||||
fileItemMediaStyle.autothumbBlue,
|
||||
fileItemMediaStyle.autothumbLightBlue,
|
||||
fileItemMediaStyle.autothumbCyan,
|
||||
fileItemMediaStyle.autothumbTeal,
|
||||
fileItemMediaStyle.autothumbGreen,
|
||||
fileItemMediaStyle.autothumbYellow,
|
||||
fileItemMediaStyle.autothumbOrange,
|
||||
];
|
||||
|
||||
componentWillMount() {
|
||||
this.setState({
|
||||
autoThumbStyle:
|
||||
FileItemMedia.AUTO_THUMB_STYLES[
|
||||
Math.floor(Math.random() * FileItemMedia.AUTO_THUMB_STYLES.length)
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
let style = this.props.style;
|
||||
const { title, thumbnail, blurRadius, resizeMode } = this.props;
|
||||
const atStyle = this.state.autoThumbStyle;
|
||||
|
||||
if (thumbnail && ((typeof thumbnail) === 'string')) {
|
||||
if (style == null) {
|
||||
style = fileItemMediaStyle.thumbnail;
|
||||
}
|
||||
|
||||
return (
|
||||
<Image source={{uri: thumbnail}}
|
||||
blurRadius={blurRadius}
|
||||
resizeMode={resizeMode ? resizeMode : "cover"}
|
||||
style={style} />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={[fileItemMediaStyle.autothumb, atStyle]}>
|
||||
<Text style={fileItemMediaStyle.autothumbText}>{title &&
|
||||
title
|
||||
.replace(/\s+/g, '')
|
||||
.substring(0, Math.min(title.replace(' ', '').length, 5))
|
||||
.toUpperCase()}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default FileItemMedia;
|
||||
@@ -1,20 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doFetchCostInfoForUri,
|
||||
makeSelectCostInfoForUri,
|
||||
makeSelectFetchingCostInfoForUri,
|
||||
makeSelectClaimForUri
|
||||
} from 'lbry-redux';
|
||||
import FilePrice from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
fetching: makeSelectFetchingCostInfoForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(FilePrice);
|
||||
@@ -1,120 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Text, View } from 'react-native';
|
||||
import { formatCredits, formatFullPrice } from 'lbry-redux';
|
||||
|
||||
class CreditAmount extends React.PureComponent {
|
||||
static propTypes = {
|
||||
amount: PropTypes.number.isRequired,
|
||||
precision: PropTypes.number,
|
||||
isEstimate: PropTypes.bool,
|
||||
label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
||||
showFree: PropTypes.bool,
|
||||
showFullPrice: PropTypes.bool,
|
||||
showPlus: PropTypes.bool,
|
||||
look: PropTypes.oneOf(['indicator', 'plain', 'fee']),
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
precision: 2,
|
||||
label: true,
|
||||
showFree: false,
|
||||
look: 'indicator',
|
||||
showFullPrice: false,
|
||||
showPlus: false,
|
||||
};
|
||||
|
||||
render() {
|
||||
const minimumRenderableAmount = Math.pow(10, -1 * this.props.precision);
|
||||
const { amount, precision, showFullPrice, style } = this.props;
|
||||
|
||||
let formattedAmount;
|
||||
const fullPrice = formatFullPrice(amount, 2);
|
||||
|
||||
if (showFullPrice) {
|
||||
formattedAmount = fullPrice;
|
||||
} else {
|
||||
formattedAmount =
|
||||
amount > 0 && amount < minimumRenderableAmount
|
||||
? `<${minimumRenderableAmount}`
|
||||
: formatCredits(amount, precision);
|
||||
}
|
||||
|
||||
let amountText;
|
||||
if (this.props.showFree && parseFloat(this.props.amount) === 0) {
|
||||
amountText = 'FREE';
|
||||
} else {
|
||||
if (this.props.label) {
|
||||
const label =
|
||||
typeof this.props.label === 'string'
|
||||
? this.props.label
|
||||
: parseFloat(amount) == 1 ? 'credit' : 'credits';
|
||||
|
||||
amountText = `${formattedAmount} ${label}`;
|
||||
} else {
|
||||
amountText = formattedAmount;
|
||||
}
|
||||
if (this.props.showPlus && amount > 0) {
|
||||
amountText = `+${amountText}`;
|
||||
}
|
||||
}
|
||||
|
||||
/*{this.props.isEstimate ? (
|
||||
<span
|
||||
className="credit-amount__estimate"
|
||||
title={__('This is an estimate and does not include data fees')}
|
||||
>
|
||||
*
|
||||
</span>
|
||||
) : null}*/
|
||||
return (
|
||||
<Text style={style}>{amountText}</Text>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class FilePrice extends React.PureComponent {
|
||||
componentWillMount() {
|
||||
this.fetchCost(this.props);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
this.fetchCost(nextProps);
|
||||
}
|
||||
|
||||
fetchCost(props) {
|
||||
const { costInfo, fetchCostInfo, uri, fetching, claim } = props;
|
||||
|
||||
if (costInfo === undefined && !fetching && claim) {
|
||||
fetchCostInfo(uri);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { costInfo, look = 'indicator', showFullPrice = false, style, textStyle } = this.props;
|
||||
|
||||
const isEstimate = costInfo ? !costInfo.includesData : null;
|
||||
|
||||
if (!costInfo) {
|
||||
return (
|
||||
<View style={style}>
|
||||
<Text style={textStyle}>???</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={style}>
|
||||
<CreditAmount
|
||||
style={textStyle}
|
||||
label={false}
|
||||
amount={costInfo.cost}
|
||||
isEstimate={isEstimate}
|
||||
showFree
|
||||
showFullPrice={showFullPrice}>???</CreditAmount>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default FilePrice;
|
||||
@@ -1,7 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import MediaPlayer from './view';
|
||||
|
||||
const select = state => ({});
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(select, perform)(MediaPlayer);
|
||||
@@ -1,274 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { PanResponder, Text, View, ScrollView, TouchableOpacity } from 'react-native';
|
||||
import Video from 'react-native-video';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome';
|
||||
import FileItemMedia from '../fileItemMedia';
|
||||
import mediaPlayerStyle from '../../styles/mediaPlayer';
|
||||
|
||||
class MediaPlayer extends React.PureComponent {
|
||||
static ControlsTimeout = 3000;
|
||||
|
||||
seekResponder = null;
|
||||
|
||||
seekerWidth = 0;
|
||||
|
||||
video = null;
|
||||
|
||||
state = {
|
||||
rate: 1,
|
||||
volume: 1,
|
||||
muted: false,
|
||||
resizeMode: 'stretch',
|
||||
duration: 0.0,
|
||||
currentTime: 0.0,
|
||||
paused: true,
|
||||
fullscreenMode: false,
|
||||
areControlsVisible: true,
|
||||
controlsTimeout: -1,
|
||||
seekerOffset: 0,
|
||||
seekerPosition: 0,
|
||||
firstPlay: true
|
||||
};
|
||||
|
||||
formatTime(time) {
|
||||
let str = '';
|
||||
let minutes = 0, hours = 0, seconds = parseInt(time, 10);
|
||||
if (seconds > 60) {
|
||||
minutes = parseInt(seconds / 60, 10);
|
||||
seconds = seconds % 60;
|
||||
|
||||
if (minutes > 60) {
|
||||
hours = parseInt(minutes / 60, 10);
|
||||
minutes = minutes % 60;
|
||||
}
|
||||
|
||||
str = (hours > 0 ? this.pad(hours) + ':' : '') + this.pad(minutes) + ':' + this.pad(seconds);
|
||||
} else {
|
||||
str = '00:' + this.pad(seconds);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
pad(value) {
|
||||
if (value < 10) {
|
||||
return '0' + String(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
onLoad = (data) => {
|
||||
this.setState({
|
||||
duration: data.duration
|
||||
});
|
||||
if (this.props.onMediaLoaded) {
|
||||
this.props.onMediaLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
onProgress = (data) => {
|
||||
this.setState({ currentTime: data.currentTime });
|
||||
|
||||
if (!this.state.seeking) {
|
||||
this.setSeekerPosition(this.calculateSeekerPosition());
|
||||
}
|
||||
|
||||
if (this.state.firstPlay) {
|
||||
this.setState({ firstPlay: false });
|
||||
this.hidePlayerControls();
|
||||
}
|
||||
}
|
||||
|
||||
clearControlsTimeout = () => {
|
||||
if (this.state.controlsTimeout > -1) {
|
||||
clearTimeout(this.state.controlsTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
showPlayerControls = () => {
|
||||
this.clearControlsTimeout();
|
||||
if (!this.state.areControlsVisible) {
|
||||
this.setState({ areControlsVisible: true });
|
||||
}
|
||||
this.hidePlayerControls();
|
||||
}
|
||||
|
||||
hidePlayerControls() {
|
||||
const player = this;
|
||||
let timeout = setTimeout(() => {
|
||||
player.setState({ areControlsVisible: false });
|
||||
}, MediaPlayer.ControlsTimeout);
|
||||
player.setState({ controlsTimeout: timeout });
|
||||
}
|
||||
|
||||
togglePlay = () => {
|
||||
this.showPlayerControls();
|
||||
this.setState({ paused: !this.state.paused });
|
||||
}
|
||||
|
||||
toggleFullscreenMode = () => {
|
||||
this.showPlayerControls();
|
||||
const { onFullscreenToggled } = this.props;
|
||||
this.setState({ fullscreenMode: !this.state.fullscreenMode }, () => {
|
||||
this.setState({ resizeMode: this.state.fullscreenMode ? 'contain' : 'stretch' });
|
||||
if (onFullscreenToggled) {
|
||||
onFullscreenToggled(this.state.fullscreenMode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onEnd = () => {
|
||||
this.setState({ paused: true });
|
||||
this.video.seek(0);
|
||||
}
|
||||
|
||||
setSeekerPosition(position = 0) {
|
||||
position = this.checkSeekerPosition(position);
|
||||
this.setState({ seekerPosition: position });
|
||||
if (!this.state.seeking) {
|
||||
this.setState({ seekerOffset: position });
|
||||
}
|
||||
}
|
||||
|
||||
checkSeekerPosition(val = 0) {
|
||||
if (val < 0) {
|
||||
val = 0;
|
||||
} else if (val >= this.seekerWidth) {
|
||||
return this.seekerWidth;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
seekTo(time = 0) {
|
||||
if (time > this.state.duration) {
|
||||
return;
|
||||
}
|
||||
this.video.seek(time);
|
||||
this.setState({ currentTime: time });
|
||||
}
|
||||
|
||||
initSeeker() {
|
||||
this.seekResponder = PanResponder.create({
|
||||
onStartShouldSetPanResponder: (evt, gestureState) => true,
|
||||
onMoveShouldSetPanResponder: (evt, gestureState) => true,
|
||||
|
||||
onPanResponderGrant: (evt, gestureState) => {
|
||||
this.clearControlsTimeout();
|
||||
this.setState({ seeking: true });
|
||||
},
|
||||
|
||||
onPanResponderMove: (evt, gestureState) => {
|
||||
const position = this.state.seekerOffset + gestureState.dx;
|
||||
this.setSeekerPosition(position);
|
||||
},
|
||||
|
||||
onPanResponderRelease: (evt, gestureState) => {
|
||||
const time = this.getCurrentTimeForSeekerPosition();
|
||||
if (time >= this.state.duration) {
|
||||
this.setState({ paused: true });
|
||||
this.onEnd();
|
||||
} else {
|
||||
this.seekTo(time);
|
||||
this.setState({ seeking: false });
|
||||
}
|
||||
this.hidePlayerControls();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getCurrentTimeForSeekerPosition() {
|
||||
return this.state.duration * (this.state.seekerPosition / this.seekerWidth);
|
||||
}
|
||||
|
||||
calculateSeekerPosition() {
|
||||
return this.seekerWidth * this.getCurrentTimePercentage();
|
||||
}
|
||||
|
||||
getCurrentTimePercentage() {
|
||||
if (this.state.currentTime > 0) {
|
||||
return parseFloat(this.state.currentTime) / parseFloat(this.state.duration);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
this.initSeeker();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.clearControlsTimeout();
|
||||
this.setState({ paused: true, fullscreenMode: false });
|
||||
const { onFullscreenToggled } = this.props;
|
||||
if (onFullscreenToggled) {
|
||||
onFullscreenToggled(false);
|
||||
}
|
||||
}
|
||||
|
||||
renderPlayerControls() {
|
||||
if (this.state.areControlsVisible) {
|
||||
return (
|
||||
<View style={mediaPlayerStyle.playerControlsContainer}>
|
||||
<TouchableOpacity style={mediaPlayerStyle.playPauseButton}
|
||||
onPress={this.togglePlay}>
|
||||
{this.state.paused && <Icon name="play" size={32} color="#ffffff" />}
|
||||
{!this.state.paused && <Icon name="pause" size={32} color="#ffffff" />}
|
||||
</TouchableOpacity>
|
||||
|
||||
<TouchableOpacity style={mediaPlayerStyle.toggleFullscreenButton} onPress={this.toggleFullscreenMode}>
|
||||
{this.state.fullscreenMode && <Icon name="compress" size={16} color="#ffffff" />}
|
||||
{!this.state.fullscreenMode && <Icon name="expand" size={16} color="#ffffff" />}
|
||||
</TouchableOpacity>
|
||||
|
||||
<Text style={mediaPlayerStyle.elapsedDuration}>{this.formatTime(this.state.currentTime)}</Text>
|
||||
<Text style={mediaPlayerStyle.totalDuration}>{this.formatTime(this.state.duration)}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fileInfo, title, thumbnail, style, fullScreenStyle } = this.props;
|
||||
const flexCompleted = this.getCurrentTimePercentage() * 100;
|
||||
const flexRemaining = (1 - this.getCurrentTimePercentage()) * 100;
|
||||
|
||||
return (
|
||||
<View style={[style, mediaPlayerStyle.container]}>
|
||||
<Video source={{ uri: 'file:///' + fileInfo.download_path }}
|
||||
ref={(ref: Video) => { this.video = ref }}
|
||||
resizeMode={this.state.resizeMode}
|
||||
playInBackground={true}
|
||||
style={mediaPlayerStyle.player}
|
||||
rate={this.state.rate}
|
||||
volume={this.state.volume}
|
||||
paused={this.state.paused}
|
||||
onLoad={this.onLoad}
|
||||
onProgress={this.onProgress}
|
||||
onEnd={this.onEnd}
|
||||
/>
|
||||
|
||||
<TouchableOpacity style={mediaPlayerStyle.playerControls} onPress={this.showPlayerControls}>
|
||||
{this.renderPlayerControls()}
|
||||
</TouchableOpacity>
|
||||
|
||||
<View style={mediaPlayerStyle.trackingControls}>
|
||||
<View style={mediaPlayerStyle.progress} onLayout={(evt) => this.seekerWidth = evt.nativeEvent.layout.width}>
|
||||
<View style={[mediaPlayerStyle.innerProgressCompleted, { flex: flexCompleted }]} />
|
||||
<View style={[mediaPlayerStyle.innerProgressRemaining, { flex: flexRemaining }]} />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{this.state.areControlsVisible &&
|
||||
<View style={[mediaPlayerStyle.seekerHandle, { left: this.state.seekerPosition }]} { ...this.seekResponder.panHandlers }>
|
||||
<View style={this.state.seeking ? mediaPlayerStyle.bigSeekerCircle : mediaPlayerStyle.seekerCircle} />
|
||||
</View>}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default MediaPlayer;
|
||||
@@ -1,6 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import NsfwOverlay from './view';
|
||||
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(null, perform)(NsfwOverlay);
|
||||
@@ -1,15 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Text, TouchableOpacity } from 'react-native';
|
||||
import discoverStyle from '../../styles/discover';
|
||||
|
||||
class NsfwOverlay extends React.PureComponent {
|
||||
render() {
|
||||
return (
|
||||
<TouchableOpacity style={discoverStyle.overlay} activeOpacity={0.95} onPress={this.props.onPress}>
|
||||
<Text style={discoverStyle.overlayText}>This content is Not Safe For Work. To view adult content, please change your Settings.</Text>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default NsfwOverlay;
|
||||
@@ -1,119 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Provider, connect } from 'react-redux';
|
||||
import DiscoverPage from './page/discover';
|
||||
import { AppRegistry, AppState, StyleSheet, Text, View, AsyncStorage, NativeModules } from 'react-native';
|
||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
||||
import {
|
||||
StackNavigator, addNavigationHelpers
|
||||
} from 'react-navigation';
|
||||
import { AppNavigator } from './component/AppNavigator';
|
||||
import AppWithNavigationState from './component/AppNavigator';
|
||||
import { persistStore, autoRehydrate } from 'redux-persist';
|
||||
import createCompressor from 'redux-persist-transform-compress';
|
||||
import createFilter from 'redux-persist-transform-filter';
|
||||
import thunk from 'redux-thunk';
|
||||
import {
|
||||
Lbry,
|
||||
claimsReducer,
|
||||
costInfoReducer,
|
||||
fileInfoReducer,
|
||||
searchReducer,
|
||||
walletReducer
|
||||
} from 'lbry-redux';
|
||||
import settingsReducer from './redux/reducers/settings';
|
||||
import { reactNavigationMiddleware } from './utils/redux';
|
||||
|
||||
function isFunction(object) {
|
||||
return typeof object === 'function';
|
||||
}
|
||||
|
||||
function isNotFunction(object) {
|
||||
return !isFunction(object);
|
||||
}
|
||||
|
||||
function createBulkThunkMiddleware() {
|
||||
return ({ dispatch, getState }) => next => action => {
|
||||
if (action.type === 'BATCH_ACTIONS') {
|
||||
action.actions.filter(isFunction).map(actionFn => actionFn(dispatch, getState));
|
||||
}
|
||||
return next(action);
|
||||
};
|
||||
}
|
||||
|
||||
function enableBatching(reducer) {
|
||||
return function batchingReducer(state, action) {
|
||||
switch (action.type) {
|
||||
case 'BATCH_ACTIONS':
|
||||
return action.actions.filter(isNotFunction).reduce(batchingReducer, state);
|
||||
default:
|
||||
return reducer(state, action);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const router = AppNavigator.router;
|
||||
const navAction = router.getActionForPathAndParams('Splash');
|
||||
const initialNavState = router.getStateForAction(navAction);
|
||||
const navigatorReducer = (state = initialNavState, action) => {
|
||||
const nextState = AppNavigator.router.getStateForAction(action, state);
|
||||
return nextState || state;
|
||||
};
|
||||
|
||||
const reducers = combineReducers({
|
||||
claims: claimsReducer,
|
||||
costInfo: costInfoReducer,
|
||||
fileInfo: fileInfoReducer,
|
||||
search: searchReducer,
|
||||
wallet: walletReducer,
|
||||
nav: navigatorReducer,
|
||||
settings: settingsReducer
|
||||
});
|
||||
|
||||
const bulkThunk = createBulkThunkMiddleware();
|
||||
const middleware = [thunk, bulkThunk, reactNavigationMiddleware];
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
const composeEnhancers = compose;
|
||||
|
||||
const store = createStore(
|
||||
enableBatching(reducers),
|
||||
{}, // initial state,
|
||||
composeEnhancers(
|
||||
autoRehydrate(),
|
||||
applyMiddleware(...middleware)
|
||||
)
|
||||
);
|
||||
|
||||
const compressor = createCompressor();
|
||||
const saveClaimsFilter = createFilter('claims', ['byId', 'claimsByUri']);
|
||||
const subscriptionsFilter = createFilter('subscriptions', ['subscriptions']);
|
||||
const settingsFilter = createFilter('settings', ['clientSettings']);
|
||||
|
||||
const persistOptions = {
|
||||
whitelist: ['claims', 'subscriptions', 'settings'],
|
||||
// Order is important. Needs to be compressed last or other transforms can't
|
||||
// read the data
|
||||
transforms: [saveClaimsFilter, subscriptionsFilter, settingsFilter, compressor],
|
||||
debounce: 10000,
|
||||
storage: AsyncStorage
|
||||
};
|
||||
|
||||
persistStore(store, persistOptions, err => {
|
||||
if (err) {
|
||||
console.log('Unable to load saved SETTINGS');
|
||||
}
|
||||
});
|
||||
|
||||
class LBRYApp extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<AppWithNavigationState />
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
AppRegistry.registerComponent('LBRYApp', () => LBRYApp);
|
||||
|
||||
export default LBRYApp;
|
||||
@@ -1,14 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doFetchFeaturedUris, selectFeaturedUris, selectFetchingFeaturedUris } from 'lbry-redux';
|
||||
import DiscoverPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
featuredUris: selectFeaturedUris(state),
|
||||
fetchingFeaturedUris: selectFetchingFeaturedUris(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchFeaturedUris: () => dispatch(doFetchFeaturedUris()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(DiscoverPage);
|
||||
@@ -1,44 +0,0 @@
|
||||
import React from 'react';
|
||||
import FeaturedCategory from '../../component/featuredCategory';
|
||||
import NavigationActions from 'react-navigation';
|
||||
import { Text, View, ScrollView } from 'react-native';
|
||||
import discoverStyle from '../../styles/discover';
|
||||
import Feather from 'react-native-vector-icons/Feather';
|
||||
|
||||
class DiscoverPage extends React.PureComponent {
|
||||
componentWillMount() {
|
||||
this.props.fetchFeaturedUris();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { featuredUris, fetchingFeaturedUris } = this.props;
|
||||
const hasContent = typeof featuredUris === 'object' && Object.keys(featuredUris).length,
|
||||
failedToLoad = !fetchingFeaturedUris && !hasContent;
|
||||
|
||||
return (
|
||||
<View style={discoverStyle.container}>
|
||||
{!hasContent && fetchingFeaturedUris && <Text style={discoverStyle.title}>Fetching content...</Text>}
|
||||
{hasContent &&
|
||||
<ScrollView style={discoverStyle.scrollContainer}>
|
||||
{hasContent &&
|
||||
Object.keys(featuredUris).map(
|
||||
category =>
|
||||
featuredUris[category].length ? (
|
||||
<FeaturedCategory
|
||||
key={category}
|
||||
category={category}
|
||||
names={featuredUris[category]}
|
||||
navigation={this.props.navigation}
|
||||
/>
|
||||
) : (
|
||||
''
|
||||
)
|
||||
)}
|
||||
</ScrollView>
|
||||
}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default DiscoverPage;
|
||||
@@ -1,38 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doFetchFileInfo,
|
||||
makeSelectFileInfoForUri,
|
||||
doFetchCostInfoForUri,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectContentTypeForUri,
|
||||
makeSelectMetadataForUri,
|
||||
selectRewardContentClaimIds,
|
||||
makeSelectCostInfoForUri
|
||||
} from 'lbry-redux';
|
||||
import { doDeleteFile, doStopDownloadingFile } from '../../redux/actions/file';
|
||||
import FilePage from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const selectProps = { uri: props.navigation.state.params.uri };
|
||||
return {
|
||||
claim: makeSelectClaimForUri(selectProps.uri)(state),
|
||||
contentType: makeSelectContentTypeForUri(selectProps.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(selectProps.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(selectProps.uri)(state),
|
||||
//obscureNsfw: !selectShowNsfw(state),
|
||||
//tab: makeSelectCurrentParam('tab')(state),
|
||||
fileInfo: makeSelectFileInfoForUri(selectProps.uri)(state),
|
||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, selectProps),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
|
||||
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
|
||||
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(select, perform)(FilePage);
|
||||
@@ -1,159 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
Button,
|
||||
Text,
|
||||
View,
|
||||
ScrollView,
|
||||
StatusBar,
|
||||
TouchableOpacity,
|
||||
NativeModules
|
||||
} from 'react-native';
|
||||
import FileItemMedia from '../../component/fileItemMedia';
|
||||
import FileDownloadButton from '../../component/fileDownloadButton';
|
||||
import MediaPlayer from '../../component/mediaPlayer';
|
||||
import Video from 'react-native-video';
|
||||
import filePageStyle from '../../styles/filePage';
|
||||
|
||||
class FilePage extends React.PureComponent {
|
||||
state = {
|
||||
mediaLoaded: false,
|
||||
fullscreenMode: false
|
||||
};
|
||||
|
||||
static navigationOptions = {
|
||||
title: ''
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
StatusBar.setHidden(false);
|
||||
this.fetchFileInfo(this.props);
|
||||
this.fetchCostInfo(this.props);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
this.fetchFileInfo(nextProps);
|
||||
}
|
||||
|
||||
fetchFileInfo(props) {
|
||||
if (props.fileInfo === undefined) {
|
||||
props.fetchFileInfo(props.navigation.state.params.uri);
|
||||
}
|
||||
}
|
||||
|
||||
fetchCostInfo(props) {
|
||||
if (props.costInfo === undefined) {
|
||||
props.fetchCostInfo(props.navigation.state.params.uri);
|
||||
}
|
||||
}
|
||||
|
||||
handleFullscreenToggle = (mode) => {
|
||||
this.setState({ fullscreenMode: mode });
|
||||
StatusBar.setHidden(mode);
|
||||
if (NativeModules.ScreenOrientation) {
|
||||
if (mode) {
|
||||
// fullscreen, so change orientation to landscape mode
|
||||
NativeModules.ScreenOrientation.lockOrientationLandscape();
|
||||
} else {
|
||||
NativeModules.ScreenOrientation.unlockOrientation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onDeletePressed = () => {
|
||||
const { deleteFile, fileInfo } = this.props;
|
||||
|
||||
Alert.alert(
|
||||
'Delete file',
|
||||
'Are you sure you want to remove this file from your device?',
|
||||
[
|
||||
{ text: 'No' },
|
||||
{ text: 'Yes', onPress: () => { deleteFile(fileInfo.outpoint, true); } }
|
||||
],
|
||||
{ cancelable: true }
|
||||
);
|
||||
}
|
||||
|
||||
onStopDownloadPressed = () => {
|
||||
const { deleteFile, stopDownload, fileInfo, navigation } = this.props;
|
||||
|
||||
Alert.alert(
|
||||
'Stop download',
|
||||
'Are you sure you want to stop downloading this file?',
|
||||
[
|
||||
{ text: 'No' },
|
||||
{ text: 'Yes', onPress: () => { stopDownload(navigation.state.params.uri, fileInfo); } }
|
||||
],
|
||||
{ cancelable: true }
|
||||
);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
StatusBar.setHidden(false);
|
||||
if (NativeModules.ScreenOrientation) {
|
||||
NativeModules.ScreenOrientation.unlockOrientation();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
claim,
|
||||
fileInfo,
|
||||
metadata,
|
||||
contentType,
|
||||
tab,
|
||||
rewardedContentClaimIds,
|
||||
navigation
|
||||
} = this.props;
|
||||
|
||||
if (!claim || !metadata) {
|
||||
return (
|
||||
<View style={filePageStyle.container}>
|
||||
<Text style={filePageStyle.emptyClaimText}>Empty claim or metadata info.</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const completed = fileInfo && fileInfo.completed;
|
||||
const title = metadata.title;
|
||||
const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
|
||||
const description = metadata.description ? metadata.description : null;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const { height, channel_name: channelName, value } = claim;
|
||||
const showActions = (completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes));
|
||||
const channelClaimId =
|
||||
value && value.publisherSignature && value.publisherSignature.certificateId;
|
||||
|
||||
return (
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
<View style={this.state.fullscreenMode ? filePageStyle.fullscreenMedia : filePageStyle.mediaContainer}>
|
||||
{(!fileInfo || (isPlayable && !this.state.mediaLoaded)) &&
|
||||
<FileItemMedia style={filePageStyle.thumbnail} title={title} thumbnail={metadata.thumbnail} />}
|
||||
{isPlayable && !this.state.mediaLoaded && <ActivityIndicator size="large" color="#40b89a" style={filePageStyle.loading} />}
|
||||
{!completed && <FileDownloadButton uri={navigation.state.params.uri} style={filePageStyle.downloadButton} />}
|
||||
{fileInfo && isPlayable && <MediaPlayer fileInfo={fileInfo}
|
||||
style={filePageStyle.player}
|
||||
onFullscreenToggled={this.handleFullscreenToggle}
|
||||
onMediaLoaded={() => { this.setState({ mediaLoaded: true }); }}/>}
|
||||
</View>
|
||||
{ showActions &&
|
||||
<View style={filePageStyle.actions}>
|
||||
{completed && <Button color="red" title="Delete" onPress={this.onDeletePressed} />}
|
||||
{!completed && fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes &&
|
||||
<Button color="red" title="Stop Download" onPress={this.onStopDownloadPressed} />
|
||||
}
|
||||
</View>}
|
||||
<ScrollView style={showActions ? filePageStyle.scrollContainerActions : filePageStyle.scrollContainer}>
|
||||
<Text style={filePageStyle.title}>{title}</Text>
|
||||
{channelName && <Text style={filePageStyle.channelName}>{channelName}</Text>}
|
||||
{description && <Text style={filePageStyle.description}>{description}</Text>}
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default FilePage;
|
||||
@@ -1,16 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { doSetClientSetting } from '../../redux/actions/settings';
|
||||
import { makeSelectClientSetting } from '../../redux/selectors/settings';
|
||||
import SettingsPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingsPage);
|
||||
@@ -1,46 +0,0 @@
|
||||
import React from 'react';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { Text, View, ScrollView, Switch } from 'react-native';
|
||||
import settingsStyle from '../../styles/settings';
|
||||
|
||||
class SettingsPage extends React.PureComponent {
|
||||
static navigationOptions = {
|
||||
title: 'Settings'
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
keepDaemonRunning,
|
||||
showNsfw,
|
||||
setClientSetting
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Text style={settingsStyle.title}>Settings</Text>
|
||||
<ScrollView style={settingsStyle.scrollContainer}>
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>Show NSFW content</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch value={showNsfw} onValueChange={(value) => setClientSetting(SETTINGS.SHOW_NSFW, value)} />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>Keep the daemon background service running when the app is suspended.</Text>
|
||||
<Text style={settingsStyle.description}>Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch value={keepDaemonRunning} onValueChange={(value) => setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value)} />
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SettingsPage;
|
||||
@@ -1,7 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import SplashScreen from './view';
|
||||
|
||||
const select = state => ({});
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(select, perform)(SplashScreen);
|
||||
@@ -1,97 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { View, Text } from 'react-native';
|
||||
import PropTypes from 'prop-types';
|
||||
import splashStyle from '../../styles/splash';
|
||||
|
||||
class SplashScreen extends React.PureComponent {
|
||||
static navigationOptions = {
|
||||
title: 'Splash'
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
this.setState({
|
||||
details: 'Starting daemon',
|
||||
message: 'Connecting',
|
||||
isRunning: false,
|
||||
isLagging: false,
|
||||
});
|
||||
}
|
||||
|
||||
updateStatus() {
|
||||
Lbry.status().then(status => {
|
||||
this._updateStatusCallback(status);
|
||||
});
|
||||
}
|
||||
|
||||
_updateStatusCallback(status) {
|
||||
const startupStatus = status.startup_status;
|
||||
if (startupStatus.code == 'started') {
|
||||
// Wait until we are able to resolve a name before declaring
|
||||
// that we are done.
|
||||
// TODO: This is a hack, and the logic should live in the daemon
|
||||
// to give us a better sense of when we are actually started
|
||||
this.setState({
|
||||
message: 'Testing Network',
|
||||
details: 'Waiting for name resolution',
|
||||
isLagging: false,
|
||||
isRunning: true,
|
||||
});
|
||||
|
||||
Lbry.resolve({ uri: 'lbry://one' }).then(() => {
|
||||
// Leave the splash screen
|
||||
const { navigation } = this.props;
|
||||
navigation.navigate('Main');
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (status.blockchain_status && status.blockchain_status.blocks_behind > 0) {
|
||||
const behind = status.blockchain_status.blocks_behind;
|
||||
const behindText = behind + ' block' + (behind == 1 ? '' : 's') + ' behind';
|
||||
this.setState({
|
||||
message: 'Blockchain Sync',
|
||||
details: behindText,
|
||||
isLagging: startupStatus.is_lagging,
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
message: 'Network Loading',
|
||||
details: startupStatus.message + (startupStatus.is_lagging ? '' : '...'),
|
||||
isLagging: startupStatus.is_lagging,
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.updateStatus();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
Lbry
|
||||
.connect()
|
||||
.then(() => {
|
||||
this.updateStatus();
|
||||
})
|
||||
.catch((e) => {
|
||||
this.setState({
|
||||
isLagging: true,
|
||||
message: 'Connection Failure',
|
||||
details:
|
||||
'We could not establish a connection to the daemon. Your data connection may be preventing LBRY from connecting. Contact hello@lbry.io if you think this is a software bug.'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { message, details, isLagging, isRunning } = this.state;
|
||||
|
||||
return (
|
||||
<View style={splashStyle.container}>
|
||||
<Text style={splashStyle.title}>Lbry.</Text>
|
||||
<Text style={splashStyle.message}>{message}</Text>
|
||||
<Text style={splashStyle.details}>{details}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SplashScreen;
|
||||
@@ -1,279 +0,0 @@
|
||||
import {
|
||||
ACTIONS,
|
||||
Lbry,
|
||||
makeSelectCostInfoForUri,
|
||||
makeSelectFileInfoForUri,
|
||||
selectTotalDownloadProgress,
|
||||
selectDownloadingByOutpoint,
|
||||
} from 'lbry-redux';
|
||||
import { NativeModules } from 'react-native';
|
||||
|
||||
const DOWNLOAD_POLL_INTERVAL = 250;
|
||||
|
||||
export function doUpdateLoadStatus(uri, outpoint) {
|
||||
return (dispatch, getState) => {
|
||||
Lbry.file_list({
|
||||
outpoint,
|
||||
full_status: true,
|
||||
}).then(([fileInfo]) => {
|
||||
if (!fileInfo || fileInfo.written_bytes === 0) {
|
||||
// download hasn't started yet
|
||||
setTimeout(() => {
|
||||
dispatch(doUpdateLoadStatus(uri, outpoint));
|
||||
}, DOWNLOAD_POLL_INTERVAL);
|
||||
} else if (fileInfo.completed) {
|
||||
// TODO this isn't going to get called if they reload the client before
|
||||
// the download finished
|
||||
const { total_bytes: totalBytes, written_bytes: writtenBytes } = fileInfo;
|
||||
dispatch({
|
||||
type: ACTIONS.DOWNLOADING_COMPLETED,
|
||||
data: {
|
||||
uri,
|
||||
outpoint,
|
||||
fileInfo,
|
||||
},
|
||||
});
|
||||
|
||||
NativeModules.LbryDownloadManager.updateDownload(uri, fileInfo.file_name, 100, writtenBytes, totalBytes);
|
||||
|
||||
/*const notif = new window.Notification('LBRY Download Complete', {
|
||||
body: fileInfo.metadata.stream.metadata.title,
|
||||
silent: false,
|
||||
});
|
||||
notif.onclick = () => {
|
||||
ipcRenderer.send('focusWindow', 'main');
|
||||
};*/
|
||||
} else {
|
||||
// ready to play
|
||||
const { total_bytes: totalBytes, written_bytes: writtenBytes } = fileInfo;
|
||||
const progress = writtenBytes / totalBytes * 100;
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.DOWNLOADING_PROGRESSED,
|
||||
data: {
|
||||
uri,
|
||||
outpoint,
|
||||
fileInfo,
|
||||
progress,
|
||||
},
|
||||
});
|
||||
|
||||
NativeModules.LbryDownloadManager.updateDownload(uri, fileInfo.file_name, progress, writtenBytes, totalBytes);
|
||||
|
||||
setTimeout(() => {
|
||||
dispatch(doUpdateLoadStatus(uri, outpoint));
|
||||
}, DOWNLOAD_POLL_INTERVAL);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doStartDownload(uri, outpoint) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
|
||||
if (!outpoint) {
|
||||
throw new Error('outpoint is required to begin a download');
|
||||
}
|
||||
|
||||
const { downloadingByOutpoint = {} } = state.fileInfo;
|
||||
|
||||
if (downloadingByOutpoint[outpoint]) return;
|
||||
|
||||
Lbry.file_list({ outpoint, full_status: true }).then(([fileInfo]) => {
|
||||
dispatch({
|
||||
type: ACTIONS.DOWNLOADING_STARTED,
|
||||
data: {
|
||||
uri,
|
||||
outpoint,
|
||||
fileInfo,
|
||||
},
|
||||
});
|
||||
|
||||
NativeModules.LbryDownloadManager.startDownload(uri, fileInfo.file_name);
|
||||
|
||||
dispatch(doUpdateLoadStatus(uri, outpoint));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doStopDownloadingFile(uri, fileInfo) {
|
||||
return dispatch => {
|
||||
let params = { status: 'stop' };
|
||||
if (fileInfo.sd_hash) {
|
||||
params.sd_hash = fileInfo.sd_hash;
|
||||
}
|
||||
if (fileInfo.stream_hash) {
|
||||
params.stream_hash = fileInfo.stream_hash;
|
||||
}
|
||||
|
||||
Lbry.file_set_status(params).then(() => {
|
||||
dispatch({
|
||||
type: ACTIONS.DOWNLOADING_CANCELED,
|
||||
data: {}
|
||||
});
|
||||
});
|
||||
|
||||
NativeModules.LbryDownloadManager.stopDownload(uri, fileInfo.file_name);
|
||||
|
||||
// Should also delete the file after the user stops downloading
|
||||
dispatch(doDeleteFile(fileInfo.outpoint, uri));
|
||||
};
|
||||
}
|
||||
|
||||
export function doDownloadFile(uri, streamInfo) {
|
||||
return dispatch => {
|
||||
dispatch(doStartDownload(uri, streamInfo.outpoint));
|
||||
|
||||
//analytics.apiLog(uri, streamInfo.output, streamInfo.claim_id);
|
||||
|
||||
//dispatch(doClaimEligiblePurchaseRewards());
|
||||
};
|
||||
}
|
||||
|
||||
export function doSetPlayingUri(uri) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.SET_PLAYING_URI,
|
||||
data: { uri },
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doLoadVideo(uri) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.LOADING_VIDEO_STARTED,
|
||||
data: {
|
||||
uri,
|
||||
},
|
||||
});
|
||||
|
||||
Lbry.get({ uri })
|
||||
.then(streamInfo => {
|
||||
const timeout =
|
||||
streamInfo === null || typeof streamInfo !== 'object' || streamInfo.error === 'Timeout';
|
||||
|
||||
if (timeout) {
|
||||
dispatch(doSetPlayingUri(null));
|
||||
dispatch({
|
||||
type: ACTIONS.LOADING_VIDEO_FAILED,
|
||||
data: { uri },
|
||||
});
|
||||
|
||||
console.log(`File timeout for uri ${uri}`);
|
||||
//dispatch(doOpenModal(MODALS.FILE_TIMEOUT, { uri }));
|
||||
} else {
|
||||
dispatch(doDownloadFile(uri, streamInfo));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
dispatch(doSetPlayingUri(null));
|
||||
dispatch({
|
||||
type: ACTIONS.LOADING_VIDEO_FAILED,
|
||||
data: { uri },
|
||||
});
|
||||
|
||||
console.log(`Failed to download ${uri}`);
|
||||
/*dispatch(
|
||||
doAlertError(
|
||||
`Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.`
|
||||
)
|
||||
);*/
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doPurchaseUri(uri, specificCostInfo) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const balance = 0;//selectBalance(state);
|
||||
const fileInfo = makeSelectFileInfoForUri(uri)(state);
|
||||
const downloadingByOutpoint = selectDownloadingByOutpoint(state);
|
||||
const alreadyDownloading = fileInfo && !!downloadingByOutpoint[fileInfo.outpoint];
|
||||
|
||||
function attemptPlay(cost, instantPurchaseMax = null) {
|
||||
if (cost > 0 && (!instantPurchaseMax || cost > instantPurchaseMax)) {
|
||||
//dispatch(doOpenModal(MODALS.AFFIRM_PURCHASE, { uri }));
|
||||
console.log('Affirm purchase...');
|
||||
} else {
|
||||
dispatch(doLoadVideo(uri));
|
||||
}
|
||||
}
|
||||
|
||||
// we already fully downloaded the file.
|
||||
if (fileInfo && fileInfo.completed) {
|
||||
// If written_bytes is false that means the user has deleted/moved the
|
||||
// file manually on their file system, so we need to dispatch a
|
||||
// doLoadVideo action to reconstruct the file from the blobs
|
||||
if (!fileInfo.written_bytes) dispatch(doLoadVideo(uri));
|
||||
|
||||
Promise.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
// we are already downloading the file
|
||||
if (alreadyDownloading) {
|
||||
Promise.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
const costInfo = makeSelectCostInfoForUri(uri)(state) || specificCostInfo;
|
||||
const { cost } = costInfo;
|
||||
|
||||
if (cost > balance) {
|
||||
dispatch(doSetPlayingUri(null));
|
||||
//dispatch(doOpenModal(MODALS.INSUFFICIENT_CREDITS));
|
||||
Promise.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
if (cost === 0/* || !makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state)*/) {
|
||||
attemptPlay(cost);
|
||||
}
|
||||
/*} else {
|
||||
const instantPurchaseMax = makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state);
|
||||
if (instantPurchaseMax.currency === 'LBC') {
|
||||
attemptPlay(cost, instantPurchaseMax.amount);
|
||||
} else {
|
||||
// Need to convert currency of instant purchase maximum before trying to play
|
||||
Lbryio.getExchangeRates().then(({ LBC_USD }) => {
|
||||
attemptPlay(cost, instantPurchaseMax.amount / LBC_USD);
|
||||
});
|
||||
}
|
||||
}*/
|
||||
};
|
||||
}
|
||||
|
||||
export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
|
||||
return (dispatch, getState) => {
|
||||
Lbry.file_delete({
|
||||
outpoint,
|
||||
delete_from_download_dir: deleteFromComputer,
|
||||
});
|
||||
|
||||
// If the file is for a claim we published then also abandon the claim
|
||||
/*const myClaimsOutpoints = selectMyClaimsOutpoints(state);
|
||||
if (abandonClaim && myClaimsOutpoints.indexOf(outpoint) !== -1) {
|
||||
const byOutpoint = selectFileInfosByOutpoint(state);
|
||||
const fileInfo = byOutpoint[outpoint];
|
||||
|
||||
if (fileInfo) {
|
||||
const txid = fileInfo.outpoint.slice(0, -2);
|
||||
const nout = Number(fileInfo.outpoint.slice(-1));
|
||||
|
||||
dispatch(doAbandonClaim(txid, nout));
|
||||
}
|
||||
}*/
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FILE_DELETE,
|
||||
data: {
|
||||
outpoint,
|
||||
},
|
||||
});
|
||||
|
||||
//const totalProgress = selectTotalDownloadProgress(getState());
|
||||
//setProgressBar(totalProgress);
|
||||
};
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { ACTIONS } from 'lbry-redux';
|
||||
|
||||
export function doSetClientSetting(key, value) {
|
||||
return {
|
||||
type: ACTIONS.CLIENT_SETTING_CHANGED,
|
||||
data: {
|
||||
key,
|
||||
value,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import { ACTIONS } from 'lbry-redux';
|
||||
|
||||
const reducers = {};
|
||||
const defaultState = {
|
||||
clientSettings: {
|
||||
keepDaemonRunning: true,
|
||||
showNsfw: false
|
||||
}
|
||||
};
|
||||
|
||||
reducers[ACTIONS.CLIENT_SETTING_CHANGED] = (state, action) => {
|
||||
const { key, value } = action.data;
|
||||
const clientSettings = Object.assign({}, state.clientSettings);
|
||||
|
||||
clientSettings[key] = value;
|
||||
|
||||
return Object.assign({}, state, {
|
||||
clientSettings,
|
||||
});
|
||||
};
|
||||
|
||||
export default function reducer(state = defaultState, action) {
|
||||
const handler = reducers[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
return state;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
const selectState = state => state.settings || {};
|
||||
|
||||
export const selectDaemonSettings = createSelector(selectState, state => state.daemonSettings);
|
||||
|
||||
export const selectClientSettings = createSelector(
|
||||
selectState,
|
||||
state => state.clientSettings || {}
|
||||
);
|
||||
|
||||
export const makeSelectClientSetting = setting =>
|
||||
createSelector(selectClientSettings, settings => (settings ? settings[setting] : undefined));
|
||||
|
||||
// refactor me
|
||||
export const selectShowNsfw = makeSelectClientSetting(SETTINGS.SHOW_NSFW);
|
||||
|
||||
export const selectKeepDaemonRunning = makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING);
|
||||
@@ -1,81 +0,0 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
const discoverStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
},
|
||||
scrollContainer: {
|
||||
flex: 1
|
||||
},
|
||||
title: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
},
|
||||
categoryName: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 20,
|
||||
marginLeft: 24,
|
||||
marginTop: 16,
|
||||
marginBottom: 16,
|
||||
color: '#40b89a'
|
||||
},
|
||||
fileItem: {
|
||||
marginLeft: 24,
|
||||
marginRight: 24,
|
||||
marginBottom: 48
|
||||
},
|
||||
fileItemName: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
marginTop: 8,
|
||||
fontSize: 16
|
||||
},
|
||||
channelName: {
|
||||
fontFamily: 'Metropolis-SemiBold',
|
||||
fontSize: 14,
|
||||
marginTop: 4,
|
||||
color: '#c0c0c0'
|
||||
},
|
||||
filePriceContainer: {
|
||||
backgroundColor: '#61fcd8',
|
||||
justifyContent: 'center',
|
||||
position: 'absolute',
|
||||
right: 16,
|
||||
top: 16,
|
||||
width: 56,
|
||||
height: 24,
|
||||
borderRadius: 4
|
||||
},
|
||||
filePriceText: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
fontSize: 12,
|
||||
textAlign: 'center',
|
||||
color: '#0c604b'
|
||||
},
|
||||
drawerHamburger: {
|
||||
marginLeft: 8
|
||||
},
|
||||
overlay: {
|
||||
flex: 1,
|
||||
opacity: 1,
|
||||
backgroundColor: '#222222',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: 32,
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
},
|
||||
overlayText: {
|
||||
color: '#ffffff',
|
||||
fontSize: 14,
|
||||
textAlign: 'center',
|
||||
fontFamily: 'Metropolis-Regular'
|
||||
}
|
||||
});
|
||||
|
||||
export default discoverStyle;
|
||||
@@ -1,19 +0,0 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
const fileDownloadButtonStyle = StyleSheet.create({
|
||||
container: {
|
||||
width: 120,
|
||||
height: 36,
|
||||
borderRadius: 18,
|
||||
justifyContent: 'center',
|
||||
backgroundColor: '#40c0a9',
|
||||
},
|
||||
text: {
|
||||
fontFamily: 'Metropolis-Medium',
|
||||
color: '#ffffff',
|
||||
fontSize: 14,
|
||||
textAlign: 'center'
|
||||
}
|
||||
});
|
||||
|
||||
export default fileDownloadButtonStyle;
|
||||
@@ -1,60 +0,0 @@
|
||||
import { StyleSheet, Dimensions } from 'react-native';
|
||||
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const width = screenDimension.width - 48; // screen width minus combined left and right margins
|
||||
|
||||
const fileItemMediaStyle = StyleSheet.create({
|
||||
autothumb: {
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
height: 200,
|
||||
justifyContent: 'center'
|
||||
},
|
||||
autothumbText: {
|
||||
fontFamily: 'Metropolis-SemiBold',
|
||||
textAlign: 'center',
|
||||
color: '#ffffff',
|
||||
fontSize: 40
|
||||
},
|
||||
autothumbPurple: {
|
||||
backgroundColor: '#9c27b0'
|
||||
},
|
||||
autothumbRed: {
|
||||
backgroundColor: '#e53935'
|
||||
},
|
||||
autothumbPink: {
|
||||
backgroundColor: '#e91e63'
|
||||
},
|
||||
autothumbIndigo: {
|
||||
backgroundColor: '#3f51b5'
|
||||
},
|
||||
autothumbBlue: {
|
||||
backgroundColor: '#2196f3'
|
||||
},
|
||||
autothumbLightBlue: {
|
||||
backgroundColor: '#039be5'
|
||||
},
|
||||
autothumbCyan: {
|
||||
backgroundColor: '#00acc1'
|
||||
},
|
||||
autothumbTeal: {
|
||||
backgroundColor: '#009688'
|
||||
},
|
||||
autothumbGreen: {
|
||||
backgroundColor: '#43a047'
|
||||
},
|
||||
autothumbYellow: {
|
||||
backgroundColor: '#ffeb3b'
|
||||
},
|
||||
autothumbOrange: {
|
||||
backgroundColor: '#ffa726'
|
||||
},
|
||||
thumbnail: {
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
height: 200,
|
||||
shadowColor: 'transparent'
|
||||
}
|
||||
});
|
||||
|
||||
export default fileItemMediaStyle;
|
||||
@@ -1,101 +0,0 @@
|
||||
import { StyleSheet, Dimensions } from 'react-native';
|
||||
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const screenWidth = screenDimension.width;
|
||||
|
||||
const filePageStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
},
|
||||
pageContainer: {
|
||||
flex: 1
|
||||
},
|
||||
mediaContainer: {
|
||||
alignItems: 'center',
|
||||
width: screenWidth,
|
||||
height: 220,
|
||||
},
|
||||
emptyClaimText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
textAlign: 'center',
|
||||
fontSize: 20,
|
||||
marginLeft: 16,
|
||||
marginRight: 16
|
||||
},
|
||||
scrollContainer: {
|
||||
flex: 1,
|
||||
marginTop: -20,
|
||||
marginBottom: -4,
|
||||
paddingTop: 10
|
||||
},
|
||||
scrollContainerActions: {
|
||||
flex: 1
|
||||
},
|
||||
title: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
fontSize: 24,
|
||||
marginTop: 12,
|
||||
marginLeft: 20,
|
||||
marginRight: 20,
|
||||
marginBottom: 12
|
||||
},
|
||||
channelName: {
|
||||
fontFamily: 'Metropolis-SemiBold',
|
||||
fontSize: 20,
|
||||
marginLeft: 20,
|
||||
marginRight: 20,
|
||||
marginBottom: 20,
|
||||
color: '#9b9b9b'
|
||||
},
|
||||
description: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 16,
|
||||
marginLeft: 20,
|
||||
marginRight: 20,
|
||||
marginBottom: 40,
|
||||
color: '#999999'
|
||||
},
|
||||
thumbnail: {
|
||||
width: screenWidth,
|
||||
height: 204
|
||||
},
|
||||
downloadButton: {
|
||||
position: 'absolute',
|
||||
top: '40%'
|
||||
},
|
||||
player: {
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
marginBottom: 14
|
||||
},
|
||||
fullscreenMedia: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
flex: 1,
|
||||
backgroundColor: '#000000',
|
||||
zIndex: 100
|
||||
},
|
||||
actions: {
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
paddingTop: 16,
|
||||
paddingBottom: 8,
|
||||
marginTop: -14,
|
||||
width: '50%',
|
||||
},
|
||||
deleteButton: {
|
||||
backgroundColor: '#ff0000',
|
||||
width: 80
|
||||
},
|
||||
loading: {
|
||||
position: 'absolute',
|
||||
top: '40%'
|
||||
}
|
||||
});
|
||||
|
||||
export default filePageStyle;
|
||||
@@ -1,104 +0,0 @@
|
||||
import { StyleSheet, Dimensions } from 'react-native';
|
||||
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const screenWidth = screenDimension.width;
|
||||
|
||||
const mediaPlayerStyle = StyleSheet.create({
|
||||
player: {
|
||||
flex: 1
|
||||
},
|
||||
container: {
|
||||
},
|
||||
progress: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
overflow: 'hidden',
|
||||
},
|
||||
innerProgressCompleted: {
|
||||
height: 4,
|
||||
backgroundColor: '#40c0a9',
|
||||
},
|
||||
innerProgressRemaining: {
|
||||
height: 4,
|
||||
backgroundColor: '#2c2c2c',
|
||||
},
|
||||
trackingControls: {
|
||||
height: 3,
|
||||
width: '100%',
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
},
|
||||
playerControls: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
playerControlsContainer: {
|
||||
backgroundColor: 'transparent',
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
playPauseButton: {
|
||||
position: 'absolute',
|
||||
width: 64,
|
||||
height: 64,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
toggleFullscreenButton: {
|
||||
position: 'absolute',
|
||||
width: 36,
|
||||
height: 36,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
right: 0,
|
||||
bottom: 14,
|
||||
},
|
||||
elapsedDuration: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
position: 'absolute',
|
||||
left: 8,
|
||||
bottom: 24,
|
||||
fontSize: 12,
|
||||
color: '#ffffff'
|
||||
},
|
||||
totalDuration: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
position: 'absolute',
|
||||
right: 40,
|
||||
bottom: 24,
|
||||
fontSize: 12,
|
||||
color: '#ffffff'
|
||||
},
|
||||
seekerCircle: {
|
||||
borderRadius: 12,
|
||||
position: 'relative',
|
||||
top: 16,
|
||||
left: 8,
|
||||
height: 12,
|
||||
width: 12,
|
||||
backgroundColor: '#40c0a9'
|
||||
},
|
||||
seekerHandle: {
|
||||
position: 'absolute',
|
||||
height: 36,
|
||||
width: 36,
|
||||
bottom: -12,
|
||||
marginLeft: -8
|
||||
},
|
||||
bigSeekerCircle: {
|
||||
borderRadius: 24,
|
||||
position: 'relative',
|
||||
top: 10,
|
||||
left: 8,
|
||||
height: 24,
|
||||
width: 24,
|
||||
backgroundColor: '#40c0a9'
|
||||
}
|
||||
});
|
||||
|
||||
export default mediaPlayerStyle;
|
||||
@@ -1,39 +0,0 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
const settingsStyle = StyleSheet.create({
|
||||
title: {
|
||||
fontSize: 20,
|
||||
fontWeight: 'bold',
|
||||
margin: 16
|
||||
},
|
||||
scrollContainer: {
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
paddingBottom: 16
|
||||
},
|
||||
row: {
|
||||
marginBottom: 24,
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between'
|
||||
},
|
||||
switchText: {
|
||||
width: '70%',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
switchContainer: {
|
||||
width: '25%',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
label: {
|
||||
fontSize: 14,
|
||||
fontFamily: 'Metropolis-Regular'
|
||||
},
|
||||
description: {
|
||||
fontSize: 12,
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
color: '#aaaaaa'
|
||||
}
|
||||
});
|
||||
|
||||
export default settingsStyle;
|
||||
@@ -1,35 +0,0 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
const splashStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
backgroundColor: '#40b89a'
|
||||
},
|
||||
title: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
fontSize: 64,
|
||||
textAlign: 'center',
|
||||
marginBottom: 48,
|
||||
color: '#ffffff'
|
||||
},
|
||||
details: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
color: '#ffffff',
|
||||
textAlign: 'center'
|
||||
},
|
||||
message: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
fontSize: 18,
|
||||
color: '#ffffff',
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
marginBottom: 4,
|
||||
textAlign: 'center'
|
||||
}
|
||||
});
|
||||
|
||||
export default splashStyle;
|
||||
@@ -1,15 +0,0 @@
|
||||
import {
|
||||
createReactNavigationReduxMiddleware,
|
||||
createReduxBoundAddListener,
|
||||
} from 'react-navigation-redux-helpers';
|
||||
|
||||
const reactNavigationMiddleware = createReactNavigationReduxMiddleware(
|
||||
"root",
|
||||
state => state.nav,
|
||||
);
|
||||
const addListener = createReduxBoundAddListener("root");
|
||||
|
||||
export {
|
||||
reactNavigationMiddleware,
|
||||
addListener,
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
[app]
|
||||
|
||||
# (str) Title of your application
|
||||
title = LBRY Browser
|
||||
title = LBRY
|
||||
|
||||
# (str) Package name
|
||||
package.name = browser
|
||||
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = openssl, sqlite3, hostpython2, android, pyjnius, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pycrypto==2.6.1, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, txrequests==0.9.5, seccure==0.3.1.3, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, git+https://github.com/lbryio/lbryschema.git@v0.0.15rc2#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.0.3, funcsigs, mock, pbr, unqlite
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -86,28 +86,28 @@ fullscreen = 0
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = INTERNET,READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
|
||||
android.permissions = CAMERA,INTERNET,READ_EXTERNAL_STORAGE,RECORD_AUDIO,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 23
|
||||
android.api = 28
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 16
|
||||
android.minapi = 21
|
||||
|
||||
# (int) Android SDK version to use
|
||||
android.sdk = 23
|
||||
|
||||
# (str) Android NDK version to use
|
||||
android.ndk = 13b
|
||||
#android.ndk = 13b
|
||||
|
||||
# (bool) Use --private data storage (True) or --dir public storage (False)
|
||||
#android.private_storage = True
|
||||
|
||||
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
||||
#android.ndk_path = ~/Dev/SDKs/android-ndk-r13b
|
||||
android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
|
||||
|
||||
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
||||
#android.sdk_path = ~/Dev/SDKs/android
|
||||
#android.sdk_path = ~/.buildozer/android
|
||||
|
||||
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
||||
#android.ant_path =
|
||||
@@ -148,7 +148,7 @@ android.react_src = ./app
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:appcompat-v7:23.4.0, com.facebook.react:react-native:+
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
@@ -0,0 +1,274 @@
|
||||
[app]
|
||||
|
||||
# (str) Title of your application
|
||||
title = LBRY
|
||||
|
||||
# (str) Package name
|
||||
package.name = browser
|
||||
|
||||
# (str) Package domain (needed for android/ios packaging)
|
||||
package.domain = io.lbry
|
||||
|
||||
# (str) Source code where the main.py live
|
||||
source.dir = ./src/main/python
|
||||
|
||||
# (list) Source files to include (let empty to include all the files)
|
||||
source.include_exts = py,png,jpg,kv,atlas
|
||||
|
||||
# (list) List of inclusions using pattern matching
|
||||
#source.include_patterns = assets/*, res/*
|
||||
|
||||
# (list) Source files to exclude (let empty to not exclude anything)
|
||||
#source.exclude_exts = spec
|
||||
|
||||
# (list) List of directory to exclude (let empty to not exclude anything)
|
||||
#source.exclude_dirs = tests, bin
|
||||
|
||||
# (list) List of exclusions using pattern matching
|
||||
#source.exclude_patterns = license,images/*/*.jpg
|
||||
|
||||
# (str) Application versioning (method 1)
|
||||
#version = 0.1
|
||||
|
||||
# (str) Application versioning (method 2)
|
||||
version.regex = __version__ = ['"](.*)['"]
|
||||
version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
# requirements.source.kivy = ../../kivy
|
||||
|
||||
# (list) Garden requirements
|
||||
#garden_requirements =
|
||||
|
||||
# (str) Presplash of the application
|
||||
#presplash.filename = %(source.dir)s/data/presplash.png
|
||||
|
||||
# (str) Icon of the application
|
||||
#icon.filename = %(source.dir)s/data/icon.png
|
||||
|
||||
# (str) Supported orientation (one of landscape, portrait or all)
|
||||
orientation = portrait
|
||||
|
||||
# (list) List of service to declare
|
||||
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
|
||||
services = lbrynetservice:./lbrynetservice.py
|
||||
|
||||
#
|
||||
# OSX Specific
|
||||
#
|
||||
|
||||
#
|
||||
# author = © Copyright Info
|
||||
|
||||
# change the major version of python used by the app
|
||||
osx.python_version = 3
|
||||
|
||||
# Kivy version to use
|
||||
osx.kivy_version = 1.9.1
|
||||
|
||||
#
|
||||
# Android specific
|
||||
#
|
||||
|
||||
# (bool) Indicate if the application should be fullscreen or not
|
||||
fullscreen = 0
|
||||
|
||||
# (string) Presplash background color (for new android toolchain)
|
||||
# Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
|
||||
# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,
|
||||
# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,
|
||||
# olive, purple, silver, teal.
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = CAMERA,INTERNET,READ_EXTERNAL_STORAGE,RECORD_AUDIO,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 28
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 21
|
||||
|
||||
# (int) Android SDK version to use
|
||||
android.sdk = 23
|
||||
|
||||
# (str) Android NDK version to use
|
||||
#android.ndk = 13b
|
||||
|
||||
# (bool) Use --private data storage (True) or --dir public storage (False)
|
||||
#android.private_storage = True
|
||||
|
||||
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
||||
android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
|
||||
|
||||
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
||||
#android.sdk_path = ~/.buildozer/android
|
||||
|
||||
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
||||
#android.ant_path =
|
||||
|
||||
# (bool) If True, then skip trying to update the Android sdk
|
||||
# This can be useful to avoid excess Internet downloads or save time
|
||||
# when an update is due and you just want to test/build your package
|
||||
#android.skip_update = False
|
||||
|
||||
# (str) Android entry point, default is ok for Kivy-based app
|
||||
#android.entrypoint = org.renpy.android.PythonActivity
|
||||
|
||||
# (list) Pattern to whitelist for the whole project
|
||||
#android.whitelist =
|
||||
|
||||
# (str) Path to a custom whitelist file
|
||||
#android.whitelist_src =
|
||||
|
||||
# (str) Path to a custom blacklist file
|
||||
#android.blacklist_src =
|
||||
|
||||
# (list) List of Java .jar files to add to the libs so that pyjnius can access
|
||||
# their classes. Don't add jars that you do not need, since extra jars can slow
|
||||
# down the build process. Allows wildcards matching, for example:
|
||||
# OUYA-ODK/libs/*.jar3
|
||||
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar
|
||||
|
||||
# (list) List of Java files to add to the android project (can be java or a
|
||||
# directory containing the files)
|
||||
android.add_src = ./src/main
|
||||
|
||||
# (str) Path to the React files and node_modules for building3
|
||||
android.react_src = ./app
|
||||
|
||||
# (list) Android AAR archives to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
#android.add_aars =
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
# (str) OUYA Console category. Should be one of GAME or APP
|
||||
# If you leave this blank, OUYA support will not be enabled
|
||||
#android.ouya.category = GAME
|
||||
|
||||
# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
|
||||
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png
|
||||
|
||||
# (str) XML file to include as an intent filters in <activity> tag
|
||||
#android.manifest.intent_filters =
|
||||
|
||||
# (list) Android additionnal libraries to copy into libs/armeabi
|
||||
#android.add_libs_armeabi = libs/android-v7/*
|
||||
#android.add_libs_armeabi_v7a = libs/android-v7/*
|
||||
#android.add_libs_x86 = libs/android-x86/*.so
|
||||
#android.add_libs_mips = libs/android-mips/*.so
|
||||
|
||||
# (bool) Indicate whether the screen should stay on
|
||||
# Don't forget to add the WAKE_LOCK permission if you set this to True
|
||||
#android.wakelock = False
|
||||
|
||||
# (list) Android application meta-data to set (key=value format)
|
||||
#android.meta_data =
|
||||
|
||||
# (list) Android library project to add (will be added in the
|
||||
# project.properties automatically.)
|
||||
#android.library_references =
|
||||
|
||||
# (str) Android logcat filters to use
|
||||
#android.logcat_filters = *:S python:D
|
||||
|
||||
# (bool) Copy library instead of making a libpymodules.so
|
||||
#android.copy_libs = 1
|
||||
|
||||
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
|
||||
android.arch = arm64-v8a
|
||||
|
||||
#
|
||||
# Python for android (p4a) specific
|
||||
#
|
||||
|
||||
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
|
||||
p4a.source_dir = ./p4a
|
||||
|
||||
# (str) The directory in which python-for-android should look for your own build recipes (if any)
|
||||
p4a.local_recipes = ./recipes
|
||||
|
||||
# (str) Filename to the hook for p4a
|
||||
#p4a.hook =
|
||||
|
||||
# (str) Bootstrap to use for android builds
|
||||
p4a.bootstrap = lbry
|
||||
|
||||
|
||||
#
|
||||
# iOS specific
|
||||
#
|
||||
|
||||
# (str) Path to a custom kivy-ios folder
|
||||
#ios.kivy_ios_dir = ../kivy-ios
|
||||
|
||||
# (str) Name of the certificate to use for signing the debug version
|
||||
# Get a list of available identities: buildozer ios list_identities
|
||||
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"
|
||||
|
||||
# (str) Name of the certificate to use for signing the release version
|
||||
#ios.codesign.release = %(ios.codesign.debug)s
|
||||
|
||||
|
||||
[buildozer]
|
||||
|
||||
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
|
||||
log_level = 2
|
||||
|
||||
# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
|
||||
warn_on_root = 1
|
||||
|
||||
# (str) Path to build artifact storage, absolute or relative to spec file
|
||||
# build_dir = ./.buildozer
|
||||
|
||||
# (str) Path to build output (i.e. .apk, .ipa) storage
|
||||
# bin_dir = ./bin
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# List as sections
|
||||
#
|
||||
# You can define all the "list" as [section:key].
|
||||
# Each line will be considered as a option to the list.
|
||||
# Let's take [app] / source.exclude_patterns.
|
||||
# Instead of doing:
|
||||
#
|
||||
#[app]
|
||||
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
|
||||
#
|
||||
# This can be translated into:
|
||||
#
|
||||
#[app:source.exclude_patterns]
|
||||
#license
|
||||
#data/audio/*.wav
|
||||
#data/images/original/*
|
||||
#
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Profiles
|
||||
#
|
||||
# You can extend section / key with a profile
|
||||
# For example, you want to deploy a demo version of your application without
|
||||
# HD content. You could first change the title to add "(demo)" in the name
|
||||
# and extend the excluded directories to remove the HD content.
|
||||
#
|
||||
#[app@demo]
|
||||
#title = My Application (demo)
|
||||
#
|
||||
#[app:source.exclude_patterns@demo]
|
||||
#images/hd/*
|
||||
#
|
||||
# Then, invoke the command line with the "demo" profile:
|
||||
#
|
||||
#buildozer --profile demo android debug
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
[app]
|
||||
|
||||
# (str) Title of your application
|
||||
title = LBRY Browser
|
||||
title = LBRY
|
||||
|
||||
# (str) Package name
|
||||
package.name = browser
|
||||
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = openssl, sqlite3, hostpython2, android, pyjnius, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pycrypto==2.6.1, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, txrequests==0.9.5, seccure==0.3.1.3, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, git+https://github.com/lbryio/lbryschema.git@v0.0.15rc2#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.0.3, funcsigs, mock, pbr, unqlite
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -86,28 +86,28 @@ fullscreen = 0
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = INTERNET,READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
|
||||
android.permissions = CAMERA,INTERNET,READ_EXTERNAL_STORAGE,RECORD_AUDIO,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 23
|
||||
android.api = 28
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 16
|
||||
android.minapi = 21
|
||||
|
||||
# (int) Android SDK version to use
|
||||
android.sdk = 23
|
||||
|
||||
# (str) Android NDK version to use
|
||||
android.ndk = 13b
|
||||
#android.ndk = 13b
|
||||
|
||||
# (bool) Use --private data storage (True) or --dir public storage (False)
|
||||
#android.private_storage = True
|
||||
|
||||
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
||||
#android.ndk_path = ~/Dev/SDKs/android-ndk-r13b
|
||||
android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
|
||||
|
||||
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
||||
#android.sdk_path = ~/Dev/SDKs/android
|
||||
#android.sdk_path = ~/.buildozer/android
|
||||
|
||||
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
||||
#android.ant_path =
|
||||
@@ -148,7 +148,7 @@ android.react_src = ./app
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:appcompat-v7:23.4.0, com.facebook.react:react-native:+
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
@@ -187,7 +187,7 @@ android.gradle_dependencies = com.android.support:appcompat-v7:23.4.0, com.faceb
|
||||
#android.copy_libs = 1
|
||||
|
||||
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
|
||||
android.arch = armeabi-v7a
|
||||
android.arch = arm64-v8a
|
||||
|
||||
#
|
||||
# Python for android (p4a) specific
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
[app]
|
||||
|
||||
# (str) Title of your application
|
||||
title = LBRY
|
||||
|
||||
# (str) Package name
|
||||
package.name = browser
|
||||
|
||||
# (str) Package domain (needed for android/ios packaging)
|
||||
package.domain = io.lbry
|
||||
|
||||
# (str) Source code where the main.py live
|
||||
source.dir = ./src/main/python
|
||||
|
||||
# (list) Source files to include (let empty to include all the files)
|
||||
source.include_exts = py,png,jpg,kv,atlas
|
||||
|
||||
# (list) List of inclusions using pattern matching
|
||||
#source.include_patterns = assets/*, res/*
|
||||
|
||||
# (list) Source files to exclude (let empty to not exclude anything)
|
||||
#source.exclude_exts = spec
|
||||
|
||||
# (list) List of directory to exclude (let empty to not exclude anything)
|
||||
#source.exclude_dirs = tests, bin
|
||||
|
||||
# (list) List of exclusions using pattern matching
|
||||
#source.exclude_patterns = license,images/*/*.jpg
|
||||
|
||||
# (str) Application versioning (method 1)
|
||||
#version = 0.1
|
||||
|
||||
# (str) Application versioning (method 2)
|
||||
version.regex = __version__ = ['"](.*)['"]
|
||||
version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
# requirements.source.kivy = ../../kivy
|
||||
|
||||
# (list) Garden requirements
|
||||
#garden_requirements =
|
||||
|
||||
# (str) Presplash of the application
|
||||
#presplash.filename = %(source.dir)s/data/presplash.png
|
||||
|
||||
# (str) Icon of the application
|
||||
#icon.filename = %(source.dir)s/data/icon.png
|
||||
|
||||
# (str) Supported orientation (one of landscape, portrait or all)
|
||||
orientation = portrait
|
||||
|
||||
# (list) List of service to declare
|
||||
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
|
||||
services = lbrynetservice:./lbrynetservice.py
|
||||
|
||||
#
|
||||
# OSX Specific
|
||||
#
|
||||
|
||||
#
|
||||
# author = © Copyright Info
|
||||
|
||||
# change the major version of python used by the app
|
||||
osx.python_version = 3
|
||||
|
||||
# Kivy version to use
|
||||
osx.kivy_version = 1.9.1
|
||||
|
||||
#
|
||||
# Android specific
|
||||
#
|
||||
|
||||
# (bool) Indicate if the application should be fullscreen or not
|
||||
fullscreen = 0
|
||||
|
||||
# (string) Presplash background color (for new android toolchain)
|
||||
# Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
|
||||
# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,
|
||||
# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,
|
||||
# olive, purple, silver, teal.
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = CAMERA,INTERNET,READ_EXTERNAL_STORAGE,RECORD_AUDIO,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 28
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 21
|
||||
|
||||
# (int) Android SDK version to use
|
||||
android.sdk = 23
|
||||
|
||||
# (str) Android NDK version to use
|
||||
#android.ndk = 13b
|
||||
|
||||
# (bool) Use --private data storage (True) or --dir public storage (False)
|
||||
#android.private_storage = True
|
||||
|
||||
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
||||
android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
|
||||
|
||||
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
||||
#android.sdk_path = ~/.buildozer/android
|
||||
|
||||
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
||||
#android.ant_path =
|
||||
|
||||
# (bool) If True, then skip trying to update the Android sdk
|
||||
# This can be useful to avoid excess Internet downloads or save time
|
||||
# when an update is due and you just want to test/build your package
|
||||
#android.skip_update = False
|
||||
|
||||
# (str) Android entry point, default is ok for Kivy-based app
|
||||
#android.entrypoint = org.renpy.android.PythonActivity
|
||||
|
||||
# (list) Pattern to whitelist for the whole project
|
||||
#android.whitelist =
|
||||
|
||||
# (str) Path to a custom whitelist file
|
||||
#android.whitelist_src =
|
||||
|
||||
# (str) Path to a custom blacklist file
|
||||
#android.blacklist_src =
|
||||
|
||||
# (list) List of Java .jar files to add to the libs so that pyjnius can access
|
||||
# their classes. Don't add jars that you do not need, since extra jars can slow
|
||||
# down the build process. Allows wildcards matching, for example:
|
||||
# OUYA-ODK/libs/*.jar
|
||||
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar
|
||||
|
||||
# (list) List of Java files to add to the android project (can be java or a
|
||||
# directory containing the files)
|
||||
android.add_src = ./src/main
|
||||
|
||||
# (str) Path to the React files and node_modules for building
|
||||
android.react_src = ./app
|
||||
|
||||
# (list) Android AAR archives to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
#android.add_aars =
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
# (str) OUYA Console category. Should be one of GAME or APP
|
||||
# If you leave this blank, OUYA support will not be enabled
|
||||
#android.ouya.category = GAME
|
||||
|
||||
# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
|
||||
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png
|
||||
|
||||
# (str) XML file to include as an intent filters in <activity> tag
|
||||
#android.manifest.intent_filters =
|
||||
|
||||
# (list) Android additionnal libraries to copy into libs/armeabi
|
||||
#android.add_libs_armeabi = libs/android-v7/*
|
||||
#android.add_libs_armeabi_v7a = libs/android-v7/*
|
||||
#android.add_libs_x86 = libs/android-x86/*.so
|
||||
#android.add_libs_mips = libs/android-mips/*.so
|
||||
|
||||
# (bool) Indicate whether the screen should stay on
|
||||
# Don't forget to add the WAKE_LOCK permission if you set this to True
|
||||
#android.wakelock = False
|
||||
|
||||
# (list) Android application meta-data to set (key=value format)
|
||||
#android.meta_data =
|
||||
|
||||
# (list) Android library project to add (will be added in the
|
||||
# project.properties automatically.)
|
||||
#android.library_references =
|
||||
|
||||
# (str) Android logcat filters to use
|
||||
#android.logcat_filters = *:S python:D
|
||||
|
||||
# (bool) Copy library instead of making a libpymodules.so
|
||||
#android.copy_libs = 1
|
||||
|
||||
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
|
||||
android.arch = arm64-v8a
|
||||
|
||||
#
|
||||
# Python for android (p4a) specific
|
||||
#
|
||||
|
||||
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
|
||||
p4a.source_dir = ./p4a
|
||||
|
||||
# (str) The directory in which python-for-android should look for your own build recipes (if any)
|
||||
p4a.local_recipes = ./recipes
|
||||
|
||||
# (str) Filename to the hook for p4a
|
||||
#p4a.hook =
|
||||
|
||||
# (str) Bootstrap to use for android builds
|
||||
p4a.bootstrap = lbry
|
||||
|
||||
|
||||
#
|
||||
# iOS specific
|
||||
#
|
||||
|
||||
# (str) Path to a custom kivy-ios folder
|
||||
#ios.kivy_ios_dir = ../kivy-ios
|
||||
|
||||
# (str) Name of the certificate to use for signing the debug version
|
||||
# Get a list of available identities: buildozer ios list_identities
|
||||
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"
|
||||
|
||||
# (str) Name of the certificate to use for signing the release version
|
||||
#ios.codesign.release = %(ios.codesign.debug)s
|
||||
|
||||
|
||||
[buildozer]
|
||||
|
||||
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
|
||||
log_level = 2
|
||||
|
||||
# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
|
||||
warn_on_root = 1
|
||||
|
||||
# (str) Path to build artifact storage, absolute or relative to spec file
|
||||
# build_dir = ./.buildozer
|
||||
|
||||
# (str) Path to build output (i.e. .apk, .ipa) storage
|
||||
# bin_dir = ./bin
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# List as sections
|
||||
#
|
||||
# You can define all the "list" as [section:key].
|
||||
# Each line will be considered as a option to the list.
|
||||
# Let's take [app] / source.exclude_patterns.
|
||||
# Instead of doing:
|
||||
#
|
||||
#[app]
|
||||
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
|
||||
#
|
||||
# This can be translated into:
|
||||
#
|
||||
#[app:source.exclude_patterns]
|
||||
#license
|
||||
#data/audio/*.wav
|
||||
#data/images/original/*
|
||||
#
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Profiles
|
||||
#
|
||||
# You can extend section / key with a profile
|
||||
# For example, you want to deploy a demo version of your application without
|
||||
# HD content. You could first change the title to add "(demo)" in the name
|
||||
# and extend the excluded directories to remove the HD content.
|
||||
#
|
||||
#[app@demo]
|
||||
#title = My Application (demo)
|
||||
#
|
||||
#[app:source.exclude_patterns@demo]
|
||||
#images/hd/*
|
||||
#
|
||||
# Then, invoke the command line with the "demo" profile:
|
||||
#
|
||||
#buildozer --profile demo android debug
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.3#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.3#egg=torba&subdirectory=torba"
|
||||
Binary file not shown.
Binary file not shown.
+4
-4
@@ -2,7 +2,7 @@
|
||||
|
||||
python-for-android is a packager for Python apps on Android. You can
|
||||
create your own Python distribution including the modules and
|
||||
dependencies you want, and bundle it in an APK along with your own
|
||||
dependencies you want and bundle it in an APK along with your own
|
||||
code.
|
||||
|
||||
Features include:
|
||||
@@ -13,7 +13,7 @@ Features include:
|
||||
- Automatic support for most pure Python modules, and built in support
|
||||
for many others, including popular dependencies such as numpy and
|
||||
sqlalchemy.
|
||||
- Multiple architecture targets, for APKs optimised on any given device.
|
||||
- Multiple architecture targets, for APKs optimized on any given device.
|
||||
|
||||
For documentation and support, see:
|
||||
|
||||
@@ -21,8 +21,8 @@ For documentation and support, see:
|
||||
- Mailing list: https://groups.google.com/forum/#!forum/kivy-users or
|
||||
https://groups.google.com/forum/#!forum/python-android.
|
||||
|
||||
In 2015 these tools were rewritten to provide a new, easier to use and
|
||||
extend interface. If you are looking for the old toolchain with
|
||||
In 2015, these tools were rewritten to provide a newer, easier to use and
|
||||
extended interface. If you are looking for the old toolchain with
|
||||
distribute.sh and build.py, it is still available at
|
||||
https://github.com/kivy/python-for-android/tree/old_toolchain, and
|
||||
issues and PRs relating to this branch are still accepted. However,
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@ python-for-android
|
||||
|
||||
python-for-android is a packager for Python apps on Android. You can
|
||||
create your own Python distribution including the modules and
|
||||
dependencies you want, and bundle it in an APK along with your own code.
|
||||
dependencies you want and bundle it in an APK along with your own code.
|
||||
|
||||
Features include:
|
||||
|
||||
@@ -13,7 +13,7 @@ Features include:
|
||||
- Automatic support for most pure Python modules, and built in support
|
||||
for many others, including popular dependencies such as numpy and
|
||||
sqlalchemy.
|
||||
- Multiple architecture targets, for APKs optimised on any given
|
||||
- Multiple architecture targets, for APKs optimized on any given
|
||||
device.
|
||||
|
||||
For documentation and support, see:
|
||||
@@ -22,7 +22,7 @@ For documentation and support, see:
|
||||
- Mailing list: https://groups.google.com/forum/#!forum/kivy-users or
|
||||
https://groups.google.com/forum/#!forum/python-android.
|
||||
|
||||
In 2015 these tools were rewritten to provide a new, easier to use and
|
||||
In 2015, these tools were rewritten to provide a new, easier to use and
|
||||
extend interface. If you are looking for the old toolchain with
|
||||
distribute.sh and build.py, it is still available at
|
||||
https://github.com/kivy/python-for-android/tree/old\_toolchain, and
|
||||
|
||||
+115
-44
@@ -1,10 +1,10 @@
|
||||
from os.path import (join, dirname)
|
||||
from os import environ, uname
|
||||
import sys
|
||||
from distutils.spawn import find_executable
|
||||
from os import environ
|
||||
from os.path import (exists, join, dirname, split)
|
||||
from glob import glob
|
||||
|
||||
from pythonforandroid.logger import warning
|
||||
from pythonforandroid.recipe import Recipe
|
||||
from pythonforandroid.util import BuildInterruptingException, build_platform
|
||||
|
||||
|
||||
class Arch(object):
|
||||
@@ -19,6 +19,12 @@ class Arch(object):
|
||||
super(Arch, self).__init__()
|
||||
self.ctx = ctx
|
||||
|
||||
# Allows injecting additional linker paths used by any recipe.
|
||||
# This can also be modified by recipes (like the librt recipe)
|
||||
# to make sure that some sort of global resource is available &
|
||||
# linked for all others.
|
||||
self.extra_global_link_paths = []
|
||||
|
||||
def __str__(self):
|
||||
return self.arch
|
||||
|
||||
@@ -30,24 +36,65 @@ class Arch(object):
|
||||
d.format(arch=self))
|
||||
for d in self.ctx.include_dirs]
|
||||
|
||||
def get_env(self, with_flags_in_cc=True):
|
||||
@property
|
||||
def target(self):
|
||||
target_data = self.command_prefix.split('-')
|
||||
return '-'.join(
|
||||
[target_data[0], 'none', target_data[1], target_data[2]])
|
||||
|
||||
def get_env(self, with_flags_in_cc=True, clang=False):
|
||||
env = {}
|
||||
|
||||
env["CFLAGS"] = " ".join([
|
||||
"-DANDROID", "-mandroid", "-fomit-frame-pointer",
|
||||
"--sysroot", self.ctx.ndk_platform])
|
||||
cflags = [
|
||||
'-DANDROID',
|
||||
'-fomit-frame-pointer',
|
||||
'-D__ANDROID_API__={}'.format(self.ctx.ndk_api)]
|
||||
if not clang:
|
||||
cflags.append('-mandroid')
|
||||
else:
|
||||
cflags.append('-target ' + self.target)
|
||||
toolchain = '{android_host}-{toolchain_version}'.format(
|
||||
android_host=self.ctx.toolchain_prefix,
|
||||
toolchain_version=self.ctx.toolchain_version)
|
||||
toolchain = join(self.ctx.ndk_dir, 'toolchains', toolchain,
|
||||
'prebuilt', build_platform)
|
||||
cflags.append('-gcc-toolchain {}'.format(toolchain))
|
||||
|
||||
env['CFLAGS'] = ' '.join(cflags)
|
||||
|
||||
# Link the extra global link paths first before anything else
|
||||
# (such that overriding system libraries with them is possible)
|
||||
env['LDFLAGS'] = ' ' + " ".join([
|
||||
"-L'" + l.replace("'", "'\"'\"'") + "'" # no shlex.quote in py2
|
||||
for l in self.extra_global_link_paths
|
||||
]) + ' '
|
||||
|
||||
sysroot = join(self.ctx._ndk_dir, 'sysroot')
|
||||
if exists(sysroot):
|
||||
# post-15 NDK per
|
||||
# https://android.googlesource.com/platform/ndk/+/ndk-r15-release/docs/UnifiedHeaders.md
|
||||
env['CFLAGS'] += ' -isystem {}/sysroot/usr/include/{}'.format(
|
||||
self.ctx.ndk_dir, self.ctx.toolchain_prefix)
|
||||
env['CFLAGS'] += ' -I{}/sysroot/usr/include/{}'.format(
|
||||
self.ctx.ndk_dir, self.command_prefix)
|
||||
else:
|
||||
sysroot = self.ctx.ndk_platform
|
||||
env['CFLAGS'] += ' -I{}'.format(self.ctx.ndk_platform)
|
||||
env['CFLAGS'] += ' -isysroot {} '.format(sysroot)
|
||||
env['CFLAGS'] += '-I' + join(self.ctx.get_python_install_dir(),
|
||||
'include/python{}'.format(
|
||||
self.ctx.python_recipe.version[0:3])
|
||||
)
|
||||
|
||||
env['LDFLAGS'] += '--sysroot={} '.format(self.ctx.ndk_platform)
|
||||
|
||||
env["CXXFLAGS"] = env["CFLAGS"]
|
||||
|
||||
env["LDFLAGS"] = " ".join(['-lm', '-L' + self.ctx.get_libs_dir(self.arch)])
|
||||
env["LDFLAGS"] += " ".join(['-lm', '-L' + self.ctx.get_libs_dir(self.arch)])
|
||||
|
||||
if self.ctx.ndk == 'crystax':
|
||||
env['LDFLAGS'] += ' -L{}/sources/crystax/libs/{} -lcrystax'.format(self.ctx.ndk_dir, self.arch)
|
||||
|
||||
py_platform = sys.platform
|
||||
if py_platform in ['linux2', 'linux3']:
|
||||
py_platform = 'linux'
|
||||
|
||||
toolchain_prefix = self.ctx.toolchain_prefix
|
||||
toolchain_version = self.ctx.toolchain_version
|
||||
command_prefix = self.command_prefix
|
||||
@@ -63,53 +110,71 @@ class Arch(object):
|
||||
env['NDK_CCACHE'] = self.ctx.ccache
|
||||
env.update({k: v for k, v in environ.items() if k.startswith('CCACHE_')})
|
||||
|
||||
cc = find_executable('{command_prefix}-gcc'.format(
|
||||
command_prefix=command_prefix), path=environ['PATH'])
|
||||
if clang:
|
||||
llvm_dirname = split(
|
||||
glob(join(self.ctx.ndk_dir, 'toolchains', 'llvm*'))[-1])[-1]
|
||||
clang_path = join(self.ctx.ndk_dir, 'toolchains', llvm_dirname,
|
||||
'prebuilt', build_platform, 'bin')
|
||||
environ['PATH'] = '{clang_path}:{path}'.format(
|
||||
clang_path=clang_path, path=environ['PATH'])
|
||||
exe = join(clang_path, 'clang')
|
||||
execxx = join(clang_path, 'clang++')
|
||||
else:
|
||||
exe = '{command_prefix}-gcc'.format(command_prefix=command_prefix)
|
||||
execxx = '{command_prefix}-g++'.format(command_prefix=command_prefix)
|
||||
|
||||
cc = find_executable(exe, path=environ['PATH'])
|
||||
if cc is None:
|
||||
print('Searching path are: {!r}'.format(environ['PATH']))
|
||||
warning('Couldn\'t find executable for CC. This indicates a '
|
||||
'problem locating the {} executable in the Android '
|
||||
'NDK, not that you don\'t have a normal compiler '
|
||||
'installed. Exiting.')
|
||||
exit(1)
|
||||
raise BuildInterruptingException(
|
||||
'Couldn\'t find executable for CC. This indicates a '
|
||||
'problem locating the {} executable in the Android '
|
||||
'NDK, not that you don\'t have a normal compiler '
|
||||
'installed. Exiting.'.format(exe))
|
||||
|
||||
if with_flags_in_cc:
|
||||
env['CC'] = '{ccache}{command_prefix}-gcc {cflags}'.format(
|
||||
command_prefix=command_prefix,
|
||||
env['CC'] = '{ccache}{exe} {cflags}'.format(
|
||||
exe=exe,
|
||||
ccache=ccache,
|
||||
cflags=env['CFLAGS'])
|
||||
env['CXX'] = '{ccache}{command_prefix}-g++ {cxxflags}'.format(
|
||||
command_prefix=command_prefix,
|
||||
env['CXX'] = '{ccache}{execxx} {cxxflags}'.format(
|
||||
execxx=execxx,
|
||||
ccache=ccache,
|
||||
cxxflags=env['CXXFLAGS'])
|
||||
else:
|
||||
env['CC'] = '{ccache}{command_prefix}-gcc'.format(
|
||||
command_prefix=command_prefix,
|
||||
env['CC'] = '{ccache}{exe}'.format(
|
||||
exe=exe,
|
||||
ccache=ccache)
|
||||
env['CXX'] = '{ccache}{command_prefix}-g++'.format(
|
||||
command_prefix=command_prefix,
|
||||
env['CXX'] = '{ccache}{execxx}'.format(
|
||||
execxx=execxx,
|
||||
ccache=ccache)
|
||||
|
||||
env['AR'] = '{}-ar'.format(command_prefix)
|
||||
env['RANLIB'] = '{}-ranlib'.format(command_prefix)
|
||||
env['LD'] = '{}-ld'.format(command_prefix)
|
||||
# env['LDSHARED'] = join(self.ctx.root_dir, 'tools', 'liblink')
|
||||
# env['LDSHARED'] = env['LD']
|
||||
env['LDSHARED'] = env["CC"] + " -pthread -shared " +\
|
||||
"-Wl,-O1 -Wl,-Bsymbolic-functions "
|
||||
if self.ctx.python_recipe and self.ctx.python_recipe.from_crystax:
|
||||
# For crystax python, we can't use the host python headers:
|
||||
env["CFLAGS"] += ' -I{}/sources/python/{}/include/python/'.\
|
||||
format(self.ctx.ndk_dir, self.ctx.python_recipe.version[0:3])
|
||||
env['STRIP'] = '{}-strip --strip-unneeded'.format(command_prefix)
|
||||
env['MAKE'] = 'make -j5'
|
||||
env['READELF'] = '{}-readelf'.format(command_prefix)
|
||||
env['NM'] = '{}-nm'.format(command_prefix)
|
||||
|
||||
hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)
|
||||
|
||||
# AND: This hardcodes python version 2.7, needs fixing
|
||||
hostpython_recipe = Recipe.get_recipe(
|
||||
'host' + self.ctx.python_recipe.name, self.ctx)
|
||||
env['BUILDLIB_PATH'] = join(
|
||||
hostpython_recipe.get_build_dir(self.arch),
|
||||
'build', 'lib.linux-{}-2.7'.format(uname()[-1]))
|
||||
'build', 'lib.{}-{}'.format(
|
||||
build_platform, self.ctx.python_recipe.major_minor_version_string)
|
||||
)
|
||||
|
||||
env['PATH'] = environ['PATH']
|
||||
|
||||
env['ARCH'] = self.arch
|
||||
env['NDK_API'] = 'android-{}'.format(str(self.ctx.ndk_api))
|
||||
|
||||
if self.ctx.python_recipe and self.ctx.python_recipe.from_crystax:
|
||||
env['CRYSTAX_PYTHON_VERSION'] = self.ctx.python_recipe.version
|
||||
@@ -123,12 +188,18 @@ class ArchARM(Arch):
|
||||
command_prefix = 'arm-linux-androideabi'
|
||||
platform_dir = 'arch-arm'
|
||||
|
||||
@property
|
||||
def target(self):
|
||||
target_data = self.command_prefix.split('-')
|
||||
return '-'.join(
|
||||
['armv7a', 'none', target_data[1], target_data[2]])
|
||||
|
||||
|
||||
class ArchARMv7_a(ArchARM):
|
||||
arch = 'armeabi-v7a'
|
||||
|
||||
def get_env(self, with_flags_in_cc=True):
|
||||
env = super(ArchARMv7_a, self).get_env(with_flags_in_cc)
|
||||
def get_env(self, with_flags_in_cc=True, clang=False):
|
||||
env = super(ArchARMv7_a, self).get_env(with_flags_in_cc, clang=clang)
|
||||
env['CFLAGS'] = (env['CFLAGS'] +
|
||||
(' -march=armv7-a -mfloat-abi=softfp '
|
||||
'-mfpu=vfp -mthumb'))
|
||||
@@ -142,8 +213,8 @@ class Archx86(Arch):
|
||||
command_prefix = 'i686-linux-android'
|
||||
platform_dir = 'arch-x86'
|
||||
|
||||
def get_env(self, with_flags_in_cc=True):
|
||||
env = super(Archx86, self).get_env(with_flags_in_cc)
|
||||
def get_env(self, with_flags_in_cc=True, clang=False):
|
||||
env = super(Archx86, self).get_env(with_flags_in_cc, clang=clang)
|
||||
env['CFLAGS'] = (env['CFLAGS'] +
|
||||
' -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32')
|
||||
env['CXXFLAGS'] = env['CFLAGS']
|
||||
@@ -152,12 +223,12 @@ class Archx86(Arch):
|
||||
|
||||
class Archx86_64(Arch):
|
||||
arch = 'x86_64'
|
||||
toolchain_prefix = 'x86'
|
||||
toolchain_prefix = 'x86_64'
|
||||
command_prefix = 'x86_64-linux-android'
|
||||
platform_dir = 'arch-x86'
|
||||
platform_dir = 'arch-x86_64'
|
||||
|
||||
def get_env(self, with_flags_in_cc=True):
|
||||
env = super(Archx86_64, self).get_env(with_flags_in_cc)
|
||||
def get_env(self, with_flags_in_cc=True, clang=False):
|
||||
env = super(Archx86_64, self).get_env(with_flags_in_cc, clang=clang)
|
||||
env['CFLAGS'] = (env['CFLAGS'] +
|
||||
' -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel')
|
||||
env['CXXFLAGS'] = env['CFLAGS']
|
||||
@@ -170,8 +241,8 @@ class ArchAarch_64(Arch):
|
||||
command_prefix = 'aarch64-linux-android'
|
||||
platform_dir = 'arch-arm64'
|
||||
|
||||
def get_env(self, with_flags_in_cc=True):
|
||||
env = super(ArchAarch_64, self).get_env(with_flags_in_cc)
|
||||
def get_env(self, with_flags_in_cc=True, clang=False):
|
||||
env = super(ArchAarch_64, self).get_env(with_flags_in_cc, clang=clang)
|
||||
incpath = ' -I' + join(dirname(__file__), 'includes', 'arm64-v8a')
|
||||
env['EXTRA_CFLAGS'] = incpath
|
||||
env['CFLAGS'] += incpath
|
||||
|
||||
@@ -70,7 +70,7 @@ class BdistAPK(Command):
|
||||
sys.argv.append('--version={}'.format(version))
|
||||
|
||||
if not argv_contains('--arch'):
|
||||
arch = 'armeabi'
|
||||
arch = 'arm64-v8a'
|
||||
self.arch = arch
|
||||
sys.argv.append('--arch={}'.format(arch))
|
||||
|
||||
|
||||
@@ -1,17 +1,39 @@
|
||||
from os.path import (join, dirname, isdir, splitext, basename, realpath)
|
||||
from os import listdir, mkdir
|
||||
from os.path import (join, dirname, isdir, normpath, splitext, basename)
|
||||
from os import listdir, walk, sep
|
||||
import sh
|
||||
import shlex
|
||||
import glob
|
||||
import json
|
||||
import importlib
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from pythonforandroid.logger import (warning, shprint, info, logger,
|
||||
debug, error)
|
||||
debug)
|
||||
from pythonforandroid.util import (current_directory, ensure_dir,
|
||||
temp_directory, which)
|
||||
temp_directory)
|
||||
from pythonforandroid.recipe import Recipe
|
||||
|
||||
|
||||
def copy_files(src_root, dest_root, override=True):
|
||||
for root, dirnames, filenames in walk(src_root):
|
||||
for filename in filenames:
|
||||
subdir = normpath(root.replace(src_root, ""))
|
||||
if subdir.startswith(sep): # ensure it is relative
|
||||
subdir = subdir[1:]
|
||||
dest_dir = join(dest_root, subdir)
|
||||
if not os.path.exists(dest_dir):
|
||||
os.makedirs(dest_dir)
|
||||
src_file = join(root, filename)
|
||||
dest_file = join(dest_dir, filename)
|
||||
if os.path.isfile(src_file):
|
||||
if override and os.path.exists(dest_file):
|
||||
os.unlink(dest_file)
|
||||
if not os.path.exists(dest_file):
|
||||
shutil.copy(src_file, dest_file)
|
||||
else:
|
||||
os.makedirs(dest_file)
|
||||
|
||||
|
||||
class Bootstrap(object):
|
||||
'''An Android project template, containing recipe stuff for
|
||||
compilation and templated fields for APK info.
|
||||
@@ -27,7 +49,11 @@ class Bootstrap(object):
|
||||
dist_name = None
|
||||
distribution = None
|
||||
|
||||
recipe_depends = ['sdl2']
|
||||
# All bootstraps should include Python in some way:
|
||||
recipe_depends = [
|
||||
("python2", "python2legacy", "python3", "python3crystax"),
|
||||
'android',
|
||||
]
|
||||
|
||||
can_be_chosen_automatically = True
|
||||
'''Determines whether the bootstrap can be chosen as one that
|
||||
@@ -78,6 +104,9 @@ class Bootstrap(object):
|
||||
def get_dist_dir(self, name):
|
||||
return join(self.ctx.dist_dir, name)
|
||||
|
||||
def get_common_dir(self):
|
||||
return os.path.abspath(join(self.bootstrap_dir, "..", 'common'))
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
modname = self.__class__.__module__
|
||||
@@ -87,9 +116,10 @@ class Bootstrap(object):
|
||||
'''Ensure that a build dir exists for the recipe. This same single
|
||||
dir will be used for building all different archs.'''
|
||||
self.build_dir = self.get_build_dir()
|
||||
shprint(sh.cp, '-r',
|
||||
join(self.bootstrap_dir, 'build'),
|
||||
self.build_dir)
|
||||
self.common_dir = self.get_common_dir()
|
||||
copy_files(join(self.bootstrap_dir, 'build'), self.build_dir)
|
||||
copy_files(join(self.common_dir, 'build'), self.build_dir,
|
||||
override=False)
|
||||
if self.ctx.symlink_java_src:
|
||||
info('Symlinking java src instead of copying')
|
||||
shprint(sh.rm, '-r', join(self.build_dir, 'src'))
|
||||
@@ -102,26 +132,15 @@ class Bootstrap(object):
|
||||
fileh.write('target=android-{}'.format(self.ctx.android_api))
|
||||
|
||||
def prepare_dist_dir(self, name):
|
||||
# self.dist_dir = self.get_dist_dir(name)
|
||||
ensure_dir(self.dist_dir)
|
||||
|
||||
def run_distribute(self):
|
||||
# print('Default bootstrap being used doesn\'t know how '
|
||||
# 'to distribute...failing.')
|
||||
# exit(1)
|
||||
with current_directory(self.dist_dir):
|
||||
info('Saving distribution info')
|
||||
with open('dist_info.json', 'w') as fileh:
|
||||
json.dump({'dist_name': self.ctx.dist_name,
|
||||
'bootstrap': self.ctx.bootstrap.name,
|
||||
'archs': [arch.arch for arch in self.ctx.archs],
|
||||
'recipes': self.ctx.recipe_build_order + self.ctx.python_modules},
|
||||
fileh)
|
||||
self.distribution.save_info(self.dist_dir)
|
||||
|
||||
@classmethod
|
||||
def list_bootstraps(cls):
|
||||
'''Find all the available bootstraps and return them.'''
|
||||
forbidden_dirs = ('__pycache__', )
|
||||
forbidden_dirs = ('__pycache__', 'common')
|
||||
bootstraps_dir = join(dirname(__file__), 'bootstraps')
|
||||
for name in listdir(bootstraps_dir):
|
||||
if name in forbidden_dirs:
|
||||
@@ -152,7 +171,7 @@ class Bootstrap(object):
|
||||
for recipe in recipes:
|
||||
try:
|
||||
recipe = Recipe.get_recipe(recipe, ctx)
|
||||
except IOError:
|
||||
except ValueError:
|
||||
conflicts = []
|
||||
else:
|
||||
conflicts = recipe.conflicts
|
||||
@@ -160,7 +179,7 @@ class Bootstrap(object):
|
||||
for conflict in conflicts]):
|
||||
ok = False
|
||||
break
|
||||
if ok:
|
||||
if ok and bs not in acceptable_bootstraps:
|
||||
acceptable_bootstraps.append(bs)
|
||||
info('Found {} acceptable bootstraps: {}'.format(
|
||||
len(acceptable_bootstraps),
|
||||
@@ -249,16 +268,22 @@ class Bootstrap(object):
|
||||
info('Python was loaded from CrystaX, skipping strip')
|
||||
return
|
||||
env = arch.get_env()
|
||||
strip = which('arm-linux-androideabi-strip', env['PATH'])
|
||||
if strip is None:
|
||||
warning('Can\'t find strip in PATH...')
|
||||
return
|
||||
strip = sh.Command(strip)
|
||||
filens = shprint(sh.find, join(self.dist_dir, 'private'),
|
||||
join(self.dist_dir, 'libs'),
|
||||
tokens = shlex.split(env['STRIP'])
|
||||
strip = sh.Command(tokens[0])
|
||||
if len(tokens) > 1:
|
||||
strip = strip.bake(tokens[1:])
|
||||
|
||||
libs_dir = join(self.dist_dir, '_python_bundle',
|
||||
'_python_bundle', 'modules')
|
||||
if self.ctx.python_recipe.name == 'python2legacy':
|
||||
libs_dir = join(self.dist_dir, 'private')
|
||||
filens = shprint(sh.find, libs_dir, join(self.dist_dir, 'libs'),
|
||||
'-iname', '*.so', _env=env).stdout.decode('utf-8')
|
||||
|
||||
logger.info('Stripping libraries in private dir')
|
||||
for filen in filens.split('\n'):
|
||||
if not filen:
|
||||
continue # skip the last ''
|
||||
try:
|
||||
strip(filen, _env=env)
|
||||
except sh.ErrorReturnCode_1:
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked into Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
source.absolute.dir = tmp-src
|
||||
|
||||
resource.absolute.dir = src/main/res
|
||||
|
||||
asset.absolute.dir = src/main/assets
|
||||
@@ -0,0 +1,795 @@
|
||||
#!/usr/bin/env python2.7
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
from os.path import (
|
||||
dirname, join, isfile, realpath,
|
||||
relpath, split, exists, basename
|
||||
)
|
||||
from os import listdir, makedirs, remove
|
||||
import os
|
||||
import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tarfile
|
||||
import tempfile
|
||||
import time
|
||||
from zipfile import ZipFile
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
from fnmatch import fnmatch
|
||||
import jinja2
|
||||
|
||||
|
||||
def get_dist_info_for(key):
|
||||
try:
|
||||
with open(join(dirname(__file__), 'dist_info.json'), 'r') as fileh:
|
||||
info = json.load(fileh)
|
||||
value = str(info[key])
|
||||
except (OSError, KeyError) as e:
|
||||
print("BUILD FAILURE: Couldn't extract the key `" + key + "` " +
|
||||
"from dist_info.json: " + str(e))
|
||||
sys.exit(1)
|
||||
return value
|
||||
|
||||
|
||||
def get_hostpython():
|
||||
return get_dist_info_for('hostpython')
|
||||
|
||||
|
||||
def get_python_version():
|
||||
return get_dist_info_for('python_version')
|
||||
|
||||
|
||||
def get_bootstrap_name():
|
||||
return get_dist_info_for('bootstrap')
|
||||
|
||||
|
||||
if os.name == 'nt':
|
||||
ANDROID = 'android.bat'
|
||||
ANT = 'ant.bat'
|
||||
else:
|
||||
ANDROID = 'android'
|
||||
ANT = 'ant'
|
||||
|
||||
curdir = dirname(__file__)
|
||||
|
||||
PYTHON = get_hostpython()
|
||||
PYTHON_VERSION = get_python_version()
|
||||
if PYTHON is not None and not exists(PYTHON):
|
||||
PYTHON = None
|
||||
|
||||
BLACKLIST_PATTERNS = [
|
||||
# code versionning
|
||||
'^*.hg/*',
|
||||
'^*.git/*',
|
||||
'^*.bzr/*',
|
||||
'^*.svn/*',
|
||||
|
||||
# temp files
|
||||
'~',
|
||||
'*.bak',
|
||||
'*.swp',
|
||||
]
|
||||
# pyc/py
|
||||
if PYTHON is not None:
|
||||
BLACKLIST_PATTERNS.append('*.py')
|
||||
if PYTHON_VERSION and int(PYTHON_VERSION[0]) == 2:
|
||||
# we only blacklist `.pyc` for python2 because in python3 the compiled
|
||||
# extension is `.pyc` (.pyo files not exists for python >= 3.6)
|
||||
BLACKLIST_PATTERNS.append('*.pyc')
|
||||
|
||||
WHITELIST_PATTERNS = []
|
||||
if get_bootstrap_name() in ('sdl2', 'webview', 'service_only'):
|
||||
WHITELIST_PATTERNS.append('pyconfig.h')
|
||||
|
||||
python_files = []
|
||||
|
||||
|
||||
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(
|
||||
join(curdir, 'templates')))
|
||||
|
||||
|
||||
def try_unlink(fn):
|
||||
if exists(fn):
|
||||
os.unlink(fn)
|
||||
|
||||
|
||||
def ensure_dir(path):
|
||||
if not exists(path):
|
||||
makedirs(path)
|
||||
|
||||
|
||||
def render(template, dest, **kwargs):
|
||||
'''Using jinja2, render `template` to the filename `dest`, supplying the
|
||||
|
||||
keyword arguments as template parameters.
|
||||
'''
|
||||
|
||||
dest_dir = dirname(dest)
|
||||
if dest_dir and not exists(dest_dir):
|
||||
makedirs(dest_dir)
|
||||
|
||||
template = environment.get_template(template)
|
||||
text = template.render(**kwargs)
|
||||
|
||||
f = open(dest, 'wb')
|
||||
f.write(text.encode('utf-8'))
|
||||
f.close()
|
||||
|
||||
|
||||
def is_whitelist(name):
|
||||
return match_filename(WHITELIST_PATTERNS, name)
|
||||
|
||||
|
||||
def is_blacklist(name):
|
||||
if is_whitelist(name):
|
||||
return False
|
||||
return match_filename(BLACKLIST_PATTERNS, name)
|
||||
|
||||
|
||||
def match_filename(pattern_list, name):
|
||||
for pattern in pattern_list:
|
||||
if pattern.startswith('^'):
|
||||
pattern = pattern[1:]
|
||||
else:
|
||||
pattern = '*/' + pattern
|
||||
if fnmatch(name, pattern):
|
||||
return True
|
||||
|
||||
|
||||
def listfiles(d):
|
||||
basedir = d
|
||||
subdirlist = []
|
||||
for item in os.listdir(d):
|
||||
fn = join(d, item)
|
||||
if isfile(fn):
|
||||
yield fn
|
||||
else:
|
||||
subdirlist.append(join(basedir, item))
|
||||
for subdir in subdirlist:
|
||||
for fn in listfiles(subdir):
|
||||
yield fn
|
||||
|
||||
|
||||
def make_python_zip():
|
||||
'''
|
||||
Search for all the python related files, and construct the pythonXX.zip
|
||||
According to
|
||||
# http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
|
||||
site-packages, config and lib-dynload will be not included.
|
||||
'''
|
||||
|
||||
if not exists('private'):
|
||||
print('No compiled python is present to zip, skipping.')
|
||||
return
|
||||
|
||||
global python_files
|
||||
d = realpath(join('private', 'lib', 'python2.7'))
|
||||
|
||||
def select(fn):
|
||||
if is_blacklist(fn):
|
||||
return False
|
||||
fn = realpath(fn)
|
||||
assert(fn.startswith(d))
|
||||
fn = fn[len(d):]
|
||||
if (fn.startswith('/site-packages/')
|
||||
or fn.startswith('/config/')
|
||||
or fn.startswith('/lib-dynload/')
|
||||
or fn.startswith('/libpymodules.so')):
|
||||
return False
|
||||
return fn
|
||||
|
||||
# get a list of all python file
|
||||
python_files = [x for x in listfiles(d) if select(x)]
|
||||
|
||||
# create the final zipfile
|
||||
zfn = join('private', 'lib', 'python27.zip')
|
||||
zf = ZipFile(zfn, 'w')
|
||||
|
||||
# put all the python files in it
|
||||
for fn in python_files:
|
||||
afn = fn[len(d):]
|
||||
zf.write(fn, afn)
|
||||
zf.close()
|
||||
|
||||
|
||||
def make_tar(tfn, source_dirs, ignore_path=[], optimize_python=True):
|
||||
'''
|
||||
Make a zip file `fn` from the contents of source_dis.
|
||||
'''
|
||||
|
||||
# selector function
|
||||
def select(fn):
|
||||
rfn = realpath(fn)
|
||||
for p in ignore_path:
|
||||
if p.endswith('/'):
|
||||
p = p[:-1]
|
||||
if rfn.startswith(p):
|
||||
return False
|
||||
if rfn in python_files:
|
||||
return False
|
||||
return not is_blacklist(fn)
|
||||
|
||||
# get the files and relpath file of all the directory we asked for
|
||||
files = []
|
||||
for sd in source_dirs:
|
||||
sd = realpath(sd)
|
||||
compile_dir(sd, optimize_python=optimize_python)
|
||||
files += [(x, relpath(realpath(x), sd)) for x in listfiles(sd)
|
||||
if select(x)]
|
||||
|
||||
# create tar.gz of thoses files
|
||||
tf = tarfile.open(tfn, 'w:gz', format=tarfile.USTAR_FORMAT)
|
||||
dirs = []
|
||||
for fn, afn in files:
|
||||
dn = dirname(afn)
|
||||
if dn not in dirs:
|
||||
# create every dirs first if not exist yet
|
||||
d = ''
|
||||
for component in split(dn):
|
||||
d = join(d, component)
|
||||
if d.startswith('/'):
|
||||
d = d[1:]
|
||||
if d == '' or d in dirs:
|
||||
continue
|
||||
dirs.append(d)
|
||||
tinfo = tarfile.TarInfo(d)
|
||||
tinfo.type = tarfile.DIRTYPE
|
||||
tf.addfile(tinfo)
|
||||
|
||||
# put the file
|
||||
tf.add(fn, afn)
|
||||
tf.close()
|
||||
|
||||
|
||||
def compile_dir(dfn, optimize_python=True):
|
||||
'''
|
||||
Compile *.py in directory `dfn` to *.pyo
|
||||
'''
|
||||
|
||||
if PYTHON is None:
|
||||
return
|
||||
|
||||
if int(PYTHON_VERSION[0]) >= 3:
|
||||
args = [PYTHON, '-m', 'compileall', '-b', '-f', dfn]
|
||||
else:
|
||||
args = [PYTHON, '-m', 'compileall', '-f', dfn]
|
||||
if optimize_python:
|
||||
# -OO = strip docstrings
|
||||
args.insert(1, '-OO')
|
||||
return_code = subprocess.call(args)
|
||||
|
||||
if return_code != 0:
|
||||
print('Error while running "{}"'.format(' '.join(args)))
|
||||
print('This probably means one of your Python files has a syntax '
|
||||
'error, see logs above')
|
||||
exit(1)
|
||||
|
||||
|
||||
def make_package(args):
|
||||
# If no launcher is specified, require a main.py/main.pyo:
|
||||
if (get_bootstrap_name() != "sdl" or args.launcher is None) and \
|
||||
get_bootstrap_name() != "webview":
|
||||
# (webview doesn't need an entrypoint, apparently)
|
||||
if args.private is None or (
|
||||
not exists(join(realpath(args.private), 'main.py')) and
|
||||
not exists(join(realpath(args.private), 'main.pyo'))):
|
||||
print('''BUILD FAILURE: No main.py(o) found in your app directory. This
|
||||
file must exist to act as the entry point for you app. If your app is
|
||||
started by a file with a different name, rename it to main.py or add a
|
||||
main.py that loads it.''')
|
||||
sys.exit(1)
|
||||
|
||||
assets_dir = "src/main/assets"
|
||||
|
||||
# Delete the old assets.
|
||||
try_unlink(join(assets_dir, 'public.mp3'))
|
||||
try_unlink(join(assets_dir, 'private.mp3'))
|
||||
ensure_dir(assets_dir)
|
||||
|
||||
# In order to speedup import and initial depack,
|
||||
# construct a python27.zip
|
||||
make_python_zip()
|
||||
|
||||
# Add extra environment variable file into tar-able directory:
|
||||
env_vars_tarpath = tempfile.mkdtemp(prefix="p4a-extra-env-")
|
||||
with open(os.path.join(env_vars_tarpath, "p4a_env_vars.txt"), "w") as f:
|
||||
f.write("P4A_IS_WINDOWED=" + str(args.window) + "\n")
|
||||
if hasattr(args, "orientation"):
|
||||
f.write("P4A_ORIENTATION=" + str(args.orientation) + "\n")
|
||||
f.write("P4A_NUMERIC_VERSION=" + str(args.numeric_version) + "\n")
|
||||
f.write("P4A_MINSDK=" + str(args.min_sdk_version) + "\n")
|
||||
|
||||
# Package up the private data (public not supported).
|
||||
tar_dirs = [env_vars_tarpath]
|
||||
if args.private:
|
||||
tar_dirs.append(args.private)
|
||||
for python_bundle_dir in ('private', 'crystax_python', '_python_bundle'):
|
||||
if exists(python_bundle_dir):
|
||||
tar_dirs.append(python_bundle_dir)
|
||||
if get_bootstrap_name() == "webview":
|
||||
tar_dirs.append('webview_includes')
|
||||
if args.private or args.launcher:
|
||||
make_tar(
|
||||
join(assets_dir, 'private.mp3'), tar_dirs, args.ignore_path,
|
||||
optimize_python=args.optimize_python)
|
||||
|
||||
# Remove extra env vars tar-able directory:
|
||||
shutil.rmtree(env_vars_tarpath)
|
||||
|
||||
# Prepare some variables for templating process
|
||||
res_dir = "src/main/res"
|
||||
default_icon = 'templates/kivy-icon.png'
|
||||
default_presplash = 'templates/kivy-presplash.jpg'
|
||||
shutil.copy(
|
||||
args.icon or default_icon,
|
||||
join(res_dir, 'drawable/icon.png')
|
||||
)
|
||||
if get_bootstrap_name() != "service_only":
|
||||
shutil.copy(
|
||||
args.presplash or default_presplash,
|
||||
join(res_dir, 'drawable/presplash.jpg')
|
||||
)
|
||||
|
||||
# If extra Java jars were requested, copy them into the libs directory
|
||||
jars = []
|
||||
if args.add_jar:
|
||||
for jarname in args.add_jar:
|
||||
if not exists(jarname):
|
||||
print('Requested jar does not exist: {}'.format(jarname))
|
||||
sys.exit(-1)
|
||||
shutil.copy(jarname, 'src/main/libs')
|
||||
jars.append(basename(jarname))
|
||||
|
||||
# If extra aar were requested, copy them into the libs directory
|
||||
aars = []
|
||||
if args.add_aar:
|
||||
ensure_dir("libs")
|
||||
for aarname in args.add_aar:
|
||||
if not exists(aarname):
|
||||
print('Requested aar does not exists: {}'.format(aarname))
|
||||
sys.exit(-1)
|
||||
shutil.copy(aarname, 'libs')
|
||||
aars.append(basename(aarname).rsplit('.', 1)[0])
|
||||
|
||||
versioned_name = (args.name.replace(' ', '').replace('\'', '') +
|
||||
'-' + args.version)
|
||||
|
||||
version_code = 0
|
||||
if not args.numeric_version:
|
||||
# Set version code in format (arch-minsdk-app_version)
|
||||
with open(join(dirname(__file__), 'dist_info.json'), 'r') as dist_info:
|
||||
dist_data = json.load(dist_info)
|
||||
arch = dist_data["archs"][0]
|
||||
arch_dict = {"x86_64": "9", "arm64-v8a": "8", "armeabi-v7a": "7", "x86": "6"}
|
||||
arch_code = arch_dict.get(arch, '1')
|
||||
min_sdk = args.min_sdk_version
|
||||
for i in args.version.split('.'):
|
||||
version_code *= 100
|
||||
version_code += int(i)
|
||||
args.numeric_version = "{}{}{}".format(arch_code, min_sdk, version_code)
|
||||
|
||||
if args.intent_filters:
|
||||
with open(args.intent_filters) as fd:
|
||||
args.intent_filters = fd.read()
|
||||
|
||||
if not args.add_activity:
|
||||
args.add_activity = []
|
||||
|
||||
if not args.activity_launch_mode:
|
||||
args.activity_launch_mode = ''
|
||||
|
||||
if args.extra_source_dirs:
|
||||
esd = []
|
||||
for spec in args.extra_source_dirs:
|
||||
if ':' in spec:
|
||||
specdir, specincludes = spec.split(':')
|
||||
else:
|
||||
specdir = spec
|
||||
specincludes = '**'
|
||||
esd.append((realpath(specdir), specincludes))
|
||||
args.extra_source_dirs = esd
|
||||
else:
|
||||
args.extra_source_dirs = []
|
||||
|
||||
service = False
|
||||
if args.private:
|
||||
service_main = join(realpath(args.private), 'service', 'main.py')
|
||||
if exists(service_main) or exists(service_main + 'o'):
|
||||
service = True
|
||||
|
||||
service_names = []
|
||||
for sid, spec in enumerate(args.services):
|
||||
spec = spec.split(':')
|
||||
name = spec[0]
|
||||
entrypoint = spec[1]
|
||||
options = spec[2:]
|
||||
|
||||
foreground = 'foreground' in options
|
||||
sticky = 'sticky' in options
|
||||
|
||||
service_names.append(name)
|
||||
service_target_path =\
|
||||
'src/main/java/{}/Service{}.java'.format(
|
||||
args.package.replace(".", "/"),
|
||||
name.capitalize()
|
||||
)
|
||||
render(
|
||||
'Service.tmpl.java',
|
||||
service_target_path,
|
||||
name=name,
|
||||
entrypoint=entrypoint,
|
||||
args=args,
|
||||
foreground=foreground,
|
||||
sticky=sticky,
|
||||
service_id=sid + 1,
|
||||
)
|
||||
|
||||
# Find the SDK directory and target API
|
||||
with open('project.properties', 'r') as fileh:
|
||||
target = fileh.read().strip()
|
||||
android_api = target.split('-')[1]
|
||||
try:
|
||||
int(android_api)
|
||||
except (ValueError, TypeError):
|
||||
raise ValueError(
|
||||
"failed to extract the Android API level from " +
|
||||
"build.properties. expected int, got: '" +
|
||||
str(android_api) + "'"
|
||||
)
|
||||
with open('local.properties', 'r') as fileh:
|
||||
sdk_dir = fileh.read().strip()
|
||||
sdk_dir = sdk_dir[8:]
|
||||
|
||||
# Try to build with the newest available build tools
|
||||
ignored = {".DS_Store", ".ds_store"}
|
||||
build_tools_versions = [x for x in listdir(join(sdk_dir, 'build-tools')) if x not in ignored]
|
||||
build_tools_versions = sorted(build_tools_versions,
|
||||
key=LooseVersion)
|
||||
build_tools_version = build_tools_versions[-1]
|
||||
|
||||
# Folder name for launcher (used by SDL2 bootstrap)
|
||||
url_scheme = 'kivy'
|
||||
|
||||
# Render out android manifest:
|
||||
manifest_path = "src/main/AndroidManifest.xml"
|
||||
render_args = {
|
||||
"args": args,
|
||||
"service": service,
|
||||
"service_names": service_names,
|
||||
"android_api": android_api
|
||||
}
|
||||
if get_bootstrap_name() == "sdl2":
|
||||
render_args["url_scheme"] = url_scheme
|
||||
render(
|
||||
'AndroidManifest.tmpl.xml',
|
||||
manifest_path,
|
||||
**render_args)
|
||||
|
||||
# Copy the AndroidManifest.xml to the dist root dir so that ant
|
||||
# can also use it
|
||||
if exists('AndroidManifest.xml'):
|
||||
remove('AndroidManifest.xml')
|
||||
shutil.copy(manifest_path, 'AndroidManifest.xml')
|
||||
|
||||
# gradle build templates
|
||||
render(
|
||||
'build.tmpl.gradle',
|
||||
'build.gradle',
|
||||
args=args,
|
||||
aars=aars,
|
||||
jars=jars,
|
||||
android_api=android_api,
|
||||
build_tools_version=build_tools_version
|
||||
)
|
||||
|
||||
# ant build templates
|
||||
render(
|
||||
'build.tmpl.xml',
|
||||
'build.xml',
|
||||
args=args,
|
||||
versioned_name=versioned_name)
|
||||
|
||||
# String resources:
|
||||
render_args = {
|
||||
"args": args,
|
||||
"private_version": str(time.time())
|
||||
}
|
||||
if get_bootstrap_name() == "sdl2":
|
||||
render_args["url_scheme"] = url_scheme
|
||||
render(
|
||||
'strings.tmpl.xml',
|
||||
join(res_dir, 'values/strings.xml'),
|
||||
**render_args)
|
||||
|
||||
if exists(join("templates", "custom_rules.tmpl.xml")):
|
||||
render(
|
||||
'custom_rules.tmpl.xml',
|
||||
'custom_rules.xml',
|
||||
args=args)
|
||||
|
||||
if get_bootstrap_name() == "webview":
|
||||
render('WebViewLoader.tmpl.java',
|
||||
'src/main/java/org/kivy/android/WebViewLoader.java',
|
||||
args=args)
|
||||
|
||||
if args.sign:
|
||||
render('build.properties', 'build.properties')
|
||||
else:
|
||||
if exists('build.properties'):
|
||||
os.remove('build.properties')
|
||||
|
||||
# Apply java source patches if any are present:
|
||||
if exists(join('src', 'patches')):
|
||||
print("Applying Java source code patches...")
|
||||
for patch_name in os.listdir(join('src', 'patches')):
|
||||
patch_path = join('src', 'patches', patch_name)
|
||||
print("Applying patch: " + str(patch_path))
|
||||
try:
|
||||
subprocess.check_output([
|
||||
# -N: insist this is FORWARd patch, don't reverse apply
|
||||
# -p1: strip first path component
|
||||
# -t: batch mode, don't ask questions
|
||||
"patch", "-N", "-p1", "-t", "-i", patch_path
|
||||
])
|
||||
except subprocess.CalledProcessError as e:
|
||||
if e.returncode == 1:
|
||||
# Return code 1 means it didn't apply, this will
|
||||
# usually mean it is already applied.
|
||||
print("Warning: failed to apply patch (" +
|
||||
"exit code 1), " +
|
||||
"assuming it is already applied: " +
|
||||
str(patch_path)
|
||||
)
|
||||
else:
|
||||
raise e
|
||||
|
||||
|
||||
def parse_args(args=None):
|
||||
global BLACKLIST_PATTERNS, WHITELIST_PATTERNS, PYTHON
|
||||
|
||||
# Get the default minsdk, equal to the NDK API that this dist is built against
|
||||
try:
|
||||
with open('dist_info.json', 'r') as fileh:
|
||||
info = json.load(fileh)
|
||||
default_min_api = int(info['ndk_api'])
|
||||
ndk_api = default_min_api
|
||||
except (OSError, KeyError, ValueError, TypeError):
|
||||
print('WARNING: Failed to read ndk_api from dist info, defaulting to 12')
|
||||
default_min_api = 12 # The old default before ndk_api was introduced
|
||||
ndk_api = 12
|
||||
|
||||
import argparse
|
||||
ap = argparse.ArgumentParser(description='''\
|
||||
Package a Python application for Android (using
|
||||
bootstrap ''' + get_bootstrap_name() + ''').
|
||||
|
||||
For this to work, Java and Ant need to be in your path, as does the
|
||||
tools directory of the Android SDK.
|
||||
''')
|
||||
|
||||
# --private is required unless for sdl2, where there's also --launcher
|
||||
ap.add_argument('--private', dest='private',
|
||||
help='the directory with the app source code files' +
|
||||
' (containing your main.py entrypoint)',
|
||||
required=(get_bootstrap_name() != "sdl2"))
|
||||
ap.add_argument('--package', dest='package',
|
||||
help=('The name of the java package the project will be'
|
||||
' packaged under.'),
|
||||
required=True)
|
||||
ap.add_argument('--name', dest='name',
|
||||
help=('The human-readable name of the project.'),
|
||||
required=True)
|
||||
ap.add_argument('--numeric-version', dest='numeric_version',
|
||||
help=('The numeric version number of the project. If not '
|
||||
'given, this is automatically computed from the '
|
||||
'version.'))
|
||||
ap.add_argument('--version', dest='version',
|
||||
help=('The version number of the project. This should '
|
||||
'consist of numbers and dots, and should have the '
|
||||
'same number of groups of numbers as previous '
|
||||
'versions.'),
|
||||
required=True)
|
||||
if get_bootstrap_name() == "sdl2":
|
||||
ap.add_argument('--launcher', dest='launcher', action='store_true',
|
||||
help=('Provide this argument to build a multi-app '
|
||||
'launcher, rather than a single app.'))
|
||||
ap.add_argument('--permission', dest='permissions', action='append', default=[],
|
||||
help='The permissions to give this app.', nargs='+')
|
||||
ap.add_argument('--meta-data', dest='meta_data', action='append', default=[],
|
||||
help='Custom key=value to add in application metadata')
|
||||
ap.add_argument('--uses-library', dest='android_used_libs', action='append', default=[],
|
||||
help='Used shared libraries included using <uses-library> tag in AndroidManifest.xml')
|
||||
ap.add_argument('--icon', dest='icon',
|
||||
help=('A png file to use as the icon for '
|
||||
'the application.'))
|
||||
ap.add_argument('--service', dest='services', action='append', default=[],
|
||||
help='Declare a new service entrypoint: '
|
||||
'NAME:PATH_TO_PY[:foreground]')
|
||||
if get_bootstrap_name() != "service_only":
|
||||
ap.add_argument('--presplash', dest='presplash',
|
||||
help=('A jpeg file to use as a screen while the '
|
||||
'application is loading.'))
|
||||
ap.add_argument('--presplash-color',
|
||||
dest='presplash_color',
|
||||
default='#000000',
|
||||
help=('A string to set the loading screen '
|
||||
'background color. '
|
||||
'Supported formats are: '
|
||||
'#RRGGBB #AARRGGBB or color names '
|
||||
'like red, green, blue, etc.'))
|
||||
ap.add_argument('--window', dest='window', action='store_true',
|
||||
default=False,
|
||||
help='Indicate if the application will be windowed')
|
||||
ap.add_argument('--orientation', dest='orientation',
|
||||
default='portrait',
|
||||
help=('The orientation that the game will '
|
||||
'display in. '
|
||||
'Usually one of "landscape", "portrait", '
|
||||
'"sensor", or "user" (the same as "sensor" '
|
||||
'but obeying the '
|
||||
'user\'s Android rotation setting). '
|
||||
'The full list of options is given under '
|
||||
'android_screenOrientation at '
|
||||
'https://developer.android.com/guide/'
|
||||
'topics/manifest/'
|
||||
'activity-element.html'))
|
||||
ap.add_argument('--wakelock', dest='wakelock', action='store_true',
|
||||
help=('Indicate if the application needs the device '
|
||||
'to stay on'))
|
||||
ap.add_argument('--blacklist', dest='blacklist',
|
||||
default=join(curdir, 'blacklist.txt'),
|
||||
help=('Use a blacklist file to match unwanted file in '
|
||||
'the final APK'))
|
||||
ap.add_argument('--whitelist', dest='whitelist',
|
||||
default=join(curdir, 'whitelist.txt'),
|
||||
help=('Use a whitelist file to prevent blacklisting of '
|
||||
'file in the final APK'))
|
||||
ap.add_argument('--add-jar', dest='add_jar', action='append',
|
||||
help=('Add a Java .jar to the libs, so you can access its '
|
||||
'classes with pyjnius. You can specify this '
|
||||
'argument more than once to include multiple jars'))
|
||||
ap.add_argument('--add-aar', dest='add_aar', action='append',
|
||||
help=('Add an aar dependency manually'))
|
||||
ap.add_argument('--depend', dest='depends', action='append',
|
||||
help=('Add a external dependency '
|
||||
'(eg: com.android.support:appcompat-v7:19.0.1)'))
|
||||
# The --sdk option has been removed, it is ignored in favour of
|
||||
# --android-api handled by toolchain.py
|
||||
ap.add_argument('--sdk', dest='sdk_version', default=-1,
|
||||
type=int, help=('Deprecated argument, does nothing'))
|
||||
ap.add_argument('--minsdk', dest='min_sdk_version',
|
||||
default=default_min_api, type=int,
|
||||
help=('Minimum Android SDK version that the app supports. '
|
||||
'Defaults to {}.'.format(default_min_api)))
|
||||
ap.add_argument('--allow-minsdk-ndkapi-mismatch', default=False,
|
||||
action='store_true',
|
||||
help=('Allow the --minsdk argument to be different from '
|
||||
'the discovered ndk_api in the dist'))
|
||||
ap.add_argument('--intent-filters', dest='intent_filters',
|
||||
help=('Add intent-filters xml rules to the '
|
||||
'AndroidManifest.xml file. The argument is a '
|
||||
'filename containing xml. The filename should be '
|
||||
'located relative to the python-for-android '
|
||||
'directory'))
|
||||
ap.add_argument('--with-billing', dest='billing_pubkey',
|
||||
help='If set, the billing service will be added (not implemented)')
|
||||
ap.add_argument('--add-source', dest='extra_source_dirs', action='append',
|
||||
help='Include additional source dirs in Java build')
|
||||
if get_bootstrap_name() == "webview":
|
||||
ap.add_argument('--port',
|
||||
help='The port on localhost that the WebView will access',
|
||||
default='5000')
|
||||
ap.add_argument('--try-system-python-compile', dest='try_system_python_compile',
|
||||
action='store_true',
|
||||
help='Use the system python during compileall if possible.')
|
||||
ap.add_argument('--no-compile-pyo', dest='no_compile_pyo', action='store_true',
|
||||
help='Do not optimise .py files to .pyo.')
|
||||
ap.add_argument('--sign', action='store_true',
|
||||
help=('Try to sign the APK with your credentials. You must set '
|
||||
'the appropriate environment variables.'))
|
||||
ap.add_argument('--add-activity', dest='add_activity', action='append',
|
||||
help='Add this Java class as an Activity to the manifest.')
|
||||
ap.add_argument('--activity-launch-mode',
|
||||
dest='activity_launch_mode',
|
||||
default='singleTask',
|
||||
help='Set the launch mode of the main activity in the manifest.')
|
||||
ap.add_argument('--allow-backup', dest='allow_backup', default='true',
|
||||
help="if set to 'false', then android won't backup the application.")
|
||||
ap.add_argument('--no-optimize-python', dest='optimize_python',
|
||||
action='store_false', default=True,
|
||||
help=('Whether to compile to optimised .pyo files, using -OO '
|
||||
'(strips docstrings and asserts)'))
|
||||
|
||||
# Put together arguments, and add those from .p4a config file:
|
||||
if args is None:
|
||||
args = sys.argv[1:]
|
||||
|
||||
def _read_configuration():
|
||||
if not exists(".p4a"):
|
||||
return
|
||||
print("Reading .p4a configuration")
|
||||
with open(".p4a") as fd:
|
||||
lines = fd.readlines()
|
||||
lines = [shlex.split(line)
|
||||
for line in lines if not line.startswith("#")]
|
||||
for line in lines:
|
||||
for arg in line:
|
||||
args.append(arg)
|
||||
_read_configuration()
|
||||
|
||||
args = ap.parse_args(args)
|
||||
args.ignore_path = []
|
||||
|
||||
if args.name and args.name[0] == '"' and args.name[-1] == '"':
|
||||
args.name = args.name[1:-1]
|
||||
|
||||
if ndk_api != args.min_sdk_version:
|
||||
print(('WARNING: --minsdk argument does not match the api that is '
|
||||
'compiled against. Only proceed if you know what you are '
|
||||
'doing, otherwise use --minsdk={} or recompile against api '
|
||||
'{}').format(ndk_api, args.min_sdk_version))
|
||||
if not args.allow_minsdk_ndkapi_mismatch:
|
||||
print('You must pass --allow-minsdk-ndkapi-mismatch to build '
|
||||
'with --minsdk different to the target NDK api from the '
|
||||
'build step')
|
||||
sys.exit(1)
|
||||
else:
|
||||
print('Proceeding with --minsdk not matching build target api')
|
||||
|
||||
if args.billing_pubkey:
|
||||
print('Billing not yet supported!')
|
||||
sys.exit(1)
|
||||
|
||||
if args.sdk_version == -1:
|
||||
print('WARNING: Received a --sdk argument, but this argument is '
|
||||
'deprecated and does nothing.')
|
||||
args.sdk_version = -1 # ensure it is not used
|
||||
|
||||
if args.permissions and isinstance(args.permissions[0], list):
|
||||
args.permissions = [p for perm in args.permissions for p in perm]
|
||||
|
||||
if args.try_system_python_compile:
|
||||
# Hardcoding python2.7 is okay for now, as python3 skips the
|
||||
# compilation anyway
|
||||
if not exists('crystax_python'):
|
||||
python_executable = 'python2.7'
|
||||
try:
|
||||
subprocess.call([python_executable, '--version'])
|
||||
except (OSError, subprocess.CalledProcessError):
|
||||
pass
|
||||
else:
|
||||
PYTHON = python_executable
|
||||
|
||||
if args.no_compile_pyo:
|
||||
PYTHON = None
|
||||
BLACKLIST_PATTERNS.remove('*.py')
|
||||
|
||||
if args.blacklist:
|
||||
with open(args.blacklist) as fd:
|
||||
patterns = [x.strip() for x in fd.read().splitlines()
|
||||
if x.strip() and not x.strip().startswith('#')]
|
||||
BLACKLIST_PATTERNS += patterns
|
||||
|
||||
if args.whitelist:
|
||||
with open(args.whitelist) as fd:
|
||||
patterns = [x.strip() for x in fd.read().splitlines()
|
||||
if x.strip() and not x.strip().startswith('#')]
|
||||
WHITELIST_PATTERNS += patterns
|
||||
|
||||
if args.private is None and \
|
||||
get_bootstrap_name() == 'sdl2' and args.launcher is None:
|
||||
print('Need --private directory or ' +
|
||||
'--launcher (SDL2 bootstrap only)' +
|
||||
'to have something to launch inside the .apk!')
|
||||
sys.exit(1)
|
||||
make_package(args)
|
||||
|
||||
return args
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parse_args()
|
||||
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
#Mon Mar 09 17:19:02 CET 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
@@ -0,0 +1,90 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1 @@
|
||||
include $(call all-subdir-makefiles)
|
||||
@@ -0,0 +1 @@
|
||||
include $(call all-subdir-makefiles)
|
||||
@@ -0,0 +1,27 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := main
|
||||
|
||||
SDL_PATH := ../../SDL
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include
|
||||
|
||||
# Add your application source files here...
|
||||
LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \
|
||||
start.c
|
||||
|
||||
LOCAL_CFLAGS += -I$(PYTHON_INCLUDE_ROOT) $(EXTRA_CFLAGS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := SDL2 python_shared
|
||||
|
||||
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog $(EXTRA_LDLIBS)
|
||||
|
||||
LOCAL_LDFLAGS += -L$(PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
ifdef CRYSTAX_PYTHON_VERSION
|
||||
$(call import-module,python/$(CRYSTAX_PYTHON_VERSION))
|
||||
endif
|
||||
+224
-41
@@ -14,6 +14,16 @@
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "bootstrap_name.h"
|
||||
#ifndef BOOTSTRAP_USES_NO_SDL_HEADERS
|
||||
#include "SDL.h"
|
||||
#ifndef BOOTSTRAP_NAME_PYGAME
|
||||
#include "SDL_opengles2.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef BOOTSTRAP_NAME_PYGAME
|
||||
#include "jniwrapperstuff.h"
|
||||
#endif
|
||||
#include "android/log.h"
|
||||
|
||||
#define ENTRYPOINT_MAXLEN 128
|
||||
@@ -57,7 +67,7 @@ int dir_exists(char *filename) {
|
||||
|
||||
int file_exists(const char *filename) {
|
||||
FILE *file;
|
||||
if (file = fopen(filename, "r")) {
|
||||
if ((file = fopen(filename, "r"))) {
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
@@ -74,25 +84,79 @@ int main(int argc, char *argv[]) {
|
||||
int ret = 0;
|
||||
FILE *fd;
|
||||
|
||||
/* AND: Several filepaths are hardcoded here, these must be made
|
||||
configurable */
|
||||
/* AND: P4A uses env vars...not sure what's best */
|
||||
LOGP("Initialize Python for Android");
|
||||
LOGP("Initializing Python for Android");
|
||||
|
||||
// Set a couple of built-in environment vars:
|
||||
setenv("P4A_BOOTSTRAP", bootstrap_name, 1); // env var to identify p4a to applications
|
||||
env_argument = getenv("ANDROID_ARGUMENT");
|
||||
setenv("ANDROID_APP_PATH", env_argument, 1);
|
||||
env_entrypoint = getenv("ANDROID_ENTRYPOINT");
|
||||
env_logname = getenv("PYTHON_NAME");
|
||||
|
||||
if (!getenv("ANDROID_UNPACK")) {
|
||||
/* ANDROID_UNPACK currently isn't set in services */
|
||||
setenv("ANDROID_UNPACK", env_argument, 1);
|
||||
}
|
||||
if (env_logname == NULL) {
|
||||
env_logname = "python";
|
||||
setenv("PYTHON_NAME", "python", 1);
|
||||
}
|
||||
|
||||
// Set additional file-provided environment vars:
|
||||
LOGP("Setting additional env vars from p4a_env_vars.txt");
|
||||
char env_file_path[256];
|
||||
snprintf(env_file_path, sizeof(env_file_path),
|
||||
"%s/p4a_env_vars.txt", getenv("ANDROID_UNPACK"));
|
||||
FILE *env_file_fd = fopen(env_file_path, "r");
|
||||
if (env_file_fd) {
|
||||
char* line = NULL;
|
||||
size_t len = 0;
|
||||
while (getline(&line, &len, env_file_fd) != -1) {
|
||||
if (strlen(line) > 0) {
|
||||
char *eqsubstr = strstr(line, "=");
|
||||
if (eqsubstr) {
|
||||
size_t eq_pos = eqsubstr - line;
|
||||
|
||||
// Extract name:
|
||||
char env_name[256];
|
||||
strncpy(env_name, line, sizeof(env_name));
|
||||
env_name[eq_pos] = '\0';
|
||||
|
||||
// Extract value (with line break removed:
|
||||
char env_value[256];
|
||||
strncpy(env_value, (char*)(line + eq_pos + 1), sizeof(env_value));
|
||||
if (strlen(env_value) > 0 &&
|
||||
env_value[strlen(env_value)-1] == '\n') {
|
||||
env_value[strlen(env_value)-1] = '\0';
|
||||
if (strlen(env_value) > 0 &&
|
||||
env_value[strlen(env_value)-1] == '\r') {
|
||||
// Also remove windows line breaks (\r\n)
|
||||
env_value[strlen(env_value)-1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
// Set value:
|
||||
setenv(env_name, env_value, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(env_file_fd);
|
||||
} else {
|
||||
LOGP("Warning: no p4a_env_vars.txt found / failed to open!");
|
||||
}
|
||||
|
||||
LOGP("Changing directory to the one provided by ANDROID_ARGUMENT");
|
||||
LOGP(env_argument);
|
||||
chdir(env_argument);
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
Py_NoSiteFlag=1;
|
||||
#endif
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
Py_SetProgramName("android_python");
|
||||
#else
|
||||
Py_SetProgramName(L"android_python");
|
||||
#endif
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
/* our logging module for android
|
||||
@@ -102,34 +166,55 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
LOGP("Preparing to initialize python");
|
||||
|
||||
if (dir_exists("crystax_python/")) {
|
||||
LOGP("crystax_python exists");
|
||||
char paths[256];
|
||||
snprintf(paths, 256,
|
||||
"%s/crystax_python/stdlib.zip:%s/crystax_python/modules",
|
||||
env_argument, env_argument);
|
||||
/* snprintf(paths, 256, "%s/stdlib.zip:%s/modules", env_argument,
|
||||
* env_argument); */
|
||||
// Set up the python path
|
||||
char paths[256];
|
||||
|
||||
char crystax_python_dir[256];
|
||||
snprintf(crystax_python_dir, 256,
|
||||
"%s/crystax_python", getenv("ANDROID_UNPACK"));
|
||||
char python_bundle_dir[256];
|
||||
snprintf(python_bundle_dir, 256,
|
||||
"%s/_python_bundle", getenv("ANDROID_UNPACK"));
|
||||
if (dir_exists(crystax_python_dir) || dir_exists(python_bundle_dir)) {
|
||||
if (dir_exists(crystax_python_dir)) {
|
||||
LOGP("crystax_python exists");
|
||||
snprintf(paths, 256,
|
||||
"%s/stdlib.zip:%s/modules",
|
||||
crystax_python_dir, crystax_python_dir);
|
||||
}
|
||||
|
||||
if (dir_exists(python_bundle_dir)) {
|
||||
LOGP("_python_bundle dir exists");
|
||||
snprintf(paths, 256,
|
||||
"%s/stdlib.zip:%s/modules",
|
||||
python_bundle_dir, python_bundle_dir);
|
||||
}
|
||||
|
||||
LOGP("calculated paths to be...");
|
||||
LOGP(paths);
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
wchar_t *wchar_paths = Py_DecodeLocale(paths, NULL);
|
||||
Py_SetPath(wchar_paths);
|
||||
#else
|
||||
char *wchar_paths = paths;
|
||||
LOGP("Can't Py_SetPath in python2, so crystax python2 doesn't work yet");
|
||||
exit(1);
|
||||
#endif
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
wchar_t *wchar_paths = Py_DecodeLocale(paths, NULL);
|
||||
Py_SetPath(wchar_paths);
|
||||
#endif
|
||||
|
||||
LOGP("set wchar paths...");
|
||||
LOGP("set wchar paths...");
|
||||
} else {
|
||||
LOGP("crystax_python does not exist");
|
||||
// We do not expect to see crystax_python any more, so no point
|
||||
// reminding the user about it. If it does exist, we'll have
|
||||
// logged it earlier.
|
||||
LOGP("_python_bundle does not exist");
|
||||
}
|
||||
|
||||
Py_Initialize();
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
// Can't Py_SetPath in python2 but we can set PySys_SetPath, which must
|
||||
// be applied after Py_Initialize rather than before like Py_SetPath
|
||||
#if PY_MICRO_VERSION >= 15
|
||||
// Only for python native-build
|
||||
PySys_SetPath(paths);
|
||||
#endif
|
||||
PySys_SetArgv(argc, argv);
|
||||
#endif
|
||||
|
||||
@@ -152,8 +237,10 @@ int main(int argc, char *argv[]) {
|
||||
*/
|
||||
PyRun_SimpleString("import sys, posix\n");
|
||||
if (dir_exists("lib")) {
|
||||
/* If we built our own python, set up the paths correctly */
|
||||
LOGP("Setting up python from ANDROID_PRIVATE");
|
||||
/* If we built our own python, set up the paths correctly.
|
||||
* This is only the case if we are using the python2legacy recipe
|
||||
*/
|
||||
LOGP("Setting up python from ANDROID_APP_PATH");
|
||||
PyRun_SimpleString("private = posix.environ['ANDROID_APP_PATH']\n"
|
||||
"argument = posix.environ['ANDROID_ARGUMENT']\n"
|
||||
"sys.path[:] = [ \n"
|
||||
@@ -164,11 +251,24 @@ int main(int argc, char *argv[]) {
|
||||
" argument ]\n");
|
||||
}
|
||||
|
||||
if (dir_exists("crystax_python")) {
|
||||
char add_site_packages_dir[256];
|
||||
char add_site_packages_dir[256];
|
||||
if (dir_exists(crystax_python_dir)) {
|
||||
snprintf(add_site_packages_dir, 256,
|
||||
"sys.path.append('%s/crystax_python/site-packages')",
|
||||
env_argument);
|
||||
"sys.path.append('%s/site-packages')",
|
||||
crystax_python_dir);
|
||||
|
||||
PyRun_SimpleString("import sys\n"
|
||||
"sys.argv = ['notaninterpreterreally']\n"
|
||||
"from os.path import realpath, join, dirname");
|
||||
PyRun_SimpleString(add_site_packages_dir);
|
||||
/* "sys.path.append(join(dirname(realpath(__file__)), 'site-packages'))") */
|
||||
PyRun_SimpleString("sys.path = ['.'] + sys.path");
|
||||
}
|
||||
|
||||
if (dir_exists(python_bundle_dir)) {
|
||||
snprintf(add_site_packages_dir, 256,
|
||||
"sys.path.append('%s/site-packages')",
|
||||
python_bundle_dir);
|
||||
|
||||
PyRun_SimpleString("import sys\n"
|
||||
"sys.argv = ['notaninterpreterreally']\n"
|
||||
@@ -209,6 +309,11 @@ int main(int argc, char *argv[]) {
|
||||
/* Get the entrypoint, search the .pyo then .py
|
||||
*/
|
||||
char *dot = strrchr(env_entrypoint, '.');
|
||||
#if PY_MAJOR_VERSION > 2
|
||||
char *ext = ".pyc";
|
||||
#else
|
||||
char *ext = ".pyo";
|
||||
#endif
|
||||
if (dot <= 0) {
|
||||
LOGP("Invalid entrypoint, abort.");
|
||||
return -1;
|
||||
@@ -217,14 +322,14 @@ int main(int argc, char *argv[]) {
|
||||
LOGP("Entrypoint path is too long, try increasing ENTRYPOINT_MAXLEN.");
|
||||
return -1;
|
||||
}
|
||||
if (!strcmp(dot, ".pyo")) {
|
||||
if (!strcmp(dot, ext)) {
|
||||
if (!file_exists(env_entrypoint)) {
|
||||
/* fallback on .py */
|
||||
strcpy(entrypoint, env_entrypoint);
|
||||
entrypoint[strlen(env_entrypoint) - 1] = '\0';
|
||||
LOGP(entrypoint);
|
||||
if (!file_exists(entrypoint)) {
|
||||
LOGP("Entrypoint not found (.pyo, fallback on .py), abort");
|
||||
LOGP("Entrypoint not found (.pyc/.pyo, fallback on .py), abort");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@@ -234,7 +339,11 @@ int main(int argc, char *argv[]) {
|
||||
/* if .py is passed, check the pyo version first */
|
||||
strcpy(entrypoint, env_entrypoint);
|
||||
entrypoint[strlen(env_entrypoint) + 1] = '\0';
|
||||
#if PY_MAJOR_VERSION > 2
|
||||
entrypoint[strlen(env_entrypoint)] = 'c';
|
||||
#else
|
||||
entrypoint[strlen(env_entrypoint)] = 'o';
|
||||
#endif
|
||||
if (!file_exists(entrypoint)) {
|
||||
/* fallback on pure python version */
|
||||
if (!file_exists(env_entrypoint)) {
|
||||
@@ -244,7 +353,7 @@ int main(int argc, char *argv[]) {
|
||||
strcpy(entrypoint, env_entrypoint);
|
||||
}
|
||||
} else {
|
||||
LOGP("Entrypoint have an invalid extension (must be .py or .pyo), abort.");
|
||||
LOGP("Entrypoint have an invalid extension (must be .py or .pyc/.pyo), abort.");
|
||||
return -1;
|
||||
}
|
||||
// LOGP("Entrypoint is:");
|
||||
@@ -259,6 +368,7 @@ int main(int argc, char *argv[]) {
|
||||
/* run python !
|
||||
*/
|
||||
ret = PyRun_SimpleFile(fd, entrypoint);
|
||||
fclose(fd);
|
||||
|
||||
if (PyErr_Occurred() != NULL) {
|
||||
ret = 1;
|
||||
@@ -269,19 +379,48 @@ int main(int argc, char *argv[]) {
|
||||
PyErr_Clear();
|
||||
}
|
||||
|
||||
/* close everything
|
||||
*/
|
||||
Py_Finalize();
|
||||
fclose(fd);
|
||||
|
||||
LOGP("Python for android ended.");
|
||||
|
||||
/* Shut down: since regular shutdown causes issues sometimes
|
||||
(seems to be an incomplete shutdown breaking next launch)
|
||||
we'll use sys.exit(ret) to shutdown, since that one works.
|
||||
|
||||
Reference discussion:
|
||||
|
||||
https://github.com/kivy/kivy/pull/6107#issue-246120816
|
||||
*/
|
||||
char terminatecmd[256];
|
||||
snprintf(
|
||||
terminatecmd, sizeof(terminatecmd),
|
||||
"import sys; sys.exit(%d)\n", ret
|
||||
);
|
||||
PyRun_SimpleString(terminatecmd);
|
||||
|
||||
/* This should never actually be reached, but we'll leave the clean-up
|
||||
* here just to be safe.
|
||||
*/
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
Py_Finalize();
|
||||
LOGP("Unexpectedly reached Py_FinalizeEx(), but was successful.");
|
||||
#else
|
||||
if (Py_FinalizeEx() != 0) // properly check success on Python 3
|
||||
LOGP("Unexpectedly reached Py_FinalizeEx(), and got error!");
|
||||
else
|
||||
LOGP("Unexpectedly reached Py_FinalizeEx(), but was successful.");
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_kivy_android_PythonService_nativeStart(
|
||||
JNIEnv *env, jobject thiz, jstring j_android_private,
|
||||
jstring j_android_argument, jstring j_service_entrypoint,
|
||||
jstring j_python_name, jstring j_python_home, jstring j_python_path,
|
||||
JNIEnv *env,
|
||||
jobject thiz,
|
||||
jstring j_android_private,
|
||||
jstring j_android_argument,
|
||||
jstring j_service_entrypoint,
|
||||
jstring j_python_name,
|
||||
jstring j_python_home,
|
||||
jstring j_python_path,
|
||||
jstring j_arg) {
|
||||
jboolean iscopy;
|
||||
const char *android_private =
|
||||
@@ -307,6 +446,7 @@ JNIEXPORT void JNICALL Java_org_kivy_android_PythonService_nativeStart(
|
||||
setenv("PYTHONHOME", python_home, 1);
|
||||
setenv("PYTHONPATH", python_path, 1);
|
||||
setenv("PYTHON_SERVICE_ARGUMENT", arg, 1);
|
||||
setenv("P4A_BOOTSTRAP", bootstrap_name, 1);
|
||||
|
||||
char *argv[] = {"."};
|
||||
/* ANDROID_ARGUMENT points to service subdir,
|
||||
@@ -315,4 +455,47 @@ JNIEXPORT void JNICALL Java_org_kivy_android_PythonService_nativeStart(
|
||||
main(1, argv);
|
||||
}
|
||||
|
||||
#if defined(BOOTSTRAP_NAME_WEBVIEW) || defined(BOOTSTRAP_NAME_SERVICEONLY)
|
||||
// Webview and service_only uses some more functions:
|
||||
|
||||
void Java_org_kivy_android_PythonActivity_nativeSetenv(
|
||||
JNIEnv* env, jclass cls,
|
||||
jstring name, jstring value)
|
||||
//JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
|
||||
// JNIEnv* env, jclass cls,
|
||||
// jstring name, jstring value)
|
||||
{
|
||||
const char *utfname = (*env)->GetStringUTFChars(env, name, NULL);
|
||||
const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL);
|
||||
|
||||
setenv(utfname, utfvalue, 1);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, name, utfname);
|
||||
(*env)->ReleaseStringUTFChars(env, value, utfvalue);
|
||||
}
|
||||
|
||||
|
||||
void Java_org_kivy_android_PythonActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
|
||||
{
|
||||
/* This nativeInit follows SDL2 */
|
||||
|
||||
/* This interface could expand with ABI negotiation, calbacks, etc. */
|
||||
/* SDL_Android_Init(env, cls); */
|
||||
|
||||
/* SDL_SetMainReady(); */
|
||||
|
||||
/* Run the application code! */
|
||||
int status;
|
||||
char *argv[2];
|
||||
argv[0] = "Python_app";
|
||||
argv[1] = NULL;
|
||||
/* status = SDL_main(1, argv); */
|
||||
|
||||
main(1, argv);
|
||||
|
||||
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
||||
/* exit(status); */
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
package org.kivy.android;
|
||||
|
||||
import android.os.Build;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import android.app.Service;
|
||||
import android.os.IBinder;
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Process;
|
||||
import java.io.File;
|
||||
|
||||
import org.kivy.android.PythonUtil;
|
||||
|
||||
import org.renpy.android.Hardware;
|
||||
|
||||
|
||||
public class PythonService extends Service implements Runnable {
|
||||
|
||||
// Thread for Python code
|
||||
private Thread pythonThread = null;
|
||||
|
||||
// Python environment variables
|
||||
private String androidPrivate;
|
||||
private String androidArgument;
|
||||
private String pythonName;
|
||||
private String pythonHome;
|
||||
private String pythonPath;
|
||||
private String serviceEntrypoint;
|
||||
// Argument to pass to Python code,
|
||||
private String pythonServiceArgument;
|
||||
public static PythonService mService = null;
|
||||
private Intent startIntent = null;
|
||||
|
||||
private boolean autoRestartService = false;
|
||||
|
||||
public void setAutoRestartService(boolean restart) {
|
||||
autoRestartService = restart;
|
||||
}
|
||||
|
||||
public boolean canDisplayNotification() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int startType() {
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
if (pythonThread != null) {
|
||||
Log.v("python service", "service exists, do not start again");
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
startIntent = intent;
|
||||
Bundle extras = intent.getExtras();
|
||||
androidPrivate = extras.getString("androidPrivate");
|
||||
androidArgument = extras.getString("androidArgument");
|
||||
serviceEntrypoint = extras.getString("serviceEntrypoint");
|
||||
pythonName = extras.getString("pythonName");
|
||||
pythonHome = extras.getString("pythonHome");
|
||||
pythonPath = extras.getString("pythonPath");
|
||||
pythonServiceArgument = extras.getString("pythonServiceArgument");
|
||||
|
||||
pythonThread = new Thread(this);
|
||||
pythonThread.start();
|
||||
|
||||
if (canDisplayNotification()) {
|
||||
doStartForeground(extras);
|
||||
}
|
||||
|
||||
return startType();
|
||||
}
|
||||
|
||||
protected void doStartForeground(Bundle extras) {
|
||||
String serviceTitle = extras.getString("serviceTitle");
|
||||
String serviceDescription = extras.getString("serviceDescription");
|
||||
|
||||
Notification notification;
|
||||
Context context = getApplicationContext();
|
||||
Intent contextIntent = new Intent(context, PythonActivity.class);
|
||||
PendingIntent pIntent = PendingIntent.getActivity(context, 0, contextIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
notification = new Notification(
|
||||
context.getApplicationInfo().icon, serviceTitle, System.currentTimeMillis());
|
||||
try {
|
||||
// prevent using NotificationCompat, this saves 100kb on apk
|
||||
Method func = notification.getClass().getMethod(
|
||||
"setLatestEventInfo", Context.class, CharSequence.class,
|
||||
CharSequence.class, PendingIntent.class);
|
||||
func.invoke(notification, context, serviceTitle, serviceDescription, pIntent);
|
||||
} catch (NoSuchMethodException | IllegalAccessException |
|
||||
IllegalArgumentException | InvocationTargetException e) {
|
||||
}
|
||||
} else {
|
||||
Notification.Builder builder = new Notification.Builder(context);
|
||||
builder.setContentTitle(serviceTitle);
|
||||
builder.setContentText(serviceDescription);
|
||||
builder.setContentIntent(pIntent);
|
||||
builder.setSmallIcon(context.getApplicationInfo().icon);
|
||||
notification = builder.build();
|
||||
}
|
||||
startForeground(1, notification);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
pythonThread = null;
|
||||
if (autoRestartService && startIntent != null) {
|
||||
Log.v("python service", "service restart requested");
|
||||
startService(startIntent);
|
||||
}
|
||||
Process.killProcess(Process.myPid());
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the task gracefully when killed.
|
||||
* Calling stopSelf() will trigger a onDestroy() call from the system.
|
||||
*/
|
||||
@Override
|
||||
public void onTaskRemoved(Intent rootIntent) {
|
||||
super.onTaskRemoved(rootIntent);
|
||||
stopSelf();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(){
|
||||
String app_root = getFilesDir().getAbsolutePath() + "/app";
|
||||
File app_root_file = new File(app_root);
|
||||
PythonUtil.loadLibraries(app_root_file,
|
||||
new File(getApplicationInfo().nativeLibraryDir));
|
||||
this.mService = this;
|
||||
nativeStart(
|
||||
androidPrivate, androidArgument,
|
||||
serviceEntrypoint, pythonName,
|
||||
pythonHome, pythonPath,
|
||||
pythonServiceArgument);
|
||||
stopSelf();
|
||||
}
|
||||
|
||||
// Native part
|
||||
public static native void nativeStart(
|
||||
String androidPrivate, String androidArgument,
|
||||
String serviceEntrypoint, String pythonName,
|
||||
String pythonHome, String pythonPath,
|
||||
String pythonServiceArgument);
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package org.kivy.android;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public class PythonUtil {
|
||||
private static final String TAG = "pythonutil";
|
||||
|
||||
protected static void addLibraryIfExists(ArrayList<String> libsList, String pattern, File libsDir) {
|
||||
// pattern should be the name of the lib file, without the
|
||||
// preceding "lib" or suffix ".so", for instance "ssl.*" will
|
||||
// match files of the form "libssl.*.so".
|
||||
File [] files = libsDir.listFiles();
|
||||
|
||||
pattern = "lib" + pattern + "\\.so";
|
||||
Pattern p = Pattern.compile(pattern);
|
||||
for (int i = 0; i < files.length; ++i) {
|
||||
File file = files[i];
|
||||
String name = file.getName();
|
||||
Log.v(TAG, "Checking pattern " + pattern + " against " + name);
|
||||
if (p.matcher(name).matches()) {
|
||||
Log.v(TAG, "Pattern " + pattern + " matched file " + name);
|
||||
libsList.add(name.substring(3, name.length() - 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static ArrayList<String> getLibraries(File libsDir) {
|
||||
ArrayList<String> libsList = new ArrayList<String>();
|
||||
addLibraryIfExists(libsList, "crystax", libsDir);
|
||||
addLibraryIfExists(libsList, "sqlite3", libsDir);
|
||||
addLibraryIfExists(libsList, "ffi", libsDir);
|
||||
addLibraryIfExists(libsList, "ssl.*", libsDir);
|
||||
addLibraryIfExists(libsList, "crypto.*", libsDir);
|
||||
libsList.add("python2.7");
|
||||
libsList.add("python3.5m");
|
||||
libsList.add("python3.6m");
|
||||
libsList.add("python3.7m");
|
||||
libsList.add("main");
|
||||
return libsList;
|
||||
}
|
||||
|
||||
public static void loadLibraries(File filesDir, File libsDir) {
|
||||
String filesDirPath = filesDir.getAbsolutePath();
|
||||
boolean foundPython = false;
|
||||
|
||||
for (String lib : getLibraries(libsDir)) {
|
||||
Log.v(TAG, "Loading library: " + lib);
|
||||
try {
|
||||
System.loadLibrary(lib);
|
||||
if (lib.startsWith("python")) {
|
||||
foundPython = true;
|
||||
}
|
||||
} catch(UnsatisfiedLinkError e) {
|
||||
// If this is the last possible libpython
|
||||
// load, and it has failed, give a more
|
||||
// general error
|
||||
Log.v(TAG, "Library loading error: " + e.getMessage());
|
||||
if (lib.startsWith("python3.7") && !foundPython) {
|
||||
throw new java.lang.RuntimeException("Could not load any libpythonXXX.so");
|
||||
} else if (lib.startsWith("python")) {
|
||||
continue;
|
||||
} else {
|
||||
Log.v(TAG, "An UnsatisfiedLinkError occurred loading " + lib);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log.v(TAG, "Loaded everything!");
|
||||
}
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
// This string is autogenerated by ChangeAppSettings.sh, do not change
|
||||
// spaces amount
|
||||
package org.renpy.android;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.File;
|
||||
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
|
||||
import org.kamranzafar.jtar.*;
|
||||
|
||||
public class AssetExtract {
|
||||
|
||||
private AssetManager mAssetManager = null;
|
||||
private Activity mActivity = null;
|
||||
|
||||
public AssetExtract(Activity act) {
|
||||
mActivity = act;
|
||||
mAssetManager = act.getAssets();
|
||||
}
|
||||
|
||||
public boolean extractTar(String asset, String target) {
|
||||
|
||||
byte buf[] = new byte[1024 * 1024];
|
||||
|
||||
InputStream assetStream = null;
|
||||
TarInputStream tis = null;
|
||||
|
||||
try {
|
||||
assetStream = mAssetManager.open(asset, AssetManager.ACCESS_STREAMING);
|
||||
tis = new TarInputStream(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(assetStream, 8192)), 8192));
|
||||
} catch (IOException e) {
|
||||
Log.e("python", "opening up extract tar", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
TarEntry entry = null;
|
||||
|
||||
try {
|
||||
entry = tis.getNextEntry();
|
||||
} catch ( java.io.IOException e ) {
|
||||
Log.e("python", "extracting tar", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( entry == null ) {
|
||||
break;
|
||||
}
|
||||
|
||||
Log.v("python", "extracting " + entry.getName());
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
|
||||
try {
|
||||
new File(target +"/" + entry.getName()).mkdirs();
|
||||
} catch ( SecurityException e ) { };
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
OutputStream out = null;
|
||||
String path = target + "/" + entry.getName();
|
||||
|
||||
try {
|
||||
out = new BufferedOutputStream(new FileOutputStream(path), 8192);
|
||||
} catch ( FileNotFoundException e ) {
|
||||
} catch ( SecurityException e ) { };
|
||||
|
||||
if ( out == null ) {
|
||||
Log.e("python", "could not open " + path);
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
int len = tis.read(buf);
|
||||
|
||||
if (len == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch ( java.io.IOException e ) {
|
||||
Log.e("python", "extracting zip", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
tis.close();
|
||||
assetStream.close();
|
||||
} catch (IOException e) {
|
||||
// pass
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* This class takes care of managing resources for us. In our code, we
|
||||
* can't use R, since the name of the package containing R will
|
||||
* change. (This same code is used in both org.renpy.android and
|
||||
* org.renpy.pygame.) So this is the next best thing.
|
||||
*/
|
||||
|
||||
package org.renpy.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.Resources;
|
||||
import android.view.View;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class ResourceManager {
|
||||
|
||||
private Activity act;
|
||||
private Resources res;
|
||||
|
||||
public ResourceManager(Activity activity) {
|
||||
act = activity;
|
||||
res = act.getResources();
|
||||
}
|
||||
|
||||
public int getIdentifier(String name, String kind) {
|
||||
Log.v("SDL", "getting identifier");
|
||||
Log.v("SDL", "kind is " + kind + " and name " + name);
|
||||
Log.v("SDL", "result is " + res.getIdentifier(name, kind, act.getPackageName()));
|
||||
return res.getIdentifier(name, kind, act.getPackageName());
|
||||
}
|
||||
|
||||
public String getString(String name) {
|
||||
|
||||
try {
|
||||
Log.v("SDL", "asked to get string " + name);
|
||||
return res.getString(getIdentifier(name, "string"));
|
||||
} catch (Exception e) {
|
||||
Log.v("SDL", "got exception looking for string!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public View inflateView(String name) {
|
||||
int id = getIdentifier(name, "layout");
|
||||
return act.getLayoutInflater().inflate(id, null);
|
||||
}
|
||||
|
||||
public View getViewById(View v, String name) {
|
||||
int id = getIdentifier(name, "id");
|
||||
return v.findViewById(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package {{ args.package }};
|
||||
|
||||
import android.os.Build;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Bundle;
|
||||
import org.kivy.android.PythonService;
|
||||
import org.kivy.android.PythonActivity;
|
||||
|
||||
|
||||
public class Service{{ name|capitalize }} extends PythonService {
|
||||
{% if sticky %}
|
||||
@Override
|
||||
public int startType() {
|
||||
return START_STICKY;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
{% if not foreground %}
|
||||
@Override
|
||||
public boolean canDisplayNotification() {
|
||||
return false;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
@Override
|
||||
protected void doStartForeground(Bundle extras) {
|
||||
Notification notification;
|
||||
Context context = getApplicationContext();
|
||||
Intent contextIntent = new Intent(context, PythonActivity.class);
|
||||
PendingIntent pIntent = PendingIntent.getActivity(context, 0, contextIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
notification = new Notification(
|
||||
context.getApplicationInfo().icon, "{{ args.name }}", System.currentTimeMillis());
|
||||
try {
|
||||
// prevent using NotificationCompat, this saves 100kb on apk
|
||||
Method func = notification.getClass().getMethod(
|
||||
"setLatestEventInfo", Context.class, CharSequence.class,
|
||||
CharSequence.class, PendingIntent.class);
|
||||
func.invoke(notification, context, "{{ args.name }}", "{{ name| capitalize }}", pIntent);
|
||||
} catch (NoSuchMethodException | IllegalAccessException |
|
||||
IllegalArgumentException | InvocationTargetException e) {
|
||||
}
|
||||
} else {
|
||||
Notification.Builder builder = new Notification.Builder(context);
|
||||
builder.setContentTitle("{{ args.name }}");
|
||||
builder.setContentText("{{ name| capitalize }}");
|
||||
builder.setContentIntent(pIntent);
|
||||
builder.setSmallIcon(context.getApplicationInfo().icon);
|
||||
notification = builder.build();
|
||||
}
|
||||
startForeground({{ service_id }}, notification);
|
||||
}
|
||||
|
||||
static public void start(Context ctx, String pythonServiceArgument) {
|
||||
Intent intent = new Intent(ctx, Service{{ name|capitalize }}.class);
|
||||
String argument = ctx.getFilesDir().getAbsolutePath() + "/app";
|
||||
intent.putExtra("androidPrivate", ctx.getFilesDir().getAbsolutePath());
|
||||
intent.putExtra("androidArgument", argument);
|
||||
intent.putExtra("serviceEntrypoint", "{{ entrypoint }}");
|
||||
intent.putExtra("pythonName", "{{ name }}");
|
||||
intent.putExtra("pythonHome", argument);
|
||||
intent.putExtra("pythonPath", argument + ":" + argument + "/lib");
|
||||
intent.putExtra("pythonServiceArgument", pythonServiceArgument);
|
||||
ctx.startService(intent);
|
||||
}
|
||||
|
||||
static public void stop(Context ctx) {
|
||||
Intent intent = new Intent(ctx, Service{{ name|capitalize }}.class);
|
||||
ctx.stopService(intent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked in Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
key.store=${env.P4A_RELEASE_KEYSTORE}
|
||||
key.alias=${env.P4A_RELEASE_KEYALIAS}
|
||||
key.store.password=${env.P4A_RELEASE_KEYSTORE_PASSWD}
|
||||
key.alias.password=${env.P4A_RELEASE_KEYALIAS_PASSWD}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.4'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion {{ android_api }}
|
||||
buildToolsVersion '{{ build_tools_version }}'
|
||||
defaultConfig {
|
||||
minSdkVersion {{ args.min_sdk_version }}
|
||||
targetSdkVersion {{ android_api }}
|
||||
versionCode {{ args.numeric_version }}
|
||||
versionName '{{ args.version }}'
|
||||
}
|
||||
|
||||
{% if args.sign -%}
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(System.getenv("P4A_RELEASE_KEYSTORE"))
|
||||
keyAlias System.getenv("P4A_RELEASE_KEYALIAS")
|
||||
storePassword System.getenv("P4A_RELEASE_KEYSTORE_PASSWD")
|
||||
keyPassword System.getenv("P4A_RELEASE_KEYALIAS_PASSWD")
|
||||
}
|
||||
}
|
||||
{%- endif %}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
}
|
||||
release {
|
||||
{% if args.sign -%}
|
||||
signingConfig signingConfigs.release
|
||||
{%- endif %}
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
jniLibs.srcDir 'libs'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
{%- for aar in aars %}
|
||||
compile(name: '{{ aar }}', ext: 'aar')
|
||||
{%- endfor -%}
|
||||
{%- for jar in jars %}
|
||||
compile files('src/main/libs/{{ jar }}')
|
||||
{%- endfor -%}
|
||||
{%- if args.depends -%}
|
||||
{%- for depend in args.depends %}
|
||||
compile '{{ depend }}'
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This should be changed to the name of your project -->
|
||||
<project name="{{ versioned_name }}" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<property file="build.properties" />
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="CustomRules">
|
||||
<target name="-pre-build">
|
||||
<copy todir="tmp-src">
|
||||
{% if args.launcher %}
|
||||
<fileset dir="src/main/java" includes="**" />
|
||||
{% else %}
|
||||
<fileset dir="src/main/java">
|
||||
<exclude name="org/kivy/android/ProjectAdapter.java" />
|
||||
<exclude name="org/kivy/android/ProjectChooser.java" />
|
||||
</fileset>
|
||||
{% endif %}
|
||||
{% for dir, includes in args.extra_source_dirs %}
|
||||
<fileset dir="{{ dir }}" includes="{{ includes }}" />
|
||||
{% endfor %}
|
||||
</copy>
|
||||
</target>
|
||||
<target name="-post-build">
|
||||
<delete dir="tmp-src" />
|
||||
</target>
|
||||
</project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1 @@
|
||||
# put files here that you need to un-blacklist
|
||||
@@ -371,7 +371,7 @@ main.py that loads it.''')
|
||||
args=args,
|
||||
url_scheme=url_scheme,
|
||||
private_version=str(time.time()))
|
||||
|
||||
|
||||
# add colors.xml
|
||||
render(
|
||||
'colors.tmpl.xml',
|
||||
@@ -380,6 +380,14 @@ main.py that loads it.''')
|
||||
url_scheme=url_scheme,
|
||||
)
|
||||
|
||||
# add themes.xml
|
||||
render(
|
||||
'themes.tmpl.xml',
|
||||
'src/main/res/values/themes.xml',
|
||||
args=args,
|
||||
url_scheme=url_scheme,
|
||||
)
|
||||
|
||||
# add activity_service_control
|
||||
render(
|
||||
'activity_service_control.xml',
|
||||
@@ -396,12 +404,12 @@ main.py that loads it.''')
|
||||
aars=aars,
|
||||
android_api=android_api,
|
||||
build_tools_version=build_tools_version)
|
||||
|
||||
render(
|
||||
'settings.tmpl.gradle',
|
||||
'settings.gradle'
|
||||
)
|
||||
|
||||
|
||||
render('settings.gradle', 'settings.gradle')
|
||||
|
||||
## google-services.json for firebase
|
||||
render('google-services.json', 'google-services.json')
|
||||
|
||||
# copy icon drawables
|
||||
for folder in ('drawable-hdpi', 'drawable-mdpi', 'drawable-xhdpi', 'drawable-xxhdpi', 'drawable-xxxhdpi'):
|
||||
shutil.copy(
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
|
||||
+2
-2
@@ -7,13 +7,13 @@ LOCAL_MODULE := main
|
||||
# Add your application source files here...
|
||||
LOCAL_SRC_FILES := start.c pyjniusjni.c
|
||||
|
||||
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/include/python2.7 $(EXTRA_CFLAGS)
|
||||
LOCAL_CFLAGS += -I$(PYTHON_INCLUDE_ROOT) $(EXTRA_CFLAGS)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := python_shared
|
||||
|
||||
LOCAL_LDLIBS := -llog $(EXTRA_LDLIBS)
|
||||
|
||||
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS)
|
||||
LOCAL_LDFLAGS += -L$(PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,6 @@
|
||||
|
||||
#define BOOTSTRAP_NAME_SERVICEONLY
|
||||
#define BOOTSTRAP_USES_NO_SDL_HEADERS
|
||||
|
||||
const char bootstrap_name[] = "service_only";
|
||||
|
||||
Loaded 100 of 1128 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user