Compare commits
946 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cfdf5603af | |||
| 45bfb8c6b6 | |||
| 65608a51b8 | |||
| b6314597fe | |||
| 20a588199a | |||
| 59916f1e95 | |||
| 8b91f8f9e7 | |||
| cbc3cce66f | |||
| b4b63b5860 | |||
| b9ae15a890 | |||
| d955389c46 | |||
| 975eb885c1 | |||
| a3aed96757 | |||
| dc70bfabaf | |||
| 6932340671 | |||
| f6637b7caf | |||
| 4f4be44caa | |||
| 7832497ba7 | |||
| 7d06e2395f | |||
| 3a479d7eef | |||
| 8fe8a1e9ee | |||
| 2d8b2e7fb0 | |||
| 9c0365f92c | |||
| b48abb08d2 | |||
| d8f3e032c7 | |||
| 8dbcb255ad | |||
| db06cbbc86 | |||
| 98ab23c1a3 | |||
| d0ca9ba6a6 | |||
| b242368675 | |||
| 664527ce63 | |||
| 99e4f80be0 | |||
| 702dae9fcd | |||
| 48fe1ba559 | |||
| 382ac7ba0d | |||
| a46f47f352 | |||
| e984d8a42c | |||
| 554bad6b8d | |||
| ed13c97ad7 | |||
| d33873d59a | |||
| 1234899ea1 | |||
| 13027dc44b | |||
| 5b4d74b7fe | |||
| 18c7bc2b5b | |||
| bbbee0f372 | |||
| cf9d090154 | |||
| 718471917f | |||
| bb97407cde | |||
| 92ce678e29 | |||
| e100aea2c7 | |||
| fea3b6cb4a | |||
| afbc132faa | |||
| b27198286d | |||
| ac93d81032 | |||
| 9981e5ca76 | |||
| 7dd3efeb53 | |||
| d38d702adf | |||
| 04a000a8a8 | |||
| 3bbf0741ee | |||
| e9a336100b | |||
| fb600e9829 | |||
| 4a455ff958 | |||
| 707e238e5c | |||
| 90f22a4b66 | |||
| b4f134adf7 | |||
| 1e00fc6149 | |||
| f52133a69c | |||
| 91b142e0d9 | |||
| 26a9dd98c1 | |||
| 99e38e1d23 | |||
| a2d8a25fd9 | |||
| d86d625bcc | |||
| 18e3fb6609 | |||
| da33ba0ed5 | |||
| 66f021d01a | |||
| 40231ea45f | |||
| cd80a47c04 | |||
| 1033bd7bda | |||
| b4f60f3acb | |||
| bed3b571cc | |||
| c8dd4e5254 | |||
| 514048171b | |||
| 32e9901592 | |||
| d83f86a469 | |||
| 403d53586c | |||
| 6acae58694 | |||
| a3f9737e63 | |||
| 263af7c139 | |||
| 7f2439f1e9 | |||
| ae87d23003 | |||
| 3192cc0aac | |||
| 6102e9aa72 | |||
| f4a152b0fe | |||
| 2b11bca7dc | |||
| 07d19f38e3 | |||
| cd228c439e | |||
| 7a859c8961 | |||
| 543f38c75d | |||
| f7b150f2d2 | |||
| 11328f643f | |||
| f270a6b8c4 | |||
| 3fec23fd36 | |||
| e01838e996 | |||
| f70e41e7cd | |||
| c4ec0c9897 | |||
| 989b071a6d | |||
| c39751f9db | |||
| dbf74a2234 | |||
| 837230d72d | |||
| f544ec4126 | |||
| 79dbf85c1e | |||
| 61fe6cc961 | |||
| 70c88b68e2 | |||
| d70c33d20f | |||
| 6b2e000e61 | |||
| b9f11dafff | |||
| 9b32eaeb8a | |||
| a99c0d438e | |||
| c634c24afb | |||
| 2ddd1437cf | |||
| 9da309ca48 | |||
| cfcd451db7 | |||
| 5ab72fd1a9 | |||
| daace9bd1a | |||
| 69adcd1d69 | |||
| 0711a22188 | |||
| 3a06412cd8 | |||
| 51c82702e2 | |||
| 1b01196ec6 | |||
| 1cd6b58ece | |||
| ea8e13b1c8 | |||
| f392229393 | |||
| a299bafe89 | |||
| d2bf539504 | |||
| 903c3989b9 | |||
| 00996f0d7a | |||
| 4aded3a436 | |||
| 9acdc37729 | |||
| d4cdcbe54f | |||
| 6fa2a0f411 | |||
| 558a8e4a14 | |||
| 8947b82034 | |||
| 56551025e9 | |||
| befb4939d5 | |||
| 289f7aba63 | |||
| 28bd245b96 | |||
| c5e7300df2 | |||
| fe25d941bb | |||
| 4cda267f3b | |||
| 82ba7e2b8b | |||
| 41ebaf3938 | |||
| 090c400037 | |||
| 12b1232ac0 | |||
| 204a84c522 | |||
| 526afd539b | |||
| d708984abd | |||
| 9d39db6428 | |||
| 67a8ec0d39 | |||
| 297a7d0ef8 | |||
| 4712833853 | |||
| 11d17f7496 | |||
| 36df3f234f | |||
| 098b298646 | |||
| 2f9320989a | |||
| ec8d5defd4 | |||
| 981676c7f8 | |||
| 7c5ae57784 | |||
| fc7be87468 | |||
| e55d8007fc | |||
| 43b7aa2d52 | |||
| cd1bad0718 | |||
| 6b47618351 | |||
| b6d384120d | |||
| 1268b26c1f | |||
| f1233bfddc | |||
| 1aa3e6afea | |||
| ce21eb241a | |||
| f96fb72eb1 | |||
| 207c467c6b | |||
| 9d1d9e33ed | |||
| e4a76c0690 | |||
| 124c3e25e9 | |||
| 5cb1201903 | |||
| bb6ca80d5a | |||
| dc7c54a1f8 | |||
| 23401440bf | |||
| f8f959e05a | |||
| edbd4d2d03 | |||
| a0b4065be3 | |||
| 1b2f964f32 | |||
| eaf5280d99 | |||
| d435da980f | |||
| 8d3a91f3a4 | |||
| b80c339c5a | |||
| 34159fc9da | |||
| b509ee9ee0 | |||
| a6819448b9 | |||
| f2847f9aa5 | |||
| 8f01e5e1c3 | |||
| acb2f43620 | |||
| 62ac65e4d8 | |||
| 8f183bdcdc | |||
| 3d135d155e | |||
| 090c811391 | |||
| 2a9e8dc525 | |||
| cb0b22cf2c | |||
| 5aba3517ce | |||
| 726f665388 | |||
| e2ac55e9ac | |||
| fa5729bac6 | |||
| e714cb6423 | |||
| 35a0162d5c | |||
| 76740adc3f | |||
| 1c814141a2 | |||
| 5545daf992 | |||
| d300615d90 | |||
| 908a5260c2 | |||
| 7aac6644c3 | |||
| 3b673c07a0 | |||
| d726da822c | |||
| 7894f72b0f | |||
| 4c5822ac67 | |||
| b917cccbee | |||
| 01d2d05d8e | |||
| 4de86cb6cf | |||
| 8861ad76ed | |||
| ef86372635 | |||
| ccff7b1148 | |||
| ed0825112d | |||
| b8df90531f | |||
| f099c3591c | |||
| ed33e048ad | |||
| 7fd3bfa30c | |||
| 07a492a32c | |||
| 11fffbd79e | |||
| eff564ad88 | |||
| d3d53e6099 | |||
| 53d122ed55 | |||
| 1778c1ef7d | |||
| a510bc74e6 | |||
| a9ecdbdfec | |||
| 06ab3cf013 | |||
| 3db5da1c8d | |||
| 5937a50b6d | |||
| b4191ee5cc | |||
| c63e42715e | |||
| 26e582d806 | |||
| ee9270845a | |||
| 6cf33897c0 | |||
| 2161bbb8fa | |||
| b75088874e | |||
| 9ac1897880 | |||
| 36c43ed2fa | |||
| 8084822f16 | |||
| 959718618f | |||
| 75f3fe0cec | |||
| b800477365 | |||
| b191341c57 | |||
| 88a40be901 | |||
| 3fef58057e | |||
| b156e4a79a | |||
| 30ac264cd3 | |||
| a9b00e1cd3 | |||
| d94fc4bc13 | |||
| 40b5339ef8 | |||
| 86f0456e8c | |||
| 48a693793f | |||
| ff28d72db6 | |||
| 456857bbbd | |||
| 7f17b66a6c | |||
| 310ec8f296 | |||
| 0c2afa9438 | |||
| c3832cf8b1 | |||
| a2de8a2a05 | |||
| 3b601896d2 | |||
| e1a90bcb00 | |||
| 2b65916344 | |||
| f149005026 | |||
| 5eb663aa1b | |||
| 12b7d6c0e3 | |||
| 723639d928 | |||
| e0502c24e1 | |||
| 358d6333c3 | |||
| 0b279d1df3 | |||
| 8e0fba7992 | |||
| d5419ec9fa | |||
| 33e3f78be6 | |||
| 3c5ad519dd | |||
| 17c5b858b5 | |||
| f6f6496c9c | |||
| b1d725e23a | |||
| a74622997e | |||
| b1a200001e | |||
| 3b1041fa1f | |||
| a83ccc18bb | |||
| 618b1b5ace | |||
| 14858adc88 | |||
| c07f35f3aa | |||
| 87eab27996 | |||
| b7296a4fe3 | |||
| 3fb9ae1fb4 | |||
| 9705939489 | |||
| eca67b1204 | |||
| c59fc3581a | |||
| e00f8c94ff | |||
| 4186153f0c | |||
| 6c01807f4f | |||
| 9d35fb397b | |||
| c9f2f57427 | |||
| c862ab0c56 | |||
| 7aaaa57c14 | |||
| 11b6394a87 | |||
| bdd48fd2df | |||
| e99af75400 | |||
| 321440e13f | |||
| 0556d984e0 | |||
| 0ba1f66136 | |||
| 7562555687 | |||
| 668ccfcd12 | |||
| 9c0337c4ef | |||
| 3fde06ab0f | |||
| 73959f328a | |||
| cca85bfee3 | |||
| 575caa53d3 | |||
| 33874a8866 | |||
| b8e909a134 | |||
| 5193a5d309 | |||
| 7db288b9aa | |||
| 9f033e64aa | |||
| 5a15ba97dc | |||
| ce6ec72683 | |||
| eedbcdd564 | |||
| 0ca2848e01 | |||
| 208275b6a9 | |||
| 4bdcaa72cd | |||
| 8c6001fa5a | |||
| c4e88abce1 | |||
| eea7174f1d | |||
| 3f7d0688fc | |||
| 6d319618c6 | |||
| 4250fa707b | |||
| 7734cd2c8f | |||
| 57467bb338 | |||
| 8ad61a52b9 | |||
| 9742a212a2 | |||
| fd21fc1a31 | |||
| 1b5a0ab9f3 | |||
| f466fef20a | |||
| 9bc70adbbd | |||
| 6f39f9849a | |||
| 5bc950ed28 | |||
| b80d460a8f | |||
| 3f555ce5e2 | |||
| 9513b476ef | |||
| 8f9e79ae37 | |||
| 53b681ef67 | |||
| 9a8094cb8a | |||
| 00ee6d0bbd | |||
| 83f6640bd3 | |||
| 2afb939ee6 | |||
| 7c442865c5 | |||
| b3d57edb24 | |||
| 6d6e017c71 | |||
| fc6b5c1d7c | |||
| 6ecd3b59fd | |||
| 456bcf3d57 | |||
| f12a9b9ac7 | |||
| 00b6a222bd | |||
| b8ccc4453e | |||
| dbb31420af | |||
| 35f4f3f81e | |||
| acbfff89d3 | |||
| 6b37675a81 | |||
| a471ffa6d8 | |||
| 7bf090fdab | |||
| 4e0279200f | |||
| 78055e3ccb | |||
| f5e6fd6340 | |||
| 2d60d5fb1f | |||
| c6dd25a119 | |||
| 68d29d9a0f | |||
| 1d63970a25 | |||
| 2b1ffac564 | |||
| e2d3a43593 | |||
| 8e13403cca | |||
| 3c6a7b76ca | |||
| 428128651e | |||
| 326678f214 | |||
| 1f994495f8 | |||
| fb1637006d | |||
| 37a35e8f70 | |||
| 1290d0ead9 | |||
| ef0f26b64c | |||
| 485d211768 | |||
| f1ea035197 | |||
| 6f961ade74 | |||
| b8e17e0116 | |||
| 040e1fe8f6 | |||
| e9c92bdf51 | |||
| 48c33f3dcd | |||
| 6b2bc924dd | |||
| a65c4f90f4 | |||
| 04bb4b351a | |||
| e02e4d52b4 | |||
| 6f3c4434f6 | |||
| 711715ca1e | |||
| d6000af843 | |||
| 9b0954a898 | |||
| 42a2c33fd7 | |||
| a4d18a18d9 | |||
| bf32409d4e | |||
| e38aec225f | |||
| 995b7a4712 | |||
| 9fe3026941 | |||
| 520658e1b8 | |||
| f822d8eddb | |||
| 2f879ce4d6 | |||
| 24528bf101 | |||
| 822682caba | |||
| 5dc3cc65a8 | |||
| 0f80caffb5 | |||
| 6c428b2777 | |||
| c9be37b84a | |||
| 87ea2f86c0 | |||
| 7e80be5ca0 | |||
| 989a818a67 | |||
| af2e17df9e | |||
| 728ec1c16d | |||
| f859c5b1b5 | |||
| ab600d7df1 | |||
| 4644f64fd6 | |||
| c274312265 | |||
| f8e63098a2 | |||
| 264d353ec2 | |||
| 2b58dcbe7f | |||
| dc791487c5 | |||
| 5637f132d4 | |||
| 9e6cca1cd0 | |||
| 640c82d517 | |||
| 20d1a93b09 | |||
| f5d1b11bda | |||
| 66c7f8bcb2 | |||
| d8fa46c558 | |||
| 10bfc8a753 | |||
| 9848599807 | |||
| 2e38ebcfbb | |||
| f875623cd0 | |||
| e6f9cb9929 | |||
| 6aac3baa55 | |||
| a860315587 | |||
| a73a73e42c | |||
| a3358e5b21 | |||
| 7e9e2fead2 | |||
| 0269a3eb6f | |||
| f449a45912 | |||
| f69d4ccd22 | |||
| 0e2df2adbb | |||
| d46894e5db | |||
| 951a61117a | |||
| 7a038ab09d | |||
| 707a2aca0a | |||
| 624837fcf1 | |||
| e3ea36c76f | |||
| 453996c374 | |||
| 8add9ba0a6 | |||
| da11b56eab | |||
| 19377c2132 | |||
| b2bff39fe1 | |||
| 5f7075d39a | |||
| 40d9d663ec | |||
| 31f9b77c32 | |||
| 690a66a093 | |||
| e7e7d36774 | |||
| f95a37956c | |||
| 1e2a27f902 | |||
| d90e3dc210 | |||
| 5df4b56c0d | |||
| 436da1cb32 | |||
| 4d0dbbc6cd | |||
| 033bf77cbb | |||
| 1068c3ca7e | |||
| df4422369d | |||
| a62183c9e0 | |||
| de48cf8243 | |||
| acd4fc4518 | |||
| da59ed019f | |||
| e73b174d1d | |||
| 2753a22e3a | |||
| 79fc33630b | |||
| bf5331ba6e | |||
| 3be47d3e54 | |||
| f9de131017 | |||
| f1f505d41c | |||
| 51603be5ec | |||
| 2152b4a2cd | |||
| a70023a32b | |||
| 5038210d78 | |||
| 28bbfd88b2 | |||
| d05a71c8fe | |||
| 245b0a7e50 | |||
| ceb9e4aee2 | |||
| d2e94dad7e | |||
| 240b2108f3 | |||
| f68d99d16d | |||
| 44e845c875 | |||
| d8e2368a18 | |||
| 172a43679d | |||
| 82305ce2b3 | |||
| eaf73edcad | |||
| 543a4ee177 | |||
| fd2a464bae | |||
| b06152ba58 | |||
| c24d285cd3 | |||
| be39cd653e | |||
| 6813f47bc1 | |||
| 8e795c4177 | |||
| 9c96afee09 | |||
| d507be0ab0 | |||
| 75a52f801a | |||
| d3b123f3a9 | |||
| da3cdd984b | |||
| 6184e5f828 | |||
| 133bd44b85 | |||
| 0c254c9621 | |||
| 1faf196f82 | |||
| 81c7887d47 | |||
| e62e630987 | |||
| 739e38a047 | |||
| 8c23b17517 | |||
| fda8f3e1ce | |||
| 9e5f64c431 | |||
| dc689d325b | |||
| 0a883dc234 | |||
| 3824e90997 | |||
| 5158a15379 | |||
| 1bae79af5b | |||
| 58b7612987 | |||
| 9506da6dd3 | |||
| 4ea886d05a | |||
| 7a52fccfd1 | |||
| f79d308a9f | |||
| 5aa64641d2 | |||
| ae594a0400 | |||
| eeece55b45 | |||
| 9fbc50d26f | |||
| 16ebf0556a | |||
| bb104b5763 | |||
| 9bac88697b | |||
| 7ab240643e | |||
| 70d5b798b2 | |||
| 4e7a92637c | |||
| 2e19d0459b | |||
| 0970fd7040 | |||
| 81532cad95 | |||
| dcb5f7b211 | |||
| 40fd7ca332 | |||
| 7f867a6185 | |||
| 23e55ac5f7 | |||
| 455974cb05 | |||
| 66a668f55b | |||
| 7ecb50a3fe | |||
| f10d1eac61 | |||
| b92c389a5b | |||
| 9dfc57c462 | |||
| 3ea1492d67 | |||
| c041614d1f | |||
| d9c5907ea9 | |||
| 0b6a52277d | |||
| 944adb5d7c | |||
| ac4129c1e1 | |||
| 0220a88ea5 | |||
| 6d33763ec9 | |||
| 3cedadbb97 | |||
| 5a6d339a89 | |||
| 905d8a4f33 | |||
| 917d312ea0 | |||
| ddc01b539f | |||
| 38e4733433 | |||
| cbd7160e23 | |||
| f2b3acb0c9 | |||
| 49c7b5c442 | |||
| 7b7d180207 | |||
| 21cf390d0e | |||
| 5e59f77f83 | |||
| 62814490b3 | |||
| e5fedb8163 | |||
| cfc74c1080 | |||
| eaf53ad3b9 | |||
| a1f0c198a7 | |||
| 6b1e48e485 | |||
| 83ea919434 | |||
| c94e93b916 | |||
| 49d418bb39 | |||
| 23adda1817 | |||
| 7c729c2c4e | |||
| ecf7a416eb | |||
| 2f87f2bb62 | |||
| 39f4102e81 | |||
| 4fcd6b15ed | |||
| 8f9ed4bc40 | |||
| 73dedd79d2 | |||
| 2754b397d5 | |||
| 7d949ee8fd | |||
| 28e2f22550 | |||
| eaa1760511 | |||
| 53dfd3f4c0 | |||
| ed2b049ad4 | |||
| 092fb40333 | |||
| 36a4225858 | |||
| e551ea8bd9 | |||
| 5a28b1bf1c | |||
| 4cd1129c92 | |||
| a5d7bc4efc | |||
| 1ff5b2af2a | |||
| 82446ce30a | |||
| 6465248483 | |||
| 48e7f82466 | |||
| 6fef21ebc0 | |||
| 837e594607 | |||
| ab0cb55b80 | |||
| 2d24c8c525 | |||
| 40383f3733 | |||
| e14861d79d | |||
| b29b3d0432 | |||
| c21d4861c0 | |||
| a6786e5c2b | |||
| 77caa9e9d4 | |||
| 835ef02872 | |||
| 279dcb1428 | |||
| 4a8c312e0a | |||
| c2bc376f87 | |||
| 73160d4d26 | |||
| 1dd2a4e9c5 | |||
| ed0c4b8de5 | |||
| 4f921d761d | |||
| 37f85d6deb | |||
| e1b75c78ab | |||
| 5e83206e6e | |||
| 1ea6838db6 | |||
| fb82420376 | |||
| 109d67956f | |||
| 9f7b2e2cfd | |||
| 22f9bfeceb | |||
| ef4c7e96da | |||
| 02865f99a9 | |||
| ef6019f13b | |||
| 33d02bb7b8 | |||
| d34df2c1cf | |||
| 7fdf540742 | |||
| f916aabb98 | |||
| 4ae7d56db4 | |||
| e3878ffde7 | |||
| 5221b6fb43 | |||
| 5e0fe86858 | |||
| c86ced0911 | |||
| 0aad82d3d7 | |||
| ce86adab82 | |||
| b543f727be | |||
| 8de7e0f198 | |||
| 866dacf198 | |||
| 3589fa381d | |||
| 5d54ebfaa0 | |||
| fea2b6253f | |||
| ba6e1ab15a | |||
| 1d9fff3c98 | |||
| 526adce603 | |||
| e7f568e162 | |||
| 7d15c602a6 | |||
| bdb30ebc48 | |||
| a31da7616d | |||
| f1147c10ee | |||
| 544a5386ad | |||
| 2d502213e4 | |||
| 55e9f8722f | |||
| b8602ee004 | |||
| e37c4b1f87 | |||
| f7a3bb2ae8 | |||
| 7d70ea78cd | |||
| 3907ec8b51 | |||
| f2b9bf0b8c | |||
| fadcc606f8 | |||
| 92e97e61c1 | |||
| 4b5b9fbde8 | |||
| 711d22a0ed | |||
| 06757153b3 | |||
| 38597aea00 | |||
| b10ce080a9 | |||
| 72e10ac597 | |||
| 5b591364ba | |||
| ace1855797 | |||
| ddedf73939 | |||
| 538014935e | |||
| 5e9bbf1200 | |||
| 29d6d3c041 | |||
| 53ab303fd9 | |||
| 24103ee856 | |||
| 20e368ab5e | |||
| 05763191ce | |||
| f6685fb9c9 | |||
| dbdf9602c2 | |||
| 6173f7049c | |||
| 4adacf4b98 | |||
| 8cb6ed26a1 | |||
| fd7aa9ccfa | |||
| e2a48d1714 | |||
| a5c4c1e0a6 | |||
| b29d03e872 | |||
| dff11092ec | |||
| 5e9c4e8fa3 | |||
| c346f32762 | |||
| d2d450aff2 | |||
| 09af858be8 | |||
| 9c8a99c79c | |||
| c6b9855198 | |||
| c142928fad | |||
| fc0cfd5188 | |||
| d9c78e5c3e | |||
| b449fceca0 | |||
| f0d15c0bce | |||
| 8f031f61ea | |||
| 502e8559f0 | |||
| 8cf6f7e936 | |||
| 0ef01cc620 | |||
| 930828ef86 | |||
| 9ebe920195 | |||
| 0df36047e7 | |||
| 94604921f9 | |||
| 284fe294ac | |||
| ffa01d491a | |||
| 1d9513e743 | |||
| 277c9e22f1 | |||
| 4e7b4da941 | |||
| 7e72c9c33b | |||
| e0e2c3a3f5 | |||
| 3b5e444e76 | |||
| 02006e3ff5 | |||
| 8083596f19 | |||
| 6551689a0c | |||
| 3fbf21a34e | |||
| b598431237 | |||
| 3b5d9a2cae | |||
| 3bd8aa8a86 | |||
| fe5fca8eaf | |||
| 848101a783 | |||
| d7c350f987 | |||
| 4c526f0b3c | |||
| 876ffb5b13 | |||
| 0b14cf3d6a | |||
| c2044b36b1 | |||
| f970b4acfa | |||
| e69c0af613 | |||
| 42e2dd8b30 | |||
| 4fd6e7b033 | |||
| 3580816eac | |||
| f1c2e5f194 | |||
| b6d59f1d46 | |||
| a3521681e7 | |||
| ca10e1136c | |||
| 282fb2af0e | |||
| 1f5a597d50 | |||
| a32666817c | |||
| b9bd3f2b4c | |||
| 4173efbe5a | |||
| 8121c8bd41 | |||
| 6ca8218d55 | |||
| 653afbdd46 | |||
| 4453d1752f | |||
| 5782c8a58b | |||
| 3e041befc8 | |||
| 6d3847c26f | |||
| 4bdfc37bc1 | |||
| 28afe0d829 | |||
| 04dddd3378 | |||
| 23a14583fe | |||
| 19c83de510 | |||
| e94d4b64cf | |||
| 7380c99f3a | |||
| 2961a372c3 | |||
| 5e2a4fb058 | |||
| a16242b9f8 | |||
| acfba9ac96 | |||
| 006343460e | |||
| 1cc8634cc7 | |||
| 9f8a110428 | |||
| 07b4279d0b | |||
| 6a33b231e3 | |||
| b38d02061d | |||
| f832a36a5e | |||
| 911ca7c29d | |||
| 544b75a2a7 | |||
| 56e8d4fb06 | |||
| 36a2278aef | |||
| 0c785b85b8 | |||
| a0ecba147e | |||
| 977591ac82 | |||
| fe1838d3fe | |||
| ede06cf97d | |||
| 93deee6824 | |||
| db19077834 | |||
| 6f91f62db2 | |||
| 1fc63b7597 | |||
| a079e479ec | |||
| e90705b459 | |||
| 244db437cb | |||
| 6558eae032 | |||
| 88b54a262b | |||
| 4fa8b8a4bd | |||
| cc0ced9a81 | |||
| 52447f5e97 | |||
| bceb69b284 | |||
| a8d826020d | |||
| 2ada7f87f2 | |||
| 7f8ca58762 | |||
| 058c25808b | |||
| c1e6b6b086 | |||
| b0a6bb79f6 | |||
| de52bf50a2 | |||
| 207dd23c86 | |||
| 7e0de29dd7 | |||
| eaa8f1ee8f | |||
| fb494c1151 | |||
| 49ecd9ef5d | |||
| 8772214fd4 | |||
| 5b74d0cbeb | |||
| 1e7c93007d | |||
| 608815a69b | |||
| fb49efa34d | |||
| b20e8616ec | |||
| acf78b6b63 | |||
| d68fe928b8 | |||
| db4d561d9e | |||
| 6933ca50a7 | |||
| 88c0e6f8ab | |||
| 6cd4728e3c | |||
| 97cc82837c | |||
| 5f0b0e8495 | |||
| c837d590ab | |||
| 6108a32631 | |||
| 6d78e1760d | |||
| c7b7242eff | |||
| 77c687efcf | |||
| 274af2f010 | |||
| 6cd5100530 | |||
| 115a408b0b | |||
| d983016137 | |||
| a8309b6b2b | |||
| e241589c92 | |||
| dcb6240a6a | |||
| 599bb5ab0f | |||
| 739fe584c6 | |||
| 920d1c6207 | |||
| c1d3d26a15 | |||
| e3b66dc7e8 | |||
| dfa08d1356 | |||
| 6da734c2f9 | |||
| a9f3141a77 | |||
| ee267d4702 | |||
| c39174ed8a | |||
| 9c872b6da6 | |||
| 2924a09936 | |||
| b9da012cc4 | |||
| 8626d41787 | |||
| c58705722a | |||
| c702ff676a | |||
| 995569dd50 | |||
| a0dfd42527 | |||
| a7dd78cce6 | |||
| e2e9cd40b3 | |||
| e4fc6f41b8 | |||
| 778b2a0d27 | |||
| 64cd15ca0b | |||
| 1e46c3c0ba | |||
| 91772b4e11 | |||
| af5c7cb7ca | |||
| e760474fa9 | |||
| 28bb88e347 | |||
| 17a1fe97ca | |||
| 7348237862 | |||
| 4e66db5dc1 | |||
| ffa6c9acd1 | |||
| b3e66a9259 | |||
| 5c0cf8c1f0 | |||
| 89c716fca4 | |||
| aae9830dfa | |||
| 48c72697c1 | |||
| aac7e9ea53 | |||
| a1b10b3222 | |||
| 2ab8db33e3 | |||
| 2b1386232f | |||
| 7bb1caa22e | |||
| 72c14b8651 | |||
| f85c3bb1e6 | |||
| d8714fe3b4 | |||
| c54c1907b6 | |||
| 55257155dd | |||
| 55a8bd86de | |||
| c60909272b | |||
| 3dcc2d8171 | |||
| 0ccbb22e4c | |||
| 0ffa10eaea | |||
| 9824073023 | |||
| d2adc11a2d | |||
| 4d0b870c88 | |||
| 840997cb7d | |||
| e4406621ed | |||
| 7f96ee0b62 | |||
| 17f850b31a | |||
| 5d87ad0301 | |||
| a33eeed6d3 | |||
| 554ce29337 | |||
| 6054d0b36f | |||
| 8ba15cf3b4 | |||
| b15e5b4867 | |||
| 544511905a | |||
| 02e3f511bd | |||
| 0539b071e7 | |||
| 36e400650c | |||
| d8930daf4b | |||
| 17b5816d5b | |||
| e574c81ea2 | |||
| 6799a2f841 | |||
| 61fb20f412 | |||
| 47f648e7bc | |||
| 064c0ddb82 | |||
| b42c42007d | |||
| 807cdfce2e | |||
| 43dc3aeebd | |||
| 0369c5ee16 | |||
| 3df2390fe4 | |||
| 9ec4a7af0f | |||
| 70636fb4a7 | |||
| 3c4efdd8f9 | |||
| 80deb301e5 | |||
| 5eabfdc34c | |||
| 5e96832666 | |||
| 1ccce24cf8 | |||
| d59e4f2da7 | |||
| a254c1a7b2 | |||
| 82cc610938 | |||
| becf7c40e8 | |||
| ed21c3ca03 | |||
| 631005e565 | |||
| b57fab8c75 | |||
| 4260a8436b | |||
| 23d478191f | |||
| d075a33d4e |
@@ -0,0 +1,30 @@
|
|||||||
|
name: Android CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- '4.**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
|
||||||
|
- name: Install NDK
|
||||||
|
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
|
||||||
|
|
||||||
|
- name: Validate Gradle Wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v1
|
||||||
|
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew qa
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
[main]
|
|
||||||
host = https://www.transifex.com
|
|
||||||
lang_map = da_DK:da-rDK,he:iw,id:in,kn_IN:kn-rIN,pt_BR:pt-rBR,pt_PT:pt,qu_EC:qu-rEC,sv_SE:sv-rSE,zh_CN:zh-rCN,zh_HK:zh-rHK,zh_TW:zh-rTW
|
|
||||||
|
|
||||||
[signal-android.master]
|
|
||||||
file_filter = res/values-<lang>/strings.xml
|
|
||||||
source_file = res/values/strings.xml
|
|
||||||
source_lang = en
|
|
||||||
type = ANDROID
|
|
||||||
|
|
||||||
@@ -1,736 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
package="org.thoughtcrime.securesms">
|
|
||||||
|
|
||||||
<uses-sdk tools:overrideLibrary="androidx.camera.core,androidx.camera.camera2"/>
|
|
||||||
|
|
||||||
<permission android:name="org.thoughtcrime.securesms.ACCESS_SECRETS"
|
|
||||||
android:label="Access to TextSecure Secrets"
|
|
||||||
android:protectionLevel="signature" />
|
|
||||||
|
|
||||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
|
||||||
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
|
|
||||||
<uses-feature android:name="android.hardware.location" android:required="false"/>
|
|
||||||
<uses-feature android:name="android.hardware.location.network" android:required="false"/>
|
|
||||||
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
|
|
||||||
<uses-feature android:name="android.hardware.microphone" android:required="false"/>
|
|
||||||
<uses-feature android:name="android.hardware.wifi" android:required="false"/>
|
|
||||||
<uses-feature android:name="android.hardware.portrait" android:required="false"/>
|
|
||||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
|
|
||||||
<uses-permission android:name="org.thoughtcrime.securesms.ACCESS_SECRETS"/>
|
|
||||||
<uses-permission android:name="android.permission.READ_PROFILE"/>
|
|
||||||
<uses-permission android:name="android.permission.WRITE_PROFILE"/>
|
|
||||||
<uses-permission android:name="android.permission.BROADCAST_WAP_PUSH"
|
|
||||||
tools:ignore="ProtectedPermissions"/>
|
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
|
||||||
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
|
|
||||||
<uses-permission android:name="android.permission.RECEIVE_MMS"/>
|
|
||||||
<uses-permission android:name="android.permission.READ_SMS"/>
|
|
||||||
<uses-permission android:name="android.permission.SEND_SMS"/>
|
|
||||||
<uses-permission android:name="android.permission.WRITE_SMS"/>
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
|
||||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
|
||||||
<uses-permission android:name="android.permission.READ_CALL_STATE"/>
|
|
||||||
|
|
||||||
<!-- For sending/receiving events -->
|
|
||||||
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
|
|
||||||
<uses-permission android:name="android.permission.READ_CALENDAR"/>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Normal -->
|
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
|
||||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
|
||||||
|
|
||||||
<!-- So we can add a TextSecure 'Account' -->
|
|
||||||
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
|
|
||||||
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
|
|
||||||
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
|
|
||||||
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
|
|
||||||
|
|
||||||
<!-- For conversation 'shortcuts' on the desktop -->
|
|
||||||
<uses-permission android:name="android.permission.INSTALL_SHORTCUT"/>
|
|
||||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
|
||||||
|
|
||||||
<!-- For fixing MMS -->
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
|
||||||
|
|
||||||
<!-- Set image as wallpaper -->
|
|
||||||
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
|
||||||
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
|
||||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
|
||||||
<uses-permission android:name="android.permission.RAISED_THREAD_PRIORITY" />
|
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
|
||||||
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
|
|
||||||
|
|
||||||
<application android:name=".ApplicationContext"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
tools:replace="android:allowBackup"
|
|
||||||
android:allowBackup="false"
|
|
||||||
android:theme="@style/TextSecure.LightTheme"
|
|
||||||
android:largeHeap="true">
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="com.google.android.geo.API_KEY"
|
|
||||||
android:value="AIzaSyCSx9xea86GwDKGznCAULE9Y5a8b-TfN9U"/>
|
|
||||||
|
|
||||||
<meta-data android:name="com.google.android.gms.version"
|
|
||||||
android:value="@integer/google_play_services_version" />
|
|
||||||
|
|
||||||
<meta-data android:name="com.google.android.gms.car.application"
|
|
||||||
android:resource="@xml/automotive_app_desc" />
|
|
||||||
|
|
||||||
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
|
|
||||||
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
|
|
||||||
<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false" />
|
|
||||||
|
|
||||||
<activity android:name="org.thoughtcrime.securesms.WebRtcCallActivity"
|
|
||||||
android:theme="@style/TextSecure.LightTheme.WebRTCCall"
|
|
||||||
android:excludeFromRecents="true"
|
|
||||||
android:screenOrientation="portrait"
|
|
||||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|fontScale"
|
|
||||||
android:launchMode="singleTask"/>
|
|
||||||
|
|
||||||
<activity android:name=".InviteActivity"
|
|
||||||
android:theme="@style/TextSecure.HighlightTheme"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:parentActivityName=".ConversationListActivity"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
|
||||||
android:value="org.thoughtcrime.securesms.ConversationListActivity" />
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name=".PromptMmsActivity"
|
|
||||||
android:label="Configure MMS Settings"
|
|
||||||
android:windowSoftInputMode="stateUnchanged"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".DeviceProvisioningActivity"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:scheme="tsdevice"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name=".preferences.MmsPreferencesActivity"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".ShareActivity"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:excludeFromRecents="true"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:taskAffinity=""
|
|
||||||
android:noHistory="true"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SEND" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
<data android:mimeType="audio/*" />
|
|
||||||
<data android:mimeType="image/*" />
|
|
||||||
<data android:mimeType="text/plain" />
|
|
||||||
<data android:mimeType="video/*" />
|
|
||||||
<data android:mimeType="application/*"/>
|
|
||||||
<data android:mimeType="text/*"/>
|
|
||||||
<data android:mimeType="*/*"/>
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.service.chooser.chooser_target_service"
|
|
||||||
android:value=".service.DirectShareService" />
|
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name=".stickers.StickerPackPreviewActivity"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:noHistory="true"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:scheme="sgnl"
|
|
||||||
android:host="addstickers" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
|
|
||||||
<activity android:name=".ConversationListActivity"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
|
||||||
android:exported="true" />
|
|
||||||
|
|
||||||
<activity-alias android:name=".RoutingActivity"
|
|
||||||
android:targetActivity=".ConversationListActivity"
|
|
||||||
android:exported="true">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<meta-data android:name="com.sec.minimode.icon.portrait.normal"
|
|
||||||
android:resource="@mipmap/ic_launcher" />
|
|
||||||
<meta-data android:name="com.sec.minimode.icon.landscape.normal"
|
|
||||||
android:resource="@mipmap/ic_launcher" />
|
|
||||||
|
|
||||||
</activity-alias>
|
|
||||||
|
|
||||||
<activity android:name=".ConversationListArchiveActivity"
|
|
||||||
android:label="@string/AndroidManifest_archived_conversations"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
|
||||||
android:parentActivityName=".ConversationListActivity">
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
|
||||||
android:value="org.thoughtcrime.securesms.ConversationListActivity" />
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name=".conversation.ConversationActivity"
|
|
||||||
android:windowSoftInputMode="stateUnchanged"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
|
||||||
android:parentActivityName=".ConversationListActivity">
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
|
||||||
android:value="org.thoughtcrime.securesms.ConversationListActivity" />
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name=".longmessage.LongMessageActivity" />
|
|
||||||
|
|
||||||
<activity android:name=".conversation.ConversationPopupActivity"
|
|
||||||
android:windowSoftInputMode="stateVisible"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:taskAffinity=""
|
|
||||||
android:excludeFromRecents="true"
|
|
||||||
android:theme="@style/TextSecure.LightTheme.Popup"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" />
|
|
||||||
|
|
||||||
<activity android:name=".MessageDetailsActivity"
|
|
||||||
android:label="@string/AndroidManifest__message_details"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".GroupCreateActivity"
|
|
||||||
android:windowSoftInputMode="stateVisible"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".DatabaseMigrationActivity"
|
|
||||||
android:theme="@style/NoAnimation.Theme.AppCompat.Light.DarkActionBar"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".migrations.ApplicationMigrationActivity"
|
|
||||||
android:theme="@style/NoAnimation.Theme.AppCompat.Light.DarkActionBar"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".ExperienceUpgradeActivity"
|
|
||||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".PassphraseCreateActivity"
|
|
||||||
android:label="@string/AndroidManifest__create_passphrase"
|
|
||||||
android:windowSoftInputMode="stateUnchanged"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".PassphrasePromptActivity"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:theme="@style/TextSecure.LightIntroTheme"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".NewConversationActivity"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:windowSoftInputMode="stateAlwaysVisible"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".PushContactSelectionActivity"
|
|
||||||
android:label="@string/AndroidManifest__select_contacts"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".giph.ui.GiphyActivity"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".mediasend.MediaSendActivity"
|
|
||||||
android:theme="@style/TextSecure.FullScreenMedia"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".PassphraseChangeActivity"
|
|
||||||
android:label="@string/AndroidManifest__change_passphrase"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".VerifyIdentityActivity"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".ApplicationPreferencesActivity"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name=".registration.RegistrationNavigationActivity"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:theme="@style/TextSecure.LightRegistrationTheme"
|
|
||||||
android:windowSoftInputMode="stateUnchanged"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".revealable.ViewOnceMessageActivity"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:theme="@style/TextSecure.FullScreenMedia"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:excludeFromRecents="true"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".stickers.StickerManagementActivity"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:theme="@style/TextSecure.LightTheme"
|
|
||||||
android:windowSoftInputMode="stateUnchanged"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".DeviceActivity"
|
|
||||||
android:label="@string/AndroidManifest__linked_devices"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".LogSubmitActivity"
|
|
||||||
android:label="@string/AndroidManifest__log_submit"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".MediaPreviewActivity"
|
|
||||||
android:label="@string/AndroidManifest__media_preview"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".MediaOverviewActivity"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:windowSoftInputMode="stateHidden"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".DummyActivity"
|
|
||||||
android:theme="@android:style/Theme.NoDisplay"
|
|
||||||
android:enabled="true"
|
|
||||||
android:allowTaskReparenting="true"
|
|
||||||
android:noHistory="true"
|
|
||||||
android:excludeFromRecents="true"
|
|
||||||
android:alwaysRetainTaskState="false"
|
|
||||||
android:stateNotNeeded="true"
|
|
||||||
android:clearTaskOnLaunch="true"
|
|
||||||
android:finishOnTaskLaunch="true" />
|
|
||||||
|
|
||||||
<activity android:name=".PlayServicesProblemActivity"
|
|
||||||
android:theme="@style/TextSecure.DialogActivity"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".SmsSendtoActivity">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SENDTO" />
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:scheme="sms" />
|
|
||||||
<data android:scheme="smsto" />
|
|
||||||
<data android:scheme="mms" />
|
|
||||||
<data android:scheme="mmsto" />
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<data android:mimeType="vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.contact" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name="org.thoughtcrime.securesms.webrtc.VoiceCallShare"
|
|
||||||
android:excludeFromRecents="true"
|
|
||||||
android:theme="@style/NoAnimation.Theme.BlackScreen"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<data android:mimeType="vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.call" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name=".RecipientPreferenceActivity"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".BlockedContactsActivity"
|
|
||||||
android:theme="@style/TextSecure.LightTheme"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".scribbles.StickerSelectActivity"
|
|
||||||
android:theme="@style/TextSecure.DarkTheme"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".scribbles.NewStickerSelectActivity"
|
|
||||||
android:theme="@style/TextSecure.DarkTheme"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
|
|
||||||
android:theme="@style/TextSecure.DarkTheme"/>
|
|
||||||
|
|
||||||
<activity android:name=".CreateProfileActivity"
|
|
||||||
android:theme="@style/TextSecure.LightRegistrationTheme"
|
|
||||||
android:windowSoftInputMode="stateVisible"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".ClearProfileAvatarActivity"
|
|
||||||
android:theme="@style/Theme.AppCompat.Dialog.Alert"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
|
||||||
android:icon="@drawable/clear_profile_avatar"
|
|
||||||
android:label="@string/AndroidManifest_remove_photo">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO"/>
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name=".contactshare.ContactShareEditActivity"
|
|
||||||
android:theme="@style/TextSecure.LightTheme"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".contactshare.ContactNameEditActivity"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".contactshare.SharedContactDetailsActivity"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity android:name=".ShortcutLauncherActivity"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar"
|
|
||||||
android:exported="true"
|
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".maps.PlacePickerActivity"
|
|
||||||
android:label="@string/PlacePickerActivity_title"
|
|
||||||
android:theme="@style/TextSecure.LightNoActionBar" />
|
|
||||||
|
|
||||||
<service android:enabled="true" android:name="org.thoughtcrime.securesms.service.WebRtcCallService"/>
|
|
||||||
<service android:enabled="true" android:name=".service.ApplicationMigrationService"/>
|
|
||||||
<service android:enabled="true" android:exported="false" android:name=".service.KeyCachingService"/>
|
|
||||||
<service android:enabled="true" android:name=".service.IncomingMessageObserver$ForegroundService"/>
|
|
||||||
|
|
||||||
<service android:name=".service.QuickResponseService"
|
|
||||||
android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
|
|
||||||
android:exported="true" >
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<data android:scheme="sms" />
|
|
||||||
<data android:scheme="smsto" />
|
|
||||||
<data android:scheme="mms" />
|
|
||||||
<data android:scheme="mmsto" />
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service android:name=".service.AccountAuthenticatorService" android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.accounts.AccountAuthenticator" />
|
|
||||||
</intent-filter>
|
|
||||||
<meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator" />
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service android:name=".service.ContactsSyncAdapterService" android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.content.SyncAdapter"/>
|
|
||||||
</intent-filter>
|
|
||||||
<meta-data android:name="android.content.SyncAdapter" android:resource="@xml/syncadapter" />
|
|
||||||
<meta-data android:name="android.provider.CONTACTS_STRUCTURE" android:resource="@xml/contactsformat" />
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service android:name=".service.DirectShareService"
|
|
||||||
android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.service.chooser.ChooserTargetService" />
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service android:name=".service.GenericForegroundService"/>
|
|
||||||
|
|
||||||
<service android:name=".gcm.FcmService">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<receiver android:name=".service.SmsListener"
|
|
||||||
android:permission="android.permission.BROADCAST_SMS"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter android:priority="1001">
|
|
||||||
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.provider.Telephony.SMS_DELIVER"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".service.SmsDeliveryListener"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.services.MESSAGE_SENT"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".service.MmsListener"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="true"
|
|
||||||
android:permission="android.permission.BROADCAST_WAP_PUSH">
|
|
||||||
<intent-filter android:priority="1001">
|
|
||||||
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED"/>
|
|
||||||
<data android:mimeType="application/vnd.wap.mms-message" />
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER"/>
|
|
||||||
<data android:mimeType="application/vnd.wap.mms-message" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".notifications.MarkReadReceiver"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="false">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.notifications.CLEAR"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".notifications.RemoteReplyReceiver"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="false">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.notifications.WEAR_REPLY"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".notifications.AndroidAutoHeardReceiver"
|
|
||||||
android:exported="false">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.notifications.ANDROID_AUTO_HEARD"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".notifications.AndroidAutoReplyReceiver"
|
|
||||||
android:exported="false">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.notifications.ANDROID_AUTO_REPLY"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".service.ExpirationListener" />
|
|
||||||
|
|
||||||
<receiver android:name=".revealable.ViewOnceMessageManager$ViewOnceAlarm" />
|
|
||||||
|
|
||||||
<provider android:name=".providers.PartProvider"
|
|
||||||
android:grantUriPermissions="true"
|
|
||||||
android:exported="false"
|
|
||||||
android:authorities="org.thoughtcrime.provider.securesms" />
|
|
||||||
|
|
||||||
<provider android:name=".providers.MmsBodyProvider"
|
|
||||||
android:grantUriPermissions="true"
|
|
||||||
android:exported="false"
|
|
||||||
android:authorities="org.thoughtcrime.provider.securesms.mms" />
|
|
||||||
|
|
||||||
<provider android:name="androidx.core.content.FileProvider"
|
|
||||||
android:authorities="org.thoughtcrime.securesms.fileprovider"
|
|
||||||
android:exported="false"
|
|
||||||
android:grantUriPermissions="true">
|
|
||||||
|
|
||||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_provider_paths" />
|
|
||||||
|
|
||||||
</provider>
|
|
||||||
|
|
||||||
<provider android:name=".database.DatabaseContentProviders$Conversation"
|
|
||||||
android:authorities="org.thoughtcrime.securesms.database.conversation"
|
|
||||||
android:exported="false" />
|
|
||||||
|
|
||||||
<provider android:name=".database.DatabaseContentProviders$ConversationList"
|
|
||||||
android:authorities="org.thoughtcrime.securesms.database.conversationlist"
|
|
||||||
android:exported="false" />
|
|
||||||
|
|
||||||
<provider android:name=".database.DatabaseContentProviders$Attachment"
|
|
||||||
android:authorities="org.thoughtcrime.securesms.database.attachment"
|
|
||||||
android:exported="false" />
|
|
||||||
|
|
||||||
<provider android:name=".database.DatabaseContentProviders$Sticker"
|
|
||||||
android:authorities="org.thoughtcrime.securesms.database.sticker"
|
|
||||||
android:exported="false" />
|
|
||||||
|
|
||||||
<provider android:name=".database.DatabaseContentProviders$StickerPack"
|
|
||||||
android:authorities="org.thoughtcrime.securesms.database.stickerpack"
|
|
||||||
android:exported="false" />
|
|
||||||
|
|
||||||
<provider android:name="androidx.camera.camera2.impl.Camera2Initializer"
|
|
||||||
android:authorities="${applicationId}.camerax-init"
|
|
||||||
android:exported="false"
|
|
||||||
android:enabled="false" />
|
|
||||||
|
|
||||||
<receiver android:name=".service.BootReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.RESTART"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".service.DirectoryRefreshListener">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".service.RotateSignedPreKeyListener">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".service.RotateSenderCertificateListener">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".service.LocalBackupListener">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".service.PersistentConnectionBootListener">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".notifications.LocaleChangedReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.LOCALE_CHANGED"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".notifications.MessageNotifier$ReminderReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.MessageNotifier.REMINDER_ACTION"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".notifications.DeleteNotificationReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.DELETE_NOTIFICATION"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver android:name=".ExperienceUpgradeActivity$AppUpgradeReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
|
|
||||||
<data android:scheme="package" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.ExperienceUpgradeActivity.DISMISS_ACTION"/>
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<receiver
|
|
||||||
android:name=".service.PanicResponderListener"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="info.guardianproject.panic.action.TRIGGER" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name=".gcm.FcmJobService"
|
|
||||||
android:permission="android.permission.BIND_JOB_SERVICE"
|
|
||||||
android:enabled="@bool/enable_job_service"
|
|
||||||
tools:targetApi="26" />
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name=".jobmanager.JobSchedulerScheduler$SystemService"
|
|
||||||
android:permission="android.permission.BIND_JOB_SERVICE"
|
|
||||||
android:enabled="@bool/enable_job_service"
|
|
||||||
tools:targetApi="26" />
|
|
||||||
|
|
||||||
<service
|
|
||||||
android:name=".jobmanager.KeepAliveService"
|
|
||||||
android:enabled="@bool/enable_alarm_manager" />
|
|
||||||
|
|
||||||
<receiver
|
|
||||||
android:name=".jobmanager.AlarmManagerScheduler$RetryReceiver"
|
|
||||||
android:enabled="@bool/enable_alarm_manager" />
|
|
||||||
|
|
||||||
<!-- Probably don't need this one -->
|
|
||||||
<receiver
|
|
||||||
android:name=".jobmanager.BootReceiver"
|
|
||||||
android:enabled="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
|
||||||
|
|
||||||
<uses-library android:name="com.sec.android.app.multiwindow" android:required="false"/>
|
|
||||||
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
|
||||||
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
|
|
||||||
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
|
|
||||||
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
|
|
||||||
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />
|
|
||||||
|
|
||||||
</application>
|
|
||||||
</manifest>
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
Building Signal
|
|
||||||
===============
|
|
||||||
|
|
||||||
Basics
|
|
||||||
------
|
|
||||||
|
|
||||||
Signal uses [Gradle](http://gradle.org) to build the project and to maintain
|
|
||||||
dependencies. However, you needn't install it yourself; the
|
|
||||||
"gradle wrapper" `gradlew`, mentioned below, will do that for you.
|
|
||||||
|
|
||||||
Building Signal
|
|
||||||
---------------
|
|
||||||
|
|
||||||
The following steps should help you (re)build Signal from the command line.
|
|
||||||
|
|
||||||
1. Checkout the Signal-Android project source with the command:
|
|
||||||
|
|
||||||
git clone https://github.com/signalapp/Signal-Android.git
|
|
||||||
|
|
||||||
2. Make sure you have the [Android SDK](https://developer.android.com/sdk/index.html) installed.
|
|
||||||
3. Ensure that the following packages are installed from the Android SDK manager:
|
|
||||||
* Android SDK Build Tools (see buildToolsVersion in build.gradle)
|
|
||||||
* SDK Platform (All API levels)
|
|
||||||
* Android Support Repository
|
|
||||||
* Google Repository
|
|
||||||
4. Create a local.properties file at the root of your source checkout and add an sdk.dir entry to it. For example:
|
|
||||||
|
|
||||||
sdk.dir=/Application/android-sdk-macosx
|
|
||||||
|
|
||||||
5. Using Java 8
|
|
||||||
|
|
||||||
6. Execute Gradle:
|
|
||||||
|
|
||||||
./gradlew build
|
|
||||||
|
|
||||||
Visual assets
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
Source assets tend to be large binary blobs, which are best stored outside of git repositories. Some source files are SVGs that can be auto-colored and sized using a tool like [android-res-utils](https://github.com/sebkur/android-res-utils).
|
|
||||||
|
|
||||||
Sample command for generating our audio placeholder image:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pngs_from_svg.py ic_audio.svg /path/to/Signal/res/ 150 --color #000 --opacity 0.54 --suffix _light
|
|
||||||
pngs_from_svg.py ic_audio.svg /path/to/Signal/res/ 150 --color #fff --opacity 1.00 --suffix _light
|
|
||||||
```
|
|
||||||
|
|
||||||
Setting up a development environment
|
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
[Android Studio](https://developer.android.com/sdk/installing/studio.html) is the recommended development environment.
|
|
||||||
|
|
||||||
1. Install Android Studio.
|
|
||||||
2. Open Android Studio. On a new installation, the Quickstart panel will appear. If you have open projects, close them using "File > Close Project" to see the Quickstart panel.
|
|
||||||
3. From the Quickstart panel, choose "Configure" then "SDK Manager".
|
|
||||||
4. In the SDK Tools tab of the SDK Manager, make sure that the "Android Support Repository" is installed, and that the latest "Android SDK build-tools" are installed. Click "OK" to return to the Quickstart panel.
|
|
||||||
5. From the Quickstart panel, choose "Checkout from Version Control" then "git".
|
|
||||||
6. Paste the URL for the Signal-Android project when prompted (https://github.com/signalapp/Signal-Android.git).
|
|
||||||
7. Android studio should detect the presence of a project file and ask you whether to open it. Click "yes".
|
|
||||||
9. Default config options should be good enough.
|
|
||||||
9. Project initialisation and build should proceed.
|
|
||||||
|
|
||||||
Contributing code
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Code contributions should be sent via github as pull requests, from feature branches [as explained here](https://help.github.com/articles/using-pull-requests).
|
|
||||||
|
|
||||||
Mailing list
|
|
||||||
------------
|
|
||||||
|
|
||||||
Development discussion happens on the whispersystems mailing list.
|
|
||||||
[To join](https://lists.riseup.net/www/info/whispersystems)
|
|
||||||
Send emails to whispersystems@lists.riseup.net
|
|
||||||
|
|
||||||
@@ -27,7 +27,6 @@ Interested in helping to translate Signal? Contribute here:
|
|||||||
https://www.transifex.com/projects/p/signal-android/
|
https://www.transifex.com/projects/p/signal-android/
|
||||||
|
|
||||||
## Contributing Code
|
## Contributing Code
|
||||||
Instructions on how to setup your development environment and build Signal can be found in [BUILDING.md](https://github.com/signalapp/Signal-Android/blob/master/BUILDING.md).
|
|
||||||
|
|
||||||
If you're new to the Signal codebase, we recommend going through our issues and picking out a simple bug to fix (check the "easy" label in our issues) in order to get yourself familiar. Also please have a look at the [CONTRIBUTING.md](https://github.com/signalapp/Signal-Android/blob/master/CONTRIBUTING.md), that might answer some of your questions.
|
If you're new to the Signal codebase, we recommend going through our issues and picking out a simple bug to fix (check the "easy" label in our issues) in order to get yourself familiar. Also please have a look at the [CONTRIBUTING.md](https://github.com/signalapp/Signal-Android/blob/master/CONTRIBUTING.md), that might answer some of your questions.
|
||||||
|
|
||||||
@@ -60,9 +59,7 @@ The form and manner of this distribution makes it eligible for export under the
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright 2011 Whisper Systems
|
Copyright 2013-2020 Signal
|
||||||
|
|
||||||
Copyright 2013-2017 Open Whisper Systems
|
|
||||||
|
|
||||||
Licensed under the GPLv3: http://www.gnu.org/licenses/gpl-3.0.html
|
Licensed under the GPLv3: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[main]
|
||||||
|
host = https://www.transifex.com
|
||||||
|
lang_map = da_DK:da-rDK,fil:tl,he:iw,id:in,kn_IN:kn-rIN,pa_PK:pa-rPK,pt_BR:pt-rBR,pt_PT:pt,qu_EC:qu-rEC,sv_SE:sv-rSE,zh_CN:zh-rCN,zh_HK:zh-rHK,zh_TW:zh-rTW
|
||||||
|
|
||||||
|
[signal-android.master]
|
||||||
|
file_filter = src/main/res/values-<lang>/strings.xml
|
||||||
|
source_file = src/main/res/values/strings.xml
|
||||||
|
source_lang = en
|
||||||
|
type = ANDROID
|
||||||
|
|
||||||
@@ -0,0 +1,457 @@
|
|||||||
|
import org.signal.signing.ApkSignerUtil
|
||||||
|
|
||||||
|
import java.security.MessageDigest
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
maven {
|
||||||
|
url "https://repo1.maven.org/maven2"
|
||||||
|
}
|
||||||
|
jcenter {
|
||||||
|
content {
|
||||||
|
includeVersion 'org.jetbrains.trove4j', 'trove4j', '20160824'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:3.6.3'
|
||||||
|
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0'
|
||||||
|
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'com.google.protobuf'
|
||||||
|
apply plugin: 'androidx.navigation.safeargs'
|
||||||
|
apply plugin: 'witness'
|
||||||
|
apply from: 'translations.gradle'
|
||||||
|
apply from: 'witness-verifications.gradle'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url "https://raw.github.com/signalapp/maven/master/photoview/releases/"
|
||||||
|
content {
|
||||||
|
includeGroupByRegex "com\\.github\\.chrisbanes.*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url "https://raw.github.com/signalapp/maven/master/shortcutbadger/releases/"
|
||||||
|
content {
|
||||||
|
includeGroupByRegex "me\\.leolin.*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url "https://raw.github.com/signalapp/maven/master/circular-progress-button/releases/"
|
||||||
|
content {
|
||||||
|
includeGroupByRegex "com\\.github\\.dmytrodanylyk\\.circular-progress-button\\.*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url "https://raw.github.com/signalapp/maven/master/sqlcipher/release/"
|
||||||
|
content {
|
||||||
|
includeGroupByRegex "org\\.signal.*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven { // textdrawable
|
||||||
|
url 'https://dl.bintray.com/amulyakhare/maven'
|
||||||
|
content {
|
||||||
|
includeGroupByRegex "com\\.amulyakhare.*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
|
||||||
|
protobuf {
|
||||||
|
protoc {
|
||||||
|
artifact = 'com.google.protobuf:protoc:3.10.0'
|
||||||
|
}
|
||||||
|
generateProtoTasks {
|
||||||
|
all().each { task ->
|
||||||
|
task.builtins {
|
||||||
|
java {
|
||||||
|
option "lite"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def canonicalVersionCode = 652
|
||||||
|
def canonicalVersionName = "4.62.4"
|
||||||
|
|
||||||
|
def postFixSize = 10
|
||||||
|
def abiPostFix = ['universal' : 0,
|
||||||
|
'armeabi-v7a' : 1,
|
||||||
|
'arm64-v8a' : 2,
|
||||||
|
'x86' : 3,
|
||||||
|
'x86_64' : 4]
|
||||||
|
|
||||||
|
android {
|
||||||
|
flavorDimensions "none"
|
||||||
|
compileSdkVersion 28
|
||||||
|
buildToolsVersion '28.0.3'
|
||||||
|
useLibrary 'org.apache.http.legacy'
|
||||||
|
|
||||||
|
dexOptions {
|
||||||
|
javaMaxHeapSize "4g"
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
versionCode canonicalVersionCode * postFixSize
|
||||||
|
versionName canonicalVersionName
|
||||||
|
|
||||||
|
minSdkVersion 19
|
||||||
|
targetSdkVersion 28
|
||||||
|
multiDexEnabled true
|
||||||
|
|
||||||
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
project.ext.set("archivesBaseName", "Signal");
|
||||||
|
|
||||||
|
buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L"
|
||||||
|
buildConfigField "String", "SIGNAL_URL", "\"https://textsecure-service.whispersystems.org\""
|
||||||
|
buildConfigField "String", "STORAGE_URL", "\"https://storage.signal.org\""
|
||||||
|
buildConfigField "String", "SIGNAL_CDN_URL", "\"https://cdn.signal.org\""
|
||||||
|
buildConfigField "String", "SIGNAL_CDN2_URL", "\"https://cdn2.signal.org\""
|
||||||
|
buildConfigField "String", "SIGNAL_CONTACT_DISCOVERY_URL", "\"https://api.directory.signal.org\""
|
||||||
|
buildConfigField "String", "SIGNAL_SERVICE_STATUS_URL", "\"uptime.signal.org\""
|
||||||
|
buildConfigField "String", "SIGNAL_KEY_BACKUP_URL", "\"https://api.backup.signal.org\""
|
||||||
|
buildConfigField "String", "CONTENT_PROXY_HOST", "\"contentproxy.signal.org\""
|
||||||
|
buildConfigField "int", "CONTENT_PROXY_PORT", "443"
|
||||||
|
buildConfigField "String", "SIGNAL_AGENT", "\"OWA\""
|
||||||
|
buildConfigField "String", "CDS_MRENCLAVE", "\"cd6cfc342937b23b1bdd3bbf9721aa5615ac9ff50a75c5527d441cd3276826c9\""
|
||||||
|
buildConfigField "String", "KBS_ENCLAVE_NAME", "\"fe7c1bfae98f9b073d220366ea31163ee82f6d04bead774f71ca8e5c40847bfe\""
|
||||||
|
buildConfigField "String", "KBS_MRENCLAVE", "\"a3baab19ef6ce6f34ab9ebb25ba722725ae44a8872dc0ff08ad6d83a9489de87\""
|
||||||
|
buildConfigField "String", "UNIDENTIFIED_SENDER_TRUST_ROOT", "\"BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF\""
|
||||||
|
buildConfigField "String", "ZKGROUP_SERVER_PUBLIC_PARAMS", "\"AMhf5ywVwITZMsff/eCyudZx9JDmkkkbV6PInzG4p8x3VqVJSFiMvnvlEKWuRob/1eaIetR31IYeAbm0NdOuHH8Qi+Rexi1wLlpzIo1gstHWBfZzy1+qHRV5A4TqPp15YzBPm0WSggW6PbSn+F4lf57VCnHF7p8SvzAA2ZZJPYJURt8X7bbg+H3i+PEjH9DXItNEqs2sNcug37xZQDLm7X0=\""
|
||||||
|
buildConfigField "String[]", "LANGUAGES", "new String[]{\"" + autoResConfig().collect { s -> s.replace('-r', '_') }.join('", "') + '"}'
|
||||||
|
buildConfigField "int", "CANONICAL_VERSION_CODE", "$canonicalVersionCode"
|
||||||
|
|
||||||
|
ndk {
|
||||||
|
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||||
|
}
|
||||||
|
|
||||||
|
resConfigs autoResConfig()
|
||||||
|
|
||||||
|
splits {
|
||||||
|
abi {
|
||||||
|
enable true
|
||||||
|
reset()
|
||||||
|
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||||
|
universalApk true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
packagingOptions {
|
||||||
|
exclude 'LICENSE.txt'
|
||||||
|
exclude 'LICENSE'
|
||||||
|
exclude 'NOTICE'
|
||||||
|
exclude 'asm-license.txt'
|
||||||
|
exclude 'META-INF/LICENSE'
|
||||||
|
exclude 'META-INF/NOTICE'
|
||||||
|
exclude 'META-INF/proguard/androidx-annotations.pro'
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
minifyEnabled true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'),
|
||||||
|
'proguard/proguard-firebase-messaging.pro',
|
||||||
|
'proguard/proguard-google-play-services.pro',
|
||||||
|
'proguard/proguard-jackson.pro',
|
||||||
|
'proguard/proguard-sqlite.pro',
|
||||||
|
'proguard/proguard-appcompat-v7.pro',
|
||||||
|
'proguard/proguard-square-okhttp.pro',
|
||||||
|
'proguard/proguard-square-okio.pro',
|
||||||
|
'proguard/proguard-spongycastle.pro',
|
||||||
|
'proguard/proguard-rounded-image-view.pro',
|
||||||
|
'proguard/proguard-glide.pro',
|
||||||
|
'proguard/proguard-shortcutbadger.pro',
|
||||||
|
'proguard/proguard-retrofit.pro',
|
||||||
|
'proguard/proguard-webrtc.pro',
|
||||||
|
'proguard/proguard-klinker.pro',
|
||||||
|
'proguard/proguard-retrolambda.pro',
|
||||||
|
'proguard/proguard-okhttp.pro',
|
||||||
|
'proguard/proguard-ez-vcard.pro',
|
||||||
|
'proguard/proguard.cfg'
|
||||||
|
testProguardFiles 'proguard/proguard-automation.pro',
|
||||||
|
'proguard/proguard.cfg'
|
||||||
|
}
|
||||||
|
staging {
|
||||||
|
initWith debug
|
||||||
|
|
||||||
|
buildConfigField "String", "SIGNAL_URL", "\"https://textsecure-service-staging.whispersystems.org\""
|
||||||
|
buildConfigField "String", "STORAGE_URL", "\"https://storage-staging.signal.org\""
|
||||||
|
buildConfigField "String", "SIGNAL_CDN_URL", "\"https://cdn-staging.signal.org\""
|
||||||
|
buildConfigField "String", "SIGNAL_CDN2_URL", "\"https://cdn2-staging.signal.org\""
|
||||||
|
buildConfigField "String", "SIGNAL_CONTACT_DISCOVERY_URL", "\"https://api-staging.directory.signal.org\""
|
||||||
|
buildConfigField "String", "SIGNAL_KEY_BACKUP_URL", "\"https://api-staging.backup.signal.org\""
|
||||||
|
buildConfigField "String", "CDS_MRENCLAVE", "\"ba4ebb438bc07713819ee6c98d94037747006d7df63fc9e44d2d6f1fec962a79\""
|
||||||
|
buildConfigField "String", "KBS_ENCLAVE_NAME", "\"823a3b2c037ff0cbe305cc48928cfcc97c9ed4a8ca6d49af6f7d6981fb60a4e9\""
|
||||||
|
buildConfigField "String", "UNIDENTIFIED_SENDER_TRUST_ROOT", "\"BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx\""
|
||||||
|
buildConfigField "String", "ZKGROUP_SERVER_PUBLIC_PARAMS", "\"ABSY21VckQcbSXVNCGRYJcfWHiAMZmpTtTELcDmxgdFbtp/bWsSxZdMKzfCp8rvIs8ocCU3B37fT3r4Mi5qAemeGeR2X+/YmOGR5ofui7tD5mDQfstAI9i+4WpMtIe8KC3wU5w3Inq3uNWVmoGtpKndsNfwJrCg0Hd9zmObhypUnSkfYn2ooMOOnBpfdanRtrvetZUayDMSC5iSRcXKpdls=\""
|
||||||
|
}
|
||||||
|
flipper {
|
||||||
|
initWith debug
|
||||||
|
minifyEnabled false
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
proguardFiles = buildTypes.debug.proguardFiles
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
productFlavors {
|
||||||
|
play {
|
||||||
|
dimension "none"
|
||||||
|
ext.websiteUpdateUrl = "null"
|
||||||
|
buildConfigField "boolean", "PLAY_STORE_DISABLED", "false"
|
||||||
|
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
|
||||||
|
}
|
||||||
|
|
||||||
|
website {
|
||||||
|
dimension "none"
|
||||||
|
ext.websiteUpdateUrl = "https://updates.signal.org/android"
|
||||||
|
buildConfigField "boolean", "PLAY_STORE_DISABLED", "true"
|
||||||
|
buildConfigField "String", "NOPLAY_UPDATE_URL", "\"$ext.websiteUpdateUrl\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
android.applicationVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
output.outputFileName = output.outputFileName.replace(".apk", "-${variant.versionName}.apk")
|
||||||
|
def abiName = output.getFilter("ABI") ?: 'universal'
|
||||||
|
def postFix = abiPostFix.get(abiName, 0)
|
||||||
|
|
||||||
|
if (postFix >= postFixSize) throw new AssertionError("postFix is too large")
|
||||||
|
|
||||||
|
output.versionCodeOverride = canonicalVersionCode * postFixSize + postFix
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError true
|
||||||
|
baseline file("lint-baseline.xml")
|
||||||
|
disable "LintError"
|
||||||
|
}
|
||||||
|
|
||||||
|
testOptions {
|
||||||
|
unitTests {
|
||||||
|
includeAndroidResources = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
lintChecks project(':lintchecks')
|
||||||
|
|
||||||
|
implementation('androidx.appcompat:appcompat:1.1.0-beta01') {
|
||||||
|
force = true
|
||||||
|
}
|
||||||
|
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||||
|
implementation 'com.google.android.material:material:1.1.0'
|
||||||
|
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||||
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
|
implementation 'androidx.preference:preference:1.0.0'
|
||||||
|
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
|
||||||
|
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
||||||
|
implementation 'androidx.exifinterface:exifinterface:1.0.0'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
|
implementation 'androidx.navigation:navigation-fragment:2.1.0'
|
||||||
|
implementation 'androidx.navigation:navigation-ui:2.1.0'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0-alpha05'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-common-java8:2.1.0'
|
||||||
|
implementation "androidx.camera:camera-core:1.0.0-beta01"
|
||||||
|
implementation "androidx.camera:camera-camera2:1.0.0-beta01"
|
||||||
|
implementation "androidx.camera:camera-lifecycle:1.0.0-beta01"
|
||||||
|
implementation "androidx.concurrent:concurrent-futures:1.0.0"
|
||||||
|
implementation "androidx.autofill:autofill:1.0.0"
|
||||||
|
implementation "androidx.paging:paging-common:2.1.2"
|
||||||
|
implementation "androidx.paging:paging-runtime:2.1.2"
|
||||||
|
implementation 'com.google.firebase:firebase-ml-vision:24.0.3'
|
||||||
|
implementation 'com.google.firebase:firebase-ml-vision-face-model:20.0.1'
|
||||||
|
|
||||||
|
implementation ('com.google.firebase:firebase-messaging:20.2.0') {
|
||||||
|
exclude group: 'com.google.firebase', module: 'firebase-core'
|
||||||
|
exclude group: 'com.google.firebase', module: 'firebase-analytics'
|
||||||
|
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
|
||||||
|
}
|
||||||
|
|
||||||
|
implementation 'com.google.android.gms:play-services-maps:16.1.0'
|
||||||
|
implementation 'com.google.android.gms:play-services-auth:16.0.1'
|
||||||
|
|
||||||
|
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.1'
|
||||||
|
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.1'
|
||||||
|
|
||||||
|
implementation 'org.conscrypt:conscrypt-android:2.0.0'
|
||||||
|
implementation 'org.signal:aesgcmprovider:0.0.3'
|
||||||
|
|
||||||
|
implementation project(':libsignal-service')
|
||||||
|
implementation 'org.signal:zkgroup-android:0.7.0'
|
||||||
|
|
||||||
|
implementation 'org.signal:argon2:13.1@aar'
|
||||||
|
|
||||||
|
implementation 'org.signal:ringrtc-android:2.0.3'
|
||||||
|
|
||||||
|
implementation "me.leolin:ShortcutBadger:1.1.16"
|
||||||
|
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
|
||||||
|
implementation 'com.jpardogo.materialtabstrip:library:1.0.9'
|
||||||
|
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
|
||||||
|
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
|
||||||
|
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||||
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
||||||
|
annotationProcessor 'androidx.annotation:annotation:1.1.0'
|
||||||
|
implementation 'com.makeramen:roundedimageview:2.1.0'
|
||||||
|
implementation 'com.pnikosis:materialish-progress:1.5'
|
||||||
|
implementation 'org.greenrobot:eventbus:3.0.0'
|
||||||
|
implementation 'pl.tajchert:waitingdots:0.1.0'
|
||||||
|
implementation 'com.melnykov:floatingactionbutton:1.3.0'
|
||||||
|
implementation 'com.google.zxing:android-integration:3.1.0'
|
||||||
|
implementation 'mobi.upod:time-duration-picker:1.1.3'
|
||||||
|
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||||
|
implementation 'com.google.zxing:core:3.2.1'
|
||||||
|
implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') {
|
||||||
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
|
}
|
||||||
|
implementation ('cn.carbswang.android:NumberPickerView:1.0.9') {
|
||||||
|
exclude group: 'com.android.support', module: 'appcompat-v7'
|
||||||
|
}
|
||||||
|
implementation ('com.tomergoldst.android:tooltips:1.0.6') {
|
||||||
|
exclude group: 'com.android.support', module: 'appcompat-v7'
|
||||||
|
}
|
||||||
|
implementation ('com.klinkerapps:android-smsmms:4.0.1') {
|
||||||
|
exclude group: 'com.squareup.okhttp', module: 'okhttp'
|
||||||
|
exclude group: 'com.squareup.okhttp', module: 'okhttp-urlconnection'
|
||||||
|
}
|
||||||
|
implementation 'com.annimon:stream:1.1.8'
|
||||||
|
implementation ('com.takisoft.fix:colorpicker:0.9.1') {
|
||||||
|
exclude group: 'com.android.support', module: 'appcompat-v7'
|
||||||
|
exclude group: 'com.android.support', module: 'recyclerview-v7'
|
||||||
|
}
|
||||||
|
|
||||||
|
implementation 'com.airbnb.android:lottie:3.0.7'
|
||||||
|
|
||||||
|
implementation 'com.codewaves.stickyheadergrid:stickyheadergrid:0.9.4'
|
||||||
|
implementation 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3-S2'
|
||||||
|
implementation 'org.signal:android-database-sqlcipher:3.5.9-S3'
|
||||||
|
implementation ('com.googlecode.ez-vcard:ez-vcard:0.9.11') {
|
||||||
|
exclude group: 'com.fasterxml.jackson.core'
|
||||||
|
exclude group: 'org.freemarker'
|
||||||
|
}
|
||||||
|
implementation 'dnsjava:dnsjava:2.1.9'
|
||||||
|
|
||||||
|
flipperImplementation 'com.facebook.flipper:flipper:0.32.2'
|
||||||
|
flipperImplementation 'com.facebook.soloader:soloader:0.8.2'
|
||||||
|
|
||||||
|
testImplementation 'junit:junit:4.12'
|
||||||
|
testImplementation 'org.assertj:assertj-core:3.11.1'
|
||||||
|
testImplementation 'org.mockito:mockito-core:1.9.5'
|
||||||
|
testImplementation 'org.powermock:powermock-api-mockito:1.6.1'
|
||||||
|
testImplementation 'org.powermock:powermock-module-junit4:1.6.1'
|
||||||
|
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1'
|
||||||
|
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1'
|
||||||
|
|
||||||
|
testImplementation 'androidx.test:core:1.2.0'
|
||||||
|
testImplementation ('org.robolectric:robolectric:4.2') {
|
||||||
|
exclude group: 'com.google.protobuf', module: 'protobuf-java'
|
||||||
|
}
|
||||||
|
testImplementation 'org.robolectric:shadows-multidex:4.2'
|
||||||
|
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencyVerification {
|
||||||
|
configuration = '(play|website)(Debug|Release)RuntimeClasspath'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def assembleWebsiteDescriptor = { variant, file ->
|
||||||
|
if (file.exists()) {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||||
|
file.eachByte 4096, {bytes, size ->
|
||||||
|
md.update(bytes, 0, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
String digest = md.digest().collect {String.format "%02x", it}.join();
|
||||||
|
String url = variant.productFlavors.get(0).ext.websiteUpdateUrl
|
||||||
|
String apkName = file.getName()
|
||||||
|
|
||||||
|
String descriptor = "{" +
|
||||||
|
"\"versionCode\" : ${canonicalVersionCode * postFixSize + abiPostFix['universal']}," +
|
||||||
|
"\"versionName\" : \"$canonicalVersionName\"," +
|
||||||
|
"\"sha256sum\" : \"$digest\"," +
|
||||||
|
"\"url\" : \"$url/$apkName\"" +
|
||||||
|
"}"
|
||||||
|
|
||||||
|
File descriptorFile = new File(file.getParent(), apkName.replace(".apk", ".json"))
|
||||||
|
|
||||||
|
descriptorFile.write(descriptor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def signProductionRelease = { variant ->
|
||||||
|
variant.outputs.collect { output ->
|
||||||
|
String apkName = output.outputFile.name
|
||||||
|
File inputFile = new File(output.outputFile.path)
|
||||||
|
File outputFile = new File(output.outputFile.parent, apkName.replace('-unsigned', ''))
|
||||||
|
|
||||||
|
new ApkSignerUtil('sun.security.pkcs11.SunPKCS11',
|
||||||
|
'pkcs11.config',
|
||||||
|
'PKCS11',
|
||||||
|
'file:pkcs11.password').calculateSignature(inputFile.getAbsolutePath(),
|
||||||
|
outputFile.getAbsolutePath())
|
||||||
|
|
||||||
|
inputFile.delete()
|
||||||
|
outputFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task signProductionPlayRelease {
|
||||||
|
doLast {
|
||||||
|
signProductionRelease(android.applicationVariants.find { (it.name == 'playRelease') })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task signProductionWebsiteRelease {
|
||||||
|
doLast {
|
||||||
|
def variant = android.applicationVariants.find { (it.name == 'websiteRelease') }
|
||||||
|
File signedRelease = signProductionRelease(variant).find { it.name.contains('universal') }
|
||||||
|
assembleWebsiteDescriptor(variant, signedRelease)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.whenTaskAdded { task ->
|
||||||
|
if (task.name.equals("assemblePlayRelease")) {
|
||||||
|
task.finalizedBy signProductionPlayRelease
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task.name.equals("assembleWebsiteRelease")) {
|
||||||
|
task.finalizedBy signProductionWebsiteRelease
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getLastCommitTimestamp() {
|
||||||
|
new ByteArrayOutputStream().withStream { os ->
|
||||||
|
def result = exec {
|
||||||
|
executable = 'git'
|
||||||
|
args = ['log', '-1', '--pretty=format:%ct']
|
||||||
|
standardOutput = os
|
||||||
|
}
|
||||||
|
|
||||||
|
return os.toString() + "000"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<issues format="5" by="lint 3.3.2" client="gradle" variant="playRelease" version="3.3.2">
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="MissingPermission"
|
||||||
|
message="Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException`"
|
||||||
|
errorLine1=" List<SubscriptionInfo> list = subscriptionManager.getActiveSubscriptionInfoList();"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/java/org/thoughtcrime/securesms/util/dualsim/SubscriptionManagerCompat.java"
|
||||||
|
line="101"
|
||||||
|
column="35"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="ResourceType"
|
||||||
|
message="Expected resource of type styleable"
|
||||||
|
errorLine1=" drawables.getColor(1, 0xff000000);"
|
||||||
|
errorLine2=" ~">
|
||||||
|
<location
|
||||||
|
file="src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListAdapter.java"
|
||||||
|
line="187"
|
||||||
|
column="36"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="AppLinkUrlError"
|
||||||
|
message="Missing URL"
|
||||||
|
errorLine1=" <intent-filter>"
|
||||||
|
errorLine2=" ^">
|
||||||
|
<location
|
||||||
|
file="AndroidManifest.xml"
|
||||||
|
line="368"
|
||||||
|
column="9"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="AppLinkUrlError"
|
||||||
|
message="Missing URL"
|
||||||
|
errorLine1=" <intent-filter>"
|
||||||
|
errorLine2=" ^">
|
||||||
|
<location
|
||||||
|
file="AndroidManifest.xml"
|
||||||
|
line="381"
|
||||||
|
column="9"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
</issues>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<lint>
|
||||||
|
|
||||||
|
<!-- L10N errors -->
|
||||||
|
<!-- This is a runtime crash so we don't want to ship with this. -->
|
||||||
|
<issue id="StringFormatMatches" severity="error" />
|
||||||
|
|
||||||
|
<!-- L10N warnings -->
|
||||||
|
<issue id="MissingTranslation" severity="warning" />
|
||||||
|
<issue id="MissingQuantity" severity="warning" />
|
||||||
|
<issue id="ExtraTranslation" severity="warning" />
|
||||||
|
<issue id="ImpliedQuantity" severity="warning" />
|
||||||
|
|
||||||
|
<issue id="CanvasSize" severity="error" />
|
||||||
|
<issue id="HardcodedText" severity="error" />
|
||||||
|
<issue id="VectorRaster" severity="error" />
|
||||||
|
<issue id="ButtonOrder" severity="error" />
|
||||||
|
<issue id="ExtraTranslation" severity="warning" />
|
||||||
|
|
||||||
|
<!-- Custom lints -->
|
||||||
|
<issue id="LogNotSignal" severity="error" />
|
||||||
|
<issue id="LogNotAppSignal" severity="error" />
|
||||||
|
<issue id="LogTagInlined" severity="error" />
|
||||||
|
|
||||||
|
<issue id="RestrictedApi" severity="error">
|
||||||
|
<ignore path="*/org/thoughtcrime/securesms/mediasend/camerax/VideoCapture.java" />
|
||||||
|
<ignore path="*/org/thoughtcrime/securesms/mediasend/camerax/CameraXModule.java" />
|
||||||
|
<ignore path="*/org/thoughtcrime/securesms/conversation/*.java" />
|
||||||
|
<ignore path="*/org/thoughtcrime/securesms/lock/v2/CreateKbsPinViewModel.java" />
|
||||||
|
<ignore path="*/org/thoughtcrime/securesms/jobs/StickerPackDownloadJob.java" />
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
</lint>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
-dontoptimize
|
||||||
|
-dontobfuscate
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
-keep class org.whispersystems.** { *; }
|
||||||
|
-keep class org.thoughtcrime.securesms.** { *; }
|
||||||
|
-keepclassmembers class ** {
|
||||||
|
public void onEvent*(**);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Protobuf lite
|
||||||
|
-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"name": "Ottttooooooooo Ocataaaaaaaavius",
|
||||||
|
"number": "+1 (555) 555-5555",
|
||||||
|
"label": "Mobile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Victor Von Doom Phd",
|
||||||
|
"number": "+1 (555) 123-4567",
|
||||||
|
"label": "Home"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Flash Thompson",
|
||||||
|
"number": "+1 (555) 435-1261",
|
||||||
|
"label": "Work"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Dr. Curtis Connors",
|
||||||
|
"number": "+1 (555) 992-1567",
|
||||||
|
"label": "Mobile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Billy Russo",
|
||||||
|
"number": "+1 (555) 234-1516",
|
||||||
|
"label": "Mobile"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package org.thoughtcrime.securesms.lock;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.thoughtcrime.securesms.util.Hex;
|
||||||
|
import org.whispersystems.signalservice.api.kbs.HashedPin;
|
||||||
|
import org.whispersystems.signalservice.api.kbs.KbsData;
|
||||||
|
import org.whispersystems.signalservice.api.kbs.MasterKey;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
public final class PinHashing_hashPin_Test {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void argon2_hashed_pin_password() throws IOException {
|
||||||
|
String pin = "password";
|
||||||
|
byte[] backupId = Hex.fromStringCondensed("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f");
|
||||||
|
MasterKey masterKey = new MasterKey(Hex.fromStringCondensed("202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"));
|
||||||
|
|
||||||
|
HashedPin hashedPin = PinHashing.hashPin(pin, () -> backupId);
|
||||||
|
KbsData kbsData = hashedPin.createNewKbsData(masterKey);
|
||||||
|
|
||||||
|
assertArrayEquals(hashedPin.getKbsAccessKey(), kbsData.getKbsAccessKey());
|
||||||
|
assertArrayEquals(Hex.fromStringCondensed("ab7e8499d21f80a6600b3b9ee349ac6d72c07e3359fe885a934ba7aa844429f8"), kbsData.getKbsAccessKey());
|
||||||
|
assertArrayEquals(Hex.fromStringCondensed("3f33ce58eb25b40436592a30eae2a8fabab1899095f4e2fba6e2d0dc43b4a2d9cac5a3931748522393951e0e54dec769"), kbsData.getCipherText());
|
||||||
|
assertEquals(masterKey, kbsData.getMasterKey());
|
||||||
|
|
||||||
|
String localPinHash = PinHashing.localPinHash(pin);
|
||||||
|
assertTrue(PinHashing.verifyLocalPinHash(localPinHash, pin));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void argon2_hashed_pin_another_password() throws IOException {
|
||||||
|
String pin = "anotherpassword";
|
||||||
|
byte[] backupId = Hex.fromStringCondensed("202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f");
|
||||||
|
MasterKey masterKey = new MasterKey(Hex.fromStringCondensed("88a787415a2ecd79da0d1016a82a27c5c695c9a19b88b0aa1d35683280aa9a67"));
|
||||||
|
|
||||||
|
HashedPin hashedPin = PinHashing.hashPin(pin, () -> backupId);
|
||||||
|
KbsData kbsData = hashedPin.createNewKbsData(masterKey);
|
||||||
|
|
||||||
|
assertArrayEquals(hashedPin.getKbsAccessKey(), kbsData.getKbsAccessKey());
|
||||||
|
assertArrayEquals(Hex.fromStringCondensed("301d9dd1e96f20ce51083f67d3298fd37b97525de8324d5e12ed2d407d3d927b"), kbsData.getKbsAccessKey());
|
||||||
|
assertArrayEquals(Hex.fromStringCondensed("9d9b05402ea39c17ff1c9298c8a0e86784a352aa02a74943bf8bcf07ec0f4b574a5b786ad0182c8d308d9eb06538b8c9"), kbsData.getCipherText());
|
||||||
|
assertEquals(masterKey, kbsData.getMasterKey());
|
||||||
|
|
||||||
|
String localPinHash = PinHashing.localPinHash(pin);
|
||||||
|
assertTrue(PinHashing.verifyLocalPinHash(localPinHash, pin));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void argon2_hashed_pin_password_with_spaces_diacritics_and_non_arabic_numerals() throws IOException {
|
||||||
|
String pin = " Pass६örd ";
|
||||||
|
byte[] backupId = Hex.fromStringCondensed("cba811749042b303a6a7efa5ccd160aea5e3ea243c8d2692bd13d515732f51a8");
|
||||||
|
MasterKey masterKey = new MasterKey(Hex.fromStringCondensed("9571f3fde1e58588ba49bcf82be1b301ca3859a6f59076f79a8f47181ef952bf"));
|
||||||
|
|
||||||
|
HashedPin hashedPin = PinHashing.hashPin(pin, () -> backupId);
|
||||||
|
KbsData kbsData = hashedPin.createNewKbsData(masterKey);
|
||||||
|
|
||||||
|
assertArrayEquals(hashedPin.getKbsAccessKey(), kbsData.getKbsAccessKey());
|
||||||
|
assertArrayEquals(Hex.fromStringCondensed("ab645acdccc1652a48a34b2ac6926340ff35c03034013f68760f20013f028dd8"), kbsData.getKbsAccessKey());
|
||||||
|
assertArrayEquals(Hex.fromStringCondensed("11c0ba1834db15e47c172f6c987c64bd4cfc69c6047dd67a022afeec0165a10943f204d5b8f37b3cb7bab21c6dfc39c8"), kbsData.getCipherText());
|
||||||
|
assertEquals(masterKey, kbsData.getMasterKey());
|
||||||
|
|
||||||
|
assertEquals("577939bccb2b6638c39222d5a97998a867c5e154e30b82cc120f2dd07a3de987", kbsData.getMasterKey().deriveRegistrationLock());
|
||||||
|
|
||||||
|
String localPinHash = PinHashing.localPinHash(pin);
|
||||||
|
assertTrue(PinHashing.verifyLocalPinHash(localPinHash, pin));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void argon2_hashed_pin_password_with_just_non_arabic_numerals() throws IOException {
|
||||||
|
String pin = " ६१८ ";
|
||||||
|
byte[] backupId = Hex.fromStringCondensed("717dc111a98423a57196512606822fca646c653facd037c10728f14ba0be2ab3");
|
||||||
|
MasterKey masterKey = new MasterKey(Hex.fromStringCondensed("0432d735b32f66d0e3a70d4f9cc821a8529521a4937d26b987715d8eff4e4c54"));
|
||||||
|
|
||||||
|
HashedPin hashedPin = PinHashing.hashPin(pin, () -> backupId);
|
||||||
|
KbsData kbsData = hashedPin.createNewKbsData(masterKey);
|
||||||
|
|
||||||
|
|
||||||
|
assertArrayEquals(hashedPin.getKbsAccessKey(), kbsData.getKbsAccessKey());
|
||||||
|
assertArrayEquals(Hex.fromStringCondensed("d2fedabd0d4c17a371491c9722578843a26be3b4923e28d452ab2fc5491e794b"), kbsData.getKbsAccessKey());
|
||||||
|
assertArrayEquals(Hex.fromStringCondensed("877ef871ef1fc668401c717ef21aa12e8523579fb1ff4474b76f28c2293537c80cc7569996c9e0229bea7f378e3a824e"), kbsData.getCipherText());
|
||||||
|
assertEquals(masterKey, kbsData.getMasterKey());
|
||||||
|
|
||||||
|
assertEquals("23a75cb1df1a87df45cc2ed167c2bdc85ab1220b847c88761b0005cac907fce5", kbsData.getMasterKey().deriveRegistrationLock());
|
||||||
|
|
||||||
|
String localPinHash = PinHashing.localPinHash(pin);
|
||||||
|
assertTrue(PinHashing.verifyLocalPinHash(localPinHash, pin));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="org.thoughtcrime.securesms">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".FlipperApplicationContext"
|
||||||
|
tools:replace="android:name"/>
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import com.facebook.flipper.android.AndroidFlipperClient;
|
||||||
|
import com.facebook.flipper.core.FlipperClient;
|
||||||
|
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
|
||||||
|
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
|
||||||
|
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
|
||||||
|
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
|
||||||
|
import com.facebook.soloader.SoLoader;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.database.FlipperSqlCipherAdapter;
|
||||||
|
|
||||||
|
public class FlipperApplicationContext extends ApplicationContext {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
|
||||||
|
SoLoader.init(this, false);
|
||||||
|
|
||||||
|
FlipperClient client = AndroidFlipperClient.getInstance(this);
|
||||||
|
client.addPlugin(new InspectorFlipperPlugin(this, DescriptorMapping.withDefaults()));
|
||||||
|
client.addPlugin(new DatabasesFlipperPlugin(new FlipperSqlCipherAdapter(this)));
|
||||||
|
client.addPlugin(new SharedPreferencesFlipperPlugin(this));
|
||||||
|
client.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
package org.thoughtcrime.securesms.database;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.facebook.flipper.plugins.databases.DatabaseDescriptor;
|
||||||
|
import com.facebook.flipper.plugins.databases.DatabaseDriver;
|
||||||
|
|
||||||
|
import net.sqlcipher.DatabaseUtils;
|
||||||
|
import net.sqlcipher.database.SQLiteDatabase;
|
||||||
|
import net.sqlcipher.database.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A lot of this code is taken from {@link com.facebook.flipper.plugins.databases.impl.SqliteDatabaseDriver}
|
||||||
|
* and made to work with SqlCipher. Unfortunately I couldn't use it directly, nor subclass it.
|
||||||
|
*/
|
||||||
|
public class FlipperSqlCipherAdapter extends DatabaseDriver<FlipperSqlCipherAdapter.Descriptor> {
|
||||||
|
|
||||||
|
public FlipperSqlCipherAdapter(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Descriptor> getDatabases() {
|
||||||
|
return Collections.singletonList(new Descriptor(DatabaseFactory.getRawDatabase(getContext())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getTableNames(Descriptor descriptor) {
|
||||||
|
SQLiteDatabase db = descriptor.getReadable();
|
||||||
|
List<String> tableNames = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Cursor cursor = db.rawQuery("SELECT name FROM sqlite_master WHERE type IN (?, ?)", new String[] { "table", "view" })) {
|
||||||
|
while (cursor != null && cursor.moveToNext()) {
|
||||||
|
tableNames.add(cursor.getString(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tableNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatabaseGetTableDataResponse getTableData(Descriptor descriptor, String table, String order, boolean reverse, int start, int count) {
|
||||||
|
SQLiteDatabase db = descriptor.getReadable();
|
||||||
|
|
||||||
|
long total = DatabaseUtils.queryNumEntries(db, table);
|
||||||
|
String orderBy = order != null ? order + (reverse ? " DESC" : " ASC") : null;
|
||||||
|
String limitBy = start + ", " + count;
|
||||||
|
|
||||||
|
try (Cursor cursor = db.query(table, null, null, null, null, null, orderBy, limitBy)) {
|
||||||
|
String[] columnNames = cursor.getColumnNames();
|
||||||
|
List<List<Object>> rows = cursorToList(cursor);
|
||||||
|
|
||||||
|
return new DatabaseGetTableDataResponse(Arrays.asList(columnNames), rows, start, rows.size(), total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatabaseGetTableStructureResponse getTableStructure(Descriptor descriptor, String table) {
|
||||||
|
SQLiteDatabase db = descriptor.getReadable();
|
||||||
|
|
||||||
|
Map<String, String> foreignKeyValues = new HashMap<>();
|
||||||
|
|
||||||
|
try(Cursor cursor = db.rawQuery("PRAGMA foreign_key_list(" + table + ")", null)) {
|
||||||
|
while (cursor != null && cursor.moveToNext()) {
|
||||||
|
String from = cursor.getString(cursor.getColumnIndex("from"));
|
||||||
|
String to = cursor.getString(cursor.getColumnIndex("to"));
|
||||||
|
String tableName = cursor.getString(cursor.getColumnIndex("table")) + "(" + to + ")";
|
||||||
|
|
||||||
|
foreignKeyValues.put(from, tableName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<String> structureColumns = Arrays.asList("column_name", "data_type", "nullable", "default", "primary_key", "foreign_key");
|
||||||
|
List<List<Object>> structureValues = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Cursor cursor = db.rawQuery("PRAGMA table_info(" + table + ")", null)) {
|
||||||
|
while (cursor != null && cursor.moveToNext()) {
|
||||||
|
String columnName = cursor.getString(cursor.getColumnIndex("name"));
|
||||||
|
String foreignKey = foreignKeyValues.containsKey(columnName) ? foreignKeyValues.get(columnName) : null;
|
||||||
|
|
||||||
|
structureValues.add(Arrays.asList(columnName,
|
||||||
|
cursor.getString(cursor.getColumnIndex("type")),
|
||||||
|
cursor.getInt(cursor.getColumnIndex("notnull")) == 0,
|
||||||
|
getObjectFromColumnIndex(cursor, cursor.getColumnIndex("dflt_value")),
|
||||||
|
cursor.getInt(cursor.getColumnIndex("pk")) == 1,
|
||||||
|
foreignKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<String> indexesColumns = Arrays.asList("index_name", "unique", "indexed_column_name");
|
||||||
|
List<List<Object>> indexesValues = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Cursor indexesCursor = db.rawQuery("PRAGMA index_list(" + table + ")", null)) {
|
||||||
|
List<String> indexedColumnNames = new ArrayList<>();
|
||||||
|
String indexName = indexesCursor.getString(indexesCursor.getColumnIndex("name"));
|
||||||
|
|
||||||
|
try(Cursor indexInfoCursor = db.rawQuery("PRAGMA index_info(" + indexName + ")", null)) {
|
||||||
|
while (indexInfoCursor.moveToNext()) {
|
||||||
|
indexedColumnNames.add(indexInfoCursor.getString(indexInfoCursor.getColumnIndex("name")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
indexesValues.add(Arrays.asList(indexName,
|
||||||
|
indexesCursor.getInt(indexesCursor.getColumnIndex("unique")) == 1,
|
||||||
|
TextUtils.join(",", indexedColumnNames)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return new DatabaseGetTableStructureResponse(structureColumns, structureValues, indexesColumns, indexesValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatabaseGetTableInfoResponse getTableInfo(Descriptor databaseDescriptor, String table) {
|
||||||
|
SQLiteDatabase db = databaseDescriptor.getReadable();
|
||||||
|
|
||||||
|
try (Cursor cursor = db.rawQuery("SELECT sql FROM sqlite_master WHERE name = ?", new String[] { table })) {
|
||||||
|
cursor.moveToFirst();
|
||||||
|
return new DatabaseGetTableInfoResponse(cursor.getString(cursor.getColumnIndex("sql")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatabaseExecuteSqlResponse executeSQL(Descriptor descriptor, String query) {
|
||||||
|
SQLiteDatabase db = descriptor.getWritable();
|
||||||
|
|
||||||
|
String firstWordUpperCase = getFirstWord(query).toUpperCase();
|
||||||
|
|
||||||
|
switch (firstWordUpperCase) {
|
||||||
|
case "UPDATE":
|
||||||
|
case "DELETE":
|
||||||
|
return executeUpdateDelete(db, query);
|
||||||
|
case "INSERT":
|
||||||
|
return executeInsert(db, query);
|
||||||
|
case "SELECT":
|
||||||
|
case "PRAGMA":
|
||||||
|
case "EXPLAIN":
|
||||||
|
return executeSelect(db, query);
|
||||||
|
default:
|
||||||
|
return executeRawQuery(db, query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getFirstWord(String s) {
|
||||||
|
s = s.trim();
|
||||||
|
int firstSpace = s.indexOf(' ');
|
||||||
|
return firstSpace >= 0 ? s.substring(0, firstSpace) : s;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static DatabaseExecuteSqlResponse executeUpdateDelete(SQLiteDatabase database, String query) {
|
||||||
|
SQLiteStatement statement = database.compileStatement(query);
|
||||||
|
int count = statement.executeUpdateDelete();
|
||||||
|
|
||||||
|
return DatabaseExecuteSqlResponse.successfulUpdateDelete(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static DatabaseExecuteSqlResponse executeInsert(SQLiteDatabase database, String query) {
|
||||||
|
SQLiteStatement statement = database.compileStatement(query);
|
||||||
|
long insertedId = statement.executeInsert();
|
||||||
|
|
||||||
|
return DatabaseExecuteSqlResponse.successfulInsert(insertedId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static DatabaseExecuteSqlResponse executeSelect(SQLiteDatabase database, String query) {
|
||||||
|
try (Cursor cursor = database.rawQuery(query, null)) {
|
||||||
|
String[] columnNames = cursor.getColumnNames();
|
||||||
|
List<List<Object>> rows = cursorToList(cursor);
|
||||||
|
|
||||||
|
return DatabaseExecuteSqlResponse.successfulSelect(Arrays.asList(columnNames), rows);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static DatabaseExecuteSqlResponse executeRawQuery(SQLiteDatabase database, String query) {
|
||||||
|
database.execSQL(query);
|
||||||
|
return DatabaseExecuteSqlResponse.successfulRawQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static @NonNull List<List<Object>> cursorToList(Cursor cursor) {
|
||||||
|
List<List<Object>> rows = new ArrayList<>();
|
||||||
|
int numColumns = cursor.getColumnCount();
|
||||||
|
|
||||||
|
while (cursor.moveToNext()) {
|
||||||
|
List<Object> values = new ArrayList<>(numColumns);
|
||||||
|
|
||||||
|
for (int column = 0; column < numColumns; column++) {
|
||||||
|
values.add(getObjectFromColumnIndex(cursor, column));
|
||||||
|
}
|
||||||
|
|
||||||
|
rows.add(values);
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static @Nullable Object getObjectFromColumnIndex(Cursor cursor, int column) {
|
||||||
|
switch (cursor.getType(column)) {
|
||||||
|
case Cursor.FIELD_TYPE_NULL:
|
||||||
|
return null;
|
||||||
|
case Cursor.FIELD_TYPE_INTEGER:
|
||||||
|
return cursor.getLong(column);
|
||||||
|
case Cursor.FIELD_TYPE_FLOAT:
|
||||||
|
return cursor.getDouble(column);
|
||||||
|
case Cursor.FIELD_TYPE_BLOB:
|
||||||
|
return cursor.getBlob(column);
|
||||||
|
case Cursor.FIELD_TYPE_STRING:
|
||||||
|
default:
|
||||||
|
return cursor.getString(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Descriptor implements DatabaseDescriptor {
|
||||||
|
private final SQLCipherOpenHelper sqlCipherOpenHelper;
|
||||||
|
|
||||||
|
Descriptor(@NonNull SQLCipherOpenHelper sqlCipherOpenHelper) {
|
||||||
|
this.sqlCipherOpenHelper = sqlCipherOpenHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String name() {
|
||||||
|
return sqlCipherOpenHelper.getDatabaseName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NonNull SQLiteDatabase getReadable() {
|
||||||
|
return sqlCipherOpenHelper.getReadableDatabase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NonNull SQLiteDatabase getWritable() {
|
||||||
|
return sqlCipherOpenHelper.getWritableDatabase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Signal (Flipper)</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,759 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="org.thoughtcrime.securesms">
|
||||||
|
|
||||||
|
<uses-sdk tools:overrideLibrary="androidx.camera.core,androidx.camera.camera2,androidx.camera.lifecycle" />
|
||||||
|
|
||||||
|
<permission android:name="org.thoughtcrime.securesms.ACCESS_SECRETS"
|
||||||
|
android:label="Access to TextSecure Secrets"
|
||||||
|
android:protectionLevel="signature" />
|
||||||
|
|
||||||
|
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||||
|
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
|
||||||
|
<uses-feature android:name="android.hardware.location" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.hardware.location.network" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.hardware.microphone" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.hardware.wifi" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.hardware.portrait" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
|
||||||
|
<uses-permission android:name="org.thoughtcrime.securesms.ACCESS_SECRETS"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_PROFILE"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_PROFILE"/>
|
||||||
|
<uses-permission android:name="android.permission.BROADCAST_WAP_PUSH"
|
||||||
|
tools:ignore="ProtectedPermissions"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_MMS"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_SMS"/>
|
||||||
|
<uses-permission android:name="android.permission.SEND_SMS"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_SMS"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
|
<uses-permission android:name="android.permission.READ_CALL_STATE"/>
|
||||||
|
|
||||||
|
<!-- For sending/receiving events -->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_CALENDAR"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Normal -->
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||||
|
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||||
|
|
||||||
|
<!-- So we can add a TextSecure 'Account' -->
|
||||||
|
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
|
||||||
|
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
|
||||||
|
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
|
||||||
|
|
||||||
|
<!-- For conversation 'shortcuts' on the desktop -->
|
||||||
|
<uses-permission android:name="android.permission.INSTALL_SHORTCUT"/>
|
||||||
|
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||||
|
|
||||||
|
<!-- For fixing MMS -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||||
|
|
||||||
|
<!-- Set image as wallpaper -->
|
||||||
|
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
|
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||||
|
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||||
|
<uses-permission android:name="android.permission.RAISED_THREAD_PRIORITY" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||||
|
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
|
||||||
|
|
||||||
|
<application android:name=".ApplicationContext"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
tools:replace="android:allowBackup"
|
||||||
|
android:allowBackup="false"
|
||||||
|
android:theme="@style/TextSecure.LightTheme"
|
||||||
|
android:largeHeap="true">
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.geo.API_KEY"
|
||||||
|
android:value="AIzaSyCSx9xea86GwDKGznCAULE9Y5a8b-TfN9U"/>
|
||||||
|
|
||||||
|
<meta-data android:name="com.google.android.gms.version"
|
||||||
|
android:value="@integer/google_play_services_version" />
|
||||||
|
|
||||||
|
<meta-data android:name="com.google.android.gms.car.application"
|
||||||
|
android:resource="@xml/automotive_app_desc" />
|
||||||
|
|
||||||
|
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
|
||||||
|
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
|
||||||
|
<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false" />
|
||||||
|
|
||||||
|
<activity android:name="org.thoughtcrime.securesms.WebRtcCallActivity"
|
||||||
|
android:theme="@style/TextSecure.LightTheme.WebRTCCall"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:supportsPictureInPicture="true"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
||||||
|
android:launchMode="singleTask"/>
|
||||||
|
|
||||||
|
<activity android:name=".InviteActivity"
|
||||||
|
android:theme="@style/Signal.Light.NoActionBar.Invite"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:parentActivityName=".MainActivity"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value="org.thoughtcrime.securesms.MainActivity" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".PromptMmsActivity"
|
||||||
|
android:label="Configure MMS Settings"
|
||||||
|
android:windowSoftInputMode="stateUnchanged"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".DeviceProvisioningActivity"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="tsdevice"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".preferences.MmsPreferencesActivity"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".sharing.ShareActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:taskAffinity=""
|
||||||
|
android:noHistory="true"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
<data android:mimeType="audio/*" />
|
||||||
|
<data android:mimeType="image/*" />
|
||||||
|
<data android:mimeType="text/plain" />
|
||||||
|
<data android:mimeType="video/*" />
|
||||||
|
<data android:mimeType="application/*"/>
|
||||||
|
<data android:mimeType="text/*"/>
|
||||||
|
<data android:mimeType="*/*"/>
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
<data android:mimeType="image/*" />
|
||||||
|
<data android:mimeType="video/*" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.service.chooser.chooser_target_service"
|
||||||
|
android:value=".service.DirectShareService" />
|
||||||
|
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".stickers.StickerPackPreviewActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:noHistory="true"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="sgnl"
|
||||||
|
android:host="addstickers" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https"
|
||||||
|
android:host="signal.art"
|
||||||
|
android:pathPrefix="/addstickers"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity-alias android:name=".RoutingActivity"
|
||||||
|
android:targetActivity=".MainActivity"
|
||||||
|
android:exported="true">
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data android:name="com.sec.minimode.icon.portrait.normal"
|
||||||
|
android:resource="@mipmap/ic_launcher" />
|
||||||
|
<meta-data android:name="com.sec.minimode.icon.landscape.normal"
|
||||||
|
android:resource="@mipmap/ic_launcher" />
|
||||||
|
|
||||||
|
</activity-alias>
|
||||||
|
|
||||||
|
<activity android:name=".conversation.ConversationActivity"
|
||||||
|
android:windowSoftInputMode="stateUnchanged"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
||||||
|
android:parentActivityName=".MainActivity">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value="org.thoughtcrime.securesms.MainActivity" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".longmessage.LongMessageActivity" />
|
||||||
|
|
||||||
|
<activity android:name=".conversation.ConversationPopupActivity"
|
||||||
|
android:windowSoftInputMode="stateVisible"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:taskAffinity=""
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:theme="@style/TextSecure.LightTheme.Popup"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" />
|
||||||
|
|
||||||
|
<activity android:name=".MessageDetailsActivity"
|
||||||
|
android:label="@string/AndroidManifest__message_details"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".GroupCreateActivity"
|
||||||
|
android:windowSoftInputMode="stateVisible"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".groups.ui.pendingmemberinvites.PendingMemberInvitesActivity"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar" />
|
||||||
|
|
||||||
|
<activity android:name=".groups.ui.managegroup.ManageGroupActivity"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".DatabaseMigrationActivity"
|
||||||
|
android:theme="@style/NoAnimation.Theme.AppCompat.Light.DarkActionBar"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".migrations.ApplicationMigrationActivity"
|
||||||
|
android:theme="@style/NoAnimation.Theme.AppCompat.Light.DarkActionBar"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".PassphraseCreateActivity"
|
||||||
|
android:label="@string/AndroidManifest__create_passphrase"
|
||||||
|
android:windowSoftInputMode="stateUnchanged"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".PassphrasePromptActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:theme="@style/TextSecure.LightIntroTheme"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".NewConversationActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:windowSoftInputMode="stateAlwaysVisible"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".PushContactSelectionActivity"
|
||||||
|
android:label="@string/AndroidManifest__select_contacts"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".giph.ui.GiphyActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".mediasend.MediaSendActivity"
|
||||||
|
android:theme="@style/TextSecure.FullScreenMedia"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".PassphraseChangeActivity"
|
||||||
|
android:label="@string/AndroidManifest__change_passphrase"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".VerifyIdentityActivity"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".ApplicationPreferencesActivity"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".registration.RegistrationNavigationActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:theme="@style/TextSecure.LightRegistrationTheme"
|
||||||
|
android:windowSoftInputMode="stateUnchanged"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".revealable.ViewOnceMessageActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:theme="@style/TextSecure.FullScreenMedia"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".stickers.StickerManagementActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:theme="@style/TextSecure.LightTheme"
|
||||||
|
android:windowSoftInputMode="stateUnchanged"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".DeviceActivity"
|
||||||
|
android:label="@string/AndroidManifest__linked_devices"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".logsubmit.SubmitDebugLogActivity"
|
||||||
|
android:label="@string/AndroidManifest__log_submit"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".MediaPreviewActivity"
|
||||||
|
android:label="@string/AndroidManifest__media_preview"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".AvatarPreviewActivity"
|
||||||
|
android:label="@string/AndroidManifest__media_preview"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".mediaoverview.MediaOverviewActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".DummyActivity"
|
||||||
|
android:theme="@android:style/Theme.NoDisplay"
|
||||||
|
android:enabled="true"
|
||||||
|
android:allowTaskReparenting="true"
|
||||||
|
android:noHistory="true"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:alwaysRetainTaskState="false"
|
||||||
|
android:stateNotNeeded="true"
|
||||||
|
android:clearTaskOnLaunch="true"
|
||||||
|
android:finishOnTaskLaunch="true" />
|
||||||
|
|
||||||
|
<activity android:name=".PlayServicesProblemActivity"
|
||||||
|
android:theme="@style/TextSecure.DialogActivity"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".SmsSendtoActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SENDTO" />
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="sms" />
|
||||||
|
<data android:scheme="smsto" />
|
||||||
|
<data android:scheme="mms" />
|
||||||
|
<data android:scheme="mmsto" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.contact" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name="org.thoughtcrime.securesms.webrtc.VoiceCallShare"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:theme="@style/NoAnimation.Theme.BlackScreen"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.call" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".RecipientPreferenceActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".mediasend.AvatarSelectionActivity"
|
||||||
|
android:theme="@style/TextSecure.FullScreenMedia"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".BlockedContactsActivity"
|
||||||
|
android:theme="@style/TextSecure.LightTheme"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".scribbles.ImageEditorStickerSelectActivity"
|
||||||
|
android:theme="@style/TextSecure.DarkTheme"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".profiles.edit.EditProfileActivity"
|
||||||
|
android:theme="@style/TextSecure.LightRegistrationTheme"
|
||||||
|
android:windowSoftInputMode="stateVisible|adjustResize" />
|
||||||
|
|
||||||
|
<activity android:name=".lock.v2.CreateKbsPinActivity"
|
||||||
|
android:theme="@style/TextSecure.LightRegistrationTheme"
|
||||||
|
android:windowSoftInputMode="adjustResize"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".lock.v2.KbsMigrationActivity"
|
||||||
|
android:theme="@style/TextSecure.LightRegistrationTheme"
|
||||||
|
android:windowSoftInputMode="adjustResize"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".ClearProfileAvatarActivity"
|
||||||
|
android:theme="@style/Theme.AppCompat.Dialog.Alert"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
||||||
|
android:icon="@drawable/clear_profile_avatar"
|
||||||
|
android:label="@string/AndroidManifest_remove_photo">
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO"/>
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".messagerequests.MessageRequestMegaphoneActivity"
|
||||||
|
android:theme="@style/TextSecure.LightRegistrationTheme"
|
||||||
|
android:windowSoftInputMode="adjustResize"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".contactshare.ContactShareEditActivity"
|
||||||
|
android:theme="@style/TextSecure.LightTheme"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".contactshare.ContactNameEditActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".contactshare.SharedContactDetailsActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".ShortcutLauncherActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:exported="true"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".maps.PlacePickerActivity"
|
||||||
|
android:label="@string/PlacePickerActivity_title"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
|
<activity android:name=".MainActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" />
|
||||||
|
|
||||||
|
<activity android:name=".pin.PinRestoreActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" />
|
||||||
|
|
||||||
|
<activity android:name=".groups.ui.creategroup.CreateGroupActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar" />
|
||||||
|
|
||||||
|
<activity android:name=".groups.ui.addmembers.AddMembersActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar" />
|
||||||
|
|
||||||
|
<activity android:name=".groups.ui.creategroup.details.AddGroupDetailsActivity"
|
||||||
|
android:theme="@style/TextSecure.LightNoActionBar" />
|
||||||
|
|
||||||
|
<service android:enabled="true" android:name="org.thoughtcrime.securesms.service.WebRtcCallService"/>
|
||||||
|
<service android:enabled="true" android:name=".service.ApplicationMigrationService"/>
|
||||||
|
<service android:enabled="true" android:exported="false" android:name=".service.KeyCachingService"/>
|
||||||
|
<service android:enabled="true" android:name=".messages.IncomingMessageObserver$ForegroundService"/>
|
||||||
|
|
||||||
|
<service android:name=".service.QuickResponseService"
|
||||||
|
android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
|
||||||
|
android:exported="true" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:scheme="sms" />
|
||||||
|
<data android:scheme="smsto" />
|
||||||
|
<data android:scheme="mms" />
|
||||||
|
<data android:scheme="mmsto" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service android:name=".service.AccountAuthenticatorService" android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.accounts.AccountAuthenticator" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator" />
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service android:name=".service.ContactsSyncAdapterService" android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.content.SyncAdapter"/>
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:name="android.content.SyncAdapter" android:resource="@xml/syncadapter" />
|
||||||
|
<meta-data android:name="android.provider.CONTACTS_STRUCTURE" android:resource="@xml/contactsformat" />
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service android:name=".service.DirectShareService"
|
||||||
|
android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.service.chooser.ChooserTargetService" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service android:name=".service.GenericForegroundService"/>
|
||||||
|
|
||||||
|
<service android:name=".gcm.FcmFetchService" />
|
||||||
|
|
||||||
|
<service android:name=".gcm.FcmReceiveService">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<receiver android:name=".service.SmsListener"
|
||||||
|
android:permission="android.permission.BROADCAST_SMS"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter android:priority="1001">
|
||||||
|
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.provider.Telephony.SMS_DELIVER"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".service.SmsDeliveryListener"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.services.MESSAGE_SENT"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".service.MmsListener"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true"
|
||||||
|
android:permission="android.permission.BROADCAST_WAP_PUSH">
|
||||||
|
<intent-filter android:priority="1001">
|
||||||
|
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED"/>
|
||||||
|
<data android:mimeType="application/vnd.wap.mms-message" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER"/>
|
||||||
|
<data android:mimeType="application/vnd.wap.mms-message" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".notifications.MarkReadReceiver"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.notifications.CLEAR"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".notifications.RemoteReplyReceiver"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.notifications.WEAR_REPLY"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".notifications.AndroidAutoHeardReceiver"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.notifications.ANDROID_AUTO_HEARD"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".notifications.AndroidAutoReplyReceiver"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.notifications.ANDROID_AUTO_REPLY"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".service.ExpirationListener" />
|
||||||
|
|
||||||
|
<receiver android:name=".revealable.ViewOnceMessageManager$ViewOnceAlarm" />
|
||||||
|
|
||||||
|
<provider android:name=".providers.PartProvider"
|
||||||
|
android:grantUriPermissions="true"
|
||||||
|
android:exported="false"
|
||||||
|
android:authorities="org.thoughtcrime.provider.securesms" />
|
||||||
|
|
||||||
|
<provider android:name=".providers.MmsBodyProvider"
|
||||||
|
android:grantUriPermissions="true"
|
||||||
|
android:exported="false"
|
||||||
|
android:authorities="org.thoughtcrime.provider.securesms.mms" />
|
||||||
|
|
||||||
|
<provider android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="org.thoughtcrime.securesms.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
|
||||||
|
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_provider_paths" />
|
||||||
|
|
||||||
|
</provider>
|
||||||
|
|
||||||
|
<provider android:name=".database.DatabaseContentProviders$Conversation"
|
||||||
|
android:authorities="org.thoughtcrime.securesms.database.conversation"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
|
<provider android:name=".database.DatabaseContentProviders$ConversationList"
|
||||||
|
android:authorities="org.thoughtcrime.securesms.database.conversationlist"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
|
<provider android:name=".database.DatabaseContentProviders$Attachment"
|
||||||
|
android:authorities="org.thoughtcrime.securesms.database.attachment"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
|
<provider android:name=".database.DatabaseContentProviders$Sticker"
|
||||||
|
android:authorities="org.thoughtcrime.securesms.database.sticker"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
|
<provider android:name=".database.DatabaseContentProviders$StickerPack"
|
||||||
|
android:authorities="org.thoughtcrime.securesms.database.stickerpack"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
|
<receiver android:name=".service.BootReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.RESTART"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".service.DirectoryRefreshListener">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".service.RotateSignedPreKeyListener">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".service.RotateSenderCertificateListener">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".service.LocalBackupListener">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".service.PersistentConnectionBootListener">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".notifications.LocaleChangedReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.LOCALE_CHANGED"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".notifications.MessageNotifier$ReminderReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.MessageNotifier.REMINDER_ACTION"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".notifications.DeleteNotificationReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.thoughtcrime.securesms.DELETE_NOTIFICATION"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name=".service.PanicResponderListener"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="info.guardianproject.panic.action.TRIGGER" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".gcm.FcmJobService"
|
||||||
|
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||||
|
android:enabled="@bool/enable_job_service"
|
||||||
|
tools:targetApi="26" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".jobmanager.JobSchedulerScheduler$SystemService"
|
||||||
|
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||||
|
android:enabled="@bool/enable_job_service"
|
||||||
|
tools:targetApi="26" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".jobmanager.KeepAliveService"
|
||||||
|
android:enabled="@bool/enable_alarm_manager" />
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name=".jobmanager.AlarmManagerScheduler$RetryReceiver"
|
||||||
|
android:enabled="@bool/enable_alarm_manager" />
|
||||||
|
|
||||||
|
<!-- Probably don't need this one -->
|
||||||
|
<receiver
|
||||||
|
android:name=".jobmanager.BootReceiver"
|
||||||
|
android:enabled="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
||||||
|
|
||||||
|
<uses-library android:name="com.sec.android.app.multiwindow" android:required="false"/>
|
||||||
|
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
||||||
|
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
|
||||||
|
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
|
||||||
|
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
|
||||||
|
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
|
After Width: | Height: | Size: 225 KiB |
|
After Width: | Height: | Size: 415 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 344 KiB |
|
After Width: | Height: | Size: 395 KiB |
|
After Width: | Height: | Size: 622 KiB |
|
After Width: | Height: | Size: 599 KiB |
|
After Width: | Height: | Size: 559 KiB |
|
After Width: | Height: | Size: 643 KiB |
|
After Width: | Height: | Size: 647 KiB |
|
After Width: | Height: | Size: 602 KiB |
|
After Width: | Height: | Size: 589 KiB |
|
After Width: | Height: | Size: 531 KiB |
|
After Width: | Height: | Size: 589 KiB |
|
After Width: | Height: | Size: 384 KiB |
@@ -0,0 +1,20 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||||
|
import org.whispersystems.signalservice.api.profiles.SignalServiceProfile;
|
||||||
|
|
||||||
|
public final class AppCapabilities {
|
||||||
|
|
||||||
|
private AppCapabilities() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final boolean UUID_CAPABLE = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param storageCapable Whether or not the user can use storage service. This is another way of
|
||||||
|
* asking if the user has set a Signal PIN or not.
|
||||||
|
*/
|
||||||
|
public static SignalServiceProfile.Capabilities getCapabilities(boolean storageCapable) {
|
||||||
|
return new SignalServiceProfile.Capabilities(UUID_CAPABLE, FeatureFlags.groupsV2(), storageCapable);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
|
import org.thoughtcrime.securesms.insights.InsightsOptOut;
|
||||||
|
import org.thoughtcrime.securesms.jobmanager.JobManager;
|
||||||
|
import org.thoughtcrime.securesms.jobs.StickerPackDownloadJob;
|
||||||
|
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||||
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.migrations.ApplicationMigrations;
|
||||||
|
import org.thoughtcrime.securesms.stickers.BlessedPacks;
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rule of thumb: if there's something you want to do on the first app launch that involves
|
||||||
|
* persisting state to the database, you'll almost certainly *also* want to do it post backup
|
||||||
|
* restore, since a backup restore will wipe the current state of the database.
|
||||||
|
*/
|
||||||
|
public final class AppInitialization {
|
||||||
|
|
||||||
|
private static final String TAG = Log.tag(AppInitialization.class);
|
||||||
|
|
||||||
|
private AppInitialization() {}
|
||||||
|
|
||||||
|
public static void onFirstEverAppLaunch(@NonNull Context context) {
|
||||||
|
Log.i(TAG, "onFirstEverAppLaunch()");
|
||||||
|
|
||||||
|
InsightsOptOut.userRequestedOptOut(context);
|
||||||
|
TextSecurePreferences.setAppMigrationVersion(context, ApplicationMigrations.CURRENT_VERSION);
|
||||||
|
TextSecurePreferences.setJobManagerVersion(context, JobManager.CURRENT_VERSION);
|
||||||
|
TextSecurePreferences.setLastExperienceVersionCode(context, Util.getCanonicalVersionCode());
|
||||||
|
TextSecurePreferences.setHasSeenStickerIntroTooltip(context, true);
|
||||||
|
ApplicationDependencies.getMegaphoneRepository().onFirstEverAppLaunch();
|
||||||
|
SignalStore.onFirstEverAppLaunch();
|
||||||
|
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forInstall(BlessedPacks.ZOZO.getPackId(), BlessedPacks.ZOZO.getPackKey(), false));
|
||||||
|
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forInstall(BlessedPacks.BANDIT.getPackId(), BlessedPacks.BANDIT.getPackKey(), false));
|
||||||
|
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forReference(BlessedPacks.SWOON_HANDS.getPackId(), BlessedPacks.SWOON_HANDS.getPackKey()));
|
||||||
|
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forReference(BlessedPacks.SWOON_FACES.getPackId(), BlessedPacks.SWOON_FACES.getPackKey()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onPostBackupRestore(@NonNull Context context) {
|
||||||
|
Log.i(TAG, "onPostBackupRestore()");
|
||||||
|
|
||||||
|
ApplicationDependencies.getMegaphoneRepository().onFirstEverAppLaunch();
|
||||||
|
SignalStore.onFirstEverAppLaunch();
|
||||||
|
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forInstall(BlessedPacks.ZOZO.getPackId(), BlessedPacks.ZOZO.getPackKey(), false));
|
||||||
|
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forInstall(BlessedPacks.BANDIT.getPackId(), BlessedPacks.BANDIT.getPackKey(), false));
|
||||||
|
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forReference(BlessedPacks.SWOON_HANDS.getPackId(), BlessedPacks.SWOON_HANDS.getPackKey()));
|
||||||
|
ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forReference(BlessedPacks.SWOON_FACES.getPackId(), BlessedPacks.SWOON_FACES.getPackKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,24 +17,22 @@
|
|||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
|
||||||
import androidx.camera.camera2.Camera2AppConfig;
|
|
||||||
import androidx.camera.core.CameraX;
|
|
||||||
import androidx.lifecycle.DefaultLifecycleObserver;
|
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
|
||||||
import androidx.lifecycle.ProcessLifecycleOwner;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import androidx.lifecycle.DefaultLifecycleObserver;
|
||||||
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
import androidx.lifecycle.ProcessLifecycleOwner;
|
||||||
import androidx.multidex.MultiDexApplication;
|
import androidx.multidex.MultiDexApplication;
|
||||||
|
|
||||||
import com.google.android.gms.security.ProviderInstaller;
|
import com.google.android.gms.security.ProviderInstaller;
|
||||||
|
|
||||||
import org.conscrypt.Conscrypt;
|
import org.conscrypt.Conscrypt;
|
||||||
import org.signal.aesgcmprovider.AesGcmProvider;
|
import org.signal.aesgcmprovider.AesGcmProvider;
|
||||||
import org.signal.ringrtc.CallConnectionFactory;
|
import org.signal.ringrtc.CallManager;
|
||||||
import org.thoughtcrime.securesms.components.TypingStatusRepository;
|
import org.thoughtcrime.securesms.components.TypingStatusRepository;
|
||||||
import org.thoughtcrime.securesms.components.TypingStatusSender;
|
import org.thoughtcrime.securesms.components.TypingStatusSender;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
@@ -42,37 +40,36 @@ import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper;
|
|||||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencyProvider;
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencyProvider;
|
||||||
import org.thoughtcrime.securesms.gcm.FcmJobService;
|
import org.thoughtcrime.securesms.gcm.FcmJobService;
|
||||||
import org.thoughtcrime.securesms.jobmanager.JobManager;
|
|
||||||
import org.thoughtcrime.securesms.jobmanager.JobMigrator;
|
|
||||||
import org.thoughtcrime.securesms.jobmanager.impl.JsonDataSerializer;
|
|
||||||
import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob;
|
import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob;
|
||||||
import org.thoughtcrime.securesms.jobs.FastJobStorage;
|
|
||||||
import org.thoughtcrime.securesms.jobs.FcmRefreshJob;
|
import org.thoughtcrime.securesms.jobs.FcmRefreshJob;
|
||||||
import org.thoughtcrime.securesms.jobs.JobManagerFactories;
|
|
||||||
import org.thoughtcrime.securesms.jobs.MultiDeviceContactUpdateJob;
|
import org.thoughtcrime.securesms.jobs.MultiDeviceContactUpdateJob;
|
||||||
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
|
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
|
||||||
import org.thoughtcrime.securesms.jobs.RefreshUnidentifiedDeliveryAbilityJob;
|
import org.thoughtcrime.securesms.jobs.RefreshPreKeysJob;
|
||||||
import org.thoughtcrime.securesms.logging.AndroidLogger;
|
import org.thoughtcrime.securesms.logging.AndroidLogger;
|
||||||
import org.thoughtcrime.securesms.logging.CustomSignalProtocolLogger;
|
import org.thoughtcrime.securesms.logging.CustomSignalProtocolLogger;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import org.thoughtcrime.securesms.logging.PersistentLogger;
|
import org.thoughtcrime.securesms.logging.PersistentLogger;
|
||||||
import org.thoughtcrime.securesms.logging.UncaughtExceptionLogger;
|
import org.thoughtcrime.securesms.logging.SignalUncaughtExceptionHandler;
|
||||||
|
import org.thoughtcrime.securesms.messages.InitialMessageRetriever;
|
||||||
import org.thoughtcrime.securesms.migrations.ApplicationMigrations;
|
import org.thoughtcrime.securesms.migrations.ApplicationMigrations;
|
||||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
|
||||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||||
import org.thoughtcrime.securesms.providers.BlobProvider;
|
import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||||
import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess;
|
import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess;
|
||||||
|
import org.thoughtcrime.securesms.registration.RegistrationUtil;
|
||||||
|
import org.thoughtcrime.securesms.revealable.ViewOnceMessageManager;
|
||||||
|
import org.thoughtcrime.securesms.ringrtc.RingRtcLogger;
|
||||||
import org.thoughtcrime.securesms.service.DirectoryRefreshListener;
|
import org.thoughtcrime.securesms.service.DirectoryRefreshListener;
|
||||||
import org.thoughtcrime.securesms.service.ExpiringMessageManager;
|
import org.thoughtcrime.securesms.service.ExpiringMessageManager;
|
||||||
import org.thoughtcrime.securesms.service.IncomingMessageObserver;
|
import org.thoughtcrime.securesms.messages.IncomingMessageObserver;
|
||||||
import org.thoughtcrime.securesms.service.KeyCachingService;
|
import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||||
import org.thoughtcrime.securesms.service.LocalBackupListener;
|
import org.thoughtcrime.securesms.service.LocalBackupListener;
|
||||||
import org.thoughtcrime.securesms.revealable.ViewOnceMessageManager;
|
|
||||||
import org.thoughtcrime.securesms.service.RotateSenderCertificateListener;
|
import org.thoughtcrime.securesms.service.RotateSenderCertificateListener;
|
||||||
import org.thoughtcrime.securesms.service.RotateSignedPreKeyListener;
|
import org.thoughtcrime.securesms.service.RotateSignedPreKeyListener;
|
||||||
import org.thoughtcrime.securesms.service.UpdateApkRefreshListener;
|
import org.thoughtcrime.securesms.service.UpdateApkRefreshListener;
|
||||||
|
import org.thoughtcrime.securesms.storage.StorageSyncHelper;
|
||||||
|
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.thoughtcrime.securesms.util.VersionTracker;
|
import org.thoughtcrime.securesms.util.concurrent.SignalExecutors;
|
||||||
import org.thoughtcrime.securesms.util.dynamiclanguage.DynamicLanguageContextWrapper;
|
import org.thoughtcrime.securesms.util.dynamiclanguage.DynamicLanguageContextWrapper;
|
||||||
import org.webrtc.voiceengine.WebRtcAudioManager;
|
import org.webrtc.voiceengine.WebRtcAudioManager;
|
||||||
import org.webrtc.voiceengine.WebRtcAudioUtils;
|
import org.webrtc.voiceengine.WebRtcAudioUtils;
|
||||||
@@ -115,8 +112,8 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||||||
initializeSecurityProvider();
|
initializeSecurityProvider();
|
||||||
initializeLogging();
|
initializeLogging();
|
||||||
initializeCrashHandling();
|
initializeCrashHandling();
|
||||||
initializeFirstEverAppLaunch();
|
|
||||||
initializeAppDependencies();
|
initializeAppDependencies();
|
||||||
|
initializeFirstEverAppLaunch();
|
||||||
initializeApplicationMigrations();
|
initializeApplicationMigrations();
|
||||||
initializeMessageRetrieval();
|
initializeMessageRetrieval();
|
||||||
initializeExpiringMessageManager();
|
initializeExpiringMessageManager();
|
||||||
@@ -129,10 +126,14 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||||||
initializeCircumvention();
|
initializeCircumvention();
|
||||||
initializeRingRtc();
|
initializeRingRtc();
|
||||||
initializePendingMessages();
|
initializePendingMessages();
|
||||||
initializeUnidentifiedDeliveryAbilityRefresh();
|
|
||||||
initializeBlobProvider();
|
initializeBlobProvider();
|
||||||
initializeCameraX();
|
initializeCleanup();
|
||||||
|
|
||||||
|
FeatureFlags.init();
|
||||||
NotificationChannels.create(this);
|
NotificationChannels.create(this);
|
||||||
|
RefreshPreKeysJob.scheduleIfNecessary();
|
||||||
|
StorageSyncHelper.scheduleRoutineSync();
|
||||||
|
RegistrationUtil.markRegistrationPossiblyComplete();
|
||||||
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
|
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < 21) {
|
if (Build.VERSION.SDK_INT < 21) {
|
||||||
@@ -146,9 +147,13 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||||||
public void onStart(@NonNull LifecycleOwner owner) {
|
public void onStart(@NonNull LifecycleOwner owner) {
|
||||||
isAppVisible = true;
|
isAppVisible = true;
|
||||||
Log.i(TAG, "App is now visible.");
|
Log.i(TAG, "App is now visible.");
|
||||||
|
FeatureFlags.refreshIfNecessary();
|
||||||
ApplicationDependencies.getRecipientCache().warmUp();
|
ApplicationDependencies.getRecipientCache().warmUp();
|
||||||
executePendingContactSync();
|
executePendingContactSync();
|
||||||
KeyCachingService.onAppForegrounded(this);
|
KeyCachingService.onAppForegrounded(this);
|
||||||
|
ApplicationDependencies.getFrameRateTracker().begin();
|
||||||
|
ApplicationDependencies.getMegaphoneRepository().onAppForegrounded();
|
||||||
|
catchUpOnMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -156,7 +161,8 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||||||
isAppVisible = false;
|
isAppVisible = false;
|
||||||
Log.i(TAG, "App is no longer visible.");
|
Log.i(TAG, "App is no longer visible.");
|
||||||
KeyCachingService.onAppBackgrounded(this);
|
KeyCachingService.onAppBackgrounded(this);
|
||||||
MessageNotifier.setVisibleThread(-1);
|
ApplicationDependencies.getMessageNotifier().clearVisibleThread();
|
||||||
|
ApplicationDependencies.getFrameRateTracker().end();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExpiringMessageManager getExpiringMessageManager() {
|
public ExpiringMessageManager getExpiringMessageManager() {
|
||||||
@@ -216,7 +222,7 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||||||
|
|
||||||
private void initializeCrashHandling() {
|
private void initializeCrashHandling() {
|
||||||
final Thread.UncaughtExceptionHandler originalHandler = Thread.getDefaultUncaughtExceptionHandler();
|
final Thread.UncaughtExceptionHandler originalHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionLogger(originalHandler));
|
Thread.setDefaultUncaughtExceptionHandler(new SignalUncaughtExceptionHandler(originalHandler));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeApplicationMigrations() {
|
private void initializeApplicationMigrations() {
|
||||||
@@ -235,9 +241,7 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||||||
if (TextSecurePreferences.getFirstInstallVersion(this) == -1) {
|
if (TextSecurePreferences.getFirstInstallVersion(this) == -1) {
|
||||||
if (!SQLCipherOpenHelper.databaseFileExists(this)) {
|
if (!SQLCipherOpenHelper.databaseFileExists(this)) {
|
||||||
Log.i(TAG, "First ever app launch!");
|
Log.i(TAG, "First ever app launch!");
|
||||||
|
AppInitialization.onFirstEverAppLaunch(this);
|
||||||
TextSecurePreferences.setAppMigrationVersion(this, ApplicationMigrations.CURRENT_VERSION);
|
|
||||||
TextSecurePreferences.setJobManagerVersion(this, JobManager.CURRENT_VERSION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(TAG, "Setting first install version to " + BuildConfig.CANONICAL_VERSION_CODE);
|
Log.i(TAG, "Setting first install version to " + BuildConfig.CANONICAL_VERSION_CODE);
|
||||||
@@ -298,6 +302,7 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||||||
add("Moto G4");
|
add("Moto G4");
|
||||||
add("TA-1053");
|
add("TA-1053");
|
||||||
add("Mi A1");
|
add("Mi A1");
|
||||||
|
add("Mi A2");
|
||||||
add("E5823"); // Sony z5 compact
|
add("E5823"); // Sony z5 compact
|
||||||
add("Redmi Note 5");
|
add("Redmi Note 5");
|
||||||
add("FP2"); // Fairphone FP2
|
add("FP2"); // Fairphone FP2
|
||||||
@@ -317,9 +322,9 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||||||
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CallConnectionFactory.initialize(this);
|
CallManager.initialize(this, new RingRtcLogger());
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
Log.w(TAG, e);
|
throw new AssertionError("Unable to load ringrtc library", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,29 +365,47 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeUnidentifiedDeliveryAbilityRefresh() {
|
|
||||||
if (TextSecurePreferences.isMultiDevice(this) && !TextSecurePreferences.isUnidentifiedDeliveryEnabled(this)) {
|
|
||||||
ApplicationDependencies.getJobManager().add(new RefreshUnidentifiedDeliveryAbilityJob());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeBlobProvider() {
|
private void initializeBlobProvider() {
|
||||||
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> {
|
SignalExecutors.BOUNDED.execute(() -> {
|
||||||
BlobProvider.getInstance().onSessionStart(this);
|
BlobProvider.getInstance().onSessionStart(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
private void initializeCleanup() {
|
||||||
private void initializeCameraX() {
|
SignalExecutors.BOUNDED.execute(() -> {
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
int deleted = DatabaseFactory.getAttachmentDatabase(this).deleteAbandonedPreuploadedAttachments();
|
||||||
new Thread(() -> {
|
Log.i(TAG, "Deleted " + deleted + " abandoned attachments.");
|
||||||
try {
|
});
|
||||||
CameraX.init(this, Camera2AppConfig.create(this));
|
}
|
||||||
} catch (Throwable t) {
|
|
||||||
Log.w(TAG, "Failed to initialize CameraX.");
|
private void catchUpOnMessages() {
|
||||||
}
|
InitialMessageRetriever retriever = ApplicationDependencies.getInitialMessageRetriever();
|
||||||
}, "signal-camerax-initialization").start();
|
|
||||||
|
if (retriever.isCaughtUp()) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SignalExecutors.UNBOUNDED.execute(() -> {
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
switch (retriever.begin(TimeUnit.SECONDS.toMillis(60))) {
|
||||||
|
case SUCCESS:
|
||||||
|
Log.i(TAG, "Successfully caught up on messages. " + (System.currentTimeMillis() - startTime) + " ms");
|
||||||
|
break;
|
||||||
|
case FAILURE_TIMEOUT:
|
||||||
|
Log.w(TAG, "Did not finish catching up due to a timeout. " + (System.currentTimeMillis() - startTime) + " ms");
|
||||||
|
break;
|
||||||
|
case FAILURE_ERROR:
|
||||||
|
Log.w(TAG, "Did not finish catching up due to an error. " + (System.currentTimeMillis() - startTime) + " ms");
|
||||||
|
break;
|
||||||
|
case SKIPPED_ALREADY_CAUGHT_UP:
|
||||||
|
Log.i(TAG, "Already caught up. " + (System.currentTimeMillis() - startTime) + " ms");
|
||||||
|
break;
|
||||||
|
case SKIPPED_ALREADY_RUNNING:
|
||||||
|
Log.i(TAG, "Already in the process of catching up. " + (System.currentTimeMillis() - startTime) + " ms");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -19,15 +19,17 @@ package org.thoughtcrime.securesms;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.help.HelpFragment;
|
||||||
import org.thoughtcrime.securesms.preferences.AdvancedPreferenceFragment;
|
import org.thoughtcrime.securesms.preferences.AdvancedPreferenceFragment;
|
||||||
import org.thoughtcrime.securesms.preferences.AppProtectionPreferenceFragment;
|
import org.thoughtcrime.securesms.preferences.AppProtectionPreferenceFragment;
|
||||||
import org.thoughtcrime.securesms.preferences.AppearancePreferenceFragment;
|
import org.thoughtcrime.securesms.preferences.AppearancePreferenceFragment;
|
||||||
@@ -35,11 +37,14 @@ import org.thoughtcrime.securesms.preferences.ChatsPreferenceFragment;
|
|||||||
import org.thoughtcrime.securesms.preferences.CorrectedPreferenceFragment;
|
import org.thoughtcrime.securesms.preferences.CorrectedPreferenceFragment;
|
||||||
import org.thoughtcrime.securesms.preferences.NotificationsPreferenceFragment;
|
import org.thoughtcrime.securesms.preferences.NotificationsPreferenceFragment;
|
||||||
import org.thoughtcrime.securesms.preferences.SmsMmsPreferenceFragment;
|
import org.thoughtcrime.securesms.preferences.SmsMmsPreferenceFragment;
|
||||||
|
import org.thoughtcrime.securesms.preferences.StoragePreferenceFragment;
|
||||||
import org.thoughtcrime.securesms.preferences.widgets.ProfilePreference;
|
import org.thoughtcrime.securesms.preferences.widgets.ProfilePreference;
|
||||||
|
import org.thoughtcrime.securesms.profiles.edit.EditProfileActivity;
|
||||||
import org.thoughtcrime.securesms.service.KeyCachingService;
|
import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
|
import org.thoughtcrime.securesms.util.ThemeUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Activity for application preference display and management.
|
* The Activity for application preference display and management.
|
||||||
@@ -60,7 +65,9 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
|||||||
private static final String PREFERENCE_CATEGORY_APP_PROTECTION = "preference_category_app_protection";
|
private static final String PREFERENCE_CATEGORY_APP_PROTECTION = "preference_category_app_protection";
|
||||||
private static final String PREFERENCE_CATEGORY_APPEARANCE = "preference_category_appearance";
|
private static final String PREFERENCE_CATEGORY_APPEARANCE = "preference_category_appearance";
|
||||||
private static final String PREFERENCE_CATEGORY_CHATS = "preference_category_chats";
|
private static final String PREFERENCE_CATEGORY_CHATS = "preference_category_chats";
|
||||||
|
private static final String PREFERENCE_CATEGORY_STORAGE = "preference_category_storage";
|
||||||
private static final String PREFERENCE_CATEGORY_DEVICES = "preference_category_devices";
|
private static final String PREFERENCE_CATEGORY_DEVICES = "preference_category_devices";
|
||||||
|
private static final String PREFERENCE_CATEGORY_HELP = "preference_category_help";
|
||||||
private static final String PREFERENCE_CATEGORY_ADVANCED = "preference_category_advanced";
|
private static final String PREFERENCE_CATEGORY_ADVANCED = "preference_category_advanced";
|
||||||
|
|
||||||
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
||||||
@@ -105,7 +112,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
|||||||
if (fragmentManager.getBackStackEntryCount() > 0) {
|
if (fragmentManager.getBackStackEntryCount() > 0) {
|
||||||
fragmentManager.popBackStack();
|
fragmentManager.popBackStack();
|
||||||
} else {
|
} else {
|
||||||
Intent intent = new Intent(this, ConversationListActivity.class);
|
// TODO [greyson] Navigation
|
||||||
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
@@ -144,10 +152,23 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
|||||||
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_APPEARANCE));
|
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_APPEARANCE));
|
||||||
this.findPreference(PREFERENCE_CATEGORY_CHATS)
|
this.findPreference(PREFERENCE_CATEGORY_CHATS)
|
||||||
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_CHATS));
|
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_CHATS));
|
||||||
|
this.findPreference(PREFERENCE_CATEGORY_STORAGE)
|
||||||
|
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_STORAGE));
|
||||||
this.findPreference(PREFERENCE_CATEGORY_DEVICES)
|
this.findPreference(PREFERENCE_CATEGORY_DEVICES)
|
||||||
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_DEVICES));
|
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_DEVICES));
|
||||||
|
this.findPreference(PREFERENCE_CATEGORY_HELP)
|
||||||
|
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_HELP));
|
||||||
this.findPreference(PREFERENCE_CATEGORY_ADVANCED)
|
this.findPreference(PREFERENCE_CATEGORY_ADVANCED)
|
||||||
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_ADVANCED));
|
.setOnPreferenceClickListener(new CategoryClickListener(PREFERENCE_CATEGORY_ADVANCED));
|
||||||
|
|
||||||
|
tintIcons();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tintIcons() {
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) return;
|
||||||
|
|
||||||
|
Preference preference = this.findPreference(PREFERENCE_CATEGORY_SMS_MMS);
|
||||||
|
preference.getIcon().setColorFilter(ThemeUtil.getThemedColor(requireContext(), R.attr.icon_tint), PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -213,6 +234,9 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
|||||||
case PREFERENCE_CATEGORY_CHATS:
|
case PREFERENCE_CATEGORY_CHATS:
|
||||||
fragment = new ChatsPreferenceFragment();
|
fragment = new ChatsPreferenceFragment();
|
||||||
break;
|
break;
|
||||||
|
case PREFERENCE_CATEGORY_STORAGE:
|
||||||
|
fragment = new StoragePreferenceFragment();
|
||||||
|
break;
|
||||||
case PREFERENCE_CATEGORY_DEVICES:
|
case PREFERENCE_CATEGORY_DEVICES:
|
||||||
Intent intent = new Intent(getActivity(), DeviceActivity.class);
|
Intent intent = new Intent(getActivity(), DeviceActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
@@ -220,6 +244,9 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
|||||||
case PREFERENCE_CATEGORY_ADVANCED:
|
case PREFERENCE_CATEGORY_ADVANCED:
|
||||||
fragment = new AdvancedPreferenceFragment();
|
fragment = new AdvancedPreferenceFragment();
|
||||||
break;
|
break;
|
||||||
|
case PREFERENCE_CATEGORY_HELP:
|
||||||
|
fragment = new HelpFragment();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
@@ -245,11 +272,12 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
|||||||
private class ProfileClickListener implements Preference.OnPreferenceClickListener {
|
private class ProfileClickListener implements Preference.OnPreferenceClickListener {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
Intent intent = new Intent(preference.getContext(), CreateProfileActivity.class);
|
Intent intent = new Intent(preference.getContext(), EditProfileActivity.class);
|
||||||
intent.putExtra(CreateProfileActivity.EXCLUDE_SYSTEM, true);
|
intent.putExtra(EditProfileActivity.EXCLUDE_SYSTEM, true);
|
||||||
|
intent.putExtra(EditProfileActivity.DISPLAY_USERNAME, true);
|
||||||
|
intent.putExtra(EditProfileActivity.NEXT_BUTTON_TEXT, R.string.save);
|
||||||
|
|
||||||
getActivity().startActivity(intent);
|
requireActivity().startActivity(intent);
|
||||||
// ((BaseActionBarActivity)getActivity()).startActivitySceneTransition(intent, getActivity().findViewById(R.id.avatar), "avatar");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.app.ActivityOptionsCompat;
|
||||||
|
|
||||||
|
import com.bumptech.glide.load.DataSource;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.bumptech.glide.load.engine.GlideException;
|
||||||
|
import com.bumptech.glide.request.RequestListener;
|
||||||
|
import com.bumptech.glide.request.target.Target;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto;
|
||||||
|
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
|
||||||
|
import org.thoughtcrime.securesms.contacts.avatars.ProfileContactPhoto;
|
||||||
|
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
|
||||||
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity for displaying avatars full screen.
|
||||||
|
*/
|
||||||
|
public final class AvatarPreviewActivity extends PassphraseRequiredActionBarActivity {
|
||||||
|
|
||||||
|
private static final String TAG = Log.tag(AvatarPreviewActivity.class);
|
||||||
|
|
||||||
|
private static final String RECIPIENT_ID_EXTRA = "recipient_id";
|
||||||
|
|
||||||
|
public static @NonNull Intent intentFromRecipientId(@NonNull Context context,
|
||||||
|
@NonNull RecipientId recipientId)
|
||||||
|
{
|
||||||
|
Intent intent = new Intent(context, AvatarPreviewActivity.class);
|
||||||
|
intent.putExtra(RECIPIENT_ID_EXTRA, recipientId.serialize());
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Bundle createTransitionBundle(@NonNull Activity activity, @NonNull View from) {
|
||||||
|
return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, from, "avatar").toBundle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState, boolean ready) {
|
||||||
|
super.onCreate(savedInstanceState, ready);
|
||||||
|
|
||||||
|
setTheme(R.style.TextSecure_MediaPreview);
|
||||||
|
setContentView(R.layout.contact_photo_preview_activity);
|
||||||
|
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
ImageView avatar = findViewById(R.id.avatar);
|
||||||
|
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
|
||||||
|
showSystemUI();
|
||||||
|
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
Context context = getApplicationContext();
|
||||||
|
RecipientId recipientId = RecipientId.from(getIntent().getStringExtra(RECIPIENT_ID_EXTRA));
|
||||||
|
|
||||||
|
Recipient.live(recipientId).observe(this, recipient -> {
|
||||||
|
ContactPhoto contactPhoto = recipient.isLocalNumber() ? new ProfileContactPhoto(recipient, recipient.getProfileAvatar())
|
||||||
|
: recipient.getContactPhoto();
|
||||||
|
FallbackContactPhoto fallbackPhoto = recipient.isLocalNumber() ? new ResourceContactPhoto(R.drawable.ic_profile_outline_40, R.drawable.ic_profile_outline_20, R.drawable.ic_person_large)
|
||||||
|
: recipient.getFallbackContactPhoto();
|
||||||
|
|
||||||
|
GlideApp.with(this).load(contactPhoto)
|
||||||
|
.fallback(fallbackPhoto.asCallCard(this))
|
||||||
|
.error(fallbackPhoto.asCallCard(this))
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
|
.addListener(new RequestListener<Drawable>() {
|
||||||
|
@Override
|
||||||
|
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
||||||
|
Log.w(TAG, "Unable to load avatar, or avatar removed, closing");
|
||||||
|
finish();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.into(avatar);
|
||||||
|
|
||||||
|
toolbar.setTitle(recipient.toShortString(context));
|
||||||
|
});
|
||||||
|
|
||||||
|
avatar.setOnClickListener(v -> toggleUiVisibility());
|
||||||
|
|
||||||
|
showAndHideWithSystemUI(getWindow(), findViewById(R.id.toolbar_layout));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void showAndHideWithSystemUI(@NonNull Window window, @NonNull View... views) {
|
||||||
|
window.getDecorView().setOnSystemUiVisibilityChangeListener(visibility -> {
|
||||||
|
boolean hide = (visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0;
|
||||||
|
|
||||||
|
for (View view : views) {
|
||||||
|
view.animate()
|
||||||
|
.alpha(hide ? 0 : 1)
|
||||||
|
.start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toggleUiVisibility() {
|
||||||
|
int systemUiVisibility = getWindow().getDecorView().getSystemUiVisibility();
|
||||||
|
if ((systemUiVisibility & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0) {
|
||||||
|
showSystemUI();
|
||||||
|
} else {
|
||||||
|
hideSystemUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideSystemUI() {
|
||||||
|
getWindow().getDecorView().setSystemUiVisibility(
|
||||||
|
View.SYSTEM_UI_FLAG_IMMERSIVE |
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||||
|
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||||
|
View.SYSTEM_UI_FLAG_FULLSCREEN );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showSystemUI() {
|
||||||
|
getWindow().getDecorView().setSystemUiVisibility(
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSupportNavigateUp() {
|
||||||
|
onBackPressed();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,9 +5,10 @@ import androidx.annotation.Nullable;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.contactshare.Contact;
|
import org.thoughtcrime.securesms.contactshare.Contact;
|
||||||
import org.thoughtcrime.securesms.database.Address;
|
|
||||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord;
|
import org.thoughtcrime.securesms.database.model.MmsMessageRecord;
|
||||||
|
import org.thoughtcrime.securesms.database.model.ReactionRecord;
|
||||||
|
import org.thoughtcrime.securesms.groups.GroupId;
|
||||||
import org.thoughtcrime.securesms.linkpreview.LinkPreview;
|
import org.thoughtcrime.securesms.linkpreview.LinkPreview;
|
||||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
@@ -44,5 +45,7 @@ public interface BindableConversationItem extends Unbindable {
|
|||||||
void onAddToContactsClicked(@NonNull Contact contact);
|
void onAddToContactsClicked(@NonNull Contact contact);
|
||||||
void onMessageSharedContactClicked(@NonNull List<Recipient> choices);
|
void onMessageSharedContactClicked(@NonNull List<Recipient> choices);
|
||||||
void onInviteSharedContactClicked(@NonNull List<Recipient> choices);
|
void onInviteSharedContactClicked(@NonNull List<Recipient> choices);
|
||||||
|
void onReactionClicked(long messageId, boolean isMms);
|
||||||
|
void onGroupMemberAvatarClicked(@NonNull RecipientId recipientId, @NonNull GroupId groupId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||||
|
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public interface BindableConversationListItem extends Unbindable {
|
||||||
|
|
||||||
|
void bind(@NonNull ThreadRecord thread,
|
||||||
|
@NonNull GlideRequests glideRequests, @NonNull Locale locale,
|
||||||
|
@NonNull Set<Long> typingThreads,
|
||||||
|
@NonNull Set<Long> selectedThreads, boolean batchMode);
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.WorkerThread;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.lifecycle.Lifecycle;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.concurrent.SignalExecutors;
|
||||||
|
import org.thoughtcrime.securesms.util.concurrent.SimpleTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This should be used whenever we want to prompt the user to block/unblock a recipient.
|
||||||
|
*/
|
||||||
|
public final class BlockUnblockDialog {
|
||||||
|
|
||||||
|
private BlockUnblockDialog() { }
|
||||||
|
|
||||||
|
public static void showBlockFor(@NonNull Context context,
|
||||||
|
@NonNull Lifecycle lifecycle,
|
||||||
|
@NonNull Recipient recipient,
|
||||||
|
@NonNull Runnable onBlock)
|
||||||
|
{
|
||||||
|
SimpleTask.run(lifecycle,
|
||||||
|
() -> buildBlockFor(context, recipient, onBlock, null),
|
||||||
|
AlertDialog.Builder::show);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showBlockAndDeleteFor(@NonNull Context context,
|
||||||
|
@NonNull Lifecycle lifecycle,
|
||||||
|
@NonNull Recipient recipient,
|
||||||
|
@NonNull Runnable onBlock,
|
||||||
|
@NonNull Runnable onBlockAndDelete)
|
||||||
|
{
|
||||||
|
SimpleTask.run(lifecycle,
|
||||||
|
() -> buildBlockFor(context, recipient, onBlock, onBlockAndDelete),
|
||||||
|
AlertDialog.Builder::show);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showUnblockFor(@NonNull Context context,
|
||||||
|
@NonNull Lifecycle lifecycle,
|
||||||
|
@NonNull Recipient recipient,
|
||||||
|
@NonNull Runnable onUnblock)
|
||||||
|
{
|
||||||
|
SimpleTask.run(lifecycle,
|
||||||
|
() -> buildUnblockFor(context, recipient, onUnblock),
|
||||||
|
AlertDialog.Builder::show);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WorkerThread
|
||||||
|
private static AlertDialog.Builder buildBlockFor(@NonNull Context context,
|
||||||
|
@NonNull Recipient recipient,
|
||||||
|
@NonNull Runnable onBlock,
|
||||||
|
@Nullable Runnable onBlockAndDelete)
|
||||||
|
{
|
||||||
|
recipient = recipient.resolve();
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
Resources resources = context.getResources();
|
||||||
|
|
||||||
|
if (recipient.isGroup()) {
|
||||||
|
if (DatabaseFactory.getGroupDatabase(context).isActive(recipient.requireGroupId())) {
|
||||||
|
builder.setTitle(resources.getString(R.string.BlockUnblockDialog_block_and_leave_s, recipient.getDisplayName(context)));
|
||||||
|
builder.setMessage(R.string.BlockUnblockDialog_you_will_no_longer_receive_messages_or_updates);
|
||||||
|
builder.setPositiveButton(R.string.BlockUnblockDialog_block_and_leave, ((dialog, which) -> onBlock.run()));
|
||||||
|
builder.setNegativeButton(android.R.string.cancel, null);
|
||||||
|
} else {
|
||||||
|
builder.setTitle(resources.getString(R.string.BlockUnblockDialog_block_s, recipient.getDisplayName(context)));
|
||||||
|
builder.setMessage(R.string.BlockUnblockDialog_group_members_wont_be_able_to_add_you);
|
||||||
|
builder.setPositiveButton(R.string.RecipientPreferenceActivity_block, ((dialog, which) -> onBlock.run()));
|
||||||
|
builder.setNegativeButton(android.R.string.cancel, null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
builder.setTitle(resources.getString(R.string.BlockUnblockDialog_block_s, recipient.getDisplayName(context)));
|
||||||
|
builder.setMessage(R.string.BlockUnblockDialog_blocked_people_wont_be_able_to_call_you_or_send_you_messages);
|
||||||
|
|
||||||
|
if (onBlockAndDelete != null) {
|
||||||
|
builder.setNeutralButton(android.R.string.cancel, null);
|
||||||
|
builder.setPositiveButton(R.string.BlockUnblockDialog_block_and_delete, (d, w) -> onBlockAndDelete.run());
|
||||||
|
builder.setNegativeButton(R.string.BlockUnblockDialog_block, (d, w) -> onBlock.run());
|
||||||
|
} else {
|
||||||
|
builder.setPositiveButton(R.string.BlockUnblockDialog_block, ((dialog, which) -> onBlock.run()));
|
||||||
|
builder.setNegativeButton(android.R.string.cancel, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@WorkerThread
|
||||||
|
private static AlertDialog.Builder buildUnblockFor(@NonNull Context context,
|
||||||
|
@NonNull Recipient recipient,
|
||||||
|
@NonNull Runnable onUnblock)
|
||||||
|
{
|
||||||
|
recipient = recipient.resolve();
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
Resources resources = context.getResources();
|
||||||
|
|
||||||
|
if (recipient.isGroup()) {
|
||||||
|
if (DatabaseFactory.getGroupDatabase(context).isActive(recipient.requireGroupId())) {
|
||||||
|
builder.setTitle(resources.getString(R.string.BlockUnblockDialog_unblock_s, recipient.getDisplayName(context)));
|
||||||
|
builder.setMessage(R.string.BlockUnblockDialog_group_members_will_be_able_to_add_you);
|
||||||
|
builder.setPositiveButton(R.string.RecipientPreferenceActivity_unblock, ((dialog, which) -> onUnblock.run()));
|
||||||
|
builder.setNegativeButton(android.R.string.cancel, null);
|
||||||
|
} else {
|
||||||
|
builder.setTitle(resources.getString(R.string.BlockUnblockDialog_unblock_s, recipient.getDisplayName(context)));
|
||||||
|
builder.setMessage(R.string.BlockUnblockDialog_group_members_will_be_able_to_add_you);
|
||||||
|
builder.setPositiveButton(R.string.RecipientPreferenceActivity_unblock, ((dialog, which) -> onUnblock.run()));
|
||||||
|
builder.setNegativeButton(android.R.string.cancel, null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
builder.setTitle(resources.getString(R.string.BlockUnblockDialog_unblock_s, recipient.getDisplayName(context)));
|
||||||
|
builder.setMessage(R.string.BlockUnblockDialog_you_will_be_able_to_call_and_message_each_other);
|
||||||
|
builder.setPositiveButton(R.string.RecipientPreferenceActivity_unblock, ((dialog, which) -> onUnblock.run()));
|
||||||
|
builder.setNegativeButton(android.R.string.cancel, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,8 @@
|
|||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.fragment.app.ListFragment;
|
|
||||||
import androidx.loader.app.LoaderManager;
|
|
||||||
import androidx.loader.content.Loader;
|
|
||||||
import androidx.cursoradapter.widget.CursorAdapter;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -17,6 +10,13 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.cursoradapter.widget.CursorAdapter;
|
||||||
|
import androidx.fragment.app.ListFragment;
|
||||||
|
import androidx.loader.app.LoaderManager;
|
||||||
|
import androidx.loader.content.Loader;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.database.RecipientDatabase;
|
import org.thoughtcrime.securesms.database.RecipientDatabase;
|
||||||
import org.thoughtcrime.securesms.database.loaders.BlockedContactsLoader;
|
import org.thoughtcrime.securesms.database.loaders.BlockedContactsLoader;
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
@@ -25,21 +25,18 @@ import org.thoughtcrime.securesms.preferences.BlockedContactListItem;
|
|||||||
import org.thoughtcrime.securesms.recipients.LiveRecipient;
|
import org.thoughtcrime.securesms.recipients.LiveRecipient;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
|
|
||||||
public class BlockedContactsActivity extends PassphraseRequiredActionBarActivity {
|
public class BlockedContactsActivity extends PassphraseRequiredActionBarActivity {
|
||||||
|
|
||||||
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
||||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPreCreate() {
|
public void onPreCreate() {
|
||||||
dynamicTheme.onCreate(this);
|
dynamicTheme.onCreate(this);
|
||||||
dynamicLanguage.onCreate(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle bundle, boolean ready) {
|
public void onCreate(Bundle bundle, boolean ready) {
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
@@ -51,16 +48,12 @@ public class BlockedContactsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
dynamicTheme.onResume(this);
|
dynamicTheme.onResume(this);
|
||||||
dynamicLanguage.onResume(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onSupportNavigateUp() {
|
||||||
switch (item.getItemId()) {
|
onBackPressed();
|
||||||
case android.R.id.home: finish(); return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BlockedContactsFragment
|
public static class BlockedContactsFragment
|
||||||
@@ -76,14 +69,14 @@ public class BlockedContactsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle bundle) {
|
public void onCreate(Bundle bundle) {
|
||||||
super.onCreate(bundle);
|
super.onCreate(bundle);
|
||||||
setListAdapter(new BlockedContactAdapter(getActivity(), GlideApp.with(this), null));
|
setListAdapter(new BlockedContactAdapter(requireActivity(), GlideApp.with(this), null));
|
||||||
getLoaderManager().initLoader(0, null, this);
|
LoaderManager.getInstance(this).initLoader(0, null, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
getLoaderManager().restartLoader(0, null, this);
|
LoaderManager.getInstance(this).restartLoader(0, null, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -114,10 +107,10 @@ public class BlockedContactsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
Recipient recipient = ((BlockedContactListItem)view).getRecipient();
|
Recipient recipient = ((BlockedContactListItem)view).getRecipient();
|
||||||
Intent intent = new Intent(getActivity(), RecipientPreferenceActivity.class);
|
BlockUnblockDialog.showUnblockFor(requireContext(), getLifecycle(), recipient, () -> {
|
||||||
intent.putExtra(RecipientPreferenceActivity.RECIPIENT_ID, recipient.getId());
|
RecipientUtil.unblock(requireContext(), recipient);
|
||||||
|
LoaderManager.getInstance(this).restartLoader(0, null, this);
|
||||||
startActivity(intent);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BlockedContactAdapter extends CursorAdapter {
|
private static class BlockedContactAdapter extends CursorAdapter {
|
||||||
@@ -143,7 +136,5 @@ public class BlockedContactsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
((BlockedContactListItem) view).set(glideRequests, recipient);
|
((BlockedContactListItem) view).set(glideRequests, recipient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||||
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
|
import org.thoughtcrime.securesms.util.ThemeUtil;
|
||||||
|
|
||||||
|
public class ClearProfileAvatarActivity extends Activity {
|
||||||
|
|
||||||
|
private static final String ARG_TITLE = "arg_title";
|
||||||
|
|
||||||
|
public static Intent createForUserProfilePhoto() {
|
||||||
|
return new Intent("org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Intent createForGroupProfilePhoto() {
|
||||||
|
Intent intent = new Intent("org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO");
|
||||||
|
intent.putExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_group_photo);
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
int titleId = getIntent().getIntExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_profile_photo);
|
||||||
|
|
||||||
|
new AlertDialog.Builder(new ContextThemeWrapper(this, DynamicTheme.isDarkTheme(this) ? R.style.TextSecure_DarkTheme : R.style.TextSecure_LightTheme))
|
||||||
|
.setMessage(titleId)
|
||||||
|
.setNegativeButton(android.R.string.cancel, (dialog, which) -> finish())
|
||||||
|
.setPositiveButton(R.string.ClearProfileActivity_remove, (dialog, which) -> {
|
||||||
|
Intent result = new Intent();
|
||||||
|
result.putExtra("delete", true);
|
||||||
|
setResult(Activity.RESULT_OK, result);
|
||||||
|
finish();
|
||||||
|
})
|
||||||
|
.setOnCancelListener(dialog -> finish())
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,12 +5,13 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureIdentityKeyStore;
|
import org.thoughtcrime.securesms.crypto.storage.TextSecureIdentityKeyStore;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
import org.thoughtcrime.securesms.database.MmsDatabase;
|
import org.thoughtcrime.securesms.database.MmsDatabase;
|
||||||
@@ -20,13 +21,15 @@ import org.thoughtcrime.securesms.database.SmsDatabase;
|
|||||||
import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch;
|
import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch;
|
||||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
import org.thoughtcrime.securesms.jobs.PushDecryptJob;
|
import org.thoughtcrime.securesms.jobs.PushDecryptMessageJob;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||||
import org.thoughtcrime.securesms.sms.MessageSender;
|
import org.thoughtcrime.securesms.sms.MessageSender;
|
||||||
import org.thoughtcrime.securesms.util.Base64;
|
import org.thoughtcrime.securesms.util.Base64;
|
||||||
import org.thoughtcrime.securesms.util.VerifySpan;
|
import org.thoughtcrime.securesms.util.VerifySpan;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.whispersystems.libsignal.SignalProtocolAddress;
|
||||||
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
|
import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
|
||||||
|
|
||||||
@@ -48,7 +51,7 @@ public class ConfirmIdentityDialog extends AlertDialog {
|
|||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
Recipient recipient = Recipient.resolved(mismatch.getRecipientId(context));
|
Recipient recipient = Recipient.resolved(mismatch.getRecipientId(context));
|
||||||
String name = recipient.toShortString();
|
String name = recipient.toShortString(context);
|
||||||
String introduction = context.getString(R.string.ConfirmIdentityDialog_your_safety_number_with_s_has_changed, name, name);
|
String introduction = context.getString(R.string.ConfirmIdentityDialog_your_safety_number_with_s_has_changed, name, name);
|
||||||
SpannableString spannableString = new SpannableString(introduction + " " +
|
SpannableString spannableString = new SpannableString(introduction + " " +
|
||||||
context.getString(R.string.ConfirmIdentityDialog_you_may_wish_to_verify_your_safety_number_with_this_contact));
|
context.getString(R.string.ConfirmIdentityDialog_you_may_wish_to_verify_your_safety_number_with_this_contact));
|
||||||
@@ -95,7 +98,7 @@ public class ConfirmIdentityDialog extends AlertDialog {
|
|||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
synchronized (SESSION_LOCK) {
|
synchronized (SESSION_LOCK) {
|
||||||
SignalProtocolAddress mismatchAddress = new SignalProtocolAddress(Recipient.resolved(recipientId).requireAddress().toPhoneString(), 1);
|
SignalProtocolAddress mismatchAddress = new SignalProtocolAddress(Recipient.resolved(recipientId).requireServiceId(), 1);
|
||||||
TextSecureIdentityKeyStore identityKeyStore = new TextSecureIdentityKeyStore(getContext());
|
TextSecureIdentityKeyStore identityKeyStore = new TextSecureIdentityKeyStore(getContext());
|
||||||
|
|
||||||
identityKeyStore.saveIdentity(mismatchAddress, mismatch.getIdentityKey(), true);
|
identityKeyStore.saveIdentity(mismatchAddress, mismatch.getIdentityKey(), true);
|
||||||
@@ -167,7 +170,7 @@ public class ConfirmIdentityDialog extends AlertDialog {
|
|||||||
boolean legacy = !messageRecord.isContentBundleKeyExchange();
|
boolean legacy = !messageRecord.isContentBundleKeyExchange();
|
||||||
|
|
||||||
SignalServiceEnvelope envelope = new SignalServiceEnvelope(SignalServiceProtos.Envelope.Type.PREKEY_BUNDLE_VALUE,
|
SignalServiceEnvelope envelope = new SignalServiceEnvelope(SignalServiceProtos.Envelope.Type.PREKEY_BUNDLE_VALUE,
|
||||||
messageRecord.getIndividualRecipient().requireAddress().toPhoneString(),
|
Optional.of(RecipientUtil.toSignalServiceAddress(getContext(), messageRecord.getIndividualRecipient())),
|
||||||
messageRecord.getRecipientDeviceId(),
|
messageRecord.getRecipientDeviceId(),
|
||||||
messageRecord.getDateSent(),
|
messageRecord.getDateSent(),
|
||||||
legacy ? Base64.decode(messageRecord.getBody()) : null,
|
legacy ? Base64.decode(messageRecord.getBody()) : null,
|
||||||
@@ -176,7 +179,7 @@ public class ConfirmIdentityDialog extends AlertDialog {
|
|||||||
|
|
||||||
long pushId = pushDatabase.insert(envelope);
|
long pushId = pushDatabase.insert(envelope);
|
||||||
|
|
||||||
ApplicationDependencies.getJobManager().add(new PushDecryptJob(getContext(), pushId, messageRecord.getId()));
|
ApplicationDependencies.getJobManager().add(new PushDecryptMessageJob(getContext(), pushId, messageRecord.getId()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new AssertionError(e);
|
throw new AssertionError(e);
|
||||||
}
|
}
|
||||||
@@ -19,18 +19,19 @@ package org.thoughtcrime.securesms;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.components.ContactFilterToolbar;
|
import org.thoughtcrime.securesms.components.ContactFilterToolbar;
|
||||||
import org.thoughtcrime.securesms.contacts.ContactsCursorLoader.DisplayMode;
|
import org.thoughtcrime.securesms.contacts.ContactsCursorLoader.DisplayMode;
|
||||||
import org.thoughtcrime.securesms.util.DirectoryHelper;
|
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
|
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
@@ -43,12 +44,14 @@ import java.lang.ref.WeakReference;
|
|||||||
*/
|
*/
|
||||||
public abstract class ContactSelectionActivity extends PassphraseRequiredActionBarActivity
|
public abstract class ContactSelectionActivity extends PassphraseRequiredActionBarActivity
|
||||||
implements SwipeRefreshLayout.OnRefreshListener,
|
implements SwipeRefreshLayout.OnRefreshListener,
|
||||||
ContactSelectionListFragment.OnContactSelectedListener
|
ContactSelectionListFragment.OnContactSelectedListener,
|
||||||
|
ContactSelectionListFragment.ScrollCallback
|
||||||
{
|
{
|
||||||
private static final String TAG = ContactSelectionActivity.class.getSimpleName();
|
private static final String TAG = ContactSelectionActivity.class.getSimpleName();
|
||||||
|
|
||||||
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
|
public static final String EXTRA_LAYOUT_RES_ID = "layout_res_id";
|
||||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
|
||||||
|
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
|
||||||
|
|
||||||
protected ContactSelectionListFragment contactsFragment;
|
protected ContactSelectionListFragment contactsFragment;
|
||||||
|
|
||||||
@@ -57,18 +60,17 @@ public abstract class ContactSelectionActivity extends PassphraseRequiredActionB
|
|||||||
@Override
|
@Override
|
||||||
protected void onPreCreate() {
|
protected void onPreCreate() {
|
||||||
dynamicTheme.onCreate(this);
|
dynamicTheme.onCreate(this);
|
||||||
dynamicLanguage.onCreate(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle icicle, boolean ready) {
|
protected void onCreate(Bundle icicle, boolean ready) {
|
||||||
if (!getIntent().hasExtra(ContactSelectionListFragment.DISPLAY_MODE)) {
|
if (!getIntent().hasExtra(ContactSelectionListFragment.DISPLAY_MODE)) {
|
||||||
int displayMode = TextSecurePreferences.isSmsEnabled(this) ? DisplayMode.FLAG_ALL
|
int displayMode = TextSecurePreferences.isSmsEnabled(this) ? DisplayMode.FLAG_ALL
|
||||||
: DisplayMode.FLAG_PUSH | DisplayMode.FLAG_ACTIVE_GROUPS | DisplayMode.FLAG_INACTIVE_GROUPS;
|
: DisplayMode.FLAG_PUSH | DisplayMode.FLAG_ACTIVE_GROUPS | DisplayMode.FLAG_INACTIVE_GROUPS | DisplayMode.FLAG_SELF;
|
||||||
getIntent().putExtra(ContactSelectionListFragment.DISPLAY_MODE, displayMode);
|
getIntent().putExtra(ContactSelectionListFragment.DISPLAY_MODE, displayMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
setContentView(R.layout.contact_selection_activity);
|
setContentView(getIntent().getIntExtra(EXTRA_LAYOUT_RES_ID, R.layout.contact_selection_activity));
|
||||||
|
|
||||||
initializeToolbar();
|
initializeToolbar();
|
||||||
initializeResources();
|
initializeResources();
|
||||||
@@ -79,7 +81,6 @@ public abstract class ContactSelectionActivity extends PassphraseRequiredActionB
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
dynamicTheme.onResume(this);
|
dynamicTheme.onResume(this);
|
||||||
dynamicLanguage.onResume(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ContactFilterToolbar getToolbar() {
|
protected ContactFilterToolbar getToolbar() {
|
||||||
@@ -87,10 +88,9 @@ public abstract class ContactSelectionActivity extends PassphraseRequiredActionB
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeToolbar() {
|
private void initializeToolbar() {
|
||||||
this.toolbar = ViewUtil.findById(this, R.id.toolbar);
|
this.toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
assert getSupportActionBar() != null;
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||||
getSupportActionBar().setIcon(null);
|
getSupportActionBar().setIcon(null);
|
||||||
@@ -113,10 +113,21 @@ public abstract class ContactSelectionActivity extends PassphraseRequiredActionB
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContactSelected(String number) {}
|
public void onContactSelected(Optional<RecipientId> recipientId, String number) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContactDeselected(String number) {}
|
public void onContactDeselected(Optional<RecipientId> recipientId, String number) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBeginScroll() {
|
||||||
|
hideKeyboard();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideKeyboard() {
|
||||||
|
ServiceUtil.getInputMethodManager(this)
|
||||||
|
.hideSoftInputFromWindow(toolbar.getWindowToken(), 0);
|
||||||
|
toolbar.clearFocus();
|
||||||
|
}
|
||||||
|
|
||||||
private static class RefreshDirectoryTask extends AsyncTask<Context, Void, Void> {
|
private static class RefreshDirectoryTask extends AsyncTask<Context, Void, Void> {
|
||||||
|
|
||||||
@@ -128,7 +139,6 @@ public abstract class ContactSelectionActivity extends PassphraseRequiredActionB
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Context... params) {
|
protected Void doInBackground(Context... params) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
DirectoryHelper.refreshDirectory(params[0], true);
|
DirectoryHelper.refreshDirectory(params[0], true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -0,0 +1,646 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Open Whisper Systems
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.animation.LayoutTransition;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.view.animation.CycleInterpolator;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.HorizontalScrollView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintSet;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.loader.app.LoaderManager;
|
||||||
|
import androidx.loader.content.Loader;
|
||||||
|
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import androidx.transition.AutoTransition;
|
||||||
|
import androidx.transition.TransitionManager;
|
||||||
|
|
||||||
|
import com.annimon.stream.Collectors;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.google.android.material.chip.ChipGroup;
|
||||||
|
import com.pnikosis.materialishprogress.ProgressWheel;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.components.RecyclerViewFastScroller;
|
||||||
|
import org.thoughtcrime.securesms.contacts.ContactChip;
|
||||||
|
import org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter;
|
||||||
|
import org.thoughtcrime.securesms.contacts.ContactSelectionListItem;
|
||||||
|
import org.thoughtcrime.securesms.contacts.ContactsCursorLoader;
|
||||||
|
import org.thoughtcrime.securesms.contacts.ContactsCursorLoader.DisplayMode;
|
||||||
|
import org.thoughtcrime.securesms.contacts.SelectedContact;
|
||||||
|
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||||
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
|
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||||
|
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||||
|
import org.thoughtcrime.securesms.recipients.LiveRecipient;
|
||||||
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
|
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||||
|
import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
|
import org.thoughtcrime.securesms.util.UsernameUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.adapter.FixedViewsAdapter;
|
||||||
|
import org.thoughtcrime.securesms.util.adapter.RecyclerViewConcatenateAdapterStickyHeader;
|
||||||
|
import org.thoughtcrime.securesms.util.concurrent.SimpleTask;
|
||||||
|
import org.thoughtcrime.securesms.util.views.SimpleProgressDialog;
|
||||||
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragment for selecting a one or more contacts from a list.
|
||||||
|
*
|
||||||
|
* @author Moxie Marlinspike
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final class ContactSelectionListFragment extends Fragment
|
||||||
|
implements LoaderManager.LoaderCallbacks<Cursor>
|
||||||
|
{
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private static final String TAG = Log.tag(ContactSelectionListFragment.class);
|
||||||
|
|
||||||
|
private static final int CHIP_GROUP_EMPTY_CHILD_COUNT = 1;
|
||||||
|
private static final int CHIP_GROUP_REVEAL_DURATION_MS = 150;
|
||||||
|
|
||||||
|
public static final int NO_LIMIT = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
public static final String DISPLAY_MODE = "display_mode";
|
||||||
|
public static final String MULTI_SELECT = "multi_select";
|
||||||
|
public static final String REFRESHABLE = "refreshable";
|
||||||
|
public static final String RECENTS = "recents";
|
||||||
|
public static final String TOTAL_CAPACITY = "total_capacity";
|
||||||
|
public static final String CURRENT_SELECTION = "current_selection";
|
||||||
|
|
||||||
|
private ConstraintLayout constraintLayout;
|
||||||
|
private TextView emptyText;
|
||||||
|
private OnContactSelectedListener onContactSelectedListener;
|
||||||
|
private SwipeRefreshLayout swipeRefresh;
|
||||||
|
private View showContactsLayout;
|
||||||
|
private Button showContactsButton;
|
||||||
|
private TextView showContactsDescription;
|
||||||
|
private ProgressWheel showContactsProgress;
|
||||||
|
private String cursorFilter;
|
||||||
|
private RecyclerView recyclerView;
|
||||||
|
private RecyclerViewFastScroller fastScroller;
|
||||||
|
private ContactSelectionListAdapter cursorRecyclerViewAdapter;
|
||||||
|
private ChipGroup chipGroup;
|
||||||
|
private HorizontalScrollView chipGroupScrollContainer;
|
||||||
|
private TextView groupLimit;
|
||||||
|
|
||||||
|
@Nullable private FixedViewsAdapter headerAdapter;
|
||||||
|
@Nullable private FixedViewsAdapter footerAdapter;
|
||||||
|
@Nullable private ListCallback listCallback;
|
||||||
|
@Nullable private ScrollCallback scrollCallback;
|
||||||
|
private GlideRequests glideRequests;
|
||||||
|
private int selectionLimit;
|
||||||
|
private Set<RecipientId> currentSelection;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
|
||||||
|
if (context instanceof ListCallback) {
|
||||||
|
listCallback = (ListCallback) context;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context instanceof ScrollCallback) {
|
||||||
|
scrollCallback = (ScrollCallback) context;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle icicle) {
|
||||||
|
super.onActivityCreated(icicle);
|
||||||
|
|
||||||
|
initializeCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
|
||||||
|
Permissions.with(this)
|
||||||
|
.request(Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS)
|
||||||
|
.ifNecessary()
|
||||||
|
.onAllGranted(() -> {
|
||||||
|
if (!TextSecurePreferences.hasSuccessfullyRetrievedDirectory(getActivity())) {
|
||||||
|
handleContactPermissionGranted();
|
||||||
|
} else {
|
||||||
|
LoaderManager.getInstance(this).initLoader(0, null, this);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.onAnyDenied(() -> {
|
||||||
|
FragmentActivity activity = requireActivity();
|
||||||
|
|
||||||
|
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||||
|
|
||||||
|
if (activity.getIntent().getBooleanExtra(RECENTS, false)) {
|
||||||
|
LoaderManager.getInstance(this).initLoader(0, null, ContactSelectionListFragment.this);
|
||||||
|
} else {
|
||||||
|
initializeNoContactsPermission();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.contact_selection_list_fragment, container, false);
|
||||||
|
|
||||||
|
emptyText = view.findViewById(android.R.id.empty);
|
||||||
|
recyclerView = view.findViewById(R.id.recycler_view);
|
||||||
|
swipeRefresh = view.findViewById(R.id.swipe_refresh);
|
||||||
|
fastScroller = view.findViewById(R.id.fast_scroller);
|
||||||
|
showContactsLayout = view.findViewById(R.id.show_contacts_container);
|
||||||
|
showContactsButton = view.findViewById(R.id.show_contacts_button);
|
||||||
|
showContactsDescription = view.findViewById(R.id.show_contacts_description);
|
||||||
|
showContactsProgress = view.findViewById(R.id.progress);
|
||||||
|
chipGroup = view.findViewById(R.id.chipGroup);
|
||||||
|
chipGroupScrollContainer = view.findViewById(R.id.chipGroupScrollContainer);
|
||||||
|
groupLimit = view.findViewById(R.id.group_limit);
|
||||||
|
constraintLayout = view.findViewById(R.id.container);
|
||||||
|
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
recyclerView.setItemAnimator(new DefaultItemAnimator() {
|
||||||
|
@Override
|
||||||
|
public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
swipeRefresh.setEnabled(requireActivity().getIntent().getBooleanExtra(REFRESHABLE, true));
|
||||||
|
|
||||||
|
selectionLimit = requireActivity().getIntent().getIntExtra(TOTAL_CAPACITY, NO_LIMIT);
|
||||||
|
currentSelection = getCurrentSelection();
|
||||||
|
|
||||||
|
updateGroupLimit(getChipCount());
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateGroupLimit(int chipCount) {
|
||||||
|
if (selectionLimit != NO_LIMIT) {
|
||||||
|
groupLimit.setText(String.format(Locale.getDefault(), "%d/%d", currentSelection.size() + chipCount, selectionLimit));
|
||||||
|
groupLimit.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
groupLimit.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
Permissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NonNull List<SelectedContact> getSelectedContacts() {
|
||||||
|
if (cursorRecyclerViewAdapter == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return cursorRecyclerViewAdapter.getSelectedContacts();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSelectedContactsCount() {
|
||||||
|
if (cursorRecyclerViewAdapter == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cursorRecyclerViewAdapter.getSelectedContactsCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set<RecipientId> getCurrentSelection() {
|
||||||
|
List<RecipientId> currentSelection = requireActivity().getIntent().getParcelableArrayListExtra(CURRENT_SELECTION);
|
||||||
|
|
||||||
|
return currentSelection == null ? Collections.emptySet()
|
||||||
|
: Collections.unmodifiableSet(Stream.of(currentSelection).collect(Collectors.toSet()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isMulti() {
|
||||||
|
return requireActivity().getIntent().getBooleanExtra(MULTI_SELECT, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeCursor() {
|
||||||
|
glideRequests = GlideApp.with(this);
|
||||||
|
|
||||||
|
cursorRecyclerViewAdapter = new ContactSelectionListAdapter(requireContext(),
|
||||||
|
glideRequests,
|
||||||
|
null,
|
||||||
|
new ListClickListener(),
|
||||||
|
isMulti(),
|
||||||
|
currentSelection);
|
||||||
|
|
||||||
|
RecyclerViewConcatenateAdapterStickyHeader concatenateAdapter = new RecyclerViewConcatenateAdapterStickyHeader();
|
||||||
|
|
||||||
|
if (listCallback != null && FeatureFlags.newGroupUI()) {
|
||||||
|
if (FeatureFlags.groupsV2create() && FeatureFlags.groupsV2internalTest()) {
|
||||||
|
headerAdapter = new FixedViewsAdapter(createNewGroupItem(listCallback), createNewGroupsV1GroupItem(listCallback));
|
||||||
|
} else {
|
||||||
|
headerAdapter = new FixedViewsAdapter(createNewGroupItem(listCallback));
|
||||||
|
}
|
||||||
|
headerAdapter.hide();
|
||||||
|
concatenateAdapter.addAdapter(headerAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
concatenateAdapter.addAdapter(cursorRecyclerViewAdapter);
|
||||||
|
|
||||||
|
if (listCallback != null) {
|
||||||
|
footerAdapter = new FixedViewsAdapter(createInviteActionView(listCallback));
|
||||||
|
footerAdapter.hide();
|
||||||
|
concatenateAdapter.addAdapter(footerAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
recyclerView.setAdapter(concatenateAdapter);
|
||||||
|
recyclerView.addItemDecoration(new StickyHeaderDecoration(concatenateAdapter, true, true));
|
||||||
|
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||||
|
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
|
||||||
|
if (scrollCallback != null) {
|
||||||
|
scrollCallback.onBeginScroll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private View createInviteActionView(@NonNull ListCallback listCallback) {
|
||||||
|
View view = LayoutInflater.from(requireContext())
|
||||||
|
.inflate(R.layout.contact_selection_invite_action_item, (ViewGroup) requireView(), false);
|
||||||
|
view.setOnClickListener(v -> listCallback.onInvite());
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private View createNewGroupItem(@NonNull ListCallback listCallback) {
|
||||||
|
View view = LayoutInflater.from(requireContext())
|
||||||
|
.inflate(R.layout.contact_selection_new_group_item, (ViewGroup) requireView(), false);
|
||||||
|
view.setOnClickListener(v -> listCallback.onNewGroup(false));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private View createNewGroupsV1GroupItem(@NonNull ListCallback listCallback) {
|
||||||
|
View view = LayoutInflater.from(requireContext())
|
||||||
|
.inflate(R.layout.contact_selection_new_group_v1_item, (ViewGroup) requireView(), false);
|
||||||
|
view.setOnClickListener(v -> listCallback.onNewGroup(true));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeNoContactsPermission() {
|
||||||
|
swipeRefresh.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
showContactsLayout.setVisibility(View.VISIBLE);
|
||||||
|
showContactsProgress.setVisibility(View.INVISIBLE);
|
||||||
|
showContactsDescription.setText(R.string.contact_selection_list_fragment__signal_needs_access_to_your_contacts_in_order_to_display_them);
|
||||||
|
showContactsButton.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
showContactsButton.setOnClickListener(v -> {
|
||||||
|
Permissions.with(this)
|
||||||
|
.request(Manifest.permission.WRITE_CONTACTS, Manifest.permission.READ_CONTACTS)
|
||||||
|
.ifNecessary()
|
||||||
|
.withPermanentDenialDialog(getString(R.string.ContactSelectionListFragment_signal_requires_the_contacts_permission_in_order_to_display_your_contacts))
|
||||||
|
.onSomeGranted(permissions -> {
|
||||||
|
if (permissions.contains(Manifest.permission.WRITE_CONTACTS)) {
|
||||||
|
handleContactPermissionGranted();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.execute();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQueryFilter(String filter) {
|
||||||
|
this.cursorFilter = filter;
|
||||||
|
LoaderManager.getInstance(this).restartLoader(0, null, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetQueryFilter() {
|
||||||
|
setQueryFilter(null);
|
||||||
|
swipeRefresh.setRefreshing(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasQueryFilter() {
|
||||||
|
return !TextUtils.isEmpty(cursorFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefreshing(boolean refreshing) {
|
||||||
|
swipeRefresh.setRefreshing(refreshing);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
cursorRecyclerViewAdapter.clearSelectedContacts();
|
||||||
|
|
||||||
|
if (!isDetached() && !isRemoving() && getActivity() != null && !getActivity().isFinishing()) {
|
||||||
|
LoaderManager.getInstance(this).restartLoader(0, null, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||||
|
FragmentActivity activity = requireActivity();
|
||||||
|
return new ContactsCursorLoader(activity,
|
||||||
|
activity.getIntent().getIntExtra(DISPLAY_MODE, DisplayMode.FLAG_ALL),
|
||||||
|
cursorFilter, activity.getIntent().getBooleanExtra(RECENTS, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadFinished(@NonNull Loader<Cursor> loader, @Nullable Cursor data) {
|
||||||
|
swipeRefresh.setVisibility(View.VISIBLE);
|
||||||
|
showContactsLayout.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
cursorRecyclerViewAdapter.changeCursor(data);
|
||||||
|
|
||||||
|
if (footerAdapter != null) {
|
||||||
|
footerAdapter.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headerAdapter != null) {
|
||||||
|
if (TextUtils.isEmpty(cursorFilter)) {
|
||||||
|
headerAdapter.show();
|
||||||
|
} else {
|
||||||
|
headerAdapter.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
emptyText.setText(R.string.contact_selection_group_activity__no_contacts);
|
||||||
|
boolean useFastScroller = data != null && data.getCount() > 20;
|
||||||
|
recyclerView.setVerticalScrollBarEnabled(!useFastScroller);
|
||||||
|
if (useFastScroller) {
|
||||||
|
fastScroller.setVisibility(View.VISIBLE);
|
||||||
|
fastScroller.setRecyclerView(recyclerView);
|
||||||
|
} else {
|
||||||
|
fastScroller.setRecyclerView(null);
|
||||||
|
fastScroller.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoaderReset(@NonNull Loader<Cursor> loader) {
|
||||||
|
cursorRecyclerViewAdapter.changeCursor(null);
|
||||||
|
fastScroller.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
private void handleContactPermissionGranted() {
|
||||||
|
final Context context = requireContext();
|
||||||
|
|
||||||
|
new AsyncTask<Void, Void, Boolean>() {
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
swipeRefresh.setVisibility(View.GONE);
|
||||||
|
showContactsLayout.setVisibility(View.VISIBLE);
|
||||||
|
showContactsButton.setVisibility(View.INVISIBLE);
|
||||||
|
showContactsDescription.setText(R.string.ConversationListFragment_loading);
|
||||||
|
showContactsProgress.setVisibility(View.VISIBLE);
|
||||||
|
showContactsProgress.spin();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean doInBackground(Void... voids) {
|
||||||
|
try {
|
||||||
|
DirectoryHelper.refreshDirectory(context, false);
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.w(TAG, e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Boolean result) {
|
||||||
|
if (result) {
|
||||||
|
showContactsLayout.setVisibility(View.GONE);
|
||||||
|
swipeRefresh.setVisibility(View.VISIBLE);
|
||||||
|
reset();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getContext(), R.string.ContactSelectionListFragment_error_retrieving_contacts_check_your_network_connection, Toast.LENGTH_LONG).show();
|
||||||
|
initializeNoContactsPermission();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ListClickListener implements ContactSelectionListAdapter.ItemClickListener {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(ContactSelectionListItem contact) {
|
||||||
|
SelectedContact selectedContact = contact.isUsernameType() ? SelectedContact.forUsername(contact.getRecipientId().orNull(), contact.getNumber())
|
||||||
|
: SelectedContact.forPhone(contact.getRecipientId().orNull(), contact.getNumber());
|
||||||
|
|
||||||
|
if (!isMulti() || !cursorRecyclerViewAdapter.isSelectedContact(selectedContact)) {
|
||||||
|
if (selectionLimitReached()) {
|
||||||
|
Toast.makeText(requireContext(), R.string.ContactSelectionListFragment_the_group_is_full, Toast.LENGTH_SHORT).show();
|
||||||
|
groupLimit.animate().scaleX(1.3f).scaleY(1.3f).setInterpolator(new CycleInterpolator(0.5f)).start();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contact.isUsernameType()) {
|
||||||
|
AlertDialog loadingDialog = SimpleProgressDialog.show(requireContext());
|
||||||
|
|
||||||
|
SimpleTask.run(getViewLifecycleOwner().getLifecycle(), () -> {
|
||||||
|
return UsernameUtil.fetchUuidForUsername(requireContext(), contact.getNumber());
|
||||||
|
}, uuid -> {
|
||||||
|
loadingDialog.dismiss();
|
||||||
|
if (uuid.isPresent()) {
|
||||||
|
Recipient recipient = Recipient.externalUsername(requireContext(), uuid.get(), contact.getNumber());
|
||||||
|
SelectedContact selected = SelectedContact.forUsername(recipient.getId(), contact.getNumber());
|
||||||
|
markContactSelected(selected);
|
||||||
|
cursorRecyclerViewAdapter.notifyItemChanged(recyclerView.getChildAdapterPosition(contact), ContactSelectionListAdapter.PAYLOAD_SELECTION_CHANGE);
|
||||||
|
|
||||||
|
if (onContactSelectedListener != null) {
|
||||||
|
onContactSelectedListener.onContactSelected(Optional.of(recipient.getId()), null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
new AlertDialog.Builder(requireContext())
|
||||||
|
.setTitle(R.string.ContactSelectionListFragment_username_not_found)
|
||||||
|
.setMessage(getString(R.string.ContactSelectionListFragment_s_is_not_a_signal_user, contact.getNumber()))
|
||||||
|
.setPositiveButton(R.string.ContactSelectionListFragment_okay, (dialog, which) -> dialog.dismiss())
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
markContactSelected(selectedContact);
|
||||||
|
cursorRecyclerViewAdapter.notifyItemChanged(recyclerView.getChildAdapterPosition(contact), ContactSelectionListAdapter.PAYLOAD_SELECTION_CHANGE);
|
||||||
|
|
||||||
|
if (onContactSelectedListener != null) {
|
||||||
|
onContactSelectedListener.onContactSelected(contact.getRecipientId(), contact.getNumber());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
markContactUnselected(selectedContact);
|
||||||
|
cursorRecyclerViewAdapter.notifyItemChanged(recyclerView.getChildAdapterPosition(contact), ContactSelectionListAdapter.PAYLOAD_SELECTION_CHANGE);
|
||||||
|
|
||||||
|
if (onContactSelectedListener != null) {
|
||||||
|
onContactSelectedListener.onContactDeselected(contact.getRecipientId(), contact.getNumber());
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean selectionLimitReached() {
|
||||||
|
return getChipCount() >= selectionLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markContactSelected(@NonNull SelectedContact selectedContact) {
|
||||||
|
cursorRecyclerViewAdapter.addSelectedContact(selectedContact);
|
||||||
|
if (isMulti() && FeatureFlags.newGroupUI()) {
|
||||||
|
addChipForSelectedContact(selectedContact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markContactUnselected(@NonNull SelectedContact selectedContact) {
|
||||||
|
cursorRecyclerViewAdapter.removeFromSelectedContacts(selectedContact);
|
||||||
|
cursorRecyclerViewAdapter.notifyItemRangeChanged(0, cursorRecyclerViewAdapter.getItemCount(), ContactSelectionListAdapter.PAYLOAD_SELECTION_CHANGE);
|
||||||
|
removeChipForContact(selectedContact);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeChipForContact(@NonNull SelectedContact contact) {
|
||||||
|
for (int i = chipGroup.getChildCount() - 1; i >= 0; i--) {
|
||||||
|
View v = chipGroup.getChildAt(i);
|
||||||
|
if (v instanceof ContactChip && contact.matches(((ContactChip) v).getContact())) {
|
||||||
|
chipGroup.removeView(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateGroupLimit(getChipCount());
|
||||||
|
|
||||||
|
if (getChipCount() == 0) {
|
||||||
|
setChipGroupVisibility(ConstraintSet.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addChipForSelectedContact(@NonNull SelectedContact selectedContact) {
|
||||||
|
SimpleTask.run(getViewLifecycleOwner().getLifecycle(),
|
||||||
|
() -> Recipient.resolved(selectedContact.getOrCreateRecipientId(requireContext())),
|
||||||
|
resolved -> addChipForRecipient(resolved, selectedContact));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addChipForRecipient(@NonNull Recipient recipient, @NonNull SelectedContact selectedContact) {
|
||||||
|
final ContactChip chip = new ContactChip(requireContext());
|
||||||
|
|
||||||
|
if (getChipCount() == 0) {
|
||||||
|
setChipGroupVisibility(ConstraintSet.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
chip.setText(recipient.getShortDisplayName(requireContext()));
|
||||||
|
chip.setContact(selectedContact);
|
||||||
|
chip.setCloseIconVisible(true);
|
||||||
|
chip.setOnCloseIconClickListener(view -> {
|
||||||
|
markContactUnselected(selectedContact);
|
||||||
|
|
||||||
|
if (onContactSelectedListener != null) {
|
||||||
|
onContactSelectedListener.onContactDeselected(Optional.of(recipient.getId()), recipient.getE164().orNull());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chipGroup.getLayoutTransition().addTransitionListener(new LayoutTransition.TransitionListener() {
|
||||||
|
@Override
|
||||||
|
public void startTransition(LayoutTransition transition, ViewGroup container, View view, int transitionType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void endTransition(LayoutTransition transition, ViewGroup container, View view, int transitionType) {
|
||||||
|
if (view == chip && transitionType == LayoutTransition.APPEARING) {
|
||||||
|
chipGroup.getLayoutTransition().removeTransitionListener(this);
|
||||||
|
registerChipRecipientObserver(chip, recipient.live());
|
||||||
|
chipGroup.post(ContactSelectionListFragment.this::smoothScrollChipsToEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chip.setAvatar(glideRequests, recipient, () -> addChip(chip));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addChip(@NonNull ContactChip chip) {
|
||||||
|
chipGroup.addView(chip);
|
||||||
|
updateGroupLimit(getChipCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getChipCount() {
|
||||||
|
int count = chipGroup.getChildCount() - CHIP_GROUP_EMPTY_CHILD_COUNT;
|
||||||
|
if (count < 0) throw new AssertionError();
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerChipRecipientObserver(@NonNull ContactChip chip, @Nullable LiveRecipient recipient) {
|
||||||
|
if (recipient != null) {
|
||||||
|
recipient.observe(getViewLifecycleOwner(), resolved -> {
|
||||||
|
if (chip.isAttachedToWindow()) {
|
||||||
|
chip.setAvatar(glideRequests, resolved, null);
|
||||||
|
chip.setText(resolved.getShortDisplayName(chip.getContext()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setChipGroupVisibility(int visibility) {
|
||||||
|
TransitionManager.beginDelayedTransition(constraintLayout, new AutoTransition().setDuration(CHIP_GROUP_REVEAL_DURATION_MS));
|
||||||
|
|
||||||
|
ConstraintSet constraintSet = new ConstraintSet();
|
||||||
|
constraintSet.clone(constraintLayout);
|
||||||
|
constraintSet.setVisibility(R.id.chipGroupScrollContainer, visibility);
|
||||||
|
constraintSet.applyTo(constraintLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnContactSelectedListener(OnContactSelectedListener onContactSelectedListener) {
|
||||||
|
this.onContactSelectedListener = onContactSelectedListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
|
||||||
|
this.swipeRefresh.setOnRefreshListener(onRefreshListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void smoothScrollChipsToEnd() {
|
||||||
|
int x = chipGroupScrollContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR ? chipGroup.getWidth() : 0;
|
||||||
|
chipGroupScrollContainer.smoothScrollTo(x, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnContactSelectedListener {
|
||||||
|
void onContactSelected(Optional<RecipientId> recipientId, String number);
|
||||||
|
void onContactDeselected(Optional<RecipientId> recipientId, String number);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ListCallback {
|
||||||
|
void onInvite();
|
||||||
|
void onNewGroup(boolean forceV1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ScrollCallback {
|
||||||
|
void onBeginScroll();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -149,7 +149,8 @@ public class DatabaseMigrationActivity extends PassphraseRequiredActionBarActivi
|
|||||||
if (getIntent().hasExtra("next_intent")) {
|
if (getIntent().hasExtra("next_intent")) {
|
||||||
startActivity((Intent)getIntent().getParcelableExtra("next_intent"));
|
startActivity((Intent)getIntent().getParcelableExtra("next_intent"));
|
||||||
} else {
|
} else {
|
||||||
startActivity(new Intent(this, ConversationListActivity.class));
|
// TODO [greyson] Navigation
|
||||||
|
startActivity(new Intent(this, MainActivity.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@ import androidx.core.content.ContextCompat;
|
|||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||||
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
||||||
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||||
import org.thoughtcrime.securesms.push.AccountManagerFactory;
|
import org.thoughtcrime.securesms.push.AccountManagerFactory;
|
||||||
@@ -177,7 +178,7 @@ public class DeviceActivity extends PassphraseRequiredActionBarActivity
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Context context = DeviceActivity.this;
|
Context context = DeviceActivity.this;
|
||||||
SignalServiceAccountManager accountManager = AccountManagerFactory.createManager(context);
|
SignalServiceAccountManager accountManager = ApplicationDependencies.getSignalServiceAccountManager();
|
||||||
String verificationCode = accountManager.getNewDeviceVerificationCode();
|
String verificationCode = accountManager.getNewDeviceVerificationCode();
|
||||||
String ephemeralId = uri.getQueryParameter("uuid");
|
String ephemeralId = uri.getQueryParameter("uuid");
|
||||||
String publicKeyEncoded = uri.getQueryParameter("pub_key");
|
String publicKeyEncoded = uri.getQueryParameter("pub_key");
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@@ -13,7 +14,6 @@ import androidx.appcompat.app.AlertDialog;
|
|||||||
|
|
||||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
import org.thoughtcrime.securesms.devicelist.Device;
|
import org.thoughtcrime.securesms.devicelist.Device;
|
||||||
import org.thoughtcrime.securesms.jobs.RefreshUnidentifiedDeliveryAbilityJob;
|
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -162,27 +162,31 @@ public class DeviceListFragment extends ListFragment
|
|||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
private void handleDisconnectDevice(final long deviceId) {
|
private void handleDisconnectDevice(final long deviceId) {
|
||||||
new ProgressDialogAsyncTask<Void, Void, Void>(getActivity(),
|
new ProgressDialogAsyncTask<Void, Void, Boolean>(getActivity(),
|
||||||
R.string.DeviceListActivity_unlinking_device_no_ellipsis,
|
R.string.DeviceListActivity_unlinking_device_no_ellipsis,
|
||||||
R.string.DeviceListActivity_unlinking_device)
|
R.string.DeviceListActivity_unlinking_device)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Boolean doInBackground(Void... params) {
|
||||||
try {
|
try {
|
||||||
accountManager.removeDevice(deviceId);
|
accountManager.removeDevice(deviceId);
|
||||||
ApplicationDependencies.getJobManager().add(new RefreshUnidentifiedDeliveryAbilityJob());
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
Toast.makeText(getActivity(), R.string.DeviceListActivity_network_failed, Toast.LENGTH_LONG).show();
|
return false;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
getLoaderManager().restartLoader(0, null, DeviceListFragment.this);
|
if (result) {
|
||||||
|
getLoaderManager().restartLoader(0, null, DeviceListFragment.this);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getActivity(), R.string.DeviceListActivity_network_failed, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
@@ -17,9 +17,6 @@ public class DeviceProvisioningActivity extends PassphraseRequiredActionBarActiv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle bundle, boolean ready) {
|
protected void onCreate(Bundle bundle, boolean ready) {
|
||||||
assert getSupportActionBar() != null;
|
|
||||||
getSupportActionBar().hide();
|
|
||||||
|
|
||||||
AlertDialog dialog = new AlertDialog.Builder(this)
|
AlertDialog dialog = new AlertDialog.Builder(this)
|
||||||
.setTitle(getString(R.string.DeviceProvisioningActivity_link_a_signal_device))
|
.setTitle(getString(R.string.DeviceProvisioningActivity_link_a_signal_device))
|
||||||
.setMessage(getString(R.string.DeviceProvisioningActivity_it_looks_like_youre_trying_to_link_a_signal_device_using_a_3rd_party_scanner))
|
.setMessage(getString(R.string.DeviceProvisioningActivity_it_looks_like_youre_trying_to_link_a_signal_device_using_a_3rd_party_scanner))
|
||||||
@@ -18,20 +18,14 @@
|
|||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.avatar.AvatarSelection;
|
|
||||||
import org.thoughtcrime.securesms.conversation.ConversationActivity;
|
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -42,6 +36,10 @@ import android.widget.ListView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
import com.bumptech.glide.request.target.SimpleTarget;
|
import com.bumptech.glide.request.target.SimpleTarget;
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
@@ -52,29 +50,35 @@ import org.thoughtcrime.securesms.contacts.ContactsCursorLoader.DisplayMode;
|
|||||||
import org.thoughtcrime.securesms.contacts.RecipientsEditor;
|
import org.thoughtcrime.securesms.contacts.RecipientsEditor;
|
||||||
import org.thoughtcrime.securesms.contacts.avatars.ContactColors;
|
import org.thoughtcrime.securesms.contacts.avatars.ContactColors;
|
||||||
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
|
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
|
||||||
import org.thoughtcrime.securesms.database.Address;
|
import org.thoughtcrime.securesms.conversation.ConversationActivity;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||||
import org.thoughtcrime.securesms.database.GroupDatabase.GroupRecord;
|
import org.thoughtcrime.securesms.database.GroupDatabase.GroupRecord;
|
||||||
import org.thoughtcrime.securesms.database.RecipientDatabase;
|
import org.thoughtcrime.securesms.database.RecipientDatabase;
|
||||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||||
|
import org.thoughtcrime.securesms.groups.GroupId;
|
||||||
import org.thoughtcrime.securesms.groups.GroupManager;
|
import org.thoughtcrime.securesms.groups.GroupManager;
|
||||||
import org.thoughtcrime.securesms.groups.GroupManager.GroupActionResult;
|
import org.thoughtcrime.securesms.groups.GroupManager.GroupActionResult;
|
||||||
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.mediasend.AvatarSelectionActivity;
|
||||||
|
import org.thoughtcrime.securesms.mediasend.AvatarSelectionBottomSheetDialogFragment;
|
||||||
|
import org.thoughtcrime.securesms.mediasend.Media;
|
||||||
|
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
|
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
||||||
|
import org.thoughtcrime.securesms.profiles.edit.EditProfileActivity;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
import org.thoughtcrime.securesms.util.BitmapUtil;
|
import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
|
||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
|
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||||
import org.thoughtcrime.securesms.util.SelectedRecipientsAdapter;
|
import org.thoughtcrime.securesms.util.SelectedRecipientsAdapter;
|
||||||
import org.thoughtcrime.securesms.util.SelectedRecipientsAdapter.OnRecipientDeletedListener;
|
import org.thoughtcrime.securesms.util.SelectedRecipientsAdapter.OnRecipientDeletedListener;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
|
||||||
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
|
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
|
||||||
import org.whispersystems.libsignal.util.guava.Optional;
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@@ -82,7 +86,7 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity to create and update groups
|
* Activity to create and update {@link GroupId.V1} groups
|
||||||
*
|
*
|
||||||
* @author Jake McGinty
|
* @author Jake McGinty
|
||||||
*/
|
*/
|
||||||
@@ -93,27 +97,31 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
|
|
||||||
private final static String TAG = GroupCreateActivity.class.getSimpleName();
|
private final static String TAG = GroupCreateActivity.class.getSimpleName();
|
||||||
|
|
||||||
public static final String GROUP_ADDRESS_EXTRA = "group_recipient";
|
private static final String GROUP_ID_EXTRA = "group_id";
|
||||||
public static final String GROUP_THREAD_EXTRA = "group_thread";
|
private static final String GROUP_THREAD_EXTRA = "group_thread";
|
||||||
|
|
||||||
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
||||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
|
||||||
|
|
||||||
private static final int PICK_CONTACT = 1;
|
private static final short REQUEST_CODE_SELECT_AVATAR = 26165;
|
||||||
public static final int AVATAR_SIZE = 210;
|
private static final int PICK_CONTACT = 1;
|
||||||
|
|
||||||
private EditText groupName;
|
private EditText groupName;
|
||||||
private ListView lv;
|
private ListView listView;
|
||||||
private ImageView avatar;
|
private ImageView avatar;
|
||||||
private TextView creatingText;
|
private TextView creatingText;
|
||||||
private Bitmap avatarBmp;
|
private Bitmap avatarBmp;
|
||||||
|
|
||||||
@NonNull private Optional<GroupData> groupToUpdate = Optional.absent();
|
@NonNull private Optional<GroupData> groupToUpdate = Optional.absent();
|
||||||
|
|
||||||
|
public static Intent newEditGroupIntent(@NonNull Context context, @NonNull GroupId.V1 groupId) {
|
||||||
|
Intent intent = new Intent(context, GroupCreateActivity.class);
|
||||||
|
intent.putExtra(GroupCreateActivity.GROUP_ID_EXTRA, groupId.toString());
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreCreate() {
|
protected void onPreCreate() {
|
||||||
dynamicTheme.onCreate(this);
|
dynamicTheme.onCreate(this);
|
||||||
dynamicLanguage.onCreate(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -129,7 +137,6 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
dynamicTheme.onResume(this);
|
dynamicTheme.onResume(this);
|
||||||
dynamicLanguage.onResume(this);
|
|
||||||
updateViewState();
|
updateViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,27 +193,42 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
RecipientsEditor recipientsEditor = ViewUtil.findById(this, R.id.recipients_text);
|
RecipientsEditor recipientsEditor = findViewById(R.id.recipients_text);
|
||||||
PushRecipientsPanel recipientsPanel = ViewUtil.findById(this, R.id.recipients);
|
PushRecipientsPanel recipientsPanel = findViewById(R.id.recipients);
|
||||||
lv = ViewUtil.findById(this, R.id.selected_contacts_list);
|
|
||||||
avatar = ViewUtil.findById(this, R.id.avatar);
|
listView = findViewById(R.id.selected_contacts_list);
|
||||||
groupName = ViewUtil.findById(this, R.id.group_name);
|
avatar = findViewById(R.id.avatar);
|
||||||
creatingText = ViewUtil.findById(this, R.id.creating_group_text);
|
groupName = findViewById(R.id.group_name);
|
||||||
|
creatingText = findViewById(R.id.creating_group_text);
|
||||||
|
|
||||||
SelectedRecipientsAdapter adapter = new SelectedRecipientsAdapter(this);
|
SelectedRecipientsAdapter adapter = new SelectedRecipientsAdapter(this);
|
||||||
adapter.setOnRecipientDeletedListener(this);
|
adapter.setOnRecipientDeletedListener(this);
|
||||||
lv.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
recipientsEditor.setHint(R.string.recipients_panel__add_members);
|
recipientsEditor.setHint(R.string.recipients_panel__add_members);
|
||||||
recipientsPanel.setPanelChangeListener(this);
|
recipientsPanel.setPanelChangeListener(this);
|
||||||
|
|
||||||
findViewById(R.id.contacts_button).setOnClickListener(new AddRecipientButtonListener());
|
findViewById(R.id.contacts_button).setOnClickListener(new AddRecipientButtonListener());
|
||||||
avatar.setImageDrawable(new ResourceContactPhoto(R.drawable.ic_group_outline_40, R.drawable.ic_group_outline_20).asDrawable(this, ContactColors.UNKNOWN_COLOR.toConversationColor(this)));
|
|
||||||
avatar.setOnClickListener(view -> AvatarSelection.startAvatarSelection(this, false, false));
|
avatar.setImageDrawable(getDefaultGroupAvatar());
|
||||||
|
avatar.setOnClickListener(view -> AvatarSelectionBottomSheetDialogFragment.create(avatarBmp != null, false, REQUEST_CODE_SELECT_AVATAR, true).show(getSupportFragmentManager(), null));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable getDefaultGroupAvatar() {
|
||||||
|
return new ResourceContactPhoto(R.drawable.ic_group_outline_34, R.drawable.ic_group_outline_20).asDrawable(this, ContactColors.UNKNOWN_COLOR.toConversationColor(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeExistingGroup() {
|
private void initializeExistingGroup() {
|
||||||
final Address groupAddress = getIntent().getParcelableExtra(GROUP_ADDRESS_EXTRA);
|
final GroupId groupId = GroupId.parseNullableOrThrow(getIntent().getStringExtra(GROUP_ID_EXTRA));
|
||||||
|
|
||||||
if (groupAddress != null) {
|
if (groupId != null) {
|
||||||
new FillExistingGroupInfoAsyncTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, groupAddress.toGroupString());
|
GroupId.V1 groupIdV1 = groupId.requireV1();
|
||||||
|
|
||||||
|
new FillExistingGroupInfoAsyncTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, groupIdV1);
|
||||||
|
|
||||||
|
if (FeatureFlags.newGroupUI()) {
|
||||||
|
avatar.setOnClickListener(v -> startActivity(EditProfileActivity.getIntentForGroupProfile(this, groupIdV1)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,8 +283,8 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleGroupUpdate() {
|
private void handleGroupUpdate() {
|
||||||
new UpdateSignalGroupTask(this, groupToUpdate.get().id, avatarBmp,
|
new UpdateSignalGroupV1Task(this, groupToUpdate.get().id, avatarBmp,
|
||||||
getGroupName(), getAdapter().getRecipients()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
getGroupName(), getAdapter().getRecipients()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleOpenConversation(long threadId, Recipient recipient) {
|
private void handleOpenConversation(long threadId, Recipient recipient) {
|
||||||
@@ -275,7 +297,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private SelectedRecipientsAdapter getAdapter() {
|
private SelectedRecipientsAdapter getAdapter() {
|
||||||
return (SelectedRecipientsAdapter)lv.getAdapter();
|
return (SelectedRecipientsAdapter) listView.getAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable String getGroupName() {
|
private @Nullable String getGroupName() {
|
||||||
@@ -285,37 +307,41 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int reqCode, int resultCode, final Intent data) {
|
public void onActivityResult(int reqCode, int resultCode, final Intent data) {
|
||||||
super.onActivityResult(reqCode, resultCode, data);
|
super.onActivityResult(reqCode, resultCode, data);
|
||||||
Uri outputFile = Uri.fromFile(new File(getCacheDir(), "cropped"));
|
|
||||||
|
|
||||||
if (data == null || resultCode != Activity.RESULT_OK)
|
if (data == null || resultCode != Activity.RESULT_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (reqCode) {
|
switch (reqCode) {
|
||||||
case PICK_CONTACT:
|
case PICK_CONTACT:
|
||||||
List<String> selected = data.getStringArrayListExtra("contacts");
|
List<RecipientId> selected = data.getParcelableArrayListExtra(PushContactSelectionActivity.KEY_SELECTED_RECIPIENTS);
|
||||||
|
|
||||||
for (String contact : selected) {
|
for (RecipientId contact : selected) {
|
||||||
Recipient recipient = Recipient.external(this, contact);
|
Recipient recipient = Recipient.resolved(contact);
|
||||||
addSelectedContacts(recipient);
|
addSelectedContacts(recipient);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case AvatarSelection.REQUEST_CODE_AVATAR:
|
|
||||||
AvatarSelection.circularCropImage(this, data.getData(), outputFile, R.string.CropImageActivity_group_avatar);
|
|
||||||
break;
|
break;
|
||||||
case AvatarSelection.REQUEST_CODE_CROP_IMAGE:
|
case REQUEST_CODE_SELECT_AVATAR:
|
||||||
final Uri resultUri = AvatarSelection.getResultUri(data);
|
if (data.getBooleanExtra("delete", false)) {
|
||||||
|
avatarBmp = null;
|
||||||
|
avatar.setImageDrawable(getDefaultGroupAvatar());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Media result = data.getParcelableExtra(AvatarSelectionActivity.EXTRA_MEDIA);
|
||||||
|
final DecryptableUri decryptableUri = new DecryptableUri(result.getUri());
|
||||||
|
|
||||||
GlideApp.with(this)
|
GlideApp.with(this)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(resultUri)
|
.load(decryptableUri)
|
||||||
.skipMemoryCache(true)
|
.skipMemoryCache(true)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
.override(AVATAR_SIZE, AVATAR_SIZE)
|
.override(AvatarHelper.AVATAR_DIMENSIONS, AvatarHelper.AVATAR_DIMENSIONS)
|
||||||
.into(new SimpleTarget<Bitmap>() {
|
.into(new SimpleTarget<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||||
setAvatar(resultUri, resource);
|
setAvatar(decryptableUri, resource);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -352,7 +378,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
memberAddresses.add(Recipient.self().getId());
|
memberAddresses.add(Recipient.self().getId());
|
||||||
|
|
||||||
String groupId = DatabaseFactory.getGroupDatabase(activity).getOrCreateGroupForMembers(memberAddresses, true);
|
GroupId.Mms groupId = DatabaseFactory.getGroupDatabase(activity).getOrCreateMmsGroupForMembers(memberAddresses);
|
||||||
RecipientId groupRecipientId = DatabaseFactory.getRecipientDatabase(activity).getOrInsertFromGroupId(groupId);
|
RecipientId groupRecipientId = DatabaseFactory.getRecipientDatabase(activity).getOrInsertFromGroupId(groupId);
|
||||||
Recipient groupRecipient = Recipient.resolved(groupRecipientId);
|
Recipient groupRecipient = Recipient.resolved(groupRecipientId);
|
||||||
long threadId = DatabaseFactory.getThreadDatabase(activity).getThreadIdFor(groupRecipient, ThreadDatabase.DistributionTypes.DEFAULT);
|
long threadId = DatabaseFactory.getThreadDatabase(activity).getThreadIdFor(groupRecipient, ThreadDatabase.DistributionTypes.DEFAULT);
|
||||||
@@ -416,7 +442,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Optional<GroupActionResult> doInBackground(Void... aVoid) {
|
protected Optional<GroupActionResult> doInBackground(Void... aVoid) {
|
||||||
return Optional.of(GroupManager.createGroup(activity, members, avatar, name, false));
|
return Optional.of(GroupManager.createGroupV1(activity, members, BitmapUtil.toByteArray(avatar), name, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -433,11 +459,11 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class UpdateSignalGroupTask extends SignalGroupTask {
|
private static class UpdateSignalGroupV1Task extends SignalGroupTask {
|
||||||
private String groupId;
|
private final GroupId.V1 groupId;
|
||||||
|
|
||||||
public UpdateSignalGroupTask(GroupCreateActivity activity, String groupId,
|
UpdateSignalGroupV1Task(GroupCreateActivity activity, GroupId.V1 groupId,
|
||||||
Bitmap avatar, String name, Set<Recipient> members)
|
Bitmap avatar, String name, Set<Recipient> members)
|
||||||
{
|
{
|
||||||
super(activity, avatar, name, members);
|
super(activity, avatar, name, members);
|
||||||
this.groupId = groupId;
|
this.groupId = groupId;
|
||||||
@@ -445,11 +471,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Optional<GroupActionResult> doInBackground(Void... aVoid) {
|
protected Optional<GroupActionResult> doInBackground(Void... aVoid) {
|
||||||
try {
|
return Optional.fromNullable(GroupManager.updateGroup(activity, groupId, members, BitmapUtil.toByteArray(avatar), name));
|
||||||
return Optional.of(GroupManager.updateGroup(activity, groupId, members, avatar, name));
|
|
||||||
} catch (InvalidNumberException e) {
|
|
||||||
return Optional.absent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -458,7 +480,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
if (!activity.isFinishing()) {
|
if (!activity.isFinishing()) {
|
||||||
Intent intent = activity.getIntent();
|
Intent intent = activity.getIntent();
|
||||||
intent.putExtra(GROUP_THREAD_EXTRA, result.get().getThreadId());
|
intent.putExtra(GROUP_THREAD_EXTRA, result.get().getThreadId());
|
||||||
intent.putExtra(GROUP_ADDRESS_EXTRA, result.get().getGroupRecipient().requireAddress());
|
intent.putExtra(GROUP_ID_EXTRA, result.get().getGroupRecipient().requireGroupId().toString());
|
||||||
activity.setResult(RESULT_OK, intent);
|
activity.setResult(RESULT_OK, intent);
|
||||||
activity.finish();
|
activity.finish();
|
||||||
}
|
}
|
||||||
@@ -500,8 +522,8 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
|
|
||||||
if (failIfNotPush && !isPush) {
|
if (failIfNotPush && !isPush) {
|
||||||
results.add(new Result(null, false, activity.getString(R.string.GroupCreateActivity_cannot_add_non_push_to_existing_group,
|
results.add(new Result(null, false, activity.getString(R.string.GroupCreateActivity_cannot_add_non_push_to_existing_group,
|
||||||
recipient.toShortString())));
|
recipient.toShortString(activity))));
|
||||||
} else if (TextUtils.equals(TextSecurePreferences.getLocalNumber(activity), recipient.requireAddress().serialize())) {
|
} else if (TextUtils.equals(TextSecurePreferences.getLocalNumber(activity), recipient.getE164().or(""))) {
|
||||||
results.add(new Result(null, false, activity.getString(R.string.GroupCreateActivity_youre_already_in_the_group)));
|
results.add(new Result(null, false, activity.getString(R.string.GroupCreateActivity_youre_already_in_the_group)));
|
||||||
} else {
|
} else {
|
||||||
results.add(new Result(recipient, isPush, null));
|
results.add(new Result(recipient, isPush, null));
|
||||||
@@ -525,7 +547,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class FillExistingGroupInfoAsyncTask extends ProgressDialogAsyncTask<String,Void,Optional<GroupData>> {
|
private static class FillExistingGroupInfoAsyncTask extends ProgressDialogAsyncTask<GroupId.V1, Void, Optional<GroupData>> {
|
||||||
private GroupCreateActivity activity;
|
private GroupCreateActivity activity;
|
||||||
|
|
||||||
public FillExistingGroupInfoAsyncTask(GroupCreateActivity activity) {
|
public FillExistingGroupInfoAsyncTask(GroupCreateActivity activity) {
|
||||||
@@ -536,18 +558,24 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Optional<GroupData> doInBackground(String... groupIds) {
|
protected Optional<GroupData> doInBackground(GroupId.V1... groupIds) {
|
||||||
final GroupDatabase db = DatabaseFactory.getGroupDatabase(activity);
|
final GroupDatabase db = DatabaseFactory.getGroupDatabase(activity);
|
||||||
final List<Recipient> recipients = db.getGroupMembers(groupIds[0], false);
|
final List<Recipient> recipients = db.getGroupMembers(groupIds[0], GroupDatabase.MemberSet.FULL_MEMBERS_EXCLUDING_SELF);
|
||||||
final Optional<GroupRecord> group = db.getGroup(groupIds[0]);
|
final Optional<GroupRecord> group = db.getGroup(groupIds[0]);
|
||||||
final Set<Recipient> existingContacts = new HashSet<>(recipients.size());
|
final Set<Recipient> existingContacts = new HashSet<>(recipients.size());
|
||||||
existingContacts.addAll(recipients);
|
existingContacts.addAll(recipients);
|
||||||
|
|
||||||
if (group.isPresent()) {
|
if (group.isPresent()) {
|
||||||
|
Bitmap avatar = null;
|
||||||
|
try {
|
||||||
|
avatar = BitmapFactory.decodeStream(AvatarHelper.getAvatar(getContext(), group.get().getRecipientId()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.w(TAG, "Failed to read avatar.");
|
||||||
|
}
|
||||||
return Optional.of(new GroupData(groupIds[0],
|
return Optional.of(new GroupData(groupIds[0],
|
||||||
existingContacts,
|
existingContacts,
|
||||||
BitmapUtil.fromByteArray(group.get().getAvatar()),
|
avatar,
|
||||||
group.get().getAvatar(),
|
BitmapUtil.toByteArray(avatar),
|
||||||
group.get().getTitle()));
|
group.get().getTitle()));
|
||||||
} else {
|
} else {
|
||||||
return Optional.absent();
|
return Optional.absent();
|
||||||
@@ -567,7 +595,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
SelectedRecipientsAdapter adapter = new SelectedRecipientsAdapter(activity, group.get().recipients);
|
SelectedRecipientsAdapter adapter = new SelectedRecipientsAdapter(activity, group.get().recipients);
|
||||||
adapter.setOnRecipientDeletedListener(activity);
|
adapter.setOnRecipientDeletedListener(activity);
|
||||||
activity.lv.setAdapter(adapter);
|
activity.listView.setAdapter(adapter);
|
||||||
activity.updateViewState();
|
activity.updateViewState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -584,13 +612,13 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class GroupData {
|
private static class GroupData {
|
||||||
String id;
|
GroupId.V1 id;
|
||||||
Set<Recipient> recipients;
|
Set<Recipient> recipients;
|
||||||
Bitmap avatarBmp;
|
Bitmap avatarBmp;
|
||||||
byte[] avatarBytes;
|
byte[] avatarBytes;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
public GroupData(String id, Set<Recipient> recipients, Bitmap avatarBmp, byte[] avatarBytes, String name) {
|
GroupData(GroupId.V1 id, Set<Recipient> recipients, Bitmap avatarBmp, byte[] avatarBytes, String name) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.recipients = recipients;
|
this.recipients = recipients;
|
||||||
this.avatarBmp = avatarBmp;
|
this.avatarBmp = avatarBmp;
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.groups.LiveGroup;
|
||||||
|
import org.thoughtcrime.securesms.groups.ui.GroupMemberEntry;
|
||||||
|
import org.thoughtcrime.securesms.groups.ui.GroupMemberListView;
|
||||||
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
|
import org.thoughtcrime.securesms.recipients.ui.bottomsheet.RecipientBottomSheetDialogFragment;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public final class GroupMembersDialog {
|
||||||
|
|
||||||
|
private final FragmentActivity fragmentActivity;
|
||||||
|
private final Recipient groupRecipient;
|
||||||
|
|
||||||
|
public GroupMembersDialog(@NonNull FragmentActivity activity,
|
||||||
|
@NonNull Recipient groupRecipient)
|
||||||
|
{
|
||||||
|
this.fragmentActivity = activity;
|
||||||
|
this.groupRecipient = groupRecipient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void display() {
|
||||||
|
AlertDialog dialog = new AlertDialog.Builder(fragmentActivity)
|
||||||
|
.setTitle(R.string.ConversationActivity_group_members)
|
||||||
|
.setIconAttribute(R.attr.group_members_dialog_icon)
|
||||||
|
.setCancelable(true)
|
||||||
|
.setView(R.layout.dialog_group_members)
|
||||||
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
|
.show();
|
||||||
|
|
||||||
|
GroupMemberListView memberListView = dialog.findViewById(R.id.list_members);
|
||||||
|
|
||||||
|
LiveGroup liveGroup = new LiveGroup(groupRecipient.requireGroupId());
|
||||||
|
LiveData<List<GroupMemberEntry.FullMember>> fullMembers = liveGroup.getFullMembers();
|
||||||
|
|
||||||
|
//noinspection ConstantConditions
|
||||||
|
fullMembers.observe(fragmentActivity, memberListView::setMembers);
|
||||||
|
|
||||||
|
dialog.setOnDismissListener(d -> fullMembers.removeObservers(fragmentActivity));
|
||||||
|
|
||||||
|
memberListView.setRecipientClickListener(recipient -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
contactClick(recipient);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void contactClick(@NonNull Recipient recipient) {
|
||||||
|
RecipientBottomSheetDialogFragment.create(recipient.getId(), groupRecipient.requireGroupId())
|
||||||
|
.show(fragmentActivity.getSupportFragmentManager(), "BOTTOM");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.AnimationUtils;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.AnimRes;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.components.ContactFilterToolbar;
|
||||||
|
import org.thoughtcrime.securesms.components.ContactFilterToolbar.OnFilterChangedListener;
|
||||||
|
import org.thoughtcrime.securesms.contacts.ContactsCursorLoader.DisplayMode;
|
||||||
|
import org.thoughtcrime.securesms.contacts.SelectedContact;
|
||||||
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
|
import org.thoughtcrime.securesms.sms.MessageSender;
|
||||||
|
import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
||||||
|
import org.thoughtcrime.securesms.util.DynamicNoActionBarInviteTheme;
|
||||||
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
|
import org.thoughtcrime.securesms.util.ThemeUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.WindowUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture.Listener;
|
||||||
|
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask;
|
||||||
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
public class InviteActivity extends PassphraseRequiredActionBarActivity implements ContactSelectionListFragment.OnContactSelectedListener {
|
||||||
|
|
||||||
|
private ContactSelectionListFragment contactsFragment;
|
||||||
|
private EditText inviteText;
|
||||||
|
private ViewGroup smsSendFrame;
|
||||||
|
private Button smsSendButton;
|
||||||
|
private Animation slideInAnimation;
|
||||||
|
private Animation slideOutAnimation;
|
||||||
|
private DynamicTheme dynamicTheme = new DynamicNoActionBarInviteTheme();
|
||||||
|
private Toolbar primaryToolbar;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreCreate() {
|
||||||
|
super.onPreCreate();
|
||||||
|
dynamicTheme.onCreate(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState, boolean ready) {
|
||||||
|
getIntent().putExtra(ContactSelectionListFragment.DISPLAY_MODE, DisplayMode.FLAG_SMS);
|
||||||
|
getIntent().putExtra(ContactSelectionListFragment.MULTI_SELECT, true);
|
||||||
|
getIntent().putExtra(ContactSelectionListFragment.REFRESHABLE, false);
|
||||||
|
|
||||||
|
setContentView(R.layout.invite_activity);
|
||||||
|
|
||||||
|
initializeAppBar();
|
||||||
|
initializeResources();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
dynamicTheme.onResume(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeAppBar() {
|
||||||
|
primaryToolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(primaryToolbar);
|
||||||
|
|
||||||
|
assert getSupportActionBar() != null;
|
||||||
|
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
getSupportActionBar().setTitle(R.string.AndroidManifest__invite_friends);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeResources() {
|
||||||
|
slideInAnimation = loadAnimation(R.anim.slide_from_bottom);
|
||||||
|
slideOutAnimation = loadAnimation(R.anim.slide_to_bottom);
|
||||||
|
|
||||||
|
View shareButton = ViewUtil.findById(this, R.id.share_button);
|
||||||
|
View smsButton = ViewUtil.findById(this, R.id.sms_button);
|
||||||
|
Button smsCancelButton = ViewUtil.findById(this, R.id.cancel_sms_button);
|
||||||
|
ContactFilterToolbar contactFilter = ViewUtil.findById(this, R.id.contact_filter);
|
||||||
|
|
||||||
|
inviteText = ViewUtil.findById(this, R.id.invite_text);
|
||||||
|
smsSendFrame = ViewUtil.findById(this, R.id.sms_send_frame);
|
||||||
|
smsSendButton = ViewUtil.findById(this, R.id.send_sms_button);
|
||||||
|
contactsFragment = (ContactSelectionListFragment)getSupportFragmentManager().findFragmentById(R.id.contact_selection_list_fragment);
|
||||||
|
|
||||||
|
inviteText.setText(getString(R.string.InviteActivity_lets_switch_to_signal, getString(R.string.install_url)));
|
||||||
|
updateSmsButtonText();
|
||||||
|
|
||||||
|
contactsFragment.setOnContactSelectedListener(this);
|
||||||
|
shareButton.setOnClickListener(new ShareClickListener());
|
||||||
|
smsButton.setOnClickListener(new SmsClickListener());
|
||||||
|
smsCancelButton.setOnClickListener(new SmsCancelClickListener());
|
||||||
|
smsSendButton.setOnClickListener(new SmsSendClickListener());
|
||||||
|
contactFilter.setOnFilterChangedListener(new ContactFilterChangedListener());
|
||||||
|
contactFilter.setNavigationIcon(R.drawable.ic_search_conversation_24);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Animation loadAnimation(@AnimRes int animResId) {
|
||||||
|
final Animation animation = AnimationUtils.loadAnimation(this, animResId);
|
||||||
|
animation.setInterpolator(new FastOutSlowInInterpolator());
|
||||||
|
return animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onContactSelected(Optional<RecipientId> recipientId, String number) {
|
||||||
|
updateSmsButtonText();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onContactDeselected(Optional<RecipientId> recipientId, String number) {
|
||||||
|
updateSmsButtonText();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendSmsInvites() {
|
||||||
|
new SendSmsInvitesAsyncTask(this, inviteText.getText().toString())
|
||||||
|
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
|
||||||
|
contactsFragment.getSelectedContacts()
|
||||||
|
.toArray(new SelectedContact[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSmsButtonText() {
|
||||||
|
List<SelectedContact> selectedContacts = contactsFragment.getSelectedContacts();
|
||||||
|
smsSendButton.setText(getResources().getQuantityString(R.plurals.InviteActivity_send_sms_to_friends,
|
||||||
|
selectedContacts.size(),
|
||||||
|
selectedContacts.size()));
|
||||||
|
smsSendButton.setEnabled(!selectedContacts.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void onBackPressed() {
|
||||||
|
if (smsSendFrame.getVisibility() == View.VISIBLE) {
|
||||||
|
cancelSmsSelection();
|
||||||
|
} else {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelSmsSelection() {
|
||||||
|
setPrimaryColorsToolbarNormal();
|
||||||
|
contactsFragment.reset();
|
||||||
|
updateSmsButtonText();
|
||||||
|
ViewUtil.animateOut(smsSendFrame, slideOutAnimation, View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setPrimaryColorsToolbarNormal() {
|
||||||
|
primaryToolbar.setBackgroundColor(0);
|
||||||
|
primaryToolbar.getNavigationIcon().setColorFilter(null);
|
||||||
|
primaryToolbar.setTitleTextColor(ThemeUtil.getThemedColor(this, R.attr.title_text_color_primary));
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
|
getWindow().setStatusBarColor(ThemeUtil.getThemedColor(this, android.R.attr.statusBarColor));
|
||||||
|
getWindow().setNavigationBarColor(ThemeUtil.getThemedColor(this, android.R.attr.navigationBarColor));
|
||||||
|
WindowUtil.setLightStatusBarFromTheme(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
WindowUtil.setLightNavigationBarFromTheme(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setPrimaryColorsToolbarForSms() {
|
||||||
|
primaryToolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.core_ultramarine));
|
||||||
|
primaryToolbar.getNavigationIcon().setColorFilter(ThemeUtil.getThemedColor(this, R.attr.conversation_subtitle_color), PorterDuff.Mode.SRC_IN);
|
||||||
|
primaryToolbar.setTitleTextColor(ThemeUtil.getThemedColor(this, R.attr.conversation_title_color));
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
|
getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.core_ultramarine));
|
||||||
|
WindowUtil.clearLightStatusBar(getWindow());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 27) {
|
||||||
|
getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.core_ultramarine));
|
||||||
|
WindowUtil.clearLightNavigationBar(getWindow());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ShareClickListener implements OnClickListener {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent sendIntent = new Intent();
|
||||||
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, inviteText.getText().toString());
|
||||||
|
sendIntent.setType("text/plain");
|
||||||
|
if (sendIntent.resolveActivity(getPackageManager()) != null) {
|
||||||
|
startActivity(Intent.createChooser(sendIntent, getString(R.string.InviteActivity_invite_to_signal)));
|
||||||
|
} else {
|
||||||
|
Toast.makeText(InviteActivity.this, R.string.InviteActivity_no_app_to_share_to, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SmsClickListener implements OnClickListener {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
setPrimaryColorsToolbarForSms();
|
||||||
|
ViewUtil.animateIn(smsSendFrame, slideInAnimation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SmsCancelClickListener implements OnClickListener {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
cancelSmsSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SmsSendClickListener implements OnClickListener {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
new AlertDialog.Builder(InviteActivity.this)
|
||||||
|
.setTitle(getResources().getQuantityString(R.plurals.InviteActivity_send_sms_invites,
|
||||||
|
contactsFragment.getSelectedContacts().size(),
|
||||||
|
contactsFragment.getSelectedContacts().size()))
|
||||||
|
.setMessage(inviteText.getText().toString())
|
||||||
|
.setPositiveButton(R.string.yes, (dialog, which) -> sendSmsInvites())
|
||||||
|
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ContactFilterChangedListener implements OnFilterChangedListener {
|
||||||
|
@Override
|
||||||
|
public void onFilterChanged(String filter) {
|
||||||
|
contactsFragment.setQueryFilter(filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
private class SendSmsInvitesAsyncTask extends ProgressDialogAsyncTask<SelectedContact,Void,Void> {
|
||||||
|
private final String message;
|
||||||
|
|
||||||
|
SendSmsInvitesAsyncTask(Context context, String message) {
|
||||||
|
super(context, R.string.InviteActivity_sending, R.string.InviteActivity_sending);
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(SelectedContact... contacts) {
|
||||||
|
final Context context = getContext();
|
||||||
|
if (context == null) return null;
|
||||||
|
|
||||||
|
for (SelectedContact contact : contacts) {
|
||||||
|
RecipientId recipientId = contact.getOrCreateRecipientId(context);
|
||||||
|
Recipient recipient = Recipient.resolved(recipientId);
|
||||||
|
int subscriptionId = recipient.getDefaultSubscriptionId().or(-1);
|
||||||
|
|
||||||
|
MessageSender.send(context, new OutgoingTextMessage(recipient, message, subscriptionId), -1L, true, null);
|
||||||
|
|
||||||
|
if (recipient.getContactUri() != null) {
|
||||||
|
DatabaseFactory.getRecipientDatabase(context).setHasSentInvite(recipient.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Void aVoid) {
|
||||||
|
super.onPostExecute(aVoid);
|
||||||
|
final Context context = getContext();
|
||||||
|
if (context == null) return;
|
||||||
|
|
||||||
|
ViewUtil.animateOut(smsSendFrame, slideOutAnimation, View.GONE).addListener(new Listener<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean result) {
|
||||||
|
contactsFragment.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(ExecutionException e) {}
|
||||||
|
});
|
||||||
|
Toast.makeText(context, R.string.InviteActivity_invitations_sent, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||||
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
|
|
||||||
|
public class MainActivity extends PassphraseRequiredActionBarActivity {
|
||||||
|
|
||||||
|
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
|
||||||
|
private final MainNavigator navigator = new MainNavigator(this);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState, boolean ready) {
|
||||||
|
super.onCreate(savedInstanceState, ready);
|
||||||
|
setContentView(R.layout.main_activity);
|
||||||
|
|
||||||
|
navigator.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreCreate() {
|
||||||
|
super.onPreCreate();
|
||||||
|
dynamicTheme.onCreate(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
dynamicTheme.onResume(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (!navigator.onBackPressed()) {
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NonNull MainNavigator getNavigator() {
|
||||||
|
return navigator;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
public class MainFragment extends Fragment {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
|
||||||
|
if (!(requireActivity() instanceof MainActivity)) {
|
||||||
|
throw new IllegalStateException("Can only be used inside of MainActivity!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected @NonNull MainNavigator getNavigator() {
|
||||||
|
return MainNavigator.get(requireActivity());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.conversation.ConversationActivity;
|
||||||
|
import org.thoughtcrime.securesms.conversationlist.ConversationListArchiveFragment;
|
||||||
|
import org.thoughtcrime.securesms.conversationlist.ConversationListFragment;
|
||||||
|
import org.thoughtcrime.securesms.groups.ui.creategroup.CreateGroupActivity;
|
||||||
|
import org.thoughtcrime.securesms.insights.InsightsLauncher;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
|
|
||||||
|
public class MainNavigator {
|
||||||
|
|
||||||
|
private final MainActivity activity;
|
||||||
|
|
||||||
|
public MainNavigator(@NonNull MainActivity activity) {
|
||||||
|
this.activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MainNavigator get(@NonNull Activity activity) {
|
||||||
|
if (!(activity instanceof MainActivity)) {
|
||||||
|
throw new IllegalArgumentException("Activity must be an instance of MainActivity!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((MainActivity) activity).getNavigator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.add(R.id.fragment_container, ConversationListFragment.newInstance())
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return True if the back pressed was handled in our own custom way, false if it should be given
|
||||||
|
* to the system to do the default behavior.
|
||||||
|
*/
|
||||||
|
public boolean onBackPressed() {
|
||||||
|
Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_container);
|
||||||
|
|
||||||
|
if (fragment instanceof BackHandler) {
|
||||||
|
return ((BackHandler) fragment).onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goToConversation(@NonNull RecipientId recipientId, long threadId, int distributionType, int startingPosition) {
|
||||||
|
Intent intent = ConversationActivity.buildIntent(activity, recipientId, threadId, distributionType, startingPosition);
|
||||||
|
|
||||||
|
activity.startActivity(intent);
|
||||||
|
activity.overridePendingTransition(R.anim.slide_from_end, R.anim.fade_scale_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goToAppSettings() {
|
||||||
|
Intent intent = new Intent(activity, ApplicationPreferencesActivity.class);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void goToArchiveList() {
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.setCustomAnimations(R.anim.slide_from_end, R.anim.slide_to_start, R.anim.slide_from_start, R.anim.slide_to_end)
|
||||||
|
.replace(R.id.fragment_container, ConversationListArchiveFragment.newInstance())
|
||||||
|
.addToBackStack(null)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goToGroupCreation() {
|
||||||
|
activity.startActivity(CreateGroupActivity.newIntent(activity));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goToInvite() {
|
||||||
|
Intent intent = new Intent(activity, InviteActivity.class);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goToInsights() {
|
||||||
|
InsightsLauncher.showInsightsDashboard(activity.getSupportFragmentManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NonNull FragmentManager getFragmentManager() {
|
||||||
|
return activity.getSupportFragmentManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface BackHandler {
|
||||||
|
/**
|
||||||
|
* @return True if the back pressed was handled in our own custom way, false if it should be given
|
||||||
|
* to the system to do the default behavior.
|
||||||
|
*/
|
||||||
|
boolean onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,11 +52,11 @@ import androidx.viewpager.widget.ViewPager;
|
|||||||
import org.thoughtcrime.securesms.animation.DepthPageTransformer;
|
import org.thoughtcrime.securesms.animation.DepthPageTransformer;
|
||||||
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
|
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
|
||||||
import org.thoughtcrime.securesms.components.viewpager.ExtendedOnPageChangedListener;
|
import org.thoughtcrime.securesms.components.viewpager.ExtendedOnPageChangedListener;
|
||||||
import org.thoughtcrime.securesms.database.Address;
|
|
||||||
import org.thoughtcrime.securesms.database.MediaDatabase;
|
import org.thoughtcrime.securesms.database.MediaDatabase;
|
||||||
import org.thoughtcrime.securesms.database.MediaDatabase.MediaRecord;
|
import org.thoughtcrime.securesms.database.MediaDatabase.MediaRecord;
|
||||||
import org.thoughtcrime.securesms.database.loaders.PagingMediaLoader;
|
import org.thoughtcrime.securesms.database.loaders.PagingMediaLoader;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.mediaoverview.MediaOverviewActivity;
|
||||||
import org.thoughtcrime.securesms.mediapreview.MediaPreviewFragment;
|
import org.thoughtcrime.securesms.mediapreview.MediaPreviewFragment;
|
||||||
import org.thoughtcrime.securesms.mediapreview.MediaPreviewViewModel;
|
import org.thoughtcrime.securesms.mediapreview.MediaPreviewViewModel;
|
||||||
import org.thoughtcrime.securesms.mediapreview.MediaRailAdapter;
|
import org.thoughtcrime.securesms.mediapreview.MediaRailAdapter;
|
||||||
@@ -64,11 +64,11 @@ import org.thoughtcrime.securesms.mms.GlideApp;
|
|||||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
|
import org.thoughtcrime.securesms.sharing.ShareActivity;
|
||||||
import org.thoughtcrime.securesms.util.AttachmentUtil;
|
import org.thoughtcrime.securesms.util.AttachmentUtil;
|
||||||
import org.thoughtcrime.securesms.util.DateUtils;
|
import org.thoughtcrime.securesms.util.DateUtils;
|
||||||
import org.thoughtcrime.securesms.util.SaveAttachmentTask;
|
import org.thoughtcrime.securesms.util.SaveAttachmentTask;
|
||||||
import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment;
|
import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -85,12 +85,16 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
|
|
||||||
private final static String TAG = MediaPreviewActivity.class.getSimpleName();
|
private final static String TAG = MediaPreviewActivity.class.getSimpleName();
|
||||||
|
|
||||||
public static final String RECIPIENT_EXTRA = "recipient_id";
|
private static final int NOT_IN_A_THREAD = -2;
|
||||||
|
|
||||||
|
public static final String THREAD_ID_EXTRA = "thread_id";
|
||||||
public static final String DATE_EXTRA = "date";
|
public static final String DATE_EXTRA = "date";
|
||||||
public static final String SIZE_EXTRA = "size";
|
public static final String SIZE_EXTRA = "size";
|
||||||
public static final String CAPTION_EXTRA = "caption";
|
public static final String CAPTION_EXTRA = "caption";
|
||||||
public static final String OUTGOING_EXTRA = "outgoing";
|
|
||||||
public static final String LEFT_IS_RECENT_EXTRA = "left_is_recent";
|
public static final String LEFT_IS_RECENT_EXTRA = "left_is_recent";
|
||||||
|
public static final String HIDE_ALL_MEDIA_EXTRA = "came_from_all_media";
|
||||||
|
public static final String SHOW_THREAD_EXTRA = "show_thread";
|
||||||
|
public static final String SORTING_EXTRA = "sorting";
|
||||||
|
|
||||||
private ViewPager mediaPager;
|
private ViewPager mediaPager;
|
||||||
private View detailsContainer;
|
private View detailsContainer;
|
||||||
@@ -103,12 +107,29 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
private String initialMediaType;
|
private String initialMediaType;
|
||||||
private long initialMediaSize;
|
private long initialMediaSize;
|
||||||
private String initialCaption;
|
private String initialCaption;
|
||||||
private Recipient conversationRecipient;
|
|
||||||
private boolean leftIsRecent;
|
private boolean leftIsRecent;
|
||||||
private MediaPreviewViewModel viewModel;
|
private MediaPreviewViewModel viewModel;
|
||||||
private ViewPagerListener viewPagerListener;
|
private ViewPagerListener viewPagerListener;
|
||||||
|
|
||||||
private int restartItem = -1;
|
private int restartItem = -1;
|
||||||
|
private long threadId = NOT_IN_A_THREAD;
|
||||||
|
private boolean cameFromAllMedia;
|
||||||
|
private boolean showThread;
|
||||||
|
private MediaDatabase.Sorting sorting;
|
||||||
|
|
||||||
|
public static @NonNull Intent intentFromMediaRecord(@NonNull Context context,
|
||||||
|
@NonNull MediaRecord mediaRecord,
|
||||||
|
boolean leftIsRecent)
|
||||||
|
{
|
||||||
|
Intent intent = new Intent(context, MediaPreviewActivity.class);
|
||||||
|
intent.putExtra(MediaPreviewActivity.THREAD_ID_EXTRA, mediaRecord.getThreadId());
|
||||||
|
intent.putExtra(MediaPreviewActivity.DATE_EXTRA, mediaRecord.getDate());
|
||||||
|
intent.putExtra(MediaPreviewActivity.SIZE_EXTRA, mediaRecord.getAttachment().getSize());
|
||||||
|
intent.putExtra(MediaPreviewActivity.CAPTION_EXTRA, mediaRecord.getAttachment().getCaption());
|
||||||
|
intent.putExtra(MediaPreviewActivity.LEFT_IS_RECENT_EXTRA, leftIsRecent);
|
||||||
|
intent.setDataAndType(mediaRecord.getAttachment().getDataUri(), mediaRecord.getContentType());
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
@Override
|
@Override
|
||||||
@@ -152,19 +173,45 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
MediaItem mediaItem = getCurrentMediaItem();
|
MediaItem mediaItem = getCurrentMediaItem();
|
||||||
|
|
||||||
if (mediaItem != null) {
|
if (mediaItem != null) {
|
||||||
CharSequence relativeTimeSpan;
|
getSupportActionBar().setTitle(getTitleText(mediaItem));
|
||||||
|
getSupportActionBar().setSubtitle(getSubTitleText(mediaItem));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mediaItem.date > 0) {
|
private @NonNull String getTitleText(@NonNull MediaItem mediaItem) {
|
||||||
relativeTimeSpan = DateUtils.getExtendedRelativeTimeSpanString(this, Locale.getDefault(), mediaItem.date);
|
String from;
|
||||||
} else {
|
if (mediaItem.outgoing) from = getString(R.string.MediaPreviewActivity_you);
|
||||||
relativeTimeSpan = getString(R.string.MediaPreviewActivity_draft);
|
else if (mediaItem.recipient != null) from = mediaItem.recipient.toShortString(this);
|
||||||
|
else from = "";
|
||||||
|
|
||||||
|
if (showThread) {
|
||||||
|
String to = null;
|
||||||
|
Recipient threadRecipient = mediaItem.threadRecipient;
|
||||||
|
|
||||||
|
if (threadRecipient != null) {
|
||||||
|
if (mediaItem.outgoing || threadRecipient.isGroup()) {
|
||||||
|
if (threadRecipient.isLocalNumber()) {
|
||||||
|
from = getString(R.string.note_to_self);
|
||||||
|
} else {
|
||||||
|
to = threadRecipient.toShortString(this);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
to = getString(R.string.MediaPreviewActivity_you);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mediaItem.outgoing) getSupportActionBar().setTitle(getString(R.string.MediaPreviewActivity_you));
|
return to != null ? getString(R.string.MediaPreviewActivity_s_to_s, from, to)
|
||||||
else if (mediaItem.recipient != null) getSupportActionBar().setTitle(mediaItem.recipient.toShortString());
|
: from;
|
||||||
else getSupportActionBar().setTitle("");
|
} else {
|
||||||
|
return from;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getSupportActionBar().setSubtitle(relativeTimeSpan);
|
private @NonNull String getSubTitleText(@NonNull MediaItem mediaItem) {
|
||||||
|
if (mediaItem.date > 0) {
|
||||||
|
return DateUtils.getExtendedRelativeTimeSpanString(this, Locale.getDefault(), mediaItem.date);
|
||||||
|
} else {
|
||||||
|
return getString(R.string.MediaPreviewActivity_draft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,20 +264,19 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
RecipientId recipientId = getIntent().getParcelableExtra(RECIPIENT_EXTRA);
|
Intent intent = getIntent();
|
||||||
|
|
||||||
initialMediaUri = getIntent().getData();
|
threadId = intent.getLongExtra(THREAD_ID_EXTRA, NOT_IN_A_THREAD);
|
||||||
initialMediaType = getIntent().getType();
|
cameFromAllMedia = intent.getBooleanExtra(HIDE_ALL_MEDIA_EXTRA, false);
|
||||||
initialMediaSize = getIntent().getLongExtra(SIZE_EXTRA, 0);
|
showThread = intent.getBooleanExtra(SHOW_THREAD_EXTRA, false);
|
||||||
initialCaption = getIntent().getStringExtra(CAPTION_EXTRA);
|
sorting = MediaDatabase.Sorting.values()[intent.getIntExtra(SORTING_EXTRA, 0)];
|
||||||
leftIsRecent = getIntent().getBooleanExtra(LEFT_IS_RECENT_EXTRA, false);
|
|
||||||
|
initialMediaUri = intent.getData();
|
||||||
|
initialMediaType = intent.getType();
|
||||||
|
initialMediaSize = intent.getLongExtra(SIZE_EXTRA, 0);
|
||||||
|
initialCaption = intent.getStringExtra(CAPTION_EXTRA);
|
||||||
|
leftIsRecent = intent.getBooleanExtra(LEFT_IS_RECENT_EXTRA, false);
|
||||||
restartItem = -1;
|
restartItem = -1;
|
||||||
|
|
||||||
if (recipientId != null) {
|
|
||||||
conversationRecipient = Recipient.live(recipientId).get();
|
|
||||||
} else {
|
|
||||||
conversationRecipient = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeObservers() {
|
private void initializeObservers() {
|
||||||
@@ -239,6 +285,11 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!((MediaItemAdapter) mediaPager.getAdapter()).hasFragmentFor(mediaPager.getCurrentItem())) {
|
||||||
|
Log.d(TAG, "MediaItemAdapter wasn't ready. Posting again...");
|
||||||
|
viewModel.resubmitPreviewData();
|
||||||
|
}
|
||||||
|
|
||||||
View playbackControls = ((MediaItemAdapter) mediaPager.getAdapter()).getPlaybackControls(mediaPager.getCurrentItem());
|
View playbackControls = ((MediaItemAdapter) mediaPager.getAdapter()).getPlaybackControls(mediaPager.getCurrentItem());
|
||||||
|
|
||||||
if (previewData.getAlbumThumbnails().isEmpty() && previewData.getCaption() == null && playbackControls == null) {
|
if (previewData.getAlbumThumbnails().isEmpty() && previewData.getCaption() == null && playbackControls == null) {
|
||||||
@@ -275,7 +326,7 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
|
|
||||||
Log.i(TAG, "Loading Part URI: " + initialMediaUri);
|
Log.i(TAG, "Loading Part URI: " + initialMediaUri);
|
||||||
|
|
||||||
if (conversationRecipient != null) {
|
if (isMediaInDb()) {
|
||||||
LoaderManager.getInstance(this).restartLoader(0, null, this);
|
LoaderManager.getInstance(this).restartLoader(0, null, this);
|
||||||
} else {
|
} else {
|
||||||
mediaPager.setAdapter(new SingleItemPagerAdapter(getSupportFragmentManager(), initialMediaUri, initialMediaType, initialMediaSize));
|
mediaPager.setAdapter(new SingleItemPagerAdapter(getSupportFragmentManager(), initialMediaUri, initialMediaType, initialMediaSize));
|
||||||
@@ -298,9 +349,7 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showOverview() {
|
private void showOverview() {
|
||||||
Intent intent = new Intent(this, MediaOverviewActivity.class);
|
startActivity(MediaOverviewActivity.forThread(this, threadId));
|
||||||
intent.putExtra(MediaOverviewActivity.RECIPIENT_EXTRA, conversationRecipient.getId());
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forward() {
|
private void forward() {
|
||||||
@@ -378,6 +427,10 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
menu.findItem(R.id.delete).setVisible(false);
|
menu.findItem(R.id.delete).setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cameFromAllMedia) {
|
||||||
|
menu.findItem(R.id.media_preview__overview).setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +450,7 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMediaInDb() {
|
private boolean isMediaInDb() {
|
||||||
return conversationRecipient != null;
|
return threadId != NOT_IN_A_THREAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable MediaItem getCurrentMediaItem() {
|
private @Nullable MediaItem getCurrentMediaItem() {
|
||||||
@@ -416,7 +469,7 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Loader<Pair<Cursor, Integer>> onCreateLoader(int id, Bundle args) {
|
public @NonNull Loader<Pair<Cursor, Integer>> onCreateLoader(int id, Bundle args) {
|
||||||
return new PagingMediaLoader(this, conversationRecipient, initialMediaUri, leftIsRecent);
|
return new PagingMediaLoader(this, threadId, initialMediaUri, leftIsRecent, sorting);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -427,16 +480,14 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
mediaPager.setAdapter(adapter);
|
mediaPager.setAdapter(adapter);
|
||||||
adapter.setActive(true);
|
adapter.setActive(true);
|
||||||
|
|
||||||
Util.postToMain(() -> {
|
viewModel.setCursor(this, data.first, leftIsRecent);
|
||||||
viewModel.setCursor(this, data.first, leftIsRecent);
|
|
||||||
|
|
||||||
int item = restartItem >= 0 ? restartItem : data.second;
|
int item = restartItem >= 0 ? restartItem : data.second;
|
||||||
mediaPager.setCurrentItem(item);
|
mediaPager.setCurrentItem(item);
|
||||||
|
|
||||||
if (item == 0) {
|
if (item == 0) {
|
||||||
viewPagerListener.onPageSelected(0);
|
viewPagerListener.onPageSelected(0);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,7 +599,7 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MediaItem getMediaItemFor(int position) {
|
public MediaItem getMediaItemFor(int position) {
|
||||||
return new MediaItem(null, null, uri, mediaType, -1, true);
|
return new MediaItem(null, null, null, uri, mediaType, -1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -565,6 +616,11 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasFragmentFor(int position) {
|
||||||
|
return mediaPreviewFragment != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void anchorMarginsToBottomInsets(@NonNull View viewToAnchor) {
|
private static void anchorMarginsToBottomInsets(@NonNull View viewToAnchor) {
|
||||||
@@ -677,12 +733,15 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
|
|
||||||
public MediaItem getMediaItemFor(int position) {
|
public MediaItem getMediaItemFor(int position) {
|
||||||
cursor.moveToPosition(getCursorPosition(position));
|
cursor.moveToPosition(getCursorPosition(position));
|
||||||
MediaRecord mediaRecord = MediaRecord.from(context, cursor);
|
|
||||||
RecipientId recipientId = mediaRecord.getRecipientId();
|
MediaRecord mediaRecord = MediaRecord.from(context, cursor);
|
||||||
|
RecipientId recipientId = mediaRecord.getRecipientId();
|
||||||
|
RecipientId threadRecipientId = mediaRecord.getThreadRecipientId();
|
||||||
|
|
||||||
if (mediaRecord.getAttachment().getDataUri() == null) throw new AssertionError();
|
if (mediaRecord.getAttachment().getDataUri() == null) throw new AssertionError();
|
||||||
|
|
||||||
return new MediaItem(Recipient.live(recipientId).get(),
|
return new MediaItem(Recipient.live(recipientId).get(),
|
||||||
|
Recipient.live(threadRecipientId).get(),
|
||||||
mediaRecord.getAttachment(),
|
mediaRecord.getAttachment(),
|
||||||
mediaRecord.getAttachment().getDataUri(),
|
mediaRecord.getAttachment().getDataUri(),
|
||||||
mediaRecord.getContentType(),
|
mediaRecord.getContentType(),
|
||||||
@@ -703,6 +762,11 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasFragmentFor(int position) {
|
||||||
|
return mediaFragments.containsKey(position);
|
||||||
|
}
|
||||||
|
|
||||||
private int getCursorPosition(int position) {
|
private int getCursorPosition(int position) {
|
||||||
if (leftIsRecent) return position;
|
if (leftIsRecent) return position;
|
||||||
else return cursor.getCount() - 1 - position;
|
else return cursor.getCount() - 1 - position;
|
||||||
@@ -711,6 +775,7 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
|
|
||||||
private static class MediaItem {
|
private static class MediaItem {
|
||||||
private final @Nullable Recipient recipient;
|
private final @Nullable Recipient recipient;
|
||||||
|
private final @Nullable Recipient threadRecipient;
|
||||||
private final @Nullable DatabaseAttachment attachment;
|
private final @Nullable DatabaseAttachment attachment;
|
||||||
private final @NonNull Uri uri;
|
private final @NonNull Uri uri;
|
||||||
private final @NonNull String type;
|
private final @NonNull String type;
|
||||||
@@ -718,18 +783,20 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
private final boolean outgoing;
|
private final boolean outgoing;
|
||||||
|
|
||||||
private MediaItem(@Nullable Recipient recipient,
|
private MediaItem(@Nullable Recipient recipient,
|
||||||
|
@Nullable Recipient threadRecipient,
|
||||||
@Nullable DatabaseAttachment attachment,
|
@Nullable DatabaseAttachment attachment,
|
||||||
@NonNull Uri uri,
|
@NonNull Uri uri,
|
||||||
@NonNull String type,
|
@NonNull String type,
|
||||||
long date,
|
long date,
|
||||||
boolean outgoing)
|
boolean outgoing)
|
||||||
{
|
{
|
||||||
this.recipient = recipient;
|
this.recipient = recipient;
|
||||||
this.attachment = attachment;
|
this.threadRecipient = threadRecipient;
|
||||||
this.uri = uri;
|
this.attachment = attachment;
|
||||||
this.type = type;
|
this.uri = uri;
|
||||||
this.date = date;
|
this.type = type;
|
||||||
this.outgoing = outgoing;
|
this.date = date;
|
||||||
|
this.outgoing = outgoing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,5 +804,6 @@ public final class MediaPreviewActivity extends PassphraseRequiredActionBarActiv
|
|||||||
MediaItem getMediaItemFor(int position);
|
MediaItem getMediaItemFor(int position);
|
||||||
void pause(int position);
|
void pause(int position);
|
||||||
@Nullable View getPlaybackControls(int position);
|
@Nullable View getPlaybackControls(int position);
|
||||||
|
boolean hasFragmentFor(int position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,11 @@ import androidx.loader.app.LoaderManager.LoaderCallbacks;
|
|||||||
import androidx.loader.content.Loader;
|
import androidx.loader.content.Loader;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.conversation.ConversationItem;
|
import org.thoughtcrime.securesms.conversation.ConversationItem;
|
||||||
|
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||||
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -51,7 +55,6 @@ import org.thoughtcrime.securesms.database.loaders.MessageDetailsLoader;
|
|||||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
|
||||||
import org.thoughtcrime.securesms.recipients.LiveRecipient;
|
import org.thoughtcrime.securesms.recipients.LiveRecipient;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.sms.MessageSender;
|
import org.thoughtcrime.securesms.sms.MessageSender;
|
||||||
@@ -61,6 +64,7 @@ import org.thoughtcrime.securesms.util.DynamicLanguage;
|
|||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
import org.thoughtcrime.securesms.util.ExpirationUtil;
|
import org.thoughtcrime.securesms.util.ExpirationUtil;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
import org.thoughtcrime.securesms.util.concurrent.SignalExecutors;
|
||||||
import org.whispersystems.libsignal.util.guava.Optional;
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
@@ -131,13 +135,13 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
assert getSupportActionBar() != null;
|
assert getSupportActionBar() != null;
|
||||||
getSupportActionBar().setTitle(R.string.AndroidManifest__message_details);
|
getSupportActionBar().setTitle(R.string.AndroidManifest__message_details);
|
||||||
|
|
||||||
MessageNotifier.setVisibleThread(threadId);
|
ApplicationDependencies.getMessageNotifier().setVisibleThread(threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
MessageNotifier.setVisibleThread(-1L);
|
ApplicationDependencies.getMessageNotifier().clearVisibleThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -268,7 +272,9 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
toFrom.setText(toFromRes);
|
toFrom.setText(toFromRes);
|
||||||
conversationItem.bind(messageRecord, Optional.absent(), Optional.absent(), glideRequests, dynamicLanguage.getCurrentLocale(), new HashSet<>(), recipient, null, false);
|
conversationItem.bind(messageRecord, Optional.absent(), Optional.absent(), glideRequests, dynamicLanguage.getCurrentLocale(), new HashSet<>(), recipient, null, false);
|
||||||
|
Parcelable state = recipientsList.onSaveInstanceState();
|
||||||
recipientsList.setAdapter(new MessageDetailsRecipientAdapter(this, glideRequests, messageRecord, recipients, isPushGroup));
|
recipientsList.setAdapter(new MessageDetailsRecipientAdapter(this, glideRequests, messageRecord, recipients, isPushGroup));
|
||||||
|
recipientsList.onRestoreInstanceState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void inflateMessageViewIfAbsent(MessageRecord messageRecord) {
|
private void inflateMessageViewIfAbsent(MessageRecord messageRecord) {
|
||||||
@@ -276,9 +282,9 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
if (messageRecord.isGroupAction()) {
|
if (messageRecord.isGroupAction()) {
|
||||||
conversationItem = (ConversationItem) inflater.inflate(R.layout.conversation_item_update, itemParent, false);
|
conversationItem = (ConversationItem) inflater.inflate(R.layout.conversation_item_update, itemParent, false);
|
||||||
} else if (messageRecord.isOutgoing()) {
|
} else if (messageRecord.isOutgoing()) {
|
||||||
conversationItem = (ConversationItem) inflater.inflate(R.layout.conversation_item_sent, itemParent, false);
|
conversationItem = (ConversationItem) inflater.inflate(R.layout.conversation_item_sent_multimedia, itemParent, false);
|
||||||
} else {
|
} else {
|
||||||
conversationItem = (ConversationItem) inflater.inflate(R.layout.conversation_item_received, itemParent, false);
|
conversationItem = (ConversationItem) inflater.inflate(R.layout.conversation_item_received_multimedia, itemParent, false);
|
||||||
}
|
}
|
||||||
itemParent.addView(conversationItem);
|
itemParent.addView(conversationItem);
|
||||||
}
|
}
|
||||||
@@ -368,7 +374,7 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
List<GroupReceiptInfo> receiptInfoList = DatabaseFactory.getGroupReceiptDatabase(context).getGroupReceiptInfo(messageRecord.getId());
|
List<GroupReceiptInfo> receiptInfoList = DatabaseFactory.getGroupReceiptDatabase(context).getGroupReceiptInfo(messageRecord.getId());
|
||||||
|
|
||||||
if (receiptInfoList.isEmpty()) {
|
if (receiptInfoList.isEmpty()) {
|
||||||
List<Recipient> group = DatabaseFactory.getGroupDatabase(context).getGroupMembers(messageRecord.getRecipient().requireAddress().toGroupString(), false);
|
List<Recipient> group = DatabaseFactory.getGroupDatabase(context).getGroupMembers(messageRecord.getRecipient().requireGroupId(), GroupDatabase.MemberSet.FULL_MEMBERS_EXCLUDING_SELF);
|
||||||
|
|
||||||
for (Recipient recipient : group) {
|
for (Recipient recipient : group) {
|
||||||
recipients.add(new RecipientDeliveryStatus(recipient, RecipientDeliveryStatus.Status.UNKNOWN, false, -1));
|
recipients.add(new RecipientDeliveryStatus(recipient, RecipientDeliveryStatus.Status.UNKNOWN, false, -1));
|
||||||
@@ -438,8 +444,8 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onResendClicked(View v) {
|
private void onResendClicked(View v) {
|
||||||
MessageSender.resend(MessageDetailsActivity.this, messageRecord);
|
|
||||||
resendButton.setVisibility(View.GONE);
|
resendButton.setVisibility(View.GONE);
|
||||||
|
SignalExecutors.BOUNDED.execute(() -> MessageSender.resend(MessageDetailsActivity.this, messageRecord));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,9 @@ import android.widget.BaseAdapter;
|
|||||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
import org.thoughtcrime.securesms.util.Conversions;
|
import org.thoughtcrime.securesms.util.Conversions;
|
||||||
|
import org.thoughtcrime.securesms.util.adapter.StableIdGenerator;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
@@ -19,11 +21,12 @@ import java.util.List;
|
|||||||
|
|
||||||
class MessageDetailsRecipientAdapter extends BaseAdapter implements AbsListView.RecyclerListener {
|
class MessageDetailsRecipientAdapter extends BaseAdapter implements AbsListView.RecyclerListener {
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final GlideRequests glideRequests;
|
private final GlideRequests glideRequests;
|
||||||
private final MessageRecord record;
|
private final MessageRecord record;
|
||||||
private final List<RecipientDeliveryStatus> members;
|
private final List<RecipientDeliveryStatus> members;
|
||||||
private final boolean isPushGroup;
|
private final boolean isPushGroup;
|
||||||
|
private final StableIdGenerator<RecipientId> idGenerator;
|
||||||
|
|
||||||
MessageDetailsRecipientAdapter(@NonNull Context context, @NonNull GlideRequests glideRequests,
|
MessageDetailsRecipientAdapter(@NonNull Context context, @NonNull GlideRequests glideRequests,
|
||||||
@NonNull MessageRecord record, @NonNull List<RecipientDeliveryStatus> members,
|
@NonNull MessageRecord record, @NonNull List<RecipientDeliveryStatus> members,
|
||||||
@@ -34,6 +37,7 @@ class MessageDetailsRecipientAdapter extends BaseAdapter implements AbsListView.
|
|||||||
this.record = record;
|
this.record = record;
|
||||||
this.isPushGroup = isPushGroup;
|
this.isPushGroup = isPushGroup;
|
||||||
this.members = members;
|
this.members = members;
|
||||||
|
this.idGenerator = new StableIdGenerator<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,11 +52,7 @@ class MessageDetailsRecipientAdapter extends BaseAdapter implements AbsListView.
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
try {
|
return idGenerator.getId(members.get(position).recipient.getId());
|
||||||
return Conversions.byteArrayToLong(MessageDigest.getInstance("SHA1").digest(members.get(position).recipient.requireAddress().serialize().getBytes()));
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
throw new AssertionError(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -81,23 +81,45 @@ public class MessageRecipientListItem extends RelativeLayout
|
|||||||
this.deliveryStatusView = findViewById(R.id.delivery_status);
|
this.deliveryStatusView = findViewById(R.id.delivery_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
observeMember();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDetachedFromWindow() {
|
||||||
|
unsubscribeFromMember();
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
}
|
||||||
|
|
||||||
public void set(final GlideRequests glideRequests,
|
public void set(final GlideRequests glideRequests,
|
||||||
final MessageRecord record,
|
final MessageRecord record,
|
||||||
final RecipientDeliveryStatus member,
|
final RecipientDeliveryStatus member,
|
||||||
final boolean isPushGroup)
|
final boolean isPushGroup)
|
||||||
{
|
{
|
||||||
if (this.member != null) this.member.getRecipient().live().removeForeverObserver(this);
|
unsubscribeFromMember();
|
||||||
|
|
||||||
this.glideRequests = glideRequests;
|
this.glideRequests = glideRequests;
|
||||||
this.member = member;
|
this.member = member;
|
||||||
|
observeMember();
|
||||||
|
|
||||||
member.getRecipient().live().observeForever(this);
|
|
||||||
fromView.setText(member.getRecipient());
|
fromView.setText(member.getRecipient());
|
||||||
contactPhotoImage.setAvatar(glideRequests, member.getRecipient(), false);
|
contactPhotoImage.setAvatar(glideRequests, member.getRecipient(), false);
|
||||||
setIssueIndicators(record, isPushGroup);
|
setIssueIndicators(record, isPushGroup);
|
||||||
unidentifiedDeliveryIcon.setVisibility(TextSecurePreferences.isShowUnidentifiedDeliveryIndicatorsEnabled(getContext()) && member.isUnidentified() ? VISIBLE : GONE);
|
unidentifiedDeliveryIcon.setVisibility(TextSecurePreferences.isShowUnidentifiedDeliveryIndicatorsEnabled(getContext()) && member.isUnidentified() ? VISIBLE : GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void observeMember() {
|
||||||
|
if (isAttachedToWindow() && member != null && member.getRecipient() != null) {
|
||||||
|
member.getRecipient().live().observeForever(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unsubscribeFromMember() {
|
||||||
|
if (member != null && member.getRecipient() != null) member.getRecipient().live().removeForeverObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
private void setIssueIndicators(final MessageRecord record,
|
private void setIssueIndicators(final MessageRecord record,
|
||||||
final boolean isPushGroup)
|
final boolean isPushGroup)
|
||||||
{
|
{
|
||||||
@@ -162,7 +184,7 @@ public class MessageRecipientListItem extends RelativeLayout
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unbind() {
|
public void unbind() {
|
||||||
if (this.member != null && this.member.getRecipient() != null) this.member.getRecipient().live().removeForeverObserver(this);
|
unsubscribeFromMember();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -23,6 +25,10 @@ public class MuteDialog extends AlertDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void show(final Context context, final @NonNull MuteSelectionListener listener) {
|
public static void show(final Context context, final @NonNull MuteSelectionListener listener) {
|
||||||
|
show(context, listener, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void show(final Context context, final @NonNull MuteSelectionListener listener, @Nullable Runnable cancelListener) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(R.string.MuteDialog_mute_notifications);
|
builder.setTitle(R.string.MuteDialog_mute_notifications);
|
||||||
builder.setItems(R.array.mute_durations, new DialogInterface.OnClickListener() {
|
builder.setItems(R.array.mute_durations, new DialogInterface.OnClickListener() {
|
||||||
@@ -43,6 +49,13 @@ public class MuteDialog extends AlertDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (cancelListener != null) {
|
||||||
|
builder.setOnCancelListener(dialog -> {
|
||||||
|
cancelListener.run();
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
builder.show();
|
builder.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,14 +19,16 @@ package org.thoughtcrime.securesms;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.conversation.ConversationActivity;
|
import org.thoughtcrime.securesms.conversation.ConversationActivity;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||||
|
import org.thoughtcrime.securesms.groups.ui.creategroup.CreateGroupActivity;
|
||||||
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity container for starting a new conversation.
|
* Activity container for starting a new conversation.
|
||||||
@@ -35,7 +37,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class NewConversationActivity extends ContactSelectionActivity
|
public class NewConversationActivity extends ContactSelectionActivity
|
||||||
implements ContactSelectionListFragment.InviteCallback
|
implements ContactSelectionListFragment.ListCallback
|
||||||
{
|
{
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@@ -49,9 +51,18 @@ public class NewConversationActivity extends ContactSelectionActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContactSelected(String number) {
|
public void onContactSelected(Optional<RecipientId> recipientId, String number) {
|
||||||
Recipient recipient = Recipient.external(this, number);
|
Recipient recipient;
|
||||||
|
if (recipientId.isPresent()) {
|
||||||
|
recipient = Recipient.resolved(recipientId.get());
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "[onContactSelected] Maybe creating a new recipient.");
|
||||||
|
recipient = Recipient.external(this, number);
|
||||||
|
}
|
||||||
|
launch(recipient);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void launch(Recipient recipient) {
|
||||||
Intent intent = new Intent(this, ConversationActivity.class);
|
Intent intent = new Intent(this, ConversationActivity.class);
|
||||||
intent.putExtra(ConversationActivity.RECIPIENT_EXTRA, recipient.getId());
|
intent.putExtra(ConversationActivity.RECIPIENT_EXTRA, recipient.getId());
|
||||||
intent.putExtra(ConversationActivity.TEXT_EXTRA, getIntent().getStringExtra(ConversationActivity.TEXT_EXTRA));
|
intent.putExtra(ConversationActivity.TEXT_EXTRA, getIntent().getStringExtra(ConversationActivity.TEXT_EXTRA));
|
||||||
@@ -85,7 +96,7 @@ public class NewConversationActivity extends ContactSelectionActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleCreateGroup() {
|
private void handleCreateGroup() {
|
||||||
startActivity(new Intent(this, GroupCreateActivity.class));
|
startActivity(CreateGroupActivity.newIntent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleInvite() {
|
private void handleInvite() {
|
||||||
@@ -93,10 +104,10 @@ public class NewConversationActivity extends ContactSelectionActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onPrepareOptionsPanel(View view, Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
MenuInflater inflater = this.getMenuInflater();
|
|
||||||
menu.clear();
|
menu.clear();
|
||||||
inflater.inflate(R.menu.new_conversation_activity, menu);
|
getMenuInflater().inflate(R.menu.new_conversation_activity, menu);
|
||||||
|
|
||||||
super.onPrepareOptionsMenu(menu);
|
super.onPrepareOptionsMenu(menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -104,5 +115,12 @@ public class NewConversationActivity extends ContactSelectionActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onInvite() {
|
public void onInvite() {
|
||||||
handleInvite();
|
handleInvite();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNewGroup(boolean forceV1) {
|
||||||
|
handleCreateGroup();
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,6 +41,8 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
|||||||
|
|
||||||
public class PassphraseChangeActivity extends PassphraseActivity {
|
public class PassphraseChangeActivity extends PassphraseActivity {
|
||||||
|
|
||||||
|
private static final String TAG = Log.tag(PassphraseChangeActivity.class);
|
||||||
|
|
||||||
private DynamicTheme dynamicTheme = new DynamicTheme();
|
private DynamicTheme dynamicTheme = new DynamicTheme();
|
||||||
private DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
private DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||||
|
|
||||||
@@ -145,7 +147,7 @@ public class PassphraseChangeActivity extends PassphraseActivity {
|
|||||||
return masterSecret;
|
return masterSecret;
|
||||||
|
|
||||||
} catch (InvalidPassphraseException e) {
|
} catch (InvalidPassphraseException e) {
|
||||||
Log.w(PassphraseChangeActivity.class.getSimpleName(), e);
|
Log.w(TAG, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,6 +55,7 @@ import org.thoughtcrime.securesms.components.AnimatingToggle;
|
|||||||
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
|
import org.thoughtcrime.securesms.crypto.InvalidPassphraseException;
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||||
|
import org.thoughtcrime.securesms.logsubmit.SubmitDebugLogActivity;
|
||||||
import org.thoughtcrime.securesms.util.DynamicIntroTheme;
|
import org.thoughtcrime.securesms.util.DynamicIntroTheme;
|
||||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
@@ -164,7 +165,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleLogSubmit() {
|
private void handleLogSubmit() {
|
||||||
Intent intent = new Intent(this, LogSubmitActivity.class);
|
Intent intent = new Intent(this, SubmitDebugLogActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
EditorInfo.IME_ACTION_DONE);
|
EditorInfo.IME_ACTION_DONE);
|
||||||
|
|
||||||
fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
|
fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
|
||||||
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN);
|
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.core_ultramarine), PorterDuff.Mode.SRC_IN);
|
||||||
|
|
||||||
lockScreenButton.setOnClickListener(v -> resumeScreenLock());
|
lockScreenButton.setOnClickListener(v -> resumeScreenLock());
|
||||||
}
|
}
|
||||||
@@ -277,7 +278,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
fingerprintManager.authenticate(null, 0, fingerprintCancellationSignal, fingerprintListener, null);
|
fingerprintManager.authenticate(null, 0, fingerprintCancellationSignal, fingerprintListener, null);
|
||||||
} else if (Build.VERSION.SDK_INT >= 21){
|
} else if (Build.VERSION.SDK_INT >= 21){
|
||||||
Log.i(TAG, "firing intent...");
|
Log.i(TAG, "firing intent...");
|
||||||
Intent intent = keyguardManager.createConfirmDeviceCredentialIntent("Unlock Signal", "");
|
Intent intent = keyguardManager.createConfirmDeviceCredentialIntent(getString(R.string.PassphrasePromptActivity_unlock_signal), "");
|
||||||
startActivityForResult(intent, 1);
|
startActivityForResult(intent, 1);
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Not compatible...");
|
Log.w(TAG, "Not compatible...");
|
||||||
@@ -357,7 +358,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
handleAuthenticated();
|
handleAuthenticated();
|
||||||
|
|
||||||
fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
|
fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
|
||||||
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN);
|
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.core_ultramarine), PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
@@ -380,7 +381,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animation animation) {
|
public void onAnimationEnd(Animation animation) {
|
||||||
fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
|
fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
|
||||||
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN);
|
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.core_ultramarine), PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.IdRes;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||||
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
|
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
|
||||||
|
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||||
|
import org.thoughtcrime.securesms.lock.v2.CreateKbsPinActivity;
|
||||||
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.migrations.ApplicationMigrationActivity;
|
||||||
|
import org.thoughtcrime.securesms.migrations.ApplicationMigrations;
|
||||||
|
import org.thoughtcrime.securesms.pin.PinRestoreActivity;
|
||||||
|
import org.thoughtcrime.securesms.profiles.edit.EditProfileActivity;
|
||||||
|
import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess;
|
||||||
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
|
import org.thoughtcrime.securesms.registration.RegistrationNavigationActivity;
|
||||||
|
import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarActivity implements MasterSecretListener {
|
||||||
|
private static final String TAG = PassphraseRequiredActionBarActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
public static final String LOCALE_EXTRA = "locale_extra";
|
||||||
|
public static final String NEXT_INTENT_EXTRA = "next_intent";
|
||||||
|
|
||||||
|
private static final int STATE_NORMAL = 0;
|
||||||
|
private static final int STATE_CREATE_PASSPHRASE = 1;
|
||||||
|
private static final int STATE_PROMPT_PASSPHRASE = 2;
|
||||||
|
private static final int STATE_UI_BLOCKING_UPGRADE = 3;
|
||||||
|
private static final int STATE_WELCOME_PUSH_SCREEN = 4;
|
||||||
|
private static final int STATE_ENTER_SIGNAL_PIN = 5;
|
||||||
|
private static final int STATE_CREATE_PROFILE_NAME = 6;
|
||||||
|
private static final int STATE_CREATE_SIGNAL_PIN = 7;
|
||||||
|
|
||||||
|
private SignalServiceNetworkAccess networkAccess;
|
||||||
|
private BroadcastReceiver clearKeyReceiver;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void onCreate(Bundle savedInstanceState) {
|
||||||
|
Log.d(TAG, "[" + Log.tag(getClass()) + "] onCreate()");
|
||||||
|
this.networkAccess = new SignalServiceNetworkAccess(this);
|
||||||
|
onPreCreate();
|
||||||
|
|
||||||
|
final boolean locked = KeyCachingService.isLocked(this);
|
||||||
|
routeApplicationState(locked);
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
if (!isFinishing()) {
|
||||||
|
initializeClearKeyReceiver();
|
||||||
|
onCreate(savedInstanceState, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onPreCreate() {}
|
||||||
|
protected void onCreate(Bundle savedInstanceState, boolean ready) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
Log.d(TAG, "[" + Log.tag(getClass()) + "] onResume()");
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
if (networkAccess.isCensored(this)) {
|
||||||
|
ApplicationDependencies.getJobManager().add(new PushNotificationReceiveJob(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
Log.d(TAG, "[" + Log.tag(getClass()) + "] onStart()");
|
||||||
|
super.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
Log.d(TAG, "[" + Log.tag(getClass()) + "] onPause()");
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
Log.d(TAG, "[" + Log.tag(getClass()) + "] onStop()");
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
Log.d(TAG, "[" + Log.tag(getClass()) + "] onDestroy()");
|
||||||
|
super.onDestroy();
|
||||||
|
removeClearKeyReceiver(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMasterSecretCleared() {
|
||||||
|
Log.d(TAG, "onMasterSecretCleared()");
|
||||||
|
if (ApplicationContext.getInstance(this).isAppVisible()) routeApplicationState(true);
|
||||||
|
else finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends Fragment> T initFragment(@IdRes int target,
|
||||||
|
@NonNull T fragment)
|
||||||
|
{
|
||||||
|
return initFragment(target, fragment, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends Fragment> T initFragment(@IdRes int target,
|
||||||
|
@NonNull T fragment,
|
||||||
|
@Nullable Locale locale)
|
||||||
|
{
|
||||||
|
return initFragment(target, fragment, locale, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T extends Fragment> T initFragment(@IdRes int target,
|
||||||
|
@NonNull T fragment,
|
||||||
|
@Nullable Locale locale,
|
||||||
|
@Nullable Bundle extras)
|
||||||
|
{
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putSerializable(LOCALE_EXTRA, locale);
|
||||||
|
|
||||||
|
if (extras != null) {
|
||||||
|
args.putAll(extras);
|
||||||
|
}
|
||||||
|
|
||||||
|
fragment.setArguments(args);
|
||||||
|
getSupportFragmentManager().beginTransaction()
|
||||||
|
.replace(target, fragment)
|
||||||
|
.commitAllowingStateLoss();
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void routeApplicationState(boolean locked) {
|
||||||
|
Intent intent = getIntentForState(getApplicationState(locked));
|
||||||
|
if (intent != null) {
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getIntentForState(int state) {
|
||||||
|
Log.d(TAG, "routeApplicationState(), state: " + state);
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case STATE_CREATE_PASSPHRASE: return getCreatePassphraseIntent();
|
||||||
|
case STATE_PROMPT_PASSPHRASE: return getPromptPassphraseIntent();
|
||||||
|
case STATE_UI_BLOCKING_UPGRADE: return getUiBlockingUpgradeIntent();
|
||||||
|
case STATE_WELCOME_PUSH_SCREEN: return getPushRegistrationIntent();
|
||||||
|
case STATE_ENTER_SIGNAL_PIN: return getEnterSignalPinIntent();
|
||||||
|
case STATE_CREATE_SIGNAL_PIN: return getCreateSignalPinIntent();
|
||||||
|
case STATE_CREATE_PROFILE_NAME: return getCreateProfileNameIntent();
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getApplicationState(boolean locked) {
|
||||||
|
if (!MasterSecretUtil.isPassphraseInitialized(this)) {
|
||||||
|
return STATE_CREATE_PASSPHRASE;
|
||||||
|
} else if (locked) {
|
||||||
|
return STATE_PROMPT_PASSPHRASE;
|
||||||
|
} else if (ApplicationMigrations.isUpdate(this) && ApplicationMigrations.isUiBlockingMigrationRunning()) {
|
||||||
|
return STATE_UI_BLOCKING_UPGRADE;
|
||||||
|
} else if (!TextSecurePreferences.hasPromptedPushRegistration(this)) {
|
||||||
|
return STATE_WELCOME_PUSH_SCREEN;
|
||||||
|
} else if (SignalStore.storageServiceValues().needsAccountRestore()) {
|
||||||
|
return STATE_ENTER_SIGNAL_PIN;
|
||||||
|
} else if (userMustSetProfileName()) {
|
||||||
|
return STATE_CREATE_PROFILE_NAME;
|
||||||
|
} else if (userMustCreateSignalPin()) {
|
||||||
|
return STATE_CREATE_SIGNAL_PIN;
|
||||||
|
} else {
|
||||||
|
return STATE_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean userMustCreateSignalPin() {
|
||||||
|
return !SignalStore.registrationValues().isRegistrationComplete() && !SignalStore.kbsValues().hasPin() && !SignalStore.kbsValues().lastPinCreateFailed();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean userMustSetProfileName() {
|
||||||
|
return !SignalStore.registrationValues().isRegistrationComplete() && Recipient.self().getProfileName().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getCreatePassphraseIntent() {
|
||||||
|
return getRoutedIntent(PassphraseCreateActivity.class, getIntent());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getPromptPassphraseIntent() {
|
||||||
|
return getRoutedIntent(PassphrasePromptActivity.class, getIntent());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getUiBlockingUpgradeIntent() {
|
||||||
|
return getRoutedIntent(ApplicationMigrationActivity.class,
|
||||||
|
TextSecurePreferences.hasPromptedPushRegistration(this)
|
||||||
|
? getConversationListIntent()
|
||||||
|
: getPushRegistrationIntent());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getPushRegistrationIntent() {
|
||||||
|
return RegistrationNavigationActivity.newIntentForNewRegistration(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getEnterSignalPinIntent() {
|
||||||
|
return getRoutedIntent(PinRestoreActivity.class, getIntent());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getCreateSignalPinIntent() {
|
||||||
|
|
||||||
|
final Intent intent;
|
||||||
|
if (userMustSetProfileName()) {
|
||||||
|
intent = getCreateProfileNameIntent();
|
||||||
|
} else {
|
||||||
|
intent = getIntent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return getRoutedIntent(CreateKbsPinActivity.class, intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getCreateProfileNameIntent() {
|
||||||
|
return getRoutedIntent(EditProfileActivity.class, getIntent());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getRoutedIntent(Class<?> destination, @Nullable Intent nextIntent) {
|
||||||
|
final Intent intent = new Intent(this, destination);
|
||||||
|
if (nextIntent != null) intent.putExtra("next_intent", nextIntent);
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getConversationListIntent() {
|
||||||
|
// TODO [greyson] Navigation
|
||||||
|
return new Intent(this, MainActivity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeClearKeyReceiver() {
|
||||||
|
this.clearKeyReceiver = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
Log.i(TAG, "onReceive() for clear key event");
|
||||||
|
onMasterSecretCleared();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IntentFilter filter = new IntentFilter(KeyCachingService.CLEAR_KEY_EVENT);
|
||||||
|
registerReceiver(clearKeyReceiver, filter, KeyCachingService.KEY_PERMISSION, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeClearKeyReceiver(Context context) {
|
||||||
|
if (clearKeyReceiver != null) {
|
||||||
|
context.unregisterReceiver(clearKeyReceiver);
|
||||||
|
clearKeyReceiver = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts an extra in {@code intent} so that {@code nextIntent} will be shown after it.
|
||||||
|
*/
|
||||||
|
public static @NonNull Intent chainIntent(@NonNull Intent intent, @NonNull Intent nextIntent) {
|
||||||
|
intent.putExtra(NEXT_INTENT_EXTRA, nextIntent);
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Whisper Systems
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.contacts.SelectedContact;
|
||||||
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity container for selecting a list of contacts.
|
||||||
|
*
|
||||||
|
* @author Moxie Marlinspike
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PushContactSelectionActivity extends ContactSelectionActivity {
|
||||||
|
|
||||||
|
public static final String KEY_SELECTED_RECIPIENTS = "recipients";
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private final static String TAG = PushContactSelectionActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle, boolean ready) {
|
||||||
|
getIntent().putExtra(ContactSelectionListFragment.MULTI_SELECT, true);
|
||||||
|
super.onCreate(icicle, ready);
|
||||||
|
|
||||||
|
initializeToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initializeToolbar() {
|
||||||
|
getToolbar().setNavigationIcon(R.drawable.ic_check_24);
|
||||||
|
getToolbar().setNavigationOnClickListener(v -> {
|
||||||
|
onFinishedSelection();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void onFinishedSelection() {
|
||||||
|
Intent resultIntent = getIntent();
|
||||||
|
List<SelectedContact> selectedContacts = contactsFragment.getSelectedContacts();
|
||||||
|
List<RecipientId> recipients = Stream.of(selectedContacts).map(sc -> sc.getOrCreateRecipientId(this)).toList();
|
||||||
|
|
||||||
|
resultIntent.putParcelableArrayListExtra(KEY_SELECTED_RECIPIENTS, new ArrayList<>(recipients));
|
||||||
|
|
||||||
|
setResult(RESULT_OK, resultIntent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||