Skip to content

Commit 03d8b63

Browse files
committed
feat: implement platform-specific filtering for repository discovery
- Add vector resources for Android, Linux, macOS, and Windows platform icons. - Implement platform filtering logic in `HomeViewModel` to allow fetching repositories by specific OS targets. - Update `HomeState` to track the currently selected platform and the visibility of the platform selection popup. - Enhance `HomeRoot` UI with a platform selector in the `TopAppBar`, including a popup menu for switching between platforms (All, Android, Macos, Windows, Linux). - Add `HomePlatformMapper` utility to map `HomePlatform` enum values to their respective UI icons. - Introduce `SwitchFilterPlatform` and `OnTogglePlatformPopup` actions to handle platform selection events.
1 parent 44a46e3 commit 03d8b63

9 files changed

Lines changed: 230 additions & 8 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="32dp"
3+
android:height="32dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
6+
<path
7+
android:pathData="M18.447,4.106C18.941,4.353 19.141,4.953 18.894,5.447L17.72,7.796C20.307,9.604 22,12.604 22,16L22,17C22,18.105 21.105,19 20,19L4,19C2.895,19 2,18.105 2,17L2,16C2,12.604 3.693,9.604 6.28,7.796L5.106,5.447C4.859,4.953 5.059,4.353 5.553,4.106C6.047,3.859 6.647,4.059 6.894,4.553L8.028,6.82C9.246,6.292 10.589,6 12,6C13.411,6 14.755,6.292 15.972,6.82L17.106,4.553C17.353,4.059 17.953,3.859 18.447,4.106ZM7.5,12C6.672,12 6,12.672 6,13.5C6,14.328 6.672,15 7.5,15C8.328,15 9,14.328 9,13.5C9,12.672 8.328,12 7.5,12ZM16.5,12C15.672,12 15,12.672 15,13.5C15,14.328 15.672,15 16.5,15C17.328,15 18,14.328 18,13.5C18,12.672 17.328,12 16.5,12Z"
8+
android:strokeWidth="1"
9+
android:fillColor="#008d40"
10+
android:fillType="evenOdd"
11+
android:strokeColor="#00000000"/>
12+
</vector>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="32dp"
3+
android:height="32dp"
4+
android:viewportWidth="16"
5+
android:viewportHeight="16">
6+
<path
7+
android:pathData="M13.338,12.033c-0.1,-0.112 -0.146,-0.319 -0.197,-0.54 -0.05,-0.22 -0.107,-0.457 -0.288,-0.61v-0.001a0.756,0.756 0,0 0,-0.223 -0.134c0.252,-0.745 0.153,-1.487 -0.1,-2.157 -0.312,-0.823 -0.855,-1.54 -1.27,-2.03 -0.464,-0.586 -0.918,-1.142 -0.91,-1.963 0.014,-1.254 0.138,-3.579 -2.068,-3.582 -0.09,0 -0.183,0.004 -0.28,0.012 -2.466,0.198 -1.812,2.803 -1.849,3.675 -0.045,0.638 -0.174,1.14 -0.613,1.764 -0.515,0.613 -1.24,1.604 -1.584,2.637 -0.162,0.487 -0.24,0.984 -0.168,1.454 -0.023,0.02 -0.044,0.041 -0.064,0.063 -0.151,0.161 -0.263,0.357 -0.388,0.489 -0.116,0.116 -0.282,0.16 -0.464,0.225 -0.183,0.066 -0.383,0.162 -0.504,0.395v0.001a0.702,0.702 0,0 0,-0.077 0.339c0,0.108 0.016,0.217 0.032,0.322 0.034,0.22 0.068,0.427 0.023,0.567 -0.144,0.395 -0.163,0.667 -0.061,0.865 0.102,0.199 0.31,0.286 0.547,0.335 0.473,0.1 1.114,0.075 1.619,0.342l0.043,-0.082 -0.043,0.082c0.54,0.283 1.089,0.383 1.526,0.284a0.99,0.99 0,0 0,0.706 -0.552c0.342,-0.002 0.717,-0.146 1.318,-0.18 0.408,-0.032 0.918,0.145 1.503,0.113a0.806,0.806 0,0 0,0.068 0.183l0.001,0.001c0.227,0.455 0.65,0.662 1.1,0.627 0.45,-0.036 0.928,-0.301 1.315,-0.762l-0.07,-0.06 0.07,0.06c0.37,-0.448 0.982,-0.633 1.388,-0.878 0.203,-0.123 0.368,-0.276 0.38,-0.499 0.013,-0.222 -0.118,-0.471 -0.418,-0.805z"
8+
android:fillColor="#202020"/>
9+
<path
10+
android:pathData="M13.571,12.828c-0.007,0.137 -0.107,0.24 -0.29,0.35 -0.368,0.222 -1.019,0.414 -1.434,0.918 -0.362,0.43 -0.802,0.665 -1.19,0.696 -0.387,0.03 -0.721,-0.13 -0.919,-0.526v-0.002c-0.123,-0.233 -0.072,-0.6 0.031,-0.987s0.251,-0.785 0.271,-1.108v-0.001c0.02,-0.415 0.044,-0.776 0.114,-1.055 0.07,-0.28 0.179,-0.468 0.373,-0.575a0.876,0.876 0,0 1,0.027 -0.014c0.022,0.359 0.2,0.725 0.514,0.804 0.343,0.09 0.838,-0.204 1.047,-0.445l0.122,-0.004c0.184,-0.005 0.337,0.006 0.495,0.143v0.001c0.121,0.102 0.179,0.296 0.229,0.512 0.05,0.217 0.09,0.453 0.239,0.621 0.287,0.32 0.38,0.534 0.371,0.672zM6.592,13.843v0.003c-0.034,0.435 -0.28,0.672 -0.656,0.758 -0.377,0.086 -0.888,0 -1.398,-0.266 -0.565,-0.3 -1.237,-0.27 -1.667,-0.36 -0.216,-0.045 -0.357,-0.113 -0.421,-0.238 -0.064,-0.126 -0.066,-0.345 0.071,-0.72v-0.001l0.001,-0.002c0.068,-0.209 0.018,-0.438 -0.015,-0.653 -0.033,-0.214 -0.049,-0.41 0.024,-0.546l0.001,-0.001c0.094,-0.181 0.232,-0.246 0.403,-0.307 0.17,-0.062 0.373,-0.11 0.533,-0.27l0.001,-0.001h0.001c0.148,-0.157 0.26,-0.353 0.39,-0.492 0.11,-0.117 0.22,-0.195 0.385,-0.196h0.005a0.61,0.61 0,0 1,0.093 0.008c0.22,0.033 0.411,0.187 0.596,0.437l0.533,0.971v0.001c0.142,0.296 0.441,0.622 0.695,0.954 0.254,0.333 0.45,0.666 0.425,0.921z"
11+
android:fillColor="#F8BF11"/>
12+
<path
13+
android:pathData="M9.25,4.788c-0.043,-0.084 -0.13,-0.164 -0.28,-0.225 -0.31,-0.133 -0.444,-0.142 -0.617,-0.254 -0.28,-0.181 -0.513,-0.244 -0.706,-0.244a0.834,0.834 0,0 0,-0.272 0.047c-0.236,0.08 -0.392,0.25 -0.49,0.342 -0.02,0.019 -0.044,0.035 -0.104,0.08 -0.06,0.043 -0.15,0.11 -0.28,0.208 -0.117,0.086 -0.154,0.2 -0.114,0.332 0.04,0.132 0.167,0.285 0.4,0.417h0.001c0.145,0.085 0.244,0.2 0.358,0.291a0.801,0.801 0,0 0,0.189 0.117c0.072,0.031 0.156,0.052 0.26,0.058 0.248,0.015 0.43,-0.06 0.59,-0.151 0.16,-0.092 0.296,-0.204 0.452,-0.255h0.001c0.32,-0.1 0.548,-0.301 0.62,-0.493a0.324,0.324 0,0 0,-0.008 -0.27z"
14+
android:fillColor="#D6A312"/>
15+
<path
16+
android:pathData="M8.438,5.26c-0.255,0.133 -0.552,0.294 -0.869,0.294 -0.316,0 -0.566,-0.146 -0.745,-0.289 -0.09,-0.07 -0.163,-0.142 -0.218,-0.193 -0.096,-0.075 -0.084,-0.181 -0.045,-0.178 0.066,0.008 0.076,0.095 0.117,0.134 0.056,0.052 0.126,0.12 0.211,0.187 0.17,0.135 0.397,0.266 0.68,0.266 0.284,0 0.614,-0.166 0.816,-0.28 0.115,-0.064 0.26,-0.179 0.379,-0.266 0.09,-0.067 0.087,-0.147 0.162,-0.138 0.075,0.009 0.02,0.089 -0.085,0.18 -0.105,0.092 -0.27,0.214 -0.403,0.283z"
17+
android:fillColor="#202020"/>
18+
<path
19+
android:pathData="M12.337,10.694a1.724,1.724 0,0 0,-0.104 0h-0.01c0.088,-0.277 -0.106,-0.48 -0.621,-0.713 -0.534,-0.235 -0.96,-0.212 -1.032,0.265 -0.005,0.025 -0.009,0.05 -0.011,0.076a0.801,0.801 0,0 0,-0.12 0.054c-0.252,0.137 -0.389,0.386 -0.465,0.692 -0.076,0.305 -0.098,0.674 -0.119,1.09 -0.013,0.208 -0.099,0.49 -0.186,0.79 -0.875,0.624 -2.09,0.894 -3.122,0.19 -0.07,-0.11 -0.15,-0.22 -0.233,-0.328a13.85,13.85 0,0 0,-0.16 -0.205,0.65 0.65,0 0,0 0.268,-0.05 0.34,0.34 0,0 0,0.186 -0.192c0.063,-0.17 0,-0.408 -0.202,-0.68 -0.201,-0.273 -0.542,-0.58 -1.043,-0.888 -0.368,-0.23 -0.574,-0.51 -0.67,-0.814 -0.097,-0.305 -0.084,-0.635 -0.01,-0.96 0.143,-0.625 0.51,-1.233 0.743,-1.614 0.063,-0.046 0.023,0.086 -0.236,0.567 -0.232,0.44 -0.667,1.455 -0.072,2.248 0.016,-0.564 0.15,-1.14 0.377,-1.677 0.329,-0.747 1.018,-2.041 1.072,-3.073 0.029,0.02 0.125,0.086 0.169,0.11 0.126,0.075 0.221,0.184 0.344,0.283a0.85,0.85 0,0 0,0.575 0.2c0.24,0 0.427,-0.079 0.582,-0.168 0.17,-0.096 0.304,-0.204 0.433,-0.245 0.27,-0.085 0.486,-0.235 0.608,-0.41 0.21,0.83 0.7,2.027 1.014,2.611 0.167,0.31 0.5,0.969 0.643,1.762 0.091,-0.002 0.191,0.01 0.299,0.038 0.375,-0.973 -0.319,-2.022 -0.636,-2.314 -0.128,-0.124 -0.135,-0.18 -0.07,-0.177 0.343,0.304 0.795,0.917 0.96,1.608 0.075,0.315 0.09,0.646 0.01,0.973 0.04,0.017 0.08,0.034 0.12,0.054 0.603,0.293 0.826,0.548 0.719,0.897z"
20+
android:fillColor="#ffffff"/>
21+
<path
22+
android:pathData="M8.04,8.062c-0.556,0.002 -1.099,0.251 -1.558,0.716 -0.46,0.464 -0.814,1.122 -1.018,1.888l0.061,0.038v0.004c0.47,0.298 0.805,0.598 1.012,0.878 0.219,0.296 0.316,0.584 0.223,0.834a0.513,0.513 0,0 1,-0.27 0.283l-0.041,0.015c0.074,0.097 0.146,0.197 0.213,0.3 0.944,0.628 2.042,0.396 2.867,-0.172 0.08,-0.278 0.153,-0.536 0.163,-0.698 0.021,-0.415 0.042,-0.792 0.124,-1.12 0.082,-0.33 0.242,-0.63 0.544,-0.795 0.017,-0.01 0.034,-0.015 0.051,-0.023a0.756,0.756 0,0 1,0.022 -0.094c-0.242,-0.622 -0.591,-1.14 -1.01,-1.5 -0.42,-0.36 -0.897,-0.551 -1.382,-0.554zM10.41,10.217l-0.002,0.005v-0.002l0.001,-0.004z"
23+
android:fillColor="#E6E6E6"/>
24+
<path
25+
android:pathData="M9.278,3.833a1.05,1.05 0,0 1,-0.215 0.656,4.119 4.119,0 0,0 -0.218,-0.09l-0.127,-0.045c0.029,-0.035 0.085,-0.075 0.107,-0.127a0.669,0.669 0,0 0,0.05 -0.243l0.001,-0.01a0.673,0.673 0,0 0,-0.035 -0.236,0.434 0.434,0 0,0 -0.108,-0.184 0.223,0.223 0,0 0,-0.156 -0.07H8.57a0.228,0.228 0,0 0,-0.151 0.06,0.434 0.434,0 0,0 -0.122,0.175 0.676,0.676 0,0 0,-0.05 0.243v0.01a0.718,0.718 0,0 0,0.009 0.14,1.773 1.773,0 0,0 -0.354,-0.12 1.196,1.196 0,0 1,-0.01 -0.133v-0.013a1.035,1.035 0,0 1,0.088 -0.447,0.793 0.793,0 0,1 0.25,-0.328 0.554,0.554 0,0 1,0.346 -0.123h0.006c0.125,0 0.232,0.036 0.342,0.116a0.78,0.78 0,0 1,0.257 0.324c0.063,0.138 0.094,0.273 0.097,0.433l0.001,0.012zM7.388,3.997a1.05,1.05 0,0 0,-0.277 0.125,0.623 0.623,0 0,0 0.002,-0.15v-0.008a0.651,0.651 0,0 0,-0.048 -0.192,0.37 0.37,0 0,0 -0.096,-0.141 0.158,0.158 0,0 0,-0.119 -0.045c-0.042,0.004 -0.077,0.024 -0.11,0.065a0.372,0.372 0,0 0,-0.07 0.156,0.626 0.626,0 0,0 -0.013,0.205v0.008a0.634,0.634 0,0 0,0.048 0.193,0.367 0.367,0 0,0 0.116,0.156l-0.102,0.08 -0.078,0.056a0.706,0.706 0,0 1,-0.16 -0.24c-0.053,-0.12 -0.082,-0.24 -0.09,-0.381v-0.001a1.071,1.071 0,0 1,0.045 -0.39,0.668 0.668,0 0,1 0.167,-0.292 0.359,0.359 0,0 1,0.264 -0.118c0.084,0 0.158,0.028 0.235,0.09a0.68,0.68 0,0 1,0.199 0.271c0.053,0.12 0.08,0.24 0.089,0.382v0.001c0.003,0.06 0.003,0.115 -0.002,0.17z"
26+
android:fillColor="#ffffff"/>
27+
<path
28+
android:pathData="M7.806,4.335c0.01,0.034 0.065,0.029 0.097,0.045 0.027,0.014 0.05,0.045 0.08,0.046 0.03,0.001 0.076,-0.01 0.08,-0.04 0.005,-0.038 -0.052,-0.063 -0.088,-0.077 -0.047,-0.019 -0.107,-0.028 -0.151,-0.003 -0.01,0.005 -0.021,0.018 -0.018,0.03zM7.484,4.335c-0.01,0.034 -0.065,0.029 -0.096,0.045 -0.028,0.014 -0.05,0.045 -0.081,0.046 -0.03,0.001 -0.076,-0.01 -0.08,-0.04 -0.005,-0.038 0.052,-0.063 0.088,-0.077 0.047,-0.019 0.108,-0.028 0.152,-0.003 0.01,0.005 0.02,0.018 0.017,0.03z"
29+
android:fillColor="#202020"/>
30+
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:viewportHeight="32" android:viewportWidth="32" android:width="32dp">
2+
3+
<path android:fillColor="#000000" android:pathData="M25.658,17.49c0.052,1.257 1.082,2.032 2.649,2.032 1.65,0 2.688,-0.812 2.688,-2.107 0,-1.016 -0.586,-1.587 -1.969,-1.903l-0.784,-0.18c-0.837,-0.197 -1.181,-0.462 -1.181,-0.916 0,-0.566 0.519,-0.945 1.29,-0.945 0.779,0 1.312,0.382 1.37,1.021h1.162c-0.029,-1.2 -1.021,-2.012 -2.523,-2.012 -1.483,0 -2.537,0.816 -2.537,2.024 0,0.975 0.596,1.578 1.852,1.867l0.884,0.207c0.86,0.204 1.208,0.487 1.208,0.977 0,0.567 -0.571,0.973 -1.393,0.973 -0.831,0 -1.458,-0.411 -1.535,-1.04zM21.932,13.518c1.213,0 1.988,0.962 1.988,2.484 0,1.516 -0.775,2.479 -1.987,2.479 -1.22,0 -1.989,-0.962 -1.989,-2.479 0,-1.521 0.77,-2.484 1.988,-2.484zM21.932,12.479c-0.032,-0.001 -0.07,-0.002 -0.108,-0.002 -1.74,0 -3.15,1.41 -3.15,3.15 0,0.133 0.008,0.263 0.024,0.391l-0.002,-0.015c-0.014,0.113 -0.022,0.243 -0.022,0.375 0,1.738 1.409,3.146 3.146,3.146 0.04,0 0.079,-0.001 0.119,-0.002l-0.006,0c0.032,0.001 0.07,0.002 0.107,0.002 1.737,0 3.144,-1.408 3.144,-3.144 0,-0.133 -0.008,-0.263 -0.024,-0.392l0.002,0.015c0.014,-0.113 0.023,-0.245 0.023,-0.378 0,-1.739 -1.409,-3.148 -3.148,-3.148 -0.037,0 -0.074,0.001 -0.11,0.002l0.005,-0zM18.301,16.186c-0.087,-1.065 -0.973,-1.896 -2.053,-1.896 -0.059,0 -0.117,0.002 -0.175,0.007l0.008,-0.001c-0.021,-0.001 -0.045,-0.001 -0.07,-0.001 -1.295,0 -2.344,1.05 -2.344,2.344 0,0.093 0.005,0.185 0.016,0.276l-0.001,-0.011c-0.01,0.082 -0.016,0.177 -0.016,0.273 0,1.287 1.043,2.33 2.33,2.33 0.033,0 0.067,-0.001 0.1,-0.002l-0.005,0c0.056,0.006 0.122,0.009 0.188,0.009 1.064,0 1.936,-0.817 2.026,-1.857l0.001,-0.008h-1.11c-0.067,0.515 -0.503,0.908 -1.03,0.908 -0.021,0 -0.043,-0.001 -0.064,-0.002l0.003,0c-0.746,0 -1.227,-0.604 -1.227,-1.652 0,-1.03 0.476,-1.653 1.218,-1.653 0.013,-0.001 0.028,-0.001 0.043,-0.001 0.541,0 0.988,0.406 1.052,0.931l0,0.005zM10.422,19.488c0.009,0 0.019,0 0.03,0 0.649,0 1.217,-0.349 1.525,-0.871l0.005,-0.008h0.022v0.799h1.135v-3.449c0,-1.005 -0.809,-1.662 -2.049,-1.662 -1.276,0 -2.074,0.671 -2.126,1.606h1.091c0.094,-0.4 0.447,-0.693 0.869,-0.693 0.042,0 0.083,0.003 0.123,0.008l-0.005,-0.001c0.58,0 0.935,0.302 0.935,0.827v0.359l-1.322,0.075c-1.22,0.076 -1.904,0.61 -1.904,1.498 0.008,0.84 0.69,1.517 1.531,1.517 0.05,0 0.099,-0.002 0.147,-0.007l-0.006,0zM10.777,18.601c-0.51,0 -0.85,-0.26 -0.85,-0.671 0,-0.397 0.325,-0.652 0.892,-0.69l1.157,-0.071v0.384c-0.034,0.588 -0.519,1.052 -1.112,1.052 -0.031,0 -0.062,-0.001 -0.092,-0.004l0.004,0zM1.004,19.408h1.176v-3.065c-0.002,-0.023 -0.003,-0.049 -0.003,-0.075 0,-0.534 0.432,-0.967 0.966,-0.968h0c0.018,-0.001 0.04,-0.002 0.062,-0.002 0.458,0 0.829,0.371 0.829,0.829 0,0.027 -0.001,0.053 -0.004,0.079l0,-0.003v3.207h1.143v-3.095c-0.002,-0.023 -0.003,-0.049 -0.003,-0.076 0,-0.519 0.42,-0.939 0.939,-0.939 0.007,0 0.013,0 0.02,0l-0.001,-0c0.018,-0.001 0.039,-0.002 0.06,-0.002 0.467,0 0.845,0.378 0.845,0.845 0,0.042 -0.003,0.083 -0.009,0.124l0.001,-0.005v3.147h1.175v-3.434c0.003,-0.034 0.004,-0.074 0.004,-0.114 0,-0.859 -0.696,-1.555 -1.555,-1.555 -0.029,0 -0.058,0.001 -0.086,0.002l0.004,-0c-0.019,-0.001 -0.04,-0.001 -0.062,-0.001 -0.673,0 -1.249,0.412 -1.492,0.996l-0.004,0.011h-0.029c-0.156,-0.585 -0.681,-1.009 -1.305,-1.009 -0.032,0 -0.064,0.001 -0.096,0.003l0.004,-0c-0.014,-0 -0.029,-0.001 -0.045,-0.001 -0.631,0 -1.169,0.397 -1.378,0.954l-0.003,0.01h-0.024v-0.869h-1.128v5.007z"/>
4+
5+
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:viewportHeight="24" android:viewportWidth="24" android:width="32dp">
2+
3+
<path android:fillColor="#000000" android:pathData="M2,12.5v6.7l8.1,1.2v-7.9M10.1,3.7L2,4.9v6.7h8.1M21.9,11.5V2L11.1,3.6v8M11.1,20.5L21.9,22v-9.5H11.1"/>
4+
5+
</vector>

feature/home/presentation/src/commonMain/kotlin/zed/rainxch/home/presentation/HomeAction.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package zed.rainxch.home.presentation
22

33
import zed.rainxch.core.presentation.model.GithubRepoSummaryUi
44
import zed.rainxch.home.domain.model.HomeCategory
5+
import zed.rainxch.home.domain.model.HomePlatform
56

67
sealed interface HomeAction {
78
data object Refresh : HomeAction
@@ -16,6 +17,8 @@ sealed interface HomeAction {
1617

1718
data object OnAppsClick : HomeAction
1819

20+
data object OnTogglePlatformPopup : HomeAction
21+
1922
data class OnShareClick(
2023
val repo: GithubRepoSummaryUi,
2124
) : HomeAction
@@ -24,6 +27,10 @@ sealed interface HomeAction {
2427
val category: HomeCategory,
2528
) : HomeAction
2629

30+
data class SwitchFilterPlatform(
31+
val platform: HomePlatform,
32+
) : HomeAction
33+
2734
data class OnRepositoryClick(
2835
val repo: GithubRepoSummaryUi,
2936
) : HomeAction

0 commit comments

Comments
 (0)