[
  {
    "path": ".github/FUNDING.yml",
    "content": "ko_fi: jnthnkl\n"
  },
  {
    "path": ".github/workflows/android.yml",
    "content": "name: Android CI\n\non:\n  push:\n    branches: [ \"main\" ]\n  pull_request:\n    branches: [ \"main\" ]\n\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v3\n    - name: set up JDK 17\n      uses: actions/setup-java@v3\n      with:\n        java-version: '17'\n        distribution: 'temurin'\n        cache: gradle\n\n    - name: Grant execute permission for gradlew\n      run: chmod +x gradlew\n    - name: Build and checks with Gradle\n      run: ./gradlew detekt assembleRelease testRelease --parallel\n"
  },
  {
    "path": ".github/workflows/jekyll-gh-pages.yml",
    "content": "# Sample workflow for building and deploying a Jekyll site to GitHub Pages\nname: Deploy Jekyll with GitHub Pages dependencies preinstalled\n\non:\n  # Runs on pushes targeting the default branch\n  push:\n    branches: [\"main\"]\n\n  # Allows you to run this workflow manually from the Actions tab\n  workflow_dispatch:\n\n# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages\npermissions:\n  contents: read\n  pages: write\n  id-token: write\n\n# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.\n# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.\nconcurrency:\n  group: \"pages\"\n  cancel-in-progress: false\n\njobs:\n  # Build job\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Setup Pages\n        uses: actions/configure-pages@v5\n      - name: Build with Jekyll\n        uses: actions/jekyll-build-pages@v1\n        with:\n          source: ./\n          destination: ./_site\n      - name: Upload artifact\n        uses: actions/upload-pages-artifact@v3\n\n  # Deployment job\n  deploy:\n    environment:\n      name: github-pages\n      url: ${{ steps.deployment.outputs.page_url }}\n    runs-on: ubuntu-latest\n    needs: build\n    steps:\n      - name: Deploy to GitHub Pages\n        id: deployment\n        uses: actions/deploy-pages@v4\n"
  },
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n/.idea/*\n.DS_Store\n**/build\n/captures\n.externalNativeBuild\n.cxx\nlocal.properties\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "<p align=\"left\"><img src=\"https://raw.githubusercontent.com/jonathanklee/Sapio/main/app/src/main/icon.png\" width=\"200\"/></p>\n\n# Sapio\n\nSapio is the anagram of Open Source API.\n\nSapio provides the compatibility of an Android application running on a device without Google Play Services (i.e. deGoogled bare Android Open Source Project (AOSP) devices, coupled or not with microG).\n\nSapio can serve as a lobbying tool by sharing compatibility on social media to raise awareness among app developers about respecting users' personal data.\n\nEvaluations in Sapio are given to the community by the community.\n\n[<img src=\"https://fdroid.gitlab.io/artwork/badge/get-it-on.png\" alt=\"Get it on F-Droid\" height=\"80\">](https://f-droid.org/packages/com.klee.sapio/) [<img src=\"https://raw.githubusercontent.com/jonathanklee/Sapio/main/ghbadge.png\" alt=\"Get it on GitHub\" height=\"80\">](https://github.com/jonathanklee/Sapio/releases)\n\n<p><img src=\"https://raw.githubusercontent.com/jonathanklee/Sapio/main/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png\" width=\"200\"/>&nbsp;&nbsp;<img src=\"https://raw.githubusercontent.com/jonathanklee/Sapio/main/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png\" width=\"200\"/>&nbsp;&nbsp;<img src=\"https://raw.githubusercontent.com/jonathanklee/Sapio/main/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png\" width=\"200\"/></p>\n\n# Rating\n\n🟢 The app works perfectly without Google Play Services\n\n🟡 The app works partially: at least one feature (notifications, in-app purchases, login methods etc) does not work without Google Play Services\n\n🔴 The app does not work at all or crashes without Google Play Services\n\n**bareAOSP** The device is a bare AOSP device \n\n**microG** The device has microG installed\n\n**secure** The device is considered secured\n\n**unsafe** The device is considered unsafe\n\n# 🔨 Build\n## Get the sources\n\n```\ngit clone git@github.com:jonathanklee/Sapio.git\n```\n## Build Sapio\n```\ncd Sapio\n./gradlew assembleDebug\n````\n# 📱 Install\n```\nadb install ./app/build/outputs/apk/debug/app-debug.apk\n```\n\n# 🌍 Public API\n\n## Base url\n```\nhttps://server.sapio.ovh/api\n```\n## Endpoints\n\n### List evaluations\n\n- Endpoint: /sapio-applications\n- Method: GET\n- Description: List evaluations\n- Parameters: https://docs.strapi.io/dev-docs/api/rest/parameters\n- Result:\n    - https://docs.strapi.io/dev-docs/api/rest#requests\n    - attributes:\n        - microg: 1 for microG, 2 for bareAOSP\n        - secure: 3 for secure, 4 for unsafe\n        - rating: 1 for green, 2 for yellow, 3 for red\n- Example: Get the latest 100 evaluations\n\n```\ncurl -X GET \"https://server.sapio.ovh/api/sapio-applications?pagination\\[pageSize\\]=100&sort=updatedAt:Desc\"\n```\n\n### Search evaluations\n\n- Endpoint: /sapio-applications\n- Method: GET\n- Description: Search evaluations\n- Parameters: https://docs.strapi.io/dev-docs/api/rest/filters-locale-publication#filtering\n- Result:\n    - https://docs.strapi.io/dev-docs/api/rest#requests\n    - attributes:\n        - microg: 1 for microG, 2 for bareAOSP\n        - secure: 3 for secure, 4 for unsafe\n        - rating: 1 for green, 2 for yellow, 3 for red\n- Example: Search evaluations for an app called ChatGPT\n ```\n curl -X GET \"https://server.sapio.ovh/api/sapio-applications?filters\\[name\\]\\[\\$eq\\]=ChatGPT\"\n ```\n\n### Get icons\n\n- Endpoint: /upload/files\n- Method: GET\n- Description: Get icons\n- Parameters: https://docs.strapi.io/dev-docs/api/rest/parameters\n- Example: Get ChatGPT icon\n ```\ncurl -X GET \"https://server.sapio.ovh/api/upload/files?filters\\[name\\]\\[\\$eq\\]=com.openai.chatgpt.png\"\n ```\n# ⚠️ Disclaimer\n\nEvaluations are community-contributed and may be inaccurate, incomplete, or device-specific. Sapio and its maintainers are not responsible for any issues arising from relying on these evaluations.\n\n# ☕ Coffee\n\nIf you want to offer me a coffee for the maintenance of the server part:\n\n<a href='https://ko-fi.com/Y8Y5191O6Z' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi6.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>\n\n# 👏 Credits\n\n<a href=\"https://www.flaticon.com/free-icons/brain\" title=\"brain icons\">Brain icons created by Freepik - Flaticon</a>\n\n<a href=\"https://www.flaticon.com/free-icons/search\" title=\"search icons\">Search icons created by Smashicons - Flaticon</a>\n"
  },
  {
    "path": "app/.gitignore",
    "content": "/build"
  },
  {
    "path": "app/build.gradle",
    "content": "plugins {\n    id 'com.android.application'\n    id 'org.jetbrains.kotlin.android'\n    id 'kotlin-parcelize'\n    id 'kotlin-kapt'\n    id 'dagger.hilt.android.plugin'\n    alias libs.plugins.compose.compiler\n    id 'jacoco'\n}\n\nandroid {\n    compileSdk 36\n\n    defaultConfig {\n        applicationId \"com.klee.sapio\"\n        minSdk 21\n        targetSdk 35\n        versionCode 85\n        versionName \"2.2.3\"\n\n        testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"\n    }\n\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'\n        }\n    }\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_17\n        targetCompatibility JavaVersion.VERSION_17\n    }\n    kotlinOptions {\n        jvmTarget = '17'\n    }\n\n    testOptions {\n        unitTests.returnDefaultValues = true\n    }\n\n    buildFeatures {\n        viewBinding = true\n        compose = true\n    }\n    namespace 'com.klee.sapio'\n}\n\njacoco {\n    toolVersion = \"0.8.13\"\n    reportsDirectory = layout.buildDirectory.dir(\"jacocoReports\")\n}\n\n// Ensure jacoco agent instruments all JVM unit tests (including Robolectric).\ntasks.withType(Test).configureEach {\n    jacoco.includeNoLocationClasses = true\n    jacoco.excludes += ['jdk.internal.*']\n}\n\ntasks.register(\"jacocoTestReport\", JacocoReport) {\n    dependsOn tasks.test\n\n    reports {\n        xml.required = true\n        html.required = true\n    }\n\n    def fileFilter = [\n            '**/R.class',\n            '**/R$*.class',\n            '**/BuildConfig.*',\n            '**/Manifest*.*',\n            '**/*Test*.*',\n            '**/android/**/*.*',\n            '**/androidTest/**/*.*',\n            '**/test/**/*.*',\n            '**/*$ViewInjector*.*',\n            '**/*$ViewBinder*.*',\n            '**/databinding/**/*.*'\n    ]\n\n    // Kotlin and Java classes live in different intermediate folders with AGP 8+.\n    def kotlinDebugTree = fileTree(\n            dir: \"${project.buildDir}/tmp/kotlin-classes/debug\",\n            excludes: fileFilter\n    )\n    def javaDebugTree = fileTree(\n            dir: \"${project.buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes\",\n            excludes: fileFilter\n    )\n    def mainSrc = [\n            \"${project.projectDir}/src/main/java\",\n            \"${project.projectDir}/src/main/kotlin\"\n    ]\n\n    sourceDirectories.from = files(mainSrc)\n    classDirectories.from = files([kotlinDebugTree, javaDebugTree])\n    executionData.from = fileTree(dir: \"${project.buildDir}\", includes: [\"**/*.exec\", \"**/*.ec\"])\n}\n\ntasks.register(\"jacocoTestCoverageVerification\", JacocoCoverageVerification) {\n    dependsOn tasks.jacocoTestReport\n\n    violationRules {\n        rule {\n            limit {\n                minimum = 0.5 // 50% coverage minimum\n            }\n        }\n    }\n}\n\ndependencies {\n\n    implementation project(':domain')\n    implementation project(':data')\n\n    implementation libs.androidx.core.ktx\n    implementation libs.androidx.appcompat\n    implementation libs.material\n    implementation libs.androidx.constraintlayout\n\n    implementation libs.glide\n    implementation libs.coil.compose\n    implementation libs.coil.network.okhttp\n\n    implementation libs.kotlinx.coroutines.android\n    implementation libs.androidx.navigation.fragment.ktx\n    implementation libs.androidx.navigation.ui.ktx\n    implementation libs.androidx.recyclerview\n    implementation libs.room.runtime\n    implementation libs.room.ktx\n    kapt libs.room.compiler\n\n    // hilt\n    implementation libs.hilt.android\n    implementation libs.androidx.runner\n    implementation libs.androidx.material3.android\n    kapt libs.hilt.compiler\n    testImplementation libs.hilt.android.testing\n\n    implementation libs.androidx.emoji2\n    implementation libs.androidx.emoji2.views\n    implementation libs.androidx.emoji2.views.helper\n\n    implementation libs.rootbeer.lib\n\n    testImplementation libs.junit\n    testImplementation libs.mockito.core\n    testImplementation libs.mockito.inline\n    testImplementation libs.robolectric\n    testImplementation libs.kotlinx.coroutines.test\n    testImplementation libs.androidx.arch.core.testing\n\n    androidTestImplementation libs.mockito.android\n    androidTestImplementation libs.androidx.junit\n    androidTestImplementation libs.androidx.espresso.core\n\n    // retrofit\n    implementation libs.retrofit\n    implementation libs.converter.jackson\n    implementation libs.logging.interceptor\n    implementation libs.retrofit2.kotlin.coroutines.adapter\n\n    implementation libs.circleimageview\n\n    implementation libs.androidx.swiperefreshlayout\n\n    // splashscreen\n    implementation libs.androidx.core.splashscreen\n    // preferences\n    implementation libs.androidx.preference.ktx\n\n    // workmanager\n    implementation libs.androidx.work.runtime.ktx\n\n    // lottie\n    implementation libs.lottie\n\n    // compose\n    implementation platform(libs.androidx.compose.bom)\n    implementation(libs.androidx.foundation)\n    implementation libs.androidx.ui\n    implementation libs.androidx.ui.tooling.preview\n    implementation libs.androidx.activity.compose\n    debugImplementation libs.androidx.ui.tooling\n}\n"
  },
  {
    "path": "app/detekt-baseline.xml",
    "content": "<?xml version=\"1.0\" ?>\n<SmellBaseline>\n  <ManuallySuppressedIssues></ManuallySuppressedIssues>\n  <CurrentIssues>\n    <ID>LoopWithTooManyJumpStatements:DeviceConfiguration.kt$DeviceConfiguration$for</ID>\n    <ID>TooManyFunctions:EvaluationRepository.kt$EvaluationRepository</ID>\n    <ID>TooManyFunctions:EvaluationRepositoryImpl.kt$EvaluationRepositoryImpl : EvaluationRepository</ID>\n  </CurrentIssues>\n</SmellBaseline>\n"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguardFiles setting in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n\n# Uncomment this to preserve the line number information for\n# debugging stack traces.\n#-keepattributes SourceFile,LineNumberTable\n\n# If you keep the line number information, uncomment this to\n# hide the original source file name.\n#-renamesourcefileattribute SourceFile"
  },
  {
    "path": "app/src/androidTest/java/com/klee/sapio/ExampleInstrumentedTest.kt",
    "content": "package com.klee.sapio\n\nimport androidx.test.ext.junit.runners.AndroidJUnit4\nimport androidx.test.platform.app.InstrumentationRegistry\nimport junit.framework.TestCase.assertEquals\nimport org.junit.runner.RunWith\nimport org.junit.Test\n\n/**\n * Instrumented test, which will execute on an Android device.\n *\n * See [testing documentation](http://d.android.com/tools/testing).\n */\n@RunWith(AndroidJUnit4::class)\nclass ExampleInstrumentedTest {\n    @Test\n    fun useAppContext() {\n        // Context of the app under test.\n        val appContext = InstrumentationRegistry.getInstrumentation().targetContext\n        assertEquals(\"com.klee.sapio\", appContext.packageName)\n    }\n}\n"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\">\n\n    <uses-permission android:name=\"android.permission.INTERNET\" />\n    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n    <uses-permission android:name=\"android.permission.POST_NOTIFICATIONS\" />\n    <uses-permission android:name=\"android.permission.QUERY_ALL_PACKAGES\" tools:ignore=\"QueryAllPackagesPermission\" />\n\n    <application\n        android:name=\".SapioApplication\"\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:roundIcon=\"@mipmap/ic_launcher_round\"\n        android:supportsRtl=\"true\">\n        <activity\n            android:name=\".ui.view.SplashActivity\"\n            android:theme=\"@style/Theme.Sapio.NoActionBar\"\n            android:screenOrientation=\"portrait\"\n            android:exported=\"true\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".ui.view.MainActivity\"\n            android:screenOrientation=\"portrait\"\n            android:theme=\"@style/Theme.Sapio.NoActionBar\"\n            android:windowSoftInputMode=\"adjustResize\"\n            android:exported=\"true\">\n        </activity>\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/SapioApplication.kt",
    "content": "package com.klee.sapio\n\nimport android.app.Application\nimport com.google.android.material.color.DynamicColors\nimport com.klee.sapio.work.CompatibilityCheckScheduler\nimport dagger.hilt.android.HiltAndroidApp\n\n@HiltAndroidApp\nclass SapioApplication : Application() {\n\n    override fun onCreate() {\n        super.onCreate()\n        DynamicColors.applyToActivitiesIfAvailable(this)\n        CompatibilityCheckScheduler.schedule(this)\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/model/InstalledAppWithRating.kt",
    "content": "package com.klee.sapio.ui.model\n\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.InstalledApplication\n\ndata class InstalledAppWithRating(\n    val installedApp: InstalledApplication,\n    val evaluation: Evaluation?\n)\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/model/Label.kt",
    "content": "package com.klee.sapio.ui.model\n\nimport android.content.Context\nimport android.os.Build\nimport androidx.annotation.RequiresApi\nimport com.klee.sapio.R\nimport com.klee.sapio.domain.model.GmsType\nimport com.klee.sapio.domain.model.UserType\n\ndata class Label(val text: String, val color: Int) {\n\n    companion object {\n        const val MICROG = GmsType.MICROG\n        const val BARE_AOSP = GmsType.BARE_AOSP\n        const val SECURE = UserType.SECURE\n        const val UNSAFE = UserType.UNSAFE\n\n        @RequiresApi(Build.VERSION_CODES.M)\n        fun create(context: Context, label: Int): Label {\n            return when (label) {\n                MICROG -> Label(\n                    context.getString(R.string.microg_label),\n                    context.getColor(R.color.blue_200)\n                )\n                BARE_AOSP -> Label(\n                    context.getString(R.string.bare_aosp_label),\n                    context.getColor(R.color.blue_700)\n                )\n                SECURE -> Label(\n                    context.getString(R.string.secure_label),\n                    context.getColor(R.color.purple_200)\n                )\n                UNSAFE -> Label(\n                    context.getString(R.string.unsafe_label),\n                    context.getColor(R.color.purple_700)\n                )\n                else -> Label(\" Empty label \", context.getColor(R.color.black))\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/model/Rating.kt",
    "content": "package com.klee.sapio.ui.model\n\nimport com.klee.sapio.R\n\ndata class Rating(val value: Int, val drawable: Int, val text: String) {\n\n    companion object {\n\n        const val GOOD = 1\n        const val AVERAGE = 2\n        const val BAD = 3\n\n        const val GREEN_CIRCLE_EMOJI = 0x1F7E2\n        const val YELLOW_CIRCLE_EMOJI = 0x1F7E1\n        const val RED_CIRCLE_EMOJI = 0x1F534\n\n        fun create(rating: Int): Rating {\n            return when (rating) {\n                GOOD -> Rating(GOOD, R.drawable.ic_status_green, String(Character.toChars(GREEN_CIRCLE_EMOJI)))\n                AVERAGE -> Rating(AVERAGE, R.drawable.ic_status_yellow, String(Character.toChars(YELLOW_CIRCLE_EMOJI)))\n                BAD -> Rating(BAD, R.drawable.ic_status_red, String(Character.toChars(RED_CIRCLE_EMOJI)))\n                else -> Rating(BAD, R.drawable.ic_status_red, String(Character.toChars(RED_CIRCLE_EMOJI)))\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/model/SharedEvaluation.kt",
    "content": "package com.klee.sapio.ui.model\n\nimport android.graphics.Bitmap\n\ndata class SharedEvaluation(\n    val name: String,\n    val packageName: String,\n    val icon: Bitmap,\n    val ratingMicrog: Int,\n    val ratingBareAOSP: Int\n)\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/state/AppEvaluationsUiState.kt",
    "content": "package com.klee.sapio.ui.state\n\nimport com.klee.sapio.domain.model.Evaluation\n\ndata class AppEvaluationsUiState(\n    val microgUser: Evaluation? = null,\n    val microgRoot: Evaluation? = null,\n    val bareAospUser: Evaluation? = null,\n    val bareAospRoot: Evaluation? = null,\n    val iconUrl: String? = null,\n    val pendingCount: Int = 0,\n    val hasError: Boolean = false\n) {\n    val isFullyLoaded: Boolean get() = pendingCount == 0\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/state/ChooseAppUiState.kt",
    "content": "package com.klee.sapio.ui.state\n\nimport com.klee.sapio.domain.model.InstalledApplication\n\ndata class ChooseAppUiState(\n    val apps: List<InstalledApplication> = emptyList(),\n    val isLoading: Boolean = true\n)\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/state/EvaluateUiState.kt",
    "content": "package com.klee.sapio.ui.state\n\ndata class EvaluateUiState(\n    val gmsType: Int,\n    val userType: Int\n)\n\nsealed class EvaluateEvent {\n    data class NavigateToSuccess(val packageName: String, val appName: String) : EvaluateEvent()\n    object ShowError : EvaluateEvent()\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/state/FeedUiState.kt",
    "content": "package com.klee.sapio.ui.state\n\nimport com.klee.sapio.domain.model.Evaluation\n\ndata class FeedUiState(\n    val items: List<Evaluation> = emptyList(),\n    val isLoading: Boolean = false,\n    val isLoadingMore: Boolean = false,\n    val hasError: Boolean = false\n)\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/state/MyAppsUiState.kt",
    "content": "package com.klee.sapio.ui.state\n\nimport com.klee.sapio.ui.model.InstalledAppWithRating\n\ndata class MyAppsUiState(\n    val items: List<InstalledAppWithRating> = emptyList(),\n    val isLoading: Boolean = false,\n    val isRefreshing: Boolean = false,\n    val progress: Int = 0\n)\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/state/SearchUiState.kt",
    "content": "package com.klee.sapio.ui.state\n\nimport com.klee.sapio.domain.model.Evaluation\n\ndata class SearchUiState(\n    val query: String = \"\",\n    val items: List<Evaluation> = emptyList(),\n    val isLoading: Boolean = false,\n    val hasError: Boolean = false\n)\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/AboutFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.os.Build\nimport android.os.Bundle\nimport android.text.Html\nimport android.text.method.LinkMovementMethod\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.fragment.app.Fragment\nimport com.klee.sapio.BuildConfig\nimport com.klee.sapio.R\nimport com.klee.sapio.databinding.FragmentAboutBinding\n\nclass AboutFragment : Fragment() {\n\n    companion object {\n        const val RATING_RULES = \"https://github.com/jonathanklee/Sapio?tab=readme-ov-file#rating\"\n        const val GITHUB_URL = \"https://github.com/jonathanklee/Sapio\"\n    }\n\n    private var _binding: FragmentAboutBinding? = null\n    private val mBinding get() = _binding!!\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        _binding = FragmentAboutBinding.inflate(inflater, container, false)\n        return mBinding.root\n    }\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n        mBinding.version.text = \"v${BuildConfig.VERSION_NAME}\"\n        mBinding.ratingRules.text = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\n            Html.fromHtml(getString(R.string.rating_rules, RATING_RULES), Html.FROM_HTML_MODE_COMPACT)\n        } else {\n            @Suppress(\"DEPRECATION\")\n            Html.fromHtml(getString(R.string.rating_rules, RATING_RULES))\n        }\n        mBinding.ratingRules.movementMethod = LinkMovementMethod.getInstance()\n    }\n\n    override fun onDestroyView() {\n        super.onDestroyView()\n        _binding = null\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/ChooseAppAdapter.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.pm.PackageManager\nimport android.os.Build\nimport android.view.LayoutInflater\nimport android.view.ViewGroup\nimport androidx.recyclerview.widget.DiffUtil\nimport androidx.recyclerview.widget.ListAdapter\nimport androidx.recyclerview.widget.RecyclerView\nimport com.klee.sapio.databinding.ChooseAppCardBinding\nimport com.klee.sapio.domain.model.InstalledApplication\n\nclass ChooseAppAdapter(\n    private val onAppClicked: (InstalledApplication) -> Unit\n) : ListAdapter<InstalledApplication, ChooseAppAdapter.ViewHolder>(DIFF_CALLBACK) {\n\n    inner class ViewHolder(val binding: ChooseAppCardBinding) :\n        RecyclerView.ViewHolder(binding.root) {\n\n        fun bind(app: InstalledApplication) {\n            binding.appName.text = app.name\n            try {\n                val pm = binding.root.context.packageManager\n                val appInfo = pm.getApplicationInfo(app.packageName, 0)\n                val icon = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {\n                    appInfo.loadUnbadgedIcon(pm)\n                } else {\n                    appInfo.loadIcon(pm)\n                }\n                binding.appIcon.setImageDrawable(icon)\n            } catch (e: PackageManager.NameNotFoundException) {\n                // leave default icon\n            }\n            binding.root.setOnClickListener { onAppClicked(app) }\n            binding.appIcon.setOnClickListener { onAppClicked(app) }\n        }\n    }\n\n    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {\n        val binding = ChooseAppCardBinding.inflate(LayoutInflater.from(parent.context), parent, false)\n        return ViewHolder(binding)\n    }\n\n    override fun onBindViewHolder(holder: ViewHolder, position: Int) {\n        holder.bind(getItem(position))\n    }\n\n    companion object {\n        private val DIFF_CALLBACK = object : DiffUtil.ItemCallback<InstalledApplication>() {\n            override fun areItemsTheSame(old: InstalledApplication, new: InstalledApplication) =\n                old.packageName == new.packageName\n            override fun areContentsTheSame(old: InstalledApplication, new: InstalledApplication) =\n                old == new\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/ChooseAppDialog.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.DialogInterface\nimport android.graphics.Color\nimport android.graphics.drawable.ColorDrawable\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.fragment.app.DialogFragment\nimport androidx.lifecycle.Lifecycle\nimport androidx.lifecycle.lifecycleScope\nimport androidx.lifecycle.repeatOnLifecycle\nimport androidx.recyclerview.widget.LinearLayoutManager\nimport androidx.recyclerview.widget.RecyclerView\nimport com.klee.sapio.databinding.DialogChooseAppBinding\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.ui.state.ChooseAppUiState\nimport kotlinx.coroutines.flow.StateFlow\nimport kotlinx.coroutines.launch\n\nclass ChooseAppDialog(\n    private val uiState: StateFlow<ChooseAppUiState>,\n    private val onAppSelected: (InstalledApplication) -> Unit,\n    private val onDismissed: (() -> Unit)? = null\n) : DialogFragment() {\n\n    private lateinit var mBinding: DialogChooseAppBinding\n    private var hasSelection = false\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        mBinding = DialogChooseAppBinding.inflate(layoutInflater)\n        return mBinding.root\n    }\n\n    override fun onStart() {\n        super.onStart()\n        val width = (resources.displayMetrics.widthPixels * DIALOG_WIDTH_RATIO).toInt()\n        dialog?.window?.setLayout(width, ViewGroup.LayoutParams.WRAP_CONTENT)\n    }\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n        dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))\n\n        val recyclerView = mBinding.recyclerView\n        recyclerView.layoutManager = LinearLayoutManager(requireActivity(), RecyclerView.VERTICAL, false)\n\n        val adapter = ChooseAppAdapter { app ->\n            hasSelection = true\n            dismiss()\n            onAppSelected(app)\n        }\n        recyclerView.adapter = adapter\n\n        viewLifecycleOwner.lifecycleScope.launch {\n            viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {\n                uiState.collect { state ->\n                    if (state.apps.isNotEmpty()) {\n                        mBinding.progressBar.visibility = View.GONE\n                        recyclerView.visibility = View.VISIBLE\n                    }\n                    adapter.submitList(state.apps)\n                }\n            }\n        }\n    }\n\n    override fun onCancel(dialog: DialogInterface) {\n        super.onCancel(dialog)\n        if (!hasSelection) {\n            onDismissed?.invoke()\n        }\n    }\n\n    override fun onDismiss(dialog: DialogInterface) {\n        super.onDismiss(dialog)\n        if (!hasSelection) {\n            onDismissed?.invoke()\n        }\n    }\n\n    companion object {\n        private const val DIALOG_WIDTH_RATIO = 0.75\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/ChooseAppFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.core.os.bundleOf\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.activityViewModels\nimport androidx.navigation.fragment.findNavController\nimport com.klee.sapio.R\nimport com.klee.sapio.databinding.FragmentChooseAppBinding\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.ui.viewmodel.ChooseAppViewModel\nimport dagger.hilt.android.AndroidEntryPoint\n\n@AndroidEntryPoint\nclass ChooseAppFragment : Fragment() {\n\n    private lateinit var mBinding: FragmentChooseAppBinding\n    private var mApp: InstalledApplication? = null\n    val viewModel: ChooseAppViewModel by activityViewModels()\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        mBinding = FragmentChooseAppBinding.inflate(inflater, container, false)\n        mBinding.chooseAppButton.setOnClickListener { onChooseButtonClicked() }\n\n        mBinding.nextButton.isEnabled = false\n        mBinding.nextButton.setOnClickListener { onNextButtonClicked() }\n        mBinding.backButton.setOnClickListener {\n            findNavController().navigate(R.id.action_chooseAppFragment_to_warningFragment)\n        }\n\n        return mBinding.root\n    }\n\n    private fun onChooseButtonClicked() {\n        mBinding.chooseAppButton.isEnabled = false\n        mBinding.nextButton.isEnabled = false\n        val dialog = ChooseAppDialog(\n            uiState = viewModel.uiState,\n            onAppSelected = { chosenApp ->\n                mBinding.appName.text = chosenApp.name\n                mApp = chosenApp\n                mBinding.nextButton.isEnabled = true\n                mBinding.chooseAppButton.isEnabled = true\n            },\n            onDismissed = {\n                mBinding.chooseAppButton.isEnabled = true\n            }\n        )\n        dialog.show(parentFragmentManager, \"\")\n    }\n\n    private fun onNextButtonClicked() {\n        val bundle = bundleOf(\n            \"package\" to mApp?.packageName,\n            \"name\" to mApp?.name\n        )\n\n        findNavController().navigate(R.id.action_chooseAppFragment_to_evaluateFragment, bundle)\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/Color.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport androidx.compose.ui.graphics.Color\n\nval Blue200 = Color(0xFF90CAF9)\nval Blue700 = Color(0xFF1976D2)\nval Gray = Color(0xFF212121)\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/ContributeFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.fragment.app.Fragment\nimport com.klee.sapio.databinding.FragmentContributeBinding\n\nclass ContributeFragment : Fragment() {\n\n    private lateinit var mBinding: FragmentContributeBinding\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        mBinding = FragmentContributeBinding.inflate(inflater, container, false)\n        return mBinding.root\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/EvaluateFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.res.ColorStateList\nimport android.os.Build\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport android.widget.RadioButton\nimport androidx.annotation.RequiresApi\nimport androidx.core.os.bundleOf\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.viewModels\nimport androidx.navigation.fragment.findNavController\nimport com.klee.sapio.R\nimport com.klee.sapio.databinding.FragmentEvaluateBinding\nimport com.klee.sapio.ui.model.Label\nimport com.klee.sapio.ui.model.Rating\nimport com.klee.sapio.ui.viewmodel.EvaluateViewModel\nimport dagger.hilt.android.AndroidEntryPoint\n\n@AndroidEntryPoint\nclass EvaluateFragment : Fragment() {\n\n    companion object {\n        const val NOT_EXISTING = -1\n    }\n\n    private val mViewModel by viewModels<EvaluateViewModel>()\n    private lateinit var mBinding: FragmentEvaluateBinding\n\n    @RequiresApi(Build.VERSION_CODES.M)\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        mBinding = FragmentEvaluateBinding.inflate(inflater, container, false)\n\n        val packageName = arguments?.getString(\"package\").orEmpty()\n        val appName = arguments?.getString(\"name\").orEmpty()\n\n        val state = mViewModel.uiState.value\n        val microgLabel = Label.create(requireContext(), state.gmsType)\n        mBinding.microgConfiguration.text = microgLabel.text\n        mBinding.microgConfiguration.backgroundTintList = ColorStateList.valueOf(microgLabel.color)\n\n        val isRootedLabel = Label.create(requireContext(), state.userType)\n        mBinding.secureConfiguration.text = isRootedLabel.text\n        mBinding.secureConfiguration.backgroundTintList = ColorStateList.valueOf(isRootedLabel.color)\n\n        mBinding.validateButton.isEnabled = false\n        mBinding.note.setOnCheckedChangeListener { _, _ ->\n            updateButtonState()\n        }\n\n        mBinding.validateButton.setOnClickListener {\n            val rating = getRatingFromRadioId(mBinding.note.checkedRadioButtonId, requireView())\n            val bundle = bundleOf(\"package\" to packageName, \"name\" to appName, \"rating\" to rating)\n            findNavController().navigate(R.id.action_evaluateFragment_to_loadingFragment, bundle)\n        }\n\n        mBinding.backButton.setOnClickListener {\n            findNavController().navigate(R.id.action_evaluateFragment_to_chooseAppFragment)\n        }\n\n        return mBinding.root\n    }\n\n    private fun updateButtonState() {\n        val radioSelected = mBinding.note.checkedRadioButtonId != -1\n        mBinding.validateButton.isEnabled = radioSelected\n    }\n\n    private fun getRatingFromRadioId(id: Int, view: View): Int {\n        val radioButton: RadioButton = view.findViewById(id)\n        return when (radioButton.text) {\n            getString(R.string.works_perfectly) -> Rating.GOOD\n            getString(R.string.works_partially) -> Rating.AVERAGE\n            getString(R.string.dont_work) -> Rating.BAD\n            else -> 0\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/EvaluationsFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.app.NotificationManager\nimport android.content.ContentValues\nimport android.content.Context\nimport android.content.Intent\nimport android.graphics.Bitmap\nimport android.graphics.Canvas\nimport android.graphics.drawable.Drawable\nimport android.net.Uri\nimport android.os.Build\nimport android.os.Bundle\nimport android.os.Environment\nimport android.provider.MediaStore.Images.Media\nimport android.util.Log\nimport android.util.TypedValue\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.activity.result.ActivityResultLauncher\nimport androidx.activity.result.contract.ActivityResultContracts\nimport androidx.annotation.RequiresApi\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.platform.ComposeView\nimport androidx.core.graphics.createBitmap\nimport androidx.core.view.isVisible\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.activityViewModels\nimport androidx.lifecycle.lifecycleScope\nimport com.bumptech.glide.Glide\nimport com.bumptech.glide.load.DataSource\nimport com.bumptech.glide.load.engine.GlideException\nimport com.bumptech.glide.request.RequestListener\nimport com.bumptech.glide.request.target.CustomTarget\nimport com.bumptech.glide.request.target.Target\nimport com.bumptech.glide.request.transition.Transition\nimport com.klee.sapio.R\nimport com.klee.sapio.databinding.FragmentEvaluationsBinding\nimport com.klee.sapio.domain.AppSettings\nimport com.klee.sapio.ui.model.Rating\nimport com.klee.sapio.ui.model.SharedEvaluation\nimport com.klee.sapio.ui.viewmodel.AppEvaluationsViewModel\nimport dagger.hilt.android.AndroidEntryPoint\nimport kotlinx.coroutines.flow.filter\nimport kotlinx.coroutines.flow.launchIn\nimport kotlinx.coroutines.flow.onEach\nimport kotlinx.coroutines.launch\nimport kotlinx.coroutines.suspendCancellableCoroutine\nimport java.io.IOException\nimport java.text.DateFormat\nimport javax.inject.Inject\nimport kotlin.coroutines.resume\nimport kotlin.coroutines.resumeWithException\n\n@AndroidEntryPoint\nclass EvaluationsFragment : Fragment() {\n\n    @Inject\n    lateinit var settings: AppSettings\n\n    private var _binding: FragmentEvaluationsBinding? = null\n    private val mBinding get() = _binding!!\n    private val mViewModel by activityViewModels<AppEvaluationsViewModel>()\n\n    private lateinit var shareLauncher: ActivityResultLauncher<Intent>\n\n    private var shareImage: Uri? = null\n    private var iconReady = false\n\n    companion object {\n        const val TAG = \"EvaluationsFragment\"\nconst val COMPRESSION_QUALITY = 100\n        const val SCREENSHOT_WIDTH_DP = 200\n        const val SCREENSHOT_HEIGHT_DP = 115\n        private const val ARG_PACKAGE_NAME = \"packageName\"\n        private const val ARG_APP_NAME = \"appName\"\n        private const val ARG_SHARE_IMMEDIATELY = \"shareImmediately\"\n        private const val ARG_NOTIFICATION_ID = \"notificationId\"\n\n        fun newInstance(\n            packageName: String,\n            appName: String,\n            shareImmediately: Boolean = false,\n            notificationId: Int = -1\n        ) = EvaluationsFragment().apply {\n            arguments = Bundle().apply {\n                putString(ARG_PACKAGE_NAME, packageName)\n                putString(ARG_APP_NAME, appName)\n                putBoolean(ARG_SHARE_IMMEDIATELY, shareImmediately)\n                putInt(ARG_NOTIFICATION_ID, notificationId)\n            }\n        }\n    }\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        shareLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {\n            shareImage?.let { requireContext().contentResolver.delete(it, null, null) }\n            shareImage = null\n        }\n    }\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        _binding = FragmentEvaluationsBinding.inflate(inflater, container, false)\n        return mBinding.root\n    }\n\n    @RequiresApi(Build.VERSION_CODES.O)\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n\n        val packageName = arguments?.getString(ARG_PACKAGE_NAME).orEmpty()\n        val appName = arguments?.getString(ARG_APP_NAME).orEmpty()\n        val shareImmediately = arguments?.getBoolean(ARG_SHARE_IMMEDIATELY) ?: false\n        val notificationId = arguments?.getInt(ARG_NOTIFICATION_ID) ?: -1\n\n        mBinding.packageName.text = packageName\n        mBinding.applicationName.text = appName\n\n        mBinding.shareButton.setOnClickListener {\n            startTakingScreenshot(appName, packageName)\n        }\n\n        mBinding.infoIcon.setOnClickListener {\n            (requireActivity() as MainActivity).navigateToAbout()\n        }\n\n        hideCard()\n\n        if (shareImmediately) {\n            if (notificationId != -1) {\n                val notificationManager =\n                    requireContext().getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager\n                notificationManager.cancel(notificationId)\n            }\n            onElementsLoaded {\n                startTakingScreenshot(appName, packageName)\n            }\n        }\n\n        onElementsLoaded {\n            showCard()\n        }\n\n        handleUnsafeConfigurationSetting()\n        observeEvaluations()\n    }\n\n    private fun hideCard() {\n        mBinding.card.visibility = View.INVISIBLE\n        mBinding.progressBar.visibility = View.VISIBLE\n    }\n\n    private fun showCard() {\n        mBinding.progressBar.visibility = View.GONE\n        mBinding.card.visibility = View.VISIBLE\n    }\n\n    private fun onElementsLoaded(callback: () -> Unit) {\n        mViewModel.uiState\n            .filter { it.isFullyLoaded }\n            .onEach { callback.invoke() }\n            .launchIn(viewLifecycleOwner.lifecycleScope)\n    }\n\n    private fun handleUnsafeConfigurationSetting() {\n        val shouldShow = settings.isUnsafeConfigurationEnabled()\n        with(mBinding) {\n            secure.isVisible = shouldShow\n            microgRoot.isVisible = shouldShow\n            bareAospRoot.isVisible = shouldShow\n            empty.isVisible = shouldShow\n            unsafe.isVisible = shouldShow\n\n            if (shouldShow) {\n                val extraPadding = resources.getDimensionPixelSize(R.dimen.card_unsafe_extra_padding)\n                cardContent.setPadding(extraPadding, 0, extraPadding, 0)\n            }\n        }\n    }\n\n    private fun observeEvaluations() {\n        viewLifecycleOwner.lifecycleScope.launch {\n            mViewModel.uiState.collect { state ->\n                renderEvaluation(mBinding.microgUser, state.microgUser)\n                renderEvaluation(mBinding.bareAospUser, state.bareAospUser)\n\n                if (settings.isUnsafeConfigurationEnabled()) {\n                    renderEvaluation(mBinding.bareAospRoot, state.bareAospRoot)\n                    renderEvaluation(mBinding.microgRoot, state.microgRoot)\n                }\n\n                if (state.isFullyLoaded) {\n                    val unsafeEnabled = settings.isUnsafeConfigurationEnabled()\n                    val microgHasData = state.microgUser != null || (unsafeEnabled && state.microgRoot != null)\n                    val bareAospHasData = state.bareAospUser != null || (unsafeEnabled && state.bareAospRoot != null)\n                    mBinding.microgRow.isVisible = microgHasData\n                    mBinding.bareAospRow.isVisible = bareAospHasData\n                    mBinding.shareButton.isEnabled = state.microgUser != null || state.bareAospUser != null\n                }\n\n                if (state.iconUrl != null && !iconReady) {\n                    iconReady = true\n                    val needsCount = !state.isFullyLoaded\n                    if (state.iconUrl.isNotEmpty()) {\n                        Glide.with(requireContext().applicationContext)\n                            .load(state.iconUrl)\n                            .listener(object : RequestListener<Drawable> {\n                                override fun onResourceReady(\n                                    resource: Drawable,\n                                    model: Any,\n                                    target: Target<Drawable>?,\n                                    dataSource: DataSource,\n                                    isFirstResource: Boolean\n                                ): Boolean {\n                                    if (needsCount) mViewModel.onIconDisplayed()\n                                    return false\n                                }\n\n                                override fun onLoadFailed(\n                                    e: GlideException?,\n                                    model: Any?,\n                                    target: Target<Drawable>,\n                                    isFirstResource: Boolean\n                                ): Boolean {\n                                    if (needsCount) mViewModel.onIconDisplayed()\n                                    return false\n                                }\n                            })\n                            .into(mBinding.image)\n                    } else {\n                        if (needsCount) mViewModel.onIconDisplayed()\n                    }\n                }\n            }\n        }\n    }\n\n    private fun renderEvaluation(\n        imageView: android.widget.ImageView,\n        evaluation: com.klee.sapio.domain.model.Evaluation?\n    ) {\n        if (evaluation != null) {\n            imageView.setImageResource(Rating.create(evaluation.rating).drawable)\n            imageView.visibility = View.VISIBLE\n        } else {\n            imageView.setImageDrawable(null)\n            imageView.visibility = View.INVISIBLE\n        }\n\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {\n            imageView.tooltipText = evaluation?.let {\n                computeTooltip(it)\n            }\n        }\n    }\n\n    private fun computeTooltip(evaluation: com.klee.sapio.domain.model.Evaluation): String {\n        val ratingText = when (evaluation.rating) {\n            Rating.GOOD -> getString(R.string.good)\n            Rating.AVERAGE -> getString(R.string.average)\n            Rating.BAD -> getString(R.string.bad)\n            else -> getString(R.string.unknown)\n        }\n        val date = evaluation.updatedAt?.let { DateFormat.getDateInstance().format(it) }\n        return if (date == null) ratingText else \"$date - $ratingText\"\n    }\n\n    private fun startTakingScreenshot(appName: String, packageName: String) {\n        viewLifecycleOwner.lifecycleScope.launch {\n            val state = mViewModel.uiState.value\n            val icon = saveImageToFile(\n                requireContext(),\n                state.iconUrl.orEmpty()\n            )\n            val sharedEvaluation = SharedEvaluation(\n                appName,\n                packageName,\n                icon,\n                state.microgUser?.rating ?: 0,\n                state.bareAospUser?.rating ?: 0,\n            )\n            share(takeScreenshot(sharedEvaluation), appName)\n        }\n    }\n\n    private fun takeScreenshot(sharedEvaluation: SharedEvaluation): Bitmap {\n        return composeToBitmap(requireContext(), SCREENSHOT_WIDTH_DP, SCREENSHOT_HEIGHT_DP) {\n            ShareScreenshot(sharedEvaluation)\n        }\n    }\n\n    private suspend fun saveImageToFile(\n        context: Context,\n        url: String\n    ): Bitmap = suspendCancellableCoroutine { continuation ->\n        val target = object : CustomTarget<Bitmap>() {\n            override fun onResourceReady(\n                resource: Bitmap,\n                transition: Transition<in Bitmap>?\n            ) {\n                continuation.resume(resource)\n            }\n\n            override fun onLoadCleared(placeholder: Drawable?) {\n                continuation.resumeWithException(Exception(\"Failed to load image\"))\n            }\n        }\n\n        Glide.with(requireContext().applicationContext)\n            .asBitmap()\n            .load(url)\n            .into(target)\n\n        continuation.invokeOnCancellation {\n            Glide.with(context).clear(target)\n        }\n    }\n\n    private fun composeToBitmap(\n        context: Context,\n        widthDp: Int,\n        heightDp: Int,\n        scaleFactor: Float = 2f,\n        composable: @Composable () -> Unit,\n    ): Bitmap {\n        val displayMetrics = context.resources.displayMetrics\n        val widthPx = TypedValue.applyDimension(\n            TypedValue.COMPLEX_UNIT_DIP,\n            widthDp.toFloat(),\n            displayMetrics\n        ).toInt()\n        val heightPx = TypedValue.applyDimension(\n            TypedValue.COMPLEX_UNIT_DIP,\n            heightDp.toFloat(),\n            displayMetrics\n        ).toInt()\n\n        val composeView = ComposeView(context).apply {\n            setLayerType(View.LAYER_TYPE_SOFTWARE, null)\n            setContent { composable() }\n            layoutParams = ViewGroup.LayoutParams(widthPx, heightPx)\n        }\n\n        mBinding.bitmapContainer.addView(composeView)\n\n        composeView.measure(\n            View.MeasureSpec.makeMeasureSpec(widthPx, View.MeasureSpec.EXACTLY),\n            View.MeasureSpec.makeMeasureSpec(heightPx, View.MeasureSpec.EXACTLY)\n        )\n        composeView.layout(0, 0, composeView.measuredWidth, composeView.measuredHeight)\n\n        val bitmap = createBitmap(\n            (composeView.width * scaleFactor).toInt(),\n            (composeView.height * scaleFactor).toInt()\n        )\n        val canvas = Canvas(bitmap)\n        canvas.scale(scaleFactor, scaleFactor)\n        composeView.draw(canvas)\n\n        mBinding.bitmapContainer.removeView(composeView)\n\n        return bitmap\n    }\n\n    private fun share(bitmap: Bitmap, appName: String) {\n        val contentValues = ContentValues().apply {\n            put(Media.DISPLAY_NAME, \"screenshot_${System.currentTimeMillis()}\")\n            put(Media.DESCRIPTION, getString(R.string.share_android_compatibility, appName))\n            put(Media.MIME_TYPE, \"image/jpeg\")\n            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {\n                put(\n                    Media.RELATIVE_PATH,\n                    \"${Environment.DIRECTORY_PICTURES}/${Environment.DIRECTORY_SCREENSHOTS}\"\n                )\n            }\n        }\n\n        shareImage =\n            requireContext().contentResolver.insert(Media.EXTERNAL_CONTENT_URI, contentValues)\n                ?: return\n\n        try {\n            requireContext().contentResolver.openOutputStream(shareImage!!)?.use { outputStream ->\n                bitmap.compress(Bitmap.CompressFormat.JPEG, COMPRESSION_QUALITY, outputStream)\n            }\n        } catch (exception: IOException) {\n            Log.e(TAG, \"Failed to share matrix\", exception)\n        }\n\n        val shareIntent = Intent(Intent.ACTION_SEND).apply {\n            type = \"image/*\"\n            putExtra(Intent.EXTRA_STREAM, shareImage)\n            putExtra(\n                Intent.EXTRA_TEXT,\n                getString(R.string.share_android_compatibility_text, appName)\n            )\n        }\n\n        shareLauncher.launch(Intent.createChooser(shareIntent, \"Share\"))\n    }\n\n    override fun onDestroyView() {\n        super.onDestroyView()\n        iconReady = false\n        shareImage?.let {\n            requireContext().contentResolver.delete(it, null, null)\n            shareImage = null\n        }\n        _binding = null\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/FeedAppAdapter.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.Context\nimport android.content.res.ColorStateList\nimport android.os.Build\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.recyclerview.widget.DiffUtil\nimport androidx.recyclerview.widget.ListAdapter\nimport androidx.recyclerview.widget.RecyclerView\nimport com.bumptech.glide.Glide\nimport com.bumptech.glide.load.engine.DiskCacheStrategy\nimport com.klee.sapio.R\nimport com.klee.sapio.databinding.FeedAppCardBinding\nimport com.klee.sapio.domain.AppSettings\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.UserType\nimport com.klee.sapio.ui.model.Label\nimport com.klee.sapio.ui.model.Rating\nimport java.text.SimpleDateFormat\nimport java.util.Locale\n\nclass FeedAppAdapter(\n    private val mContext: Context,\n    private var mSettings: AppSettings,\n    private val onAppSelected: (packageName: String, appName: String) -> Unit\n) : ListAdapter<Evaluation, FeedAppAdapter.ViewHolder>(DiffCallback) {\n\n    companion object {\n        const val DATE_FORMAT = \"dd/MM/yyyy\"\n\n        private val DiffCallback = object : DiffUtil.ItemCallback<Evaluation>() {\n            override fun areItemsTheSame(oldItem: Evaluation, newItem: Evaluation): Boolean {\n                return oldItem.packageName == newItem.packageName &&\n                    oldItem.microg == newItem.microg &&\n                    oldItem.secure == newItem.secure\n            }\n\n            override fun areContentsTheSame(oldItem: Evaluation, newItem: Evaluation): Boolean {\n                return oldItem == newItem\n            }\n        }\n    }\n\n    inner class ViewHolder(val binding: FeedAppCardBinding) : RecyclerView.ViewHolder(binding.root)\n\n    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {\n        val binding = FeedAppCardBinding.inflate(LayoutInflater.from(parent.context), parent, false)\n        return ViewHolder(binding)\n    }\n\n    override fun onBindViewHolder(holder: ViewHolder, position: Int) {\n        val app = getItem(position)\n        val element = holder.binding\n        element.appName.text = app.name\n        element.packageName.text = app.packageName\n\n        val dateFormat = SimpleDateFormat(DATE_FORMAT, Locale.getDefault())\n        element.updatedDate.text =\n            mContext.getString(\n                R.string.updated_on,\n                app.updatedAt?.let { dateFormat.format(it) }\n            )\n\n        element.emoji.setImageResource(Rating.create(app.rating).drawable)\n\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n            val microgLabel = Label.create(mContext, app.microg)\n            val secureLabel = Label.create(mContext, app.secure)\n\n            element.microG.text = microgLabel.text\n            element.microG.backgroundTintList = ColorStateList.valueOf(microgLabel.color)\n\n            element.secure.text = secureLabel.text\n            element.secure.backgroundTintList = ColorStateList.valueOf(secureLabel.color)\n\n            if (mSettings.getUnsafeConfigurationLevel() == UserType.UNSAFE) {\n                element.secure.visibility = View.VISIBLE\n            } else {\n                element.secure.visibility = View.GONE\n            }\n        }\n\n        Glide.with(mContext.applicationContext).clear(holder.binding.image)\n        val iconUrl = app.iconUrl\n        if (!iconUrl.isNullOrEmpty()) {\n            Glide.with(mContext.applicationContext)\n                .load(iconUrl)\n                .diskCacheStrategy(DiskCacheStrategy.ALL)\n                .into(holder.binding.image)\n        }\n\n        holder.itemView.setOnClickListener {\n            onAppSelected(app.packageName, app.name)\n        }\n    }\n\n    override fun onViewRecycled(holder: ViewHolder) {\n        super.onViewRecycled(holder)\n        Glide.with(mContext.applicationContext).clear(holder.binding.image)\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/FeedFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.activityViewModels\nimport androidx.lifecycle.lifecycleScope\nimport androidx.recyclerview.widget.LinearLayoutManager\nimport androidx.recyclerview.widget.RecyclerView\nimport com.klee.sapio.databinding.FragmentMainBinding\nimport com.klee.sapio.domain.AppSettings\nimport com.klee.sapio.ui.viewmodel.FeedViewModel\nimport dagger.hilt.android.AndroidEntryPoint\nimport kotlinx.coroutines.Job\nimport kotlinx.coroutines.launch\nimport javax.inject.Inject\n\n@AndroidEntryPoint\nclass FeedFragment : Fragment() {\n\n    companion object {\n        private const val LOAD_MORE_THRESHOLD = 3\n    }\n\n    @Inject\n    lateinit var mSettings: AppSettings\n\n    private lateinit var mBinding: FragmentMainBinding\n    private lateinit var mFeedAppAdapter: FeedAppAdapter\n    private val mViewModel by activityViewModels<FeedViewModel>()\n    private var fetchJob: Job? = null\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        mBinding = FragmentMainBinding.inflate(inflater, container, false)\n        mBinding.recyclerView.layoutManager = LinearLayoutManager(context)\n        setupAdapter()\n        collectFeed()\n\n        mBinding.refreshView.setOnRefreshListener {\n            mViewModel.refresh()\n        }\n\n        setupScrollListener()\n\n        return mBinding.root\n    }\n\n    override fun onResume() {\n        super.onResume()\n        mViewModel.syncUnsafeConfiguration(mSettings.getUnsafeConfigurationLevel())\n    }\n\n    private fun setupAdapter() {\n        mFeedAppAdapter = FeedAppAdapter(requireContext(), mSettings) { packageName, appName ->\n            (requireActivity() as MainActivity).navigateToEvaluations(packageName, appName)\n        }\n        mBinding.recyclerView.adapter = mFeedAppAdapter\n    }\n\n    private fun setupScrollListener() {\n        mBinding.recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {\n            override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {\n                if (dy <= 0) return\n                val layoutManager = recyclerView.layoutManager as? LinearLayoutManager ?: return\n                val lastVisible = layoutManager.findLastVisibleItemPosition()\n                val total = layoutManager.itemCount\n                if (total > 0 && lastVisible >= total - LOAD_MORE_THRESHOLD) {\n                    mViewModel.loadNextPage()\n                }\n            }\n        })\n    }\n\n    private fun collectFeed() {\n        fetchJob?.cancel()\n        fetchJob = viewLifecycleOwner.lifecycleScope.launch {\n            mViewModel.uiState.collect { state ->\n                mFeedAppAdapter.submitList(state.items) {\n                    if (!state.isLoading && !state.isLoadingMore) {\n                        loadMoreIfNeeded()\n                    }\n                }\n                val isInitialLoad = state.isLoading && state.items.isEmpty()\n                mBinding.progressBar.visibility = if (isInitialLoad) View.VISIBLE else View.GONE\n                mBinding.refreshView.isRefreshing = false\n            }\n        }\n    }\n\n    private fun loadMoreIfNeeded() {\n        mBinding.recyclerView.post {\n            val layoutManager = mBinding.recyclerView.layoutManager as? LinearLayoutManager ?: return@post\n            val lastVisible = layoutManager.findLastVisibleItemPosition()\n            val total = layoutManager.itemCount\n            if (total > 0 && lastVisible >= total - LOAD_MORE_THRESHOLD) {\n                mViewModel.loadNextPage()\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/FragmentAdapter.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.FragmentManager\nimport androidx.lifecycle.Lifecycle\nimport androidx.viewpager2.adapter.FragmentStateAdapter\n\nclass FragmentAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle) :\n    FragmentStateAdapter(fragmentManager, lifecycle) {\n\n    private val fragments: HashMap<Int, Fragment> = hashMapOf(\n        0 to FeedFragment(),\n        1 to SearchFragment(),\n        2 to ContributeFragment()\n    )\n\n    override fun getItemCount(): Int {\n        return fragments.size\n    }\n\n    override fun createFragment(position: Int): Fragment {\n        return fragments[position]!!\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/LoadingFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport android.widget.Toast\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.viewModels\nimport androidx.lifecycle.lifecycleScope\nimport androidx.navigation.fragment.findNavController\nimport com.klee.sapio.R\nimport com.klee.sapio.databinding.FragmentLoadingBinding\nimport com.klee.sapio.ui.state.EvaluateEvent\nimport com.klee.sapio.ui.viewmodel.LoadingViewModel\nimport dagger.hilt.android.AndroidEntryPoint\nimport kotlinx.coroutines.launch\n\n@AndroidEntryPoint\nclass LoadingFragment : Fragment() {\n\n    private val mViewModel by viewModels<LoadingViewModel>()\n    private lateinit var mBinding: FragmentLoadingBinding\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        mBinding = FragmentLoadingBinding.inflate(inflater, container, false)\n\n        val packageName = arguments?.getString(\"package\").orEmpty()\n        val appName = arguments?.getString(\"name\").orEmpty()\n        val rating = arguments?.getInt(\"rating\") ?: 0\n\n        mViewModel.submit(packageName, appName, rating)\n\n        viewLifecycleOwner.lifecycleScope.launch {\n            mViewModel.events.collect { event ->\n                when (event) {\n                    is EvaluateEvent.NavigateToSuccess -> {\n                        val bundle = Bundle().apply {\n                            putString(\"package\", event.packageName)\n                            putString(\"name\", event.appName)\n                        }\n                        findNavController().navigate(R.id.action_loadingFragment_to_successFragment, bundle)\n                    }\n                    is EvaluateEvent.ShowError -> {\n                        Toast.makeText(context, getString(R.string.upload_error), Toast.LENGTH_LONG).show()\n                        findNavController().popBackStack()\n                    }\n                }\n            }\n        }\n\n        return mBinding.root\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/MainActivity.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.Manifest\nimport android.content.Intent\nimport android.content.pm.PackageManager\nimport android.os.Bundle\nimport android.view.ViewGroup\nimport androidx.activity.OnBackPressedCallback\nimport androidx.activity.result.contract.ActivityResultContracts\nimport androidx.appcompat.app.AppCompatActivity\nimport androidx.core.content.ContextCompat\nimport androidx.core.view.ViewCompat\nimport androidx.core.view.WindowInsetsCompat\nimport androidx.core.view.updateLayoutParams\nimport androidx.activity.viewModels\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.FragmentManager\nimport com.klee.sapio.R\nimport com.klee.sapio.databinding.ActivityMainBinding\nimport com.klee.sapio.ui.viewmodel.AppEvaluationsViewModel\nimport com.klee.sapio.ui.viewmodel.ChooseAppViewModel\nimport dagger.hilt.android.AndroidEntryPoint\n\n@AndroidEntryPoint\nclass MainActivity : AppCompatActivity() {\n\n    private lateinit var mBinding: ActivityMainBinding\n    private val mEvaluationsViewModel by viewModels<AppEvaluationsViewModel>()\n    private val mChooseAppViewModel by viewModels<ChooseAppViewModel>()\n    private val notificationPermissionLauncher =\n        registerForActivityResult(ActivityResultContracts.RequestPermission()) { }\n\n    companion object {\n        const val DONATE_URL = \"https://ko-fi.com/jnthnkl\"\n        const val EXTRA_PACKAGE_NAME = \"packageName\"\n        const val EXTRA_APP_NAME = \"appName\"\n        const val EXTRA_SHARE_IMMEDIATELY = \"shareImmediately\"\n        const val EXTRA_NOTIFICATION_ID = \"notificationId\"\n    }\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n\n        mBinding = ActivityMainBinding.inflate(layoutInflater)\n        setContentView(mBinding.root)\n\n        requestNotificationPermissionIfNeeded()\n        mChooseAppViewModel.uiState\n\n        if (savedInstanceState == null) {\n            displayFragment(FeedFragment())\n            handleDeepLinkIntent(intent)\n        }\n\n        handleEdgeToEdgeInsets()\n\n        onBackPressedDispatcher.addCallback(\n            this,\n            object : OnBackPressedCallback(true) {\n                override fun handleOnBackPressed() {\n                    if (supportFragmentManager.backStackEntryCount > 0) {\n                        supportFragmentManager.popBackStack()\n                    } else if (mBinding.bottomNavigation.selectedItemId != R.id.feed) {\n                        mBinding.bottomNavigation.selectedItemId = R.id.feed\n                    } else {\n                        finish()\n                    }\n                }\n            }\n        )\n\n        mBinding.bottomNavigation.setOnItemSelectedListener { item ->\n            when (item.itemId) {\n                R.id.feed -> displayFragment(FeedFragment())\n                R.id.search -> displayFragment(SearchFragment())\n                R.id.my_apps -> displayFragment(MyAppsFragment())\n                R.id.contribute -> displayFragment(ContributeFragment())\n                R.id.options -> displayFragment(PreferencesFragment())\n            }\n            return@setOnItemSelectedListener true\n        }\n    }\n\n    override fun onNewIntent(intent: Intent) {\n        super.onNewIntent(intent)\n        handleDeepLinkIntent(intent)\n    }\n\n    private fun handleDeepLinkIntent(intent: Intent) {\n        val packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME) ?: return\n        val appName = intent.getStringExtra(EXTRA_APP_NAME).orEmpty()\n        val shareImmediately = intent.getBooleanExtra(EXTRA_SHARE_IMMEDIATELY, false)\n        val notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)\n        navigateToEvaluations(packageName, appName, shareImmediately, notificationId)\n    }\n\n    fun navigateToAbout() {\n        supportFragmentManager.beginTransaction()\n            .replace(R.id.fragment_container, AboutFragment())\n            .addToBackStack(null)\n            .commit()\n    }\n\n    fun navigateToContribute() {\n        mBinding.bottomNavigation.selectedItemId = R.id.contribute\n    }\n\n    fun navigateToEvaluations(\n        packageName: String,\n        appName: String,\n        shareImmediately: Boolean = false,\n        notificationId: Int = -1\n    ) {\n        mEvaluationsViewModel.listEvaluations(packageName)\n        val fragment = EvaluationsFragment.newInstance(packageName, appName, shareImmediately, notificationId)\n        supportFragmentManager.beginTransaction()\n            .replace(R.id.fragment_container, fragment)\n            .addToBackStack(null)\n            .commit()\n    }\n\n    private fun displayFragment(fragment: Fragment) {\n        supportFragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)\n        supportFragmentManager.beginTransaction().replace(R.id.fragment_container, fragment).commit()\n    }\n\n    private fun handleEdgeToEdgeInsets() {\n        ViewCompat.setOnApplyWindowInsetsListener(mBinding.root) { v, windowInsets ->\n            val bars = windowInsets.getInsets(\n                WindowInsetsCompat.Type.systemBars()\n                    or WindowInsetsCompat.Type.displayCutout()\n            )\n            val ime = windowInsets.getInsets(WindowInsetsCompat.Type.ime())\n\n            v.updateLayoutParams<ViewGroup.MarginLayoutParams> {\n                bottomMargin = maxOf(bars.bottom, ime.bottom)\n                leftMargin = bars.left\n                rightMargin = bars.right\n                topMargin = bars.top\n            }\n\n            WindowInsetsCompat.CONSUMED\n        }\n    }\n\n    private fun requestNotificationPermissionIfNeeded() {\n        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.TIRAMISU) {\n            return\n        }\n\n        val permission = Manifest.permission.POST_NOTIFICATIONS\n        val isGranted = ContextCompat.checkSelfPermission(this, permission) ==\n            PackageManager.PERMISSION_GRANTED\n        if (!isGranted) {\n            notificationPermissionLauncher.launch(permission)\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/MyAppsAdapter.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.Context\nimport android.content.pm.PackageManager\nimport android.os.Build\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.recyclerview.widget.DiffUtil\nimport androidx.recyclerview.widget.ListAdapter\nimport androidx.recyclerview.widget.RecyclerView\nimport com.klee.sapio.databinding.MyAppCardBinding\nimport com.klee.sapio.ui.model.InstalledAppWithRating\nimport com.klee.sapio.ui.model.Rating\n\nclass MyAppsAdapter(\n    private val mContext: Context,\n    private val onAppSelected: (packageName: String, appName: String) -> Unit,\n    private val onContribute: () -> Unit\n) : ListAdapter<InstalledAppWithRating, MyAppsAdapter.ViewHolder>(DiffCallback) {\n\n    companion object {\n        private val DiffCallback = object : DiffUtil.ItemCallback<InstalledAppWithRating>() {\n            override fun areItemsTheSame(\n                oldItem: InstalledAppWithRating,\n                newItem: InstalledAppWithRating\n            ): Boolean {\n                return oldItem.installedApp.packageName == newItem.installedApp.packageName\n            }\n\n            override fun areContentsTheSame(\n                oldItem: InstalledAppWithRating,\n                newItem: InstalledAppWithRating\n            ): Boolean {\n                return oldItem == newItem\n            }\n        }\n    }\n\n    inner class ViewHolder(val binding: MyAppCardBinding) : RecyclerView.ViewHolder(binding.root)\n\n    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {\n        val binding = MyAppCardBinding.inflate(\n            LayoutInflater.from(parent.context),\n            parent,\n            false\n        )\n        return ViewHolder(binding)\n    }\n\n    override fun onBindViewHolder(holder: ViewHolder, position: Int) {\n        val item = getItem(position)\n        val element = holder.binding\n\n        element.appName.text = item.installedApp.name\n        element.packageName.text = item.installedApp.packageName\n        try {\n            val pm = holder.itemView.context.packageManager\n            val appInfo = pm.getApplicationInfo(item.installedApp.packageName, 0)\n            val icon = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {\n                appInfo.loadUnbadgedIcon(pm)\n            } else {\n                appInfo.loadIcon(pm)\n            }\n            element.image.setImageDrawable(icon)\n        } catch (e: PackageManager.NameNotFoundException) {\n            // leave default\n        }\n\n        val rating = item.evaluation?.rating\n        element.infoIcon.visibility = View.VISIBLE\n        if (rating != null) {\n            element.emoji.setImageResource(Rating.create(rating).drawable)\n            element.emoji.visibility = View.VISIBLE\n            element.noRatingIcon.visibility = View.GONE\n        } else {\n            element.emoji.visibility = View.GONE\n            element.noRatingIcon.visibility = View.VISIBLE\n        }\n\n        holder.itemView.setOnClickListener {\n            if (item.evaluation != null) {\n                onAppSelected(item.installedApp.packageName, item.installedApp.name)\n            } else {\n                onContribute()\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/MyAppsFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.activityViewModels\nimport androidx.lifecycle.lifecycleScope\nimport androidx.recyclerview.widget.LinearLayoutManager\nimport com.klee.sapio.databinding.FragmentMyAppsBinding\nimport com.klee.sapio.ui.viewmodel.MyAppsViewModel\nimport dagger.hilt.android.AndroidEntryPoint\nimport kotlinx.coroutines.launch\n\n@AndroidEntryPoint\nclass MyAppsFragment : Fragment() {\n\n    private lateinit var mBinding: FragmentMyAppsBinding\n    private lateinit var mAdapter: MyAppsAdapter\n    private val mViewModel by activityViewModels<MyAppsViewModel>()\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        mBinding = FragmentMyAppsBinding.inflate(inflater, container, false)\n        mBinding.recyclerView.layoutManager = LinearLayoutManager(context)\n\n        mAdapter = MyAppsAdapter(\n            requireContext(),\n            onAppSelected = { packageName, appName ->\n                (requireActivity() as MainActivity).navigateToEvaluations(packageName, appName)\n            },\n            onContribute = {\n                (requireActivity() as MainActivity).navigateToContribute()\n            }\n        )\n        mBinding.recyclerView.adapter = mAdapter\n\n        mBinding.swipeRefreshLayout.setOnRefreshListener {\n            mViewModel.loadApps(forceRefresh = true)\n        }\n\n        collectState()\n        mViewModel.loadApps()\n\n        return mBinding.root\n    }\n\n    private fun collectState() {\n        viewLifecycleOwner.lifecycleScope.launch {\n            mViewModel.uiState.collect { state ->\n                if (state.isLoading) {\n                    mAdapter.submitList(emptyList())\n                    mBinding.progressBar.visibility = View.VISIBLE\n                } else {\n                    mAdapter.submitList(state.items)\n                    mBinding.progressBar.visibility = View.GONE\n                }\n                mBinding.recyclerView.visibility =\n                    if (state.isLoading) View.GONE else View.VISIBLE\n                mBinding.swipeRefreshLayout.isRefreshing = false\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/PreferencesFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.Intent\nimport android.net.Uri\nimport android.os.Bundle\nimport android.view.View\nimport androidx.core.view.ViewCompat\nimport androidx.core.view.WindowInsetsCompat\nimport androidx.core.view.updatePadding\nimport androidx.preference.Preference\nimport androidx.preference.PreferenceFragmentCompat\nimport com.klee.sapio.R\n\nclass PreferencesFragment : PreferenceFragmentCompat() {\n    override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {\n        setPreferencesFromResource(R.xml.preferences, rootKey)\n    }\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n\n        ViewCompat.setOnApplyWindowInsetsListener(view) { v, windowInsets ->\n            val bars = windowInsets.getInsets(\n                WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()\n            )\n\n            v.updatePadding(\n                left = bars.left,\n                right = bars.right,\n                top = bars.top,\n                bottom = bars.bottom\n            )\n\n            WindowInsetsCompat.CONSUMED\n        }\n\n        setupPreferenceClickListeners()\n    }\n\n    private fun setupPreferenceClickListeners() {\n        findPreference<Preference>(\"github_star_preference\")?.setOnPreferenceClickListener {\n            val githubUrl = getString(R.string.github_url)\n            val intent = Intent(Intent.ACTION_VIEW, Uri.parse(githubUrl))\n            startActivity(intent)\n            true\n        }\n\n        findPreference<Preference>(\"about_preference\")?.setOnPreferenceClickListener {\n            (requireActivity() as MainActivity).navigateToAbout()\n            true\n        }\n\n        findPreference<Preference>(\"donate_preference\")?.setOnPreferenceClickListener {\n            val donateUrl = \"https://ko-fi.com/jnthnkl\"\n            val intent = Intent(Intent.ACTION_VIEW, Uri.parse(donateUrl))\n            startActivity(intent)\n            true\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/SearchAppAdapter.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.Context\nimport android.view.LayoutInflater\nimport android.view.ViewGroup\nimport androidx.recyclerview.widget.DiffUtil\nimport androidx.recyclerview.widget.ListAdapter\nimport androidx.recyclerview.widget.RecyclerView\nimport com.bumptech.glide.Glide\nimport com.bumptech.glide.load.engine.DiskCacheStrategy\nimport com.klee.sapio.databinding.SearchAppCardBinding\nimport com.klee.sapio.domain.model.Evaluation\n\nclass SearchAppAdapter(\n    private val mContext: Context,\n    private val onAppSelected: (packageName: String, appName: String) -> Unit\n) : ListAdapter<Evaluation, SearchAppAdapter.ViewHolder>(DiffCallback) {\n\n    companion object {\n        private val DiffCallback = object : DiffUtil.ItemCallback<Evaluation>() {\n            override fun areItemsTheSame(oldItem: Evaluation, newItem: Evaluation): Boolean {\n                return oldItem.packageName == newItem.packageName &&\n                    oldItem.microg == newItem.microg &&\n                    oldItem.secure == newItem.secure\n            }\n\n            override fun areContentsTheSame(oldItem: Evaluation, newItem: Evaluation): Boolean {\n                return oldItem == newItem\n            }\n        }\n    }\n\n    inner class ViewHolder(val binding: SearchAppCardBinding) : RecyclerView.ViewHolder(binding.root)\n\n    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {\n        val binding = SearchAppCardBinding.inflate(\n            LayoutInflater.from(parent.context),\n            parent,\n            false\n        )\n        return ViewHolder(binding)\n    }\n\n    override fun onBindViewHolder(holder: ViewHolder, position: Int) {\n        val app = getItem(position)\n        val element = holder.binding\n        element.appName.text = app.name\n        element.packageName.text = app.packageName\n\n        Glide.with(mContext.applicationContext).clear(holder.binding.image)\n        val iconUrl = app.iconUrl\n        if (!iconUrl.isNullOrEmpty()) {\n            Glide.with(mContext.applicationContext)\n                .load(iconUrl)\n                .diskCacheStrategy(DiskCacheStrategy.ALL)\n                .into(holder.binding.image)\n        }\n\n        holder.itemView.setOnClickListener {\n            onAppSelected(app.packageName, app.name)\n        }\n    }\n\n    override fun onViewRecycled(holder: ViewHolder) {\n        super.onViewRecycled(holder)\n        Glide.with(mContext.applicationContext).clear(holder.binding.image)\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/SearchFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.Context\nimport android.graphics.PorterDuff\nimport android.os.Build\nimport android.os.Bundle\nimport android.os.Handler\nimport android.os.Looper\nimport android.text.Editable\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport android.view.inputmethod.InputMethodManager\nimport androidx.core.content.ContextCompat\nimport androidx.core.widget.addTextChangedListener\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.viewModels\nimport androidx.lifecycle.lifecycleScope\nimport androidx.recyclerview.widget.LinearLayoutManager\nimport com.google.android.material.R\nimport com.klee.sapio.databinding.FragmentSearchBinding\nimport com.klee.sapio.ui.state.SearchUiState\nimport com.klee.sapio.ui.viewmodel.SearchViewModel\nimport dagger.hilt.android.AndroidEntryPoint\nimport kotlinx.coroutines.Job\nimport kotlinx.coroutines.launch\n\n@AndroidEntryPoint\nclass SearchFragment : Fragment() {\n\n    private lateinit var mBinding: FragmentSearchBinding\n    private lateinit var mSearchAppAdapter: SearchAppAdapter\n    private val mViewModel by viewModels<SearchViewModel>()\n    private var searchJob: Job? = null\n\n    private lateinit var mHandler: Handler\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        mBinding = FragmentSearchBinding.inflate(inflater, container, false)\n        mBinding.recyclerView.layoutManager = LinearLayoutManager(context)\n        mBinding.recyclerView.visibility = View.INVISIBLE\n\n        mHandler = Handler(Looper.getMainLooper())\n\n        mSearchAppAdapter = SearchAppAdapter(requireContext()) { packageName, appName ->\n            (requireActivity() as MainActivity).navigateToEvaluations(packageName, appName)\n        }\n        mBinding.recyclerView.adapter = mSearchAppAdapter\n\n        mBinding.editTextSearch.addTextChangedListener { editable ->\n            onTextChanged(editable)\n        }\n\n        setupClearButton()\n        setSearchIconsColor()\n        collectSearch()\n\n        return mBinding.root\n    }\n\n    private fun onTextChanged(editable: Editable?) {\n        val text = editable?.trim().toString()\n        searchJob?.cancel()\n        searchJob = viewLifecycleOwner.lifecycleScope.launch {\n            mViewModel.searchApplication(text, this@SearchFragment::onNetworkError)\n        }\n    }\n\n    private fun collectSearch() {\n        viewLifecycleOwner.lifecycleScope.launch {\n            mViewModel.uiState.collect { state ->\n                renderState(state)\n            }\n        }\n    }\n\n    private fun renderState(state: SearchUiState) {\n        mSearchAppAdapter.submitList(state.items)\n        showResults(state.query.isNotEmpty() && state.items.isNotEmpty())\n    }\n\n    private fun setupClearButton() {\n        mBinding.editTextSearch.addTextChangedListener { text ->\n            mBinding.clearSearch.visibility = if (text?.isNotEmpty() == true) View.VISIBLE else View.GONE\n        }\n\n        mBinding.clearSearch.setOnClickListener {\n            mBinding.editTextSearch.text?.clear()\n        }\n    }\n\n    private fun setSearchIconsColor() {\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {\n            mBinding.searchIcon.setColorFilter(\n                ContextCompat.getColor(\n                    requireContext(),\n                    R.color.material_dynamic_primary80\n                ),\n                PorterDuff.Mode.SRC_IN\n            )\n            mBinding.searchIconBig.setColorFilter(\n                ContextCompat.getColor(\n                    requireContext(),\n                    R.color.material_dynamic_primary80\n                ),\n                PorterDuff.Mode.SRC_IN\n            )\n        }\n    }\n\n    override fun onResume() {\n        super.onResume()\n        showKeyboard()\n    }\n\n    private fun onNetworkError() {\n        // Nothing for now\n    }\n\n    private fun showResults(visible: Boolean) {\n        if (visible) {\n            mBinding.recyclerView.visibility = View.VISIBLE\n            mBinding.emptyState.visibility = View.GONE\n        } else {\n            mBinding.recyclerView.visibility = View.INVISIBLE\n            mBinding.emptyState.visibility = View.VISIBLE\n        }\n    }\n\n    private fun showKeyboard() {\n        mBinding.editTextSearch.post {\n            if (!isAdded) return@post\n            mBinding.editTextSearch.requestFocus()\n\n            val inputMethodManager =\n                requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE)\n                    as InputMethodManager\n\n            inputMethodManager.showSoftInput(\n                mBinding.editTextSearch,\n                InputMethodManager.SHOW_IMPLICIT\n            )\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/ShareComposable.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.annotation.SuppressLint\nimport android.graphics.Bitmap\nimport androidx.compose.foundation.Image\nimport androidx.compose.foundation.background\nimport androidx.compose.foundation.layout.Box\nimport androidx.compose.foundation.layout.Column\nimport androidx.compose.foundation.layout.Row\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxSize\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.height\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.foundation.layout.requiredHeight\nimport androidx.compose.foundation.layout.requiredWidth\nimport androidx.compose.foundation.layout.size\nimport androidx.compose.foundation.layout.width\nimport androidx.compose.foundation.shape.CircleShape\nimport androidx.compose.foundation.shape.RoundedCornerShape\nimport androidx.compose.material3.Text\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.draw.clip\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.graphics.asImageBitmap\nimport androidx.compose.ui.res.painterResource\nimport androidx.compose.ui.res.stringResource\nimport androidx.compose.ui.text.TextStyle\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.text.style.TextOverflow\nimport androidx.compose.ui.tooling.preview.Preview\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.unit.sp\nimport com.klee.sapio.R\nimport com.klee.sapio.ui.model.Rating\nimport com.klee.sapio.ui.model.SharedEvaluation\nimport java.time.LocalDate\nimport java.time.format.DateTimeFormatter\n\n@SuppressLint(\"NewApi\")\n@Composable\nfun ShareScreenshot(\n    sharedEvaluation: SharedEvaluation,\n) {\n    Box(\n        modifier = Modifier\n            .requiredWidth(200.dp)\n            .requiredHeight(115.dp)\n            .background(color = Gray)\n    ) {\n        Column(\n            modifier = Modifier\n                .fillMaxSize()\n                .padding(start = 12.dp, end = 12.dp, top = 8.dp, bottom = 4.dp)\n        ) {\n            Box(\n                modifier = Modifier.fillMaxWidth()\n            ) {\n                Column(\n                    modifier = Modifier.align(Alignment.TopCenter),\n                    horizontalAlignment = Alignment.CenterHorizontally\n                ) {\n                    Text(\n                        stringResource(R.string.android_compatibility_matrix),\n                        style = TextStyle(\n                            color = Color.White,\n                            fontSize = 8.5.sp\n                        )\n                    )\n                    Text(\n                        stringResource(R.string.android_compatibility_subtitle),\n                        style = TextStyle(\n                            color = Color.White.copy(alpha = 0.7f),\n                            fontSize = 5.sp\n                        )\n                    )\n                }\n\n                Image(\n                    painter = painterResource(R.drawable.ic_launcher_foreground),\n                    modifier = Modifier\n                        .size(18.dp)\n                        .align(Alignment.TopEnd),\n                    contentDescription = \"Sapio icon\",\n                )\n            }\n\n            Spacer(modifier = Modifier.height(8.dp))\n\n            Box(\n                modifier = Modifier.fillMaxWidth()\n            ) {\n                Box(\n                    modifier = Modifier\n                        .size(44.dp)\n                        .background(\n                            color = Blue200.copy(alpha = 0.18f),\n                            shape = CircleShape\n                        )\n                        .align(Alignment.CenterStart),\n                    contentAlignment = Alignment.Center\n                ) {\n                    Image(\n                        bitmap = sharedEvaluation.icon.asImageBitmap(),\n                        contentDescription = null,\n                        modifier = Modifier\n                            .clip(CircleShape)\n                            .size(36.dp),\n                    )\n                }\n\n                Column(\n                    modifier = Modifier\n                        .align(Alignment.Center)\n                        .padding(horizontal = 48.dp),\n                    horizontalAlignment = Alignment.CenterHorizontally\n                ) {\n                    Text(\n                        sharedEvaluation.name,\n                        style = TextStyle(\n                            color = Color.White.copy(alpha = 0.9f),\n                            fontSize = 9.sp\n                        )\n                    )\n                    Text(\n                        sharedEvaluation.packageName,\n                        style = TextStyle(\n                            color = Color.White.copy(alpha = 0.65f),\n                            fontSize = 5.sp\n                        ),\n                        maxLines = 1,\n                        overflow = TextOverflow.Ellipsis\n                    )\n\n                    Spacer(modifier = Modifier.height(6.dp))\n\n                    val availableRatings = buildList {\n                        if (hasRating(sharedEvaluation.ratingMicrog)) {\n                            add(\"microG\" to sharedEvaluation.ratingMicrog)\n                        }\n                        if (hasRating(sharedEvaluation.ratingBareAOSP)) {\n                            add(\"bareAOSP\" to sharedEvaluation.ratingBareAOSP)\n                        }\n                    }\n                    val pillHeight = 14.dp\n                    val pillSpacing = 3.dp\n                    val pillStackHeight = (pillHeight * 2) + pillSpacing\n                    val pillAreaHeight = if (availableRatings.isEmpty()) 0.dp else pillStackHeight\n\n                    Box(\n                        modifier = Modifier\n                            .height(pillAreaHeight),\n                        contentAlignment = Alignment.CenterStart\n                    ) {\n                        when (availableRatings.size) {\n                            1 -> {\n                                val (label, rating) = availableRatings[0]\n                                RatingPill(\n                                    label = label,\n                                    rating = rating,\n                                    modifier = Modifier.height(pillHeight)\n                                )\n                            }\n                            2 -> {\n                                Column {\n                                    availableRatings.forEachIndexed { index, (label, rating) ->\n                                        RatingPill(\n                                            label = label,\n                                            rating = rating,\n                                            modifier = Modifier.height(pillHeight)\n                                        )\n                                        if (index == 0) {\n                                            Spacer(modifier = Modifier.height(pillSpacing))\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n\n            Spacer(modifier = Modifier.weight(1f))\n\n            Column(\n                modifier = Modifier.fillMaxWidth(),\n                horizontalAlignment = Alignment.CenterHorizontally\n            ) {\n                Row(\n                    verticalAlignment = Alignment.CenterVertically,\n                ) {\n                    Text(\n                        stringResource(R.string.app_name),\n                        style = TextStyle(\n                            color = Color.White,\n                            fontSize = 5.5.sp\n                        )\n                    )\n                }\n            }\n\n            Box(\n                modifier = Modifier\n                    .fillMaxWidth()\n                    .padding(top = 2.dp)\n            ) {\n                Text(\n                    stringResource(R.string.support_privacy_focused_apps),\n                    style = TextStyle(\n                        color = Color.White.copy(alpha = 0.8f),\n                        fontSize = 4.sp\n                    ),\n                    modifier = Modifier.align(Alignment.Center)\n                )\n                Text(\n                    LocalDate.now().format(\n                        DateTimeFormatter.ofPattern(\"dd/MM/yyyy\")\n                    ),\n                    style = TextStyle(\n                        color = Color.White.copy(alpha = 0.8f),\n                        fontSize = 5.sp\n                    ),\n                    modifier = Modifier.align(Alignment.CenterEnd)\n                )\n            }\n        }\n    }\n}\n\n@Composable\nprivate fun RatingPill(\n    label: String,\n    rating: Int,\n    modifier: Modifier = Modifier,\n) {\n    Row(\n        verticalAlignment = Alignment.CenterVertically,\n        modifier = modifier\n            .background(Color.White.copy(alpha = 0.08f), shape = RoundedCornerShape(10.dp))\n            .padding(start = 7.dp, end = 7.dp, top = 3.dp, bottom = 3.dp)\n    ) {\n        Text(\n            text = label,\n            style = TextStyle(\n                color = Color.White.copy(alpha = 0.9f),\n                fontSize = 6.sp\n            ),\n            modifier = Modifier.width(40.dp),\n            textAlign = TextAlign.Start\n        )\n        Spacer(modifier = Modifier.width(4.dp))\n        val circleColor = when (rating) {\n            Rating.GOOD -> Color(0xFF4CAF50)\n            Rating.AVERAGE -> Color(0xFFFFC107)\n            Rating.BAD -> Color(0xFFF44336)\n            else -> Color.Transparent\n        }\n        Box(\n            modifier = Modifier\n                .size(7.dp)\n                .background(circleColor, shape = CircleShape)\n        )\n    }\n}\n\nprivate fun hasRating(rating: Int): Boolean {\n    return rating == Rating.GOOD || rating == Rating.AVERAGE || rating == Rating.BAD\n}\n\nconst val WIDTH = 5\nconst val HEIGHT = 5\n\n@Preview\n@Composable\nfun ShareScreenshotPreview() {\n    val sharedEvaluation =\n        SharedEvaluation(\n            \"My great app\",\n            \"my.great.app\",\n            Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888),\n            1,\n            2\n        )\n    ShareScreenshot(sharedEvaluation)\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/SplashActivity.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.Intent\nimport android.os.Build\nimport android.os.Bundle\nimport android.os.Handler\nimport android.view.WindowManager\nimport androidx.appcompat.app.AppCompatActivity\nimport androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen\nimport com.klee.sapio.databinding.ActivitySplashBinding\n\nclass SplashActivity : AppCompatActivity() {\n\n    companion object {\n        const val SPLASH_DELAY_MS = 2000\n    }\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        val splashScreen = installSplashScreen()\n        splashScreen.setKeepOnScreenCondition {\n            Build.VERSION.SDK_INT >= Build.VERSION_CODES.S\n        }\n\n        window.setFlags(\n            WindowManager.LayoutParams.FLAG_FULLSCREEN,\n            WindowManager.LayoutParams.FLAG_FULLSCREEN\n        )\n\n        val binding = ActivitySplashBinding.inflate(layoutInflater)\n        setContentView(binding.root)\n\n        val delay = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) 0 else SPLASH_DELAY_MS\n\n        Handler().postDelayed({\n            val intent = Intent(this@SplashActivity, MainActivity::class.java)\n            startActivity(intent)\n            finish()\n        }, delay.toLong())\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/SuccessFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.activityViewModels\nimport androidx.lifecycle.lifecycleScope\nimport com.klee.sapio.databinding.FragmentSuccessBinding\nimport com.klee.sapio.ui.viewmodel.AppEvaluationsViewModel\nimport dagger.hilt.android.AndroidEntryPoint\nimport kotlinx.coroutines.flow.launchIn\nimport kotlinx.coroutines.flow.onEach\n\n@AndroidEntryPoint\nclass SuccessFragment : Fragment() {\n\n    private lateinit var mBinding: FragmentSuccessBinding\n    private val mViewModel by activityViewModels<AppEvaluationsViewModel>()\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        val packageName = arguments?.getString(\"package\").orEmpty()\n        val appName = arguments?.getString(\"name\").orEmpty()\n\n        mBinding = FragmentSuccessBinding.inflate(inflater, container, false)\n        mBinding.emoji.text = \"\\uD83C\\uDF89 \\uD83E\\uDD73\"\n        mViewModel.listEvaluations(packageName)\n        mBinding.shareEvaluation.setOnClickListener {\n            (requireActivity() as MainActivity).navigateToEvaluations(\n                packageName,\n                appName,\n                shareImmediately = true\n            )\n        }\n\n        mViewModel.uiState.onEach { state ->\n            mBinding.shareEvaluation.isEnabled = state.microgUser != null || state.bareAospUser != null\n        }.launchIn(viewLifecycleOwner.lifecycleScope)\n\n        return mBinding.root\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/ToastMessage.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.content.Context\nimport android.widget.Toast\n\nobject ToastMessage {\n\n    fun showNetworkIssue(context: Context) {\n        Toast.makeText(\n            context,\n            \"Sapio's server cannot be reached.\",\n            Toast.LENGTH_LONG\n        ).show()\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/view/WarningFragment.kt",
    "content": "package com.klee.sapio.ui.view\n\nimport android.os.Build\nimport android.os.Bundle\nimport android.text.Html\nimport android.text.method.LinkMovementMethod\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.fragment.app.Fragment\nimport androidx.navigation.fragment.findNavController\nimport com.klee.sapio.R\nimport com.klee.sapio.databinding.FragmentWarningBinding\nimport com.klee.sapio.domain.DeviceInfo\nimport com.klee.sapio.domain.model.GmsType\nimport dagger.hilt.android.AndroidEntryPoint\nimport javax.inject.Inject\n\n@AndroidEntryPoint\nclass WarningFragment : Fragment() {\n\n    @Inject\n    lateinit var mDeviceInfo: DeviceInfo\n\n    private lateinit var mBinding: FragmentWarningBinding\n\n    override fun onCreateView(\n        inflater: LayoutInflater,\n        container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        mBinding = FragmentWarningBinding.inflate(inflater, container, false)\n        mBinding.reportAppDescription.text = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\n            Html.fromHtml(getString(R.string.warning_desc, AboutFragment.RATING_RULES), Html.FROM_HTML_MODE_LEGACY)\n        } else {\n            @Suppress(\"DEPRECATION\")\n            Html.fromHtml(getString(R.string.warning_desc, AboutFragment.RATING_RULES))\n        }\n\n        mBinding.reportAppDescription.movementMethod = LinkMovementMethod.getInstance()\n\n        mBinding.proceedButton.setOnClickListener {\n            findNavController().navigate(R.id.action_warningFragment_to_chooseAppFragment)\n        }\n\n        mBinding.checkbox.setOnClickListener {\n            updateProceedButton()\n        }\n\n        updateProceedButton()\n        return mBinding.root\n    }\n\n    private fun updateProceedButton() {\n        mBinding.proceedButton.isEnabled =\n            mDeviceInfo.getGmsType() != GmsType.GOOGLE_PLAY_SERVICES && mBinding.checkbox.isChecked\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/viewmodel/AppEvaluationsViewModel.kt",
    "content": "package com.klee.sapio.ui.viewmodel\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModelScope\nimport com.klee.sapio.domain.AppSettings\nimport com.klee.sapio.domain.FetchAppEvaluationUseCase\nimport com.klee.sapio.domain.FetchIconUrlUseCase\nimport com.klee.sapio.domain.model.GmsType\nimport com.klee.sapio.domain.model.UserType\nimport com.klee.sapio.ui.state.AppEvaluationsUiState\nimport dagger.hilt.android.lifecycle.HiltViewModel\nimport kotlinx.coroutines.CoroutineDispatcher\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.Job\nimport kotlinx.coroutines.flow.MutableStateFlow\nimport kotlinx.coroutines.flow.asStateFlow\nimport kotlinx.coroutines.flow.update\nimport kotlinx.coroutines.launch\nimport javax.inject.Inject\n\n@HiltViewModel\nclass AppEvaluationsViewModel @Inject constructor(\n    private val fetchAppEvaluationUseCase: FetchAppEvaluationUseCase,\n    private val fetchIconUrlUseCase: FetchIconUrlUseCase,\n    private val settings: AppSettings\n) : ViewModel() {\n\n    internal var ioDispatcher: CoroutineDispatcher = Dispatchers.IO\n\n    private val _uiState = MutableStateFlow(AppEvaluationsUiState())\n    val uiState = _uiState.asStateFlow()\n\n    private var loadingJob: Job? = null\n\n    companion object {\n        private const val FETCHES_WITH_UNSAFE = 5\n        private const val FETCHES_WITHOUT_UNSAFE = 3\n    }\n\n    fun listEvaluations(packageName: String) {\n        loadingJob?.cancel()\n        _uiState.value = AppEvaluationsUiState()\n\n        val expectedFetches = if (settings.isUnsafeConfigurationEnabled()) FETCHES_WITH_UNSAFE else FETCHES_WITHOUT_UNSAFE\n        _uiState.update { it.copy(pendingCount = expectedFetches) }\n\n        loadingJob = viewModelScope.launch {\n            launch(ioDispatcher) {\n                _uiState.update {\n                    it.copy(\n                        microgUser = fetchAppEvaluationUseCase(\n                            packageName,\n                            GmsType.MICROG,\n                            UserType.SECURE\n                        ).getOrNull(),\n                        pendingCount = it.pendingCount - 1\n                    )\n                }\n            }\n\n            launch(ioDispatcher) {\n                _uiState.update {\n                    it.copy(\n                        bareAospUser = fetchAppEvaluationUseCase(\n                            packageName,\n                            GmsType.BARE_AOSP,\n                            UserType.SECURE\n                        ).getOrNull(),\n                        pendingCount = it.pendingCount - 1\n                    )\n                }\n            }\n\n            if (settings.isUnsafeConfigurationEnabled()) {\n                launch(ioDispatcher) {\n                    _uiState.update {\n                        it.copy(\n                            microgRoot = fetchAppEvaluationUseCase(\n                                packageName,\n                                GmsType.MICROG,\n                                UserType.UNSAFE\n                            ).getOrNull(),\n                            pendingCount = it.pendingCount - 1\n                        )\n                    }\n                }\n\n                launch(ioDispatcher) {\n                    _uiState.update {\n                        it.copy(\n                            bareAospRoot = fetchAppEvaluationUseCase(\n                                packageName,\n                                GmsType.BARE_AOSP,\n                                UserType.UNSAFE\n                            ).getOrNull(),\n                            pendingCount = it.pendingCount - 1\n                        )\n                    }\n                }\n            }\n\n            launch(ioDispatcher) {\n                _uiState.update {\n                    it.copy(iconUrl = fetchIconUrlUseCase(packageName).getOrDefault(\"\"))\n                }\n            }\n        }\n    }\n\n    fun onIconDisplayed() {\n        _uiState.update { it.copy(pendingCount = it.pendingCount - 1) }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/viewmodel/ChooseAppViewModel.kt",
    "content": "package com.klee.sapio.ui.viewmodel\n\nimport android.content.BroadcastReceiver\nimport android.content.Context\nimport android.content.Intent\nimport android.content.IntentFilter\nimport androidx.core.content.ContextCompat\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModelScope\nimport com.klee.sapio.domain.CheckFdroidAvailabilityUseCase\nimport com.klee.sapio.domain.InstalledApplicationsDataSource\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.ui.state.ChooseAppUiState\nimport dagger.hilt.android.lifecycle.HiltViewModel\nimport dagger.hilt.android.qualifiers.ApplicationContext\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.async\nimport kotlinx.coroutines.awaitAll\nimport kotlinx.coroutines.coroutineScope\nimport kotlinx.coroutines.flow.MutableStateFlow\nimport kotlinx.coroutines.flow.asStateFlow\nimport kotlinx.coroutines.flow.update\nimport kotlinx.coroutines.launch\nimport kotlinx.coroutines.sync.Semaphore\nimport kotlinx.coroutines.sync.withPermit\nimport kotlinx.coroutines.withContext\nimport javax.inject.Inject\n\n@HiltViewModel\nclass ChooseAppViewModel @Inject constructor(\n    private val installedApplicationsDataSource: InstalledApplicationsDataSource,\n    private val checkFdroidAvailabilityUseCase: CheckFdroidAvailabilityUseCase,\n    @ApplicationContext private val context: Context\n) : ViewModel() {\n\n    private val _uiState = MutableStateFlow(ChooseAppUiState())\n    val uiState = _uiState.asStateFlow()\n\n    private val packageReceiver = object : BroadcastReceiver() {\n        override fun onReceive(context: Context, intent: Intent) {\n            if (intent.action == Intent.ACTION_PACKAGE_ADDED || intent.action == Intent.ACTION_PACKAGE_REMOVED) {\n                loadApps()\n            }\n        }\n    }\n\n    init {\n        loadApps()\n        val filter = IntentFilter().apply {\n            addAction(Intent.ACTION_PACKAGE_ADDED)\n            addAction(Intent.ACTION_PACKAGE_REMOVED)\n            addDataScheme(\"package\")\n        }\n        ContextCompat.registerReceiver(context, packageReceiver, filter, ContextCompat.RECEIVER_EXPORTED)\n    }\n\n    override fun onCleared() {\n        super.onCleared()\n        context.unregisterReceiver(packageReceiver)\n    }\n\n    private fun loadApps() {\n        viewModelScope.launch {\n            val allApps = withContext(Dispatchers.IO) {\n                installedApplicationsDataSource.listInstalledApplications()\n            }\n            val filtered = filterFdroidApps(allApps)\n            _uiState.update { it.copy(apps = filtered, isLoading = false) }\n        }\n    }\n\n    private suspend fun filterFdroidApps(apps: List<InstalledApplication>): List<InstalledApplication> {\n        val semaphore = Semaphore(PARALLEL_REQUESTS)\n        return coroutineScope {\n            apps.map { app ->\n                async(Dispatchers.IO) {\n                    semaphore.withPermit {\n                        if (checkFdroidAvailabilityUseCase(app.packageName)) null else app\n                    }\n                }\n            }.awaitAll().filterNotNull()\n        }\n    }\n\n    companion object {\n        private const val PARALLEL_REQUESTS = 10\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/viewmodel/EvaluateViewModel.kt",
    "content": "package com.klee.sapio.ui.viewmodel\n\nimport androidx.lifecycle.ViewModel\nimport com.klee.sapio.domain.DeviceInfo\nimport com.klee.sapio.ui.state.EvaluateUiState\nimport dagger.hilt.android.lifecycle.HiltViewModel\nimport kotlinx.coroutines.flow.MutableStateFlow\nimport kotlinx.coroutines.flow.asStateFlow\nimport javax.inject.Inject\n\n@HiltViewModel\nclass EvaluateViewModel @Inject constructor(\n    deviceInfo: DeviceInfo\n) : ViewModel() {\n\n    private val _uiState = MutableStateFlow(\n        EvaluateUiState(\n            gmsType = deviceInfo.getGmsType(),\n            userType = deviceInfo.isUnsafe()\n        )\n    )\n    val uiState = _uiState.asStateFlow()\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/viewmodel/FeedViewModel.kt",
    "content": "package com.klee.sapio.ui.viewmodel\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModelScope\nimport com.klee.sapio.domain.ListLatestEvaluationsUseCase\nimport com.klee.sapio.ui.state.FeedUiState\nimport dagger.hilt.android.lifecycle.HiltViewModel\nimport kotlinx.coroutines.flow.MutableStateFlow\nimport kotlinx.coroutines.flow.asStateFlow\nimport kotlinx.coroutines.flow.update\nimport kotlinx.coroutines.launch\nimport javax.inject.Inject\n\n@HiltViewModel\nclass FeedViewModel @Inject constructor(\n    private val listLatestEvaluationsUseCase: ListLatestEvaluationsUseCase\n) : ViewModel() {\n\n    private var currentPage = 0\n    private var hasMorePages = true\n    private var lastLoadedUnsafeLevel: Int? = null\n\n    private val _uiState = MutableStateFlow(FeedUiState(isLoading = true))\n    val uiState = _uiState.asStateFlow()\n\n    init {\n        refresh()\n    }\n\n    fun syncUnsafeConfiguration(currentLevel: Int) {\n        val last = lastLoadedUnsafeLevel\n        if (last == null) {\n            lastLoadedUnsafeLevel = currentLevel\n        } else if (last != currentLevel) {\n            lastLoadedUnsafeLevel = currentLevel\n            refresh()\n        }\n    }\n\n    fun refresh() {\n        viewModelScope.launch {\n            currentPage = 0\n            hasMorePages = true\n            _uiState.update { it.copy(items = emptyList(), isLoading = true, isLoadingMore = false, hasError = false) }\n            loadPage()\n        }\n    }\n\n    fun loadNextPage() {\n        val state = _uiState.value\n        if (state.isLoading || state.isLoadingMore || !hasMorePages) return\n        viewModelScope.launch {\n            _uiState.update { it.copy(isLoadingMore = true) }\n            loadPage()\n        }\n    }\n\n    private suspend fun loadPage() {\n        currentPage++\n        val result = listLatestEvaluationsUseCase(currentPage)\n        if (result.isFailure) {\n            _uiState.update { it.copy(isLoading = false, isLoadingMore = false, hasError = true) }\n            return\n        }\n\n        val newItems = result.getOrDefault(emptyList())\n        _uiState.update {\n            val combined = (it.items + newItems).distinctBy { item ->\n                Triple(item.packageName, item.microg, item.secure)\n            }\n            hasMorePages = combined.size > it.items.size\n            it.copy(\n                items = combined,\n                isLoading = false,\n                isLoadingMore = false\n            )\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/viewmodel/LoadingViewModel.kt",
    "content": "package com.klee.sapio.ui.viewmodel\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModelScope\nimport com.klee.sapio.domain.EvaluateAppUseCase\nimport com.klee.sapio.domain.InstalledApplicationsDataSource\nimport com.klee.sapio.ui.state.EvaluateEvent\nimport dagger.hilt.android.lifecycle.HiltViewModel\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.flow.asSharedFlow\nimport kotlinx.coroutines.launch\nimport javax.inject.Inject\n\n@HiltViewModel\nclass LoadingViewModel @Inject constructor(\n    private val installedApplicationsDataSource: InstalledApplicationsDataSource,\n    private val evaluateAppUseCase: EvaluateAppUseCase\n) : ViewModel() {\n\n    private val _events = MutableSharedFlow<EvaluateEvent>()\n    val events = _events.asSharedFlow()\n\n    fun submit(packageName: String, appName: String, rating: Int) {\n        viewModelScope.launch {\n            val app = installedApplicationsDataSource.getInstalledApplication(packageName)\n            if (app == null) {\n                _events.emit(EvaluateEvent.ShowError)\n                return@launch\n            }\n            val result = evaluateAppUseCase(app, rating)\n            if (result.isSuccess) {\n                _events.emit(EvaluateEvent.NavigateToSuccess(packageName, appName))\n            } else {\n                _events.emit(EvaluateEvent.ShowError)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/viewmodel/MyAppsViewModel.kt",
    "content": "package com.klee.sapio.ui.viewmodel\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModelScope\nimport com.klee.sapio.domain.CheckFdroidAvailabilityUseCase\nimport com.klee.sapio.domain.DeviceAppCacheRepository\nimport com.klee.sapio.domain.DeviceInfo\nimport com.klee.sapio.domain.FetchAppEvaluationUseCase\nimport com.klee.sapio.domain.InstalledApplicationsDataSource\nimport com.klee.sapio.domain.model.CachedDeviceApp\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.ui.model.InstalledAppWithRating\nimport com.klee.sapio.ui.state.MyAppsUiState\nimport dagger.hilt.android.lifecycle.HiltViewModel\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.async\nimport kotlinx.coroutines.awaitAll\nimport kotlinx.coroutines.coroutineScope\nimport kotlinx.coroutines.flow.MutableStateFlow\nimport kotlinx.coroutines.flow.asStateFlow\nimport kotlinx.coroutines.flow.update\nimport kotlinx.coroutines.launch\nimport kotlinx.coroutines.sync.Semaphore\nimport kotlinx.coroutines.sync.withPermit\nimport kotlinx.coroutines.withContext\nimport java.util.concurrent.atomic.AtomicInteger\nimport javax.inject.Inject\n\n@HiltViewModel\nclass MyAppsViewModel @Inject constructor(\n    private val installedApplicationsDataSource: InstalledApplicationsDataSource,\n    private val fetchAppEvaluationUseCase: FetchAppEvaluationUseCase,\n    private val checkFdroidAvailabilityUseCase: CheckFdroidAvailabilityUseCase,\n    private val deviceInfo: DeviceInfo,\n    private val deviceAppCacheRepository: DeviceAppCacheRepository\n) : ViewModel() {\n\n    private val _uiState = MutableStateFlow(MyAppsUiState())\n    val uiState = _uiState.asStateFlow()\n\n    private var lastLoadTime: Long? = null\n\n    private fun isCacheValid(timestamp: Long?): Boolean {\n        val last = timestamp ?: return false\n        return System.currentTimeMillis() - last < CACHE_VALIDITY_MS\n    }\n\n    fun loadApps(forceRefresh: Boolean = false) {\n        if (_uiState.value.isLoading || _uiState.value.isRefreshing) return\n        if (!forceRefresh && _uiState.value.items.isNotEmpty() && isCacheValid(lastLoadTime)) return\n\n        viewModelScope.launch {\n            if (forceRefresh) {\n                _uiState.update { it.copy(isLoading = true, isRefreshing = true, progress = 0) }\n                fetchFromWebAndSave()\n            } else {\n                _uiState.update { it.copy(isLoading = true, progress = 0) }\n                val entities = withContext(Dispatchers.IO) { deviceAppCacheRepository.getAll() }\n                val lastCachedAt = entities.maxOfOrNull { it.cachedAt }\n\n                if (entities.isNotEmpty() && isCacheValid(lastCachedAt)) {\n                    val result = buildListFromEntities(entities)\n                    lastLoadTime = lastCachedAt\n                    _uiState.update { it.copy(items = result, isLoading = false) }\n                } else {\n                    fetchFromWebAndSave()\n                }\n            }\n        }\n    }\n\n    private suspend fun buildListFromEntities(\n        entities: List<CachedDeviceApp>\n    ): List<InstalledAppWithRating> {\n        val installedMap = withContext(Dispatchers.IO) {\n            installedApplicationsDataSource.listInstalledApplications().associateBy { it.packageName }\n        }\n        val total = entities.size\n        val result = mutableListOf<InstalledAppWithRating>()\n        entities.forEachIndexed { index, entity ->\n            val installedApp = installedMap[entity.packageName] ?: return@forEachIndexed\n            val evaluation = entity.rating?.let { rating ->\n                Evaluation(\n                    name = installedApp.name,\n                    packageName = entity.packageName,\n                    iconUrl = null,\n                    rating = rating,\n                    microg = 0,\n                    secure = 0,\n                    updatedAt = null,\n                    createdAt = null,\n                    publishedAt = null,\n                    versionName = null\n                )\n            }\n            result.add(InstalledAppWithRating(installedApp, evaluation))\n            _uiState.update { it.copy(progress = ((index + 1) * 100) / total) }\n        }\n        return result\n    }\n\n    private suspend fun fetchFromWebAndSave() {\n        val gmsType = deviceInfo.getGmsType()\n        val userType = deviceInfo.isUnsafe()\n\n        val installedApps = withContext(Dispatchers.IO) {\n            installedApplicationsDataSource.listInstalledApplications()\n        }\n\n        val total = installedApps.size\n        val semaphore = Semaphore(PARALLEL_REQUESTS)\n        val completed = AtomicInteger(0)\n\n        val result = coroutineScope {\n            installedApps.map { app ->\n                async(Dispatchers.IO) {\n                    semaphore.withPermit {\n                        val isFdroid = checkFdroidAvailabilityUseCase(app.packageName)\n                        val item = if (!isFdroid) {\n                            val evaluation = fetchAppEvaluationUseCase(\n                                app.packageName,\n                                gmsType,\n                                userType\n                            ).getOrNull()\n                            InstalledAppWithRating(app, evaluation)\n                        } else {\n                            null\n                        }\n                        _uiState.update { state ->\n                            state.copy(progress = (completed.incrementAndGet() * 100) / total)\n                        }\n                        item\n                    }\n                }\n            }.awaitAll().filterNotNull()\n        }\n\n        val now = System.currentTimeMillis()\n        val entities = result.map { item ->\n            CachedDeviceApp(\n                packageName = item.installedApp.packageName,\n                rating = item.evaluation?.rating,\n                cachedAt = now\n            )\n        }\n\n        withContext(Dispatchers.IO) {\n            deviceAppCacheRepository.replaceAll(entities)\n        }\n\n        lastLoadTime = now\n        _uiState.update { it.copy(items = result, isLoading = false, isRefreshing = false) }\n    }\n\n    companion object {\n        private const val CACHE_VALIDITY_MS = 86_400_000L\n        private const val PARALLEL_REQUESTS = 10\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/ui/viewmodel/SearchViewModel.kt",
    "content": "package com.klee.sapio.ui.viewmodel\n\nimport androidx.lifecycle.ViewModel\nimport androidx.lifecycle.viewModelScope\nimport com.klee.sapio.domain.SearchEvaluationUseCase\nimport com.klee.sapio.ui.state.SearchUiState\nimport dagger.hilt.android.lifecycle.HiltViewModel\nimport kotlinx.coroutines.flow.MutableStateFlow\nimport kotlinx.coroutines.flow.asStateFlow\nimport kotlinx.coroutines.flow.update\nimport kotlinx.coroutines.launch\nimport javax.inject.Inject\n\n@HiltViewModel\nclass SearchViewModel @Inject constructor(\n    private val searchEvaluationUseCase: SearchEvaluationUseCase\n) : ViewModel() {\n\n    private val _uiState = MutableStateFlow(SearchUiState())\n    val uiState = _uiState.asStateFlow()\n\n    fun searchApplication(pattern: String, onError: () -> Unit) {\n        _uiState.update { it.copy(query = pattern, isLoading = true, hasError = false) }\n        viewModelScope.launch {\n            val result = searchEvaluationUseCase(pattern)\n            val list = result.getOrDefault(emptyList())\n            val hasError = result.isFailure\n\n            if (list.isEmpty() || hasError) {\n                onError.invoke()\n            }\n\n            _uiState.update {\n                it.copy(\n                    items = list,\n                    isLoading = false,\n                    hasError = hasError\n                )\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/work/CompatibilityCheckScheduler.kt",
    "content": "package com.klee.sapio.work\n\nimport android.content.Context\nimport androidx.work.Constraints\nimport androidx.work.ExistingPeriodicWorkPolicy\nimport androidx.work.NetworkType\nimport androidx.work.PeriodicWorkRequestBuilder\nimport androidx.work.WorkManager\nimport java.util.concurrent.TimeUnit\n\nobject CompatibilityCheckScheduler {\n    private const val UNIQUE_WORK_NAME = \"compatibility_check\"\n    private const val UNIQUE_WORK_NOW_NAME = \"compatibility_check_now\"\n    private const val REPEAT_INTERVAL_DAYS = 7L\n    private const val FLEX_INTERVAL_DAYS = 1L\n\n    fun schedule(context: Context) {\n        if (!WorkManager.isInitialized()) {\n            return\n        }\n        val constraints = Constraints.Builder()\n            .setRequiredNetworkType(NetworkType.CONNECTED)\n            .build()\n\n        val request = PeriodicWorkRequestBuilder<CompatibilityCheckWorker>(\n            REPEAT_INTERVAL_DAYS,\n            TimeUnit.DAYS,\n            FLEX_INTERVAL_DAYS,\n            TimeUnit.DAYS\n        )\n            .setConstraints(constraints)\n            .build()\n\n        WorkManager.getInstance(context)\n            .enqueueUniquePeriodicWork(\n                UNIQUE_WORK_NAME,\n                ExistingPeriodicWorkPolicy.UPDATE,\n                request\n            )\n    }\n\n    fun runNow(context: Context) {\n        if (!WorkManager.isInitialized()) {\n            return\n        }\n        val constraints = Constraints.Builder()\n            .setRequiredNetworkType(NetworkType.CONNECTED)\n            .build()\n\n        val request = androidx.work.OneTimeWorkRequestBuilder<CompatibilityCheckWorker>()\n            .setConstraints(constraints)\n            .build()\n\n        WorkManager.getInstance(context)\n            .enqueueUniqueWork(\n                UNIQUE_WORK_NOW_NAME,\n                androidx.work.ExistingWorkPolicy.REPLACE,\n                request\n            )\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/work/CompatibilityCheckWorker.kt",
    "content": "package com.klee.sapio.work\n\nimport android.content.Context\nimport androidx.work.CoroutineWorker\nimport androidx.work.WorkerParameters\nimport com.klee.sapio.domain.EvaluationRepository\nimport com.klee.sapio.domain.DeviceInfo\nimport com.klee.sapio.domain.InstalledApplicationsDataSource\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.domain.model.GmsType\nimport com.klee.sapio.domain.model.UserType\nimport com.klee.sapio.ui.model.Rating\nimport dagger.hilt.EntryPoint\nimport dagger.hilt.InstallIn\nimport dagger.hilt.android.EntryPointAccessors\nimport dagger.hilt.components.SingletonComponent\nimport kotlin.random.Random\n\nclass CompatibilityCheckWorker(\n    appContext: Context,\n    params: WorkerParameters\n) : CoroutineWorker(appContext, params) {\n\n    override suspend fun doWork(): Result {\n        val entryPoint = EntryPointAccessors.fromApplication(\n            applicationContext,\n            CompatibilityWorkerEntryPoint::class.java\n        )\n        val deviceConfiguration = entryPoint.deviceConfiguration()\n        val gmsType = deviceConfiguration.getGmsType()\n\n        if (gmsType == GmsType.GOOGLE_PLAY_SERVICES) {\n            return Result.success()\n        }\n\n        val installedApps = entryPoint.installedApplicationsRepository()\n            .listInstalledApplications()\n\n        val evaluationRepository = entryPoint.evaluationRepository()\n        val userType = UserType.SECURE\n\n        val badApps = mutableListOf<InstalledApplication>()\n        val averageApps = mutableListOf<InstalledApplication>()\n        for (app in installedApps) {\n            when {\n                isBadCompatibility(evaluationRepository, app, gmsType, userType) -> {\n                    badApps.add(app)\n                }\n                isAverageCompatibility(evaluationRepository, app, gmsType, userType) -> {\n                    averageApps.add(app)\n                }\n            }\n        }\n\n        if (badApps.isNotEmpty()) {\n            val badApp = badApps[Random.nextInt(badApps.size)]\n            CompatibilityNotificationManager(applicationContext).show(badApp)\n        } else if (averageApps.isNotEmpty()) {\n            val averageApp = averageApps[Random.nextInt(averageApps.size)]\n            CompatibilityNotificationManager(applicationContext).show(averageApp)\n        }\n\n        return Result.success()\n    }\n\n    private suspend fun isBadCompatibility(\n        evaluationRepository: EvaluationRepository,\n        app: InstalledApplication,\n        gmsType: Int,\n        userType: Int\n    ): Boolean {\n        val evaluation = evaluationRepository.fetchEvaluation(app.packageName, gmsType, userType).getOrNull()\n        return evaluation?.rating == Rating.BAD\n    }\n\n    private suspend fun isAverageCompatibility(\n        evaluationRepository: EvaluationRepository,\n        app: InstalledApplication,\n        gmsType: Int,\n        userType: Int\n    ): Boolean {\n        val evaluation = evaluationRepository.fetchEvaluation(app.packageName, gmsType, userType).getOrNull()\n        return evaluation?.rating == Rating.AVERAGE\n    }\n}\n\n@EntryPoint\n@InstallIn(SingletonComponent::class)\ninterface CompatibilityWorkerEntryPoint {\n    fun installedApplicationsRepository(): InstalledApplicationsDataSource\n    fun evaluationRepository(): EvaluationRepository\n    fun deviceConfiguration(): DeviceInfo\n}\n"
  },
  {
    "path": "app/src/main/java/com/klee/sapio/work/CompatibilityNotificationManager.kt",
    "content": "package com.klee.sapio.work\n\nimport android.app.NotificationChannel\nimport android.app.NotificationManager\nimport android.app.PendingIntent\nimport android.content.Context\nimport android.content.Intent\nimport android.content.pm.PackageManager\nimport android.graphics.Bitmap\nimport android.os.Build\nimport androidx.core.app.NotificationCompat\nimport androidx.core.graphics.drawable.toBitmap\nimport com.klee.sapio.R\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.ui.view.MainActivity\n\nclass CompatibilityNotificationManager(\n    private val context: Context\n) {\n    fun show(app: InstalledApplication) {\n        notify(app)\n    }\n\n    private fun notify(app: InstalledApplication) {\n        val notificationManager =\n            context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager\n        ensureChannel(notificationManager)\n\n        val pendingIntent = createEvaluationPendingIntent(app, shareImmediately = false)\n        val sharePendingIntent = createEvaluationPendingIntent(app, shareImmediately = true)\n\n        val notification = buildNotification(app, pendingIntent, sharePendingIntent)\n        notificationManager.notify(NOTIFICATION_ID, notification)\n    }\n\n    private fun ensureChannel(notificationManager: NotificationManager) {\n        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {\n            return\n        }\n\n        val channel = NotificationChannel(\n            CHANNEL_ID,\n            context.getString(R.string.compatibility_check_channel_name),\n            NotificationManager.IMPORTANCE_DEFAULT\n        ).apply {\n            description = context.getString(R.string.compatibility_check_channel_description)\n        }\n        notificationManager.createNotificationChannel(channel)\n    }\n\n    private fun createEvaluationPendingIntent(\n        app: InstalledApplication,\n        shareImmediately: Boolean\n    ): PendingIntent {\n        val intent = Intent(context, MainActivity::class.java).apply {\n            putExtra(MainActivity.EXTRA_PACKAGE_NAME, app.packageName)\n            putExtra(MainActivity.EXTRA_APP_NAME, app.name)\n            if (shareImmediately) {\n                putExtra(MainActivity.EXTRA_SHARE_IMMEDIATELY, true)\n                putExtra(MainActivity.EXTRA_NOTIFICATION_ID, NOTIFICATION_ID)\n            }\n            flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP\n        }\n\n        val requestCode = if (shareImmediately) {\n            app.packageName.hashCode() + 1\n        } else {\n            app.packageName.hashCode()\n        }\n\n        return PendingIntent.getActivity(\n            context,\n            requestCode,\n            intent,\n            PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE\n        )\n    }\n\n    private fun getAppIcon(packageName: String): Bitmap? {\n        return try {\n            context.packageManager.getApplicationIcon(packageName).toBitmap()\n        } catch (e: PackageManager.NameNotFoundException) {\n            null\n        }\n    }\n\n    private fun buildNotification(\n        app: InstalledApplication,\n        pendingIntent: PendingIntent,\n        sharePendingIntent: PendingIntent\n    ) = NotificationCompat.Builder(context, CHANNEL_ID)\n        .setSmallIcon(R.drawable.ic_notification_info)\n        .apply {\n            val icon = getAppIcon(app.packageName)\n            if (icon != null) {\n                setLargeIcon(icon)\n            }\n        }\n        .setContentTitle(context.getString(R.string.compatibility_check_notification_title))\n        .setContentText(\n            context.getString(\n                R.string.compatibility_check_notification_body,\n                app.name\n            )\n        )\n        .setStyle(\n            NotificationCompat.BigTextStyle().bigText(\n                context.getString(\n                    R.string.compatibility_check_notification_body,\n                    app.name\n                )\n            )\n        )\n        .setAutoCancel(false)\n        .setContentIntent(pendingIntent)\n        .addAction(\n            android.R.drawable.ic_menu_share,\n            context.getString(R.string.compatibility_check_notification_share_action),\n            sharePendingIntent\n        )\n        .build()\n\n    private companion object {\n        const val CHANNEL_ID = \"compatibility_check\"\n        const val NOTIFICATION_ID = 2201\n    }\n}\n"
  },
  {
    "path": "app/src/main/res/drawable/bg_label_rounded.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:shape=\"rectangle\">\n    <solid android:color=\"@android:color/white\" />\n    <corners android:radius=\"6dp\" />\n</shape>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_close.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\"\n    android:tint=\"?attr/colorOnSurfaceVariant\">\n  <path\n      android:fillColor=\"#FFFFFFFF\"\n      android:pathData=\"M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12 19,6.41Z\"/>\n</vector>"
  },
  {
    "path": "app/src/main/res/drawable/ic_info_background.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector\n    android:height=\"108dp\"\n    android:width=\"108dp\"\n    android:viewportHeight=\"108\"\n    android:viewportWidth=\"108\"\n    xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:fillColor=\"#3DDC84\"\n          android:pathData=\"M0,0h108v108h-108z\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M9,0L9,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M19,0L19,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M29,0L29,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M39,0L39,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M49,0L49,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M59,0L59,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M69,0L69,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M79,0L79,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M89,0L89,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M99,0L99,108\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,9L108,9\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,19L108,19\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,29L108,29\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,39L108,39\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,49L108,49\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,59L108,59\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,69L108,69\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,79L108,79\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,89L108,89\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M0,99L108,99\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M19,29L89,29\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M19,39L89,39\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M19,49L89,49\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M19,59L89,59\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M19,69L89,69\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M19,79L89,79\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M29,19L29,89\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M39,19L39,89\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M49,19L49,89\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M59,19L59,89\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M69,19L69,89\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n    <path android:fillColor=\"#00000000\" android:pathData=\"M79,19L79,89\"\n          android:strokeColor=\"#33FFFFFF\" android:strokeWidth=\"0.8\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_launcher_foreground.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"108dp\"\n    android:height=\"108dp\"\n    android:viewportWidth=\"108\"\n    android:viewportHeight=\"108\">\n  <path\n      android:pathData=\"M62.3,73.24c-1.8,-1.34 -0.23,-6.25 -0.23,-8.66l-9.47,2.77 5.96,10.9a2.5,2.5 0,0 0,2.19 1.3c1.65,0 2.84,-1.57 2.41,-3.16z\"\n      android:fillColor=\"#eab1b7\"/>\n  <path\n      android:pathData=\"M59.33,67.35c0,4.05 3.28,7.33 7.33,7.33h1.29c4.81,0 9,-3.47 9.56,-7.93 -1.16,0.39 -3.2,-3.79 -4.49,-3.79Z\"\n      android:fillColor=\"#e28086\"/>\n  <path\n      android:pathData=\"M43.88,67.35h29.94c3.23,0 6.15,-1.31 8.27,-3.43 1.55,-1.56 1.56,-4.08 0,-5.63l-1.03,-1.03 0.2,0.2c1.56,1.56 4.24,0.47 4.25,-1.73l0,-0.05c0,-7.47 -3.01,-14.23 -7.87,-19.15 -0.97,-0.98 -2.56,-1 -3.54,-0.02l-0.34,0.34c1.11,-1.11 0.93,-2.96 -0.38,-3.83h0c-4.32,-2.88 -9.51,-4.56 -15.09,-4.56H56.49c-1.38,0 -2.49,1.12 -2.49,2.49 0,-1.38 -1.12,-2.49 -2.49,-2.49h-5.56c-4.14,0 -8.11,1.05 -11.6,2.94 -1.46,0.79 -1.73,2.77 -0.56,3.94l-0.62,-0.62c-0.93,-0.93 -2.43,-0.98 -3.42,-0.1 -2.89,2.57 -5.16,5.84 -6.6,9.6 -2.48,6.57 2.38,13.58 9.39,13.58h2.37a0.31,0.31 0,0 1,0.3 0.33,8.76 8.76,0 0,0 -0.02,0.57c-0,4.79 3.89,8.67 8.68,8.66z\"\n      android:fillColor=\"#eab1b7\"/>\n  <path\n      android:pathData=\"M77.63,36.52c-0.85,-0.86 -2.16,-0.98 -3.13,-0.35 3.71,4.65 5.93,10.55 5.93,16.96v0.03c-0.02,6.44 -5.24,11.65 -11.68,11.65H38.81a8.73,8.73 0,0 1,-1.14 -0.07c1.58,1.61 3.78,2.61 6.21,2.61h29.94c3.23,0 6.15,-1.31 8.27,-3.43 1.55,-1.56 1.56,-4.08 0,-5.63l-0.84,-0.84c1.56,1.56 4.24,0.47 4.25,-1.73v-0.05c0,-7.47 -3.01,-14.23 -7.87,-19.15z\"\n      android:fillColor=\"#e4989d\"/>\n  <path\n      android:pathData=\"M30.2,38.63c-0.37,0.41 -0.72,0.83 -1.05,1.27 -0.48,0.63 -0.42,1.51 0.14,2.07l0.02,0.02c0.67,0.67 1.78,0.6 2.36,-0.16 0.28,-0.37 0.58,-0.73 0.89,-1.07 0.55,-0.61 0.54,-1.54 -0.02,-2.14l-0.02,-0.02c-0.63,-0.67 -1.7,-0.65 -2.32,0.04zM29.5,49.86c-0.57,-0.83 -0.79,-1.77 -0.59,-2.78 0.1,-0.52 -0.05,-1.06 -0.43,-1.44 -0.88,-0.88 -2.39,-0.43 -2.65,0.79 -0.38,1.75 -0.16,3.46 1.06,5.23 0.9,1.31 2.17,2.22 3.63,2.67 1.01,0.31 2.02,-0.45 2.02,-1.51v-0.02c0,-0.68 -0.44,-1.3 -1.09,-1.5 -0.78,-0.23 -1.46,-0.73 -1.95,-1.44Z\"\n      android:fillColor=\"#f6d3d5\"/>\n  <path\n      android:pathData=\"M62.33,49.07h-2.38v-9.02a0.95,0.95 0,0 0,-0.95 -0.95,0.95 0.95,0 0,0 -0.95,0.95v9.02H48.53v-9.02a0.95,0.95 0,0 0,-0.95 -0.95,0.95 0.95,0 0,0 -0.95,0.95v9.02h-3.72c-1.53,0 -2.98,0.36 -4.26,1l-4.63,-4.63a0.95,0.95 0,1 0,-1.34 1.34l4.32,4.32c-2.03,1.59 -3.41,3.98 -3.66,6.68h1.58a0.31,0.31 0,0 1,0.3 0.27c0.32,-3.96 3.64,-7.09 7.69,-7.09h19.43a0.95,0.95 0,0 0,0.95 -0.95c-0,-0.53 -0.43,-0.95 -0.95,-0.95z\"\n      android:fillColor=\"#e4989d\"/>\n  <path\n      android:pathData=\"M62.79,57.05c3.11,0 6.03,-1.21 8.23,-3.41l2.94,-2.94a0.95,0.95 0,0 0,-1.34 -1.34l-2.94,2.94c-1.84,1.84 -4.29,2.85 -6.89,2.85L46.57,55.15c-2.01,0 -3.89,0.78 -5.31,2.2l-0.32,0.32a0.95,0.95 0,0 0,0 1.34,0.95 0.95,0 0,0 0.67,0.28 0.95,0.95 0,0 0,0.67 -0.28l0.32,-0.32c1.06,-1.06 2.47,-1.64 3.97,-1.64zM70.91,64.71c-2.51,-2.51 -5.86,-3.9 -9.41,-3.9L49.67,60.81a0.95,0.95 0,0 0,-0.95 0.95c0,0.52 0.43,0.95 0.95,0.95h11.82c3.05,0 5.91,1.19 8.07,3.34l1.3,1.3h2.69zM75.06,54.81c-0.37,0.37 -0.37,0.97 0,1.34a0.95,0.95 0,0 0,0.67 0.28,0.95 0.95,0 0,0 0.67,-0.28l1.71,-1.71c2.15,-2.15 2.52,-5.57 0.88,-8.13l-0.74,-1.16a0.95,0.95 0,0 0,-1.31 -0.29,0.95 0.95,0 0,0 -0.29,1.31l0.74,1.16c1.16,1.82 0.9,4.24 -0.63,5.76zM33.17,34.71c-0.82,-0.82 -2.09,-0.95 -3.06,-0.37l4.7,4.7a0.95,0.95 0,0 0,0.67 0.28,0.95 0.95,0 0,0 0.67,-0.28 0.95,0.95 0,0 0,0 -1.34zM53.05,40.26a0.95,0.95 0,0 0,0.95 -0.95v-8.38c0,-1.17 -0.81,-2.16 -1.9,-2.42v10.8c0,0.52 0.43,0.95 0.95,0.95zM74.12,33.79a2.48,2.48 0,0 0,-0.75 -0.78l0,-0a27.14,27.14 0,0 0,-5.53 -2.84,27.33 27.33,0 0,1 3.57,2.71c1.03,0.93 1.09,2.53 0.11,3.51l-3.47,3.47a0.95,0.95 0,0 0,1.34 1.34l4.36,-4.36c0.84,-0.84 0.94,-2.11 0.37,-3.06z\"\n      android:fillColor=\"#e4989d\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_notification_info.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\">\n\n    <path\n        android:fillColor=\"#FFFFFFFF\"\n        android:pathData=\"M11,7h2v2h-2zM11,11h2v6h-2z\" />\n\n    <path\n        android:fillColor=\"#FFFFFFFF\"\n        android:pathData=\"M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8s8,3.59 8,8s-3.59,8 -8,8z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_phone.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\">\n  <path\n      android:fillColor=\"#CC000000\"\n      android:pathData=\"M17,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,19H7V5h10v14z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_settings.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\"\n    android:tint=\"?attr/colorOnSurface\">\n  <path\n      android:fillColor=\"#FFFFFFFF\"\n      android:pathData=\"M19.14,12.94C19.18,12.64 19.2,12.33 19.2,12.02C19.2,11.71 19.18,11.39 19.13,11.09L21.17,9.51C21.35,9.37 21.4,9.1 21.29,8.9L19.39,5.58C19.27,5.36 19.03,5.3 18.8,5.38L16.41,6.34C15.9,5.95 15.37,5.62 14.77,5.38L14.47,3.1C14.44,2.86 14.23,2.68 13.98,2.68H10.18C9.93,2.68 9.72,2.86 9.68,3.11L9.38,5.39C8.78,5.64 8.25,5.96 7.74,6.35L5.35,5.39C5.11,5.29 4.87,5.37 4.75,5.59L2.85,8.91C2.73,9.12 2.79,9.38 2.97,9.52L5.01,11.1C4.96,11.4 4.94,11.71 4.94,12.02C4.94,12.33 4.96,12.64 5.01,12.94L2.97,14.52C2.79,14.66 2.74,14.93 2.85,15.13L4.75,18.45C4.87,18.67 5.11,18.73 5.35,18.65L7.74,17.69C8.25,18.08 8.78,18.41 9.38,18.65L9.68,20.93C9.72,21.18 9.93,21.36 10.18,21.36H13.98C14.23,21.36 14.44,21.18 14.48,20.93L14.78,18.65C15.38,18.4 15.91,18.08 16.42,17.69L18.81,18.65C19.04,18.74 19.28,18.66 19.4,18.44L21.3,15.12C21.42,14.91 21.37,14.65 21.19,14.51L19.14,12.94ZM12.08,15.5C10.15,15.5 8.58,13.93 8.58,12C8.58,10.07 10.15,8.5 12.08,8.5C14.01,8.5 15.58,10.07 15.58,12C15.58,13.93 14.01,15.5 12.08,15.5Z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_status_green.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"20dp\"\n    android:height=\"20dp\"\n    android:viewportWidth=\"20\"\n    android:viewportHeight=\"20\">\n    <path\n        android:fillColor=\"#4CAF50\"\n        android:pathData=\"M10,10 m-10,0 a10,10 0 1,0 20,0 a10,10 0 1,0 -20,0\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_status_red.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"20dp\"\n    android:height=\"20dp\"\n    android:viewportWidth=\"20\"\n    android:viewportHeight=\"20\">\n    <path\n        android:fillColor=\"#F44336\"\n        android:pathData=\"M10,10 m-10,0 a10,10 0 1,0 20,0 a10,10 0 1,0 -20,0\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_status_yellow.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"20dp\"\n    android:height=\"20dp\"\n    android:viewportWidth=\"20\"\n    android:viewportHeight=\"20\">\n    <path\n        android:fillColor=\"#FFC107\"\n        android:pathData=\"M10,10 m-10,0 a10,10 0 1,0 20,0 a10,10 0 1,0 -20,0\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable-anydpi/ic_add.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"960\"\n    android:viewportHeight=\"960\"\n    android:tint=\"#000000\"\n    android:alpha=\"0.8\">\n  <path\n      android:fillColor=\"@android:color/white\"\n      android:pathData=\"M720,560L720,440L600,440L600,360L720,360L720,240L800,240L800,360L920,360L920,440L800,440L800,560L720,560ZM360,480Q294,480 247,433Q200,386 200,320Q200,254 247,207Q294,160 360,160Q426,160 473,207Q520,254 520,320Q520,386 473,433Q426,480 360,480ZM40,800L40,688Q40,654 57.5,625.5Q75,597 104,582Q166,551 230,535.5Q294,520 360,520Q426,520 490,535.5Q554,551 616,582Q645,597 662.5,625.5Q680,654 680,688L680,800L40,800ZM120,720L600,720L600,688Q600,677 594.5,668Q589,659 580,654Q526,627 471,613.5Q416,600 360,600Q304,600 249,613.5Q194,627 140,654Q131,659 125.5,668Q120,677 120,688L120,720ZM360,400Q393,400 416.5,376.5Q440,353 440,320Q440,287 416.5,263.5Q393,240 360,240Q327,240 303.5,263.5Q280,287 280,320Q280,353 303.5,376.5Q327,400 360,400ZM360,320Q360,320 360,320Q360,320 360,320Q360,320 360,320Q360,320 360,320Q360,320 360,320Q360,320 360,320Q360,320 360,320Q360,320 360,320ZM360,720L360,720Q360,720 360,720Q360,720 360,720Q360,720 360,720Q360,720 360,720Q360,720 360,720Q360,720 360,720Q360,720 360,720Q360,720 360,720L360,720L360,720Z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable-anydpi/ic_search.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"960\"\n    android:viewportHeight=\"960\"\n    android:tint=\"#000000\"\n    android:alpha=\"0.8\">\n  <path\n      android:fillColor=\"@android:color/white\"\n      android:pathData=\"M784,840L532,588Q502,612 463,626Q424,640 380,640Q271,640 195.5,564.5Q120,489 120,380Q120,271 195.5,195.5Q271,120 380,120Q489,120 564.5,195.5Q640,271 640,380Q640,424 626,463Q612,502 588,532L840,784L784,840ZM380,560Q455,560 507.5,507.5Q560,455 560,380Q560,305 507.5,252.5Q455,200 380,200Q305,200 252.5,252.5Q200,305 200,380Q200,455 252.5,507.5Q305,560 380,560Z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable-anydpi/ic_settings.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\"\n    android:tint=\"#000000\"\n    android:alpha=\"0.8\">\n  <path\n      android:fillColor=\"#FFFFFFFF\"\n      android:pathData=\"M19.14,12.94C19.18,12.64 19.2,12.33 19.2,12.02C19.2,11.71 19.18,11.39 19.13,11.09L21.17,9.51C21.35,9.37 21.4,9.1 21.29,8.9L19.39,5.58C19.27,5.36 19.03,5.3 18.8,5.38L16.41,6.34C15.9,5.95 15.37,5.62 14.77,5.38L14.47,3.1C14.44,2.86 14.23,2.68 13.98,2.68H10.18C9.93,2.68 9.72,2.86 9.68,3.11L9.38,5.39C8.78,5.64 8.25,5.96 7.74,6.35L5.35,5.39C5.11,5.29 4.87,5.37 4.75,5.59L2.85,8.91C2.73,9.12 2.79,9.38 2.97,9.52L5.01,11.1C4.96,11.4 4.94,11.71 4.94,12.02C4.94,12.33 4.96,12.64 5.01,12.94L2.97,14.52C2.79,14.66 2.74,14.93 2.85,15.13L4.75,18.45C4.87,18.67 5.11,18.73 5.35,18.65L7.74,17.69C8.25,18.08 8.78,18.41 9.38,18.65L9.68,20.93C9.72,21.18 9.93,21.36 10.18,21.36H13.98C14.23,21.36 14.44,21.18 14.48,20.93L14.78,18.65C15.38,18.4 15.91,18.08 16.42,17.69L18.81,18.65C19.04,18.74 19.28,18.66 19.4,18.44L21.3,15.12C21.42,14.91 21.37,14.65 21.19,14.51L19.14,12.94ZM12.08,15.5C10.15,15.5 8.58,13.93 8.58,12C8.58,10.07 10.15,8.5 12.08,8.5C14.01,8.5 15.58,10.07 15.58,12C15.58,13.93 14.01,15.5 12.08,15.5Z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable-v33/ic_launcher_monochrome.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"107.98dp\"\n    android:height=\"107.98dp\"\n    android:viewportWidth=\"107.98\"\n    android:viewportHeight=\"107.98\">\n  <path\n      android:fillColor=\"#FF000000\"\n      android:pathData=\"M46.78,55.1c-1.95,0 -3.78,0.76 -5.16,2.14l-0.31,0.31a0.92,0.92 0,0 0,0 1.31c0.36,0.36 0.94,0.36 1.3,-0l0.31,-0.31c1.03,-1.03 2.4,-1.6 3.85,-1.6h15.74c3.02,0 5.86,-1.18 7.99,-3.31l2.86,-2.86c0.36,-0.36 0.36,-0.94 0,-1.3a0.92,0.92 0,0 0,-1.3 -0l-2.86,2.86c-1.79,1.79 -4.16,2.77 -6.69,2.77zM74.44,54.78c-0.36,0.36 -0.36,0.94 0,1.3 0.36,0.36 0.94,0.36 1.3,0l1.66,-1.66c2.09,-2.09 2.45,-5.41 0.86,-7.89l-0.72,-1.13c-0.27,-0.43 -0.85,-0.55 -1.27,-0.28a0.92,0.92 0,0 0,-0.28 1.27l0.72,1.13c1.13,1.76 0.87,4.11 -0.61,5.59z\"/>\n  <path\n      android:fillColor=\"#FF000000\"\n      android:pathData=\"M77.58,36.38c-0.75,-0.75 -1.77,-1.1 -2.8,-0.97 -0.07,-1.03 -0.6,-1.96 -1.46,-2.54a0.58,0.58 0,0 0,-0.02 -0.02c-4.49,-3 -9.74,-4.58 -15.16,-4.58h-1.74c-0.95,0 -1.81,0.4 -2.42,1.04 -0.61,-0.64 -1.47,-1.04 -2.42,-1.04h-5.4a24.8,24.8 0,0 0,-2.02 0.08,0.92 0.92,0 0,0 -0.84,1c0.04,0.51 0.49,0.89 1,0.84a22.98,22.98 0,0 1,1.87 -0.08h5.4c0.82,0 1.49,0.67 1.49,1.49v8.13c0,0.51 0.41,0.92 0.92,0.92a0.92,0.92 0,0 0,0.92 -0.92v-8.13c0,-0.82 0.67,-1.49 1.49,-1.49H58.14c5.05,0 9.93,1.47 14.12,4.26l0.02,0.01c0.79,0.52 0.89,1.63 0.23,2.3l-3.58,3.58a0.92,0.92 0,0 0,1.3 1.31l3.91,-3.91c0.28,-0.28 0.65,-0.44 1.06,-0.44 0.4,0 0.79,0.16 1.07,0.45 4.85,4.9 7.39,11.33 7.37,17.98 -0,0.61 -0.34,1.12 -0.92,1.35 -0.58,0.24 -1.19,0.12 -1.64,-0.32l-0.19,-0.19c-0.36,-0.36 -0.94,-0.36 -1.3,0 -0.36,0.36 -0.36,0.94 0,1.3l1,1c1.15,1.15 1.15,3.02 -0,4.17 -1.15,1.15 -2.52,2 -4.01,2.51a0.91,0.91 0,0 0,-0.14 0.05c-1.03,0.33 -2.11,0.51 -3.22,0.51h-1.38a0.92,0.92 0,0 0,-0.25 -0.44l-1.2,-1.2c-2.44,-2.44 -5.69,-3.79 -9.14,-3.79h-11.48a0.92,0.92 0,0 0,-0.92 0.92c0,0.51 0.41,0.92 0.92,0.92h11.48c2.96,0 5.74,1.15 7.83,3.24l0.34,0.34H44.15c-2,0 -3.88,-0.78 -5.29,-2.19 -1.62,-1.62 -2.39,-3.83 -2.16,-6.07v-0c0.39,-3.82 3.58,-6.71 7.45,-6.71h18.86a0.92,0.92 0,0 0,0.92 -0.92,0.92 0.92,0 0,0 -0.92,-0.92h-2.31v-8.76a0.92,0.92 0,0 0,-0.92 -0.92,0.92 0.92,0 0,0 -0.92,0.92v8.76h-9.25v-8.76a0.92,0.92 0,0 0,-0.92 -0.92,0.92 0.92,0 0,0 -0.92,0.92v8.76h-3.61c-1.49,0 -2.9,0.34 -4.15,0.96L35.52,45.69a0.92,0.92 0,0 0,-1.3 1.31l4.18,4.18a9.28,9.28 0,0 0,-3.41 5.58h-1.82c-2.94,0 -5.58,-1.39 -7.26,-3.8 -1.67,-2.42 -2.04,-5.38 -1,-8.13 1.33,-3.46 3.46,-6.56 6.16,-8.96 0.59,-0.53 1.49,-0.5 2.05,0.06l3.61,3.61a0.92,0.92 0,0 0,1.3 -1.31l-3.01,-3.01c-0.34,-0.34 -0.49,-0.8 -0.42,-1.28 0.07,-0.47 0.34,-0.86 0.75,-1.08a22.74,22.74 0,0 1,4.79 -1.93,0.92 0.92,0 0,0 -0.49,-1.78 24.59,24.59 0,0 0,-5.18 2.08c-0.9,0.49 -1.56,1.37 -1.71,2.48 -1.01,-0.22 -2.1,0.04 -2.93,0.77 -2.92,2.6 -5.22,5.95 -6.66,9.69a10.67,10.67 0,0 0,1.21 9.83,10.67 10.67,0 0,0 8.77,4.6h1.65c0.01,2.48 0.99,4.8 2.74,6.55 1.76,1.76 4.1,2.73 6.59,2.73h7.93l1.97,3.6c0.25,0.45 0.81,0.61 1.25,0.37 0.45,-0.24 0.61,-0.81 0.37,-1.25l-1.48,-2.71h4.1c0.25,2.15 1.34,4.04 2.94,5.33l0.76,2.77c0.26,0.96 -0.46,1.9 -1.45,1.9a1.5,1.5 0,0 1,-1.32 -0.78L57.75,74.4a0.92,0.92 0,0 0,-1.25 -0.37,0.92 0.92,0 0,0 -0.37,1.25l1.47,2.69a3.35,3.35 0,0 0,2.94 1.74c1.05,0 2.02,-0.48 2.66,-1.32 0.64,-0.84 0.85,-1.9 0.57,-2.91l-0.27,-0.99a8,8 0,0 0,2.78 0.49h1.26c2.14,0 4.21,-0.64 5.98,-1.84 0.42,-0.29 0.53,-0.86 0.24,-1.28 -0.29,-0.42 -0.86,-0.53 -1.28,-0.24 -1.46,0.99 -3.17,1.52 -4.94,1.52h-1.26c-3.1,0 -5.68,-2.29 -6.12,-5.27h13.08a12.4,12.4 0,0 0,2.34 -0.22,7.35 7.35,0 0,1 -0.51,1.15 0.92,0.92 0,0 0,0.37 1.25c0.45,0.24 1.01,0.08 1.25,-0.37 0.46,-0.83 0.77,-1.71 0.95,-2.63 1.58,-0.61 3.04,-1.55 4.27,-2.79 1.45,-1.45 1.77,-3.61 0.97,-5.38a3.51,3.51 0,0 0,0.56 -0.18c1.26,-0.52 2.05,-1.69 2.06,-3.05 0.02,-7.03 -2.63,-13.96 -7.91,-19.29z\"/>\n  <path\n      android:fillColor=\"#FF000000\"\n      android:pathData=\"m33.82,38.42 l-0.02,-0.02c-0.97,-1.02 -2.64,-1.03 -3.61,0.05 -0.37,0.41 -0.73,0.84 -1.06,1.29 -0.74,0.97 -0.65,2.36 0.21,3.22l0.02,0.02c1.05,1.05 2.78,0.93 3.68,-0.25a16.59,16.59 0,0 1,0.82 -0.99c0.86,-0.96 0.84,-2.39 -0.04,-3.32zM32.49,40.51a18.56,18.56 0,0 0,-0.91 1.1c-0.22,0.29 -0.65,0.32 -0.91,0.06l-0.02,-0.02a0.61,0.61 0,0 1,-0.05 -0.79c0.31,-0.4 0.64,-0.8 0.97,-1.18 0.23,-0.26 0.64,-0.28 0.89,-0.01l0.02,0.02c0.22,0.23 0.22,0.58 0.01,0.82zM29.87,45.23a2.44,2.44 0,0 0,-2.42 -0.62,2.46 2.46,0 0,0 -1.71,1.84c-0.45,2.1 -0.07,4 1.18,5.8 0.99,1.43 2.38,2.45 4.01,2.95 0.75,0.23 1.53,0.09 2.16,-0.38 1.07,-0.79 0.99,-1.98 0.99,-1.99 0,-1.07 -0.71,-2.04 -1.72,-2.34 -0.57,-0.17 -1.04,-0.52 -1.4,-1.04 -0.43,-0.62 -0.57,-1.28 -0.43,-2 0.16,-0.81 -0.09,-1.65 -0.67,-2.23zM31.84,52.26c0.24,0.07 0.4,0.3 0.4,0.57 -0,0.01 0.03,0.31 -0.25,0.51 -0.09,0.07 -0.28,0.17 -0.53,0.09 -1.23,-0.37 -2.28,-1.14 -3.03,-2.23 -0.95,-1.38 -1.23,-2.76 -0.89,-4.36 0.1,-0.47 0.68,-0.65 1.02,-0.31 0.14,0.14 0.2,0.35 0.16,0.56 -0.24,1.2 0.01,2.38 0.72,3.4 0.6,0.86 1.42,1.47 2.39,1.76z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".ui.view.MainActivity\">\n\n    <FrameLayout\n        android:id=\"@+id/fragment_container\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_above=\"@id/bottom_navigation\" />\n\n    <com.google.android.material.bottomnavigation.BottomNavigationView\n        android:id=\"@+id/bottom_navigation\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentBottom=\"true\"\n        app:menu=\"@menu/bottom_menu\"\n        app:labelVisibilityMode=\"labeled\" />\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/activity_splash.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"@color/ic_launcher_background\"\n    tools:context=\".ui.view.MainActivity\">\n\n    <androidx.appcompat.widget.LinearLayoutCompat\n      android:layout_width=\"wrap_content\"\n      android:layout_height=\"wrap_content\"\n      android:orientation=\"vertical\"\n      app:layout_constraintBottom_toBottomOf=\"parent\"\n      app:layout_constraintEnd_toEndOf=\"parent\"\n      app:layout_constraintStart_toStartOf=\"parent\"\n      app:layout_constraintTop_toTopOf=\"parent\">\n\n        <ImageView\n          android:id=\"@+id/imageView\"\n          android:layout_width=\"250dp\"\n          android:layout_height=\"250dp\"\n          android:layout_gravity=\"center\"\n          app:srcCompat=\"@drawable/ic_launcher_foreground\" />\n\n    </androidx.appcompat.widget.LinearLayoutCompat>\n\n</androidx.constraintlayout.widget.ConstraintLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/choose_app_card.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\">\n\n    <androidx.cardview.widget.CardView\n        app:cardCornerRadius=\"0dp\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\">\n\n        <androidx.constraintlayout.widget.ConstraintLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginEnd=\"15dp\"\n            android:layout_marginStart=\"15dp\"\n            android:layout_marginBottom=\"10dp\"\n            android:layout_marginTop=\"10dp\">\n\n            <ImageView\n                android:id=\"@+id/appIcon\"\n                android:layout_width=\"50dp\"\n                android:layout_height=\"50dp\"\n                app:layout_constraintStart_toStartOf=\"parent\"\n                app:layout_constraintTop_toTopOf=\"parent\"\n                tools:srcCompat=\"@tools:sample/avatars\" />\n\n            <TextView\n                android:id=\"@+id/appName\"\n                android:layout_width=\"150dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginStart=\"20dp\"\n                android:text=\"Application name\"\n                app:layout_constraintBottom_toBottomOf=\"@+id/appIcon\"\n                app:layout_constraintStart_toEndOf=\"@+id/appIcon\"\n                app:layout_constraintTop_toTopOf=\"@+id/appIcon\" />\n        </androidx.constraintlayout.widget.ConstraintLayout>\n    </androidx.cardview.widget.CardView>\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/dialog_choose_app.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <ProgressBar\n        android:id=\"@+id/progressBar\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:visibility=\"visible\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" />\n\n    <androidx.recyclerview.widget.RecyclerView\n        android:id=\"@+id/recyclerView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:visibility=\"gone\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" />\n</androidx.constraintlayout.widget.ConstraintLayout>"
  },
  {
    "path": "app/src/main/res/layout/feed_app_card.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\">\n\n    <androidx.cardview.widget.CardView\n        android:backgroundTint=\"@color/cardview_background_color\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        app:cardCornerRadius=\"30dp\"\n        app:cardElevation=\"1dp\"\n        android:layout_marginLeft=\"5dp\"\n        android:layout_marginRight=\"5dp\"\n        android:layout_marginBottom=\"5dp\"\n        android:layout_marginTop=\"0dp\">\n\n        <androidx.constraintlayout.widget.ConstraintLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:layout_margin=\"8dp\"\n            android:orientation=\"horizontal\">\n\n            <androidx.cardview.widget.CardView\n                android:id=\"@+id/imageCard\"\n                android:layout_gravity=\"center\"\n                android:layout_marginStart=\"10dp\"\n                app:layout_constraintBottom_toBottomOf=\"parent\"\n                app:layout_constraintStart_toStartOf=\"parent\"\n                app:layout_constraintTop_toTopOf=\"parent\"\n                android:backgroundTint=\"@color/cardview_background_color\"\n                app:cardElevation=\"0dp\"\n                android:layout_width=\"50dp\"\n                android:layout_height=\"50dp\">\n\n                <com.google.android.material.imageview.ShapeableImageView\n                    android:id=\"@+id/image\"\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"match_parent\"\n                    app:shapeAppearanceOverlay=\"@style/ShapeAppearance.Material3.Corner.Full\"\n                    tools:srcCompat=\"@tools:sample/avatars\" />\n            </androidx.cardview.widget.CardView>\n\n            <LinearLayout\n                android:id=\"@+id/labelsGroup\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:orientation=\"horizontal\"\n                android:gravity=\"end\"\n                android:layout_marginEnd=\"10dp\"\n                app:layout_constraintEnd_toEndOf=\"parent\"\n                app:layout_constraintTop_toTopOf=\"parent\">\n\n                <TextView\n                    android:id=\"@+id/microG\"\n                    android:layout_width=\"wrap_content\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_marginTop=\"5dp\"\n                    android:background=\"@drawable/bg_label_rounded\"\n                    android:paddingHorizontal=\"6dp\"\n                    android:paddingVertical=\"2dp\"\n                    android:text=\"@string/microg_label\"\n                    android:textColor=\"@color/white\"\n                    android:textSize=\"11sp\" />\n\n                <TextView\n                    android:id=\"@+id/secure\"\n                    android:layout_width=\"wrap_content\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_marginTop=\"5dp\"\n                    android:layout_marginStart=\"4dp\"\n                    android:background=\"@drawable/bg_label_rounded\"\n                    android:paddingHorizontal=\"6dp\"\n                    android:paddingVertical=\"2dp\"\n                    android:text=\"@string/secure_label\"\n                    android:textColor=\"@color/white\"\n                    android:textSize=\"11sp\" />\n\n            </LinearLayout>\n\n            <androidx.appcompat.widget.LinearLayoutCompat\n                android:id=\"@+id/textColumn\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:orientation=\"vertical\"\n                android:layout_marginStart=\"20dp\"\n                android:layout_marginEnd=\"8dp\"\n                app:layout_constraintStart_toEndOf=\"@+id/imageCard\"\n                app:layout_constraintEnd_toStartOf=\"@+id/labelsGroup\"\n                app:layout_constraintTop_toTopOf=\"parent\">\n\n                <TextView\n                    android:id=\"@+id/appName\"\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"wrap_content\"\n                    android:ellipsize=\"end\"\n                    android:maxLines=\"1\"\n                    android:text=\"AppName\"\n                    android:textSize=\"16sp\" />\n\n                <TextView\n                    android:id=\"@+id/packageName\"\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"wrap_content\"\n                    android:ellipsize=\"end\"\n                    android:maxLines=\"1\"\n                    android:text=\"PackageName\"\n                    android:textSize=\"12sp\" />\n\n            </androidx.appcompat.widget.LinearLayoutCompat>\n\n            <ImageView\n                android:id=\"@+id/emoji\"\n                android:layout_width=\"20dp\"\n                android:layout_height=\"20dp\"\n                android:layout_marginTop=\"3dp\"\n                app:layout_constraintStart_toStartOf=\"@+id/textColumn\"\n                app:layout_constraintTop_toBottomOf=\"@+id/textColumn\" />\n\n            <TextView\n                android:id=\"@+id/updatedDate\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginStart=\"8dp\"\n                android:text=\"@string/updated_on\"\n                android:textSize=\"10sp\"\n                android:textStyle=\"italic\"\n                app:layout_constraintStart_toEndOf=\"@+id/emoji\"\n                app:layout_constraintTop_toTopOf=\"@+id/emoji\"\n                app:layout_constraintBottom_toBottomOf=\"@+id/emoji\" />\n\n            <ImageView\n                android:id=\"@+id/infoIcon\"\n                android:layout_width=\"25dp\"\n                android:layout_height=\"25dp\"\n                android:layout_marginEnd=\"5dp\"\n                android:layout_marginBottom=\"5dp\"\n                app:layout_constraintBottom_toBottomOf=\"parent\"\n                app:layout_constraintEnd_toEndOf=\"parent\"\n                app:layout_constraintTop_toBottomOf=\"@+id/labelsGroup\"\n                app:tint=\"?android:colorPrimary\"\n                app:srcCompat=\"@mipmap/ic_info_foreground\" />\n\n        </androidx.constraintlayout.widget.ConstraintLayout>\n    </androidx.cardview.widget.CardView>\n</LinearLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/fragment_about.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".ui.view.AboutFragment\">\n\n    <androidx.constraintlayout.widget.ConstraintLayout\n      android:layout_width=\"wrap_content\"\n      android:layout_height=\"wrap_content\"\n      app:layout_constraintBottom_toBottomOf=\"parent\"\n      app:layout_constraintEnd_toEndOf=\"parent\"\n      app:layout_constraintStart_toStartOf=\"parent\"\n      app:layout_constraintTop_toTopOf=\"parent\">\n\n        <ImageView\n          android:id=\"@+id/imageCard\"\n          android:layout_width=\"150dp\"\n          android:layout_height=\"150dp\"\n          app:layout_constraintEnd_toEndOf=\"parent\"\n          app:layout_constraintStart_toStartOf=\"parent\"\n          app:layout_constraintTop_toTopOf=\"parent\"\n          app:srcCompat=\"@drawable/ic_launcher_foreground\" />\n\n        <TextView\n            android:id=\"@+id/version\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"version\"\n            app:layout_constraintBottom_toTopOf=\"@id/aboutView\"\n            app:layout_constraintEnd_toEndOf=\"parent\"\n            app:layout_constraintStart_toStartOf=\"parent\"\n            app:layout_constraintTop_toBottomOf=\"@+id/imageCard\" />\n\n        <TextView\n          android:id=\"@+id/aboutView\"\n          android:layout_width=\"match_parent\"\n          android:layout_height=\"wrap_content\"\n          android:layout_marginTop=\"25dp\"\n          android:layout_marginLeft=\"30dp\"\n          android:layout_marginRight=\"30dp\"\n          android:layout_marginBottom=\"20dp\"\n          android:text=\"@string/about_text\"\n          app:layout_constraintEnd_toEndOf=\"parent\"\n          app:layout_constraintStart_toStartOf=\"parent\"\n          app:layout_constraintTop_toBottomOf=\"@id/version\" />\n\n        <TextView\n            android:id=\"@+id/ratingRules\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/rating_rules\"\n            android:layout_margin=\"40dp\"\n            app:layout_constraintStart_toStartOf=\"@id/aboutView\"\n            app:layout_constraintEnd_toEndOf=\"@id/aboutView\"\n            app:layout_constraintTop_toBottomOf=\"@id/aboutView\"\n            />\n\n    </androidx.constraintlayout.widget.ConstraintLayout>\n\n</androidx.constraintlayout.widget.ConstraintLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/fragment_choose_app.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".ui.view.FeedFragment\">\n\n    <TextView\n        android:id=\"@+id/selectAppName\"\n        android:textSize=\"18sp\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:text=\"@string/select_application_text\"\n        android:textStyle=\"bold\"\n        app:layout_constraintBottom_toTopOf=\"@+id/chooseAppButton\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\" />\n\n    <Button\n        android:id=\"@+id/chooseAppButton\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:text=\"@string/select_button\"\n        app:layout_constraintBottom_toTopOf=\"@+id/backButton\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\"\n        app:layout_constraintVertical_bias=\"0.507\" />\n\n    <TextView\n        android:id=\"@+id/appName\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:textSize=\"16sp\"\n        android:textStyle=\"bold\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toBottomOf=\"@+id/chooseAppButton\" />\n\n    <Button\n        android:id=\"@+id/nextButton\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:text=\"@string/next\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\" />\n\n    <Button\n        android:id=\"@+id/backButton\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:text=\"@string/previous\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\" />\n\n</androidx.constraintlayout.widget.ConstraintLayout>"
  },
  {
    "path": "app/src/main/res/layout/fragment_contribute.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n       <androidx.fragment.app.FragmentContainerView\n        android:id=\"@+id/fragment_container_view\"\n        android:name=\"androidx.navigation.fragment.NavHostFragment\"\n        android:layout_width=\"0dp\"\n        android:layout_height=\"0dp\"\n        app:defaultNavHost=\"true\"\n        app:navGraph=\"@navigation/nav_graph\"\n        app:layout_constraintLeft_toLeftOf=\"parent\"\n        app:layout_constraintRight_toRightOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n\n        tools:layout_editor_absoluteX=\"24dp\"\n        tools:layout_editor_absoluteY=\"24dp\" />\n\n</androidx.constraintlayout.widget.ConstraintLayout>"
  },
  {
    "path": "app/src/main/res/layout/fragment_evaluate.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <TextView\n        android:id=\"@+id/noteApplication\"\n        android:textSize=\"18sp\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginBottom=\"30dp\"\n        android:text=\"@string/note_application_text\"\n        android:textStyle=\"bold\"\n        app:layout_constraintBottom_toTopOf=\"@+id/note\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\" />\n\n    <TextView\n        android:id=\"@+id/configurationDetected\"\n        android:textSize=\"18sp\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginBottom=\"30dp\"\n        android:layout_marginTop=\"50dp\"\n        android:text=\"@string/environment_detected\"\n        android:textStyle=\"bold\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toBottomOf=\"@+id/note\" />\n\n    <TextView\n        android:id=\"@+id/microgConfiguration\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"30dp\"\n        android:background=\"@drawable/bg_label_rounded\"\n        android:paddingHorizontal=\"8dp\"\n        android:paddingVertical=\"2dp\"\n        android:text=\"microG configuration\"\n        android:textColor=\"@color/white\"\n        app:layout_constraintEnd_toStartOf=\"@+id/configurationDetected\"\n        app:layout_constraintStart_toStartOf=\"@+id/configurationDetected\"\n        app:layout_constraintTop_toBottomOf=\"@+id/configurationDetected\" />\n\n    <TextView\n        android:id=\"@+id/secureConfiguration\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"30dp\"\n        android:background=\"@drawable/bg_label_rounded\"\n        android:paddingHorizontal=\"8dp\"\n        android:paddingVertical=\"2dp\"\n        android:text=\"secure configuration\"\n        android:textColor=\"@color/white\"\n        app:layout_constraintEnd_toEndOf=\"@+id/configurationDetected\"\n        app:layout_constraintStart_toEndOf=\"@+id/configurationDetected\"\n        app:layout_constraintTop_toBottomOf=\"@+id/configurationDetected\" />\n\n    <Button\n        android:id=\"@+id/validateButton\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:text=\"@string/validate_button\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\" />\n\n    <Button\n        android:id=\"@+id/backButton\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:text=\"@string/previous\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\" />\n\n    <RadioGroup\n        android:id=\"@+id/note\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        app:layout_constraintBottom_toTopOf=\"@+id/backButton\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\">\n\n        <RadioButton\n            android:id=\"@+id/greenRadioButton\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/works_perfectly\"\n            app:layout_constraintStart_toStartOf=\"parent\"\n            app:layout_constraintTop_toBottomOf=\"@+id/noteApplication\" />\n\n        <RadioButton\n            android:id=\"@+id/orangeRadioButton\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/works_partially\"\n            app:layout_constraintStart_toStartOf=\"parent\"\n            app:layout_constraintTop_toBottomOf=\"@+id/greenRadioButton\" />\n\n        <RadioButton\n            android:id=\"@+id/redRadioButton\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/dont_work\"\n            app:layout_constraintStart_toStartOf=\"parent\"\n            app:layout_constraintTop_toBottomOf=\"@+id/orangeRadioButton\" />\n    </RadioGroup>\n\n</androidx.constraintlayout.widget.ConstraintLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/fragment_evaluations.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n  xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n  xmlns:tools=\"http://schemas.android.com/tools\"\n  android:layout_width=\"match_parent\"\n  android:layout_height=\"match_parent\"\n  android:orientation=\"horizontal\"\n  tools:context=\".ui.view.EvaluationsFragment\">\n\n    <FrameLayout\n        android:id=\"@+id/bitmap_container\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:visibility=\"gone\"\n        tools:ignore=\"MissingConstraints\" />\n\n    <ProgressBar\n        android:id=\"@+id/progressBar\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:visibility=\"visible\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" />\n\n    <androidx.cardview.widget.CardView\n      android:backgroundTint=\"@color/cardview_background_color\"\n      android:id=\"@+id/card\"\n      app:cardElevation=\"1dp\"\n      app:cardCornerRadius=\"30dp\"\n      android:layout_width=\"wrap_content\"\n      android:layout_height=\"wrap_content\"\n      app:layout_constraintBottom_toBottomOf=\"parent\"\n      app:layout_constraintEnd_toEndOf=\"parent\"\n      app:layout_constraintStart_toStartOf=\"parent\"\n      app:layout_constraintTop_toTopOf=\"parent\">\n\n    <androidx.constraintlayout.widget.ConstraintLayout\n      android:id=\"@+id/cardContent\"\n      android:layout_width=\"wrap_content\"\n      android:layout_height=\"wrap_content\"\n      android:layout_gravity=\"center\"\n\n      app:layout_constraintBottom_toBottomOf=\"parent\"\n      app:layout_constraintEnd_toEndOf=\"parent\"\n      app:layout_constraintStart_toStartOf=\"parent\"\n      app:layout_constraintTop_toTopOf=\"parent\"\n      tools:targetApi=\"m\">\n\n        <androidx.cardview.widget.CardView\n          android:id=\"@+id/imageCard\"\n          android:layout_width=\"94dp\"\n          android:layout_height=\"94dp\"\n          app:cardElevation=\"0dp\"\n          android:layout_margin=\"25dp\"\n          android:backgroundTint=\"@color/cardview_background_color\"\n          app:layout_constraintEnd_toEndOf=\"parent\"\n          app:layout_constraintStart_toStartOf=\"parent\"\n          app:layout_constraintTop_toTopOf=\"parent\">\n\n            <com.google.android.material.imageview.ShapeableImageView\n                android:id=\"@+id/image\"\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"match_parent\"\n                app:shapeAppearanceOverlay=\"@style/ShapeAppearance.Material3.Corner.Full\"\n                tools:srcCompat=\"@tools:sample/avatars\" />\n\n        </androidx.cardview.widget.CardView>\n\n        <TableLayout\n          android:id=\"@+id/table\"\n          android:layout_width=\"wrap_content\"\n          android:layout_height=\"wrap_content\"\n          android:layout_marginTop=\"20dp\"\n          app:layout_constraintEnd_toEndOf=\"parent\"\n          app:layout_constraintStart_toStartOf=\"parent\"\n          app:layout_constraintTop_toBottomOf=\"@id/compatibilityMatrix\">\n\n            <TableRow\n              android:layout_width=\"wrap_content\"\n              android:layout_height=\"wrap_content\">\n\n                <TextView\n                  android:id=\"@+id/empty\"\n                  android:layout_width=\"wrap_content\"\n                  android:layout_height=\"wrap_content\"\n                  android:layout_margin=\"10dp\"\n                  android:textSize=\"15sp\" />\n\n                <TextView\n                  android:id=\"@+id/secure\"\n                  android:layout_width=\"wrap_content\"\n                  android:layout_height=\"wrap_content\"\n                  android:layout_margin=\"10dp\"\n                  android:background=\"@drawable/bg_label_rounded\"\n                  android:backgroundTint=\"@color/purple_200\"\n                  android:paddingHorizontal=\"8dp\"\n                  android:paddingVertical=\"2dp\"\n                  android:text=\"@string/secure_label\"\n                  android:textColor=\"@color/white\"\n                  android:textSize=\"17sp\" />\n\n                <TextView\n                  android:id=\"@+id/unsafe\"\n                  android:layout_width=\"wrap_content\"\n                  android:layout_height=\"wrap_content\"\n                  android:layout_margin=\"10dp\"\n                  android:background=\"@drawable/bg_label_rounded\"\n                  android:backgroundTint=\"@color/purple_700\"\n                  android:paddingHorizontal=\"8dp\"\n                  android:paddingVertical=\"2dp\"\n                  android:text=\"@string/unsafe_label\"\n                  android:textColor=\"@color/white\"\n                  android:textSize=\"17sp\" />\n\n\n            </TableRow>\n\n            <TableRow\n              android:id=\"@+id/microgRow\"\n              android:layout_width=\"wrap_content\"\n              android:layout_height=\"wrap_content\"\n              android:gravity=\"center_vertical\">\n\n                <TextView\n                  android:id=\"@+id/microg\"\n                  android:layout_width=\"wrap_content\"\n                  android:layout_height=\"wrap_content\"\n                  android:layout_margin=\"10dp\"\n                  android:background=\"@drawable/bg_label_rounded\"\n                  android:backgroundTint=\"@color/blue_200\"\n                  android:paddingHorizontal=\"8dp\"\n                  android:paddingVertical=\"2dp\"\n                  android:text=\"@string/microg_label\"\n                  android:textColor=\"@color/white\"\n                  android:textSize=\"17sp\" />\n\n                <ImageView\n                  android:id=\"@+id/microgUser\"\n                  android:layout_width=\"20dp\"\n                  android:layout_height=\"20dp\"\n                  android:layout_margin=\"10dp\" />\n\n                <ImageView\n                  android:id=\"@+id/microgRoot\"\n                  android:layout_width=\"20dp\"\n                  android:layout_height=\"20dp\"\n                  android:layout_margin=\"10dp\" />\n\n            </TableRow>\n\n            <TableRow\n              android:id=\"@+id/bareAospRow\"\n              android:layout_width=\"match_parent\"\n              android:layout_height=\"match_parent\"\n              android:gravity=\"center_vertical\">\n\n                <TextView\n                  android:id=\"@+id/bareAosp\"\n                  android:layout_width=\"wrap_content\"\n                  android:layout_height=\"wrap_content\"\n                  android:layout_margin=\"10dp\"\n                  android:background=\"@drawable/bg_label_rounded\"\n                  android:backgroundTint=\"@color/blue_700\"\n                  android:paddingHorizontal=\"8dp\"\n                  android:paddingVertical=\"2dp\"\n                  android:text=\"@string/bare_aosp_label\"\n                  android:textColor=\"@color/white\"\n                  android:textSize=\"17sp\"\n                  app:layout_constraintStart_toStartOf=\"parent\"\n                  app:layout_constraintTop_toBottomOf=\"@+id/dividerH1\" />\n\n                <ImageView\n                  android:id=\"@+id/bareAospUser\"\n                  android:layout_width=\"20dp\"\n                  android:layout_height=\"20dp\"\n                  android:layout_margin=\"10dp\" />\n\n                <ImageView\n                  android:id=\"@+id/bareAospRoot\"\n                  android:layout_width=\"20dp\"\n                  android:layout_height=\"20dp\"\n                  android:layout_margin=\"10dp\" />\n\n            </TableRow>\n        </TableLayout>\n\n        <TextView\n          android:id=\"@+id/packageName\"\n          android:gravity=\"center_horizontal\"\n          android:layout_width=\"200dp\"\n          android:layout_height=\"wrap_content\"\n          android:layout_marginBottom=\"20dp\"\n          android:layout_marginTop=\"5dp\"\n          android:text=\"@string/package_name\"\n          android:textSize=\"12sp\"\n          app:layout_constraintEnd_toEndOf=\"parent\"\n          app:layout_constraintStart_toStartOf=\"parent\"\n          app:layout_constraintTop_toBottomOf=\"@id/applicationName\" />\n\n        <TextView\n          android:id=\"@+id/applicationName\"\n          android:textStyle=\"bold\"\n          android:gravity=\"center_horizontal\"\n          android:layout_width=\"225dp\"\n          android:layout_height=\"wrap_content\"\n          android:layout_margin=\"30dp\"\n          android:layout_marginTop=\"100dp\"\n          android:text=\"@string/application_name\"\n          android:textSize=\"20sp\"\n          app:layout_constraintEnd_toEndOf=\"parent\"\n          app:layout_constraintHorizontal_bias=\"0.507\"\n          app:layout_constraintStart_toStartOf=\"parent\"\n          app:layout_constraintTop_toBottomOf=\"@id/imageCard\" />\n\n        <TextView\n          android:id=\"@+id/compatibilityMatrix\"\n          android:layout_width=\"wrap_content\"\n          android:layout_height=\"wrap_content\"\n          android:layout_margin=\"40dp\"\n          android:text=\"@string/android_compatibility_matrix\"\n          android:textSize=\"14sp\"\n          app:layout_constraintBottom_toTopOf=\"@+id/table\"\n          app:layout_constraintEnd_toEndOf=\"parent\"\n          app:layout_constraintStart_toStartOf=\"parent\"\n          app:layout_constraintTop_toBottomOf=\"@+id/packageName\" />\n\n        <ImageView\n          android:id=\"@+id/infoIcon\"\n          android:layout_width=\"40dp\"\n          android:layout_height=\"40dp\"\n          android:layout_marginTop=\"20dp\"\n          android:layout_marginBottom=\"20dp\"\n          app:tint=\"?android:colorPrimary\"\n          app:layout_constraintEnd_toEndOf=\"parent\"\n          app:layout_constraintStart_toStartOf=\"parent\"\n          app:layout_constraintTop_toBottomOf=\"@id/shareButton\"\n          app:layout_constraintBottom_toBottomOf=\"parent\"\n          app:srcCompat=\"@mipmap/ic_info_foreground\" />\n\n        <Button\n          android:id=\"@+id/shareButton\"\n          android:layout_width=\"wrap_content\"\n          android:layout_height=\"wrap_content\"\n          android:text=\"@string/share\"\n          android:layout_marginTop=\"40dp\"\n          app:layout_constraintTop_toBottomOf=\"@+id/table\"\n          app:layout_constraintBottom_toTopOf=\"@+id/infoIcon\"\n          app:layout_constraintEnd_toEndOf=\"@+id/table\"\n          app:layout_constraintStart_toStartOf=\"@+id/table\" />\n\n    </androidx.constraintlayout.widget.ConstraintLayout>\n    </androidx.cardview.widget.CardView>\n\n</androidx.constraintlayout.widget.ConstraintLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/fragment_loading.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"?android:attr/windowBackground\">\n\n    <ProgressBar\n        android:id=\"@+id/progressBar\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" />\n\n</androidx.constraintlayout.widget.ConstraintLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/fragment_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".ui.view.FeedFragment\">\n    \n    <ProgressBar\n        android:id=\"@+id/progressBar\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:visibility=\"gone\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" />\n\n    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout\n      android:id=\"@+id/refreshView\"\n      android:layout_marginTop=\"5dp\"\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"match_parent\">\n\n    <androidx.recyclerview.widget.RecyclerView\n        android:id=\"@+id/recyclerView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintHorizontal_bias=\"1.0\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\"\n        app:layout_constraintVertical_bias=\"1.0\" />\n\n    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>\n\n</androidx.constraintlayout.widget.ConstraintLayout>"
  },
  {
    "path": "app/src/main/res/layout/fragment_my_apps.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".ui.view.MyAppsFragment\">\n\n    <ProgressBar\n        android:id=\"@+id/progressBar\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:visibility=\"gone\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" />\n\n    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout\n        android:id=\"@+id/swipeRefreshLayout\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\">\n\n        <androidx.recyclerview.widget.RecyclerView\n            android:id=\"@+id/recyclerView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:layout_marginTop=\"5dp\" />\n\n    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>\n\n</androidx.constraintlayout.widget.ConstraintLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/fragment_search.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"\n    tools:context=\".ui.view.SearchFragment\">\n\n    <!-- Standard Material Search Bar at Top -->\n    <com.google.android.material.card.MaterialCardView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"16dp\"\n        android:layout_marginTop=\"8dp\"\n        app:cardElevation=\"0dp\"\n        app:cardUseCompatPadding=\"false\"\n        app:cardCornerRadius=\"8dp\"\n        app:strokeWidth=\"0dp\"\n        app:strokeColor=\"@android:color/transparent\">\n\n        <LinearLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:orientation=\"horizontal\"\n            android:padding=\"12dp\"\n            android:gravity=\"center_vertical\">\n\n            <ImageView\n                android:id=\"@+id/searchIcon\"\n                android:layout_width=\"24dp\"\n                android:layout_height=\"24dp\"\n                android:layout_marginEnd=\"12dp\"\n                android:src=\"@drawable/ic_search\"\n                app:tint=\"?attr/colorOnSurfaceVariant\" />\n\n            <com.google.android.material.textfield.TextInputEditText\n                android:id=\"@+id/editTextSearch\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:background=\"@null\"\n                android:hint=\"@string/search_hint\"\n                android:inputType=\"textPersonName\"\n                android:imeOptions=\"actionSearch\"\n                android:maxLines=\"1\"\n                android:textColor=\"?attr/colorOnSurface\"\n                android:textColorHint=\"?attr/colorOnSurfaceVariant\" />\n\n            <ImageView\n                android:id=\"@+id/clearSearch\"\n                android:layout_width=\"24dp\"\n                android:layout_height=\"24dp\"\n                android:layout_marginStart=\"12dp\"\n                android:src=\"@drawable/ic_close\"\n                app:tint=\"?attr/colorOnSurfaceVariant\"\n                android:visibility=\"gone\" />\n\n        </LinearLayout>\n    </com.google.android.material.card.MaterialCardView>\n\n    <!-- Search Results -->\n    <androidx.recyclerview.widget.RecyclerView\n        android:id=\"@+id/recyclerView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:visibility=\"invisible\" />\n\n    <!-- Empty State -->\n    <LinearLayout\n        android:id=\"@+id/emptyState\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:orientation=\"vertical\"\n        android:gravity=\"center\"\n        android:visibility=\"visible\">\n\n        <ImageView\n            android:id=\"@+id/searchIconBig\"\n            android:layout_width=\"125dp\"\n            android:layout_height=\"101dp\"\n            android:src=\"@drawable/search\"\n            app:tint=\"?attr/colorPrimary\" />\n\n        <TextView\n            android:id=\"@+id/searchText\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginTop=\"16dp\"\n            android:text=\"@string/look_for_an_application\"\n            android:textSize=\"18sp\"\n            android:textStyle=\"bold\"\n            android:textColor=\"?attr/colorOnSurface\" />\n\n    </LinearLayout>\n\n</LinearLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/fragment_success.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".ui.view.FeedFragment\">\n\n    <androidx.emoji2.widget.EmojiTextView\n        android:id=\"@+id/emoji\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:text=\"\\uD83C\\uDF89 \\uD83E\\uDD73\"\n        android:textSize=\"40sp\"\n        app:layout_constraintBottom_toTopOf=\"@+id/appEvaluatedText\"\n        app:layout_constraintEnd_toEndOf=\"@+id/appEvaluatedText\"\n        app:layout_constraintStart_toStartOf=\"@+id/appEvaluatedText\" />\n\n    <TextView\n        android:id=\"@+id/appEvaluatedText\"\n        android:textSize=\"18sp\"\n        android:textStyle=\"bold\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        android:layout_margin=\"20dp\"\n        android:text=\"@string/thank_you\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" />\n\n    <Button\n        android:id=\"@+id/shareEvaluation\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:text=\"@string/share\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toBottomOf=\"@+id/appEvaluatedText\" />\n\n    <TextView\n        android:id=\"@+id/shareText\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:gravity=\"center\"\n        android:text=\"@string/share_text\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toBottomOf=\"@+id/shareEvaluation\" />\n\n</androidx.constraintlayout.widget.ConstraintLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/fragment_warning.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".ui.view.FeedFragment\">\n\n\n    <Button\n        android:id=\"@+id/proceedButton\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"20dp\"\n        android:text=\"@string/proceed\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\" />\n\n    <TextView\n        android:id=\"@+id/reportAppDescription\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"30dp\"\n        android:text=\"@string/warning_desc\"\n        app:layout_constraintBottom_toTopOf=\"@+id/proceedButton\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" />\n\n    <LinearLayout\n        android:layout_margin=\"25dp\"\n        android:orientation=\"horizontal\"\n        android:gravity=\"left\"\n        app:layout_constraintTop_toBottomOf=\"@id/reportAppDescription\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\">\n\n        <CheckBox\n            android:id=\"@+id/checkbox\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"/>\n\n        <TextView\n            android:id=\"@+id/checkboxText\"\n            android:text=\"@string/i_have_read_and_i_understand_the_rating_rules\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"/>\n\n    </LinearLayout>\n\n</androidx.constraintlayout.widget.ConstraintLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/my_app_card.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\">\n\n    <androidx.cardview.widget.CardView\n        android:backgroundTint=\"@color/cardview_background_color\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        app:cardElevation=\"1dp\"\n        app:cardCornerRadius=\"30dp\"\n        android:layout_marginLeft=\"5dp\"\n        android:layout_marginRight=\"5dp\"\n        android:layout_marginBottom=\"5dp\"\n        android:layout_marginTop=\"0dp\">\n\n        <androidx.constraintlayout.widget.ConstraintLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:layout_margin=\"8dp\"\n            android:minHeight=\"55dp\"\n            android:orientation=\"horizontal\">\n\n            <androidx.cardview.widget.CardView\n                android:id=\"@+id/imageCard\"\n                android:layout_width=\"50dp\"\n                android:layout_height=\"50dp\"\n                android:layout_gravity=\"center\"\n                app:cardElevation=\"0dp\"\n                android:backgroundTint=\"@color/cardview_background_color\"\n                android:layout_marginStart=\"10dp\"\n                app:layout_constraintBottom_toBottomOf=\"parent\"\n                app:layout_constraintStart_toStartOf=\"parent\"\n                app:layout_constraintTop_toTopOf=\"parent\">\n\n                <com.google.android.material.imageview.ShapeableImageView\n                    android:id=\"@+id/image\"\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"match_parent\"\n                    app:shapeAppearanceOverlay=\"@style/ShapeAppearance.Material3.Corner.Full\"\n                    android:layout_gravity=\"center\"\n                    tools:srcCompat=\"@tools:sample/avatars\" />\n\n            </androidx.cardview.widget.CardView>\n\n            <androidx.appcompat.widget.LinearLayoutCompat\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:orientation=\"vertical\"\n                android:layout_marginStart=\"20dp\"\n                android:layout_marginEnd=\"8dp\"\n                app:layout_constraintBottom_toBottomOf=\"parent\"\n                app:layout_constraintStart_toEndOf=\"@+id/imageCard\"\n                app:layout_constraintEnd_toStartOf=\"@+id/rightColumn\"\n                app:layout_constraintTop_toTopOf=\"parent\">\n\n                <TextView\n                    android:id=\"@+id/appName\"\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"wrap_content\"\n                    android:ellipsize=\"end\"\n                    android:maxLines=\"1\"\n                    android:text=\"AppName\"\n                    android:textSize=\"16sp\" />\n\n                <TextView\n                    android:id=\"@+id/packageName\"\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"wrap_content\"\n                    android:text=\"PackageName\"\n                    android:maxLines=\"1\"\n                    android:ellipsize=\"end\"\n                    android:textSize=\"12sp\" />\n\n            </androidx.appcompat.widget.LinearLayoutCompat>\n\n            <LinearLayout\n                android:id=\"@+id/rightColumn\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:orientation=\"horizontal\"\n                android:gravity=\"center_vertical\"\n                android:layout_marginEnd=\"5dp\"\n                app:layout_constraintBottom_toBottomOf=\"parent\"\n                app:layout_constraintEnd_toEndOf=\"parent\"\n                app:layout_constraintTop_toTopOf=\"parent\">\n\n                <ImageView\n                    android:id=\"@+id/noRatingIcon\"\n                    android:layout_width=\"20dp\"\n                    android:layout_height=\"20dp\"\n                    android:visibility=\"gone\"\n                    app:srcCompat=\"@drawable/ic_add\"\n                    app:tint=\"?attr/colorOnSurface\" />\n\n                <ImageView\n                    android:id=\"@+id/emoji\"\n                    android:layout_width=\"20dp\"\n                    android:layout_height=\"20dp\"\n                    android:visibility=\"gone\" />\n\n                <ImageView\n                    android:id=\"@+id/infoIcon\"\n                    android:layout_width=\"25dp\"\n                    android:layout_height=\"25dp\"\n                    android:layout_marginStart=\"4dp\"\n                    android:visibility=\"gone\"\n                    app:srcCompat=\"@mipmap/ic_info_foreground\"\n                    app:tint=\"?android:colorPrimary\" />\n\n            </LinearLayout>\n\n        </androidx.constraintlayout.widget.ConstraintLayout>\n    </androidx.cardview.widget.CardView>\n</LinearLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/search_app_card.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\">\n\n    <androidx.cardview.widget.CardView\n        android:backgroundTint=\"@color/cardview_background_color\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        app:cardElevation=\"1dp\"\n        app:cardCornerRadius=\"30dp\"\n        android:layout_marginLeft=\"5dp\"\n        android:layout_marginRight=\"5dp\"\n        android:layout_marginBottom=\"5dp\"\n        android:layout_marginTop=\"0dp\">\n\n        <androidx.constraintlayout.widget.ConstraintLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:layout_margin=\"8dp\"\n            android:minHeight=\"55dp\"\n            android:orientation=\"horizontal\">\n\n            <androidx.cardview.widget.CardView\n                android:id=\"@+id/imageCard\"\n                android:layout_width=\"50dp\"\n                android:layout_height=\"50dp\"\n                android:layout_gravity=\"center\"\n                app:cardElevation=\"0dp\"\n                android:backgroundTint=\"@color/cardview_background_color\"\n                android:layout_marginStart=\"10dp\"\n                app:layout_constraintBottom_toBottomOf=\"parent\"\n                app:layout_constraintStart_toStartOf=\"parent\"\n                app:layout_constraintTop_toTopOf=\"parent\"\n                tools:srcCompat=\"@tools:sample/avatars\">\n\n                <com.google.android.material.imageview.ShapeableImageView\n                  android:id=\"@+id/image\"\n                  android:layout_width=\"match_parent\"\n                  android:layout_height=\"match_parent\"\n                  app:shapeAppearanceOverlay=\"@style/ShapeAppearance.Material3.Corner.Full\"\n                  android:layout_gravity=\"center\"\n                  tools:srcCompat=\"@tools:sample/avatars\" />\n\n            </androidx.cardview.widget.CardView>\n\n\n            <androidx.appcompat.widget.LinearLayoutCompat\n              android:layout_width=\"wrap_content\"\n              android:layout_height=\"wrap_content\"\n              android:orientation=\"vertical\"\n              android:layout_marginStart=\"20dp\"\n              app:layout_constraintBottom_toBottomOf=\"parent\"\n              app:layout_constraintStart_toEndOf=\"@+id/imageCard\"\n              app:layout_constraintTop_toTopOf=\"parent\">\n\n                <TextView\n                  android:id=\"@+id/appName\"\n                  android:layout_width=\"200dp\"\n                  android:layout_height=\"wrap_content\"\n                  android:ellipsize=\"end\"\n                  android:maxLines=\"1\"\n                  android:text=\"AppName\"\n                  android:textSize=\"16sp\" />\n\n                <TextView\n                  android:id=\"@+id/packageName\"\n                  android:layout_width=\"200dp\"\n                  android:layout_height=\"wrap_content\"\n                  android:text=\"PackageName\"\n                  android:maxLines=\"1\"\n                  android:ellipsize=\"end\"\n                  android:textSize=\"12sp\"\n                  app:layout_constraintStart_toStartOf=\"@+id/appName\"\n                  app:layout_constraintTop_toBottomOf=\"@+id/appName\" />\n\n            </androidx.appcompat.widget.LinearLayoutCompat>\n\n\n            <ImageView\n              android:id=\"@+id/infoIcon\"\n              android:layout_width=\"25dp\"\n              android:layout_height=\"25dp\"\n              app:layout_constraintBottom_toBottomOf=\"parent\"\n              app:layout_constraintEnd_toEndOf=\"parent\"\n              app:layout_constraintTop_toTopOf=\"parent\"\n              android:layout_marginEnd=\"5dp\"\n              app:srcCompat=\"@mipmap/ic_info_foreground\"\n              app:tint=\"?android:colorPrimary\" />\n\n        </androidx.constraintlayout.widget.ConstraintLayout>\n    </androidx.cardview.widget.CardView>\n</LinearLayout>\n"
  },
  {
    "path": "app/src/main/res/menu/bottom_menu.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item\n        android:id=\"@+id/feed\"\n        android:icon=\"@drawable/ic_home\"\n        android:title=\"@string/feed_title\"/>\n\n    <item\n        android:id=\"@+id/search\"\n        android:icon=\"@drawable/ic_search\"\n        android:title=\"@string/search_title\"/>\n\n    <item\n        android:id=\"@+id/my_apps\"\n        android:icon=\"@drawable/ic_phone\"\n        android:title=\"@string/device_title\"/>\n\n    <item\n        android:id=\"@+id/contribute\"\n        android:icon=\"@drawable/ic_add\"\n        android:title=\"@string/contribute_title\"/>\n    <item\n        android:id=\"@+id/options\"\n        android:icon=\"@drawable/ic_settings\"\n        android:title=\"@string/options_title\"/>\n</menu>"
  },
  {
    "path": "app/src/main/res/menu/menu.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:id=\"@+id/settings\"\n        android:title=\"@string/settings\" />\n    <item android:id=\"@+id/about\"\n          android:title=\"@string/about\" />\n    <item android:id=\"@+id/donate\"\n        android:title=\"@string/donate\" />\n</menu>\n"
  },
  {
    "path": "app/src/main/res/mipmap-anydpi-v26/ic_info.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@drawable/ic_info_background\"/>\n    <foreground android:drawable=\"@mipmap/ic_info_foreground\"/>\n</adaptive-icon>"
  },
  {
    "path": "app/src/main/res/mipmap-anydpi-v26/ic_info_round.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@drawable/ic_info_background\"/>\n    <foreground android:drawable=\"@mipmap/ic_info_foreground\"/>\n</adaptive-icon>"
  },
  {
    "path": "app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/ic_launcher_background\"/>\n    <foreground android:drawable=\"@drawable/ic_launcher_foreground\"/>\n    <monochrome android:drawable=\"@drawable/ic_launcher_monochrome\"/>\n</adaptive-icon>"
  },
  {
    "path": "app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/ic_launcher_background\"/>\n    <foreground android:drawable=\"@drawable/ic_launcher_foreground\"/>\n    <monochrome android:drawable=\"@drawable/ic_launcher_monochrome\"/>\n</adaptive-icon>"
  },
  {
    "path": "app/src/main/res/mipmap-anydpi-v26/search_icon.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/background\"/>\n    <foreground android:drawable=\"@mipmap/foreground\"/>\n</adaptive-icon>"
  },
  {
    "path": "app/src/main/res/mipmap-anydpi-v26/search_icon_round.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/background\"/>\n    <foreground android:drawable=\"@mipmap/foreground\"/>\n</adaptive-icon>"
  },
  {
    "path": "app/src/main/res/navigation/nav_graph.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<navigation xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:id=\"@+id/navigation\"\n    app:startDestination=\"@id/warningFragment\">\n    <fragment\n        android:id=\"@+id/warningFragment\"\n        android:name=\"com.klee.sapio.ui.view.WarningFragment\"\n        android:label=\"WarningFragment\" >\n        <action\n            android:id=\"@+id/action_warningFragment_to_chooseAppFragment\"\n            app:destination=\"@id/chooseAppFragment\" />\n    </fragment>\n    <fragment\n        android:id=\"@+id/chooseAppFragment\"\n        android:name=\"com.klee.sapio.ui.view.ChooseAppFragment\"\n        android:label=\"ChooseAppFragment\" >\n        <action\n            android:id=\"@+id/action_chooseAppFragment_to_evaluateFragment\"\n            app:destination=\"@id/evaluateFragment\" />\n        <action\n            android:id=\"@+id/action_chooseAppFragment_to_warningFragment\"\n            app:destination=\"@id/warningFragment\" />\n    </fragment>\n    <fragment\n        android:id=\"@+id/evaluateFragment\"\n        android:name=\"com.klee.sapio.ui.view.EvaluateFragment\"\n        android:label=\"EvaluateFragment\" >\n        <action\n            android:id=\"@+id/action_evaluateFragment_to_chooseAppFragment\"\n            app:destination=\"@id/chooseAppFragment\" />\n        <action\n            android:id=\"@+id/action_evaluateFragment_to_loadingFragment\"\n            app:destination=\"@id/loadingFragment\" />\n        <argument\n            android:name=\"package\"\n            app:argType=\"string\" />\n    </fragment>\n    <fragment\n        android:id=\"@+id/loadingFragment\"\n        android:name=\"com.klee.sapio.ui.view.LoadingFragment\"\n        android:label=\"LoadingFragment\">\n        <action\n            android:id=\"@+id/action_loadingFragment_to_successFragment\"\n            app:destination=\"@id/successFragment\"\n            app:popUpTo=\"@id/navigation\"\n            app:popUpToInclusive=\"false\" />\n        <argument\n            android:name=\"package\"\n            app:argType=\"string\" />\n        <argument\n            android:name=\"name\"\n            app:argType=\"string\" />\n        <argument\n            android:name=\"rating\"\n            app:argType=\"integer\" />\n    </fragment>\n    <fragment\n        android:id=\"@+id/successFragment\"\n        android:name=\"com.klee.sapio.ui.view.SuccessFragment\"\n        android:label=\"SuccessFragment\" >\n        <argument\n            android:name=\"package\"\n            app:argType=\"string\" />\n        <argument\n            android:name=\"name\"\n            app:argType=\"string\" />\n    </fragment>\n</navigation>\n"
  },
  {
    "path": "app/src/main/res/raw/loading.json",
    "content": "{\n  \"v\": \"5.9.0\",\n  \"fr\": 60,\n  \"ip\": 0,\n  \"op\": 60,\n  \"w\": 200,\n  \"h\": 200,\n  \"nm\": \"loading\",\n  \"ddd\": 0,\n  \"assets\": [],\n  \"layers\": [\n    {\n      \"ddd\": 0,\n      \"ind\": 1,\n      \"ty\": 4,\n      \"nm\": \"Progress\",\n      \"sr\": 1,\n      \"ks\": {\n        \"o\": {\"a\": 0, \"k\": 100},\n        \"r\": {\"a\": 0, \"k\": 0},\n        \"p\": {\"a\": 0, \"k\": [100, 100, 0]},\n        \"a\": {\"a\": 0, \"k\": [0, 0, 0]},\n        \"s\": {\"a\": 0, \"k\": [100, 100, 100]}\n      },\n      \"ao\": 0,\n      \"shapes\": [\n        {\n          \"ty\": \"gr\",\n          \"it\": [\n            {\n              \"ty\": \"el\",\n              \"p\": {\"a\": 0, \"k\": [0, 0]},\n              \"s\": {\"a\": 0, \"k\": [160, 160]},\n              \"nm\": \"Ellipse\"\n            },\n            {\n              \"ty\": \"st\",\n              \"c\": {\"a\": 0, \"k\": [0.098, 0.463, 0.824, 1]},\n              \"o\": {\"a\": 0, \"k\": 100},\n              \"w\": {\"a\": 0, \"k\": 16},\n              \"lc\": 2,\n              \"lj\": 2,\n              \"nm\": \"Stroke\"\n            },\n            {\n              \"ty\": \"tm\",\n              \"s\": {\"a\": 0, \"k\": 0},\n              \"e\": {\n                \"a\": 1,\n                \"k\": [\n                  {\"i\": {\"x\": [1], \"y\": [1]}, \"o\": {\"x\": [0], \"y\": [0]}, \"t\": 0, \"s\": [0]},\n                  {\"t\": 60, \"s\": [100]}\n                ]\n              },\n              \"o\": {\"a\": 0, \"k\": -90},\n              \"m\": 1,\n              \"nm\": \"Trim\"\n            },\n            {\n              \"ty\": \"tr\",\n              \"p\": {\"a\": 0, \"k\": [0, 0]},\n              \"a\": {\"a\": 0, \"k\": [0, 0]},\n              \"s\": {\"a\": 0, \"k\": [100, 100]},\n              \"r\": {\"a\": 0, \"k\": 0},\n              \"o\": {\"a\": 0, \"k\": 100}\n            }\n          ],\n          \"nm\": \"Group\"\n        }\n      ],\n      \"ip\": 0,\n      \"op\": 60,\n      \"st\": 0,\n      \"bm\": 0\n    },\n    {\n      \"ddd\": 0,\n      \"ind\": 2,\n      \"ty\": 4,\n      \"nm\": \"Track\",\n      \"sr\": 1,\n      \"ks\": {\n        \"o\": {\"a\": 0, \"k\": 20},\n        \"r\": {\"a\": 0, \"k\": 0},\n        \"p\": {\"a\": 0, \"k\": [100, 100, 0]},\n        \"a\": {\"a\": 0, \"k\": [0, 0, 0]},\n        \"s\": {\"a\": 0, \"k\": [100, 100, 100]}\n      },\n      \"ao\": 0,\n      \"shapes\": [\n        {\n          \"ty\": \"gr\",\n          \"it\": [\n            {\n              \"ty\": \"el\",\n              \"p\": {\"a\": 0, \"k\": [0, 0]},\n              \"s\": {\"a\": 0, \"k\": [160, 160]},\n              \"nm\": \"Ellipse\"\n            },\n            {\n              \"ty\": \"st\",\n              \"c\": {\"a\": 0, \"k\": [0.098, 0.463, 0.824, 1]},\n              \"o\": {\"a\": 0, \"k\": 100},\n              \"w\": {\"a\": 0, \"k\": 16},\n              \"lc\": 2,\n              \"lj\": 2,\n              \"nm\": \"Stroke\"\n            },\n            {\n              \"ty\": \"tr\",\n              \"p\": {\"a\": 0, \"k\": [0, 0]},\n              \"a\": {\"a\": 0, \"k\": [0, 0]},\n              \"s\": {\"a\": 0, \"k\": [100, 100]},\n              \"r\": {\"a\": 0, \"k\": 0},\n              \"o\": {\"a\": 0, \"k\": 100}\n            }\n          ],\n          \"nm\": \"Group\"\n        }\n      ],\n      \"ip\": 0,\n      \"op\": 60,\n      \"st\": 0,\n      \"bm\": 0\n    }\n  ]\n}\n"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"purple_200\">#FFBB86FC</color>\n    <color name=\"purple_700\">#FF3700B3</color>\n    <color name=\"blue_200\">#90CAF9</color>\n    <color name=\"blue_700\">#1976D2</color>\n    <color name=\"black\">#FF000000</color>\n    <color name=\"white\">#FFFFFFFF</color>\n    <color name=\"grey\">#212121</color>\n    <color name=\"grey_light\">#E0E0E0</color>\n    <color name=\"ic_launcher_background\">@color/grey</color>\n    <color name=\"background\">@color/white</color>\n    <color name=\"cardview_background_color\">@color/white</color>\n</resources>"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "content": "<resources>\n    <dimen name=\"fab_margin\">16dp</dimen>\n    <dimen name=\"card_unsafe_extra_padding\">16dp</dimen>\n</resources>"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\" translatable=\"false\">Sapio</string>\n    <string name=\"next\">Next</string>\n    <string name=\"previous\">Previous</string>\n    <string name=\"warning_desc\"><![CDATA[You are tasked with evaluating the behavior of an Android application on a deGoogled bare Android Open Source Project (AOSP) device.<br><br>Therefore, your device must not have the official Google Play Services installed<br><br>Make sure to understand properly the <a href=\"%1$s\">rating rules</a> before contributing.]]></string>\n    <string name=\"proceed\">Proceed</string>\n    <string name=\"select_button\">Select</string>\n    <string name=\"select_application_text\">Select the application to evaluate</string>\n    <string name=\"select_application_error\">The app does not have dependencies to Google Play Services</string>\n    <string name=\"note_application_text\">You can now evaluate the application</string>\n    <string name=\"select_evaluation_error\">Please select an evaluation</string>\n    <string name=\"microg_label\" translatable=\"false\">microG</string>\n    <string name=\"bare_aosp_label\" translatable=\"false\">bareAOSP</string>\n    <string name=\"secure_label\" translatable=\"false\">secure</string>\n    <string name=\"unsafe_label\" translatable=\"false\">unsafe</string>\n    <string name=\"works_perfectly\">\\ It works perfectly. All features are working.</string>\n    <string name=\"works_partially\">\\ It works partially. Some features do not work.</string>\n    <string name=\"dont_work\">\\ It does not work at all or crashes.</string>\n    <string name=\"upload_error\">Error evaluating app</string>\n    <string name=\"about_text\">Sapio is the anagram of Open Source API.\\n\\nSapio provides the compatibility of an Android application running on a device without Google Play Services (i.e. deGoogled bare Android Open Source Project (AOSP) devices, coupled or not with microG).\\n\\nSapio can serve as a lobbying tool by sharing compatibility on social media to raise awareness among app developers about respecting users\\' personal data.\\n\\nEvaluations in Sapio are given to the community by the community.</string>\n    <string name=\"credits\">Brain icons created by Freepik - Flaticon</string>\n    <string name=\"environment_detected\">Environment detected</string>\n    <string name=\"look_for_an_application\">Look for an application</string>\n    <string name=\"search_hint\">Search applications...</string>\n    <string name=\"updated_on\">Updated on %1$s</string>\n    <string name=\"android_compatibility_matrix\">Android Compatibility</string>\n    <string name=\"android_compatibility_subtitle\">without Google Play Services</string>\n    <string name=\"application_name\">Application name</string>\n    <string name=\"package_name\">Package name</string>\n    <string name=\"feed_title\">Feed</string>\n    <string name=\"search_title\">Search</string>\n    <string name=\"contribute_title\">Contribute</string>\n    <string name=\"options_title\">Options</string>\n    <string name=\"device_title\">Device</string>\n    <string name=\"about\">About</string>\n    <string name=\"validate_button\">Validate</string>\n    <string name=\"thank_you\">Thank you for evaluating the application</string>\n    <string name=\"good\">Works perfectly</string>\n    <string name=\"average\">One or more feature don\\'t work</string>\n    <string name=\"bad\">Does not work at all</string>\n    <string name=\"unknown\">Unknown</string>\n    <string name=\"share\">Share</string>\n    <string name=\"share_text\">Feel free to share your evaluation on social media to raise awareness among app developers about respecting users\\' personal data.</string>\n    <string name=\"share_android_compatibility\">%1$s Android Compatibility</string>\n    <string name=\"share_android_compatibility_text\">%1$s Android Compatibility https://github.com/jonathanklee/Sapio #degoogle #sapio</string>\n    <string name=\"support_privacy_focused_apps\">Support privacy-focused Android apps!</string>\n    <string name=\"donate\">Buy me a coffee</string>\n    <string name=\"settings\">Settings</string>\n    <string name=\"compatibility_check_channel_name\">Compatibility checks</string>\n    <string name=\"compatibility_check_channel_description\">Notifications about apps that are incompatible with your configuration.</string>\n    <string name=\"compatibility_check_notification_title\">Incompatible app</string>\n    <string name=\"compatibility_check_notification_body\">%1$s doesn\\'t seem to work properly without Google Play Services. Help us make noise -- share this and tag the developer to request a privacy-respecting version!</string>\n    <string name=\"compatibility_check_notification_share_action\">Share now</string>\n    <string name=\"rating_rules\"><![CDATA[<a href=\"%1$s\">Rating rules</a>]]></string>\n    <string name=\"i_have_read_and_i_understand_the_rating_rules\">I have read and I understand the rating rules</string>\n    <string name=\"show_unsafe\">Environments</string>\n    <string name=\"show_unsafe_environments\">Show unsafe environments</string>\n    <string name=\"general\">General</string>\n    <string name=\"github_star\">Star on GitHub</string>\n    <string name=\"github_url\">https://github.com/jonathanklee/Sapio</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/themes.xml",
    "content": "<resources xmlns:tools=\"http://schemas.android.com/tools\">\n    <!-- Base application theme. -->\n    <style name=\"Theme.Sapio\" parent=\"Theme.Material3.DynamicColors.DayNight\">\n        <!-- Remove capitalized text in button -->\n        <item name=\"textAllCaps\">false</item>\n        <item name=\"android:statusBarColor\">@android:color/transparent</item>\n        <item name=\"android:windowTranslucentStatus\">true</item>\n        <item name=\"android:windowTranslucentNavigation\">true</item>\n    </style>\n\n    <style name=\"Theme.Sapio.NoActionBar\" parent=\"Theme.Material3.DynamicColors.DayNight\">\n        <!-- Remove capitalized text in button -->\n        <item name=\"textAllCaps\">false</item>\n        <item name=\"android:statusBarColor\">@android:color/transparent</item>\n        <item name=\"android:windowTranslucentStatus\">true</item>\n        <item name=\"android:windowTranslucentNavigation\">true</item>\n        <!-- Remove ActionBar -->\n        <item name=\"windowActionBar\">false</item>\n        <item name=\"windowNoTitle\">true</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-de/strings.xml",
    "content": "<resources>\n    <string name=\"next\">Weiter</string>\n    <string name=\"previous\">Zurück</string>\n    <string name=\"warning_desc\"><![CDATA[Sie sollen das Verhalten einer Android-Anwendung auf einem de-gegoogelten AOSP-Gerät (Android Open Source Project) bewerten.<br><br>Daher darf auf Ihrem Gerät das offizielle Google Play Services nicht installiert sein.<br><br>Stellen Sie sicher, die <a href=\"%1$s\">Bewertungsregeln</a> richtig zu verstehen, bevor Sie beitragen.]]></string>\n    <string name=\"proceed\">Weiter</string>\n    <string name=\"select_button\">Auswählen</string>\n    <string name=\"select_application_text\">Wählen Sie die zu bewertende Anwendung aus</string>\n    <string name=\"select_application_error\">Die App hat keine Abhängigkeiten zu Google Play Services</string>\n    <string name=\"note_application_text\">Sie können die Anwendung jetzt bewerten</string>\n    <string name=\"select_evaluation_error\">Bitte wählen Sie eine Bewertung aus</string>\n    <string name=\"works_perfectly\">\\ Funktioniert perfekt. Alle Funktionen sind nutzbar.</string>\n    <string name=\"works_partially\">\\ Funktioniert teilweise. Einige Funktionen funktionieren nicht.</string>\n    <string name=\"dont_work\">\\ Funktioniert überhaupt nicht oder stürzt ab.</string>\n    <string name=\"upload_error\">Fehler bei der App-Bewertung</string>\n    <string name=\"about_text\">Sapio ist das Anagramm von Open Source API.\\n\\nSapio bietet die Kompatibilität einer Android-Anwendung auf einem Gerät ohne Google Play Services (d.h. de-gegoogelte Android Open Source Project (AOSP)-Geräte, mit oder ohne microG).\\n\\nSapio kann als Lobbying-Tool dienen, indem Kompatibilitätsinformationen in sozialen Medien geteilt werden, um App-Entwickler für den Schutz persönlicher Daten zu sensibilisieren.\\n\\nBewertungen in Sapio werden von der Community für die Community gegeben.</string>\n    <string name=\"credits\">Gehirn-Icons erstellt von Freepik - Flaticon</string>\n    <string name=\"environment_detected\">Umgebung erkannt</string>\n    <string name=\"look_for_an_application\">Eine Anwendung suchen</string>\n    <string name=\"search_hint\">Anwendungen suchen…</string>\n    <string name=\"updated_on\">Aktualisiert am %1$s</string>\n    <string name=\"android_compatibility_matrix\">Android-Kompatibilität</string>\n    <string name=\"android_compatibility_subtitle\">ohne Google Play Services</string>\n    <string name=\"application_name\">Anwendungsname</string>\n    <string name=\"package_name\">Paketname</string>\n    <string name=\"feed_title\">Feed</string>\n    <string name=\"search_title\">Suchen</string>\n    <string name=\"contribute_title\">Beitragen</string>\n    <string name=\"device_title\">Gerät</string>\n    <string name=\"options_title\">Optionen</string>\n    <string name=\"about\">Über</string>\n    <string name=\"validate_button\">Bestätigen</string>\n    <string name=\"thank_you\">Vielen Dank für die Bewertung der Anwendung</string>\n    <string name=\"good\">Funktioniert perfekt</string>\n    <string name=\"average\">Eine oder mehrere Funktionen funktionieren nicht</string>\n    <string name=\"bad\">Funktioniert überhaupt nicht</string>\n    <string name=\"unknown\">Unbekannt</string>\n    <string name=\"share\">Teilen</string>\n    <string name=\"share_text\">Teilen Sie gerne Ihre Bewertung in sozialen Medien, um App-Entwickler für den Schutz persönlicher Daten zu sensibilisieren.</string>\n    <string name=\"share_android_compatibility\">Android-Kompatibilität von %1$s</string>\n    <string name=\"share_android_compatibility_text\">Android-Kompatibilität von %1$s https://github.com/jonathanklee/Sapio #degoogle #sapio</string>\n    <string name=\"support_privacy_focused_apps\">Unterstützen Sie datenschutzorientierte Android-Apps!</string>\n    <string name=\"donate\">Einen Kaffee ausgeben</string>\n    <string name=\"settings\">Einstellungen</string>\n    <string name=\"compatibility_check_channel_name\">Kompatibilitätsprüfungen</string>\n    <string name=\"compatibility_check_channel_description\">Benachrichtigungen über Apps, die mit Ihrer Konfiguration nicht kompatibel sind.</string>\n    <string name=\"compatibility_check_notification_title\">Inkompatible App</string>\n    <string name=\"compatibility_check_notification_body\">%1$s scheint ohne Google Play Services nicht richtig zu funktionieren. Helfen Sie uns, auf das Problem aufmerksam zu machen — teilen Sie dies und markieren Sie den Entwickler, um eine datenschutzfreundliche Version anzufordern!</string>\n    <string name=\"compatibility_check_notification_share_action\">Jetzt teilen</string>\n    <string name=\"rating_rules\"><![CDATA[<a href=\"%1$s\">Bewertungsregeln</a>]]></string>\n    <string name=\"i_have_read_and_i_understand_the_rating_rules\">Ich habe die Bewertungsregeln gelesen und verstehe sie</string>\n    <string name=\"show_unsafe\">Umgebungen</string>\n    <string name=\"show_unsafe_environments\">Riskante Umgebungen anzeigen</string>\n    <string name=\"general\">Allgemein</string>\n    <string name=\"github_star\">Auf GitHub bewerten</string>\n    <string name=\"github_url\">https://github.com/jonathanklee/Sapio</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-es/strings.xml",
    "content": "<resources>\n    <string name=\"next\">Siguiente</string>\n    <string name=\"previous\">Anterior</string>\n    <string name=\"warning_desc\"><![CDATA[Se te pide evaluar el comportamiento de una aplicación Android en un dispositivo AOSP desgoogleado (Android Open Source Project).<br><br>Por tanto, tu dispositivo no debe tener instalados los Google Play Services oficiales.<br><br>Asegúrate de entender correctamente las <a href=\"%1$s\">reglas de evaluación</a> antes de contribuir.]]></string>\n    <string name=\"proceed\">Continuar</string>\n    <string name=\"select_button\">Seleccionar</string>\n    <string name=\"select_application_text\">Selecciona la aplicación a evaluar</string>\n    <string name=\"select_application_error\">La app no tiene dependencias de Google Play Services</string>\n    <string name=\"note_application_text\">Ahora puedes evaluar la aplicación</string>\n    <string name=\"select_evaluation_error\">Por favor, selecciona una evaluación</string>\n    <string name=\"works_perfectly\">\\ Funciona perfectamente. Todas las funciones están operativas.</string>\n    <string name=\"works_partially\">\\ Funciona parcialmente. Algunas funciones no funcionan.</string>\n    <string name=\"dont_work\">\\ No funciona en absoluto o se bloquea.</string>\n    <string name=\"upload_error\">Error al evaluar la app</string>\n    <string name=\"about_text\">Sapio es el anagrama de Open Source API.\\n\\nSapio proporciona la compatibilidad de una aplicación Android en un dispositivo sin Google Play Services (es decir, dispositivos Android Open Source Project (AOSP) desgoogleados, con o sin microG).\\n\\nSapio puede servir como herramienta de presión compartiendo la compatibilidad en redes sociales para concienciar a los desarrolladores de apps sobre el respeto de los datos personales de los usuarios.\\n\\nLas evaluaciones en Sapio son dadas a la comunidad por la comunidad.</string>\n    <string name=\"credits\">Iconos de cerebro creados por Freepik - Flaticon</string>\n    <string name=\"environment_detected\">Entorno detectado</string>\n    <string name=\"look_for_an_application\">Buscar una aplicación</string>\n    <string name=\"search_hint\">Buscar aplicaciones…</string>\n    <string name=\"updated_on\">Actualizado el %1$s</string>\n    <string name=\"android_compatibility_matrix\">Compatibilidad Android</string>\n    <string name=\"android_compatibility_subtitle\">sin Google Play Services</string>\n    <string name=\"application_name\">Nombre de la aplicación</string>\n    <string name=\"package_name\">Nombre del paquete</string>\n    <string name=\"feed_title\">Novedades</string>\n    <string name=\"search_title\">Buscar</string>\n    <string name=\"contribute_title\">Contribuir</string>\n    <string name=\"device_title\">Dispositivo</string>\n    <string name=\"options_title\">Opciones</string>\n    <string name=\"about\">Acerca de</string>\n    <string name=\"validate_button\">Validar</string>\n    <string name=\"thank_you\">Gracias por evaluar la aplicación</string>\n    <string name=\"good\">Funciona perfectamente</string>\n    <string name=\"average\">Una o más funciones no funcionan</string>\n    <string name=\"bad\">No funciona en absoluto</string>\n    <string name=\"unknown\">Desconocido</string>\n    <string name=\"share\">Compartir</string>\n    <string name=\"share_text\">No dudes en compartir tu evaluación en las redes sociales para concienciar a los desarrolladores sobre el respeto de los datos personales de los usuarios.</string>\n    <string name=\"share_android_compatibility\">Compatibilidad Android de %1$s</string>\n    <string name=\"share_android_compatibility_text\">Compatibilidad Android de %1$s https://github.com/jonathanklee/Sapio #degoogle #sapio</string>\n    <string name=\"support_privacy_focused_apps\">¡Apoya las apps Android centradas en la privacidad!</string>\n    <string name=\"donate\">Invitar a un café</string>\n    <string name=\"settings\">Configuración</string>\n    <string name=\"compatibility_check_channel_name\">Comprobaciones de compatibilidad</string>\n    <string name=\"compatibility_check_channel_description\">Notificaciones sobre apps incompatibles con tu configuración.</string>\n    <string name=\"compatibility_check_notification_title\">App incompatible</string>\n    <string name=\"compatibility_check_notification_body\">%1$s no parece funcionar correctamente sin Google Play Services. ¡Ayúdanos a hacer ruido — comparte esto y etiqueta al desarrollador para solicitar una versión respetuosa con la privacidad!</string>\n    <string name=\"compatibility_check_notification_share_action\">Compartir ahora</string>\n    <string name=\"rating_rules\"><![CDATA[<a href=\"%1$s\">Reglas de evaluación</a>]]></string>\n    <string name=\"i_have_read_and_i_understand_the_rating_rules\">He leído y entiendo las reglas de evaluación</string>\n    <string name=\"show_unsafe\">Entornos</string>\n    <string name=\"show_unsafe_environments\">Mostrar entornos arriesgados</string>\n    <string name=\"general\">General</string>\n    <string name=\"github_star\">Dar estrella en GitHub</string>\n    <string name=\"github_url\">https://github.com/jonathanklee/Sapio</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-fr/strings.xml",
    "content": "<resources>\n    <string name=\"next\">Suivant</string>\n    <string name=\"previous\">Précédent</string>\n    <string name=\"warning_desc\"><![CDATA[Vous êtes sur le point d\\'évaluer le fonctionnement d\\'une application Android sur un appareil AOSP déGooglisé.<br><br>Par conséquent, votre appareil ne doit pas avoir les Google Play Services d\\'installés.<br><br>Soyez certains de bien comprendre les <a href=\"%1$s\">règles d\\'évaluation</a> avant de contribuer.]]></string>\n    <string name=\"proceed\">Commencer</string>\n    <string name=\"select_button\">Sélectionner</string>\n    <string name=\"select_application_text\">Selectionnez l\\'application à évaluer</string>\n    <string name=\"select_application_error\">L\\'app n\\'a pas de dépendances vers les Google Play Services</string>\n    <string name=\"note_application_text\">Vous pouvez désormais évaluer l\\'application</string>\n    <string name=\"select_evaluation_error\">Veuillez sélectionner une évaluation</string>\n    <string name=\"works_perfectly\">\\ Elle fonctionne parfaitement.</string>\n    <string name=\"works_partially\">\\ Elle fonctionne partiellement.</string>\n    <string name=\"dont_work\">\\ Elle ne fonctionne pas du tout ou crashe.</string>\n    <string name=\"upload_error\">Erreur lors de l\\'évaluation</string>\n    <string name=\"about_text\">Sapio est l\\'anagramme d\\'Open Source API.\\n\\nSapio fournit la compatibilité d\\'une application Android sur un appareil sans Google Play Services (i.e. les téléphones fonctionnant sur un Android Open Source Project (AOSP) déGooglisé, associés ou non à microG).\\n\\nSapio peut être utilisé comme un outil de lobbying en partageant la compatibilité sur les réseaux sociaux pour sensibiliser les développeurs d\\'applications aux données personnelles des utilisateurs.\\n\\nLes évaluations de Sapio sont fournies à la communauté par la communauté.</string>\n    <string name=\"credits\">Icone cerveau créé par Freepik - Flaticon</string>\n    <string name=\"environment_detected\">Environnement détécté</string>\n    <string name=\"look_for_an_application\">Rechercher une application</string>\n    <string name=\"search_hint\">Rechercher des applications ...</string>\n    <string name=\"updated_on\">Mis à jour le %1$s</string>\n    <string name=\"android_compatibility_matrix\">Compatibilité Android</string>\n    <string name=\"android_compatibility_subtitle\">sans Google Play Services</string>\n    <string name=\"application_name\">Nom de l\\'application</string>\n    <string name=\"package_name\">Nom du paquet</string>\n    <string name=\"feed_title\">Actualité</string>\n    <string name=\"search_title\">Rechercher</string>\n    <string name=\"contribute_title\">Contribuer</string>\n    <string name=\"device_title\">Appareil</string>\n    <string name=\"options_title\">Options</string>\n    <string name=\"about\">A propos</string>\n    <string name=\"donate\">Offrir un café</string>\n    <string name=\"validate_button\">Valider</string>\n    <string name=\"thank_you\">Merci d\\'avoir évalué l\\'application</string>\n    <string name=\"good\">Fonctionne parfaitement</string>\n    <string name=\"average\">Fonctionne partiellement</string>\n    <string name=\"bad\">Ne fonctionne pas du tout</string>\n    <string name=\"unknown\">Inconnu</string>\n    <string name=\"settings\">Paramètres</string>\n    <string name=\"share\">Partager</string>\n    <string name=\"rating_rules\"><![CDATA[<a href=\"%1$s\">Règles d\\'évaluation</a>]]></string>\n    <string name=\"i_have_read_and_i_understand_the_rating_rules\">J\\'ai lu et je comprends les règles d\\'évaluation</string>\n    <string name=\"share_text\">N\\'hésitez pas à partager votre évaluation sur les réseaux sociaux pour sensibiliser les développeurs au respect des données personnelles.</string>\n    <string name=\"share_android_compatibility\">%1$s Compatibilité Android</string>\n    <string name=\"share_android_compatibility_text\">%1$s Compatibilité Android https://github.com/jonathanklee/Sapio #degoogle #sapio</string>\n    <string name=\"compatibility_check_channel_name\">Vérifications de compatibilité</string>\n    <string name=\"compatibility_check_channel_description\">Notifications sur les applications incompatibles avec votre configuration.</string>\n    <string name=\"compatibility_check_notification_title\">App incompatible</string>\n    <string name=\"compatibility_check_notification_body\">L\\'application %1$s ne semble pas fonctionner correctement sans Google Play Services. Aidez-nous à faire du bruit - partagez ceci et taguez le développeur pour demander une version respectueuse de la vie privée !</string>\n    <string name=\"compatibility_check_notification_share_action\">Partager maintenant</string>\n    <string name=\"support_privacy_focused_apps\">Soutenez les applications Android respectueuses de la vie privée !</string>\n    <string name=\"show_unsafe\">Environnements</string>\n    <string name=\"general\">Général</string>\n    <string name=\"show_unsafe_environments\">Montrer les environnements non-securisés</string>\n    <string name=\"github_star\">Étoiler sur GitHub</string>\n    <string name=\"github_url\">https://github.com/jonathanklee/Sapio</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-it/strings.xml",
    "content": "<resources>\n    <string name=\"next\">Avanti</string>\n    <string name=\"previous\">Indietro</string>\n    <string name=\"warning_desc\"><![CDATA[Sei incaricato di valutare il comportamento di un\\'applicazione Android su un dispositivo AOSP de-googlizzato (Android Open Source Project).<br><br>Pertanto, il tuo dispositivo non deve avere i Google Play Services ufficiali installati.<br><br>Assicurati di capire correttamente le <a href=\"%1$s\">regole di valutazione</a> prima di contribuire.]]></string>\n    <string name=\"proceed\">Procedi</string>\n    <string name=\"select_button\">Seleziona</string>\n    <string name=\"select_application_text\">Seleziona l\\'applicazione da valutare</string>\n    <string name=\"select_application_error\">L\\'app non ha dipendenze da Google Play Services</string>\n    <string name=\"note_application_text\">Ora puoi valutare l\\'applicazione</string>\n    <string name=\"select_evaluation_error\">Seleziona una valutazione</string>\n    <string name=\"works_perfectly\">\\ Funziona perfettamente. Tutte le funzionalità sono operative.</string>\n    <string name=\"works_partially\">\\ Funziona parzialmente. Alcune funzionalità non funzionano.</string>\n    <string name=\"dont_work\">\\ Non funziona affatto o va in crash.</string>\n    <string name=\"upload_error\">Errore nella valutazione dell\\'app</string>\n    <string name=\"about_text\">Sapio è l\\'anagramma di Open Source API.\\n\\nSapio fornisce la compatibilità di un\\'applicazione Android su un dispositivo senza Google Play Services (es. dispositivi Android Open Source Project (AOSP) de-googlizzati, con o senza microG).\\n\\nSapio può essere usato come strumento di lobbying condividendo la compatibilità sui social media per sensibilizzare gli sviluppatori di app sul rispetto dei dati personali degli utenti.\\n\\nLe valutazioni in Sapio sono date alla comunità dalla comunità.</string>\n    <string name=\"credits\">Icone cervello create da Freepik - Flaticon</string>\n    <string name=\"environment_detected\">Ambiente rilevato</string>\n    <string name=\"look_for_an_application\">Cerca un\\'applicazione</string>\n    <string name=\"search_hint\">Cerca applicazioni…</string>\n    <string name=\"updated_on\">Aggiornato il %1$s</string>\n    <string name=\"android_compatibility_matrix\">Compatibilità Android</string>\n    <string name=\"android_compatibility_subtitle\">senza Google Play Services</string>\n    <string name=\"application_name\">Nome dell\\'applicazione</string>\n    <string name=\"package_name\">Nome del pacchetto</string>\n    <string name=\"feed_title\">Feed</string>\n    <string name=\"search_title\">Cerca</string>\n    <string name=\"contribute_title\">Contribuisci</string>\n    <string name=\"device_title\">Dispositivo</string>\n    <string name=\"options_title\">Opzioni</string>\n    <string name=\"about\">Informazioni</string>\n    <string name=\"validate_button\">Valida</string>\n    <string name=\"thank_you\">Grazie per aver valutato l\\'applicazione</string>\n    <string name=\"good\">Funziona perfettamente</string>\n    <string name=\"average\">Una o più funzionalità non funzionano</string>\n    <string name=\"bad\">Non funziona affatto</string>\n    <string name=\"unknown\">Sconosciuto</string>\n    <string name=\"share\">Condividi</string>\n    <string name=\"share_text\">Condividi la tua valutazione sui social media per sensibilizzare gli sviluppatori di app sul rispetto dei dati personali degli utenti.</string>\n    <string name=\"share_android_compatibility\">Compatibilità Android di %1$s</string>\n    <string name=\"share_android_compatibility_text\">Compatibilità Android di %1$s https://github.com/jonathanklee/Sapio #degoogle #sapio</string>\n    <string name=\"support_privacy_focused_apps\">Supporta le app Android rispettose della privacy!</string>\n    <string name=\"donate\">Offrimi un caffè</string>\n    <string name=\"settings\">Impostazioni</string>\n    <string name=\"compatibility_check_channel_name\">Controlli di compatibilità</string>\n    <string name=\"compatibility_check_channel_description\">Notifiche sulle app incompatibili con la tua configurazione.</string>\n    <string name=\"compatibility_check_notification_title\">App incompatibile</string>\n    <string name=\"compatibility_check_notification_body\">%1$s non sembra funzionare correttamente senza Google Play Services. Aiutaci a far sentire la nostra voce — condividi e tagga lo sviluppatore per richiedere una versione rispettosa della privacy!</string>\n    <string name=\"compatibility_check_notification_share_action\">Condividi ora</string>\n    <string name=\"rating_rules\"><![CDATA[<a href=\"%1$s\">Regole di valutazione</a>]]></string>\n    <string name=\"i_have_read_and_i_understand_the_rating_rules\">Ho letto e capisco le regole di valutazione</string>\n    <string name=\"show_unsafe\">Ambienti</string>\n    <string name=\"show_unsafe_environments\">Mostra ambienti rischiosi</string>\n    <string name=\"general\">Generale</string>\n    <string name=\"github_star\">Metti una stella su GitHub</string>\n    <string name=\"github_url\">https://github.com/jonathanklee/Sapio</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-land/dimens.xml",
    "content": "<resources>\n    <dimen name=\"fab_margin\">48dp</dimen>\n</resources>"
  },
  {
    "path": "app/src/main/res/values-night/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"cardview_background_color\">@color/grey</color>\n</resources>"
  },
  {
    "path": "app/src/main/res/values-night-v31/themes.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <style name=\"Theme.Sapio\" parent=\"Theme.Material3.DynamicColors.DayNight\">\n        <!-- Remove capitalized text in button -->\n        <item name=\"textAllCaps\">false</item>\n        <item name=\"android:statusBarColor\">@android:color/transparent</item>\n        <item name=\"android:windowSplashScreenBackground\">@color/ic_launcher_background</item>\n    </style>\n\n    <style name=\"Theme.Sapio.NoActionBar\" parent=\"Theme.Material3.DynamicColors.DayNight\">\n        <!-- Remove capitalized text in button -->\n        <item name=\"textAllCaps\">false</item>\n        <item name=\"android:statusBarColor\">@android:color/transparent</item>\n        <item name=\"android:windowSplashScreenBackground\">@color/ic_launcher_background</item>\n        <!-- Remove ActionBar -->\n        <item name=\"windowActionBar\">false</item>\n        <item name=\"windowNoTitle\">true</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-v31/themes.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <style name=\"Theme.Sapio\" parent=\"Theme.Material3.DynamicColors.DayNight\">\n        <!-- Remove capitalized text in button -->\n        <item name=\"textAllCaps\">false</item>\n        <item name=\"android:statusBarColor\">@android:color/transparent</item>\n        <item name=\"android:windowSplashScreenBackground\">@color/ic_launcher_background</item>\n        <item name=\"android:windowLightStatusBar\">true</item>\n    </style>\n\n    <style name=\"Theme.Sapio.NoActionBar\" parent=\"Theme.Material3.DynamicColors.DayNight\">\n        <!-- Remove capitalized text in button -->\n        <item name=\"textAllCaps\">false</item>\n        <item name=\"android:statusBarColor\">@android:color/transparent</item>\n        <item name=\"android:windowSplashScreenBackground\">@color/ic_launcher_background</item>\n        <item name=\"android:windowLightStatusBar\">true</item>\n        <!-- Remove ActionBar -->\n        <item name=\"windowActionBar\">false</item>\n        <item name=\"windowNoTitle\">true</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-w1240dp/dimens.xml",
    "content": "<resources>\n    <dimen name=\"fab_margin\">200dp</dimen>\n</resources>"
  },
  {
    "path": "app/src/main/res/values-w600dp/dimens.xml",
    "content": "<resources>\n    <dimen name=\"fab_margin\">48dp</dimen>\n</resources>"
  },
  {
    "path": "app/src/main/res/xml/preferences.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.preference.PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <PreferenceCategory android:title=\"@string/general\">\n        <SwitchPreferenceCompat\n            android:key=\"show_root\"\n            android:title=\"@string/show_unsafe\"\n            android:summary=\"@string/show_unsafe_environments\"\n            android:defaultValue=\"false\" />\n    </PreferenceCategory>\n    \n    <PreferenceCategory android:title=\"@string/about\">\n        <Preference\n            android:key=\"github_star_preference\"\n            android:title=\"@string/github_star\" />\n        \n        <Preference\n            android:key=\"donate_preference\"\n            android:title=\"@string/donate\" />\n        \n        <Preference\n            android:key=\"about_preference\"\n            android:title=\"@string/about\" />\n    </PreferenceCategory>\n</androidx.preference.PreferenceScreen>\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/AppEvaluationsViewModelTest.kt",
    "content": "package com.klee.sapio\n\nimport android.os.Build\nimport androidx.arch.core.executor.testing.InstantTaskExecutorRule\nimport com.klee.sapio.data.system.Settings\nimport com.klee.sapio.domain.model.GmsType\nimport com.klee.sapio.domain.model.UserType\nimport com.klee.sapio.domain.EvaluationRepository\nimport com.klee.sapio.domain.FetchAppEvaluationUseCase\nimport com.klee.sapio.domain.FetchIconUrlUseCase\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport com.klee.sapio.ui.viewmodel.AppEvaluationsViewModel\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.ExperimentalCoroutinesApi\nimport kotlinx.coroutines.test.StandardTestDispatcher\nimport kotlinx.coroutines.test.advanceUntilIdle\nimport kotlinx.coroutines.test.resetMain\nimport kotlinx.coroutines.test.runTest\nimport kotlinx.coroutines.test.setMain\nimport org.junit.After\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertNull\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Rule\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.RuntimeEnvironment\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n@OptIn(ExperimentalCoroutinesApi::class)\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.M])\nclass AppEvaluationsViewModelTest {\n\n    @get:Rule\n    val instantTaskExecutorRule = InstantTaskExecutorRule()\n\n    private val dispatcher = StandardTestDispatcher()\n    private val appContext = RuntimeEnvironment.getApplication()\n\n    @Before\n    fun setUp() {\n        Dispatchers.setMain(dispatcher)\n    }\n\n    @After\n    fun tearDown() {\n        Dispatchers.resetMain()\n    }\n\n    @Test\n    fun `listEvaluations posts only user evaluations when unsafe disabled`() = runTest(dispatcher) {\n        val vm = buildViewModel(unsafeEnabled = false)\n\n        vm.listEvaluations(\"pkg\")\n        advanceUntilIdle()\n        vm.onIconDisplayed()\n\n        val state = vm.uiState.value\n        assertEquals(\"microg-secure\", state.microgUser?.name)\n        assertEquals(\"bare-secure\", state.bareAospUser?.name)\n        assertNull(state.microgRoot)\n        assertNull(state.bareAospRoot)\n        assertEquals(\"https://icon\", state.iconUrl)\n        assertTrue(state.isFullyLoaded)\n        assertEquals(0, state.pendingCount)\n    }\n\n    @Test\n    fun `listEvaluations posts unsafe evaluations when unsafe enabled`() = runTest(dispatcher) {\n        val vm = buildViewModel(unsafeEnabled = true)\n\n        vm.listEvaluations(\"pkg\")\n        advanceUntilIdle()\n        vm.onIconDisplayed()\n\n        val state = vm.uiState.value\n        assertEquals(\"microg-unsafe\", state.microgRoot?.name)\n        assertEquals(\"bare-unsafe\", state.bareAospRoot?.name)\n        assertTrue(state.isFullyLoaded)\n        assertEquals(0, state.pendingCount)\n    }\n\n    @Test\n    fun `listEvaluations handles null evaluations`() = runTest(dispatcher) {\n        val vm = buildViewModel(unsafeEnabled = true, returnNullEvals = true, iconUrl = \"\")\n\n        vm.listEvaluations(\"pkg\")\n        advanceUntilIdle()\n        vm.onIconDisplayed()\n\n        val state = vm.uiState.value\n        assertNull(state.microgUser)\n        assertNull(state.bareAospUser)\n        assertNull(state.microgRoot)\n        assertNull(state.bareAospRoot)\n        assertEquals(\"\", state.iconUrl)\n        assertTrue(state.isFullyLoaded)\n        assertEquals(0, state.pendingCount)\n    }\n\n    private fun buildViewModel(\n        unsafeEnabled: Boolean,\n        returnNullEvals: Boolean = false,\n        iconUrl: String = \"https://icon\"\n    ): AppEvaluationsViewModel {\n        val mockRepository = object : EvaluationRepository {\n            override suspend fun listLatestEvaluations(pageNumber: Int): Result<List<Evaluation>> =\n                Result.success(emptyList())\n            override suspend fun searchEvaluations(pattern: String): Result<List<Evaluation>> =\n                Result.success(emptyList())\n            override suspend fun addEvaluation(evaluation: UploadEvaluation): Result<Unit> = Result.success(Unit)\n            override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int): Result<Unit> =\n                Result.success(Unit)\n            override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int): Result<Evaluation?> =\n                Result.success(null)\n            override suspend fun existingEvaluations(packageName: String): Result<List<EvaluationRecord>> =\n                Result.success(emptyList())\n            override suspend fun uploadIcon(packageName: String): Result<List<Icon>> =\n                Result.success(emptyList())\n            override suspend fun existingIcon(iconName: String): Result<List<Icon>> =\n                Result.success(emptyList())\n            override suspend fun deleteIcon(id: Int): Result<Unit> = Result.success(Unit)\n        }\n\n        val fetchEvaluationUseCase = object : FetchAppEvaluationUseCase(mockRepository) {\n            override suspend fun invoke(packageName: String, gmsType: Int, userType: Int): Result<Evaluation?> {\n                if (returnNullEvals) return Result.success(null)\n                val name = when {\n                    gmsType == GmsType.MICROG && userType == UserType.SECURE -> \"microg-secure\"\n                    gmsType == GmsType.MICROG && userType == UserType.UNSAFE -> \"microg-unsafe\"\n                    gmsType == GmsType.BARE_AOSP && userType == UserType.SECURE -> \"bare-secure\"\n                    else -> \"bare-unsafe\"\n                }\n                return Result.success(eval(name, packageName))\n            }\n        }\n        val iconUrlUseCase = object : FetchIconUrlUseCase(mockRepository) {\n            override suspend fun invoke(packageName: String): Result<String> = Result.success(iconUrl)\n        }\n        val settingsObj = object : Settings(appContext) {\n            override fun isUnsafeConfigurationEnabled(): Boolean = unsafeEnabled\n        }\n\n        return AppEvaluationsViewModel(\n            fetchEvaluationUseCase,\n            iconUrlUseCase,\n            settingsObj\n        ).apply {\n            ioDispatcher = dispatcher\n        }\n    }\n\n    private fun eval(name: String, packageName: String) = Evaluation(\n        name = name,\n        packageName = packageName,\n        iconUrl = null,\n        rating = 1,\n        microg = 1,\n        secure = 1,\n        updatedAt = null,\n        createdAt = null,\n        publishedAt = null,\n        versionName = null\n    )\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/DeviceConfigurationTest.kt",
    "content": "package com.klee.sapio\n\nimport android.content.Context\nimport android.content.pm.ApplicationInfo\nimport android.content.pm.PackageManager\nimport android.os.Build\nimport com.klee.sapio.data.system.DeviceConfiguration\nimport com.klee.sapio.domain.model.GmsType\nimport com.klee.sapio.domain.model.UserType\nimport org.junit.Assert\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.mockito.ArgumentMatchers.eq\nimport org.mockito.Mock\nimport org.mockito.Mockito\nimport org.mockito.MockitoAnnotations\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\nimport org.robolectric.util.ReflectionHelpers\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.M])\nclass DeviceConfigurationTest {\n\n    private lateinit var deviceConfiguration: DeviceConfiguration\n\n    @Mock\n    private lateinit var mockedContext: Context\n\n    @Mock\n    private lateinit var mockedPackageManager: PackageManager\n\n    private lateinit var fakeGmsApp: ApplicationInfo\n    private lateinit var fakeMicroGApp: ApplicationInfo\n    private lateinit var fakeRegularApp: ApplicationInfo\n\n    @Before\n    fun setUp() {\n        MockitoAnnotations.openMocks(this)\n\n        fakeGmsApp = ApplicationInfo().apply {\n            packageName = DeviceConfiguration.GMS_SERVICES_PACKAGE_NAME\n            name = \"Google Play Services\"\n        }\n\n        fakeMicroGApp = ApplicationInfo().apply {\n            packageName = DeviceConfiguration.GMS_SERVICES_PACKAGE_NAME\n            name = \"microG Services Core\"\n        }\n\n        fakeRegularApp = ApplicationInfo().apply {\n            packageName = \"com.example.app\"\n            name = \"Example App\"\n        }\n\n        // Setup the mocked context and package manager BEFORE creating DeviceConfiguration\n        Mockito.`when`(mockedContext.packageManager).thenReturn(mockedPackageManager)\n\n        // Create DeviceConfiguration with mocked context\n        deviceConfiguration = DeviceConfiguration(mockedContext)\n    }\n\n    @Test\n    fun test_getGmsType_withGooglePlayServices() {\n        // Setup the mock behavior BEFORE creating DeviceConfiguration\n        val apps = listOf(fakeGmsApp, fakeRegularApp)\n        Mockito.`when`(mockedPackageManager.getInstalledApplications(0))\n            .thenReturn(apps)\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(fakeGmsApp)))\n            .thenReturn(\"Google Play Services\")\n\n        // Recreate DeviceConfiguration with the properly mocked context\n        deviceConfiguration = DeviceConfiguration(mockedContext)\n\n        val result = deviceConfiguration.getGmsType()\n        Assert.assertEquals(\"Should return Google Play Services type\", GmsType.GOOGLE_PLAY_SERVICES, result)\n    }\n\n    @Test\n    fun test_getGmsType_withMicroG() {\n        // Setup the mock behavior BEFORE creating DeviceConfiguration\n        val apps = listOf(fakeMicroGApp, fakeRegularApp)\n        Mockito.`when`(mockedPackageManager.getInstalledApplications(0))\n            .thenReturn(apps)\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(fakeMicroGApp)))\n            .thenReturn(\"microG Services Core\")\n\n        // Recreate DeviceConfiguration with the properly mocked context\n        deviceConfiguration = DeviceConfiguration(mockedContext)\n\n        val result = deviceConfiguration.getGmsType()\n        Assert.assertEquals(\"Should return microG type\", GmsType.MICROG, result)\n    }\n\n    @Test\n    fun test_getGmsType_withMicroGRenamedAsAppCompatibilityServices() {\n        val renamedMicroGApp = ApplicationInfo().apply {\n            packageName = DeviceConfiguration.GMS_SERVICES_PACKAGE_NAME\n        }\n        val apps = listOf(renamedMicroGApp, fakeRegularApp)\n        Mockito.`when`(mockedPackageManager.getInstalledApplications(0))\n            .thenReturn(apps)\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(renamedMicroGApp)))\n            .thenReturn(\"App compatibility Services\")\n\n        deviceConfiguration = DeviceConfiguration(mockedContext)\n\n        val result = deviceConfiguration.getGmsType()\n        Assert.assertEquals(GmsType.MICROG, result)\n    }\n\n    @Test\n    fun test_getGmsType_withBareAosp() {\n        // Setup the mock behavior BEFORE creating DeviceConfiguration\n        val apps = listOf(fakeRegularApp)\n        Mockito.`when`(mockedPackageManager.getInstalledApplications(0))\n            .thenReturn(apps)\n\n        // Recreate DeviceConfiguration with the properly mocked context\n        deviceConfiguration = DeviceConfiguration(mockedContext)\n\n        val result = deviceConfiguration.getGmsType()\n        Assert.assertEquals(\"Should return bare AOSP type\", GmsType.BARE_AOSP, result)\n    }\n\n    @Test\n    fun test_isUnsafe_withRootedAndUnlockedBootloader() {\n        // This test is more complex due to the private isBootloaderLocked method\n        // We'll test the public behavior by mocking the RootBeer result\n        val apps = listOf(fakeRegularApp)\n        Mockito.`when`(mockedPackageManager.getInstalledApplications(0))\n            .thenReturn(apps)\n\n        // For this test, we'll assume the device is rooted and bootloader is unlocked\n        // Since we can't easily mock the private method, we'll test the happy path\n        val result = deviceConfiguration.isUnsafe()\n        // The actual result depends on the device state, so we'll just verify it returns a valid value\n        Assert.assertTrue(\"Should return either UNSAFE or SECURE\", \n            result == UserType.UNSAFE || result == UserType.SECURE)\n    }\n\n    @Test\n    fun test_isBootloaderLocked_states() {\n        // Force bootloader state via ShadowSystemProperties used by SystemPropertyReader inside DeviceConfiguration\n        ReflectionHelpers.callStaticMethod<Void>(\n            Class.forName(\"android.os.SystemProperties\"),\n            \"set\",\n            org.robolectric.util.ReflectionHelpers.ClassParameter.from(String::class.java, \"ro.boot.verifiedbootstate\"),\n            org.robolectric.util.ReflectionHelpers.ClassParameter.from(String::class.java, \"green\")\n        )\n        Assert.assertEquals(UserType.SECURE, deviceConfiguration.isUnsafe()) // green => locked -> secure if not rooted\n\n        ReflectionHelpers.callStaticMethod<Void>(\n            Class.forName(\"android.os.SystemProperties\"),\n            \"set\",\n            org.robolectric.util.ReflectionHelpers.ClassParameter.from(String::class.java, \"ro.boot.verifiedbootstate\"),\n            org.robolectric.util.ReflectionHelpers.ClassParameter.from(String::class.java, \"red\")\n        )\n        val redResult = deviceConfiguration.isUnsafe()\n        Assert.assertTrue(redResult == UserType.UNSAFE || redResult == UserType.SECURE)\n    }\n\n    @Test\n    fun test_isUnsafe_branch_with_overrides() {\n        val fake = object : DeviceConfiguration(mockedContext) {\n            override fun isRooted(): Boolean = true\n            override fun isBootloaderLocked(): Boolean = false\n        }\n        Assert.assertEquals(UserType.UNSAFE, fake.isUnsafe())\n\n        val secure = object : DeviceConfiguration(mockedContext) {\n            override fun isRooted(): Boolean = true\n            override fun isBootloaderLocked(): Boolean = true\n        }\n        Assert.assertEquals(UserType.SECURE, secure.isUnsafe())\n\n        val clean = object : DeviceConfiguration(mockedContext) {\n            override fun isRooted(): Boolean = false\n            override fun isBootloaderLocked(): Boolean = false\n        }\n        Assert.assertEquals(UserType.SECURE, clean.isUnsafe())\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/DomainUseCasesTest.kt",
    "content": "package com.klee.sapio\n\nimport com.klee.sapio.domain.FetchAppEvaluationUseCase\nimport com.klee.sapio.domain.FetchIconUrlUseCase\nimport com.klee.sapio.domain.EvaluationRepository\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.GmsType\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.UserType\nimport kotlinx.coroutines.ExperimentalCoroutinesApi\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertEquals\nimport org.junit.Before\nimport org.junit.Test\nimport org.mockito.Mock\nimport org.mockito.Mockito.`when`\nimport org.mockito.Mockito.verify\nimport org.mockito.MockitoAnnotations\n\n@OptIn(ExperimentalCoroutinesApi::class)\nclass DomainUseCasesTest {\n\n    @Mock\n    lateinit var evaluationRepository: EvaluationRepository\n\n    private lateinit var fetchIconUrlUseCase: FetchIconUrlUseCase\n    private lateinit var fetchEvaluationUseCase: FetchAppEvaluationUseCase\n\n    @Before\n    fun setUp() {\n        MockitoAnnotations.openMocks(this)\n        fetchIconUrlUseCase = FetchIconUrlUseCase(evaluationRepository)\n        fetchEvaluationUseCase = FetchAppEvaluationUseCase(evaluationRepository)\n    }\n\n    @Test\n    fun `fetch icon url returns first url when icons exist`() = runTest {\n        val icon = Icon(\n            id = 1,\n            name = \"icon.png\",\n            url = \"https://example.com/icon.png\"\n        )\n\n        `when`(evaluationRepository.existingIcon(\"com.test.png\")).thenReturn(Result.success(listOf(icon)))\n\n        val result = fetchIconUrlUseCase(\"com.test\")\n\n        assertEquals(\"https://example.com/icon.png\", result.getOrNull())\n        verify(evaluationRepository).existingIcon(\"com.test.png\")\n    }\n\n    @Test\n    fun `fetch icon url returns empty string when no icons`() = runTest {\n        `when`(evaluationRepository.existingIcon(\"com.empty.png\")).thenReturn(Result.success(emptyList()))\n\n        val result = fetchIconUrlUseCase(\"com.empty\")\n\n        assertEquals(\"\", result.getOrNull())\n        verify(evaluationRepository).existingIcon(\"com.empty.png\")\n    }\n\n    @Test\n    fun `fetch microg secure delegates to repository`() = runTest {\n        val expected = dummyEvaluation(\"microg.secure\")\n        `when`(evaluationRepository.fetchEvaluation(\"pkg\", GmsType.MICROG, UserType.SECURE))\n            .thenReturn(Result.success(expected))\n\n        val result = fetchEvaluationUseCase(\"pkg\", GmsType.MICROG, UserType.SECURE)\n\n        assertEquals(expected, result.getOrNull())\n        verify(evaluationRepository).fetchEvaluation(\"pkg\", GmsType.MICROG, UserType.SECURE)\n    }\n\n    @Test\n    fun `fetch microg unsafe delegates to repository`() = runTest {\n        val expected = dummyEvaluation(\"microg.unsafe\")\n        `when`(evaluationRepository.fetchEvaluation(\"pkg\", GmsType.MICROG, UserType.UNSAFE))\n            .thenReturn(Result.success(expected))\n\n        val result = fetchEvaluationUseCase(\"pkg\", GmsType.MICROG, UserType.UNSAFE)\n\n        assertEquals(expected, result.getOrNull())\n        verify(evaluationRepository).fetchEvaluation(\"pkg\", GmsType.MICROG, UserType.UNSAFE)\n    }\n\n    @Test\n    fun `fetch bare aosp secure delegates to repository`() = runTest {\n        val expected = dummyEvaluation(\"bare.secure\")\n        `when`(evaluationRepository.fetchEvaluation(\"pkg\", GmsType.BARE_AOSP, UserType.SECURE))\n            .thenReturn(Result.success(expected))\n\n        val result = fetchEvaluationUseCase(\"pkg\", GmsType.BARE_AOSP, UserType.SECURE)\n\n        assertEquals(expected, result.getOrNull())\n        verify(evaluationRepository).fetchEvaluation(\"pkg\", GmsType.BARE_AOSP, UserType.SECURE)\n    }\n\n    @Test\n    fun `fetch bare aosp unsafe delegates to repository`() = runTest {\n        val expected = dummyEvaluation(\"bare.unsafe\")\n        `when`(evaluationRepository.fetchEvaluation(\"pkg\", GmsType.BARE_AOSP, UserType.UNSAFE))\n            .thenReturn(Result.success(expected))\n\n        val result = fetchEvaluationUseCase(\"pkg\", GmsType.BARE_AOSP, UserType.UNSAFE)\n\n        assertEquals(expected, result.getOrNull())\n        verify(evaluationRepository).fetchEvaluation(\"pkg\", GmsType.BARE_AOSP, UserType.UNSAFE)\n    }\n\n    private fun dummyEvaluation(name: String) = Evaluation(\n        name = name,\n        packageName = \"pkg\",\n        iconUrl = null,\n        rating = 1,\n        microg = 1,\n        secure = 1,\n        updatedAt = null,\n        createdAt = null,\n        publishedAt = null,\n        versionName = null\n    )\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/EvaluateAppUseCaseBehaviourTest.kt",
    "content": "package com.klee.sapio\n\nimport android.os.Build\nimport com.klee.sapio.domain.EvaluateAppUseCase\nimport com.klee.sapio.data.system.DeviceConfiguration\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport kotlinx.coroutines.ExperimentalCoroutinesApi\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertFalse\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n@OptIn(ExperimentalCoroutinesApi::class)\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.M])\nclass EvaluateAppUseCaseBehaviourTest {\n\n    private lateinit var useCase: EvaluateAppUseCase\n    private lateinit var deviceConfiguration: DeviceConfiguration\n    private lateinit var repository: FakeRepository\n\n    private val installedApp = InstalledApplication(\n        name = \"Demo\",\n        packageName = \"com.demo.app\"\n    )\n\n    @Before\n    fun setup() {\n        repository = FakeRepository()\n        val roboContext = org.robolectric.RuntimeEnvironment.getApplication()\n        deviceConfiguration = DeviceConfiguration(roboContext)\n        useCase = EvaluateAppUseCase(repository, deviceConfiguration)\n    }\n\n    @Test\n    fun `invoke uploads, deletes old icons and adds evaluation`() = runTest {\n        repository.existingIcons = listOf(\n            iconAnswer(id = 10, url = \"old1\"),\n            iconAnswer(id = 11, url = \"old2\")\n        )\n        repository.uploadResponse = arrayListOf(iconAnswer(id = 99, url = \"new\"))\n\n        val result = useCase(installedApp, rating = 5)\n\n        assertTrue(repository.deletedIds.containsAll(listOf(10, 11)))\n        assertTrue(repository.addedEvaluations.isNotEmpty())\n        assertEquals(99, repository.addedEvaluations.first().icon)\n        assertEquals(5, repository.addedEvaluations.first().rating)\n        assertTrue(result.isSuccess)\n    }\n\n    @Test\n    fun `invoke returns failure when upload fails`() = runTest {\n        repository.existingIcons = emptyList()\n        repository.uploadResponse = null\n\n        val result = useCase(installedApp, rating = 2)\n\n        assertTrue(result.isFailure)\n        assertTrue(repository.addedEvaluations.isEmpty())\n        assertTrue(repository.deletedIds.isEmpty())\n    }\n\n    private fun iconAnswer(id: Int, url: String) = Icon(id = id, name = \"icon$id\", url = url)\n\n    private class FakeRepository : com.klee.sapio.domain.EvaluationRepository {\n        var existingIcons: List<Icon> = emptyList()\n        var uploadResponse: List<Icon>? = null\n        val deletedIds = mutableListOf<Int>()\n        val addedEvaluations = mutableListOf<UploadEvaluation>()\n\n        override suspend fun listLatestEvaluations(pageNumber: Int): Result<List<com.klee.sapio.domain.model.Evaluation>> =\n            Result.success(emptyList())\n        override suspend fun searchEvaluations(pattern: String): Result<List<com.klee.sapio.domain.model.Evaluation>> =\n            Result.success(emptyList())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation): Result<Unit> {\n            addedEvaluations.add(evaluation)\n            return Result.success(Unit)\n        }\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int): Result<Unit> = Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int): Result<com.klee.sapio.domain.model.Evaluation?> =\n            Result.success(null)\n        override suspend fun existingEvaluations(packageName: String): Result<List<com.klee.sapio.domain.model.EvaluationRecord>> =\n            Result.success(emptyList())\n        override suspend fun uploadIcon(packageName: String): Result<List<Icon>> =\n            Result.success(uploadResponse ?: emptyList())\n        override suspend fun existingIcon(iconName: String): Result<List<Icon>> =\n            Result.success(existingIcons)\n        override suspend fun deleteIcon(id: Int): Result<Unit> {\n            deletedIds.add(id)\n            return Result.success(Unit)\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/EvaluateAppUseCaseTest.kt",
    "content": "package com.klee.sapio\n\nimport android.os.Build\nimport com.klee.sapio.domain.EvaluateAppUseCase\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.ExperimentalCoroutinesApi\nimport kotlinx.coroutines.test.UnconfinedTestDispatcher\nimport kotlinx.coroutines.test.resetMain\nimport kotlinx.coroutines.test.runTest\nimport kotlinx.coroutines.test.setMain\nimport org.junit.After\nimport org.junit.Assert\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n@ExperimentalCoroutinesApi\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.M])\nclass EvaluateAppUseCaseTest {\n\n    private lateinit var evaluateAppUseCase: EvaluateAppUseCase\n    private lateinit var fakeRepository: FakeRepository\n    private lateinit var realInstalledApplication: InstalledApplication\n\n    private val testDispatcher = UnconfinedTestDispatcher()\n\n    @Before\n    fun setUp() {\n        Dispatchers.setMain(testDispatcher)\n\n        val roboContext = org.robolectric.RuntimeEnvironment.getApplication()\n        val deviceConfiguration = com.klee.sapio.data.system.DeviceConfiguration(roboContext)\n\n        fakeRepository = FakeRepository()\n        evaluateAppUseCase = EvaluateAppUseCase(fakeRepository, deviceConfiguration)\n\n        realInstalledApplication = InstalledApplication(\n            name = \"Test App\",\n            packageName = \"com.test.app\"\n        )\n\n        fakeRepository.addEvaluationResult = Result.success(Unit)\n    }\n\n    @After\n    fun tearDown() {\n        Dispatchers.resetMain()\n    }\n\n    @Test\n    fun test_evaluateApp_withFailedIconUpload() = runTest {\n        fakeRepository.uploadIconResult = Result.success(emptyList())\n        fakeRepository.existingIconsResult = Result.success(emptyList())\n\n        val result = evaluateAppUseCase(realInstalledApplication, 1)\n\n        Assert.assertTrue(\"Should return failure\", result.isFailure)\n    }\n\n    @Test\n    fun test_evaluateApp_withSuccessfulIconUpload() = runTest {\n        val fakeIcon = Icon(id = 123, name = \"test.png\", url = \"http://example.com/test.png\")\n        fakeRepository.uploadIconResult = Result.success(listOf(fakeIcon))\n        fakeRepository.existingIconsResult = Result.success(emptyList())\n\n        val result = evaluateAppUseCase(realInstalledApplication, 1)\n\n        Assert.assertTrue(\"Should return success\", result.isSuccess)\n    }\n\n    private class FakeRepository : com.klee.sapio.domain.EvaluationRepository {\n        var uploadIconResult: Result<List<Icon>> = Result.success(emptyList())\n        var existingIconsResult: Result<List<Icon>> = Result.success(emptyList())\n        var addEvaluationResult: Result<Unit> = Result.success(Unit)\n\n        override suspend fun listLatestEvaluations(pageNumber: Int): Result<List<Evaluation>> =\n            Result.success(emptyList())\n        override suspend fun searchEvaluations(pattern: String): Result<List<Evaluation>> =\n            Result.success(emptyList())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation): Result<Unit> =\n            addEvaluationResult\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int): Result<Unit> =\n            Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int): Result<Evaluation?> =\n            Result.success(null)\n        override suspend fun existingEvaluations(packageName: String): Result<List<EvaluationRecord>> =\n            Result.success(emptyList())\n        override suspend fun uploadIcon(packageName: String): Result<List<Icon>> =\n            uploadIconResult\n        override suspend fun existingIcon(iconName: String): Result<List<Icon>> =\n            existingIconsResult\n        override suspend fun deleteIcon(id: Int): Result<Unit> = Result.success(Unit)\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/EvaluateViewModelTest.kt",
    "content": "package com.klee.sapio\n\nimport android.os.Build\nimport androidx.arch.core.executor.testing.InstantTaskExecutorRule\nimport com.klee.sapio.data.system.DeviceConfiguration\nimport com.klee.sapio.domain.model.GmsType\nimport com.klee.sapio.domain.model.UserType\nimport com.klee.sapio.ui.viewmodel.EvaluateViewModel\nimport org.junit.Assert.assertEquals\nimport org.junit.Rule\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.RuntimeEnvironment\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.M])\nclass EvaluateViewModelTest {\n\n    @get:Rule\n    val instantTaskExecutorRule = InstantTaskExecutorRule()\n\n    private val appContext = RuntimeEnvironment.getApplication()\n\n    @Test\n    fun `uiState initializes with device gmsType and userType`() {\n        val vm = buildViewModel(gmsType = GmsType.MICROG, userType = UserType.SECURE)\n\n        assertEquals(GmsType.MICROG, vm.uiState.value.gmsType)\n        assertEquals(UserType.SECURE, vm.uiState.value.userType)\n    }\n\n    private fun buildViewModel(gmsType: Int = GmsType.BARE_AOSP, userType: Int = UserType.SECURE): EvaluateViewModel {\n        val fakeDeviceConfig = object : DeviceConfiguration(appContext) {\n            override fun getGmsType() = gmsType\n            override fun isUnsafe() = userType\n        }\n        return EvaluateViewModel(fakeDeviceConfig)\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/EvaluationServiceTest.kt",
    "content": "package com.klee.sapio\n\nimport android.app.Application\nimport android.content.pm.ApplicationInfo\nimport android.content.pm.PackageInfo\nimport android.os.Build\nimport androidx.test.core.app.ApplicationProvider\nimport com.klee.sapio.data.api.EvaluationApi\nimport com.klee.sapio.data.api.EvaluationService\nimport com.klee.sapio.data.system.Settings\nimport org.robolectric.Shadows\nimport com.klee.sapio.data.dto.Evaluation\nimport com.klee.sapio.data.dto.IconAnswer\nimport com.klee.sapio.data.dto.StrapiAnswer\nimport com.klee.sapio.data.dto.StrapiElement\nimport com.klee.sapio.data.dto.StrapiMeta\nimport com.klee.sapio.data.dto.UploadAnswer\nimport com.klee.sapio.data.dto.UploadEvaluation\nimport com.klee.sapio.data.dto.UploadEvaluationHeader\nimport kotlinx.coroutines.runBlocking\nimport okhttp3.MediaType.Companion.toMediaTypeOrNull\nimport okhttp3.ResponseBody.Companion.toResponseBody\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertNull\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.mockito.ArgumentMatchers.any\nimport org.mockito.ArgumentMatchers.anyInt\nimport org.mockito.ArgumentMatchers.anyString\nimport org.mockito.Mock\nimport org.mockito.Mockito\nimport org.mockito.MockitoAnnotations\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\nimport retrofit2.HttpException\nimport retrofit2.Response\nimport java.io.IOException\nimport java.util.Date\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.P])\nclass EvaluationServiceTest {\n\n    @Mock\n    private lateinit var mockSettings: Settings\n\n    private lateinit var service: EvaluationService\n\n    @Before\n    fun setUp() {\n        MockitoAnnotations.openMocks(this)\n        val context = ApplicationProvider.getApplicationContext<Application>()\n        Shadows.shadowOf(context.packageManager).installPackage(\n            PackageInfo().apply {\n                packageName = \"android\"\n                applicationInfo = ApplicationInfo().apply { packageName = \"android\" }\n            }\n        )\n        service = EvaluationService(context)\n        setField(\"settings\", mockSettings)\n    }\n\n    @Test\n    fun listLatestEvaluations_returnsEmptyOnHttpException() = runBlocking {\n        val errorBody = \"error\".toResponseBody(\"text/plain\".toMediaTypeOrNull())\n        Mockito.`when`(mockSettings.getUnsafeConfigurationLevel()).thenReturn(0)\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun listLatestEvaluationsAsync(root: Int, pageNumber: Int): StrapiAnswer {\n                throw HttpException(Response.error<StrapiAnswer>(500, errorBody))\n            }\n        }\n        setApi(api)\n\n        val result = service.listLatestEvaluations(pageNumber = 1)\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun listLatestEvaluations_happyPathSorted() = runBlocking {\n        Mockito.`when`(mockSettings.getUnsafeConfigurationLevel()).thenReturn(1)\n        val evalNewer = StrapiElement(1, createEvaluation(\"AppOne\", \"pkg1\", updatedAtOffset = 2))\n        val evalOlder = StrapiElement(2, createEvaluation(\"AppTwo\", \"pkg1\", updatedAtOffset = 1))\n        val answer = StrapiAnswer(arrayListOf(evalOlder, evalNewer), StrapiMeta(null))\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun listLatestEvaluationsAsync(root: Int, pageNumber: Int): StrapiAnswer = answer\n        }\n        setApi(api)\n\n        val result = service.listLatestEvaluations(pageNumber = 0).getOrThrow()\n        assertEquals(2, result.size)\n        assertEquals(\"AppOne\", result.first().name)\n        assertEquals(\"AppTwo\", result.last().name)\n    }\n\n    @Test\n    fun listLatestEvaluations_sortsByUpdatedAtAcrossPackages() = runBlocking {\n        Mockito.`when`(mockSettings.getUnsafeConfigurationLevel()).thenReturn(1)\n        val older = StrapiElement(1, createEvaluation(\"Old\", \"pkg.old\", updatedAtOffset = 1))\n        val newer = StrapiElement(2, createEvaluation(\"New\", \"pkg.new\", updatedAtOffset = 5))\n        val answer = StrapiAnswer(arrayListOf(older, newer), StrapiMeta(null))\n        setApi(object : EvaluationApi by failingApi() {\n            override suspend fun listLatestEvaluationsAsync(root: Int, pageNumber: Int): StrapiAnswer = answer\n        })\n\n        val result = service.listLatestEvaluations(pageNumber = 0).getOrThrow()\n        assertEquals(listOf(\"pkg.new\", \"pkg.old\"), result.map { it.packageName })\n    }\n\n    @Test\n    fun listLatestEvaluations_respectsPageNumberParameter() = runBlocking {\n        Mockito.`when`(mockSettings.getUnsafeConfigurationLevel()).thenReturn(1)\n        val page1 = StrapiAnswer(arrayListOf(StrapiElement(1, createEvaluation(\"P1\", \"p1\"))), StrapiMeta(null))\n        val page2 = StrapiAnswer(arrayListOf(StrapiElement(2, createEvaluation(\"P2\", \"p2\"))), StrapiMeta(null))\n\n        setApi(object : EvaluationApi by failingApi() {\n            override suspend fun listLatestEvaluationsAsync(root: Int, pageNumber: Int): StrapiAnswer =\n                if (pageNumber == 2) page2 else page1\n        })\n\n        val first = service.listLatestEvaluations(pageNumber = 1).getOrThrow()\n        val second = service.listLatestEvaluations(pageNumber = 2).getOrThrow()\n\n        assertEquals(\"p1\", first.first().packageName)\n        assertEquals(\"p2\", second.first().packageName)\n    }\n\n    @Test\n    fun searchEvaluation_returnsEmptyOnIOException() = runBlocking {\n        Mockito.`when`(mockSettings.getUnsafeConfigurationLevel()).thenReturn(0)\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun searchAsync(name: String, packageName: String, rooted: Int): StrapiAnswer {\n                throw IOException(\"boom\")\n            }\n        }\n        setApi(api)\n\n        val result = service.searchEvaluation(\"pattern\")\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun searchEvaluation_happyPathDistinctByPackage() = runBlocking {\n        Mockito.`when`(mockSettings.getUnsafeConfigurationLevel()).thenReturn(0)\n        val evalA = StrapiElement(1, createEvaluation(\"A\", \"pkgA\"))\n        val evalADuplicate = StrapiElement(2, createEvaluation(\"A2\", \"pkgA\"))\n        val answer = StrapiAnswer(arrayListOf(evalA, evalADuplicate), StrapiMeta(null))\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun searchAsync(name: String, packageName: String, rooted: Int): StrapiAnswer = answer\n        }\n        setApi(api)\n\n        val result = service.searchEvaluation(\"a\").getOrThrow()\n        assertEquals(1, result.size)\n        assertEquals(\"pkgA\", result.first().packageName)\n        assertEquals(\"A\", result.first().name)\n    }\n\n    @Test\n    fun fetchEvaluation_returnsNullWhenNoData() = runBlocking {\n        val answer = StrapiAnswer(arrayListOf(), StrapiMeta(null))\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun getSingleEvaluationAsync(packageName: String, microG: Int, rooted: Int): StrapiAnswer = answer\n        }\n        setApi(api)\n\n        val result = service.fetchEvaluation(\"pkg\", microG = 0, rooted = 0).getOrThrow()\n        assertNull(result)\n    }\n\n    @Test\n    fun existingEvaluations_returnsList() = runBlocking {\n        val eval = StrapiElement(10, createEvaluation(\"B\", \"pkgB\"))\n        val answer = StrapiAnswer(arrayListOf(eval), StrapiMeta(null))\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun existingEvaluationsAsync(packageName: String): StrapiAnswer = answer\n        }\n        setApi(api)\n\n        val result = service.existingEvaluations(\"pkgB\").getOrThrow()\n        assertEquals(1, result.size)\n        assertEquals(10, result.first().id)\n        assertEquals(\"pkgB\", result.first().attributes.packageName)\n    }\n\n    @Test\n    fun existingIcon_returnsNullOnIOException() = runBlocking {\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun existingIconAsync(iconName: String): List<IconAnswer> {\n                throw IOException(\"fail\")\n            }\n        }\n        setApi(api)\n\n        val result = service.existingIcon(\"icon.png\")\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun existingIcon_returnsListOnSuccess() = runBlocking {\n        val answer = emptyList<IconAnswer>()\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun existingIconAsync(iconName: String): List<IconAnswer> = answer\n        }\n        setApi(api)\n\n        val result = service.existingIcon(\"icon.png\").getOrThrow()\n        assertTrue(result.isEmpty())\n    }\n\n    @Test\n    fun fetchEvaluation_returnsFirstElement() = runBlocking {\n        val eval = StrapiElement(5, createEvaluation(\"PkgEval\", \"pkg.eval\"))\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun getSingleEvaluationAsync(packageName: String, microG: Int, rooted: Int): StrapiAnswer =\n                StrapiAnswer(arrayListOf(eval), StrapiMeta(null))\n        }\n        setApi(api)\n\n        val result = service.fetchEvaluation(\"pkg.eval\", 0, 0).getOrThrow()\n        assertEquals(\"pkg.eval\", result?.packageName)\n    }\n\n    @Test\n    fun addEvaluation_returnsNullOnIOException() = runBlocking {\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun addEvaluation(evaluation: UploadEvaluationHeader): UploadAnswer {\n                throw IOException(\"add failed\")\n            }\n        }\n        setApi(api)\n\n        val result = service.addEvaluation(UploadEvaluationHeader(UploadEvaluation(\"a\", \"p\", 1, 1, 0, 0)))\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun addEvaluation_returnsResponseOnSuccess() = runBlocking {\n        val response = UploadAnswer(\n            StrapiElement(1, createEvaluation(\"Success\", \"pkg.s\")),\n            StrapiMeta(null)\n        )\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun addEvaluation(evaluation: UploadEvaluationHeader): UploadAnswer = response\n        }\n        setApi(api)\n\n        val result = service.addEvaluation(UploadEvaluationHeader(UploadEvaluation(\"a\", \"p\", 1, 1, 0, 0)))\n        assertTrue(result.isSuccess)\n    }\n\n    @Test\n    fun updateEvaluation_returnsNullOnIOException() = runBlocking {\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun updateEvaluation(evaluation: UploadEvaluationHeader, id: Int): UploadAnswer {\n                throw IOException(\"update failed\")\n            }\n        }\n        setApi(api)\n\n        val result = service.updateEvaluation(UploadEvaluationHeader(UploadEvaluation(\"a\", \"p\", 1, 1, 0, 0)), 1)\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun updateEvaluation_returnsResponseOnSuccess() = runBlocking {\n        val response = UploadAnswer(\n            StrapiElement(2, createEvaluation(\"Updated\", \"pkg.u\")),\n            StrapiMeta(null)\n        )\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun updateEvaluation(evaluation: UploadEvaluationHeader, id: Int): UploadAnswer = response\n        }\n        setApi(api)\n\n        val result = service.updateEvaluation(UploadEvaluationHeader(UploadEvaluation(\"a\", \"p\", 1, 1, 0, 0)), 2)\n        assertTrue(result.isSuccess)\n    }\n\n    @Test\n    fun uploadIcon_returnsResponseOnSuccess() = runBlocking {\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun addIcon(image: okhttp3.MultipartBody.Part): ArrayList<IconAnswer> =\n                arrayListOf(createIconAnswer())\n        }\n        setApi(api)\n\n        val result = service.uploadIcon(\"android\")\n        assertEquals(1, result.getOrThrow().size)\n    }\n\n    @Test\n    fun deleteIcon_returnsResponseOnSuccess() = runBlocking {\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun deleteIcon(id: Int): IconAnswer = createIconAnswer()\n        }\n        setApi(api)\n\n        val result = service.deleteIcon(99)\n        assertTrue(result.isSuccess)\n    }\n\n    @Test\n    fun uploadIcon_returnsNullOnIOException() = runBlocking {\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun addIcon(image: okhttp3.MultipartBody.Part): ArrayList<IconAnswer> {\n                throw IOException(\"net down\")\n            }\n        }\n        setApi(api)\n\n        val result = service.uploadIcon(\"android\")\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun deleteIcon_returnsNullOnIOException() = runBlocking {\n        val api = object : EvaluationApi by failingApi() {\n            override suspend fun deleteIcon(id: Int): IconAnswer {\n                throw IOException(\"delete failed\")\n            }\n        }\n        setApi(api)\n\n        val result = service.deleteIcon(123)\n        assertTrue(result.isFailure)\n    }\n\n    private fun setField(name: String, value: Any) {\n        org.robolectric.util.ReflectionHelpers.setField(service, name, value)\n    }\n\n    private fun setApi(api: EvaluationApi) {\n        setField(\"evaluationsApi\", api)\n    }\n\n    private fun failingApi(): EvaluationApi = object : EvaluationApi {\n        override suspend fun listLatestEvaluationsAsync(root: Int, pageNumber: Int) =\n            throw NotImplementedError()\n        override suspend fun searchAsync(name: String, packageName: String, rooted: Int) =\n            throw NotImplementedError()\n        override suspend fun existingEvaluationsAsync(packageName: String) = throw NotImplementedError()\n        override suspend fun addEvaluation(evaluation: UploadEvaluationHeader) = throw NotImplementedError()\n        override suspend fun updateEvaluation(evaluation: UploadEvaluationHeader, id: Int) = throw NotImplementedError()\n        override suspend fun addIcon(image: okhttp3.MultipartBody.Part) = throw NotImplementedError()\n        override suspend fun existingIconAsync(iconName: String) = throw NotImplementedError()\n        override suspend fun deleteIcon(id: Int) = throw NotImplementedError()\n        override suspend fun getSingleEvaluationAsync(packageName: String, microG: Int, rooted: Int) =\n            throw NotImplementedError()\n    }\n\n    private fun createEvaluation(\n        name: String,\n        packageName: String,\n        updatedAtOffset: Long = 0\n    ): Evaluation {\n        val date = Date(System.currentTimeMillis() + updatedAtOffset)\n        return Evaluation(\n            name = name,\n            packageName = packageName,\n            icon = null,\n            rating = 1,\n            microg = 0,\n            secure = 0,\n            updatedAt = date,\n            createdAt = date,\n            publishedAt = date,\n            versionName = \"1.0\"\n        )\n    }\n\n    private fun createIconAnswer(): IconAnswer {\n        val now = Date()\n        return IconAnswer(\n            id = 1,\n            name = \"icon\",\n            alternativeText = null,\n            caption = null,\n            width = 10,\n            height = 10,\n            formats = null,\n            hash = \"hash\",\n            ext = \".png\",\n            mime = \"image/png\",\n            size = 1,\n            url = \"http://localhost/icon.png\",\n            previewUrl = null,\n            provider = null,\n            provider_metadata = null,\n            createdAt = now,\n            updatedAt = now\n        )\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/FeedViewModelTest.kt",
    "content": "package com.klee.sapio\n\nimport android.os.Build\nimport androidx.arch.core.executor.testing.InstantTaskExecutorRule\nimport com.klee.sapio.domain.ListLatestEvaluationsUseCase\nimport com.klee.sapio.domain.EvaluationRepository\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport com.klee.sapio.ui.viewmodel.FeedViewModel\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.ExperimentalCoroutinesApi\nimport kotlinx.coroutines.test.StandardTestDispatcher\nimport kotlinx.coroutines.test.advanceUntilIdle\nimport kotlinx.coroutines.test.resetMain\nimport kotlinx.coroutines.test.runTest\nimport kotlinx.coroutines.test.setMain\nimport org.junit.After\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertFalse\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Rule\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n@OptIn(ExperimentalCoroutinesApi::class)\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.M])\nclass FeedViewModelTest {\n\n    @get:Rule\n    val instantTaskExecutorRule = InstantTaskExecutorRule()\n\n    private val dispatcher = StandardTestDispatcher()\n\n    @Before\n    fun setUp() {\n        Dispatchers.setMain(dispatcher)\n    }\n\n    @After\n    fun tearDown() {\n        Dispatchers.resetMain()\n    }\n\n    @Test\n    fun `refresh loads only page 1 on startup`() = runTest(dispatcher) {\n        val pagesRequested = mutableListOf<Int>()\n        val vm = FeedViewModel(useCaseReturningOnePage(pagesRequested))\n        advanceUntilIdle()\n\n        assertEquals(listOf(1), pagesRequested)\n        assertEquals(1, vm.uiState.value.items.size)\n        assertEquals(\"page-1\", vm.uiState.value.items.first().name)\n    }\n\n    @Test\n    fun `loadNextPage appends the next page`() = runTest(dispatcher) {\n        val pagesRequested = mutableListOf<Int>()\n        val vm = FeedViewModel(useCaseReturningOnePage(pagesRequested))\n        advanceUntilIdle()\n\n        vm.loadNextPage()\n        advanceUntilIdle()\n\n        assertEquals(listOf(1, 2), pagesRequested)\n        assertEquals(2, vm.uiState.value.items.size)\n        assertEquals(\"page-1\", vm.uiState.value.items[0].name)\n        assertEquals(\"page-2\", vm.uiState.value.items[1].name)\n    }\n\n    @Test\n    fun `loadNextPage is ignored while initial load is in progress`() = runTest(dispatcher) {\n        val pagesRequested = mutableListOf<Int>()\n        val vm = FeedViewModel(useCaseReturningOnePage(pagesRequested))\n\n        // initial load is enqueued but hasn't run yet (isLoading = true from initial state)\n        vm.loadNextPage()\n        advanceUntilIdle()\n\n        // only page 1 should have been fetched\n        assertEquals(listOf(1), pagesRequested)\n    }\n\n    @Test\n    fun `loadNextPage stops when an empty page is returned`() = runTest(dispatcher) {\n        val pagesRequested = mutableListOf<Int>()\n        val vm = FeedViewModel(useCaseReturningEmptyAfter(page = 1, pagesRequested))\n        advanceUntilIdle()\n\n        vm.loadNextPage() // page 2 returns empty — hasMorePages becomes false\n        advanceUntilIdle()\n\n        vm.loadNextPage() // should be no-ops from here\n        vm.loadNextPage()\n        advanceUntilIdle()\n\n        assertEquals(listOf(1, 2), pagesRequested)\n    }\n\n    @Test\n    fun `refresh resets and reloads from page 1`() = runTest(dispatcher) {\n        val pagesRequested = mutableListOf<Int>()\n        val vm = FeedViewModel(useCaseReturningOnePage(pagesRequested))\n        advanceUntilIdle()\n\n        vm.loadNextPage()\n        advanceUntilIdle()\n\n        vm.refresh()\n        advanceUntilIdle()\n\n        assertEquals(listOf(1, 2, 1), pagesRequested)\n        assertEquals(1, vm.uiState.value.items.size)\n        assertEquals(\"page-1\", vm.uiState.value.items.first().name)\n    }\n\n    @Test\n    fun `error during load sets hasError in state`() = runTest(dispatcher) {\n        val vm = FeedViewModel(useCaseAlwaysFailing())\n        advanceUntilIdle()\n\n        assertTrue(vm.uiState.value.hasError)\n        assertFalse(vm.uiState.value.isLoading)\n    }\n\n    // --- helpers ---\n\n    private fun useCaseReturningOnePage(tracker: MutableList<Int>): ListLatestEvaluationsUseCase {\n        return object : ListLatestEvaluationsUseCase(emptyRepository()) {\n            override suspend fun invoke(pageNumber: Int): Result<List<Evaluation>> {\n                tracker.add(pageNumber)\n                return Result.success(listOf(eval(\"page-$pageNumber\", pageNumber)))\n            }\n        }\n    }\n\n    private fun useCaseReturningEmptyAfter(\n        page: Int,\n        tracker: MutableList<Int>\n    ): ListLatestEvaluationsUseCase {\n        return object : ListLatestEvaluationsUseCase(emptyRepository()) {\n            override suspend fun invoke(pageNumber: Int): Result<List<Evaluation>> {\n                tracker.add(pageNumber)\n                return if (pageNumber <= page) {\n                    Result.success(listOf(eval(\"page-$pageNumber\", pageNumber)))\n                } else {\n                    Result.success(emptyList())\n                }\n            }\n        }\n    }\n\n    private fun useCaseAlwaysFailing(): ListLatestEvaluationsUseCase {\n        return object : ListLatestEvaluationsUseCase(emptyRepository()) {\n            override suspend fun invoke(pageNumber: Int): Result<List<Evaluation>> {\n                return Result.failure(RuntimeException(\"network error\"))\n            }\n        }\n    }\n\n    private fun emptyRepository(): EvaluationRepository = object : EvaluationRepository {\n        override suspend fun listLatestEvaluations(pageNumber: Int): Result<List<Evaluation>> = Result.success(emptyList())\n        override suspend fun searchEvaluations(pattern: String): Result<List<Evaluation>> = Result.success(emptyList())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation): Result<Unit> = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int): Result<Unit> = Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int): Result<Evaluation?> = Result.success(null)\n        override suspend fun existingEvaluations(packageName: String): Result<List<EvaluationRecord>> = Result.success(emptyList())\n        override suspend fun uploadIcon(packageName: String): Result<List<Icon>> = Result.success(emptyList())\n        override suspend fun existingIcon(iconName: String): Result<List<Icon>> = Result.success(emptyList())\n        override suspend fun deleteIcon(id: Int): Result<Unit> = Result.success(Unit)\n    }\n\n    private fun eval(name: String, rating: Int) = Evaluation(\n        name = name,\n        packageName = \"pkg$rating\",\n        iconUrl = null,\n        rating = rating,\n        microg = 1,\n        secure = 1,\n        updatedAt = null,\n        createdAt = null,\n        publishedAt = null,\n        versionName = null\n    )\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/InstalledApplicationsRepositoryTest.kt",
    "content": "package com.klee.sapio\n\nimport android.content.Context\nimport android.content.Intent\nimport android.content.pm.ActivityInfo\nimport android.content.pm.ApplicationInfo\nimport android.content.pm.PackageManager\nimport android.content.pm.ResolveInfo\nimport android.graphics.drawable.Drawable\nimport android.os.Build\nimport com.klee.sapio.data.repository.InstalledApplicationsRepository\nimport junit.framework.TestCase.assertEquals\nimport org.junit.Assert\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.mockito.ArgumentMatchers.any\nimport org.mockito.ArgumentMatchers.anyInt\nimport org.mockito.ArgumentMatchers.anyString\nimport org.mockito.ArgumentMatchers.eq\nimport org.mockito.Mock\nimport org.mockito.Mockito\nimport org.mockito.MockitoAnnotations\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n/**\n * Example local unit test, which will execute on the development machine (host).\n *\n * See [testing documentation](http://d.android.com/tools/testing).\n */\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.N])\nclass InstalledApplicationsRepositoryTest {\n\n    private lateinit var repository: InstalledApplicationsRepository\n\n    @Mock\n    private lateinit var mockedPackageManager: PackageManager\n\n    @Mock\n    private lateinit var mockedContext: Context\n\n    @Mock\n    private lateinit var mockedDrawable: Drawable\n\n    private lateinit var fakeRegularApplicationInfo: ApplicationInfo\n    private lateinit var fakeSystemApplicationInfo: ApplicationInfo\n    private lateinit var fakeGmsApp: ApplicationInfo\n\n    private var fakeListApplicationInfo: List<ApplicationInfo>? = null\n\n    @Before\n    fun setUp() {\n\n        MockitoAnnotations.openMocks(this)\n\n        repository = InstalledApplicationsRepository(mockedContext)\n\n        fakeRegularApplicationInfo = ApplicationInfo().apply {\n            packageName = \"fake.package.name.one\"\n            name = \"FakeApplicationOne\"\n        }\n\n        fakeSystemApplicationInfo = ApplicationInfo().apply {\n            packageName = \"fake.package.name.one\"\n            name = \"FakeApplicationTwo\"\n            flags = ApplicationInfo.FLAG_SYSTEM\n        }\n\n        fakeGmsApp = ApplicationInfo().apply {\n            packageName = \"fake.package.gms\"\n            name = \"FakeApplicationThree\"\n        }\n\n        fakeListApplicationInfo = mutableListOf(\n            fakeRegularApplicationInfo,\n            fakeSystemApplicationInfo,\n            fakeGmsApp\n        )\n\n        Mockito.`when`(mockedContext.packageManager).thenReturn(mockedPackageManager)\n        Mockito.`when`(mockedPackageManager.queryIntentActivities(any(Intent::class.java), eq(0)))\n            .thenReturn(fakeListApplicationInfo!!.map { makeResolveInfo(it) })\n\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(fakeRegularApplicationInfo)))\n            .thenReturn(\"FakeApplicationOne\")\n\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(fakeSystemApplicationInfo)))\n            .thenReturn(\"FakeApplicationTwo\")\n\n        Mockito.`when`(mockedPackageManager.getDrawable(anyString(), anyInt(), any()))\n            .thenReturn(mockedDrawable)\n    }\n\n    private fun makeResolveInfo(appInfo: ApplicationInfo): ResolveInfo {\n        val activityInfo = ActivityInfo().apply { applicationInfo = appInfo }\n        return ResolveInfo().apply { this.activityInfo = activityInfo }\n    }\n\n    @Test\n    fun test_isSystemAppWithRegularApp() {\n        Assert.assertEquals(\n            \"App status error\",\n            false,\n            repository.isSystemApp(fakeRegularApplicationInfo)\n        )\n    }\n\n    @Test\n    fun test_isSystemAppWithSystemApp() {\n        Assert.assertEquals(\n            \"App status error\",\n            true,\n            repository.isSystemApp(fakeSystemApplicationInfo)\n        )\n    }\n\n    @Test\n    fun test_isGmsWithRegularApp() {\n        Assert.assertEquals(\n            \"App status error\",\n            false,\n            repository.isGmsRelated(fakeRegularApplicationInfo)\n        )\n    }\n\n    @Test\n    fun test_isGmsWithGmsApp() {\n        Assert.assertEquals(\n            \"App status error\",\n            true,\n            repository.isGmsRelated(fakeGmsApp)\n        )\n    }\n\n    @Test\n    fun test_isGmsWithPlayStoreApp() {\n        val playStoreApp = ApplicationInfo().apply {\n            packageName = \"com.android.vending\"\n            name = \"PlayStore\"\n        }\n\n        Assert.assertTrue(\"Play Store should be treated as GMS\", repository.isGmsRelated(playStoreApp))\n    }\n\n    @Test\n    fun test_listApplicationCheckListSize() {\n        val list = repository.listInstalledApplications()\n        assertEquals(\"Wrong list size.\", 1, list.size)\n    }\n\n    @Test\n    fun test_listApplicationCheckElement() {\n        val list = repository.listInstalledApplications()\n        assertEquals(\n            \"Package name are not the same.\",\n            fakeRegularApplicationInfo.packageName,\n            list[0].packageName)\n    }\n\n    @Test\n    fun test_getApplicationFromPackageName_found() {\n        val result = repository.getInstalledApplication(fakeRegularApplicationInfo.packageName)\n        Assert.assertNotNull(\"Should find the application\", result)\n        Assert.assertEquals(\"Package names should match\", fakeRegularApplicationInfo.packageName, result?.packageName)\n    }\n\n    @Test\n    fun test_getApplicationFromPackageName_notFound() {\n        val result = repository.getInstalledApplication(\"non.existent.package\")\n        Assert.assertNull(\"Should return null for non-existent package\", result)\n    }\n\n    @Test\n    fun test_getAppList_sorting() {\n        val fakeAppZ = ApplicationInfo().apply {\n            packageName = \"fake.package.name.z\"\n            name = \"ZebraApp\"\n        }\n\n        val appsWithZ = mutableListOf(\n            fakeRegularApplicationInfo,\n            fakeSystemApplicationInfo,\n            fakeGmsApp,\n            fakeAppZ\n        )\n\n        Mockito.`when`(mockedPackageManager.queryIntentActivities(any(Intent::class.java), eq(0)))\n            .thenReturn(appsWithZ.map { makeResolveInfo(it) })\n\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(fakeRegularApplicationInfo)))\n            .thenReturn(\"FakeApplicationOne\")\n\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(fakeAppZ)))\n            .thenReturn(\"ZebraApp\")\n\n        val list = repository.listInstalledApplications()\n\n        Assert.assertEquals(\"Should have 2 apps\", 2, list.size)\n        Assert.assertEquals(\"First app should be FakeApplicationOne\", \"fakeapplicationone\", list[0].name.lowercase())\n        Assert.assertEquals(\"Second app should be ZebraApp\", \"zebraapp\", list[1].name.lowercase())\n    }\n\n    @Test\n    fun test_getAppList_emptyListWhenNoApps() {\n        Mockito.`when`(mockedPackageManager.queryIntentActivities(any(Intent::class.java), eq(0)))\n            .thenReturn(emptyList())\n\n        val list = repository.listInstalledApplications()\n\n        Assert.assertTrue(\"List should be empty when no apps are installed\", list.isEmpty())\n    }\n\n    @Test\n    fun test_getAppList_filtersSystemAndGmsApps() {\n        fakeSystemApplicationInfo.flags = ApplicationInfo.FLAG_SYSTEM\n        fakeGmsApp.packageName = \"com.google.gms\"\n\n        Mockito.`when`(mockedPackageManager.queryIntentActivities(any(Intent::class.java), eq(0)))\n            .thenReturn(listOf(fakeRegularApplicationInfo, fakeSystemApplicationInfo, fakeGmsApp).map { makeResolveInfo(it) })\n\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(fakeRegularApplicationInfo)))\n            .thenReturn(\"FakeApplicationOne\")\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(fakeSystemApplicationInfo)))\n            .thenReturn(\"SystemApp\")\n        Mockito.`when`(mockedPackageManager.getApplicationLabel(eq(fakeGmsApp)))\n            .thenReturn(\"GmsApp\")\n\n        val list = repository.listInstalledApplications()\n\n        Assert.assertEquals(1, list.size)\n        Assert.assertEquals(fakeRegularApplicationInfo.packageName, list.first().packageName)\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/LoadingViewModelTest.kt",
    "content": "package com.klee.sapio\n\nimport android.os.Build\nimport androidx.arch.core.executor.testing.InstantTaskExecutorRule\nimport com.klee.sapio.data.system.DeviceConfiguration\nimport com.klee.sapio.domain.EvaluateAppUseCase\nimport com.klee.sapio.domain.InstalledApplicationsDataSource\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.ui.state.EvaluateEvent\nimport com.klee.sapio.ui.viewmodel.LoadingViewModel\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.ExperimentalCoroutinesApi\nimport kotlinx.coroutines.launch\nimport kotlinx.coroutines.test.StandardTestDispatcher\nimport kotlinx.coroutines.test.UnconfinedTestDispatcher\nimport kotlinx.coroutines.test.advanceUntilIdle\nimport kotlinx.coroutines.test.resetMain\nimport kotlinx.coroutines.test.runTest\nimport kotlinx.coroutines.test.setMain\nimport org.junit.After\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Rule\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.RuntimeEnvironment\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n@OptIn(ExperimentalCoroutinesApi::class)\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.M])\nclass LoadingViewModelTest {\n\n    @get:Rule\n    val instantTaskExecutorRule = InstantTaskExecutorRule()\n\n    private val dispatcher = StandardTestDispatcher()\n    private val appContext = RuntimeEnvironment.getApplication()\n\n    private val fakeApp = InstalledApplication(\n        name = \"Test App\",\n        packageName = \"com.test.app\"\n    )\n\n    @Before\n    fun setUp() {\n        Dispatchers.setMain(dispatcher)\n    }\n\n    @After\n    fun tearDown() {\n        Dispatchers.resetMain()\n    }\n\n    @Test\n    fun `submit emits NavigateToSuccess on success`() = runTest(dispatcher) {\n        val vm = buildViewModel(app = fakeApp, useCaseResult = Result.success(Unit))\n\n        val events = mutableListOf<EvaluateEvent>()\n        val job = launch(UnconfinedTestDispatcher(testScheduler)) {\n            vm.events.collect { events.add(it) }\n        }\n\n        vm.submit(\"com.test.app\", \"Test App\", rating = 1)\n        advanceUntilIdle()\n\n        val event = events.first()\n        assertTrue(event is EvaluateEvent.NavigateToSuccess)\n        assertEquals(\"com.test.app\", (event as EvaluateEvent.NavigateToSuccess).packageName)\n        assertEquals(\"Test App\", event.appName)\n        job.cancel()\n    }\n\n    @Test\n    fun `submit emits ShowError on failure`() = runTest(dispatcher) {\n        val vm = buildViewModel(\n            app = fakeApp,\n            useCaseResult = Result.failure(IllegalStateException(\"error\"))\n        )\n\n        val events = mutableListOf<EvaluateEvent>()\n        val job = launch(UnconfinedTestDispatcher(testScheduler)) {\n            vm.events.collect { events.add(it) }\n        }\n\n        vm.submit(\"com.test.app\", \"Test App\", rating = 1)\n        advanceUntilIdle()\n\n        assertTrue(events.first() is EvaluateEvent.ShowError)\n        job.cancel()\n    }\n\n    @Test\n    fun `submit emits ShowError when app not found`() = runTest(dispatcher) {\n        val vm = buildViewModel(app = null, useCaseResult = Result.success(Unit))\n\n        val events = mutableListOf<EvaluateEvent>()\n        val job = launch(UnconfinedTestDispatcher(testScheduler)) {\n            vm.events.collect { events.add(it) }\n        }\n\n        vm.submit(\"com.unknown.app\", \"Unknown\", rating = 1)\n        advanceUntilIdle()\n\n        assertTrue(events.first() is EvaluateEvent.ShowError)\n        job.cancel()\n    }\n\n    private fun buildViewModel(\n        app: InstalledApplication? = fakeApp,\n        useCaseResult: Result<Unit> = Result.success(Unit)\n    ): LoadingViewModel {\n        val fakeRepo = object : com.klee.sapio.domain.EvaluationRepository {\n            override suspend fun listLatestEvaluations(pageNumber: Int) = Result.success(emptyList<com.klee.sapio.domain.model.Evaluation>())\n            override suspend fun searchEvaluations(pattern: String) = Result.success(emptyList<com.klee.sapio.domain.model.Evaluation>())\n            override suspend fun addEvaluation(evaluation: com.klee.sapio.domain.model.UploadEvaluation) = Result.success(Unit)\n            override suspend fun updateEvaluation(evaluation: com.klee.sapio.domain.model.UploadEvaluation, id: Int) = Result.success(Unit)\n            override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int) = Result.success(null)\n            override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<com.klee.sapio.domain.model.EvaluationRecord>())\n            override suspend fun uploadIcon(packageName: String) = Result.success(emptyList<com.klee.sapio.domain.model.Icon>())\n            override suspend fun existingIcon(iconName: String) = Result.success(emptyList<com.klee.sapio.domain.model.Icon>())\n            override suspend fun deleteIcon(id: Int) = Result.success(Unit)\n        }\n\n        val fakeDeviceConfig = object : DeviceConfiguration(appContext) {\n            override fun getGmsType() = 0\n            override fun isUnsafe() = 0\n        }\n\n        val fakeInstalledAppsRepo = object : InstalledApplicationsDataSource {\n            override fun listInstalledApplications(): List<InstalledApplication> {\n                return emptyList()\n            }\n\n            override fun getInstalledApplication(packageName: String): InstalledApplication? {\n                return app\n            }\n        }\n\n        val fakeUseCase = object : EvaluateAppUseCase(fakeRepo, fakeDeviceConfig) {\n            override suspend fun invoke(a: InstalledApplication, rating: Int) = useCaseResult\n        }\n\n        return LoadingViewModel(fakeInstalledAppsRepo, fakeUseCase)\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/RatingTest.kt",
    "content": "package com.klee.sapio\n\nimport com.klee.sapio.ui.model.Rating\nimport org.junit.Assert.assertEquals\nimport org.junit.Test\n\nclass RatingTest {\n\n    @Test\n    fun `create returns green circle for GOOD`() {\n        val rating = Rating.create(Rating.GOOD)\n\n        assertEquals(Rating.GOOD, rating.value)\n        assertEquals(String(Character.toChars(Rating.GREEN_CIRCLE_EMOJI)), rating.text)\n    }\n\n    @Test\n    fun `create returns yellow circle for AVERAGE`() {\n        val rating = Rating.create(Rating.AVERAGE)\n\n        assertEquals(Rating.AVERAGE, rating.value)\n        assertEquals(String(Character.toChars(Rating.YELLOW_CIRCLE_EMOJI)), rating.text)\n    }\n\n    @Test\n    fun `create returns red circle for BAD`() {\n        val rating = Rating.create(Rating.BAD)\n\n        assertEquals(Rating.BAD, rating.value)\n        assertEquals(String(Character.toChars(Rating.RED_CIRCLE_EMOJI)), rating.text)\n    }\n\n    @Test\n    fun `create defaults to BAD when rating is unknown`() {\n        val rating = Rating.create(999)\n\n        assertEquals(Rating.BAD, rating.value)\n        assertEquals(String(Character.toChars(Rating.RED_CIRCLE_EMOJI)), rating.text)\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/SapioApplicationTest.kt",
    "content": "package com.klee.sapio\n\nimport androidx.test.core.app.ApplicationProvider\nimport org.junit.Assert.assertNotNull\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, application = SapioApplication::class)\nclass SapioApplicationTest {\n\n    @Test\n    fun onCreate_shouldApplyDynamicColorsWithoutCrashing() {\n        val app = ApplicationProvider.getApplicationContext<SapioApplication>()\n        app.onCreate()\n        assertNotNull(app)\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/SearchViewModelTest.kt",
    "content": "package com.klee.sapio\n\nimport android.os.Build\nimport com.klee.sapio.domain.SearchEvaluationUseCase\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport com.klee.sapio.ui.viewmodel.SearchViewModel\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.ExperimentalCoroutinesApi\nimport kotlinx.coroutines.test.UnconfinedTestDispatcher\nimport kotlinx.coroutines.test.advanceUntilIdle\nimport kotlinx.coroutines.test.resetMain\nimport kotlinx.coroutines.test.runTest\nimport kotlinx.coroutines.test.setMain\nimport org.junit.After\nimport org.junit.Assert\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n@ExperimentalCoroutinesApi\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.M])\nclass SearchViewModelTest {\n\n    private lateinit var searchViewModel: SearchViewModel\n\n    private val testDispatcher = UnconfinedTestDispatcher()\n\n    @Before\n    fun setUp() {\n        Dispatchers.setMain(testDispatcher)\n        \n        searchViewModel = SearchViewModel(FakeSearchUseCase(emptyList()))\n    }\n\n    @After\n    fun tearDown() {\n        Dispatchers.resetMain()\n    }\n\n    @Test\n    fun test_searchViewModel_initialState() = runTest {\n        // Test that the ViewModel initializes correctly\n        val initialState = searchViewModel.uiState.value\n        Assert.assertTrue(\"Initial state should be empty\", initialState.items.isEmpty())\n    }\n\n    @Test\n    fun test_searchViewModel_flowBehavior() = runTest {\n        // Test basic flow behavior - this is a simple test to verify the ViewModel works\n        // without needing to mock the complex use case\n        val initialState = searchViewModel.uiState.value\n        Assert.assertNotNull(\"State should not be null\", initialState)\n    }\n\n    @Test\n    fun test_search_updates_state_and_calls_onError_when_empty() = runTest {\n        val fakeUseCase = FakeSearchUseCase(emptyList())\n        val viewModel = SearchViewModel(fakeUseCase)\n        var errored = false\n\n        viewModel.searchApplication(\"pattern\") { errored = true }\n        advanceUntilIdle()\n\n        val result = viewModel.uiState.value.items\n        Assert.assertTrue(errored)\n        Assert.assertTrue(result.isEmpty())\n    }\n\n    @Test\n    fun test_search_updates_state_with_results() = runTest {\n        val expected = listOf(\n            Evaluation(\"Name\", \"pkg\", iconUrl = null, rating = 1, microg = 1, secure = 1, updatedAt = null, createdAt = null, publishedAt = null, versionName = null)\n        )\n        val fakeUseCase = FakeSearchUseCase(expected)\n        val viewModel = SearchViewModel(fakeUseCase)\n        var errored = false\n\n        viewModel.searchApplication(\"pattern\") { errored = true }\n        advanceUntilIdle()\n\n        val result = viewModel.uiState.value.items\n        Assert.assertFalse(errored)\n        Assert.assertEquals(expected, result)\n    }\n\n    private class FakeSearchUseCase(private val result: List<Evaluation>) : SearchEvaluationUseCase(object : com.klee.sapio.domain.EvaluationRepository {\n        override suspend fun listLatestEvaluations(pageNumber: Int): Result<List<Evaluation>> =\n            Result.success(emptyList())\n        override suspend fun searchEvaluations(pattern: String): Result<List<Evaluation>> =\n            Result.success(emptyList())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation): Result<Unit> = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int): Result<Unit> =\n            Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int): Result<Evaluation?> =\n            Result.success(null)\n        override suspend fun existingEvaluations(packageName: String): Result<List<EvaluationRecord>> =\n            Result.success(emptyList())\n        override suspend fun uploadIcon(packageName: String): Result<List<Icon>> =\n            Result.success(emptyList())\n        override suspend fun existingIcon(iconName: String): Result<List<Icon>> =\n            Result.success(emptyList())\n        override suspend fun deleteIcon(id: Int): Result<Unit> = Result.success(Unit)\n    }) {\n        override suspend operator fun invoke(pattern: String): Result<List<Evaluation>> = Result.success(result)\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/SettingsTest.kt",
    "content": "package com.klee.sapio\n\nimport android.os.Build\nimport androidx.preference.PreferenceManager\nimport com.klee.sapio.data.system.Settings\nimport com.klee.sapio.domain.model.UserType\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertFalse\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.RuntimeEnvironment\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.M])\nclass SettingsTest {\n\n    private lateinit var settings: Settings\n\n    @Before\n    fun setUp() {\n        val context = RuntimeEnvironment.getApplication()\n        // Start with clean preferences for each test\n        PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit()\n        settings = Settings(context)\n    }\n\n    @Test\n    fun `isUnsafeConfigurationEnabled returns false by default`() {\n        assertFalse(settings.isUnsafeConfigurationEnabled())\n        assertEquals(UserType.SECURE, settings.getUnsafeConfigurationLevel())\n    }\n\n    @Test\n    fun `isUnsafeConfigurationEnabled reflects stored preference`() {\n        val context = RuntimeEnvironment.getApplication()\n        PreferenceManager.getDefaultSharedPreferences(context)\n            .edit()\n            .putBoolean(\"show_root\", true)\n            .commit()\n\n        assertTrue(settings.isUnsafeConfigurationEnabled())\n        assertEquals(UserType.UNSAFE, settings.getUnsafeConfigurationLevel())\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/SystemPropertyReaderTest.kt",
    "content": "package com.klee.sapio\n\nimport android.os.Build\nimport com.klee.sapio.data.system.SystemPropertyReader\nimport org.junit.Assert.assertEquals\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport org.robolectric.annotation.Config.NONE\nimport org.robolectric.util.ReflectionHelpers\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = NONE, sdk = [Build.VERSION_CODES.P])\nclass SystemPropertyReaderTest {\n\n    private lateinit var reader: SystemPropertyReader\n\n    @org.junit.Before\n    fun setUp() {\n        reader = SystemPropertyReader()\n    }\n\n    @Test\n    fun read_returnsValueWhenPropertyIsSet() {\n        ReflectionHelpers.callStaticMethod<Void>(\n            Class.forName(\"android.os.SystemProperties\"),\n            \"set\",\n            ReflectionHelpers.ClassParameter.from(String::class.java, \"test.prop\"),\n            ReflectionHelpers.ClassParameter.from(String::class.java, \"value123\")\n        )\n\n        assertEquals(\"value123\", reader.read(\"test.prop\"))\n    }\n\n    @Test\n    fun read_returnsEmptyStringWhenPropertyIsMissing() {\n        assertEquals(\"\", reader.read(\"missing.prop\"))\n    }\n\n    @Test\n    fun read_returnsEmptyStringOnIllegalArgument() {\n        // Swap out the cached getMethod to one that always throws IllegalArgumentException\n        val failingMethod = Class.forName(\"com.klee.sapio.SystemPropertyReaderTestKt\")\n            .getDeclaredMethod(\"throwIllegal\", String::class.java, String::class.java)\n        org.robolectric.util.ReflectionHelpers.setField(reader, \"getMethod\\$delegate\", lazy { failingMethod })\n\n        assertEquals(\"\", reader.read(\"any.prop\"))\n    }\n}\n\nfun throwIllegal(name: String, def: String): String {\n    throw IllegalArgumentException(\"boom\")\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/data/local/EvaluationDaoTest.kt",
    "content": "package com.klee.sapio.data.local\n\nimport android.os.Build\nimport androidx.room.Room\nimport java.util.Date\nimport kotlinx.coroutines.test.runTest\nimport org.junit.After\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertNotNull\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.RuntimeEnvironment\nimport org.robolectric.annotation.Config\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = Config.NONE, sdk = [Build.VERSION_CODES.N])\nclass EvaluationDaoTest {\n\n    private lateinit var database: AppDatabase\n    private lateinit var evaluationDao: EvaluationDao\n    private lateinit var iconDao: IconDao\n\n    @Before\n    fun setUp() {\n        database = Room.inMemoryDatabaseBuilder(\n            RuntimeEnvironment.getApplication(),\n            AppDatabase::class.java\n        ).allowMainThreadQueries().build()\n        evaluationDao = database.evaluationDao()\n        iconDao = database.iconDao()\n    }\n\n    @After\n    fun tearDown() {\n        database.close()\n    }\n\n    @Test\n    fun listLatestEvaluations_ordersByUpdatedAt() = runTest {\n        val older = EvaluationEntity(\n            name = \"Old\",\n            packageName = \"com.old\",\n            iconUrl = null,\n            rating = 1,\n            microg = 0,\n            secure = 1,\n            updatedAt = Date(100),\n            createdAt = Date(50),\n            publishedAt = Date(60),\n            versionName = \"1.0\",\n            cachedAt = 1\n        )\n        val newer = EvaluationEntity(\n            name = \"New\",\n            packageName = \"com.new\",\n            iconUrl = null,\n            rating = 2,\n            microg = 1,\n            secure = 0,\n            updatedAt = Date(200),\n            createdAt = Date(80),\n            publishedAt = Date(90),\n            versionName = \"1.1\",\n            cachedAt = 1\n        )\n        evaluationDao.upsertAll(listOf(older, newer))\n\n        val results = evaluationDao.listLatestEvaluations(limit = 1, offset = 0)\n\n        assertEquals(1, results.size)\n        assertEquals(\"com.new\", results.first().packageName)\n    }\n\n    @Test\n    fun searchEvaluations_matchesNameOrPackage() = runTest {\n        val target = EvaluationEntity(\n            name = \"Target App\",\n            packageName = \"com.target.app\",\n            iconUrl = null,\n            rating = 1,\n            microg = 0,\n            secure = 1,\n            updatedAt = Date(100),\n            createdAt = Date(50),\n            publishedAt = Date(60),\n            versionName = \"1.0\",\n            cachedAt = 1\n        )\n        val other = EvaluationEntity(\n            name = \"Other\",\n            packageName = \"com.other\",\n            iconUrl = null,\n            rating = 1,\n            microg = 0,\n            secure = 1,\n            updatedAt = Date(100),\n            createdAt = Date(50),\n            publishedAt = Date(60),\n            versionName = \"1.0\",\n            cachedAt = 1\n        )\n        evaluationDao.upsertAll(listOf(target, other))\n\n        val results = evaluationDao.searchEvaluations(\"%target%\")\n\n        assertEquals(1, results.size)\n        assertEquals(\"com.target.app\", results.first().packageName)\n    }\n\n    @Test\n    fun getEvaluation_usesCompositeKey() = runTest {\n        val target = EvaluationEntity(\n            name = \"Keyed\",\n            packageName = \"com.keyed\",\n            iconUrl = null,\n            rating = 1,\n            microg = 1,\n            secure = 0,\n            updatedAt = Date(100),\n            createdAt = Date(50),\n            publishedAt = Date(60),\n            versionName = \"1.0\",\n            cachedAt = 1\n        )\n        evaluationDao.upsertAll(listOf(target))\n\n        val result = evaluationDao.getEvaluation(\"com.keyed\", microg = 1, secure = 0)\n\n        assertNotNull(result)\n        assertEquals(\"com.keyed\", result?.packageName)\n    }\n\n    @Test\n    fun findIconByName_returnsAllMatchingName() = runTest {\n        val expired = IconEntity(\n            id = 1,\n            name = \"com.app.png\",\n            url = \"/expired.png\",\n            cachedAt = 10\n        )\n        val fresh = IconEntity(\n            id = 2,\n            name = \"com.app.png\",\n            url = \"/fresh.png\",\n            cachedAt = 200\n        )\n        iconDao.upsertAll(listOf(expired, fresh))\n\n        val results = iconDao.findByName(\"com.app.png\")\n\n        assertEquals(2, results.size)\n        assertTrue(results.any { it.url.contains(\"fresh\") })\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/klee/sapio/data/repository/EvaluationRepositoryImplTest.kt",
    "content": "package com.klee.sapio.data.repository\n\nimport android.os.Build\nimport androidx.room.Room\nimport com.klee.sapio.data.api.EvaluationService\nimport com.klee.sapio.data.dto.Evaluation\nimport com.klee.sapio.data.dto.IconAnswer\nimport com.klee.sapio.data.local.AppDatabase\nimport com.klee.sapio.data.local.EvaluationDao\nimport com.klee.sapio.data.local.IconDao\nimport com.klee.sapio.data.local.EvaluationEntity\nimport com.klee.sapio.data.local.IconEntity\nimport java.util.Date\nimport kotlinx.coroutines.test.runTest\nimport org.junit.After\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.mockito.Mockito\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.RuntimeEnvironment\nimport org.robolectric.annotation.Config\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = Config.NONE, sdk = [Build.VERSION_CODES.N])\nclass EvaluationRepositoryImplTest {\n\n    private lateinit var database: AppDatabase\n    private lateinit var evaluationDao: EvaluationDao\n    private lateinit var iconDao: IconDao\n    private lateinit var evaluationService: EvaluationService\n    private lateinit var repository: EvaluationRepositoryImpl\n\n    @Before\n    fun setUp() {\n        database = Room.inMemoryDatabaseBuilder(\n            RuntimeEnvironment.getApplication(),\n            AppDatabase::class.java\n        ).allowMainThreadQueries().build()\n        evaluationDao = database.evaluationDao()\n        iconDao = database.iconDao()\n        evaluationService = Mockito.mock(EvaluationService::class.java)\n        repository = EvaluationRepositoryImpl(evaluationService, evaluationDao, iconDao)\n    }\n\n    @After\n    fun tearDown() {\n        database.close()\n    }\n\n    @Test\n    fun listLatestEvaluations_remoteSuccessCachesResults() = runTest {\n        val remote = listOf(\n            Evaluation(\n                name = \"App One\",\n                packageName = \"com.app.one\",\n                icon = null,\n                rating = 1,\n                microg = 1,\n                secure = 0,\n                updatedAt = Date(2),\n                createdAt = Date(1),\n                publishedAt = Date(1),\n                versionName = \"1.0\"\n            )\n        )\n        Mockito.`when`(evaluationService.listLatestEvaluations(1))\n            .thenReturn(Result.success(remote))\n\n        val result = repository.listLatestEvaluations(1)\n\n        assertTrue(result.isSuccess)\n        assertEquals(1, result.getOrThrow().size)\n        assertEquals(1, evaluationDao.listLatestEvaluations(10, 0).size)\n    }\n\n    @Test\n    fun listLatestEvaluations_remoteFailureFallsBackToCache() = runTest {\n        val cached = Evaluation(\n            name = \"Cached App\",\n            packageName = \"com.cached.app\",\n            icon = null,\n            rating = 2,\n            microg = 0,\n            secure = 1,\n            updatedAt = Date(2),\n            createdAt = Date(1),\n            publishedAt = Date(1),\n            versionName = \"1.0\"\n        )\n        evaluationDao.upsertAll(listOf(\n            EvaluationEntity(\n                name = cached.name,\n                packageName = cached.packageName,\n                iconUrl = null,\n                rating = cached.rating,\n                microg = cached.microg,\n                secure = cached.secure,\n                updatedAt = cached.updatedAt,\n                createdAt = cached.createdAt,\n                publishedAt = cached.publishedAt,\n                versionName = cached.versionName,\n                cachedAt = System.currentTimeMillis()\n            )\n        ))\n        Mockito.`when`(evaluationService.listLatestEvaluations(1))\n            .thenReturn(Result.failure(IllegalStateException(\"Network error\")))\n\n        val result = repository.listLatestEvaluations(1)\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"com.cached.app\", result.getOrThrow().first().packageName)\n    }\n\n    @Test\n    fun existingIcon_networkFirstCachesWhenSuccessful() = runTest {\n        val now = System.currentTimeMillis()\n        iconDao.upsertAll(\n            listOf(IconEntity(id = 12, name = \"com.app.one.png\", url = \"/icon.png\", cachedAt = now))\n        )\n        val remote = listOf(\n            iconAnswer(\n                id = 13,\n                name = \"com.app.one.png\",\n                url = \"/remote.png\"\n            )\n        )\n        Mockito.`when`(evaluationService.existingIcon(\"com.app.one.png\"))\n            .thenReturn(Result.success(remote))\n\n        val result = repository.existingIcon(\"com.app.one.png\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"${EvaluationService.BASE_URL}/remote.png\", result.getOrThrow().first().url)\n    }\n\n    @Test\n    fun existingIcon_fallsBackToCacheOnFailure() = runTest {\n        val cachedAt = System.currentTimeMillis() - 1000\n        iconDao.upsertAll(\n            listOf(IconEntity(id = 22, name = \"com.app.two.png\", url = \"/old.png\", cachedAt = cachedAt))\n        )\n        Mockito.`when`(evaluationService.existingIcon(\"com.app.two.png\"))\n            .thenReturn(Result.failure(IllegalStateException(\"Network error\")))\n\n        val result = repository.existingIcon(\"com.app.two.png\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"${EvaluationService.BASE_URL}/old.png\", result.getOrThrow().first().url)\n    }\n\n    private fun iconAnswer(id: Int, name: String, url: String): IconAnswer {\n        return IconAnswer(\n            id = id,\n            name = name,\n            alternativeText = null,\n            caption = null,\n            width = 64,\n            height = 64,\n            formats = null,\n            hash = \"hash\",\n            ext = \".png\",\n            mime = \"image/png\",\n            size = 10,\n            url = url,\n            previewUrl = null,\n            provider = \"local\",\n            provider_metadata = null,\n            createdAt = Date(0),\n            updatedAt = Date(0)\n        )\n    }\n}\n"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\nbuildscript {\n    dependencies {\n        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.54'\n    }\n}\n\nplugins {\n    id 'com.android.application' version '8.11.2' apply false\n    id 'com.android.library' version '8.11.2' apply false\n    id 'org.jetbrains.kotlin.android' version '2.1.0' apply false\n    id 'org.jetbrains.kotlin.jvm' version '2.1.0' apply false\n\n    alias libs.plugins.detekt\n    alias libs.plugins.compose.compiler apply false\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n\nsubprojects {\n    detekt {\n        source = files(\n                \"src/main/java\"\n        )\n\n        toolVersion = \"1.23.1\"\n        config.setFrom(\"detekt.yml\")\n        baseline = file(\"detekt-baseline.xml\")\n        parallel = false\n        buildUponDefaultConfig = true\n        allRules = false\n        disableDefaultRuleSets = false\n        debug = false\n        ignoreFailures = false\n        basePath = projectDir\n    }\n}\n\ndependencies {\n    detektPlugins libs.detekt.formatting\n}\n\n\n"
  },
  {
    "path": "data/build.gradle",
    "content": "plugins {\n    id 'com.android.library'\n    id 'org.jetbrains.kotlin.android'\n    id 'kotlin-kapt'\n    id 'dagger.hilt.android.plugin'\n}\n\nandroid {\n    compileSdk 36\n\n    defaultConfig {\n        minSdk 21\n        testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"\n    }\n\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_17\n        targetCompatibility JavaVersion.VERSION_17\n    }\n    kotlinOptions {\n        jvmTarget = '17'\n    }\n    namespace 'com.klee.sapio.data'\n}\n\ndependencies {\n    implementation project(':domain')\n\n    implementation libs.androidx.core.ktx\n    implementation libs.kotlinx.coroutines.android\n    implementation libs.room.runtime\n    implementation libs.room.ktx\n    kapt libs.room.compiler\n\n    implementation libs.hilt.android\n    kapt libs.hilt.compiler\n\n    implementation libs.rootbeer.lib\n\n    implementation libs.retrofit\n    implementation libs.converter.jackson\n    implementation libs.logging.interceptor\n    implementation libs.retrofit2.kotlin.coroutines.adapter\n\n    implementation libs.androidx.preference.ktx\n    implementation libs.androidx.work.runtime.ktx\n\n    testImplementation libs.junit\n    testImplementation libs.mockito.core\n    testImplementation libs.mockito.inline\n    testImplementation libs.robolectric\n    testImplementation libs.kotlinx.coroutines.test\n    testImplementation libs.androidx.arch.core.testing\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/api/RetrofitClient.kt",
    "content": "package com.klee.sapio.data.api\n\nimport android.content.Context\nimport android.graphics.Bitmap\nimport android.graphics.drawable.AdaptiveIconDrawable\nimport android.util.Log\nimport androidx.core.graphics.drawable.toBitmap\nimport com.klee.sapio.data.dto.Evaluation\nimport com.klee.sapio.data.dto.IconAnswer\nimport com.klee.sapio.data.dto.StrapiAnswer\nimport com.klee.sapio.data.dto.StrapiElement\nimport com.klee.sapio.data.dto.UploadAnswer\nimport com.klee.sapio.data.dto.UploadEvaluationHeader\nimport com.klee.sapio.domain.AppSettings\nimport dagger.hilt.android.qualifiers.ApplicationContext\nimport kotlinx.coroutines.withTimeout\nimport okhttp3.Cache\nimport okhttp3.MultipartBody\nimport okhttp3.OkHttpClient\nimport okhttp3.RequestBody.Companion.toRequestBody\nimport retrofit2.HttpException\nimport retrofit2.Retrofit\nimport retrofit2.converter.jackson.JacksonConverterFactory\nimport retrofit2.http.Body\nimport retrofit2.http.DELETE\nimport retrofit2.http.GET\nimport retrofit2.http.Headers\nimport retrofit2.http.Multipart\nimport retrofit2.http.POST\nimport retrofit2.http.PUT\nimport retrofit2.http.Part\nimport retrofit2.http.Path\nimport retrofit2.http.Query\nimport java.io.ByteArrayOutputStream\nimport javax.inject.Inject\n\ninterface EvaluationApi {\n    @GET(\"sapio-applications?pagination[pageSize]=20&sort=updatedAt:Desc&populate[icon]=*\")\n    suspend fun listLatestEvaluationsAsync(\n        @Query(\"filters[rooted][\\$lte]\") root: Int,\n        @Query(\"pagination[page]\") pageNumber: Int\n    ): StrapiAnswer\n\n    @GET(\"sapio-applications?sort=name&populate[icon]=*\")\n    suspend fun searchAsync(\n        @Query(\"filters[\\$or][0][name][\\$contains]\") name: String,\n        @Query(\"filters[\\$or][1][packageName][\\$contains]\") packageName: String,\n        @Query(\"filters[\\$and][2][rooted][\\$lte]\") rooted: Int\n    ): StrapiAnswer\n\n    @GET(\"sapio-applications?\")\n    suspend fun existingEvaluationsAsync(\n        @Query(\"filters[packageName][\\$eq]\") packageName: String\n    ): StrapiAnswer\n\n    @Headers(\"Content-Type: application/json\")\n    @POST(\"sapio-applications\")\n    suspend fun addEvaluation(@Body evaluation: UploadEvaluationHeader): UploadAnswer\n\n    @Headers(\"Content-Type: application/json\")\n    @PUT(\"sapio-applications/{id}\")\n    suspend fun updateEvaluation(\n        @Body evaluation: UploadEvaluationHeader,\n        @Path(value = \"id\", encoded = false) id: Int\n    ): UploadAnswer\n\n    @Multipart\n    @POST(\"upload\")\n    suspend fun addIcon(@Part image: MultipartBody.Part): ArrayList<IconAnswer>\n\n    @GET(\"upload/files?sort=updatedAt\")\n    suspend fun existingIconAsync(\n        @Query(\"filters[name][\\$eq]\") iconName: String\n    ): List<IconAnswer>\n\n    @DELETE(\"upload/files/{id}\")\n    suspend fun deleteIcon(\n        @Path(value = \"id\", encoded = false) id: Int\n    ): IconAnswer\n\n    @GET(\"sapio-applications?sort=updatedAt:Desc\")\n    suspend fun getSingleEvaluationAsync(\n        @Query(\"filters[\\$and][0][packageName][\\$eq]\") packageName: String,\n        @Query(\"filters[\\$and][1][microG][\\$contains]\") microG: Int,\n        @Query(\"filters[\\$and][2][rooted][\\$contains]\") rooted: Int\n    ): StrapiAnswer\n}\n\nopen class EvaluationService @Inject constructor(\n    @ApplicationContext private val context: Context\n) {\n    companion object {\n        const val BASE_URL = \"https://server.sapio.ovh\"\n        const val COMPRESSION_QUALITY = 100\n        const val UPLOAD_TIMEOUT_MS: Long = 10000\n        const val CACHE_MAX_SIZE = 10 * 1024 * 1024L\n    }\n\n    @Inject\n    lateinit var settings: AppSettings\n    private var retrofit: Retrofit\n    private var evaluationsApi: EvaluationApi\n\n    init {\n        val okHttpClient = OkHttpClient()\n            .newBuilder()\n            .cache(Cache(context.cacheDir, CACHE_MAX_SIZE))\n            .build()\n\n        retrofit = Retrofit.Builder()\n            .client(okHttpClient)\n            .baseUrl(\"$BASE_URL/api/\")\n            .addConverterFactory(JacksonConverterFactory.create())\n            .build()\n\n        evaluationsApi = retrofit.create(EvaluationApi::class.java)\n    }\n\n    open suspend fun listLatestEvaluations(pageNumber: Int): Result<List<Evaluation>> =\n        runCatching {\n            val strapiAnswer = evaluationsApi.listLatestEvaluationsAsync(\n                settings.getUnsafeConfigurationLevel(),\n                pageNumber\n            )\n\n            strapiAnswer.data.map { it.attributes }\n                .sortedByDescending { it.updatedAt }\n        }.onFailure { exception ->\n            if (exception is HttpException) {\n                Log.i(\"EvaluationService\", \"HttpException: $exception\")\n            }\n        }\n\n    open suspend fun searchEvaluation(pattern: String): Result<List<Evaluation>> =\n        runCatching {\n            val strapiAnswer = evaluationsApi.searchAsync(\n                pattern,\n                pattern,\n                settings.getUnsafeConfigurationLevel()\n            )\n\n            strapiAnswer.data.map { it.attributes }\n                .sortedWith(\n                    compareByDescending<Evaluation> { it.icon != null }\n                        .thenByDescending { it.updatedAt }\n                )\n                .distinctBy { it.packageName }\n        }\n\n    open suspend fun existingEvaluations(packageName: String): Result<List<StrapiElement>> =\n        runCatching {\n            val strapiAnswer = evaluationsApi.existingEvaluationsAsync(packageName)\n            strapiAnswer.data.toList()\n        }\n\n    open suspend fun addEvaluation(app: UploadEvaluationHeader): Result<Unit> =\n        runCatching {\n            evaluationsApi.addEvaluation(app)\n            Unit\n        }\n\n    open suspend fun updateEvaluation(app: UploadEvaluationHeader, id: Int): Result<Unit> =\n        runCatching {\n            evaluationsApi.updateEvaluation(app, id)\n            Unit\n        }\n\n    open suspend fun uploadIcon(packageName: String): Result<List<IconAnswer>> {\n        return runCatching {\n            val appInfo = context.packageManager.getApplicationInfo(packageName, 0)\n            val drawable = appInfo.loadUnbadgedIcon(context.packageManager) as AdaptiveIconDrawable\n            val bytes = fromDrawableToByArray(drawable)\n            val requestBody = bytes.toRequestBody(null, 0, bytes.size)\n            val image = MultipartBody.Part.createFormData(\n                \"files\",\n                \"$packageName.png\",\n                requestBody\n            )\n            withTimeout(UPLOAD_TIMEOUT_MS) {\n                evaluationsApi.addIcon(image)\n            }\n        }\n    }\n\n    open suspend fun existingIcon(iconName: String): Result<List<IconAnswer>> =\n        runCatching {\n            evaluationsApi.existingIconAsync(iconName)\n        }\n\n    open suspend fun deleteIcon(id: Int): Result<Unit> =\n        runCatching {\n            evaluationsApi.deleteIcon(id)\n            Unit\n        }\n\n    open suspend fun fetchEvaluation(appPackageName: String, microG: Int, rooted: Int): Result<Evaluation?> =\n        runCatching {\n            val answer = evaluationsApi.getSingleEvaluationAsync(\n                appPackageName,\n                microG,\n                rooted\n            )\n\n            answer.data.firstOrNull()?.attributes\n        }\n\n    private fun fromDrawableToByArray(drawable: AdaptiveIconDrawable): ByteArray {\n        val bitmap = drawable.toBitmap()\n        val stream = ByteArrayOutputStream()\n        bitmap.compress(Bitmap.CompressFormat.PNG, COMPRESSION_QUALITY, stream)\n        return stream.toByteArray()\n    }\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/di/DataModule.kt",
    "content": "package com.klee.sapio.data.di\n\nimport com.klee.sapio.data.fdroid.CachedFdroidAvailabilityChecker\nimport com.klee.sapio.data.repository.DeviceAppCacheRepositoryImpl\nimport com.klee.sapio.data.repository.InstalledApplicationsRepository\nimport com.klee.sapio.data.system.DeviceConfiguration\nimport com.klee.sapio.data.system.Settings\nimport com.klee.sapio.domain.AppSettings\nimport com.klee.sapio.domain.DeviceAppCacheRepository\nimport com.klee.sapio.domain.DeviceInfo\nimport com.klee.sapio.domain.FdroidAvailabilityChecker\nimport com.klee.sapio.domain.InstalledApplicationsDataSource\nimport dagger.Binds\nimport dagger.Module\nimport dagger.hilt.InstallIn\nimport dagger.hilt.components.SingletonComponent\nimport javax.inject.Singleton\n\n@Module\n@InstallIn(SingletonComponent::class)\nabstract class DataModule {\n\n    @Binds\n    @Singleton\n    abstract fun bindFdroidAvailabilityChecker(\n        impl: CachedFdroidAvailabilityChecker\n    ): FdroidAvailabilityChecker\n\n    @Binds\n    @Singleton\n    abstract fun bindDeviceInfo(\n        impl: DeviceConfiguration\n    ): DeviceInfo\n\n    @Binds\n    @Singleton\n    abstract fun bindInstalledApplicationsDataSource(\n        impl: InstalledApplicationsRepository\n    ): InstalledApplicationsDataSource\n\n    @Binds\n    @Singleton\n    abstract fun bindAppSettings(\n        impl: Settings\n    ): AppSettings\n\n    @Binds\n    @Singleton\n    abstract fun bindDeviceAppCacheRepository(\n        impl: DeviceAppCacheRepositoryImpl\n    ): DeviceAppCacheRepository\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/dto/Evaluation.kt",
    "content": "package com.klee.sapio.data.dto\n\nimport com.fasterxml.jackson.annotation.JsonProperty\nimport java.util.Date\n\ndata class Evaluation(\n    @JsonProperty(\"name\") val name: String,\n    @JsonProperty(\"packageName\") val packageName: String,\n    @JsonProperty(\"icon\") val icon: Icon?,\n    @JsonProperty(\"rating\") val rating: Int,\n    @JsonProperty(\"microg\") val microg: Int,\n    @JsonProperty(\"rooted\") val secure: Int,\n    @JsonProperty(\"updatedAt\") val updatedAt: Date?,\n    @JsonProperty(\"createdAt\") val createdAt: Date?,\n    @JsonProperty(\"publishedAt\") val publishedAt: Date?,\n    @JsonProperty(\"versionName\") val versionName: String?\n)\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/dto/IconDtos.kt",
    "content": "package com.klee.sapio.data.dto\n\nimport com.fasterxml.jackson.annotation.JsonProperty\nimport java.util.Date\n\ndata class RemoteImage(\n    @JsonProperty(\"name\") val name: String,\n    @JsonProperty(\"alternativeText\") val alternativeText: String?,\n    @JsonProperty(\"caption\") val caption: String?,\n    @JsonProperty(\"width\") val width: Int,\n    @JsonProperty(\"height\") val height: Int,\n    @JsonProperty(\"formats\") val formats: RemoteImageFormats?,\n    @JsonProperty(\"hash\") val hash: String,\n    @JsonProperty(\"ext\") val ext: String,\n    @JsonProperty(\"mime\") val mime: String,\n    @JsonProperty(\"size\") val size: Int,\n    @JsonProperty(\"url\") val url: String,\n    @JsonProperty(\"previewUrl\") val previewUrl: String?,\n    @JsonProperty(\"provider\") val provider: String?,\n    @JsonProperty(\"provider_metadata\") val provider_metadata: String?,\n    @JsonProperty(\"createdAt\") val createdAt: Date,\n    @JsonProperty(\"updatedAt\") val updatedAt: Date\n)\n\ndata class RemoteImageFormats(\n    @JsonProperty(\"thumbnail\") val thumbnail: Image,\n    @JsonProperty(\"large\") val large: Image?,\n    @JsonProperty(\"medium\") val medium: Image?,\n    @JsonProperty(\"small\") val small: Image?\n)\n\ndata class Image(\n    @JsonProperty(\"name\") val name: String,\n    @JsonProperty(\"hash\") val hash: String,\n    @JsonProperty(\"ext\") val ext: String,\n    @JsonProperty(\"mime\") val mime: String,\n    @JsonProperty(\"path\") val path: String?,\n    @JsonProperty(\"width\") val width: Int,\n    @JsonProperty(\"height\") val height: Int,\n    @JsonProperty(\"size\") val size: Int,\n    @JsonProperty(\"url\") val url: String\n)\n\ndata class IconAnswer(\n    @JsonProperty(\"id\") val id: Int,\n    @JsonProperty(\"name\") val name: String,\n    @JsonProperty(\"alternativeText\") val alternativeText: String?,\n    @JsonProperty(\"caption\") val caption: String?,\n    @JsonProperty(\"width\") val width: Int,\n    @JsonProperty(\"height\") val height: Int,\n    @JsonProperty(\"formats\") val formats: RemoteImageFormats?,\n    @JsonProperty(\"hash\") val hash: String,\n    @JsonProperty(\"ext\") val ext: String,\n    @JsonProperty(\"mime\") val mime: String,\n    @JsonProperty(\"size\") val size: Int,\n    @JsonProperty(\"url\") val url: String,\n    @JsonProperty(\"previewUrl\") val previewUrl: String?,\n    @JsonProperty(\"provider\") val provider: String?,\n    @JsonProperty(\"provider_metadata\") val provider_metadata: String?,\n    @JsonProperty(\"createdAt\") val createdAt: Date,\n    @JsonProperty(\"updatedAt\") val updatedAt: Date\n)\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/dto/StrapiDtos.kt",
    "content": "package com.klee.sapio.data.dto\n\nimport com.fasterxml.jackson.annotation.JsonProperty\n\ndata class StrapiAnswer(\n    @JsonProperty(\"data\") val data: ArrayList<StrapiElement>,\n    @JsonProperty(\"meta\") val meta: StrapiMeta\n)\n\ndata class StrapiMeta(\n    @JsonProperty(\"pagination\") val pagination: StrapiPagination?\n)\n\ndata class StrapiPagination(\n    @JsonProperty(\"page\") val page: Int,\n    @JsonProperty(\"pageSize\") val pageSize: Int,\n    @JsonProperty(\"pageCount\") val pageCount: Int,\n    @JsonProperty(\"total\") val total: Int\n)\n\ndata class StrapiImageElement(\n    @JsonProperty(\"id\") val id: Int,\n    @JsonProperty(\"attributes\") val attributes: RemoteImage\n)\n\ndata class StrapiElement(\n    @JsonProperty(\"id\") val id: Int,\n    @JsonProperty(\"attributes\") val attributes: Evaluation\n)\n\ndata class Icon(\n    @JsonProperty(\"data\") val data: StrapiImageElement?\n)\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/dto/UploadDtos.kt",
    "content": "package com.klee.sapio.data.dto\n\nimport com.fasterxml.jackson.annotation.JsonProperty\n\ndata class UploadEvaluation(\n    @JsonProperty(\"name\") val name: String,\n    @JsonProperty(\"packageName\") val packageName: String,\n    @JsonProperty(\"icon\") var icon: Int?,\n    @JsonProperty(\"rating\") val rating: Int,\n    @JsonProperty(\"microg\") val microg: Int,\n    @JsonProperty(\"rooted\") val rooted: Int\n)\n\ndata class UploadAnswer(\n    @JsonProperty(\"data\") val data: StrapiElement,\n    @JsonProperty(\"meta\") val meta: StrapiMeta?\n)\n\ndata class UploadEvaluationHeader(\n    @JsonProperty(\"data\") var data: UploadEvaluation\n)\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/fdroid/CachedFdroidAvailabilityChecker.kt",
    "content": "package com.klee.sapio.data.fdroid\n\nimport com.klee.sapio.domain.FdroidAvailabilityChecker\nimport java.util.concurrent.ConcurrentHashMap\nimport javax.inject.Inject\n\nclass CachedFdroidAvailabilityChecker @Inject constructor(\n    private val delegate: OkHttpFdroidAvailabilityChecker\n) : FdroidAvailabilityChecker {\n\n    private data class CacheEntry(val isAvailable: Boolean, val cachedAt: Long)\n\n    private val cache = ConcurrentHashMap<String, CacheEntry>()\n\n    override suspend fun isAvailable(packageName: String): Boolean? {\n        val entry = cache[packageName]\n        if (entry != null && System.currentTimeMillis() - entry.cachedAt < CACHE_VALIDITY_MS) {\n            return entry.isAvailable\n        }\n        val result = delegate.isAvailable(packageName)\n        if (result != null) {\n            cache[packageName] = CacheEntry(result, System.currentTimeMillis())\n        }\n        return result\n    }\n\n    companion object {\n        private const val CACHE_VALIDITY_MS = 86_400_000L // 24 hours\n    }\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/fdroid/OkHttpFdroidAvailabilityChecker.kt",
    "content": "package com.klee.sapio.data.fdroid\n\nimport android.util.Log\nimport com.klee.sapio.domain.FdroidAvailabilityChecker\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.withContext\nimport okhttp3.OkHttpClient\nimport okhttp3.Request\nimport java.io.IOException\nimport javax.inject.Inject\n\nclass OkHttpFdroidAvailabilityChecker @Inject constructor() : FdroidAvailabilityChecker {\n\n    private val client = OkHttpClient()\n\n    override suspend fun isAvailable(packageName: String): Boolean? {\n        val request = Request.Builder()\n            .url(\"https://f-droid.org/api/v1/packages/$packageName\")\n            .build()\n        return try {\n            withContext(Dispatchers.IO) {\n                client.newCall(request).execute().use { response ->\n                    response.code == HTTP_200_SUCCESS\n                }\n            }\n        } catch (e: IOException) {\n            Log.e(\"OkHttpFdroidChecker\", \"Failed to reach F-Droid for $packageName\", e)\n            null\n        }\n    }\n\n    companion object {\n        private const val HTTP_200_SUCCESS = 200\n    }\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/local/AppDatabase.kt",
    "content": "package com.klee.sapio.data.local\n\nimport androidx.room.Database\nimport androidx.room.RoomDatabase\nimport androidx.room.TypeConverters\n\n@Database(\n    entities = [EvaluationEntity::class, IconEntity::class, DeviceAppEntity::class],\n    version = 5,\n    exportSchema = false\n)\n@TypeConverters(Converters::class)\nabstract class AppDatabase : RoomDatabase() {\n    abstract fun evaluationDao(): EvaluationDao\n    abstract fun iconDao(): IconDao\n    abstract fun deviceAppDao(): DeviceAppDao\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/local/Converters.kt",
    "content": "package com.klee.sapio.data.local\n\nimport androidx.room.TypeConverter\nimport java.util.Date\n\nclass Converters {\n\n    @TypeConverter\n    fun fromTimestamp(value: Long?): Date? {\n        return value?.let { Date(it) }\n    }\n\n    @TypeConverter\n    fun dateToTimestamp(date: Date?): Long? {\n        return date?.time\n    }\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/local/DatabaseModule.kt",
    "content": "package com.klee.sapio.data.local\n\nimport android.content.Context\nimport androidx.room.Room\nimport dagger.Module\nimport dagger.Provides\nimport dagger.hilt.InstallIn\nimport dagger.hilt.android.qualifiers.ApplicationContext\nimport dagger.hilt.components.SingletonComponent\nimport javax.inject.Singleton\n\n@Module\n@InstallIn(SingletonComponent::class)\nobject DatabaseModule {\n\n    @Provides\n    @Singleton\n    fun provideDatabase(@ApplicationContext context: Context): AppDatabase {\n        return Room.databaseBuilder(\n            context,\n            AppDatabase::class.java,\n            \"sapio.db\"\n        ).fallbackToDestructiveMigration()\n            .build()\n    }\n\n    @Provides\n    fun provideEvaluationDao(database: AppDatabase): EvaluationDao = database.evaluationDao()\n\n    @Provides\n    fun provideIconDao(database: AppDatabase): IconDao = database.iconDao()\n\n    @Provides\n    fun provideDeviceAppDao(database: AppDatabase): DeviceAppDao = database.deviceAppDao()\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/local/DeviceAppDao.kt",
    "content": "package com.klee.sapio.data.local\n\nimport androidx.room.Dao\nimport androidx.room.Insert\nimport androidx.room.OnConflictStrategy\nimport androidx.room.Query\n\n@Dao\ninterface DeviceAppDao {\n\n    @Query(\"SELECT * FROM DeviceAppEntity\")\n    suspend fun getAll(): List<DeviceAppEntity>\n\n    @Insert(onConflict = OnConflictStrategy.REPLACE)\n    suspend fun upsertAll(items: List<DeviceAppEntity>)\n\n    @Query(\"DELETE FROM DeviceAppEntity\")\n    suspend fun deleteAll()\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/local/DeviceAppEntity.kt",
    "content": "package com.klee.sapio.data.local\n\nimport androidx.room.Entity\nimport androidx.room.PrimaryKey\n\n@Entity\ndata class DeviceAppEntity(\n    @PrimaryKey val packageName: String,\n    val rating: Int?,\n    val cachedAt: Long\n)\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/local/EvaluationDao.kt",
    "content": "package com.klee.sapio.data.local\n\nimport androidx.room.Dao\nimport androidx.room.Insert\nimport androidx.room.OnConflictStrategy\nimport androidx.room.Query\n\n@Dao\ninterface EvaluationDao {\n\n    @Query(\n        \"\"\"\n        SELECT * FROM EvaluationEntity\n        ORDER BY updatedAt DESC\n        LIMIT :limit OFFSET :offset\n        \"\"\"\n    )\n    suspend fun listLatestEvaluations(\n        limit: Int,\n        offset: Int\n    ): List<EvaluationEntity>\n\n    @Query(\n        \"\"\"\n        SELECT * FROM EvaluationEntity\n        WHERE (name LIKE :pattern OR packageName LIKE :pattern)\n        ORDER BY name\n        \"\"\"\n    )\n    suspend fun searchEvaluations(pattern: String): List<EvaluationEntity>\n\n    @Query(\n        \"\"\"\n        SELECT * FROM EvaluationEntity\n        WHERE packageName = :packageName AND microg = :microg AND secure = :secure\n        LIMIT 1\n        \"\"\"\n    )\n    suspend fun getEvaluation(\n        packageName: String,\n        microg: Int,\n        secure: Int\n    ): EvaluationEntity?\n\n    @Insert(onConflict = OnConflictStrategy.REPLACE)\n    suspend fun upsertAll(items: List<EvaluationEntity>)\n}\n\n@Dao\ninterface IconDao {\n\n    @Query(\n        \"\"\"\n        SELECT * FROM IconEntity\n        WHERE name = :iconName\n        ORDER BY id DESC\n        \"\"\"\n    )\n    suspend fun findByName(iconName: String): List<IconEntity>\n\n    @Insert(onConflict = OnConflictStrategy.REPLACE)\n    suspend fun upsertAll(items: List<IconEntity>)\n\n    @Query(\"DELETE FROM IconEntity WHERE id = :id\")\n    suspend fun deleteById(id: Int)\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/local/EvaluationEntity.kt",
    "content": "package com.klee.sapio.data.local\n\nimport androidx.room.Entity\nimport java.util.Date\n\n@Entity(primaryKeys = [\"packageName\", \"microg\", \"secure\"])\ndata class EvaluationEntity(\n    val name: String,\n    val packageName: String,\n    val iconUrl: String?,\n    val rating: Int,\n    val microg: Int,\n    val secure: Int,\n    val updatedAt: Date?,\n    val createdAt: Date?,\n    val publishedAt: Date?,\n    val versionName: String?,\n    val cachedAt: Long\n)\n\n@Entity(primaryKeys = [\"id\"])\ndata class IconEntity(\n    val id: Int,\n    val name: String,\n    val url: String,\n    val cachedAt: Long\n)\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/repository/DeviceAppCacheRepositoryImpl.kt",
    "content": "package com.klee.sapio.data.repository\n\nimport com.klee.sapio.data.local.DeviceAppDao\nimport com.klee.sapio.data.local.DeviceAppEntity\nimport com.klee.sapio.domain.DeviceAppCacheRepository\nimport com.klee.sapio.domain.model.CachedDeviceApp\nimport javax.inject.Inject\n\nclass DeviceAppCacheRepositoryImpl @Inject constructor(\n    private val deviceAppDao: DeviceAppDao\n) : DeviceAppCacheRepository {\n\n    override suspend fun getAll(): List<CachedDeviceApp> {\n        return deviceAppDao.getAll().map { it.toDomain() }\n    }\n\n    override suspend fun replaceAll(items: List<CachedDeviceApp>) {\n        deviceAppDao.deleteAll()\n        deviceAppDao.upsertAll(items.map { it.toEntity() })\n    }\n}\n\nprivate fun DeviceAppEntity.toDomain(): CachedDeviceApp = CachedDeviceApp(\n    packageName = packageName,\n    rating = rating,\n    cachedAt = cachedAt\n)\n\nprivate fun CachedDeviceApp.toEntity(): DeviceAppEntity = DeviceAppEntity(\n    packageName = packageName,\n    rating = rating,\n    cachedAt = cachedAt\n)\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/repository/EvaluationRepositoryImpl.kt",
    "content": "package com.klee.sapio.data.repository\n\nimport com.klee.sapio.data.api.EvaluationService\nimport com.klee.sapio.data.dto.IconAnswer\nimport com.klee.sapio.data.dto.StrapiElement\nimport com.klee.sapio.data.dto.UploadEvaluation as DtoUploadEvaluation\nimport com.klee.sapio.data.dto.UploadEvaluationHeader\nimport com.klee.sapio.data.local.EvaluationDao\nimport com.klee.sapio.data.local.EvaluationEntity\nimport com.klee.sapio.data.local.IconDao\nimport com.klee.sapio.data.local.IconEntity\nimport com.klee.sapio.domain.EvaluationRepository\nimport dagger.Binds\nimport dagger.Module\nimport dagger.hilt.InstallIn\nimport dagger.hilt.components.SingletonComponent\nimport kotlinx.coroutines.async\nimport kotlinx.coroutines.awaitAll\nimport kotlinx.coroutines.coroutineScope\nimport javax.inject.Inject\nimport com.klee.sapio.data.dto.Evaluation as DtoEvaluation\nimport com.klee.sapio.domain.model.Evaluation as DomainEvaluation\nimport com.klee.sapio.domain.model.EvaluationRecord as DomainEvaluationRecord\nimport com.klee.sapio.domain.model.Icon as DomainIcon\nimport com.klee.sapio.domain.model.UploadEvaluation as DomainUploadEvaluation\n\nclass EvaluationRepositoryImpl @Inject constructor(\n    private val retrofitService: EvaluationService,\n    private val evaluationDao: EvaluationDao,\n    private val iconDao: IconDao\n) :\n    EvaluationRepository {\n\n    companion object {\n        private const val PAGE_SIZE = 20\n    }\n\n    override suspend fun listLatestEvaluations(pageNumber: Int): Result<List<DomainEvaluation>> {\n        val offset = (pageNumber - 1).coerceAtLeast(0) * PAGE_SIZE\n        val remote = retrofitService.listLatestEvaluations(pageNumber)\n        if (remote.isSuccess) {\n            val evaluations = remote.getOrThrow()\n            val now = System.currentTimeMillis()\n            evaluationDao.upsertAll(evaluations.map { it.toEntity(now) })\n            return Result.success(evaluations.enrichWithIcons())\n        }\n\n        val cached = evaluationDao.listLatestEvaluations(PAGE_SIZE, offset)\n            .map { it.toDomain() }\n        return if (cached.isNotEmpty()) {\n            Result.success(cached)\n        } else {\n            Result.failure(remote.exceptionOrNull() ?: IllegalStateException(\"Failed to load evaluations\"))\n        }\n    }\n\n    override suspend fun searchEvaluations(pattern: String): Result<List<DomainEvaluation>> {\n        val remote = retrofitService.searchEvaluation(pattern)\n        if (remote.isSuccess) {\n            val evaluations = remote.getOrThrow()\n            val now = System.currentTimeMillis()\n            evaluationDao.upsertAll(evaluations.map { it.toEntity(now) })\n            return Result.success(evaluations.enrichWithIcons())\n        }\n\n        val cached = evaluationDao.searchEvaluations(\"%$pattern%\")\n            .map { it.toDomain() }\n        return if (cached.isNotEmpty()) {\n            Result.success(cached)\n        } else {\n            Result.failure(remote.exceptionOrNull() ?: IllegalStateException(\"Failed to search evaluations\"))\n        }\n    }\n\n    override suspend fun addEvaluation(evaluation: DomainUploadEvaluation): Result<Unit> {\n        val header = UploadEvaluationHeader(evaluation.toData())\n        return retrofitService.addEvaluation(header)\n    }\n\n    override suspend fun updateEvaluation(evaluation: DomainUploadEvaluation, id: Int): Result<Unit> {\n        val header = UploadEvaluationHeader(evaluation.toData())\n        return retrofitService.updateEvaluation(header, id)\n    }\n\n    override suspend fun fetchEvaluation(\n        appPackageName: String,\n        gmsType: Int,\n        userType: Int\n    ): Result<DomainEvaluation?> {\n        return fetchEvaluationWithFallback(appPackageName, gmsType, userType)\n    }\n\n    override suspend fun existingEvaluations(packageName: String): Result<List<DomainEvaluationRecord>> {\n        return retrofitService.existingEvaluations(packageName)\n            .map { evaluations -> evaluations.map { it.toDomain() } }\n    }\n\n    override suspend fun uploadIcon(packageName: String): Result<List<DomainIcon>> {\n        val remote = retrofitService.uploadIcon(packageName)\n        if (remote.isSuccess) {\n            val icons = remote.getOrThrow()\n            val now = System.currentTimeMillis()\n            iconDao.upsertAll(icons.map { it.toEntity(now) })\n            return Result.success(icons.map { it.toDomain() })\n        }\n\n        val cached = iconDao.findByName(\"$packageName.png\")\n            .map { it.toDomain() }\n        return if (cached.isNotEmpty()) {\n            Result.success(cached)\n        } else {\n            Result.failure(remote.exceptionOrNull() ?: IllegalStateException(\"Failed to upload icon\"))\n        }\n    }\n\n    override suspend fun existingIcon(iconName: String): Result<List<DomainIcon>> {\n        val remote = retrofitService.existingIcon(iconName)\n        if (remote.isSuccess) {\n            val icons = remote.getOrThrow()\n            val now = System.currentTimeMillis()\n            iconDao.upsertAll(icons.map { it.toEntity(now) })\n            return Result.success(icons.map { it.toDomain() })\n        }\n\n        val cached = iconDao.findByName(iconName)\n            .map { it.toDomain() }\n        return if (cached.isNotEmpty()) {\n            Result.success(cached)\n        } else {\n            Result.failure(remote.exceptionOrNull() ?: IllegalStateException(\"Failed to load icon\"))\n        }\n    }\n\n    override suspend fun deleteIcon(id: Int): Result<Unit> {\n        val remote = retrofitService.deleteIcon(id)\n        if (remote.isSuccess) {\n            iconDao.deleteById(id)\n        }\n        return remote\n    }\n\n    private suspend fun fetchEvaluationWithFallback(\n        packageName: String,\n        microg: Int,\n        secure: Int\n    ): Result<DomainEvaluation?> {\n        val remote = retrofitService.fetchEvaluation(packageName, microg, secure)\n        if (remote.isSuccess) {\n            val evaluation = remote.getOrNull()\n            if (evaluation != null) {\n                val now = System.currentTimeMillis()\n                evaluationDao.upsertAll(listOf(evaluation.toEntity(now)))\n            }\n            return Result.success(evaluation?.toDomain())\n        }\n\n        val cached = evaluationDao.getEvaluation(packageName, microg, secure)\n            ?.toDomain()\n        return if (cached != null) {\n            Result.success(cached)\n        } else {\n            Result.failure(remote.exceptionOrNull() ?: IllegalStateException(\"Failed to load evaluation\"))\n        }\n    }\n\n    private suspend fun List<DtoEvaluation>.enrichWithIcons(): List<DomainEvaluation> =\n        coroutineScope {\n            map { evaluation ->\n                async {\n                    val domain = evaluation.toDomain()\n                    if (domain.iconUrl == null) {\n                        val fallback = retrofitService.existingIcon(\"${evaluation.packageName}.png\")\n                        domain.copy(iconUrl = fallback.getOrNull()?.firstOrNull()?.url.toAbsoluteUrl())\n                    } else {\n                        domain\n                    }\n                }\n            }.awaitAll()\n        }\n}\n\n@Module\n@InstallIn(SingletonComponent::class)\nabstract class EvaluationRepositoryModule {\n\n    @Binds\n    abstract fun bindEvaluationRepository(\n        evaluationRepositoryImpl: EvaluationRepositoryImpl\n    ): EvaluationRepository\n}\n\nprivate fun DtoEvaluation.toDomain(): DomainEvaluation = DomainEvaluation(\n    name = name,\n    packageName = packageName,\n    iconUrl = icon?.data?.attributes?.url.toAbsoluteUrl(),\n    rating = rating,\n    microg = microg,\n    secure = secure,\n    updatedAt = updatedAt,\n    createdAt = createdAt,\n    publishedAt = publishedAt,\n    versionName = versionName\n)\n\nprivate fun DtoEvaluation.toEntity(cachedAt: Long): EvaluationEntity = EvaluationEntity(\n    name = name,\n    packageName = packageName,\n    iconUrl = icon?.data?.attributes?.url,\n    rating = rating,\n    microg = microg,\n    secure = secure,\n    updatedAt = updatedAt,\n    createdAt = createdAt,\n    publishedAt = publishedAt,\n    versionName = versionName,\n    cachedAt = cachedAt\n)\n\nprivate fun EvaluationEntity.toDomain(): DomainEvaluation = DomainEvaluation(\n    name = name,\n    packageName = packageName,\n    iconUrl = iconUrl.toAbsoluteUrl(),\n    rating = rating,\n    microg = microg,\n    secure = secure,\n    updatedAt = updatedAt,\n    createdAt = createdAt,\n    publishedAt = publishedAt,\n    versionName = versionName\n)\n\nprivate fun StrapiElement.toDomain(): DomainEvaluationRecord = DomainEvaluationRecord(\n    id = id,\n    evaluation = attributes.toDomain()\n)\n\nprivate fun IconAnswer.toDomain(): DomainIcon = DomainIcon(\n    id = id,\n    name = name,\n    url = url.toAbsoluteUrl().orEmpty()\n)\n\nprivate fun IconAnswer.toEntity(cachedAt: Long): IconEntity = IconEntity(\n    id = id,\n    name = name,\n    url = url,\n    cachedAt = cachedAt\n)\n\nprivate fun IconEntity.toDomain(): DomainIcon = DomainIcon(\n    id = id,\n    name = name,\n    url = url.toAbsoluteUrl().orEmpty()\n)\n\nprivate fun DomainUploadEvaluation.toData(): DtoUploadEvaluation = DtoUploadEvaluation(\n    name = name,\n    packageName = packageName,\n    icon = icon,\n    rating = rating,\n    microg = microg,\n    rooted = rooted\n)\n\nprivate fun String?.toAbsoluteUrl(): String? {\n    val value = this ?: return null\n    return if (value.startsWith(\"http://\") || value.startsWith(\"https://\")) {\n        value\n    } else {\n        \"${EvaluationService.BASE_URL}$value\"\n    }\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/repository/InstalledApplicationsRepository.kt",
    "content": "package com.klee.sapio.data.repository\n\nimport android.content.Context\nimport android.content.Intent\nimport android.content.pm.ApplicationInfo\nimport android.graphics.drawable.AdaptiveIconDrawable\nimport android.os.Build\nimport androidx.annotation.VisibleForTesting\nimport com.klee.sapio.domain.InstalledApplicationsDataSource\nimport com.klee.sapio.domain.model.InstalledApplication\nimport dagger.hilt.android.qualifiers.ApplicationContext\nimport javax.inject.Inject\nimport javax.inject.Singleton\n\n@Singleton\nopen class InstalledApplicationsRepository @Inject constructor(\n    @ApplicationContext private val context: Context\n) : InstalledApplicationsDataSource {\n\n    override fun listInstalledApplications(): List<InstalledApplication> {\n        val pm = context.packageManager\n        val intent = Intent(Intent.ACTION_MAIN).apply {\n            addCategory(Intent.CATEGORY_LAUNCHER)\n        }\n        val resolveInfoList = try {\n            pm.queryIntentActivities(intent, 0)\n        } catch (e: RuntimeException) {\n            return emptyList()\n        }\n\n        val results: MutableList<InstalledApplication> = arrayListOf()\n        for (resolveInfo in resolveInfoList) {\n            val appInfo = resolveInfo.activityInfo.applicationInfo\n            if (isSystemApp(appInfo) || isGmsRelated(appInfo)) continue\n            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !hasAdaptiveIcon(context, appInfo)) continue\n            val label = try {\n                pm.getApplicationLabel(appInfo).toString()\n            } catch (e: RuntimeException) {\n                continue\n            }\n            results.add(InstalledApplication(label, appInfo.packageName))\n        }\n\n        return results.sortedBy { app -> app.name.lowercase() }\n    }\n\n    override fun getInstalledApplication(packageName: String): InstalledApplication? {\n        val appList = listInstalledApplications()\n        for (app in appList) {\n            if (app.packageName == packageName) {\n                return app\n            }\n        }\n        return null\n    }\n\n    @VisibleForTesting\n    fun isSystemApp(info: ApplicationInfo): Boolean {\n        return info.flags and ApplicationInfo.FLAG_SYSTEM != 0\n    }\n\n    @VisibleForTesting\n    fun isGmsRelated(info: ApplicationInfo): Boolean {\n        val pkgName = info.packageName ?: return false\n        return pkgName.endsWith(\".gms\") || pkgName == \"com.android.vending\"\n    }\n\n    @VisibleForTesting\n    fun hasAdaptiveIcon(context: Context, info: ApplicationInfo): Boolean {\n        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return false\n        return try {\n            val icon = info.loadUnbadgedIcon(context.packageManager) ?: return false\n            icon is AdaptiveIconDrawable\n        } catch (e: RuntimeException) {\n            false\n        }\n    }\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/system/DeviceConfiguration.kt",
    "content": "package com.klee.sapio.data.system\n\nimport android.content.Context\nimport android.content.pm.PackageManager\nimport com.klee.sapio.domain.DeviceInfo\nimport com.klee.sapio.domain.model.GmsType\nimport com.klee.sapio.domain.model.UserType\nimport com.scottyab.rootbeer.RootBeer\nimport dagger.hilt.android.qualifiers.ApplicationContext\nimport javax.inject.Inject\nimport javax.inject.Singleton\n\n@Singleton\nopen class DeviceConfiguration @Inject constructor(\n    @ApplicationContext private val mContext: Context\n) : DeviceInfo {\n    companion object {\n        const val GMS_SERVICES_PACKAGE_NAME = \"com.google.android.gms\"\n    }\n\n    private var packageManager: PackageManager = mContext.packageManager\n\n    override fun getGmsType(): Int = cachedGmsType\n\n    private val cachedGmsType: Int by lazy { computeGmsType() }\n\n    private fun computeGmsType(): Int {\n        val apps = try {\n            packageManager.getInstalledApplications(0)\n        } catch (e: RuntimeException) {\n            return GmsType.BARE_AOSP\n        }\n        val gmsApp = apps.firstOrNull { it.packageName == GMS_SERVICES_PACKAGE_NAME }\n            ?: return GmsType.BARE_AOSP\n\n        return try {\n            if (packageManager.getApplicationLabel(gmsApp).toString().contains(\"Google\", true)) {\n                GmsType.GOOGLE_PLAY_SERVICES\n            } else {\n                GmsType.MICROG\n            }\n        } catch (e: RuntimeException) {\n            GmsType.BARE_AOSP\n        }\n    }\n\n    override fun isUnsafe(): Int {\n        return if (isRooted() && !isBootloaderLocked()) {\n            UserType.UNSAFE\n        } else {\n            UserType.SECURE\n        }\n    }\n\n    protected open fun isRooted(): Boolean = RootBeer(mContext).isRooted\n\n    protected open fun isBootloaderLocked(): Boolean {\n        val verifiedBootState = SystemPropertyReader().read(\"ro.boot.verifiedbootstate\")\n        return verifiedBootState == \"yellow\" || verifiedBootState == \"green\"\n    }\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/system/Settings.kt",
    "content": "package com.klee.sapio.data.system\n\nimport android.content.Context\nimport androidx.preference.PreferenceManager\nimport com.klee.sapio.domain.AppSettings\nimport com.klee.sapio.domain.model.UserType\nimport dagger.hilt.android.qualifiers.ApplicationContext\nimport javax.inject.Inject\n\nopen class Settings @Inject constructor(\n    @ApplicationContext private val mContext: Context\n) : AppSettings {\n\n    override fun getUnsafeConfigurationLevel(): Int {\n        return if (isUnsafeConfigurationEnabled()) {\n            UserType.UNSAFE\n        } else {\n            UserType.SECURE\n        }\n    }\n\n    override fun isUnsafeConfigurationEnabled(): Boolean {\n        val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext)\n        return sharedPreferences.getBoolean(\"show_root\", false)\n    }\n}\n"
  },
  {
    "path": "data/src/main/java/com/klee/sapio/data/system/SystemPropertyReader.kt",
    "content": "package com.klee.sapio.data.system\n\nimport android.annotation.SuppressLint\nimport android.util.Log\n\n@SuppressLint(\"PrivateApi\")\nclass SystemPropertyReader {\n\n    private val getMethod by lazy {\n        val clazz = Class.forName(\"android.os.SystemProperties\")\n        clazz.getMethod(\"get\", String::class.java, String::class.java)\n    }\n\n    fun read(propertyName: String): String {\n        return try {\n            val value = getMethod.invoke(null, propertyName, \"\") as String\n            value.trim()\n        } catch (exception: ReflectiveOperationException) {\n            Log.w(TAG, \"Unable to read property $propertyName\", exception)\n            \"\"\n        } catch (exception: IllegalArgumentException) {\n            Log.w(TAG, \"Invalid arguments supplied for $propertyName\", exception)\n            \"\"\n        }\n    }\n\n    private companion object {\n        private const val TAG = \"SystemPropertyReader\"\n    }\n}\n"
  },
  {
    "path": "data/src/test/java/com/klee/sapio/data/CachedFdroidAvailabilityCheckerTest.kt",
    "content": "package com.klee.sapio.data\n\nimport com.klee.sapio.data.fdroid.CachedFdroidAvailabilityChecker\nimport com.klee.sapio.data.fdroid.OkHttpFdroidAvailabilityChecker\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertFalse\nimport org.junit.Assert.assertNull\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Test\nimport org.mockito.Mock\nimport org.mockito.Mockito.times\nimport org.mockito.Mockito.verify\nimport org.mockito.Mockito.`when`\nimport org.mockito.MockitoAnnotations\n\nclass CachedFdroidAvailabilityCheckerTest {\n\n    @Mock\n    private lateinit var delegate: OkHttpFdroidAvailabilityChecker\n\n    @Before\n    fun setUp() {\n        MockitoAnnotations.openMocks(this)\n    }\n\n    @Test\n    fun `returns true when delegate reports available`() = runTest {\n        `when`(delegate.isAvailable(\"com.test.app\")).thenReturn(true)\n        val checker = CachedFdroidAvailabilityChecker(delegate)\n\n        assertTrue(checker.isAvailable(\"com.test.app\")!!)\n    }\n\n    @Test\n    fun `returns false when delegate reports unavailable`() = runTest {\n        `when`(delegate.isAvailable(\"com.test.app\")).thenReturn(false)\n        val checker = CachedFdroidAvailabilityChecker(delegate)\n\n        assertFalse(checker.isAvailable(\"com.test.app\")!!)\n    }\n\n    @Test\n    fun `returns null when delegate reports network error`() = runTest {\n        `when`(delegate.isAvailable(\"com.test.app\")).thenReturn(null)\n        val checker = CachedFdroidAvailabilityChecker(delegate)\n\n        assertNull(checker.isAvailable(\"com.test.app\"))\n    }\n\n    @Test\n    fun `does not cache network errors - retries delegate on next call`() = runTest {\n        `when`(delegate.isAvailable(\"com.test.app\"))\n            .thenReturn(null)\n            .thenReturn(true)\n        val checker = CachedFdroidAvailabilityChecker(delegate)\n\n        checker.isAvailable(\"com.test.app\")\n        val second = checker.isAvailable(\"com.test.app\")\n\n        verify(delegate, times(2)).isAvailable(\"com.test.app\")\n        assertTrue(second!!)\n    }\n\n    @Test\n    fun `caches true results - does not call delegate again`() = runTest {\n        `when`(delegate.isAvailable(\"com.test.app\")).thenReturn(true)\n        val checker = CachedFdroidAvailabilityChecker(delegate)\n\n        checker.isAvailable(\"com.test.app\")\n        checker.isAvailable(\"com.test.app\")\n\n        verify(delegate, times(1)).isAvailable(\"com.test.app\")\n    }\n\n    @Test\n    fun `caches false results - does not call delegate again`() = runTest {\n        `when`(delegate.isAvailable(\"com.test.app\")).thenReturn(false)\n        val checker = CachedFdroidAvailabilityChecker(delegate)\n\n        checker.isAvailable(\"com.test.app\")\n        checker.isAvailable(\"com.test.app\")\n\n        verify(delegate, times(1)).isAvailable(\"com.test.app\")\n    }\n}\n"
  },
  {
    "path": "data/src/test/java/com/klee/sapio/data/ConvertersTest.kt",
    "content": "package com.klee.sapio.data\n\nimport com.klee.sapio.data.local.Converters\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertNull\nimport org.junit.Test\nimport java.util.Date\n\nclass ConvertersTest {\n\n    private val converters = Converters()\n\n    @Test\n    fun `fromTimestamp returns null when value is null`() {\n        assertNull(converters.fromTimestamp(null))\n    }\n\n    @Test\n    fun `fromTimestamp returns correct Date for given timestamp`() {\n        val timestamp = 1700000000000L\n        val result = converters.fromTimestamp(timestamp)\n        assertEquals(Date(timestamp), result)\n    }\n\n    @Test\n    fun `fromTimestamp returns epoch date for zero`() {\n        val result = converters.fromTimestamp(0L)\n        assertEquals(Date(0), result)\n    }\n\n    @Test\n    fun `dateToTimestamp returns null when date is null`() {\n        assertNull(converters.dateToTimestamp(null))\n    }\n\n    @Test\n    fun `dateToTimestamp returns correct timestamp for given date`() {\n        val timestamp = 1700000000000L\n        val date = Date(timestamp)\n        assertEquals(timestamp, converters.dateToTimestamp(date))\n    }\n\n    @Test\n    fun `dateToTimestamp returns zero for epoch date`() {\n        assertEquals(0L, converters.dateToTimestamp(Date(0)))\n    }\n\n    @Test\n    fun `fromTimestamp and dateToTimestamp are inverse operations`() {\n        val timestamp = 1700000000000L\n        val date = converters.fromTimestamp(timestamp)\n        assertEquals(timestamp, converters.dateToTimestamp(date))\n    }\n}\n"
  },
  {
    "path": "data/src/test/java/com/klee/sapio/data/EvaluationRepositoryImplTest.kt",
    "content": "package com.klee.sapio.data\n\nimport android.content.Context\nimport android.os.Build\nimport org.robolectric.RuntimeEnvironment\nimport com.klee.sapio.data.api.EvaluationService\nimport com.klee.sapio.data.dto.Evaluation as DtoEvaluation\nimport com.klee.sapio.data.dto.IconAnswer\nimport com.klee.sapio.data.dto.StrapiElement\nimport com.klee.sapio.data.dto.UploadEvaluationHeader\nimport com.klee.sapio.data.local.EvaluationDao\nimport com.klee.sapio.data.local.EvaluationEntity\nimport com.klee.sapio.data.local.IconDao\nimport com.klee.sapio.data.local.IconEntity\nimport com.klee.sapio.data.repository.EvaluationRepositoryImpl\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertNull\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.annotation.Config\nimport java.util.Date\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = Config.NONE, sdk = [Build.VERSION_CODES.M])\nclass EvaluationRepositoryImplTest {\n\n    private lateinit var service: FakeEvaluationService\n    private lateinit var evaluationDao: FakeEvaluationDao\n    private lateinit var iconDao: FakeIconDao\n    private lateinit var repository: EvaluationRepositoryImpl\n\n    @Before\n    fun setUp() {\n        val context = RuntimeEnvironment.getApplication() as Context\n        service = FakeEvaluationService(context)\n        evaluationDao = FakeEvaluationDao()\n        iconDao = FakeIconDao()\n        repository = EvaluationRepositoryImpl(service, evaluationDao, iconDao)\n    }\n\n    // region listLatestEvaluations\n\n    @Test\n    fun `listLatestEvaluations returns remote data on success`() = runTest {\n        val dto = dtoEvaluation(name = \"App\", packageName = \"com.app\", iconUrl = \"http://icon.png\")\n        service.listLatestResult = Result.success(listOf(dto))\n\n        val result = repository.listLatestEvaluations(1)\n\n        assertTrue(result.isSuccess)\n        assertEquals(1, result.getOrNull()?.size)\n        assertEquals(\"App\", result.getOrNull()?.first()?.name)\n    }\n\n    @Test\n    fun `listLatestEvaluations caches remote data on success`() = runTest {\n        val dto = dtoEvaluation(name = \"App\", packageName = \"com.app\", iconUrl = \"http://icon.png\")\n        service.listLatestResult = Result.success(listOf(dto))\n\n        repository.listLatestEvaluations(1)\n\n        assertEquals(1, evaluationDao.upsertedItems.size)\n    }\n\n    @Test\n    fun `listLatestEvaluations returns cache on remote failure when cache is non-empty`() = runTest {\n        service.listLatestResult = Result.failure(RuntimeException(\"network error\"))\n        evaluationDao.listResult = listOf(evaluationEntity(name = \"Cached App\"))\n\n        val result = repository.listLatestEvaluations(1)\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"Cached App\", result.getOrNull()?.first()?.name)\n    }\n\n    @Test\n    fun `listLatestEvaluations returns failure on remote failure when cache is empty`() = runTest {\n        service.listLatestResult = Result.failure(RuntimeException(\"network error\"))\n        evaluationDao.listResult = emptyList()\n\n        val result = repository.listLatestEvaluations(1)\n\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun `listLatestEvaluations fetches missing icon url via enrichment`() = runTest {\n        val dto = dtoEvaluation(name = \"App\", packageName = \"com.app\", iconUrl = null)\n        service.listLatestResult = Result.success(listOf(dto))\n        service.existingIconResult = Result.success(listOf(iconAnswer(url = \"http://fallback.png\")))\n\n        val result = repository.listLatestEvaluations(1)\n\n        assertEquals(\"http://fallback.png\", result.getOrNull()?.first()?.iconUrl)\n    }\n\n    // endregion\n\n    // region searchEvaluations\n\n    @Test\n    fun `searchEvaluations returns remote data on success`() = runTest {\n        val dto = dtoEvaluation(name = \"Firefox\", packageName = \"org.mozilla.firefox\", iconUrl = \"http://icon.png\")\n        service.searchResult = Result.success(listOf(dto))\n\n        val result = repository.searchEvaluations(\"firefox\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"Firefox\", result.getOrNull()?.first()?.name)\n    }\n\n    @Test\n    fun `searchEvaluations caches remote results`() = runTest {\n        service.searchResult = Result.success(listOf(dtoEvaluation(iconUrl = \"http://icon.png\")))\n\n        repository.searchEvaluations(\"test\")\n\n        assertEquals(1, evaluationDao.upsertedItems.size)\n    }\n\n    @Test\n    fun `searchEvaluations returns cache on remote failure when cache is non-empty`() = runTest {\n        service.searchResult = Result.failure(RuntimeException())\n        evaluationDao.searchResult = listOf(evaluationEntity(name = \"Cached\"))\n\n        val result = repository.searchEvaluations(\"cached\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"Cached\", result.getOrNull()?.first()?.name)\n    }\n\n    @Test\n    fun `searchEvaluations returns failure on remote failure when cache is empty`() = runTest {\n        service.searchResult = Result.failure(RuntimeException())\n        evaluationDao.searchResult = emptyList()\n\n        val result = repository.searchEvaluations(\"nothing\")\n\n        assertTrue(result.isFailure)\n    }\n\n    // endregion\n\n    // region addEvaluation and updateEvaluation\n\n    @Test\n    fun `addEvaluation returns success when service succeeds`() = runTest {\n        service.addEvalResult = Result.success(Unit)\n\n        val result = repository.addEvaluation(domainUploadEvaluation())\n\n        assertTrue(result.isSuccess)\n    }\n\n    @Test\n    fun `addEvaluation returns failure when service fails`() = runTest {\n        service.addEvalResult = Result.failure(RuntimeException(\"server error\"))\n\n        val result = repository.addEvaluation(domainUploadEvaluation())\n\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun `updateEvaluation returns success when service succeeds`() = runTest {\n        service.updateEvalResult = Result.success(Unit)\n\n        val result = repository.updateEvaluation(domainUploadEvaluation(), id = 1)\n\n        assertTrue(result.isSuccess)\n    }\n\n    // endregion\n\n    // region fetchEvaluation\n\n    @Test\n    fun `fetchEvaluation returns evaluation when remote succeeds`() = runTest {\n        val dto = dtoEvaluation(name = \"App\", packageName = \"com.app\")\n        service.fetchEvalResult = Result.success(dto)\n\n        val result = repository.fetchEvaluation(\"com.app\", gmsType = 1, userType = 3)\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"App\", result.getOrNull()?.name)\n    }\n\n    @Test\n    fun `fetchEvaluation caches evaluation when remote succeeds`() = runTest {\n        service.fetchEvalResult = Result.success(dtoEvaluation())\n\n        repository.fetchEvaluation(\"com.app\", gmsType = 1, userType = 3)\n\n        assertEquals(1, evaluationDao.upsertedItems.size)\n    }\n\n    @Test\n    fun `fetchEvaluation returns null when remote returns null`() = runTest {\n        service.fetchEvalResult = Result.success(null)\n\n        val result = repository.fetchEvaluation(\"com.app\", gmsType = 1, userType = 3)\n\n        assertTrue(result.isSuccess)\n        assertNull(result.getOrNull())\n    }\n\n    @Test\n    fun `fetchEvaluation returns cache on remote failure when cached`() = runTest {\n        service.fetchEvalResult = Result.failure(RuntimeException())\n        evaluationDao.getEvaluationResult = evaluationEntity(name = \"Cached App\")\n\n        val result = repository.fetchEvaluation(\"com.app\", gmsType = 1, userType = 3)\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"Cached App\", result.getOrNull()?.name)\n    }\n\n    @Test\n    fun `fetchEvaluation returns failure when remote fails and cache is empty`() = runTest {\n        service.fetchEvalResult = Result.failure(RuntimeException())\n        evaluationDao.getEvaluationResult = null\n\n        val result = repository.fetchEvaluation(\"com.app\", gmsType = 1, userType = 3)\n\n        assertTrue(result.isFailure)\n    }\n\n    // endregion\n\n    // region uploadIcon\n\n    @Test\n    fun `uploadIcon returns icons from remote on success`() = runTest {\n        service.uploadIconResult = Result.success(listOf(iconAnswer(id = 5, url = \"http://icon.png\")))\n\n        val result = repository.uploadIcon(\"com.test.app\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(5, result.getOrNull()?.first()?.id)\n    }\n\n    @Test\n    fun `uploadIcon caches icons on remote success`() = runTest {\n        service.uploadIconResult = Result.success(listOf(iconAnswer()))\n\n        repository.uploadIcon(\"com.test.app\")\n\n        assertEquals(1, iconDao.upsertedItems.size)\n    }\n\n    @Test\n    fun `uploadIcon returns cached icons on remote failure`() = runTest {\n        service.uploadIconResult = Result.failure(RuntimeException())\n        iconDao.findByNameResult = listOf(iconEntity(id = 3, url = \"http://cached.png\"))\n\n        val result = repository.uploadIcon(\"com.test.app\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(3, result.getOrNull()?.first()?.id)\n    }\n\n    @Test\n    fun `uploadIcon returns failure when remote fails and cache is empty`() = runTest {\n        service.uploadIconResult = Result.failure(RuntimeException())\n        iconDao.findByNameResult = emptyList()\n\n        val result = repository.uploadIcon(\"com.test.app\")\n\n        assertTrue(result.isFailure)\n    }\n\n    // endregion\n\n    // region existingIcon\n\n    @Test\n    fun `existingIcon returns icons from remote on success`() = runTest {\n        service.existingIconResult = Result.success(listOf(iconAnswer(url = \"http://icon.png\")))\n\n        val result = repository.existingIcon(\"com.test.app.png\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"http://icon.png\", result.getOrNull()?.first()?.url)\n    }\n\n    @Test\n    fun `existingIcon caches icons on remote success`() = runTest {\n        service.existingIconResult = Result.success(listOf(iconAnswer()))\n\n        repository.existingIcon(\"com.test.app.png\")\n\n        assertEquals(1, iconDao.upsertedItems.size)\n    }\n\n    @Test\n    fun `existingIcon returns cache on remote failure`() = runTest {\n        service.existingIconResult = Result.failure(RuntimeException())\n        iconDao.findByNameResult = listOf(iconEntity(url = \"http://cached.png\"))\n\n        val result = repository.existingIcon(\"com.test.app.png\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"http://cached.png\", result.getOrNull()?.first()?.url)\n    }\n\n    @Test\n    fun `existingIcon returns failure when remote fails and cache is empty`() = runTest {\n        service.existingIconResult = Result.failure(RuntimeException())\n        iconDao.findByNameResult = emptyList()\n\n        val result = repository.existingIcon(\"com.test.app.png\")\n\n        assertTrue(result.isFailure)\n    }\n\n    // endregion\n\n    // region deleteIcon\n\n    @Test\n    fun `deleteIcon removes from local dao on remote success`() = runTest {\n        service.deleteIconResult = Result.success(Unit)\n\n        repository.deleteIcon(id = 10)\n\n        assertTrue(iconDao.deletedIds.contains(10))\n    }\n\n    @Test\n    fun `deleteIcon does not remove from local dao on remote failure`() = runTest {\n        service.deleteIconResult = Result.failure(RuntimeException())\n\n        repository.deleteIcon(id = 10)\n\n        assertTrue(iconDao.deletedIds.isEmpty())\n    }\n\n    @Test\n    fun `deleteIcon returns failure when remote fails`() = runTest {\n        service.deleteIconResult = Result.failure(RuntimeException(\"error\"))\n\n        val result = repository.deleteIcon(id = 10)\n\n        assertTrue(result.isFailure)\n    }\n\n    // endregion\n\n    // region helpers\n\n    private fun dtoEvaluation(\n        name: String = \"Test App\",\n        packageName: String = \"com.test.app\",\n        iconUrl: String? = null,\n        rating: Int = 1,\n        microg: Int = 1,\n        secure: Int = 3\n    ): DtoEvaluation {\n        val icon = iconUrl?.let {\n            val imageData = com.klee.sapio.data.dto.RemoteImage(\n                name = \"test.png\", alternativeText = null, caption = null,\n                width = 100, height = 100, formats = null,\n                hash = \"hash\", ext = \".png\", mime = \"image/png\",\n                size = 100, url = it, previewUrl = null,\n                provider = null, provider_metadata = null,\n                createdAt = Date(), updatedAt = Date()\n            )\n            com.klee.sapio.data.dto.Icon(com.klee.sapio.data.dto.StrapiImageElement(1, imageData))\n        }\n        return DtoEvaluation(\n            name = name, packageName = packageName, icon = icon,\n            rating = rating, microg = microg, secure = secure,\n            updatedAt = null, createdAt = null, publishedAt = null, versionName = null\n        )\n    }\n\n    private fun iconAnswer(\n        id: Int = 1,\n        name: String = \"com.test.app.png\",\n        url: String = \"http://icon/test.png\"\n    ) = IconAnswer(\n        id = id, name = name, url = url,\n        alternativeText = null, caption = null,\n        width = 100, height = 100, formats = null,\n        hash = \"hash\", ext = \".png\", mime = \"image/png\",\n        size = 100, previewUrl = null, provider = null,\n        provider_metadata = null, createdAt = Date(), updatedAt = Date()\n    )\n\n    private fun evaluationEntity(\n        name: String = \"Test App\",\n        packageName: String = \"com.test.app\",\n        microg: Int = 1,\n        secure: Int = 3\n    ) = EvaluationEntity(\n        name = name, packageName = packageName, iconUrl = null,\n        rating = 1, microg = microg, secure = secure,\n        updatedAt = null, createdAt = null, publishedAt = null,\n        versionName = null, cachedAt = 0L\n    )\n\n    private fun iconEntity(\n        id: Int = 1,\n        name: String = \"com.test.app.png\",\n        url: String = \"http://icon/test.png\"\n    ) = IconEntity(id = id, name = name, url = url, cachedAt = 0L)\n\n    private fun domainUploadEvaluation() = com.klee.sapio.domain.model.UploadEvaluation(\n        name = \"Test App\", packageName = \"com.test.app\", icon = 1,\n        rating = 1, microg = 1, rooted = 3\n    )\n\n    // endregion\n\n    // region fakes\n\n    private class FakeEvaluationService(context: Context) : EvaluationService(context) {\n        var listLatestResult: Result<List<DtoEvaluation>> = Result.success(emptyList())\n        var searchResult: Result<List<DtoEvaluation>> = Result.success(emptyList())\n        var addEvalResult: Result<Unit> = Result.success(Unit)\n        var updateEvalResult: Result<Unit> = Result.success(Unit)\n        var fetchEvalResult: Result<DtoEvaluation?> = Result.success(null)\n        var uploadIconResult: Result<List<IconAnswer>> = Result.success(emptyList())\n        var existingIconResult: Result<List<IconAnswer>> = Result.success(emptyList())\n        var deleteIconResult: Result<Unit> = Result.success(Unit)\n        var existingEvaluationsResult: Result<List<StrapiElement>> = Result.success(emptyList())\n\n        override suspend fun listLatestEvaluations(pageNumber: Int) = listLatestResult\n        override suspend fun searchEvaluation(pattern: String) = searchResult\n        override suspend fun addEvaluation(app: UploadEvaluationHeader) = addEvalResult\n        override suspend fun updateEvaluation(app: UploadEvaluationHeader, id: Int) = updateEvalResult\n        override suspend fun fetchEvaluation(appPackageName: String, microG: Int, rooted: Int) = fetchEvalResult\n        override suspend fun uploadIcon(packageName: String) = uploadIconResult\n        override suspend fun existingIcon(iconName: String) = existingIconResult\n        override suspend fun deleteIcon(id: Int) = deleteIconResult\n        override suspend fun existingEvaluations(packageName: String) = existingEvaluationsResult\n    }\n\n    private class FakeEvaluationDao : EvaluationDao {\n        var listResult: List<EvaluationEntity> = emptyList()\n        var searchResult: List<EvaluationEntity> = emptyList()\n        var getEvaluationResult: EvaluationEntity? = null\n        val upsertedItems = mutableListOf<EvaluationEntity>()\n\n        override suspend fun listLatestEvaluations(limit: Int, offset: Int) = listResult\n        override suspend fun searchEvaluations(pattern: String) = searchResult\n        override suspend fun getEvaluation(packageName: String, microg: Int, secure: Int) = getEvaluationResult\n        override suspend fun upsertAll(items: List<EvaluationEntity>) { upsertedItems.addAll(items) }\n    }\n\n    private class FakeIconDao : IconDao {\n        var findByNameResult: List<IconEntity> = emptyList()\n        val upsertedItems = mutableListOf<IconEntity>()\n        val deletedIds = mutableListOf<Int>()\n\n        override suspend fun findByName(iconName: String) = findByNameResult\n        override suspend fun upsertAll(items: List<IconEntity>) { upsertedItems.addAll(items) }\n        override suspend fun deleteById(id: Int) { deletedIds.add(id) }\n    }\n\n    // endregion\n}\n"
  },
  {
    "path": "data/src/test/java/com/klee/sapio/data/InstalledApplicationsRepositoryTest.kt",
    "content": "package com.klee.sapio.data\n\nimport android.content.pm.ApplicationInfo\nimport android.os.Build\nimport com.klee.sapio.data.repository.InstalledApplicationsRepository\nimport org.junit.Assert.assertFalse\nimport org.junit.Assert.assertTrue\nimport org.junit.Before\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.robolectric.RobolectricTestRunner\nimport org.robolectric.RuntimeEnvironment\nimport org.robolectric.annotation.Config\n\n@RunWith(RobolectricTestRunner::class)\n@Config(manifest = Config.NONE, sdk = [Build.VERSION_CODES.M])\nclass InstalledApplicationsRepositoryTest {\n\n    private lateinit var repository: InstalledApplicationsRepository\n\n    @Before\n    fun setUp() {\n        repository = InstalledApplicationsRepository(RuntimeEnvironment.getApplication())\n    }\n\n    @Test\n    fun `isSystemApp returns true when FLAG_SYSTEM is set`() {\n        val info = ApplicationInfo().apply { flags = ApplicationInfo.FLAG_SYSTEM }\n        assertTrue(repository.isSystemApp(info))\n    }\n\n    @Test\n    fun `isSystemApp returns false when FLAG_SYSTEM is not set`() {\n        val info = ApplicationInfo().apply { flags = 0 }\n        assertFalse(repository.isSystemApp(info))\n    }\n\n    @Test\n    fun `isSystemApp returns false for user-installed app with other flags`() {\n        val info = ApplicationInfo().apply { flags = ApplicationInfo.FLAG_INSTALLED }\n        assertFalse(repository.isSystemApp(info))\n    }\n\n    @Test\n    fun `isGmsRelated returns true for package ending with gms`() {\n        val info = ApplicationInfo().apply { packageName = \"com.google.android.gms\" }\n        assertTrue(repository.isGmsRelated(info))\n    }\n\n    @Test\n    fun `isGmsRelated returns true for com android vending`() {\n        val info = ApplicationInfo().apply { packageName = \"com.android.vending\" }\n        assertTrue(repository.isGmsRelated(info))\n    }\n\n    @Test\n    fun `isGmsRelated returns false for regular package`() {\n        val info = ApplicationInfo().apply { packageName = \"org.mozilla.firefox\" }\n        assertFalse(repository.isGmsRelated(info))\n    }\n\n    @Test\n    fun `isGmsRelated returns false for package that contains gms but does not end with it`() {\n        val info = ApplicationInfo().apply { packageName = \"com.google.gms.something\" }\n        assertFalse(repository.isGmsRelated(info))\n    }\n\n    @Test\n    fun `isGmsRelated returns false for empty package name`() {\n        val info = ApplicationInfo().apply { packageName = \"\" }\n        assertFalse(repository.isGmsRelated(info))\n    }\n}\n"
  },
  {
    "path": "detekt.yml",
    "content": "# Naming rules\nnaming:\n\n  ConstructorParameterNaming:\n    active: false\n\n  VariableNaming:\n    active: false\n\n  FunctionNaming:\n    active: true\n    ignoreAnnotated: ['Composable']\n\n  TopLevelPropertyNaming:\n    active: true\n    constantPattern: '[A-Z][A-Za-z0-9]*'\n\n# Style rules\nstyle:\n\n  ForbiddenComment:\n    active: false\n\n  ReturnCount:\n    excludeGuardClauses: true\n\n  MagicNumber:\n    active: true\n    ignorePropertyDeclaration: true\n    ignoreCompanionObjectPropertyDeclaration: true\n\n# Complexity rules\ncomplexity:\n\n  TooManyFunctions:\n    ignorePrivate: true\n\n  LongMethod:\n    ignoreAnnotated: ['Composable']\n"
  },
  {
    "path": "domain/build.gradle",
    "content": "plugins {\n    id 'org.jetbrains.kotlin.jvm'\n}\n\njava {\n    sourceCompatibility = JavaVersion.VERSION_17\n    targetCompatibility = JavaVersion.VERSION_17\n}\n\nkotlin {\n    jvmToolchain(17)\n}\n\ndependencies {\n    implementation libs.kotlinx.coroutines.android\n    implementation libs.javax.inject\n\n    testImplementation libs.junit\n    testImplementation libs.kotlinx.coroutines.test\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/AppSettings.kt",
    "content": "package com.klee.sapio.domain\n\ninterface AppSettings {\n    fun getUnsafeConfigurationLevel(): Int\n\n    fun isUnsafeConfigurationEnabled(): Boolean\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/CheckFdroidAvailabilityUseCase.kt",
    "content": "package com.klee.sapio.domain\n\nimport javax.inject.Inject\n\nopen class CheckFdroidAvailabilityUseCase @Inject constructor(\n    private val fdroidAvailabilityChecker: FdroidAvailabilityChecker\n) {\n    open suspend operator fun invoke(packageName: String): Boolean {\n        return fdroidAvailabilityChecker.isAvailable(packageName) ?: false\n    }\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/DeviceAppCacheRepository.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.CachedDeviceApp\n\ninterface DeviceAppCacheRepository {\n    suspend fun getAll(): List<CachedDeviceApp>\n\n    suspend fun replaceAll(items: List<CachedDeviceApp>)\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/DeviceInfo.kt",
    "content": "package com.klee.sapio.domain\n\ninterface DeviceInfo {\n    fun getGmsType(): Int\n    fun isUnsafe(): Int\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/EvaluateAppUseCase.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.withContext\nimport javax.inject.Inject\n\nopen class EvaluateAppUseCase @Inject constructor(\n    private val evaluationRepository: EvaluationRepository,\n    private val deviceInfo: DeviceInfo\n) {\n\n    open suspend operator fun invoke(\n        app: InstalledApplication,\n        rating: Int\n    ): Result<Unit> {\n        val existingIcons = getExistingIcons(app)\n        val uploadedIcons = uploadIcon(app)\n\n        return when {\n            uploadedIcons.isEmpty() ->\n                Result.failure(IllegalStateException(\"Failed to upload icon\"))\n            !submitEvaluation(app, uploadedIcons[0].id, rating) ->\n                Result.failure(IllegalStateException(\"Failed to add evaluation\"))\n            else -> {\n                existingIcons.forEach { deleteIcon(it.id) }\n                Result.success(Unit)\n            }\n        }\n    }\n\n    private suspend fun uploadIcon(app: InstalledApplication): List<Icon> {\n        return evaluationRepository.uploadIcon(app.packageName).getOrDefault(emptyList())\n    }\n\n    private suspend fun deleteIcon(id: Int) {\n        evaluationRepository.deleteIcon(id)\n    }\n\n    private suspend fun submitEvaluation(app: InstalledApplication, iconId: Int, rating: Int): Boolean {\n        val newEvaluation = UploadEvaluation(\n            app.name,\n            app.packageName,\n            iconId,\n            rating,\n            deviceInfo.getGmsType(),\n            deviceInfo.isUnsafe()\n        )\n\n        return evaluationRepository.addEvaluation(newEvaluation).isSuccess\n    }\n\n    private suspend fun getExistingIcons(app: InstalledApplication): List<Icon> {\n        return withContext(Dispatchers.IO) {\n            evaluationRepository.existingIcon(\"${app.packageName}.png\").getOrDefault(emptyList())\n        }\n    }\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/EvaluationRepository.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.UploadEvaluation\n\ninterface EvaluationRepository {\n\n    suspend fun listLatestEvaluations(pageNumber: Int): Result<List<Evaluation>>\n\n    suspend fun searchEvaluations(pattern: String): Result<List<Evaluation>>\n\n    suspend fun addEvaluation(evaluation: UploadEvaluation): Result<Unit>\n\n    suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int): Result<Unit>\n\n    suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int): Result<Evaluation?>\n\n    suspend fun existingEvaluations(packageName: String): Result<List<EvaluationRecord>>\n\n    suspend fun uploadIcon(packageName: String): Result<List<Icon>>\n\n    suspend fun existingIcon(iconName: String): Result<List<Icon>>\n\n    suspend fun deleteIcon(id: Int): Result<Unit>\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/FdroidAvailabilityChecker.kt",
    "content": "package com.klee.sapio.domain\n\ninterface FdroidAvailabilityChecker {\n    suspend fun isAvailable(packageName: String): Boolean?\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/FetchAppEvaluationUseCase.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Evaluation\nimport javax.inject.Inject\n\nopen class FetchAppEvaluationUseCase @Inject constructor(\n    private val evaluationRepository: EvaluationRepository\n) {\n\n    open suspend operator fun invoke(\n        packageName: String,\n        gmsType: Int,\n        userType: Int\n    ): Result<Evaluation?> {\n        return evaluationRepository.fetchEvaluation(packageName, gmsType, userType)\n    }\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/FetchIconUrlUseCase.kt",
    "content": "package com.klee.sapio.domain\n\nimport javax.inject.Inject\n\nopen class FetchIconUrlUseCase @Inject constructor(\n    private val evaluationRepository: EvaluationRepository\n) {\n\n    open suspend operator fun invoke(packageName: String): Result<String> {\n        return evaluationRepository.existingIcon(\"$packageName.png\")\n            .map { icons -> icons.firstOrNull()?.url.orEmpty() }\n    }\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/InstalledApplicationsDataSource.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.InstalledApplication\n\ninterface InstalledApplicationsDataSource {\n    fun listInstalledApplications(): List<InstalledApplication>\n\n    fun getInstalledApplication(packageName: String): InstalledApplication?\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/ListLatestEvaluationsUseCase.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Evaluation\nimport javax.inject.Inject\n\nopen class ListLatestEvaluationsUseCase @Inject constructor(\n    private val evaluationRepository: EvaluationRepository\n) {\n\n    open suspend operator fun invoke(pageNumber: Int): Result<List<Evaluation>> {\n        return evaluationRepository.listLatestEvaluations(pageNumber)\n    }\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/SearchEvaluationUseCase.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Evaluation\nimport javax.inject.Inject\n\nopen class SearchEvaluationUseCase @Inject constructor(\n    private val evaluationRepository: EvaluationRepository\n) {\n\n    open suspend operator fun invoke(pattern: String): Result<List<Evaluation>> {\n        return evaluationRepository.searchEvaluations(pattern)\n    }\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/model/CachedDeviceApp.kt",
    "content": "package com.klee.sapio.domain.model\n\ndata class CachedDeviceApp(\n    val packageName: String,\n    val rating: Int?,\n    val cachedAt: Long\n)\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/model/DeviceProfile.kt",
    "content": "package com.klee.sapio.domain.model\n\nobject GmsType {\n    const val MICROG = 1\n    const val BARE_AOSP = 2\n    const val GOOGLE_PLAY_SERVICES = 3\n}\n\nobject UserType {\n    const val SECURE = 3\n    const val UNSAFE = 4\n}\n"
  },
  {
    "path": "domain/src/main/java/com/klee/sapio/domain/model/Models.kt",
    "content": "package com.klee.sapio.domain.model\n\nimport java.util.Date\n\ndata class Evaluation(\n    val name: String,\n    val packageName: String,\n    val iconUrl: String?,\n    val rating: Int,\n    val microg: Int,\n    val secure: Int,\n    val updatedAt: Date?,\n    val createdAt: Date?,\n    val publishedAt: Date?,\n    val versionName: String?\n)\n\ndata class UploadEvaluation(\n    val name: String,\n    val packageName: String,\n    val icon: Int?,\n    val rating: Int,\n    val microg: Int,\n    val rooted: Int\n)\n\ndata class Icon(\n    val id: Int,\n    val name: String,\n    val url: String\n)\n\ndata class EvaluationRecord(\n    val id: Int,\n    val evaluation: Evaluation\n)\n\ndata class InstalledApplication(\n    val name: String,\n    val packageName: String\n)\n\nobject EvaluationRating {\n    const val GOOD = 1\n    const val AVERAGE = 2\n    const val BAD = 3\n}\n"
  },
  {
    "path": "domain/src/test/java/com/klee/sapio/domain/CheckFdroidAvailabilityUseCaseTest.kt",
    "content": "package com.klee.sapio.domain\n\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertFalse\nimport org.junit.Assert.assertTrue\nimport org.junit.Test\n\nclass CheckFdroidAvailabilityUseCaseTest {\n\n    @Test\n    fun `returns true when checker reports available`() = runTest {\n        val useCase = CheckFdroidAvailabilityUseCase(FakeFdroidChecker(available = true))\n\n        assertTrue(useCase(\"com.test.app\"))\n    }\n\n    @Test\n    fun `returns false when checker reports unavailable`() = runTest {\n        val useCase = CheckFdroidAvailabilityUseCase(FakeFdroidChecker(available = false))\n\n        assertFalse(useCase(\"com.test.app\"))\n    }\n\n    @Test\n    fun `returns false when checker reports network error`() = runTest {\n        val useCase = CheckFdroidAvailabilityUseCase(FakeFdroidChecker(available = null))\n\n        assertFalse(useCase(\"com.test.app\"))\n    }\n\n    @Test\n    fun `passes package name to checker`() = runTest {\n        val checker = RecordingFdroidChecker()\n        val useCase = CheckFdroidAvailabilityUseCase(checker)\n\n        useCase(\"org.mozilla.firefox\")\n\n        assertTrue(checker.lastCheckedPackage == \"org.mozilla.firefox\")\n    }\n\n    private class FakeFdroidChecker(private val available: Boolean?) : FdroidAvailabilityChecker {\n        override suspend fun isAvailable(packageName: String) = available\n    }\n\n    private class RecordingFdroidChecker : FdroidAvailabilityChecker {\n        var lastCheckedPackage: String = \"\"\n        override suspend fun isAvailable(packageName: String): Boolean? {\n            lastCheckedPackage = packageName\n            return false\n        }\n    }\n}\n"
  },
  {
    "path": "domain/src/test/java/com/klee/sapio/domain/EvaluateAppUseCaseTest.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.InstalledApplication\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertFalse\nimport org.junit.Assert.assertTrue\nimport org.junit.Test\n\nclass EvaluateAppUseCaseTest {\n\n    private val app = InstalledApplication(name = \"Test App\", packageName = \"com.test.app\")\n    private val icon = Icon(id = 42, name = \"com.test.app.png\", url = \"http://icon/test.png\")\n    private val existingIcon = Icon(id = 7, name = \"com.test.app.png\", url = \"http://icon/old.png\")\n\n    @Test\n    fun `returns failure when icon upload returns empty list`() = runTest {\n        val repo = fakeRepo(uploadIconResult = Result.success(emptyList()))\n        val useCase = EvaluateAppUseCase(repo, FakeDeviceInfo())\n\n        val result = useCase(app, rating = 1)\n\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun `returns failure when icon upload fails`() = runTest {\n        val repo = fakeRepo(uploadIconResult = Result.failure(RuntimeException(\"network error\")))\n        val useCase = EvaluateAppUseCase(repo, FakeDeviceInfo())\n\n        val result = useCase(app, rating = 1)\n\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun `returns failure when add evaluation fails`() = runTest {\n        val repo = fakeRepo(\n            uploadIconResult = Result.success(listOf(icon)),\n            addEvaluationResult = Result.failure(RuntimeException(\"server error\"))\n        )\n        val useCase = EvaluateAppUseCase(repo, FakeDeviceInfo())\n\n        val result = useCase(app, rating = 1)\n\n        assertTrue(result.isFailure)\n    }\n\n    @Test\n    fun `returns success when upload and evaluation succeed`() = runTest {\n        val repo = fakeRepo(\n            uploadIconResult = Result.success(listOf(icon)),\n            addEvaluationResult = Result.success(Unit)\n        )\n        val useCase = EvaluateAppUseCase(repo, FakeDeviceInfo())\n\n        val result = useCase(app, rating = 1)\n\n        assertTrue(result.isSuccess)\n    }\n\n    @Test\n    fun `deletes existing icons on success`() = runTest {\n        val repo = fakeRepo(\n            uploadIconResult = Result.success(listOf(icon)),\n            addEvaluationResult = Result.success(Unit),\n            existingIconResult = Result.success(listOf(existingIcon))\n        )\n        val useCase = EvaluateAppUseCase(repo, FakeDeviceInfo())\n\n        useCase(app, rating = 1)\n\n        assertTrue(repo.deletedIconIds.contains(existingIcon.id))\n    }\n\n    @Test\n    fun `does not fail when there are no existing icons to delete`() = runTest {\n        val repo = fakeRepo(\n            uploadIconResult = Result.success(listOf(icon)),\n            addEvaluationResult = Result.success(Unit),\n            existingIconResult = Result.success(emptyList())\n        )\n        val useCase = EvaluateAppUseCase(repo, FakeDeviceInfo())\n\n        val result = useCase(app, rating = 1)\n\n        assertTrue(result.isSuccess)\n        assertTrue(repo.deletedIconIds.isEmpty())\n    }\n\n    @Test\n    fun `does not delete icons when evaluation fails`() = runTest {\n        val repo = fakeRepo(\n            uploadIconResult = Result.success(listOf(icon)),\n            addEvaluationResult = Result.failure(RuntimeException()),\n            existingIconResult = Result.success(listOf(existingIcon))\n        )\n        val useCase = EvaluateAppUseCase(repo, FakeDeviceInfo())\n\n        useCase(app, rating = 1)\n\n        assertFalse(repo.deletedIconIds.contains(existingIcon.id))\n    }\n\n    @Test\n    fun `uses device gmsType and userType when building evaluation`() = runTest {\n        val deviceInfo = FakeDeviceInfo(gmsType = 2, userType = 4)\n        val repo = fakeRepo(\n            uploadIconResult = Result.success(listOf(icon)),\n            addEvaluationResult = Result.success(Unit)\n        )\n        val useCase = EvaluateAppUseCase(repo, deviceInfo)\n\n        useCase(app, rating = 1)\n\n        val submitted = repo.lastSubmittedEvaluation\n        assertTrue(submitted?.microg == 2)\n        assertTrue(submitted?.rooted == 4)\n    }\n\n    private fun fakeRepo(\n        uploadIconResult: Result<List<Icon>> = Result.success(listOf(icon)),\n        addEvaluationResult: Result<Unit> = Result.success(Unit),\n        existingIconResult: Result<List<Icon>> = Result.success(emptyList())\n    ) = FakeEvaluationRepository(\n        uploadIconResult = uploadIconResult,\n        addEvaluationResult = addEvaluationResult,\n        existingIconResult = existingIconResult\n    )\n\n    private class FakeEvaluationRepository(\n        private val uploadIconResult: Result<List<Icon>>,\n        private val addEvaluationResult: Result<Unit>,\n        private val existingIconResult: Result<List<Icon>>\n    ) : EvaluationRepository {\n        val deletedIconIds = mutableListOf<Int>()\n        var lastSubmittedEvaluation: UploadEvaluation? = null\n\n        override suspend fun uploadIcon(packageName: String) = uploadIconResult\n        override suspend fun existingIcon(iconName: String) = existingIconResult\n        override suspend fun addEvaluation(evaluation: UploadEvaluation): Result<Unit> {\n            lastSubmittedEvaluation = evaluation\n            return addEvaluationResult\n        }\n        override suspend fun deleteIcon(id: Int): Result<Unit> {\n            deletedIconIds.add(id)\n            return Result.success(Unit)\n        }\n        override suspend fun listLatestEvaluations(pageNumber: Int) = Result.success(emptyList<Evaluation>())\n        override suspend fun searchEvaluations(pattern: String) = Result.success(emptyList<Evaluation>())\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int) = Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int) = Result.success(null)\n        override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<EvaluationRecord>())\n    }\n\n    private class FakeDeviceInfo(\n        private val gmsType: Int = 1,\n        private val userType: Int = 3\n    ) : DeviceInfo {\n        override fun getGmsType() = gmsType\n        override fun isUnsafe() = userType\n    }\n}\n"
  },
  {
    "path": "domain/src/test/java/com/klee/sapio/domain/FetchAppEvaluationUseCaseTest.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertNull\nimport org.junit.Assert.assertTrue\nimport org.junit.Test\nimport java.util.Date\n\nclass FetchAppEvaluationUseCaseTest {\n\n    @Test\n    fun `returns evaluation when found`() = runTest {\n        val evaluation = evaluation()\n        val useCase = FetchAppEvaluationUseCase(fakeRepo(Result.success(evaluation)))\n\n        val result = useCase(\"com.test.app\", gmsType = 1, userType = 3)\n\n        assertTrue(result.isSuccess)\n        assertEquals(evaluation, result.getOrNull())\n    }\n\n    @Test\n    fun `returns null when not found`() = runTest {\n        val useCase = FetchAppEvaluationUseCase(fakeRepo(Result.success(null)))\n\n        val result = useCase(\"com.test.app\", gmsType = 1, userType = 3)\n\n        assertTrue(result.isSuccess)\n        assertNull(result.getOrNull())\n    }\n\n    @Test\n    fun `propagates failure from repository`() = runTest {\n        val error = RuntimeException(\"network error\")\n        val useCase = FetchAppEvaluationUseCase(fakeRepo(Result.failure(error)))\n\n        val result = useCase(\"com.test.app\", gmsType = 1, userType = 3)\n\n        assertTrue(result.isFailure)\n        assertEquals(error, result.exceptionOrNull())\n    }\n\n    @Test\n    fun `passes correct arguments to repository`() = runTest {\n        val repo = RecordingFakeRepo()\n        val useCase = FetchAppEvaluationUseCase(repo)\n\n        useCase(\"com.test.app\", gmsType = 2, userType = 4)\n\n        assertEquals(\"com.test.app\", repo.lastPackageName)\n        assertEquals(2, repo.lastGmsType)\n        assertEquals(4, repo.lastUserType)\n    }\n\n    private fun fakeRepo(result: Result<Evaluation?>) = object : EvaluationRepository {\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int) = result\n        override suspend fun listLatestEvaluations(pageNumber: Int) = Result.success(emptyList<Evaluation>())\n        override suspend fun searchEvaluations(pattern: String) = Result.success(emptyList<Evaluation>())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation) = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int) = Result.success(Unit)\n        override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<EvaluationRecord>())\n        override suspend fun uploadIcon(packageName: String) = Result.success(emptyList<Icon>())\n        override suspend fun existingIcon(iconName: String) = Result.success(emptyList<Icon>())\n        override suspend fun deleteIcon(id: Int) = Result.success(Unit)\n    }\n\n    private class RecordingFakeRepo : EvaluationRepository {\n        var lastPackageName: String = \"\"\n        var lastGmsType: Int = -1\n        var lastUserType: Int = -1\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int): Result<Evaluation?> {\n            lastPackageName = appPackageName\n            lastGmsType = gmsType\n            lastUserType = userType\n            return Result.success(null)\n        }\n        override suspend fun listLatestEvaluations(pageNumber: Int) = Result.success(emptyList<Evaluation>())\n        override suspend fun searchEvaluations(pattern: String) = Result.success(emptyList<Evaluation>())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation) = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int) = Result.success(Unit)\n        override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<EvaluationRecord>())\n        override suspend fun uploadIcon(packageName: String) = Result.success(emptyList<Icon>())\n        override suspend fun existingIcon(iconName: String) = Result.success(emptyList<Icon>())\n        override suspend fun deleteIcon(id: Int) = Result.success(Unit)\n    }\n\n    private fun evaluation() = Evaluation(\n        name = \"Test App\", packageName = \"com.test.app\", iconUrl = null,\n        rating = 1, microg = 1, secure = 3,\n        updatedAt = Date(), createdAt = Date(), publishedAt = null, versionName = null\n    )\n}\n"
  },
  {
    "path": "domain/src/test/java/com/klee/sapio/domain/FetchIconUrlUseCaseTest.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertTrue\nimport org.junit.Test\n\nclass FetchIconUrlUseCaseTest {\n\n    @Test\n    fun `returns url of first icon when found`() = runTest {\n        val icon = Icon(id = 1, name = \"com.test.app.png\", url = \"http://icon/test.png\")\n        val useCase = FetchIconUrlUseCase(fakeRepo(Result.success(listOf(icon))))\n\n        val result = useCase(\"com.test.app\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"http://icon/test.png\", result.getOrNull())\n    }\n\n    @Test\n    fun `returns empty string when icon list is empty`() = runTest {\n        val useCase = FetchIconUrlUseCase(fakeRepo(Result.success(emptyList())))\n\n        val result = useCase(\"com.test.app\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(\"\", result.getOrNull())\n    }\n\n    @Test\n    fun `appends png extension when querying`() = runTest {\n        val repo = RecordingFakeRepo()\n        val useCase = FetchIconUrlUseCase(repo)\n\n        useCase(\"com.test.app\")\n\n        assertEquals(\"com.test.app.png\", repo.lastIconName)\n    }\n\n    @Test\n    fun `returns url of first icon when multiple icons exist`() = runTest {\n        val icons = listOf(\n            Icon(id = 1, name = \"com.test.app.png\", url = \"http://icon/first.png\"),\n            Icon(id = 2, name = \"com.test.app.png\", url = \"http://icon/second.png\")\n        )\n        val useCase = FetchIconUrlUseCase(fakeRepo(Result.success(icons)))\n\n        val result = useCase(\"com.test.app\")\n\n        assertEquals(\"http://icon/first.png\", result.getOrNull())\n    }\n\n    @Test\n    fun `propagates failure from repository`() = runTest {\n        val error = RuntimeException(\"network error\")\n        val useCase = FetchIconUrlUseCase(fakeRepo(Result.failure(error)))\n\n        val result = useCase(\"com.test.app\")\n\n        assertTrue(result.isFailure)\n    }\n\n    private fun fakeRepo(result: Result<List<Icon>>) = object : EvaluationRepository {\n        override suspend fun existingIcon(iconName: String) = result\n        override suspend fun listLatestEvaluations(pageNumber: Int) = Result.success(emptyList<Evaluation>())\n        override suspend fun searchEvaluations(pattern: String) = Result.success(emptyList<Evaluation>())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation) = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int) = Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int) = Result.success(null)\n        override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<EvaluationRecord>())\n        override suspend fun uploadIcon(packageName: String) = Result.success(emptyList<Icon>())\n        override suspend fun deleteIcon(id: Int) = Result.success(Unit)\n    }\n\n    private class RecordingFakeRepo : EvaluationRepository {\n        var lastIconName: String = \"\"\n        override suspend fun existingIcon(iconName: String): Result<List<Icon>> {\n            lastIconName = iconName\n            return Result.success(emptyList())\n        }\n        override suspend fun listLatestEvaluations(pageNumber: Int) = Result.success(emptyList<Evaluation>())\n        override suspend fun searchEvaluations(pattern: String) = Result.success(emptyList<Evaluation>())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation) = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int) = Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int) = Result.success(null)\n        override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<EvaluationRecord>())\n        override suspend fun uploadIcon(packageName: String) = Result.success(emptyList<Icon>())\n        override suspend fun deleteIcon(id: Int) = Result.success(Unit)\n    }\n}\n"
  },
  {
    "path": "domain/src/test/java/com/klee/sapio/domain/ListLatestEvaluationsUseCaseTest.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertTrue\nimport org.junit.Test\nimport java.util.Date\n\nclass ListLatestEvaluationsUseCaseTest {\n\n    @Test\n    fun `returns list from repository on success`() = runTest {\n        val evaluations = listOf(\n            evaluation(name = \"App A\", packageName = \"com.a\"),\n            evaluation(name = \"App B\", packageName = \"com.b\")\n        )\n        val useCase = ListLatestEvaluationsUseCase(fakeRepo(Result.success(evaluations)))\n\n        val result = useCase(pageNumber = 1)\n\n        assertTrue(result.isSuccess)\n        assertEquals(evaluations, result.getOrNull())\n    }\n\n    @Test\n    fun `returns empty list when repository returns empty`() = runTest {\n        val useCase = ListLatestEvaluationsUseCase(fakeRepo(Result.success(emptyList())))\n\n        val result = useCase(pageNumber = 1)\n\n        assertTrue(result.isSuccess)\n        assertEquals(emptyList<Evaluation>(), result.getOrNull())\n    }\n\n    @Test\n    fun `propagates failure from repository`() = runTest {\n        val error = RuntimeException(\"network error\")\n        val useCase = ListLatestEvaluationsUseCase(fakeRepo(Result.failure(error)))\n\n        val result = useCase(pageNumber = 1)\n\n        assertTrue(result.isFailure)\n        assertEquals(error, result.exceptionOrNull())\n    }\n\n    @Test\n    fun `passes page number to repository`() = runTest {\n        val repo = RecordingFakeRepo()\n        val useCase = ListLatestEvaluationsUseCase(repo)\n\n        useCase(pageNumber = 3)\n\n        assertEquals(3, repo.lastPageNumber)\n    }\n\n    private fun fakeRepo(result: Result<List<Evaluation>>) = object : EvaluationRepository {\n        override suspend fun listLatestEvaluations(pageNumber: Int) = result\n        override suspend fun searchEvaluations(pattern: String) = Result.success(emptyList<Evaluation>())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation) = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int) = Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int) = Result.success(null)\n        override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<EvaluationRecord>())\n        override suspend fun uploadIcon(packageName: String) = Result.success(emptyList<Icon>())\n        override suspend fun existingIcon(iconName: String) = Result.success(emptyList<Icon>())\n        override suspend fun deleteIcon(id: Int) = Result.success(Unit)\n    }\n\n    private class RecordingFakeRepo : EvaluationRepository {\n        var lastPageNumber: Int = -1\n        override suspend fun listLatestEvaluations(pageNumber: Int): Result<List<Evaluation>> {\n            lastPageNumber = pageNumber\n            return Result.success(emptyList())\n        }\n        override suspend fun searchEvaluations(pattern: String) = Result.success(emptyList<Evaluation>())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation) = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int) = Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int) = Result.success(null)\n        override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<EvaluationRecord>())\n        override suspend fun uploadIcon(packageName: String) = Result.success(emptyList<Icon>())\n        override suspend fun existingIcon(iconName: String) = Result.success(emptyList<Icon>())\n        override suspend fun deleteIcon(id: Int) = Result.success(Unit)\n    }\n\n    private fun evaluation(name: String = \"App\", packageName: String = \"com.app\") = Evaluation(\n        name = name, packageName = packageName, iconUrl = null,\n        rating = 1, microg = 1, secure = 3,\n        updatedAt = Date(), createdAt = Date(), publishedAt = null, versionName = null\n    )\n}\n"
  },
  {
    "path": "domain/src/test/java/com/klee/sapio/domain/SearchEvaluationUseCaseTest.kt",
    "content": "package com.klee.sapio.domain\n\nimport com.klee.sapio.domain.model.Evaluation\nimport com.klee.sapio.domain.model.EvaluationRecord\nimport com.klee.sapio.domain.model.Icon\nimport com.klee.sapio.domain.model.UploadEvaluation\nimport kotlinx.coroutines.test.runTest\nimport org.junit.Assert.assertEquals\nimport org.junit.Assert.assertTrue\nimport org.junit.Test\nimport java.util.Date\n\nclass SearchEvaluationUseCaseTest {\n\n    @Test\n    fun `returns list from repository on success`() = runTest {\n        val evaluations = listOf(evaluation(\"App A\"), evaluation(\"App B\"))\n        val useCase = SearchEvaluationUseCase(fakeRepo(Result.success(evaluations)))\n\n        val result = useCase(\"app\")\n\n        assertTrue(result.isSuccess)\n        assertEquals(evaluations, result.getOrNull())\n    }\n\n    @Test\n    fun `returns empty list when no results`() = runTest {\n        val useCase = SearchEvaluationUseCase(fakeRepo(Result.success(emptyList())))\n\n        val result = useCase(\"unknown\")\n\n        assertTrue(result.isSuccess)\n        assertTrue(result.getOrNull()!!.isEmpty())\n    }\n\n    @Test\n    fun `propagates failure from repository`() = runTest {\n        val error = RuntimeException(\"network error\")\n        val useCase = SearchEvaluationUseCase(fakeRepo(Result.failure(error)))\n\n        val result = useCase(\"app\")\n\n        assertTrue(result.isFailure)\n        assertEquals(error, result.exceptionOrNull())\n    }\n\n    @Test\n    fun `passes pattern to repository`() = runTest {\n        val repo = RecordingFakeRepo()\n        val useCase = SearchEvaluationUseCase(repo)\n\n        useCase(\"firefox\")\n\n        assertEquals(\"firefox\", repo.lastPattern)\n    }\n\n    private fun fakeRepo(result: Result<List<Evaluation>>) = object : EvaluationRepository {\n        override suspend fun searchEvaluations(pattern: String) = result\n        override suspend fun listLatestEvaluations(pageNumber: Int) = Result.success(emptyList<Evaluation>())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation) = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int) = Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int) = Result.success(null)\n        override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<EvaluationRecord>())\n        override suspend fun uploadIcon(packageName: String) = Result.success(emptyList<Icon>())\n        override suspend fun existingIcon(iconName: String) = Result.success(emptyList<Icon>())\n        override suspend fun deleteIcon(id: Int) = Result.success(Unit)\n    }\n\n    private class RecordingFakeRepo : EvaluationRepository {\n        var lastPattern: String = \"\"\n        override suspend fun searchEvaluations(pattern: String): Result<List<Evaluation>> {\n            lastPattern = pattern\n            return Result.success(emptyList())\n        }\n        override suspend fun listLatestEvaluations(pageNumber: Int) = Result.success(emptyList<Evaluation>())\n        override suspend fun addEvaluation(evaluation: UploadEvaluation) = Result.success(Unit)\n        override suspend fun updateEvaluation(evaluation: UploadEvaluation, id: Int) = Result.success(Unit)\n        override suspend fun fetchEvaluation(appPackageName: String, gmsType: Int, userType: Int) = Result.success(null)\n        override suspend fun existingEvaluations(packageName: String) = Result.success(emptyList<EvaluationRecord>())\n        override suspend fun uploadIcon(packageName: String) = Result.success(emptyList<Icon>())\n        override suspend fun existingIcon(iconName: String) = Result.success(emptyList<Icon>())\n        override suspend fun deleteIcon(id: Int) = Result.success(Unit)\n    }\n\n    private fun evaluation(name: String = \"App\") = Evaluation(\n        name = name, packageName = \"com.${name.lowercase()}\", iconUrl = null,\n        rating = 1, microg = 1, secure = 3,\n        updatedAt = Date(), createdAt = null, publishedAt = null, versionName = null\n    )\n}\n"
  },
  {
    "path": "fastlane/metadata/android/de-DE/full_description.txt",
    "content": "Sapio ist das Anagramm von Open Source API.\n\nSapio bietet die Kompatibilität einer Android-Anwendung auf einem Gerät ohne Google Play Services (d.h. de-gegoogelte Android Open Source Project (AOSP)-Geräte, mit oder ohne microG).\n\nSapio kann als Lobbying-Tool dienen, indem Kompatibilitätsinformationen in sozialen Medien geteilt werden, um App-Entwickler für den Schutz persönlicher Daten zu sensibilisieren.\n\nBewertungen in Sapio werden von der Community für die Community gegeben.\n"
  },
  {
    "path": "fastlane/metadata/android/de-DE/short_description.txt",
    "content": "Android Open Source API Kompatibilität\n"
  },
  {
    "path": "fastlane/metadata/android/de-DE/title.txt",
    "content": "Sapio\n"
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/4.txt",
    "content": "Get rid of old backend for Fdroid publication.\n"
  },
  {
    "path": "fastlane/metadata/android/en-US/full_description.txt",
    "content": "Sapio is the anagram of Open Source API.\n\nSapio provides the compatibility of an Android application running on a device without Google Play Services (i.e with deGoogled bare Android Open Source Project (AOSP) devices, coupled or not with microG).\n\nSapio can serve as a lobbying tool by sharing compatibility on social media to raise awareness among app developers about respecting users' personal data.\n\nEvaluations in Sapio are given to the community by the community.\n"
  },
  {
    "path": "fastlane/metadata/android/en-US/short_description.txt",
    "content": "Android Open Source API compatibility\n"
  },
  {
    "path": "fastlane/metadata/android/en-US/title.txt",
    "content": "Sapio\n"
  },
  {
    "path": "fastlane/metadata/android/es-ES/full_description.txt",
    "content": "Sapio es el anagrama de Open Source API.\n\nSapio proporciona la compatibilidad de una aplicación Android en un dispositivo sin Google Play Services (es decir, dispositivos Android Open Source Project (AOSP) desgoogleados, con o sin microG).\n\nSapio puede servir como herramienta de presión compartiendo la compatibilidad en redes sociales para concienciar a los desarrolladores de apps sobre el respeto de los datos personales de los usuarios.\n\nLas evaluaciones en Sapio son dadas a la comunidad por la comunidad.\n"
  },
  {
    "path": "fastlane/metadata/android/es-ES/short_description.txt",
    "content": "Compatibilidad de apps Android de código abierto\n"
  },
  {
    "path": "fastlane/metadata/android/es-ES/title.txt",
    "content": "Sapio\n"
  },
  {
    "path": "fastlane/metadata/android/fr-FR/full_description.txt",
    "content": "Sapio est l'anagramme d'API Open Source.\n\nSapio fournit la compatibilité d'une application Android sur un appareil sans Google Play Services (i.e. les appareils fonctionnant sur un Android Open Source Project (AOSP) pure déGooglisé, associés ou non à microG.\n\nSapio peut être utilisé comme un outil de lobbying en partageant la compatibilité sur les réseaux sociaux pour sensibiliser les développeurs d'applications aux données personnelles des utilisateurs.\n\nLes évaluations de Sapio sont fournies à la communauté par la communauté.\n"
  },
  {
    "path": "fastlane/metadata/android/fr-FR/short_description.txt",
    "content": "Compatibilité avec les API Android Open Source.\n"
  },
  {
    "path": "fastlane/metadata/android/it-IT/full_description.txt",
    "content": "Sapio è l'anagramma di Open Source API.\n\nSapio fornisce la compatibilità di un'applicazione Android su un dispositivo senza Google Play Services (es. dispositivi Android Open Source Project (AOSP) de-googlizzati, con o senza microG).\n\nSapio può essere usato come strumento di lobbying condividendo la compatibilità sui social media per sensibilizzare gli sviluppatori di app sul rispetto dei dati personali degli utenti.\n\nLe valutazioni in Sapio sono date alla comunità dalla comunità.\n"
  },
  {
    "path": "fastlane/metadata/android/it-IT/short_description.txt",
    "content": "Compatibilità delle app Android Open Source\n"
  },
  {
    "path": "fastlane/metadata/android/it-IT/title.txt",
    "content": "Sapio\n"
  },
  {
    "path": "gradle/libs.versions.toml",
    "content": "[versions]\nactivityCompose = \"1.11.0\"\nappcompat = \"1.7.0\"\ncircleimageview = \"3.1.0\"\ncoilCompose = \"3.3.0\"\ncoilNetworkOkhttp = \"3.3.0\"\ncomposeBom = \"2025.09.01\"\nconstraintlayout = \"2.2.0\"\ncoreKtx = \"1.15.0\"\ncoreSplashscreen = \"1.0.1\"\ndetekt = \"1.23.8\"\nemoji2 = \"1.3.0\"\nespressoCore = \"3.6.1\"\nglide = \"5.0.5\"\nhiltAndroid = \"2.54\"\nhiltAndroidTesting = \"2.38.1\"\njunit = \"4.13.2\"\njunitVersion = \"1.2.1\"\nkotlin = \"2.0.0\"\nkotlinxCoroutinesAndroid = \"1.10.1\"\nktorClientCore = \"3.0.3\"\nloggingInterceptor = \"4.11.0\"\nmaterial = \"1.9.0\"\nmockitoAndroid = \"2.24.5\"\nmockitoCore = \"4.3.1\"\nmockitoInline = \"4.3.1\"\nnavigationFragmentKtx = \"2.8.5\"\nnavigationUiKtx = \"2.5.3\"\npreferenceKtx = \"1.2.1\"\nrecyclerview = \"1.3.0\"\nretrofit = \"2.11.0\"\nretrofit2KotlinCoroutinesAdapter = \"0.9.2\"\nrobolectric = \"4.14.1\"\nrootbeerLib = \"0.1.1\"\nrunner = \"1.6.2\"\nswiperefreshlayout = \"1.1.0\"\nlottie = \"6.4.0\"\nmaterial3AndroidVersion = \"1.4.0\"\narchCoreTesting = \"2.2.0\"\nroom = \"2.7.0-rc01\"\nwork = \"2.9.0\"\n\n[libraries]\nandroidx-activity-compose = { module = \"androidx.activity:activity-compose\", version.ref = \"activityCompose\" }\nandroidx-appcompat = { module = \"androidx.appcompat:appcompat\", version.ref = \"appcompat\" }\nandroidx-compose-bom = { module = \"androidx.compose:compose-bom\", version.ref = \"composeBom\" }\nandroidx-constraintlayout = { module = \"androidx.constraintlayout:constraintlayout\", version.ref = \"constraintlayout\" }\nandroidx-core-ktx = { module = \"androidx.core:core-ktx\", version.ref = \"coreKtx\" }\nandroidx-core-splashscreen = { module = \"androidx.core:core-splashscreen\", version.ref = \"coreSplashscreen\" }\nandroidx-emoji2 = { module = \"androidx.emoji2:emoji2\", version.ref = \"emoji2\" }\nandroidx-emoji2-views = { module = \"androidx.emoji2:emoji2-views\", version.ref = \"emoji2\" }\nandroidx-emoji2-views-helper = { module = \"androidx.emoji2:emoji2-views-helper\", version.ref = \"emoji2\" }\nandroidx-espresso-core = { module = \"androidx.test.espresso:espresso-core\", version.ref = \"espressoCore\" }\nandroidx-foundation = { module = \"androidx.compose.foundation:foundation\" }\nandroidx-junit = { module = \"androidx.test.ext:junit\", version.ref = \"junitVersion\" }\nandroidx-material3-android = { group = \"androidx.compose.material3\", name = \"material3-android\", version.ref = \"material3AndroidVersion\" }\nandroidx-navigation-fragment-ktx = { module = \"androidx.navigation:navigation-fragment-ktx\", version.ref = \"navigationFragmentKtx\" }\nandroidx-navigation-ui-ktx = { module = \"androidx.navigation:navigation-ui-ktx\", version.ref = \"navigationUiKtx\" }\nandroidx-preference-ktx = { module = \"androidx.preference:preference-ktx\", version.ref = \"preferenceKtx\" }\nandroidx-recyclerview = { module = \"androidx.recyclerview:recyclerview\", version.ref = \"recyclerview\" }\nandroidx-runner = { module = \"androidx.test:runner\", version.ref = \"runner\" }\nandroidx-swiperefreshlayout = { module = \"androidx.swiperefreshlayout:swiperefreshlayout\", version.ref = \"swiperefreshlayout\" }\nandroidx-ui = { module = \"androidx.compose.ui:ui\" }\nandroidx-ui-tooling = { module = \"androidx.compose.ui:ui-tooling\" }\nandroidx-ui-tooling-preview = { module = \"androidx.compose.ui:ui-tooling-preview\" }\ncircleimageview = { module = \"de.hdodenhof:circleimageview\", version.ref = \"circleimageview\" }\ncoil-compose = { module = \"io.coil-kt.coil3:coil-compose\", version.ref = \"coilCompose\" }\ncoil-network-okhttp = { module = \"io.coil-kt.coil3:coil-network-okhttp\", version.ref = \"coilNetworkOkhttp\" }\nconverter-jackson = { module = \"com.squareup.retrofit2:converter-jackson\", version.ref = \"retrofit\" }\ndetekt-formatting = { module = \"io.gitlab.arturbosch.detekt:detekt-formatting\", version.ref = \"detekt\" }\nglide = { module = \"com.github.bumptech.glide:glide\", version.ref = \"glide\" }\nhilt-android = { module = \"com.google.dagger:hilt-android\", version.ref = \"hiltAndroid\" }\nhilt-android-testing = { module = \"com.google.dagger:hilt-android-testing\", version.ref = \"hiltAndroidTesting\" }\nhilt-compiler = { module = \"com.google.dagger:hilt-compiler\", version.ref = \"hiltAndroid\" }\njunit = { module = \"junit:junit\", version.ref = \"junit\" }\nkotlinx-coroutines-android = { module = \"org.jetbrains.kotlinx:kotlinx-coroutines-android\", version.ref = \"kotlinxCoroutinesAndroid\" }\nkotlinx-coroutines-test = { module = \"org.jetbrains.kotlinx:kotlinx-coroutines-test\", version.ref = \"kotlinxCoroutinesAndroid\" }\nktor-client-android = { module = \"io.ktor:ktor-client-android\", version.ref = \"ktorClientCore\" }\nktor-client-core = { module = \"io.ktor:ktor-client-core\", version.ref = \"ktorClientCore\" }\nlogging-interceptor = { module = \"com.squareup.okhttp3:logging-interceptor\", version.ref = \"loggingInterceptor\" }\nmaterial = { module = \"com.google.android.material:material\", version.ref = \"material\" }\nmockito-android = { module = \"org.mockito:mockito-android\", version.ref = \"mockitoAndroid\" }\nmockito-core = { module = \"org.mockito:mockito-core\", version.ref = \"mockitoCore\" }\nmockito-inline = { module = \"org.mockito:mockito-inline\", version.ref = \"mockitoInline\" }\nretrofit = { module = \"com.squareup.retrofit2:retrofit\", version.ref = \"retrofit\" }\nretrofit2-kotlin-coroutines-adapter = { module = \"com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter\", version.ref = \"retrofit2KotlinCoroutinesAdapter\" }\nrobolectric = { module = \"org.robolectric:robolectric\", version.ref = \"robolectric\" }\nrootbeer-lib = { module = \"com.scottyab:rootbeer-lib\", version.ref = \"rootbeerLib\" }\nandroidx-arch-core-testing = { module = \"androidx.arch.core:core-testing\", version.ref = \"archCoreTesting\" }\nroom-runtime = { module = \"androidx.room:room-runtime\", version.ref = \"room\" }\nroom-ktx = { module = \"androidx.room:room-ktx\", version.ref = \"room\" }\nroom-compiler = { module = \"androidx.room:room-compiler\", version.ref = \"room\" }\nandroidx-work-runtime-ktx = { module = \"androidx.work:work-runtime-ktx\", version.ref = \"work\" }\nlottie = { module = \"com.airbnb.android:lottie\", version.ref = \"lottie\" }\njavax-inject = { module = \"javax.inject:javax.inject\", version = \"1\" }\n\n[plugins]\ncompose-compiler = { id = \"org.jetbrains.kotlin.plugin.compose\", version.ref = \"kotlin\" }\ndetekt = { id = \"io.gitlab.arturbosch.detekt\", version.ref = \"detekt\" }\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Mon Nov 03 15:21:24 CET 2025\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-8.14.3-bin.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\norg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n# AndroidX package structure to make it clearer which packages are bundled with the\n# Android operating system, and which are packaged with your app\"s APK\n# https://developer.android.com/topic/libraries/support-library/androidx-rn\nandroid.useAndroidX=true\n# Kotlin code style for this project: \"official\" or \"obsolete\":\nkotlin.code.style=official\n# Enables namespacing of each library's R class so that its R class includes only the\n# resources declared in the library itself and none from the library's dependencies,\n# thereby reducing the size of the R class for that library\nandroid.nonTransitiveRClass=true\nandroid.defaults.buildfeatures.buildconfig=true\nandroid.nonFinalResIds=false"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env sh\n\n#\n# Copyright 2015 the original author or authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn () {\n    echo \"$*\"\n}\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\n  NONSTOP* )\n    nonstop=true\n    ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" -a \"$nonstop\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif [ \"$cygwin\" = \"true\" -o \"$msys\" = \"true\" ] ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=`expr $i + 1`\n    done\n    case $i in\n        0) set -- ;;\n        1) set -- \"$args0\" ;;\n        2) set -- \"$args0\" \"$args1\" ;;\n        3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Escape application args\nsave () {\n    for i do printf %s\\\\n \"$i\" | sed \"s/'/'\\\\\\\\''/g;1s/^/'/;\\$s/\\$/' \\\\\\\\/\" ; done\n    echo \" \"\n}\nAPP_ARGS=`save \"$@\"`\n\n# Collect all arguments for the java command, following the shell quoting and substitution rules\neval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS \"\\\"-Dorg.gradle.appname=$APP_BASE_NAME\\\"\" -classpath \"\\\"$CLASSPATH\\\"\" org.gradle.wrapper.GradleWrapperMain \"$APP_ARGS\"\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@rem\r\n@rem Copyright 2015 the original author or authors.\r\n@rem\r\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\r\n@rem you may not use this file except in compliance with the License.\r\n@rem You may obtain a copy of the License at\r\n@rem\r\n@rem      https://www.apache.org/licenses/LICENSE-2.0\r\n@rem\r\n@rem Unless required by applicable law or agreed to in writing, software\r\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\r\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n@rem See the License for the specific language governing permissions and\r\n@rem limitations under the License.\r\n@rem\r\n\r\n@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\r\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif \"%ERRORLEVEL%\" == \"0\" goto execute\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto execute\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %*\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\r\nexit /b 1\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "settings.gradle",
    "content": "pluginManagement {\n    repositories {\n        gradlePluginPortal()\n        google()\n        mavenCentral()\n        maven { url 'https://jitpack.io'}\n    }\n}\ndependencyResolutionManagement {\n    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n    repositories {\n        google()\n        mavenCentral()\n        maven { url 'https://jitpack.io'}\n    }\n}\nrootProject.name = \"Sapio\"\ninclude ':app'\ninclude ':domain'\ninclude ':data'\n"
  }
]