π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] Add gallery cleanup in free up space (#14176)
Rakhul423b2d80d9ec
diff --git a/mobile/apps/photos/assets/photo_review/all_cleaned_up.svg b/mobile/apps/photos/assets/photo_review/all_cleaned_up.svgnew file mode 100644index 0000000000..fd6540941b--- /dev/null+++ b/mobile/apps/photos/assets/photo_review/all_cleaned_up.svg@@ -0,0 +1,77 @@+<svg width="335" height="133.41" viewBox="0 0 335 133.41" fill="none" xmlns="http://www.w3.org/2000/svg">+<g id="Frame 1597881573">+<g id="Group 1597882049">+<path id="Vector" d="M166.934 133.41C208.674 133.41 242.511 131.56 242.511 129.278C242.511 126.996 208.674 125.146 166.934 125.146C125.194 125.146 91.3568 126.996 91.3568 129.278C91.3568 131.56 125.194 133.41 166.934 133.41Z" fill="#232323"/>+<g id="Group">+<path id="Vector_2" d="M196.764 70.5732C237.652 54.812 232.183 16.389 188.504 43.9327Z" fill="#F4D93B"/>+<path id="Vector_3" d="M196.389 69.5978C205.778 65.7681 215.13 60.1094 220.613 51.3708C222.614 48.0063 224.185 43.8063 222.726 39.9857C221.155 36.147 216.594 35.2438 212.814 35.4967C204.084 36.0386 196.628 40.9115 188.756 44.3302C188.287 44.5424 187.849 43.8876 188.255 43.5353C190.929 41.1689 194.004 39.3354 197.21 37.7863C203.682 34.7831 211.012 31.9289 218.278 33.5457C222.297 34.4851 225.454 37.7367 225.752 41.9366C226.24 49.5237 220.947 56.1082 215.65 60.8907C210.248 65.6055 203.827 69.0513 197.147 71.5487C195.865 71.9913 195.133 70.1442 196.398 69.6023L196.389 69.5978Z" fill="#232323"/>+</g>+<g id="Group_2">+<path id="Vector_4" d="M121.97 98.8304C105.717 104.042 108.86 113.675 130.167 117.401C151.474 121.126 121.97 98.8304 121.97 98.8304Z" fill="#F2C33D"/>+<path id="Vector_5" d="M134.187 118.954C132.782 118.954 131.283 118.742 129.973 118.516C117.965 116.416 110.883 112.374 110.545 107.429C110.278 103.568 114.212 100.136 121.623 97.76C121.971 97.6471 122.354 97.7149 122.648 97.9362C122.693 97.9678 127.16 101.35 131.332 105.221C139.353 112.659 139.43 115.477 138.793 116.949C138.12 118.498 136.264 118.959 134.187 118.959V118.954ZM121.758 100.09C115.96 102.046 112.622 104.71 112.798 107.271C113.105 111.715 122.449 114.908 130.361 116.29C134.95 117.093 136.517 116.511 136.72 116.041C137.443 114.379 131.612 107.61 121.758 100.09Z" fill="#232323"/>+</g>+<g id="Group_3">+<path id="Vector_6" d="M134.405 113.161C123.571 122.929 124.172 130.453 137.715 131.654C151.259 132.86 160.982 130.087 157.853 121.615C154.723 113.143 134.405 113.156 134.405 113.156V113.161Z" fill="#FF814A"/>+<path id="Vector_7" d="M143.311 133.045C141.224 133.045 139.251 132.927 137.616 132.783C131.067 132.2 127.174 130.191 126.045 126.808C124.763 122.974 127.391 117.966 133.651 112.325C133.858 112.135 134.116 112.036 134.414 112.036C135.389 112.036 155.558 112.153 158.914 121.231C159.984 124.121 159.763 126.587 158.254 128.556C155.49 132.169 148.987 133.049 143.311 133.049V133.045ZM134.838 114.294C127.793 120.752 127.64 124.451 128.186 126.09C128.994 128.506 132.323 130.046 137.814 130.534C147.384 131.383 154.181 130.164 156.457 127.183C157.473 125.851 157.586 124.157 156.791 122.012C154.51 115.834 140.574 114.366 134.838 114.294Z" fill="#232323"/>+</g>+<g id="Group_4">+<path id="Vector_8" d="M186.619 113.161C197.453 122.929 196.852 130.453 183.308 131.654C169.764 132.86 160.041 130.087 163.171 121.615C166.301 113.143 186.619 113.156 186.619 113.156V113.161Z" fill="#FF814A"/>+<path id="Vector_9" d="M177.717 133.045C172.041 133.045 165.538 132.164 162.774 128.556C161.27 126.587 161.048 124.121 162.114 121.231C165.47 112.153 185.634 112.036 186.614 112.036H186.623C186.903 112.036 187.17 112.14 187.377 112.325C193.632 117.966 196.261 122.974 194.983 126.808C193.853 130.191 189.961 132.2 183.412 132.783C181.777 132.927 179.804 133.045 177.717 133.045ZM186.19 114.294C180.454 114.362 166.518 115.834 164.237 122.012C163.442 124.162 163.555 125.851 164.571 127.183C166.847 130.164 173.644 131.383 183.214 130.534C188.705 130.046 192.033 128.511 192.842 126.09C193.388 124.451 193.235 120.752 186.19 114.294Z" fill="#232323"/>+</g>+<g id="Group_5">+<path id="Vector_10" d="M210.601 95.3621C210.583 95.5698 210.56 95.773 210.533 95.9808C207.873 114.312 187.46 120.499 170.575 123.791V123.809L169.902 123.917V123.899C167.436 124.238 164.875 124.541 162.283 124.762C146.951 126.081 130.318 124.563 123.11 110.459C118.888 101.721 118.368 90.3763 119.326 80.486C120.211 73.3461 122.004 66.3913 121.272 59.1474V59.0887C121.047 56.0855 120.627 53.0281 120.419 49.9978C119.832 42.763 120.789 34.9682 123.801 28.7089C128.435 18.1232 139.576 11.2722 150.866 8.96902V8.94644C150.975 8.93289 151.088 8.91934 151.201 8.90128L151.539 8.83354V8.85612C156.376 8.23741 161.448 8.39999 166.284 9.43869C172.878 10.8568 179.024 13.9006 183.527 18.8186C188.395 23.7728 191.814 30.8405 193.589 37.8811C194.054 39.6198 194.447 41.3946 194.849 43.1559C195.124 44.3662 195.404 45.572 195.716 46.7598L195.729 46.814C197.373 53.9088 201.311 59.9152 204.454 66.3868C208.46 75.2519 211.576 85.8873 210.601 95.3621Z" fill="#F4D93B"/>+<path id="Vector_11" d="M194.848 43.1558C191.935 32.4842 182.849 16.0366 163.714 11.7508L166.284 9.43857C172.877 10.8566 179.023 13.9005 183.526 18.8185C188.394 23.7727 191.813 30.8404 193.588 37.881C194.053 39.6197 194.446 41.3945 194.848 43.1558Z" fill="white"/>+<path id="Vector_12" d="M210.6 95.3619C210.582 95.5696 210.56 95.7728 210.533 95.9806C207.873 114.311 187.46 120.499 170.574 123.791V123.809L169.901 123.917V123.899C167.435 124.238 164.875 124.54 162.283 124.762L155.91 124.021C137.742 122.942 137.747 88.0413 147.09 75.0665C158.439 59.3053 183.495 55.0511 199.825 65.8491C208.541 71.6117 209.661 83.8277 210.6 95.3619Z" fill="#FFE76E"/>+<path id="Vector_13" d="M153.932 126.284C140.831 126.284 128.276 123.05 122.103 110.97C117.379 101.193 117.374 88.9403 118.201 80.3733C118.445 78.4223 118.752 76.4939 119.045 74.6288C119.881 69.3811 120.671 64.4269 120.147 59.256L120.138 59.1566C120.034 57.7431 119.881 56.2708 119.732 54.8482C119.569 53.2857 119.398 51.6689 119.289 50.0702C118.634 42.0225 119.872 34.2548 122.78 28.2168C127.102 18.3446 137.688 10.5633 150.423 7.90336C150.509 7.86723 150.604 7.84013 150.699 7.82658L151.326 7.72271C151.426 7.70465 151.525 7.70013 151.624 7.70916C164.536 6.1195 177.059 10.0756 184.357 18.0556C189.027 22.8065 192.703 29.7613 194.681 37.6013C195.092 39.1367 195.453 40.7219 195.801 42.2574C196.117 43.6528 196.447 45.0935 196.808 46.4709L196.822 46.5115C198.005 51.6147 200.349 56.0541 202.833 60.7508C203.713 62.4218 204.625 64.1469 205.47 65.8856C209.024 73.7527 212.971 85.3545 211.653 96.1074C208.907 115.034 188.517 121.42 170.981 124.852C170.908 124.879 170.836 124.902 170.764 124.911L170.086 125.024C170.005 125.038 169.928 125.042 169.847 125.038C164.717 125.733 159.279 126.275 153.932 126.275V126.284ZM151.232 10.0395C151.186 10.0575 151.137 10.0666 151.087 10.0801C138.966 12.5504 128.904 19.862 124.83 29.1652C122.08 34.8871 120.915 42.2393 121.538 49.9076C121.647 51.4792 121.814 53.0734 121.976 54.6179C122.125 56.0586 122.283 57.5489 122.392 59.0121V59.0798C122.943 64.4992 122.094 69.8327 121.272 74.9901C120.978 76.8372 120.676 78.743 120.441 80.6262C119.646 88.8726 119.637 100.687 124.121 109.967C132.187 125.751 152.74 125.11 169.743 122.784C169.802 122.775 169.856 122.775 169.915 122.775L170.19 122.73C170.244 122.712 170.299 122.694 170.353 122.685C187.198 119.406 206.861 113.386 209.408 95.8229C210.659 85.6119 206.838 74.4346 203.415 66.8566C202.598 65.1766 201.699 63.4695 200.823 61.8166C198.384 57.1966 195.86 52.4231 194.622 47.076V47.0625C194.247 45.6354 193.913 44.1767 193.593 42.7632C193.249 41.2457 192.893 39.6787 192.491 38.1703C190.603 30.6961 187.135 24.1071 182.713 19.6091C175.831 12.0853 163.949 8.40916 151.679 9.97625C151.629 9.98076 151.575 9.98528 151.53 9.98528L151.417 10.0079C151.417 10.0079 151.372 10.0169 151.354 10.0169L151.236 10.0304L151.232 10.0395Z" fill="#232323"/>+</g>+<path id="Vector_14" d="M145.464 40.3921C145.053 36.0611 149.127 32.8095 153.187 34.6295C154.379 35.1579 155.381 36.1334 155.86 37.3166C156 37.6644 155.833 38.0618 155.481 38.2018C155.183 38.3237 154.849 38.2153 154.668 37.9624C154.094 37.2037 153.331 36.6663 152.482 36.3773C149.402 35.3702 147.252 37.5469 146.81 40.4914C146.643 41.2547 145.514 41.1598 145.464 40.3876V40.3921Z" fill="#232323"/>+<path id="Vector_15" d="M168.641 35.0177C168.171 30.6371 172.277 27.3358 176.391 29.1874C177.592 29.7293 178.595 30.7409 179.033 31.9422C179.164 32.299 178.978 32.6919 178.622 32.8183C178.333 32.9222 178.021 32.8183 177.84 32.588C177.226 31.8519 176.463 31.3461 175.623 31.0706C172.575 30.1042 170.475 32.2132 169.978 35.117C169.797 35.8667 168.691 35.7719 168.632 35.0132L168.641 35.0177Z" fill="#232323"/>+<g id="Group_6">+<path id="Vector_16" d="M143.64 13.964C145.966 1.58983 153.12 -1.06564 154.127 6.60722C154.127 6.60722 156.949 0.650483 164.125 2.45241C171.297 4.25433 164.961 16.0368 152.392 14.7904" fill="#F4D93B"/>+<path id="Vector_17" d="M155.387 5.5278C164.125 2.45234 166.225 7.21231 165.367 9.44327C164.509 11.6742 167.399 6.69296 167.399 6.69296L166.157 3.26072L161.393 2.11815L158.733 2.2446L155.391 5.53232L155.387 5.5278Z" fill="white"/>+<path id="Vector_18" d="M143.098 13.8646C143.004 9.75496 145.027 4.17757 148.626 1.82016C152.343 -0.397243 154.98 2.90403 155.147 6.47627L153.196 6.16917C153.404 5.73111 153.598 5.42401 153.851 5.04015C155.608 2.40726 158.783 0.754363 161.958 0.930491C163.47 1.02081 165.033 1.23307 166.329 2.09113C169.924 4.49821 168.118 9.30335 165.589 11.6788C162.174 14.9485 156.927 16.7865 152.347 15.224C151.914 15.0749 151.977 14.4201 152.424 14.3524C153.91 14.1085 155.31 13.9278 156.678 13.6298C159.361 13.1149 161.976 11.9498 163.877 9.98979C165.986 7.87174 167.309 4.13241 163.33 3.53628C160.034 2.74145 156.778 4.12338 155.062 7.0453C154.623 7.96206 153.237 7.73626 153.111 6.7382C151.747 -0.34305 147.298 5.92982 146.038 9.43883C145.415 10.9427 144.878 12.4962 144.182 14.0678C143.961 14.6098 143.103 14.4472 143.103 13.8601L143.098 13.8646Z" fill="#232323"/>+</g>+<path id="Vector_19" d="M163.009 125.651C177.452 127.417 193.656 121.411 193.656 121.411L191.587 117.82L174.724 123.782L163.009 125.651Z" fill="#232323"/>+<g id="Group_7">+<path id="Vector_20" d="M156.231 42.7718C161.673 37.7183 164.721 36.8422 171.897 39.6783C173.568 40.3331 173.401 41.9047 172.227 42.686C169.418 44.5557 160.752 46.4344 157.076 45.9647C155.368 45.7344 154.75 44.1537 156.236 42.7718H156.231Z" fill="#FF814A"/>+<path id="Vector_21" d="M155.581 42.0763C157.284 40.5498 159.194 39.0053 161.357 38.0524C164.234 36.7382 167.625 37.2169 170.471 38.1789C171.003 38.3369 171.514 38.5356 172.033 38.7163C172.412 38.8472 172.805 39.0143 173.153 39.2943C174.345 40.1253 174.404 41.9904 173.406 43.0021C172.02 44.3388 170.069 44.8808 168.303 45.4814C164.857 46.4975 161.438 47.2065 157.789 47.0801C157.32 47.0259 156.683 47.0033 156.227 46.8136C154.005 46.0504 153.892 43.4672 155.581 42.0717V42.0763ZM156.882 43.4717C156.145 44.1898 156.218 44.8762 157.32 44.9395L157.884 44.9711C161.118 44.9349 164.532 44.2304 167.684 43.3814C168.407 43.1375 173.149 41.8866 171.938 40.8027C171.785 40.6672 171.577 40.5769 171.351 40.4911C170.868 40.3014 170.376 40.0892 169.888 39.9266C164.098 37.7318 161.068 39.3666 156.886 43.4717H156.882Z" fill="#232323"/>+</g>+<g id="Group_8">+<path id="Vector_22" d="M123.26 59.3054C106.284 63.2164 95.9148 69.0467 96.7774 82.6582C97.64 96.2697 120.094 109.443 128.851 102.1C137.607 94.7568 118.811 77.0447 118.811 77.0447L121.95 76.3131" fill="#F4D93B"/>+<path id="Vector_23" d="M123.512 60.4073C115.311 62.426 104.901 65.0679 100.096 72.5692C98.0957 75.8118 97.5402 79.8401 98.0189 83.593C99.2744 90.7646 105.258 96.3013 111.355 99.7923C115.194 101.883 119.583 103.486 123.991 102.954C128.688 102.281 131.05 98.9794 129.636 94.3458C128.345 90.1007 125.536 86.3072 122.704 82.8795C121.232 81.1362 119.66 79.4292 118.039 77.8621C117.574 77.5866 117.42 76.9859 117.7 76.5208C117.867 76.2001 118.26 76.0827 118.558 75.9427C119.059 75.7169 119.592 75.6492 120.134 75.613C120.839 75.6311 122.474 75.3601 122.361 76.4982C122.329 76.6743 122.23 76.8234 122.094 76.9272C121.173 77.564 120.175 78.0563 119.069 78.1421L119.588 76.2227C123.007 79.5691 126.082 83.1278 128.683 87.1517C130.58 90.2271 132.45 93.7497 132.278 97.5568C131.98 103.45 125.707 105.934 120.554 105.23C112.317 104.232 104.323 98.9568 99.4325 92.3452C97.8338 90.1413 96.5331 87.5807 95.9596 84.844C95.0925 80.2917 95.7383 75.3872 98.1725 71.3815C103.398 63.1938 114.132 60.3802 123.007 58.2035C124.465 57.9144 124.962 60.028 123.512 60.4028V60.4073Z" fill="#232323"/>+</g>+<g id="Group_9">+<path id="Vector_24" d="M210.392 1.12903L218.417 106.083H222.739L215.057 1.12903H210.392Z" fill="#08C225"/>+<path id="Vector_25" d="M222.739 107.212H218.417C217.825 107.212 217.338 106.756 217.293 106.169L209.267 1.21483C209.245 0.903221 209.353 0.59161 209.566 0.361288C209.778 0.130967 210.08 0 210.392 0H215.053C215.644 0 216.136 0.456126 216.177 1.04774L223.864 106.002C223.886 106.314 223.778 106.625 223.565 106.851C223.353 107.081 223.051 107.212 222.739 107.212ZM219.465 104.954H221.529L214.005 2.25805H211.611L219.465 104.954Z" fill="#232323"/>+</g>+<g id="Group_10">+<path id="Vector_26" d="M198.226 104.421V113.16L242.511 112.735V102.655L198.226 104.421Z" fill="#08C225"/>+<path id="Vector_27" d="M198.226 114.289C197.928 114.289 197.643 114.172 197.431 113.964C197.219 113.752 197.097 113.463 197.097 113.16V104.421C197.097 103.816 197.575 103.319 198.181 103.292L242.465 101.527C242.773 101.513 243.071 101.626 243.292 101.843C243.513 102.055 243.64 102.349 243.64 102.656V112.736C243.64 113.354 243.143 113.86 242.52 113.865L198.235 114.289H198.226ZM199.355 105.505V112.017L241.382 111.616V103.825L199.355 105.501V105.505Z" fill="#232323"/>+</g>+<g id="Group_11">+<path id="Vector_28" d="M200.466 113.137C199.026 122.978 200.466 130.8 200.466 130.8H242.511C240.407 124.622 240.822 112.749 240.822 112.749L200.466 113.137Z" fill="#CCCBA2"/>+<path id="Vector_29" d="M242.511 131.929H200.466C199.92 131.929 199.455 131.541 199.355 131.003C199.297 130.678 197.897 122.883 199.351 112.975C199.432 112.424 199.902 112.013 200.457 112.008L240.813 111.62H240.822C241.125 111.62 241.418 111.742 241.631 111.959C241.847 112.18 241.96 112.478 241.951 112.785C241.951 112.903 241.567 124.523 243.582 130.43C243.699 130.773 243.645 131.157 243.432 131.45C243.22 131.748 242.877 131.92 242.516 131.92L242.511 131.929ZM201.433 129.671H241.003C239.662 124.401 239.625 116.8 239.666 113.892L201.451 114.257C200.525 121.443 201.135 127.444 201.437 129.671H201.433Z" fill="#232323"/>+</g>+<g id="Group_12">+<path id="Vector_30" d="M208.067 112.754C206.816 118.95 207.394 125.146 207.394 125.146Z" fill="#6B6B6B"/>+<path id="Vector_31" d="M208.541 112.849C208.482 114.913 208.099 116.904 207.945 118.959C207.769 121.009 207.661 123.073 207.624 125.132C207.624 125.403 207.209 125.44 207.168 125.169C206.644 122.057 206.586 118.887 206.897 115.748C207.01 114.7 207.232 113.662 207.597 112.659C207.692 112.406 207.972 112.275 208.225 112.37C208.428 112.447 208.555 112.645 208.546 112.849H208.541Z" fill="#232323"/>+</g>+<path id="Vector_32" d="M217.514 130.8C217.42 130.452 217.573 129.947 217.609 129.594C217.785 128.42 217.989 127.138 218.21 125.977C218.255 125.738 218.485 125.579 218.725 125.625C218.91 125.661 219.045 125.805 219.077 125.977C219.231 126.781 219.366 127.585 219.497 128.388L219.682 129.594C219.718 129.947 219.867 130.452 219.777 130.8C219.484 131.956 217.804 131.938 217.519 130.8H217.514Z" fill="#232323"/>+<g id="Group_13">+<path id="Vector_33" d="M234.509 113.16C234.125 119.912 235.087 125.977 235.087 125.977Z" fill="#6B6B6B"/>+<path id="Vector_34" d="M235.633 113.224C235.186 117.433 235.118 121.705 235.43 125.932C235.466 126.356 234.82 126.456 234.734 126.031C233.849 121.768 233.38 117.46 233.375 113.097C233.375 112.474 233.876 111.964 234.504 111.964C235.177 111.955 235.714 112.56 235.633 113.228V113.224Z" fill="#232323"/>+</g>+<g id="Group_14">+<path id="Vector_35" d="M226.43 113.16C226.335 116.448 226.43 120.391 226.43 120.391Z" fill="#6B6B6B"/>+<path id="Vector_36" d="M227.057 113.178C227.297 115.577 227.306 118.02 226.755 120.382C226.705 120.562 226.524 120.671 226.344 120.621C226.231 120.589 226.145 120.499 226.109 120.395C225.919 119.795 225.815 119.189 225.729 118.589C225.522 116.778 225.495 114.944 225.806 113.138C225.874 112.795 226.204 112.569 226.547 112.637C226.822 112.691 227.021 112.912 227.057 113.174V113.178Z" fill="#232323"/>+</g>+<path id="Vector_37" d="M216.277 113.16L215.608 116.773C215.527 117.242 214.827 117.238 214.75 116.773L214.082 113.16C213.87 111.417 216.489 111.417 216.277 113.16Z" fill="#232323"/>+<path id="Vector_38" d="M207.628 34.2593C211.733 41.7696 213.449 61.1572 213.449 61.1572L214.854 59.5179L212.921 34.2593H207.624H207.628Z" fill="#232323"/>+<g id="Group_15">+<path id="Vector_39" d="M118.811 77.0401C116.115 74.7595 112.313 75.0847 112.313 75.0847Z" fill="#6B6B6B"/>+<path id="Vector_40" d="M118.084 77.9029C116.639 76.3719 114.422 75.6719 112.353 75.5455C112.087 75.5455 111.866 75.3287 111.879 75.0577C111.888 74.8319 112.06 74.6513 112.277 74.6197C112.909 74.5294 113.5 74.5023 114.119 74.5158C116.034 74.5519 117.94 75.0758 119.543 76.1777C120.938 77.1668 119.299 79.1132 118.084 77.9029Z" fill="#232323"/>+</g>+</g>+<path id="Vector_41" d="M246.277 78.2275L245.964 72.0912C245.951 71.8162 245.574 71.7483 245.466 72.0013L243.03 77.6422C242.537 78.7873 241.437 79.5529 240.193 79.616L234.067 79.9331C233.792 79.9492 233.724 80.324 233.977 80.4328L239.607 82.869C240.75 83.3623 241.514 84.4637 241.576 85.7089L241.889 91.8453C241.905 92.1207 242.279 92.1882 242.388 91.9352L244.823 86.2943C245.317 85.1492 246.417 84.3836 247.66 84.3205L253.787 84.0034C254.062 83.9872 254.129 83.6124 253.877 83.5036L248.246 81.0674C247.103 80.5742 246.34 79.4728 246.277 78.2275Z" fill="#F4D93B"/>+</g>+</svg>diff --git a/mobile/apps/photos/changes/review-old-photos.md b/mobile/apps/photos/changes/review-old-photos.mdnew file mode 100644index 0000000000..9748b3c85c--- /dev/null+++ b/mobile/apps/photos/changes/review-old-photos.md@@ -0,0 +1 @@+- Added gallery cleanup to review photos month by month and choose what to keep or delete.diff --git a/mobile/apps/photos/lib/core/configuration.dart b/mobile/apps/photos/lib/core/configuration.dartindex da63d05e12..e004e49b8d 100644--- a/mobile/apps/photos/lib/core/configuration.dart+++ b/mobile/apps/photos/lib/core/configuration.dart@@ -25,6 +25,7 @@ import "package:photos/db/gallery_downloads_db.dart";import "package:photos/db/memories_db.dart";import "package:photos/db/memory_shares_db.dart";import "package:photos/db/ml/db.dart";+import "package:photos/db/photo_review_db.dart";import "package:photos/db/social_db.dart";import 'package:photos/db/trash_db.dart';import 'package:photos/db/upload_locks_db.dart';@@ -237,6 +238,7 @@ class Configuration implements LockScreenHost, AccountDeletionHost {await CollectionsDB.instance.clearTable();await MemoriesDB.instance.clearTable();await MemorySharesDB.instance.clearTable();+ await PhotoReviewDB.instance.clearTable();await MLDataDB.instance.clearTable();await UploadLocksDB.instance.clearTable();await TrashDB.instance.clearTable();diff --git a/mobile/apps/photos/lib/db/photo_review_db.dart b/mobile/apps/photos/lib/db/photo_review_db.dartnew file mode 100644index 0000000000..cf3eac67c0--- /dev/null+++ b/mobile/apps/photos/lib/db/photo_review_db.dart@@ -0,0 +1,360 @@+import "package:collection/collection.dart";+import "package:logging/logging.dart";+import "package:photos/db/common/base.dart";+import "package:photos/models/photo_review/photo_review_models.dart";+import "package:sqlite_async/sqlite_async.dart";++class PhotoReviewDB with SqlDbBase {+ static const _databaseName = "ente.photo_review.db";+ static const decisionsTable = "review_decisions";+ static const monthsTable = "review_months";++ static const columnFileKey = "file_key";+ static const columnUploadedFileID = "uploaded_file_id";+ static const columnGeneratedID = "generated_id";+ static const columnLocalID = "local_id";+ static const columnMonthKey = "month_key";+ static const columnDecision = "decision";+ static const columnUpdatedAt = "updated_at";+ static const columnMarkedReviewed = "marked_reviewed";+ static const columnFreedBytes = "freed_bytes";+ static const columnFreedCount = "freed_count";++ static const _lookupChunkSize = 500;++ static final Logger _logger = Logger("PhotoReviewDB");++ static final _migrationScripts = [+ '''+ CREATE TABLE IF NOT EXISTS $decisionsTable (+ $columnFileKey TEXT PRIMARY KEY,+ $columnUploadedFileID INTEGER,+ $columnGeneratedID INTEGER,+ $columnLocalID TEXT,+ $columnMonthKey TEXT NOT NULL,+ $columnDecision INTEGER NOT NULL,+ $columnUpdatedAt INTEGER NOT NULL+ );+ CREATE INDEX IF NOT EXISTS review_decisions_month_index+ ON $decisionsTable($columnMonthKey);+ CREATE INDEX IF NOT EXISTS review_decisions_local_id_index+ ON $decisionsTable($columnLocalID);+ CREATE INDEX IF NOT EXISTS review_decisions_generated_id_index+ ON $decisionsTable($columnGeneratedID);+ CREATE TABLE IF NOT EXISTS $monthsTable (+ $columnMonthKey TEXT PRIMARY KEY,+ $columnMarkedReviewed INTEGER NOT NULL DEFAULT 0,+ $columnFreedBytes INTEGER NOT NULL DEFAULT 0,+ $columnFreedCount INTEGER NOT NULL DEFAULT 0,+ $columnUpdatedAt INTEGER NOT NULL+ );+ ''',+ ];++ PhotoReviewDB._privateConstructor();++ static final PhotoReviewDB instance = PhotoReviewDB._privateConstructor();++ Future<SqliteDatabase> get database => getOrOpenDatabase(+ () => openMigratedDatabase(+ _databaseName,+ _migrationScripts,+ logPath: (path) => _logger.info("DB path $path"),+ ),+ );++ Future<List<ReviewDecisionRecord>> getAllDecisions() async {+ final db = await database;+ final rows = await db.getAll("SELECT * FROM $decisionsTable");+ return rows.map(_decisionFromRow).toList();+ }++ Future<List<ReviewDecisionRecord>> getDecisionsForFiles(+ List<String> fileKeys,+ List<String> localIDs, {+ List<int> generatedIDs = const [],+ }) async {+ final db = await database;+ return db.readTransaction((tx) async {+ final records = <ReviewDecisionRecord>[];+ for (final (column, values) in [+ (columnFileKey, fileKeys),+ (columnLocalID, localIDs),+ (columnGeneratedID, generatedIDs),+ ]) {+ for (final chunk in values.slices(_lookupChunkSize)) {+ final placeholders = SqlDbBase.getParams(chunk.length);+ final rows = await tx.getAll(+ "SELECT * FROM $decisionsTable WHERE $column IN ($placeholders)",+ chunk,+ );+ records.addAll(rows.map(_decisionFromRow));+ }+ }+ return records;+ });+ }++ Future<Map<String, ReviewMonthRecord>> getMonthRecords() async {+ final db = await database;+ final rows = await db.getAll("SELECT * FROM $monthsTable");+ return {+ for (final row in rows) row[columnMonthKey] as String: _monthFromRow(row),+ };+ }++ Future<ReviewMonthRecord?> getMonthRecord(String monthKey) async {+ final db = await database;+ final row = await db.getOptional(+ "SELECT * FROM $monthsTable WHERE $columnMonthKey = ?",+ [monthKey],+ );+ return row == null ? null : _monthFromRow(row);+ }++ Future<void> saveDecisions(+ List<ReviewDecisionRecord> records,+ String monthKey,+ int updatedAt,+ ) async {+ if (records.isEmpty) return;+ final db = await database;+ await db.writeTransaction((tx) async {+ await _upsertDecisions(tx, records);+ await _touchMonth(tx, monthKey, updatedAt);+ });+ }++ Future<void> rekeyDecisions(Map<String, ReviewDecisionRecord> records) async {+ if (records.isEmpty) return;+ final db = await database;+ await db.writeTransaction((tx) async {+ await tx.executeBatch(+ '''+ UPDATE OR IGNORE $decisionsTable+ SET $columnFileKey = ?, $columnUploadedFileID = ?,+ $columnLocalID = ?, $columnMonthKey = ?, $columnGeneratedID = ?+ WHERE $columnFileKey = ?+ AND ($columnGeneratedID IS NULL OR $columnGeneratedID = ?)+ ''',+ [+ for (final entry in records.entries)+ [+ entry.value.fileKey,+ entry.value.uploadedFileID,+ entry.value.localID,+ entry.value.monthKey,+ entry.value.generatedID,+ entry.key,+ entry.value.generatedID,+ ],+ ],+ );+ await tx.executeBatch(+ '''+ DELETE FROM $decisionsTable WHERE $columnFileKey = ?+ AND ($columnGeneratedID IS NULL OR $columnGeneratedID = ?)+ ''',+ [+ for (final entry in records.entries)+ if (entry.key != entry.value.fileKey)+ [entry.key, entry.value.generatedID],+ ],+ );+ });+ }++ Future<void> deleteDecision(+ String fileKey,+ String monthKey,+ int updatedAt, {+ int? generatedID,+ int? uploadedFileID,+ }) async {+ final db = await database;+ await db.writeTransaction((tx) async {+ final record = uploadedFileID == null+ ? null+ : await tx.getOptional(+ "SELECT $columnGeneratedID FROM $decisionsTable WHERE $columnFileKey = ?",+ [fileKey],+ );+ await tx.execute(+ '''+ DELETE FROM $decisionsTable+ WHERE $columnFileKey = ?+ OR ($columnGeneratedID IN (?, ?)+ AND ($columnUploadedFileID IS NULL OR ? IS NULL))+ ''',+ [fileKey, generatedID, record?[columnGeneratedID], uploadedFileID],+ );+ await _touchMonth(tx, monthKey, updatedAt);+ });+ }++ Future<void> recordDeletion(+ List<ReviewDecisionRecord> records,+ String monthKey,+ int freedBytes,+ int updatedAt,+ ) async {+ if (records.isEmpty) return;+ final db = await database;+ await db.writeTransaction((tx) async {+ await tx.executeBatch(+ '''+ DELETE FROM $decisionsTable+ WHERE $columnFileKey != ?+ AND ($columnGeneratedID = ? OR $columnGeneratedID = (+ SELECT $columnGeneratedID FROM $decisionsTable+ WHERE $columnFileKey = ?+ ))+ AND ($columnUploadedFileID IS NULL OR ? IS NULL)+ ''',+ [+ for (final record in records)+ [+ record.fileKey,+ record.generatedID,+ record.fileKey,+ record.uploadedFileID,+ ],+ ],+ );+ await _upsertDecisions(tx, records);+ await tx.execute(+ '''+ INSERT INTO $monthsTable (+ $columnMonthKey, $columnFreedBytes, $columnFreedCount, $columnUpdatedAt+ ) VALUES (?, ?, ?, ?)+ ON CONFLICT($columnMonthKey) DO UPDATE SET+ $columnFreedBytes = $columnFreedBytes + excluded.$columnFreedBytes,+ $columnFreedCount = $columnFreedCount + excluded.$columnFreedCount,+ $columnUpdatedAt = excluded.$columnUpdatedAt+ ''',+ [monthKey, freedBytes, records.length, updatedAt],+ );+ });+ }++ Future<void> markMonthsReviewed(List<String> monthKeys, int updatedAt) async {+ if (monthKeys.isEmpty) return;+ final db = await database;+ await db.executeBatch(+ '''+ INSERT INTO $monthsTable (+ $columnMonthKey, $columnMarkedReviewed, $columnUpdatedAt+ ) VALUES (?, 1, ?)+ ON CONFLICT($columnMonthKey) DO UPDATE SET+ $columnMarkedReviewed = 1,+ $columnUpdatedAt = excluded.$columnUpdatedAt+ ''',+ [+ for (final key in monthKeys) [key, updatedAt],+ ],+ );+ }++ Future<void> unmarkMonthReviewed(String monthKey, int updatedAt) async {+ final db = await database;+ await db.execute(+ '''+ UPDATE $monthsTable+ SET $columnMarkedReviewed = 0, $columnUpdatedAt = ?+ WHERE $columnMonthKey = ?+ ''',+ [updatedAt, monthKey],+ );+ }++ Future<void> resetMonths(List<String> monthKeys) async {+ if (monthKeys.isEmpty) return;+ final db = await database;+ await db.writeTransaction((tx) async {+ await tx.executeBatch(+ "DELETE FROM $decisionsTable WHERE $columnMonthKey = ?",+ [+ for (final key in monthKeys) [key],+ ],+ );+ await tx.executeBatch(+ "DELETE FROM $monthsTable WHERE $columnMonthKey = ?",+ [+ for (final key in monthKeys) [key],+ ],+ );+ });+ }++ Future<void> clearTable() async {+ final db = await database;+ await db.writeTransaction((tx) async {+ await tx.execute("DELETE FROM $decisionsTable");+ await tx.execute("DELETE FROM $monthsTable");+ });+ }++ Future<void> _upsertDecisions(+ SqliteWriteContext tx,+ List<ReviewDecisionRecord> records,+ ) {+ return tx.executeBatch(+ '''+ INSERT OR REPLACE INTO $decisionsTable (+ $columnFileKey, $columnUploadedFileID, $columnLocalID,+ $columnMonthKey, $columnDecision, $columnUpdatedAt, $columnGeneratedID+ ) VALUES (?, ?, ?, ?, ?, ?, ?)+ ''',+ [+ for (final record in records)+ [+ record.fileKey,+ record.uploadedFileID,+ record.localID,+ record.monthKey,+ record.decision.storedValue,+ record.updatedAt,+ record.generatedID,+ ],+ ],+ );+ }++ Future<void> _touchMonth(+ SqliteWriteContext tx,+ String monthKey,+ int updatedAt,+ ) {+ return tx.execute(+ '''+ INSERT INTO $monthsTable ($columnMonthKey, $columnUpdatedAt)+ VALUES (?, ?)+ ON CONFLICT($columnMonthKey) DO UPDATE SET+ $columnUpdatedAt = excluded.$columnUpdatedAt+ ''',+ [monthKey, updatedAt],+ );+ }++ ReviewDecisionRecord _decisionFromRow(Map<String, dynamic> row) {+ return ReviewDecisionRecord(+ fileKey: row[columnFileKey] as String,+ uploadedFileID: row[columnUploadedFileID] as int?,+ generatedID: row[columnGeneratedID] as int?,+ localID: row[columnLocalID] as String?,+ monthKey: row[columnMonthKey] as String,+ decision: ReviewDecision.fromStoredValue(row[columnDecision] as int),+ updatedAt: row[columnUpdatedAt] as int,+ );+ }++ ReviewMonthRecord _monthFromRow(Map<String, dynamic> row) {+ return ReviewMonthRecord(+ monthKey: row[columnMonthKey] as String,+ markedReviewed: (row[columnMarkedReviewed] as int) == 1,+ freedBytes: row[columnFreedBytes] as int,+ freedCount: row[columnFreedCount] as int,+ updatedAt: row[columnUpdatedAt] as int,+ );+ }+}diff --git a/mobile/apps/photos/lib/events/photo_review_updated_event.dart b/mobile/apps/photos/lib/events/photo_review_updated_event.dartnew file mode 100644index 0000000000..d452a59bfe--- /dev/null+++ b/mobile/apps/photos/lib/events/photo_review_updated_event.dart@@ -0,0 +1,3 @@+import "package:photos/events/event.dart";++class PhotoReviewUpdatedEvent extends Event {}diff --git a/mobile/apps/photos/lib/models/photo_review/photo_review_models.dart b/mobile/apps/photos/lib/models/photo_review/photo_review_models.dartnew file mode 100644index 0000000000..ba62fe5c4e--- /dev/null+++ b/mobile/apps/photos/lib/models/photo_review/photo_review_models.dart@@ -0,0 +1,172 @@+import "package:photos/models/file/file.dart";++enum ReviewDecision {+ keep(0),+ queued(1),+ deleted(2);++ const ReviewDecision(this.storedValue);++ final int storedValue;++ static ReviewDecision fromStoredValue(int value) {+ return ReviewDecision.values.firstWhere(+ (decision) => decision.storedValue == value,+ );+ }+}++enum ReviewMonthState { normal, inProgress, completed }++class ReviewMonthKey implements Comparable<ReviewMonthKey> {+ const ReviewMonthKey(this.year, this.month);++ factory ReviewMonthKey.fromCreationTime(int creationTimeMicros) {+ final date = DateTime.fromMicrosecondsSinceEpoch(creationTimeMicros);+ return ReviewMonthKey(date.year, date.month);+ }++ final int year;+ final int month;++ String get key => "$year-${month.toString().padLeft(2, "0")}";++ DateTime get start => DateTime(year, month);++ int get startMicros => start.microsecondsSinceEpoch;++ int get endMicros => DateTime(year, month + 1).microsecondsSinceEpoch - 1;++ @override+ int compareTo(ReviewMonthKey other) {+ if (year != other.year) return year.compareTo(other.year);+ return month.compareTo(other.month);+ }++ @override+ bool operator ==(Object other) =>+ other is ReviewMonthKey && other.year == year && other.month == month;++ @override+ int get hashCode => Object.hash(year, month);++ @override+ String toString() => key;+}++class ReviewDecisionRecord {+ const ReviewDecisionRecord({+ required this.fileKey,+ required this.uploadedFileID,+ required this.localID,+ required this.monthKey,+ required this.decision,+ required this.updatedAt,+ this.generatedID,+ });++ final String fileKey;+ final int? uploadedFileID;+ final int? generatedID;+ final String? localID;+ final String monthKey;+ final ReviewDecision decision;+ final int updatedAt;+}++class ReviewMonthRecord {+ const ReviewMonthRecord({+ required this.monthKey,+ required this.markedReviewed,+ required this.freedBytes,+ required this.freedCount,+ required this.updatedAt,+ });++ final String monthKey;+ final bool markedReviewed;+ final int freedBytes;+ final int freedCount;+ final int updatedAt;++ ReviewMonthRecord copyWith({required bool markedReviewed}) {+ return ReviewMonthRecord(+ monthKey: monthKey,+ markedReviewed: markedReviewed,+ freedBytes: freedBytes,+ freedCount: freedCount,+ updatedAt: updatedAt,+ );+ }+}++class ReviewMonthSummary {+ const ReviewMonthSummary({+ required this.key,+ required this.cover,+ required this.totalCount,+ required this.decidedCount,+ required this.queuedCount,+ required this.markedReviewed,+ required this.lastReviewedAt,+ });++ final ReviewMonthKey key;+ final EnteFile cover;+ final int totalCount;+ final int decidedCount;+ final int queuedCount;+ final bool markedReviewed;+ final int lastReviewedAt;++ bool get isCompleted =>+ markedReviewed || (totalCount > 0 && decidedCount >= totalCount);++ ReviewMonthState get state {+ if (isCompleted) return ReviewMonthState.completed;+ if (decidedCount > 0) return ReviewMonthState.inProgress;+ return ReviewMonthState.normal;+ }++ bool get hasProgress => markedReviewed || decidedCount > 0;++ double get progress =>+ totalCount == 0 ? 0 : (decidedCount / totalCount).clamp(0, 1);++ int get progressPercent => (progress * 100).floor();+}++class ReviewYearSummary {+ const ReviewYearSummary({required this.year, required this.months});++ final int year;+ final List<ReviewMonthSummary> months;++ bool get isCompleted => months.every((month) => month.isCompleted);+}++class ReviewOverview {+ const ReviewOverview({required this.years, required this.bannerMonths});++ final List<ReviewYearSummary> years;+ final List<ReviewMonthSummary> bannerMonths;++ bool get isEmpty => years.isEmpty;++ Iterable<ReviewMonthSummary> get months =>+ years.expand((year) => year.months);+}++class ReviewMonthData {+ const ReviewMonthData({+ required this.files,+ required this.decisions,+ required this.history,+ required this.record,+ });++ final List<EnteFile> files;+ final Map<String, ReviewDecision> decisions;+ final List<(EnteFile, ReviewDecision)> history;+ final ReviewMonthRecord? record;+}diff --git a/mobile/apps/photos/lib/services/photo_review/photo_review_service.dart b/mobile/apps/photos/lib/services/photo_review/photo_review_service.dartnew file mode 100644index 0000000000..26b93d0b7c--- /dev/null+++ b/mobile/apps/photos/lib/services/photo_review/photo_review_service.dart@@ -0,0 +1,349 @@+import "dart:async";++import "package:collection/collection.dart";+import "package:logging/logging.dart";+import "package:photos/core/configuration.dart";+import "package:photos/core/constants.dart";+import "package:photos/core/event_bus.dart";+import "package:photos/core/user_config.dart";+import "package:photos/db/files_db.dart";+import "package:photos/db/photo_review_db.dart";+import "package:photos/events/photo_review_updated_event.dart";+import "package:photos/models/file/file.dart";+import "package:photos/models/file_load_result.dart";+import "package:photos/models/photo_review/photo_review_models.dart";+import "package:photos/service_locator.dart";+import "package:photos/services/collections_service.dart";+import "package:photos/services/filter/db_filters.dart";++class PhotoReviewService {+ PhotoReviewService._privateConstructor();++ static final PhotoReviewService instance =+ PhotoReviewService._privateConstructor();++ static final _logger = Logger("PhotoReviewService");++ final PhotoReviewDB _db = PhotoReviewDB.instance;++ static String fileKey(EnteFile file) {+ if (file.uploadedFileID != null) return "u:${file.uploadedFileID}";+ if (file.localID != null) return "l:${file.localID}";+ return "g:${file.generatedID}";+ }++ Future<ReviewOverview> loadOverview() async {+ final files = await _loadFiles(galleryLoadStartTime, galleryLoadEndTime);+ final decisions = await _db.getAllDecisions();+ final months = await _db.getMonthRecords();+ final index = await _reconcileDecisions(+ files,+ ReviewDecisionIndex(decisions),+ loadAllDecisions: decisions.length <= files.length,+ );+ return buildOverview(files, index.records.toList(), months);+ }++ Future<ReviewMonthData> loadMonth(ReviewMonthKey key) async {+ final files = await _loadFiles(key.startMicros, key.endMicros);+ final index = await _reconcileDecisions(+ files,+ ReviewDecisionIndex(+ await _db.getDecisionsForFiles(+ files.map(fileKey).toList(),+ [for (final file in files) ?file.localID],+ generatedIDs: [for (final file in files) ?file.generatedID],+ ),+ ),+ );+ final decisions = <String, ReviewDecision>{};+ final undoable = <(EnteFile, ReviewDecisionRecord)>[];+ for (final file in files) {+ final record = index.lookup(file);+ if (record == null || record.decision == ReviewDecision.deleted) {+ continue;+ }+ decisions[fileKey(file)] = record.decision;+ undoable.add((file, record));+ }+ undoable.sort((a, b) => a.$2.updatedAt.compareTo(b.$2.updatedAt));+ return ReviewMonthData(+ files: files,+ decisions: decisions,+ history: [for (final (file, record) in undoable) (file, record.decision)],+ record: await _db.getMonthRecord(key.key),+ );+ }++ Future<void> recordDecision(+ EnteFile file,+ ReviewMonthKey month,+ ReviewDecision decision,+ ) async {+ final now = _now();+ await _db.saveDecisions(+ [_recordFor(file, month, decision, now)],+ month.key,+ now,+ );+ _notifyUpdated();+ }++ Future<void> removeDecision(EnteFile file, ReviewMonthKey month) async {+ await _db.deleteDecision(+ fileKey(file),+ month.key,+ _now(),+ generatedID: file.generatedID,+ uploadedFileID: file.uploadedFileID,+ );+ _notifyUpdated();+ }++ Future<void> recordDeletion(+ ReviewMonthKey month, {+ required List<EnteFile> removed,+ required List<EnteFile> kept,+ }) async {+ final now = _now();+ final freedBytes = [+ ...removed,+ ...kept,+ ].fold<int>(0, (sum, file) => sum + (file.fileSize ?? 0));+ await _db.recordDeletion(+ [+ for (final file in removed)+ _recordFor(file, month, ReviewDecision.deleted, now),+ for (final file in kept)+ _recordFor(file, month, ReviewDecision.keep, now),+ ],+ month.key,+ freedBytes,+ now,+ );+ _notifyUpdated();+ }++ Future<void> markMonthsReviewed(Iterable<ReviewMonthKey> months) async {+ await _db.markMonthsReviewed(+ months.map((month) => month.key).toList(),+ _now(),+ );+ _notifyUpdated();+ }++ Future<void> unmarkMonthReviewed(ReviewMonthKey month) async {+ await _db.unmarkMonthReviewed(month.key, _now());+ _notifyUpdated();+ }++ Future<void> resetMonths(Iterable<ReviewMonthKey> months) async {+ await _db.resetMonths(months.map((month) => month.key).toList());+ _notifyUpdated();+ }++ static ReviewOverview buildOverview(+ List<EnteFile> files,+ List<ReviewDecisionRecord> decisions,+ Map<String, ReviewMonthRecord> monthRecords,+ ) {+ final index = ReviewDecisionIndex(decisions);+ final buckets = <ReviewMonthKey, List<EnteFile>>{};+ for (final file in files) {+ final creationTime = file.creationTime;+ if (creationTime == null) continue;+ buckets+ .putIfAbsent(ReviewMonthKey.fromCreationTime(creationTime), () => [])+ .add(file);+ }+ final summaries = <ReviewMonthSummary>[];+ for (final entry in buckets.entries) {+ var decided = 0;+ var queued = 0;+ for (final file in entry.value) {+ final record = index.lookup(file);+ if (record == null || record.decision == ReviewDecision.deleted) {+ continue;+ }+ decided++;+ if (record.decision == ReviewDecision.queued) queued++;+ }+ final record = monthRecords[entry.key.key];+ summaries.add(+ ReviewMonthSummary(+ key: entry.key,+ cover: entry.value.first,+ totalCount: entry.value.length,+ decidedCount: decided,+ queuedCount: queued,+ markedReviewed: record?.markedReviewed ?? false,+ lastReviewedAt: record?.updatedAt ?? 0,+ ),+ );+ }+ summaries.sort((a, b) => a.key.compareTo(b.key));+ final byYear = <int, List<ReviewMonthSummary>>{};+ for (final summary in summaries) {+ byYear.putIfAbsent(summary.key.year, () => []).add(summary);+ }+ final years = [+ for (final year in byYear.keys.toList()..sort((a, b) => b.compareTo(a)))+ ReviewYearSummary(year: year, months: byYear[year]!),+ ];+ return ReviewOverview(years: years, bannerMonths: _bannerMonths(summaries));+ }++ static List<ReviewMonthSummary> _bannerMonths(+ List<ReviewMonthSummary> months,+ ) {+ final inProgress =+ months+ .where((month) => month.state == ReviewMonthState.inProgress)+ .toList()+ ..sort((a, b) => b.lastReviewedAt.compareTo(a.lastReviewedAt));+ final untouched = months.lastWhereOrNull(+ (month) => month.state == ReviewMonthState.normal,+ );+ return [...inProgress, ?untouched];+ }++ static ReviewMonthKey? nextMonthToReview(+ ReviewOverview overview,+ ReviewMonthKey after,+ ) {+ final months = overview.months.toList()+ ..sort((a, b) => b.key.compareTo(a.key));+ for (final month in months) {+ if (month.key.compareTo(after) < 0 && !month.isCompleted) {+ return month.key;+ }+ }+ for (final month in months) {+ if (month.key != after && !month.isCompleted) return month.key;+ }+ return null;+ }++ Future<List<EnteFile>> _loadFiles(int startMicros, int endMicros) async {+ final ownerID = Configuration.instance.getUserIDV2();+ final filterOptions = DBFilterOptions(+ hideIgnoredForUpload: true,+ dedupeUploadID: true,+ ignoredCollectionIDs: CollectionsService.instance+ .archivedOrHiddenCollectionIds(),+ ignoreSavedFiles: true,+ ignoreSharedItems: true,+ );+ final includeLocalOnly =+ backupPreferenceService.hasSelectedAllFoldersForBackup ||+ isLocalGalleryMode;+ final FileLoadResult result;+ if (includeLocalOnly) {+ result = await FilesDB.instance.getAllLocalAndUploadedFiles(+ startMicros,+ endMicros,+ ownerID,+ filterOptions: filterOptions,+ );+ } else {+ result = await FilesDB.instance.getAllPendingOrUploadedFiles(+ startMicros,+ endMicros,+ ownerID,+ filterOptions: filterOptions,+ );+ }+ _logger.info(+ "Loaded ${result.files.length} files for review in [$startMicros, $endMicros]",+ );+ return result.files;+ }++ Future<ReviewDecisionIndex> _reconcileDecisions(+ List<EnteFile> files,+ ReviewDecisionIndex index, {+ bool loadAllDecisions = false,+ }) async {+ final updated = <String, ReviewDecisionRecord>{};+ for (final file in files) {+ final record = index.lookup(file);+ final creationTime = file.creationTime;+ if (record == null || creationTime == null) continue;+ final key = fileKey(file);+ final monthKey = ReviewMonthKey.fromCreationTime(creationTime).key;+ if (record.fileKey == key && record.monthKey == monthKey) {+ continue;+ }+ updated[record.fileKey] = ReviewDecisionRecord(+ fileKey: key,+ uploadedFileID: file.uploadedFileID,+ generatedID: record.generatedID ?? file.generatedID,+ localID: file.localID,+ monthKey: monthKey,+ decision: record.decision,+ updatedAt: record.updatedAt,+ );+ }+ if (updated.isEmpty) return index;+ await _db.rekeyDecisions(updated);+ if (loadAllDecisions) {+ return ReviewDecisionIndex(await _db.getAllDecisions());+ }+ return ReviewDecisionIndex(+ await _db.getDecisionsForFiles(+ files.map(fileKey).toList(),+ [for (final file in files) ?file.localID],+ generatedIDs: [for (final file in files) ?file.generatedID],+ ),+ );+ }++ void _notifyUpdated() {+ Bus.instance.fire(PhotoReviewUpdatedEvent());+ }++ ReviewDecisionRecord _recordFor(+ EnteFile file,+ ReviewMonthKey month,+ ReviewDecision decision,+ int updatedAt,+ ) {+ return ReviewDecisionRecord(+ fileKey: fileKey(file),+ uploadedFileID: file.uploadedFileID,+ generatedID: file.generatedID,+ localID: file.localID,+ monthKey: month.key,+ decision: decision,+ updatedAt: updatedAt,+ );+ }++ static int _now() => DateTime.now().microsecondsSinceEpoch;+}++class ReviewDecisionIndex {+ ReviewDecisionIndex(List<ReviewDecisionRecord> records) {+ for (final record in records) {+ _byFileKey[record.fileKey] = record;+ if (record.uploadedFileID != null) continue;+ final localID = record.localID;+ if (localID != null) _byLocalID[localID] = record;+ final generatedID = record.generatedID;+ if (generatedID != null) _byGeneratedID[generatedID] = record;+ }+ }++ final Map<String, ReviewDecisionRecord> _byFileKey = {};+ final Map<String, ReviewDecisionRecord> _byLocalID = {};+ final Map<int, ReviewDecisionRecord> _byGeneratedID = {};++ Iterable<ReviewDecisionRecord> get records => _byFileKey.values;++ ReviewDecisionRecord? lookup(EnteFile file) {+ final direct = _byFileKey[PhotoReviewService.fileKey(file)];+ if (direct != null) return direct;+ if (file.isUploaded) return _byGeneratedID[file.generatedID];+ return _byLocalID[file.localID] ?? _byGeneratedID[file.generatedID];+ }+}diff --git a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dartindex d5d0bc06c7..7f73cf8362 100644--- a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart+++ b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart@@ -19,6 +19,7 @@ import "package:photos/ui/notification/toast.dart";import "package:photos/ui/tools/debug/app_storage_viewer.dart";import "package:photos/ui/tools/deduplicate_page.dart";import "package:photos/ui/tools/free_space_page.dart";+import "package:photos/ui/tools/photo_review/review_old_photos_page.dart";import "package:photos/ui/tools/similar_images_page.dart";import "package:photos/ui/viewer/gallery/delete_suggestions_page.dart";import "package:photos/ui/viewer/gallery/large_files_page.dart";@@ -85,6 +86,15 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {Widget _buildReviewOptions(BuildContext context, StringsLocalizations l10n) {final options = <Widget>[+ if (flagService.internalUser)+ _buildFreeSpaceOption(+ title: l10n.oldPhotos,+ subtitle: l10n.oldPhotosDesc,+ icon: HugeIcons.strokeRoundedClock02,+ onTap: () async {+ await routeToPage(context, const ReviewOldPhotosPage());+ },+ ),if (flagService.enableVectorDb)_buildFreeSpaceOption(title: l10n.similarImages,diff --git a/mobile/apps/photos/lib/ui/tools/photo_review/review_month_page.dart b/mobile/apps/photos/lib/ui/tools/photo_review/review_month_page.dartnew file mode 100644index 0000000000..6642b832da--- /dev/null+++ b/mobile/apps/photos/lib/ui/tools/photo_review/review_month_page.dart@@ -0,0 +1,867 @@+import "dart:async";+import "dart:io";+import "dart:math" as math;++import "package:collection/collection.dart";+import "package:ente_components/ente_components.dart";+import "package:ente_pure_utils/ente_pure_utils.dart";+import "package:ente_strings/ente_strings.dart";+import "package:flutter/material.dart";+import "package:flutter/services.dart";+import "package:flutter_svg/flutter_svg.dart";+import "package:hugeicons/hugeicons.dart";+import "package:intl/intl.dart";+import "package:logging/logging.dart";+import "package:photos/core/event_bus.dart";+import "package:photos/events/files_updated_event.dart";+import "package:photos/models/file/file.dart";+import "package:photos/models/photo_review/photo_review_models.dart";+import "package:photos/service_locator.dart";+import "package:photos/services/favorites_service.dart";+import "package:photos/services/photo_review/photo_review_service.dart";+import "package:photos/ui/tools/photo_review/widgets/review_swipe_stack.dart";+import "package:photos/ui/viewer/file/detail_page.dart";+import "package:photos/ui/viewer/file/thumbnail_widget.dart";+import "package:photos/utils/delete_file_util.dart";+import "package:photos/utils/dialog_util.dart";++enum _ReviewMonthView { swipe, queue, done }++class ReviewMonthPage extends StatefulWidget {+ const ReviewMonthPage({required this.monthKey, super.key});++ final ReviewMonthKey monthKey;++ @override+ State<ReviewMonthPage> createState() => _ReviewMonthPageState();+}++class _ReviewMonthPageState extends State<ReviewMonthPage> {+ static final _logger = Logger("ReviewMonthPage");+ static const _tagPrefix = "photo_review_";+ static const _actionButtonSize = 60.0;+ static const _undoButtonSize = 46.0;+ static const _actionButtonSpacing = 40.0;+ static const _bottomActionInset = 25.0;+ static const _queueTileExtent = 120.0;++ final _service = PhotoReviewService.instance;+ final _stackController = ReviewSwipeStackController();+ final _reloadDebouncer = Debouncer(+ const Duration(milliseconds: 500),+ executionInterval: const Duration(seconds: 2),+ leading: true,+ );+ late final StreamSubscription<FilesUpdatedEvent> _filesSubscription;++ List<EnteFile> _files = [];+ final Map<String, ReviewDecision> _decisions = {};+ final List<EnteFile> _undecided = [];+ final List<(EnteFile, ReviewSwipeDirection)> _history = [];+ ReviewMonthRecord? _record;+ Future<void> _lastWrite = Future.value();+ int _loadGeneration = 0;+ bool _loaded = false;+ bool _deleting = false;+ bool _reportingWriteFailure = false;+ _ReviewMonthView _view = _ReviewMonthView.swipe;++ @override+ void initState() {+ super.initState();+ _filesSubscription = Bus.instance.on<FilesUpdatedEvent>().listen(+ _onFilesUpdated,+ );+ unawaited(_load());+ }++ @override+ void dispose() {+ _filesSubscription.cancel();+ _reloadDebouncer.cancelDebounceTimer();+ super.dispose();+ }++ void _write(String action, Future<void> Function() operation) {+ _lastWrite = _lastWrite.then((_) => operation()).catchError((+ Object e,+ StackTrace s,+ ) {+ _logger.severe("Failed to $action", e, s);+ unawaited(_recoverFromWriteFailure(e));+ });+ }++ Future<void> _recoverFromWriteFailure(Object error) async {+ if (!mounted || _reportingWriteFailure) return;+ _reportingWriteFailure = true;+ try {+ await showGenericErrorDialog(context: context, error: error);+ } finally {+ _reportingWriteFailure = false;+ }+ if (mounted) await _load();+ }++ Future<void> _load({bool resetView = true}) async {+ final generation = ++_loadGeneration;+ try {+ ReviewMonthData data;+ Future<void> settled;+ do {+ settled = _lastWrite;+ await settled;+ data = await _service.loadMonth(widget.monthKey);+ } while (!identical(settled, _lastWrite));+ if (!mounted || generation != _loadGeneration) return;+ setState(() {+ _files = data.files;+ _decisions+ ..clear()+ ..addAll(data.decisions);+ _record = data.record;+ _loaded = true;+ _rebuildUndecided();+ _history+ ..clear()+ ..addAll([+ for (final (file, decision) in data.history)+ (+ file,+ decision == ReviewDecision.queued+ ? ReviewSwipeDirection.left+ : ReviewSwipeDirection.right,+ ),+ ]);+ if (resetView ||+ _view == _ReviewMonthView.done ||+ (_view == _ReviewMonthView.queue && _queued.isEmpty) ||+ (_view == _ReviewMonthView.swipe && !_canSwipe)) {+ _view = _resolveView();+ }+ });+ } catch (e, s) {+ _logger.severe("Failed to load month ${widget.monthKey}", e, s);+ if (!mounted || generation != _loadGeneration) return;+ await showGenericErrorDialog(context: context, error: e);+ if (!mounted || generation != _loadGeneration) return;+ Navigator.of(context).pop();+ }+ }++ void _onFilesUpdated(FilesUpdatedEvent event) {+ if (_deleting) return;+ _reloadDebouncer.run(() => _load(resetView: false));+ }++ EnteFile? _loadedFile(EnteFile file) => _files.firstWhereOrNull(+ (loaded) =>+ (file.generatedID != null && loaded.generatedID == file.generatedID) ||+ (file.uploadedFileID != null &&+ loaded.uploadedFileID == file.uploadedFileID),+ );++ void _rebuildUndecided() {+ _undecided+ ..clear()+ ..addAll(+ _files.where(+ (file) => !_decisions.containsKey(PhotoReviewService.fileKey(file)),+ ),+ );+ }++ bool get _canSwipe =>+ _undecided.isNotEmpty && !(_record?.markedReviewed ?? false);++ _ReviewMonthView _resolveView() {+ if (_canSwipe) return _ReviewMonthView.swipe;+ if (_queued.isNotEmpty) return _ReviewMonthView.queue;+ return _ReviewMonthView.done;+ }++ Iterable<EnteFile> get _queued => _files.where(+ (file) =>+ _decisions[PhotoReviewService.fileKey(file)] == ReviewDecision.queued,+ );++ int get _decidedCount => _files.length - _undecided.length;++ Future<void> _onSwiped(+ EnteFile swiped,+ ReviewSwipeDirection direction,+ ) async {+ final file = _loadedFile(swiped);+ if (file == null) return;+ setState(() {+ _decisions[PhotoReviewService.fileKey(file)] = direction.decision;+ _undecided.remove(file);+ _history.add((file, direction));+ if (!_canSwipe) _view = _resolveView();+ });+ _write(+ "record decision",+ () => _service.recordDecision(file, widget.monthKey, direction.decision),+ );+ }++ void _undo() {+ if (_history.isEmpty ||+ _stackController.isSwipingOut ||+ _stackController.isDragging) {+ return;+ }+ final (file, direction) = _history.removeLast();+ if (!_files.contains(file)) return;+ unawaited(HapticFeedback.lightImpact());+ setState(() {+ _decisions.remove(PhotoReviewService.fileKey(file));+ _undecided.insert(0, file);+ _view = _ReviewMonthView.swipe;+ });+ _stackController.revealFromSide(direction);+ _write(+ "undo decision",+ () => _service.removeDecision(file, widget.monthKey),+ );+ }++ void _removeFromQueue(EnteFile file) {+ unawaited(HapticFeedback.selectionClick());+ final record = _record;+ final unmark = record != null && record.markedReviewed;+ setState(() {+ _decisions.remove(PhotoReviewService.fileKey(file));+ _undecided.insert(0, file);+ _history.removeWhere((entry) => entry.$1 == file);+ if (unmark) _record = record.copyWith(markedReviewed: false);+ if (_queued.isEmpty) _view = _resolveView();+ });+ _write(+ "return queued file to the deck",+ () => _service.removeDecision(file, widget.monthKey),+ );+ if (unmark) {+ _write(+ "unmark month as reviewed",+ () => _service.unmarkMonthReviewed(widget.monthKey),+ );+ }+ }++ void _openViewer(List<EnteFile> files, EnteFile file) {+ unawaited(+ routeToPage(+ context,+ DetailPage(+ DetailPageConfiguration(+ List.of(files),+ files.indexOf(file),+ _tagPrefix,+ mode: DetailPageMode.minimalistic,+ ),+ ),+ ),+ );+ }++ Future<void> _freeUpSpace() async {+ final queued = _queued.toList();+ if (queued.isEmpty || _deleting) return;+ final hasLocal = queued.any((file) => file.localID != null);+ final hasRemote =+ !isLocalGalleryMode && queued.any((file) => file.isUploaded);+ if (!hasLocal && !hasRemote) return;+ var didDeleteFiles = false;+ var deletedLocal = false;+ void recordDeletion({+ required List<EnteFile> removed,+ List<EnteFile> kept = const [],+ }) {+ if (removed.isEmpty && kept.isEmpty) return;+ didDeleteFiles = true;+ _write(+ "record deletion",+ () => _service.recordDeletion(+ widget.monthKey,+ removed: removed,+ kept: kept,+ ),+ );+ }++ _deleting = true;+ try {+ final didDelete = await showDeleteConfirmationSheet(+ context,+ files: queued,+ isLocal: hasLocal,+ isRemote: hasRemote,+ count: queued.length,+ onDeleteFromLocal: () async {+ final result = await deleteFilesOnDeviceOnly(context, queued);+ recordDeletion(+ removed: result.where((file) => !file.isUploaded).toList(),+ kept: result.where((file) => file.isUploaded).toList(),+ );+ deletedLocal = result.isNotEmpty;+ return result.isNotEmpty;+ },+ onDeleteFromRemote: () async {+ final remote = queued.where((file) => file.isUploaded).toList();+ await deleteFilesFromRemoteOnly(context, List.of(remote));+ recordDeletion(removed: remote);+ return remote.isNotEmpty;+ },+ onDeleteFromBoth: () async {+ final result = await deleteFilesFromEverywhere(context, queued);+ recordDeletion(removed: result);+ deletedLocal = result.any((file) => file.localID != null);+ return result.isNotEmpty;+ },+ );+ if (!mounted) return;+ if (didDelete == true && deletedLocal) {+ await showMediaManagementHintSheet(context);+ }+ } catch (e, s) {+ _logger.severe("Failed to free up space", e, s);+ } finally {+ _deleting = false;+ }+ if (mounted) await _load(resetView: didDeleteFiles);+ }++ Future<void> _reviewNextMonth() async {+ final overview = await _service.loadOverview();+ if (!mounted || ModalRoute.of(context)?.isCurrent != true) return;+ final next = PhotoReviewService.nextMonthToReview(+ overview,+ widget.monthKey,+ );+ if (next == null) {+ Navigator.of(context).pop();+ return;+ }+ final page = ReviewMonthPage(monthKey: next);+ if (Platform.isIOS) {+ unawaited(+ Navigator.of(context).pushReplacement(+ SwipeableRouteBuilder(pageBuilder: (_, _, _) => page),+ ),+ );+ } else {+ replacePage(context, page);+ }+ }++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final locale = Localizations.localeOf(context).toString();+ final title = DateFormat.yMMMM(locale).format(widget.monthKey.start);+ final canReturnToSwipe = _view == _ReviewMonthView.queue && _canSwipe;+ return PopScope(+ canPop: !canReturnToSwipe,+ onPopInvokedWithResult: (didPop, _) {+ if (!didPop) setState(() => _view = _ReviewMonthView.swipe);+ },+ child: Scaffold(+ backgroundColor: colors.backgroundBase,+ body: switch (_view) {+ _ReviewMonthView.swipe => _buildSwipeView(context, title),+ _ReviewMonthView.queue => _buildQueueView(context, title),+ _ReviewMonthView.done => _buildDoneView(context, title),+ },+ ),+ );+ }++ Widget _buildSwipeView(BuildContext context, String title) {+ final colors = context.componentColors;+ final l10n = context.strings;+ final queuedCount = _queued.length;+ final padding = MediaQuery.paddingOf(context);+ final landscape =+ MediaQuery.orientationOf(context) == Orientation.landscape;+ final actions = [+ _RoundActionButton(+ size: _actionButtonSize,+ background: colors.fillBase,+ tooltip: l10n.delete,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedDelete01,+ size: 28,+ strokeWidth: 2.117,+ color: colors.textReverse,+ ),+ onTap: () =>+ unawaited(_stackController.swipe(ReviewSwipeDirection.left)),+ ),+ _RoundActionButton(+ size: _undoButtonSize,+ background: colors.fillLight,+ tooltip: l10n.undo,+ enabled: _history.isNotEmpty,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedUndo03,+ size: 21.135,+ strokeWidth: 1.554,+ color: colors.textBase,+ ),+ onTap: _undo,+ ),+ _RoundActionButton(+ size: _actionButtonSize,+ background: colors.primary,+ tooltip: l10n.keep,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedTick02,+ size: 28,+ strokeWidth: 2.117,+ color: colors.specialWhite,+ ),+ onTap: () =>+ unawaited(_stackController.swipe(ReviewSwipeDirection.right)),+ ),+ ];+ final deck = Column(+ children: [+ Padding(+ padding: const EdgeInsets.fromLTRB(+ Spacing.lg,+ Spacing.sm,+ Spacing.lg,+ 0,+ ),+ child: _ProgressHeader(reviewed: _decidedCount, total: _files.length),+ ),+ const SizedBox(height: 9),+ Expanded(+ child: ReviewSwipeStack(+ files: _undecided,+ controller: _stackController,+ onSwiped: _onSwiped,+ onCardTap: (file) => _openViewer(_undecided, file),+ isFavorite: (file) =>+ FavoritesService.instance.isFavoriteCache(file),+ ),+ ),+ ],+ );+ final Widget body;+ if (landscape) {+ final bottom = math.max(padding.bottom, Spacing.xl);+ body = Stack(+ children: [+ Padding(+ padding: EdgeInsets.only(bottom: bottom),+ child: deck,+ ),+ Positioned(+ top: Spacing.sm,+ bottom: bottom,+ right: math.max(padding.right, Spacing.xl),+ width: _actionButtonSize,+ child: FittedBox(+ fit: BoxFit.scaleDown,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ for (final action in actions.reversed) ...[+ if (action != actions.last)+ const SizedBox(height: Spacing.xl),+ action,+ ],+ ],+ ),+ ),+ ),+ ],+ );+ } else {+ body = Column(+ children: [+ Expanded(child: deck),+ const SizedBox(height: Spacing.xl),+ Row(+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ for (final action in actions) ...[+ if (action != actions.first)+ const SizedBox(width: _actionButtonSpacing),+ action,+ ],+ ],+ ),+ SizedBox(height: math.max(padding.bottom, _bottomActionInset)),+ ],+ );+ }+ return AppBarComponent(+ title: title,+ physics: const NeverScrollableScrollPhysics(),+ actions: [+ Stack(+ clipBehavior: Clip.none,+ children: [+ IconButtonComponent(+ variant: IconButtonComponentVariant.primary,+ tooltip: l10n.itemsQueuedForDeletion,+ shouldSurfaceExecutionStates: false,+ icon: const HugeIcon(icon: HugeIcons.strokeRoundedDelete01),+ onTap: queuedCount == 0+ ? null+ : () => setState(() => _view = _ReviewMonthView.queue),+ ),+ if (queuedCount > 0)+ Positioned(+ top: -5,+ right: -5,+ child: _QueueBadge(count: queuedCount),+ ),+ ],+ ),+ ],+ slivers: [+ SliverFillRemaining(+ child: !_loaded ? const Center(child: LoadingComponent()) : body,+ ),+ ],+ );+ }++ Widget _buildQueueView(BuildContext context, String title) {+ final colors = context.componentColors;+ final l10n = context.strings;+ final queued = _queued.toList();+ return Column(+ children: [+ Expanded(+ child: AppBarComponent(+ title: title,+ subtitle: l10n.itemsQueuedForDeletion,+ onBack: _canSwipe+ ? () => setState(() => _view = _ReviewMonthView.swipe)+ : null,+ slivers: [+ SliverPadding(+ padding: const EdgeInsets.fromLTRB(+ Spacing.lg,+ Spacing.xl,+ Spacing.lg,+ Spacing.xl,+ ),+ sliver: SliverGrid(+ gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(+ maxCrossAxisExtent: _queueTileExtent,+ mainAxisSpacing: Spacing.lg,+ crossAxisSpacing: 10,+ ),+ delegate: SliverChildBuilderDelegate(+ (context, index) => _QueuedTile(+ file: queued[index],+ onTap: () => _openViewer(queued, queued[index]),+ onRemove: () => _removeFromQueue(queued[index]),+ ),+ childCount: queued.length,+ ),+ ),+ ),+ ],+ ),+ ),+ ColoredBox(+ color: colors.backgroundBase,+ child: SafeArea(+ top: false,+ child: Padding(+ padding: const EdgeInsets.fromLTRB(+ Spacing.xl,+ Spacing.lg,+ Spacing.xl,+ Spacing.lg,+ ),+ child: ButtonComponent(+ label: l10n.freeUpSpace,+ shouldSurfaceExecutionStates: false,+ isDisabled: queued.isEmpty,+ onTap: _freeUpSpace,+ ),+ ),+ ),+ ),+ ],+ );+ }++ Widget _buildDoneView(BuildContext context, String title) {+ final colors = context.componentColors;+ final l10n = context.strings;+ final record = _record;+ final summary = record == null || record.freedCount == 0+ ? l10n.reviewKeptEverything+ : record.freedBytes > 0+ ? l10n.reviewFreedUpSummary(+ size: formatBytes(record.freedBytes),+ count: record.freedCount,+ )+ : l10n.reviewRemovedItemsSummary(count: record.freedCount);+ return AppBarComponent(+ title: title,+ slivers: [+ SliverSafeArea(+ top: false,+ sliver: SliverFillRemaining(+ hasScrollBody: false,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: Spacing.xl),+ child: Column(+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ const _CleanedUpIllustration(),+ const SizedBox(height: Spacing.xxl),+ Text(+ l10n.allCleanedUp,+ textAlign: TextAlign.center,+ style: TextStyles.display2.copyWith(color: colors.textBase),+ ),+ const SizedBox(height: Spacing.md),+ Text(+ summary,+ textAlign: TextAlign.center,+ style: TextStyles.body.copyWith(color: colors.textLight),+ ),+ const SizedBox(height: Spacing.xxl),+ ButtonComponent(+ label: l10n.reviewNextMonth,+ onTap: _reviewNextMonth,+ ),+ ],+ ),+ ),+ ),+ ),+ ],+ );+ }+}++class _ProgressHeader extends StatelessWidget {+ const _ProgressHeader({required this.reviewed, required this.total});++ final int reviewed;+ final int total;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Column(+ crossAxisAlignment: CrossAxisAlignment.end,+ children: [+ ClipRRect(+ borderRadius: BorderRadius.circular(2),+ child: LinearProgressIndicator(+ value: total == 0 ? 0 : reviewed / total,+ minHeight: 4,+ backgroundColor: colors.fillDark,+ valueColor: AlwaysStoppedAnimation(colors.primary),+ ),+ ),+ const SizedBox(height: 6),+ Text(+ context.strings.reviewProgressCount(reviewed: reviewed, total: total),+ style: TextStyles.tiny.copyWith(+ height: 13 / 10,+ color: colors.textLight,+ ),+ ),+ ],+ );+ }+}++class _QueueBadge extends StatelessWidget {+ const _QueueBadge({required this.count});++ final int count;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return IgnorePointer(+ child: Container(+ constraints: const BoxConstraints(minWidth: 18, minHeight: 18),+ padding: const EdgeInsets.symmetric(horizontal: 6),+ decoration: BoxDecoration(+ color: colors.warning,+ borderRadius: BorderRadius.circular(19),+ ),+ alignment: Alignment.center,+ child: Text(+ count.toString(),+ style: TextStyles.tiny.copyWith(+ fontWeight: FontWeight.w700,+ height: null,+ color: colors.specialWhite,+ ),+ ),+ ),+ );+ }+}++class _RoundActionButton extends StatefulWidget {+ const _RoundActionButton({+ required this.size,+ required this.background,+ required this.icon,+ required this.tooltip,+ required this.onTap,+ this.enabled = true,+ });++ final double size;+ final Color background;+ final Widget icon;+ final String tooltip;+ final VoidCallback onTap;+ final bool enabled;++ @override+ State<_RoundActionButton> createState() => _RoundActionButtonState();+}++class _RoundActionButtonState extends State<_RoundActionButton> {+ bool _pressed = false;++ @override+ Widget build(BuildContext context) {+ return Semantics(+ button: true,+ enabled: widget.enabled,+ label: widget.tooltip,+ child: Tooltip(+ message: widget.tooltip,+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTapDown: widget.enabled+ ? (_) => setState(() => _pressed = true)+ : null,+ onTapUp: widget.enabled+ ? (_) => setState(() => _pressed = false)+ : null,+ onTapCancel: widget.enabled+ ? () => setState(() => _pressed = false)+ : null,+ onTap: widget.enabled ? widget.onTap : null,+ child: AnimatedScale(+ scale: _pressed ? 0.95 : 1,+ duration: Motion.quick,+ curve: Curves.easeOutCubic,+ child: AnimatedOpacity(+ opacity: widget.enabled ? 1 : 0.5,+ duration: Motion.quick,+ child: Container(+ width: widget.size,+ height: widget.size,+ alignment: Alignment.center,+ decoration: BoxDecoration(+ color: widget.background,+ shape: BoxShape.circle,+ ),+ child: widget.icon,+ ),+ ),+ ),+ ),+ ),+ );+ }+}++class _QueuedTile extends StatelessWidget {+ const _QueuedTile({+ required this.file,+ required this.onTap,+ required this.onRemove,+ });++ final EnteFile file;+ final VoidCallback onTap;+ final VoidCallback onRemove;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Stack(+ clipBehavior: Clip.none,+ children: [+ Positioned.fill(+ child: Semantics(+ button: true,+ label: file.displayName,+ child: GestureDetector(+ onTap: onTap,+ child: ClipRRect(+ borderRadius: BorderRadius.circular(Radii.button),+ child: ThumbnailWidget(+ file,+ key: Key("review_queue_${file.tag}"),+ shouldShowSyncStatus: false,+ placeholderColor: colors.fillDark,+ ),+ ),+ ),+ ),+ ),+ Positioned(+ top: -5 - Spacing.sm,+ right: -6 - Spacing.sm,+ child: Semantics(+ button: true,+ label: context.strings.reviewAgain,+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: onRemove,+ child: Padding(+ padding: const EdgeInsets.all(Spacing.sm),+ child: Container(+ width: 22,+ height: 22,+ alignment: Alignment.center,+ decoration: BoxDecoration(+ color: colors.warning,+ shape: BoxShape.circle,+ border: Border.all(color: colors.specialWhite, width: 1.5),+ ),+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedCancel01,+ size: 12,+ strokeWidth: 3,+ color: colors.specialWhite,+ ),+ ),+ ),+ ),+ ),+ ),+ ],+ );+ }+}++class _CleanedUpIllustration extends StatelessWidget {+ const _CleanedUpIllustration();++ @override+ Widget build(BuildContext context) {+ return FittedBox(+ child: SvgPicture.asset(+ "assets/photo_review/all_cleaned_up.svg",+ width: 335,+ height: 133.41,+ ),+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/tools/photo_review/review_old_photos_page.dart b/mobile/apps/photos/lib/ui/tools/photo_review/review_old_photos_page.dartnew file mode 100644index 0000000000..88b1cb723c--- /dev/null+++ b/mobile/apps/photos/lib/ui/tools/photo_review/review_old_photos_page.dart@@ -0,0 +1,386 @@+import "dart:async";++import "package:ente_components/ente_components.dart";+import "package:ente_pure_utils/ente_pure_utils.dart";+import "package:ente_strings/ente_strings.dart";+import "package:flutter/material.dart";+import "package:flutter/services.dart";+import "package:flutter_svg/flutter_svg.dart";+import "package:logging/logging.dart";+import "package:photos/core/event_bus.dart";+import "package:photos/events/files_updated_event.dart";+import "package:photos/events/photo_review_updated_event.dart";+import "package:photos/models/photo_review/photo_review_models.dart";+import "package:photos/services/app_navigation_service.dart";+import "package:photos/services/photo_review/photo_review_service.dart";+import "package:photos/ui/tools/photo_review/review_month_page.dart";+import "package:photos/ui/tools/photo_review/widgets/review_banner.dart";+import "package:photos/ui/tools/photo_review/widgets/review_selection_bar.dart";+import "package:photos/ui/tools/photo_review/widgets/review_year_section.dart";+import "package:photos/utils/dialog_util.dart";++class ReviewOldPhotosPage extends StatefulWidget {+ const ReviewOldPhotosPage({super.key});++ @override+ State<ReviewOldPhotosPage> createState() => _ReviewOldPhotosPageState();+}++class _ReviewOldPhotosPageState extends State<ReviewOldPhotosPage>+ with RouteAware {+ static final _logger = Logger("ReviewOldPhotosPage");+ static const _horizontalPadding = Spacing.xl;++ final _service = PhotoReviewService.instance;+ final _reloadDebouncer = Debouncer(const Duration(seconds: 2));+ late final StreamSubscription<FilesUpdatedEvent> _filesSubscription;+ late final StreamSubscription<PhotoReviewUpdatedEvent> _reviewSubscription;++ ReviewOverview? _overview;+ Object? _error;+ final Set<ReviewMonthKey> _selected = {};+ final Set<int> _expandedYears = {};+ final _selectionBarKey = GlobalKey();+ double _selectionBarHeight = 0;+ int _loadGeneration = 0;+ bool _covered = false;+ bool _reloadWhenUncovered = false;++ bool get _selectionMode => _selected.isNotEmpty;++ @override+ void initState() {+ super.initState();+ _filesSubscription = Bus.instance.on<FilesUpdatedEvent>().listen(+ (_) => _scheduleReload(debounce: true),+ );+ _reviewSubscription = Bus.instance.on<PhotoReviewUpdatedEvent>().listen(+ (_) => _scheduleReload(debounce: false),+ );+ unawaited(_load());+ }++ @override+ void didChangeDependencies() {+ super.didChangeDependencies();+ final route = ModalRoute.of(context);+ if (route is PageRoute) {+ AppNavigationService.instance.routeObserver.subscribe(this, route);+ }+ }++ @override+ void didPushNext() {+ _covered = true;+ if (_reloadDebouncer.isActive()) {+ _reloadDebouncer.cancelDebounce();+ _reloadWhenUncovered = true;+ }+ }++ @override+ void didPopNext() {+ _covered = false;+ if (_reloadWhenUncovered) {+ _reloadWhenUncovered = false;+ unawaited(_load());+ }+ }++ @override+ void dispose() {+ AppNavigationService.instance.routeObserver.unsubscribe(this);+ _filesSubscription.cancel();+ _reviewSubscription.cancel();+ _reloadDebouncer.cancelDebounceTimer();+ super.dispose();+ }++ void _measureSelectionBar(Duration _) {+ final box =+ _selectionBarKey.currentContext?.findRenderObject() as RenderBox?;+ final height = box?.size.height ?? 0;+ if (mounted && height != _selectionBarHeight) {+ setState(() => _selectionBarHeight = height);+ }+ }++ void _scheduleReload({required bool debounce}) {+ if (_covered) {+ _reloadWhenUncovered = true;+ } else if (debounce) {+ _reloadDebouncer.run(_load);+ } else {+ unawaited(_load());+ }+ }++ Future<void> _load() async {+ if (_covered) {+ _reloadWhenUncovered = true;+ return;+ }+ final generation = ++_loadGeneration;+ try {+ final overview = await _service.loadOverview();+ if (!mounted || generation != _loadGeneration) return;+ final existingKeys = overview.months.map((month) => month.key).toSet();+ setState(() {+ _overview = overview;+ _error = null;+ _selected.retainAll(existingKeys);+ });+ } catch (e, s) {+ _logger.severe("Failed to load review overview", e, s);+ if (!mounted) return;+ setState(() => _error = e);+ }+ }++ void _openMonth(ReviewMonthKey key) {+ unawaited(routeToPage(context, ReviewMonthPage(monthKey: key)));+ }++ void _toggleMonth(ReviewMonthKey key) {+ unawaited(HapticFeedback.selectionClick());+ setState(() {+ if (!_selected.remove(key)) _selected.add(key);+ });+ }++ void _toggleYear(ReviewYearSummary year) {+ unawaited(HapticFeedback.selectionClick());+ final keys = year.months.map((month) => month.key);+ final allSelected = keys.every(_selected.contains);+ setState(() {+ if (allSelected) {+ _selected.removeAll(keys);+ } else {+ _selected.addAll(keys);+ }+ });+ }++ void _clearSelection() {+ setState(() {+ _selected.clear();+ });+ }++ Iterable<ReviewMonthSummary> get _selectedSummaries =>+ _overview?.months.where((month) => _selected.contains(month.key)) ??+ const [];++ Future<void> _markAsReviewed() async {+ final keys = _selectedSummaries+ .where((month) => !month.isCompleted)+ .map((month) => month.key)+ .toList();+ unawaited(HapticFeedback.mediumImpact());+ try {+ await _service.markMonthsReviewed(keys);+ } catch (e, s) {+ _logger.severe("Failed to mark months as reviewed", e, s);+ if (mounted) await showGenericErrorDialog(context: context, error: e);+ return;+ }+ if (mounted) _clearSelection();+ }++ Future<void> _reviewAgain() async {+ final keys = _selectedSummaries+ .where((month) => month.hasProgress)+ .map((month) => month.key)+ .toList();+ unawaited(HapticFeedback.mediumImpact());+ try {+ await _service.resetMonths(keys);+ } catch (e, s) {+ _logger.severe("Failed to reset months", e, s);+ if (mounted) await showGenericErrorDialog(context: context, error: e);+ return;+ }+ if (mounted) _clearSelection();+ }++ @override+ Widget build(BuildContext context) {+ WidgetsBinding.instance.addPostFrameCallback(_measureSelectionBar);+ final colors = context.componentColors;+ final l10n = context.strings;+ final overview = _overview;+ final canMarkReviewed = _selectedSummaries.any(+ (month) => !month.isCompleted,+ );+ final canReviewAgain = _selectedSummaries.any((month) => month.hasProgress);+ final allSelected =+ overview != null &&+ overview.months.isNotEmpty &&+ overview.months.every((month) => _selected.contains(month.key));++ return PopScope(+ canPop: !_selectionMode,+ onPopInvokedWithResult: (didPop, _) {+ if (!didPop) _clearSelection();+ },+ child: Scaffold(+ backgroundColor: colors.backgroundBase,+ body: Stack(+ children: [+ AppBarComponent(+ title: l10n.reviewOldPhotos,+ slivers: [+ if (overview == null)+ SliverFillRemaining(+ hasScrollBody: false,+ child: Center(+ child: _error == null+ ? const LoadingComponent()+ : Padding(+ padding: const EdgeInsets.all(Spacing.xxl),+ child: Text(+ l10n.somethingWentWrong,+ textAlign: TextAlign.center,+ style: TextStyles.body.copyWith(+ color: colors.textLight,+ ),+ ),+ ),+ ),+ )+ else if (overview.isEmpty)+ const SliverFillRemaining(+ hasScrollBody: false,+ child: _EmptyReviewState(),+ )+ else ...[+ if (overview.bannerMonths.isNotEmpty)+ SliverPadding(+ padding: const EdgeInsets.only(top: Spacing.xxl),+ sliver: SliverToBoxAdapter(+ child: ReviewBannerCarousel(+ months: overview.bannerMonths,+ horizontalPadding: _horizontalPadding,+ onTap: (month) => _openMonth(month.key),+ ),+ ),+ ),+ SliverSafeArea(+ top: false,+ sliver: SliverPadding(+ padding: EdgeInsets.fromLTRB(+ _horizontalPadding,+ Spacing.xxl,+ _horizontalPadding,+ _selectionMode+ ? _selectionBarHeight + Spacing.xxl+ : Spacing.xxl,+ ),+ sliver: SliverList.list(+ children: [+ for (var i = 0; i < overview.years.length; i++) ...[+ if (i > 0) const SizedBox(height: 44),+ ReviewYearSection(+ year: overview.years[i],+ selectedMonths: _selected,+ expanded: _expandedYears.contains(+ overview.years[i].year,+ ),+ onMonthTap: (month) => _selectionMode+ ? _toggleMonth(month.key)+ : _openMonth(month.key),+ onMonthLongPress: (month) =>+ _toggleMonth(month.key),+ onYearToggle: () =>+ _toggleYear(overview.years[i]),+ onExpandedChanged: (expanded) => setState(() {+ if (expanded) {+ _expandedYears.add(overview.years[i].year);+ } else {+ _expandedYears.remove(overview.years[i].year);+ }+ }),+ ),+ ],+ ],+ ),+ ),+ ),+ ],+ ],+ ),+ Align(+ alignment: Alignment.bottomCenter,+ child: AnimatedSlide(+ offset: _selectionMode ? Offset.zero : const Offset(0, 1),+ duration: Motion.slow,+ curve: Curves.easeOutCubic,+ child: IgnorePointer(+ ignoring: !_selectionMode,+ child: ReviewSelectionBar(+ key: _selectionBarKey,+ selectedCount: _selected.length,+ allSelected: allSelected,+ onSelectAll: () {+ unawaited(HapticFeedback.selectionClick());+ setState(() {+ if (allSelected) {+ _selected.clear();+ } else {+ _selected.addAll(+ overview?.months.map((month) => month.key) ??+ const [],+ );+ }+ });+ },+ onClear: _clearSelection,+ onMarkAsReviewed: canMarkReviewed ? _markAsReviewed : null,+ onReviewAgain: canReviewAgain ? _reviewAgain : null,+ ),+ ),+ ),+ ),+ ],+ ),+ ),+ );+ }+}++class _EmptyReviewState extends StatelessWidget {+ const _EmptyReviewState();++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final l10n = context.strings;+ return Center(+ child: Padding(+ padding: const EdgeInsets.all(Spacing.xl),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ SvgPicture.asset(+ "assets/photo_review/all_cleaned_up.svg",+ width: 335,+ height: 133.41,+ ),+ const SizedBox(height: Spacing.xxl),+ Text(+ l10n.nothingToReviewYet,+ textAlign: TextAlign.center,+ style: TextStyles.display2.copyWith(color: colors.textBase),+ ),+ const SizedBox(height: Spacing.md),+ Text(+ l10n.nothingToReviewYetDesc,+ textAlign: TextAlign.center,+ style: TextStyles.body.copyWith(color: colors.textLight),+ ),+ ],+ ),+ ),+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_banner.dart b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_banner.dartnew file mode 100644index 0000000000..32218c4899--- /dev/null+++ b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_banner.dart@@ -0,0 +1,267 @@+import "dart:math" as math;++import "package:ente_components/ente_components.dart";+import "package:ente_strings/ente_strings.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:intl/intl.dart";+import "package:photos/models/photo_review/photo_review_models.dart";++class ReviewBannerCarousel extends StatefulWidget {+ const ReviewBannerCarousel({+ required this.months,+ required this.horizontalPadding,+ required this.onTap,+ super.key,+ });++ static const double _barHeight = 6;++ final List<ReviewMonthSummary> months;+ final double horizontalPadding;+ final ValueChanged<ReviewMonthSummary> onTap;++ static double heightFor(BuildContext context) {+ final scaler = MediaQuery.textScalerOf(context);+ double lineHeight(TextStyle style) =>+ scaler.scale(style.fontSize!) * style.height!;+ final textHeight =+ lineHeight(ReviewBanner.captionStyle) ++ lineHeight(ReviewBanner.titleStyle);+ return Spacing.lg * 2 + textHeight + Spacing.md + _barHeight;+ }++ @override+ State<ReviewBannerCarousel> createState() => _ReviewBannerCarouselState();+}++class _ReviewBannerCarouselState extends State<ReviewBannerCarousel> {+ static const double _gap = Spacing.md;+ static const double _maxCardWidth = 400;++ PageController? _controller;++ @override+ void dispose() {+ _controller?.dispose();+ super.dispose();+ }++ PageController _controllerFor(double viewportFraction) {+ final current = _controller;+ if (current != null && current.viewportFraction == viewportFraction) {+ return current;+ }+ final controller = PageController(viewportFraction: viewportFraction);+ _controller = controller;+ if (current != null) {+ WidgetsBinding.instance.addPostFrameCallback((_) => current.dispose());+ }+ return controller;+ }++ @override+ Widget build(BuildContext context) {+ final months = widget.months;+ return SizedBox(+ height: ReviewBannerCarousel.heightFor(context),+ child: LayoutBuilder(+ builder: (context, constraints) {+ final cardWidth = math.min(+ constraints.maxWidth - widget.horizontalPadding * 2,+ _maxCardWidth,+ );+ final viewportWidth = constraints.maxWidth - widget.horizontalPadding;+ final fraction = (cardWidth + _gap) / viewportWidth;+ return Padding(+ padding: EdgeInsets.only(left: widget.horizontalPadding),+ child: PageView.builder(+ controller: _controllerFor(fraction),+ padEnds: false,+ clipBehavior: Clip.none,+ physics: months.length > 1+ ? const PageScrollPhysics()+ : const NeverScrollableScrollPhysics(),+ itemCount: months.length,+ itemBuilder: (context, index) => Padding(+ padding: const EdgeInsets.only(right: _gap),+ child: ReviewBanner(+ month: months[index],+ onTap: () => widget.onTap(months[index]),+ ),+ ),+ ),+ );+ },+ ),+ );+ }+}++class ReviewBanner extends StatelessWidget {+ const ReviewBanner({required this.month, required this.onTap, super.key});++ static final captionStyle = TextStyles.display3.copyWith(+ fontSize: 12,+ height: 20 / 12,+ );+ static final titleStyle = TextStyles.display2.copyWith(+ fontWeight: FontWeight.w700,+ );++ final ReviewMonthSummary month;+ final VoidCallback onTap;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final l10n = context.strings;+ final inProgress = month.state == ReviewMonthState.inProgress;+ final locale = Localizations.localeOf(context).toString();+ final title = DateFormat.yMMMM(locale).format(month.key.start);+ final caption = inProgress+ ? l10n.reviewPickUpAgain+ : l10n.reviewLetsGetStartedWith;++ return Semantics(+ button: true,+ label: "$caption $title",+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: onTap,+ child: Container(+ width: double.infinity,+ constraints: BoxConstraints(+ minHeight: ReviewBannerCarousel.heightFor(context),+ ),+ padding: const EdgeInsets.all(Spacing.lg),+ decoration: BoxDecoration(+ color: colors.fillLight,+ borderRadius: BorderRadius.circular(Radii.lg),+ ),+ child: Stack(+ alignment: AlignmentDirectional.centerStart,+ children: [+ Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(+ crossAxisAlignment: CrossAxisAlignment.end,+ children: [+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ caption,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: captionStyle.copyWith(+ color: colors.textLighter,+ ),+ ),+ Text(+ title,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: titleStyle.copyWith(+ color: colors.textBase,+ ),+ ),+ ],+ ),+ ),+ if (inProgress) ...[+ const SizedBox(width: Spacing.sm),+ _PercentLabel(percent: month.progressPercent),+ ] else+ const SizedBox(width: 28 + Spacing.sm),+ ],+ ),+ if (inProgress) ...[+ const SizedBox(height: Spacing.md),+ ClipRRect(+ borderRadius: BorderRadius.circular(200),+ child: LinearProgressIndicator(+ value: month.progress,+ minHeight: 6,+ backgroundColor: colors.fillDark,+ valueColor: AlwaysStoppedAnimation(colors.primary),+ ),+ ),+ ],+ ],+ ),+ Positioned(+ top: 0,+ bottom: inProgress ? null : 0,+ right: 0,+ child: Center(child: _ArrowButton(color: colors.primary)),+ ),+ ],+ ),+ ),+ ),+ );+ }+}++class _PercentLabel extends StatelessWidget {+ const _PercentLabel({required this.percent});++ final int percent;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final text = context.strings.reviewPercentReviewed(percent: percent);+ final number = "$percent%";+ final start = text.indexOf(number);+ final style = TextStyles.tiny.copyWith(+ height: 13 / 10,+ color: colors.textDark,+ );+ final bold = style.copyWith(fontWeight: FontWeight.w700);+ return Text.rich(+ start < 0+ ? TextSpan(text: text, style: style)+ : TextSpan(+ style: style,+ children: [+ TextSpan(text: text.substring(0, start)),+ TextSpan(text: number, style: bold),+ TextSpan(text: text.substring(start + number.length)),+ ],+ ),+ maxLines: 1,+ );+ }+}++class _ArrowButton extends StatelessWidget {+ const _ArrowButton({required this.color});++ final Color color;++ @override+ Widget build(BuildContext context) {+ return SizedBox(+ width: 28,+ height: 28,+ child: DecoratedBox(+ decoration: BoxDecoration(+ color: color,+ borderRadius: BorderRadius.circular(Radii.sm),+ ),+ child: Center(+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedArrowRight01,+ size: IconSizes.small,+ color: context.componentColors.specialWhite,+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_month_card.dart b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_month_card.dartnew file mode 100644index 0000000000..cc0db7e671--- /dev/null+++ b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_month_card.dart@@ -0,0 +1,341 @@+import "dart:math" as math;++import "package:ente_components/ente_components.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:photos/models/file/file.dart";+import "package:photos/models/photo_review/photo_review_models.dart";+import "package:photos/ui/viewer/actions/select_all_status_icon.dart";+import "package:photos/ui/viewer/file/thumbnail_widget.dart";++class ReviewMonthCard extends StatelessWidget {+ const ReviewMonthCard({+ required this.cover,+ required this.label,+ required this.count,+ required this.state,+ required this.progress,+ required this.selected,+ this.onTap,+ this.onLongPress,+ this.semanticLabel,+ super.key,+ });++ static const double width = 86;+ static const double height = 122;+ static const double borderWidth = 2.522;+ static const double radius = 10.088;+ static const double _labelBaselineShift = 2;+ static const List<BoxShadow> shadow = [+ BoxShadow(+ color: Color(0x40000000),+ offset: Offset(2.522, 2.522),+ blurRadius: 4.92,+ ),+ ];++ final EnteFile cover;+ final String label;+ final int count;+ final ReviewMonthState state;+ final double progress;+ final bool selected;+ final VoidCallback? onTap;+ final VoidCallback? onLongPress;+ final String? semanticLabel;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final white = colors.specialWhite;+ final isCompleted = state == ReviewMonthState.completed;+ final showShadow = state != ReviewMonthState.inProgress;+ final labelText = Transform.translate(+ offset: Offset(0, isCompleted ? 0 : _labelBaselineShift),+ child: FittedBox(+ fit: BoxFit.scaleDown,+ alignment: Alignment.centerLeft,+ child: Text(+ label,+ maxLines: 1,+ style: TextStyles.display2.copyWith(+ fontWeight: FontWeight.w700,+ height: 1,+ leadingDistribution: TextLeadingDistribution.even,+ color: white,+ ),+ ),+ ),+ );++ return Semantics(+ button: onTap != null,+ selected: selected,+ label: semanticLabel,+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: onTap,+ onLongPress: onLongPress,+ child: SizedBox(+ width: width,+ height: height,+ child: Stack(+ clipBehavior: Clip.none,+ children: [+ Positioned(+ left: -borderWidth,+ top: -borderWidth,+ right: -borderWidth,+ bottom: -borderWidth,+ child: DecoratedBox(+ decoration: BoxDecoration(+ color: white,+ borderRadius: BorderRadius.circular(radius + borderWidth),+ boxShadow: showShadow ? shadow : null,+ ),+ ),+ ),+ Positioned.fill(+ child: ClipRRect(+ borderRadius: BorderRadius.circular(radius),+ child: Container(+ foregroundDecoration: isCompleted+ ? const BoxDecoration(+ color: Color(0xFFBFBFBF),+ backgroundBlendMode: BlendMode.saturation,+ )+ : null,+ child: Stack(+ fit: StackFit.expand,+ children: [+ ThumbnailWidget(+ cover,+ key: Key("review_month_card_${cover.tag}"),+ shouldShowSyncStatus: false,+ shouldShowFavoriteIcon: false,+ shouldShowVideoOverlayIcon: false,+ placeholderColor: colors.fillDark,+ ),+ const DecoratedBox(+ decoration: BoxDecoration(gradient: _defaultGradient),+ ),+ ],+ ),+ ),+ ),+ ),+ if (state == ReviewMonthState.inProgress)+ Positioned.fill(+ child: CustomPaint(+ painter: _ProgressRingPainter(+ progress: progress,+ color: colors.primary,+ ),+ ),+ ),+ Positioned(+ left: Spacing.sm,+ right: Spacing.sm,+ top: Spacing.md,+ bottom: Spacing.md,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const Spacer(),+ if (state == ReviewMonthState.inProgress) ...[+ _ProgressPill(progress: progress),+ const SizedBox(height: Spacing.xs),+ ],+ if (isCompleted)+ Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Flexible(child: labelText),+ const SizedBox(width: Spacing.xs),+ SizedBox(+ width: 20,+ height: 20,+ child: Center(+ child: SelectAllStatusIcon(+ isSelected: true,+ size: 16,+ tickIconSize: 12,+ tickStrokeWidth: 3.2,+ selectedFillColor: colors.primary,+ selectedTickColor: white,+ ),+ ),+ ),+ ],+ )+ else+ labelText,+ ],+ ),+ ),+ if (selected)+ const Positioned(top: -9, left: 71, child: ReviewSelectedTick())+ else if (state == ReviewMonthState.normal)+ Positioned(top: -8, left: 70, child: _CountBadge(count: count)),+ ],+ ),+ ),+ ),+ );+ }++ static const _defaultGradient = LinearGradient(+ begin: Alignment.bottomCenter,+ end: Alignment.topCenter,+ colors: [Color(0xA3000000), Color(0x00000000)],+ );+}++class _CountBadge extends StatelessWidget {+ const _CountBadge({required this.count});++ final int count;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Container(+ constraints: const BoxConstraints(minWidth: 18, minHeight: 18),+ padding: const EdgeInsets.symmetric(horizontal: 6),+ decoration: BoxDecoration(+ color: colors.fillLight,+ borderRadius: BorderRadius.circular(19),+ boxShadow: ReviewMonthCard.shadow,+ ),+ alignment: Alignment.center,+ child: Text(+ count.toString(),+ maxLines: 1,+ style: TextStyles.tiny.copyWith(+ fontWeight: FontWeight.w700,+ height: null,+ color: colors.textLighter,+ ),+ ),+ );+ }+}++class _ProgressPill extends StatelessWidget {+ const _ProgressPill({required this.progress});++ final double progress;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Container(+ padding: const EdgeInsets.symmetric(horizontal: 6, vertical: Spacing.xs),+ decoration: BoxDecoration(+ color: colors.primary,+ borderRadius: BorderRadius.circular(Radii.md),+ ),+ child: Text(+ "${(progress * 100).floor()}%",+ maxLines: 1,+ style: TextStyles.tiny.copyWith(+ fontWeight: FontWeight.w700,+ height: null,+ color: colors.specialWhite,+ ),+ ),+ );+ }+}++class ReviewSelectedTick extends StatelessWidget {+ const ReviewSelectedTick({super.key});++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Container(+ width: 22,+ height: 22,+ alignment: Alignment.center,+ decoration: BoxDecoration(+ color: colors.primary,+ shape: BoxShape.circle,+ border: Border.all(color: colors.specialWhite, width: 1.5),+ ),+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedTick02,+ size: 12,+ strokeWidth: 3,+ color: colors.specialWhite,+ ),+ );+ }+}++class _ProgressRingPainter extends CustomPainter {+ const _ProgressRingPainter({required this.progress, required this.color});++ final double progress;+ final Color color;++ static const double _strokeWidth = 5;+ static const double _radius = 12;+ static const Rect _ringRect = Rect.fromLTWH(-1.71, -1, 89, 125);++ @override+ void paint(Canvas canvas, Size size) {+ if (progress <= 0) return;+ final path = _clockwiseRRectPath(_ringRect, _radius);+ final metric = path.computeMetrics().first;+ final visible = metric.extractPath(0, metric.length * progress.clamp(0, 1));+ final shadow = Paint()+ ..color = const Color(0x40000000)+ ..style = PaintingStyle.stroke+ ..strokeWidth = _strokeWidth+ ..strokeCap = StrokeCap.round+ ..maskFilter = const MaskFilter.blur(BlurStyle.normal, 3.342);+ canvas.save();+ canvas.translate(2.522, 2.522);+ canvas.drawPath(visible, shadow);+ canvas.restore();+ final paint = Paint()+ ..color = color+ ..style = PaintingStyle.stroke+ ..strokeWidth = _strokeWidth+ ..strokeCap = StrokeCap.round;+ canvas.drawPath(visible, paint);+ }++ static Path _clockwiseRRectPath(Rect rect, double radius) {+ final r = math.min(radius, math.min(rect.width, rect.height) / 2);+ final path = Path()..moveTo(rect.center.dx, rect.top);+ path.lineTo(rect.right - r, rect.top);+ path.arcToPoint(+ Offset(rect.right, rect.top + r),+ radius: Radius.circular(r),+ );+ path.lineTo(rect.right, rect.bottom - r);+ path.arcToPoint(+ Offset(rect.right - r, rect.bottom),+ radius: Radius.circular(r),+ );+ path.lineTo(rect.left + r, rect.bottom);+ path.arcToPoint(+ Offset(rect.left, rect.bottom - r),+ radius: Radius.circular(r),+ );+ path.lineTo(rect.left, rect.top + r);+ path.arcToPoint(+ Offset(rect.left + r, rect.top),+ radius: Radius.circular(r),+ );+ path.lineTo(rect.center.dx, rect.top);+ return path;+ }++ @override+ bool shouldRepaint(covariant _ProgressRingPainter oldDelegate) =>+ oldDelegate.progress != progress || oldDelegate.color != color;+}diff --git a/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_selection_bar.dart b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_selection_bar.dartnew file mode 100644index 0000000000..05d3f3a5f0--- /dev/null+++ b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_selection_bar.dart@@ -0,0 +1,80 @@+import "package:ente_components/ente_components.dart";+import "package:ente_strings/ente_strings.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:photos/ui/components/bottom_action_bar/action_bar_widget.dart";+import "package:photos/ui/components/bottom_action_bar/selection_action_sheet.dart";+import "package:photos/ui/viewer/actions/select_all_status_icon.dart";++class ReviewSelectionBar extends StatelessWidget {+ const ReviewSelectionBar({+ required this.selectedCount,+ required this.allSelected,+ required this.onSelectAll,+ required this.onClear,+ required this.onMarkAsReviewed,+ required this.onReviewAgain,+ super.key,+ });++ final int selectedCount;+ final bool allSelected;+ final VoidCallback onSelectAll;+ final VoidCallback onClear;+ final VoidCallback? onMarkAsReviewed;+ final VoidCallback? onReviewAgain;++ @override+ Widget build(BuildContext context) {+ final l10n = context.strings;+ return SelectionActionSheet(+ actions: [+ SelectionSheetAction(+ labelText: l10n.markAsReviewed,+ hugeIcon: HugeIcons.strokeRoundedTickDouble02,+ onTap: onMarkAsReviewed,+ ),+ SelectionSheetAction(+ labelText: l10n.reviewAgain,+ hugeIcon: HugeIcons.strokeRoundedReload,+ onTap: onReviewAgain,+ ),+ ],+ selectionControls: SafeArea(+ top: false,+ bottom: false,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: Spacing.sm),+ child: Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ Flexible(+ child: SelectionControlChip(+ label: l10n.selectAllShort,+ semanticLabel: l10n.selectAll,+ isSelected: allSelected,+ icon: SelectAllStatusIcon(+ isSelected: allSelected,+ size: IconSizes.small,+ unselectedColor: context.componentColors.textLighter,+ ),+ onTap: onSelectAll,+ ),+ ),+ const SizedBox(width: Spacing.sm),+ Flexible(+ child: SelectionControlChip(+ label: selectedCount.toString(),+ semanticLabel:+ "${l10n.cancel}, ${l10n.selectedPhotos(count: selectedCount)}",+ icon: const HugeIcon(icon: HugeIcons.strokeRoundedCancel01),+ onTap: onClear,+ ),+ ),+ ],+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_swipe_stack.dart b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_swipe_stack.dartnew file mode 100644index 0000000000..3411628aa6--- /dev/null+++ b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_swipe_stack.dart@@ -0,0 +1,548 @@+import "dart:async";+import "dart:math" as math;++import "package:ente_components/ente_components.dart";+import "package:ente_icons/ente_icons.dart";+import "package:ente_pure_utils/ente_pure_utils.dart";+import "package:flutter/material.dart";+import "package:flutter/services.dart";+import "package:hugeicons/hugeicons.dart";+import "package:photos/core/constants.dart";+import "package:photos/models/file/file.dart";+import "package:photos/models/file/file_type.dart";+import "package:photos/models/photo_review/photo_review_models.dart";+import "package:photos/ui/viewer/file/thumbnail_widget.dart";++enum ReviewSwipeDirection { left, right }++extension ReviewSwipeDirectionDecision on ReviewSwipeDirection {+ ReviewDecision get decision => switch (this) {+ ReviewSwipeDirection.left => ReviewDecision.queued,+ ReviewSwipeDirection.right => ReviewDecision.keep,+ };++ double get sign => this == ReviewSwipeDirection.right ? 1 : -1;+}++class ReviewSwipeStackController {+ _ReviewSwipeStackState? _state;++ bool get isSwipingOut => _state?._flying ?? false;++ bool get isDragging => _state?._dragging ?? false;++ Future<void> swipe(ReviewSwipeDirection direction) async {+ await _state?._flyOut(direction);+ }++ void _detach(_ReviewSwipeStackState state) {+ if (identical(_state, state)) _state = null;+ }++ void revealFromSide(ReviewSwipeDirection direction) {+ _state?._revealFromSide(direction);+ }+}++class ReviewSwipeStack extends StatefulWidget {+ const ReviewSwipeStack({+ required this.files,+ required this.controller,+ required this.onSwiped,+ required this.onCardTap,+ required this.isFavorite,+ super.key,+ });++ static const double aspectRatio = 312.9 / 503;+ static const double horizontalInset = 31;+ static const double backCardPeek = 26;+ static const double _backCardRise = 53.5;+ static const double _backCardScale = 273 / 312.9;+ static const double _backCardShift = 23;+ static const double _backCardTilt = 4.06;+ static const double _minCardWidth = 80;+ static const double _cardRadius = 21;+ static const double _cardBorder = 4.2;+ static const double _maxTiltDegrees = 12;+ static const double _swipeFraction = 0.3;+ static const double _glowFraction = 0.21;+ static const double _flingVelocity = 800;+ static const double _verticalDamping = 0.2;+ static const double _maxVerticalDrift = 24;++ final List<EnteFile> files;+ final ReviewSwipeStackController controller;+ final Future<void> Function(EnteFile file, ReviewSwipeDirection direction)+ onSwiped;+ final ValueChanged<EnteFile> onCardTap;+ final bool Function(EnteFile file) isFavorite;++ @override+ State<ReviewSwipeStack> createState() => _ReviewSwipeStackState();+}++class _ReviewSwipeStackState extends State<ReviewSwipeStack>+ with SingleTickerProviderStateMixin {+ late final AnimationController _animation = AnimationController(+ vsync: this,+ duration: Motion.slow,+ );+ Animation<Offset>? _tween;+ Offset _drag = Offset.zero;+ int? _draggedFileID;+ bool _dragging = false;+ bool _flying = false;+ bool _crossedThreshold = false;+ Size _cardSize = Size.zero;+ _SideGlow? _keepGlow;+ _SideGlow? _deleteGlow;++ @override+ void initState() {+ super.initState();+ widget.controller._state = this;+ _animation.addListener(() {+ final tween = _tween;+ if (tween != null) {+ setState(() => _drag = tween.value);+ }+ });+ }++ @override+ void didUpdateWidget(covariant ReviewSwipeStack oldWidget) {+ super.didUpdateWidget(oldWidget);+ if (oldWidget.controller != widget.controller) {+ oldWidget.controller._detach(this);+ widget.controller._state = this;+ }+ }++ @override+ void dispose() {+ widget.controller._detach(this);+ _animation.dispose();+ super.dispose();+ }++ double get _threshold => _cardSize.width * ReviewSwipeStack._swipeFraction;++ Future<void> _animateTo(Offset target, {Curve curve = Curves.easeOutCubic}) {+ _tween = Tween(+ begin: _drag,+ end: target,+ ).chain(CurveTween(curve: curve)).animate(_animation);+ _animation+ ..reset()+ ..duration = Motion.slow;+ return _animation.forward().orCancel.catchError((_) {});+ }++ Future<void> _flyOut(ReviewSwipeDirection direction) async {+ if (_flying || _dragging || widget.files.isEmpty || !mounted) return;+ final file = widget.files.first;+ _flying = true;+ final width = MediaQuery.sizeOf(context).width;+ final target = Offset(direction.sign * (width + _cardSize.width), _drag.dy);+ unawaited(HapticFeedback.mediumImpact());+ await _animateTo(target, curve: Curves.easeIn);+ if (!mounted) return;+ _tween = null;+ _drag = Offset.zero;+ _flying = false;+ _crossedThreshold = false;+ await widget.onSwiped(file, direction);+ }++ void _revealFromSide(ReviewSwipeDirection direction) {+ if (!mounted) return;+ final width = MediaQuery.sizeOf(context).width;+ _drag = Offset(direction.sign * (width + _cardSize.width), 0);+ unawaited(_animateTo(Offset.zero));+ }++ void _onPanStart(DragStartDetails details) {+ if (_flying || widget.files.isEmpty) return;+ _animation.stop();+ _tween = null;+ _dragging = true;+ _draggedFileID = widget.files.first.generatedID;+ _crossedThreshold = false;+ }++ void _onPanUpdate(DragUpdateDetails details) {+ if (!_dragging) return;+ setState(() {+ final dy =+ _drag.dy + details.delta.dy * ReviewSwipeStack._verticalDamping;+ _drag = Offset(+ _drag.dx + details.delta.dx,+ dy.clamp(+ -ReviewSwipeStack._maxVerticalDrift,+ ReviewSwipeStack._maxVerticalDrift,+ ),+ );+ });+ final crossed = _drag.dx.abs() >= _threshold;+ if (crossed != _crossedThreshold) {+ _crossedThreshold = crossed;+ if (crossed) unawaited(HapticFeedback.selectionClick());+ }+ }++ void _onPanEnd(DragEndDetails details) {+ if (!_dragging) return;+ _dragging = false;+ if (widget.files.isEmpty ||+ widget.files.first.generatedID != _draggedFileID) {+ unawaited(_animateTo(Offset.zero));+ return;+ }+ final velocity = details.velocity.pixelsPerSecond.dx;+ final passed = _drag.dx.abs() >= _threshold;+ final flung = velocity.abs() >= ReviewSwipeStack._flingVelocity;+ if (passed || flung) {+ final direction = (passed ? _drag.dx : velocity) > 0+ ? ReviewSwipeDirection.right+ : ReviewSwipeDirection.left;+ unawaited(_flyOut(direction));+ } else {+ unawaited(_animateTo(Offset.zero));+ }+ }++ @override+ Widget build(BuildContext context) {+ return LayoutBuilder(+ builder: (context, constraints) {+ final width = math+ .min(+ constraints.maxWidth - ReviewSwipeStack.horizontalInset * 2,+ (constraints.maxHeight - ReviewSwipeStack.backCardPeek) *+ ReviewSwipeStack.aspectRatio,+ )+ .clamp(ReviewSwipeStack._minCardWidth, double.infinity);+ _cardSize = Size(width, width / ReviewSwipeStack.aspectRatio);+ final files = widget.files.take(3).toList();+ final glow =+ (_drag.dx / (_cardSize.width * ReviewSwipeStack._glowFraction))+ .clamp(-1.0, 1.0);+ final tilt =+ (_drag.dx / _cardSize.width * ReviewSwipeStack._maxTiltDegrees)+ .clamp(+ -ReviewSwipeStack._maxTiltDegrees,+ ReviewSwipeStack._maxTiltDegrees,+ ) *+ math.pi /+ 180;++ _keepGlow = _glowFor(_keepGlow, context.componentColors.primary);+ _deleteGlow = _glowFor(_deleteGlow, _SideGlow.deleteColor);++ return Stack(+ clipBehavior: Clip.none,+ alignment: Alignment.topCenter,+ children: [+ Positioned(+ right: -81 - _SideGlow.spread,+ top: -_SideGlow.spread,+ child: IgnorePointer(+ child: Opacity(opacity: glow.clamp(0, 1), child: _keepGlow),+ ),+ ),+ Positioned(+ left: -72 - _SideGlow.spread,+ top: -_SideGlow.spread,+ child: IgnorePointer(+ child: Opacity(+ opacity: (-glow).clamp(0, 1),+ child: _deleteGlow,+ ),+ ),+ ),+ for (var index = files.length - 1; index >= 0; index--)+ _positionedCard(files[index], index, tilt),+ ],+ );+ },+ );+ }++ _SideGlow _glowFor(_SideGlow? cached, Color color) {+ if (cached != null &&+ cached.color == color &&+ cached.cardHeight == _cardSize.height) {+ return cached;+ }+ return _SideGlow(color: color, cardHeight: _cardSize.height);+ }++ Widget _positionedCard(EnteFile file, int index, double topTilt) {+ final isTop = index == 0;+ final depth = index.clamp(0, 2);+ final back = !isTop;+ final shift = back+ ? (depth == 1 ? 1 : -1) * ReviewSwipeStack._backCardShift+ : 0.0;+ final scale = back ? ReviewSwipeStack._backCardScale : 1.0;+ final backTilt = back+ ? (depth == 1 ? 1 : -1) * ReviewSwipeStack._backCardTilt * math.pi / 180+ : 0.0;+ final translate = back+ ? Offset(+ shift,+ ReviewSwipeStack.backCardPeek - ReviewSwipeStack._backCardRise,+ )+ : Offset(_drag.dx, ReviewSwipeStack.backCardPeek + _drag.dy);+ final transform = Matrix4.identity()+ ..translateByDouble(translate.dx, translate.dy, 0, 1)+ ..translateByDouble(_cardSize.width / 2, _cardSize.height / 2, 0, 1)+ ..rotateZ(back ? backTilt : topTilt)+ ..scaleByDouble(scale, scale, 1, 1)+ ..translateByDouble(-_cardSize.width / 2, -_cardSize.height / 2, 0, 1);++ final card = RepaintBoundary(+ child: _ReviewCard(+ file: file,+ size: _cardSize,+ radius: ReviewSwipeStack._cardRadius,+ border: ReviewSwipeStack._cardBorder,+ isFavorite: widget.isFavorite(file),+ onTap: isTop ? () => widget.onCardTap(file) : null,+ ),+ );++ return Positioned(+ key: ValueKey("review_card_${file.tag}"),+ top: 0,+ child: AnimatedContainer(+ duration: _dragging || _flying || _animation.isAnimating+ ? Duration.zero+ : Motion.slow,+ curve: Curves.easeOutCubic,+ transform: transform,+ child: isTop+ ? GestureDetector(+ behavior: HitTestBehavior.opaque,+ onPanStart: _onPanStart,+ onPanUpdate: _onPanUpdate,+ onPanEnd: _onPanEnd,+ onPanCancel: () => _onPanEnd(DragEndDetails()),+ child: card,+ )+ : IgnorePointer(child: card),+ ),+ );+ }+}++class _ReviewCard extends StatelessWidget {+ const _ReviewCard({+ required this.file,+ required this.size,+ required this.radius,+ required this.border,+ required this.isFavorite,+ required this.onTap,+ });++ final EnteFile file;+ final Size size;+ final double radius;+ final double border;+ final bool isFavorite;+ final VoidCallback? onTap;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final fileSize = file.fileSize;+ return Semantics(+ button: onTap != null,+ label: file.displayName,+ child: GestureDetector(+ onTap: onTap,+ child: Container(+ width: size.width,+ height: size.height,+ decoration: BoxDecoration(+ color: colors.fillDark,+ borderRadius: BorderRadius.circular(radius),+ border: Border.all(color: colors.specialWhite, width: border),+ boxShadow: const [+ BoxShadow(+ color: Color(0x40000000),+ offset: Offset(0, 6.031),+ blurRadius: 14.7,+ ),+ ],+ ),+ child: ClipRRect(+ borderRadius: BorderRadius.circular(radius - border),+ child: Stack(+ fit: StackFit.expand,+ children: [+ ThumbnailWidget(+ file,+ key: Key("review_swipe_${file.tag}"),+ thumbnailSize: thumbnailLargeSize,+ shouldShowSyncStatus: false,+ shouldShowFavoriteIcon: false,+ shouldShowVideoOverlayIcon: false,+ placeholderColor: colors.fillDark,+ ),+ if (file.fileType == FileType.video)+ Center(child: _VideoIndicator(duration: file.duration)),+ if (fileSize != null)+ Positioned(+ left: Spacing.lg,+ top: Spacing.lg,+ child: Container(+ padding: const EdgeInsets.symmetric(+ horizontal: Spacing.md,+ vertical: Spacing.xs,+ ),+ decoration: BoxDecoration(+ color: colors.specialScrim,+ borderRadius: BorderRadius.circular(38),+ ),+ child: Text(+ formatBytes(fileSize, fileSize >= 1024 * 1024 ? 1 : 0),+ style: TextStyles.mini.copyWith(+ color: colors.specialWhite,+ ),+ ),+ ),+ ),+ if (isFavorite)+ Positioned(+ right: Spacing.lg,+ top: Spacing.lg,+ child: Icon(+ EnteIcons.favoriteFilled,+ size: 20,+ color: colors.specialWhite,+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ );+ }+}++class _VideoIndicator extends StatelessWidget {+ const _VideoIndicator({required this.duration});++ final int? duration;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final seconds = duration ?? 0;+ return Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Container(+ width: 54,+ height: 54,+ alignment: Alignment.center,+ decoration: BoxDecoration(+ color: colors.specialScrim,+ shape: BoxShape.circle,+ border: Border.all(+ color: colors.specialWhite.withValues(alpha: 0.16),+ width: 1,+ ),+ ),+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedPlay,+ size: 32,+ color: colors.specialWhite,+ ),+ ),+ if (seconds > 0) ...[+ const SizedBox(height: Spacing.sm),+ Container(+ padding: const EdgeInsets.symmetric(+ horizontal: Spacing.md,+ vertical: Spacing.xs,+ ),+ decoration: BoxDecoration(+ color: colors.specialScrim,+ borderRadius: BorderRadius.circular(38),+ ),+ child: Text(+ secondsToDuration(seconds),+ style: TextStyles.mini.copyWith(color: colors.specialWhite),+ ),+ ),+ ],+ ],+ );+ }+}++class _SideGlow extends StatelessWidget {+ const _SideGlow({required this.color, required this.cardHeight});++ static const double _width = 120;+ static const double _top = 58;+ static const double _bottomInset = 31;+ static const double _blurSigma = 60;+ static const double spread = _blurSigma * 3;+ static const Color deleteColor = Color(0xFFFF4C38);++ final Color color;+ final double cardHeight;++ @override+ Widget build(BuildContext context) {+ final height = math.max(0.0, cardHeight - _bottomInset);+ final boxHeight = spread + _top + height + spread;+ return RepaintBoundary(+ child: ShaderMask(+ blendMode: BlendMode.dstIn,+ shaderCallback: (bounds) => LinearGradient(+ begin: Alignment.topCenter,+ end: Alignment.bottomCenter,+ colors: const [+ Color(0x00FFFFFF),+ Color(0x00FFFFFF),+ Color(0xFFFFFFFF),+ ],+ stops: [0, spread / boxHeight, (spread + _top) / boxHeight],+ ).createShader(bounds),+ child: SizedBox(+ width: _width + spread * 2,+ height: boxHeight,+ child: Stack(+ clipBehavior: Clip.none,+ children: [+ Positioned(+ left: spread,+ top: spread + _top,+ child: Container(+ width: _width,+ height: height,+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(_width / 2),+ boxShadow: [+ BoxShadow(+ color: color,+ blurRadius: (_blurSigma - 0.5) / 0.57735,+ ),+ ],+ ),+ ),+ ),+ ],+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_year_section.dart b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_year_section.dartnew file mode 100644index 0000000000..e4a6c8183d--- /dev/null+++ b/mobile/apps/photos/lib/ui/tools/photo_review/widgets/review_year_section.dart@@ -0,0 +1,309 @@+import "dart:math" as math;++import "package:ente_components/components/chip_surface.dart";+import "package:ente_components/ente_components.dart";+import "package:ente_strings/ente_strings.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:intl/intl.dart";+import "package:photos/models/photo_review/photo_review_models.dart";+import "package:photos/ui/tools/photo_review/widgets/review_month_card.dart";+import "package:photos/ui/viewer/actions/select_all_status_icon.dart";++class ReviewYearSection extends StatelessWidget {+ const ReviewYearSection({+ required this.year,+ required this.selectedMonths,+ required this.expanded,+ required this.onMonthTap,+ required this.onMonthLongPress,+ required this.onYearToggle,+ required this.onExpandedChanged,+ super.key,+ });++ static const double _slotWidth = 90.205;+ static const double _slotHeight = 124.927;+ static const double _rowSpacing = 32;+ static const double _minSlotGap = 12;+ static const double _tiltDegrees = 2;++ static int _slotsPerRow(double width) {+ final usable = width - Spacing.sm * 2 + _minSlotGap;+ return math.max(1, (usable / (_slotWidth + _minSlotGap)).floor());+ }++ final ReviewYearSummary year;+ final Set<ReviewMonthKey> selectedMonths;+ final bool expanded;+ final ValueChanged<ReviewMonthSummary> onMonthTap;+ final ValueChanged<ReviewMonthSummary> onMonthLongPress;+ final VoidCallback onYearToggle;+ final ValueChanged<bool> onExpandedChanged;++ @override+ Widget build(BuildContext context) {+ final l10n = context.strings;+ final colors = context.componentColors;+ final locale = Localizations.localeOf(context).toString();+ final yearLabel = DateFormat.y(locale).format(DateTime(year.year));+ final allSelected =+ year.months.isNotEmpty &&+ year.months.every((month) => selectedMonths.contains(month.key));+ final completed = year.isCompleted;+ final collapsed = completed && !expanded;++ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(+ children: [+ Text(+ yearLabel,+ style: TextStyles.display3.copyWith(color: colors.textBase),+ ),+ if (completed) ...[+ const SizedBox(width: Spacing.xs),+ SelectAllStatusIcon(+ isSelected: true,+ size: 16,+ tickIconSize: 12,+ tickStrokeWidth: 3.2,+ selectedFillColor: colors.primary,+ selectedTickColor: colors.specialWhite,+ ),+ ],+ const Spacer(),+ if (!collapsed)+ Semantics(+ button: true,+ selected: allSelected,+ label: l10n.selectYear(year: yearLabel),+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: onYearToggle,+ child: SizedBox(+ width: 28.182,+ height: 28.182,+ child: Center(+ child: allSelected+ ? const ReviewSelectedTick()+ : HugeIcon(+ icon: HugeIcons.strokeRoundedCircle,+ size: 23.826,+ strokeWidth: 2.11,+ color: colors.textLighter,+ ),+ ),+ ),+ ),+ ),+ ],+ ),+ const SizedBox(height: Spacing.xl),+ if (collapsed)+ _CompletedYearRow(+ year: year,+ yearLabel: yearLabel,+ onSeeAll: () => onExpandedChanged(true),+ )+ else ...[+ LayoutBuilder(+ builder: (context, constraints) {+ final perRow = _slotsPerRow(constraints.maxWidth);+ return Column(+ children: [+ for (+ var start = 0;+ start < year.months.length;+ start += perRow+ ) ...[+ if (start > 0) const SizedBox(height: _rowSpacing),+ Padding(+ padding: const EdgeInsets.symmetric(+ horizontal: Spacing.sm,+ ),+ child: Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ for (+ var index = start;+ index < start + perRow;+ index+++ )+ index < year.months.length+ ? _monthSlot(context, year.months[index], index)+ : const SizedBox(width: _slotWidth),+ ],+ ),+ ),+ ],+ ],+ );+ },+ ),+ if (completed) ...[+ const SizedBox(height: Spacing.xl),+ Center(+ child: Semantics(+ button: true,+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () => onExpandedChanged(false),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ l10n.seeLess,+ style: TextStyles.mini.copyWith(+ color: colors.textLight,+ ),+ ),+ const SizedBox(width: Spacing.xs),+ SizedBox(+ width: 12,+ height: 24,+ child: Center(+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedArrowUp01,+ size: IconSizes.tiny,+ strokeWidth: 3,+ color: colors.textLight,+ ),+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ ],+ ],+ ],+ );+ }++ Widget _monthSlot(BuildContext context, ReviewMonthSummary month, int index) {+ final locale = Localizations.localeOf(context).toString();+ final label = DateFormat.MMM(locale).format(month.key.start);+ final tilt = month.state == ReviewMonthState.completed+ ? 0.0+ : (index.isEven ? _tiltDegrees : -_tiltDegrees) * math.pi / 180;+ return SizedBox(+ width: _slotWidth,+ height: _slotHeight,+ child: Center(+ child: Transform.rotate(+ angle: tilt,+ child: ReviewMonthCard(+ cover: month.cover,+ label: label,+ count: month.totalCount,+ state: month.state,+ progress: month.progress,+ selected: selectedMonths.contains(month.key),+ semanticLabel: DateFormat.yMMMM(locale).format(month.key.start),+ onTap: () => onMonthTap(month),+ onLongPress: () => onMonthLongPress(month),+ ),+ ),+ ),+ );+ }+}++class _CompletedYearRow extends StatelessWidget {+ const _CompletedYearRow({+ required this.year,+ required this.yearLabel,+ required this.onSeeAll,+ });++ final ReviewYearSummary year;+ final String yearLabel;+ final VoidCallback onSeeAll;++ @override+ Widget build(BuildContext context) {+ final l10n = context.strings;+ final colors = context.componentColors;+ final locale = Localizations.localeOf(context).toString();+ final months = year.months;+ final stacked = [+ if (months.length > 2) (months.last, -14.19, const Offset(1.754, -0.16)),+ if (months.length > 1) (months[1], -7.06, const Offset(25.389, 5.44)),+ (months[0], 0.0, const Offset(47.732, 11.437)),+ ];++ return Padding(+ padding: const EdgeInsets.symmetric(horizontal: Spacing.sm),+ child: Row(+ children: [+ SizedBox(+ width: 134,+ height: 142,+ child: Stack(+ clipBehavior: Clip.none,+ children: [+ for (final (month, degrees, offset) in stacked)+ Positioned(+ left: offset.dx,+ top: offset.dy,+ child: Transform.rotate(+ angle: degrees * math.pi / 180,+ child: ReviewMonthCard(+ cover: month.cover,+ label: DateFormat.MMM(locale).format(month.key.start),+ count: month.totalCount,+ state: ReviewMonthState.completed,+ progress: 1,+ selected: false,+ ),+ ),+ ),+ ],+ ),+ ),+ const SizedBox(width: 25),+ Expanded(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ l10n.reviewYouReviewedYear(year: yearLabel),+ textAlign: TextAlign.center,+ style: TextStyles.display3.copyWith(+ fontSize: 18,+ height: null,+ color: colors.textBase,+ ),+ ),+ const SizedBox(height: Spacing.sm),+ ChipSurface(+ surfaceKey: ValueKey("review-see-all-${year.year}"),+ enabled: true,+ selected: false,+ semanticLabel: l10n.seeAll,+ minHeight: 36,+ minWidth: 99,+ padding: const EdgeInsets.symmetric(horizontal: Spacing.xxl),+ background: colors.fillLight,+ borderRadius: BorderRadius.circular(Radii.md),+ onTap: onSeeAll,+ child: Text(+ l10n.seeAll,+ style: TextStyles.display3.copyWith(+ fontSize: 10,+ height: 28 / 10,+ color: colors.textBase,+ ),+ ),+ ),+ ],+ ),+ ),+ ],+ ),+ );+ }+}diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yamlindex 526160ff76..d480abcb3c 100644--- a/mobile/apps/photos/pubspec.yaml+++ b/mobile/apps/photos/pubspec.yaml@@ -291,6 +291,7 @@ flutter:- assets/icons/- assets/icons/nav_bar/- assets/launcher_icon/+ - assets/photo_review/fonts:# TODO: Migrate legacy Photos text styles to ente_components fonts, then# remove this app-local Inter declaration.diff --git a/mobile/apps/photos/test/db/photo_review_db_test.dart b/mobile/apps/photos/test/db/photo_review_db_test.dartnew file mode 100644index 0000000000..3a358076ef--- /dev/null+++ b/mobile/apps/photos/test/db/photo_review_db_test.dart@@ -0,0 +1,279 @@+import "dart:io";++import "package:flutter_test/flutter_test.dart";+import "package:path_provider_platform_interface/path_provider_platform_interface.dart";+import "package:photos/db/photo_review_db.dart";+import "package:photos/models/file/file.dart";+import "package:photos/models/photo_review/photo_review_models.dart";+import "package:photos/services/photo_review/photo_review_service.dart";++void main() {+ final db = PhotoReviewDB.instance;+ const month = "2026-01";+ late Directory tempDir;+ late PathProviderPlatform previousPathProvider;++ setUpAll(() async {+ previousPathProvider = PathProviderPlatform.instance;+ tempDir = await Directory.systemTemp.createTemp("photo_review_db_test_");+ PathProviderPlatform.instance = _FakePathProvider(tempDir.path);+ });++ tearDownAll(() async {+ await (await db.database).close();+ PathProviderPlatform.instance = previousPathProvider;+ await tempDir.delete(recursive: true);+ });++ setUp(db.clearTable);++ test("uploaded copies do not inherit each other's decisions", () {+ final original = _decision("u:7", generatedID: 42);+ final copy = EnteFile()+ ..uploadedFileID = 8+ ..generatedID = 43+ ..localID = "a";+ expect(ReviewDecisionIndex([original]).lookup(copy), isNull);++ final pending = _decision("l:a", generatedID: 43);+ final index = ReviewDecisionIndex([pending, original]);+ expect(index.lookup(copy), same(pending));+ copy.uploadedFileID = 7;+ expect(index.lookup(copy), same(original));+ });++ test("pending decisions only follow their own uploaded file", () {+ final pending = _decision("l:a", generatedID: 42);+ final index = ReviewDecisionIndex([pending]);+ final uploaded = EnteFile()+ ..uploadedFileID = 7+ ..generatedID = 42+ ..localID = "a";+ expect(index.lookup(uploaded), same(pending));+ uploaded.generatedID = 43;+ expect(index.lookup(uploaded), isNull);+ uploaded.generatedID = null;+ expect(index.lookup(uploaded), isNull);+ });++ test("undo removes only the selected upload and its pending alias", () async {+ await db.saveDecisions(+ [+ _decision("l:a", generatedID: 42),+ _decision("u:7", generatedID: 42),+ _decision("u:8", generatedID: 43, decision: ReviewDecision.keep),+ ],+ month,+ 10,+ );+ await PhotoReviewService.instance.removeDecision(+ EnteFile()+ ..uploadedFileID = 7+ ..generatedID = 44+ ..localID = "a",+ const ReviewMonthKey(2026, 1),+ );+ expect((await db.getAllDecisions()).single.fileKey, "u:8");++ await db.saveDecisions([_decision("l:a")], month, 30);+ await db.deleteDecision("l:a", month, 40);+ final remaining = (await db.getAllDecisions()).single;+ expect(remaining.fileKey, "u:8");+ expect(remaining.decision, ReviewDecision.keep);+ });++ test("undo of an uploaded copy preserves another pending decision", () async {+ final copy = EnteFile()+ ..uploadedFileID = 8+ ..generatedID = 43+ ..localID = "a";+ await db.saveDecisions(+ [_decision("l:a", generatedID: 42), _decision("u:8", generatedID: 43)],+ month,+ 10,+ );+ await PhotoReviewService.instance.removeDecision(+ copy,+ const ReviewMonthKey(2026, 1),+ );+ expect((await db.getAllDecisions()).single.fileKey, "l:a");+ });++ test(+ "undo with a pre-upload file removes its promoted decision only",+ () async {+ final local = EnteFile()+ ..localID = "a"+ ..generatedID = 42;+ await db.saveDecisions(+ [_decision("l:a", generatedID: 42), _decision("u:8", generatedID: 43)],+ month,+ 10,+ );+ await db.rekeyDecisions({+ "l:a": _decision("u:7", localID: null, generatedID: 42),+ });++ await PhotoReviewService.instance.removeDecision(+ local,+ const ReviewMonthKey(2026, 1),+ );++ expect((await db.getAllDecisions()).single.fileKey, "u:8");+ },+ );++ test(+ "stale upload reconciliation cannot resurrect an undone decision",+ () async {+ await db.saveDecisions([_decision("l:a")], month, 10);+ final stale = _decision("u:7");+ await db.deleteDecision("l:a", month, 20);++ await db.rekeyDecisions({"l:a": stale});++ expect(await db.getAllDecisions(), isEmpty);+ expect((await db.getMonthRecord(month))!.updatedAt, 20);+ },+ );++ test("reconciliation preserves a newer decision and its timestamp", () async {+ await db.saveDecisions([_decision("l:a")], month, 10);+ final stale = _decision("u:7", month: "2026-02");+ await db.saveDecisions(+ [_decision("l:a", decision: ReviewDecision.keep, updatedAt: 20)],+ month,+ 20,+ );++ await db.rekeyDecisions({"l:a": stale});++ final current = (await db.getAllDecisions()).single;+ expect(current.fileKey, "u:7");+ expect(current.monthKey, "2026-02");+ expect(current.decision, ReviewDecision.keep);+ expect(current.updatedAt, 20);+ });++ test("stale reconciliation preserves a different pending file", () async {+ await db.saveDecisions([_decision("l:a", generatedID: 42)], month, 10);+ final stale = _decision("u:7", generatedID: 42);+ await db.saveDecisions([_decision("l:a", generatedID: 43)], month, 20);++ await db.rekeyDecisions({"l:a": stale});++ final current = (await db.getAllDecisions()).single;+ expect(current.fileKey, "l:a");+ expect(current.generatedID, 43);+ });++ test(+ "deletion from a pre-upload snapshot clears its promoted queue",+ () async {+ await db.saveDecisions(+ [_decision("u:7", generatedID: 42), _decision("u:8", generatedID: 43)],+ month,+ 10,+ );+ await db.recordDeletion(+ [_decision("l:a", generatedID: 42, decision: ReviewDecision.deleted)],+ month,+ 100,+ 20,+ );++ final records = await db.getAllDecisions();+ expect(+ records.map((record) => record.fileKey),+ unorderedEquals(["l:a", "u:8"]),+ );+ expect(+ records.firstWhere((record) => record.fileKey == "u:8").decision,+ ReviewDecision.queued,+ );+ },+ );++ test("reconciliation preserves an existing uploaded decision", () async {+ await db.saveDecisions(+ [+ _decision("l:a"),+ _decision("u:7", decision: ReviewDecision.keep, updatedAt: 20),+ ],+ month,+ 20,+ );++ await db.rekeyDecisions({"l:a": _decision("u:7")});++ final current = (await db.getAllDecisions()).single;+ expect(current.fileKey, "u:7");+ expect(current.decision, ReviewDecision.keep);+ expect(current.updatedAt, 20);+ });++ test(+ "progress survives upload and loss of the local ID, then undoes",+ () async {+ await db.saveDecisions([_decision("l:a", generatedID: 42)], month, 10);+ final uploaded = EnteFile()+ ..uploadedFileID = 7+ ..generatedID = 42;+ final records = await db.getDecisionsForFiles(+ [PhotoReviewService.fileKey(uploaded)],+ [],+ generatedIDs: [42],+ );+ final matched = ReviewDecisionIndex(records).lookup(uploaded);+ expect(matched?.decision, ReviewDecision.queued);++ await db.rekeyDecisions({+ matched!.fileKey: _decision("u:7", localID: null, generatedID: 42),+ });+ expect((await db.getAllDecisions()).single.fileKey, "u:7");+ await db.deleteDecision("u:7", month, 20, uploadedFileID: 7);+ expect(await db.getAllDecisions(), isEmpty);+ },+ );++ test("resetting one month leaves another month's progress intact", () async {+ await db.saveDecisions(+ [_decision("u:1"), _decision("u:2", month: "2026-02")],+ month,+ 10,+ );+ await db.markMonthsReviewed([month, "2026-02"], 20);++ await db.resetMonths([month]);++ expect((await db.getAllDecisions()).single.fileKey, "u:2");+ expect(await db.getMonthRecord(month), isNull);+ expect((await db.getMonthRecord("2026-02"))!.markedReviewed, isTrue);+ });+}++ReviewDecisionRecord _decision(+ String key, {+ ReviewDecision decision = ReviewDecision.queued,+ String month = "2026-01",+ String? localID = "a",+ int? generatedID,+ int updatedAt = 1,+}) => ReviewDecisionRecord(+ fileKey: key,+ uploadedFileID: key.startsWith("u:") ? int.parse(key.substring(2)) : null,+ localID: localID,+ generatedID: generatedID,+ monthKey: month,+ decision: decision,+ updatedAt: updatedAt,+);++class _FakePathProvider extends PathProviderPlatform {+ _FakePathProvider(this.documentsPath);++ final String documentsPath;++ @override+ Future<String?> getApplicationDocumentsPath() async => documentsPath;+}diff --git a/mobile/packages/strings/lib/l10n/arb/strings_en.arb b/mobile/packages/strings/lib/l10n/arb/strings_en.arbindex d9d438edeb..dcb484f9a1 100644--- a/mobile/packages/strings/lib/l10n/arb/strings_en.arb+++ b/mobile/packages/strings/lib/l10n/arb/strings_en.arb@@ -1,4 +1,5 @@{+ "allCleanedUp": "All cleaned up!","bringMemoriesTogether": "Bring your memories together","@bringMemoriesTogether": {"description": "Title on the Local Gallery photo permission screen"@@ -2147,6 +2148,7 @@}},"itemsLabel": "Items",+ "itemsQueuedForDeletion": "Items queued for deletion","itemsShowTheNumberOfDaysRemainingBeforePermanentDeletion": "Items show the number of days remaining before permanent deletion","itemsStored": "Items stored","itemsWillBeDeletedFromAllCollections": "{count, plural, one{This item will be deleted from all collections. You can recover it from Trash.} other{These items will be deleted from all collections. You can recover them from Trash.}}",@@ -2172,6 +2174,10 @@"joinAlbumConfirmationDialogBody": "Joining an album will make your email visible to its participants.","joinAlbumSubtext": "to view and add your photos","joinAlbumSubtextViewer": "to add this to shared albums",+ "keep": "Keep",+ "@keep": {+ "description": "Tooltip for the button that keeps the current photo while reviewing old photos."+ },"keepOffline": "Keep offline","keepPhotos": "Keep photos","kiloMeterUnit": "km",@@ -2553,6 +2559,7 @@},"maps": "Maps","mapsPrivacyNotice": "Approximate coordinates will be sent to privacy conscious third parties like OpenStreetMap to show the map and location.",+ "markAsReviewed": "Mark as reviewed","markingAsImportant": "Marking as important...","me": "Me","mediaManagementHintMessage": "Turn on media management for Ente in settings, and the prompts stop.",@@ -2887,6 +2894,8 @@}}},+ "nothingToReviewYet": "Nothing to review yet",+ "nothingToReviewYetDesc": "Your photos will show up here, month by month.","nothingToSeeHere": "Nothing to see here","nothingToCleanUp": "Nothing to clean up","nothingToTidyUpHere": "Nothing to tidy up here",@@ -2924,6 +2933,8 @@"offlineNameFaceBannerTitle": "Give this face a name","offlineSettingsBannerDesc": "Zero-knowledge encryption means your memories stay yours.","offlineSettingsBannerTitle": "We can't see your photos. Ever.",+ "oldPhotos": "Old photos",+ "oldPhotosDesc": "Look back, keep what matters","onboardingDesc": "Save your photos and videos. Every memory, in one place.","onboardingTitle": "For everything you don't want to forget","onDevice": "Device",@@ -3632,7 +3643,72 @@"retake": "Retake","retry": "Retry","review": "Review",+ "reviewAgain": "Review again",+ "reviewFreedUpSummary": "{count, plural, one{You freed up {size} from {count} item.} other{You freed up {size} from {count} items.}}",+ "@reviewFreedUpSummary": {+ "placeholders": {+ "size": {+ "example": "128 MB",+ "type": "String"+ },+ "count": {+ "example": "24",+ "type": "int"+ }+ }+ },+ "reviewKeptEverything": "You kept everything in this month.",+ "reviewLetsGetStartedWith": "Letβs get started with",+ "@reviewLetsGetStartedWith": {+ "description": "Caption above the month name on the Review old photos banner before any month has been started."+ },+ "reviewNextMonth": "Review next month",+ "reviewOldPhotos": "Review old photos",+ "reviewPercentReviewed": "{percent}% reviewed",+ "@reviewPercentReviewed": {+ "placeholders": {+ "percent": {+ "example": "40",+ "type": "int"+ }+ }+ },+ "reviewPickUpAgain": "Pick up again",+ "@reviewPickUpAgain": {+ "description": "Caption above the month name on the Review old photos banner when a month is partly reviewed."+ },+ "reviewProgressCount": "{reviewed}/{total} reviewed",+ "@reviewProgressCount": {+ "placeholders": {+ "reviewed": {+ "example": "40",+ "type": "int"+ },+ "total": {+ "example": "60",+ "type": "int"+ }+ }+ },+ "reviewRemovedItemsSummary": "{count, plural, one{You removed {count} item.} other{You removed {count} items.}}",+ "@reviewRemovedItemsSummary": {+ "placeholders": {+ "count": {+ "example": "24",+ "type": "int"+ }+ }+ },"reviewSuggestions": "Review suggestions",+ "reviewYouReviewedYear": "You reviewed {year}!",+ "@reviewYouReviewedYear": {+ "placeholders": {+ "year": {+ "example": "2026",+ "type": "String"+ }+ }+ },"revoke": "Revoke","revokeInvite": "Revoke invite","@revokeInvite": {@@ -3914,7 +3990,9 @@"secretCanNotBeEmpty": "Secret can not be empty","security": "Security","securityDesc": "Encryption, recovery keys, app lock, and account protection",+ "seeAll": "See all","seeAllCollections": "All collections",+ "seeLess": "See less","seePublicAlbumLinksInApp": "See public album links in app","selectAlbumsToBackUpToEnte": "Select albums to back up to Ente","selectAlbumToLikePhoto": "Select the album to like this photo",@@ -4022,6 +4100,16 @@},"selectStartOfRange": "Select start of range","selectTime": "Select time",+ "selectYear": "Select {year}",+ "@selectYear": {+ "description": "Accessibility label of the control that selects every month of a year.",+ "placeholders": {+ "year": {+ "example": "2026",+ "type": "String"+ }+ }+ },"selectYourFace": "Select your face","selfiesWithThem": "Selfies with {name}","@selfiesWithThem": {