[
  {
    "path": ".github/release.yaml",
    "content": "changelog:\n  exclude:\n    labels:\n      - ignore-for-release\n  categories:\n    - title: '🔥 Breaking Changes'\n      labels:\n        - 'breaking'\n    - title: '🏕 Features'\n      labels:\n        - 'feat'\n    - title: '🐛 Bug Fixes'\n      labels:\n        - 'fix'\n    - title: '📄 Docs'\n      labels:\n        - 'docs'\n    - title: '📦 Dependencies & Build'\n      labels:\n        - 'chore'\n    - title: 'Other Changes'\n      labels:\n        - \"*\"\n"
  },
  {
    "path": ".github/workflows/github-releases-to-discord.yml",
    "content": "name: Push release to Discord\non:\n  release:\n    types: [ published,edited ]\n\njobs:\n  github-releases-to-discord:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v3\n      - name: Github Releases To Discord\n        uses: SethCohen/github-releases-to-discord@v1.13.1\n        with:\n          webhook_url: ${{ secrets.WEBHOOK_URL }}\n          username: \"Ascent Release\"\n          footer_title: \"Changelog\"\n          footer_timestamp: true"
  },
  {
    "path": ".gitignore",
    "content": ".flutter-plugins\n.flutter-plugins-dependencies\n.idea/\nbuild/\n.dart_tool/\nrust_builder\nlogs\nandroid/key.properties"
  },
  {
    "path": ".metadata",
    "content": "# This file tracks properties of this Flutter project.\n# Used by Flutter tool to assess capabilities and perform upgrades etc.\n#\n# This file should be version controlled and should not be manually edited.\n\nversion:\n  revision: \"db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\"\n  channel: \"stable\"\n\nproject_type: app\n\n# Tracks metadata for the flutter migrate command\nmigration:\n  platforms:\n    - platform: root\n      create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n      base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n    - platform: android\n      create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n      base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n    - platform: ios\n      create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n      base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n    - platform: linux\n      create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n      base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n    - platform: macos\n      create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n      base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n    - platform: web\n      create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n      base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n    - platform: windows\n      create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n      base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a\n\n  # User provided section\n\n  # List of Local paths (relative to this file) that should be\n  # ignored by the migrate tool.\n  #\n  # Files that are not part of the templates will be ignored by default.\n  unmanaged_files:\n    - 'lib/main.dart'\n    - 'ios/Runner.xcodeproj/project.pbxproj'\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 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 Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\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,\nour General Public Licenses are 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.\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  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\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 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 work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero 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 your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\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 AGPL, see\n<https://www.gnu.org/licenses/>."
  },
  {
    "path": "README.md",
    "content": "# Ascent\n![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/4o3F/Ascent/total)\n![Discord](https://img.shields.io/discord/1180781478951530537?color=5865F2&label=403F%E2%80%99s%20Cafe&logo=discord&logoColor=white\")\n\n\nA tool for retrieving wish link from Mihoyo games on Android with single device, no Root or PC required.\n\n**Please give me a star if you like this tool**\n\nThanks to @Mirai0009 for the excellent [guide](https://gist.github.com/Mirai0009/8615e52e09083de9c0ea2dc00dc62ea8). Thanks Dark_St4lker for Russian translation.  \nIf you still have problems, please raise a issue or join our [Discord](https://discord.com/invite/6v6HEUaRWk) for support.\n\nSupported:\n\n+ Xiaomi\n+ Honor\n+ Samsung\n+ Vivo/iQOO (Only Android 14, other versions need interaction with customer service)\n+ ....mostly all brands\n\nNot supported:\n\n+ ~~Vivo/iQOO~~\n+ ~~Samsung~~(Fixed by V2)\n+ Huawei/Honor(No wireless debug available, requires PC to enable)\n\nAscent mainly simulates the ADB wireless debug pairing and connect protocol, thus filtering out the wish history URL from the WebView log of Unity. For tech details, please refer to [my blog post](https://403f.cafe/p/adb-tls-protocol/).\n\n\n\n## Build\n\n1. Make sure you have Flutter and Rust installed\n2. Simply run `flutter build apk`, it should auto configure everything\n\n\n\n[![Stargazers over time](https://starchart.cc/4o3F/Ascent.svg?variant=adaptive)](https://starchart.cc/4o3F/Ascent)\n"
  },
  {
    "path": "analysis_options.yaml",
    "content": "# This file configures the analyzer, which statically analyzes Dart code to\n# check for errors, warnings, and lints.\n#\n# The issues identified by the analyzer are surfaced in the UI of Dart-enabled\n# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be\n# invoked from the command line by running `flutter analyze`.\n\n# The following line activates a set of recommended lints for Flutter apps,\n# packages, and plugins designed to encourage good coding practices.\ninclude: package:flutter_lints/flutter.yaml\n\nlinter:\n  # The lint rules applied to this project can be customized in the\n  # section below to disable rules from the `package:flutter_lints/flutter.yaml`\n  # included above or to enable additional rules. A list of all available lints\n  # and their documentation is published at https://dart.dev/lints.\n  #\n  # Instead of disabling a lint rule for the entire project in the\n  # section below, it can also be suppressed for a single line of code\n  # or a specific dart file by using the `// ignore: name_of_lint` and\n  # `// ignore_for_file: name_of_lint` syntax on the line or in the file\n  # producing the lint.\n  rules:\n    # avoid_print: false  # Uncomment to disable the `avoid_print` rule\n    # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule\n\n# Additional information about this file can be found at\n# https://dart.dev/guides/language/analysis-options\n"
  },
  {
    "path": "android/.gitignore",
    "content": "gradle-wrapper.jar\n/.gradle\n/captures/\n/gradlew\n/gradlew.bat\n/local.properties\nGeneratedPluginRegistrant.java\n\n# Remember to never publicly share your keystore.\n# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app\nkey.properties\n**/*.keystore\n**/*.jks\n"
  },
  {
    "path": "android/app/build.gradle",
    "content": "import com.android.build.OutputFile\n\nplugins {\n    id \"com.android.application\"\n    id \"kotlin-android\"\n    id \"dev.flutter.flutter-gradle-plugin\"\n}\n\ndef localProperties = new Properties()\ndef localPropertiesFile = rootProject.file('local.properties')\nif (localPropertiesFile.exists()) {\n    localPropertiesFile.withReader('UTF-8') { reader ->\n        localProperties.load(reader)\n    }\n}\n\ndef flutterVersionCode = localProperties.getProperty('flutter.versionCode')\nif (flutterVersionCode == null) {\n    flutterVersionCode = '1'\n}\n\ndef flutterVersionName = localProperties.getProperty('flutter.versionName')\nif (flutterVersionName == null) {\n    flutterVersionName = '1.0'\n}\n\nandroid {\n    namespace \"cafe.f403.ascent\"\n    compileSdkVersion localProperties.getProperty('flutter.compileSdkVersion').toInteger()\n    ndkVersion flutter.ndkVersion\n\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_8\n        targetCompatibility JavaVersion.VERSION_1_8\n    }\n\n    kotlinOptions {\n        jvmTarget = '1.8'\n    }\n\n    sourceSets {\n        main.java.srcDirs += 'src/main/kotlin'\n    }\n\n    defaultConfig {\n        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).\n        applicationId \"cafe.f403.ascent\"\n        // You can update the following values to match your application needs.\n        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.\n        minSdkVersion flutter.minSdkVersion\n        targetSdkVersion flutter.targetSdkVersion\n        versionCode flutterVersionCode.toInteger()\n        versionName flutterVersionName\n    }\n\n    buildTypes {\n        release {\n            // TODO: Add your own signing config for the release build.\n            // Signing with the debug keys for now, so `flutter run --release` works.\n//            signingConfig signingConfigs.release\n            applicationVariants.all { variant ->\n                variant.outputs.all { output ->\n                    if (variant.buildType.name.equals('release')) {\n                        output.outputFileName = \"ascent_${flutterVersionName}${getFilter(OutputFile.ABI) ? \"_${getFilter(OutputFile.ABI)}\" : \"\"}.apk\"\n                    } else if (variant.buildType.name.equals('debug')) {\n                        outputFileName = \"ascent_${flutterVersionName}${getFilter(OutputFile.ABI) ? \"_${getFilter(OutputFile.ABI)}\" : \"\"}_debug.apk\"\n                    }\n                }\n            }\n        }\n    }\n\n\n    splits {\n        abi {\n            enable true\n            reset()\n            include \"armeabi-v7a\", \"arm64-v8a\", \"x86_64\"\n            universalApk true\n        }\n    }\n}\n\n\nflutter {\n    source '../..'\n}\n\ndependencies {}\n"
  },
  {
    "path": "android/app/src/debug/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <!-- The INTERNET permission is required for development. Specifically,\n         the Flutter tool needs it to communicate with the running application\n         to allow setting breakpoints, to provide hot reload, etc.\n    -->\n    <uses-permission android:name=\"android.permission.INTERNET\"/>\n</manifest>\n"
  },
  {
    "path": "android/app/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <uses-permission android:name=\"android.permission.INTERNET\"/>\n    <uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\"/>\n    <uses-permission android:name=\"android.permission.FOREGROUND_SERVICE\"/>\n    <!-- foregroundServiceType: dataSync -->\n    <uses-permission android:name=\"android.permission.FOREGROUND_SERVICE_DATA_SYNC\"/>\n\n    <!-- foregroundServiceType: remoteMessaging -->\n    <uses-permission android:name=\"android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING\"/>\n    <application\n            android:label=\"Ascent\"\n            android:name=\"${applicationName}\"\n            android:icon=\"@mipmap/ic_launcher\">\n        <provider\n                android:name=\"rikka.shizuku.ShizukuProvider\"\n                android:authorities=\"${applicationId}.shizuku\"\n                android:multiprocess=\"false\"\n                android:enabled=\"true\"\n                android:exported=\"true\"\n                android:permission=\"android.permission.INTERACT_ACROSS_USERS_FULL\" />\n        <activity\n                android:name=\".MainActivity\"\n                android:exported=\"true\"\n                android:launchMode=\"singleInstance\"\n                android:theme=\"@style/LaunchTheme\"\n                android:configChanges=\"orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode\"\n                android:hardwareAccelerated=\"true\"\n                android:windowSoftInputMode=\"adjustResize\">\n            <!-- Specifies an Android theme to apply to this Activity as soon as\n                 the Android process has started. This theme is visible to the user\n                 while the Flutter UI initializes. After that, this theme continues\n                 to determine the Window background behind the Flutter UI. -->\n            <meta-data\n                    android:name=\"io.flutter.embedding.android.NormalTheme\"\n                    android:resource=\"@style/NormalTheme\"\n            />\n            <meta-data\n                    android:name=\"io.flutter.embedding.android.EnableImpeller\"\n                    android:value=\"false\" />\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\"/>\n                <category android:name=\"android.intent.category.LAUNCHER\"/>\n            </intent-filter>\n\n            <intent-filter>\n                <action android:name=\"android.intent.action.SEND\"/>\n                <category android:name=\"android.intent.category.DEFAULT\"/>\n                <data android:mimeType=\"*/*\"/>\n            </intent-filter>\n        </activity>\n        <service\n                android:name=\"com.pravera.flutter_foreground_task.service.ForegroundService\"\n                android:foregroundServiceType=\"dataSync|remoteMessaging\"\n                android:exported=\"false\"/>\n        <!-- Don't delete the meta-data below.\n             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->\n        <meta-data\n                android:name=\"flutterEmbedding\"\n                android:value=\"2\"/>\n    </application>\n</manifest>\n"
  },
  {
    "path": "android/app/src/main/kotlin/cafe/f403/ascent/MainActivity.kt",
    "content": "package cafe.f403.ascent\n\nimport androidx.annotation.NonNull\nimport android.provider.Settings\nimport android.content.Context\nimport \tandroid.os.Build\nimport io.flutter.embedding.android.FlutterActivity\nimport io.flutter.embedding.engine.FlutterEngine\nimport io.flutter.plugin.common.MethodChannel\n\nclass MainActivity : FlutterActivity() {\n    private val CHANNEL = \"cafe.f403.ascent/main\"\n\n    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {\n        super.configureFlutterEngine(flutterEngine)\n        MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result ->\n            if (call.method == \"getDeveloperOptionEnabled\") {\n                result.success(isDevMode(this))\n            } else {\n                result.notImplemented()\n            }\n        }\n    }\n\n    fun isDevMode(context: Context): Boolean {\n        return when {\n            Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN -> {\n                Settings.Secure.getInt(\n                    context.contentResolver,\n                    Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0\n                ) != 0\n            }\n\n            Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN -> {\n                @Suppress(\"DEPRECATION\")\n                Settings.Secure.getInt(\n                    context.contentResolver,\n                    Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 0\n                ) != 0\n            }\n\n            else -> false\n        }\n    }\n}\n"
  },
  {
    "path": "android/app/src/main/res/drawable/launch_background.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Modify this file to customize your launch splash screen -->\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:drawable=\"@android:color/white\" />\n\n    <!-- You can insert your own image assets here -->\n    <!-- <item>\n        <bitmap\n            android:gravity=\"center\"\n            android:src=\"@mipmap/launch_image\" />\n    </item> -->\n</layer-list>\n"
  },
  {
    "path": "android/app/src/main/res/drawable-v21/launch_background.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Modify this file to customize your launch splash screen -->\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:drawable=\"?android:colorBackground\" />\n\n    <!-- You can insert your own image assets here -->\n    <!-- <item>\n        <bitmap\n            android:gravity=\"center\"\n            android:src=\"@mipmap/launch_image\" />\n    </item> -->\n</layer-list>\n"
  },
  {
    "path": "android/app/src/main/res/values/styles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->\n    <style name=\"LaunchTheme\" parent=\"@android:style/Theme.Light.NoTitleBar\">\n        <!-- Show a splash screen on the activity. Automatically removed when\n             the Flutter engine draws its first frame -->\n        <item name=\"android:windowBackground\">@drawable/launch_background</item>\n    </style>\n    <!-- Theme applied to the Android Window as soon as the process has started.\n         This theme determines the color of the Android Window while your\n         Flutter UI initializes, as well as behind your Flutter UI while its\n         running.\n\n         This Theme is only used starting with V2 of Flutter's Android embedding. -->\n    <style name=\"NormalTheme\" parent=\"@android:style/Theme.Light.NoTitleBar\">\n        <item name=\"android:windowBackground\">?android:colorBackground</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "android/app/src/main/res/values-night/styles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->\n    <style name=\"LaunchTheme\" parent=\"@android:style/Theme.Black.NoTitleBar\">\n        <!-- Show a splash screen on the activity. Automatically removed when\n             the Flutter engine draws its first frame -->\n        <item name=\"android:windowBackground\">@drawable/launch_background</item>\n    </style>\n    <!-- Theme applied to the Android Window as soon as the process has started.\n         This theme determines the color of the Android Window while your\n         Flutter UI initializes, as well as behind your Flutter UI while its\n         running.\n\n         This Theme is only used starting with V2 of Flutter's Android embedding. -->\n    <style name=\"NormalTheme\" parent=\"@android:style/Theme.Black.NoTitleBar\">\n        <item name=\"android:windowBackground\">?android:colorBackground</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "android/app/src/profile/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <!-- The INTERNET permission is required for development. Specifically,\n         the Flutter tool needs it to communicate with the running application\n         to allow setting breakpoints, to provide hot reload, etc.\n    -->\n    <uses-permission android:name=\"android.permission.INTERNET\"/>\n</manifest>\n"
  },
  {
    "path": "android/ascent_android.iml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n  <component name=\"FacetManager\">\n    <facet type=\"android\" name=\"Android\">\n      <configuration>\n        <option name=\"ALLOW_USER_CONFIGURATION\" value=\"false\" />\n        <option name=\"GEN_FOLDER_RELATIVE_PATH_APT\" value=\"/gen\" />\n        <option name=\"GEN_FOLDER_RELATIVE_PATH_AIDL\" value=\"/gen\" />\n        <option name=\"MANIFEST_FILE_RELATIVE_PATH\" value=\"/app/src/main/AndroidManifest.xml\" />\n        <option name=\"RES_FOLDER_RELATIVE_PATH\" value=\"/app/src/main/res\" />\n        <option name=\"ASSETS_FOLDER_RELATIVE_PATH\" value=\"/app/src/main/assets\" />\n        <option name=\"LIBS_FOLDER_RELATIVE_PATH\" value=\"/app/src/main/libs\" />\n        <option name=\"PROGUARD_LOGS_FOLDER_RELATIVE_PATH\" value=\"/app/src/main/proguard_logs\" />\n      </configuration>\n    </facet>\n  </component>\n  <component name=\"NewModuleRootManager\" inherit-compiler-output=\"true\">\n    <exclude-output />\n    <content url=\"file://$MODULE_DIR$\">\n      <sourceFolder url=\"file://$MODULE_DIR$/app/src/main/java\" isTestSource=\"false\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/app/src/main/kotlin\" isTestSource=\"false\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/gen\" isTestSource=\"false\" generated=\"true\" />\n    </content>\n    <orderEntry type=\"jdk\" jdkName=\"Android API 29 Platform\" jdkType=\"Android SDK\" />\n    <orderEntry type=\"sourceFolder\" forTests=\"false\" />\n    <orderEntry type=\"library\" name=\"Flutter for Android\" level=\"project\" />\n    <orderEntry type=\"library\" name=\"KotlinJavaRuntime\" level=\"project\" />\n  </component>\n</module>"
  },
  {
    "path": "android/build.gradle",
    "content": "buildscript {\n    ext.kotlin_version = '2.1.0'\n    repositories {\n        google()\n        mavenCentral()\n    }\n\n    dependencies {\n        classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version\"\n    }\n}\n\nallprojects {\n    repositories {\n        google()\n        mavenCentral()\n    }\n\n    subprojects {\n        afterEvaluate { project ->\n            if (project.hasProperty('android')) {\n                project.android {\n                    if (namespace == null) {\n                        namespace project.group\n                    }\n                    compileSdkVersion 36\n                }\n            }\n        }\n    }\n}\n\nrootProject.buildDir = '../build'\nsubprojects {\n    project.buildDir = \"${rootProject.buildDir}/${project.name}\"\n}\nsubprojects {\n    project.evaluationDependsOn(':app')\n}\n\ntasks.register(\"clean\", Delete) {\n    delete rootProject.buildDir\n}\n\ntasks.withType(JavaCompile) {\n    options.encoding = \"UTF-8\"\n}\n"
  },
  {
    "path": "android/gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-8.11.1-all.zip\n"
  },
  {
    "path": "android/gradle.properties",
    "content": "org.gradle.jvmargs=-Xmx4G\nandroid.useAndroidX=true\nandroid.enableJetifier=true\n"
  },
  {
    "path": "android/settings.gradle",
    "content": "pluginManagement {\n    def flutterSdkPath = {\n        def properties = new Properties()\n        file(\"local.properties\").withInputStream { properties.load(it) }\n        def flutterSdkPath = properties.getProperty(\"flutter.sdk\")\n        assert flutterSdkPath != null, \"flutter.sdk not set in local.properties\"\n        return flutterSdkPath\n    }\n    settings.ext.flutterSdkPath = flutterSdkPath()\n\n    includeBuild(\"${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle\")\n\n    repositories {\n        google()\n        mavenCentral()\n        gradlePluginPortal()\n    }\n\n    plugins {\n        id \"dev.flutter.flutter-gradle-plugin\" version \"1.0.0\" apply false\n    }\n}\n\nplugins {\n    id \"dev.flutter.flutter-plugin-loader\" version \"1.0.0\"\n    id \"com.android.application\" version \"8.9.1\" apply false\n}\n\ninclude \":app\"\n"
  },
  {
    "path": "ascent.iml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n  <component name=\"NewModuleRootManager\" inherit-compiler-output=\"true\">\n    <exclude-output />\n    <content url=\"file://$MODULE_DIR$\">\n      <excludeFolder url=\"file://$MODULE_DIR$/.dart_tool\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/.pub\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build\" />\n    </content>\n    <orderEntry type=\"sourceFolder\" forTests=\"false\" />\n    <orderEntry type=\"library\" name=\"Dart SDK\" level=\"project\" />\n    <orderEntry type=\"library\" name=\"Dart Packages\" level=\"project\" />\n    <orderEntry type=\"library\" name=\"Flutter Plugins\" level=\"project\" />\n  </component>\n</module>"
  },
  {
    "path": "assets/translations/en-US.json",
    "content": "{\n  \"title\": \"Ascent\",\n  \"navigation\": {\n    \"home\": \"Home\",\n    \"pair\": \"Pair\",\n    \"connect\": \"Connect\",\n    \"info\": \"Info\"\n  },\n  \"home\": {\n    \"star\": \"If you like Ascent, Star it ;D\",\n    \"support\": \"Get Support\",\n    \"developer_option\": {\n      \"status\": \"Developer Option Status: \",\n      \"enabled\": \"Enabled\",\n      \"disabled\": \"Disabled\"\n    },\n    \"root\": {\n      \"name\": \"Get Link\",\n      \"enabled\": \"Root Enabled!\",\n      \"direct_connect\": \"You can directly tap connect\"\n    },\n    \"shizuku\": {\n      \"name\": \"Get Link\",\n      \"enabled\": \"Shizuku Enabled!\",\n      \"direct_connect\": \"You can directly tap connect\"\n    },\n    \"pairing\": {\n      \"name\": \"Pair\",\n      \"status\": \"ADB Pair Status: \",\n      \"paired\": \"Paired\",\n      \"wait_pairing\": \"Wait Pairing\"\n    },\n    \"connect\": {\n      \"name\": \"Connect\",\n      \"status\": \"ADB Connect Status: \",\n      \"connected\": \"Connected\",\n      \"wait_connect\": \"Wait Connecting\"\n    }\n  },\n  \"pair\": {\n    \"guide\": {\n      \"prepare_guide\": \"Please follow the guide in notification for following ADB pairing process\",\n      \"pair\": \"Start Pairing\",\n      \"reset\": \"Reset Pair Cert\"\n    },\n    \"notification_title\": \"Ascent Pairing\",\n    \"notification_description\": {\n      \"guide_port\": \"Open wireless debugging and click 'Pair device with pairing code'\\nEnter the pairing port by clicking the following button\",\n      \"guide_code\": \"Please enter the pairing code (6 bit) below the button\",\n      \"error_init\": \"Foreground service start failed, please contact developer\",\n      \"pair_port\": \"Port: \",\n      \"pair_code\": \"Code: \",\n      \"pair_success\": \"Pairing success, please return to Ascent\",\n      \"pair_fail\": \"Pair failed, please check pair code\\n\"\n    },\n    \"notification_reply_button\": \"Enter data here\"\n  },\n  \"connect\": {\n    \"guide\": {\n      \"prepare_guide\": \"Open game after connect\\nYou'll be notified on success\",\n      \"connect\": \"Connect!\",\n      \"in_progress\": \"Waiting...\",\n      \"reset\": \"Reset Process\",\n      \"root_connect\": \"Root Connect!\",\n      \"shizuku_connect\": \"Shizuku Connect!\"\n    },\n    \"notification_title\": \"Ascent Connect\",\n    \"notification_description\": {\n      \"connecting\": \"Port undetected, enter 5 digit port number behind IP address\",\n      \"waiting\": \"Please open game, waiting for link\",\n      \"success\": \"Success, please return to Ascent\",\n      \"fail\": \"Failed, please check port\\n\",\n      \"repair\": \"Cert invalid, please redo pairing\"\n    },\n    \"notification_reply_button\": \"Enter data here\",\n    \"link_action\": {\n      \"title\": \"Wish history link\",\n      \"copy_button\": \"Copy\",\n      \"copied\": \"Copied\"\n    }\n  },\n  \"root_connect\": {\n    \"notification_title\": \"Ascent Root Connect\",\n    \"notification_description\": {\n      \"waiting\": \"Waiting for link\",\n      \"success\": \"Success, please return to Ascent\"\n    }\n  },\n  \"shizuku_connect\": {\n    \"notification_title\": \"Ascent Shizuku Connect\",\n    \"notification_description\": {\n      \"waiting\": \"Waiting for link\",\n      \"success\": \"Success, please return to Ascent\"\n    }\n  },\n  \"update\": {\n    \"title\": \"New version \",\n    \"ok\": \"Update\",\n    \"cancel\": \"Not now\"\n  },\n  \"error\": {\n    \"title\": \"Please contact support\",\n    \"copy\": \"Copy\",\n    \"copied\": \"Copied\"\n  },\n  \"settings\": {\n    \"disable_auto_detect_port\": \"Disable auto detect port\"\n  }\n}"
  },
  {
    "path": "assets/translations/en.json",
    "content": "{\n  \"title\": \"Ascent\",\n  \"navigation\": {\n    \"home\": \"Home\",\n    \"pair\": \"Pair\",\n    \"connect\": \"Connect\",\n    \"info\": \"Info\"\n  },\n  \"home\": {\n    \"star\": \"If you like Ascent, Star it ;D\",\n    \"support\": \"Get Support\",\n    \"developer_option\": {\n      \"status\": \"Developer Option Status: \",\n      \"enabled\": \"Enabled\",\n      \"disabled\": \"Disabled\"\n    },\n    \"root\": {\n      \"name\": \"Get Link\",\n      \"enabled\": \"Root Enabled!\",\n      \"direct_connect\": \"You can directly tap connect\"\n    },\n    \"shizuku\": {\n      \"name\": \"Get Link\",\n      \"enabled\": \"Shizuku Enabled!\",\n      \"direct_connect\": \"You can directly tap connect\"\n    },\n    \"pairing\": {\n      \"name\": \"Pair\",\n      \"status\": \"ADB Pair Status: \",\n      \"paired\": \"Paired\",\n      \"wait_pairing\": \"Wait Pairing\"\n    },\n    \"connect\": {\n      \"name\": \"Connect\",\n      \"status\": \"ADB Connect Status: \",\n      \"connected\": \"Connected\",\n      \"wait_connect\": \"Wait Connecting\"\n    }\n  },\n  \"pair\": {\n    \"guide\": {\n      \"prepare_guide\": \"Please follow the guide in notification for following ADB pairing process\",\n      \"pair\": \"Start Pairing\",\n      \"reset\": \"Reset Pair Cert\"\n    },\n    \"notification_title\": \"Ascent Pairing\",\n    \"notification_description\": {\n      \"guide_port\": \"Open wireless debugging and click 'Pair device with pairing code'\\nEnter the pairing port by clicking the following button\",\n      \"guide_code\": \"Please enter the pairing code (6 bit) below the button\",\n      \"error_init\": \"Foreground service start failed, please contact developer\",\n      \"pair_port\": \"Port: \",\n      \"pair_code\": \"Code: \",\n      \"pair_success\": \"Pairing success, please return to Ascent\",\n      \"pair_fail\": \"Pair failed, please check pair code\\n\"\n    },\n    \"notification_reply_button\": \"Enter data here\"\n  },\n  \"connect\": {\n    \"guide\": {\n      \"prepare_guide\": \"Open game after connect\\nYou'll be notified on success\",\n      \"connect\": \"Connect!\",\n      \"in_progress\": \"Waiting...\",\n      \"reset\": \"Reset Process\",\n      \"root_connect\": \"Root Connect!\",\n      \"shizuku_connect\": \"Shizuku Connect!\"\n    },\n    \"notification_title\": \"Ascent Connect\",\n    \"notification_description\": {\n      \"connecting\": \"Port undetected, enter 5 digit port number behind IP address\",\n      \"waiting\": \"Please open game, waiting for link\",\n      \"success\": \"Success, please return to Ascent\",\n      \"fail\": \"Failed, please check port\\n\",\n      \"repair\": \"Cert invalid, please redo pairing\"\n    },\n    \"notification_reply_button\": \"Enter data here\",\n    \"link_action\": {\n      \"title\": \"Wish history link\",\n      \"copy_button\": \"Copy\",\n      \"copied\": \"Copied\"\n    }\n  },\n  \"root_connect\": {\n    \"notification_title\": \"Ascent Root Connect\",\n    \"notification_description\": {\n      \"waiting\": \"Waiting for link\",\n      \"success\": \"Success, please return to Ascent\"\n    }\n  },\n  \"shizuku_connect\": {\n    \"notification_title\": \"Ascent Shizuku Connect\",\n    \"notification_description\": {\n      \"waiting\": \"Waiting for link\",\n      \"success\": \"Success, please return to Ascent\"\n    }\n  },\n  \"update\": {\n    \"title\": \"New version \",\n    \"ok\": \"Update\",\n    \"cancel\": \"Not now\"\n  },\n  \"error\": {\n    \"title\": \"Please contact support\",\n    \"copy\": \"Copy\",\n    \"copied\": \"Copied\"\n  },\n  \"settings\": {\n    \"disable_auto_detect_port\": \"Disable auto detect port\"\n  }\n}"
  },
  {
    "path": "assets/translations/ru-RU.json",
    "content": "{\n  \"title\": \"Ascent\",\n  \"navigation\": {\n    \"home\": \"Главная\",\n    \"pair\": \"Соедините\",\n    \"connect\": \"Подключение\",\n    \"info\": \"Информация\"\n  },\n  \"home\": {\n    \"star\": \"Если вам нравится Ascent, поставьте ему звездочку ;D\",\n    \"support\": \"Возникли вопросы\",\n    \"developer_option\": {\n      \"status\": \"Статус опции разработчика: \",\n      \"enabled\": \"Вкл\",\n      \"disabled\": \"Выкл\"\n    },\n    \"root\": {\n      \"name\": \"Получить ссылку\",\n      \"enabled\": \"Root-доступ вкл!\",\n      \"direct_connect\": \"Вы можете напрямую нажать «Подключиться»\"\n    },\n    \"shizuku\": {\n      \"name\": \"Get Link\",\n      \"enabled\": \"Shizuku Enabled!\",\n      \"direct_connect\": \"You can directly tap connect\"\n    },\n    \"pairing\": {\n      \"name\": \"Соедините\",\n      \"status\": \"Статус подключение ADB: \",\n      \"paired\": \"Подключен\",\n      \"wait_pairing\": \"Подождите подключение\"\n    },\n    \"connect\": {\n      \"name\": \"Подключение\",\n      \"status\": \"Статус подключения ADB: \",\n      \"connected\": \"Подключен\",\n      \"wait_connect\": \"Подождите, идет подключение\"\n    }\n  },\n  \"pair\": {\n    \"guide\": {\n      \"prepare_guide\": \"Пожалуйста, следуйте инструкциям в уведомлении для последующего процесса сопряжения с ADB.\",\n      \"pair\": \"Начать подключение\",\n      \"reset\": \"Сброс соединение сертификатов\"\n    },\n    \"notification_title\": \"Ascent Подключается\",\n    \"notification_description\": {\n      \"guide_port\": \"Откройте отладку по беспроводной сети и нажмите «Связать устройство с кодом сопряжения».\\n Введите порт сопряжения, нажав следующую кнопку.\",\n      \"guide_code\": \"Введите код сопряжения (6 цифр) под кнопкой.\",\n      \"error_init\": \"Не удалось запустить службу, обратитесь к разработчику\",\n      \"pair_port\": \"Порт: \",\n      \"pair_code\": \"Код: \",\n      \"pair_success\": \"Сопряжение прошло успешно, пожалуйста, вернитесь к Ascent\",\n      \"pair_fail\": \"Соединение не удалась, проверьте код соединение\\n\"\n    },\n    \"notification_reply_button\": \"Введите данные здесь\"\n  },\n  \"connect\": {\n    \"guide\": {\n      \"prepare_guide\": \"Откройте игру после подключения\\nВы будете уведомлены об успешный подключение\",\n      \"connect\": \"Соединять!\",\n      \"in_progress\": \"Ожидание...\",\n      \"reset\": \"Начать заново\",\n      \"root_connect\": \"Подключитесь как root!\",\n      \"shizuku_connect\": \"Shizuku Connect!\"\n    },\n    \"notification_title\": \"Ascent Подключение\",\n    \"notification_description\": {\n      \"connecting\": \"Порт не обнаружен, введите 5-значный номер порта за IP-адресом\",\n      \"waiting\": \"Пожалуйста, откройте игру, ждите ссылку\",\n      \"success\": \"Успешно, пожалуйста, вернитесь в программу Ascent\",\n      \"fail\": \"Ошибка, проверьте порт\\n\",\n      \"repair\": \"Сертификат недействителен, пожалуйста, повторите подключение\"\n    },\n    \"notification_reply_button\": \"Введите данные здесь\",\n    \"link_action\": {\n      \"title\": \"Ссылка на историю пожеланий\",\n      \"copy_button\": \"Копировать\",\n      \"copied\": \"Скопировано\"\n    }\n  },\n  \"root_connect\": {\n    \"notification_title\": \"Ascent Root Connect\",\n    \"notification_description\": {\n      \"waiting\": \"Ожидание ссылки\",\n      \"success\": \"Успешно, пожалуйста, вернитесь в программу Ascent\"\n    }\n  },\n  \"shizuku_connect\": {\n    \"notification_title\": \"Ascent Shizuku Connect\",\n    \"notification_description\": {\n      \"waiting\": \"Waiting for link\",\n      \"success\": \"Success, please return to Ascent\"\n    }\n  },\n  \"update\": {\n    \"title\": \"Новая версия\",\n    \"ok\": \"Обновить\",\n    \"cancel\": \"Не сейчас\"\n  },\n  \"error\": {\n    \"title\": \"Пожалуйста, свяжитесь со службой поддержки.\",\n    \"copy\": \"Копировать\",\n    \"copied\": \"Скопировано\"\n  },\n  \"settings\": {\n    \"disable_auto_detect_port\": \"Отключить автоматическое определение порта\"\n  }\n}\n"
  },
  {
    "path": "assets/translations/ru.json",
    "content": "{\n  \"title\": \"Ascent\",\n  \"navigation\": {\n    \"home\": \"Главная\",\n    \"pair\": \"Соедините\",\n    \"connect\": \"Подключение\",\n    \"info\": \"Информация\"\n  },\n  \"home\": {\n    \"star\": \"Если вам нравится Ascent, поставьте ему звездочку ;D\",\n    \"support\": \"Возникли вопросы\",\n    \"developer_option\": {\n      \"status\": \"Статус опции разработчика: \",\n      \"enabled\": \"Вкл\",\n      \"disabled\": \"Выкл\"\n    },\n    \"root\": {\n      \"name\": \"Получить ссылку\",\n      \"enabled\": \"Root-доступ вкл!\",\n      \"direct_connect\": \"Вы можете напрямую нажать «Подключиться»\"\n    },\n    \"shizuku\": {\n      \"name\": \"Get Link\",\n      \"enabled\": \"Shizuku Enabled!\",\n      \"direct_connect\": \"You can directly tap connect\"\n    },\n    \"pairing\": {\n      \"name\": \"Соедините\",\n      \"status\": \"Статус подключение ADB: \",\n      \"paired\": \"Подключен\",\n      \"wait_pairing\": \"Подождите подключение\"\n    },\n    \"connect\": {\n      \"name\": \"Подключение\",\n      \"status\": \"Статус подключения ADB: \",\n      \"connected\": \"Подключен\",\n      \"wait_connect\": \"Подождите, идет подключение\"\n    }\n  },\n  \"pair\": {\n    \"guide\": {\n      \"prepare_guide\": \"Пожалуйста, следуйте инструкциям в уведомлении для последующего процесса сопряжения с ADB.\",\n      \"pair\": \"Начать подключение\",\n      \"reset\": \"Сброс соединение сертификатов\"\n    },\n    \"notification_title\": \"Ascent Подключается\",\n    \"notification_description\": {\n      \"guide_port\": \"Откройте отладку по беспроводной сети и нажмите «Связать устройство с кодом сопряжения».\\n Введите порт сопряжения, нажав следующую кнопку.\",\n      \"guide_code\": \"Введите код сопряжения (6 цифр) под кнопкой.\",\n      \"error_init\": \"Не удалось запустить службу, обратитесь к разработчику\",\n      \"pair_port\": \"Порт: \",\n      \"pair_code\": \"Код: \",\n      \"pair_success\": \"Сопряжение прошло успешно, пожалуйста, вернитесь к Ascent\",\n      \"pair_fail\": \"Соединение не удалась, проверьте код соединение\\n\"\n    },\n    \"notification_reply_button\": \"Введите данные здесь\"\n  },\n  \"connect\": {\n    \"guide\": {\n      \"prepare_guide\": \"Откройте игру после подключения\\nВы будете уведомлены об успешный подключение\",\n      \"connect\": \"Соединять!\",\n      \"in_progress\": \"Ожидание...\",\n      \"reset\": \"Начать заново\",\n      \"root_connect\": \"Подключитесь как root!\",\n      \"shizuku_connect\": \"Shizuku Connect!\"\n    },\n    \"notification_title\": \"Ascent Подключение\",\n    \"notification_description\": {\n      \"connecting\": \"Порт не обнаружен, введите 5-значный номер порта за IP-адресом\",\n      \"waiting\": \"Пожалуйста, откройте игру, ждите ссылку\",\n      \"success\": \"Успешно, пожалуйста, вернитесь в программу Ascent\",\n      \"fail\": \"Ошибка, проверьте порт\\n\",\n      \"repair\": \"Сертификат недействителен, пожалуйста, повторите подключение\"\n    },\n    \"notification_reply_button\": \"Введите данные здесь\",\n    \"link_action\": {\n      \"title\": \"Ссылка на историю пожеланий\",\n      \"copy_button\": \"Копировать\",\n      \"copied\": \"Скопировано\"\n    }\n  },\n  \"root_connect\": {\n    \"notification_title\": \"Ascent Root Connect\",\n    \"notification_description\": {\n      \"waiting\": \"Ожидание ссылки\",\n      \"success\": \"Успешно, пожалуйста, вернитесь в программу Ascent\"\n    }\n  },\n  \"shizuku_connect\": {\n    \"notification_title\": \"Ascent Shizuku Connect\",\n    \"notification_description\": {\n      \"waiting\": \"Waiting for link\",\n      \"success\": \"Success, please return to Ascent\"\n    }\n  },\n  \"update\": {\n    \"title\": \"Новая версия\",\n    \"ok\": \"Обновить\",\n    \"cancel\": \"Не сейчас\"\n  },\n  \"error\": {\n    \"title\": \"Пожалуйста, свяжитесь со службой поддержки.\",\n    \"copy\": \"Копировать\",\n    \"copied\": \"Скопировано\"\n  },\n  \"settings\": {\n    \"disable_auto_detect_port\": \"Отключить автоматическое определение порта\"\n  }\n}\n"
  },
  {
    "path": "assets/translations/zh-CN.json",
    "content": "{\n  \"title\": \"Ascent\",\n  \"navigation\": {\n    \"home\": \"主页\",\n    \"pair\": \"配对\",\n    \"connect\": \"连接\",\n    \"info\": \"关于\"\n  },\n  \"home\": {\n    \"star\": \"如果你喜欢Ascent 请给个Star吧 ;D\",\n    \"support\": \"技术支持\",\n    \"developer_option\": {\n      \"status\": \"开发者选项状态: \",\n      \"enabled\": \"已启用\",\n      \"disabled\": \"未启用\"\n    },\n    \"root\": {\n      \"name\": \"获取链接\",\n      \"enabled\": \"Root已开启!\",\n      \"direct_connect\": \"你可以直接点击连接\"\n    },\n    \"shizuku\": {\n      \"name\": \"获取链接\",\n      \"enabled\": \"Shizuku已开启!\",\n      \"direct_connect\": \"你可以直接点击连接\"\n    },\n    \"pairing\": {\n      \"name\": \"配对\",\n      \"status\": \"无线调试配对状态: \",\n      \"paired\": \"已配对\",\n      \"wait_pairing\": \"未配对\"\n    },\n    \"connect\": {\n      \"name\": \"连接\",\n      \"status\": \"无线调试连接状态: \",\n      \"connected\": \"已连接\",\n      \"wait_connect\": \"等待连接\"\n    }\n  },\n  \"pair\": {\n    \"guide\": {\n      \"prepare_guide\": \"接下来的无线调试配对过程请跟随通知栏中的提示进行\",\n      \"pair\": \"开始配对\",\n      \"reset\": \"重置配对状态\"\n    },\n    \"notification_title\": \"Ascent配对\",\n    \"notification_description\": {\n      \"guide_port\": \"打开无线调试并点击使用配对码配对设备\\n通过下面的按钮输入无线调试配对端口\",\n      \"guide_code\": \"请通过下面的按钮输入无线调试配对码\",\n      \"error_init\": \"前台服务启动失败，请联系开发者\",\n      \"pair_port\": \"端口: \",\n      \"pair_code\": \"配对码: \",\n      \"pair_success\": \"配对成功，请返回Ascent主程序\",\n      \"pair_fail\": \"配对失败，请确认配对码\"\n    },\n    \"notification_reply_button\": \"点此输入数据\"\n  },\n  \"connect\": {\n    \"guide\": {\n      \"prepare_guide\": \"连接后请直接打开游戏\\n成功获得链接后将在通知中提示\",\n      \"connect\": \"开始连接!\",\n      \"in_progress\": \"请打开游戏,等待中...\",\n      \"reset\": \"重置状态\",\n      \"root_connect\": \"开始Root连接!\",\n      \"shizuku_connect\": \"开始Shizuku连接！\"\n    },\n    \"notification_title\": \"Ascent连接\",\n    \"notification_description\": {\n      \"connecting\": \"连接无线调试中,请点击按钮输入无线调试端口\",\n      \"waiting\": \"等待链接中\",\n      \"success\": \"获取成功，请返回Ascent主程序\",\n      \"fail\": \"失败，请检查端口\\n\",\n      \"repair\": \"证书失效，请重新配对\"\n    },\n    \"notification_reply_button\": \"点此输入数据\",\n    \"link_action\": {\n      \"title\": \"抽卡链接\",\n      \"copy_button\": \"复制\",\n      \"copied\": \"已复制\"\n    }\n  },\n  \"root_connect\": {\n    \"notification_title\": \"Ascent Root连接\",\n    \"notification_description\": {\n      \"waiting\": \"等待链接中\",\n      \"success\": \"获取成功，请返回Ascent主程序\"\n    }\n  },\n  \"shizuku_connect\": {\n    \"notification_title\": \"Ascent Shizuku连接\",\n    \"notification_description\": {\n      \"waiting\": \"等待链接中\",\n      \"success\": \"获取成功，请返回Ascent主程序\"\n    }\n  },\n  \"update\": {\n    \"title\": \"新版本 \",\n    \"ok\": \"更新\",\n    \"cancel\": \"暂不更新\"\n  },\n  \"error\" : {\n    \"title\": \"请联系技术支持\",\n    \"copy\": \"复制\",\n    \"copied\": \"已复制\"\n  },\n  \"settings\": {\n    \"disable_auto_detect_port\": \"关闭端口自动检测\"\n  }\n}"
  },
  {
    "path": "assets/translations/zh.json",
    "content": "{\n  \"title\": \"Ascent\",\n  \"navigation\": {\n    \"home\": \"主页\",\n    \"pair\": \"配对\",\n    \"connect\": \"连接\",\n    \"info\": \"关于\"\n  },\n  \"home\": {\n    \"star\": \"如果你喜欢Ascent 请给个Star吧 ;D\",\n    \"support\": \"技术支持\",\n    \"developer_option\": {\n      \"status\": \"开发者选项状态: \",\n      \"enabled\": \"已启用\",\n      \"disabled\": \"未启用\"\n    },\n    \"root\": {\n      \"name\": \"获取链接\",\n      \"enabled\": \"Root已开启!\",\n      \"direct_connect\": \"你可以直接点击连接\"\n    },\n    \"shizuku\": {\n      \"name\": \"获取链接\",\n      \"enabled\": \"Shizuku已开启!\",\n      \"direct_connect\": \"你可以直接点击连接\"\n    },\n    \"pairing\": {\n      \"name\": \"配对\",\n      \"status\": \"无线调试配对状态: \",\n      \"paired\": \"已配对\",\n      \"wait_pairing\": \"未配对\"\n    },\n    \"connect\": {\n      \"name\": \"连接\",\n      \"status\": \"无线调试连接状态: \",\n      \"connected\": \"已连接\",\n      \"wait_connect\": \"等待连接\"\n    }\n  },\n  \"pair\": {\n    \"guide\": {\n      \"prepare_guide\": \"接下来的无线调试配对过程请跟随通知栏中的提示进行\",\n      \"pair\": \"开始配对\",\n      \"reset\": \"重置配对状态\"\n    },\n    \"notification_title\": \"Ascent配对\",\n    \"notification_description\": {\n      \"guide_port\": \"打开无线调试并点击使用配对码配对设备\\n通过下面的按钮输入无线调试配对端口\",\n      \"guide_code\": \"请通过下面的按钮输入无线调试配对码\",\n      \"error_init\": \"前台服务启动失败，请联系开发者\",\n      \"pair_port\": \"端口: \",\n      \"pair_code\": \"配对码: \",\n      \"pair_success\": \"配对成功，请返回Ascent主程序\",\n      \"pair_fail\": \"配对失败，请确认配对码\"\n    },\n    \"notification_reply_button\": \"点此输入数据\"\n  },\n  \"connect\": {\n    \"guide\": {\n      \"prepare_guide\": \"连接后请直接打开游戏\\n成功获得链接后将在通知中提示\",\n      \"connect\": \"开始连接!\",\n      \"in_progress\": \"请打开游戏,等待中...\",\n      \"reset\": \"重置状态\",\n      \"root_connect\": \"开始Root连接!\",\n      \"shizuku_connect\": \"开始Shizuku连接！\"\n    },\n    \"notification_title\": \"Ascent连接\",\n    \"notification_description\": {\n      \"connecting\": \"连接无线调试中,请点击按钮输入无线调试端口\",\n      \"waiting\": \"等待链接中\",\n      \"success\": \"获取成功，请返回Ascent主程序\",\n      \"fail\": \"失败，请检查端口\\n\",\n      \"repair\": \"证书失效，请重新配对\"\n    },\n    \"notification_reply_button\": \"点此输入数据\",\n    \"link_action\": {\n      \"title\": \"抽卡链接\",\n      \"copy_button\": \"复制\",\n      \"copied\": \"已复制\"\n    }\n  },\n  \"root_connect\": {\n    \"notification_title\": \"Ascent Root连接\",\n    \"notification_description\": {\n      \"waiting\": \"等待链接中\",\n      \"success\": \"获取成功，请返回Ascent主程序\"\n    }\n  },\n  \"shizuku_connect\": {\n    \"notification_title\": \"Ascent Shizuku连接\",\n    \"notification_description\": {\n      \"waiting\": \"等待链接中\",\n      \"success\": \"获取成功，请返回Ascent主程序\"\n    }\n  },\n  \"update\": {\n    \"title\": \"新版本 \",\n    \"ok\": \"更新\",\n    \"cancel\": \"暂不更新\"\n  },\n  \"error\" : {\n    \"title\": \"请联系技术支持\",\n    \"copy\": \"复制\",\n    \"copied\": \"已复制\"\n  },\n  \"settings\": {\n    \"disable_auto_detect_port\": \"关闭端口自动检测\"\n  }\n}"
  },
  {
    "path": "flutter_rust_bridge.yaml",
    "content": "rust_input: crate::api\nrust_root: rust/\ndart_output: lib/native"
  },
  {
    "path": "integration_test/simple_test.dart",
    "content": "import 'package:flutter_test/flutter_test.dart';\nimport 'package:ascent/main.dart';\nimport 'package:ascent/src/rust/frb_generated.dart';\nimport 'package:integration_test/integration_test.dart';\n\nvoid main() {\n  IntegrationTestWidgetsFlutterBinding.ensureInitialized();\n  setUpAll(() async => await RustLib.init());\n  testWidgets('Can call rust function', (WidgetTester tester) async {\n    await tester.pumpWidget(const MyApp());\n    expect(find.textContaining('Result: `Hello, Tom!`'), findsOneWidget);\n  });\n}\n"
  },
  {
    "path": "lib/components/bottom_navigation_bar/view.dart",
    "content": "import 'package:ascent/global_state.dart';\nimport 'package:ascent/routes.dart';\nimport 'package:bruno/bruno.dart';\nimport 'package:easy_localization/easy_localization.dart' as easy_localization;\nimport 'package:flutter/material.dart';\nimport 'package:flutter_foreground_task/flutter_foreground_task.dart';\nimport 'package:get/get.dart';\n\nclass BottomNavigationBarComponent extends StatelessWidget {\n  const BottomNavigationBarComponent({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    return Directionality(\n        textDirection: TextDirection.ltr,\n        child: Obx(() => BrnBottomTabBar(\n              currentIndex: Routes.route2index(GlobalState.currentRoute.value),\n              onTap: (index) {\n                GlobalState.currentRoute.value = Routes.index2route(index);\n                FlutterForegroundTask.isRunningService.then((value) => {\n                      if (value) {FlutterForegroundTask.stopService()}\n                    });\n                Get.toNamed(GlobalState.currentRoute.value);\n              },\n              fixedColor: Colors.blueAccent,\n              isInkResponse: true,\n              items: [\n                BrnBottomTabBarItem(\n                  icon: const Icon(Icons.home),\n                  title: const Text('navigation.home').tr(),\n                ),\n                BrnBottomTabBarItem(\n                  icon: const Icon(Icons.key),\n                  title: const Text('navigation.pair').tr(),\n                ),\n                BrnBottomTabBarItem(\n                  icon: const Icon(Icons.link),\n                  title: const Text('navigation.connect').tr(),\n                ),\n                BrnBottomTabBarItem(\n                  icon: const Icon(Icons.info),\n                  title: const Text('navigation.info').tr(),\n                )\n              ],\n            )));\n  }\n}\n"
  },
  {
    "path": "lib/foreground/connect.dart",
    "content": "import 'dart:io';\n\nimport 'package:ascent/native/api/api.dart' as api;\nimport 'package:ascent/global_state.dart';\nimport 'package:ascent/native/frb_generated.dart';\nimport 'package:ascent/pages/connect/logic.dart';\nimport 'package:bruno/bruno.dart';\nimport 'package:easy_localization/easy_localization.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\nimport 'package:flutter_foreground_task/flutter_foreground_task.dart';\nimport 'package:easy_localization/src/easy_localization_controller.dart';\nimport 'package:easy_localization/src/localization.dart';\nimport 'package:flutter_rust_bridge/flutter_rust_bridge.dart';\nimport 'package:get/get.dart';\nimport 'package:multicast_dns/multicast_dns.dart';\n\n@pragma('vm:entry-point')\nvoid startCallback() {\n  // The setTaskHandler function must be called to handle the task in the background.\n  FlutterForegroundTask.setTaskHandler(ConnectTaskHandler());\n}\n\nenum ConnectStatus { WAIT_PORT, WAIT_LINK }\n\nclass ConnectTaskHandler extends TaskHandler {\n  String port = \"\";\n  String link = \"\";\n  static late MDnsClient mDnsClient;\n  ConnectStatus status = ConnectStatus.WAIT_PORT;\n\n  Future<void> loadTranslations() async {\n    //this will only set EasyLocalizationController.savedLocale\n    await EasyLocalizationController.initEasyLocation();\n\n    final controller = EasyLocalizationController(\n      saveLocale: true,\n      //mandatory to use EasyLocalizationController.savedLocale\n      fallbackLocale: GlobalState.supportedLocale[0],\n      supportedLocales: GlobalState.supportedLocale,\n      assetLoader: const RootBundleAssetLoader(),\n      useOnlyLangCode: false,\n      useFallbackTranslations: true,\n      path: GlobalState.localizationAssetPath,\n      onLoadError: (FlutterError e) {},\n    );\n\n    //Load translations from assets\n    await controller.loadTranslations();\n\n    //load translations into exploitable data, kept in memory\n    Localization.load(controller.locale,\n        translations: controller.translations,\n        fallbackTranslations: controller.fallbackTranslations);\n  }\n\n  Future<void> startMDNS() async {\n    print(\"Start listening to mDNS\");\n    await mDnsClient.start();\n    while (status == ConnectStatus.WAIT_PORT) {\n      await for (final PtrResourceRecord ptr\n          in mDnsClient.lookup<PtrResourceRecord>(\n              ResourceRecordQuery.serverPointer('_adb-tls-connect._tcp'))) {\n        await for (final SrvResourceRecord srv\n            in mDnsClient.lookup<SrvResourceRecord>(\n                ResourceRecordQuery.service(ptr.domainName))) {\n          port = srv.port.toString();\n          status = ConnectStatus.WAIT_LINK;\n          waitLink();\n        }\n      }\n      await Future.delayed(const Duration(milliseconds: 500));\n    }\n  }\n\n  Future<void> waitLink() async {\n    mDnsClient.stop();\n    FlutterForegroundTask.updateService(\n      notificationText: tr('connect.notification_description.waiting'),\n    );\n\n    await RustLib.init();\n    String errorMessage = \"\";\n    api\n        .doConnect(port: port, dataFolder: GlobalState.dataDir.path)\n        .catchError((error) {\n      if (error is AnyhowException) {\n        errorMessage = error.message;\n      } else {\n        errorMessage = error.toString();\n      }\n      if (errorMessage.contains(\"error.pair_cert_invalid\")) {\n        FlutterForegroundTask.sendDataToMain(\n            \"error.pair_cert_invalid#$errorMessage\");\n        return \"error.pair_cert_invalid\";\n      } else {\n        FlutterForegroundTask.sendDataToMain(\"error.other#$errorMessage\");\n        return \"error.other\";\n      }\n    }).then((value) {\n      if (!value.startsWith(\"error\")) {\n        link = value;\n        FlutterForegroundTask.updateService(\n          notificationText: tr('connect.notification_description.success'),\n        );\n        FlutterForegroundTask.sendDataToMain(link);\n      } else {\n        if (value == \"error.pair_cert_invalid\") {\n          FlutterForegroundTask.updateService(\n            notificationText: tr('connect.notification_description.repair'),\n          );\n        } else {\n          FlutterForegroundTask.updateService(\n            notificationText:\n                tr('connect.notification_description.fail') + errorMessage,\n          );\n        }\n      }\n    });\n  }\n\n  @override\n  Future<void> onDestroy(DateTime timestamp) async {\n    mDnsClient.stop();\n  }\n\n  @override\n  void onRepeatEvent(DateTime timestamp) {}\n\n  @override\n  Future<void> onStart(DateTime timestamp, TaskStarter starter) async {\n    await loadTranslations();\n    await GlobalState.init();\n    mDnsClient = MDnsClient(rawDatagramSocketFactory: (dynamic host, int port,\n        {bool reuseAddress = true, bool reusePort = true, int ttl = 1}) {\n      return RawDatagramSocket.bind(host, port,\n          reuseAddress: true, reusePort: false, ttl: ttl);\n    });\n    if (!GlobalState.disableAutoDetectPort.value) {\n      startMDNS();\n    }\n  }\n\n  @override\n  void onNotificationReplied(String id, String reply) {\n    if (status == ConnectStatus.WAIT_PORT) {\n      if (reply.length > 5) {\n        FlutterForegroundTask.updateService(\n          notificationText: tr('connect.notification_description.fail'),\n        );\n        return;\n      }\n      if (int.tryParse(reply) != null) {\n        port = reply;\n        status = ConnectStatus.WAIT_LINK;\n        waitLink();\n      }\n    }\n  }\n}\n\nclass ConnectForegroundTask {\n  Future<void> requestPermission() async {\n    // Android 12 or higher, there are restrictions on starting a foreground service.\n    //\n    // To restart the service on device reboot or unexpected problem, you need to allow below permission.\n    if (!await FlutterForegroundTask.isIgnoringBatteryOptimizations) {\n      // This function requires `android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` permission.\n      await FlutterForegroundTask.requestIgnoreBatteryOptimization();\n    }\n\n    // Android 13 and higher, you need to allow notification permission to expose foreground service notification.\n    final NotificationPermission notificationPermissionStatus =\n        await FlutterForegroundTask.checkNotificationPermission();\n    if (notificationPermissionStatus != NotificationPermission.granted) {\n      await FlutterForegroundTask.requestNotificationPermission();\n    }\n  }\n\n  Future<bool> startConnectForegroundTask(ConnectLogic logic) async {\n    GlobalState.mixpanel.track(\"Connect Begin\");\n    GlobalState.mixpanel.flush();\n    await requestPermission();\n    if (await FlutterForegroundTask.isRunningService) {\n      await FlutterForegroundTask.stopService();\n    }\n    FlutterForegroundTask.dataCallbacks.clear();\n    FlutterForegroundTask.addTaskDataCallback((dynamic data) {\n      if (data is String) {\n        if (data.startsWith(\"error.other#\")) {\n          logic.inProgress.value = false;\n          String errorMessage = data.replaceFirst(\"error.other#\", \"\");\n          Get.dialog(BrnScrollableTextDialog(\n            title: tr(\"error.title\"),\n            contentText: errorMessage,\n            submitText: tr(\"error.copy\"),\n            submitBgColor: Colors.orangeAccent,\n            onSubmitClick: () {\n              Clipboard.setData(ClipboardData(text: errorMessage));\n              BrnToast.showInCenter(\n                text: tr(\"error.copied\"),\n                context: Get.context!,\n              );\n            },\n          ));\n        } else if (data.startsWith(\"error.pair_cert_invalid#\")) {\n          logic.inProgress.value = false;\n          File(\"${GlobalState.dataDir.path}/cert.pem\").deleteSync();\n          File(\"${GlobalState.dataDir.path}/pkey.pem\").deleteSync();\n          GlobalState.hasCert.value = false;\n        } else {\n          RegExp regex = RegExp(r'https://(.+)');\n          Match? match = regex.firstMatch(data);\n          if (match != null) {\n            logic.link.value = match.group(0)!;\n            logic.inProgress.value = false;\n            Get.dialog(BrnScrollableTextDialog(\n              title: tr(\"connect.link_action.title\"),\n              contentText: logic.link.value,\n              submitText: tr(\"connect.link_action.copy_button\"),\n              submitBgColor: Colors.greenAccent,\n              onSubmitClick: () {\n                Clipboard.setData(ClipboardData(text: logic.link.value));\n                BrnToast.showInCenter(\n                  text: tr(\"connect.link_action.copied\"),\n                  context: Get.context!,\n                );\n              },\n            ));\n            GlobalState.mixpanel.track(\"Connect Complete\", properties: {\n              'Game': logic.link.value.contains('hkrpg') ? 'hkrpg' : 'gs',\n            });\n            GlobalState.mixpanel.flush();\n            FlutterForegroundTask.stopService();\n          }\n        }\n      }\n    });\n\n    FlutterForegroundTask.init(\n      androidNotificationOptions: AndroidNotificationOptions(\n        channelId: 'ascent_foreground_service',\n        channelName: 'Ascent Foreground Service',\n        channelImportance: NotificationChannelImportance.HIGH,\n        priority: NotificationPriority.HIGH,\n      ),\n      iosNotificationOptions: const IOSNotificationOptions(\n        showNotification: false,\n        playSound: false,\n      ),\n      foregroundTaskOptions: ForegroundTaskOptions(\n        allowWakeLock: true,\n        autoRunOnBoot: false,\n        allowWifiLock: true,\n        eventAction: ForegroundTaskEventAction.repeat(5000),\n      ),\n    );\n    await FlutterForegroundTask.startService(\n      notificationTitle: tr('connect.notification_title'),\n      notificationText: tr('connect.notification_description.connecting'),\n      callback: startCallback,\n      notificationButtons: [\n        NotificationButton(\n          id: 'replyButton',\n          text: tr(\"pair.notification_reply_button\"),\n          isReply: true,\n        )\n      ],\n    );\n    return true;\n  }\n}\n"
  },
  {
    "path": "lib/foreground/pair.dart",
    "content": "import 'dart:io';\n\nimport 'package:ascent/native/api/api.dart' as api;\nimport 'package:ascent/global_state.dart';\nimport 'package:ascent/native/frb_generated.dart';\nimport 'package:bruno/bruno.dart';\nimport 'package:easy_localization/easy_localization.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\nimport 'package:flutter_foreground_task/flutter_foreground_task.dart';\nimport 'package:flutter_rust_bridge/flutter_rust_bridge.dart';\nimport 'package:get/get.dart';\nimport 'package:multicast_dns/multicast_dns.dart';\nimport 'package:easy_localization/src/easy_localization_controller.dart';\nimport 'package:easy_localization/src/localization.dart';\n\n// Top level callback function, will run in isolated\n@pragma('vm:entry-point')\nvoid startCallback() {\n  // The setTaskHandler function must be called to handle the task in the background.\n  FlutterForegroundTask.setTaskHandler(PairTaskHandler());\n}\n\nenum PairStatus { WAIT_PORT, WAIT_CODE }\n\n// This will run in the foreground service isolated\nclass PairTaskHandler extends TaskHandler {\n  PairStatus status = PairStatus.WAIT_PORT;\n  String port = \"\";\n  String code = \"\";\n  static late MDnsClient mDnsClient;\n\n  Future<void> loadTranslations() async {\n    //this will only set EasyLocalizationController.savedLocale\n    await EasyLocalizationController.initEasyLocation();\n\n    final controller = EasyLocalizationController(\n      saveLocale: true,\n      //mandatory to use EasyLocalizationController.savedLocale\n      fallbackLocale: GlobalState.supportedLocale[0],\n      supportedLocales: GlobalState.supportedLocale,\n      assetLoader: const RootBundleAssetLoader(),\n      useOnlyLangCode: false,\n      useFallbackTranslations: true,\n      path: GlobalState.localizationAssetPath,\n      onLoadError: (FlutterError e) {},\n    );\n\n    //Load translations from assets\n    await controller.loadTranslations();\n\n    //load translations into exploitable data, kept in memory\n    Localization.load(controller.locale,\n        translations: controller.translations,\n        fallbackTranslations: controller.fallbackTranslations);\n  }\n\n  Future<void> startMDNS() async {\n    print(\"Start listening to mDNS\");\n    await mDnsClient.start();\n    while (status == PairStatus.WAIT_PORT) {\n      await for (final PtrResourceRecord ptr\n          in mDnsClient.lookup<PtrResourceRecord>(\n              ResourceRecordQuery.serverPointer('_adb-tls-pairing._tcp'))) {\n        await for (final SrvResourceRecord srv\n            in mDnsClient.lookup<SrvResourceRecord>(\n                ResourceRecordQuery.service(ptr.domainName))) {\n          port = srv.port.toString();\n          status = PairStatus.WAIT_CODE;\n          waitCode();\n        }\n      }\n      await Future.delayed(const Duration(milliseconds: 500));\n    }\n  }\n\n  // This is called when pairing port has been set already\n  Future<void> waitCode() async {\n    // Stop mDnsClient for it has no use\n    mDnsClient.stop();\n    FlutterForegroundTask.updateService(\n      notificationTitle:\n          \"${tr('pair.notification_title')} ${tr('pair.notification_description.pair_port')} $port\",\n      notificationText: tr('pair.notification_description.guide_code'),\n    );\n  }\n\n  Future<void> doPair() async {\n    await RustLib.init();\n    String errorMessage = \"\";\n    api\n        .doPair(port: port, code: code, dataFolder: GlobalState.dataDir.path)\n        .catchError((error) {\n      if (error is AnyhowException) {\n        errorMessage = error.message;\n      } else {\n        errorMessage = error.toString();\n      }\n      FlutterForegroundTask.sendDataToMain(\"error#$errorMessage\");\n      return false;\n    }).then((value) {\n      if (value) {\n        FlutterForegroundTask.updateService(\n          notificationTitle: tr('pair.notification_title'),\n          notificationText: tr('pair.notification_description.pair_success'),\n        );\n        FlutterForegroundTask.sendDataToMain('pair_complete');\n      } else {\n        FlutterForegroundTask.updateService(\n          notificationTitle: tr('pair.notification_title'),\n          notificationText:\n              tr('pair.notification_description.pair_fail') + errorMessage,\n        );\n        File(\"${GlobalState.dataDir.path}/cert.pem\").deleteSync();\n        File(\"${GlobalState.dataDir.path}/pkey.pem\").deleteSync();\n      }\n    });\n  }\n\n  @override\n  Future<void> onDestroy(DateTime timestamp) async {\n    mDnsClient.stop();\n  }\n\n  @override\n  void onRepeatEvent(DateTime timestamp) {}\n\n  @override\n  Future<void> onStart(DateTime timestamp, TaskStarter starter) async {\n    loadTranslations();\n    await GlobalState.init();\n    mDnsClient = MDnsClient(rawDatagramSocketFactory: (dynamic host, int port,\n        {bool reuseAddress = true, bool reusePort = true, int ttl = 1}) {\n      return RawDatagramSocket.bind(host, port,\n          reuseAddress: true, reusePort: false, ttl: ttl);\n    });\n    // Start mdns listener\n    if (!GlobalState.disableAutoDetectPort.value) {\n      startMDNS();\n    }\n  }\n\n  @override\n  void onNotificationReplied(String id, String reply) {\n    switch (status) {\n      case PairStatus.WAIT_PORT:\n        if (int.tryParse(reply) != null) {\n          port = reply;\n          status = PairStatus.WAIT_CODE;\n          waitCode();\n        }\n        break;\n      case PairStatus.WAIT_CODE:\n        code = reply;\n        doPair();\n        break;\n    }\n  }\n}\n\nclass PairForegroundTask {\n  Future<void> requestPermission() async {\n    // Android 12 or higher, there are restrictions on starting a foreground service.\n    //\n    // To restart the service on device reboot or unexpected problem, you need to allow below permission.\n    if (!await FlutterForegroundTask.isIgnoringBatteryOptimizations) {\n      // This function requires `android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` permission.\n      await FlutterForegroundTask.requestIgnoreBatteryOptimization();\n    }\n\n    // Android 13 and higher, you need to allow notification permission to expose foreground service notification.\n    final NotificationPermission notificationPermissionStatus =\n        await FlutterForegroundTask.checkNotificationPermission();\n    if (notificationPermissionStatus != NotificationPermission.granted) {\n      await FlutterForegroundTask.requestNotificationPermission();\n    }\n  }\n\n  void pairCallback(Object data) {\n    if (data is String) {\n      if (data == \"pair_complete\") {\n        WidgetsBinding.instance.addPostFrameCallback((_) {\n          GlobalState.hasCert.value = true;\n          GlobalState.mixpanel.track(\"Pair Complete\");\n          GlobalState.mixpanel.flush();\n          FlutterForegroundTask.stopService();\n        });\n      } else if (data.startsWith(\"error#\")) {\n        String errorMessage = data.replaceFirst(\"error#\", \"\");\n        Get.dialog(BrnScrollableTextDialog(\n          title: tr(\"error.title\"),\n          contentText: errorMessage,\n          submitText: tr(\"error.copy\"),\n          submitBgColor: Colors.orangeAccent,\n          onSubmitClick: () {\n            Clipboard.setData(ClipboardData(text: errorMessage));\n            BrnToast.showInCenter(\n              text: tr(\"error.copied\"),\n              context: Get.context!,\n            );\n          },\n        ));\n      }\n    }\n  }\n\n  Future<bool> startPairForegroundTask() async {\n    GlobalState.mixpanel.track(\"Pair Begin\");\n    GlobalState.mixpanel.flush();\n    // Request permission\n    await requestPermission();\n    // Stop any foreground service still running\n    if (await FlutterForegroundTask.isRunningService) {\n      await FlutterForegroundTask.stopService();\n    }\n\n    FlutterForegroundTask.addTaskDataCallback(pairCallback);\n\n    // Init foreground task\n    FlutterForegroundTask.init(\n      androidNotificationOptions: AndroidNotificationOptions(\n        channelId: 'ascent_foreground_service',\n        channelName: 'Ascent Foreground Service',\n        channelImportance: NotificationChannelImportance.HIGH,\n        priority: NotificationPriority.HIGH,\n      ),\n      iosNotificationOptions: const IOSNotificationOptions(\n        showNotification: false,\n        playSound: false,\n      ),\n      foregroundTaskOptions: ForegroundTaskOptions(\n        eventAction: ForegroundTaskEventAction.repeat(5000),\n        allowWakeLock: true,\n        autoRunOnBoot: false,\n        allowWifiLock: true,\n      ),\n    );\n\n    // Start task\n    await FlutterForegroundTask.startService(\n        notificationTitle: tr('pair.notification_title'),\n        notificationText: tr('pair.notification_description.guide_port'),\n        callback: startCallback,\n        notificationButtons: [\n          NotificationButton(\n            id: 'replyButton',\n            text: tr(\"pair.notification_reply_button\"),\n            isReply: true,\n          )\n        ]);\n    return true;\n  }\n}\n"
  },
  {
    "path": "lib/foreground/root_connect.dart",
    "content": "import 'package:ascent/global_state.dart';\nimport 'package:ascent/pages/connect/logic.dart';\nimport 'package:bruno/bruno.dart';\nimport 'package:easy_localization/easy_localization.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\nimport 'package:flutter_foreground_task/flutter_foreground_task.dart';\nimport 'package:easy_localization/src/easy_localization_controller.dart';\nimport 'package:easy_localization/src/localization.dart';\nimport 'package:get/get.dart';\nimport 'package:root/root.dart';\n\n@pragma('vm:entry-point')\nvoid startCallback() {\n  // The setTaskHandler function must be called to handle the task in the background.\n  FlutterForegroundTask.setTaskHandler(RootConnectTaskHandler());\n}\n\nclass RootConnectTaskHandler extends TaskHandler {\n  String link = \"\";\n\n  Future<void> loadTranslations() async {\n    //this will only set EasyLocalizationController.savedLocale\n    await EasyLocalizationController.initEasyLocation();\n\n    final controller = EasyLocalizationController(\n      saveLocale: true,\n      //mandatory to use EasyLocalizationController.savedLocale\n      fallbackLocale: GlobalState.supportedLocale[0],\n      supportedLocales: GlobalState.supportedLocale,\n      assetLoader: const RootBundleAssetLoader(),\n      useOnlyLangCode: false,\n      useFallbackTranslations: true,\n      path: GlobalState.localizationAssetPath,\n      onLoadError: (FlutterError e) {},\n    );\n\n    //Load translations from assets\n    await controller.loadTranslations();\n\n    //load translations into exploitable data, kept in memory\n    Localization.load(controller.locale,\n        translations: controller.translations,\n        fallbackTranslations: controller.fallbackTranslations);\n  }\n\n  Future<void> waitLink() async {\n    FlutterForegroundTask.updateService(\n      notificationText: tr('root_connect.notification_description.waiting'),\n    );\n\n    while (link.isEmpty) {\n      String? data = await Root.exec(\n          cmd:\n              \"logcat -d | grep -E 'https://(webstatic|hk4e-api|webstatic-sea|hk4e-api-os|api-takumi|api-os-takumi|gs|aki-gm-resources-oversea).(mihoyo\\\\.com|hoyoverse\\\\.com|aki-game\\\\.net|aki-game\\\\.com)' | grep -i 'gacha' | tail -n 1\");\n      if (data != null) {\n        link = data;\n        FlutterForegroundTask.sendDataToMain(link);\n      }\n      Future.delayed(const Duration(milliseconds: 500));\n    }\n  }\n\n  @override\n  Future<void> onDestroy(DateTime timestamp) async {}\n\n  @override\n  void onRepeatEvent(DateTime timestamp) {}\n\n  @override\n  Future<void> onStart(DateTime timestamp, TaskStarter starter) async {\n    await loadTranslations();\n    await GlobalState.init();\n    waitLink();\n  }\n}\n\nclass RootConnectForegroundTask {\n  Future<void> requestPermission() async {\n    // Android 12 or higher, there are restrictions on starting a foreground service.\n    //\n    // To restart the service on device reboot or unexpected problem, you need to allow below permission.\n    if (!await FlutterForegroundTask.isIgnoringBatteryOptimizations) {\n      // This function requires `android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` permission.\n      await FlutterForegroundTask.requestIgnoreBatteryOptimization();\n    }\n\n    // Android 13 and higher, you need to allow notification permission to expose foreground service notification.\n    final NotificationPermission notificationPermissionStatus =\n        await FlutterForegroundTask.checkNotificationPermission();\n    if (notificationPermissionStatus != NotificationPermission.granted) {\n      await FlutterForegroundTask.requestNotificationPermission();\n    }\n  }\n\n  Future<bool> startRootConnectForegroundTask(ConnectLogic logic) async {\n    GlobalState.mixpanel.track(\"Root Connect Begin\");\n    GlobalState.mixpanel.flush();\n    await requestPermission();\n    if (await FlutterForegroundTask.isRunningService) {\n      await FlutterForegroundTask.stopService();\n    }\n    FlutterForegroundTask.dataCallbacks.clear();\n    FlutterForegroundTask.addTaskDataCallback((dynamic data) {\n      if (data is String) {\n        if (data.startsWith(\"error.other#\")) {\n          logic.inProgress.value = false;\n          String errorMessage = data.replaceFirst(\"error.other#\", \"\");\n          Get.dialog(BrnScrollableTextDialog(\n            title: tr(\"error.title\"),\n            contentText: errorMessage,\n            submitText: tr(\"error.copy\"),\n            submitBgColor: Colors.orangeAccent,\n            onSubmitClick: () {\n              Clipboard.setData(ClipboardData(text: errorMessage));\n              BrnToast.showInCenter(\n                text: tr(\"error.copied\"),\n                context: Get.context!,\n              );\n            },\n          ));\n        } else {\n          RegExp regex = RegExp(r'https://(.+)');\n          Match? match = regex.firstMatch(data);\n          if (match != null) {\n            logic.link.value = match.group(0)!;\n            logic.inProgress.value = false;\n            Get.dialog(BrnScrollableTextDialog(\n              title: tr(\"connect.link_action.title\"),\n              contentText: logic.link.value,\n              submitText: tr(\"connect.link_action.copy_button\"),\n              submitBgColor: Colors.greenAccent,\n              onSubmitClick: () {\n                Clipboard.setData(ClipboardData(text: logic.link.value));\n                BrnToast.showInCenter(\n                  text: tr(\"connect.link_action.copied\"),\n                  context: Get.context!,\n                );\n              },\n            ));\n            GlobalState.mixpanel.track(\"Connect Complete\", properties: {\n              'Game': logic.link.value.contains('hkrpg') ? 'hkrpg' : 'gs',\n            });\n            GlobalState.mixpanel.flush();\n            FlutterForegroundTask.stopService();\n          }\n        }\n      }\n    });\n\n    FlutterForegroundTask.init(\n      androidNotificationOptions: AndroidNotificationOptions(\n        channelId: 'ascent_foreground_service',\n        channelName: 'Ascent Foreground Service',\n        channelImportance: NotificationChannelImportance.HIGH,\n        priority: NotificationPriority.HIGH,\n      ),\n      iosNotificationOptions: const IOSNotificationOptions(\n        showNotification: false,\n        playSound: false,\n      ),\n      foregroundTaskOptions: ForegroundTaskOptions(\n        eventAction: ForegroundTaskEventAction.repeat(5000),\n        allowWakeLock: true,\n        autoRunOnBoot: false,\n        allowWifiLock: true,\n      ),\n    );\n    await FlutterForegroundTask.startService(\n      notificationTitle: tr('root_connect.notification_title'),\n      notificationText: tr('root_connect.notification_description.waiting'),\n      callback: startCallback,\n    );\n    return true;\n  }\n}\n"
  },
  {
    "path": "lib/foreground/shizuku_connect.dart",
    "content": "import 'package:ascent/global_state.dart';\nimport 'package:ascent/pages/connect/logic.dart';\nimport 'package:bruno/bruno.dart';\nimport 'package:easy_localization/easy_localization.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\nimport 'package:flutter_foreground_task/flutter_foreground_task.dart';\nimport 'package:easy_localization/src/easy_localization_controller.dart';\nimport 'package:easy_localization/src/localization.dart';\nimport 'package:get/get.dart';\nimport 'package:shizuku_api/shizuku_api.dart';\n\n@pragma('vm:entry-point')\nvoid startCallback() {\n  // The setTaskHandler function must be called to handle the task in the background.\n  FlutterForegroundTask.setTaskHandler(ShizukuConnectTaskHandler());\n}\n\nclass ShizukuConnectTaskHandler extends TaskHandler {\n  String link = \"\";\n\n  Future<void> loadTranslations() async {\n    //this will only set EasyLocalizationController.savedLocale\n    await EasyLocalizationController.initEasyLocation();\n\n    final controller = EasyLocalizationController(\n      saveLocale: true,\n      //mandatory to use EasyLocalizationController.savedLocale\n      fallbackLocale: GlobalState.supportedLocale[0],\n      supportedLocales: GlobalState.supportedLocale,\n      assetLoader: const RootBundleAssetLoader(),\n      useOnlyLangCode: false,\n      useFallbackTranslations: true,\n      path: GlobalState.localizationAssetPath,\n      onLoadError: (FlutterError e) {},\n    );\n\n    //Load translations from assets\n    await controller.loadTranslations();\n\n    //load translations into exploitable data, kept in memory\n    Localization.load(controller.locale,\n        translations: controller.translations,\n        fallbackTranslations: controller.fallbackTranslations);\n  }\n\n  Future<void> waitLink() async {\n    FlutterForegroundTask.updateService(\n      notificationText: tr('shizuku_connect.notification_description.waiting'),\n    );\n\n    final _shizukuApiPlugin = ShizukuApi();\n    while (link.isEmpty) {\n      String? data = await _shizukuApiPlugin.runCommand(\n          \"logcat -d | grep -E 'https://(webstatic|hk4e-api|webstatic-sea|hk4e-api-os|api-takumi|api-os-takumi|gs|aki-gm-resources-oversea).(mihoyo\\\\.com|hoyoverse\\\\.com|aki-game\\\\.net|aki-game\\\\.com)' | grep -i 'gacha' | tail -n 1\");\n      if (data != null) {\n        link = data;\n        FlutterForegroundTask.sendDataToMain(link);\n      }\n      Future.delayed(const Duration(milliseconds: 500));\n    }\n  }\n\n  @override\n  Future<void> onDestroy(DateTime timestamp) async {}\n\n  @override\n  void onRepeatEvent(DateTime timestamp) {}\n\n  @override\n  Future<void> onStart(DateTime timestamp, TaskStarter starter) async {\n    await loadTranslations();\n    await GlobalState.init();\n    waitLink();\n  }\n}\n\nclass ShizukuConnectForegroundTask {\n  Future<void> requestPermission() async {\n    // Android 12 or higher, there are restrictions on starting a foreground service.\n    //\n    // To restart the service on device reboot or unexpected problem, you need to allow below permission.\n    if (!await FlutterForegroundTask.isIgnoringBatteryOptimizations) {\n      // This function requires `android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` permission.\n      await FlutterForegroundTask.requestIgnoreBatteryOptimization();\n    }\n\n    // Android 13 and higher, you need to allow notification permission to expose foreground service notification.\n    final NotificationPermission notificationPermissionStatus =\n        await FlutterForegroundTask.checkNotificationPermission();\n    if (notificationPermissionStatus != NotificationPermission.granted) {\n      await FlutterForegroundTask.requestNotificationPermission();\n    }\n  }\n\n  Future<bool> startShizukuConnectForegroundTask(ConnectLogic logic) async {\n    GlobalState.mixpanel.track(\"Shizuku Connect Begin\");\n    GlobalState.mixpanel.flush();\n    await requestPermission();\n    if (await FlutterForegroundTask.isRunningService) {\n      await FlutterForegroundTask.stopService();\n    }\n    FlutterForegroundTask.dataCallbacks.clear();\n    FlutterForegroundTask.addTaskDataCallback((dynamic data) {\n      if (data is String) {\n        if (data.startsWith(\"error.other#\")) {\n          logic.inProgress.value = false;\n          String errorMessage = data.replaceFirst(\"error.other#\", \"\");\n          Get.dialog(BrnScrollableTextDialog(\n            title: tr(\"error.title\"),\n            contentText: errorMessage,\n            submitText: tr(\"error.copy\"),\n            submitBgColor: Colors.orangeAccent,\n            onSubmitClick: () {\n              Clipboard.setData(ClipboardData(text: errorMessage));\n              BrnToast.showInCenter(\n                text: tr(\"error.copied\"),\n                context: Get.context!,\n              );\n            },\n          ));\n        } else {\n          RegExp regex = RegExp(r'https://(.+)');\n          Match? match = regex.firstMatch(data);\n          if (match != null) {\n            logic.link.value = match.group(0)!;\n            logic.inProgress.value = false;\n            Get.dialog(BrnScrollableTextDialog(\n              title: tr(\"connect.link_action.title\"),\n              contentText: logic.link.value,\n              submitText: tr(\"connect.link_action.copy_button\"),\n              submitBgColor: Colors.greenAccent,\n              onSubmitClick: () {\n                Clipboard.setData(ClipboardData(text: logic.link.value));\n                BrnToast.showInCenter(\n                  text: tr(\"connect.link_action.copied\"),\n                  context: Get.context!,\n                );\n              },\n            ));\n            GlobalState.mixpanel.track(\"Connect Complete\", properties: {\n              'Game': logic.link.value.contains('hkrpg') ? 'hkrpg' : 'gs',\n            });\n            GlobalState.mixpanel.flush();\n            FlutterForegroundTask.stopService();\n          }\n        }\n      }\n    });\n\n    FlutterForegroundTask.init(\n      androidNotificationOptions: AndroidNotificationOptions(\n        channelId: 'ascent_foreground_service',\n        channelName: 'Ascent Foreground Service',\n        channelImportance: NotificationChannelImportance.HIGH,\n        priority: NotificationPriority.HIGH,\n      ),\n      iosNotificationOptions: const IOSNotificationOptions(\n        showNotification: false,\n        playSound: false,\n      ),\n      foregroundTaskOptions: ForegroundTaskOptions(\n        eventAction: ForegroundTaskEventAction.repeat(5000),\n        allowWakeLock: true,\n        autoRunOnBoot: false,\n        allowWifiLock: true,\n      ),\n    );\n    await FlutterForegroundTask.startService(\n      notificationTitle: tr('shizuku_connect.notification_title'),\n      notificationText: tr('shizuku_connect.notification_description.waiting'),\n      callback: startCallback,\n    );\n    return true;\n  }\n}\n"
  },
  {
    "path": "lib/global_state.dart",
    "content": "import 'dart:async';\nimport 'dart:io';\nimport 'dart:ui';\n\nimport 'package:flutter/foundation.dart';\nimport 'package:flutter/services.dart';\nimport 'package:get/get.dart';\nimport 'package:mixpanel_flutter/mixpanel_flutter.dart';\nimport 'package:path_provider/path_provider.dart';\nimport 'package:root/root.dart';\nimport 'package:shizuku_api/shizuku_api.dart';\n\nclass GlobalState {\n  static const version = \"2.4.0\";\n  static String discord = \"https://discord.gg/6v6HEUaRWk\";\n\n  static const platform = MethodChannel('cafe.f403.ascent/main');\n  static Rx<String> currentRoute = \"/home\".obs;\n  static late final Directory dataDir;\n  static const String localizationAssetPath = \"assets/translations\";\n  static Rx<bool> hasCert = false.obs;\n  static Rx<bool> rootEnabled = false.obs;\n  static Rx<bool> shizukuEnabled = false.obs;\n  static late Mixpanel mixpanel;\n  static StreamSubscription? intentSubscription;\n  static String? locale;\n  static Rx<bool> disableAutoDetectPort = false.obs;\n\n  static const List<Locale> supportedLocale = [\n    Locale('en', 'US'),\n    Locale('zh', 'CN'),\n    Locale('ru', 'RU'),\n  ];\n\n  static Future<void> init() async {\n    dataDir = await getApplicationDocumentsDirectory();\n    hasCert.value = File(\"${dataDir.path}/cert.pem\").existsSync();\n    if (kDebugMode) {\n      print(\"Data directory: ${dataDir.path}\");\n    }\n\n    disableAutoDetectPort.value =\n        File(\"${dataDir.path}/disableAutoDetectPort\").existsSync();\n\n    mixpanel = await Mixpanel.init(\"1bad86a59f59ee1d395c31b61bf9202a\",\n        trackAutomaticEvents: true);\n\n    rootEnabled.value = await Root.isRooted() ?? false;\n    final _shizukuApiPlugin = ShizukuApi();\n    if ((await _shizukuApiPlugin.pingBinder() ?? false) &&\n        (await _shizukuApiPlugin.checkPermission() ?? false) &&\n        (await _shizukuApiPlugin.requestPermission() ?? false)) {\n      shizukuEnabled.value = true;\n    }\n  }\n}\n"
  },
  {
    "path": "lib/main.dart",
    "content": "import 'dart:convert';\nimport 'dart:io';\n\nimport 'package:ascent/global_state.dart';\nimport 'package:ascent/native/frb_generated.dart';\nimport 'package:ascent/routes.dart';\nimport 'package:bruno/bruno.dart';\nimport 'package:easy_localization/easy_localization.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\nimport 'package:flutter_foreground_task/flutter_foreground_task.dart';\nimport 'package:get/get.dart';\nimport 'package:pub_semver/pub_semver.dart';\nimport 'package:receive_intent/receive_intent.dart' as intent;\nimport 'package:uri_to_file/uri_to_file.dart';\nimport 'package:url_launcher/url_launcher.dart';\nimport 'components/bottom_navigation_bar/view.dart';\nimport 'package:http/http.dart' as http;\n\nimport 'native/api/api.dart';\n\nvoid main() async {\n  WidgetsFlutterBinding.ensureInitialized();\n  // Load localizations\n  await EasyLocalization.ensureInitialized();\n\n  await RustLib.init();\n  // Set some final global data\n  await GlobalState.init();\n\n  FlutterForegroundTask.initCommunicationPort();\n  runApp(\n    WithForegroundTask(\n      child: EasyLocalization(\n        supportedLocales: GlobalState.supportedLocale,\n        path: GlobalState.localizationAssetPath,\n        fallbackLocale: GlobalState.supportedLocale[0],\n        child: const AscentApp(),\n      ),\n    ),\n  );\n}\n\nFuture<void> checkUpdate() async {\n  String url = GlobalState.locale == \"zh_CN\"\n      ? \"https://gist.gitmirror.com/4o3F/d44252ab04227a81b8270fe85a50691a/raw\"\n      : \"https://gist.github.com/4o3F/d44252ab04227a81b8270fe85a50691a/raw\";\n  http.Response response = await http.get(Uri.parse(url));\n  Map parsed = json.decode(response.body);\n  String version = parsed['version'];\n  String discord = parsed['discord'];\n  GlobalState.discord = discord;\n  Version newVersion = Version.parse(version);\n  Version currentVersion = Version.parse(GlobalState.version);\n  if (newVersion > currentVersion) {\n    String updateInfo =\n        parsed['info'][GlobalState.locale] ?? parsed['info']['en_US'];\n    Uri url = Uri.parse(GlobalState.locale == \"zh_CN\"\n        ? parsed['url']['backup']\n        : parsed['url']['main']);\n    BrnEnhanceOperationDialog dialog = BrnEnhanceOperationDialog(\n      context: Get.context!,\n      titleText: tr('update.title') + version,\n      descText: updateInfo,\n      mainButtonText: tr('update.ok'),\n      secondaryButtonText: tr('update.cancel'),\n      onMainButtonClick: () async {\n        if (!await launchUrl(url, mode: LaunchMode.externalApplication)) {\n          await launchUrl(url);\n        }\n      },\n      onSecondaryButtonClick: () {\n        Get.back(closeOverlays: true);\n      },\n    );\n    dialog.show();\n  }\n}\n\nclass AscentApp extends StatelessWidget {\n  const AscentApp({super.key});\n\n  Future<void> initReceiveIntent() async {\n    try {\n      final receivedIntent = await intent.ReceiveIntent.getInitialIntent();\n      if (receivedIntent != null && receivedIntent.action != null) {\n        if (receivedIntent.action == \"android.intent.action.SEND\" &&\n            receivedIntent.extra != null) {\n          File file = await toFile(\n              receivedIntent.extra?[\"android.intent.extra.STREAM\"]);\n          String path = file.path;\n          String link = await doFilter(filePath: path);\n          file.deleteSync();\n          GlobalState.mixpanel.track(\"System Trace Complete\", properties: {\n            'Game': link.contains('hkrpg') ? 'hkrpg' : 'gs',\n          });\n          Get.dialog(BrnScrollableTextDialog(\n            title: tr(\"connect.link_action.title\"),\n            contentText: link,\n            submitText: tr(\"connect.link_action.copy_button\"),\n            submitBgColor: Colors.greenAccent,\n            onSubmitClick: () {\n              Clipboard.setData(ClipboardData(text: link));\n              BrnToast.showInCenter(\n                text: tr(\"connect.link_action.copied\"),\n                context: Get.context!,\n              );\n            },\n          ));\n          GlobalState.mixpanel.flush();\n        }\n      }\n    } on PlatformException catch (_, e) {\n      GlobalState.mixpanel\n          .track('Platform error', properties: {'error': e.toString()});\n    }\n\n    GlobalState.intentSubscription ??= intent.ReceiveIntent.receivedIntentStream\n        .listen((intent.Intent? receivedIntent) async {\n      if (receivedIntent != null && receivedIntent.action != null) {\n        if (receivedIntent.action == \"android.intent.action.SEND\" &&\n            receivedIntent.extra != null) {\n          File file = await toFile(\n              receivedIntent.extra?[\"android.intent.extra.STREAM\"]);\n          String path = file.path;\n          String link = await doFilter(filePath: path);\n          file.deleteSync();\n          GlobalState.mixpanel.track(\"System Trace Complete\", properties: {\n            'Game': link.contains('hkrpg') ? 'hkrpg' : 'gs',\n          });\n          Get.dialog(BrnScrollableTextDialog(\n            title: tr(\"connect.link_action.title\"),\n            contentText: link,\n            submitText: tr(\"connect.link_action.copy_button\"),\n            submitBgColor: Colors.greenAccent,\n            onSubmitClick: () {\n              Clipboard.setData(ClipboardData(text: link));\n              BrnToast.showInCenter(\n                text: tr(\"connect.link_action.copied\"),\n                context: Get.context!,\n              );\n            },\n          ));\n          GlobalState.mixpanel.flush();\n        }\n      }\n    }, onError: (err) {\n      GlobalState.mixpanel\n          .track('Platform error', properties: {'error': err.toString()});\n    });\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    initReceiveIntent();\n    GlobalState.locale = context.deviceLocale.toString();\n    checkUpdate();\n    initLogger();\n    return MaterialApp(\n        localizationsDelegates: context.localizationDelegates,\n        supportedLocales: context.supportedLocales,\n        locale: context.locale,\n        debugShowCheckedModeBanner: false,\n        home: Column(\n          children: [\n            Expanded(\n              child: Scaffold(\n                body: GetMaterialApp(\n                  initialRoute: Routes.defaultRoute,\n                  getPages: Routes.routes,\n                  defaultTransition: Transition.fade,\n                  debugShowCheckedModeBanner: false,\n                  routingCallback: (routing) {\n                    // Switch current route, mainly used for updating bottom navigation tab\n                    GlobalState.currentRoute.value = routing!.current;\n                  },\n                ),\n              ),\n            ),\n            BottomNavigationBarComponent()\n          ],\n        ));\n  }\n}"
  },
  {
    "path": "lib/native/api/api.dart",
    "content": "// This file is automatically generated, so please do not edit it.\n// @generated by `flutter_rust_bridge`@ 2.11.1.\n\n// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import\n\nimport '../frb_generated.dart';\nimport 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';\n\nFuture<bool> doPair(\n        {required String port,\n        required String code,\n        required String dataFolder}) =>\n    RustLib.instance.api\n        .crateApiApiDoPair(port: port, code: code, dataFolder: dataFolder);\n\nFuture<String> doConnect({required String port, required String dataFolder}) =>\n    RustLib.instance.api\n        .crateApiApiDoConnect(port: port, dataFolder: dataFolder);\n\nFuture<String> doFilter({required String filePath}) =>\n    RustLib.instance.api.crateApiApiDoFilter(filePath: filePath);\n\nFuture<void> initLogger() => RustLib.instance.api.crateApiApiInitLogger();\n"
  },
  {
    "path": "lib/native/frb_generated.dart",
    "content": "// This file is automatically generated, so please do not edit it.\n// @generated by `flutter_rust_bridge`@ 2.11.1.\n\n// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field\n\nimport 'api/api.dart';\nimport 'dart:async';\nimport 'dart:convert';\nimport 'frb_generated.dart';\nimport 'frb_generated.io.dart'\n    if (dart.library.js_interop) 'frb_generated.web.dart';\nimport 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';\n\n/// Main entrypoint of the Rust API\nclass RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {\n  @internal\n  static final instance = RustLib._();\n\n  RustLib._();\n\n  /// Initialize flutter_rust_bridge\n  static Future<void> init({\n    RustLibApi? api,\n    BaseHandler? handler,\n    ExternalLibrary? externalLibrary,\n    bool forceSameCodegenVersion = true,\n  }) async {\n    await instance.initImpl(\n      api: api,\n      handler: handler,\n      externalLibrary: externalLibrary,\n      forceSameCodegenVersion: forceSameCodegenVersion,\n    );\n  }\n\n  /// Initialize flutter_rust_bridge in mock mode.\n  /// No libraries for FFI are loaded.\n  static void initMock({\n    required RustLibApi api,\n  }) {\n    instance.initMockImpl(\n      api: api,\n    );\n  }\n\n  /// Dispose flutter_rust_bridge\n  ///\n  /// The call to this function is optional, since flutter_rust_bridge (and everything else)\n  /// is automatically disposed when the app stops.\n  static void dispose() => instance.disposeImpl();\n\n  @override\n  ApiImplConstructor<RustLibApiImpl, RustLibWire> get apiImplConstructor =>\n      RustLibApiImpl.new;\n\n  @override\n  WireConstructor<RustLibWire> get wireConstructor =>\n      RustLibWire.fromExternalLibrary;\n\n  @override\n  Future<void> executeRustInitializers() async {}\n\n  @override\n  ExternalLibraryLoaderConfig get defaultExternalLibraryLoaderConfig =>\n      kDefaultExternalLibraryLoaderConfig;\n\n  @override\n  String get codegenVersion => '2.11.1';\n\n  @override\n  int get rustContentHash => -637951497;\n\n  static const kDefaultExternalLibraryLoaderConfig =\n      ExternalLibraryLoaderConfig(\n    stem: 'rust_lib_ascent',\n    ioDirectory: 'rust/target/release/',\n    webPrefix: 'pkg/',\n  );\n}\n\nabstract class RustLibApi extends BaseApi {\n  Future<String> crateApiApiDoConnect(\n      {required String port, required String dataFolder});\n\n  Future<String> crateApiApiDoFilter({required String filePath});\n\n  Future<bool> crateApiApiDoPair(\n      {required String port, required String code, required String dataFolder});\n\n  Future<void> crateApiApiInitLogger();\n}\n\nclass RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {\n  RustLibApiImpl({\n    required super.handler,\n    required super.wire,\n    required super.generalizedFrbRustBinding,\n    required super.portManager,\n  });\n\n  @override\n  Future<String> crateApiApiDoConnect(\n      {required String port, required String dataFolder}) {\n    return handler.executeNormal(NormalTask(\n      callFfi: (port_) {\n        final serializer = SseSerializer(generalizedFrbRustBinding);\n        sse_encode_String(port, serializer);\n        sse_encode_String(dataFolder, serializer);\n        pdeCallFfi(generalizedFrbRustBinding, serializer,\n            funcId: 1, port: port_);\n      },\n      codec: SseCodec(\n        decodeSuccessData: sse_decode_String,\n        decodeErrorData: sse_decode_AnyhowException,\n      ),\n      constMeta: kCrateApiApiDoConnectConstMeta,\n      argValues: [port, dataFolder],\n      apiImpl: this,\n    ));\n  }\n\n  TaskConstMeta get kCrateApiApiDoConnectConstMeta => const TaskConstMeta(\n        debugName: \"do_connect\",\n        argNames: [\"port\", \"dataFolder\"],\n      );\n\n  @override\n  Future<String> crateApiApiDoFilter({required String filePath}) {\n    return handler.executeNormal(NormalTask(\n      callFfi: (port_) {\n        final serializer = SseSerializer(generalizedFrbRustBinding);\n        sse_encode_String(filePath, serializer);\n        pdeCallFfi(generalizedFrbRustBinding, serializer,\n            funcId: 2, port: port_);\n      },\n      codec: SseCodec(\n        decodeSuccessData: sse_decode_String,\n        decodeErrorData: sse_decode_AnyhowException,\n      ),\n      constMeta: kCrateApiApiDoFilterConstMeta,\n      argValues: [filePath],\n      apiImpl: this,\n    ));\n  }\n\n  TaskConstMeta get kCrateApiApiDoFilterConstMeta => const TaskConstMeta(\n        debugName: \"do_filter\",\n        argNames: [\"filePath\"],\n      );\n\n  @override\n  Future<bool> crateApiApiDoPair(\n      {required String port,\n      required String code,\n      required String dataFolder}) {\n    return handler.executeNormal(NormalTask(\n      callFfi: (port_) {\n        final serializer = SseSerializer(generalizedFrbRustBinding);\n        sse_encode_String(port, serializer);\n        sse_encode_String(code, serializer);\n        sse_encode_String(dataFolder, serializer);\n        pdeCallFfi(generalizedFrbRustBinding, serializer,\n            funcId: 3, port: port_);\n      },\n      codec: SseCodec(\n        decodeSuccessData: sse_decode_bool,\n        decodeErrorData: sse_decode_AnyhowException,\n      ),\n      constMeta: kCrateApiApiDoPairConstMeta,\n      argValues: [port, code, dataFolder],\n      apiImpl: this,\n    ));\n  }\n\n  TaskConstMeta get kCrateApiApiDoPairConstMeta => const TaskConstMeta(\n        debugName: \"do_pair\",\n        argNames: [\"port\", \"code\", \"dataFolder\"],\n      );\n\n  @override\n  Future<void> crateApiApiInitLogger() {\n    return handler.executeNormal(NormalTask(\n      callFfi: (port_) {\n        final serializer = SseSerializer(generalizedFrbRustBinding);\n        pdeCallFfi(generalizedFrbRustBinding, serializer,\n            funcId: 4, port: port_);\n      },\n      codec: SseCodec(\n        decodeSuccessData: sse_decode_unit,\n        decodeErrorData: null,\n      ),\n      constMeta: kCrateApiApiInitLoggerConstMeta,\n      argValues: [],\n      apiImpl: this,\n    ));\n  }\n\n  TaskConstMeta get kCrateApiApiInitLoggerConstMeta => const TaskConstMeta(\n        debugName: \"init_logger\",\n        argNames: [],\n      );\n\n  @protected\n  AnyhowException dco_decode_AnyhowException(dynamic raw) {\n    // Codec=Dco (DartCObject based), see doc to use other codecs\n    return AnyhowException(raw as String);\n  }\n\n  @protected\n  String dco_decode_String(dynamic raw) {\n    // Codec=Dco (DartCObject based), see doc to use other codecs\n    return raw as String;\n  }\n\n  @protected\n  bool dco_decode_bool(dynamic raw) {\n    // Codec=Dco (DartCObject based), see doc to use other codecs\n    return raw as bool;\n  }\n\n  @protected\n  Uint8List dco_decode_list_prim_u_8_strict(dynamic raw) {\n    // Codec=Dco (DartCObject based), see doc to use other codecs\n    return raw as Uint8List;\n  }\n\n  @protected\n  int dco_decode_u_8(dynamic raw) {\n    // Codec=Dco (DartCObject based), see doc to use other codecs\n    return raw as int;\n  }\n\n  @protected\n  void dco_decode_unit(dynamic raw) {\n    // Codec=Dco (DartCObject based), see doc to use other codecs\n    return;\n  }\n\n  @protected\n  AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    var inner = sse_decode_String(deserializer);\n    return AnyhowException(inner);\n  }\n\n  @protected\n  String sse_decode_String(SseDeserializer deserializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    var inner = sse_decode_list_prim_u_8_strict(deserializer);\n    return utf8.decoder.convert(inner);\n  }\n\n  @protected\n  bool sse_decode_bool(SseDeserializer deserializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    return deserializer.buffer.getUint8() != 0;\n  }\n\n  @protected\n  Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    var len_ = sse_decode_i_32(deserializer);\n    return deserializer.buffer.getUint8List(len_);\n  }\n\n  @protected\n  int sse_decode_u_8(SseDeserializer deserializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    return deserializer.buffer.getUint8();\n  }\n\n  @protected\n  void sse_decode_unit(SseDeserializer deserializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n  }\n\n  @protected\n  int sse_decode_i_32(SseDeserializer deserializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    return deserializer.buffer.getInt32();\n  }\n\n  @protected\n  void sse_encode_AnyhowException(\n      AnyhowException self, SseSerializer serializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    sse_encode_String(self.message, serializer);\n  }\n\n  @protected\n  void sse_encode_String(String self, SseSerializer serializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer);\n  }\n\n  @protected\n  void sse_encode_bool(bool self, SseSerializer serializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    serializer.buffer.putUint8(self ? 1 : 0);\n  }\n\n  @protected\n  void sse_encode_list_prim_u_8_strict(\n      Uint8List self, SseSerializer serializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    sse_encode_i_32(self.length, serializer);\n    serializer.buffer.putUint8List(self);\n  }\n\n  @protected\n  void sse_encode_u_8(int self, SseSerializer serializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    serializer.buffer.putUint8(self);\n  }\n\n  @protected\n  void sse_encode_unit(void self, SseSerializer serializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n  }\n\n  @protected\n  void sse_encode_i_32(int self, SseSerializer serializer) {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    serializer.buffer.putInt32(self);\n  }\n}\n"
  },
  {
    "path": "lib/native/frb_generated.io.dart",
    "content": "// This file is automatically generated, so please do not edit it.\n// @generated by `flutter_rust_bridge`@ 2.11.1.\n\n// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field\n\nimport 'api/api.dart';\nimport 'dart:async';\nimport 'dart:convert';\nimport 'dart:ffi' as ffi;\nimport 'frb_generated.dart';\nimport 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart';\n\nabstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {\n  RustLibApiImplPlatform({\n    required super.handler,\n    required super.wire,\n    required super.generalizedFrbRustBinding,\n    required super.portManager,\n  });\n\n  @protected\n  AnyhowException dco_decode_AnyhowException(dynamic raw);\n\n  @protected\n  String dco_decode_String(dynamic raw);\n\n  @protected\n  bool dco_decode_bool(dynamic raw);\n\n  @protected\n  Uint8List dco_decode_list_prim_u_8_strict(dynamic raw);\n\n  @protected\n  int dco_decode_u_8(dynamic raw);\n\n  @protected\n  void dco_decode_unit(dynamic raw);\n\n  @protected\n  AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);\n\n  @protected\n  String sse_decode_String(SseDeserializer deserializer);\n\n  @protected\n  bool sse_decode_bool(SseDeserializer deserializer);\n\n  @protected\n  Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer);\n\n  @protected\n  int sse_decode_u_8(SseDeserializer deserializer);\n\n  @protected\n  void sse_decode_unit(SseDeserializer deserializer);\n\n  @protected\n  int sse_decode_i_32(SseDeserializer deserializer);\n\n  @protected\n  void sse_encode_AnyhowException(\n      AnyhowException self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_String(String self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_bool(bool self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_list_prim_u_8_strict(\n      Uint8List self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_u_8(int self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_unit(void self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_i_32(int self, SseSerializer serializer);\n}\n\n// Section: wire_class\n\nclass RustLibWire implements BaseWire {\n  factory RustLibWire.fromExternalLibrary(ExternalLibrary lib) =>\n      RustLibWire(lib.ffiDynamicLibrary);\n\n  /// Holds the symbol lookup function.\n  final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)\n      _lookup;\n\n  /// The symbols are looked up in [dynamicLibrary].\n  RustLibWire(ffi.DynamicLibrary dynamicLibrary)\n      : _lookup = dynamicLibrary.lookup;\n}\n"
  },
  {
    "path": "lib/native/frb_generated.web.dart",
    "content": "// This file is automatically generated, so please do not edit it.\n// @generated by `flutter_rust_bridge`@ 2.11.1.\n\n// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field\n\n// Static analysis wrongly picks the IO variant, thus ignore this\n// ignore_for_file: argument_type_not_assignable\n\nimport 'api/api.dart';\nimport 'dart:async';\nimport 'dart:convert';\nimport 'frb_generated.dart';\nimport 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_web.dart';\n\nabstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {\n  RustLibApiImplPlatform({\n    required super.handler,\n    required super.wire,\n    required super.generalizedFrbRustBinding,\n    required super.portManager,\n  });\n\n  @protected\n  AnyhowException dco_decode_AnyhowException(dynamic raw);\n\n  @protected\n  String dco_decode_String(dynamic raw);\n\n  @protected\n  bool dco_decode_bool(dynamic raw);\n\n  @protected\n  Uint8List dco_decode_list_prim_u_8_strict(dynamic raw);\n\n  @protected\n  int dco_decode_u_8(dynamic raw);\n\n  @protected\n  void dco_decode_unit(dynamic raw);\n\n  @protected\n  AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);\n\n  @protected\n  String sse_decode_String(SseDeserializer deserializer);\n\n  @protected\n  bool sse_decode_bool(SseDeserializer deserializer);\n\n  @protected\n  Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer);\n\n  @protected\n  int sse_decode_u_8(SseDeserializer deserializer);\n\n  @protected\n  void sse_decode_unit(SseDeserializer deserializer);\n\n  @protected\n  int sse_decode_i_32(SseDeserializer deserializer);\n\n  @protected\n  void sse_encode_AnyhowException(\n      AnyhowException self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_String(String self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_bool(bool self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_list_prim_u_8_strict(\n      Uint8List self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_u_8(int self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_unit(void self, SseSerializer serializer);\n\n  @protected\n  void sse_encode_i_32(int self, SseSerializer serializer);\n}\n\n// Section: wire_class\n\nclass RustLibWire implements BaseWire {\n  RustLibWire.fromExternalLibrary(ExternalLibrary lib);\n}\n\n@JS('wasm_bindgen')\nexternal RustLibWasmModule get wasmModule;\n\n@JS()\n@anonymous\nextension type RustLibWasmModule._(JSObject _) implements JSObject {}\n"
  },
  {
    "path": "lib/pages/connect/logic.dart",
    "content": "import 'package:get/get.dart';\n\nclass ConnectLogic extends GetxController {\n  Rx<bool> developerOptionEnabled = false.obs;\n  Rx<String> link = \"\".obs;\n  Rx<bool> inProgress = false.obs;\n}\n"
  },
  {
    "path": "lib/pages/connect/view.dart",
    "content": "import 'package:ascent/foreground/connect.dart';\nimport 'package:ascent/foreground/root_connect.dart';\nimport 'package:ascent/foreground/shizuku_connect.dart';\nimport 'package:ascent/global_state.dart';\nimport 'package:bruno/bruno.dart';\nimport 'package:easy_localization/easy_localization.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter_foreground_task/flutter_foreground_task.dart';\nimport 'package:get/get.dart';\n\nimport 'logic.dart';\n\nclass ConnectPage extends StatelessWidget {\n  ConnectPage({super.key});\n\n  final logic = Get.put(ConnectLogic());\n  ConnectForegroundTask connectForegroundTask = ConnectForegroundTask();\n  RootConnectForegroundTask rootConnectForegroundTask =\n      RootConnectForegroundTask();\n  ShizukuConnectForegroundTask shizukuConnectForegroundTask = ShizukuConnectForegroundTask();\n\n  Future<void> doConnect() async {\n    logic.inProgress.value = true;\n    await connectForegroundTask.startConnectForegroundTask(logic);\n  }\n\n  Future<void> doRootConnect() async {\n    logic.inProgress.value = true;\n    await rootConnectForegroundTask.startRootConnectForegroundTask(logic);\n  }\n\n  Future<void> doShizukuConnect() async {\n    logic.inProgress.value = true;\n    await shizukuConnectForegroundTask.startShizukuConnectForegroundTask(logic);\n  }\n\n  Future<void> doResetProcess() async {\n    logic.inProgress.value = false;\n    logic.link.value = \"\";\n    await FlutterForegroundTask.stopService();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    GlobalState.platform.invokeMethod('getDeveloperOptionEnabled').then(\n        (value) =>\n            logic.developerOptionEnabled.value = (value.toString() == \"true\"));\n    FlutterForegroundTask.isRunningService.then((value) => {\n          if (!value) {logic.inProgress.value = false, logic.link.value = \"\"}\n        });\n    return Material(\n      child: Padding(\n          padding: const EdgeInsets.only(left: 20, right: 20),\n          child: Obx(\n            () => Column(\n              mainAxisAlignment: MainAxisAlignment.center,\n              children: [\n                const Text(\n                  'connect.guide.prepare_guide',\n                  style: TextStyle(fontSize: 20),\n                ).tr(),\n                const SizedBox(height: 20),\n                BrnBigMainButton(\n                  title: logic.inProgress.value\n                      ? tr('connect.guide.in_progress')\n                      : tr('connect.guide.connect'),\n                  bgColor: Colors.blueAccent.withOpacity(0.8),\n                  isEnable: ((logic.developerOptionEnabled.value &&\n                          GlobalState.hasCert.value) &&\n                      !logic.inProgress.value),\n                  onTap: () {\n                    doConnect();\n                  },\n                ),\n                const SizedBox(height: 20),\n                BrnBigMainButton(\n                  title: tr('connect.guide.reset'),\n                  bgColor: Colors.orangeAccent.withOpacity(0.8),\n                  onTap: () {\n                    doResetProcess();\n                  },\n                ),\n                const SizedBox(height: 20),\n                Visibility(\n                  visible: GlobalState.rootEnabled.value,\n                  child: BrnBigMainButton(\n                    title: logic.inProgress.value\n                        ? tr('connect.guide.in_progress')\n                        : tr('connect.guide.root_connect'),\n                    bgColor: Colors.blueAccent.withOpacity(0.8),\n                    isEnable: (GlobalState.rootEnabled.value &&\n                        !logic.inProgress.value),\n                    onTap: () {\n                      doRootConnect();\n                    },\n                  ),\n                ),\n                Visibility(\n                  visible: GlobalState.shizukuEnabled.value,\n                  child: BrnBigMainButton(\n                    title: logic.inProgress.value\n                        ? tr('connect.guide.in_progress')\n                        : tr('connect.guide.shizuku_connect'),\n                    bgColor: Colors.blueAccent.withOpacity(0.8),\n                    isEnable: (GlobalState.shizukuEnabled.value &&\n                        !logic.inProgress.value),\n                    onTap: () {\n                      doShizukuConnect();\n                    },\n                  ),\n                )\n              ],\n            ),\n          )),\n    );\n  }\n}\n"
  },
  {
    "path": "lib/pages/home/logic.dart",
    "content": "import 'package:get/get.dart';\n\nclass HomeLogic extends GetxController {\n  Rx<bool> developerOptionEnabled = false.obs;\n}\n"
  },
  {
    "path": "lib/pages/home/view.dart",
    "content": "import 'package:ascent/global_state.dart';\nimport 'package:bruno/bruno.dart';\nimport 'package:easy_localization/easy_localization.dart';\nimport 'package:flutter/material.dart';\nimport 'package:get/get.dart';\nimport 'package:url_launcher/url_launcher.dart';\n\nimport 'logic.dart';\n\nclass HomePage extends StatelessWidget {\n  HomePage({super.key});\n\n  final logic = Get.put(HomeLogic());\n\n  @override\n  Widget build(BuildContext context) {\n    GlobalState.platform.invokeMethod('getDeveloperOptionEnabled').then(\n        (value) =>\n            logic.developerOptionEnabled.value = (value.toString() == \"true\"));\n\n    return Material(\n      child: Padding(\n        padding: const EdgeInsets.only(left: 20, right: 20),\n        child: Obx(() => Column(\n              mainAxisAlignment: MainAxisAlignment.center,\n              crossAxisAlignment: CrossAxisAlignment.center,\n              children: [\n                Row(\n                  mainAxisAlignment: MainAxisAlignment.center,\n                  children: [\n                    const Text(\n                      \"home.developer_option.status\",\n                      style: TextStyle(fontSize: 20),\n                    ).tr(),\n                    logic.developerOptionEnabled.value\n                        ? const Text(\n                            \"home.developer_option.enabled\",\n                            style: TextStyle(\n                                color: Colors.lightGreenAccent, fontSize: 20),\n                          ).tr()\n                        : const Text(\n                            \"home.developer_option.disabled\",\n                            style: TextStyle(\n                                color: Colors.redAccent, fontSize: 20),\n                          ).tr(),\n                  ],\n                ),\n                const SizedBox(\n                  height: 20,\n                ),\n                Row(\n                  mainAxisAlignment: MainAxisAlignment.center,\n                  children: [\n                    const Text(\n                      \"home.pairing.status\",\n                      style: TextStyle(fontSize: 20),\n                    ).tr(),\n                    GlobalState.hasCert.value\n                        ? const Text(\n                            \"home.pairing.paired\",\n                            style: TextStyle(\n                                color: Colors.lightGreenAccent, fontSize: 20),\n                          ).tr()\n                        : const Text(\n                            \"home.pairing.wait_pairing\",\n                            style: TextStyle(\n                                color: Colors.redAccent, fontSize: 20),\n                          ).tr(),\n                  ],\n                ),\n                const SizedBox(\n                  height: 20,\n                ),\n                Visibility(\n                    visible: GlobalState.rootEnabled.value,\n                    child: Column(\n                      children: [\n                        Row(\n                          mainAxisAlignment: MainAxisAlignment.center,\n                          children: [\n                            const Text(\n                              \"home.root.enabled\",\n                              style: TextStyle(\n                                fontSize: 20,\n                                color: Colors.lightGreenAccent,\n                                fontWeight: FontWeight.w500,\n                              ),\n                            ).tr(),\n                          ],\n                        ),\n                        const SizedBox(\n                          height: 20,\n                        ),\n                        Row(\n                          mainAxisAlignment: MainAxisAlignment.center,\n                          children: [\n                            const Text(\n                              \"home.root.direct_connect\",\n                              style: TextStyle(\n                                fontSize: 20,\n                                color: Colors.deepOrangeAccent,\n                                fontWeight: FontWeight.w500,\n                              ),\n                            ).tr(),\n                          ],\n                        ),\n                        const SizedBox(\n                          height: 20,\n                        ),\n                      ],\n                    )),\n                Visibility(\n                    visible: GlobalState.shizukuEnabled.value,\n                    child: Column(\n                      children: [\n                        Row(\n                          mainAxisAlignment: MainAxisAlignment.center,\n                          children: [\n                            const Text(\n                              \"home.shizuku.enabled\",\n                              style: TextStyle(\n                                fontSize: 20,\n                                color: Colors.lightGreenAccent,\n                                fontWeight: FontWeight.w500,\n                              ),\n                            ).tr(),\n                          ],\n                        ),\n                        const SizedBox(\n                          height: 20,\n                        ),\n                        Row(\n                          mainAxisAlignment: MainAxisAlignment.center,\n                          children: [\n                            const Text(\n                              \"home.shizuku.direct_connect\",\n                              style: TextStyle(\n                                fontSize: 20,\n                                color: Colors.deepOrangeAccent,\n                                fontWeight: FontWeight.w500,\n                              ),\n                            ).tr(),\n                          ],\n                        ),\n                        const SizedBox(\n                          height: 20,\n                        ),\n                      ],\n                    )),\n                BrnBigMainButton(\n                  title: tr('home.pairing.name'),\n                  bgColor: Colors.cyan.withOpacity(0.8),\n                  isEnable: (logic.developerOptionEnabled.value &&\n                      !GlobalState.hasCert.value),\n                  onTap: () {\n                    Get.toNamed(\"/pair\");\n                  },\n                ),\n                const SizedBox(\n                  height: 20,\n                ),\n                BrnBigMainButton(\n                  title: tr('home.connect.name'),\n                  bgColor: Colors.indigoAccent.withOpacity(0.8),\n                  isEnable: ((logic.developerOptionEnabled.value &&\n                          GlobalState.hasCert.value) ||\n                      GlobalState.rootEnabled.value || GlobalState.shizukuEnabled.value),\n                  onTap: () {\n                    Get.toNamed(\"/connect\");\n                  },\n                ),\n                const SizedBox(\n                  height: 40,\n                ),\n                BrnBigGhostButton(\n                  title: tr('home.star'),\n                  onTap: () async {\n                    final Uri url = Uri.parse(\"https://github.com/4o3F\");\n                    if (!await launchUrl(url,\n                        mode: LaunchMode.externalApplication)) {\n                      await launchUrl(url);\n                    }\n                  },\n                ),\n                const SizedBox(\n                  height: 20,\n                ),\n                BrnBigGhostButton(\n                  bgColor: Colors.orangeAccent.withOpacity(0.8),\n                  titleColor: Colors.white,\n                  title: tr('home.support'),\n                  onTap: () async {\n                    final Uri url = Uri.parse(GlobalState.discord);\n                    if (!await launchUrl(url,\n                        mode: LaunchMode.externalApplication)) {\n                      await launchUrl(url);\n                    }\n                  },\n                ),\n              ],\n            )),\n      ),\n    );\n  }\n}\n"
  },
  {
    "path": "lib/pages/info/logic.dart",
    "content": "import 'package:get/get.dart';\n\nclass InfoLogic extends GetxController {}\n"
  },
  {
    "path": "lib/pages/info/view.dart",
    "content": "import 'dart:io';\n\nimport 'package:ascent/global_state.dart';\nimport 'package:flutter/material.dart';\nimport 'package:easy_localization/easy_localization.dart';\nimport 'package:get/get.dart';\nimport 'package:path_provider/path_provider.dart';\n\nimport 'logic.dart';\n\nclass InfoPage extends StatelessWidget {\n  InfoPage({super.key});\n\n  final logic = Get.put(InfoLogic());\n\n  @override\n  Widget build(BuildContext context) {\n    return Material(\n        child: Padding(\n      padding: const EdgeInsets.all(20),\n      child: Column(\n        mainAxisAlignment: MainAxisAlignment.center,\n        crossAxisAlignment: CrossAxisAlignment.center,\n        children: [\n          Row(\n            mainAxisAlignment: MainAxisAlignment.center,\n            crossAxisAlignment: CrossAxisAlignment.center,\n            children: [\n              Container(\n                width: 100,\n                height: 100,\n                clipBehavior: Clip.hardEdge,\n                decoration: BoxDecoration(\n                  borderRadius: BorderRadius.circular(50),\n                ),\n                child: Image.network(\n                  \"https://0.gravatar.com/avatar/3915902215ca977d6e1e82f82540cf1aab004717f087e996cb5ffaab43a8c681?size=1024\",\n                  fit: BoxFit.cover,\n                ),\n              ),\n              const SizedBox(\n                width: 20,\n              ),\n              const Text(\n                \"403F\",\n                style: TextStyle(fontSize: 30),\n              ),\n            ],\n          ),\n          const SizedBox(\n            height: 20,\n          ),\n          const Text(\n            \"Source code at \",\n            style: TextStyle(fontSize: 15),\n          ),\n          const Text(\n            \"https://github.com/4o3F/Ascent\",\n            style: TextStyle(fontSize: 15, color: Colors.indigoAccent),\n          ),\n          const SizedBox(\n            height: 20,\n          ),\n          const Text(\n            \"Version: ${GlobalState.version}\",\n            style: TextStyle(fontSize: 15, color: Colors.orangeAccent),\n          ),\n          const SizedBox(\n            height: 20,\n          ),\n          const Text(\n            \"Contact me\",\n            style: TextStyle(fontSize: 15),\n          ),\n          const Row(\n            mainAxisAlignment: MainAxisAlignment.center,\n            crossAxisAlignment: CrossAxisAlignment.center,\n            children: [\n              Text(\"Email: \"),\n              Text(\"4o3f@proton.me\",\n                  style: TextStyle(color: Colors.blueAccent)),\n            ],\n          ),\n          const SizedBox(\n            height: 10,\n          ),\n          const Row(\n            mainAxisAlignment: MainAxisAlignment.center,\n            crossAxisAlignment: CrossAxisAlignment.center,\n            children: [\n              Text(\"Discord: \"),\n              Text(\"403F\", style: TextStyle(color: Colors.blueAccent)),\n            ],\n          ),\n          const SizedBox(\n            height: 10,\n          ),\n          const Row(\n            mainAxisAlignment: MainAxisAlignment.center,\n            crossAxisAlignment: CrossAxisAlignment.center,\n            children: [\n              Text(\"QQ: \"),\n              Text(\"855857816\", style: TextStyle(color: Colors.blueAccent)),\n            ],\n          ),\n          const SizedBox(\n            height: 10,\n          ),\n          Row(\n            mainAxisAlignment: MainAxisAlignment.center,\n            crossAxisAlignment: CrossAxisAlignment.center,\n            children: [\n              Text(\"settings.disable_auto_detect_port\").tr(),\n              Obx(() => Switch(\n                  value: GlobalState.disableAutoDetectPort.value,\n                  onChanged: (bool value) async {\n                    var dataDir = await getApplicationDocumentsDirectory();\n                    GlobalState.disableAutoDetectPort.value = value;\n                    if (value) {\n                      File(\"${dataDir.path}/disableAutoDetectPort\")\n                          .createSync();\n                    } else {\n                      File(\"${dataDir.path}/disableAutoDetectPort\").deleteSync();\n                    }\n                  }))\n            ],\n          )\n        ],\n      ),\n    ));\n  }\n}\n"
  },
  {
    "path": "lib/pages/pair/logic.dart",
    "content": "import 'package:get/get.dart';\n\nclass PairLogic extends GetxController {\n  Rx<bool> developerOptionEnabled = false.obs;\n\n  Rx<bool> foregroundServiceStartResult = true.obs;\n}\n"
  },
  {
    "path": "lib/pages/pair/view.dart",
    "content": "import 'dart:io';\n\nimport 'package:android_intent_plus/android_intent.dart';\nimport 'package:ascent/global_state.dart';\nimport 'package:bruno/bruno.dart';\nimport 'package:easy_localization/easy_localization.dart';\nimport 'package:flutter/material.dart';\nimport 'package:get/get.dart';\n\nimport '../../foreground/pair.dart';\nimport 'logic.dart';\n\nclass PairPage extends StatelessWidget {\n  PairPage({super.key});\n\n  final logic = Get.put(PairLogic());\n  PairForegroundTask pairForegroundTask = PairForegroundTask();\n\n  Future<void> doPair() async {\n    // Call out developer option intent\n    AndroidIntent intent = const AndroidIntent(\n      action: 'android.settings.APPLICATION_DEVELOPMENT_SETTINGS',\n    );\n    bool result = await pairForegroundTask.startPairForegroundTask();\n    if (!result) {\n      logic.foregroundServiceStartResult.value = false;\n    }\n    await intent.launch();\n  }\n\n  Future<void> resetPair() async {\n    File(\"${GlobalState.dataDir.path}/cert.pem\").deleteSync();\n    File(\"${GlobalState.dataDir.path}/pkey.pem\").deleteSync();\n    GlobalState.hasCert.value = false;\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    // GlobalState.hasCert.value =\n    //     File(\"${GlobalState.dataDir.path}/cert.pem\").existsSync();\n    GlobalState.platform.invokeMethod('getDeveloperOptionEnabled').then(\n        (value) =>\n            logic.developerOptionEnabled.value = (value.toString() == \"true\"));\n\n    logic.foregroundServiceStartResult.listen((result) {\n      if (!result) {\n        BrnToast.showInCenter(\n            text: tr('pair.notification_description.error_init'),\n            context: context);\n      }\n    });\n    return Material(\n      child: Padding(\n        padding: const EdgeInsets.only(left: 20, right: 20),\n        child: Obx(\n          () => Column(\n            mainAxisAlignment: MainAxisAlignment.center,\n            crossAxisAlignment: CrossAxisAlignment.center,\n            children: [\n              const Text(\n                'pair.guide.prepare_guide',\n                style: TextStyle(fontSize: 20),\n              ).tr(),\n              const SizedBox(\n                height: 20,\n              ),\n              BrnBigMainButton(\n                title: tr('pair.guide.pair'),\n                bgColor: Colors.indigoAccent.withOpacity(0.8),\n                isEnable: (logic.developerOptionEnabled.value &&\n                    !GlobalState.hasCert.value),\n                onTap: () {\n                  doPair();\n                },\n              ),\n              const SizedBox(\n                height: 20,\n              ),\n              BrnBigMainButton(\n                title: tr('pair.guide.reset'),\n                bgColor: Colors.orangeAccent.withOpacity(0.8),\n                isEnable: (logic.developerOptionEnabled.value &&\n                    GlobalState.hasCert.value),\n                onTap: () {\n                  resetPair();\n                },\n              ),\n            ],\n          ),\n        ),\n      ),\n    );\n  }\n}\n"
  },
  {
    "path": "lib/routes.dart",
    "content": "import 'package:ascent/pages/connect/view.dart';\nimport 'package:ascent/pages/home/view.dart';\nimport 'package:ascent/pages/info/view.dart';\nimport 'package:ascent/pages/pair/view.dart';\nimport 'package:get/get.dart';\n\nclass Routes {\n  static const String defaultRoute = \"/home\";\n  static final List<GetPage> routes = [\n    GetPage(name: '/home', page: () => HomePage()),\n    GetPage(name: '/pair', page: () => PairPage()),\n    GetPage(name: '/connect', page: () => ConnectPage()),\n    GetPage(name: '/info', page: () => InfoPage()),\n  ];\n\n  static int route2index(String route) {\n    switch (route) {\n      case '/home':\n        return 0;\n      case '/pair':\n        return 1;\n      case '/connect':\n        return 2;\n      case '/info':\n        return 3;\n      default:\n        return 0;\n    }\n  }\n\n  static String index2route(int index) {\n    switch (index) {\n      case 0:\n        return '/home';\n      case 1:\n        return '/pair';\n      case 2:\n        return '/connect';\n      case 3:\n        return '/info';\n      default:\n        return '/home';\n    }\n  }\n}\n"
  },
  {
    "path": "pubspec.yaml",
    "content": "name: ascent\ndescription: Tool for mihoyo game gacha link retrival\n# The following line prevents the package from being accidentally published to\n# pub.dev using `flutter pub publish`. This is preferred for private packages.\npublish_to: 'none' # Remove this line if you wish to publish to pub.dev\n\n# The following defines the version and build number for your application.\n# A version number is three numbers separated by dots, like 1.2.43\n# followed by an optional build number separated by a +.\n# Both the version and the builder number may be overridden in flutter\n# build by specifying --build-name and --build-number, respectively.\n# In Android, build-name is used as versionName while build-number used as versionCode.\n# Read more about Android versioning at https://developer.android.com/studio/publish/versioning\n# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.\n# Read more about iOS versioning at\n# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html\n# In Windows, build-name is used as the major, minor, and patch parts\n# of the product and file versions while build-number is used as the build suffix.\nversion: 2.4.0\n\nenvironment:\n  sdk: '>=3.3.0 <4.0.0'\n\n# Dependencies specify other packages that your package needs in order to work.\n# To automatically upgrade your package dependencies to the latest versions\n# consider running `flutter pub upgrade --major-versions`. Alternatively,\n# dependencies can be manually updated by changing the version numbers below to\n# the latest version available on pub.dev. To see which dependencies have newer\n# versions available, run `flutter pub outdated`.\ndependencies:\n  flutter:\n    sdk: flutter\n  bruno: 3.4.3\n  get: ^4.6.6\n  path_provider: ^2.1.1\n  easy_localization: ^3.0.3\n  flutter_foreground_task:\n    git:\n      url: https://github.com/4o3F/flutter_foreground_task\n\n\n  # The following adds the Cupertino Icons font to your application.\n  # Use with the CupertinoIcons class for iOS style icons.\n  cupertino_icons: ^1.0.2\n  freezed_annotation: ^2.4.1\n  multicast_dns: ^0.3.2+5\n  android_intent_plus: ^5.2.2\n  mixpanel_flutter: ^2.2.0\n  url_launcher: ^6.2.1\n  uri_to_file: ^1.0.0\n  receive_intent:\n    git:\n      url: https://github.com/daadu/receive_intent\n      ref: master\n  http: ^1.1.0\n  pub_semver: ^2.1.4\n  root: ^2.0.4\n  rust_lib_ascent:\n    path: rust_builder\n  flutter_rust_bridge: 2.11.1\n  shizuku_api: ^1.2.1\n\ndev_dependencies:\n  flutter_test:\n    sdk: flutter\n\n  # The \"flutter_lints\" package below contains a set of recommended lints to\n  # encourage good coding practices. The lint set provided by the package is\n  # activated in the `analysis_options.yaml` file located at the root of your\n  # package. See that file for information about deactivating specific lint\n  # rules and activating additional ones.\n  flutter_lints: ^5.0.0\n  build_runner: ^2.4.6\n  freezed: ^2.4.5\n  integration_test:\n    sdk: flutter\n\n# For information on the generic Dart part of this file, see the\n# following page: https://dart.dev/tools/pub/pubspec\n\n# The following section is specific to Flutter packages.\nflutter:\n\n  # The following line ensures that the Material Icons font is\n  # included with your application, so that you can use the icons in\n  # the material Icons class.\n  uses-material-design: true\n\n  # To add assets to your application, add an assets section, like this:\n  # assets:\n  #   - images/a_dot_burr.jpeg\n  #   - images/a_dot_ham.jpeg\n  assets:\n    - assets/translations/\n\n  # An image asset can refer to one or more resolution-specific \"variants\", see\n  # https://flutter.dev/assets-and-images/#resolution-aware\n\n  # For details regarding adding assets from package dependencies, see\n  # https://flutter.dev/assets-and-images/#from-packages\n\n  # To add custom fonts to your application, add a fonts section here,\n  # in this \"flutter\" section. Each entry in this list should have a\n  # \"family\" key with the font family name, and a \"fonts\" key with a\n  # list giving the asset and other descriptors for the font. For\n  # example:\n  # fonts:\n  #   - family: Schyler\n  #     fonts:\n  #       - asset: fonts/Schyler-Regular.ttf\n  #       - asset: fonts/Schyler-Italic.ttf\n  #         style: italic\n  #   - family: Trajan Pro\n  #     fonts:\n  #       - asset: fonts/TrajanPro.ttf\n  #       - asset: fonts/TrajanPro_Bold.ttf\n  #         weight: 700\n  #\n  # For details regarding fonts from package dependencies,\n  # see https://flutter.dev/custom-fonts/#from-packages\n\ndependency_overrides:\n  intl: 0.19.0\n  shared_preferences_android: 2.4.10"
  },
  {
    "path": "rust/.cargo/config.toml",
    "content": "#[env]\n#CC = { value = \"D:\\\\Applications\\\\LLVM\\\\bin\\\\clang-cl.exe\", force = true }\n#CMAKE_CXX_COMPILER = { value = \"D:\\\\Applications\\\\LLVM\\\\bin\\\\clang-cl.exe\", force = true }\n#CMAKE_C_COMPILER = { value = \"D:\\\\Applications\\\\LLVM\\\\bin\\\\clang-cl.exe\", force = true }\n#CMAKE_GENERATOR = { value = \"Ninja\", force = true }\n#CXX = { value = \"D:\\\\Applications\\\\LLVM\\\\bin\\\\clang-cl.exe\", force = true }\n"
  },
  {
    "path": "rust/.gitignore",
    "content": "/target\n"
  },
  {
    "path": "rust/Cargo.toml",
    "content": "[package]\nname = \"rust_lib_ascent\"\nversion = \"2.4.0\"\nedition = \"2021\"\n\n[dependencies]\nflutter_rust_bridge = \"=2.11.1\"\nanyhow = { version = \"1.0.75\" }\nbytebuffer = \"2.2.0\"\nhex = \"0.4.3\"\nhkdf = \"0.12.3\"\nspake2 = \"0.4.0\"\ntokio = { version = \"1.34.0\", features = [\"full\"] }\nsha2 = \"0.10.8\"\nboring = { git = \"https://github.com/4o3F/boring.git\" }\ntokio-boring = { git = \"https://github.com/4o3F/boring.git\" }\nlog = \"0.4.20\"\nregex = { version = \"1.10.2\", features = [] }\nandroid_logger = \"0.13.3\"\n\n\n[lib]\ncrate-type = [\"cdylib\", \"staticlib\"]\n\n[profile.release]\nlto = true\nopt-level = \"z\"\ncodegen-units = 1"
  },
  {
    "path": "rust/src/api/api.rs",
    "content": "use std::{env, fs};\n\nuse android_logger::Config;\nuse anyhow::Result;\nuse log::{debug, LevelFilter};\nuse regex::Regex;\nuse tokio::runtime::Runtime;\n\nuse crate::{connect, pair};\n\npub fn do_pair(port: String, code: String, data_folder: String) -> Result<bool> {\n    debug!(\"Do pair native called\");\n    let rt = Runtime::new().unwrap();\n    rt.block_on(async {\n        pair::pair(port, code, data_folder).await\n    })\n}\n\npub fn do_connect(port: String, data_folder: String) -> Result<String> {\n    debug!(\"Do connect native called\");\n    let rt = Runtime::new().unwrap();\n    rt.block_on(async {\n        connect::connect(port, data_folder).await\n    })\n}\n\npub fn do_filter(file_path: String) -> Result<String> {\n    let rt = Runtime::new().unwrap();\n    rt.block_on(async {\n        let bytes = fs::read(file_path).unwrap();\n        let data = String::from_utf8_lossy(bytes.as_slice()).to_string();\n        let re = Regex::new(r\"https://(webstatic|hk4e-api|webstatic-sea|hk4e-api-os|api-takumi|api-os-takumi|gs|public-operation-hk4e).(mihoyo\\.com|hoyoverse\\.com).*authkey=.*\\s*.*game_biz.*(plat_type|#/log)\").unwrap();\n        let matches = re.find(data.as_str()).unwrap();\n        let data = String::from(matches.as_str());\n        let mut front_half: String = String::new();\n        let mut back_half: String = String::new();\n\n        for (_, c) in data.chars().enumerate() {\n            if !c.is_ascii_alphanumeric() && !c.is_ascii_punctuation() {\n                break;\n            }\n            front_half.push(c);\n        }\n\n        for (_, c) in data.chars().rev().enumerate() {\n            if !c.is_ascii_alphanumeric() && !c.is_ascii_punctuation() {\n                break;\n            }\n            back_half.push(c);\n        }\n        //reverse back_half\n        back_half = back_half.chars().rev().collect();\n\n        let result = front_half + back_half.as_str();\n        Ok(result)\n    })\n}\n\npub fn init_logger() {\n    env::set_var(\"RUST_BACKTRACE\", \"1\");\n    if cfg!(debug_assertions) {\n        android_logger::init_once(\n            Config::default().with_max_level(LevelFilter::Trace).with_tag(\"flutter_native\"),\n        );\n    } else {\n        android_logger::init_once(\n            Config::default().with_max_level(LevelFilter::Error).with_tag(\"flutter_native\"),\n        );\n    }\n}"
  },
  {
    "path": "rust/src/api/mod.rs",
    "content": "pub mod api;\n"
  },
  {
    "path": "rust/src/connect.rs",
    "content": "use std::io::Read;\n\nuse anyhow::{anyhow, Context, Result};\nuse log::debug;\nuse tokio::io::{AsyncReadExt, AsyncWriteExt};\n\nconst ADB_HEADER_LENGTH: usize = 24;\nconst SYSTEM_IDENTITY_STRING_HOST: &str = \"host::\\u{0}\";\nconst A_CNXN: i32 = 0x4e584e43;\nconst A_OPEN: i32 = 0x4e45504f;\nconst A_OKAY: i32 = 0x59414b4f;\nconst A_WRTE: i32 = 0x45545257;\nconst A_STLS: i32 = 0x534c5453;\n// wireless debug introduced in Android 11, so must use TLS\nconst A_VERSION: i32 = 0x01000001;\nconst MAX_PAYLOAD: i32 = 1024 * 1024;\nconst A_STLS_VERSION: i32 = 0x01000000;\n\n\nstruct Message {\n    command: u32,\n    _arg0: u32,\n    _arg1: u32,\n    data_length: u32,\n    _data_check: u32,\n    _magic: u32,\n}\n\nimpl Message {\n    fn parse(buffer: &mut bytebuffer::ByteBuffer) -> Message {\n        Message {\n            command: buffer.read_u32().unwrap(),\n            _arg0: buffer.read_u32().unwrap(),\n            _arg1: buffer.read_u32().unwrap(),\n            data_length: buffer.read_u32().unwrap(),\n            _data_check: buffer.read_u32().unwrap(),\n            _magic: buffer.read_u32().unwrap(),\n        }\n    }\n}\n\nfn get_payload_checksum(data: Vec<u8>, offset: i32, length: i32) -> i32 {\n    let mut checksum: i32 = 0;\n    for i in offset..(offset + length) {\n        checksum += (data[i as usize] & 0xFF) as i32;\n    }\n    checksum\n}\n\nfn generate_message(command: i32, arg0: i32, arg1: i32, data: Vec<u8>) -> bytebuffer::ByteBuffer {\n    let mut message = bytebuffer::ByteBuffer::new();\n    message.resize(ADB_HEADER_LENGTH + data.len());\n    message.set_endian(bytebuffer::Endian::LittleEndian);\n    message.write_i32(command);\n    message.write_i32(arg0);\n    message.write_i32(arg1);\n    if data.len() != 0 {\n        message.write_i32(data.len() as i32);\n        message.write_i32(get_payload_checksum(data.clone(), 0, data.len() as i32));\n    } else {\n        message.write_i32(0);\n        message.write_i32(0);\n    }\n    message.write_i32(!command);\n    if data.len() != 0 {\n        message.write_bytes(data.as_slice());\n    }\n    message\n}\n\npub async fn connect(port: String, data_folder: String) -> Result<String> {\n    let host = String::from(\"127.0.0.1:\") + port.as_str();\n    let host = host.as_str();\n    debug!(\"Connecting {}\",host);\n    let mut stream = tokio::net::TcpStream::connect(host).await.with_context(|| format!(\"TCP connection to {} failed\", host))?;\n    let link: String;\n    // Send CNXN first\n    {\n        let cnxn_message = generate_message(\n            A_CNXN,\n            A_VERSION,\n            MAX_PAYLOAD,\n            Vec::from(SYSTEM_IDENTITY_STRING_HOST.as_bytes()),\n        );\n        stream.write_all(cnxn_message.as_bytes()).await.with_context(|| format!(\"Send CNXN\"))?;\n        debug!(\"CNXN Sent\");\n    }\n\n    // Read STLS command\n    {\n        let mut message_raw = vec![0u8; ADB_HEADER_LENGTH];\n        stream.read_exact(message_raw.as_mut_slice()).await.with_context(|| format!(\"Read STLS\"))?;\n        let mut header = bytebuffer::ByteBuffer::from_vec(message_raw); // CNXN header\n        header.resize(ADB_HEADER_LENGTH);\n        header.set_endian(bytebuffer::Endian::LittleEndian);\n\n        let message = Message::parse(&mut header);\n        if message.command != A_STLS as u32 {\n            return Err(anyhow!(\"Not STLS command\"));\n        }\n        debug!(\"STLS Received\")\n    }\n    // Send STLS packet\n    {\n        let stls_message = generate_message(A_STLS, A_STLS_VERSION, 0, Vec::new());\n        stream.write_all(stls_message.as_bytes()).await.with_context(|| format!(\"Send STLS\"))?;\n        debug!(\"STLS Sent\")\n    }\n\n    debug!(\"TLS Handshake begin\");\n    let data_folder = data_folder;\n    let cert_path = data_folder.clone() + \"/cert.pem\";\n    let pkey_path = data_folder.clone() + \"/pkey.pem\";\n    let cert_path = std::path::Path::new(cert_path.as_str());\n    let pkey_path = std::path::Path::new(pkey_path.as_str());\n    // Load cert and pkey from file\n    let cert_file = std::fs::File::open(cert_path)?;\n    let pkey_file = std::fs::File::open(pkey_path)?;\n    let x509_raw: Vec<u8> = cert_file.bytes().map(|x| x.unwrap()).collect();\n    let x509_raw = x509_raw.as_slice();\n    let pkey_raw: Vec<u8> = pkey_file.bytes().map(|x| x.unwrap()).collect();\n    let pkey_raw = pkey_raw.as_slice();\n\n    let x509 = Some(boring::x509::X509::from_pem(x509_raw).unwrap());\n    let pkey = Some(boring::pkey::PKey::private_key_from_pem(pkey_raw).unwrap());\n\n    let method = boring::ssl::SslMethod::tls();\n    let mut connector = boring::ssl::SslConnector::builder(method).unwrap();\n    connector.set_verify(boring::ssl::SslVerifyMode::PEER);\n    connector.set_certificate(x509.clone().unwrap().as_ref()).unwrap();\n    connector.set_private_key(pkey.clone().unwrap().as_ref()).unwrap();\n    connector.set_options(boring::ssl::SslOptions::NO_TLSV1);\n    connector.set_options(boring::ssl::SslOptions::NO_TLSV1_2);\n    connector.set_options(boring::ssl::SslOptions::NO_TLSV1_1);\n    connector.set_keylog_callback(move |_, line| {\n        debug!(\"{}\", line);\n    });\n    let mut config = connector.build().configure().unwrap();\n    //config.set_verify_hostname(false);\n    config.set_use_server_name_indication(false);\n    config.set_verify_callback(boring::ssl::SslVerifyMode::PEER, |_, _| {\n        return true;\n    });\n    let mut stream = tokio_boring::connect(config, host, stream).await.with_context(|| format!(\"Open TLS stream\"))?;\n    debug!(\"TLS Handshake success\");\n    // Read CNXN\n    {\n        let mut message_raw = vec![0u8; ADB_HEADER_LENGTH];\n        match stream.read_exact(message_raw.as_mut_slice()).await.with_context(|| format!(\"Read CNXN header\")) {\n            Ok(_) => {}\n            Err(e) => {\n                debug!(\"Read CNXN header failed: {:?}\", e.source().unwrap().to_string());\n                if e.source().unwrap().to_string().contains(\"SSLV3_ALERT_CERTIFICATE_UNKNOWN\") {\n                    return Err(anyhow!(\"error.pair_cert_invalid\"));\n                }\n                return Err(anyhow!(\"Read CNXN header failed \\n {}\", e.root_cause()));\n            }\n        }\n        let mut header = bytebuffer::ByteBuffer::from_vec(message_raw); // CNXN header\n        header.resize(ADB_HEADER_LENGTH);\n        header.set_endian(bytebuffer::Endian::LittleEndian);\n\n        let message = Message::parse(&mut header);\n        debug!(\"CNXN Received\");\n        let mut data_raw = vec![0u8; message.data_length as usize];\n        stream.read_exact(data_raw.as_mut_slice()).await.with_context(|| format!(\"Read CNXN\"))?;\n        let data = String::from_utf8(data_raw).with_context(|| format!(\"Parse CNXN data\"))?;\n        debug!(\"CNXN data: {}\", data)\n    }\n    // Send OPEN\n    {\n        let shell_cmd = \"shell:setprop log.tag I && logcat -b all -c && logcat | grep -E 'https://(webstatic|hk4e-api|webstatic-sea|hk4e-api-os|api-takumi|api-os-takumi|gs|public-operation-hk4e|aki-gm-resources-oversea).(mihoyo\\\\.com|hoyoverse\\\\.com|aki-game\\\\.net|aki-game\\\\.com)' | grep -i 'gacha'\\u{0}\";\n        let open_message = generate_message(A_OPEN, 233, 0, Vec::from(shell_cmd.as_bytes()));\n        stream.write_all(open_message.as_bytes()).await.with_context(|| format!(\"Send OPEN\"))?;\n        debug!(\"OPEN Sent\");\n    }\n    // Read OKAY\n    {\n        let mut message_raw = vec![0u8; ADB_HEADER_LENGTH];\n        stream.read_exact(message_raw.as_mut_slice()).await.with_context(|| format!(\"Read OKAY\"))?;\n        let mut header = bytebuffer::ByteBuffer::from_vec(message_raw);\n        header.resize(ADB_HEADER_LENGTH);\n        header.set_endian(bytebuffer::Endian::LittleEndian);\n\n        let message = Message::parse(&mut header);\n        if message.command != A_OKAY as u32 {\n            return Err(anyhow!(\"Not OKAY command\"));\n        }\n        debug!(\"OKAY Received\");\n    }\n    // Read WRTE\n    {\n        let mut message_raw = vec![0u8; ADB_HEADER_LENGTH];\n        stream.read_exact(message_raw.as_mut_slice()).await.with_context(|| format!(\"Read WRTE header\"))?;\n        let mut header = bytebuffer::ByteBuffer::from_vec(message_raw);\n        header.resize(ADB_HEADER_LENGTH);\n        header.set_endian(bytebuffer::Endian::LittleEndian);\n\n        let message = Message::parse(&mut header);\n        if message.command != A_WRTE as u32 {\n            return Err(anyhow!(\"Not WRTE command\"));\n        }\n        debug!(\"WRTE Received\");\n        let mut data_raw = vec![0u8; message.data_length as usize];\n        stream.read_exact(data_raw.as_mut_slice()).await.with_context(|| format!(\"Read WRTE\"))?;\n        link = String::from_utf8(data_raw).with_context(|| format!(\"Parse WRTE string\"))?;\n        debug!(\"WRTE data: {}\", link)\n    }\n    // Send OKAY\n    {\n        let okay_message = generate_message(A_OKAY, 233, 0, Vec::new());\n        stream.write_all(okay_message.as_bytes()).await.with_context(|| format!(\"Send OKAY\"))?;\n        debug!(\"OKAY Sent\");\n    }\n\n    stream.flush().await.with_context(|| format!(\"Flush stream\"))?;\n    stream.shutdown().await.with_context(|| format!(\"Shutdown stream\"))?;\n\n    Ok(link)\n}"
  },
  {
    "path": "rust/src/frb_generated.io.rs",
    "content": "// This file is automatically generated, so please do not edit it.\n// Generated by `flutter_rust_bridge`@ 2.0.0-dev.32.\n\n// Section: imports\n\nuse super::*;\nuse flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};\nuse flutter_rust_bridge::for_generated::transform_result_dco;\nuse flutter_rust_bridge::{Handler, IntoIntoDart};\n\n// Section: boilerplate\n\nflutter_rust_bridge::frb_generated_boilerplate_io!();\n"
  },
  {
    "path": "rust/src/frb_generated.rs",
    "content": "// This file is automatically generated, so please do not edit it.\n// @generated by `flutter_rust_bridge`@ 2.11.1.\n\n#![allow(\n    non_camel_case_types,\n    unused,\n    non_snake_case,\n    clippy::needless_return,\n    clippy::redundant_closure_call,\n    clippy::redundant_closure,\n    clippy::useless_conversion,\n    clippy::unit_arg,\n    clippy::unused_unit,\n    clippy::double_parens,\n    clippy::let_and_return,\n    clippy::too_many_arguments,\n    clippy::match_single_binding,\n    clippy::clone_on_copy,\n    clippy::let_unit_value,\n    clippy::deref_addrof,\n    clippy::explicit_auto_deref,\n    clippy::borrow_deref_ref,\n    clippy::needless_borrow\n)]\n\n// Section: imports\n\nuse flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};\nuse flutter_rust_bridge::for_generated::{transform_result_dco, Lifetimeable, Lockable};\nuse flutter_rust_bridge::{Handler, IntoIntoDart};\n\n// Section: boilerplate\n\nflutter_rust_bridge::frb_generated_boilerplate!(\n    default_stream_sink_codec = SseCodec,\n    default_rust_opaque = RustOpaqueMoi,\n    default_rust_auto_opaque = RustAutoOpaqueMoi,\n);\npub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = \"2.11.1\";\npub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -637951497;\n\n// Section: executor\n\nflutter_rust_bridge::frb_generated_default_handler!();\n\n// Section: wire_funcs\n\nfn wire__crate__api__api__do_connect_impl(\n    port_: flutter_rust_bridge::for_generated::MessagePort,\n    ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,\n    rust_vec_len_: i32,\n    data_len_: i32,\n) {\n    FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::<flutter_rust_bridge::for_generated::SseCodec, _, _>(\n        flutter_rust_bridge::for_generated::TaskInfo {\n            debug_name: \"do_connect\",\n            port: Some(port_),\n            mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,\n        },\n        move || {\n            let message = unsafe {\n                flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(\n                    ptr_,\n                    rust_vec_len_,\n                    data_len_,\n                )\n            };\n            let mut deserializer =\n                flutter_rust_bridge::for_generated::SseDeserializer::new(message);\n            let api_port = <String>::sse_decode(&mut deserializer);\n            let api_data_folder = <String>::sse_decode(&mut deserializer);\n            deserializer.end();\n            move |context| {\n                transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>(\n                    (move || {\n                        let output_ok = crate::api::api::do_connect(api_port, api_data_folder)?;\n                        Ok(output_ok)\n                    })(),\n                )\n            }\n        },\n    )\n}\nfn wire__crate__api__api__do_filter_impl(\n    port_: flutter_rust_bridge::for_generated::MessagePort,\n    ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,\n    rust_vec_len_: i32,\n    data_len_: i32,\n) {\n    FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::<flutter_rust_bridge::for_generated::SseCodec, _, _>(\n        flutter_rust_bridge::for_generated::TaskInfo {\n            debug_name: \"do_filter\",\n            port: Some(port_),\n            mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,\n        },\n        move || {\n            let message = unsafe {\n                flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(\n                    ptr_,\n                    rust_vec_len_,\n                    data_len_,\n                )\n            };\n            let mut deserializer =\n                flutter_rust_bridge::for_generated::SseDeserializer::new(message);\n            let api_file_path = <String>::sse_decode(&mut deserializer);\n            deserializer.end();\n            move |context| {\n                transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>(\n                    (move || {\n                        let output_ok = crate::api::api::do_filter(api_file_path)?;\n                        Ok(output_ok)\n                    })(),\n                )\n            }\n        },\n    )\n}\nfn wire__crate__api__api__do_pair_impl(\n    port_: flutter_rust_bridge::for_generated::MessagePort,\n    ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,\n    rust_vec_len_: i32,\n    data_len_: i32,\n) {\n    FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::<flutter_rust_bridge::for_generated::SseCodec, _, _>(\n        flutter_rust_bridge::for_generated::TaskInfo {\n            debug_name: \"do_pair\",\n            port: Some(port_),\n            mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,\n        },\n        move || {\n            let message = unsafe {\n                flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(\n                    ptr_,\n                    rust_vec_len_,\n                    data_len_,\n                )\n            };\n            let mut deserializer =\n                flutter_rust_bridge::for_generated::SseDeserializer::new(message);\n            let api_port = <String>::sse_decode(&mut deserializer);\n            let api_code = <String>::sse_decode(&mut deserializer);\n            let api_data_folder = <String>::sse_decode(&mut deserializer);\n            deserializer.end();\n            move |context| {\n                transform_result_sse::<_, flutter_rust_bridge::for_generated::anyhow::Error>(\n                    (move || {\n                        let output_ok =\n                            crate::api::api::do_pair(api_port, api_code, api_data_folder)?;\n                        Ok(output_ok)\n                    })(),\n                )\n            }\n        },\n    )\n}\nfn wire__crate__api__api__init_logger_impl(\n    port_: flutter_rust_bridge::for_generated::MessagePort,\n    ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,\n    rust_vec_len_: i32,\n    data_len_: i32,\n) {\n    FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::<flutter_rust_bridge::for_generated::SseCodec, _, _>(\n        flutter_rust_bridge::for_generated::TaskInfo {\n            debug_name: \"init_logger\",\n            port: Some(port_),\n            mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,\n        },\n        move || {\n            let message = unsafe {\n                flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(\n                    ptr_,\n                    rust_vec_len_,\n                    data_len_,\n                )\n            };\n            let mut deserializer =\n                flutter_rust_bridge::for_generated::SseDeserializer::new(message);\n            deserializer.end();\n            move |context| {\n                transform_result_sse::<_, ()>((move || {\n                    let output_ok = Result::<_, ()>::Ok({\n                        crate::api::api::init_logger();\n                    })?;\n                    Ok(output_ok)\n                })())\n            }\n        },\n    )\n}\n\n// Section: dart2rust\n\nimpl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {\n        let mut inner = <String>::sse_decode(deserializer);\n        return flutter_rust_bridge::for_generated::anyhow::anyhow!(\"{}\", inner);\n    }\n}\n\nimpl SseDecode for String {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {\n        let mut inner = <Vec<u8>>::sse_decode(deserializer);\n        return String::from_utf8(inner).unwrap();\n    }\n}\n\nimpl SseDecode for bool {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {\n        deserializer.cursor.read_u8().unwrap() != 0\n    }\n}\n\nimpl SseDecode for Vec<u8> {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {\n        let mut len_ = <i32>::sse_decode(deserializer);\n        let mut ans_ = vec![];\n        for idx_ in 0..len_ {\n            ans_.push(<u8>::sse_decode(deserializer));\n        }\n        return ans_;\n    }\n}\n\nimpl SseDecode for u8 {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {\n        deserializer.cursor.read_u8().unwrap()\n    }\n}\n\nimpl SseDecode for () {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {}\n}\n\nimpl SseDecode for i32 {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {\n        deserializer.cursor.read_i32::<NativeEndian>().unwrap()\n    }\n}\n\nfn pde_ffi_dispatcher_primary_impl(\n    func_id: i32,\n    port: flutter_rust_bridge::for_generated::MessagePort,\n    ptr: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,\n    rust_vec_len: i32,\n    data_len: i32,\n) {\n    // Codec=Pde (Serialization + dispatch), see doc to use other codecs\n    match func_id {\n        1 => wire__crate__api__api__do_connect_impl(port, ptr, rust_vec_len, data_len),\n        2 => wire__crate__api__api__do_filter_impl(port, ptr, rust_vec_len, data_len),\n        3 => wire__crate__api__api__do_pair_impl(port, ptr, rust_vec_len, data_len),\n        4 => wire__crate__api__api__init_logger_impl(port, ptr, rust_vec_len, data_len),\n        _ => unreachable!(),\n    }\n}\n\nfn pde_ffi_dispatcher_sync_impl(\n    func_id: i32,\n    ptr: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,\n    rust_vec_len: i32,\n    data_len: i32,\n) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse {\n    // Codec=Pde (Serialization + dispatch), see doc to use other codecs\n    match func_id {\n        _ => unreachable!(),\n    }\n}\n\n// Section: rust2dart\n\nimpl SseEncode for flutter_rust_bridge::for_generated::anyhow::Error {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {\n        <String>::sse_encode(format!(\"{:?}\", self), serializer);\n    }\n}\n\nimpl SseEncode for String {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {\n        <Vec<u8>>::sse_encode(self.into_bytes(), serializer);\n    }\n}\n\nimpl SseEncode for bool {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {\n        serializer.cursor.write_u8(self as _).unwrap();\n    }\n}\n\nimpl SseEncode for Vec<u8> {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {\n        <i32>::sse_encode(self.len() as _, serializer);\n        for item in self {\n            <u8>::sse_encode(item, serializer);\n        }\n    }\n}\n\nimpl SseEncode for u8 {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {\n        serializer.cursor.write_u8(self).unwrap();\n    }\n}\n\nimpl SseEncode for () {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {}\n}\n\nimpl SseEncode for i32 {\n    // Codec=Sse (Serialization based), see doc to use other codecs\n    fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {\n        serializer.cursor.write_i32::<NativeEndian>(self).unwrap();\n    }\n}\n\n#[cfg(not(target_family = \"wasm\"))]\nmod io {\n    // This file is automatically generated, so please do not edit it.\n    // @generated by `flutter_rust_bridge`@ 2.11.1.\n\n    // Section: imports\n\n    use super::*;\n    use flutter_rust_bridge::for_generated::byteorder::{\n        NativeEndian, ReadBytesExt, WriteBytesExt,\n    };\n    use flutter_rust_bridge::for_generated::{transform_result_dco, Lifetimeable, Lockable};\n    use flutter_rust_bridge::{Handler, IntoIntoDart};\n\n    // Section: boilerplate\n\n    flutter_rust_bridge::frb_generated_boilerplate_io!();\n}\n#[cfg(not(target_family = \"wasm\"))]\npub use io::*;\n\n/// cbindgen:ignore\n#[cfg(target_family = \"wasm\")]\nmod web {\n    // This file is automatically generated, so please do not edit it.\n    // @generated by `flutter_rust_bridge`@ 2.11.1.\n\n    // Section: imports\n\n    use super::*;\n    use flutter_rust_bridge::for_generated::byteorder::{\n        NativeEndian, ReadBytesExt, WriteBytesExt,\n    };\n    use flutter_rust_bridge::for_generated::wasm_bindgen;\n    use flutter_rust_bridge::for_generated::wasm_bindgen::prelude::*;\n    use flutter_rust_bridge::for_generated::{transform_result_dco, Lifetimeable, Lockable};\n    use flutter_rust_bridge::{Handler, IntoIntoDart};\n\n    // Section: boilerplate\n\n    flutter_rust_bridge::frb_generated_boilerplate_web!();\n}\n#[cfg(target_family = \"wasm\")]\npub use web::*;\n"
  },
  {
    "path": "rust/src/frb_generated.web.rs",
    "content": "// This file is automatically generated, so please do not edit it.\n// Generated by `flutter_rust_bridge`@ 2.0.0-dev.32.\n\n// Section: imports\n\nuse super::*;\nuse flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};\nuse flutter_rust_bridge::for_generated::transform_result_dco;\nuse flutter_rust_bridge::for_generated::wasm_bindgen;\nuse flutter_rust_bridge::for_generated::wasm_bindgen::prelude::*;\nuse flutter_rust_bridge::{Handler, IntoIntoDart};\n\n// Section: boilerplate\n\nflutter_rust_bridge::frb_generated_boilerplate_web!();\n"
  },
  {
    "path": "rust/src/lib.rs",
    "content": "pub mod api;\npub mod pair;\npub mod connect;\nmod frb_generated; /* AUTO INJECTED BY flutter_rust_bridge. This line may not be accurate, and you can change it according to your needs. */\n"
  },
  {
    "path": "rust/src/pair.rs",
    "content": "use std::io::Write;\n\nuse anyhow::{anyhow, bail, Context, Result};\nuse log::debug;\nuse tokio::io::{AsyncReadExt, AsyncWriteExt};\n\nconst EXPORTED_KEY_LABEL: &str = \"adb-label\\u{0}\";\npub const CLIENT_NAME: &str = \"adb pair client\\u{0}\";\npub const SERVER_NAME: &str = \"adb pair server\\u{0}\";\npub const MAX_PEER_INFO_SIZE: i32 = 1 << 13;\n\nconst ANDROID_PUBKEY_MODULUS_SIZE: i32 = 2048 / 8;\nconst ANDROID_PUBKEY_ENCODED_SIZE: i32 = 3 * 4 + 2 * ANDROID_PUBKEY_MODULUS_SIZE;\nconst ANDROID_PUBKEY_MODULUS_SIZE_WORDS: i32 = ANDROID_PUBKEY_MODULUS_SIZE / 4;\n\nfn generate_cert() -> Result<(boring::x509::X509, boring::pkey::PKey<boring::pkey::Private>)> {\n    let rsa = boring::rsa::Rsa::generate(2048).with_context(|| format!(\"failed to generate rsa keypair\"))?;\n    // put it into the pkey struct\n    let pkey = boring::pkey::PKey::from_rsa(rsa).with_context(|| format!(\"failed to create pkey struct from rsa keypair\"))?;\n\n    // make a new x509 certificate with the pkey we generated\n    let mut x509builder = boring::x509::X509::builder().with_context(|| format!(\"failed to make x509 builder\"))?;\n    x509builder\n        .set_version(2)\n        .with_context(|| format!(\"failed to set x509 version\"))?;\n\n    // set the serial number to some big random positive integer\n    let mut serial = boring::bn::BigNum::new().with_context(|| format!(\"failed to make new bignum\"))?;\n    serial\n        .rand(32, boring::bn::MsbOption::ONE, false)\n        .with_context(|| format!(\"failed to generate random bignum\"))?;\n    let serial = serial\n        .to_asn1_integer()\n        .with_context(|| format!(\"failed to get asn1 integer from bignum\"))?;\n    x509builder\n        .set_serial_number(&serial)\n        .with_context(|| format!(\"failed to set x509 serial number\"))?;\n\n    // call fails without expiration dates\n    // I guess they are important anyway, but still\n    let not_before = boring::asn1::Asn1Time::days_from_now(0).with_context(|| format!(\"failed to parse 'notBefore' timestamp\"))?;\n    let not_after = boring::asn1::Asn1Time::days_from_now(360)\n        .with_context(|| format!(\"failed to parse 'notAfter' timestamp\"))?;\n    x509builder\n        .set_not_before(&not_before)\n        .with_context(|| format!(\"failed to set x509 start date\"))?;\n    x509builder\n        .set_not_after(&not_after)\n        .with_context(|| format!(\"failed to set x509 expiration date\"))?;\n\n    // add the issuer and subject name\n    // it's set to \"/CN=LinuxTransport\"\n    // if we want we can make that configurable later\n    let mut x509namebuilder = boring::x509::X509Name::builder().with_context(|| format!(\"failed to get x509name builder\"))?;\n    x509namebuilder\n        .append_entry_by_text(\"CN\", \"LinuxTransport\")\n        .with_context(|| format!(\"failed to append /CN=LinuxTransport to x509name builder\"))?;\n    let x509name = x509namebuilder.build();\n    x509builder\n        .set_issuer_name(&x509name)\n        .with_context(|| format!(\"failed to set x509 issuer name\"))?;\n    x509builder\n        .set_subject_name(&x509name)\n        .with_context(|| format!(\"failed to set x509 subject name\"))?;\n\n    // set the public key\n    x509builder\n        .set_pubkey(&pkey)\n        .with_context(|| format!(\"failed to set x509 pubkey\"))?;\n\n    // it also needs several extensions\n    // in the openssl configuration file, these are set when generating certs\n    //     basicConstraints=CA:true\n    //     subjectKeyIdentifier=hash\n    //     authorityKeyIdentifier=keyid:always,issuer\n    // that means these extensions get added to certs generated using the\n    // command line tool automatically. but since we are constructing it, we\n    // need to add them manually.\n    // we need to do them one at a time, and they need to be in this order\n    // let conf = boring::conf::Conf::new(boring::conf::ConfMethod::).with_context(|| format!(\"failed to make new conf struct\"))?;\n    // it seems like everything depends on the basic constraints, so let's do\n    // that first.\n    let bc = boring::x509::extension::BasicConstraints::new()\n        .ca()\n        .build()\n        .with_context(|| format!(\"failed to build BasicConstraints extension\"))?;\n    x509builder\n        .append_extension(bc)\n        .with_context(|| format!(\"failed to append BasicConstraints extension\"))?;\n\n    // the akid depends on the skid. I guess it copies the skid when the cert is\n    // self-signed or something, I'm not really sure.\n    let skid = {\n        // we need to wrap these in a block because the builder gets borrowed away\n        // from us\n        let ext_con = x509builder.x509v3_context(None, None);\n        boring::x509::extension::SubjectKeyIdentifier::new()\n            .build(&ext_con)\n            .with_context(|| format!(\"failed to build SubjectKeyIdentifier extention\"))?\n    };\n    x509builder\n        .append_extension(skid)\n        .with_context(|| format!(\"failed to append SubjectKeyIdentifier extention\"))?;\n\n    // now that the skid is added we can add the akid\n    let akid = {\n        let ext_con = x509builder.x509v3_context(None, None);\n        boring::x509::extension::AuthorityKeyIdentifier::new()\n            .keyid(true)\n            .issuer(false)\n            .build(&ext_con)\n            .with_context(|| format!(\"failed to build AuthorityKeyIdentifier extention\"))?\n    };\n    x509builder\n        .append_extension(akid)\n        .with_context(|| format!(\"failed to append AuthorityKeyIdentifier extention\"))?;\n\n    // self-sign the certificate\n    x509builder\n        .sign(&pkey, boring::hash::MessageDigest::sha256())\n        .with_context(|| format!(\"failed to self-sign x509 cert\"))?;\n\n    let x509 = x509builder.build();\n\n    Ok((x509, pkey))\n}\n\nfn big_endian_to_little_endian_padded(len: usize, num: boring::bn::BigNum) -> Result<Vec<u8>, anyhow::Error> {\n    let mut out = vec![0u8; len];\n    let bytes = swap_endianness(num.to_vec());\n    let mut num_bytes = bytes.len();\n    if len < num_bytes {\n        if !fit_in_bytes(bytes.as_ref(), num_bytes, len) {\n            return Err(anyhow!(\"Can't fit in bytes\"));\n        }\n        num_bytes = len;\n    }\n    out[..num_bytes].copy_from_slice(&bytes[..num_bytes]);\n    return Ok(out);\n}\n\nfn fit_in_bytes(bytes: &Vec<u8>, num_bytes: usize, len: usize) -> bool {\n    let mut mask = 0u8;\n    for i in len..num_bytes {\n        mask |= bytes[i];\n    }\n    return mask == 0;\n}\n\nfn swap_endianness(bytes: Vec<u8>) -> Vec<u8> {\n    bytes.into_iter().rev().collect()\n}\n\npub fn encode_rsa_publickey(public_key: boring::rsa::Rsa<boring::pkey::Public>) -> Result<Vec<u8>, anyhow::Error> {\n    let mut r32: boring::bn::BigNum;\n    let mut n0inv: boring::bn::BigNum;\n    let mut rr: boring::bn::BigNum;\n\n    let mut tmp: boring::bn::BigNum;\n\n    let mut ctx = boring::bn::BigNumContext::new()?;\n\n    if (public_key.n().to_vec().len() as i32) < ANDROID_PUBKEY_MODULUS_SIZE {\n        return Err(anyhow!(String::from(\"Invalid key length \") + public_key.n().to_vec().len().to_string().as_str()));\n    }\n\n    let mut key_struct = bytebuffer::ByteBuffer::new();\n    key_struct.resize(ANDROID_PUBKEY_ENCODED_SIZE as usize);\n    key_struct.set_endian(bytebuffer::Endian::LittleEndian);\n    key_struct.write_i32(ANDROID_PUBKEY_MODULUS_SIZE_WORDS);\n\n    // Compute and store n0inv = -1 / N[0] mod 2 ^ 32\n    r32 = boring::bn::BigNum::new()?;\n    r32.set_bit(32)?;\n    n0inv = public_key.n().to_owned()?;\n    tmp = n0inv.to_owned()?;\n    // do n0inv mod r32\n    n0inv.checked_rem(tmp.as_mut(), r32.as_ref(), ctx.as_mut())?;\n    tmp = n0inv.to_owned()?;\n    n0inv.mod_inverse(tmp.as_mut(), r32.as_ref(), ctx.as_mut())?;\n    tmp = n0inv.to_owned()?;\n    n0inv.checked_sub(r32.as_ref(), tmp.as_mut())?;\n\n    // This is hacky.....\n    key_struct.write_u32(n0inv.to_dec_str().unwrap().parse::<u32>().unwrap());\n\n    key_struct.write(big_endian_to_little_endian_padded(\n        ANDROID_PUBKEY_MODULUS_SIZE as usize,\n        public_key.n().to_owned().unwrap())\n        .unwrap().as_slice())?;\n\n    rr = boring::bn::BigNum::new()?;\n    rr.set_bit(ANDROID_PUBKEY_MODULUS_SIZE * 8)?;\n    tmp = rr.to_owned()?;\n    rr.mod_sqr(tmp.as_ref(), public_key.n().to_owned().unwrap().as_ref(), ctx.as_mut())?;\n\n    key_struct.write(big_endian_to_little_endian_padded(\n        ANDROID_PUBKEY_MODULUS_SIZE as usize,\n        rr.to_owned().unwrap())\n        .unwrap().as_slice())?;\n\n    println!(\"{:?}\", public_key.e().to_string().parse::<i32>().unwrap());\n    key_struct.write_i32(public_key.e().to_string().parse::<i32>().unwrap());\n\n    Ok(key_struct.into_vec())\n}\n\nfn encode_rsa_publickey_with_name(public_key: boring::rsa::Rsa<boring::pkey::Public>) -> Result<Vec<u8>, anyhow::Error> {\n    let name = \" Ascent@Antagonism\\u{0}\";\n    let pkey_size = 4 * (f64::from(ANDROID_PUBKEY_ENCODED_SIZE) / 3.0).ceil() as usize;\n    let mut bos = bytebuffer::ByteBuffer::new();\n    bos.resize(pkey_size + name.len());\n    let base64 = boring::base64::encode_block(encode_rsa_publickey(public_key).unwrap().as_slice());\n    bos.write(base64.as_bytes())?;\n    bos.write(name.as_bytes())?;\n    Ok(bos.into_vec())\n}\n\n// TODO: Rewrite this to FSM\npub async fn pair(port: String, code: String, data_folder: String) -> Result<bool> {\n    let host = \"127.0.0.1\".to_string();\n    debug!(\"Pair starting\");\n    // Check cert file existance\n    let data_folder = data_folder;\n\n    debug!(\"Cert load begin\");\n    let cert_path = data_folder.clone() + \"/cert.pem\";\n    let pkey_path = data_folder.clone() + \"/pkey.pem\";\n    let cert_path = std::path::Path::new(cert_path.as_str());\n    let pkey_path = std::path::Path::new(pkey_path.as_str());\n\n    let x509: Option<boring::x509::X509>;\n    let pkey: Option<boring::pkey::PKey<boring::pkey::Private>>;\n\n    if !cert_path.exists() || !pkey_path.exists() {\n        debug!(\"Cert file don't exist\");\n        let (x509_raw, pkey_raw) = generate_cert().with_context(|| format!(\"Generate cert\"))?;\n        x509 = Some(x509_raw.clone());\n        pkey = Some(pkey_raw.clone());\n        let mut cert_file = std::fs::File::create(cert_path)?;\n        let mut pkey_file = std::fs::File::create(pkey_path)?;\n        cert_file.write_all(x509_raw.to_pem().unwrap().as_slice())?;\n        pkey_file.write_all(pkey_raw.private_key_to_pem_pkcs8().unwrap().as_slice())?;\n    } else {\n        return Ok(true);\n    }\n    debug!(\"Cert load end\");\n\n    debug!(\"TLS connect begin\");\n    debug!(\"Building TLS connector\");\n    let domain = host.clone() + \":\" + port.as_str();\n    let method = boring::ssl::SslMethod::tls();\n    let mut connector = boring::ssl::SslConnector::builder(method)?;\n    connector.set_verify(boring::ssl::SslVerifyMode::PEER);\n    // The following two line is critical for ADB client auth, without them system_server will throw out \"No peer certificate\" error.\n    connector.set_certificate(x509.clone().unwrap().as_ref())?;\n    connector.set_private_key(pkey.clone().unwrap().as_ref())?;\n\n    let mut config = connector.build().configure()?;\n    config.set_verify_callback(boring::ssl::SslVerifyMode::PEER, |_, _| true);\n    debug!(\"TLS connector build\");\n    debug!(\"TCP connecting at {}\", domain);\n    let stream = tokio::net::TcpStream::connect(domain.as_str()).await.with_context(|| format!(\"TCP stream connect\"))?;\n    debug!(\"TLS connecting\");\n    let mut stream = tokio_boring::connect(config, host.as_str(), stream).await.with_context(|| format!(\"TLS stream connect\"))?;\n    // To ensure the connection is not stolen while we do the PAKE, append the exported key material from the\n    // tls connection to the password.\n    let mut exported_key_material = [0; 64];\n    stream.ssl().export_keying_material(&mut exported_key_material, EXPORTED_KEY_LABEL, None).with_context(|| format!(\"Export key material\"))?;\n    debug!(\"exported_key_material: {:?}\\n\", exported_key_material);\n\n    let mut password = vec![0u8; code.as_bytes().len() + exported_key_material.len()];\n    password[..code.as_bytes().len()].copy_from_slice(code.as_bytes());\n    password[code.as_bytes().len()..].copy_from_slice(&exported_key_material);\n    let spake2_context = boring::curve25519::Spake2Context::new(\n        boring::curve25519::Spake2Role::Alice,\n        CLIENT_NAME,\n        SERVER_NAME,\n    ).with_context(|| format!(\"SPAKE2 context generation\"))?;\n    let mut outbound_msg = vec![0u8; 32];\n    spake2_context.generate_message(outbound_msg.as_mut_slice(), 32, password.as_ref()).with_context(|| format!(\"SPAKE2 message generation\"))?;\n\n    // Set header\n    let mut header = bytebuffer::ByteBuffer::new();\n    header.resize(6);\n    header.set_endian(bytebuffer::Endian::BigEndian);\n    // Write in data\n    // Write version\n    header.write_u8(1);\n    // Write message type\n    header.write_u8(0);\n    // Write message length\n    header.write_i32(outbound_msg.len() as i32);\n\n    // Send data\n    stream.write_all(header.as_bytes()).await.with_context(|| format!(\"Send SPAKE2 header\"))?;\n    stream.write_all(outbound_msg.as_slice()).await.with_context(|| format!(\"Send SPAKE2 message\"))?;\n    debug!(\"SPAKE2 Send\");\n\n    // Read header data\n    stream.read_u8().await.with_context(|| format!(\"Read SPAKE2 header\"))?;\n    let msg_type = stream.read_u8().await.with_context(|| format!(\"Read SPAKE2 header msg_type\"))?;\n    let payload_length = stream.read_i32().await.with_context(|| format!(\"Read SPAKE2 header payload_length\"))?;\n    if msg_type != 0u8 {\n        debug!(\"Message type miss match\");\n        return Err(anyhow!(\"Message type miss match\"));\n    }\n\n    let mut payload_raw = vec![0u8; payload_length as usize];\n    stream.read_exact(payload_raw.as_mut_slice()).await.with_context(|| format!(\"Read SPAKE2 message\"))?;\n\n    let mut bob_key = vec![0u8; 64];\n    spake2_context.process_message(bob_key.as_mut_slice(), 64, payload_raw.as_mut_slice()).with_context(|| format!(\"Process SPAKE2\"))?;\n\n    // Has checked the hkdf generation process is correct\n    let mut secret_key = [0u8; 16];\n    match hkdf::Hkdf::<sha2::Sha256>::new(None, bob_key.as_ref()).expand(\"adb pairing_auth aes-128-gcm key\".as_bytes(), &mut secret_key) {\n        Ok(_) => {}\n        Err(err) => {\n            bail!(err)\n        }\n    };\n\n    let encrypt_iv: i64 = 0;\n\n    let mut iv_bytes = bytebuffer::ByteBuffer::new();\n    iv_bytes.resize(12);\n    iv_bytes.set_endian(bytebuffer::Endian::LittleEndian);\n    iv_bytes.write_i64(encrypt_iv);\n\n    let iv = iv_bytes.as_bytes();\n\n    debug!(\"Create encrypt crypter\");\n    let mut crypter = boring::symm::Crypter::new(\n        boring::symm::Cipher::aes_128_gcm(),\n        boring::symm::Mode::Encrypt,\n        secret_key.as_ref(),\n        Some(iv)).with_context(|| format!(\"Create encrypt crypter\"))?;\n    debug!(\"Encrypt crypter created\");\n\n    debug!(\"Generate PeerInfo\");\n    let mut peerinfo = bytebuffer::ByteBuffer::new();\n    peerinfo.resize(MAX_PEER_INFO_SIZE as usize);\n    peerinfo.set_endian(bytebuffer::Endian::BigEndian);\n\n    peerinfo.write_u8(0);\n    peerinfo.write(encode_rsa_publickey_with_name(x509.unwrap().public_key().unwrap().rsa().unwrap()).unwrap().as_slice()).with_context(|| format!(\"Write peerinfo data\"))?;\n    debug!(\"PeerInfo Generated\");\n\n    debug!(\"Update Crypter\");\n    let mut encrypted = vec![0u8; peerinfo.as_bytes().len()];\n    crypter.update(peerinfo.as_bytes(), encrypted.as_mut_slice()).with_context(|| format!(\"Update encrypt crypter\"))?;\n    debug!(\"Crypter Updated\");\n    let fin = crypter.finalize(encrypted.as_mut_slice()).with_context(|| format!(\"Finalize encrypt crypter\"))?;\n    if fin != 0 {\n        debug!(\"Finalize error\");\n        return Err(anyhow!(\"Finalize error\"));\n    }\n\n    let mut encryption_tag = vec![0u8; 16];\n    crypter.get_tag(encryption_tag.as_mut_slice()).with_context(|| format!(\"Get encrypt tag\"))?;\n    encrypted.append(encryption_tag.as_mut());\n    // Set header    // Write version\n    let mut header = bytebuffer::ByteBuffer::new();\n    header.resize(6);\n    header.set_endian(bytebuffer::Endian::BigEndian);\n    // Write in data\n    header.write_u8(1);\n    // Write message type\n    header.write_u8(1);\n    // Write message length\n    header.write_i32(encrypted.len() as i32);\n\n    stream.write_all(header.as_bytes()).await.with_context(|| format!(\"Send KeyExchange header\"))?;\n    stream.write_all(encrypted.as_slice()).await.with_context(|| format!(\"Send KeyExchange data\"))?;\n\n    // Read peer info header\n    stream.read_u8().await.with_context(|| format!(\"Read KeyExchange header\"))?;\n    let msg_type = stream.read_u8().await.with_context(|| format!(\"Read KeyExchange header msg_type\"))?;\n    let payload_length = stream.read_i32().await.with_context(|| format!(\"Read KeyExchange header payload_length\"))?;\n    if msg_type != 1u8 {\n        debug!(\"Message type miss match\");\n        return Err(anyhow!(\"Message type miss match\"));\n    }\n\n    let mut payload_raw = vec![0u8; payload_length as usize];\n    stream.read_exact(payload_raw.as_mut_slice()).await.with_context(|| format!(\"Read KeyExchange payload\"))?;\n    let encrypted = payload_raw[0..payload_length as usize - 16].to_vec();\n    let encrypted_tag = payload_raw[payload_length as usize - 16..payload_length as usize].to_vec();\n\n    let decrypt_iv: i64 = 0;\n    let mut iv_bytes = bytebuffer::ByteBuffer::new();\n    iv_bytes.resize(12);\n    iv_bytes.set_endian(bytebuffer::Endian::LittleEndian);\n    iv_bytes.write_i64(decrypt_iv);\n\n    let iv = iv_bytes.as_bytes();\n\n    debug!(\"Create decrypt crypter\");\n    let mut crypter = boring::symm::Crypter::new(\n        boring::symm::Cipher::aes_128_gcm(),\n        boring::symm::Mode::Decrypt,\n        secret_key.as_ref(),\n        Some(iv)).with_context(|| format!(\"Create decrypt crypter\"))?;\n    debug!(\"Decrypt crypter created\");\n\n    // debug!(\"Encrypted: {:?}\",boring::base64::encode_block(encrypted.as_slice()));\n    // debug!(\"Tag: {:?}\",boring::base64::encode_block(encrypted_tag.as_slice()));\n    // debug!(\"Key: {:?}\", boring::base64::encode_block(secret_key.as_ref()));\n    // debug!(\"IV: {:?}\", boring::base64::encode_block(iv));\n\n    debug!(\"Update crypter\");\n    let mut decrypted = vec![0u8; (payload_length - 16) as usize];\n    crypter.set_tag(encrypted_tag.as_ref()).with_context(|| format!(\"Set decrypt tag\"))?;\n    crypter.update((encrypted).as_slice(), decrypted.as_mut_slice()).with_context(|| format!(\"Update decrypt crypter\"))?;\n    debug!(\"Crypter updated\");\n    let fin = crypter.finalize(decrypted.as_mut_slice()).with_context(|| format!(\"Finalize decrypt crypter\"))?;\n    if fin != 0 {\n        debug!(\"Finalize error\");\n        return Err(anyhow!(\"Finalize error\"));\n    }\n\n    debug!(\"All process done, peerinfo is {:?}\", String::from_utf8(decrypted)?.trim_matches(char::from(0)));\n    Ok(true)\n}"
  },
  {
    "path": "test_driver/integration_test.dart",
    "content": "import 'package:integration_test/integration_test_driver.dart';\n\nFuture<void> main() => integrationDriver();\n"
  }
]