[
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]\npatreon: # Replace with a single Patreon username\nko_fi: shabinder # Replace with a single Ko-fi username\nopen_collective: spotiflyer # Replace with a single Open Collective username\ntidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\ncustom: [\"https://paypal.me/shabinder\",\"https://rzp.io/l/9J3UBYiU\"]\n# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug-report.md",
    "content": "---\nname: Bug Report\nabout: Create a bug report to help us improve\ntitle: \"[BUG] : <Issue_Title>\"\nlabels: bug\nassignees: ''\n\n---\n\n<!---\n\tREAD THIS!\n\tIf some Song Download Failed with StackTrace having any of the following reason:\n\t\t- DownloadLinkFetchFailed(trackName=For Those About to Race, jioSaavnError=java.util.NoSuchElementException: Collection is empty., ytMusicError=MP3ConversionFailed(extraInfo=Client request invalid: 404 Not Found. Text: \"Not Found\", message=MP3 Converter unreachable, probably BUSY !\n\t\t\t- Please Dont Open issue! , Online Converter Was Busy! , try again after some time and download will be successfull . \n-->\n\n**Describe the bug:**\n<!--- A clear and concise description of what the bug is. --->\n\n**Media Links Used:** \n<!---  - Paste Song/Album/Playlist Link where you encountered this issue --->\n\n**Expected behavior**\n<!--- A clear and concise description of what you expected to happen. --->\n\n**Screenshots:**\n<!--- If applicable, add screenshots / screenrecording to help explain your problem. --->\n\n**StackTrace:**\n```\nPaste Stacktrace here if available\n```\n\n**Device Info (please complete the following information):**\n - Device:   [e.g. iPhone6, Samsung J2, PocoF1]\n - OS:   [e.g. iOS, Android 10, WinOS, MacOS]\n - Version:   [e.g. 3.2.1]\n - Country: [eg: India, will help in detecting if service is accessible to u]\n\n**Additional context:**\n<!--- Add any other context about the problem here. --->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: \"[Feature-Request]: <Feature_Title>\"\nlabels: enhancement\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n  - package-ecosystem: \"github-actions\"\n    directory: \"/.github/workflows\"\n    schedule:\n      interval: \"daily\"\n  - package-ecosystem: \"gradle\"\n    directory: \"/\"\n    schedule:\n      interval: \"daily\"\n  - package-ecosystem: \"terraform\"\n    directory: \"/infra\"\n    schedule:\n      interval: \"daily\"\n"
  },
  {
    "path": ".github/workflows/Release.yml",
    "content": "name: Release\n\non:\n  [workflow_dispatch]\n\n#  workflow_dispatch:\n#  release:\n#    types: [ created ]\n\njobs:\n  build:\n    name: Build App\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Restore Gradle cache\n        id: cache\n        uses: actions/cache@v2.1.4\n        with:\n          path: |\n            ~/.gradle/caches\n            ~/.gradle/wrapper\n          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}\n          restore-keys: |\n            ${{ runner.os }}-gradle-\n      - uses: actions/setup-java@v2\n        with:\n          distribution: 'zulu'\n          java-version: 8\n      - name: Build Web App\n        run: ./gradlew :web-app:build\n      - name: Upload Static Web App Artifact\n        uses: actions/upload-artifact@v2\n        id: upload\n        with:\n          path: web-app/build/distributions\n          name: static-web-app\n          if-no-files-found: error\n\n  deploy-Infrastructure:\n    runs-on: ubuntu-latest\n    name: Deploy Main Infrastructure\n    needs: [ build ]\n    env:\n      ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USER }}\n      ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}\n      ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}\n      ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}\n      ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}\n      ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n      - name: Setup Terraform environment\n        uses: little-core-labs/install-terraform@v2.0.0\n        with:\n          version: 0.14.5\n      - name: Terraform init\n        run: terraform init\n        working-directory: infra\n      - name: Terraform apply\n        run: terraform apply -auto-approve\n        working-directory: infra\n        env:\n          TF_VAR_docker_registry_username: ${{ secrets.GH_PKG_USER }}\n          TF_VAR_docker_registry_password: ${{ secrets.GH_PKG_PASSWORD }}\n          TF_VAR_cors_anywhere_allow_list: \"\"\n          TF_VAR_cors_anywhere_rate_limit: \"\"\n\n  deploy-StaticWebApp:\n    runs-on: ubuntu-latest\n    name: Deploy Static Web App\n    needs: [ build ]\n    steps:\n      - uses: actions/checkout@v2\n      - name: Download Static Web App Artifact\n        uses: actions/download-artifact@v2\n        with:\n          name: static-web-app\n          path: dist/\n      - name: Deploy\n        uses: JamesIves/github-pages-deploy-action@4.1.0\n        with:\n          BRANCH: gh-pages # The branch the action should deploy to.\n          FOLDER: dist/ # The folder the action should deploy.\n          CLEAN: true # Automatically remove deleted files from the deploy branch\n#      - name: Deploy Azure Static Web App\n#        uses: Azure/static-web-apps-deploy@v0.0.1-preview\n#        with:\n#          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_WATER_0BC116E03 }}\n#          repo_token: ${{ github.token }} # Used for Github integrations (i.e. PR comments)\n#          action: \"upload\"\n#          ###### Repository/Build Configurations - These values can be configured to match you app requirements. ######\n#          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig\n#          app_location: \"/dist\"\n#          ###### End of Repository/Build Configurations ######\n"
  },
  {
    "path": ".github/workflows/build-and-publish-kjs.yml",
    "content": "name: Build and Publish\non: [ pull_request ]\njobs:\n  build:\n    name: Test and Build\n    runs-on: ubuntu-latest\n    steps:\n\n      # Setup Java 1.8 environment for the next steps\n      - name: Setup Java\n        uses: actions/setup-java@v2\n        with:\n          distribution: 'zulu'\n          java-version: 15\n\n      # Check out current repository\n      - name: Fetch Sources\n        uses: actions/checkout@v2.3.1\n\n      # Build Android application\n      - name: Android App\n        run: ./gradlew :android:build\n\n      # Build Desktop application\n      - name: Desktop App\n        run: ./gradlew :desktop:build\n\n      # Build Web application\n      - name: Web App\n        run: ./gradlew :web-app:build\n"
  },
  {
    "path": ".github/workflows/build-release-binaries.yml",
    "content": "name: Build Release Binaries\n\non:\n  [ workflow_dispatch ]\n\njobs:\n  create-linux-package:\n    runs-on: ubuntu-latest\n    name: Create Deb Package\n    steps:\n      # Setup Java environment for the next steps\n      - name: Setup Java\n        uses: actions/setup-java@v2\n        with:\n          distribution: 'zulu'\n          java-version: 15\n\n      # Check out current repository\n      - name: Fetch Sources\n        uses: actions/checkout@v2.3.1\n\n      # Build Desktop Uber Jar application\n      - name: Desktop Uber Jar\n        run: ./gradlew :desktop:packageUberJarForCurrentOS\n\n      # Build Desktop Packaged application\n      - name: Desktop App Package\n        run: ./gradlew :desktop:packageDeb\n\n      # Create a Draft Release\n      - name: Draft Release\n        uses: ncipollo/release-action@v1\n        with:\n          draft: true\n          allowUpdates: true\n          tag: \"v3.6.4\"\n          artifacts: \"desktop/build/compose/jars/*.jar,desktop/build/compose/binaries/main/*/*\"\n          token: ${{ secrets.GH_TOKEN }}\n\n\n  # Windows Package\n  create-win-package:\n    runs-on: windows-latest\n    name: Create Windows Package\n    steps:\n      # Setup Java environment for the next steps\n      - name: Setup Java\n        uses: actions/setup-java@v2\n        with:\n          distribution: 'zulu'\n          java-version: 15\n\n      # Check out current repository\n      - name: Fetch Sources\n        uses: actions/checkout@v2.3.1\n\n      # Build Desktop Uber Jar application\n      - name: Desktop Uber Jar\n        run: ./gradlew :desktop:packageUberJarForCurrentOS\n\n      # Build Desktop Packaged application\n      - name: Desktop App Package\n        run: ./gradlew :desktop:packageMsi\n\n      # Build Android App\n      - name: Generate Release APK\n        run: ./gradlew :android:assembleRelease\n\n      # Sign Android Apk\n      - name: Sign APK\n        uses: r0adkll/sign-android-release@v1\n        id: sign_app\n        with:\n          releaseDirectory: android/build/outputs/apk/release\n          signingKeyBase64: ${{ secrets.SIGNING_KEY }}\n          alias: ${{ secrets.ALIAS }}\n          keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}\n          keyPassword: ${{ secrets.KEY_PASSWORD }}\n\n      # Create a Draft Release\n      - name: Draft Release\n        uses: ncipollo/release-action@v1\n        with:\n          draft: true\n          allowUpdates: true\n          tag: \"v3.6.4\"\n          artifacts: \"desktop/build/compose/jars/*.jar,desktop/build/compose/binaries/main/*/*,android/build/outputs/apk/release/*signed.apk\"\n          token: ${{ secrets.GH_TOKEN }}\n\n\n  create-mac-package:\n    runs-on: macos-latest\n    name: Create Mac Package\n    steps:\n      # Setup Java environment for the next steps\n      - name: Setup Java\n        uses: actions/setup-java@v2\n        with:\n          distribution: 'zulu'\n          java-version: 15\n\n      # Check out current repository\n      - name: Fetch Sources\n        uses: actions/checkout@v2.3.1\n\n      # Build Desktop Uber Jar application\n      - name: Desktop Uber Jar\n        run: ./gradlew :desktop:packageUberJarForCurrentOS\n\n      # Build Desktop Packaged application\n      - name: Desktop App Package\n        run: ./gradlew :desktop:packageDmg\n\n      # Create a Draft Release\n      - name: Draft Release\n        uses: ncipollo/release-action@v1\n        with:\n          draft: true\n          allowUpdates: true\n          tag: \"v3.6.4\"\n          artifacts: \"desktop/build/compose/jars/*.jar,desktop/build/compose/binaries/main/*/*\"\n          token: ${{ secrets.GH_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/maintenance.yml",
    "content": "name: Maintenance\n\non: [ pull_request ]\n  #workflow_dispatch:\n  #schedule:\n  #  - cron: '0 0 * * *' #once a day\n\njobs:\n  build:\n    name: Maintenance Time\n    runs-on: ubuntu-latest\n    steps:\n\n      # Setup Java environment for the next steps\n      - name: Setup Java\n        uses: actions/setup-java@v2\n        with:\n          distribution: 'zulu'\n          java-version: 15\n\n      # Check out current repository\n      - name: Fetch Sources\n        uses: actions/checkout@v2.3.1\n\n      # Run Maintenance Tasks\n      - name: Maintenance Run\n        run: ./gradlew :maintenance-tasks:run\n        env:\n          GH_TOKEN: ${{ secrets.GH_TOKEN }}\n          OWNER_NAME: 'Shabinder'\n          REPO_NAME: 'SpotiFlyer'\n          BRANCH_NAME: 'main'\n          FILE_PATH: 'README.md'\n          IMAGE_DESCRIPTION: 'Analytics'\n          COMMIT_MESSAGE: 'Analytics & Download Card Updated'\n          TAG_NAME: 'HTI'\n"
  },
  {
    "path": ".github/workflows/tf-refresh.yml",
    "content": "name: Refresh Terraform State\n\non:\n  workflow_dispatch:\n  schedule:\n    - cron: '0 0 * * 0'\n\njobs:\n  refresh-Infrastructure:\n    runs-on: ubuntu-latest\n    name: Refresh Main Infrastructure\n    env:\n      ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USER }}\n      ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}\n      ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}\n      ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}\n      ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}\n      ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n      - name: Setup Terraform environment\n        uses: little-core-labs/install-terraform@v2.0.0\n        with:\n          version: 0.14.5\n      - name: Terraform init\n        run: terraform init\n        working-directory: infra\n      - name: Terraform refresh\n        run: terraform refresh\n        working-directory: infra\n        env:\n          TF_VAR_docker_registry_username: ${{ secrets.GH_PKG_USER }}\n          TF_VAR_docker_registry_password: ${{ secrets.GH_PKG_PASSWORD }}\n"
  },
  {
    "path": ".gitignore",
    "content": ".idea/\nlocal.properties\n/android/release/\n/android/google-services.json\nbuild/\n.gradle/\nterraform.tfvars\n.terraform/\n/spotiflyer-ios/Pods/\n/fastlane/report.xml\n/fastlane/README.md\nGemfile\nGemfile.lock\n/maintenance-tasks/build/\n/android/.cxx/Debug/5k2s1t1p/x86/\n/ffmpeg/ffmpeg-kit-android-lib/.cxx/Debug/\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"spotiflyer-ios\"]\n\tpath = spotiflyer-ios\n\turl = https://github.com/Shabinder/spotiflyer-ios\n[submodule \"ffmpeg/ffmpeg-android-maker\"]\n\tpath = ffmpeg/ffmpeg-android-maker\n\turl = https://github.com/Shabinder/ffmpeg-android-maker/\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "### Contributing Translations:\n\n - **Fork** this repo (Button at top Right Corner)\n \n - Create **`Strings_{language-code}.properties.xml`**  in  **`/translations/`**\n   \n   - Refer to the **Default file** - *English **(en)*** => [`Strings_en.properties`](https://github.com/Shabinder/SpotiFlyer/blob/main/translations/Strings_en.properties)\n   \n       - For example, if you want to translate the app to **French** , create **`Strings_fr.properties`**\n   \n   - **Copy** all Key-Value pairs from **`Strings_en.properties`** to your newly created **`Strings_fr.properties`** and Translate all Values.\n \n - **Commit** your Changes to your Fork and then **Create a Pull Request** to this Repo.\n \n - **Sit Back and Relax**... and **kudos** for your contibution! Your effort and contribution will benefit lots of people. 🙏😊\n\nIf You Need any Help with Anything, just create an issue asking about the same.\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": " We will from now on publish **[PLUGINS](https://gitlab.com/shabinder/soundbound#-disclaimer)** for **[Soundbound](https://soundbound.app)**, which users can install **explicitly** on their own responsibility [(*disclaimer*)](https://gitlab.com/shabinder/soundbound#-disclaimer).\n\n - [Soundbound Installation Guide.](https://soundbound.app/install)\n   - [Wiki](https://soundbound.app/wiki)\n   - [Telegram](https://soundbound.app/telegram)\n\n![Feature Soundbound](art/soundbound-feature.jpg)\n\n# Soundbound - [Get Now!](https://soundbound.app/) \n\n---\n> Please refer above for latest updates.\n>  - Spotiflyer itself won't be getting any more updates, \n>  We all thank you for your support and hope to see you in [Soundbound Telegram Community](https://soundbound.app/telegram). \n---\n![Web Cover](art/cover-web.jpg)\n![Android Cover](art/cover-android.jpg)\n![Desktop Cover](art/cover-desktop.jpg)\n\n\n<a href=\"https://github.com/Shabinder/SpotiFlyer\"><img src=\"https://github.com/Shabinder/SpotiFlyer/blob/Compose/art/SpotiFlyer.svg\" align=\"left\" height=\"80\" width=\"80\" ></a>\n\n# [SpotiFlyer](https://spotiflyer.in/)\n- **Kotlin Multiplatform** Music Downloader ,supports **Spotify, Youtube, Gaana, Jio-Saavn and SoundCloud**.\n\nSupports- Playlist, Albums, Tracks. _(If You know Any Source for Episodes/Podcasts create an Issue sharing It.)_\n\n **Currently running on:**\n - [Android (Jetpack Compose)](https://github.com/Shabinder/SpotiFlyer#-install) \n - [Desktop (Compose for Desktop) <sup>β</sup>](https://github.com/Shabinder/SpotiFlyer#-install)\n - [Web (Kotlin/JS + React Wrapper) <sup>β</sup>](https://shabinder.github.io/SpotiFlyer/)\n - [_(WIP)_ IOS SOON (SWIFTUI)](https://github.com/Shabinder/spotiflyer-ios)\n\n<!--[![Build Status](https://github.com/Shabinder/SpotiFlyer/blob/master/app/build_passing.svg)](https://github.com/Shabinder/SpotiFlyer/releases)\n![API](https://img.shields.io/badge/API-26%2B-brightgreen.svg)\n</br>-->\n[![GitHub stars](https://img.shields.io/github/stars/Shabinder/SpotiFlyer?style=social)](https://github.com/Shabinder/SpotiFlyer/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/Shabinder/SpotiFlyer?style=social)](https://github.com/Shabinder/SpotiFlyer/network/members)\n[![GitHub watchers](https://img.shields.io/github/watchers/Shabinder/SpotiFlyer?style=social)](https://github.com/Shabinder/SpotiFlyer/watchers)\n\n***Encourage this repo by giving it a Star⭐ .***\n\n[SpotiFlyer](https://app.spotiflyer.in/) is an **App**(Written in **Kotlin**), which **aims** to work as:\n  - **Downloads**: Albums, Tracks and Playlists,etc \n  - **Save your Data** ,by not **_Streaming_** your Fav Songs Online again & again(Just Download Them!)\n  - **No ADS!** \n  - **Works straight out of the box** and does not require you to generate or mess with your API keys (already included).\n  \n### Supported Platforms:\n- Spotify\n- Gaana\n- Youtube\n- Youtube Music\n- Jio-Saavn\n- SoundCloud\n- _(more coming soon)_\n\n<!--START_SECTION:DCI \n<a href=\"https://github.com/Shabinder/SpotiFlyer/releases/latest\"><img src=\"https://hcti.io/v1/image/53d51dc7-91c7-4b9d-b923-2ea32e6b17ad\" height=\"125\" width=\"280\" alt=\"Total Downloads\"></a>\n<!--END_SECTION:DCI-->\n\n        \n\n## 💻 Install \n\n| Platform | Download | Status |\n|----------|----------|--------|\n| Android    |[![Download Button](https://img.shields.io/github/v/release/Shabinder/SpotiFlyer?color=7885FF&label=Android-Apk&logo=android&style=for-the-badge)](https://github.com/Shabinder/SpotiFlyer/releases/download/v3.6.3/SpotiFlyer-3.6.3.apk)| ✅ Stable | \n| Windows    |[![Download Button](https://img.shields.io/github/v/release/Shabinder/SpotiFlyer?color=00A8E8&label=Windows-msi&logo=windows&style=for-the-badge)](https://github.com/Shabinder/SpotiFlyer/releases/download/v3.6.3/SpotiFlyer-3.6.3.msi)| ✅ Stable | \n| Windows-JAR   |[![Download Button](https://img.shields.io/github/v/release/Shabinder/SpotiFlyer?color=00719c&label=Windows-jar&logo=windows&style=for-the-badge)](https://github.com/Shabinder/SpotiFlyer/releases/download/v3.6.3/SpotiFlyer-windows-x64-3.6.3.jar)| ✅ Stable | \n| MacOS-JAR    |[![Download Button](https://img.shields.io/github/v/release/Shabinder/SpotiFlyer?color=5F85CE&label=MacOS-jar&logo=apple&style=for-the-badge)](https://github.com/Shabinder/SpotiFlyer/releases/download/v3.6.3/SpotiFlyer-macos-x64-3.6.3.jar) | ✅ Stable |\n| Linux-DEB    |[![Download Button](https://img.shields.io/github/v/release/Shabinder/SpotiFlyer?color=D0074E&label=Linux-deb&logo=debian&style=for-the-badge)](https://github.com/Shabinder/SpotiFlyer/releases/download/v3.6.3/spotiflyer_3.6.3-1_amd64.deb)| ✅ Stable |\n| Linux-JAR    |[![Download Button](https://img.shields.io/github/v/release/Shabinder/SpotiFlyer?color=EBA201&label=Linux-jar&logo=linux&style=for-the-badge)](https://github.com/Shabinder/SpotiFlyer/releases/download/v3.6.3/SpotiFlyer-linux-x64-3.6.3.jar)| ✅ Stable | \n| Web    |[![Download Button](https://img.shields.io/github/v/release/Shabinder/SpotiFlyer?color=FF7139&label=SpotiFlyer&logo=firefox&style=for-the-badge)](https://shabinder.github.io/SpotiFlyer/) | ⚠️ Beta | \n\n- To run the `jar` version, you need JAVA installed.\n- MacOs DMG is not notarized and signed using a certificate , so Use jar in mac for now.\n\n<!-- [![Latest Download](https://img.shields.io/github/downloads/Shabinder/SpotiFlyer/total?style=for-the-badge&color=17B2E7)](https://github.com/Shabinder/SpotiFlyer/releases/latest) -->\n\n<a href=\"https://f-droid.org/packages/com.shabinder.spotiflyer\">\n    <img src=\"https://fdroid.gitlab.io/artwork/badge/get-it-on.png\"\n    alt=\"Get it on F-Droid\"\n    height=\"110\">\n</a>\n\n### Want to Contribute 🙋‍♂️?\nWant to contribute? Great!\nAll contributions are welcome, from code to documentation to graphics to design suggestions to bug reports. Please use GitHub to its fullest-- contribute Pull Requests, contribute tutorials or other wiki content-- whatever you have to offer, we can use it!\n\n - For **Translations** , read [Contributing.md](https://github.com/Shabinder/SpotiFlyer/blob/main/CONTRIBUTING.md)\n\n**Please Donate to support me and my work!**\n</br>\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R84CS1D)\n</br>\n<a href=\"https://opencollective.com/spotiflyer/donate\">\n    <img src=\"https://opencollective.com/spotiflyer/tiers/donate.svg?avatarHeight=52\">\n</a>\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://paypal.me/shabinder)\n\n### Want to discuss? 💬\nHave any questions, doubts or want to present your opinions, views? You're always welcome. You can [start discussions](https://github.com/Shabinder/SpotiFlyer/discussions).\n\n### Todos 📄\n - Write **Tests**.\n - Support for Podcasts/Episodes and Shows.\n - Build a Media Player into this app. [#113](https://github.com/Shabinder/SpotiFlyer/issues/113) \n \n### Note\nThe availability of YouTube Music / JioSaavn in your country is important for this app to work. The reason behind this is, we use YouTube Music / JioSaavn to filter out our search results and get the desired song downloaded from Youtube Music OR other providers we may use(like Jio Saavn).\nTo check if YouTube Music is available in your country, visit [YouTube Music](https://music.youtube.com).\n\nI am hosting a **server for WEB APP on my own personal device** , so expect some downtimes, If you have a **server** available and would like to share , open an issue or ping me wherever you can get a hold of me.\n\n\n### Permissions Info:\n - **NETWORK**- *(INTERNET, ACCESS_NETWORK_STATE, ACCESS_WIFI_STATE)*: to access the online streaming services, and Confirm Network Connectivity.\n - **STORAGE**- *READ_STORAGE_PERMISSION, READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, MANAGE_EXTERNAL_STORAGE)*: to save Downloaded Media Files.\n - **QUERY_ALL_PACKAGES**- in order to check if Youtube Music, Spotify, Gaana, JioSaavn, etc apps are installed and if they are, user can directly open them.\n - **REQUEST_IGNORE_BATTERY_OPTIMIZATIONS**: User Allows App to Run in Background at runtime in Permission Dialog.\n - **Wake Lock**: Don't let Wifi/Internet Sleep in screen off / dozing state when Songs are being downloaded.\n - **Foreground Service**: Service responsible to download and save songs to storage even after app is exited/background. \n - **NOTE**: Analytics and Crashlytics are **OPT-IN** *(Disabled by Default)* and are **Self-Hosted**.\n\nLicense\n![GPL-License](https://img.shields.io/github/license/Shabinder/SpotiFlyer?style=flat-square)\n----\n**GPL-3.0 License**\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\n***Free Software, Hell Yeah!***\n\n\nCredits\n----\n - Some Logos are Based on Logos by [Freepik](https://www.freepik.com/).\n  \n  \nDisclaimer\n----\nDownloading copyright songs may be illegal in your country. This tool is for educational purposes only and was created only to show how Music Platform's Apis like Spotify's API can be exploited to download music. Please support the artists by buying their music.\n\n"
  },
  {
    "path": "android/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport com.android.build.gradle.internal.cxx.configure.gradleLocalProperties\nimport org.jetbrains.compose.compose\n\nplugins {\n    id(\"com.android.application\")\n    kotlin(\"android\")\n    id(\"kotlin-parcelize\")\n    id(\"org.jetbrains.compose\")\n    id(\"ktlint-setup\")\n}\n\ngroup = \"com.shabinder\"\nversion = Versions.versionName\n\nrepositories {\n    google()\n    mavenCentral()\n}\n\nandroid {\n    val props = gradleLocalProperties(rootDir)\n    if (props.containsKey(\"storeFileDir\")) {\n        signingConfigs {\n            create(\"release\") {\n                storeFile = file(props.getProperty(\"storeFileDir\"))\n                storePassword = props.getProperty(\"storePassword\")\n                keyAlias = props.getProperty(\"keyAlias\")\n                keyPassword = props.getProperty(\"keyPassword\")\n            }\n        }\n    }\n\n    compileSdk = Versions.compileSdkVersion\n    buildToolsVersion = \"30.0.3\"\n\n    defaultConfig {\n        applicationId = \"com.shabinder.spotiflyer\"\n        minSdk = Versions.minSdkVersion\n        targetSdk = Versions.targetSdkVersion\n        versionCode = Versions.versionCode\n        versionName = Versions.versionName\n        ndkVersion = \"21.4.7075529\"\n    }\n    buildTypes {\n        getByName(\"release\") {\n            isMinifyEnabled = true\n            // isShrinkResources = true\n            if (props.containsKey(\"storeFileDir\")) {\n                signingConfig = signingConfigs.getByName(\"release\")\n            }\n            proguardFiles(\n                getDefaultProguardFile(\"proguard-android-optimize.txt\"),\n                \"proguard-rules.pro\"\n            )\n        }\n    }\n    kotlinOptions {\n        jvmTarget = \"1.8\"\n    }\n    compileOptions {\n        // Flag to enable support for the new language APIs\n        isCoreLibraryDesugaringEnabled = true\n        sourceCompatibility = JavaVersion.VERSION_1_8\n        targetCompatibility = JavaVersion.VERSION_1_8\n    }\n    packagingOptions {\n        exclude(\"META-INF/*\")\n    }\n}\ndependencies {\n    implementation(compose.material)\n    implementation(compose.materialIconsExtended)\n    implementation(deps.androidx.activity)\n\n    // Project's SubModules\n    implementation(project(\":common:database\"))\n    implementation(project(\":common:compose\"))\n    implementation(project(\":common:root\"))\n    implementation(project(\":common:dependency-injection\"))\n    implementation(project(\":common:data-models\"))\n    implementation(project(\":common:core-components\"))\n    implementation(project(\":common:providers\"))\n\n    with(deps) {\n\n        // Koin\n        with(koin) {\n            implementation(androidx.compose)\n            implementation(android)\n        }\n\n        // DECOMPOSE\n        with(decompose) {\n            implementation(dep)\n            implementation(extensions.compose)\n        }\n\n        implementation(countly.android)\n        implementation(android.app.notifier)\n        implementation(storage.chooser)\n\n        with(bundles) {\n            implementation(ktor)\n            implementation(mviKotlin)\n            implementation(androidx.lifecycle)\n            implementation(accompanist.inset)\n        }\n\n        // Test\n        testImplementation(junit)\n        androidTestImplementation(androidx.junit)\n        androidTestImplementation(androidx.expresso)\n\n        // Desugar\n        coreLibraryDesugaring(androidx.desugar)\n\n        // Debug\n        debugImplementation(leak.canary)\n    }\n}\n"
  },
  {
    "path": "android/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguardFiles setting in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n\n# Uncomment this to preserve the line number information for\n# debugging stack traces.\n#-keepattributes SourceFile,LineNumberTable\n\n# If you keep the line number information, uncomment this to\n# hide the original source file name.\n#-renamesourcefileattribute SourceFile\n-keepattributes *Annotation*, InnerClasses\n-dontnote kotlinx.serialization.AnnotationsKt # core serialization annotations\n-keepattributes SourceFile,LineNumberTable        # Keep file names and line numbers.\n-keep public class * extends java.lang.Exception  # Optional: Keep custom exceptions.\n\n# kotlinx-serialization-json specific. Add this if you have java.lang.NoClassDefFoundError kotlinx.serialization.json.JsonObjectSerializer\n-keepclassmembers class kotlinx.serialization.json.** {\n    *** Companion;\n}\n-keepclasseswithmembers class kotlinx.serialization.json.** {\n    kotlinx.serialization.KSerializer serializer(...);\n}\n-keep class com.shabinder.** { *; }\n-keep class com.mpatric.** { *; }\n-keep,includedescriptorclasses class com.shabinder.**$$serializer { *; } # <-- change package name to your app's\n-keepclassmembers class com.shabinder.** { # <-- change package name to your app's\n    *** Companion;\n}\n-keepclasseswithmembers class com.shabinder.** { # <-- change package name to your app's\n    kotlinx.serialization.KSerializer serializer(...);\n}\n# Ktor\n-keep class io.ktor.** { *; }\n-keep class kotlinx.coroutines.** { *; }"
  },
  {
    "path": "android/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    package=\"com.shabinder.spotiflyer\">\n\n    <queries>\n        <package android:name=\"com.gaana\" />\n        <package android:name=\"com.spotify.music\" />\n        <package android:name=\"com.jio.media.jiobeats\" />\n        <package android:name=\"com.soundcloud.android\" />\n        <package android:name=\"com.google.android.youtube\" />\n        <package android:name=\"com.google.android.apps.youtube.music\" />\n    </queries>\n\n    <uses-permission android:name=\"android.permission.INTERNET\"/>\n    <uses-permission android:name=\"android.permission.QUERY_ALL_PACKAGES\" />\n    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n    <uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />\n    <uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />\n    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"\n        tools:ignore=\"ScopedStorage\" />\n    <uses-permission android:name=\"android.permission.READ_STORAGE_PERMISSION\" />\n    <uses-permission android:name=\"android.permission.MANAGE_EXTERNAL_STORAGE\"\n        tools:ignore=\"ProtectedPermissions,ScopedStorage\" />\n    <uses-permission android:name=\"android.permission.WAKE_LOCK\" />\n    <uses-permission android:name=\"android.permission.FOREGROUND_SERVICE\" />\n    <uses-permission android:name=\"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\" />\n\n    <application\n        android:name=\".App\"\n        android:allowBackup=\"false\"\n        android:supportsRtl=\"true\"\n        android:usesCleartextTraffic=\"true\"\n        android:theme=\"@style/Theme.AppCompat.Light.NoActionBar\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:hardwareAccelerated=\"true\"\n        android:largeHeap=\"true\"\n        android:label=\"SpotiFlyer\"\n        android:roundIcon=\"@mipmap/ic_launcher_round\"\n        android:configChanges=\"orientation|screenSize\"\n        android:forceDarkAllowed=\"true\"\n        android:extractNativeLibs=\"true\"\n        android:requestLegacyExternalStorage=\"true\"\n        tools:targetApi=\"q\">\n        <activity\n            android:name=\".ui.SplashScreenActivity\"\n            android:theme=\"@style/SplashTheme\"\n            android:hardwareAccelerated=\"true\"\n            >\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n\n        <activity android:name=\".MainActivity\"\n            android:launchMode=\"singleTask\"\n            android:hardwareAccelerated=\"true\"\n            android:theme=\"@style/Theme.SpotiFlyer\"\n            >\n            <intent-filter>\n                <category android:name=\"android.intent.category.DEFAULT\" />\n                <action android:name=\"android.intent.action.SEND\" />\n                <data android:mimeType=\"text/plain\" />\n            </intent-filter>\n        </activity>\n\n        <service android:name=\".service.ForegroundService\"/>\n        <service android:name=\"org.openudid.OpenUDID_service\"\n            tools:ignore=\"ExportedService,IntentFilterExportedReceiver\">\n            <intent-filter>\n                <action android:name=\"org.openudid.GETUDID\" />\n            </intent-filter>\n        </service>\n\n        <receiver android:name=\"ly.count.android.sdk.ReferrerReceiver\" android:exported=\"true\"\n            tools:ignore=\"ExportedReceiver\">\n            <intent-filter>\n                <action android:name=\"com.android.vending.INSTALL_REFERRER\" />\n            </intent-filter>\n        </receiver>\n    </application>\n</manifest>"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/App.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.spotiflyer\n\nimport android.app.Application\nimport com.shabinder.common.di.initKoin\nimport com.shabinder.spotiflyer.di.appModule\nimport org.koin.android.ext.koin.androidContext\nimport org.koin.android.ext.koin.androidLogger\nimport org.koin.core.component.KoinComponent\nimport org.koin.core.logger.Level\n\nclass App : Application(), KoinComponent {\n\n    companion object {\n        const val SIGNATURE_HEX = \"53304f6d75736a2f30484230334c454b714753525763724259444d3d0a\"\n    }\n\n    override fun onCreate() {\n        super.onCreate()\n\n        val loggingEnabled = true\n        // KOIN - DI\n        initKoin(loggingEnabled) {\n            androidLogger(Level.NONE) // No virtual method elapsedNow\n            androidContext(this@App)\n            modules(appModule(loggingEnabled))\n        }\n    }\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/MainActivity.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.spotiflyer\n\nimport android.annotation.SuppressLint\nimport android.content.*\nimport android.content.pm.PackageManager\nimport android.media.MediaScannerConnection\nimport android.net.Uri\nimport android.os.Build\nimport android.os.Bundle\nimport android.os.IBinder\nimport android.os.PowerManager\nimport android.util.Log\nimport androidx.activity.ComponentActivity\nimport androidx.activity.compose.setContent\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.foundation.background\nimport androidx.compose.foundation.layout.Box\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.material.MaterialTheme\nimport androidx.compose.material.Surface\nimport androidx.compose.runtime.*\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.platform.LocalView\nimport androidx.core.content.ContextCompat\nimport androidx.core.view.WindowCompat\nimport androidx.lifecycle.Lifecycle\nimport androidx.lifecycle.lifecycleScope\nimport androidx.lifecycle.repeatOnLifecycle\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.decompose.defaultComponentContext\nimport com.arkivanov.mvikotlin.logging.store.LoggingStoreFactory\nimport com.arkivanov.mvikotlin.main.store.DefaultStoreFactory\nimport com.codekidlabs.storagechooser.R\nimport com.codekidlabs.storagechooser.StorageChooser\nimport com.google.accompanist.insets.ProvideWindowInsets\nimport com.google.accompanist.insets.navigationBarsPadding\nimport com.google.accompanist.insets.statusBarsHeight\nimport com.google.accompanist.insets.statusBarsPadding\nimport com.shabinder.common.core_components.ConnectionLiveData\nimport com.shabinder.common.core_components.analytics.AnalyticsManager\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.di.ApplicationInit\nimport com.shabinder.common.di.observeAsState\nimport com.shabinder.common.models.*\nimport com.shabinder.common.models.PlatformActions.Companion.SharedPreferencesKey\nimport com.shabinder.common.providers.FetchPlatformQueryResult\nimport com.shabinder.common.root.SpotiFlyerRoot\nimport com.shabinder.common.root.callbacks.SpotiFlyerRootCallBacks\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTheme\nimport com.shabinder.common.uikit.configurations.colorOffWhite\nimport com.shabinder.common.uikit.screens.SpotiFlyerRootContent\nimport com.shabinder.spotiflyer.service.ForegroundService\nimport com.shabinder.spotiflyer.ui.AnalyticsDialog\nimport com.shabinder.spotiflyer.ui.NetworkDialog\nimport com.shabinder.spotiflyer.ui.PermissionDialog\nimport com.shabinder.spotiflyer.utils.*\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.delay\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.flow.conflate\nimport kotlinx.coroutines.flow.emitAll\nimport kotlinx.coroutines.flow.flowOn\nimport kotlinx.coroutines.launch\nimport org.koin.android.ext.android.inject\nimport org.koin.core.parameter.parametersOf\nimport java.io.File\n\n@OptIn(ExperimentalAnimationApi::class)\nclass MainActivity : ComponentActivity() {\n\n    private val fetcher: FetchPlatformQueryResult by inject()\n    private val fileManager: FileManager by inject()\n    private val preferenceManager: PreferenceManager by inject()\n    private val analyticsManager: AnalyticsManager by inject { parametersOf(this) }\n    private val applicationInit: ApplicationInit by inject()\n    private val callBacks: SpotiFlyerRootCallBacks get() = this.rootComponent.callBacks\n    private val trackStatusFlow = MutableSharedFlow<HashMap<String, DownloadStatus>>(1)\n    private var permissionGranted = mutableStateOf(true)\n    private val internetAvailability by lazy { ConnectionLiveData(applicationContext) }\n    private lateinit var rootComponent: SpotiFlyerRoot\n    // private val visibleChild get(): SpotiFlyerRoot.Child = root.routerState.value.activeChild.instance\n\n    // Variable for storing instance of our service class\n    var foregroundService: ForegroundService? = null\n\n    // Boolean to check if our activity is bound to service or not\n    var isServiceBound: Boolean? = null\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        preferenceManager.analyticsManager = analyticsManager\n        // This app draws behind the system bars, so we want to handle fitting system windows\n        WindowCompat.setDecorFitsSystemWindows(window, false)\n        this.rootComponent = spotiFlyerRoot(defaultComponentContext())\n        setContent {\n            SpotiFlyerTheme {\n                Surface(contentColor = colorOffWhite) {\n                    ProvideWindowInsets {\n                        permissionGranted = remember { mutableStateOf(true) }\n                        val view = LocalView.current\n\n                        Box {\n                            SpotiFlyerRootContent(\n                                this@MainActivity.rootComponent,\n                                Modifier.statusBarsPadding().navigationBarsPadding(),\n                                showSplash = false // We already show System-Native Splash\n                            )\n                            Spacer(\n                                Modifier\n                                    .statusBarsHeight()\n                                    .fillMaxWidth()\n                                    .background(MaterialTheme.colors.background.copy(alpha = 0.65f))\n                            )\n                        }\n\n                        NetworkDialog(isInternetAvailableState())\n\n                        PermissionDialog(\n                            permissionGranted.value,\n                            { requestStoragePermission() },\n                            { disableDozeMode(disableDozeCode) },\n                        )\n\n                        var askForAnalyticsPermission by remember { mutableStateOf(false) }\n                        AnalyticsDialog(\n                            askForAnalyticsPermission,\n                            enableAnalytics = {\n                                preferenceManager.toggleAnalytics(true)\n                                preferenceManager.firstLaunchDone()\n                            },\n                            dismissDialog = {\n                                askForAnalyticsPermission = false\n                                preferenceManager.firstLaunchDone()\n                            }\n                        )\n\n                        LaunchedEffect(view) {\n                            permissionGranted.value = checkPermissions()\n                            if (preferenceManager.isFirstLaunch) {\n                                delay(2500)\n                                // Ask For Analytics Permission on first Dialog\n                                askForAnalyticsPermission = true\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        initialise()\n    }\n\n    private fun initialise() {\n        val isGithubRelease = checkAppSignature(this)\n        /*\n        * Only Send an `Update Notification` on Github Release Builds\n        * and Track Downloads for all other releases like F-Droid,\n        * for `Github Downloads` we will track Downloads using : https://tooomm.github.io/github-release-stats/?username=Shabinder&repository=SpotiFlyer\n        * */\n        if (isGithubRelease) {\n            checkIfLatestVersion()\n        }\n        // TODO Track Download Event\n        handleIntentFromExternalActivity()\n\n        initForegroundService()\n    }\n\n    /*START: Foreground Service Handlers*/\n    private fun initForegroundService() {\n        // Start and then Bind to the Service\n        ContextCompat.startForegroundService(\n            this@MainActivity,\n            Intent(this, ForegroundService::class.java)\n        )\n        bindService()\n    }\n\n    /**\n     * Interface for getting the instance of binder from our service class\n     * So client can get instance of our service class and can directly communicate with it.\n     */\n    private val serviceConnection = object : ServiceConnection {\n        val tag = \"Service Connection\"\n\n        override fun onServiceConnected(className: ComponentName, iBinder: IBinder) {\n            Log.d(tag, \"connected to service.\")\n            // We've bound to MyService, cast the IBinder and get MyBinder instance\n            val binder = iBinder as ForegroundService.DownloadServiceBinder\n            foregroundService = binder.service\n            isServiceBound = true\n            lifecycleScope.launch {\n                repeatOnLifecycle(Lifecycle.State.STARTED) {\n                    foregroundService?.trackStatusFlowMap?.statusFlow?.let {\n                        trackStatusFlow.emitAll(it.conflate().flowOn(Dispatchers.Default))\n                    }\n                }\n            }\n        }\n\n        override fun onServiceDisconnected(arg0: ComponentName) {\n            Log.d(tag, \"disconnected from service.\")\n            isServiceBound = false\n        }\n    }\n\n    /*Used to bind to our service class*/\n    private fun bindService() {\n        Intent(this, ForegroundService::class.java).also { intent ->\n            bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE)\n        }\n    }\n\n    /*Used to unbind from our service class*/\n    private fun unbindService() {\n        Intent(this, ForegroundService::class.java).also {\n            unbindService(serviceConnection)\n        }\n    }\n    /*END: Foreground Service Handlers*/\n\n    @Composable\n    private fun isInternetAvailableState(): State<Boolean?> {\n        return internetAvailability.observeAsState()\n    }\n\n    private fun showPopUpMessage(string: String, long: Boolean = false) {\n        runOnUiThread {\n            android.widget.Toast.makeText(\n                applicationContext,\n                string,\n                if (long) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT\n            ).show()\n        }\n        Log.i(\"Toasting\", string)\n    }\n\n    @Suppress(\"DEPRECATION\")\n    override fun onRequestPermissionsResult(\n        requestCode: Int,\n        permissions: Array<out String>,\n        grantResults: IntArray\n    ) {\n        super.onRequestPermissionsResult(requestCode, permissions, grantResults)\n        permissionGranted.value = checkPermissions()\n    }\n\n    private fun spotiFlyerRoot(componentContext: ComponentContext): SpotiFlyerRoot =\n        SpotiFlyerRoot(\n            componentContext,\n            dependencies = object : SpotiFlyerRoot.Dependencies {\n                override val storeFactory = LoggingStoreFactory(DefaultStoreFactory())\n                override val database = this@MainActivity.fileManager.db\n                override val fetchQuery = this@MainActivity.fetcher\n                override val fileManager: FileManager = this@MainActivity.fileManager\n                override val preferenceManager = this@MainActivity.preferenceManager\n                override val analyticsManager: AnalyticsManager = this@MainActivity.analyticsManager\n                override val downloadProgressFlow: MutableSharedFlow<HashMap<String, DownloadStatus>> =\n                    trackStatusFlow\n                override val appInit: ApplicationInit = applicationInit\n                override val actions = object : Actions {\n\n                    override val platformActions = object : PlatformActions {\n                        override val imageCacheDir: String =\n                            applicationContext.cacheDir.absolutePath + File.separator\n                        override val sharedPreferences = applicationContext.getSharedPreferences(\n                            SharedPreferencesKey,\n                            MODE_PRIVATE\n                        )\n\n                        override fun addToLibrary(path: String) {\n                            MediaScannerConnection.scanFile(\n                                applicationContext,\n                                listOf(path).toTypedArray(), null, null\n                            )\n                        }\n\n                        override fun sendTracksToService(array: List<TrackDetails>) {\n                            for (chunk in array.chunked(25)) {\n                                if (foregroundService == null) initForegroundService()\n                                foregroundService?.downloadAllTracks(chunk)\n                            }\n                        }\n                    }\n\n                    override fun showPopUpMessage(string: String, long: Boolean) =\n                        this@MainActivity.showPopUpMessage(string, long)\n\n                    override fun setDownloadDirectoryAction(callBack: (String) -> Unit) =\n                        setUpOnPrefClickListener(callBack)\n\n                    override fun queryActiveTracks() = this@MainActivity.queryActiveTracks()\n\n                    override fun giveDonation() {\n                        openPlatform(\n                            \"\",\n                            platformLink = \"https://razorpay.com/payment-button/pl_GnKuuDBdBu0ank/view/?utm_source=payment_button&utm_medium=button&utm_campaign=payment_button\"\n                        )\n                    }\n\n                    override fun shareApp() {\n                        val sendIntent: Intent = Intent().apply {\n                            action = Intent.ACTION_SEND\n                            putExtra(Intent.EXTRA_TEXT, Strings.shareMessage())\n                            type = \"text/plain\"\n                        }\n\n                        val shareIntent = Intent.createChooser(sendIntent, null)\n                        startActivity(shareIntent)\n                    }\n\n                    override fun copyToClipboard(text: String) {\n                        val clipboard = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager\n                        val clip = ClipData.newPlainText(\"SpotiFlyer Selection\", text)\n                        clipboard.setPrimaryClip(clip)\n\n                        showPopUpMessage(\"Text Copied to Clipboard.\")\n                    }\n\n                    override fun openPlatform(packageID: String, platformLink: String) {\n                        val manager: PackageManager = applicationContext.packageManager\n                        try {\n                            val intent = manager.getLaunchIntentForPackage(packageID)\n                                ?: throw PackageManager.NameNotFoundException()\n                            intent.addCategory(Intent.CATEGORY_LAUNCHER)\n                            startActivity(intent)\n                        } catch (e: PackageManager.NameNotFoundException) {\n                            val uri: Uri =\n                                Uri.parse(platformLink)\n                            val intent = Intent(Intent.ACTION_VIEW, uri)\n                            startActivity(intent)\n                        }\n                    }\n\n                    override fun writeMp3Tags(trackDetails: TrackDetails) {\n                        /*IMPLEMENTED*/\n                    }\n\n                    override val isInternetAvailable get() = internetAvailability.value ?: true\n                }\n            }\n        )\n\n    private fun queryActiveTracks() {\n        lifecycleScope.launch {\n            foregroundService?.trackStatusFlowMap?.let { tracksStatus ->\n                trackStatusFlow.emit(tracksStatus)\n            }\n        }\n    }\n\n    override fun onResume() {\n        super.onResume()\n        queryActiveTracks()\n    }\n\n    @Suppress(\"DEPRECATION\")\n    private fun setUpOnPrefClickListener(callBack: (String) -> Unit) {\n        // Initialize Builder\n        val chooser = StorageChooser.Builder()\n            .withActivity(this)\n            .withFragmentManager(fragmentManager)\n            .withMemoryBar(true)\n            .setTheme(\n                StorageChooser.Theme(applicationContext).apply {\n                    scheme = applicationContext.resources.getIntArray(R.array.default_dark)\n                }\n            )\n            .setDialogTitle(Strings.setDownloadDirectory())\n            .allowCustomPath(true)\n            .setType(StorageChooser.DIRECTORY_CHOOSER)\n            .build()\n\n        // get path that the user has chosen\n        chooser.setOnSelectListener { path ->\n            Log.d(\"Setting Base Path\", path)\n            val f = File(path)\n            if (f.canWrite()) {\n                // hell yeah :)\n                preferenceManager.setDownloadDirectory(path)\n                callBack(path)\n                showPopUpMessage(Strings.downloadDirectorySetTo(\"\\n${fileManager.defaultDir()}\"))\n            } else {\n                showPopUpMessage(Strings.noWriteAccess(\"\\n$path \"))\n            }\n        }\n\n        // Show dialog whenever you want by\n        chooser.show()\n    }\n\n    @Suppress(\"DEPRECATION\")\n    @SuppressLint(\"ObsoleteSdkInt\")\n    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {\n        super.onActivityResult(requestCode, resultCode, data)\n        if (requestCode == disableDozeCode) {\n            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n                val pm =\n                    getSystemService(Context.POWER_SERVICE) as PowerManager\n                val isIgnoringBatteryOptimizations =\n                    pm.isIgnoringBatteryOptimizations(packageName)\n                if (isIgnoringBatteryOptimizations) {\n                    // Ignoring battery optimization\n                    permissionGranted.value = true\n                } else {\n                    disableDozeMode(disableDozeCode) // Again Ask For Permission!!\n                }\n            }\n        }\n    }\n\n    override fun onNewIntent(intent: Intent?) {\n        super.onNewIntent(intent)\n        handleIntentFromExternalActivity(intent)\n    }\n\n    private fun handleIntentFromExternalActivity(intent: Intent? = getIntent()) {\n        if (intent?.action == Intent.ACTION_SEND) {\n            if (\"text/plain\" == intent.type) {\n                intent.getStringExtra(Intent.EXTRA_TEXT)?.let {\n                    val filterLinkRegex = \"\"\"http.+\\w\"\"\".toRegex()\n                    val string = it.replace(\"\\n\".toRegex(), \" \")\n                    val link = filterLinkRegex.find(string)?.value.toString()\n                    Log.i(\"Intent\", link)\n                    lifecycleScope.launch {\n                        while (!this@MainActivity::rootComponent.isInitialized) {\n                            delay(100)\n                        }\n                        if (Actions.instance.isInternetAvailable) callBacks.searchLink(link)\n                    }\n                }\n            }\n        }\n    }\n\n    override fun onDestroy() {\n        super.onDestroy()\n        unbindService()\n    }\n\n    override fun onStart() {\n        super.onStart()\n        analyticsManager.onStart()\n    }\n\n    override fun onStop() {\n        super.onStop()\n        analyticsManager.onStop()\n    }\n\n    companion object {\n        const val disableDozeCode = 1223\n    }\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/di/AppModule.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.spotiflyer.di\n\nimport org.koin.dsl.module\n\nfun appModule(enableLogging: Boolean = false) = module {}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/service/ForegroundService.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.spotiflyer.service\n\nimport android.annotation.SuppressLint\nimport android.app.Notification\nimport android.app.NotificationChannel\nimport android.app.NotificationManager\nimport android.app.PendingIntent\nimport android.content.Context\nimport android.content.Intent\nimport android.os.Binder\nimport android.os.Build\nimport android.os.IBinder\nimport android.os.PowerManager\nimport android.util.Log\nimport androidx.core.app.NotificationCompat\nimport androidx.lifecycle.LifecycleService\nimport androidx.lifecycle.lifecycleScope\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.file_manager.downloadFile\nimport com.shabinder.common.core_components.parallel_executor.ParallelExecutor\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.event.coroutines.failure\nimport com.shabinder.common.providers.FetchPlatformQueryResult\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.spotiflyer.R\nimport io.ktor.client.HttpClient\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.coroutineScope\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.flow.collect\nimport kotlinx.coroutines.launch\nimport org.koin.android.ext.android.inject\nimport java.io.File\n\nclass ForegroundService : LifecycleService() {\n\n    private lateinit var downloadService: ParallelExecutor\n    val trackStatusFlowMap = TrackStatusFlowMap(\n        MutableSharedFlow(replay = 1),\n        lifecycleScope\n    )\n\n    private val fetcher: FetchPlatformQueryResult by inject()\n    private val logger: Kermit by inject()\n    private val dir: FileManager by inject()\n    private val httpClient: HttpClient by inject()\n\n    private var messageList =\n        java.util.Collections.synchronizedList(MutableList(5) { emptyMessage })\n    private var wakeLock: PowerManager.WakeLock? = null\n    private var isServiceStarted = false\n    private val cancelIntent: PendingIntent by lazy {\n        val intent = Intent(this, ForegroundService::class.java).apply { action = \"kill\" }\n        val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n            PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE\n        } else {\n            PendingIntent.FLAG_UPDATE_CURRENT\n        }\n        PendingIntent.getService(this, 0, intent, flags)\n    }\n\n    /* Variables Holding Download State */\n    private var total = 0\n    private var converted = 0\n    private var downloaded = 0\n    private var failed = 0\n    private val isFinished get() = converted + failed == total\n    private var isSingleDownload = false\n\n    inner class DownloadServiceBinder : Binder() {\n        val service get() = this@ForegroundService\n    }\n\n    private val myBinder: IBinder = DownloadServiceBinder()\n\n    override fun onBind(intent: Intent): IBinder {\n        super.onBind(intent)\n        return myBinder\n    }\n\n    override fun onCreate() {\n        super.onCreate()\n        downloadService = ParallelExecutor(Dispatchers.IO)\n        trackStatusFlowMap.scope = lifecycleScope\n        createNotificationChannel(CHANNEL_ID, \"Downloader Service\")\n    }\n\n    @SuppressLint(\"WakelockTimeout\")\n    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {\n        super.onStartCommand(intent, flags, startId)\n        downloadService.reviveIfClosed()\n        // Send a notification that service is started\n        Log.i(TAG, \"Foreground Service Started.\")\n        startForeground(NOTIFICATION_ID, createNotification())\n\n        intent?.let {\n            when (it.action) {\n                \"kill\" -> killService()\n            }\n        }\n\n        // Wake locks and misc tasks from here :\n        return if (isServiceStarted) {\n            // Service Already Started\n            START_STICKY\n        } else {\n            isServiceStarted = true\n            Log.i(TAG, \"Starting the foreground service task\")\n            wakeLock =\n                (getSystemService(Context.POWER_SERVICE) as PowerManager).run {\n                    newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, \"EndlessService::lock\").apply {\n                        acquire()\n                    }\n                }\n            START_STICKY\n        }\n    }\n\n    /**\n     * Function To Download All Tracks Available in a List\n     **/\n    fun downloadAllTracks(trackList: List<TrackDetails>) {\n        downloadService.reviveIfClosed()\n        trackList.size.also { size ->\n            total += size\n            isSingleDownload = (size == 1)\n            updateNotification()\n        }\n\n        for (track in trackList) {\n            trackStatusFlowMap[track.title] = DownloadStatus.Queued\n            lifecycleScope.launch {\n                downloadService.executeSuspending {\n                    fetcher.findBestDownloadLink(track).fold(\n                        success = { res ->\n                            enqueueDownload(res.first, track.apply { audioQuality = res.second })\n                        },\n                        failure = { error ->\n                            failed++\n                            updateNotification()\n                            trackStatusFlowMap[track.title] = DownloadStatus.Failed(error)\n                        }\n                    )\n                }\n            }\n        }\n    }\n\n    private suspend fun enqueueDownload(url: String, track: TrackDetails) {\n        // Initiating Download\n        addToNotification(Message(track.title, DownloadStatus.Downloading()))\n        trackStatusFlowMap[track.title] = DownloadStatus.Downloading()\n\n        // Enqueueing Download\n        httpClient.downloadFile(url).collect {\n            when (it) {\n                is DownloadResult.Error -> {\n                    logger.d(TAG) { it.message }\n                    failed++\n                    trackStatusFlowMap[track.title] =\n                        DownloadStatus.Failed(it.cause ?: Exception(it.message))\n                    removeFromNotification(Message(track.title, DownloadStatus.Downloading()))\n                }\n\n                is DownloadResult.Progress -> {\n                    trackStatusFlowMap[track.title] = DownloadStatus.Downloading(it.progress)\n                    // updateProgressInNotification(Message(track.title,DownloadStatus.Downloading(it.progress)))\n                }\n\n                is DownloadResult.Success -> {\n                    coroutineScope {\n                        SuspendableEvent {\n                            // Save File and Embed Metadata\n                            val job = launch(Dispatchers.Default) {\n                                dir.saveFileWithMetadata(\n                                    it.byteArray,\n                                    track\n                                ).fold(\n                                    failure = { throwable ->\n                                        throwable.printStackTrace()\n                                        throw throwable\n                                    }, success = {}\n                                )\n                            }\n\n                            // Send Converting Status\n                            trackStatusFlowMap[track.title] = DownloadStatus.Converting\n                            addToNotification(Message(track.title, DownloadStatus.Converting))\n\n                            // All Processing Completed for this Track\n                            job.invokeOnCompletion { throwable ->\n                                if (throwable != null /*&& throwable !is CancellationException*/) {\n                                    // handle error\n                                    failed++\n                                    trackStatusFlowMap[track.title] =\n                                        DownloadStatus.Failed(throwable)\n                                    removeFromNotification(\n                                        Message(\n                                            track.title,\n                                            DownloadStatus.Converting\n                                        )\n                                    )\n                                    return@invokeOnCompletion\n                                }\n                                converted++\n                                trackStatusFlowMap[track.title] = DownloadStatus.Downloaded\n                                removeFromNotification(\n                                    Message(\n                                        track.title,\n                                        DownloadStatus.Converting\n                                    )\n                                )\n                            }\n                            logger.d(TAG) { \"${track.title} Download Completed\" }\n                            downloaded++\n                        }.failure { error ->\n                            error.printStackTrace()\n                            // Download Failed\n                            failed++\n                            trackStatusFlowMap[track.title] = DownloadStatus.Failed(error)\n                        }\n                        removeFromNotification(Message(track.title, DownloadStatus.Downloading()))\n                    }\n                }\n            }\n        }\n    }\n\n    private fun releaseWakeLock() {\n        logger.d(TAG) { \"Releasing Wake Lock\" }\n        try {\n            wakeLock?.let {\n                if (it.isHeld) {\n                    it.release()\n                }\n            }\n        } catch (e: Exception) {\n            logger.d(TAG) { \"Service stopped without being started: ${e.message}\" }\n        }\n        isServiceStarted = false\n    }\n\n    @Suppress(\"SameParameterValue\")\n    private fun createNotificationChannel(channelId: String, channelName: String) {\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {\n            val channel = NotificationChannel(\n                channelId,\n                channelName, NotificationManager.IMPORTANCE_DEFAULT\n            )\n            channel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC\n            val service = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager\n            service.createNotificationChannel(channel)\n        }\n    }\n\n    /*\n    * Time To Wrap UP\n    *  - `Clean Up` and `Stop this Foreground Service`\n    * */\n    private fun killService() {\n        lifecycleScope.launch {\n            logger.d(TAG) { \"Killing Self\" }\n            resetVar()\n            messageList = messageList.getEmpty().apply {\n                set(index = 0, Message(Strings.cleaningAndExiting(), DownloadStatus.NotDownloaded))\n            }\n            downloadService.close()\n            updateNotification()\n            trackStatusFlowMap.apply {\n                clear()\n                scope = null\n            }\n            cleanFiles(File(dir.defaultDir()))\n            // cleanFiles(File(dir.imageCacheDir()))\n            messageList = messageList.getEmpty()\n            releaseWakeLock()\n            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {\n                stopForeground(true)\n                stopSelf()\n            } else {\n                stopSelf()\n            }\n        }\n    }\n\n    private fun resetVar() {\n        total = 0\n        downloaded = 0\n        failed = 0\n        converted = 0\n    }\n\n    private fun createNotification(): Notification =\n        NotificationCompat.Builder(this, CHANNEL_ID).run {\n            setSmallIcon(R.drawable.ic_download_arrow)\n            setContentTitle(\"${Strings.total()}: $total  ${Strings.completed()}:$converted  ${Strings.failed()}:$failed\")\n            setSilent(true)\n            setProgress(total, failed + converted, false)\n            setStyle(\n                NotificationCompat.InboxStyle().run {\n                    addLine(messageList[messageList.size - 1].asString())\n                    addLine(messageList[messageList.size - 2].asString())\n                    addLine(messageList[messageList.size - 3].asString())\n                    addLine(messageList[messageList.size - 4].asString())\n                    addLine(messageList[messageList.size - 5].asString())\n                }\n            )\n            addAction(R.drawable.ic_round_cancel_24, Strings.exit(), cancelIntent)\n            build()\n        }\n\n    private fun addToNotification(message: Message) {\n        synchronized(messageList) {\n            messageList.add(message)\n        }\n        updateNotification()\n    }\n\n    private fun removeFromNotification(message: Message) {\n        synchronized(messageList) {\n            messageList.removeAll { it.title == message.title }\n        }\n        updateNotification()\n    }\n\n    @Suppress(\"unused\")\n    private fun updateProgressInNotification(message: Message) {\n        synchronized(messageList) {\n            val index = messageList.indexOfFirst { it.title == message.title }\n            messageList[index] = message\n        }\n        updateNotification()\n    }\n\n    // Update Notification only if Service is Still Active\n    private fun updateNotification() {\n        if (!downloadService.isClosed.value) {\n            val mNotificationManager: NotificationManager =\n                getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager\n            mNotificationManager.notify(NOTIFICATION_ID, createNotification())\n        } else {\n            // Service is Inactive so clear residual status\n            resetVar()\n        }\n    }\n\n    override fun onDestroy() {\n        super.onDestroy()\n        if (isFinished) {\n            killService()\n        }\n    }\n\n    override fun onTaskRemoved(rootIntent: Intent?) {\n        super.onTaskRemoved(rootIntent)\n        if (isFinished) {\n            killService()\n        }\n    }\n\n    companion object {\n        private const val TAG: String = \"Foreground Service\"\n        private const val CHANNEL_ID = \"ForegroundDownloaderService\"\n        private const val NOTIFICATION_ID = 101\n    }\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/service/Message.kt",
    "content": "package com.shabinder.spotiflyer.service\n\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.translations.Strings\n\ntypealias Message = Pair<String, DownloadStatus>\n\nval Message.title: String get() = first\n\nval Message.downloadStatus: DownloadStatus get() = second\n\nval Message.progress: String get() = when (downloadStatus) {\n    is DownloadStatus.Downloading -> \"-> ${(downloadStatus as DownloadStatus.Downloading).progress}%\"\n    is DownloadStatus.Converting -> \"-> 100%\"\n    is DownloadStatus.Downloaded -> \"-> ${Strings.downloadDone}\"\n    is DownloadStatus.Failed -> \"-> ${Strings.failed()}\"\n    is DownloadStatus.Queued -> \"-> ${Strings.queued()}\"\n    is DownloadStatus.NotDownloaded -> \"\"\n}\n\nval emptyMessage = Message(\"\", DownloadStatus.NotDownloaded)\n\n// `Progress` is not being shown because we don't get get consistent Updates from Download Fun ,\n//  all Progress data is emitted all together from fun\nfun Message.asString(): String {\n    val statusString = when (downloadStatus) {\n        is DownloadStatus.Downloading -> Strings.downloading()\n        is DownloadStatus.Converting -> Strings.processing()\n        else -> \"\"\n    }\n    return \"$statusString $title ${\"\"/*progress*/}\".trim()\n}\n\nfun List<Message>.getEmpty(): MutableList<Message> = java.util.Collections.synchronizedList(MutableList(size) { emptyMessage })\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/service/TrackStatusFlowMap.kt",
    "content": "package com.shabinder.spotiflyer.service\n\nimport com.shabinder.common.models.DownloadStatus\nimport kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.launch\n\nclass TrackStatusFlowMap(\n    val statusFlow: MutableSharedFlow<HashMap<String, DownloadStatus>>,\n    var scope: CoroutineScope?\n) : HashMap<String, DownloadStatus>() {\n    override fun put(key: String, value: DownloadStatus): DownloadStatus? {\n        synchronized(this) {\n            val res = super.put(key, value)\n            emitValue(this)\n            return res\n        }\n    }\n\n    override fun clear() {\n        synchronized(this) {\n            // Reset Statuses\n            this.forEach { (title, status) ->\n                if(status !is DownloadStatus.Failed && status !is DownloadStatus.Downloaded) {\n                    super.put(title,DownloadStatus.NotDownloaded)\n                }\n            }\n            emitValue(this)\n            super.clear()\n            emitValue(this)\n        }\n    }\n\n    private fun emitValue(map: HashMap<String,DownloadStatus>) {\n        scope?.launch { statusFlow.emit(map) }\n    }\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/service/Utils.kt",
    "content": "package com.shabinder.spotiflyer.service\n\nimport android.util.Log\nimport java.io.File\n\n/**\n * Cleaning All Residual Files except Mp3 Files\n **/\nfun cleanFiles(dir: File) {\n    try {\n        Log.d(\"File Cleaning\", \"Starting Cleaning in ${dir.path} \")\n        val fList = dir.listFiles()\n        fList?.let {\n            for (file in fList) {\n                if (file.isDirectory) {\n                    cleanFiles(file)\n                } else if (file.isFile) {\n                    val filePath = file.path.toString()\n                    if (filePath.substringAfterLast(\".\") != \"mp3\" || filePath.isTempFile()) {\n                        Log.d(\"Files Cleaning\", \"Cleaning $filePath\")\n                        file.delete()\n                    }\n                }\n            }\n        }\n    } catch (e: Exception) {\n        e.printStackTrace()\n    }\n}\n\nprivate fun String.isTempFile(): Boolean {\n    return substringBeforeLast(\".\").takeLast(5) == \".temp\"\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/ui/AnalyticsDialog.kt",
    "content": "package com.shabinder.spotiflyer.ui\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.foundation.background\nimport androidx.compose.foundation.layout.Arrangement\nimport androidx.compose.foundation.layout.Column\nimport androidx.compose.foundation.layout.Row\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.foundation.layout.size\nimport androidx.compose.material.AlertDialog\nimport androidx.compose.material.ButtonDefaults\nimport androidx.compose.material.Icon\nimport androidx.compose.material.OutlinedButton\nimport androidx.compose.material.Text\nimport androidx.compose.material.TextButton\nimport androidx.compose.material.icons.Icons\nimport androidx.compose.material.icons.rounded.Insights\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.unit.sp\nimport androidx.compose.ui.window.DialogProperties\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.configurations.SpotiFlyerShapes\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.colorPrimary\n\n@ExperimentalAnimationApi\n@Composable\nfun AnalyticsDialog(\n    isVisible: Boolean,\n    enableAnalytics: () -> Unit,\n    dismissDialog: () -> Unit,\n) {\n    // Analytics Permission Dialog\n    AnimatedVisibility(isVisible) {\n        AlertDialog(\n            onDismissRequest = dismissDialog,\n            title = {\n                Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.SpaceEvenly) {\n                    Icon(Icons.Rounded.Insights, Strings.analytics(), Modifier.size(42.dp))\n                    Spacer(Modifier.padding(horizontal = 8.dp))\n                    Text(Strings.grantAnalytics(), style = SpotiFlyerTypography.h5, textAlign = TextAlign.Center)\n                }\n            },\n            backgroundColor = Color.DarkGray,\n            buttons = {\n                Column {\n                    OutlinedButton(\n                        onClick = dismissDialog,\n                        Modifier.padding(horizontal = 8.dp).fillMaxWidth()\n                            .background(Color.DarkGray, shape = SpotiFlyerShapes.medium)\n                            .padding(horizontal = 8.dp),\n                        shape = SpotiFlyerShapes.medium,\n                        colors = ButtonDefaults.buttonColors(backgroundColor = Color(0xFF303030))\n                    ) {\n                        Text(Strings.no(), color = colorPrimary, fontSize = 18.sp, textAlign = TextAlign.Center)\n                    }\n                    Spacer(Modifier.padding(vertical = 4.dp))\n                    TextButton(\n                        onClick = {\n                            dismissDialog()\n                            enableAnalytics()\n                        },\n                        Modifier.padding(bottom = 16.dp, start = 16.dp, end = 16.dp).fillMaxWidth()\n                            .background(colorPrimary, shape = SpotiFlyerShapes.medium)\n                            .padding(horizontal = 8.dp),\n                        shape = SpotiFlyerShapes.medium\n                    ) {\n                        Text(Strings.yes(), color = Color.Black, fontSize = 18.sp, textAlign = TextAlign.Center)\n                    }\n                }\n            },\n            text = {\n                Text(Strings.analyticsDescription(), style = SpotiFlyerTypography.body2, textAlign = TextAlign.Center)\n            },\n            properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false)\n        )\n    }\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/ui/NetworkDialog.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.spotiflyer.ui\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.foundation.Image\nimport androidx.compose.foundation.layout.Arrangement\nimport androidx.compose.foundation.layout.Column\nimport androidx.compose.foundation.layout.Row\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.foundation.layout.size\nimport androidx.compose.material.AlertDialog\nimport androidx.compose.material.Text\nimport androidx.compose.material.icons.Icons\nimport androidx.compose.material.icons.rounded.CloudOff\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.LaunchedEffect\nimport androidx.compose.runtime.State\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.remember\nimport androidx.compose.runtime.setValue\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.graphics.ColorFilter\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.unit.dp\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.configurations.SpotiFlyerShapes\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.colorOffWhite\nimport kotlinx.coroutines.delay\n\n@ExperimentalAnimationApi\n@Composable\nfun NetworkDialog(\n    networkAvailability: State<Boolean?>\n) {\n    var visible by remember { mutableStateOf(false) }\n\n    LaunchedEffect(Unit) {\n        delay(2600)\n        visible = true\n    }\n\n    AnimatedVisibility(\n        networkAvailability.value == false && visible\n    ) {\n        AlertDialog(\n            onDismissRequest = {},\n            buttons = {\n                /*    TextButton({\n                        //Retry Network Connection\n                    },\n                        Modifier.padding(bottom = 16.dp,start = 16.dp,end = 16.dp).fillMaxWidth().background(Color(0xFFFC5C7D),shape = RoundedCornerShape(size = 8.dp)).padding(horizontal = 8.dp),\n                    ){\n                        Text(\"Retry\",color = Color.Black,fontSize = 18.sp,textAlign = TextAlign.Center)\n                        Icon(Icons.Rounded.SyncProblem,\"Check Network Connection Again\")\n                    }\n                */\n            },\n            title = {\n                Text(\n                    Strings.noInternetConnection(),\n                    style = SpotiFlyerTypography.h5,\n                    textAlign = TextAlign.Center\n                )\n            },\n            backgroundColor = Color.DarkGray,\n            text = {\n                Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {\n                    Spacer(modifier = Modifier.padding(8.dp))\n                    Row(\n                        verticalAlignment = Alignment.CenterVertically,\n                        modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp)\n                    ) {\n                        Image(\n                            Icons.Rounded.CloudOff,\n                            Strings.noInternetConnection(), Modifier.size(42.dp),\n                            colorFilter = ColorFilter.tint(\n                                colorOffWhite\n                            )\n                        )\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n                        Text(\n                            text = Strings.checkInternetConnection(),\n                            style = SpotiFlyerTypography.subtitle1\n                        )\n                    }\n                }\n            },\n            shape = SpotiFlyerShapes.medium\n        )\n    }\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/ui/PermissionDialog.kt",
    "content": "package com.shabinder.spotiflyer.ui\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.foundation.background\nimport androidx.compose.foundation.layout.Column\nimport androidx.compose.foundation.layout.Row\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.material.AlertDialog\nimport androidx.compose.material.Icon\nimport androidx.compose.material.Text\nimport androidx.compose.material.TextButton\nimport androidx.compose.material.icons.Icons\nimport androidx.compose.material.icons.rounded.SdStorage\nimport androidx.compose.material.icons.rounded.SystemSecurityUpdate\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.LaunchedEffect\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.remember\nimport androidx.compose.runtime.setValue\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.text.font.FontWeight\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.unit.sp\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.configurations.SpotiFlyerShapes\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.colorPrimary\nimport kotlinx.coroutines.delay\n\n@ExperimentalAnimationApi\n@Composable\nfun PermissionDialog(\n    permissionGranted: Boolean,\n    requestStoragePermission: () -> Unit,\n    disableDozeMode: () -> Unit,\n) {\n    var askForPermission by remember { mutableStateOf(false) }\n    LaunchedEffect(Unit) {\n        delay(2600)\n        askForPermission = true\n    }\n\n    AnimatedVisibility(\n        askForPermission && !permissionGranted\n    ) {\n        AlertDialog(\n            onDismissRequest = {},\n            buttons = {\n                TextButton(\n                    {\n                        requestStoragePermission()\n                        disableDozeMode()\n                    },\n                    Modifier.padding(bottom = 16.dp, start = 16.dp, end = 16.dp).fillMaxWidth()\n                        .background(colorPrimary, shape = SpotiFlyerShapes.medium)\n                        .padding(horizontal = 8.dp),\n                ) {\n                    Text(Strings.grantPermissions(), color = Color.Black, fontSize = 18.sp, textAlign = TextAlign.Center)\n                }\n            },\n            title = { Text(Strings.requiredPermissions(), style = SpotiFlyerTypography.h5, textAlign = TextAlign.Center) },\n            backgroundColor = Color.DarkGray,\n            text = {\n                Column {\n                    Spacer(modifier = Modifier.padding(8.dp))\n                    Row(\n                        verticalAlignment = Alignment.CenterVertically,\n                        modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp)\n                    ) {\n                        Icon(Icons.Rounded.SdStorage, Strings.storagePermission())\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n                        Column {\n                            Text(\n                                text = Strings.storagePermission(),\n                                style = SpotiFlyerTypography.h6.copy(fontWeight = FontWeight.SemiBold)\n                            )\n                            Text(\n                                text = Strings.storagePermissionReason(),\n                                style = SpotiFlyerTypography.subtitle2,\n                            )\n                        }\n                    }\n                    Row(\n                        modifier = Modifier.fillMaxWidth().padding(top = 6.dp),\n                        verticalAlignment = Alignment.CenterVertically\n                    ) {\n                        Icon(Icons.Rounded.SystemSecurityUpdate, Strings.backgroundRunning())\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n                        Column {\n                            Text(\n                                text = Strings.backgroundRunning(),\n                                style = SpotiFlyerTypography.h6.copy(fontWeight = FontWeight.SemiBold)\n                            )\n                            Text(\n                                text = Strings.backgroundRunningReason(),\n                                style = SpotiFlyerTypography.subtitle2,\n                            )\n                        }\n                    }\n                    /*Row(\n                        modifier = Modifier.fillMaxWidth().padding(top = 6.dp),\n                        verticalAlignment = Alignment.CenterVertically\n                    ) {\n                        Icon(Icons.Rounded.Insights,\"Analytics\")\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n                        Column {\n                            Text(\n                                text = \"Analytics\",\n                                style = SpotiFlyerTypography.h6.copy(fontWeight = FontWeight.SemiBold)\n                            )\n                            Text(\n                                text = \"Share Analytics Data (optional) with App Devs (Self-Hosted), It will never be used/shared/sold to any third party service.\",\n                                style = SpotiFlyerTypography.subtitle2,\n                            )\n                        }\n                    }*/\n                }\n            }\n        )\n    }\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/ui/SplashScreenActivity.kt",
    "content": "package com.shabinder.spotiflyer.ui\n\nimport android.content.Intent\nimport android.os.Bundle\nimport androidx.appcompat.app.AppCompatActivity\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.lifecycle.lifecycleScope\nimport com.shabinder.common.core_components.analytics.AnalyticsManager\nimport com.shabinder.common.di.ApplicationInit\nimport com.shabinder.spotiflyer.MainActivity\nimport kotlinx.coroutines.delay\nimport kotlinx.coroutines.launch\nimport org.koin.android.ext.android.inject\nimport org.koin.androidx.scope.ScopeActivity\nimport org.koin.core.parameter.parametersOf\n\nclass SplashScreenActivity : AppCompatActivity() {\n\n    private val applicationInit: ApplicationInit by inject()\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        applicationInit.init()\n        lifecycleScope.launch {\n            delay(SPLASH_DELAY)\n            startActivity(Intent(this@SplashScreenActivity, MainActivity::class.java))\n            finish()\n        }\n    }\n\n    companion object {\n        private const val SPLASH_DELAY = 2000L\n    }\n}"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/utils/SignatureVerification.kt",
    "content": "package com.shabinder.spotiflyer.utils\n\nimport android.annotation.SuppressLint\nimport android.content.Context\nimport android.content.pm.PackageInfo\nimport android.content.pm.PackageManager\nimport android.util.Base64\nimport com.shabinder.spotiflyer.App\nimport java.security.MessageDigest\n\n@Suppress(\"DEPRECATION\")\n@SuppressLint(\"PackageManagerGetSignatures\")\nfun checkAppSignature(context: Context): Boolean {\n    try {\n        val packageInfo: PackageInfo =\n            context.packageManager.getPackageInfo(context.packageName, PackageManager.GET_SIGNATURES)\n        for (signature in packageInfo.signatures) {\n            val md: MessageDigest = MessageDigest.getInstance(\"SHA\")\n            md.update(signature.toByteArray())\n            val currentSignature: String = Base64.encodeToString(md.digest(), Base64.DEFAULT)\n            // Log.d(\"REMOVE_ME\", \"Include this string as a value for SIGNATURE:$currentSignature\")\n            // Log.d(\"REMOVE_ME HEX\", \"Include this string as a value for SIGNATURE Hex:${currentSignature.toByteArray().toHEX()}\")\n\n            // compare signatures\n            if (App.SIGNATURE_HEX == currentSignature.toByteArray().toHEX()) {\n                return true\n            }\n        }\n    } catch (e: Exception) {\n        e.printStackTrace()\n        // assumes an issue in checking signature., but we let the caller decide on what to do.\n    }\n    return false\n}\n\nfun ByteArray.toHEX(): String {\n    val builder = StringBuilder()\n    for (aByte in this) {\n        builder.append(String.format(\"%02x\", aByte))\n    }\n    return builder.toString()\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/utils/UtilFunctions.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.spotiflyer.utils\n\nimport android.Manifest\nimport android.annotation.SuppressLint\nimport android.app.Activity\nimport android.content.Context\nimport android.content.Intent\nimport android.content.pm.PackageManager\nimport android.net.Uri\nimport android.os.Build\nimport android.os.PowerManager\nimport android.provider.Settings\nimport androidx.core.content.ContextCompat\nimport com.github.javiersantos.appupdater.AppUpdater\nimport com.github.javiersantos.appupdater.enums.Display\nimport com.github.javiersantos.appupdater.enums.UpdateFrom\n\nfun Activity.checkIfLatestVersion() {\n    AppUpdater(this, 0).run {\n        setDisplay(Display.NOTIFICATION)\n        showAppUpdated(false) // true:Show App is Updated Dialog\n        setUpdateFrom(UpdateFrom.XML)\n        setUpdateXML(\"https://raw.githubusercontent.com/Shabinder/SpotiFlyer/Compose/app/src/main/res/xml/app_update.xml\")\n        setCancelable(false)\n        start()\n    }\n}\n\nfun Activity.checkPermissions(): Boolean = ContextCompat\n    .checkSelfPermission(\n        this,\n        Manifest.permission.WRITE_EXTERNAL_STORAGE\n    ) == PackageManager.PERMISSION_GRANTED &&\n    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n        ContextCompat.checkSelfPermission(\n            this,\n            Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\n        ) == PackageManager.PERMISSION_GRANTED\n    } else true\n\n@SuppressLint(\"BatteryLife\", \"ObsoleteSdkInt\")\nfun Activity.disableDozeMode(requestCode: Int) {\n    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n        val pm =\n            this.getSystemService(Context.POWER_SERVICE) as PowerManager\n        val isIgnoringBatteryOptimizations = pm.isIgnoringBatteryOptimizations(packageName)\n        if (!isIgnoringBatteryOptimizations) {\n            val intent = Intent().apply {\n                action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS\n                data = Uri.parse(\"package:$packageName\")\n            }\n            startActivityForResult(intent, requestCode)\n        }\n    }\n}\n@SuppressLint(\"ObsoleteSdkInt\")\nfun Activity.requestStoragePermission() {\n    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n        this.requestPermissions(\n            arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),\n            786\n        )\n    }\n}\n/*\nfun Activity.requestBroaderStoragePermission() {\n    val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)\n    startActivity(intent)\n}*/\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/utils/autoclear/AutoClear.kt",
    "content": "package com.shabinder.spotiflyer.utils.autoclear\n\nimport androidx.lifecycle.Lifecycle\nimport androidx.lifecycle.LifecycleOwner\nimport com.shabinder.spotiflyer.utils.autoclear.AutoClear.Companion.TRIGGER\nimport com.shabinder.spotiflyer.utils.autoclear.lifecycleobservers.LifecycleCreateAndDestroyObserver\nimport com.shabinder.spotiflyer.utils.autoclear.lifecycleobservers.LifecycleResumeAndPauseObserver\nimport com.shabinder.spotiflyer.utils.autoclear.lifecycleobservers.LifecycleStartAndStopObserver\nimport kotlin.properties.ReadWriteProperty\nimport kotlin.reflect.KProperty\n\nclass AutoClear<T : Any?>(\n    lifecycle: Lifecycle,\n    private val initializer: (() -> T)?,\n    private val trigger: TRIGGER = TRIGGER.ON_CREATE,\n) : ReadWriteProperty<LifecycleOwner, T?> {\n\n    companion object {\n        enum class TRIGGER {\n            ON_CREATE,\n            ON_START,\n            ON_RESUME\n        }\n    }\n\n    private var _value: T?\n        get() = observer.value\n        set(value) { observer.value = value }\n\n    val value: T get() = _value ?: initializer?.invoke()\n        ?: throw IllegalStateException(\"The value has not yet been set or no default initializer provided\")\n\n    fun getOrNull(): T? = _value\n\n    private val observer: LifecycleAutoInitializer<T?> by lazy {\n        when (trigger) {\n            TRIGGER.ON_CREATE -> LifecycleCreateAndDestroyObserver(initializer)\n            TRIGGER.ON_START -> LifecycleStartAndStopObserver(initializer)\n            TRIGGER.ON_RESUME -> LifecycleResumeAndPauseObserver(initializer)\n        }\n    }\n\n    init {\n        lifecycle.addObserver(observer)\n    }\n\n    override fun getValue(thisRef: LifecycleOwner, property: KProperty<*>): T {\n\n        if (_value != null) {\n            return value\n        }\n\n        // If for Some Reason Initializer is not invoked even after Initialisation, invoke it after checking state\n        if (thisRef.lifecycle.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {\n            return initializer?.invoke().also { _value = it }\n                ?: throw IllegalStateException(\"The value has not yet been set or no default initializer provided\")\n        } else {\n            throw IllegalStateException(\"Activity might have been destroyed or not initialized yet\")\n        }\n    }\n\n    override fun setValue(thisRef: LifecycleOwner, property: KProperty<*>, value: T?) {\n        this._value = value\n    }\n\n    fun reset() {\n        this._value = null\n    }\n}\n\nfun <T : Any> LifecycleOwner.autoClear(\n    trigger: TRIGGER = TRIGGER.ON_CREATE,\n    initializer: () -> T\n): AutoClear<T> {\n    return AutoClear(this.lifecycle, initializer, trigger)\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/utils/autoclear/AutoClearFragment.kt",
    "content": "package com.shabinder.spotiflyer.utils.autoclear\n\nimport androidx.fragment.app.Fragment\nimport androidx.lifecycle.DefaultLifecycleObserver\nimport androidx.lifecycle.Lifecycle\nimport androidx.lifecycle.LifecycleOwner\nimport androidx.lifecycle.Observer\nimport kotlin.properties.ReadWriteProperty\nimport kotlin.reflect.KProperty\n\nclass AutoClearFragment<T : Any?>(\n    fragment: Fragment,\n    private val initializer: (() -> T)?\n) : ReadWriteProperty<Fragment, T?> {\n\n    private var _value: T? = null\n\n    init {\n        fragment.lifecycle.addObserver(object : DefaultLifecycleObserver {\n            val viewLifecycleOwnerObserver = Observer<LifecycleOwner?> { viewLifecycleOwner ->\n\n                viewLifecycleOwner?.lifecycle?.addObserver(object : DefaultLifecycleObserver {\n                    override fun onDestroy(owner: LifecycleOwner) {\n                        _value = null\n                    }\n                })\n            }\n\n            override fun onCreate(owner: LifecycleOwner) {\n                fragment.viewLifecycleOwnerLiveData.observeForever(viewLifecycleOwnerObserver)\n            }\n\n            override fun onDestroy(owner: LifecycleOwner) {\n                fragment.viewLifecycleOwnerLiveData.removeObserver(viewLifecycleOwnerObserver)\n            }\n        }\n        )\n    }\n\n    override fun getValue(thisRef: Fragment, property: KProperty<*>): T {\n        val value = _value\n\n        if (value != null) {\n            return value\n        }\n\n        if (thisRef.viewLifecycleOwner.lifecycle.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {\n            return initializer?.invoke().also { _value = it }\n                ?: throw IllegalStateException(\"The value has not yet been set or no default initializer provided\")\n        } else {\n            throw IllegalStateException(\"Fragment might have been destroyed or not initialized yet\")\n        }\n    }\n\n    override fun setValue(thisRef: Fragment, property: KProperty<*>, value: T?) {\n        _value = value\n    }\n}\n\nfun <T : Any> Fragment.autoClear(initializer: () -> T): AutoClearFragment<T> {\n    return AutoClearFragment(this, initializer)\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/utils/autoclear/LifecycleAutoInitializer.kt",
    "content": "package com.shabinder.spotiflyer.utils.autoclear\n\nimport androidx.lifecycle.DefaultLifecycleObserver\n\ninterface LifecycleAutoInitializer<T> : DefaultLifecycleObserver {\n    var value: T?\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/utils/autoclear/lifecycleobservers/LifecycleCreateAndDestroyObserver.kt",
    "content": "package com.shabinder.spotiflyer.utils.autoclear.lifecycleobservers\n\nimport androidx.lifecycle.LifecycleOwner\nimport com.shabinder.spotiflyer.utils.autoclear.LifecycleAutoInitializer\n\nclass LifecycleCreateAndDestroyObserver<T : Any?>(\n    private val initializer: (() -> T)?\n) : LifecycleAutoInitializer<T> {\n\n    override var value: T? = null\n\n    override fun onCreate(owner: LifecycleOwner) {\n        super.onCreate(owner)\n        value = initializer?.invoke()\n    }\n\n    override fun onDestroy(owner: LifecycleOwner) {\n        super.onDestroy(owner)\n        value = null\n    }\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/utils/autoclear/lifecycleobservers/LifecycleResumeAndPauseObserver.kt",
    "content": "package com.shabinder.spotiflyer.utils.autoclear.lifecycleobservers\n\nimport androidx.lifecycle.LifecycleOwner\nimport com.shabinder.spotiflyer.utils.autoclear.LifecycleAutoInitializer\n\nclass LifecycleResumeAndPauseObserver<T : Any?>(\n    private val initializer: (() -> T)?\n) : LifecycleAutoInitializer<T> {\n\n    override var value: T? = null\n\n    override fun onResume(owner: LifecycleOwner) {\n        super.onResume(owner)\n        value = initializer?.invoke()\n    }\n\n    override fun onPause(owner: LifecycleOwner) {\n        super.onPause(owner)\n        value = null\n    }\n}\n"
  },
  {
    "path": "android/src/main/java/com/shabinder/spotiflyer/utils/autoclear/lifecycleobservers/LifecycleStartAndStopObserver.kt",
    "content": "package com.shabinder.spotiflyer.utils.autoclear.lifecycleobservers\n\nimport androidx.lifecycle.LifecycleOwner\nimport com.shabinder.spotiflyer.utils.autoclear.LifecycleAutoInitializer\n\nclass LifecycleStartAndStopObserver<T : Any?>(\n    private val initializer: (() -> T)?\n) : LifecycleAutoInitializer<T> {\n\n    override var value: T? = null\n\n    override fun onStart(owner: LifecycleOwner) {\n        super.onStart(owner)\n        value = initializer?.invoke()\n    }\n\n    override fun onStop(owner: LifecycleOwner) {\n        super.onStop(owner)\n        value = null\n    }\n}\n"
  },
  {
    "path": "android/src/main/res/drawable/ic_splash.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:paddingBottom=\"20dp\"\n    android:paddingRight=\"20dp\"\n    android:paddingLeft=\"20dp\"\n    android:paddingTop=\"20dp\">\n    <!-- Your product logo - 144dp color version of your app icon -->\n    <item\n        android:drawable=\"@drawable/spotiflyer\"\n        android:gravity=\"center\">\n    </item>\n</layer-list>"
  },
  {
    "path": "android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/ic_launcher_background\"/>\n    <foreground android:drawable=\"@drawable/ic_spotiflyer_logo\"/>\n</adaptive-icon>"
  },
  {
    "path": "android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/ic_launcher_background\"/>\n    <foreground android:drawable=\"@drawable/ic_spotiflyer_logo\"/>\n</adaptive-icon>"
  },
  {
    "path": "android/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<resources>\n    <color name=\"colorPrimary\">#FC5C7D</color>\n    <color name=\"colorPrimaryDark\">#CE1CFF</color>\n    <color name=\"colorAccent\">#9AB3FF</color>\n    <color name=\"white\">#FFFFFF</color>\n    <color name=\"grey\">#99FFFFFF</color>\n    <color name=\"darkGrey\">#E6333333</color>\n    <color name=\"black\">#000000</color>\n    <color name=\"dark\">#121212</color>\n    <color name=\"successGreen\">#59C351</color>\n    <color name=\"errorRed\">#FF9494</color>\n</resources>"
  },
  {
    "path": "android/src/main/res/values/ic_launcher_background.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<resources>\n    <color name=\"ic_launcher_background\">#000000</color>\n</resources>"
  },
  {
    "path": "android/src/main/res/values/themes.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<resources>\n    <!-- Base application theme. -->\n    <style name=\"Theme.SpotiFlyer\" parent=\"Theme.AppCompat.NoActionBar\">\n        <!-- Primary brand color. -->\n        <item name=\"colorPrimary\">@color/colorPrimary</item>\n        <item name=\"colorAccent\">@color/colorAccent</item>\n        <item name=\"android:textColor\">@color/white</item>\n        <item name=\"android:background\">@android:color/black</item>\n        <item name=\"android:statusBarColor\">@android:color/transparent</item>\n        <item name=\"android:navigationBarColor\">@android:color/transparent</item>\n    </style>\n\n    <style name=\"SplashTheme\" parent=\"Theme.SpotiFlyer\">\n        <item name=\"android:windowBackground\">@drawable/ic_splash</item>\n        <item name=\"android:background\">@android:color/transparent</item>\n    </style>\n</resources>"
  },
  {
    "path": "build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    `kotlin-dsl`\n    id(\"org.jlleitschuh.gradle.ktlint\")\n    id(\"org.jlleitschuh.gradle.ktlint-idea\")\n}\n\nallprojects {\n    repositories {\n        google()\n        mavenCentral()\n        // mavenLocal()\n        maven(url = \"https://jitpack.io\")\n        maven(url = \"https://maven.pkg.jetbrains.space/public/p/compose/dev\")\n        maven(url = \"https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven\")\n        maven(url = \"https://storage.googleapis.com/r8-releases/raw\")\n    }\n    /*Fixes: Could not resolve org.nodejs:node*/\n    plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {\n        configure<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension> {\n            download = false\n        }\n    }\n    tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().configureEach {\n        dependsOn(\":common:data-models:generateI18n4kFiles\")\n        kotlinOptions {\n            if (this is org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions) {\n                jvmTarget = \"1.8\"\n            }\n            freeCompilerArgs = (freeCompilerArgs + listOf(\"-Xopt-in=kotlin.RequiresOptIn\"))\n        }\n    }\n    configurations.all {\n        resolutionStrategy {\n            eachDependency {\n                if (requested.group == \"org.jetbrains.kotlin\") {\n                    @Suppress(\"UnstableApiUsage\")\n                    useVersion(deps.kotlin.kotlinGradlePlugin.get().versionConstraint.requiredVersion)\n                }\n            }\n        }\n    }\n    afterEvaluate {\n        project.extensions.findByType<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension>()\n            ?.let { kmpExt ->\n                kmpExt.sourceSets.run {\n                    all {\n                        languageSettings.useExperimentalAnnotation(\"kotlin.RequiresOptIn\")\n                        languageSettings.useExperimentalAnnotation(\"kotlinx.serialization.ExperimentalSerializationApi\")\n                    }\n                    removeAll { it.name == \"androidAndroidTestRelease\" }\n                }\n            }\n    }\n}\n"
  },
  {
    "path": "buildSrc/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    `kotlin-dsl`\n}\n\ngroup = \"com.shabinder\"\n\nrepositories {\n    google()\n    // mavenLocal()\n    mavenCentral()\n    maven(url = \"https://jitpack.io\")\n    maven(url = \"https://plugins.gradle.org/m2/\")\n    maven(url = \"https://maven.pkg.jetbrains.space/public/p/compose/dev\")\n}\n\ndependencies {\n    with(deps) {\n        implementation(androidx.r8)\n        implementation(androidx.gradle.plugin)\n        implementation(kotlin.compose.gradle)\n        implementation(ktlint.gradle)\n        implementation(mosaic.gradle)\n        implementation(kotlin.kotlinGradlePlugin)\n        implementation(sqldelight.gradle.plugin)\n        implementation(i18n4k.gradle.plugin)\n        implementation(kotlin.serialization)\n    }\n}\n\nkotlin {\n    // Add Deps to compilation, so it will become available in main project\n    sourceSets.getByName(\"main\").kotlin.srcDir(\"buildSrc/src/main/kotlin\")\n}\n\n"
  },
  {
    "path": "buildSrc/buildSrc/build.gradle.kts",
    "content": "plugins {\n    `kotlin-dsl`\n}\n\nrepositories {\n    mavenCentral()\n}\n"
  },
  {
    "path": "buildSrc/buildSrc/src/main/kotlin/Versions.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n@file:Suppress(\"MayBeConstant\", \"SpellCheckingInspection\", \"UnstableApiUsage\")\n\nimport org.gradle.api.Project\nimport org.gradle.api.artifacts.ExternalModuleDependency\nimport org.gradle.api.artifacts.VersionCatalog\nimport org.gradle.api.artifacts.VersionCatalogsExtension\nimport org.gradle.api.artifacts.dsl.DependencyHandler\nimport org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo\nimport org.gradle.kotlin.dsl.getByType\n\nobject Versions {\n    // App's Version (To be bumped at each update)\n    const val versionName = \"3.6.4\"\n\n    const val versionCode = 32\n\n    // Android\n    const val minSdkVersion = 21\n    const val compileSdkVersion = 31\n    const val targetSdkVersion = 29\n}\n\nobject HostOS {\n    // Host OS Properties\n    private val hostOs = System.getProperty(\"os.name\")\n    val isMingwX64 = hostOs.startsWith(\"Windows\", true)\n    val isMac = hostOs.startsWith(\"Mac\", true)\n    val isLinux = hostOs.startsWith(\"Linux\", true)\n}\n\nval Project.Deps: VersionCatalog get() = project.extensions.getByType<VersionCatalogsExtension>().named(\"deps\")\n\nval VersionCatalog.ktorBundle get() = findBundle(\"ktor\").get()\nval VersionCatalog.statelyBundle get() = findBundle(\"stately\").get()\nval VersionCatalog.androidXLifecycleBundle get() = findBundle(\"androidx-lifecycle\").get()\nval VersionCatalog.androidXCommonBundle get() = findBundle(\"androidx-common\").get()\nval VersionCatalog.kotlinTestBundle get() = findBundle(\"kotlin-test\").get()\nval VersionCatalog.sqldelightBundle get() = findBundle(\"sqldelight\").get()\nval VersionCatalog.mviKotlinBundle get() = findBundle(\"mviKotlin\").get()\nval VersionCatalog.essentyBundle get() = findBundle(\"essenty\").get()\nval VersionCatalog.koinAndroidBundle get() = findBundle(\"koin-android\").get()\nval VersionCatalog.kotlinJSWrappers get() = findBundle(\"kotlin-js-wrappers\").get()\n\nval VersionCatalog.kotlinJunitTest get() = findDependency(\"kotlin-kotlinTestJunit\").get()\nval VersionCatalog.kotlinJSTest get() = findDependency(\"kotlin-kotlinTestJs\").get()\nval VersionCatalog.kermit get() = findDependency(\"kermit\").get()\nval VersionCatalog.decompose get() = findDependency(\"decompose-dep\").get()\nval VersionCatalog.decomposeComposeExt get() = findDependency(\"decompose-extensions-compose\").get()\nval VersionCatalog.jaffree get() = findDependency(\"jaffree\").get()\n\nval VersionCatalog.ktlintGradle get() = findDependency(\"ktlint-gradle\").get()\nval VersionCatalog.androidGradle get() = findDependency(\"androidx-gradle-plugin\").get()\nval VersionCatalog.mosaicGradle get() = findDependency(\"mosaic-gradle\").get()\nval VersionCatalog.kotlinComposeGradle get() = findDependency(\"kotlin-compose-gradle\").get()\nval VersionCatalog.kotlinGradle get() = findDependency(\"kotlin-kotlinGradlePlugin\").get()\nval VersionCatalog.i18n4kGradle get() = findDependency(\"i18n4k-gradle-plugin\").get()\nval VersionCatalog.sqlDelightGradle get() = findDependency(\"sqldelight-gradle-plugin\").get()\nval VersionCatalog.kotlinSerializationPlugin get() = findDependency(\"kotlin-serialization\").get()\n\nval VersionCatalog.koinCore get() = findDependency(\"koin-core\").get()\nval VersionCatalog.kotlinCoroutines get() = findDependency(\"kotlin-coroutines\").get()\nval VersionCatalog.kotlinxSerialization get() = findDependency(\"kotlinx-serialization-json\").get()\nval VersionCatalog.ktorClientIOS get() = findDependency(\"ktor-client-ios\").get()\nval VersionCatalog.ktorClientAndroid get() = findDependency(\"ktor-client-android\").get()\nval VersionCatalog.ktorClientAndroidOkHttp get() = findDependency(\"ktor-client-okhttp\").get()\nval VersionCatalog.ktorClientApache get() = findDependency(\"ktor-client-apache\").get()\nval VersionCatalog.ktorClientJS get() = findDependency(\"ktor-client-js\").get()\nval VersionCatalog.ktorClientCIO get() = findDependency(\"ktor-client-cio\").get()\nval VersionCatalog.slf4j get() = findDependency(\"slf4j-simple\").get()\n\nval VersionCatalog.sqlDelightJDBC get() = findDependency(\"sqlite-jdbc-driver\").get()\nval VersionCatalog.sqlDelightNative get() = findDependency(\"sqldelight-native-driver\").get()\nval VersionCatalog.sqlDelightAndroid get() = findDependency(\"sqldelight-android-driver\").get()\nval VersionCatalog.sqlDelightDriver get() = findDependency(\"sqldelight-driver\").get()\n"
  },
  {
    "path": "buildSrc/deps.versions.toml",
    "content": "[versions]\nkotlin = \"1.6.10\"\nandroidCoroutines = \"1.5.1\"\nktLint = \"10.1.0\"\nmosaic = \"0.1.0\"\nkoin = \"3.1.2\"\nkermit = \"0.1.9\"\nmokoParcelize = \"0.7.1\"\nktor = \"1.6.7\"\nkotlinxSerialization = \"1.3.1\"\nsqlDelight = \"1.5.3\"\nsqliteJdbcDriver = \"3.34.0\"\nslf4j = \"1.7.31\"\ni18n4k = \"0.1.3\"\nessenty = \"0.2.2\"\nmultiplatformSettings = \"0.7.7\"\ndecompose = \"0.5.0\"\nmviKotlin = \"3.0.0-alpha03\"\naccompanist = \"0.22.0-rc\"\nstatelyVersion = \"1.2.1\"\nstatelyIsoVersion = \"1.2.1\"\nandroidxLifecycle = \"2.4.0-alpha03\"\n\n\n[libraries]\nkotlin-kotlinGradlePlugin = { group = \"org.jetbrains.kotlin\", name = \"kotlin-gradle-plugin\", version.ref = \"kotlin\" }\nkotlin-serialization = { group = \"org.jetbrains.kotlin\", name = \"kotlin-serialization\", version.ref = \"kotlin\" }\nkotlin-reflect = { group = \"org.jetbrains.kotlin\", name = \"kotlin-reflect\", version.ref = \"kotlin\" }\nkotlin-kotlinTestCommon = { group = \"org.jetbrains.kotlin\", name = \"kotlin-test-common\", version.ref = \"kotlin\" }\nkotlin-kotlinTestJs = { group = \"org.jetbrains.kotlin\", name = \"kotlin-test-js\", version.ref = \"kotlin\" }\nkotlin-kotlinTestJunit = { group = \"org.jetbrains.kotlin\", name = \"kotlin-test-junit\", version.ref = \"kotlin\" }\nkotlin-kotlinTestAnnotationsCommon = { group = \"org.jetbrains.kotlin\", name = \"kotlin-test-annotations-common\", version.ref = \"kotlin\" }\nkotlin-coroutines = { group = \"org.jetbrains.kotlinx\", name = \"kotlinx-coroutines-core\", version = \"1.6.0\" }\nkotlinx-serialization-json = { group = \"org.jetbrains.kotlinx\", name = \"kotlinx-serialization-json\", version.ref = \"kotlinxSerialization\" }\nkotlinx-atomicfu = { group = \"org.jetbrains.kotlinx\", name = \"atomicfu\", version = \"0.17.0\" }\nkotlinx-datetime = { group = \"org.jetbrains.kotlinx\", name = \"kotlinx-datetime\", version = \"0.3.2\" }\n\nkotlin-compose-gradle = { group = \"org.jetbrains.compose\", name = \"compose-gradle-plugin\", version = \"1.0.1\" }\nmosaic-gradle =  { group = \"com.jakewharton.mosaic\", name = \"mosaic-gradle-plugin\", version.ref = \"mosaic\" }\n\nessenty-lifecycle = { group = \"com.arkivanov.essenty\", name = \"lifecycle\", version.ref = \"essenty\" }\nessenty-instanceKeeper = { group = \"com.arkivanov.essenty\", name = \"instance-keeper\", version.ref = \"essenty\" }\n\ndecompose-dep = { group = \"com.arkivanov.decompose\", name = \"decompose\", version.ref = \"decompose\" }\ndecompose-extensions-compose = { group = \"com.arkivanov.decompose\", name = \"extensions-compose-jetbrains\", version.ref = \"decompose\" }\n\nmviKotlin-dep = { group = \"com.arkivanov.mvikotlin\", name = \"mvikotlin\", version.ref = \"mviKotlin\" }\nmviKotlin-rx = { group = \"com.arkivanov.mvikotlin\", name = \"rx\", version.ref = \"mviKotlin\" }\nmviKotlin-main = { group = \"com.arkivanov.mvikotlin\", name = \"mvikotlin-main\", version.ref = \"mviKotlin\" }\nmviKotlin-coroutines = { group = \"com.arkivanov.mvikotlin\", name = \"mvikotlin-extensions-coroutines\", version.ref = \"mviKotlin\" }\nmviKotlin-keepers = { group = \"com.arkivanov.mvikotlin\", name = \"keepers\", version.ref = \"mviKotlin\" }\nmviKotlin-logging = { group = \"com.arkivanov.mvikotlin\", name = \"mvikotlin-logging\", version.ref = \"mviKotlin\" }\nmviKotlin-timetravel = { group = \"com.arkivanov.mvikotlin\", name = \"mvikotlin-timetravel\", version.ref = \"mviKotlin\" }\nmviKotlin-extensions-reaktive = { group = \"com.arkivanov.mvikotlin\", name = \"mvikotlin-extensions-reaktive\", version.ref = \"mviKotlin\" }\n\nktor-client-core = { group = \"io.ktor\", name = \"ktor-client-core\", version.ref = \"ktor\" }\nktor-client-json = { group = \"io.ktor\", name = \"ktor-client-json\", version.ref = \"ktor\" }\nktor-client-logging = { group = \"io.ktor\", name = \"ktor-client-logging\", version.ref = \"ktor\" }\nktor-client-serialization = { group = \"io.ktor\", name = \"ktor-client-serialization\", version.ref = \"ktor\" }\nktor-client-auth = { group = \"io.ktor\", name = \"ktor-client-auth\", version.ref = \"ktor\" }\nktor-client-android = { group = \"io.ktor\", name = \"ktor-client-android\", version.ref = \"ktor\" }\nktor-client-okhttp = { group = \"io.ktor\", name = \"ktor-client-okhttp\", version.ref = \"ktor\" }\nktor-client-curl = { group = \"io.ktor\", name = \"ktor-client-curl\", version.ref = \"ktor\" }\nktor-client-apache = { group = \"io.ktor\", name = \"ktor-client-apache\", version.ref = \"ktor\" }\nktor-client-ios = { group = \"io.ktor\", name = \"ktor-client-ios\", version.ref = \"ktor\" }\nktor-client-cio = { group = \"io.ktor\", name = \"ktor-client-cio\", version.ref = \"ktor\" }\nktor-client-js = { group = \"io.ktor\", name = \"ktor-client-js\", version.ref = \"ktor\" }\nslf4j-simple = { group = \"org.slf4j\", name = \"slf4j-simple\", version.ref = \"slf4j\" }\n\ni18n4k-core = { group = \"de.comahe.i18n4k\", name = \"i18n4k-core\", version.ref = \"i18n4k\" }\ni18n4k-gradle-plugin = { group = \"de.comahe.i18n4k\", name = \"i18n4k-gradle-plugin\", version.ref = \"i18n4k\" }\n\nyoutube-downloader = { group = \"io.github.shabinder\", name = \"youtube-api-dl\", version = \"1.4\" }\nfuzzy-wuzzy = { group = \"io.github.shabinder\", name = \"fuzzywuzzy\", version = \"1.1\" }\nmp3agic = { group = \"com.mpatric\", name = \"mp3agic\", version = \"0.9.0\" }\nkermit = { group = \"co.touchlab\", name = \"kermit\", version.ref = \"kermit\" }\nstorage-chooser = { group = \"com.github.shabinder\", name = \"storage-chooser\", version = \"2.0.4.45\" }\naccompanist-inset = { group = \"com.google.accompanist\", name = \"accompanist-insets\", version.ref = \"accompanist\" }\nandroid-app-notifier = { group = \"com.github.amitbd1508\", name = \"AppUpdater\", version = \"4.1.0\" }\nmoko-parcelize = { group = \"dev.icerock.moko\", name = \"parcelize\", version.ref = \"mokoParcelize\" }\njaffree = { group = \"com.github.kokorin.jaffree\", name = \"jaffree\", version = \"2021.08.16\" }\nmultiplatform-settings = { group = \"com.russhwolf\", name = \"multiplatform-settings-no-arg\", version.ref = \"multiplatformSettings\" }\n\ncountly-android = { group = \"ly.count.android\", name = \"sdk\", version = \"20.11.8\" }\ncountly-desktop = { group = \"ly.count.sdk\", name = \"java\", version = \"20.11.0\" }\n\nstately-common = { group = \"co.touchlab\", name = \"stately-common\", version.ref = \"statelyVersion\" }\nstately-concurrency = { group = \"co.touchlab\", name = \"stately-concurrency\", version.ref = \"statelyVersion\" }\nstately-isolate = { group = \"co.touchlab\", name = \"stately-isolate\", version.ref = \"statelyIsoVersion\" }\nstately-iso-collections = { group = \"co.touchlab\", name = \"stately-iso-collections\", version.ref = \"statelyIsoVersion\" }\n\nsqldelight-runtime = { group = \"com.squareup.sqldelight\", name = \"runtime\", version.ref = \"sqlDelight\" }\nsqldelight-coroutines-extension = { group = \"com.squareup.sqldelight\", name = \"coroutines-extensions\", version.ref = \"sqlDelight\" }\nsqldelight-gradle-plugin = { group = \"com.squareup.sqldelight\", name = \"gradle-plugin\", version.ref = \"sqlDelight\" }\nsqldelight-driver = { group = \"com.squareup.sqldelight\", name = \"sqlite-driver\", version.ref = \"sqlDelight\" }\nsqldelight-android-driver = { group = \"com.squareup.sqldelight\", name = \"android-driver\", version.ref = \"sqlDelight\" }\nsqldelight-native-driver = { group = \"com.squareup.sqldelight\", name = \"native-driver\", version.ref = \"sqlDelight\" }\nsqlite-jdbc-driver = { group = \"org.xerial\", name = \"sqlite-jdbc\", version.ref = \"sqliteJdbcDriver\" }\n\nkoin-core = { group = \"io.insert-koin\", name = \"koin-core\", version.ref = \"koin\" }\nkoin-test = { group = \"io.insert-koin\", name = \"koin-test\", version.ref = \"koin\" }\nkoin-android = { group = \"io.insert-koin\", name = \"koin-android\", version.ref = \"koin\" }\nkoin-androidx-compose = { group = \"io.insert-koin\", name = \"koin-androidx-compose\", version.ref = \"koin\" }\n\nkotlin-js-wrappers-react = { group = \"org.jetbrains.kotlin-wrappers\", name = \"kotlin-react\", version = \"17.0.2-pre.251-kotlin-1.5.31\" }\nkotlin-js-wrappers-reactDom = { group = \"org.jetbrains.kotlin-wrappers\", name = \"kotlin-react-dom\", version = \"17.0.2-pre.251-kotlin-1.5.31\" }\nkotlin-js-wrappers-styled = { group = \"org.jetbrains.kotlin-wrappers\", name = \"kotlin-styled\", version = \"5.3.1-pre.250-kotlin-1.5.31\" }\nkotlin-js-wrappers-ext = { group = \"org.jetbrains.kotlin-wrappers\", name = \"kotlin-extensions\", version = \"1.0.1-pre.251-kotlin-1.5.31\" }\n\nandroidx-activity = { group = \"androidx.activity\", name = \"activity-compose\", version = \"1.3.1\" }\nandroidx-core = { group = \"androidx.core\", name = \"core-ktx\", version = \"1.6.0\" }\nandroidx-palette = { group = \"androidx.palette\", name = \"palette-ktx\", version = \"1.0.0\" }\nandroidx-coroutines = { group = \"org.jetbrains.kotlinx\", name = \"kotlinx-coroutines-android\", version.ref = \"androidCoroutines\" }\nandroidx-junit = { group = \"androidx.test.ext\", name = \"junit\", version = \"1.1.2\" }\nandroidx-expresso = { group = \"androidx.test.espresso\", name = \"espresso-core\", version = \"3.3.0\" }\nandroidx-r8 = { group = \"com.android.tools\", name = \"r8\", version = \"3.3.28\" }\nandroidx-gradle-plugin = { group = \"com.android.tools.build\", name = \"gradle\", version = \"4.2.2\" }\nandroidx-lifecycle-service = { group = \"androidx.lifecycle\", name = \"lifecycle-service\", version.ref = \"androidxLifecycle\" }\nandroidx-lifecycle-common = { group = \"androidx.lifecycle\", name = \"lifecycle-common-java8\", version.ref = \"androidxLifecycle\" }\nandroidx-lifecycle-runtime = { group = \"androidx.lifecycle\", name = \"lifecycle-runtime-ktx\", version.ref = \"androidxLifecycle\" }\nandroidx-desugar = { group = \"com.android.tools\", name = \"desugar_jdk_libs\", version = \"1.1.5\" }\nleak-canary = { group = \"com.squareup.leakcanary\", name = \"leakcanary-android\", version = \"2.7\" }\njunit = { group = \"junit\", name = \"junit\", version = \"4.13.2\" }\n\nktlint-gradle = { group = \"org.jlleitschuh.gradle\", name = \"ktlint-gradle\", version.ref = \"ktLint\" }\n\n[bundles]\nktor = [\"ktor-client-core\",\"ktor-client-json\",\"ktor-client-auth\",\"ktor-client-logging\",\"ktor-client-serialization\"]\nstately = [\"stately-common\",\"stately-concurrency\",\"stately-isolate\",\"stately-iso-collections\"]\nandroidx-lifecycle = [\"androidx-lifecycle-service\",\"androidx-lifecycle-common\",\"androidx-lifecycle-runtime\"]\nandroidx-common = [\"androidx-activity\",\"androidx-core\"]\nkotlin-test = [\"kotlin-kotlinTestCommon\",\"kotlin-kotlinTestAnnotationsCommon\"]\nsqldelight = [\"sqldelight-runtime\",\"sqldelight-coroutines-extension\",\"sqldelight-driver\"]\nmviKotlin = [\"mviKotlin-dep\",\"mviKotlin-main\",\"mviKotlin-coroutines\",\"mviKotlin-logging\",\"mviKotlin-timetravel\"]\nkotlinCommon = [\"kotlin-coroutines\", \"kotlin-serialization\", \"kotlinx-serialization-json\", \"kotlinx-atomicfu\"]\nessenty = [\"essenty-lifecycle\",\"essenty-instanceKeeper\"]\nkoin-android = [\"koin-androidx-compose\",\"koin-android\"]\nkotlin-js-wrappers = [\"kotlin-js-wrappers-react\",\"kotlin-js-wrappers-reactDom\",\"kotlin-js-wrappers-styled\",\"kotlin-js-wrappers-ext\"]"
  },
  {
    "path": "buildSrc/settings.gradle.kts",
    "content": "\nenableFeaturePreview(\"VERSION_CATALOGS\")\ndependencyResolutionManagement {\n    @Suppress(\"UnstableApiUsage\")\n    versionCatalogs {\n        create(\"deps\") {\n            from(files(\"deps.versions.toml\"))\n        }\n    }\n}\n\nrootProject.name = \"spotiflyer-build\"\n"
  },
  {
    "path": "buildSrc/src/main/kotlin/android-setup.gradle.kts",
    "content": "@file:Suppress(\"UnstableApiUsage\")\n\n/*\n*  * Copyright (c)  2021  Shabinder Singh\n*  * This program is free software: you can redistribute it and/or modify\n*  * it under the terms of the GNU General Public License as published by\n*  * the Free Software Foundation, either version 3 of the License, or\n*  * (at your option) any later version.\n*  *\n*  * This program is distributed in the hope that it will be useful,\n*  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n*  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n*  * GNU General Public License for more details.\n*  *\n*  *  You should have received a copy of the GNU General Public License\n*  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n*/\n\nplugins {\n    id(\"com.android.library\")\n    id(\"ktlint-setup\")\n    id(\"compiler-args\")\n}\n\nandroid {\n    compileSdk = Versions.compileSdkVersion\n\n    defaultConfig {\n        minSdk = Versions.minSdkVersion\n        targetSdk = Versions.targetSdkVersion\n    }\n\n    compileOptions {\n        sourceCompatibility = JavaVersion.VERSION_1_8\n        targetCompatibility = JavaVersion.VERSION_1_8\n    }\n\n    sourceSets {\n        named(\"main\") {\n            manifest.srcFile(\"src/androidMain/AndroidManifest.xml\")\n            res.srcDirs(\"src/androidMain/res\")\n        }\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/main/kotlin/compiler-args.gradle.kts",
    "content": "plugins {\n    kotlin(\"multiplatform\")\n}\n\nkotlin {\n    sourceSets {\n        all {\n            languageSettings.apply {\n                optIn(\"kotlin.RequiresOptIn\")\n                optIn(\"kotlin.Experimental\")\n                optIn(\"kotlin.time.ExperimentalTime\")\n                optIn(\"kotlinx.serialization.ExperimentalSerializationApi\")\n            }\n        }\n    }\n}"
  },
  {
    "path": "buildSrc/src/main/kotlin/ktlint-setup.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"org.jlleitschuh.gradle.ktlint\")\n    id(\"org.jlleitschuh.gradle.ktlint-idea\")\n}\n\nktlint {\n    outputToConsole.set(true)\n    ignoreFailures.set(true)\n    coloredOutput.set(true)\n    verbose.set(true)\n    disabledRules.set(setOf(\"filename,no-wildcard-imports\"))\n    filter {\n        exclude(\"**/generated/**\")\n        exclude(\"**/build/**\")\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"com.android.library\")\n    id(\"kotlin-multiplatform\")\n    id(\"org.jetbrains.compose\")\n    id(\"kotlin-parcelize\")\n    id(\"ktlint-setup\")\n    id(\"compiler-args\")\n}\n\nkotlin {\n    jvm(\"desktop\")\n    android()\n    sourceSets {\n        all {\n            languageSettings.apply {\n                optIn(\"androidx.compose.animation\")\n            }\n        }\n        named(\"commonMain\") {\n            dependencies {\n                implementation(compose.ui)\n                implementation(compose.runtime)\n                implementation(compose.foundation)\n                implementation(compose.material)\n                implementation(compose.animation)\n                implementation(Deps.kotlinCoroutines)\n                implementation(Deps.decompose)\n            }\n        }\n        named(\"androidMain\") {\n            dependencies {\n                implementation(Deps.androidXCommonBundle)\n            }\n        }\n        named(\"desktopMain\") {\n            dependencies {\n                implementation(compose.desktop.common)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/main/kotlin/multiplatform-setup-test.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"com.android.library\")\n    id(\"kotlin-multiplatform\")\n    id(\"compiler-args\")\n}\n\nkotlin {\n    /*IOS Target Can be only built on Mac*/\n    if(HostOS.isMac){\n        val sdkName: String? = System.getenv(\"SDK_NAME\")\n        val isiOSDevice = sdkName.orEmpty().startsWith(\"iphoneos\")\n        if (isiOSDevice) {\n            iosArm64(\"ios\")\n        } else {\n            iosX64(\"ios\")\n        }\n    }\n\n    jvm(\"desktop\")\n    android()\n\n    js(BOTH) {\n        browser()\n        // nodejs()\n    }\n    sourceSets {\n        named(\"commonTest\") {\n            dependencies {\n                implementation(Deps.kotlinTestBundle)\n            }\n        }\n\n        named(\"androidTest\") {\n            dependencies {\n                implementation(Deps.kotlinJunitTest)\n            }\n        }\n        named(\"desktopTest\") {\n            dependencies {\n                implementation(Deps.kotlinJunitTest)\n            }\n        }\n        named(\"jsTest\") {\n            dependencies {\n                implementation(Deps.kotlinJSTest)\n            }\n        }\n    }\n}"
  },
  {
    "path": "buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"android-setup\")\n    id(\"kotlin-multiplatform\")\n    id(\"org.jetbrains.compose\")\n    id(\"ktlint-setup\")\n    id(\"kotlin-parcelize\")\n    id(\"compiler-args\")\n}\n\nkotlin {\n    /*IOS Target Can be only built on Mac*/\n    if (HostOS.isMac) {\n        val sdkName: String? = System.getenv(\"SDK_NAME\")\n        val isiOSDevice = sdkName.orEmpty().startsWith(\"iphoneos\")\n        if (isiOSDevice) {\n            iosArm64(\"ios\")\n        } else {\n            iosX64(\"ios\") {}\n        }\n    }\n\n    jvm(\"desktop\")\n    android()\n\n    js(BOTH) {\n        browser {\n            commonWebpackConfig {\n                cssSupport.enabled = true\n            }\n        }\n        // nodejs()\n    }\n\n    sourceSets {\n        named(\"commonMain\") {\n            dependencies {\n                implementation(Deps.ktorBundle)\n                implementation(Deps.kotlinxSerialization)\n                implementation(Deps.kotlinCoroutines)\n                implementation(Deps.mviKotlinBundle)\n                implementation(Deps.decompose)\n                implementation(Deps.koinCore)\n            }\n        }\n\n        named(\"androidMain\") {\n            dependencies {\n                implementation(compose.runtime)\n                implementation(compose.material)\n                implementation(compose.foundation)\n                implementation(compose.materialIconsExtended)\n                implementation(Deps.androidXCommonBundle)\n                implementation(Deps.decomposeComposeExt)\n                implementation(Deps.ktorClientAndroidOkHttp)\n                implementation(Deps.koinAndroidBundle)\n            }\n        }\n\n        named(\"desktopMain\") {\n            dependencies {\n                implementation(compose.runtime)\n                implementation(compose.foundation)\n                implementation(compose.material)\n                implementation(compose.desktop.common)\n                implementation(compose.materialIconsExtended)\n                implementation(Deps.decomposeComposeExt)\n                implementation(Deps.ktorClientApache)\n                implementation(Deps.slf4j)\n            }\n        }\n        named(\"jsMain\") {\n            dependencies {\n                implementation(Deps.ktorClientJS)\n            }\n        }\n        if (HostOS.isMac) {\n            named(\"iosMain\") {\n                dependencies {\n                    implementation(Deps.ktorClientIOS)\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/compose/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport org.jetbrains.compose.compose\n\nplugins {\n    id(\"android-setup\")\n    id(\"multiplatform-compose-setup\")\n}\n\nkotlin {\n    sourceSets {\n        all {\n            languageSettings.apply {\n                useExperimentalAnnotation(\"androidx.compose.animation\")\n            }\n        }\n        commonMain {\n            dependencies {\n                implementation(compose.material)\n                implementation(compose.materialIconsExtended)\n                implementation(project(\":common:root\"))\n                implementation(project(\":common:main\"))\n                implementation(project(\":common:list\"))\n                implementation(project(\":common:preference\"))\n                implementation(project(\":common:core-components\"))\n                implementation(project(\":common:database\"))\n                implementation(project(\":common:data-models\"))\n                implementation(project(\":common:dependency-injection\"))\n                implementation(deps.decompose.extensions.compose)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/compose/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.uikit\"/>\n"
  },
  {
    "path": "common/compose/src/androidMain/kotlin/com/shabinder/common/uikit/AndroidDialog.kt",
    "content": "package com.shabinder.common.uikit\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.runtime.Composable\n\n@OptIn(ExperimentalAnimationApi::class)\n@Composable\nactual fun Dialog(\n    isVisible: Boolean,\n    onDismiss: () -> Unit,\n    content: @Composable () -> Unit\n) {\n    AnimatedVisibility(isVisible) {\n        androidx.compose.ui.window.Dialog(onDismiss) {\n            content()\n        }\n    }\n}\n"
  },
  {
    "path": "common/compose/src/androidMain/kotlin/com/shabinder/common/uikit/AndroidImageLoad.kt",
    "content": "package com.shabinder.common.uikit\n\nimport androidx.compose.animation.Crossfade\nimport androidx.compose.foundation.Image\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.LaunchedEffect\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.remember\nimport androidx.compose.runtime.setValue\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.ImageBitmap\nimport androidx.compose.ui.layout.ContentScale\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.models.dispatcherIO\nimport kotlinx.coroutines.withContext\n\n@Composable\nactual fun ImageLoad(\n    link: String,\n    loader: suspend () -> Picture,\n    desc: String,\n    modifier: Modifier\n    // placeholder: ImageVector\n) {\n    var pic by remember(link) {\n        mutableStateOf<ImageBitmap?>(null)\n    }\n\n    LaunchedEffect(link) {\n        withContext(dispatcherIO) {\n            pic = loader().image\n        }\n    }\n\n    Crossfade(pic) {\n        if (it == null) {\n            Image(PlaceHolderImage(), desc, modifier, contentScale = ContentScale.Crop)\n        } else Image(it, desc, modifier, contentScale = ContentScale.Crop)\n    }\n}\n"
  },
  {
    "path": "common/compose/src/androidMain/kotlin/com/shabinder/common/uikit/AndroidImages.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n@file:Suppress(\"FunctionName\")\n\npackage com.shabinder.common.uikit\n\nimport androidx.compose.foundation.Image\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.painter.Painter\nimport androidx.compose.ui.graphics.vector.ImageVector\nimport androidx.compose.ui.graphics.vector.rememberVectorPainter\nimport androidx.compose.ui.res.painterResource\nimport androidx.compose.ui.res.vectorResource\nimport com.shabinder.common.database.R\nimport com.shabinder.common.translations.Strings\nimport kotlinx.coroutines.flow.MutableStateFlow\n\n@Composable\ninternal actual fun <T> imageVectorResource(id: T): ImageVector =\n    ImageVector.Companion.vectorResource(id as Int)\n\n@Composable\nactual fun DownloadImageTick() {\n    Image(\n        getCachedPainter(R.drawable.ic_tick),\n        Strings.downloadDone()\n    )\n}\n\n@Composable\nactual fun DownloadImageError(modifier: Modifier) {\n    Image(\n        getCachedPainter(R.drawable.ic_error),\n        Strings.downloadError(),\n        modifier = modifier\n    )\n}\n\n@Composable\nactual fun DownloadImageArrow(modifier: Modifier) {\n    Image(\n        getCachedPainter(R.drawable.ic_arrow),\n        Strings.downloadStart(),\n        modifier\n    )\n}\n\n@Composable\nactual fun DownloadAllImage() = getCachedPainter(R.drawable.ic_download_arrow)\n\n@Composable\nactual fun ShareImage() = getCachedPainter(R.drawable.ic_share_open)\n\n@Composable\nactual fun PlaceHolderImage() = getCachedPainter(R.drawable.ic_song_placeholder)\n\n@Composable\nactual fun SpotiFlyerLogo() = getCachedPainter(R.drawable.ic_spotiflyer_logo)\n\n@Composable\nactual fun HeartIcon() = painterResource(R.drawable.ic_heart)\n\n@Composable\nactual fun SpotifyLogo() = getCachedPainter(R.drawable.ic_spotify_logo)\n\n@Composable\nactual fun SoundboundLogo() = getCachedPainter(R.drawable.soundbound_app_logo)\n\n@Composable\nactual fun SaavnLogo() = getCachedPainter(R.drawable.ic_jio_saavn_logo)\n\n@Composable\nactual fun SoundCloudLogo() = getCachedPainter(R.drawable.ic_soundcloud)\n\n@Composable\nactual fun GaanaLogo() = getCachedPainter(R.drawable.ic_gaana)\n\n@Composable\nactual fun YoutubeLogo() = getCachedPainter(R.drawable.ic_youtube)\n\n@Composable\nactual fun YoutubeMusicLogo() = getCachedPainter(R.drawable.ic_youtube_music_logo)\n\n@Composable\nactual fun GithubLogo() = getCachedPainter(R.drawable.ic_github)\n\n@Composable\nactual fun PaypalLogo() = painterResource(R.drawable.ic_paypal_logo)\n\n@Composable\nactual fun OpenCollectiveLogo() = painterResource(R.drawable.ic_opencollective_icon)\n\n@Composable\nactual fun RazorPay() = painterResource(R.drawable.ic_indian_rupee)\n\n@Composable\nactual fun Toast(\n    flow: MutableStateFlow<String>,\n    duration: ToastDuration\n) {\n    // We Have Android's Implementation of Toast so its just Empty\n}"
  },
  {
    "path": "common/compose/src/androidMain/kotlin/com/shabinder/common/uikit/AndroidScrollBars.kt",
    "content": "package com.shabinder.common.uikit\n\nimport androidx.compose.foundation.ScrollState\nimport androidx.compose.foundation.lazy.LazyListState\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.unit.Dp\nimport androidx.compose.ui.unit.dp\n\nactual val MARGIN_SCROLLBAR: Dp = 0.dp\n\nactual interface ScrollbarAdapter\n\n@Composable\nactual fun rememberScrollbarAdapter(\n    scrollState: ScrollState\n): ScrollbarAdapter = object : ScrollbarAdapter {}\n\n@Composable\nactual fun rememberScrollbarAdapter(\n    scrollState: LazyListState,\n    itemCount: Int,\n    averageItemSize: Dp\n): ScrollbarAdapter =\n    object : ScrollbarAdapter {}\n\n@Composable\nactual fun VerticalScrollbar(\n    modifier: Modifier,\n    adapter: ScrollbarAdapter\n) {\n}\n"
  },
  {
    "path": "common/compose/src/androidMain/kotlin/com/shabinder/common/uikit/configurations/AndroidTypography.kt",
    "content": "package com.shabinder.common.uikit.configurations\n\nimport androidx.compose.ui.text.font.Font\nimport androidx.compose.ui.text.font.FontFamily\nimport androidx.compose.ui.text.font.FontWeight\nimport com.shabinder.common.models.R\n\nactual fun montserratFont() = FontFamily(\n    Font(R.font.montserrat_light, FontWeight.Light),\n    Font(R.font.montserrat_regular, FontWeight.Normal),\n    Font(R.font.montserrat_medium, FontWeight.Medium),\n    Font(R.font.montserrat_semibold, FontWeight.SemiBold),\n)\n\nactual fun pristineFont(): FontFamily = FontFamily(\n    Font(R.font.pristine_script, FontWeight.Bold)\n)\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/ExpectDialog.kt",
    "content": "package com.shabinder.common.uikit\n\nimport androidx.compose.runtime.Composable\n\n@Composable\nexpect fun Dialog(\n    isVisible: Boolean,\n    onDismiss: () -> Unit,\n    content: @Composable () -> Unit\n)\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/ExpectImageLoad.kt",
    "content": "package com.shabinder.common.uikit\n\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.Modifier\nimport com.shabinder.common.core_components.picture.Picture\n\n@Composable\nexpect fun ImageLoad(\n    link: String,\n    loader: suspend () -> Picture,\n    desc: String,\n    modifier: Modifier\n    // placeholder:Painter = PlaceHolderImage()\n)\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/ExpectImages.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n@file:Suppress(\"FunctionName\")\n\npackage com.shabinder.common.uikit\n\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.painter.Painter\nimport androidx.compose.ui.graphics.vector.ImageVector\nimport androidx.compose.ui.graphics.vector.rememberVectorPainter\nimport com.shabinder.common.caching.Cache\n\nprivate val ImageCache = Cache.Builder.newBuilder()\n    .maximumCacheSize(15).build<Any, ImageVector>()\n\n@Composable\ninternal expect fun <T> imageVectorResource(id: T): ImageVector\n\n@Composable\nfun <K : Any> getCachedPainter(key: K): Painter {\n    return rememberVectorPainter(\n        ImageCache.get(key) ?: imageVectorResource(key).also { ImageCache.put(key, it) })\n}\n\n@Composable\nexpect fun DownloadImageTick()\n\n@Composable\nexpect fun DownloadAllImage(): Painter\n\n@Composable\nexpect fun ShareImage(): Painter\n\n@Composable\nexpect fun PlaceHolderImage(): Painter\n\n@Composable\nexpect fun SpotiFlyerLogo(): Painter\n\n@Composable\nexpect fun SpotifyLogo(): Painter\n\n@Composable\nexpect fun SoundboundLogo(): Painter\n\n@Composable\nexpect fun SaavnLogo(): Painter\n\n@Composable\nexpect fun SoundCloudLogo(): Painter\n\n@Composable\nexpect fun YoutubeLogo(): Painter\n\n@Composable\nexpect fun GaanaLogo(): Painter\n\n@Composable\nexpect fun YoutubeMusicLogo(): Painter\n\n@Composable\nexpect fun GithubLogo(): Painter\n\n@Composable\nexpect fun PaypalLogo(): Painter\n\n@Composable\nexpect fun OpenCollectiveLogo(): Painter\n\n@Composable\nexpect fun RazorPay(): Painter\n\n@Composable\nexpect fun HeartIcon(): Painter\n\n@Composable\nexpect fun DownloadImageError(modifier: Modifier)\n\n@Composable\nexpect fun DownloadImageArrow(modifier: Modifier)\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/ScrollBars.kt",
    "content": "package com.shabinder.common.uikit\n\nimport androidx.compose.foundation.ScrollState\nimport androidx.compose.foundation.lazy.LazyListState\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.unit.Dp\n\nexpect val MARGIN_SCROLLBAR: Dp\n\nexpect interface ScrollbarAdapter\n\n@Composable\nexpect fun rememberScrollbarAdapter(\n    scrollState: LazyListState,\n    itemCount: Int,\n    averageItemSize: Dp\n): ScrollbarAdapter\n\n@Composable\nexpect fun rememberScrollbarAdapter(\n    scrollState: ScrollState\n): ScrollbarAdapter\n\n@Composable\nexpect fun VerticalScrollbar(\n    modifier: Modifier,\n    adapter: ScrollbarAdapter\n)\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/Toast.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit\n\nimport androidx.compose.runtime.Composable\nimport kotlinx.coroutines.flow.MutableStateFlow\n\nenum class ToastDuration(val value: Int) {\n    Short(1000), Long(2500)\n}\n\n@Composable\nexpect fun Toast(\n    flow: MutableStateFlow<String>,\n    duration: ToastDuration\n)\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/configurations/Color.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit.configurations\n\nimport androidx.compose.material.darkColors\nimport androidx.compose.ui.graphics.Color\n\nval colorPrimary = Color(0xFFFC5C7D)\nval colorPrimaryDark = Color(0xFFCE1CFF)\nval colorAccent = Color(0xFF9AB3FF)\nval colorSoundbound = Color(0xFF4b9fff)\nval colorAccentVariant = Color(0xFF3457D5)\nval colorRedError = Color(0xFFFF9494)\nval colorSuccessGreen = Color(0xFF59C351)\nval darkBackgroundColor = Color(0xFF000000)\nval colorOffWhite = Color(0xFFE7E7E7)\nval transparent = Color(0x00000000)\nval black = Color(0xFF000000)\nval lightGray = Color(0xFFCCCCCC)\n\nval SpotiFlyerColors = darkColors(\n    primary = colorPrimary,\n    onPrimary = black,\n    primaryVariant = colorPrimaryDark,\n    secondary = colorAccent,\n    onSecondary = black,\n    error = colorRedError,\n    onError = black,\n    surface = darkBackgroundColor,\n    background = darkBackgroundColor,\n    onSurface = lightGray,\n    onBackground = lightGray\n)\n\n/**\n * Return the fully opaque color that results from compositing [onSurface] atop [surface] with the\n * given [alpha]. Useful for situations where semi-transparent colors are undesirable.\n */\n/*\n@Composable\nfun Colors.compositedOnSurface(alpha: Float): Color {\n    return onSurface.copy(alpha = alpha).compositeOver(surface)\n}*/\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/configurations/Shape.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit.configurations\n\nimport androidx.compose.foundation.shape.RoundedCornerShape\nimport androidx.compose.material.Shapes\nimport androidx.compose.ui.unit.dp\n\nval SpotiFlyerShapes = Shapes(\n    small = RoundedCornerShape(percent = 50),\n    medium = RoundedCornerShape(size = 8.dp),\n    large = RoundedCornerShape(size = 0.dp)\n)\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/configurations/Theme.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit.configurations\n\nimport androidx.compose.material.MaterialTheme\nimport androidx.compose.runtime.Composable\n\n@Composable\nfun SpotiFlyerTheme(content: @Composable () -> Unit) {\n    MaterialTheme(\n        colors = SpotiFlyerColors,\n        typography = SpotiFlyerTypography,\n        shapes = SpotiFlyerShapes,\n        content = content\n    )\n}\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/configurations/Type.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit.configurations\n\nimport androidx.compose.material.Typography\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.text.TextStyle\nimport androidx.compose.ui.text.font.FontFamily\nimport androidx.compose.ui.text.font.FontWeight\nimport androidx.compose.ui.unit.sp\n\nexpect fun montserratFont(): FontFamily\nexpect fun pristineFont(): FontFamily\n\nval SpotiFlyerTypography = Typography(\n    h1 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 96.sp,\n        fontWeight = FontWeight.Light,\n        lineHeight = 117.sp,\n        letterSpacing = (-1.5).sp\n    ),\n    h2 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 60.sp,\n        fontWeight = FontWeight.Light,\n        lineHeight = 73.sp,\n        letterSpacing = (-0.5).sp\n    ),\n    h3 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 48.sp,\n        fontWeight = FontWeight.Normal,\n        lineHeight = 59.sp\n    ),\n    h4 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 30.sp,\n        fontWeight = FontWeight.SemiBold,\n        lineHeight = 37.sp\n    ),\n    h5 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 24.sp,\n        fontWeight = FontWeight.SemiBold,\n        lineHeight = 29.sp\n    ),\n    h6 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 18.sp,\n        fontWeight = FontWeight.Medium,\n        lineHeight = 26.sp,\n        letterSpacing = 0.5.sp\n\n    ),\n    subtitle1 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 16.sp,\n        fontWeight = FontWeight.SemiBold,\n        lineHeight = 20.sp,\n        letterSpacing = 0.5.sp\n    ),\n    subtitle2 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 14.sp,\n        fontWeight = FontWeight.Medium,\n        lineHeight = 17.sp,\n        letterSpacing = 0.1.sp\n    ),\n    body1 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 16.sp,\n        fontWeight = FontWeight.Medium,\n        lineHeight = 20.sp,\n        letterSpacing = 0.15.sp,\n    ),\n    body2 = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 14.sp,\n        fontWeight = FontWeight.SemiBold,\n        lineHeight = 20.sp,\n        letterSpacing = 0.25.sp\n    ),\n    button = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 14.sp,\n        fontWeight = FontWeight.SemiBold,\n        lineHeight = 16.sp,\n        letterSpacing = 1.25.sp\n    ),\n    caption = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 12.sp,\n        fontWeight = FontWeight.SemiBold,\n        lineHeight = 16.sp,\n        letterSpacing = 0.sp\n    ),\n    overline = TextStyle(\n        fontFamily = montserratFont(),\n        fontSize = 12.sp,\n        fontWeight = FontWeight.SemiBold,\n        lineHeight = 16.sp,\n        letterSpacing = 1.sp\n    )\n)\n\nval appNameStyle = TextStyle(\n    fontFamily = pristineFont(),\n    fontSize = 40.sp,\n    fontWeight = FontWeight.SemiBold,\n    lineHeight = 42.sp,\n    letterSpacing = (1.5).sp,\n    color = Color(0xFFECECEC)\n)\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/dialogs/Donation.kt",
    "content": "package com.shabinder.common.uikit.dialogs\n\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.foundation.BorderStroke\nimport androidx.compose.foundation.clickable\nimport androidx.compose.foundation.layout.Arrangement\nimport androidx.compose.foundation.layout.Column\nimport androidx.compose.foundation.layout.Row\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.foundation.layout.size\nimport androidx.compose.material.ButtonDefaults\nimport androidx.compose.material.Card\nimport androidx.compose.material.Icon\nimport androidx.compose.material.OutlinedButton\nimport androidx.compose.material.Text\nimport androidx.compose.material.TextButton\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.remember\nimport androidx.compose.runtime.setValue\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.unit.dp\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.Dialog\nimport com.shabinder.common.uikit.OpenCollectiveLogo\nimport com.shabinder.common.uikit.PaypalLogo\nimport com.shabinder.common.uikit.RazorPay\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.colorAccent\n\ntypealias DonationDialogCallBacks = Triple<openAction, dismissAction, snoozeAction>\ninternal typealias openAction = () -> Unit\ninternal typealias dismissAction = () -> Unit\nprivate typealias snoozeAction = () -> Unit\n\n@OptIn(ExperimentalAnimationApi::class)\n@Composable\nfun DonationDialogComponent(onDismissExtra: () -> Unit): DonationDialogCallBacks {\n    var isDonationDialogVisible by remember { mutableStateOf(false) }\n    DonationDialog(\n        isDonationDialogVisible,\n        onSnooze = { isDonationDialogVisible = false },\n        onDismiss = {\n            isDonationDialogVisible = false\n        }\n    )\n\n    val openDonationDialog = { isDonationDialogVisible = true }\n    val snoozeDonationDialog = { isDonationDialogVisible = false }\n    val dismissDonationDialog = {\n        onDismissExtra()\n        isDonationDialogVisible = false\n    }\n    return DonationDialogCallBacks(openDonationDialog, dismissDonationDialog, snoozeDonationDialog)\n}\n\n@ExperimentalAnimationApi\n@Composable\nfun DonationDialog(\n    isVisible: Boolean,\n    onDismiss: () -> Unit,\n    onSnooze: () -> Unit\n) {\n    Dialog(isVisible, onDismiss) {\n        Card(\n            modifier = Modifier.fillMaxWidth(),\n            border = BorderStroke(1.dp, Color.Gray) // Gray\n        ) {\n            Column(Modifier.padding(16.dp)) {\n                Text(\n                    Strings.supportUs(),\n                    style = SpotiFlyerTypography.h5,\n                    textAlign = TextAlign.Center,\n                    color = colorAccent,\n                    modifier = Modifier\n                )\n                Spacer(modifier = Modifier.padding(vertical = 4.dp))\n                Row(\n                    verticalAlignment = Alignment.CenterVertically,\n                    modifier = Modifier.fillMaxWidth().clickable(\n                        onClick = {\n                            onDismiss()\n                            Actions.instance.openPlatform(\"\", \"https://opencollective.com/spotiflyer/donate\")\n                        }\n                    )\n                        .padding(vertical = 6.dp)\n                ) {\n                    Icon(OpenCollectiveLogo(), \"Open Collective Logo\", Modifier.size(24.dp), tint = Color(0xFFCCCCCC))\n                    Spacer(modifier = Modifier.padding(start = 16.dp))\n                    Column {\n                        Text(\n                            text = \"Open Collective\",\n                            style = SpotiFlyerTypography.h6\n                        )\n                        Text(\n                            text = Strings.worldWideDonations(),\n                            style = SpotiFlyerTypography.subtitle2\n                        )\n                    }\n                }\n                Row(\n                    verticalAlignment = Alignment.CenterVertically,\n                    modifier = Modifier.fillMaxWidth().clickable(\n                        onClick = {\n                            onDismiss()\n                            Actions.instance.openPlatform(\"\", \"https://www.paypal.com/paypalme/shabinder\")\n                        }\n                    )\n                        .padding(vertical = 6.dp)\n                ) {\n                    Icon(PaypalLogo(), \"Paypal Logo\", Modifier.size(24.dp), tint = Color(0xFFCCCCCC))\n                    Spacer(modifier = Modifier.padding(start = 16.dp))\n                    Column {\n                        Text(\n                            text = \"Paypal\",\n                            style = SpotiFlyerTypography.h6\n                        )\n                        Text(\n                            text = Strings.worldWideDonations(),\n                            style = SpotiFlyerTypography.subtitle2\n                        )\n                    }\n                }\n                Row(\n                    modifier = Modifier.fillMaxWidth().padding(top = 6.dp)\n                        .clickable(\n                            onClick = {\n                                onDismiss()\n                                Actions.instance.giveDonation()\n                            }\n                        ),\n                    verticalAlignment = Alignment.CenterVertically\n                ) {\n                    Icon(RazorPay(), \"Indian Rupee Logo\", Modifier.size(24.dp), tint = Color(0xFFCCCCCC))\n                    Spacer(modifier = Modifier.padding(start = 16.dp))\n                    Column {\n                        Text(\n                            text = \"RazorPay\",\n                            style = SpotiFlyerTypography.h6\n                        )\n                        Text(\n                            text = \"${Strings.indianDonations()} (UPI / PayTM / PhonePe / Cards).\",\n                            style = SpotiFlyerTypography.subtitle2\n                        )\n                    }\n                }\n                Spacer(modifier = Modifier.padding(vertical = 16.dp))\n                Row(\n                    verticalAlignment = Alignment.CenterVertically,\n                    horizontalArrangement = Arrangement.SpaceEvenly,\n                    modifier = Modifier.padding(horizontal = 4.dp).fillMaxWidth()\n                ) {\n                    OutlinedButton(onClick = onDismiss) {\n                        Text(Strings.dismiss())\n                    }\n                    TextButton(onClick = onSnooze, colors = ButtonDefaults.buttonColors()) {\n                        Text(Strings.remindLater())\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/dialogs/ErrorInfoDialog.kt",
    "content": "package com.shabinder.common.uikit.dialogs\n\nimport androidx.compose.foundation.BorderStroke\nimport androidx.compose.foundation.layout.Arrangement\nimport androidx.compose.foundation.layout.Column\nimport androidx.compose.foundation.layout.Row\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.foundation.rememberScrollState\nimport androidx.compose.foundation.text.selection.SelectionContainer\nimport androidx.compose.foundation.verticalScroll\nimport androidx.compose.material.ButtonDefaults\nimport androidx.compose.material.Card\nimport androidx.compose.material.Text\nimport androidx.compose.material.TextButton\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.remember\nimport androidx.compose.runtime.setValue\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.text.font.FontWeight\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.unit.dp\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.Dialog\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.colorAccent\n\ntypealias ErrorInfoDialogCallBacks = Pair<openAction, dismissAction>\n\n@Composable\nfun ErrorInfoDialog(error: Throwable): ErrorInfoDialogCallBacks {\n    var isErrorDialogVisible by remember { mutableStateOf(false) }\n    val onDismissDialog = { isErrorDialogVisible = false }\n    val openErrorDialog = { isErrorDialogVisible = true }\n\n    Dialog(isErrorDialogVisible, onDismissDialog) {\n        Card(\n            modifier = Modifier.fillMaxWidth(),\n            border = BorderStroke(1.dp, Color.Gray) // Gray\n        ) {\n            Column(Modifier.padding(16.dp)) {\n                Text(\n                    Strings.whatWentWrong(),\n                    style = SpotiFlyerTypography.h5,\n                    textAlign = TextAlign.Center,\n                    color = colorAccent,\n                    modifier = Modifier.padding(vertical = 4.dp).fillMaxWidth()\n                )\n\n                Spacer(Modifier.padding(top = 4.dp))\n                Text(Strings.copyCodeInGithubIssue(), fontWeight = FontWeight.SemiBold)\n\n                SelectionContainer(Modifier.padding(vertical = 8.dp).verticalScroll(rememberScrollState()).weight(1f)) {\n                    Text(error.stackTraceToString(), fontWeight = FontWeight.Light)\n                }\n                Row(\n                    Modifier.padding(top = 8.dp).fillMaxWidth(),\n                    verticalAlignment = Alignment.CenterVertically,\n                    horizontalArrangement = Arrangement.SpaceEvenly\n                ) {\n                    TextButton(onClick = onDismissDialog, colors = ButtonDefaults.buttonColors()) {\n                        Text(Strings.dismiss())\n                    }\n                    TextButton(onClick = { Actions.instance.copyToClipboard(error.stackTraceToString()) }, colors = ButtonDefaults.buttonColors()) {\n                        Text(Strings.copyToClipboard())\n                    }\n                }\n            }\n        }\n    }\n\n    return ErrorInfoDialogCallBacks(openErrorDialog, onDismissDialog)\n}\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/screens/SpotiFlyerListUi.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n@file:Suppress(\"UNUSED_VARIABLE\")\n\npackage com.shabinder.common.uikit.screens\n\nimport androidx.compose.foundation.clickable\nimport androidx.compose.foundation.layout.Arrangement\nimport androidx.compose.foundation.layout.Box\nimport androidx.compose.foundation.layout.Column\nimport androidx.compose.foundation.layout.Row\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxHeight\nimport androidx.compose.foundation.layout.fillMaxSize\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.height\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.foundation.layout.size\nimport androidx.compose.foundation.layout.width\nimport androidx.compose.foundation.lazy.LazyColumn\nimport androidx.compose.foundation.lazy.itemsIndexed\nimport androidx.compose.foundation.lazy.rememberLazyListState\nimport androidx.compose.material.CircularProgressIndicator\nimport androidx.compose.material.ExtendedFloatingActionButton\nimport androidx.compose.material.Icon\nimport androidx.compose.material.MaterialTheme\nimport androidx.compose.material.Text\nimport androidx.compose.material.icons.Icons\nimport androidx.compose.material.icons.rounded.Info\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.LaunchedEffect\nimport androidx.compose.runtime.getValue\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.draw.clip\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.text.style.TextOverflow\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.unit.sp\nimport com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.list.SpotiFlyerList\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.DownloadAllImage\nimport com.shabinder.common.uikit.DownloadImageArrow\nimport com.shabinder.common.uikit.DownloadImageError\nimport com.shabinder.common.uikit.DownloadImageTick\nimport com.shabinder.common.uikit.ImageLoad\nimport com.shabinder.common.uikit.VerticalScrollbar\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.appNameStyle\nimport com.shabinder.common.uikit.configurations.colorAccent\nimport com.shabinder.common.uikit.configurations.colorPrimary\nimport com.shabinder.common.uikit.configurations.lightGray\nimport com.shabinder.common.uikit.dialogs.DonationDialogComponent\nimport com.shabinder.common.uikit.dialogs.ErrorInfoDialog\nimport com.shabinder.common.uikit.rememberScrollbarAdapter\n\n@Composable\nfun SpotiFlyerListContent(\n    component: SpotiFlyerList,\n    modifier: Modifier = Modifier\n) {\n    val model by component.model.subscribeAsState()\n\n    LaunchedEffect(model.errorOccurred) {\n        /*Handle if Any Exception Occurred*/\n        model.errorOccurred?.let {\n            Actions.instance.showPopUpMessage(it.message ?: Strings.errorOccurred())\n            component.onBackPressed()\n        }\n    }\n\n    Box(modifier = modifier.fillMaxSize()) {\n        val result = model.queryResult\n        if (result == null) {\n            /* Loading Bar */\n            Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally) {\n                CircularProgressIndicator()\n                Spacer(modifier.padding(8.dp))\n                Text(\"${Strings.loading()}...\", style = appNameStyle, color = colorPrimary)\n            }\n        } else {\n\n            val listState = rememberLazyListState()\n\n            LazyColumn(\n                verticalArrangement = Arrangement.spacedBy(12.dp),\n                content = {\n                    item {\n                        CoverImage(result.title, result.coverUrl, component::loadImage)\n                    }\n                    itemsIndexed(model.trackList) { _, item ->\n                        TrackCard(\n                            track = item,\n                            downloadTrack = { component.onDownloadClicked(item) },\n                            loadImage = { component.loadImage(item.albumArtURL) }\n                        )\n                    }\n                },\n                state = listState,\n                modifier = Modifier.fillMaxSize(),\n            )\n\n            // Donation Dialog Visibility\n            val (openDonationDialog, dismissDonationDialog, snoozeDonationDialog) = DonationDialogComponent {\n                component.dismissDonationDialogSetOffset()\n            }\n\n            DownloadAllButton(\n                onClick = {\n                    component.onDownloadAllClicked(model.trackList)\n                    // Check If we are allowed to show donation Dialog\n                    if (model.askForDonation) {\n                        // Show Donation Dialog\n                        openDonationDialog()\n                    }\n                },\n                modifier = Modifier.padding(bottom = 24.dp).align(Alignment.BottomCenter)\n            )\n\n            VerticalScrollbar(\n                modifier = Modifier.padding(end = 2.dp).align(Alignment.CenterEnd).fillMaxHeight(),\n                adapter = rememberScrollbarAdapter(\n                    scrollState = listState,\n                    itemCount = model.trackList.size,\n                    averageItemSize = 72.dp\n                )\n            )\n        }\n    }\n}\n\n@Composable\nfun TrackCard(\n    track: TrackDetails,\n    downloadTrack: () -> Unit,\n    loadImage: suspend () -> Picture\n) {\n    Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp)) {\n        ImageLoad(\n            track.albumArtURL,\n            { loadImage() },\n            Strings.albumArt(),\n            modifier = Modifier\n                .width(70.dp)\n                .height(70.dp)\n                .clip(MaterialTheme.shapes.medium)\n        )\n        Column(modifier = Modifier.padding(horizontal = 8.dp).height(60.dp).weight(1f), verticalArrangement = Arrangement.SpaceEvenly) {\n            Text(track.title, maxLines = 1, overflow = TextOverflow.Ellipsis, style = SpotiFlyerTypography.h6, color = colorAccent)\n            Row(\n                horizontalArrangement = Arrangement.SpaceBetween,\n                verticalAlignment = Alignment.Bottom,\n                modifier = Modifier.padding(horizontal = 8.dp).fillMaxSize()\n            ) {\n                Text(\"${track.artists.firstOrNull()}...\", fontSize = 12.sp, maxLines = 1)\n                Text(\"${track.durationSec / 60} ${Strings.minute()}, ${track.durationSec % 60} ${Strings.second()}\", fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)\n            }\n        }\n        when (track.downloaded) {\n            is DownloadStatus.Downloaded -> {\n                DownloadImageTick()\n            }\n            is DownloadStatus.Queued -> {\n                CircularProgressIndicator()\n            }\n            is DownloadStatus.Failed -> {\n                val (openErrorDialog, dismissErrorDialog) = ErrorInfoDialog((track.downloaded as DownloadStatus.Failed).error)\n\n                Icon(\n                    Icons.Rounded.Info, Strings.downloadError(), tint = lightGray,\n                    modifier = Modifier.size(42.dp).clickable {\n                        openErrorDialog()\n                    }.padding(start = 4.dp, end = 12.dp)\n                )\n\n                DownloadImageError(\n                    Modifier.clickable(\n                        onClick = {\n                            downloadTrack()\n                        }\n                    )\n                )\n            }\n            is DownloadStatus.Downloading -> {\n                CircularProgressIndicator(progress = (track.downloaded as DownloadStatus.Downloading).progress.toFloat() / 100f)\n            }\n            is DownloadStatus.Converting -> {\n                CircularProgressIndicator(progress = 100f, color = colorAccent)\n            }\n            is DownloadStatus.NotDownloaded -> {\n                DownloadImageArrow(\n                    Modifier.clickable(\n                        onClick = {\n                            downloadTrack()\n                        }\n                    )\n                )\n            }\n        }\n    }\n}\n\n@Composable\nfun CoverImage(\n    title: String,\n    coverURL: String,\n    loadImage: suspend (URL: String, isCover: Boolean) -> Picture,\n    modifier: Modifier = Modifier,\n) {\n    Column(\n        modifier.padding(vertical = 8.dp).fillMaxWidth(),\n        horizontalAlignment = Alignment.CenterHorizontally\n    ) {\n        ImageLoad(\n            coverURL,\n            { loadImage(coverURL, true) },\n            Strings.coverImage(),\n            modifier = Modifier\n                .padding(12.dp)\n                .width(190.dp)\n                .height(210.dp)\n                .clip(MaterialTheme.shapes.medium)\n        )\n        Text(\n            text = title,\n            style = SpotiFlyerTypography.h5,\n            maxLines = 2,\n            textAlign = TextAlign.Center,\n            overflow = TextOverflow.Ellipsis,\n        )\n    }\n    /*scope.launch {\n        updateGradient(coverURL, ctx)\n    }*/\n}\n\n@Composable\nfun DownloadAllButton(onClick: () -> Unit, modifier: Modifier = Modifier) {\n    ExtendedFloatingActionButton(\n        text = { Text(Strings.downloadAll()) },\n        onClick = onClick,\n        icon = { Icon(DownloadAllImage(), Strings.downloadAll() + Strings.button(), tint = Color(0xFF000000)) },\n        backgroundColor = colorAccent,\n        modifier = modifier\n    )\n}\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/screens/SpotiFlyerMainUi.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit.screens\n\nimport androidx.compose.animation.Crossfade\nimport androidx.compose.foundation.BorderStroke\nimport androidx.compose.foundation.Image\nimport androidx.compose.foundation.background\nimport androidx.compose.foundation.border\nimport androidx.compose.foundation.clickable\nimport androidx.compose.foundation.layout.Arrangement\nimport androidx.compose.foundation.layout.Box\nimport androidx.compose.foundation.layout.Column\nimport androidx.compose.foundation.layout.Row\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxHeight\nimport androidx.compose.foundation.layout.fillMaxSize\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.height\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.foundation.layout.size\nimport androidx.compose.foundation.layout.width\nimport androidx.compose.foundation.layout.wrapContentWidth\nimport androidx.compose.foundation.lazy.LazyColumn\nimport androidx.compose.foundation.lazy.items\nimport androidx.compose.foundation.lazy.rememberLazyListState\nimport androidx.compose.foundation.rememberScrollState\nimport androidx.compose.foundation.shape.RoundedCornerShape\nimport androidx.compose.foundation.text.KeyboardOptions\nimport androidx.compose.foundation.verticalScroll\nimport androidx.compose.material.ButtonDefaults\nimport androidx.compose.material.Card\nimport androidx.compose.material.Icon\nimport androidx.compose.material.MaterialTheme\nimport androidx.compose.material.OutlinedButton\nimport androidx.compose.material.Switch\nimport androidx.compose.material.SwitchDefaults\nimport androidx.compose.material.Tab\nimport androidx.compose.material.TabPosition\nimport androidx.compose.material.TabRow\nimport androidx.compose.material.TabRowDefaults.tabIndicatorOffset\nimport androidx.compose.material.Text\nimport androidx.compose.material.TextButton\nimport androidx.compose.material.TextField\nimport androidx.compose.material.TextFieldDefaults.textFieldColors\nimport androidx.compose.material.icons.Icons\nimport androidx.compose.material.icons.outlined.History\nimport androidx.compose.material.icons.outlined.Info\nimport androidx.compose.material.icons.rounded.CardGiftcard\nimport androidx.compose.material.icons.rounded.ChevronRight\nimport androidx.compose.material.icons.rounded.Edit\nimport androidx.compose.material.icons.rounded.Flag\nimport androidx.compose.material.icons.rounded.Insights\nimport androidx.compose.material.icons.rounded.Share\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.getValue\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.draw.clip\nimport androidx.compose.ui.graphics.Brush\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.text.TextStyle\nimport androidx.compose.ui.text.font.FontStyle\nimport androidx.compose.ui.text.font.FontWeight\nimport androidx.compose.ui.text.input.KeyboardType\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.text.style.TextOverflow\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.unit.sp\nimport com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.main.SpotiFlyerMain\nimport com.shabinder.common.main.SpotiFlyerMain.HomeCategory\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.DownloadRecord\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.GaanaLogo\nimport com.shabinder.common.uikit.GithubLogo\nimport com.shabinder.common.uikit.ImageLoad\nimport com.shabinder.common.uikit.SaavnLogo\nimport com.shabinder.common.uikit.ShareImage\nimport com.shabinder.common.uikit.SoundCloudLogo\nimport com.shabinder.common.uikit.SoundboundLogo\nimport com.shabinder.common.uikit.SpotifyLogo\nimport com.shabinder.common.uikit.VerticalScrollbar\nimport com.shabinder.common.uikit.YoutubeLogo\nimport com.shabinder.common.uikit.YoutubeMusicLogo\nimport com.shabinder.common.uikit.configurations.SpotiFlyerShapes\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.black\nimport com.shabinder.common.uikit.configurations.colorAccent\nimport com.shabinder.common.uikit.configurations.colorOffWhite\nimport com.shabinder.common.uikit.configurations.colorPrimary\nimport com.shabinder.common.uikit.configurations.transparent\nimport com.shabinder.common.uikit.dialogs.DonationDialogComponent\nimport com.shabinder.common.uikit.rememberScrollbarAdapter\n\n@Composable\nfun SpotiFlyerMainContent(component: SpotiFlyerMain) {\n    val model by component.model.subscribeAsState()\n\n    val (openDonationDialog, _, _) = DonationDialogComponent {\n        component.dismissDonationDialogOffset()\n    }\n\n    Column {\n        SearchPanel(\n            model.link,\n            component::onInputLinkChanged,\n            component::onLinkSearch\n        )\n\n        HomeTabBar(\n            model.selectedCategory,\n            HomeCategory.values(),\n            component::selectCategory,\n        )\n\n        when (model.selectedCategory) {\n            HomeCategory.About -> AboutColumn(\n                analyticsEnabled = model.isAnalyticsEnabled,\n                toggleAnalytics = component::toggleAnalytics,\n                openDonationDialog = {\n                    component.analytics.donationDialogVisit()\n                    openDonationDialog()\n                }\n            )\n\n            HomeCategory.History -> HistoryColumn(\n                model.records.sortedByDescending { it.id },\n                component::loadImage,\n                component::onLinkSearch\n            )\n        }\n    }\n}\n\n@Composable\nfun HomeTabBar(\n    selectedCategory: HomeCategory,\n    categories: Array<HomeCategory>,\n    selectCategory: (HomeCategory) -> Unit,\n    modifier: Modifier = Modifier\n) {\n    val selectedIndex = categories.indexOfFirst { it == selectedCategory }\n    val indicator = @Composable { tabPositions: List<TabPosition> ->\n        HomeCategoryTabIndicator(\n            Modifier.tabIndicatorOffset(tabPositions[selectedIndex])\n        )\n    }\n\n    TabRow(\n        backgroundColor = transparent,\n        selectedTabIndex = selectedIndex,\n        indicator = indicator,\n        modifier = modifier,\n    ) {\n        categories.forEachIndexed { index, category ->\n            Tab(\n                selected = index == selectedIndex,\n                onClick = { selectCategory(category) },\n                text = {\n                    Text(\n                        text = when (category) {\n                            HomeCategory.About -> Strings.about()\n                            HomeCategory.History -> Strings.history()\n                        },\n                        style = MaterialTheme.typography.body2\n                    )\n                },\n                icon = {\n                    when (category) {\n                        HomeCategory.About -> Icon(Icons.Outlined.Info, Strings.infoTab())\n                        HomeCategory.History -> Icon(Icons.Outlined.History, Strings.historyTab())\n                    }\n                }\n            )\n        }\n    }\n}\n\n@Composable\nfun SearchPanel(\n    link: String,\n    updateLink: (String) -> Unit,\n    onSearch: (String) -> Unit,\n    modifier: Modifier = Modifier\n) {\n    Column(\n        horizontalAlignment = Alignment.CenterHorizontally,\n        modifier = modifier.padding(top = 16.dp)\n    ) {\n        TextField(\n            value = link,\n            onValueChange = updateLink,\n            leadingIcon = {\n                Icon(Icons.Rounded.Edit, Strings.linkTextBox(), tint = Color.LightGray)\n            },\n            label = { Text(text = Strings.pasteLinkHere(), color = Color.LightGray) },\n            singleLine = true,\n            textStyle = TextStyle.Default.merge(TextStyle(fontSize = 18.sp, color = Color.White)),\n            keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),\n            modifier = modifier.padding(12.dp).fillMaxWidth()\n                .border(\n                    BorderStroke(\n                        2.dp,\n                        Brush.horizontalGradient(\n                            listOf(\n                                colorPrimary,\n                                colorAccent\n                            )\n                        )\n                    ),\n                    RoundedCornerShape(30.dp)\n                ),\n            shape = RoundedCornerShape(size = 30.dp),\n            colors = textFieldColors(\n                focusedIndicatorColor = Color.Transparent,\n                unfocusedIndicatorColor = Color.Transparent,\n                backgroundColor = Color.Black\n            )\n        )\n        OutlinedButton(\n            modifier = Modifier.padding(12.dp).wrapContentWidth(),\n            onClick = {\n                if (link.isBlank()) Actions.instance.showPopUpMessage(Strings.enterALink())\n                else {\n                    // TODO if(!isOnline(ctx)) showPopUpMessage(\"Check Your Internet Connection\") else\n                    onSearch(link)\n                }\n            },\n            border = BorderStroke(\n                1.dp,\n                Brush.horizontalGradient(\n                    listOf(\n                        colorPrimary,\n                        colorAccent\n                    )\n                )\n            )\n        ) {\n            Text(\n                text = Strings.search(),\n                style = SpotiFlyerTypography.h6,\n                modifier = Modifier.padding(4.dp)\n            )\n        }\n    }\n}\n\n@Composable\nfun AboutColumn(\n    modifier: Modifier = Modifier,\n    analyticsEnabled: Boolean,\n    openDonationDialog: () -> Unit,\n    toggleAnalytics: (enabled: Boolean) -> Unit\n) {\n\n    Box {\n        val stateVertical = rememberScrollState(0)\n\n        Column(modifier.fillMaxSize().padding(8.dp).verticalScroll(stateVertical)) {\n            Card(\n                modifier = modifier.fillMaxWidth(),\n                border = BorderStroke(1.dp, Color.Gray)\n            ) {\n                Column(modifier.padding(12.dp).clickable(\n                    onClick = {\n                        Actions.instance.openPlatform(\n                            \"in.shabinder.soundbound\",\n                            \"https://soundbound.app\"\n                        )\n                    }\n                )) {\n                    Row {\n                        Image(\n                            painter = SoundboundLogo(),\n                            \"${Strings.open()} Soundbound\",\n                        )\n\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n\n                        Column(\n                            horizontalAlignment = Alignment.CenterHorizontally,\n                            verticalArrangement = Arrangement.Center,\n                            modifier = Modifier.weight(1f)\n                        ) {\n                            Text(\n                                text = \"Get Soundbound\",\n                                style = SpotiFlyerTypography.h4,\n                                color = colorAccent\n                            )\n\n                            Spacer(modifier = Modifier.padding(top = 8.dp))\n\n                            Text(\n                                text = \"No BOUNDs to,\\nyour Music & SOUNDs.\",\n                                style = SpotiFlyerTypography.h6,\n                                textAlign = TextAlign.Center,\n                                fontStyle = FontStyle.Italic,\n                                color = colorOffWhite,\n                                modifier = Modifier.align(Alignment.CenterHorizontally)\n                                    .padding(top = 4.dp)\n                            )\n                        }\n                    }\n\n                    TextButton(\n                        onClick = {\n                            Actions.instance.openPlatform(\n                                \"in.shabinder.soundbound\",\n                                \"https://soundbound.app\"\n                            )\n                        },\n                        modifier = Modifier.fillMaxWidth()\n                            .padding(vertical = 8.dp, horizontal = 16.dp),\n                        colors = ButtonDefaults.textButtonColors(\n                            contentColor = black,\n                            backgroundColor = colorAccent\n                        )\n                    ) {\n                        Text(\n                            text = Strings.open(),\n                            style = SpotiFlyerTypography.body1,\n                            modifier = Modifier.padding(vertical = 4.dp),\n                            fontWeight = FontWeight.SemiBold\n                        )\n\n                        Icon(\n                            Icons.Rounded.ChevronRight,\n                            Strings.open(),\n                            tint = black,\n                            modifier = Modifier\n                        )\n                    }\n                }\n            }\n            Spacer(modifier = Modifier.padding(top = 8.dp))\n            Card(\n                modifier = modifier.fillMaxWidth(),\n                border = BorderStroke(1.dp, Color.Gray)\n            ) {\n                Column(modifier.padding(12.dp)) {\n                    Text(\n                        text = Strings.supportedPlatforms(),\n                        style = SpotiFlyerTypography.body1,\n                        color = colorAccent\n                    )\n                    Spacer(modifier = Modifier.padding(top = 12.dp))\n                    Row(\n                        horizontalArrangement = Arrangement.Center,\n                        modifier = modifier.fillMaxWidth()\n                    ) {\n                        Icon(\n                            SpotifyLogo(),\n                            \"${Strings.open()} Spotify\",\n                            tint = Color.Unspecified,\n                            modifier = Modifier.clip(SpotiFlyerShapes.small).clickable(\n                                onClick = {\n                                    Actions.instance.openPlatform(\n                                        \"com.spotify.music\",\n                                        \"https://open.spotify.com\"\n                                    )\n                                }\n                            )\n                        )\n                        Spacer(modifier = modifier.padding(start = 16.dp))\n                        Icon(\n                            GaanaLogo(),\n                            \"${Strings.open()} Gaana\",\n                            tint = Color.Unspecified,\n                            modifier = Modifier.clip(SpotiFlyerShapes.small).clickable(\n                                onClick = {\n                                    Actions.instance.openPlatform(\n                                        \"com.gaana\",\n                                        \"https://www.gaana.com\"\n                                    )\n                                }\n                            )\n                        )\n                        Spacer(modifier = modifier.padding(start = 16.dp))\n                        Icon(\n                            SaavnLogo(),\n                            \"${Strings.open()} Jio Saavn\",\n                            tint = Color.Unspecified,\n                            modifier = Modifier.clickable(\n                                onClick = {\n                                    Actions.instance.openPlatform(\n                                        \"com.jio.media.jiobeats\",\n                                        \"https://www.jiosaavn.com/\"\n                                    )\n                                }\n                            )\n                        )\n                        Spacer(modifier = modifier.padding(start = 16.dp))\n                        Icon(\n                            YoutubeLogo(),\n                            \"${Strings.open()} Youtube\",\n                            tint = Color.Unspecified,\n                            modifier = Modifier.clip(SpotiFlyerShapes.small).clickable(\n                                onClick = {\n                                    Actions.instance.openPlatform(\n                                        \"com.google.android.youtube\",\n                                        \"https://m.youtube.com\"\n                                    )\n                                }\n                            )\n                        )\n                        Spacer(modifier = modifier.padding(start = 12.dp))\n                        Icon(\n                            YoutubeMusicLogo(),\n                            \"${Strings.open()} Youtube Music\",\n                            tint = Color.Unspecified,\n                            modifier = Modifier.clip(SpotiFlyerShapes.small).clickable(\n                                onClick = {\n                                    Actions.instance.openPlatform(\n                                        \"com.google.android.apps.youtube.music\",\n                                        \"https://music.youtube.com/\"\n                                    )\n                                }\n                            )\n                        )\n                    }\n                    Spacer(modifier = Modifier.padding(top = 8.dp))\n                    Row(\n                        horizontalArrangement = Arrangement.Center,\n                        modifier = modifier.fillMaxWidth()\n                    ) {\n                        Icon(\n                            SoundCloudLogo(),\n                            \"${Strings.open()} Sound Cloud\",\n                            tint = Color.Unspecified,\n                            modifier = Modifier.clip(SpotiFlyerShapes.medium).clickable(\n                                onClick = {\n                                    Actions.instance.openPlatform(\n                                        \"com.soundcloud.android\",\n                                        \"https://soundcloud.com/\"\n                                    )\n                                }\n                            )\n                        )\n                    }\n                }\n            }\n            Spacer(modifier = Modifier.padding(top = 8.dp))\n            Card(\n                modifier = modifier.fillMaxWidth(),\n                border = BorderStroke(1.dp, Color.Gray) // Gray\n            ) {\n                Column(modifier.padding(12.dp)) {\n                    Text(\n                        text = Strings.supportDevelopment(),\n                        style = SpotiFlyerTypography.body1,\n                        color = colorAccent\n                    )\n                    Spacer(modifier = Modifier.padding(top = 6.dp))\n                    Row(\n                        verticalAlignment = Alignment.CenterVertically,\n                        modifier = Modifier.fillMaxWidth().clickable(\n                            onClick = {\n                                Actions.instance.openPlatform(\n                                    \"\",\n                                    \"https://github.com/Shabinder/SpotiFlyer\"\n                                )\n                            }\n                        )\n                            .padding(vertical = 6.dp)\n                    ) {\n                        Icon(\n                            GithubLogo(),\n                            Strings.openProjectRepo(),\n                            Modifier.size(32.dp),\n                            tint = Color(0xFFCCCCCC)\n                        )\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n                        Column {\n                            Text(\n                                text = \"GitHub\",\n                                style = SpotiFlyerTypography.h6\n                            )\n                            Text(\n                                text = Strings.starOrForkProject(),\n                                style = SpotiFlyerTypography.subtitle2\n                            )\n                        }\n                    }\n                    Row(\n                        modifier = modifier.fillMaxWidth().padding(vertical = 6.dp)\n                            .clickable(onClick = {\n                                Actions.instance.openPlatform(\n                                    \"\",\n                                    \"https://github.com/Shabinder/SpotiFlyer/blob/main/CONTRIBUTING.md\"\n                                )\n                            }),\n                        verticalAlignment = Alignment.CenterVertically\n                    ) {\n                        Icon(\n                            Icons.Rounded.Flag,\n                            Strings.help() + Strings.translate(),\n                            Modifier.size(32.dp)\n                        )\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n                        Column {\n                            Text(\n                                text = Strings.translate(),\n                                style = SpotiFlyerTypography.h6\n                            )\n                            Text(\n                                text = Strings.helpTranslateDescription(),\n                                style = SpotiFlyerTypography.subtitle2\n                            )\n                        }\n                    }\n\n                    Row(\n                        modifier = modifier.fillMaxWidth().padding(vertical = 6.dp)\n                            .clickable(onClick = openDonationDialog),\n                        verticalAlignment = Alignment.CenterVertically\n                    ) {\n                        Icon(\n                            Icons.Rounded.CardGiftcard,\n                            Strings.supportDeveloper(),\n                            Modifier.size(32.dp)\n                        )\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n                        Column {\n                            Text(\n                                text = Strings.donate(),\n                                style = SpotiFlyerTypography.h6\n                            )\n                            Text(\n                                text = Strings.donateDescription(),\n                                // text = \"SpotiFlyer will always be, Free and Open-Source. You can however show us that you care by sending a small donation.\",\n                                style = SpotiFlyerTypography.subtitle2\n                            )\n                        }\n                    }\n                    Row(\n                        modifier = modifier.fillMaxWidth().padding(vertical = 6.dp)\n                            .clickable(\n                                onClick = {\n                                    Actions.instance.shareApp()\n                                }\n                            ),\n                        verticalAlignment = Alignment.CenterVertically\n                    ) {\n                        Icon(\n                            Icons.Rounded.Share,\n                            Strings.share() + Strings.title() + \"App\",\n                            Modifier.size(32.dp)\n                        )\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n                        Column {\n                            Text(\n                                text = Strings.share(),\n                                style = SpotiFlyerTypography.h6\n                            )\n                            Text(\n                                text = Strings.shareDescription(),\n                                style = SpotiFlyerTypography.subtitle2\n                            )\n                        }\n                    }\n                    Row(\n                        modifier = modifier.fillMaxWidth().padding(vertical = 6.dp)\n                            .clickable(\n                                onClick = {\n                                    toggleAnalytics(!analyticsEnabled)\n                                }\n                            ),\n                        verticalAlignment = Alignment.CenterVertically\n                    ) {\n                        Icon(\n                            Icons.Rounded.Insights,\n                            Strings.analytics() + Strings.status(),\n                            Modifier.size(32.dp)\n                        )\n                        Spacer(modifier = Modifier.padding(start = 16.dp))\n                        Column(\n                            Modifier.weight(1f)\n                        ) {\n                            Text(\n                                text = Strings.analytics(),\n                                style = SpotiFlyerTypography.h6\n                            )\n                            Text(\n                                text = Strings.analyticsDescription(),\n                                style = SpotiFlyerTypography.subtitle2\n                            )\n                        }\n                        Switch(\n                            checked = analyticsEnabled,\n                            onCheckedChange = null,\n                            colors = SwitchDefaults.colors(uncheckedThumbColor = colorOffWhite)\n                        )\n                    }\n                }\n            }\n        }\n\n        VerticalScrollbar(\n            modifier = Modifier.padding(end = 2.dp).align(Alignment.CenterEnd).fillMaxHeight(),\n            adapter = rememberScrollbarAdapter(stateVertical)\n        )\n    }\n}\n\n@Composable\nfun HistoryColumn(\n    list: List<DownloadRecord>,\n    loadImage: suspend (String) -> Picture,\n    onItemClicked: (String) -> Unit\n) {\n    Crossfade(list) {\n        if (it.isEmpty()) {\n            Column(\n                Modifier.padding(8.dp).fillMaxSize(),\n                verticalArrangement = Arrangement.Center,\n                horizontalAlignment = Alignment.CenterHorizontally\n            ) {\n                Icon(\n                    Icons.Outlined.Info,\n                    Strings.noHistoryAvailable(),\n                    modifier = Modifier.size(80.dp),\n                    colorOffWhite\n                )\n                Text(\n                    Strings.noHistoryAvailable(),\n                    style = SpotiFlyerTypography.h4.copy(fontWeight = FontWeight.Light),\n                    textAlign = TextAlign.Center\n                )\n            }\n        } else {\n            Box {\n\n                val listState = rememberLazyListState()\n                val itemList = it.distinctBy { record -> record.coverUrl }\n\n                LazyColumn(\n                    verticalArrangement = Arrangement.spacedBy(12.dp),\n                    content = {\n                        items(itemList) { record ->\n                            DownloadRecordItem(\n                                item = record,\n                                loadImage,\n                                onItemClicked\n                            )\n                        }\n                    },\n                    state = listState,\n                    modifier = Modifier.padding(top = 8.dp).fillMaxSize()\n                )\n\n                /*VerticalScrollbar(\n                    modifier = Modifier.padding(end = 2.dp).align(Alignment.CenterEnd).fillMaxHeight(),\n                    adapter = rememberScrollbarAdapter(\n                        scrollState = listState,\n                        itemCount = itemList.size,\n                        averageItemSize = 70.dp\n                    )\n                )*/\n            }\n        }\n    }\n}\n\n@Composable\nfun DownloadRecordItem(\n    item: DownloadRecord,\n    loadImage: suspend (String) -> Picture,\n    onItemClicked: (String) -> Unit\n) {\n    Row(\n        verticalAlignment = Alignment.CenterVertically,\n        modifier = Modifier.fillMaxWidth().padding(end = 8.dp)\n    ) {\n        ImageLoad(\n            item.coverUrl,\n            { loadImage(item.coverUrl) },\n            Strings.albumArt(),\n            modifier = Modifier.height(70.dp).width(70.dp).clip(SpotiFlyerShapes.medium)\n        )\n        Column(\n            modifier = Modifier.padding(horizontal = 8.dp).height(60.dp).weight(1f),\n            verticalArrangement = Arrangement.SpaceEvenly\n        ) {\n            Text(\n                item.name,\n                maxLines = 1,\n                overflow = TextOverflow.Ellipsis,\n                style = SpotiFlyerTypography.h6,\n                color = colorAccent\n            )\n            Row(\n                horizontalArrangement = Arrangement.SpaceBetween,\n                verticalAlignment = Alignment.Bottom,\n                modifier = Modifier.padding(horizontal = 8.dp).fillMaxSize()\n            ) {\n                Text(item.type, fontSize = 13.sp, color = colorOffWhite)\n                Text(\n                    \"${Strings.tracks()}: ${item.totalFiles}\",\n                    fontSize = 13.sp,\n                    color = colorOffWhite\n                )\n            }\n        }\n        Image(\n            ShareImage(),\n            Strings.reSearch(),\n            modifier = Modifier.clickable(\n                onClick = {\n                    // if(!isOnline(ctx)) showDialog(\"Check Your Internet Connection\") else\n                    onItemClicked(item.link)\n                }\n            )\n        )\n    }\n}\n\n@Composable\nfun HomeCategoryTabIndicator(\n    modifier: Modifier = Modifier,\n    color: Color = MaterialTheme.colors.onSurface\n) {\n    Spacer(\n        modifier.padding(horizontal = 24.dp)\n            .height(3.dp)\n            .background(color, RoundedCornerShape(topStartPercent = 100, topEndPercent = 100))\n    )\n}\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/screens/SpotiFlyerPreferenceUi.kt",
    "content": "package com.shabinder.common.uikit.screens\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.foundation.BorderStroke\nimport androidx.compose.foundation.background\nimport androidx.compose.foundation.clickable\nimport androidx.compose.foundation.layout.Arrangement\nimport androidx.compose.foundation.layout.Column\nimport androidx.compose.foundation.layout.ColumnScope\nimport androidx.compose.foundation.layout.Row\nimport androidx.compose.foundation.layout.RowScope\nimport androidx.compose.foundation.layout.Spacer\nimport androidx.compose.foundation.layout.fillMaxSize\nimport androidx.compose.foundation.layout.fillMaxWidth\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.foundation.layout.size\nimport androidx.compose.foundation.layout.wrapContentWidth\nimport androidx.compose.foundation.rememberScrollState\nimport androidx.compose.foundation.selection.selectable\nimport androidx.compose.foundation.verticalScroll\nimport androidx.compose.material.Card\nimport androidx.compose.material.Icon\nimport androidx.compose.material.RadioButton\nimport androidx.compose.material.Switch\nimport androidx.compose.material.SwitchDefaults\nimport androidx.compose.material.Text\nimport androidx.compose.material.TextButton\nimport androidx.compose.material.TextField\nimport androidx.compose.material.icons.Icons\nimport androidx.compose.material.icons.rounded.Edit\nimport androidx.compose.material.icons.rounded.Insights\nimport androidx.compose.material.icons.rounded.ManageAccounts\nimport androidx.compose.material.icons.rounded.MusicNote\nimport androidx.compose.material.icons.rounded.SnippetFolder\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.remember\nimport androidx.compose.runtime.setValue\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.graphics.painter.Painter\nimport androidx.compose.ui.graphics.vector.rememberVectorPainter\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.unit.sp\nimport com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.spotify.SpotifyCredentials\nimport com.shabinder.common.preference.SpotiFlyerPreference\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.configurations.SpotiFlyerShapes\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.colorAccent\nimport com.shabinder.common.uikit.configurations.colorOffWhite\nimport com.shabinder.common.uikit.configurations.colorPrimary\n\n@Composable\nfun SpotiFlyerPreferenceContent(component: SpotiFlyerPreference) {\n    val model by component.model.subscribeAsState()\n\n    val stateVertical = rememberScrollState(0)\n\n    Column(Modifier.fillMaxSize().padding(8.dp).verticalScroll(stateVertical)) {\n        Spacer(Modifier.padding(top = 16.dp))\n        Card(\n            modifier = Modifier.fillMaxWidth(),\n            border = BorderStroke(1.dp, Color.Gray)\n        ) {\n            Column(Modifier.padding(12.dp)) {\n                Text(\n                    text = Strings.preferences(),\n                    style = SpotiFlyerTypography.body1,\n                    color = colorAccent\n                )\n                Spacer(modifier = Modifier.padding(top = 12.dp))\n\n                SettingsRow(\n                    icon = rememberVectorPainter(Icons.Rounded.MusicNote),\n                    title = \"Preferred Audio Quality\",\n                    value = model.preferredQuality.kbps + \"KBPS\"\n                ) { save ->\n                    val audioQualities = AudioQuality.values().toMutableList().apply {\n                        remove(AudioQuality.UNKNOWN)\n                    }\n\n                    audioQualities.forEach { quality ->\n                        Row(\n                            Modifier\n                                .fillMaxWidth()\n                                .selectable(\n                                    selected = (quality == model.preferredQuality),\n                                    onClick = {\n                                        component.setPreferredQuality(quality)\n                                        save()\n                                    }\n                                )\n                                .padding(horizontal = 16.dp, vertical = 2.dp)\n                        ) {\n                            RadioButton(\n                                selected = (quality == model.preferredQuality),\n                                onClick = {\n                                    component.setPreferredQuality(quality)\n                                    save()\n                                }\n                            )\n                            Text(\n                                text = quality.kbps + \" KBPS\",\n                                style = SpotiFlyerTypography.h6,\n                                modifier = Modifier.padding(start = 16.dp)\n                            )\n                        }\n                    }\n                }\n\n                Spacer(Modifier.padding(top = 12.dp))\n\n                Row(\n                    verticalAlignment = Alignment.CenterVertically,\n                    modifier = Modifier.fillMaxWidth().clickable(\n                        onClick = { component.selectNewDownloadDirectory() }\n                    )\n                ) {\n                    Icon(\n                        Icons.Rounded.SnippetFolder,\n                        Strings.setDownloadDirectory(),\n                        Modifier.size(32.dp),\n                        tint = Color(0xFFCCCCCC)\n                    )\n                    Spacer(modifier = Modifier.padding(start = 16.dp))\n                    Column {\n                        Text(\n                            text = Strings.setDownloadDirectory(),\n                            style = SpotiFlyerTypography.h6\n                        )\n                        Text(\n                            text = model.downloadPath,\n                            style = SpotiFlyerTypography.subtitle2\n                        )\n                    }\n                }\n\n                Spacer(Modifier.padding(top = 12.dp))\n\n                SettingsRow(\n                    icon = rememberVectorPainter(Icons.Rounded.ManageAccounts),\n                    title = Strings.spotifyCreds(),\n                    value = if (model.spotifyCredentials == SpotifyCredentials()) Strings.defaultString() else Strings.userSet(),\n                    contentEnd = {\n                        Spacer(Modifier.weight(1f))\n                        Icon(\n                            Icons.Rounded.Edit,\n                            \"Edit\",\n                            Modifier.padding(end = 8.dp).size(24.dp),\n                            tint = Color(0xFFCCCCCC)\n                        )\n                    }\n                ) { save ->\n                    Spacer(Modifier.padding(top = 8.dp))\n\n                    var clientID by remember { mutableStateOf(model.spotifyCredentials.clientID) }\n                    var clientSecret by remember { mutableStateOf(model.spotifyCredentials.clientSecret) }\n                    TextField(\n                        value = clientID,\n                        onValueChange = { clientID = it.trim() },\n                        label = { Text(Strings.clientID()) },\n                        modifier = Modifier.fillMaxWidth()\n                    )\n                    Spacer(Modifier.padding(vertical = 4.dp))\n\n                    TextField(\n                        value = clientSecret,\n                        onValueChange = { clientSecret = it.trim() },\n                        label = { Text(Strings.clientSecret()) },\n                        modifier = Modifier.fillMaxWidth()\n                    )\n\n                    Spacer(Modifier.padding(vertical = 4.dp))\n\n                    Row(\n                        modifier = Modifier.fillMaxWidth(),\n                        horizontalArrangement = Arrangement.SpaceEvenly\n                    ) {\n                        TextButton(\n                            onClick = {\n                                component.updateSpotifyCredentials(\n                                    SpotifyCredentials(\n                                        clientID,\n                                        clientSecret\n                                    )\n                                )\n                                Actions.instance.showPopUpMessage(Strings.requestAppRestart())\n                                save()\n                            },\n                            Modifier.padding(bottom = 8.dp, start = 8.dp, end = 8.dp).wrapContentWidth()\n                                .background(colorPrimary, shape = SpotiFlyerShapes.medium)\n                                .padding(horizontal = 4.dp),\n                            shape = SpotiFlyerShapes.small\n                        ) {\n                            Text(\n                                Strings.save(),\n                                color = Color.Black,\n                                fontSize = 16.sp,\n                                textAlign = TextAlign.Center\n                            )\n                        }\n\n                        TextButton(\n                            onClick = {\n                                component.updateSpotifyCredentials(\n                                    SpotifyCredentials()\n                                )\n                                Actions.instance.showPopUpMessage(Strings.requestAppRestart())\n                                save()\n                            },\n                            Modifier.padding(bottom = 8.dp, start = 8.dp, end = 8.dp).wrapContentWidth()\n                                .background(colorPrimary, shape = SpotiFlyerShapes.medium)\n                                .padding(horizontal = 4.dp),\n                            shape = SpotiFlyerShapes.small\n                        ) {\n                            Text(\n                                Strings.reset(),\n                                color = Color.Black,\n                                fontSize = 16.sp,\n                                textAlign = TextAlign.Center\n                            )\n                        }\n                    }\n                }\n\n                Spacer(Modifier.padding(top = 4.dp))\n\n                Row(\n                    modifier = Modifier.fillMaxWidth()\n                        .clickable(\n                            onClick = { component.toggleAnalytics(!model.isAnalyticsEnabled) }\n                        ),\n                    verticalAlignment = Alignment.CenterVertically\n                ) {\n                    @Suppress(\"DuplicatedCode\")\n                    Icon(\n                        Icons.Rounded.Insights,\n                        Strings.analytics() + Strings.status(),\n                        Modifier.size(32.dp)\n                    )\n                    Spacer(modifier = Modifier.padding(start = 16.dp))\n                    Column(\n                        Modifier.weight(1f)\n                    ) {\n                        Text(\n                            text = Strings.analytics(),\n                            style = SpotiFlyerTypography.h6\n                        )\n                        Text(\n                            text = Strings.analyticsDescription(),\n                            style = SpotiFlyerTypography.subtitle2\n                        )\n                    }\n                    Switch(\n                        checked = model.isAnalyticsEnabled,\n                        onCheckedChange = null,\n                        colors = SwitchDefaults.colors(uncheckedThumbColor = colorOffWhite)\n                    )\n                }\n            }\n        }\n        Spacer(modifier = Modifier.padding(top = 8.dp))\n    }\n}\n\n@OptIn(ExperimentalAnimationApi::class)\n@Composable\nfun SettingsRow(\n    icon: Painter,\n    title: String,\n    value: String,\n    contentEnd: @Composable RowScope.() -> Unit = {},\n    editContent: @Composable ColumnScope.(() -> Unit) -> Unit\n) {\n\n    var isEditMode by remember { mutableStateOf(false) }\n    Column {\n        Row(\n            verticalAlignment = Alignment.CenterVertically,\n            modifier = Modifier.fillMaxWidth().clickable(\n                onClick = { isEditMode = !isEditMode }\n            ).padding(vertical = 6.dp)\n        ) {\n            Icon(icon, title, Modifier.size(32.dp), tint = Color(0xFFCCCCCC))\n            Spacer(modifier = Modifier.padding(start = 16.dp))\n            Column {\n                Text(\n                    text = title,\n                    style = SpotiFlyerTypography.h6\n                )\n                Text(\n                    text = value,\n                    style = SpotiFlyerTypography.subtitle2\n                )\n            }\n            contentEnd()\n        }\n        AnimatedVisibility(isEditMode) {\n            Column {\n                editContent {\n                    isEditMode = false\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/screens/SpotiFlyerRootUi.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n@file:Suppress(\"EXPERIMENTAL_API_USAGE\")\n\npackage com.shabinder.common.uikit.screens\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.animation.core.MutableTransitionState\nimport androidx.compose.animation.core.Spring.StiffnessLow\nimport androidx.compose.animation.core.animateDp\nimport androidx.compose.animation.core.animateFloat\nimport androidx.compose.animation.core.spring\nimport androidx.compose.animation.core.tween\nimport androidx.compose.animation.core.updateTransition\nimport androidx.compose.foundation.Image\nimport androidx.compose.foundation.clickable\nimport androidx.compose.foundation.layout.*\nimport androidx.compose.material.Icon\nimport androidx.compose.material.IconButton\nimport androidx.compose.material.MaterialTheme\nimport androidx.compose.material.Text\nimport androidx.compose.material.TopAppBar\nimport androidx.compose.material.icons.Icons\nimport androidx.compose.material.icons.filled.Settings\nimport androidx.compose.material.icons.rounded.ArrowBackIosNew\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.remember\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.draw.alpha\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.layout.ContentScale\nimport androidx.compose.ui.unit.Dp\nimport androidx.compose.ui.unit.dp\nimport com.arkivanov.decompose.extensions.compose.jetbrains.Children\nimport com.arkivanov.decompose.extensions.compose.jetbrains.animation.child.crossfadeScale\nimport com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState\nimport com.shabinder.common.root.SpotiFlyerRoot\nimport com.shabinder.common.root.SpotiFlyerRoot.Child\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.SpotiFlyerLogo\nimport com.shabinder.common.uikit.Toast\nimport com.shabinder.common.uikit.ToastDuration\nimport com.shabinder.common.uikit.configurations.appNameStyle\nimport com.shabinder.common.uikit.configurations.colorPrimaryDark\nimport com.shabinder.common.uikit.screens.splash.Splash\nimport com.shabinder.common.uikit.screens.splash.SplashState\nimport com.shabinder.common.uikit.utils.verticalGradientScrim\n\n// Splash Status\nprivate var isSplashShown = SplashState.Show\n\n@Composable\nfun SpotiFlyerRootContent(\n    component: SpotiFlyerRoot,\n    modifier: Modifier = Modifier,\n    showSplash: Boolean = true\n): SpotiFlyerRoot {\n    isSplashShown = if (showSplash) SplashState.Show else SplashState.Completed\n    val transitionState = remember { MutableTransitionState(isSplashShown) }\n    val transition = updateTransition(transitionState, label = \"transition\")\n\n    val splashAlpha by transition.animateFloat(\n        transitionSpec = { tween(durationMillis = 100) }, label = \"Splash-Alpha\"\n    ) {\n        if (it == SplashState.Show && isSplashShown == SplashState.Show) 1f else 0f\n    }\n    val contentAlpha by transition.animateFloat(\n        transitionSpec = { tween(durationMillis = 300) }, label = \"Content-Alpha\"\n    ) {\n        if (it == SplashState.Show && isSplashShown == SplashState.Show) 0f else 1f\n    }\n    val contentTopPadding by transition.animateDp(\n        transitionSpec = { spring(stiffness = StiffnessLow) }, label = \"Content-Padding\"\n    ) {\n        if (it == SplashState.Show && isSplashShown == SplashState.Show) 100.dp else 0.dp\n    }\n\n    Box {\n        Splash(\n            modifier = modifier.alpha(splashAlpha),\n            onTimeout = {\n                transitionState.targetState = SplashState.Completed\n                isSplashShown = SplashState.Completed\n            }\n        )\n        MainScreen(\n            modifier,\n            contentAlpha,\n            contentTopPadding,\n            component\n        )\n        Toast(\n            flow = component.toastState,\n            duration = ToastDuration.Long\n        )\n    }\n    return component\n}\n\n@Composable\nfun MainScreen(\n    modifier: Modifier = Modifier,\n    alpha: Float,\n    topPadding: Dp = 0.dp,\n    component: SpotiFlyerRoot\n) {\n\n    val appBarColor = MaterialTheme.colors.surface.copy(alpha = 0.65f)\n\n    Column(\n        modifier = Modifier.fillMaxSize()\n            .alpha(alpha)\n            .verticalGradientScrim(\n                color = colorPrimaryDark.copy(alpha = 0.38f),\n                startYPercentage = 0.29f,\n                endYPercentage = 0f,\n            ).then(modifier)\n    ) {\n\n        val activeComponent = component.routerState.subscribeAsState()\n        val callBacks = component.callBacks\n        AppBar(\n            backgroundColor = appBarColor,\n            onBackPressed = callBacks::popBackToHomeScreen,\n            openPreferenceScreen = callBacks::openPreferenceScreen,\n            isBackButtonVisible = activeComponent.value.activeChild.instance !is Child.Main,\n            isSettingsIconVisible = activeComponent.value.activeChild.instance is Child.Main,\n            modifier = Modifier.fillMaxWidth()\n        )\n        Spacer(Modifier.padding(top = topPadding))\n        Children(\n            routerState = component.routerState,\n            animation = crossfadeScale()\n        ) {\n            when (val child = it.instance) {\n                is Child.Main -> SpotiFlyerMainContent(component = child.component)\n                is Child.List -> SpotiFlyerListContent(component = child.component)\n                is Child.Preference -> SpotiFlyerPreferenceContent(component = child.component)\n            }\n        }\n    }\n}\n\n@OptIn(ExperimentalAnimationApi::class)\n@Composable\nfun AppBar(\n    backgroundColor: Color,\n    onBackPressed: () -> Unit,\n    openPreferenceScreen: () -> Unit,\n    isBackButtonVisible: Boolean,\n    isSettingsIconVisible: Boolean,\n    modifier: Modifier = Modifier\n) {\n    TopAppBar(\n        backgroundColor = backgroundColor,\n        title = {\n            Row(verticalAlignment = Alignment.CenterVertically) {\n                AnimatedVisibility(isBackButtonVisible) {\n                    Icon(\n                        Icons.Rounded.ArrowBackIosNew,\n                        contentDescription = Strings.backButton(),\n                        modifier = Modifier.clickable { onBackPressed() },\n                        tint = Color.LightGray\n                    )\n                    Spacer(Modifier.padding(horizontal = 4.dp))\n                }\n                Image(\n                    SpotiFlyerLogo(),\n                    Strings.spotiflyerLogo(),\n                    Modifier.requiredHeight(66.dp).requiredWidth(42.dp),\n                    contentScale = ContentScale.FillHeight\n                )\n                Spacer(Modifier.padding(horizontal = 4.dp))\n                Text(\n                    text = Strings.title(),\n                    style = appNameStyle\n                )\n            }\n        },\n        actions = {\n            AnimatedVisibility(isSettingsIconVisible) {\n                IconButton(\n                    onClick = { openPreferenceScreen() }\n                ) {\n                    Icon(Icons.Filled.Settings, Strings.preferences(), tint = Color.Gray)\n                }\n            }\n        },\n        modifier = modifier,\n        elevation = 0.dp\n    )\n}\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/screens/splash/Splash.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit.screens.splash\n\nimport androidx.compose.foundation.Image\nimport androidx.compose.foundation.layout.*\nimport androidx.compose.material.Icon\nimport androidx.compose.material.Text\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.LaunchedEffect\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.rememberUpdatedState\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.unit.sp\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.HeartIcon\nimport com.shabinder.common.uikit.SpotiFlyerLogo\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.colorAccent\nimport com.shabinder.common.uikit.configurations.colorPrimary\nimport kotlinx.coroutines.delay\n\nprivate const val SplashWaitTime: Long = 2000\nenum class SplashState { Show, Completed }\n\n@Composable\nfun Splash(modifier: Modifier = Modifier, onTimeout: () -> Unit) {\n    Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) {\n        // Adds composition consistency. Use the value when LaunchedEffect is first called\n        val currentOnTimeout by rememberUpdatedState(onTimeout)\n\n        LaunchedEffect(Unit) {\n            delay(SplashWaitTime)\n            currentOnTimeout()\n        }\n\n        Image(SpotiFlyerLogo(), Strings.spotiflyerLogo(),modifier = Modifier.fillMaxSize())\n        MadeInIndia(Modifier.align(Alignment.BottomCenter))\n    }\n}\n\n@Composable\nfun MadeInIndia(\n    modifier: Modifier = Modifier\n) {\n    Column(\n        horizontalAlignment = Alignment.CenterHorizontally,\n        modifier = modifier.padding(8.dp)\n    ) {\n        Row(\n            horizontalArrangement = Arrangement.Center,\n            verticalAlignment = Alignment.CenterVertically,\n        ) {\n            Text(\n                text = \"${Strings.madeWith()} \",\n                color = colorPrimary,\n                fontSize = 22.sp\n            )\n            Spacer(modifier = Modifier.padding(start = 4.dp))\n            Icon(HeartIcon(), Strings.love(), tint = Color.Unspecified)\n            Spacer(modifier = Modifier.padding(start = 4.dp))\n            Text(\n                text = \" ${Strings.inIndia()}\",\n                color = colorPrimary,\n                fontSize = 22.sp\n            )\n        }\n        Text(\n            Strings.byDeveloperName(),\n            style = SpotiFlyerTypography.h6,\n            color = colorAccent,\n            fontSize = 14.sp\n        )\n    }\n}\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/utils/Colors.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit.utils\n\n/*\n\nfun Color.contrastAgainst(background: Color): Float {\n    val fg = if (alpha < 1f) compositeOver(background) else this\n\n    val fgLuminance = fg.luminance() + 0.05f\n    val bgLuminance = background.luminance() + 0.05f\n\n    return max(fgLuminance, bgLuminance) / min(fgLuminance, bgLuminance)\n}\n*/\n"
  },
  {
    "path": "common/compose/src/commonMain/kotlin/com/shabinder/common/uikit/utils/GradientScrim.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit.utils\n\nimport androidx.compose.animation.core.animateFloatAsState\nimport androidx.compose.animation.core.tween\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.remember\nimport androidx.compose.runtime.setValue\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.composed\nimport androidx.compose.ui.draw.drawBehind\nimport androidx.compose.ui.graphics.Brush\nimport androidx.compose.ui.graphics.Color\nimport kotlin.math.pow\n\n/**\n * Draws a vertical gradient scrim in the foreground.\n *\n * @param color The color of the gradient scrim.\n * @param startYPercentage The start y value, in percentage of the layout's height (0f to 1f)\n * @param endYPercentage The end y value, in percentage of the layout's height (0f to 1f)\n * @param decay The exponential decay to apply to the gradient. Defaults to `1.0f` which is\n * a linear gradient.\n * @param numStops The number of color stops to draw in the gradient. Higher numbers result in\n * the higher visual quality at the cost of draw performance. Defaults to `16`.\n */\nfun Modifier.verticalGradientScrim(\n    color: Color,\n    /*@FloatRange(from = 0.0, to = 1.0)*/\n    startYPercentage: Float = 0f,\n    /*@FloatRange(from = 0.0, to = 1.0)*/\n    endYPercentage: Float = 1f,\n    decay: Float = 1.0f,\n    numStops: Int = 16,\n    fixedHeight: Float? = null\n): Modifier = composed {\n    val colors = remember(color, numStops) {\n        if (decay != 1f) {\n            // If we have a non-linear decay, we need to create the color gradient steps\n            // manually\n            val baseAlpha = color.alpha\n            List(numStops) { i ->\n                val x = i * 1f / (numStops - 1)\n                val opacity = x.pow(decay)\n                color.copy(alpha = baseAlpha * opacity)\n            }\n        } else {\n            // If we have a linear decay, we just create a simple list of start + end colors\n            listOf(color.copy(alpha = 0f), color)\n        }\n    }\n    var height by remember { mutableStateOf(fixedHeight ?: 1f) }\n    val scrimHeight by animateFloatAsState(\n        // Whenever the target value changes, new animation\n        // will start to the new target value\n        targetValue = height,\n        animationSpec = tween(durationMillis = 1500)\n    )\n    val brush = remember(color, numStops, startYPercentage, endYPercentage, scrimHeight) {\n        Brush.verticalGradient(\n            colors = colors,\n            startY = scrimHeight * startYPercentage,\n            endY = scrimHeight * endYPercentage\n        )\n    }\n\n    drawBehind {\n        height = fixedHeight ?: size.height\n        drawRect(brush = brush)\n    }\n}\n"
  },
  {
    "path": "common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/DesktopDialog.kt",
    "content": "package com.shabinder.common.uikit\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.graphics.painter.BitmapPainter\nimport androidx.compose.ui.res.loadImageBitmap\nimport androidx.compose.ui.res.useResource\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.window.DialogState\n\n@OptIn(ExperimentalAnimationApi::class)\n@Composable\nactual fun Dialog(\n    isVisible: Boolean,\n    onDismiss: () -> Unit,\n    content: @Composable () -> Unit\n) {\n    AnimatedVisibility(isVisible) {\n        androidx.compose.ui.window.Dialog(\n            onDismiss,\n            state = DialogState(width = 350.dp, height = 340.dp),\n            title = \"SpotiFlyer\",\n            icon = BitmapPainter(useResource(\"drawable/spotiflyer.png\", ::loadImageBitmap))\n        ) {\n            content()\n        }\n    }\n}\n"
  },
  {
    "path": "common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/DesktopImageLoad.kt",
    "content": "package com.shabinder.common.uikit\n\nimport androidx.compose.animation.Crossfade\nimport androidx.compose.foundation.Image\nimport androidx.compose.runtime.*\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.ImageBitmap\nimport androidx.compose.ui.layout.ContentScale\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.models.dispatcherIO\nimport kotlinx.coroutines.withContext\n\n@Composable\nactual fun ImageLoad(\n    link: String,\n    loader: suspend () -> Picture,\n    desc: String,\n    modifier: Modifier\n    // placeholder: ImageVector\n) {\n    var pic by remember(link) { mutableStateOf<ImageBitmap?>(null) }\n    LaunchedEffect(link) {\n        withContext(dispatcherIO) {\n            pic = loader().image\n        }\n    }\n\n    Crossfade(pic) {\n        if (it == null) Image(PlaceHolderImage(), desc, modifier, contentScale = ContentScale.Crop) else Image(\n            it,\n            desc,\n            modifier,\n            contentScale = ContentScale.Crop\n        )\n    }\n}\n"
  },
  {
    "path": "common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/DesktopImages.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n@file:Suppress(\"FunctionName\")\n\npackage com.shabinder.common.uikit\n\nimport androidx.compose.foundation.Image\nimport androidx.compose.runtime.Composable\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.vector.ImageVector\nimport androidx.compose.ui.platform.LocalDensity\nimport androidx.compose.ui.res.loadXmlImageVector\nimport androidx.compose.ui.res.useResource\nimport org.xml.sax.InputSource\n\n@Composable\ninternal actual fun <T> imageVectorResource(id: T): ImageVector {\n    val density = LocalDensity.current\n    return useResource(id as String) {\n        loadXmlImageVector(InputSource(it), density)\n    }\n}\n\n@Composable\nactual fun DownloadImageTick() {\n    Image(\n        getCachedPainter(\"drawable/ic_tick.xml\"),\n        \"Downloaded\"\n    )\n}\n\n@Composable\nactual fun DownloadImageError(modifier: Modifier) {\n    Image(\n        getCachedPainter(\"drawable/ic_error.xml\"),\n        \"Can't Download\",\n        modifier = modifier\n    )\n}\n\n@Composable\nactual fun DownloadImageArrow(modifier: Modifier) {\n    Image(\n        getCachedPainter(\"drawable/ic_arrow.xml\"),\n        \"Download\",\n        modifier\n    )\n}\n\n@Composable\nactual fun DownloadAllImage() = getCachedPainter(\"drawable/ic_download_arrow.xml\")\n\n\n@Composable\nactual fun ShareImage() = getCachedPainter(\"drawable/ic_share_open.xml\")\n\n@Composable\nactual fun PlaceHolderImage() = getCachedPainter(\"drawable/music.xml\")\n\n@Composable\nactual fun SpotiFlyerLogo() = getCachedPainter(\"drawable/ic_spotiflyer_logo.xml\")\n\n@Composable\nactual fun HeartIcon() =\n    getCachedPainter(\"drawable/ic_heart.xml\")\n\n@Composable\nactual fun SpotifyLogo() =\n    getCachedPainter(\"drawable/ic_spotify_logo.xml\")\n\n@Composable\nactual fun SoundboundLogo() =\n    getCachedPainter(\"drawable/soundbound_app_logo.xml\")\n\n@Composable\nactual fun SaavnLogo() =\n    getCachedPainter(\"drawable/ic_jio_saavn_logo.xml\")\n\n@Composable\nactual fun SoundCloudLogo() =\n    getCachedPainter(\"drawable/ic_soundcloud.xml\")\n\n@Composable\nactual fun YoutubeLogo() =\n    getCachedPainter(\"drawable/ic_youtube.xml\")\n\n@Composable\nactual fun GaanaLogo() =\n    getCachedPainter(\"drawable/ic_gaana.xml\")\n\n@Composable\nactual fun YoutubeMusicLogo() =\n    getCachedPainter(\"drawable/ic_youtube_music_logo.xml\")\n\n@Composable\nactual fun GithubLogo() =\n    getCachedPainter(\"drawable/ic_github.xml\")\n\n@Composable\nactual fun PaypalLogo() =\n    getCachedPainter(\"drawable/ic_paypal_logo.xml\")\n\n@Composable\nactual fun OpenCollectiveLogo() =\n    getCachedPainter(\"drawable/ic_opencollective_icon.xml\")\n\n@Composable\nactual fun RazorPay() =\n    getCachedPainter(\"drawable/ic_indian_rupee.xml\")\n"
  },
  {
    "path": "common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/DesktopScrollBar.kt",
    "content": "package com.shabinder.common.uikit\n\nimport androidx.compose.foundation.ExperimentalFoundationApi\nimport androidx.compose.foundation.ScrollState\nimport androidx.compose.foundation.ScrollbarAdapter\nimport androidx.compose.foundation.lazy.LazyListState\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.remember\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.unit.Dp\nimport androidx.compose.ui.unit.dp\n\nactual val MARGIN_SCROLLBAR: Dp = 8.dp\n\nactual typealias ScrollbarAdapter = ScrollbarAdapter\n\n@OptIn(ExperimentalFoundationApi::class)\n@Composable\nactual fun rememberScrollbarAdapter(\n    scrollState: LazyListState,\n    itemCount: Int,\n    averageItemSize: Dp\n): ScrollbarAdapter =\n    androidx.compose.foundation.rememberScrollbarAdapter(\n        scrollState = scrollState,\n    )\n\n@Composable\nactual fun rememberScrollbarAdapter(\n    scrollState: ScrollState\n): ScrollbarAdapter = remember(scrollState) {\n    ScrollbarAdapter(scrollState)\n}\n\n@Composable\nactual fun VerticalScrollbar(\n    modifier: Modifier,\n    adapter: ScrollbarAdapter\n) {\n    androidx.compose.foundation.VerticalScrollbar(\n        modifier = modifier,\n        adapter = adapter\n    )\n}\n"
  },
  {
    "path": "common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/DesktopToast.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.uikit\n\nimport androidx.compose.animation.AnimatedVisibility\nimport androidx.compose.animation.ExperimentalAnimationApi\nimport androidx.compose.animation.fadeIn\nimport androidx.compose.animation.fadeOut\nimport androidx.compose.animation.slideInVertically\nimport androidx.compose.animation.slideOutHorizontally\nimport androidx.compose.foundation.BorderStroke\nimport androidx.compose.foundation.layout.Box\nimport androidx.compose.foundation.layout.fillMaxSize\nimport androidx.compose.foundation.layout.padding\nimport androidx.compose.foundation.layout.sizeIn\nimport androidx.compose.foundation.shape.RoundedCornerShape\nimport androidx.compose.material.Surface\nimport androidx.compose.material.Text\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.DisposableEffect\nimport androidx.compose.runtime.collectAsState\nimport androidx.compose.ui.Alignment\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.text.style.TextAlign\nimport androidx.compose.ui.text.style.TextOverflow\nimport androidx.compose.ui.unit.dp\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.colorOffWhite\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.delay\nimport kotlinx.coroutines.flow.MutableStateFlow\nimport kotlinx.coroutines.launch\n\n@OptIn(ExperimentalAnimationApi::class)\n@Composable\nactual fun Toast(\n    flow: MutableStateFlow<String>,\n    duration: ToastDuration\n) {\n\n    val state = flow.collectAsState(\"\")\n    val message = state.value\n\n    AnimatedVisibility(\n        visible = message != \"\",\n        enter = fadeIn() + slideInVertically(initialOffsetY = { it / 4 }),\n        exit = slideOutHorizontally(targetOffsetX = { it / 4 }) + fadeOut()\n    ) {\n        Box(\n            modifier = Modifier.fillMaxSize().padding(bottom = 16.dp).padding(end = 16.dp),\n            contentAlignment = Alignment.BottomEnd\n        ) {\n            Surface(\n                modifier = Modifier.sizeIn(maxWidth = 250.dp, maxHeight = 80.dp),\n                color = Color(23, 23, 23),\n                shape = RoundedCornerShape(8.dp),\n                border = BorderStroke(1.dp, colorOffWhite)\n            ) {\n                Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {\n                    Text(\n                        text = message,\n                        color = Color(210, 210, 210),\n                        textAlign = TextAlign.Center,\n                        overflow = TextOverflow.Ellipsis,\n                        style = SpotiFlyerTypography.body2,\n                        modifier = Modifier.padding(8.dp)\n                    )\n                }\n                DisposableEffect(Unit) {\n                    GlobalScope.launch {\n                        delay(duration.value.toLong())\n                        flow.value = \"\"\n                    }\n                    onDispose { }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/configurations/DesktopTypography.kt",
    "content": "package com.shabinder.common.uikit.configurations\n\nimport androidx.compose.ui.text.font.FontFamily\nimport androidx.compose.ui.text.font.FontWeight\nimport androidx.compose.ui.text.platform.Font\n\nactual fun montserratFont() = FontFamily(\n    Font(\"font/montserrat_light.ttf\", FontWeight.Light),\n    Font(\"font/montserrat_regular.ttf\", FontWeight.Normal),\n    Font(\"font/montserrat_medium.ttf\", FontWeight.Medium),\n    Font(\"font/montserrat_semibold.ttf\", FontWeight.SemiBold),\n)\n\nactual fun pristineFont() = FontFamily(\n    Font(\"font/pristine_script.ttf\", FontWeight.Bold)\n)\n"
  },
  {
    "path": "common/core-components/build.gradle.kts",
    "content": "plugins {\n    id(\"multiplatform-setup\")\n    id(\"multiplatform-setup-test\")\n    kotlin(\"plugin.serialization\")\n}\n\nkotlin {\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(project(\":common:data-models\"))\n                implementation(project(\":common:database\"))\n                with(deps) {\n                    api(multiplatform.settings)\n                    api(kotlinx.atomicfu)\n                    implementation(mviKotlin.rx)\n                    implementation(decompose.dep)\n                }\n            }\n        }\n        androidMain {\n            dependencies {\n                with(deps) {\n                    implementation(mp3agic)\n                    implementation(countly.android)\n                }\n                implementation(project(\":ffmpeg:android-ffmpeg\"))\n            }\n        }\n        desktopMain {\n            dependencies {\n                with(deps) {\n                    implementation(mp3agic)\n                    implementation(countly.desktop)\n                    implementation(jaffree)\n                }\n            }\n        }\n        jsMain {\n            dependencies {\n                implementation(npm(\"browser-id3-writer\", \"4.4.0\"))\n                implementation(npm(\"file-saver\", \"2.0.4\"))\n                implementation(deps.kotlin.js.wrappers.ext)\n            }\n        }\n    }\n}"
  },
  {
    "path": "common/core-components/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.core_components\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n</manifest>\n"
  },
  {
    "path": "common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/AndroidNetworkObserver.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.core_components\n\nimport android.content.Context\nimport android.content.Context.CONNECTIVITY_SERVICE\nimport android.net.ConnectivityManager\nimport android.net.Network\nimport android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET\nimport android.net.NetworkRequest\nimport android.util.Log\nimport androidx.lifecycle.LiveData\nimport com.shabinder.common.core_components.utils.isInternetAccessible\nimport kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.launch\nimport kotlinx.coroutines.withContext\nimport java.lang.Exception\nimport java.net.URL\nimport javax.net.ssl.HttpsURLConnection\n\nconst val TAG = \"C-Manager\"\n\n/**\n * Save all available networks with an internet connection to a set (@validNetworks).\n * As long as the size of the set > 0, this LiveData emits true.\n * MinSdk = 21.\n *\n * Inspired by:\n * https://github.com/AlexSheva-mason/Rick-Morty-Database/blob/master/app/src/main/java/com/shevaalex/android/rickmortydatabase/utils/networking/ConnectionLiveData.kt\n */\nclass ConnectionLiveData(context: Context) : LiveData<Boolean>() {\n\n    private lateinit var networkCallback: ConnectivityManager.NetworkCallback\n    private val cm = context.getSystemService(CONNECTIVITY_SERVICE) as ConnectivityManager\n    private val validNetworks: MutableSet<Network> = HashSet()\n\n    private fun checkValidNetworks() {\n        postValue(validNetworks.size > 0)\n    }\n\n    override fun onActive() {\n        checkValidNetworks()\n        networkCallback = createNetworkCallback()\n        val networkRequest = NetworkRequest.Builder()\n            .addCapability(NET_CAPABILITY_INTERNET)\n            .build()\n        cm.registerNetworkCallback(networkRequest, networkCallback)\n    }\n\n    override fun onInactive() {\n        cm.unregisterNetworkCallback(networkCallback)\n    }\n\n    private fun createNetworkCallback() = object : ConnectivityManager.NetworkCallback() {\n\n        /*\n          Called when a network is detected. If that network has internet, save it in the Set.\n          Source: https://developer.android.com/reference/android/net/ConnectivityManager.NetworkCallback#onAvailable(android.net.Network)\n         */\n        override fun onAvailable(network: Network) {\n            Log.d(TAG, \"onAvailable: $network\")\n            val networkCapabilities = cm.getNetworkCapabilities(network)\n            val hasInternetCapability = networkCapabilities?.hasCapability(NET_CAPABILITY_INTERNET)\n            Log.d(TAG, \"onAvailable: $network, $hasInternetCapability\")\n            if (hasInternetCapability == true) {\n                // check if this network actually has internet\n                CoroutineScope(Dispatchers.IO).launch {\n                    val hasInternet = DoesNetworkHaveInternet.execute(network)\n                    if (hasInternet) {\n                        withContext(Dispatchers.Main) {\n                            Log.d(TAG, \"onAvailable: adding network. $network\")\n                            validNetworks.add(network)\n                            checkValidNetworks()\n                        }\n                    }\n                }\n            }\n        }\n\n        /*\n          If the callback was registered with registerNetworkCallback() it will be called for each network which no longer satisfies the criteria of the callback.\n          Source: https://developer.android.com/reference/android/net/ConnectivityManager.NetworkCallback#onLost(android.net.Network)\n         */\n        override fun onLost(network: Network) {\n            Log.d(TAG, \"onLost: $network\")\n            validNetworks.remove(network)\n            checkValidNetworks()\n        }\n    }\n\n    /**\n     * Try Establishing an Actual Internet Connection.\n     * If successful, that means we have internet.\n     */\n    object DoesNetworkHaveInternet {\n        suspend fun execute(network: Network): Boolean = withContext(Dispatchers.IO) {\n            try {\n                val url = URL(\"https://open.spotify.com/\")\n                val connection = network.openConnection(url) as HttpsURLConnection\n                connection.connect()\n                connection.disconnect()\n                true\n            } catch (e: Exception) {\n                e.printStackTrace()\n                // Handle VPN Connection / Google DNS Blocked Cases\n                isInternetAccessible()\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/LiveDataExt.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.di\n\nimport androidx.compose.runtime.Composable\nimport androidx.compose.runtime.DisposableEffect\nimport androidx.compose.runtime.State\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.remember\nimport androidx.compose.ui.platform.LocalLifecycleOwner\nimport androidx.lifecycle.Lifecycle\nimport androidx.lifecycle.LifecycleOwner\nimport androidx.lifecycle.LiveData\nimport androidx.lifecycle.Observer\n\n@Composable\nfun <T> LiveData<T>.observeAsState(): State<T?> = observeAsState(value)\n\n/**\n * Starts observing this [LiveData] and represents its values via [State]. Every time there would\n * be new value posted into the [LiveData] the returned [State] will be updated causing\n * recomposition of every [State.value] usage.\n *\n * The inner observer will automatically be removed when this composable disposes or the current\n * [LifecycleOwner] moves to the [Lifecycle.State.DESTROYED] state.\n *\n * @sample androidx.compose.runtime.livedata.samples.LiveDataWithInitialSample\n */\n@Composable\nfun <R, T : R> LiveData<T>.observeAsState(initial: R): State<R> {\n    val lifecycleOwner = LocalLifecycleOwner.current\n    val state = remember { mutableStateOf(initial) }\n    DisposableEffect(this, lifecycleOwner) {\n        val observer = Observer<T> { state.value = it }\n        observe(lifecycleOwner, observer)\n        onDispose { removeObserver(observer) }\n    }\n    return state\n}\n"
  },
  {
    "path": "common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/analytics/AndroidAnalyticsManager.kt",
    "content": "package com.shabinder.common.core_components.analytics\n\nimport android.app.Activity\nimport android.app.Application\nimport ly.count.android.sdk.Countly\nimport ly.count.android.sdk.CountlyConfig\nimport ly.count.android.sdk.DeviceId\nimport org.koin.dsl.bind\nimport org.koin.dsl.module\n\ninternal class AndroidAnalyticsManager(private val mainActivity: Activity) : AnalyticsManager {\n\n    companion object {\n        private var isInitialised = false\n    }\n\n    init {\n        // Don't Init If Instantiated on Diff Activities\n        if (!isInitialised) {\n            isInitialised = true\n            init()\n        }\n    }\n\n    override fun init() {\n        Countly.sharedInstance().init(\n            CountlyConfig(\n                mainActivity.applicationContext as Application,\n                COUNTLY_CONFIG.APP_KEY,\n                COUNTLY_CONFIG.SERVER_URL\n            ).apply {\n                setIdMode(DeviceId.Type.OPEN_UDID)\n                setViewTracking(true)\n                enableCrashReporting()\n                setLoggingEnabled(false)\n                setRecordAllThreadsWithCrash()\n                setRequiresConsent(true)\n                setShouldIgnoreAppCrawlers(true)\n                setEventQueueSizeToSend(5)\n            }\n        )\n    }\n\n    override fun onStart() {\n        Countly.sharedInstance().onStart(mainActivity)\n    }\n\n    override fun onStop() {\n        Countly.sharedInstance().onStop()\n    }\n\n    override fun giveConsent() {\n        Countly.sharedInstance().consent().giveConsentAll()\n    }\n\n    override fun isTracking(): Boolean =\n        Countly.sharedInstance().consent().getConsent(Countly.CountlyFeatureNames.events)\n\n    override fun revokeConsent() {\n        Countly.sharedInstance().consent().removeConsentAll()\n    }\n\n    override fun sendView(name: String, extras: MutableMap<String, Any>) {\n        Countly.sharedInstance().views().recordView(name, extras)\n    }\n\n    override fun sendEvent(eventName: String, extras: MutableMap<String, Any>) {\n        Countly.sharedInstance().events().recordEvent(eventName, extras)\n    }\n\n    override fun sendCrashReport(error: Throwable, extras: MutableMap<String, Any>) {\n        Countly.sharedInstance().crashes().recordUnhandledException(error, extras)\n    }\n}\n\ninternal actual fun analyticsModule() = module {\n    factory { (mainActivity: Activity) ->\n        AndroidAnalyticsManager(mainActivity)\n    } bind AnalyticsManager::class\n}"
  },
  {
    "path": "common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/file_manager/AndroidFileManager.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.core_components.file_manager\n\nimport android.graphics.Bitmap\nimport android.graphics.BitmapFactory\nimport android.os.Environment\nimport androidx.compose.ui.graphics.asImageBitmap\nimport co.touchlab.kermit.Kermit\nimport com.mpatric.mp3agic.InvalidDataException\nimport com.mpatric.mp3agic.Mp3File\nimport com.shabinder.common.core_components.media_converter.MediaConverter\nimport com.shabinder.common.core_components.media_converter.removeAllTags\nimport com.shabinder.common.core_components.media_converter.setId3v1Tags\nimport com.shabinder.common.core_components.media_converter.setId3v2TagsAndSaveFile\nimport com.shabinder.common.core_components.parallel_executor.ParallelExecutor\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.database.SpotiFlyerDatabase\nimport com.shabinder.common.di.getMemoryEfficientBitmap\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.dispatcherIO\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.event.coroutines.map\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.AudioFormat\nimport com.shabinder.database.Database\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.withContext\nimport org.koin.dsl.bind\nimport org.koin.dsl.module\nimport java.io.File\nimport java.io.FileOutputStream\nimport java.io.IOException\nimport java.net.HttpURLConnection\nimport java.net.URL\n\ninternal actual fun fileManagerModule() = module {\n    single { AndroidFileManager(get(), get(), get(), get()) } bind FileManager::class\n}\n\n/*\n* Ignore Deprecation\n*  `Deprecation is only a Suggestion P->`\n* */\n@Suppress(\"DEPRECATION\")\nclass AndroidFileManager(\n    override val logger: Kermit,\n    override val preferenceManager: PreferenceManager,\n    override val mediaConverter: MediaConverter,\n    spotiFlyerDatabase: SpotiFlyerDatabase\n) : FileManager {\n    @Suppress(\"DEPRECATION\")\n    private val defaultBaseDir =\n        Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).toString()\n\n    override fun fileSeparator(): String = File.separator\n\n    override fun imageCacheDir(): String = Actions.instance.platformActions.imageCacheDir\n\n    // fun call in order to always access Updated Value\n    override fun defaultDir(): String = (preferenceManager.downloadDir ?: defaultBaseDir) +\n            File.separator + \"SpotiFlyer\" + File.separator\n\n    override fun isPresent(path: String): Boolean = File(path).exists()\n\n    override fun createDirectory(dirPath: String) {\n        val yourAppDir = File(dirPath)\n\n        if (!yourAppDir.exists() && !yourAppDir.isDirectory) { // create empty directory\n            if (yourAppDir.mkdirs()) {\n                logger.i { \"$dirPath created\" }\n            } else {\n                logger.e { \"Unable to create Dir: $dirPath!\" }\n            }\n        } else {\n            logger.i { \"$dirPath already exists\" }\n        }\n    }\n\n    @Suppress(\"unused\")\n    override suspend fun clearCache(): Unit = withContext(dispatcherIO) {\n        File(imageCacheDir()).deleteRecursively()\n    }\n\n    @Suppress(\"BlockingMethodInNonBlockingContext\")\n    override suspend fun saveFileWithMetadata(\n        mp3ByteArray: ByteArray,\n        trackDetails: TrackDetails,\n        postProcess: (track: TrackDetails) -> Unit\n    ) = withContext(dispatcherIO) {\n        val songFile = File(trackDetails.outputFilePath)\n        try {\n            /*\n            * Check , if Fetch was Used, File is saved Already, else write byteArray we Received\n            * */\n            if (!songFile.exists()) {\n                /*Make intermediate Dirs if they don't exist yet*/\n                songFile.parentFile?.mkdirs()\n            }\n            // Write Bytes to Media File\n            songFile.writeBytes(mp3ByteArray)\n\n            try {\n                // Add Mp3 Tags and Add to Library\n                if (trackDetails.audioFormat != AudioFormat.MP3)\n                    throw InvalidDataException(\"Audio Format is ${trackDetails.audioFormat}, Needs Conversion!\")\n\n                Mp3File(File(songFile.absolutePath))\n                    .removeAllTags()\n                    .setId3v1Tags(trackDetails)\n                    .setId3v2TagsAndSaveFile(trackDetails)\n                addToLibrary(songFile.absolutePath)\n            } catch (e: Exception) {\n                // Media File Isn't MP3 lets Convert It first\n                if (e is InvalidDataException) {\n                    val convertedFilePath =\n                        songFile.absolutePath.substringBeforeLast('.') + \".temp.mp3\"\n\n                    val conversionResult = mediaConverter.convertAudioFile(\n                        inputFilePath = songFile.absolutePath,\n                        outputFilePath = convertedFilePath,\n                        trackDetails.audioQuality\n                    )\n\n                    conversionResult.map { outputFilePath ->\n                        Mp3File(File(outputFilePath))\n                            .removeAllTags()\n                            .setId3v1Tags(trackDetails)\n                            .setId3v2TagsAndSaveFile(trackDetails, trackDetails.outputFilePath)\n\n                        addToLibrary(trackDetails.outputFilePath)\n                    }.fold(\n                        success = {},\n                        failure = {\n                            throw it\n                        }\n                    )\n                    File(convertedFilePath).delete()\n                } else throw e\n            }\n            SuspendableEvent.success(trackDetails.outputFilePath)\n        } catch (e: Throwable) {\n            e.printStackTrace()\n            if (songFile.exists()) songFile.delete()\n            logger.e { \"${songFile.absolutePath} could not be created\" }\n            SuspendableEvent.error(e)\n        }\n    }\n\n    override fun addToLibrary(path: String) = Actions.instance.platformActions.addToLibrary(path)\n\n    override suspend fun loadImage(url: String, reqWidth: Int, reqHeight: Int): Picture =\n        withContext(dispatcherIO) {\n            val cachePath = getImageCachePath(url)\n            Picture(\n                image = (loadCachedImage(cachePath, reqWidth, reqHeight) ?: freshImage(\n                    url,\n                    reqWidth,\n                    reqHeight\n                ))?.asImageBitmap()\n            )\n        }\n\n    private fun loadCachedImage(cachePath: String, reqWidth: Int, reqHeight: Int): Bitmap? {\n        return try {\n            getMemoryEfficientBitmap(cachePath, reqWidth, reqHeight)\n        } catch (e: Exception) {\n            e.printStackTrace()\n            null\n        }\n    }\n\n    @Suppress(\"BlockingMethodInNonBlockingContext\")\n    override suspend fun cacheImage(image: Any, path: String): Unit = withContext(dispatcherIO) {\n        try {\n            FileOutputStream(path).use { out ->\n                (image as? Bitmap)?.compress(Bitmap.CompressFormat.JPEG, 100, out)\n            }\n        } catch (e: IOException) {\n            e.printStackTrace()\n        }\n    }\n\n    @Suppress(\"BlockingMethodInNonBlockingContext\")\n    private suspend fun freshImage(url: String, reqWidth: Int, reqHeight: Int): Bitmap? =\n        withContext(dispatcherIO) {\n            try {\n                val source = URL(url)\n                val connection: HttpURLConnection = source.openConnection() as HttpURLConnection\n                connection.connectTimeout = 5000\n                connection.connect()\n\n                val input: ByteArray = connection.inputStream.readBytes()\n\n                // Get Memory Efficient Bitmap\n                val bitmap: Bitmap? = getMemoryEfficientBitmap(input, reqWidth, reqHeight)\n\n                parallelExecutor.execute {\n                    // Decode and Cache Full Sized Image in Background\n                    cacheImage(\n                        BitmapFactory.decodeByteArray(input, 0, input.size),\n                        getImageCachePath(url)\n                    )\n                }\n                bitmap // return Memory Efficient Bitmap\n            } catch (e: Exception) {\n                e.printStackTrace()\n                null\n            }\n        }\n\n    /*\n    * Parallel Executor with 2 concurrent operation at a time.\n    *   -   We will use this to queue up operations and decode Full Sized Images\n    *   -   Will Decode Only a small set of images at a time , to avoid going into `Out of Memory`\n    * */\n    private val parallelExecutor = ParallelExecutor(Dispatchers.IO, 2)\n\n    override val db: Database? = spotiFlyerDatabase.instance\n}\n"
  },
  {
    "path": "common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/media_converter/AndroidMediaConverter.kt",
    "content": "package com.shabinder.common.core_components.media_converter\n\nimport android.content.Context\nimport android.util.Log\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.SpotiFlyerException\nimport kotlinx.coroutines.delay\nimport nl.bravobit.ffmpeg.ExecuteBinaryResponseHandler\nimport nl.bravobit.ffmpeg.FFmpeg\nimport org.koin.dsl.bind\nimport org.koin.dsl.module\n\n\nclass AndroidMediaConverter(private val appContext: Context) : MediaConverter() {\n\n    override suspend fun convertAudioFile(\n        inputFilePath: String,\n        outputFilePath: String,\n        audioQuality: AudioQuality,\n        progressCallbacks: (Long) -> Unit,\n    ) = executeSafelyInPool {\n        var progressing = true\n        var error = \"\"\n        var timeout = 600_000L * 2 // 20 min\n        val progressDelayCheck = 500L\n        // 192 is Default\n        val audioBitrate =\n            if (audioQuality == AudioQuality.UNKNOWN) 192 else audioQuality.kbps.toIntOrNull()\n                ?: 192\n        FFmpeg.getInstance(appContext).execute(\n            arrayOf(\n                \"-i\",\n                inputFilePath,\n                \"-y\", /*\"-acodec\", \"libmp3lame\",*/\n                \"-b:a\",\n                \"${audioBitrate}k\",\n                \"-vn\",\n                outputFilePath\n            ), object : ExecuteBinaryResponseHandler() {\n                override fun onSuccess(message: String?) {\n                    //Log.d(\"FFmpeg Command\", \"Success $message\")\n                    progressing = false\n                    Log.d(\"FFmpeg Success\", \"$message\")\n                }\n\n                override fun onProgress(message: String?) {\n                    super.onProgress(message)\n                    Log.d(\"FFmpeg Progress\", \"Progress $message  ---  $inputFilePath\")\n                }\n\n                override fun onFailure(message: String?) {\n                    error = \"Failed: $message $inputFilePath\"\n                    error += \"FFmpeg Support\" + FFmpeg.getInstance(appContext).isSupported.toString()\n                    Log.d(\"FFmpeg Error\", error)\n                    progressing = false\n                }\n            }\n        )\n        while (progressing) {\n            if (timeout < 0) throw SpotiFlyerException.MP3ConversionFailed(\"$error Conversion Timeout for $inputFilePath\")\n            delay(progressDelayCheck)\n            timeout -= progressDelayCheck\n        }\n        if(error.isNotBlank()) throw SpotiFlyerException.MP3ConversionFailed(error)\n        // Return output file path after successful conversion\n        outputFilePath\n    }\n}\n\ninternal actual fun mediaConverterModule() = module {\n    single { AndroidMediaConverter(get()) } bind MediaConverter::class\n}"
  },
  {
    "path": "common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/media_converter/AudioTagging.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.core_components.media_converter\n\nimport android.util.Log\nimport com.mpatric.mp3agic.ID3v1Tag\nimport com.mpatric.mp3agic.ID3v24Tag\nimport com.mpatric.mp3agic.Mp3File\nimport com.shabinder.common.core_components.file_manager.downloadFile\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.TrackDetails\nimport kotlinx.coroutines.flow.collect\nimport java.io.File\nimport java.io.FileInputStream\n\nfun Mp3File.removeAllTags(): Mp3File {\n    removeId3v1Tag()\n    removeId3v2Tag()\n    removeCustomTag()\n    return this\n}\n\nfun Mp3File.setId3v1Tags(track: TrackDetails): Mp3File {\n    val id3v1Tag = ID3v1Tag().apply {\n        artist = track.artists.joinToString(\", \")\n        title = track.title\n        album = track.albumName\n        year = track.year\n        comment = \"${track.comment}\"\n        if (track.trackNumber != null)\n            this.track = track.trackNumber.toString()\n    }\n    this.id3v1Tag = id3v1Tag\n    return this\n}\n\n@Suppress(\"BlockingMethodInNonBlockingContext\")\nsuspend fun Mp3File.setId3v2TagsAndSaveFile(track: TrackDetails, outputFilePath: String? = null) {\n    val id3v2Tag = ID3v24Tag().apply {\n        albumArtist = track.albumArtists.joinToString(\", \")\n        artist = track.artists.joinToString(\", \")\n        title = track.title\n        album = track.albumName\n        year = track.year\n\n        genreDescription = \"Genre: \" + track.genre.joinToString(\", \")\n        comment = track.comment\n        lyrics = track.lyrics ?: \"\"\n        url = track.trackUrl\n        if (track.trackNumber != null)\n            this.track = track.trackNumber.toString()\n    }\n    try {\n        val art = File(track.albumArtPath)\n        val bytesArray = ByteArray(art.length().toInt())\n        val fis = FileInputStream(art)\n        fis.read(bytesArray) // read file into bytes[]\n        fis.close()\n        id3v2Tag.setAlbumImage(bytesArray, \"image/jpeg\")\n        this.id3v2Tag = id3v2Tag\n        saveFile(outputFilePath ?: track.outputFilePath)\n    } catch (e: java.io.FileNotFoundException) {\n        Log.e(\"Error\", \"Couldn't Write Cached Mp3 Album Art, Downloading And Trying Again, error: ${e.message}\")\n        try {\n            // Image Still Not Downloaded!\n            // Lets Download Now and Write it into Album Art\n            downloadFile(track.albumArtURL).collect {\n                when (it) {\n                    is DownloadResult.Error -> {} // Error\n                    is DownloadResult.Success -> {\n                        id3v2Tag.setAlbumImage(it.byteArray, \"image/jpeg\")\n                        this.id3v2Tag = id3v2Tag\n                        saveFile(outputFilePath ?: track.outputFilePath)\n                    }\n                    is DownloadResult.Progress -> {} // Nothing for Now , no progress bar to show\n                }\n            }\n        } catch (e: Exception) {\n            Log.e(\"Error\", \"Couldn't Write Mp3 Album Art, error:\")\n            e.printStackTrace()\n        }\n    }\n}\n\nfun Mp3File.saveFile(filePath: String) {\n    save(filePath.substringBeforeLast('.') + \".tagged.mp3\")\n\n    val oldFile = File(filePath)\n    oldFile.delete()\n\n    val newFile = File((filePath.substringBeforeLast('.') + \".tagged.mp3\"))\n    newFile.renameTo(File(filePath.substringBeforeLast('.') + \".mp3\"))\n}\n"
  },
  {
    "path": "common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/picture/AndroidPicture.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.di\n\nimport android.graphics.Bitmap\nimport android.graphics.BitmapFactory\nimport androidx.compose.ui.graphics.ImageBitmap\n\nfun getMemoryEfficientBitmap(\n    input: ByteArray,\n    reqWidth: Int,\n    reqHeight: Int,\n    offset: Int = 0,\n    size: Int = input.size\n): Bitmap? {\n    return BitmapFactory.Options().run {\n        inJustDecodeBounds = true\n        BitmapFactory.decodeByteArray(input, offset, size, this)\n\n        // Calculate inSampleSize\n        inSampleSize = calculateInSampleSize(this, reqWidth, reqHeight)\n\n        // Decode bitmap with inSampleSize set\n        inJustDecodeBounds = false\n        // Return Mem. Efficient Bitmap\n        BitmapFactory.decodeByteArray(input, offset, size, this)\n    }\n}\nfun getMemoryEfficientBitmap(\n    filePath: String,\n    reqWidth: Int,\n    reqHeight: Int,\n): Bitmap? {\n    return BitmapFactory.Options().run {\n        inJustDecodeBounds = true\n        BitmapFactory.decodeFile(filePath, this)\n\n        // Calculate inSampleSize\n        inSampleSize = calculateInSampleSize(this, reqWidth, reqHeight)\n\n        // Decode bitmap with inSampleSize set\n        inJustDecodeBounds = false\n\n        BitmapFactory.decodeFile(filePath, this)\n    }\n}\nfun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int, reqHeight: Int): Int {\n    // Raw height and width of image\n    val (height: Int, width: Int) = options.run { outHeight to outWidth }\n    var inSampleSize = 1\n\n    if (height > reqHeight || width > reqWidth) {\n\n        val halfHeight: Int = height / 2\n        val halfWidth: Int = width / 2\n\n        // Calculate the largest inSampleSize value that is a power of 2 and keeps both\n        // height and width larger than the requested height and width.\n        while (halfHeight / inSampleSize >= reqHeight && halfWidth / inSampleSize >= reqWidth) {\n            inSampleSize *= 2\n        }\n    }\n\n    return inSampleSize\n}\n"
  },
  {
    "path": "common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/picture/Picture.kt",
    "content": "package com.shabinder.common.core_components.picture\n\nimport androidx.compose.ui.graphics.ImageBitmap\n\nactual data class Picture(\n    var image: ImageBitmap?\n)"
  },
  {
    "path": "common/core-components/src/androidMain/kotlin/com/shabinder/common/core_components/utils/AndroidHttpClient.kt",
    "content": "package com.shabinder.common.core_components.utils\n\nimport android.annotation.SuppressLint\nimport io.ktor.client.HttpClient\nimport io.ktor.client.HttpClientConfig\nimport io.ktor.client.engine.HttpClientEngineConfig\nimport io.ktor.client.engine.okhttp.OkHttp\nimport io.ktor.client.engine.okhttp.OkHttpConfig\nimport okhttp3.OkHttpClient\nimport java.security.SecureRandom\nimport java.security.cert.X509Certificate\nimport javax.net.ssl.SSLContext\nimport javax.net.ssl.TrustManager\nimport javax.net.ssl.X509TrustManager\n\nactual fun buildHttpClient(extraConfig: HttpClientConfig<*>.() -> Unit): HttpClient {\n    return HttpClient(OkHttp) {\n        engine {\n            preconfigured = getUnsafeOkHttpClient()\n        }\n        extraConfig()\n    }\n}\n\nfun getUnsafeOkHttpClient(): OkHttpClient {\n    return try {\n        // Create a trust manager that does not validate certificate chains\n        @SuppressLint(\"CustomX509TrustManager\")\n        val trustAllCerts: TrustManager = object : X509TrustManager {\n            @SuppressLint(\"TrustAllX509TrustManager\")\n            override fun checkClientTrusted(chain: Array<X509Certificate?>?, authType: String?) {\n            }\n\n            @SuppressLint(\"TrustAllX509TrustManager\")\n            override fun checkServerTrusted(chain: Array<X509Certificate?>?, authType: String?) {\n            }\n\n            override fun getAcceptedIssuers(): Array<X509Certificate> = arrayOf()\n        }\n\n        // Install the all-trusting trust manager\n        val sslContext: SSLContext = SSLContext.getInstance(\"SSL\").apply {\n            init(null, arrayOf(trustAllCerts), SecureRandom())\n        }\n\n        OkHttpClient.Builder().run {\n            sslSocketFactory(sslContext.socketFactory, trustAllCerts as X509TrustManager)\n            hostnameVerifier { _, _ -> true }\n            followRedirects(true)\n            build()\n        }\n    } catch (e: Exception) {\n        throw RuntimeException(e)\n    }\n}"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/CoreComponentsModule.kt",
    "content": "package com.shabinder.common.core_components\n\nimport co.touchlab.kermit.Kermit\nimport com.russhwolf.settings.Settings\nimport com.shabinder.common.core_components.analytics.analyticsModule\nimport com.shabinder.common.core_components.file_manager.fileManagerModule\nimport com.shabinder.common.core_components.media_converter.mediaConverterModule\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.core_components.utils.createHttpClient\nimport com.shabinder.common.database.getLogger\nimport org.koin.dsl.module\n\nfun coreComponentModules(enableLogging: Boolean) = listOf(\n    commonModule(enableLogging),\n    analyticsModule(),\n    fileManagerModule(),\n    mediaConverterModule()\n)\n\nprivate fun commonModule(enableLogging: Boolean) = module {\n    single { createHttpClient(enableLogging) }\n    single { Settings() }\n    single { Kermit(getLogger()) }\n    single { PreferenceManager(get()) }\n}\n"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/analytics/AnalyticsManager.kt",
    "content": "package com.shabinder.common.core_components.analytics\n\nimport org.koin.core.module.Module\n\ninterface AnalyticsManager {\n    fun init()\n    fun onStart()\n    fun onStop()\n    fun giveConsent()\n    fun isTracking(): Boolean\n    fun revokeConsent()\n    fun sendView(name: String, extras: MutableMap<String, Any> = mutableMapOf())\n    fun sendEvent(eventName: String, extras: MutableMap<String, Any> = mutableMapOf())\n    fun track(event: AnalyticsAction) = event.track(this)\n    fun sendCrashReport(error: Throwable, extras: MutableMap<String, Any> = mutableMapOf())\n\n    companion object {\n        abstract class AnalyticsAction {\n            abstract fun track(analyticsManager: AnalyticsManager)\n        }\n    }\n}\n\n@Suppress(\"ClassName\", \"SpellCheckingInspection\")\nobject COUNTLY_CONFIG {\n    const val APP_KEY = \"27820f304468cc651ef47d787f0cb5fe11c577df\"\n    const val SERVER_URL = \"https://counlty.shabinder.in\"\n}\n\ninternal expect fun analyticsModule(): Module"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/analytics/Events.kt",
    "content": "package com.shabinder.common.core_components.analytics\n\nsealed class AnalyticsEvent(private val eventName: String, private val extras: MutableMap<String, Any> = mutableMapOf()): AnalyticsManager.Companion.AnalyticsAction() {\n\n    override fun track(analyticsManager: AnalyticsManager) = analyticsManager.sendEvent(eventName,extras)\n\n    object AppLaunch: AnalyticsEvent(\"app_launch\")\n    object DonationDialogOpen: AnalyticsEvent(\"donation_dialog_open\")\n}"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/analytics/Views.kt",
    "content": "package com.shabinder.common.core_components.analytics\n\nimport com.shabinder.common.core_components.analytics.AnalyticsManager.Companion.AnalyticsAction\n\nsealed class AnalyticsView(private val viewName: String, private val extras: MutableMap<String, Any> = mutableMapOf()) : AnalyticsAction() {\n    override fun track(analyticsManager: AnalyticsManager) = analyticsManager.sendView(viewName,extras)\n\n    object HomeScreen: AnalyticsView(\"home_screen\")\n    object ListScreen: AnalyticsView(\"list_screen\")\n}"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/file_manager/FileManager.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.core_components.file_manager\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.media_converter.MediaConverter\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.core_components.utils.createHttpClient\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.utils.removeIllegalChars\nimport com.shabinder.common.utils.requireNotNull\nimport com.shabinder.database.Database\nimport io.ktor.client.HttpClient\nimport io.ktor.client.request.HttpRequestBuilder\nimport io.ktor.client.request.get\nimport io.ktor.client.statement.HttpStatement\nimport io.ktor.http.contentLength\nimport io.ktor.http.isSuccess\nimport kotlinx.coroutines.flow.Flow\nimport kotlinx.coroutines.flow.catch\nimport kotlinx.coroutines.flow.flow\nimport org.koin.core.module.Module\nimport kotlin.math.roundToInt\n\ninternal expect fun fileManagerModule(): Module\n\ninterface FileManager {\n\n    val logger: Kermit\n    val preferenceManager: PreferenceManager\n    val mediaConverter: MediaConverter\n    val db: Database?\n\n    fun isPresent(path: String): Boolean\n\n    fun fileSeparator(): String\n\n    fun defaultDir(): String\n\n    fun imageCacheDir(): String\n\n    fun createDirectory(dirPath: String)\n\n    suspend fun cacheImage(\n        image: Any,\n        path: String\n    ) // in Android = ImageBitmap, Desktop = BufferedImage\n\n    suspend fun loadImage(url: String, reqWidth: Int = 150, reqHeight: Int = 150): Picture\n\n    suspend fun clearCache()\n\n    suspend fun saveFileWithMetadata(\n        mp3ByteArray: ByteArray,\n        trackDetails: TrackDetails,\n        postProcess: (track: TrackDetails) -> Unit = {}\n    ): SuspendableEvent<String, Throwable>\n\n    fun addToLibrary(path: String)\n}\n\n/*\n* Call this function at startup!\n* */\nfun FileManager.createDirectories() {\n    try {\n        if (!defaultDir().contains(\"null${fileSeparator()}SpotiFlyer\")) {\n            createDirectory(defaultDir())\n            createDirectory(imageCacheDir())\n            createDirectory(defaultDir() + \"Tracks\" + fileSeparator())\n            createDirectory(defaultDir() + \"Albums\" + fileSeparator())\n            createDirectory(defaultDir() + \"Playlists\" + fileSeparator())\n            createDirectory(defaultDir() + \"YT_Downloads\" + fileSeparator())\n        }\n    } catch (ignored: Exception) {\n    }\n}\n\nfun FileManager.finalOutputDir(\n    itemName: String,\n    type: String,\n    subFolder: String,\n    defaultDir: String,\n    extension: String = \".mp3\"\n): String =\n    defaultDir + removeIllegalChars(type) + this.fileSeparator() +\n            if (subFolder.isEmpty()) \"\" else {\n                removeIllegalChars(subFolder) + this.fileSeparator()\n            } +\n            removeIllegalChars(itemName) + extension\n\nfun FileManager.getImageCachePath(\n    url: String\n): String = imageCacheDir() + getNameFromURL(url, isImage = true)\n\n/*DIR Specific Operation End*/\nprivate fun getNameFromURL(url: String, isImage: Boolean = false): String {\n    val startIndex = url.lastIndexOf('/', url.lastIndexOf('/') - 1) + 1\n\n    var fileName = if (startIndex != -1)\n        url.substring(startIndex).replace('/', '_')\n    else url.substringAfterLast(\"/\")\n\n    // Generify File Extensions\n    if (isImage) {\n        if (fileName.length - fileName.lastIndexOf(\".\") > 5) {\n            fileName += \".jpeg\"\n        } else {\n            if (fileName.endsWith(\".jpg\"))\n                fileName = fileName.substringBeforeLast(\".\") + \".jpeg\"\n        }\n    }\n\n    return fileName\n}\n\nsuspend fun HttpClient.downloadFile(url: String) = downloadFile(url, this)\n\nsuspend fun downloadFile(url: String, client: HttpClient? = null): Flow<DownloadResult> {\n    return flow {\n        val httpClient = client ?: createHttpClient()\n        httpClient.get<HttpStatement>(url).execute { response ->\n            // Not all requests return Content Length\n            val data = kotlin.runCatching {\n                ByteArray(response.contentLength().requireNotNull().toInt())\n            }.getOrNull() ?: byteArrayOf()\n            var offset = 0\n            val downloadableContent = response.content\n\n            do {\n                // Set Length optimally, after how many kb you want a progress update, now its 0.25mb\n                val currentRead = downloadableContent.readAvailable(data, offset, 2_50_000).also {\n                    offset += it\n                }\n\n                // Calculate Download Progress\n                val progress = data.size.takeIf { it != 0 }?.let { fileSize ->\n                    (offset * 100f / fileSize).roundToInt()\n                }\n\n                // Emit Progress Update\n                emit(DownloadResult.Progress(progress ?: 0))\n            } while (currentRead > 0)\n\n            // Download Complete\n            if (response.status.isSuccess()) {\n                emit(DownloadResult.Success(data))\n            } else {\n                emit(DownloadResult.Error(\"File not downloaded\"))\n            }\n        }\n\n        // Close Client if We Created One during invocation\n        if (client == null)\n            httpClient.close()\n    }.catch { e ->\n        e.printStackTrace()\n        emit(DownloadResult.Error(e.message ?: \"File not downloaded\"))\n    }\n}\n\nsuspend fun downloadByteArray(\n    url: String,\n    httpBuilder: HttpRequestBuilder.() -> Unit = {}\n): ByteArray? {\n    val client = createHttpClient()\n    val response = try {\n        client.get<ByteArray>(url, httpBuilder)\n    } catch (e: Exception) {\n        return null\n    }\n    client.close()\n    return response\n}\n"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/media_converter/MediaConverter.kt",
    "content": "package com.shabinder.common.core_components.media_converter\n\nimport com.shabinder.common.core_components.parallel_executor.ParallelExecutor\nimport com.shabinder.common.core_components.parallel_executor.ParallelProcessor\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.dispatcherDefault\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport org.koin.core.module.Module\n\nabstract class MediaConverter : ParallelProcessor {\n\n    /*\n    * Operations Pool\n    * */\n    override val parallelExecutor = ParallelExecutor(dispatcherDefault)\n\n    /*\n    * By Default AudioQuality Output will be equal to Input's Quality,i.e, Denoted by AudioQuality.UNKNOWN\n    * */\n    abstract suspend fun convertAudioFile(\n        inputFilePath: String,\n        outputFilePath: String,\n        audioQuality: AudioQuality = AudioQuality.UNKNOWN,\n        progressCallbacks: (Long) -> Unit = {},\n    ): SuspendableEvent<String, Throwable>\n}\n\ninternal expect fun mediaConverterModule(): Module"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/parallel_executor/ParallelExecutor.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.core_components.parallel_executor\n\n// Dependencies:\n// implementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9-native-mt\")\n// implementation(\"org.jetbrains.kotlinx:atomicfu:0.14.4\")\n// Gist: https://gist.github.com/fluidsonic/ba32de21c156bbe8424c8d5fc20dcd8e\n\nimport com.shabinder.common.models.dispatcherIO\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport io.ktor.utils.io.core.*\nimport kotlinx.atomicfu.atomic\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.Channel\nimport kotlinx.coroutines.selects.select\nimport kotlin.coroutines.CoroutineContext\n\ninterface ParallelProcessor {\n\n    val parallelExecutor: ParallelExecutor\n\n    suspend fun <T> executeSafelyInPool(block: suspend () -> T): SuspendableEvent<T, Throwable> {\n        return SuspendableEvent {\n            parallelExecutor.executeSuspending(block)\n        }\n    }\n\n    suspend fun stopAllTasks() {\n        parallelExecutor.closeAndReInit()\n    }\n}\n\n\nclass ParallelExecutor(\n    private val context: CoroutineContext = dispatcherIO,\n    concurrentOperationLimit: Int = 4\n) : Closeable, CoroutineScope {\n\n    private var service: Job = SupervisorJob()\n    override val coroutineContext get() = context + service\n    var isClosed = atomic(false)\n        private set\n    private var killQueue = Channel<Unit>(Channel.UNLIMITED)\n    private var operationQueue = Channel<Operation<*>>(Channel.RENDEZVOUS)\n    private var concurrentOperationLimit = atomic(concurrentOperationLimit)\n\n\n    init {\n        startOrStopProcessors(expectedCount = this.concurrentOperationLimit.value, actualCount = 0)\n    }\n\n    override fun close() {\n        if (!isClosed.compareAndSet(expect = false, update = true))\n            return\n\n        val cause = CancellationException(\"Executor was closed.\")\n\n        killQueue.close(cause)\n        operationQueue.close(cause)\n        service.cancel(cause)\n        coroutineContext.cancel(cause)\n    }\n\n    fun reviveIfClosed() {\n        if (!service.isActive) {\n            closeAndReInit()\n        }\n    }\n\n    fun closeAndReInit(newConcurrentOperationLimit: Int = 4) {\n        // Close Everything\n        close()\n\n        // ReInit everything\n        service = SupervisorJob()\n        isClosed = atomic(false)\n        killQueue = Channel(Channel.UNLIMITED)\n        operationQueue = Channel(Channel.RENDEZVOUS)\n        concurrentOperationLimit = atomic(newConcurrentOperationLimit)\n        startOrStopProcessors(expectedCount = this.concurrentOperationLimit.value, actualCount = 0)\n    }\n\n    private fun CoroutineScope.launchProcessor() = launch {\n        while (true) {\n            val operation = select<Operation<*>?> {\n                killQueue.onReceive { null }\n                operationQueue.onReceive { it }\n            } ?: break\n\n            operation.execute()\n        }\n    }\n\n    suspend fun <Result> executeSuspending(block: suspend () -> Result): Result =\n        withContext(coroutineContext) {\n            val operation = Operation(block)\n            operationQueue.send(operation)\n\n            operation.result.await()\n        }\n\n    fun <Result> execute(onComplete: (Result) -> Unit = {}, block: suspend () -> Result) {\n        launch(coroutineContext) {\n            val operation = Operation(block)\n            operationQueue.send(operation)\n\n            onComplete(operation.result.await())\n        }\n    }\n\n    // TODO This launches all coroutines in advance even if they're never needed. Find a lazy way to do this.\n    @Suppress(\"unused\")\n    fun setConcurrentOperationLimit(limit: Int) {\n        require(limit >= 1) { \"'limit' must be greater than zero: $limit\" }\n        require(limit < 1_000_000) { \"Don't use a very high limit because it will cause a lot of coroutines to be started eagerly: $limit\" }\n\n        startOrStopProcessors(expectedCount = limit, actualCount = concurrentOperationLimit.getAndSet(limit))\n    }\n\n    private fun startOrStopProcessors(expectedCount: Int, actualCount: Int) {\n        if (!service.isActive) service = SupervisorJob()\n        if (expectedCount == actualCount)\n            return\n\n        if (isClosed.value)\n            return\n\n        var change = expectedCount - actualCount\n        while (change > 0 && killQueue.tryReceive().getOrNull() != null)\n            change -= 1\n\n        if (change > 0)\n            repeat(change) { launchProcessor() }\n        else\n            repeat(-change) { killQueue.trySend(Unit).isSuccess }\n    }\n\n    private class Operation<Result>(\n        private val block: suspend () -> Result,\n    ) {\n\n        private val _result = CompletableDeferred<Result>()\n\n        val result: Deferred<Result> get() = _result\n\n        suspend fun execute() {\n            try {\n                _result.complete(block())\n            } catch (e: Throwable) {\n                _result.completeExceptionally(e)\n            }\n        }\n    }\n}\n\n/*\nsuspend fun main() = coroutineScope {\n    val executor = ParallelExecutor(coroutineContext)\n\n    println(\"Concurrency: 1\")\n\n    coroutineScope {\n        (1 .. 200).forEach { i ->\n            launch {\n                executor.execute {\n                    println(\"Execution $i\")\n                    delay(250)\n\n                    when (i) {\n                        10 -> {\n                            println(\"Concurrency: 5\")\n                            executor.setConcurrentOperationLimit(5)\n                        }\n\n                        100 -> {\n                            println(\"Concurrency: 1\")\n                            executor.setConcurrentOperationLimit(1)\n                        }\n\n                        110 -> {\n                            println(\"Closing executor\")\n                            executor.close()\n                        }\n                    }\n                }\n            }\n            delay(1)\n        }\n    }\n\n    println(\"Fin.\")\n}*/\n"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/picture/Picture.kt",
    "content": "package com.shabinder.common.core_components.picture\n\nexpect class Picture"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/preference_manager/PreferenceManager.kt",
    "content": "package com.shabinder.common.core_components.preference_manager\n\nimport co.touchlab.stately.annotation.Throws\nimport com.russhwolf.settings.Settings\nimport com.shabinder.common.core_components.analytics.AnalyticsManager\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.spotify.SpotifyCredentials\nimport kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.json.Json\nimport kotlin.native.concurrent.ThreadLocal\n\nclass PreferenceManager(\n    settings: Settings,\n) : Settings by settings {\n\n    companion object {\n        const val DIR_KEY = \"downloadDir\"\n        const val ANALYTICS_KEY = \"analytics\"\n        const val FIRST_LAUNCH = \"firstLaunch\"\n        const val DONATION_INTERVAL = \"donationInterval\"\n        const val PREFERRED_AUDIO_QUALITY = \"preferredAudioQuality\"\n\n        @Suppress(\"VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL\")\n        lateinit var instance: PreferenceManager\n            private set\n    }\n\n    init {\n        instance = this\n    }\n\n    lateinit var analyticsManager: AnalyticsManager\n\n    /* ANALYTICS */\n     val isAnalyticsEnabled get() = getBooleanOrNull(ANALYTICS_KEY) ?: false\n     fun toggleAnalytics(enabled: Boolean) {\n         putBoolean(ANALYTICS_KEY, enabled)\n         if (this::analyticsManager.isInitialized) {\n             if (enabled) analyticsManager.giveConsent() else analyticsManager.revokeConsent()\n         }\n     }\n\n    /* DOWNLOAD DIRECTORY */\n    val downloadDir get() = getStringOrNull(DIR_KEY)\n    fun setDownloadDirectory(newBasePath: String) = putString(DIR_KEY, newBasePath)\n\n    /* Preferred Audio Quality */\n    val audioQuality get() = AudioQuality.getQuality(getStringOrNull(PREFERRED_AUDIO_QUALITY) ?: \"320\")\n    fun setPreferredAudioQuality(quality: AudioQuality) = putString(PREFERRED_AUDIO_QUALITY, quality.kbps)\n\n    val spotifyCredentials: SpotifyCredentials get() = getStringOrNull(\"spotifyCredentials\")?.let {\n        Json.decodeFromString(it)\n    } ?: SpotifyCredentials()\n    fun setSpotifyCredentials(credentials: SpotifyCredentials) = putString(\"spotifyCredentials\", Json.encodeToString(SpotifyCredentials.serializer(), credentials))\n\n    /* OFFSET FOR WHEN TO ASK FOR SUPPORT */\n    val getDonationOffset: Int get() = (getIntOrNull(DONATION_INTERVAL) ?: 3).also {\n        // Min. Donation Asking Interval is `3`\n        if (it < 3) setDonationOffset(3) else setDonationOffset(it - 1)\n    }\n    fun setDonationOffset(offset: Int = 5) = putInt(DONATION_INTERVAL, offset)\n\n    /* TO CHECK IF THIS IS APP's FIRST LAUNCH */\n    val isFirstLaunch get() = getBooleanOrNull(FIRST_LAUNCH) ?: true\n    fun firstLaunchDone() = putBoolean(FIRST_LAUNCH, false)\n}\n"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/utils/NetworkingExt.kt",
    "content": "package com.shabinder.common.core_components.utils\n\nimport com.shabinder.common.models.dispatcherIO\nimport com.shabinder.common.utils.globalJson\nimport io.ktor.client.HttpClient\nimport io.ktor.client.HttpClientConfig\nimport io.ktor.client.features.HttpTimeout\nimport io.ktor.client.features.json.JsonFeature\nimport io.ktor.client.features.json.serializer.KotlinxSerializer\nimport io.ktor.client.features.logging.DEFAULT\nimport io.ktor.client.features.logging.LogLevel\nimport io.ktor.client.features.logging.Logger\nimport io.ktor.client.features.logging.Logging\nimport io.ktor.client.request.HttpRequestBuilder\nimport io.ktor.client.request.get\nimport io.ktor.client.request.head\nimport io.ktor.client.statement.HttpResponse\nimport io.ktor.http.ContentType\nimport kotlinx.coroutines.withContext\nimport kotlin.native.concurrent.SharedImmutable\n\nsuspend fun isInternetAccessible(): Boolean {\n    return withContext(dispatcherIO) {\n        try {\n            ktorHttpClient.head<String>(\"https://open.spotify.com/\")\n            true\n        } catch (e: Exception) {\n            e.printStackTrace()\n            false\n        }\n    }\n}\n\n// If Fails returns Input Url\nsuspend inline fun HttpClient.getFinalUrl(\n    url: String,\n    crossinline block: HttpRequestBuilder.() -> Unit = {}\n): String {\n    return withContext(dispatcherIO) {\n        runCatching {\n            get<HttpResponse>(url, block).call.request.url.toString()\n        }.getOrNull() ?: url\n    }\n}\n\nfun createHttpClient(enableNetworkLogs: Boolean = false) = buildHttpClient {\n    // https://github.com/Kotlin/kotlinx.serialization/issues/1450\n    install(JsonFeature) {\n        serializer = KotlinxSerializer(globalJson)\n    }\n    install(HttpTimeout) {\n        socketTimeoutMillis = 520_000\n        requestTimeoutMillis = 360_000\n        connectTimeoutMillis = 360_000\n    }\n    // WorkAround for Freezing\n    // Use httpClient.getData / httpClient.postData Extensions\n    /*install(JsonFeature) {\n        serializer = KotlinxSerializer(\n            Json {\n                isLenient = true\n                ignoreUnknownKeys = true\n            }\n        )\n    }*/\n    if (enableNetworkLogs) {\n        install(Logging) {\n            logger = Logger.DEFAULT\n            level = LogLevel.INFO\n        }\n    }\n}\n\nexpect fun buildHttpClient(extraConfig: HttpClientConfig<*>.() -> Unit): HttpClient\n\n/*Client Active Throughout App's Lifetime*/\n@SharedImmutable\nprivate val ktorHttpClient = HttpClient {}"
  },
  {
    "path": "common/core-components/src/commonMain/kotlin/com.shabinder.common.core_components/utils/StoreExt.kt",
    "content": "package com.shabinder.common.core_components.utils\n\nimport com.arkivanov.decompose.value.Value\nimport com.arkivanov.decompose.value.ValueObserver\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.arkivanov.mvikotlin.rx.Disposable\n\nfun <T : Any> Store<*, T, *>.asValue(): Value<T> =\n    object : Value<T>() {\n        override val value: T get() = state\n        private var disposables = emptyMap<ValueObserver<T>, Disposable>()\n\n        override fun subscribe(observer: ValueObserver<T>) {\n            val disposable = states(com.arkivanov.mvikotlin.rx.observer(onNext = observer))\n            this.disposables += observer to disposable\n        }\n\n        override fun unsubscribe(observer: ValueObserver<T>) {\n            val disposable = disposables[observer] ?: return\n            this.disposables -= observer\n            disposable.dispose()\n        }\n    }\n"
  },
  {
    "path": "common/core-components/src/desktopMain/kotlin/com/shabinder/common/core_components/utils/DesktopHttpClient.kt",
    "content": "package com.shabinder.common.core_components.utils\n\nimport io.ktor.client.HttpClient\nimport io.ktor.client.HttpClientConfig\nimport io.ktor.client.engine.apache.Apache\nimport org.apache.http.conn.ssl.NoopHostnameVerifier\nimport org.apache.http.conn.ssl.TrustSelfSignedStrategy\nimport org.apache.http.ssl.SSLContextBuilder\n\nactual fun buildHttpClient(extraConfig: HttpClientConfig<*>.() -> Unit): HttpClient {\n    return HttpClient(Apache) {\n        engine {\n            customizeClient {\n                setSSLContext(\n                    SSLContextBuilder\n                        .create()\n                        .loadTrustMaterial(TrustSelfSignedStrategy())\n                        .build()\n                )\n                setSSLHostnameVerifier(NoopHostnameVerifier())\n            }\n        }\n        extraConfig()\n    }\n}\n"
  },
  {
    "path": "common/core-components/src/desktopMain/kotlin/com.shabinder.common.core_components/analytics/DesktopAnalyticsManager.kt",
    "content": "package com.shabinder.common.core_components.analytics\n\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport ly.count.sdk.java.Config\nimport ly.count.sdk.java.Config.DeviceIdStrategy\nimport ly.count.sdk.java.Config.Feature\nimport ly.count.sdk.java.ConfigCore.LoggingLevel\nimport ly.count.sdk.java.Countly\nimport org.koin.dsl.bind\nimport org.koin.dsl.module\nimport java.io.File\n\ninternal class DesktopAnalyticsManager(\n    private val fileManager: FileManager\n) : AnalyticsManager {\n\n    init {\n        init()\n    }\n\n    override fun init() {\n\n        val config: Config = Config(COUNTLY_CONFIG.SERVER_URL, COUNTLY_CONFIG.APP_KEY).apply {\n            eventsBufferSize = 2\n            loggingLevel = LoggingLevel.ERROR\n            setDeviceIdStrategy(DeviceIdStrategy.UUID)\n            enableFeatures(*featuresSet)\n            setRequiresConsent(true)\n        }\n\n        Countly.init(File(fileManager.defaultDir()), config)\n\n        Countly.session().begin();\n    }\n\n    override fun giveConsent() {\n        Countly.onConsent(*featuresSet)\n    }\n\n    override fun isTracking(): Boolean = Countly.isTracking(Feature.Events)\n\n    override fun revokeConsent() {\n        Countly.onConsentRemoval(*featuresSet)\n    }\n\n    override fun sendView(name: String, extras: MutableMap<String, Any>) {\n        Countly.api().view(name)\n    }\n\n    override fun sendEvent(eventName: String, extras: MutableMap<String, Any>) {\n        Countly.api().event(eventName)\n            .setSegmentation(extras.filterValues { it is String } as? MutableMap<String, String> ?: emptyMap()).record()\n    }\n\n    override fun sendCrashReport(error: Throwable, extras: MutableMap<String, Any>) {\n        Countly.api().addCrashReport(\n            error,\n            extras.getOrDefault(\"fatal\", true) as Boolean,\n            error.javaClass.simpleName,\n            extras.filterValues { it is String } as? MutableMap<String, String> ?: emptyMap()\n        )\n    }\n\n    companion object {\n        val featuresSet = arrayOf(\n            Feature.Events,\n            Feature.Sessions,\n            Feature.CrashReporting,\n            Feature.Views,\n            Feature.UserProfiles,\n            Feature.Location,\n        )\n    }\n\n    override fun onStart() {}\n\n    override fun onStop() {}\n}\n\nactual fun analyticsModule() = module {\n    single { DesktopAnalyticsManager(get()) } bind AnalyticsManager::class\n}"
  },
  {
    "path": "common/core-components/src/desktopMain/kotlin/com.shabinder.common.core_components/file_manager/DesktopFileManager.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.core_components.file_manager\n\nimport androidx.compose.ui.graphics.ImageBitmap\nimport androidx.compose.ui.graphics.asImageBitmap\nimport co.touchlab.kermit.Kermit\nimport com.github.kokorin.jaffree.JaffreeException\nimport com.mpatric.mp3agic.InvalidDataException\nimport com.mpatric.mp3agic.Mp3File\nimport com.shabinder.common.core_components.media_converter.MediaConverter\nimport com.shabinder.common.core_components.parallel_executor.ParallelExecutor\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.core_components.removeAllTags\nimport com.shabinder.common.core_components.setId3v1Tags\nimport com.shabinder.common.core_components.setId3v2TagsAndSaveFile\nimport com.shabinder.common.database.SpotiFlyerDatabase\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.dispatcherIO\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.event.coroutines.map\nimport com.shabinder.database.Database\nimport kotlinx.coroutines.DelicateCoroutinesApi\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.launch\nimport kotlinx.coroutines.withContext\nimport org.jetbrains.skia.Image\nimport org.koin.dsl.bind\nimport org.koin.dsl.module\nimport java.awt.image.BufferedImage\nimport java.io.ByteArrayOutputStream\nimport java.io.File\nimport java.io.IOException\nimport java.io.InputStream\nimport java.net.HttpURLConnection\nimport java.net.URL\nimport javax.imageio.ImageIO\n\ninternal actual fun fileManagerModule() = module {\n    single { DesktopFileManager(get(), get(), get(), get()) } bind FileManager::class\n}\n\nval DownloadProgressFlow: MutableSharedFlow<HashMap<String, DownloadStatus>> = MutableSharedFlow(1)\n\n// Scope Allowing 4 Parallel Downloads\nval DownloadScope = ParallelExecutor(Dispatchers.IO)\n\nclass DesktopFileManager(\n    override val logger: Kermit,\n    override val preferenceManager: PreferenceManager,\n    override val mediaConverter: MediaConverter,\n    spotiFlyerDatabase: SpotiFlyerDatabase,\n) : FileManager {\n\n    init {\n        createDirectories()\n    }\n\n    override fun fileSeparator(): String = File.separator\n\n    override fun imageCacheDir(): String = System.getProperty(\"user.home\") +\n            fileSeparator() + \"SpotiFlyer/.images\" + fileSeparator()\n\n    private val defaultBaseDir = System.getProperty(\"user.home\")\n\n    override fun defaultDir(): String = (preferenceManager.downloadDir ?: defaultBaseDir) + fileSeparator() +\n            \"SpotiFlyer\" + fileSeparator()\n\n    override fun isPresent(path: String): Boolean = File(path).exists()\n\n    override fun createDirectory(dirPath: String) {\n        val yourAppDir = File(dirPath)\n\n        if (!yourAppDir.exists() && !yourAppDir.isDirectory) { // create empty directory\n            if (yourAppDir.mkdirs()) {\n                logger.i { \"$dirPath created\" }\n            } else {\n                logger.e { \"Unable to create Dir: $dirPath!\" }\n            }\n        } else {\n            logger.i { \"$dirPath already exists\" }\n        }\n    }\n\n    override suspend fun clearCache() {\n        File(imageCacheDir()).deleteRecursively()\n    }\n\n    override suspend fun cacheImage(image: Any, path: String): Unit = withContext(dispatcherIO) {\n        try {\n            val file = File(path)\n            if(!file.parentFile.exists()) createDirectories()\n            (image as? BufferedImage)?.let {\n                ImageIO.write(it, \"jpeg\", file)\n             }\n        } catch (e: IOException) {\n            e.printStackTrace()\n        }\n    }\n\n    @Suppress(\"BlockingMethodInNonBlockingContext\")\n    override suspend fun saveFileWithMetadata(\n        mp3ByteArray: ByteArray,\n        trackDetails: TrackDetails,\n        postProcess: (track: TrackDetails) -> Unit\n    ) = withContext(dispatcherIO) {\n        val songFile = File(trackDetails.outputFilePath)\n        try {\n            /*\n            * Check , if Fetch was Used, File is saved Already, else write byteArray we Received\n            * */\n            if (!songFile.exists()) {\n                /*Make intermediate Dirs if they don't exist yet*/\n                songFile.parentFile.mkdirs()\n            }\n\n            if (mp3ByteArray.isNotEmpty()) songFile.writeBytes(mp3ByteArray)\n            try {\n                // Add Mp3 Tags and Add to Library\n                Mp3File(File(songFile.absolutePath))\n                    .removeAllTags()\n                    .setId3v1Tags(trackDetails)\n                    .setId3v2TagsAndSaveFile(trackDetails)\n                addToLibrary(songFile.absolutePath)\n            } catch (e: Exception) {\n                // Media File Isn't MP3 lets Convert It first\n                if (e is InvalidDataException) {\n                    val convertedFilePath = songFile.absolutePath.substringBeforeLast('.') + \".temp.mp3\"\n\n                    val conversionResult = mediaConverter.convertAudioFile(\n                        inputFilePath = songFile.absolutePath,\n                        outputFilePath = convertedFilePath,\n                        trackDetails.audioQuality\n                    )\n\n                    conversionResult.map { outputFilePath ->\n                        Mp3File(File(outputFilePath))\n                            .removeAllTags()\n                            .setId3v1Tags(trackDetails)\n                            .setId3v2TagsAndSaveFile(trackDetails, trackDetails.outputFilePath)\n\n                        addToLibrary(trackDetails.outputFilePath)\n                    }.fold(\n                        success = {},\n                        failure = {\n                            throw it\n                        }\n                    )\n                    File(convertedFilePath).delete()\n                } else throw e\n            }\n            SuspendableEvent.success(trackDetails.outputFilePath)\n        } catch (e: Throwable) {\n            if (e is JaffreeException) Actions.instance.showPopUpMessage(\"No FFmpeg found at path.\")\n            if (songFile.exists()) songFile.delete()\n            logger.e { \"${songFile.absolutePath} could not be created\" }\n            SuspendableEvent.error(e)\n        }\n    }\n\n    override fun addToLibrary(path: String) {}\n\n    override suspend fun loadImage(url: String, reqWidth: Int, reqHeight: Int): Picture {\n        var picture: ImageBitmap? = loadCachedImage(getImageCachePath(url), reqWidth, reqHeight)\n        if (picture == null) picture = freshImage(url, reqWidth, reqHeight)\n        return Picture(image = picture)\n    }\n\n    private fun loadCachedImage(cachePath: String, reqWidth: Int, reqHeight: Int): ImageBitmap? {\n        return try {\n            ImageIO.read(File(cachePath))?.toImageBitmap()\n        } catch (e: Exception) {\n            // e.printStackTrace()\n            null\n        }\n    }\n\n    @OptIn(DelicateCoroutinesApi::class)\n    @Suppress(\"BlockingMethodInNonBlockingContext\")\n    private suspend fun freshImage(url: String, reqWidth: Int, reqHeight: Int): ImageBitmap? {\n        return withContext(Dispatchers.IO) {\n            try {\n                val source = URL(url)\n                val connection: HttpURLConnection = source.openConnection() as HttpURLConnection\n                connection.connectTimeout = 5000\n                connection.connect()\n\n                val input: InputStream = connection.inputStream\n                val result: BufferedImage? = ImageIO.read(input)\n\n                if (result != null) {\n                    GlobalScope.launch(Dispatchers.IO) { // TODO Refactor\n                        cacheImage(result, getImageCachePath(url))\n                    }\n                    result.toImageBitmap()\n                } else null\n            } catch (e: Exception) {\n                e.printStackTrace()\n                null\n            }\n        }\n    }\n\n    override val db: Database? = spotiFlyerDatabase.instance\n}\n\nfun BufferedImage.toImageBitmap() = Image.makeFromEncoded(\n    toByteArray(this)\n).asImageBitmap()\n\nprivate fun toByteArray(bitmap: BufferedImage): ByteArray {\n    val baOs = ByteArrayOutputStream()\n    ImageIO.write(bitmap, \"png\", baOs)\n    return baOs.toByteArray()\n}\n"
  },
  {
    "path": "common/core-components/src/desktopMain/kotlin/com.shabinder.common.core_components/media_converter/DesktopMediaConverter.kt",
    "content": "package com.shabinder.common.core_components.media_converter\n\nimport com.github.kokorin.jaffree.ffmpeg.FFmpeg\nimport com.github.kokorin.jaffree.ffmpeg.UrlInput\nimport com.github.kokorin.jaffree.ffmpeg.UrlOutput\nimport com.shabinder.common.models.AudioQuality\nimport org.koin.dsl.bind\nimport org.koin.dsl.module\nimport kotlin.io.path.Path\n\nclass DesktopMediaConverter : MediaConverter() {\n\n    override suspend fun convertAudioFile(\n        inputFilePath: String,\n        outputFilePath: String,\n        audioQuality: AudioQuality,\n        progressCallbacks: (Long) -> Unit,\n    ) = executeSafelyInPool {\n        val audioBitrate =\n            if (audioQuality == AudioQuality.UNKNOWN) 192 else audioQuality.kbps.toIntOrNull()\n                ?: 192\n        FFmpeg.atPath().run {\n            addInput(UrlInput.fromUrl(inputFilePath))\n            setOverwriteOutput(true)\n            if (audioQuality != AudioQuality.UNKNOWN) {\n                addArguments(\"-b:a\", \"${audioBitrate}k\")\n            }\n            addArguments(\"-acodec\", \"libmp3lame\")\n            addArgument(\"-vn\")\n            addOutput(UrlOutput.toUrl(outputFilePath))\n            setProgressListener {\n                progressCallbacks(it.timeMillis)\n            }\n            execute()\n\n            return@run outputFilePath\n        }\n    }\n}\n\ninternal actual fun mediaConverterModule() = module {\n    single { DesktopMediaConverter() } bind MediaConverter::class\n}"
  },
  {
    "path": "common/core-components/src/desktopMain/kotlin/com.shabinder.common.core_components/media_converter/ID3Tagging.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.core_components\n\nimport com.mpatric.mp3agic.ID3v1Tag\nimport com.mpatric.mp3agic.ID3v24Tag\nimport com.mpatric.mp3agic.Mp3File\nimport com.shabinder.common.core_components.file_manager.downloadFile\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.TrackDetails\nimport kotlinx.coroutines.flow.collect\nimport java.io.File\nimport java.io.FileInputStream\n\nfun Mp3File.removeAllTags(): Mp3File {\n    if (hasId3v1Tag()) removeId3v1Tag()\n    if (hasId3v2Tag()) removeId3v2Tag()\n    if (hasCustomTag()) removeCustomTag()\n    return this\n}\n\n/**\n * Modifying Mp3 with MetaData!\n **/\nfun Mp3File.setId3v1Tags(track: TrackDetails): Mp3File {\n    val id3v1Tag = ID3v1Tag().apply {\n        artist = track.artists.joinToString(\",\")\n        title = track.title\n        album = track.albumName\n        year = track.year\n        comment = \"Genres:${track.comment}\"\n    }\n    this.id3v1Tag = id3v1Tag\n    return this\n}\n\n\n@Suppress(\"BlockingMethodInNonBlockingContext\")\nsuspend fun Mp3File.setId3v2TagsAndSaveFile(track: TrackDetails, outputFilePath: String? = null) {\n    val id3v2Tag = ID3v24Tag().apply {\n        albumArtist = track.albumArtists.joinToString(\", \")\n        artist = track.artists.joinToString(\", \")\n        title = track.title\n        album = track.albumName\n        year = track.year\n\n        genreDescription = \"Genre: \" + track.genre.joinToString(\", \")\n        comment = track.comment\n        lyrics = track.lyrics ?: \"\"\n        url = track.trackUrl\n        if (track.trackNumber != null)\n            this.track = track.trackNumber.toString()\n    }\n    try {\n        val art = File(track.albumArtPath)\n        val bytesArray = ByteArray(art.length().toInt())\n        val fis = FileInputStream(art)\n        fis.read(bytesArray) // read file into bytes[]\n        fis.close()\n        id3v2Tag.setAlbumImage(bytesArray, \"image/jpeg\")\n        this.id3v2Tag = id3v2Tag\n        saveFile(outputFilePath ?: track.outputFilePath)\n    } catch (e: java.io.FileNotFoundException) {\n        try {\n            // Image Still Not Downloaded!\n            // Lets Download Now and Write it into Album Art\n            downloadFile(track.albumArtURL).collect {\n                when (it) {\n                    is DownloadResult.Error -> {} // Error\n                    is DownloadResult.Success -> {\n                        id3v2Tag.setAlbumImage(it.byteArray, \"image/jpeg\")\n                        this.id3v2Tag = id3v2Tag\n                        saveFile(outputFilePath ?: track.outputFilePath)\n                    }\n                    is DownloadResult.Progress -> {} // Nothing for Now , no progress bar to show\n                }\n            }\n        } catch (e: Exception) {\n            e.printStackTrace()\n        }\n    }\n}\n\nfun Mp3File.saveFile(filePath: String) {\n    save(filePath.substringBeforeLast('.') + \".tagged.mp3\")\n\n    val oldFile = File(filePath)\n    oldFile.delete()\n\n    val newFile = File((filePath.substringBeforeLast('.') + \".tagged.mp3\"))\n    newFile.renameTo(File(filePath.substringBeforeLast('.') + \".mp3\"))\n}\n"
  },
  {
    "path": "common/core-components/src/desktopMain/kotlin/com.shabinder.common.core_components/picture/Picture.kt",
    "content": "package com.shabinder.common.core_components.picture\n\nimport androidx.compose.ui.graphics.ImageBitmap\n\nactual data class Picture(\n    var image: ImageBitmap?\n)"
  },
  {
    "path": "common/core-components/src/iosMain/kotlin/com.shabinder.common.core_components/IOSDeps.kt",
    "content": "package com.shabinder.common.di\n\nimport org.koin.core.component.KoinComponent\nimport org.koin.core.component.inject\n\n/*\n* Dependency Provider for IOS\n* */\nobject IOSDeps : KoinComponent {\n    val dir: Dir by inject() // = get()\n    val fetchPlatformQueryResult: FetchPlatformQueryResult by inject() //  get()\n    val database get() = dir.db\n    val sharedFlow = DownloadProgressFlow\n    val defaultDispatcher = dispatcherDefault\n}\n"
  },
  {
    "path": "common/core-components/src/iosMain/kotlin/com.shabinder.common.core_components/IOSDir.kt",
    "content": "package com.shabinder.common.di\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.database.SpotiFlyerDatabase\nimport com.shabinder.common.di.preference.PreferenceManager\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.database.Database\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.launch\nimport kotlinx.coroutines.withContext\nimport platform.Foundation.NSCachesDirectory\nimport platform.Foundation.NSDirectoryEnumerationSkipsHiddenFiles\nimport platform.Foundation.NSFileManager\nimport platform.Foundation.NSMusicDirectory\nimport platform.Foundation.NSURL\nimport platform.Foundation.NSURLConnection\nimport platform.Foundation.NSURLRequest\nimport platform.Foundation.NSUserDomainMask\nimport platform.Foundation.URLByAppendingPathComponent\nimport platform.Foundation.sendSynchronousRequest\nimport platform.Foundation.writeToFile\nimport platform.UIKit.UIImage\nimport platform.UIKit.UIImageJPEGRepresentation\n\nactual class Dir actual constructor(\n    val logger: Kermit,\n    private val preferenceManager: PreferenceManager,\n    spotiFlyerDatabase: SpotiFlyerDatabase,\n) {\n\n    actual fun isPresent(path: String): Boolean = NSFileManager.defaultManager.fileExistsAtPath(path)\n\n    actual fun fileSeparator(): String = \"/\"\n\n    private val defaultBaseDir = NSFileManager.defaultManager.URLForDirectory(NSMusicDirectory, NSUserDomainMask, null, true, null)!!.path!!\n\n    // TODO Error Handling\n    actual fun defaultDir(): String = (preferenceManager.downloadDir ?: defaultBaseDir) +\n        fileSeparator() + \"SpotiFlyer\" + fileSeparator()\n\n    private val defaultDirURL: NSURL by lazy {\n        val musicDir = NSFileManager.defaultManager.URLForDirectory(NSMusicDirectory, NSUserDomainMask, null, true, null)!!\n        musicDir.URLByAppendingPathComponent(\"SpotiFlyer\", true)!!\n    }\n\n    actual fun imageCacheDir(): String = imageCacheURL.path!! + fileSeparator()\n\n    private val imageCacheURL: NSURL by lazy {\n        val cacheDir = NSFileManager.defaultManager.URLForDirectory(NSCachesDirectory, NSUserDomainMask, null, true, null)\n        cacheDir?.URLByAppendingPathComponent(\"SpotiFlyer\", true)!!\n    }\n\n    actual fun createDirectory(dirPath: String) {\n        try {\n            NSFileManager.defaultManager.createDirectoryAtPath(dirPath, true, null, null)\n        } catch (e: Exception) {\n            e.printStackTrace()\n        }\n    }\n\n    fun createDirectory(dirURL: NSURL) {\n        try {\n            NSFileManager.defaultManager.createDirectoryAtURL(dirURL, true, null, null)\n        } catch (e: Exception) {\n            e.printStackTrace()\n        }\n    }\n\n    actual suspend fun cacheImage(image: Any, path: String): Unit = withContext(dispatcherIO) {\n        try {\n            (image as? UIImage)?.let {\n                // We Will Be Using JPEG as default format everywhere\n                UIImageJPEGRepresentation(it, 1.0)\n                    ?.writeToFile(path, true)\n            }\n        } catch (e: Exception) {\n            e.printStackTrace()\n        }\n    }\n\n    actual suspend fun loadImage(url: String, reqWidth: Int, reqHeight: Int): Picture = withContext(dispatcherIO) {\n        try {\n            val cachePath = imageCacheURL.URLByAppendingPathComponent(getNameURL(url))\n            Picture(image = cachePath?.path?.let { loadCachedImage(it) } ?: loadFreshImage(url))\n        } catch (e: Exception) {\n            e.printStackTrace()\n            Picture(null)\n        }\n    }\n\n    private fun loadCachedImage(filePath: String, reqWidth: Int = 150, reqHeight: Int = 150): UIImage? {\n        return try {\n            UIImage.imageWithContentsOfFile(filePath)\n        } catch (e: Exception) {\n            e.printStackTrace()\n            null\n        }\n    }\n\n    private suspend fun loadFreshImage(url: String, reqWidth: Int = 150, reqHeight: Int = 150): UIImage? = withContext(dispatcherIO) {\n        try {\n            val nsURL = NSURL(string = url)\n            val data = NSURLConnection.sendSynchronousRequest(NSURLRequest.requestWithURL(nsURL), null, null)\n            if (data != null) {\n                UIImage.imageWithData(data)?.also {\n                    GlobalScope.launch {\n                        cacheImage(it, imageCacheDir() + getNameURL(url))\n                    }\n                }\n            } else null\n        } catch (e: Exception) {\n            e.printStackTrace()\n            null\n        }\n    }\n\n    actual suspend fun clearCache(): Unit = withContext(dispatcherIO) {\n        try {\n            val fileManager = NSFileManager.defaultManager\n            val paths = fileManager.contentsOfDirectoryAtURL(\n                imageCacheURL,\n                null,\n                NSDirectoryEnumerationSkipsHiddenFiles,\n                null\n            )\n            paths?.forEach {\n                (it as? NSURL)?.let { nsURL ->\n                    // Lets Remove Cached File\n                    fileManager.removeItemAtURL(nsURL, null)\n                }\n            }\n        } catch (e: Exception) {\n            e.printStackTrace()\n        }\n    }\n\n    actual suspend fun saveFileWithMetadata(\n        mp3ByteArray: ByteArray,\n        trackDetails: TrackDetails,\n        postProcess: (track: TrackDetails) -> Unit\n    ): Unit = withContext(dispatcherIO) {\n        try {\n            if (mp3ByteArray.isNotEmpty()) {\n                mp3ByteArray.toNSData().writeToFile(\n                    trackDetails.outputFilePath,\n                    true\n                )\n            }\n            when (trackDetails.outputFilePath.substringAfterLast('.')) {\n                \".mp3\" -> {\n                    if (!isPresent(trackDetails.albumArtPath)) {\n                        val imageData = downloadByteArray(\n                            trackDetails.albumArtURL\n                        )?.toNSData()\n                        if (imageData != null) {\n                            UIImage.imageWithData(imageData)?.also {\n                                cacheImage(it, trackDetails.albumArtPath)\n                            }\n                        }\n                    }\n                    postProcess(trackDetails)\n                    /*val file = TLAudio(trackDetails.outputFilePath)\n                    file.addTagsAndSave(\n                    trackDetails,\n                    this::loadCachedImage,\n                    this::addToLibrary\n                )*/\n                }\n            }\n        } catch (e: Exception) {\n            e.printStackTrace()\n        }\n    }\n\n    actual fun addToLibrary(path: String) {\n        // TODO\n    }\n\n    actual val db: Database? = spotiFlyerDatabase.instance\n}\n"
  },
  {
    "path": "common/core-components/src/iosMain/kotlin/com.shabinder.common.core_components/IOSTagging.kt",
    "content": "package com.shabinder.common.di\n/*\n\nimport cocoapods.TagLibIOS.TLAudio\nimport com.shabinder.common.models.TrackDetails\nimport platform.Foundation.NSNumber\nimport platform.UIKit.UIImage\nimport platform.UIKit.UIImageJPEGRepresentation\n\nsuspend fun TLAudio.addTagsAndSave(\n    trackDetails: TrackDetails,\n    loadCachedImage:(path:String)->UIImage?,\n    addToLibrary:(path:String)->Unit\n) {\n    title = trackDetails.title\n    artist = trackDetails.artists.joinToString(\", \")\n    album = trackDetails.albumName\n    comment = trackDetails.comment\n    try { trackDetails.year?.substring(0, 4)?.toInt()?.let { year = NSNumber(it) } } catch (e: Exception) {}\n    try {\n        val image = loadCachedImage(trackDetails.albumArtPath)\n        if (image != null) {\n            setFrontCoverPicture(UIImageJPEGRepresentation(image,1.0))\n            save()\n            addToLibrary(trackDetails.outputFilePath)\n        }\n        throw Exception(\"Cached Image not Present,Trying to Download...\")\n    } catch (e: Exception){\n        e.printStackTrace()\n        try {\n            downloadByteArray(trackDetails.albumArtURL)?.toNSData()?.also {\n                setFrontCoverPicture(it)\n                save()\n                addToLibrary(trackDetails.outputFilePath)\n            }\n        } catch (e: Exception){ e.printStackTrace() }\n    }\n}*/\n"
  },
  {
    "path": "common/core-components/src/iosMain/kotlin/com.shabinder.common.core_components/IOSUtils.kt",
    "content": "package com.shabinder.common.di\n\nimport kotlinx.cinterop.memScoped\nimport kotlinx.cinterop.refTo\nimport kotlinx.cinterop.toCValues\nimport platform.Foundation.NSData\nimport platform.Foundation.create\nimport platform.posix.memcpy\n\n@OptIn(ExperimentalUnsignedTypes::class)\nfun ByteArray.toNSData(): NSData = memScoped {\n    return NSData.create(\n        bytes = toCValues().getPointer(this),\n        length = size.toULong()\n    )\n}\n\n@OptIn(ExperimentalUnsignedTypes::class)\nfun NSData.toByteArray(): ByteArray = memScoped {\n    val size = length.toInt()\n    val nsData = ByteArray(size)\n    memcpy(nsData.refTo(0), bytes, size.toULong())\n    return nsData\n}\n"
  },
  {
    "path": "common/core-components/src/iosMain/kotlin/com.shabinder.common.core_components/picture/IOSPicture.kt",
    "content": "package com.shabinder.common.di\n\nimport platform.UIKit.UIImage\n\nactual data class Picture(\n    val image: UIImage?\n)\n"
  },
  {
    "path": "common/core-components/src/jsMain/kotlin/com.shabinder.common.core_components/FileSave.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n@file:JsModule(\"file-saver\")\n@file:JsNonModule\n\npackage com.shabinder.common.core_components\n\nimport org.w3c.files.Blob\n\nexternal interface FileSaverOptions {\n    var autoBom: Boolean\n}\n\nexternal fun saveAs(data: Blob, filename: String = definedExternally, options: FileSaverOptions = definedExternally)\n\nexternal fun saveAs(data: Blob)\n\nexternal fun saveAs(data: Blob, filename: String = definedExternally)\n\nexternal fun saveAs(data: String, filename: String = definedExternally, options: FileSaverOptions = definedExternally)\n\nexternal fun saveAs(data: String)\n\nexternal fun saveAs(data: String, filename: String = definedExternally)\n\nexternal fun saveAs(data: Blob, filename: String = definedExternally, disableAutoBOM: Boolean = definedExternally)\n\nexternal fun saveAs(data: String, filename: String = definedExternally, disableAutoBOM: Boolean = definedExternally)\n"
  },
  {
    "path": "common/core-components/src/jsMain/kotlin/com.shabinder.common.core_components/ID3Writer.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.core_components\n\nimport org.khronos.webgl.ArrayBuffer\nimport org.w3c.files.Blob\n\n@JsModule(\"browser-id3-writer\")\n@JsNonModule\nexternal class ID3Writer(a: ArrayBuffer) {\n    fun setFrame(frameName: String, frameValue: Any): ID3Writer\n    fun removeTag()\n    fun addTag(): ArrayBuffer\n    fun getBlob(): Blob\n    fun getURL(): String\n    fun revokeURL()\n}\n"
  },
  {
    "path": "common/core-components/src/jsMain/kotlin/com.shabinder.common.core_components/analytics/WebAnalyticsManager.kt",
    "content": "package com.shabinder.common.core_components.analytics\n\nimport org.koin.dsl.bind\nimport org.koin.dsl.module\n\n// TODO(\"Not yet implemented\")\nprivate val webAnalytics =\n    object : AnalyticsManager {\n        override fun init() {}\n\n        override fun onStart() {}\n\n        override fun onStop() {}\n\n        override fun giveConsent() {}\n\n        override fun isTracking(): Boolean = false\n\n        override fun revokeConsent() {}\n\n        override fun sendView(name: String, extras: MutableMap<String, Any>) {}\n\n        override fun sendEvent(eventName: String, extras: MutableMap<String, Any>) {}\n\n        override fun sendCrashReport(error: Throwable, extras: MutableMap<String, Any>) {}\n    }\n\nactual fun analyticsModule() = module {\n    single { webAnalytics } bind AnalyticsManager::class\n}"
  },
  {
    "path": "common/core-components/src/jsMain/kotlin/com.shabinder.common.core_components/file_manager/WebFileManager.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.core_components.file_manager\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.ID3Writer\nimport com.shabinder.common.core_components.media_converter.MediaConverter\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.core_components.saveAs\nimport com.shabinder.common.database.SpotiFlyerDatabase\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.corsApi\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.utils.removeIllegalChars\nimport com.shabinder.database.Database\nimport kotlinext.js.Object\nimport kotlinext.js.js\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.flow.collect\nimport org.khronos.webgl.ArrayBuffer\nimport org.khronos.webgl.Int8Array\nimport org.koin.dsl.bind\nimport org.koin.dsl.module\nimport org.w3c.dom.ImageBitmap\n\n\ninternal actual fun fileManagerModule() = module {\n    single { WebFileManager(get(), get(), get(), get()) } bind FileManager::class\n}\n\nclass WebFileManager(\n    override val logger: Kermit,\n    override val preferenceManager: PreferenceManager,\n    override val mediaConverter: MediaConverter,\n    spotiFlyerDatabase: SpotiFlyerDatabase,\n) : FileManager {\n    /*init {\n        createDirectories()\n    }*/\n\n    /*\n    * TODO\n    * */\n    override fun fileSeparator(): String = \"/\"\n\n    override fun imageCacheDir(): String = \"TODO\" +\n            fileSeparator() + \"SpotiFlyer/.images\" + fileSeparator()\n\n    override fun defaultDir(): String = \"TODO\" + fileSeparator() +\n            \"SpotiFlyer\" + fileSeparator()\n\n    override fun isPresent(path: String): Boolean = false\n\n    override fun createDirectory(dirPath: String) {}\n\n    override suspend fun clearCache() {}\n\n    override suspend fun cacheImage(image: Any, path: String) {}\n\n    @Suppress(\"BlockingMethodInNonBlockingContext\")\n    override suspend fun saveFileWithMetadata(\n        mp3ByteArray: ByteArray,\n        trackDetails: TrackDetails,\n        postProcess: (track: TrackDetails) -> Unit\n    ): SuspendableEvent<String, Throwable> {\n        return SuspendableEvent {\n            val writer = ID3Writer(mp3ByteArray.toArrayBuffer())\n            val albumArt = downloadFile(corsApi + trackDetails.albumArtURL)\n            albumArt.collect {\n                when (it) {\n                    is DownloadResult.Success -> {\n                        logger.d { \"Album Art Downloaded Success\" }\n                        val albumArtObj = js {\n                            this[\"type\"] = 3\n                            this[\"data\"] = it.byteArray.toArrayBuffer()\n                            this[\"description\"] = \"Cover Art\"\n                        }\n                        writeTagsAndSave(writer, albumArtObj as Object, trackDetails)\n                    }\n                    is DownloadResult.Error -> {\n                        logger.d { \"Album Art Downloading Error\" }\n                        writeTagsAndSave(writer, null, trackDetails)\n                    }\n                    is DownloadResult.Progress -> logger.d { \"Album Art Downloading: ${it.progress}\" }\n                }\n            }\n            trackDetails.outputFilePath\n        }\n    }\n\n    private suspend fun writeTagsAndSave(writer: ID3Writer, albumArt: Object?, trackDetails: TrackDetails) {\n        writer.apply {\n            setFrame(\"TIT2\", trackDetails.title)\n            setFrame(\"TPE1\", trackDetails.artists.toTypedArray())\n            setFrame(\"TALB\", trackDetails.albumName ?: \"\")\n            try {\n                trackDetails.year?.substring(0, 4)?.toInt()?.let { setFrame(\"TYER\", it) }\n            } catch (e: Exception) {\n            }\n            setFrame(\"TPE2\", trackDetails.artists.joinToString(\",\"))\n            setFrame(\"WOAS\", trackDetails.source.toString())\n            setFrame(\"TLEN\", trackDetails.durationSec)\n            albumArt?.let { setFrame(\"APIC\", it) }\n        }\n        writer.addTag()\n        allTracksStatus[trackDetails.title] = DownloadStatus.Downloaded\n        DownloadProgressFlow.emit(allTracksStatus)\n        saveAs(writer.getBlob(), \"${removeIllegalChars(trackDetails.title)}.mp3\")\n    }\n\n    override fun addToLibrary(path: String) {}\n\n    override suspend fun loadImage(url: String, reqWidth: Int, reqHeight: Int): Picture {\n        return Picture(url)\n    }\n\n    private fun loadCachedImage(cachePath: String): ImageBitmap? = null\n\n    private suspend fun freshImage(url: String): ImageBitmap? = null\n\n    override val db: Database? = spotiFlyerDatabase.instance\n}\n\nfun ByteArray.toArrayBuffer(): ArrayBuffer {\n    return this.unsafeCast<Int8Array>().buffer\n}\n\nval DownloadProgressFlow: MutableSharedFlow<HashMap<String, DownloadStatus>> = MutableSharedFlow(1)\n\n// Error:https://github.com/Kotlin/kotlinx.atomicfu/issues/182\n// val DownloadScope = ParallelExecutor(Dispatchers.Default) //Download Pool of 4 parallel\nval allTracksStatus: HashMap<String, DownloadStatus> = hashMapOf()\n"
  },
  {
    "path": "common/core-components/src/jsMain/kotlin/com.shabinder.common.core_components/media_converter/WebMediaConverter.kt",
    "content": "package com.shabinder.common.core_components.media_converter\n\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.event.Event\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport org.koin.dsl.bind\nimport org.koin.dsl.module\n\nclass WebMediaConverter: MediaConverter() {\n    override suspend fun convertAudioFile(\n        inputFilePath: String,\n        outputFilePath: String,\n        audioQuality: AudioQuality,\n        progressCallbacks: (Long) -> Unit\n    ): SuspendableEvent<String, Throwable> {\n        // TODO(\"Not yet implemented\")\n        return SuspendableEvent.error(NotImplementedError())\n    }\n}\n\ninternal actual fun mediaConverterModule() = module {\n    single { WebMediaConverter() } bind MediaConverter::class\n}"
  },
  {
    "path": "common/core-components/src/jsMain/kotlin/com.shabinder.common.core_components/picture/Picture.kt",
    "content": "package com.shabinder.common.core_components.picture\n\nactual data class Picture(\n    var imageUrl: String\n)"
  },
  {
    "path": "common/core-components/src/jsMain/kotlin/com.shabinder.common.core_components/utils/WebHttpClient.kt",
    "content": "package com.shabinder.common.core_components.utils\n\nimport io.ktor.client.HttpClient\nimport io.ktor.client.HttpClientConfig\nimport io.ktor.client.engine.js.Js\n\nactual fun buildHttpClient(extraConfig: HttpClientConfig<*>.() -> Unit): HttpClient = HttpClient(Js) {\n    extraConfig()\n}\n"
  },
  {
    "path": "common/data-models/build.gradle.kts",
    "content": "import de.comahe.i18n4k.gradle.plugin.i18n4k\n\n/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"android-setup\")\n    id(\"multiplatform-setup\")\n    id(\"multiplatform-setup-test\")\n    id(\"kotlin-parcelize\")\n    kotlin(\"plugin.serialization\")\n    id(\"de.comahe.i18n4k\")\n}\n\ni18n4k {\n    inputDirectory = \"../../translations\"\n    packageName = \"com.shabinder.common.translations\"\n    // sourceCodeLocales = listOf(\"en\", \"de\", \"es\", \"fr\", \"id\", \"pt\", \"ru\", \"uk\")\n}\n\nkotlin {\n    sourceSets {\n        /*\n        * Depend on https://github.com/ReactiveCircus/cache4k\n        * -As Soon as Kotlin 1.5 and Compose becomes compatible\n        * */\n        all {\n            languageSettings.apply {\n                progressiveMode = true\n                enableLanguageFeature(\"NewInference\")\n                useExperimentalAnnotation(\"kotlin.Experimental\")\n                useExperimentalAnnotation(\"kotlin.time.ExperimentalTime\")\n            }\n        }\n        commonMain {\n            dependencies {\n                with(deps) {\n                    api(bundles.stately)\n                    api(i18n4k.core)\n                    api(kermit)\n                    api(moko.parcelize)\n                    implementation(youtube.downloader)\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.models\"/>\n"
  },
  {
    "path": "common/data-models/src/androidMain/kotlin/com.shabinder.common.models/AndroidAtomicReference.kt",
    "content": "package com.shabinder.common.models\n\nactual class NativeAtomicReference<T> actual constructor(actual var value: T)\n"
  },
  {
    "path": "common/data-models/src/androidMain/kotlin/com.shabinder.common.models/AndroidDispatcher.kt",
    "content": "package com.shabinder.common.models\n\nimport kotlinx.coroutines.CoroutineDispatcher\nimport kotlinx.coroutines.Dispatchers\n\n// IO-Dispatcher\nactual val dispatcherIO: CoroutineDispatcher = Dispatchers.IO\n"
  },
  {
    "path": "common/data-models/src/androidMain/kotlin/com.shabinder.common.models/AndroidPlatformActions.kt",
    "content": "package com.shabinder.common.models\n\nimport android.content.SharedPreferences\nimport kotlinx.coroutines.CoroutineScope\n\nactual interface PlatformActions {\n\n    companion object {\n        const val SharedPreferencesKey = \"configurations\"\n    }\n\n    val imageCacheDir: String\n\n    val sharedPreferences: SharedPreferences?\n\n    fun addToLibrary(path: String)\n\n    fun sendTracksToService(array: List<TrackDetails>)\n}\n\ninternal actual val StubPlatformActions = object : PlatformActions {\n    override val imageCacheDir = \"\"\n\n    override val sharedPreferences: SharedPreferences? = null\n\n    override fun addToLibrary(path: String) {}\n\n    override fun sendTracksToService(array: List<TrackDetails>) {}\n}\n\nactual fun <T> runBlocking(block: suspend CoroutineScope.() -> T): T = kotlinx.coroutines.runBlocking { block() }"
  },
  {
    "path": "common/data-models/src/androidMain/res/drawable/jio_saavn.xml",
    "content": "<vector android:height=\"42dp\" android:viewportHeight=\"250\"\n    android:viewportWidth=\"488\" android:width=\"81.984dp\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:fillColor=\"#fff\" android:pathData=\"M483.73,36A53.1,53.1 0,0 0,452 4.28C438.49,0 425.94,0 400.84,0H325.16C300.07,0 287.52,0 274,4.28A53.08,53.08 0,0 0,242.28 36a76.64,76.64 0,0 0,-2 7.74,140.32 140.32,0 0,1 14,24.86c0.38,-9.57 1.27,-17.22 3.46,-24.14 4.68,-12.86 11.88,-20.06 24.74,-24.74C294.25,16 308.12,16 330,16h66c21.88,0 35.76,0 47.54,3.73 12.86,4.68 20,11.88 24.74,24.74C472,56.25 472,70.13 472,92v66c0,21.88 0,35.76 -3.72,47.53 -4.69,12.86 -11.88,20.06 -24.74,24.74C431.76,234 417.88,234 396,234H330c-21.89,0 -35.76,0 -47.54,-3.73 -12.86,-4.68 -20.06,-11.88 -24.74,-24.74 -2.19,-6.92 -3.09,-14.58 -3.46,-24.15a140.51,140.51 0,0 1,-14 24.85,77.18 77.18,0 0,0 2,7.77A53.08,53.08 0,0 0,274 245.73C287.52,250 300.07,250 325.16,250h75.68c25.1,0 37.65,0 51.16,-4.27A53.11,53.11 0,0 0,483.73 214C488,200.49 488,187.94 488,162.84V87.17C488,62.07 488,49.52 483.73,36Z\"/>\n    <path android:fillColor=\"#fff\" android:pathData=\"M422,217L380.33,217c-1.76,0 -5.83,-2.79 -2.63,-6.67 21.36,-23 48,-30.93 73.4,-39.42 3.32,-1 3.91,2.51 3.91,3.48v8.68C455,202.61 441.57,217 422,217ZM343.73,212.69c-4,-29.73 -18.06,-80.79 -71,-118.55A3.78,3.78 0,0 1,271 90.63L271,66.36c0,-26.69 18,-33.31 26.37,-33.31a4.3,4.3 0,0 1,4.07 2.1c25.24,55 41,89.86 50.7,172.83 0.05,1.62 0.31,2.39 1.28,0 6.86,-15.07 39.35,-92 26.44,-170.68a3.64,3.64 0,0 1,3.5 -4.25L422,33.05c19.54,0 33,13.43 33,33.36L455,100.5a3.63,3.63 0,0 1,-2.07 3.36,180.12 180.12,0 0,0 -90.3,109.25c-0.79,2.21 -1.25,3.9 -3.71,3.9h-11.8C344.77,217 344.27,216.05 343.73,212.7ZM304.35,217c-20,0 -33.35,-12.37 -33.35,-33.93v-2.24c0,-0.9 0.71,-4.29 4.09,-3.63 20.24,6.23 41.92,12.52 57.77,33.49 1.82,2.56 0.23,6.3 -2.91,6.31Z\"/>\n    <path android:fillColor=\"#fff\" android:pathData=\"M124.991,239.991a115,115 54.655,1 0,2.007 -229.991a115,115 54.655,1 0,-2.007 229.991z\"/>\n    <path android:fillColor=\"#2bc5b4\" android:pathData=\"M180.77,114.59c-8.62,0 -15.61,7.39 -15.61,16.49s7,16.5 15.61,16.5 15.62,-7.38 15.62,-16.5S189.4,114.59 180.77,114.59Z\"/>\n    <path android:fillColor=\"#2bc5b4\" android:pathData=\"M125,0A125,125 0,1 0,250 125,125 125,0 0,0 125,0ZM95.37,132.09c0,63.82 -101.74,35.68 -60.49,2.93 9.65,13.39 28.18,12.5 30.15,-0.72l0.37,-52.05c0.95,-13.32 26.85,-16 30,0ZM133.31,156.32a12.05,12.05 0,0 1,-12 12L116.1,168.32a12.05,12.05 0,0 1,-12 -12L104.1,106a12,12 0,0 1,12 -12h5.21a12,12 0,0 1,12 12ZM133.31,74.56a11.84,11.84 0,0 1,-11.79 11.79L115.9,86.35a11.84,11.84 0,0 1,-11.81 -11.79L104.09,71.65A11.83,11.83 0,0 1,115.9 59.86h5.62a11.82,11.82 0,0 1,11.79 11.79ZM180.77,169.9c-22,0 -39.82,-17.37 -39.82,-38.82s17.84,-38.81 39.82,-38.81 39.81,17.38 39.81,38.81S202.76,169.9 180.77,169.9Z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/caching/Cache.kt",
    "content": "package com.shabinder.common.caching\n\nimport kotlin.time.Duration\nimport kotlin.time.ExperimentalTime\nimport kotlin.time.TimeSource\n\n/**\n * An in-memory key-value cache with support for time-based (expiration) and size-based evictions.\n */\npublic interface Cache<in Key : Any, Value : Any> {\n\n    /**\n     * Returns the value associated with [key] in this cache, or null if there is no\n     * cached value for [key].\n     */\n    public fun get(key: Key): Value?\n\n    /**\n     * Returns the value associated with [key] in this cache if exists,\n     * otherwise gets the value by invoking [loader], associates the value with [key] in the cache,\n     * and returns the cached value.\n     *\n     * Any exceptions thrown by the [loader] will be propagated to the caller of this function.\n     */\n    public suspend fun get(key: Key, loader: suspend () -> Value): Value\n\n    public fun getBlocking(key: Key, loader: suspend () -> Value): Value\n\n    /**\n     * Associates [value] with [key] in this cache. If the cache previously contained a\n     * value associated with [key], the old value is replaced by [value].\n     */\n    public fun put(key: Key, value: Value)\n\n    /**\n     * Discards any cached value for key [key].\n     */\n    public fun invalidate(key: Key)\n\n    /**\n     * Discards all entries in the cache.\n     */\n    public fun invalidateAll()\n\n    /**\n     * Returns a defensive copy of cache entries as [Map].\n     */\n    public fun asMap(): Map<in Key, Value>\n\n    /**\n     * Main entry point for creating a [Cache].\n     */\n    public interface Builder {\n\n        /**\n         * Specifies that each entry should be automatically removed from the cache once a fixed duration\n         * has elapsed after the entry's creation or the most recent replacement of its value.\n         *\n         * When [duration] is zero, the cache's max size will be set to 0\n         * meaning no values will be cached.\n         */\n        public fun expireAfterWrite(duration: Duration): Builder\n\n        /**\n         * Specifies that each entry should be automatically removed from the cache once a fixed duration\n         * has elapsed after the entry's creation, the most recent replacement of its value, or its last\n         * access.\n         *\n         * When [duration] is zero, the cache's max size will be set to 0\n         * meaning no values will be cached.\n         */\n        public fun expireAfterAccess(duration: Duration): Builder\n\n        /**\n         * Specifies the maximum number of entries the cache may contain.\n         * Cache eviction policy is based on LRU - i.e. least recently accessed entries get evicted first.\n         *\n         * When [size] is 0, entries will be discarded immediately and no values will be cached.\n         *\n         * If not set, cache size will be unlimited.\n         */\n        public fun maximumCacheSize(size: Long): Builder\n\n        /**\n         * Specifies a [FakeTimeSource] for programmatically advancing the reading of the underlying\n         * [TimeSource] used for expiry checks in tests.\n         *\n         * If not specified, [TimeSource.Monotonic] will be used for expiry checks.\n         */\n        public fun fakeTimeSource(fakeTimeSource: FakeTimeSource): Builder\n\n        /**\n         * Builds a new instance of [Cache] with the specified configurations.\n         */\n        public fun <K : Any, V : Any> build(): Cache<K, V>\n\n        public companion object {\n\n            /**\n             * Returns a new [Cache.Builder] instance.\n             */\n            public fun newBuilder(): Builder = CacheBuilderImpl()\n        }\n    }\n}\n\n/**\n * A default implementation of [Cache.Builder].\n */\ninternal class CacheBuilderImpl : Cache.Builder {\n\n    private var expireAfterWriteDuration = Duration.INFINITE\n\n    private var expireAfterAccessDuration = Duration.INFINITE\n    private var maxSize = UNSET_LONG\n    private var fakeTimeSource: FakeTimeSource? = null\n\n    override fun expireAfterWrite(duration: Duration): CacheBuilderImpl = apply {\n        require(duration.isPositive()) {\n            \"expireAfterWrite duration must be positive\"\n        }\n        this.expireAfterWriteDuration = duration\n    }\n\n    override fun expireAfterAccess(duration: Duration): CacheBuilderImpl = apply {\n        require(duration.isPositive()) {\n            \"expireAfterAccess duration must be positive\"\n        }\n        this.expireAfterAccessDuration = duration\n    }\n\n    override fun maximumCacheSize(size: Long): CacheBuilderImpl = apply {\n        require(size >= 0) {\n            \"maximum size must not be negative\"\n        }\n        this.maxSize = size\n    }\n\n    override fun fakeTimeSource(fakeTimeSource: FakeTimeSource): CacheBuilderImpl = apply {\n        this.fakeTimeSource = fakeTimeSource\n    }\n\n    override fun <K : Any, V : Any> build(): Cache<K, V> {\n        return RealCache(\n            expireAfterWriteDuration,\n            expireAfterAccessDuration,\n            maxSize,\n            fakeTimeSource ?: TimeSource.Monotonic,\n        )\n    }\n\n    companion object {\n        internal const val UNSET_LONG: Long = -1\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/caching/FakeTimeSource.kt",
    "content": "package com.shabinder.common.caching\n\nimport co.touchlab.stately.concurrency.AtomicLong\nimport kotlin.time.AbstractLongTimeSource\nimport kotlin.time.Duration\nimport kotlin.time.DurationUnit\n\n/**\n * A time source that has programmatically updatable readings with support for multi-threaded access in Kotlin/Native.\n *\n * Implementation is identical to [kotlin.time.TestTimeSource] except the internal [reading] is an [AtomicLong].\n */\npublic class FakeTimeSource : AbstractLongTimeSource(unit = DurationUnit.NANOSECONDS) {\n\n    private val reading = AtomicLong(0)\n\n    override fun read(): Long = reading.get()\n\n    /**\n     * Advances the current reading value of this time source by the specified [duration].\n     *\n     * [duration] value is rounded down towards zero when converting it to a [Long] number of nanoseconds.\n     * For example, if the duration being added is `0.6.nanoseconds`, the reading doesn't advance because\n     * the duration value is rounded to zero nanoseconds.\n     *\n     * @throws IllegalStateException when the reading value overflows as the result of this operation.\n     */\n    public operator fun plusAssign(duration: Duration) {\n        val delta = duration.toDouble(unit)\n        val longDelta = delta.toLong()\n        reading.set(\n            reading.get().let { currentReading ->\n                if (longDelta != Long.MIN_VALUE && longDelta != Long.MAX_VALUE) {\n                    // when delta fits in long, add it as long\n                    val newReading = currentReading + longDelta\n                    if (currentReading xor longDelta >= 0 && currentReading xor newReading < 0) overflow(duration)\n                    newReading\n                } else {\n                    // when delta is greater than long, add it as double\n                    val newReading = currentReading + delta\n                    if (newReading > Long.MAX_VALUE || newReading < Long.MIN_VALUE) overflow(duration)\n                    newReading.toLong()\n                }\n            }\n        )\n    }\n\n    private fun overflow(duration: Duration) {\n        throw IllegalStateException(\"FakeTimeSource will overflow if its reading ${reading}ns is advanced by $duration.\")\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/caching/RealCache.kt",
    "content": "package com.shabinder.common.caching\n\nimport co.touchlab.stately.collections.IsoMutableMap\nimport co.touchlab.stately.collections.IsoMutableSet\nimport co.touchlab.stately.concurrency.AtomicReference\nimport co.touchlab.stately.concurrency.value\nimport com.shabinder.common.models.runBlocking\nimport kotlin.time.Duration\nimport kotlin.time.TimeMark\nimport kotlin.time.TimeSource\n\n/**\n * A Kotlin Multiplatform [Cache] implementation powered by touchlab/Stately.\n *\n * Two types of evictions are supported:\n *\n * 1. Time-based evictions (expiration)\n * 2. Size-based evictions\n *\n * Time-based evictions are enabled by specifying [expireAfterWriteDuration] and/or [expireAfterAccessDuration].\n * When [expireAfterWriteDuration] is specified, entries will be automatically removed from the cache\n * once a fixed duration has elapsed after the entry's creation\n * or most recent replacement of its value.\n * When [expireAfterAccessDuration] is specified, entries will be automatically removed from the cache\n * once a fixed duration has elapsed after the entry's creation,\n * the most recent replacement of its value, or its last access.\n *\n * Note that creation and replacement of an entry is also considered an access.\n *\n * Size-based evictions are enabled by specifying [maxSize]. When the size of the cache entries grows\n * beyond [maxSize], least recently accessed entries will be evicted.\n */\ninternal class RealCache<Key : Any, Value : Any>(\n    val expireAfterWriteDuration: Duration,\n    val expireAfterAccessDuration: Duration,\n    val maxSize: Long,\n    val timeSource: TimeSource,\n) : Cache<Key, Value> {\n\n    private val cacheEntries = IsoMutableMap<Key, CacheEntry<Key, Value>>()\n\n    /**\n     * Whether to perform size based evictions.\n     */\n    private val evictsBySize = maxSize >= 0\n\n    /**\n     * Whether to perform write-time based expiration.\n     */\n    private val expiresAfterWrite = expireAfterWriteDuration.isFinite()\n\n    /**\n     * Whether to perform access-time (both read and write) based expiration.\n     */\n    private val expiresAfterAccess = expireAfterAccessDuration.isFinite()\n\n    /**\n     * A queue of unique cache entries ordered by write time.\n     * Used for performing write-time based cache expiration.\n     */\n    private val writeQueue: IsoMutableSet<CacheEntry<Key, Value>>? =\n        takeIf { expiresAfterWrite }?.let {\n            ReorderingIsoMutableSet()\n        }\n\n    /**\n     * A queue of unique cache entries ordered by access time.\n     * Used for performing both write-time and read-time based cache expiration\n     * as well as size-based eviction.\n     *\n     * Note that a write is also considered an access.\n     */\n    private val accessQueue: IsoMutableSet<CacheEntry<Key, Value>>? =\n        takeIf { expiresAfterAccess || evictsBySize }?.let {\n            ReorderingIsoMutableSet()\n        }\n\n    override fun get(key: Key): Value? {\n        return cacheEntries[key]?.let {\n            if (it.isExpired()) {\n                // clean up expired entries and return null\n                expireEntries()\n                null\n            } else {\n                // update eviction metadata\n                recordRead(it)\n                it.value.get()\n            }\n        }\n    }\n\n    override suspend fun get(key: Key, loader: suspend () -> Value): Value {\n        return cacheEntries[key]?.let {\n            if (it.isExpired()) {\n                // clean up expired entries\n                expireEntries()\n                null\n            } else {\n                // update eviction metadata\n                recordRead(it)\n                it.value.get()\n            }\n        } ?: loader().let { loadedValue ->\n            val existingValue = get(key)\n            if (existingValue != null) {\n                existingValue\n            } else {\n                put(key, loadedValue)\n                loadedValue\n            }\n        }\n    }\n\n\n    override fun getBlocking(key: Key, loader: suspend () -> Value): Value =\n        runBlocking {\n            get(key, loader)\n        }\n\n    override fun put(key: Key, value: Value) {\n        expireEntries()\n\n        val existingEntry = cacheEntries[key]\n        if (existingEntry != null) {\n            // cache entry found\n            recordWrite(existingEntry)\n            existingEntry.value.set(value)\n        } else {\n            // create a new cache entry\n            val nowTimeMark = timeSource.markNow()\n            val newEntry = CacheEntry(\n                key = key,\n                value = AtomicReference(value),\n                accessTimeMark = AtomicReference(nowTimeMark),\n                writeTimeMark = AtomicReference(nowTimeMark),\n            )\n            recordWrite(newEntry)\n            cacheEntries[key] = newEntry\n        }\n\n        evictEntries()\n    }\n\n    override fun invalidate(key: Key) {\n        expireEntries()\n        cacheEntries.remove(key)?.also {\n            writeQueue?.remove(it)\n            accessQueue?.remove(it)\n        }\n    }\n\n    override fun invalidateAll() {\n        cacheEntries.clear()\n        writeQueue?.clear()\n        accessQueue?.clear()\n    }\n\n    override fun asMap(): Map<in Key, Value> {\n        return cacheEntries.values.associate { entry ->\n            entry.key to entry.value.get()\n        }\n    }\n\n    /**\n     * Remove all expired entries.\n     */\n    private fun expireEntries() {\n        val queuesToProcess = listOfNotNull(\n            if (expiresAfterWrite) writeQueue else null,\n            if (expiresAfterAccess) accessQueue else null\n        )\n\n        queuesToProcess.forEach { queue ->\n            queue.access {\n                val iterator = queue.iterator()\n                for (entry in iterator) {\n                    if (entry.isExpired()) {\n                        cacheEntries.remove(entry.key)\n                        // remove the entry from the current queue\n                        iterator.remove()\n                    } else {\n                        // found unexpired entry, no need to look any further\n                        break\n                    }\n                }\n            }\n        }\n    }\n\n    /**\n     * Check whether the [CacheEntry] has expired based on either access time or write time.\n     */\n    private fun CacheEntry<Key, Value>.isExpired(): Boolean {\n        return expiresAfterAccess && (accessTimeMark.get() + expireAfterAccessDuration).hasPassedNow() ||\n                expiresAfterWrite && (writeTimeMark.get() + expireAfterWriteDuration).hasPassedNow()\n    }\n\n    /**\n     * Evict least recently accessed entries until [cacheEntries] is no longer over capacity.\n     */\n    private fun evictEntries() {\n        if (!evictsBySize) {\n            return\n        }\n\n        checkNotNull(accessQueue)\n\n        while (cacheEntries.size > maxSize) {\n            accessQueue.access {\n                it.firstOrNull()?.run {\n                    cacheEntries.remove(key)\n                    writeQueue?.remove(this)\n                    accessQueue.remove(this)\n                }\n            }\n        }\n    }\n\n    /**\n     * Update the eviction metadata on the [cacheEntry] which has just been read.\n     */\n    private fun recordRead(cacheEntry: CacheEntry<Key, Value>) {\n        if (expiresAfterAccess) {\n            val accessTimeMark = cacheEntry.accessTimeMark.value\n            cacheEntry.accessTimeMark.set(accessTimeMark + accessTimeMark.elapsedNow())\n        }\n        accessQueue?.add(cacheEntry)\n    }\n\n    /**\n     * Update the eviction metadata on the [CacheEntry] which is about to be written.\n     * Note that a write is also considered an access.\n     */\n    private fun recordWrite(cacheEntry: CacheEntry<Key, Value>) {\n        if (expiresAfterAccess) {\n            val accessTimeMark = cacheEntry.accessTimeMark.value\n            cacheEntry.accessTimeMark.set(accessTimeMark + accessTimeMark.elapsedNow())\n        }\n        if (expiresAfterWrite) {\n            val writeTimeMark = cacheEntry.writeTimeMark.value\n            cacheEntry.writeTimeMark.set(writeTimeMark + writeTimeMark.elapsedNow())\n        }\n        accessQueue?.add(cacheEntry)\n        writeQueue?.add(cacheEntry)\n    }\n}\n\n/**\n * A cache entry holds the [key] and [value] pair,\n * along with the metadata needed to perform cache expiration and eviction.\n */\nprivate class CacheEntry<Key : Any, Value : Any>(\n    val key: Key,\n    val value: AtomicReference<Value>,\n    val accessTimeMark: AtomicReference<TimeMark>,\n    val writeTimeMark: AtomicReference<TimeMark>,\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/caching/ReorderingIsoMutableSet.kt",
    "content": "package com.shabinder.common.caching\n\nimport co.touchlab.stately.collections.IsoMutableSet\n\n/**\n * A custom [IsoMutableSet] that updates the insertion order when an element is re-inserted,\n * i.e. an inserted element will always be placed at the end\n * regardless of whether the element already exists.\n */\ninternal class ReorderingIsoMutableSet<T> : IsoMutableSet<T>(), MutableSet<T> {\n    override fun add(element: T): Boolean = access {\n        val exists = remove(element)\n        super.add(element)\n        // respect the contract \"true if this set did not already contain the specified element\"\n        !exists\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/Actions.kt",
    "content": "package com.shabinder.common.models\n\nimport co.touchlab.stately.freeze\nimport kotlin.jvm.JvmStatic\n\n/*\n* Interface Having All Platform Dependent Functions\n* */\ninterface Actions {\n\n    // Platform Specific Actions\n    val platformActions: PlatformActions\n\n    // Platform Specific Implementation Preferred\n    val isInternetAvailable: Boolean\n\n    // Show Toast\n    fun showPopUpMessage(string: String, long: Boolean = false)\n\n    // Change Download Directory\n    fun setDownloadDirectoryAction(callBack: (String) -> Unit)\n\n    /*\n    * Query Downloading Tracks\n    * ex- Get Tracks from android service etc\n    * */\n    fun queryActiveTracks()\n\n    // Donate Money\n    fun giveDonation()\n\n    // Share SpotiFlyer App\n    fun shareApp()\n\n    // Copy to Clipboard\n    fun copyToClipboard(text: String)\n\n    // Open / Redirect to another Platform\n    fun openPlatform(packageID: String, platformLink: String)\n    fun writeMp3Tags(trackDetails: TrackDetails)\n\n    companion object {\n        /*\n        * Holder to call platform actions from anywhere\n        * */\n        @JvmStatic\n        var instance: Actions\n            get() = methodsAtomicRef.value\n            set(value) {\n                methodsAtomicRef.value = value\n            }\n\n        private val methodsAtomicRef = NativeAtomicReference(stubActions().freeze())\n    }\n}\n\nprivate fun stubActions(): Actions = object : Actions {\n    override val platformActions = StubPlatformActions\n    override fun showPopUpMessage(string: String, long: Boolean) {}\n    override fun setDownloadDirectoryAction(callBack: (String) -> Unit) {}\n    override fun queryActiveTracks() {}\n    override fun giveDonation() {}\n    override fun shareApp() {}\n    override fun copyToClipboard(text: String) {}\n\n    override fun openPlatform(packageID: String, platformLink: String) {}\n    override fun writeMp3Tags(trackDetails: TrackDetails) {}\n\n    override val isInternetAvailable: Boolean = true\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/AudioFormat.kt",
    "content": "package com.shabinder.common.models\n\nenum class AudioFormat {\n    MP3, MP4, FLAC, UNKNOWN\n}"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/AudioQuality.kt",
    "content": "package com.shabinder.common.models\n\nenum class AudioQuality(val kbps: String) {\n    KBPS128(\"128\"),\n    KBPS160(\"160\"),\n    KBPS192(\"192\"),\n    KBPS256(\"256\"),\n    KBPS320(\"320\"),\n    UNKNOWN(\"-1\");\n\n    companion object {\n        fun getQuality(kbps: String): AudioQuality {\n            return when (kbps) {\n                \"128\" -> KBPS128\n                \"160\" -> KBPS160\n                \"192\" -> KBPS192\n                \"256\" -> KBPS256\n                \"320\" -> KBPS320\n                \"-1\" -> UNKNOWN\n                else -> KBPS160 // Use 160 as baseline\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/Consumer.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models\n\n/*\n* Callback Utility\n* */\ninterface Consumer<in T> {\n    fun callback(value: T)\n}\n\n@Suppress(\"FunctionName\") // Factory function\ninline fun <T> Consumer(crossinline block: (T) -> Unit): Consumer<T> =\n    object : Consumer<T> {\n        override fun callback(value: T) {\n            block(value)\n        }\n    }\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/CorsProxy.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models\n\nimport io.github.shabinder.TargetPlatforms\nimport io.github.shabinder.activePlatform\n\nsealed class CorsProxy(open val url: String) {\n    data class SelfHostedCorsProxy(override val url: String = \"https://cors.spotiflyer.ml/cors/\" /*\"https://spotiflyer.azurewebsites.net/\"*/) : CorsProxy(url)\n    data class PublicProxyWithExtension(override val url: String = \"https://cors.bridged.cc/\") : CorsProxy(url)\n\n    fun toggle(mode: CorsProxy? = null): CorsProxy {\n        mode?.let {\n            corsProxy = mode\n            return corsProxy\n        }\n        corsProxy = when (corsProxy) {\n            is SelfHostedCorsProxy -> PublicProxyWithExtension()\n            is PublicProxyWithExtension -> SelfHostedCorsProxy()\n        }\n        return corsProxy\n    }\n\n    fun extensionMode(): Boolean {\n        return when (corsProxy) {\n            is SelfHostedCorsProxy -> false\n            is PublicProxyWithExtension -> true\n        }\n    }\n}\n\n/*\n* This Var Keeps Track for Cors Config in JS Platform\n* Default Self Hosted, However ask user to use extension if possible.\n* */\nvar corsProxy: CorsProxy = CorsProxy.SelfHostedCorsProxy()\n\nval corsApi get() = if (activePlatform is TargetPlatforms.Js) corsProxy.url else \"\"\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/Dispatcher.kt",
    "content": "package com.shabinder.common.models\n\nimport kotlinx.coroutines.CoroutineDispatcher\nimport kotlinx.coroutines.Dispatchers\n\n// IO-Dispatcher\nexpect val dispatcherIO: CoroutineDispatcher\n\n// Default-Dispatcher\nval dispatcherDefault: CoroutineDispatcher = Dispatchers.Default\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadObject.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models\n\nimport com.shabinder.common.models.spotify.Source\nimport dev.icerock.moko.parcelize.Parcelable\nimport dev.icerock.moko.parcelize.Parcelize\nimport kotlinx.serialization.Serializable\n\n@Parcelize\n@Serializable\ndata class TrackDetails(\n    var title: String,\n    var artists: List<String>,\n    var durationSec: Int,\n    var albumName: String? = null,\n    var albumArtists: List<String> = emptyList(),\n    var genre: List<String> = emptyList(),\n    var trackNumber: Int? = null,\n    var year: String? = null,\n    var comment: String? = null,\n    var lyrics: String? = null,\n    var trackUrl: String? = null,\n    var albumArtPath: String, // UriString in Android\n    var albumArtURL: String,\n    var source: Source,\n    val progress: Int = 2,\n    val downloadLink: String? = null,\n    val downloaded: DownloadStatus = DownloadStatus.NotDownloaded,\n    var audioQuality: AudioQuality = AudioQuality.KBPS192,\n    var audioFormat: AudioFormat = AudioFormat.MP4,\n    var outputFilePath: String, // UriString in Android\n    var videoID: String? = null, // will be used for purposes like Downloadable Link || VideoID etc. based on Provider\n) : Parcelable {\n    val outputMp3Path get() = outputFilePath.substringBeforeLast(\".\") + \".mp3\"\n}\n\n@Serializable\nsealed class DownloadStatus : Parcelable {\n    @Parcelize object Downloaded : DownloadStatus()\n    @Parcelize data class Downloading(val progress: Int = 2) : DownloadStatus()\n    @Parcelize object Queued : DownloadStatus()\n    @Parcelize object NotDownloaded : DownloadStatus()\n    @Parcelize object Converting : DownloadStatus()\n    @Parcelize data class Failed(val error: Throwable) : DownloadStatus()\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadRecord.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models\n\ndata class DownloadRecord(\n    var id: Long = 0,\n    var type: String,\n    var name: String,\n    var link: String,\n    var coverUrl: String,\n    var totalFiles: Long = 1,\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/DownloadResult.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models\n\nsealed class DownloadResult {\n\n    data class Error(val message: String, val cause: Exception? = null) : DownloadResult()\n\n    data class Progress(val progress: Int) : DownloadResult()\n\n    data class Success(val byteArray: ByteArray) : DownloadResult() {\n        override fun equals(other: Any?): Boolean {\n            if (this === other) return true\n            if (other == null || this::class != other::class) return false\n\n            other as Success\n\n            if (!byteArray.contentEquals(other.byteArray)) return false\n\n            return true\n        }\n\n        override fun hashCode(): Int {\n            return byteArray.contentHashCode()\n        }\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/NativeAtomicReference.kt",
    "content": "package com.shabinder.common.models\n\nexpect class NativeAtomicReference<T>(value: T) {\n    var value: T\n//    fun compareAndSet(expected: T, new: T): Boolean\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/PlatformActions.kt",
    "content": "package com.shabinder.common.models\n\nimport kotlinx.coroutines.CoroutineScope\n\nexpect interface PlatformActions\n\ninternal expect val StubPlatformActions: PlatformActions\n\nexpect fun <T> runBlocking(block: suspend CoroutineScope.() -> T): T"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/PlatformQueryResult.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models\n\nimport com.shabinder.common.models.spotify.Source\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class PlatformQueryResult(\n    var folderType: String,\n    var subFolder: String,\n    var title: String,\n    var coverUrl: String,\n    var trackList: List<TrackDetails>,\n    var source: Source\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/SpotiFlyerException.kt",
    "content": "package com.shabinder.common.models\n\nimport com.shabinder.common.translations.Strings\n\nsealed class SpotiFlyerException(override val message: String) : Exception(message) {\n\n    data class FeatureNotImplementedYet(override val message: String = Strings.featureUnImplemented()) : SpotiFlyerException(message)\n    data class NoInternetException(override val message: String = Strings.checkInternetConnection()) : SpotiFlyerException(message)\n\n    data class MP3ConversionFailed(\n        val extraInfo: String? = null,\n        override val message: String = /*${Strings.mp3ConverterBusy()} */\"CAUSE:$extraInfo\"\n    ) : SpotiFlyerException(message)\n\n    data class GeoLocationBlocked(\n        val extraInfo: String? = null,\n        override val message: String = \"This Content is not Accessible from your Location, try using a VPN! \\nCAUSE:$extraInfo\"\n    ) : SpotiFlyerException(message)\n\n    data class UnknownReason(\n        val exception: Throwable? = null,\n        override val message: String = Strings.unknownError()\n    ) : SpotiFlyerException(message)\n\n    data class NoMatchFound(\n        val trackName: String? = null,\n        override val message: String = \"$trackName : ${Strings.noMatchFound()}\"\n    ) : SpotiFlyerException(message)\n\n    data class YoutubeLinkNotFound(\n        val videoID: String? = null,\n        override val message: String = \"${Strings.noLinkFound()}: $videoID\"\n    ) : SpotiFlyerException(message)\n\n    data class DownloadLinkFetchFailed(\n        val errorTrace: String\n    ) : SpotiFlyerException(errorTrace) {\n        constructor(\n            trackName: String,\n            jioSaavnError: Throwable,\n            ytMusicError: Throwable,\n            errorTrace: String = \"${Strings.noLinkFound()}: $trackName,\" +\n                    \" \\n YtMusic Error's StackTrace: ${ytMusicError.stackTraceToString()} \\n \" +\n                    \" \\n JioSaavn Error's StackTrace: ${jioSaavnError.stackTraceToString()} \\n \"\n        ): this(errorTrace)\n    }\n\n    data class LinkInvalid(\n        val link: String? = null,\n        override val message: String = \"${Strings.linkNotValid()}\\n ${link ?: \"\"}\"\n    ) : SpotiFlyerException(message)\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/Status.kt",
    "content": "package com.shabinder.common.models\n\nimport kotlin.jvm.JvmStatic\n\n/**\n * Enumeration which contains the different states a download\n * could go through.\n *\n * From Fetch\n * */\nenum class Status constructor(val value: Int) {\n\n    /** Indicates when a download is newly created and not yet queued.*/\n    NONE(0),\n\n    /** Indicates when a newly created download is queued.*/\n    QUEUED(1),\n\n    /** Indicates when a download is currently being downloaded.*/\n    DOWNLOADING(2),\n\n    /** Indicates when a download is paused.*/\n    PAUSED(3),\n\n    /** Indicates when a download is completed.*/\n    COMPLETED(4),\n\n    /** Indicates when a download is cancelled.*/\n    CANCELLED(5),\n\n    /** Indicates when a download has failed.*/\n    FAILED(6),\n\n    /** Indicates when a download has been removed and is no longer managed by Fetch.*/\n    REMOVED(7),\n\n    /** Indicates when a download has been deleted and is no longer managed by Fetch.*/\n    DELETED(8),\n\n    /** Indicates when a download has been Added to Fetch for management.*/\n    ADDED(9);\n\n    companion object {\n\n        @JvmStatic\n        fun valueOf(value: Int): Status {\n            return when (value) {\n                0 -> NONE\n                1 -> QUEUED\n                2 -> DOWNLOADING\n                3 -> PAUSED\n                4 -> COMPLETED\n                5 -> CANCELLED\n                6 -> FAILED\n                7 -> REMOVED\n                8 -> DELETED\n                9 -> ADDED\n                else -> NONE\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/YoutubeTrack.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class YoutubeTrack(\n    var name: String? = null,\n    var type: String? = null, // Song / Video\n    var artist: String? = null,\n    var duration: String? = null,\n    var videoId: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/event/Event.kt",
    "content": "package com.shabinder.common.models.event\n\nimport kotlin.properties.ReadOnlyProperty\nimport kotlin.reflect.KProperty\n\ninline fun <reified X> Event<*, *>.getAs() = when (this) {\n    is Event.Success -> value as? X\n    is Event.Failure -> error as? X\n}\n\ninline fun <V : Any?> Event<V, *>.success(f: (V) -> Unit) = fold(f, {})\n\ninline fun <E : Throwable> Event<*, E>.failure(f: (E) -> Unit) = fold({}, f)\n\ninfix fun <V : Any?, E : Throwable> Event<V, E>.or(fallback: V) = when (this) {\n    is Event.Success -> this\n    else -> Event.Success(fallback)\n}\n\ninline infix fun <V : Any?, E : Throwable> Event<V, E>.getOrElse(fallback: (E) -> V): V {\n    return when (this) {\n        is Event.Success -> value\n        is Event.Failure -> fallback(error)\n    }\n}\n\nfun <V : Any?, E : Throwable> Event<V, E>.getOrNull(): V? {\n    return when (this) {\n        is Event.Success -> value\n        is Event.Failure -> null\n    }\n}\n\nfun <V : Any?, E : Throwable> Event<V, E>.getThrowableOrNull(): E? {\n    return when (this) {\n        is Event.Success -> null\n        is Event.Failure -> error\n    }\n}\n\ninline fun <V : Any?, E : Throwable, U : Any?, F : Throwable> Event<V, E>.mapEither(\n    success: (V) -> U,\n    failure: (E) -> F\n): Event<U, F> {\n    return when (this) {\n        is Event.Success -> Event.success(success(value))\n        is Event.Failure -> Event.error(failure(error))\n    }\n}\n\ninline fun <V : Any?, U : Any?, reified E : Throwable> Event<V, E>.map(transform: (V) -> U): Event<U, E> = try {\n    when (this) {\n        is Event.Success -> Event.Success(transform(value))\n        is Event.Failure -> Event.Failure(error)\n    }\n} catch (ex: Throwable) {\n    when (ex) {\n        is E -> Event.error(ex)\n        else -> throw ex\n    }\n}\n\ninline fun <V : Any?, U : Any?, reified E : Throwable> Event<V, E>.flatMap(transform: (V) -> Event<U, E>): Event<U, E> =\n    try {\n        when (this) {\n            is Event.Success -> transform(value)\n            is Event.Failure -> Event.Failure(error)\n        }\n    } catch (ex: Throwable) {\n        when (ex) {\n            is E -> Event.error(ex)\n            else -> throw ex\n        }\n    }\n\ninline fun <V : Any?, E : Throwable, E2 : Throwable> Event<V, E>.mapError(transform: (E) -> E2) = when (this) {\n    is Event.Success -> Event.Success(value)\n    is Event.Failure -> Event.Failure(transform(error))\n}\n\ninline fun <V : Any?, E : Throwable, E2 : Throwable> Event<V, E>.flatMapError(transform: (E) -> Event<V, E2>) =\n    when (this) {\n        is Event.Success -> Event.Success(value)\n        is Event.Failure -> transform(error)\n    }\n\ninline fun <V : Any?, E : Throwable> Event<V, E>.onError(f: (E) -> Unit) = when (this) {\n    is Event.Success -> Event.Success(value)\n    is Event.Failure -> {\n        f(error)\n        this\n    }\n}\n\ninline fun <V : Any?, E : Throwable> Event<V, E>.onSuccess(f: (V) -> Unit): Event<V, E> {\n    return when (this) {\n        is Event.Success -> {\n            f(value)\n            this\n        }\n        is Event.Failure -> this\n    }\n}\n\ninline fun <V : Any?, E : Throwable> Event<V, E>.any(predicate: (V) -> Boolean): Boolean = try {\n    when (this) {\n        is Event.Success -> predicate(value)\n        is Event.Failure -> false\n    }\n} catch (ex: Throwable) {\n    false\n}\n\ninline fun <V : Any?, U : Any?> Event<V, *>.fanout(other: () -> Event<U, *>): Event<Pair<V, U>, *> =\n    flatMap { outer -> other().map { outer to it } }\n\ninline fun <V : Any?, reified E : Throwable> List<Event<V, E>>.lift(): Event<List<V>, E> = fold(\n    Event.success(\n        mutableListOf<V>()\n    ) as Event<MutableList<V>, E>\n) { acc, Event ->\n    acc.flatMap { combine ->\n        Event.map { combine.apply { add(it) } }\n    }\n}\n\ninline fun <V, E : Throwable> Event<V, E>.unwrap(failure: (E) -> Nothing): V =\n    apply { component2()?.let(failure) }.component1()!!\n\ninline fun <V, E : Throwable> Event<V, E>.unwrapError(success: (V) -> Nothing): E =\n    apply { component1()?.let(success) }.component2()!!\n\nsealed class Event<out V : Any?, out E : Throwable> : ReadOnlyProperty<Any?, V> {\n\n    open operator fun component1(): V? = null\n    open operator fun component2(): E? = null\n\n    inline fun <X> fold(success: (V) -> X, failure: (E) -> X): X = when (this) {\n        is Success -> success(this.value)\n        is Failure -> failure(this.error)\n    }\n\n    abstract val value: V\n\n    class Success<out V : Any?>(override val value: V) : Event<V, Nothing>() {\n        override fun component1(): V? = value\n\n        override fun toString() = \"[Success: $value]\"\n\n        override fun hashCode(): Int = value.hashCode()\n\n        override fun equals(other: Any?): Boolean {\n            if (this === other) return true\n            return other is Success<*> && value == other.value\n        }\n\n        override fun getValue(thisRef: Any?, property: KProperty<*>): V = value\n    }\n\n    class Failure<out E : Throwable>(val error: E) : Event<Nothing, E>() {\n        override fun component2(): E = error\n\n        override val value: Nothing get() = throw error\n\n        fun getThrowable(): E = error\n\n        override fun toString() = \"[Failure: $error]\"\n\n        override fun hashCode(): Int = error.hashCode()\n\n        override fun equals(other: Any?): Boolean {\n            if (this === other) return true\n            return other is Failure<*> && error == other.error\n        }\n\n        override fun getValue(thisRef: Any?, property: KProperty<*>): Nothing = value\n    }\n\n    companion object {\n        // Factory methods\n        fun <E : Throwable> error(ex: E) = Failure(ex)\n\n        fun <V : Any?> success(v: V) = Success(v)\n\n        inline fun <V : Any?> of(\n            value: V?,\n            fail: (() -> Throwable) = { Throwable() }\n        ): Event<V, Throwable> =\n            value?.let { success(it) } ?: error(fail())\n\n        inline fun <V : Any?, reified E : Throwable> of(crossinline f: () -> V): Event<V, E> = try {\n            success(f())\n        } catch (ex: Throwable) {\n            when (ex) {\n                is E -> error(ex)\n                else -> throw ex\n            }\n        }\n\n        inline operator fun <V : Any?> invoke(crossinline f: () -> V): Event<V, Throwable> = try {\n            success(f())\n        } catch (ex: Throwable) {\n            error(ex)\n        }\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/event/Factory.kt",
    "content": "package com.shabinder.common.models.event\n\ninline fun <V> runCatching(block: () -> V): Event<V, Throwable> {\n    return try {\n        Event.success(block())\n    } catch (e: Throwable) {\n        Event.error(e)\n    }\n}\n\ninline infix fun <T, V> T.runCatching(block: T.() -> V): Event<V, Throwable> {\n    return try {\n        Event.success(block())\n    } catch (e: Throwable) {\n        Event.error(e)\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/event/Validation.kt",
    "content": "package com.shabinder.common.models.event\n\nclass Validation<out E : Throwable>(vararg resultSequence: Event<*, E>) {\n\n    val failures: List<E> = resultSequence.filterIsInstance<Event.Failure<E>>().map { it.getThrowable() }\n\n    val hasFailure = failures.isNotEmpty()\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/event/coroutines/SuspendableEvent.kt",
    "content": "@file:Suppress(\"UNCHECKED_CAST\")\n\npackage com.shabinder.common.models.event.coroutines\n\nimport kotlin.contracts.ExperimentalContracts\nimport kotlin.contracts.InvocationKind\nimport kotlin.contracts.contract\nimport kotlin.properties.ReadOnlyProperty\nimport kotlin.reflect.KProperty\n\ninline fun <reified X> SuspendableEvent<*, *>.getAs() = when (this) {\n    is SuspendableEvent.Success -> value as? X\n    is SuspendableEvent.Failure -> error as? X\n}\n\nsuspend inline fun <V : Any?> SuspendableEvent<V, *>.success(noinline f: suspend (V) -> Unit) = fold(f, {})\n\nsuspend inline fun <E : Throwable> SuspendableEvent<*, E>.failure(noinline f: suspend (E) -> Unit) = fold({}, f)\n\ninfix fun <V : Any?, E : Throwable> SuspendableEvent<V, E>.or(fallback: V) = when (this) {\n    is SuspendableEvent.Success -> this\n    else -> SuspendableEvent.Success(fallback)\n}\n\nsuspend inline infix fun <V : Any?, E : Throwable> SuspendableEvent<V, E>.getOrElse(crossinline fallback: suspend (E) -> V): V {\n    return when (this) {\n        is SuspendableEvent.Success -> value\n        is SuspendableEvent.Failure -> fallback(error)\n    }\n}\n\nfun <V : Any?, E : Throwable> SuspendableEvent<V, E>.getOrNull(): V? {\n    return when (this) {\n        is SuspendableEvent.Success -> value\n        is SuspendableEvent.Failure -> null\n    }\n}\n\nsuspend inline fun <V : Any?, U : Any?, E : Throwable> SuspendableEvent<V, E>.map(\n    crossinline transform: suspend (V) -> U\n): SuspendableEvent<U, E> = try {\n    when (this) {\n        is SuspendableEvent.Success -> SuspendableEvent.Success(transform(value))\n        is SuspendableEvent.Failure -> SuspendableEvent.Failure(error)\n    }\n} catch (ex: Throwable) {\n    SuspendableEvent.error(ex as E)\n}\n\nsuspend inline fun <V : Any?, U : Any?, E : Throwable> SuspendableEvent<V, E>.flatMap(\n    crossinline transform: suspend (V) -> SuspendableEvent<U, E>\n): SuspendableEvent<U, E> = try {\n    when (this) {\n        is SuspendableEvent.Success -> transform(value)\n        is SuspendableEvent.Failure -> SuspendableEvent.Failure(error)\n    }\n} catch (ex: Throwable) {\n    SuspendableEvent.error(ex as E)\n}\n\nsuspend inline fun <V : Any?, E : Throwable, E2 : Throwable> SuspendableEvent<V, E>.mapError(\n    crossinline transform: suspend (E) -> E2\n) = try {\n    when (this) {\n        is SuspendableEvent.Success -> SuspendableEvent.Success<V, E2>(value)\n        is SuspendableEvent.Failure -> SuspendableEvent.Failure<V, E2>(transform(error))\n    }\n} catch (ex: Throwable) {\n    SuspendableEvent.error(ex as E)\n}\n\nsuspend inline fun <V : Any?, E : Throwable, E2 : Throwable> SuspendableEvent<V, E>.flatMapError(\n    crossinline transform: suspend (E) -> SuspendableEvent<V, E2>\n) = try {\n    when (this) {\n        is SuspendableEvent.Success -> SuspendableEvent.Success(value)\n        is SuspendableEvent.Failure -> transform(error)\n    }\n} catch (ex: Throwable) {\n    SuspendableEvent.error(ex as E)\n}\n\n@OptIn(ExperimentalContracts::class)\nsuspend inline fun <V, E : Throwable> SuspendableEvent<V, E>.onSuccess(crossinline f: suspend (V) -> Unit): SuspendableEvent<V, E> {\n    contract {\n        callsInPlace(f, InvocationKind.EXACTLY_ONCE)\n    }\n    return fold({ f(it); this }, { this })\n}\n\n@OptIn(ExperimentalContracts::class)\nsuspend inline fun <V, E : Throwable> SuspendableEvent<V, E>.onFailure(crossinline f: suspend (E) -> Unit): SuspendableEvent<V, E> {\n    contract {\n        callsInPlace(f, InvocationKind.EXACTLY_ONCE)\n    }\n    return fold({ this }, { f(it); this })\n}\n\nsuspend inline fun <V : Any?, E : Throwable> SuspendableEvent<V, E>.any(\n    crossinline predicate: suspend (V) -> Boolean\n): Boolean = try {\n    when (this) {\n        is SuspendableEvent.Success -> predicate(value)\n        is SuspendableEvent.Failure -> false\n    }\n} catch (ex: Throwable) {\n    false\n}\n\nsuspend inline fun <V : Any?, U : Any> SuspendableEvent<V, *>.fanout(\n    crossinline other: suspend () -> SuspendableEvent<U, *>\n): SuspendableEvent<Pair<V, U>, *> =\n    flatMap { outer -> other().map { outer to it } }\n\nsuspend fun <V : Any?, E : Throwable> List<SuspendableEvent<V, E>>.lift(): SuspendableEvent<List<V>, E> = fold(\n    SuspendableEvent.Success<MutableList<V>, E>(mutableListOf<V>()) as SuspendableEvent<MutableList<V>, E>\n) { acc, result ->\n    acc.flatMap { combine ->\n        result.map { combine.apply { add(it) } }\n    }\n}\n\nsealed class SuspendableEvent<out V : Any?, out E : Throwable> : ReadOnlyProperty<Any?, V> {\n\n    abstract operator fun component1(): V?\n    abstract operator fun component2(): E?\n\n    suspend inline fun <X> fold(noinline success: suspend (V) -> X, noinline failure: suspend (E) -> X): X {\n        return when (this) {\n            is Success -> success(this.value)\n            is Failure -> failure(this.error)\n        }\n    }\n\n    abstract val value: V\n\n    class Success<out V : Any?, out E : Throwable>(override val value: V) : SuspendableEvent<V, E>() {\n        override fun component1(): V? = value\n        override fun component2(): E? = null\n\n        override fun toString() = \"[Success: $value]\"\n\n        override fun hashCode(): Int = value.hashCode()\n\n        override fun equals(other: Any?): Boolean {\n            if (this === other) return true\n            return other is Success<*, *> && value == other.value\n        }\n\n        override fun getValue(thisRef: Any?, property: KProperty<*>): V = value\n    }\n\n    class Failure<out V : Any?, out E : Throwable>(val error: E) : SuspendableEvent<V, E>() {\n        override fun component1(): V? = null\n        override fun component2(): E? = error\n\n        override val value: V get() = throw error\n\n        fun getThrowable(): E = error\n\n        override fun toString() = \"[Failure: $error]\"\n\n        override fun hashCode(): Int = error.hashCode()\n\n        override fun equals(other: Any?): Boolean {\n            if (this === other) return true\n            return other is Failure<*, *> && error == other.error\n        }\n\n        override fun getValue(thisRef: Any?, property: KProperty<*>): V = value\n    }\n\n    companion object {\n        // Factory methods\n        fun <E : Throwable> error(ex: E) = Failure<Nothing, E>(ex)\n\n        fun <V : Any> success(res: V) = Success<V, Throwable>(res)\n\n        inline fun <V : Any?> of(value: V?, crossinline fail: (() -> Throwable) = { Throwable() }): SuspendableEvent<V, Throwable> {\n            return value?.let { Success<V, Nothing>(it) } ?: error(fail())\n        }\n\n        suspend inline fun <V : Any?, E : Throwable> of(\n            crossinline block: suspend () -> V\n        ): SuspendableEvent<V, E> = try {\n            Success(block())\n        } catch (ex: Throwable) {\n            Failure(ex as E)\n        }\n\n        suspend inline operator fun <V : Any?> invoke(\n            crossinline block: suspend () -> V\n        ): SuspendableEvent<V, Throwable> = of(block)\n    }\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/event/coroutines/SuspendedValidation.kt",
    "content": "package com.shabinder.common.models.event.coroutines\n\nclass SuspendedValidation<out E : Throwable>(vararg resultSequence: SuspendableEvent<*, E>) {\n\n    val failures: List<E> = resultSequence.filterIsInstance<SuspendableEvent.Failure<*, E>>().map { it.getThrowable() }\n\n    val hasFailure = failures.isNotEmpty()\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Artist.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Artist(\n    val popularity: Int,\n    val seokey: String,\n    val name: String,\n    @SerialName(\"artwork_175x175\")var artworkLink: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/CustomArtworks.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class CustomArtworks(\n    @SerialName(\"40x40\") val size_40p: String,\n    @SerialName(\"80x80\") val size_80p: String,\n    @SerialName(\"110x110\")val size_110p: String,\n    @SerialName(\"175x175\")val size_175p: String,\n    @SerialName(\"480x480\")val size_480p: String,\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaAlbum.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaAlbum(\n    val tracks: List<GaanaTrack>?,\n    val count: Int,\n    val custom_artworks: CustomArtworks,\n    val release_year: Int,\n    val favorite_count: Int,\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaArtistDetails.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaArtistDetails(\n    val artist: List<Artist>,\n    val count: Int,\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaArtistTracks.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaArtistTracks(\n    val count: Int,\n    val tracks: List<GaanaTrack>? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaPlaylist.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaPlaylist(\n    val modified_on: String,\n    val count: Int,\n    val created_on: String,\n    val favorite_count: Int,\n    val tracks: List<GaanaTrack>,\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaSong.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaSong(\n    val tracks: List<GaanaTrack>\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/GaanaTrack.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport com.shabinder.common.models.DownloadStatus\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaTrack(\n    val tags: List<Tags?>? = null,\n    val seokey: String,\n    val albumseokey: String? = null,\n    val track_title: String,\n    val album_title: String? = null,\n    val language: String? = null,\n    val duration: Int,\n    @SerialName(\"artwork_large\") val artworkLink: String,\n    val artist: List<Artist?> = emptyList(),\n    @SerialName(\"gener\") val genre: List<Genre?>? = null,\n    val lyrics_url: String? = null,\n    val youtube_id: String? = null,\n    val total_favourite_count: Int? = null,\n    val release_date: String? = null,\n    val play_ct: String? = null,\n    val secondary_language: String? = null,\n    var downloaded: DownloadStatus? = DownloadStatus.NotDownloaded\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Genre.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Genre(\n    val genre_id: Int,\n    val name: String\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/gaana/Tags.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Tags(\n    val tag_id: Int,\n    val tag_name: String\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/saavn/MoreInfo.kt",
    "content": "package com.shabinder.common.models.saavn\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class MoreInfo(\n    val language: String,\n    val primary_artists: String,\n    val singers: String,\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/saavn/SaavnAlbum.kt",
    "content": "package com.shabinder.common.models.saavn\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class SaavnAlbum(\n    val albumid: String,\n    val image: String,\n    val name: String,\n    val perma_url: String,\n    val primary_artists: String,\n    val primary_artists_id: String,\n    val release_date: String,\n    val songs: List<SaavnSong>,\n    val title: String,\n    val year: String\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/saavn/SaavnPlaylist.kt",
    "content": "package com.shabinder.common.models.saavn\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class SaavnPlaylist(\n    val fan_count: Int? = 0,\n    val firstname: String? = null,\n    val follower_count: Long? = null,\n    val image: String,\n    val images: List<String>? = null,\n    val last_updated: String,\n    val lastname: String? = null,\n    val list_count: String? = null,\n    val listid: String? = null,\n    val listname: String, // Title\n    val perma_url: String,\n    val songs: List<SaavnSong>,\n    val sub_types: List<String>? = null,\n    val type: String = \"\", // chart,etc\n    val uid: String? = null,\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/saavn/SaavnSearchResult.kt",
    "content": "package com.shabinder.common.models.saavn\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class SaavnSearchResult(\n    val album: String? = \"\",\n    val description: String,\n    val id: String,\n    val image: String,\n    val title: String,\n    val type: String,\n    val url: String,\n    val ctr: Int? = 0,\n    val position: Int? = 0,\n    val more_info: MoreInfo? = null,\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/saavn/SaavnSong.kt",
    "content": "package com.shabinder.common.models.saavn\n\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.DownloadStatus\nimport kotlinx.serialization.ExperimentalSerializationApi\nimport kotlinx.serialization.Serializable\nimport kotlinx.serialization.json.JsonNames\n\n@Serializable\ndata class SaavnSong @OptIn(ExperimentalSerializationApi::class) constructor(\n    @JsonNames(\"320kbps\") val is320Kbps: Boolean,\n    val album: String,\n    val album_url: String? = null,\n    val albumid: String? = null,\n    val artistMap: Map<String, String>,\n    val copyright_text: String? = null,\n    val duration: String,\n    val encrypted_media_path: String,\n    val encrypted_media_url: String,\n//    val explicit_content: Int = 0,\n    val has_lyrics: Boolean = false,\n    val id: String,\n    val image: String = \"\",\n    val label: String? = null,\n    val label_url: String? = null,\n    val language: String,\n    val lyrics_snippet: String? = null,\n    val lyrics: String? = null,\n    val media_preview_url: String? = null,\n    val media_url: String? = null, // Downloadable M4A Link\n    val music: String,\n    val music_id: String,\n    val origin: String? = null,\n    val perma_url: String? = null,\n//    val play_count: Int = 0,\n    val primary_artists: String,\n    val primary_artists_id: String,\n    val release_date: String, // Format - 2021-05-04\n    val singers: String,\n    val song: String, // title\n    val starring: String? = null,\n    val type: String = \"\",\n    val vcode: String? = null,\n    val vlink: String? = null,\n    val year: String,\n    var downloaded: DownloadStatus = DownloadStatus.NotDownloaded\n) {\n    val audioQuality get() = if (is320Kbps) AudioQuality.KBPS320 else AudioQuality.KBPS160\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/Badges.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Badges(\n    val pro: Boolean = false,\n    @SerialName(\"pro_unlimited\")\n    val proUnlimited: Boolean = false,\n    val verified: Boolean = false\n)"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/CreatorSubscription.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class CreatorSubscription(\n    val product: Product = Product()\n)"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/Format.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Format(\n    @SerialName(\"mime_type\")\n    val mimeType: String = \"\",\n    val protocol: String = \"\"\n) {\n    val isProgressive get() = protocol == \"progressive\"\n}"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/Media.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Media(\n    val transcodings: List<Transcoding> = emptyList()\n)"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/Product.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Product(\n    val id: String = \"\"\n)"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/PublisherMetadata.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class PublisherMetadata(\n    @SerialName(\"album_title\")\n    val albumTitle: String = \"\",\n    val artist: String = \"\",\n    @SerialName(\"contains_music\")\n    val containsMusic: Boolean = false,\n    val id: Int = 0,\n    val isrc: String = \"\",\n    val publisher: String = \"\",\n    @SerialName(\"release_title\")\n    val releaseTitle: String = \"\",\n    @SerialName(\"upc_or_ean\")\n    val upcOrEan: String = \"\",\n    val urn: String = \"\",\n    @SerialName(\"writer_composer\")\n    val writerComposer: String = \"\"\n)"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/Transcoding.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport com.shabinder.common.models.AudioFormat\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Transcoding(\n    val duration: Int = 0,\n    val format: Format = Format(),\n    val preset: String = \"\",\n    val quality: String = \"\", //sq == 128kbps //hq == 256kbps\n    val snipped: Boolean = false,\n    val url: String = \"\"\n) {\n    val audioFormat: AudioFormat = when {\n        preset.contains(\"mp3\") -> AudioFormat.MP3\n        preset.contains(\"aac\") || preset.contains(\"m4a\") -> AudioFormat.MP4\n        preset.contains(\"flac\") -> AudioFormat.FLAC\n        else -> AudioFormat.UNKNOWN\n    }\n}"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/User.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class User(\n    @SerialName(\"avatar_url\")\n    val avatarUrl: String = \"\",\n    val badges: Badges = Badges(),\n    val city: String = \"\",\n    @SerialName(\"country_code\")\n    val countryCode: String = \"\",\n    @SerialName(\"first_name\")\n    val firstName: String = \"\",\n    @SerialName(\"followers_count\")\n    val followersCount: Int = 0,\n    @SerialName(\"full_name\")\n    val fullName: String = \"\",\n    val id: Int = 0,\n    val kind: String = \"\",\n    @SerialName(\"last_modified\")\n    val lastModified: String = \"\",\n    @SerialName(\"last_name\")\n    val lastName: String = \"\",\n    val permalink: String = \"\",\n    @SerialName(\"permalink_url\")\n    val permalinkUrl: String = \"\",\n    @SerialName(\"station_permalink\")\n    val stationPermalink: String = \"\",\n    @SerialName(\"station_urn\")\n    val stationUrn: String = \"\",\n    val uri: String = \"\",\n    val urn: String = \"\",\n    val username: String = \"\",\n    val verified: Boolean = false\n)"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/Visual.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Visual(\n    @SerialName(\"entry_time\")\n    val entryTime: Int = 0,\n    val urn: String = \"\",\n    @SerialName(\"visual_url\")\n    val visualUrl: String = \"\"\n)"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/Visuals.kt",
    "content": "package com.shabinder.common.models.soundcloud\n\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Visuals(\n    val enabled: Boolean = false,\n    //val tracking: Any = Any(),\n    val urn: String = \"\",\n    val visuals: List<Visual> = listOf()\n)"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/soundcloud/resolvemodel/SoundCloudResolveResponseBase.kt",
    "content": "package com.shabinder.common.models.soundcloud.resolvemodel\n\nimport com.shabinder.common.models.AudioFormat\nimport com.shabinder.common.models.soundcloud.Media\nimport com.shabinder.common.models.soundcloud.PublisherMetadata\nimport com.shabinder.common.models.soundcloud.User\nimport com.shabinder.common.models.soundcloud.Visuals\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\nimport kotlinx.serialization.json.JsonClassDiscriminator\n\n@Serializable\n@JsonClassDiscriminator(\"kind\")\nsealed class SoundCloudResolveResponseBase {\n    abstract val kind: String\n\n    @SerialName(\"playlist\")\n    @Serializable\n    data class SoundCloudResolveResponsePlaylist(\n        @SerialName(\"artwork_url\")\n        val artworkUrl: String = \"\",\n        @SerialName(\"calculated_artwork_url\")\n        val calculatedArtworkUrl: String = \"\", //t500x500, t120x120 //  \"https://i1.sndcdn.com/artworks-pjsabv9w0EXW3lBJ-nvjDYg-large.jpg\" // https://i1.sndcdn.com/artworks-pjsabv9w0EXW3lBJ-nvjDYg-t500x500.jpg\n        @SerialName(\"created_at\")\n        val createdAt: String = \"\",\n        val description: String = \"\",\n        @SerialName(\"display_date\")\n        val displayDate: String = \"\",\n        val duration: Int = 0,\n        override val kind: String = \"\",\n        @SerialName(\"embeddable_by\")\n        val embeddableBy: String = \"\",\n        val genre: String = \"\",\n        val id: String = \"\",\n        @SerialName(\"is_album\")\n        val isAlbum: Boolean = false,\n        @SerialName(\"label_name\")\n        val labelName: String = \"\",\n        @SerialName(\"last_modified\")\n        val lastModified: String = \"\",\n        val license: String = \"\",\n        @SerialName(\"likes_count\")\n        val likesCount: Int = 0,\n        @SerialName(\"managed_by_feeds\")\n        val managedByFeeds: Boolean = false,\n        val permalink: String = \"\",\n        @SerialName(\"permalink_url\")\n        val permalinkUrl: String = \"\",\n        val `public`: Boolean = false,\n        @SerialName(\"published_at\")\n        val publishedAt: String = \"\",\n        @SerialName(\"purchase_title\")\n        val purchaseTitle: String = \"\",\n        @SerialName(\"purchase_url\")\n        val purchaseUrl: String = \"\",\n        @SerialName(\"release_date\")\n        val releaseDate: String = \"\",\n        @SerialName(\"reposts_count\")\n        val repostsCount: Int = 0,\n        @SerialName(\"secret_token\")\n        val secretToken: String = \"\",\n        @SerialName(\"set_type\")\n        val setType: String = \"\",\n        val sharing: String = \"\",\n        @SerialName(\"tag_list\")\n        val tagList: String = \"\",\n        val title: String = \"\",  //\"Top 50: Hip-hop & Rap\"\n        @SerialName(\"track_count\")\n        val trackCount: Int = 0,\n        var tracks: List<SoundCloudResolveResponseTrack> = emptyList(),\n        val uri: String = \"\",\n        val user: User = User(),\n        @SerialName(\"user_id\")\n        val userId: Int = 0\n    ) : SoundCloudResolveResponseBase()\n\n\n    @SerialName(\"track\")\n    @Serializable\n    data class SoundCloudResolveResponseTrack(\n        @SerialName(\"artwork_url\")\n        val artworkUrl: String = \"\",\n        val caption: String = \"\",\n        @SerialName(\"comment_count\")\n        val commentCount: Int = 0,\n        val commentable: Boolean = false,\n        @SerialName(\"created_at\")\n        val createdAt: String = \"\",\n        val description: String = \"\",\n        @SerialName(\"display_date\")\n        val displayDate: String = \"\",\n        @SerialName(\"download_count\")\n        val downloadCount: Int = 0,\n        val downloadable: Boolean = false,\n        val duration: Int = 0,\n        @SerialName(\"embeddable_by\")\n        val embeddableBy: String = \"\",\n        @SerialName(\"full_duration\")\n        val fullDuration: Int = 0,\n        val genre: String = \"\",\n        @SerialName(\"has_downloads_left\")\n        val hasDownloadsLeft: Boolean = false,\n        val id: String = \"\",\n        override val kind: String = \"\",\n        @SerialName(\"label_name\")\n        val labelName: String = \"\",\n        @SerialName(\"last_modified\")\n        val lastModified: String = \"\",\n        val license: String = \"\",\n        @SerialName(\"likes_count\")\n        val likesCount: Int = 0,\n        val media: Media = Media(),\n        @SerialName(\"monetization_model\")\n        val monetizationModel: String = \"\",\n        val permalink: String = \"\",\n        @SerialName(\"permalink_url\")\n        val permalinkUrl: String = \"\",\n        @SerialName(\"playback_count\")\n        val playbackCount: Int = 0,\n        val policy: String = \"\",\n        val `public`: Boolean = false,\n        @SerialName(\"publisher_metadata\")\n        val publisherMetadata: PublisherMetadata = PublisherMetadata(),\n        @SerialName(\"purchase_title\")\n        val purchaseTitle: String = \"\",\n        @SerialName(\"purchase_url\")\n        val purchaseUrl: String = \"\",\n        @SerialName(\"release_date\")\n        val releaseDate: String = \"\",\n        @SerialName(\"reposts_count\")\n        val repostsCount: Int = 0,\n        @SerialName(\"secret_token\")\n        val secretToken: String = \"\",\n        val sharing: String = \"\",\n        val state: String = \"\",\n        @SerialName(\"station_permalink\")\n        val stationPermalink: String = \"\",\n        @SerialName(\"station_urn\")\n        val stationUrn: String = \"\",\n        val streamable: Boolean = false,\n        @SerialName(\"tag_list\")\n        val tagList: String = \"\",\n        val title: String = \"\",\n        @SerialName(\"track_authorization\")\n        val trackAuthorization: String = \"\",\n        @SerialName(\"track_format\")\n        val trackFormat: String = \"\",\n        val uri: String = \"\",\n        val urn: String = \"\",\n        val user: User = User(),\n        @SerialName(\"user_id\")\n        val userId: Int = 0,\n        val visuals: Visuals? = null,\n        @SerialName(\"waveform_url\")\n        val waveformUrl: String = \"\"\n    ) : SoundCloudResolveResponseBase() {\n        fun getDownloadableLink(): Pair<String, AudioFormat>? {\n            return (media.transcodings.firstOrNull {\n                it.quality == \"hq\" && (it.format.isProgressive || it.url.contains(\"progressive\"))\n            } ?: media.transcodings.firstOrNull {\n                it.quality == \"sq\" && (it.format.isProgressive || it.url.contains(\"progressive\"))\n            })?.let {\n                it.url to it.audioFormat\n            }\n        }\n    }\n}"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Album.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Album(\n    var album_type: String? = null,\n    var artists: List<Artist?>? = null,\n    var available_markets: List<String?>? = null,\n    var copyrights: List<Copyright?>? = null,\n    var external_ids: Map<String?, String?>? = null,\n    var external_urls: Map<String?, String?>? = null,\n    var genres: List<String?>? = null,\n    var href: String? = null,\n    var id: String? = null,\n    var images: List<Image?>? = null,\n    var label: String? = null,\n    var name: String? = null,\n    var popularity: Int? = null,\n    var release_date: String? = null,\n    var release_date_precision: String? = null,\n    var tracks: PagingObjectTrack? = null,\n    var type: String? = null,\n    var uri: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Artist.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Artist(\n    var external_urls: Map<String?, String?>? = null,\n    var href: String? = null,\n    var id: String? = null,\n    var name: String? = null,\n    var type: String? = null,\n    var uri: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Copyright.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Copyright(\n    var text: String? = null,\n    var type: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Episodes.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Episodes(\n    var audio_preview_url: String?,\n    var description: String?,\n    var duration_ms: Int?,\n    var explicit: Boolean?,\n    var external_urls: Map<String, String>?,\n    var href: String?,\n    var id: String?,\n    var images: List<Image?>?,\n    var is_externally_hosted: Boolean?,\n    var is_playable: Boolean?,\n    var language: String?,\n    var languages: List<String?>?,\n    var name: String?,\n    var release_date: String?,\n    var release_date_precision: String?,\n    var type: String?,\n    var uri: String\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Followers.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Followers(\n    var href: String? = null,\n    var total: Int? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Image.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Image(\n    var width: Int? = null,\n    var height: Int? = null,\n    var url: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/LinkedTrack.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class LinkedTrack(\n    var external_urls: Map<String?, String?>? = null,\n    var href: String? = null,\n    var id: String? = null,\n    var type: String? = null,\n    var uri: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PagingObjectPlaylistTrack.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class PagingObjectPlaylistTrack(\n    var href: String? = null,\n    var items: List<PlaylistTrack>? = null,\n    var limit: Int = 0,\n    var next: String? = null,\n    var offset: Int = 0,\n    var previous: String? = null,\n    var total: Int = 0\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PagingObjectTrack.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class PagingObjectTrack(\n    var href: String? = null,\n    var items: List<Track>? = null,\n    var limit: Int = 0,\n    var next: String? = null,\n    var offset: Int = 0,\n    var previous: String? = null,\n    var total: Int = 0\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Playlist.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Playlist(\n    @SerialName(\"collaborative\")var is_collaborative: Boolean? = null,\n    var description: String? = null,\n    var external_urls: Map<String?, String?>? = null,\n    var followers: Followers? = null,\n    var href: String? = null,\n    var id: String? = null,\n    var images: List<Image?>? = null,\n    var name: String? = null,\n    var owner: UserPublic? = null,\n    @SerialName(\"public\")var is_public: Boolean? = null,\n    var snapshot_id: String? = null,\n    var tracks: PagingObjectPlaylistTrack? = null,\n    var type: String? = null,\n    var uri: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/PlaylistTrack.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class PlaylistTrack(\n    var added_at: String? = null,\n    var added_by: UserPublic? = null,\n    var track: Track? = null,\n    var is_local: Boolean? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Source.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nenum class Source {\n    Spotify,\n    YouTube,\n    Gaana,\n    JioSaavn,\n    SoundCloud\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/SpotifyCredentials.kt",
    "content": "package com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class SpotifyCredentials(\n    val clientID: String = \"5f573c9620494bae87890c0f08a60293\",\n    val clientSecret: String = \"212476d9b0f3472eaa762d90b19b0ba8\",\n)"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/TokenData.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class TokenData(\n    var access_token: String?,\n    var token_type: String?,\n    @SerialName(\"expires_in\") var expiry: Long?\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/Track.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport com.shabinder.common.models.DownloadStatus\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Track(\n    var artists: List<Artist?>? = null,\n    var available_markets: List<String?>? = null,\n    var is_playable: Boolean? = null,\n    var linked_from: LinkedTrack? = null,\n    var disc_number: Int = 0,\n    var duration_ms: Long = 0,\n    var explicit: Boolean? = null,\n    var external_urls: Map<String?, String?>? = null,\n    var href: String? = null,\n    var name: String? = null,\n    var preview_url: String? = null,\n    var track_number: Int = 0,\n    var type: String? = null,\n    var uri: String? = null,\n    var album: Album? = null,\n    var external_ids: Map<String?, String?>? = null,\n    var popularity: Int? = null,\n    var downloaded: DownloadStatus = DownloadStatus.NotDownloaded\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/UserPrivate.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class UserPrivate(\n    val country: String,\n    var display_name: String,\n    val email: String,\n    var external_urls: Map<String?, String?>? = null,\n    var followers: Followers? = null,\n    var href: String? = null,\n    var id: String? = null,\n    var images: List<Image?>? = null,\n    var product: String,\n    var type: String? = null,\n    var uri: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/spotify/UserPublic.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class UserPublic(\n    var display_name: String? = null,\n    var external_urls: Map<String?, String?>? = null,\n    var followers: Followers? = null,\n    var href: String? = null,\n    var id: String? = null,\n    var images: List<Image?>? = null,\n    var type: String? = null,\n    var uri: String? = null\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/wynk/AlbumRefWynk.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.wynk\n\ndata class AlbumRefWynk(\n    val id: String,\n    val largeImage: String,\n    val smallImage: String,\n    val title: String,\n    val type: String\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/wynk/HtDataWynk.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.wynk\n\ndata class HtDataWynk(\n    val cutName: String,\n    val previewUrl: String,\n    val vcode: String\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/wynk/ItemWynk.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.wynk\n\ndata class ItemWynk(\n    val album: String,\n    val albumRef: AlbumRefWynk,\n    val basicShortUrl: String,\n    val branchUrl: String,\n    val contentLang: String,\n    val contentState: String,\n    val count: Int,\n    val cues: List<String>,\n    val downloadPrice: String,\n    val downloadUrl: String,\n    val duration: Int, // in Seconds\n    val exclusive: Boolean,\n    val formats: List<String>,\n    val htData: List<HtDataWynk>,\n    val id: String,\n    val isHt: Boolean,\n    val itemContentLang: String,\n    val keywords: String,\n    val largeImage: String,\n    val lyrics_avl: String,\n    val ostreamingUrl: String,\n    val purchaseUrl: String,\n    val rentUrl: String,\n    val serverEtag: String,\n    val shortUrl: String,\n    val smallImage: String, // Cover Image after Replacing 120x120 with 720x720\n    val subtitle: String, // String : `ArtistName - TrackName`\n    val subtitleId: String, // ARTIST NAME,artist-id , etc //USE SUBTITLE INSTEAD\n    val subtitleType: String, // ARTIST etc\n    val title: String,\n    val type: String, // Song ,etc\n    val videoPresent: Boolean\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/wynk/ShortURLWynk.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.wynk\n\n// Use Kotlinx JSON Parsing as in YT Music\ndata class ShortURLWynk(\n    val actualTotal: Int,\n    val basicShortUrl: String,\n    val branchUrl: String,\n    val count: Int,\n    val downloadUrl: String,\n    val duration: Int,\n    val exclusive: Boolean,\n    val followCount: String,\n    val id: String,\n    val isCurated: Boolean,\n    val isFollowable: Boolean,\n    val isHt: Boolean,\n    val itemIds: List<String>,\n    val itemTypes: List<String>, // Songs , etc\n    val items: List<ItemWynk>,\n    val lang: String,\n    val largeImage: String, // Cover Image Alternate\n    val lastUpdated: Long,\n    val offset: Int,\n    val owner: String,\n    val playIcon: Boolean,\n    val playlistImage: String, // Cover Image\n    val redesignFeaturedImage: String,\n    val shortUrl: String,\n    val singers: List<SingerWynk>,\n    val smallImage: String,\n    val title: String,\n    val total: Int,\n    val type: String\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/models/wynk/SingerWynk.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.models.wynk\n\ndata class SingerWynk(\n    val id: String,\n    val isCurated: Boolean,\n    val packageId: String,\n    val smallImage: String,\n    val title: String,\n    val type: String\n)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/utils/Ext.kt",
    "content": "package com.shabinder.common.utils\n\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.dispatcherIO\nimport kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.withContext\nimport kotlin.contracts.ExperimentalContracts\nimport kotlin.contracts.InvocationKind\nimport kotlin.contracts.contract\n\nfun <T : Any?> T?.requireNotNull(): T = requireNotNull(this)\n\n@OptIn(ExperimentalContracts::class)\ninline fun buildString(track: TrackDetails, builderAction: StringBuilder.() -> Unit): String {\n    contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }\n    return StringBuilder().run {\n        appendLine(\"Find Link for ${track.title} ${if (!track.videoID.isNullOrBlank()) \"-> VideoID:\" + track.videoID else \"\"}\")\n        apply(builderAction)\n    }.toString()\n}\n\nfun StringBuilder.appendPadded(data: Any?) {\n    appendLine().append(data).appendLine()\n}\n\nfun StringBuilder.appendPadded(header: Any?, data: Any?) {\n    appendLine().append(header).appendLine(data).appendLine()\n}\n\nsuspend fun <T> runOnMain(block: suspend CoroutineScope.() -> T): T =\n    withContext(Dispatchers.Main, block)\n\nsuspend fun <T> runOnIO(block: suspend CoroutineScope.() -> T): T =\n    withContext(dispatcherIO, block)\n\nsuspend fun <T> runOnDefault(block: suspend CoroutineScope.() -> T): T =\n    withContext(Dispatchers.Default, block)\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/utils/JsonUtils.kt",
    "content": "package com.shabinder.common.utils\n\n/*\n* JSON UTILS\n* */\nfun String.escape(): String {\n    val output = StringBuilder()\n    for (element in this) {\n        val chx = element.code\n        if (chx != 0) {\n            when (element) {\n                '\\n' -> {\n                    output.append(\"\\\\n\")\n                }\n                '\\t' -> {\n                    output.append(\"\\\\t\")\n                }\n                '\\r' -> {\n                    output.append(\"\\\\r\")\n                }\n                '\\\\' -> {\n                    output.append(\"\\\\\\\\\")\n                }\n                '\"' -> {\n                    output.append(\"\\\\\\\"\")\n                }\n                '\\b' -> {\n                    output.append(\"\\\\b\")\n                }\n                /*chx >= 0x10000 -> {\n                    assert(false) { \"Java stores as u16, so it should never give us a character that's bigger than 2 bytes. It literally can't.\" }\n                }*/\n                /*chx > 127 -> {\n                    output.append(String.format(\"\\\\u%04x\", chx))\n                }*/\n                else -> {\n                    output.append(element)\n                }\n            }\n        }\n    }\n    return output.toString()\n}\n\nfun String.unescape(): String {\n    val builder = StringBuilder()\n    var i = 0\n    while (i < this.length) {\n        val delimiter = this[i]\n        i++ // consume letter or backslash\n        if (delimiter == '\\\\' && i < this.length) {\n\n            // consume first after backslash\n            val ch = this[i]\n            i++\n            when (ch) {\n                '\\\\', '/', '\"', '\\'' -> {\n                    builder.append(ch)\n                }\n                'n' -> builder.append('\\n')\n                'r' -> builder.append('\\r')\n                't' -> builder.append(\n                    '\\t'\n                )\n                'b' -> builder.append('\\b')\n                'f' -> builder.append(\"\\\\f\")\n                'u' -> {\n                    val hex = StringBuilder()\n\n                    // expect 4 digits\n                    if (i + 4 > this.length) {\n                        throw RuntimeException(\"Not enough unicode digits! \")\n                    }\n                    for (x in this.substring(i, i + 4).toCharArray()) {\n                        // TODO in 1.5 Kotlin\n                        /*if (!x.isLetterOrDigit()) {\n                            throw RuntimeException(\"Bad character in unicode escape.\")\n                        }*/\n                        hex.append(x.lowercaseChar())\n                    }\n                    i += 4 // consume those four digits.\n                    val code = hex.toString().toInt(16)\n                    builder.append(code.toChar())\n                }\n                else -> {\n                    throw RuntimeException(\"Illegal escape sequence: \\\\$ch\")\n                }\n            }\n        } else { // it's not a backslash, or it's the last character.\n            builder.append(delimiter)\n        }\n    }\n    return builder.toString()\n}\n"
  },
  {
    "path": "common/data-models/src/commonMain/kotlin/com/shabinder/common/utils/Utils.kt",
    "content": "package com.shabinder.common.utils\n\nimport kotlinx.serialization.json.Json\nimport kotlin.native.concurrent.ThreadLocal\n\n@ThreadLocal\nval globalJson by lazy {\n    Json {\n        isLenient = true\n        ignoreUnknownKeys = true\n        coerceInputValues = true\n    }\n}\n\n/**\n * Removing Illegal Chars from File Name\n * **/\nfun removeIllegalChars(fileName: String): String {\n    return fileName.replace(\"[^\\\\dA-Za-z0-9-_]\".toRegex(), \"_\")\n}\n"
  },
  {
    "path": "common/data-models/src/desktopMain/kotlin/com/shabinder/common/models/DesktopAtomicReference.kt",
    "content": "package com.shabinder.common.models\n\nactual class NativeAtomicReference<T> actual constructor(actual var value: T)\n"
  },
  {
    "path": "common/data-models/src/desktopMain/kotlin/com/shabinder/common/models/DesktopDispacthers.kt",
    "content": "package com.shabinder.common.models\n\nimport kotlinx.coroutines.CoroutineDispatcher\nimport kotlinx.coroutines.Dispatchers\n\n// IO-Dispatcher\nactual val dispatcherIO: CoroutineDispatcher = Dispatchers.IO\n"
  },
  {
    "path": "common/data-models/src/desktopMain/kotlin/com/shabinder/common/models/DesktopPlatformActions.kt",
    "content": "package com.shabinder.common.models\n\nimport kotlinx.coroutines.CoroutineScope\n\nactual interface PlatformActions\n\ninternal actual val StubPlatformActions = object : PlatformActions {}\n\nactual fun <T> runBlocking(block: suspend CoroutineScope.() -> T): T = kotlinx.coroutines.runBlocking { block() }"
  },
  {
    "path": "common/data-models/src/iosMain/kotlin/com.shabinder.common.models/IOSPlatformActions.kt",
    "content": "package com.shabinder.common.models\n\nimport kotlin.native.concurrent.AtomicReference\n\nactual interface PlatformActions\n\nactual val StubPlatformActions = object : PlatformActions {}\n\nactual typealias NativeAtomicReference<T> = AtomicReference<T>\n"
  },
  {
    "path": "common/data-models/src/jsMain/kotlin/com.shabinder.common.models/JSPlatformActions.kt",
    "content": "package com.shabinder.common.models\n\nimport kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.promise\n\n\nactual interface PlatformActions\ninternal actual val StubPlatformActions = object : PlatformActions {}\nactual fun <T> runBlocking(block: suspend CoroutineScope.() -> T): dynamic = GlobalScope.promise(block = block)"
  },
  {
    "path": "common/data-models/src/jsMain/kotlin/com.shabinder.common.models/WebActual.kt",
    "content": "package com.shabinder.common.models\n\nimport kotlinx.coroutines.CoroutineDispatcher\nimport kotlinx.coroutines.Dispatchers\n\nactual val dispatcherIO: CoroutineDispatcher = Dispatchers.Default"
  },
  {
    "path": "common/data-models/src/jsMain/kotlin/com.shabinder.common.models/WebAtomicReference.kt",
    "content": "package com.shabinder.common.models\n\nactual class NativeAtomicReference<T> actual constructor(actual var value: T)"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_arrow.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"40dp\"\n    android:height=\"38dp\" android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:fillColor=\"#516AEC\" android:pathData=\"m296,288 l60,-60c7.73,-7.73 17.86,-11.6 28,-11.6 10.055,0 20.101,3.806 27.806,11.407 15.612,15.402 15.207,41.18 -0.3,56.687l-134.293,134.293c-11.716,11.716 -30.711,11.716 -42.426,0l-134.787,-134.787c-7.73,-7.73 -11.6,-17.86 -11.6,-28 0,-10.055 3.806,-20.101 11.407,-27.806 15.402,-15.612 41.18,-15.207 56.687,0.3l59.506,59.506v-232c0,-22.091 17.909,-40 40,-40 22.091,0 40,17.909 40,40z\"/>\n    <path android:fillColor=\"#EC7EBA\" android:pathData=\"m411.51,284.49 l-134.3,134.3c-11.71,11.71 -30.71,11.71 -42.42,0l-12.74,-12.74c10.69,4.06 23.23,1.77 31.84,-6.84l134.29,-134.29c12.51,-12.51 15.19,-31.7 7.57,-46.74 5.86,1.81 11.39,5.03 16.06,9.63 15.61,15.4 15.2,41.18 -0.3,56.68z\"/>\n    <path android:fillColor=\"#EC7EBA\" android:pathData=\"m251.88,27.72c-3.46,-3.46 -7.55,-6.29 -12.08,-8.3 4.95,-2.2 10.43,-3.42 16.2,-3.42 11.04,0 21.04,4.48 28.28,11.72s11.72,17.24 11.72,28.28v232l-15.329,15.329c-6.3,6.3 -17.071,1.838 -17.071,-7.071v-240.258c0,-11.04 -4.48,-21.04 -11.72,-28.28z\"/>\n    <path android:fillColor=\"#6A82FB\" android:pathData=\"m496,512h-24c-8.836,0 -16,-7.164 -16,-16s7.164,-16 16,-16h24c8.836,0 16,7.164 16,16s-7.164,16 -16,16z\"/>\n    <path android:fillColor=\"#6A82FB\" android:pathData=\"m40,512h-24c-8.836,0 -16,-7.164 -16,-16s7.164,-16 16,-16h24c8.836,0 16,7.164 16,16s-7.164,16 -16,16z\"/>\n    <path android:fillColor=\"#FC5C7D\" android:pathData=\"m416,512h-320c-8.836,0 -16,-7.164 -16,-16s7.164,-16 16,-16h320c8.836,0 16,7.164 16,16s-7.164,16 -16,16z\"/>\n    <path android:fillColor=\"#4AFC5C7D\" android:pathData=\"m256,443.552c-11.78,0 -23.56,-4.484 -32.527,-13.452l-134.786,-134.787c-10.503,-10.502 -16.287,-24.463 -16.287,-39.313 0,-14.708 5.688,-28.573 16.017,-39.042 10.31,-10.451 24.214,-16.233 39.151,-16.284h0.189c14.966,0 29.552,6.009 40.05,16.507l32.193,32.192v-193.373c0,-30.878 25.122,-56 56,-56s56,25.122 56,56v193.373l32.687,-32.687c10.501,-10.502 24.463,-16.286 39.313,-16.286 14.708,0 28.573,5.688 39.042,16.017 10.45,10.31 16.233,24.214 16.284,39.151 0.051,15.032 -5.966,29.698 -16.507,40.24l-134.292,134.292c-8.967,8.968 -20.747,13.452 -32.527,13.452zM127.761,232.673c-0.028,0 -0.056,0 -0.084,0 -6.349,0.021 -12.202,2.421 -16.479,6.758 -4.383,4.443 -6.797,10.327 -6.797,16.569 0,6.302 2.456,12.228 6.914,16.686l134.785,134.787c5.459,5.459 14.341,5.459 19.8,0l134.292,-134.292c4.556,-4.557 7.157,-10.937 7.134,-17.504 -0.021,-6.349 -2.421,-12.202 -6.758,-16.479 -4.443,-4.383 -10.327,-6.797 -16.569,-6.797 -6.302,0 -12.228,2.456 -16.687,6.914l-60,60c-4.575,4.577 -11.456,5.945 -17.437,3.469 -5.977,-2.478 -9.875,-8.313 -9.875,-14.784v-232c0,-13.234 -10.767,-24 -24,-24 -13.234,0 -24,10.766 -24,24v232c0,6.471 -3.898,12.306 -9.877,14.782 -5.978,2.476 -12.861,1.108 -17.437,-3.469l-59.506,-59.505c-4.536,-4.537 -10.882,-7.135 -17.419,-7.135z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_download_arrow.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\"\n    android:tint=\"?attr/colorControlNormal\">\n  <path\n      android:fillColor=\"#FFFFFF\"\n      android:pathData=\"M12,4c4.41,0 8,3.59 8,8s-3.59,8 -8,8s-8,-3.59 -8,-8S7.59,4 12,4M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10c5.52,0 10,-4.48 10,-10C22,6.48 17.52,2 12,2L12,2zM13,12l0,-4h-2l0,4H8l4,4l4,-4H13z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_error.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" xmlns:aapt=\"http://schemas.android.com/aapt\"\n    android:width=\"40dp\" android:height=\"40dp\"\n    android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:pathData=\"m512,256c0,141.387 -114.613,256 -256,256s-256,-114.613 -256,-256 114.613,-256 256,-256 256,114.613 256,256zM512,256\">\n        <aapt:attr name=\"android:fillColor\">\n            <gradient android:endX=\"512\" android:endY=\"256\"\n                android:startX=\"0\" android:startY=\"256\" android:type=\"linear\">\n                <item android:color=\"#748AFF\" android:offset=\"0\"/>\n                <item android:color=\"#FF3C64\" android:offset=\"1\"/>\n            </gradient>\n        </aapt:attr>\n    </path>\n    <path android:fillColor=\"#000\" android:pathData=\"m256,56c-110.281,0 -200,89.719 -200,200s89.719,200 200,200 200,-89.719 200,-200 -89.719,-200 -200,-200zM256,426c-93.738,0 -170,-76.262 -170,-170s76.262,-170 170,-170 170,76.262 170,170 -76.262,170 -170,170zM256,426\"/>\n    <path android:fillColor=\"#000\" android:pathData=\"m324.18,187.82c-5.859,-5.855 -15.355,-5.855 -21.215,0l-46.965,46.965 -46.965,-46.965c-5.859,-5.855 -15.355,-5.855 -21.215,0 -5.855,5.859 -5.855,15.355 0,21.215l46.965,46.965 -46.965,46.965c-5.855,5.859 -5.855,15.355 0,21.215 2.93,2.93 6.77,4.395 10.605,4.395 3.84,0 7.68,-1.465 10.605,-4.395l46.969,-46.965 46.965,46.965c2.93,2.93 6.77,4.395 10.605,4.395 3.84,0 7.68,-1.465 10.609,-4.395 5.855,-5.859 5.855,-15.355 0,-21.215l-46.965,-46.965 46.965,-46.965c5.855,-5.859 5.855,-15.355 0,-21.215zM324.18,187.82\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_gaana.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector android:height=\"42dp\" android:viewportHeight=\"200\"\n    android:viewportWidth=\"200\" android:width=\"42dp\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <group>\n        <clip-path android:pathData=\"M100,100m-100,0a100,100 0,1 1,200 0a100,100 0,1 1,-200 0\"/>\n        <path android:fillColor=\"#E62C28\" android:pathData=\"M202.7,195.2c0,0.3 -0.1,0.8 -0.1,1.1c-1.5,3 -3.7,5.3 -6.9,6.4c-0.2,0 -0.4,0 -0.6,0.1c-0.8,-0.1 -1.6,-0.4 -2.3,-0.4c-61,0 -122.1,0 -183.1,0c-0.7,0 -1.4,0.3 -2.1,0.4c-0.3,0 -0.7,-0.1 -1,-0.1c-3,-1.4 -5.2,-3.6 -6.5,-6.6V6.7c1.3,-3.1 3.5,-5.3 6.6,-6.7C6.8,0 7,0 7.2,0c0.9,0.1 1.7,0.4 2.6,0.4c61,0 122.1,0 183.1,0c0.8,0 1.5,-0.2 2.3,-0.4c0.2,0 0.4,0 0.5,0c3.4,1.2 5.7,3.5 6.9,7c0,0.1 0,0.4 0,0.5c-0.1,0.7 -0.4,1.4 -0.4,2.1c0,61.2 0,122.3 0,183.5C202.3,193.8 202.6,194.5 202.7,195.2zM52.3,178.7c0.9,0 1.6,0 2.3,0c11.3,0 22.6,0.1 33.8,0c2.9,0 6,-0.3 8.8,-0.9c15.9,-3.4 26.8,-12.6 30.8,-28.7c1.8,-7.3 2.8,-14.9 4.1,-22.3c5.5,-31.1 11,-62.2 16.4,-93.2c0.5,-3.1 1.1,-6.1 1.6,-9.4c-1,0 -1.8,0 -2.5,0c-13.4,0 -26.8,-0.1 -40.2,0c-2.9,0 -6,0.3 -8.8,0.9C82,28.6 71.1,38.5 67.6,55.6c-2.1,10 -3.7,20.1 -5.4,30.1c-1.2,6.9 -2.6,13.9 -3.2,20.9c-0.9,10.1 2.7,18.4 11.9,23.6c3.9,2.2 8.2,3.7 12.7,3.9c7.7,0.3 15.4,0.3 23.1,0.4c0.7,0 1.4,0 2.2,0c-0.7,3.6 -1.3,6.8 -1.9,10c-1.6,8.3 -6.1,12.1 -14.5,12.1c-11.3,0 -22.6,0 -33.8,0c-0.8,0 -1.5,0 -2.3,0C54.9,164.1 53.7,171.2 52.3,178.7z\"/>\n        <path android:fillColor=\"#E94845\" android:pathData=\"M195.2,0c-0.8,0.1 -1.5,0.4 -2.3,0.4c-61,0 -122.1,0 -183.1,0C9,0.4 8.3,0.1 7.5,0C70.1,0 132.6,0 195.2,0z\"/>\n        <path android:fillColor=\"#E94845\" android:pathData=\"M202.7,195.2c-0.1,-0.7 -0.4,-1.4 -0.4,-2.1c0,-61.2 0,-122.3 0,-183.5c0,-0.7 0.2,-1.4 0.4,-2.1C202.7,70.1 202.7,132.6 202.7,195.2z\"/>\n        <path android:fillColor=\"#E94845\" android:pathData=\"M7.5,202.7c0.7,-0.1 1.4,-0.4 2.1,-0.4c61,0 122.1,0 183.1,0c0.7,0 1.4,0.3 2.1,0.4C132.4,202.7 69.9,202.7 7.5,202.7z\"/>\n        <path android:fillColor=\"#FDFCFC\" android:pathData=\"M202.7,7.1c-1.2,-3.5 -3.6,-5.9 -7.1,-7.1h7.1V7.1z\"/>\n        <path android:fillColor=\"#FDFCFC\" android:pathData=\"M195.6,202.7c3.4,-1.2 5.7,-3.5 7.1,-6.7v6.7H195.6z\"/>\n        <path android:fillColor=\"#FDFCFC\" android:pathData=\"M0,196c1.3,3.1 3.6,5.3 6.7,6.7H0V196z\"/>\n        <path android:fillColor=\"#FDFCFC\" android:pathData=\"M6.7,0C3.6,1.4 1.3,3.6 0,6.7V0H6.7z\"/>\n        <path android:fillColor=\"#FDFCFC\" android:pathData=\"M52.3,178.7c1.3,-7.4 2.6,-14.6 4,-22c0.8,0 1.6,0 2.3,0c11.3,0 22.6,0 33.8,0c8.4,0 12.9,-3.8 14.5,-12.1c0.6,-3.2 1.2,-6.5 1.9,-10c-0.8,0 -1.5,0 -2.2,0c-7.7,-0.1 -15.4,0 -23.1,-0.4c-4.5,-0.2 -8.8,-1.7 -12.7,-3.9c-9.2,-5.2 -12.8,-13.5 -11.9,-23.6c0.6,-7 2,-13.9 3.2,-20.9c1.7,-10.1 3.4,-20.2 5.4,-30.1C71.1,38.5 82,28.6 98.8,25c2.9,-0.6 5.9,-0.9 8.8,-0.9c13.4,-0.1 26.8,0 40.2,0c0.7,0 1.4,0 2.5,0c-0.6,3.3 -1.1,6.3 -1.6,9.4c-5.5,31.1 -11,62.2 -16.4,93.2c-1.3,7.5 -2.3,15 -4.1,22.3c-4,16.1 -14.9,25.3 -30.8,28.7c-2.9,0.6 -5.9,0.9 -8.8,0.9c-11.3,0.1 -22.6,0 -33.8,0C53.9,178.7 53.2,178.7 52.3,178.7zM112.7,112.4c1.2,-6.8 2.4,-13.4 3.5,-20c2.1,-12.1 4.3,-24.3 6.3,-36.4c0.8,-4.6 -1.4,-8 -5.9,-9.3c-1.3,-0.4 -2.7,-0.5 -4.1,-0.5c-3,-0.1 -5.9,0 -8.9,0c-8.2,0 -13.2,4.4 -14.5,12.4c-0.8,4.9 -1.7,9.7 -2.6,14.6c-1.7,9.6 -3.5,19.2 -5,28.8c-0.9,6 2.1,10 8.2,10.3C97.3,112.6 104.9,112.4 112.7,112.4z\"/>\n        <path android:fillColor=\"#E62D29\" android:pathData=\"M112.7,112.4c-7.8,0 -15.3,0.3 -22.9,-0.1c-6.1,-0.3 -9.2,-4.3 -8.2,-10.3c1.5,-9.6 3.3,-19.2 5,-28.8c0.8,-4.9 1.8,-9.7 2.6,-14.6c1.3,-8 6.3,-12.4 14.5,-12.4c3,0 5.9,-0.1 8.9,0c1.4,0 2.8,0.2 4.1,0.5c4.5,1.3 6.7,4.7 5.9,9.3c-2.1,12.1 -4.2,24.3 -6.3,36.4C115,98.9 113.9,105.5 112.7,112.4z\"/>\n    </group>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_github.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"34dp\"\n    android:height=\"34dp\" android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:fillColor=\"#4EA4FF\" android:pathData=\"M255.968,5.329C114.624,5.329 0,120.401 0,262.353c0,113.536 73.344,209.856 175.104,243.872c12.8,2.368 17.472,-5.568 17.472,-12.384c0,-6.112 -0.224,-22.272 -0.352,-43.712c-71.2,15.52 -86.24,-34.464 -86.24,-34.464c-11.616,-29.696 -28.416,-37.6 -28.416,-37.6c-23.264,-15.936 1.728,-15.616 1.728,-15.616c25.696,1.824 39.2,26.496 39.2,26.496c22.848,39.264 59.936,27.936 74.528,21.344c2.304,-16.608 8.928,-27.936 16.256,-34.368c-56.832,-6.496 -116.608,-28.544 -116.608,-127.008c0,-28.064 9.984,-51.008 26.368,-68.992c-2.656,-6.496 -11.424,-32.64 2.496,-68c0,0 21.504,-6.912 70.4,26.336c20.416,-5.696 42.304,-8.544 64.096,-8.64c21.728,0.128 43.648,2.944 64.096,8.672c48.864,-33.248 70.336,-26.336 70.336,-26.336c13.952,35.392 5.184,61.504 2.56,68c16.416,17.984 26.304,40.928 26.304,68.992c0,98.72 -59.84,120.448 -116.864,126.816c9.184,7.936 17.376,23.616 17.376,47.584c0,34.368 -0.32,62.08 -0.32,70.496c0,6.88 4.608,14.88 17.6,12.352C438.72,472.145 512,375.857 512,262.353C512,120.401 397.376,5.329 255.968,5.329z\"/>\n</vector>\n\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_heart.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"25dp\"\n    android:height=\"25dp\" android:viewportWidth=\"512.007\" android:viewportHeight=\"512.007\">\n    <path android:fillColor=\"#fe646f\" android:pathData=\"m380.125,59.036c-59.77,0 -109.664,42.249 -121.469,98.51 -0.608,2.899 -4.703,2.901 -5.312,0 -11.805,-56.261 -61.699,-98.51 -121.469,-98.51 -114.106,0 -167.756,141.01 -82.508,216.858l193.339,172.02c7.58,6.744 19.009,6.744 26.589,0l193.339,-172.02c85.248,-75.848 31.598,-216.858 -82.509,-216.858z\"/>\n    <path android:fillColor=\"#fd4755\" android:pathData=\"m380.125,59.036c-6.912,0 -13.689,0.572 -20.293,1.658 99.376,15.991 141.363,144.168 61.527,215.2l-185.996,165.487 7.343,6.533c7.58,6.744 19.009,6.744 26.589,0l193.339,-172.02c85.248,-75.848 31.598,-216.858 -82.509,-216.858z\"/>\n    <path android:fillColor=\"#fe646f\" android:pathData=\"m380.125,59.036c-59.77,0 -109.664,42.249 -121.469,98.51 -0.608,2.899 -4.703,2.901 -5.312,0 -11.805,-56.261 -61.699,-98.51 -121.469,-98.51 -114.106,0 -167.756,141.01 -82.508,216.858l193.339,172.02c7.58,6.744 19.009,6.744 26.589,0l193.339,-172.02c85.248,-75.848 31.598,-216.858 -82.509,-216.858z\"/>\n    <path android:fillColor=\"#fd4755\" android:pathData=\"m380.125,59.036c-6.912,0 -13.689,0.572 -20.293,1.658 99.376,15.991 141.363,144.168 61.527,215.2l-185.996,165.487 7.343,6.533c7.58,6.744 19.009,6.744 26.589,0l193.339,-172.02c85.248,-75.848 31.598,-216.858 -82.509,-216.858z\"/>\n    <path android:fillColor=\"#FF000000\" android:pathData=\"m237.72,453.517c-204.315,-181.786 -197.402,-175.776 -197.402,-175.776 -25.999,-24.984 -40.318,-58.201 -40.318,-93.533 0,-46.48 24.63,-91.702 65.906,-115.47 3.589,-2.067 8.174,-0.833 10.242,2.757 2.067,3.589 0.833,8.175 -2.757,10.242 -36.017,20.74 -58.391,60.004 -58.391,102.471 0,31.212 12.683,60.588 35.711,82.717 0,0 -6.881,-5.996 196.979,175.386 2.292,2.039 5.242,3.161 8.309,3.161 3.066,0 6.018,-1.123 8.31,-3.162l61.917,-55.089c3.095,-2.753 7.835,-2.477 10.588,0.618s2.477,7.835 -0.618,10.588l-61.917,55.09c-10.431,9.281 -26.148,9.263 -36.559,0zM357.363,377.059c-2.067,0 -4.124,-0.849 -5.606,-2.515 -2.753,-3.095 -2.477,-7.835 0.618,-10.588l105.273,-93.665c21.815,-19.409 35.132,-44.369 38.513,-72.181 0.001,-0.006 0.001,-0.012 0.002,-0.018 7.637,-62.927 -37.915,-131.557 -116.038,-131.557 -54.879,0 -102.877,38.923 -114.129,92.55 -1.005,4.79 -5.116,8.135 -9.997,8.135s-8.991,-3.346 -9.996,-8.136c-11.252,-53.626 -59.25,-92.549 -114.128,-92.549 -9.633,0 -19.082,1.076 -28.084,3.198 -4.033,0.952 -8.07,-1.548 -9.021,-5.579 -0.951,-4.032 1.547,-8.07 5.579,-9.021 10.128,-2.388 20.735,-3.598 31.525,-3.598 55.699,0 105.463,35.109 124.125,87.792 18.71,-52.817 68.567,-87.792 124.125,-87.792 84.905,0 139.884,74.56 130.929,148.362 0,0.007 -0.001,0.015 -0.002,0.022 -3.829,31.494 -18.847,59.703 -43.433,81.578l-105.273,93.665c-1.429,1.272 -3.209,1.897 -4.982,1.897z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_indian_rupee.xml",
    "content": "<vector android:height=\"24dp\" android:viewportHeight=\"456\"\n    android:viewportWidth=\"456\" android:width=\"24dp\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:fillColor=\"#FFFFFF\" android:pathData=\"M61.179,282h-41.2c-6,0 -10.9,4.9 -10.9,10.9v152.2c0,6 4.9,10.9 10.9,10.9h41.2c6,0 10.9,-4.9 10.9,-10.9V292.9C72.079,286.9 67.179,282 61.179,282z\"/>\n    <path android:fillColor=\"#FFFFFF\" android:pathData=\"M443.179,294.4c-0.3,-0.4 -0.6,-0.8 -0.8,-1.2c-6.1,-6.8 -16.4,-7.7 -23.6,-2.1c-20,16.3 -49.2,39.8 -68.1,55.1c-16.7,13.3 -37.3,21 -58.7,21.8l-51.2,1.7c-9.4,0.3 -18.2,-4.5 -23,-12.6l-5.7,-9.7c-1.5,-2.5 -2.5,-5.3 -3.1,-8.2c-2.6,-13.9 6.5,-27.4 20.4,-30l52.9,-10c8.5,-1.7 14.3,-9.7 13.3,-18.3c-1,-8.2 -8,-14.3 -16.2,-14.4c-0.3,0 -0.7,0 -0.8,0c-0.4,0 -0.9,0 -1.3,0l-71.2,-2.9c-24.7,-0.9 -46,3.9 -71.2,16.1l-42.8,20.7v114l35.9,-6.6c0.1,-0.1 0.2,-0.1 0.3,-0.1c13.9,-2 23.1,-2.9 38.2,-2.2l107.5,5c33.7,1.4 66.8,-9.7 92.7,-31.3l74.4,-61.7C447.979,311.7 448.879,301.3 443.179,294.4z\"/>\n    <path android:fillColor=\"#FFFFFF\" android:pathData=\"M307.379,0c-61.2,0.1 -110.7,49.7 -110.8,110.8c0,0.1 0,0.1 0,0.1c0,61.2 49.7,110.8 110.9,110.8s110.8,-49.7 110.8,-110.9S368.579,0 307.379,0zM333.079,80h13.4c5.5,0 10,4.5 10,10s-4.5,10 -10,10h-13.4c-2,7.8 -6,14.9 -11.7,20.6c-7.5,7.5 -17.5,11.9 -28.1,12.5l37.7,35.7c4,3.8 4.2,10.1 0.4,14.1s-10.1,4.2 -14.1,0.4l-55.9,-52.9c-1.9,-1.9 -3.1,-4.5 -3.1,-7.2c-0.1,-5.6 4.4,-10.1 10,-10.2h22.4c6.2,0.1 12.2,-2.3 16.7,-6.7c1.8,-1.9 3.3,-4 4.6,-6.3h-43.7c-5.5,0 -10,-4.5 -10,-10s4.5,-10 10,-10h43.7c-3.7,-8 -11.9,-14 -21.3,-14h-22.4c-5.5,0 -10,-4.5 -10,-10s4.5,-10 10,-10h78.2c5.5,0 10,4.5 10,10s-4.5,10 -10,10h-19.2C330.079,70.3 331.979,75 333.079,80z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_instagram.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" xmlns:aapt=\"http://schemas.android.com/aapt\"\n    android:width=\"32dp\" android:height=\"32dp\"\n    android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:pathData=\"M352,0H160C71.648,0 0,71.648 0,160v192c0,88.352 71.648,160 160,160h192c88.352,0 160,-71.648 160,-160V160C512,71.648 440.352,0 352,0zM464,352c0,61.76 -50.24,112 -112,112H160c-61.76,0 -112,-50.24 -112,-112V160C48,98.24 98.24,48 160,48h192c61.76,0 112,50.24 112,112V352z\">\n        <aapt:attr name=\"android:fillColor\">\n            <gradient android:endX=\"465.1312\" android:endY=\"46.8656\"\n                android:startX=\"46.8688\" android:startY=\"465.1344\" android:type=\"linear\">\n                <item android:color=\"#FFFFC107\" android:offset=\"0\"/>\n                <item android:color=\"#FFF44336\" android:offset=\"0.507\"/>\n                <item android:color=\"#FF9C27B0\" android:offset=\"0.99\"/>\n            </gradient>\n        </aapt:attr>\n    </path>\n    <path android:pathData=\"M256,128c-70.688,0 -128,57.312 -128,128s57.312,128 128,128s128,-57.312 128,-128S326.688,128 256,128zM256,336c-44.096,0 -80,-35.904 -80,-80c0,-44.128 35.904,-80 80,-80s80,35.872 80,80C336,300.096 300.096,336 256,336z\">\n        <aapt:attr name=\"android:fillColor\">\n            <gradient android:endX=\"346.5072\" android:endY=\"165.4928\"\n                android:startX=\"165.4928\" android:startY=\"346.5072\" android:type=\"linear\">\n                <item android:color=\"#FFFFC107\" android:offset=\"0\"/>\n                <item android:color=\"#FFF44336\" android:offset=\"0.507\"/>\n                <item android:color=\"#FF9C27B0\" android:offset=\"0.99\"/>\n            </gradient>\n        </aapt:attr>\n    </path>\n    <path android:pathData=\"M393.6,118.4m-17.056,0a17.056,17.056 0,1 1,34.112 0a17.056,17.056 0,1 1,-34.112 0\">\n        <aapt:attr name=\"android:fillColor\">\n            <gradient android:endX=\"405.6592\" android:endY=\"106.3408\"\n                android:startX=\"381.5408\" android:startY=\"130.4624\" android:type=\"linear\">\n                <item android:color=\"#FFFFC107\" android:offset=\"0\"/>\n                <item android:color=\"#FFF44336\" android:offset=\"0.507\"/>\n                <item android:color=\"#FF9C27B0\" android:offset=\"0.99\"/>\n            </gradient>\n        </aapt:attr>\n    </path>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_jio_saavn_logo.xml",
    "content": "<vector android:height=\"42dp\" android:viewportHeight=\"250\"\n    android:viewportWidth=\"488\" android:width=\"81.984dp\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:fillColor=\"#fff\" android:pathData=\"M483.73,36A53.1,53.1 0,0 0,452 4.28C438.49,0 425.94,0 400.84,0H325.16C300.07,0 287.52,0 274,4.28A53.08,53.08 0,0 0,242.28 36a76.64,76.64 0,0 0,-2 7.74,140.32 140.32,0 0,1 14,24.86c0.38,-9.57 1.27,-17.22 3.46,-24.14 4.68,-12.86 11.88,-20.06 24.74,-24.74C294.25,16 308.12,16 330,16h66c21.88,0 35.76,0 47.54,3.73 12.86,4.68 20,11.88 24.74,24.74C472,56.25 472,70.13 472,92v66c0,21.88 0,35.76 -3.72,47.53 -4.69,12.86 -11.88,20.06 -24.74,24.74C431.76,234 417.88,234 396,234H330c-21.89,0 -35.76,0 -47.54,-3.73 -12.86,-4.68 -20.06,-11.88 -24.74,-24.74 -2.19,-6.92 -3.09,-14.58 -3.46,-24.15a140.51,140.51 0,0 1,-14 24.85,77.18 77.18,0 0,0 2,7.77A53.08,53.08 0,0 0,274 245.73C287.52,250 300.07,250 325.16,250h75.68c25.1,0 37.65,0 51.16,-4.27A53.11,53.11 0,0 0,483.73 214C488,200.49 488,187.94 488,162.84V87.17C488,62.07 488,49.52 483.73,36Z\"/>\n    <path android:fillColor=\"#fff\" android:pathData=\"M422,217L380.33,217c-1.76,0 -5.83,-2.79 -2.63,-6.67 21.36,-23 48,-30.93 73.4,-39.42 3.32,-1 3.91,2.51 3.91,3.48v8.68C455,202.61 441.57,217 422,217ZM343.73,212.69c-4,-29.73 -18.06,-80.79 -71,-118.55A3.78,3.78 0,0 1,271 90.63L271,66.36c0,-26.69 18,-33.31 26.37,-33.31a4.3,4.3 0,0 1,4.07 2.1c25.24,55 41,89.86 50.7,172.83 0.05,1.62 0.31,2.39 1.28,0 6.86,-15.07 39.35,-92 26.44,-170.68a3.64,3.64 0,0 1,3.5 -4.25L422,33.05c19.54,0 33,13.43 33,33.36L455,100.5a3.63,3.63 0,0 1,-2.07 3.36,180.12 180.12,0 0,0 -90.3,109.25c-0.79,2.21 -1.25,3.9 -3.71,3.9h-11.8C344.77,217 344.27,216.05 343.73,212.7ZM304.35,217c-20,0 -33.35,-12.37 -33.35,-33.93v-2.24c0,-0.9 0.71,-4.29 4.09,-3.63 20.24,6.23 41.92,12.52 57.77,33.49 1.82,2.56 0.23,6.3 -2.91,6.31Z\"/>\n    <path android:fillColor=\"#fff\" android:pathData=\"M124.991,239.991a115,115 54.655,1 0,2.007 -229.991a115,115 54.655,1 0,-2.007 229.991z\"/>\n    <path android:fillColor=\"#2bc5b4\" android:pathData=\"M180.77,114.59c-8.62,0 -15.61,7.39 -15.61,16.49s7,16.5 15.61,16.5 15.62,-7.38 15.62,-16.5S189.4,114.59 180.77,114.59Z\"/>\n    <path android:fillColor=\"#2bc5b4\" android:pathData=\"M125,0A125,125 0,1 0,250 125,125 125,0 0,0 125,0ZM95.37,132.09c0,63.82 -101.74,35.68 -60.49,2.93 9.65,13.39 28.18,12.5 30.15,-0.72l0.37,-52.05c0.95,-13.32 26.85,-16 30,0ZM133.31,156.32a12.05,12.05 0,0 1,-12 12L116.1,168.32a12.05,12.05 0,0 1,-12 -12L104.1,106a12,12 0,0 1,12 -12h5.21a12,12 0,0 1,12 12ZM133.31,74.56a11.84,11.84 0,0 1,-11.79 11.79L115.9,86.35a11.84,11.84 0,0 1,-11.81 -11.79L104.09,71.65A11.83,11.83 0,0 1,115.9 59.86h5.62a11.82,11.82 0,0 1,11.79 11.79ZM180.77,169.9c-22,0 -39.82,-17.37 -39.82,-38.82s17.84,-38.81 39.82,-38.81 39.81,17.38 39.81,38.81S202.76,169.9 180.77,169.9Z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_linkedin.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" xmlns:aapt=\"http://schemas.android.com/aapt\"\n    android:width=\"52dp\" android:height=\"52dp\"\n    android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:pathData=\"m140.008,423h-30c-11.047,0 -20,-8.953 -20,-20v-186c0,-11.047 8.953,-20 20,-20h30c11.047,0 20,8.953 20,20v186c0,11.047 -8.953,20 -20,20zM166.992,124.996c0,-22.629 -18.359,-40.996 -40.977,-40.996 -22.703,0 -41.016,18.367 -41.016,40.996 0,22.637 18.313,41.004 41.016,41.004 22.617,0 40.977,-18.367 40.977,-41.004zM422,403v-104.336c0,-60.668 -12.816,-105.664 -83.688,-105.664 -34.055,0 -56.914,17.031 -66.246,34.742h-0.066v-10.742c0,-11.047 -8.953,-20 -20,-20h-28c-11.047,0 -20,8.953 -20,20v186c0,11.047 8.953,20 20,20h28c11.047,0 20,-8.953 20,-20v-92.211c0,-29.387 7.48,-57.855 43.906,-57.855 35.93,0 37.094,33.605 37.094,59.723v90.344c0,11.047 8.953,20 20,20h29c11.047,0 20,-8.953 20,-20zM512,432c0,-11.047 -8.953,-20 -20,-20s-20,8.953 -20,20c0,22.055 -17.945,40 -40,40h-352c-22.055,0 -40,-17.945 -40,-40v-352c0,-22.055 17.945,-40 40,-40h352c22.055,0 40,17.945 40,40v251c0,11.047 8.953,20 20,20s20,-8.953 20,-20v-251c0,-44.113 -35.887,-80 -80,-80h-352c-44.113,0 -80,35.887 -80,80v352c0,44.113 35.887,80 80,80h352c44.113,0 80,-35.887 80,-80zM512,432\">\n        <aapt:attr name=\"android:fillColor\">\n            <gradient android:endX=\"512\" android:endY=\"256\"\n                android:startX=\"0\" android:startY=\"256\" android:type=\"linear\">\n                <item android:color=\"#FF00F2FE\" android:offset=\"0\"/>\n                <item android:color=\"#FF03EFFE\" android:offset=\"0.0208\"/>\n                <item android:color=\"#FF24D2FE\" android:offset=\"0.2931\"/>\n                <item android:color=\"#FF3CBDFE\" android:offset=\"0.5538\"/>\n                <item android:color=\"#FF4AB0FE\" android:offset=\"0.7956\"/>\n                <item android:color=\"#FF4FACFE\" android:offset=\"1\"/>\n            </gradient>\n        </aapt:attr>\n    </path>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_mug.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"40dp\"\n    android:height=\"40dp\" android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:fillColor=\"#ff5d7d\" android:fillType=\"evenOdd\" android:pathData=\"m258.229,255.863c-11.191,-11.155 -29.503,-11.155 -40.693,0 -4.486,4.471 -11.053,4.007 -15.072,0 -11.191,-11.155 -29.503,-11.155 -40.693,0 -30.403,30.307 28.128,83.271 48.229,88.64 20.102,-5.369 78.632,-58.333 48.229,-88.64z\"/>\n    <path android:fillColor=\"#fff\" android:fillType=\"evenOdd\" android:pathData=\"m258.229,255.863c30.403,30.307 -28.128,83.271 -48.23,88.64 -20.102,-5.369 -78.633,-58.334 -48.229,-88.64 11.191,-11.155 29.502,-11.155 40.693,0 4.02,4.007 10.587,4.471 15.072,0 11.191,-11.155 29.503,-11.155 40.694,0zM10,176c0,94.167 60,173.334 80,260h240c3.112,-13.487 7.193,-26.792 11.866,-40 4.742,-13.403 10.093,-26.707 15.66,-40 16.471,-39.33 34.83,-78.563 44.877,-119.994 3.154,-13.009 5.489,-26.235 6.689,-39.749 0.593,-6.679 0.908,-13.429 0.908,-20.257 0,-11 -9,-20 -20,-20 -120,0 -240,0 -360.001,0 -10.999,0 -19.999,9 -19.999,20z\"/>\n    <path android:fillColor=\"#ccf5fc\" android:fillType=\"evenOdd\" android:pathData=\"m402,356h-44.474c-5.567,13.293 -10.918,26.597 -15.66,40h60.134c55,0 99.999,-45 99.999,-100 0,-52.616 -41.185,-96.074 -92.908,-99.743 -1.2,13.514 -3.534,26.74 -6.69,39.749 32.818,0.218 59.599,27.129 59.599,59.994 0,33 -27,60 -60,60z\"/>\n    <path android:fillColor=\"#ccf5fc\" android:fillType=\"evenOdd\" android:pathData=\"m330,436h-240,-20c-11,0 -20,9 -20,20s9,20 20,20h280c11,0 20,-9 20,-20s-9,-20 -20,-20z\"/>\n    <path android:fillColor=\"#FF000000\" android:pathData=\"m419.714,187.451c0.186,-3.793 0.286,-7.608 0.286,-11.451 0,-16.542 -13.458,-30 -30,-30h-360c-16.542,0 -30,13.458 -30,30 0,59.097 22.691,112.205 44.635,163.564 12.597,29.484 24.571,57.526 32.514,86.436h-7.149c-16.542,0 -30,13.458 -30,30s13.458,30 30,30h280c16.542,0 30,-13.458 30,-30s-13.458,-30 -30,-30h-7.147c1.842,-6.704 3.897,-13.362 6.13,-20h53.017c60.654,0 110,-49.346 110,-110 0,-53.968 -39.847,-99.962 -92.286,-108.549zM409.978,246.658c23.725,3.87 42.022,24.684 42.022,49.342 0,27.57 -22.43,50 -50,50h-29.383c0.912,-2.138 1.828,-4.282 2.747,-6.435 12.854,-30.084 25.958,-60.771 34.614,-92.907zM254.997,426c-5.523,0 -10,4.478 -10,10s4.477,10 10,10h95.003c5.514,0 10,4.486 10,10s-4.486,10 -10,10h-280c-5.514,0 -10,-4.486 -10,-10s4.486,-10 10,-10h94.997c5.523,0 10,-4.478 10,-10s-4.477,-10 -10,-10h-67.153c-8.334,-32.299 -21.78,-63.781 -34.817,-94.293 -21.153,-49.509 -43.027,-100.704 -43.027,-155.707 0,-5.514 4.486,-10 10,-10h360c5.514,0 10,4.486 10,10 0,55.003 -21.874,106.198 -43.027,155.707 -13.036,30.513 -26.486,61.997 -34.82,94.293zM402,386h-45.791c2.546,-6.646 5.221,-13.303 7.988,-20h37.803c38.599,0 70,-31.401 70,-70 0,-34.024 -24.884,-62.818 -57.401,-68.83 1.329,-6.513 2.447,-13.09 3.312,-19.739 42.202,7.615 74.089,44.901 74.089,88.569 0,49.626 -40.374,90 -90,90z\"/>\n    <path android:fillColor=\"#FF000000\" android:pathData=\"m210.476,248.781c-0.2,0.201 -0.476,0.477 -0.953,0v0.001c-15.113,-15.066 -39.703,-15.066 -54.813,0 -10.553,10.519 -13.958,24.203 -9.847,39.572 8.313,31.073 45.551,61.27 62.555,65.811 0.845,0.226 1.713,0.339 2.581,0.339s1.735,-0.113 2.581,-0.339c17.004,-4.541 54.242,-34.736 62.556,-65.811 4.111,-15.369 0.706,-29.054 -9.846,-39.572 -15.113,-15.065 -39.702,-15.066 -54.814,-0.001zM255.815,283.185c-5.882,21.986 -33.302,45.229 -45.815,50.721 -12.513,-5.491 -39.933,-28.734 -45.814,-50.721 -2.249,-8.407 -0.773,-14.838 4.646,-20.239 3.663,-3.651 8.474,-5.478 13.286,-5.478s9.624,1.826 13.288,5.478v0.001c8.185,8.156 21.007,8.157 29.191,-0.001 7.326,-7.303 19.247,-7.303 26.574,0 5.417,5.401 6.892,11.832 4.644,20.239z\"/>\n    <path android:fillColor=\"#ccf5fc\" android:pathData=\"m201.736,110.504c-3.034,4.615 -1.752,10.815 2.862,13.85 1.693,1.113 3.599,1.646 5.484,1.646 3.253,0 6.444,-1.586 8.365,-4.507 17.816,-27.099 6.822,-41.619 -0.453,-51.228 -6.372,-8.416 -9.882,-13.052 0.453,-28.771 3.034,-4.615 1.752,-10.815 -2.862,-13.85 -4.614,-3.034 -10.815,-1.753 -13.85,2.861 -18.093,27.52 -7.016,42.15 0.314,51.832 6.489,8.57 9.745,12.871 -0.313,28.167z\"/>\n    <path android:fillColor=\"#ccf5fc\" android:pathData=\"m121.733,110.504c-3.034,4.615 -1.752,10.815 2.862,13.85 1.693,1.113 3.599,1.646 5.484,1.646 3.253,0 6.444,-1.586 8.365,-4.507 17.816,-27.099 6.823,-41.619 -0.452,-51.228 -6.373,-8.416 -9.882,-13.053 0.452,-28.771 3.034,-4.615 1.752,-10.815 -2.862,-13.85 -4.614,-3.034 -10.816,-1.753 -13.85,2.861 -18.093,27.52 -7.016,42.15 0.314,51.831 6.489,8.571 9.746,12.872 -0.313,28.168z\"/>\n    <path android:fillColor=\"#ccf5fc\" android:pathData=\"m281.739,110.504c-3.034,4.615 -1.753,10.815 2.861,13.85 1.693,1.113 3.6,1.646 5.484,1.646 3.254,0 6.444,-1.585 8.365,-4.507 17.817,-27.099 6.823,-41.619 -0.452,-51.228 -6.372,-8.416 -9.882,-13.053 0.452,-28.771 3.034,-4.615 1.753,-10.815 -2.861,-13.85 -4.615,-3.034 -10.815,-1.751 -13.85,2.861 -18.094,27.52 -7.017,42.15 0.313,51.831 6.49,8.571 9.746,12.872 -0.312,28.168z\"/>\n    <path android:fillColor=\"#FF000000\" android:pathData=\"m210,426h-0.007c-5.523,0 -9.996,4.478 -9.996,10s4.48,10 10.003,10 10,-4.478 10,-10 -4.477,-10 -10,-10z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_musicplaceholder.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"300dp\"\n    android:height=\"300dp\" android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m256,80a48.054,48.054 0,0 1,48 48v32h12a19.991,19.991 0,0 0,3.524 -39.671,63.984 63.984,0 0,0 -127.048,0 19.991,19.991 0,0 0,3.524 39.671h12v-32a48.054,48.054 0,0 1,48 -48z\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m48,152a24.027,24.027 0,0 0,24 -24v-74.234l42.53,-14.176 -5.06,-15.18 -48,16a8,8 0,0 0,-5.47 7.59v57.376a24,24 0,1 0,-8 46.624zM48,120a8,8 0,1 1,-8 8,8.009 8.009,0 0,1 8,-8z\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m485.006,17.76a7.993,7.993 0,0 0,-6.741 -1.569l-72,16a8,8 0,0 0,-6.265 7.809v57.376a24,24 0,1 0,16 22.624v-73.583l56,-12.444v47.4a24,24 0,1 0,16 22.627v-80a8,8 0,0 0,-2.994 -6.24zM392,128a8,8 0,1 1,8 -8,8.009 8.009,0 0,1 -8,8zM464,112a8,8 0,1 1,8 -8,8.009 8.009,0 0,1 -8,8z\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m48,456h416v40h-416z\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m64,376a16,16 0,0 0,-16 16v7h48v-7a16,16 0,0 0,-16 -16z\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m24,416h464v24h-464z\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"M256,144m-48,0a48,48 0,1 1,96 0a48,48 0,1 1,-96 0\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m368,400 l16,-160h-256l16,160zM256,296a24,24 0,1 1,-24 24,24 24,0 0,1 24,-24z\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m168,224h176a32,32 0,0 0,-32 -32h-112a32,32 0,0 0,-32 32z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_opencollective_icon.xml",
    "content": "<vector android:height=\"24dp\" android:viewportHeight=\"64\"\n    android:viewportWidth=\"64\" android:width=\"24dp\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:fillColor=\"#BBFFFFFF\" android:fillType=\"evenOdd\" android:pathData=\"M52.402,31.916c0,4.03 -1.17,7.895 -3.178,11.087l8.196,8.23c4.014,-5.375 6.523,-12.094 6.523,-19.318s-2.51,-13.942 -6.523,-19.318l-8.196,8.23c2.007,3.192 3.178,6.887 3.178,11.087z\"/>\n    <path android:fillColor=\"#FFFFFF\" android:fillType=\"evenOdd\" android:pathData=\"M32.004,52.41c-11.207,0 -20.406,-9.24 -20.406,-20.493s9.2,-20.493 20.406,-20.493c4.182,0 7.86,1.176 11.04,3.36l8.196,-8.23C45.887,2.52 39.197,0 32.004,0 14.44,0 0.057,14.278 0.057,32.084S14.44,64 32.004,64c7.36,0 14.05,-2.52 19.403,-6.55l-8.196,-8.23c-3.178,2.016 -7.025,3.192 -11.207,3.192z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_paypal_logo.xml",
    "content": "<vector android:height=\"24dp\" android:viewportHeight=\"435.505\"\n    android:viewportWidth=\"435.505\" android:width=\"24dp\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:fillColor=\"#FFFFFF\" android:pathData=\"M403.496,101.917c-4.104,-5.073 -8.877,-9.705 -14.166,-13.839c0.707,13.117 -0.508,27.092 -3.668,41.884c-8.627,40.413 -29.256,74.754 -59.656,99.304c-30.375,24.533 -68.305,37.502 -109.686,37.502h-60.344l-19.533,91.512c-3.836,17.959 -19.943,30.99 -38.303,30.99H70.938l-4.898,22.484c-1.258,5.79 0.17,11.839 3.887,16.453c3.715,4.614 9.324,7.298 15.25,7.298h66.498c9.24,0 17.225,-6.459 19.152,-15.495L193.667,313h76.188c36.854,0 70.527,-11.464 97.384,-33.152c26.869,-21.697 45.129,-52.186 52.807,-88.162C427.822,155.309 422.253,125.106 403.496,101.917z\"/>\n    <path android:fillColor=\"#FFFFFF\" android:pathData=\"M117.292,354.191l22.84,-107.008h76.188c36.852,0 70.527,-11.465 97.383,-33.154c26.867,-21.697 45.129,-52.186 52.809,-88.161c7.773,-36.378 2.207,-66.58 -16.553,-89.769C331.952,13.832 301.17,0 269.633,0H103.639c-9.209,0 -17.174,6.417 -19.135,15.414L12.505,345.938c-1.26,5.789 0.168,11.838 3.887,16.453c3.713,4.613 9.32,7.296 15.248,7.296h66.5C107.38,369.687 115.36,363.229 117.292,354.191zM178.235,75.291h52.229c12.287,0 23.274,5.149 30.145,14.129c7.297,9.539 9.431,22.729 5.853,36.188c-0.047,0.171 -0.088,0.342 -0.131,0.516c-6.57,27.73 -33.892,50.291 -60.898,50.291h-50.05L178.235,75.291z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_refreshgradient.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"42dp\"\n    android:height=\"42dp\" android:viewportWidth=\"496\" android:viewportHeight=\"496\">\n    <path android:fillColor=\"#6C9DFF\" android:pathData=\"M248,92c-13.6,0 -24,-10.4 -24,-24V24c0,-13.6 10.4,-24 24,-24s24,10.4 24,24v44C272,80.8 261.6,92 248,92z\"/>\n    <path android:fillColor=\"#DA3B7A\" android:pathData=\"M248,496c-13.6,0 -24,-10.4 -24,-24v-44c0,-13.6 10.4,-24 24,-24s24,10.4 24,24v44C272,485.6 261.6,496 248,496z\"/>\n    <path android:fillColor=\"#63BBFF\" android:pathData=\"M157.6,116c-8,0 -16,-4 -20.8,-12l-21.6,-37.6c-6.4,-11.2 -2.4,-26.4 8.8,-32.8s26.4,-2.4 32.8,8.8L178.4,80c6.4,11.2 2.4,26.4 -8.8,32.8C166.4,114.4 161.6,116 157.6,116z\"/>\n    <path android:fillColor=\"#E542A9\" android:pathData=\"M360,465.6c-8,0 -16,-4 -20.8,-12L317.6,416c-6.4,-11.2 -2.4,-26.4 8.8,-32.8c11.2,-6.4 26.4,-2.4 32.8,8.8l21.6,37.6c6.4,11.2 2.4,26.4 -8.8,32.8C368,464.8 364,465.6 360,465.6z\"/>\n    <path android:fillColor=\"#A1DCEC\" android:pathData=\"M92,181.6c-4,0 -8,-0.8 -12,-3.2l-37.6,-21.6c-11.2,-6.4 -15.2,-21.6 -8.8,-32.8s21.6,-15.2 32.8,-8.8l37.6,21.6c11.2,6.4 15.2,21.6 8.8,32.8C108,177.6 100,181.6 92,181.6z\"/>\n    <path android:fillColor=\"#B135FF\" android:pathData=\"M442.4,384c-4,0 -8,-0.8 -12,-3.2L392,359.2c-11.2,-6.4 -15.2,-21.6 -8.8,-32.8c6.4,-11.2 21.6,-15.2 32.8,-8.8l37.6,21.6c11.2,6.4 15.2,21.6 8.8,32.8C458.4,380 450.4,384 442.4,384z\"/>\n    <path android:fillColor=\"#F3FFFD\" android:pathData=\"M68,272H24c-13.6,0 -24,-10.4 -24,-24s10.4,-24 24,-24h44c13.6,0 24,10.4 24,24S80.8,272 68,272z\"/>\n    <path android:fillColor=\"#9254C8\" android:pathData=\"M472,272h-44c-13.6,0 -24,-10.4 -24,-24s10.4,-24 24,-24h44c13.6,0 24,10.4 24,24S485.6,272 472,272z\"/>\n    <path android:fillColor=\"#CE1CFF\" android:pathData=\"M53.6,384c-8,0 -16,-4 -20.8,-12c-6.4,-11.2 -2.4,-26.4 8.8,-32.8l37.6,-21.6c11.2,-6.4 26.4,-2.4 32.8,8.8c6.4,11.2 2.4,26.4 -8.8,32.8l-37.6,21.6C62.4,383.2 58.4,384 53.6,384z\"/>\n    <path android:fillColor=\"#6953E5\" android:pathData=\"M404,181.6c-8,0 -16,-4 -20.8,-12c-6.4,-11.2 -2.4,-26.4 8.8,-32.8l37.6,-21.6c11.2,-6.4 26.4,-2.4 32.8,8.8s2.4,26.4 -8.8,32.8L416,178.4C412,180.8 408,181.6 404,181.6z\"/>\n    <path android:fillColor=\"#DE339F\" android:pathData=\"M136,465.6c-4,0 -8,-0.8 -12,-3.2c-11.2,-6.4 -15.2,-21.6 -8.8,-32.8l21.6,-37.6c6.4,-11.2 21.6,-15.2 32.8,-8.8c11.2,6.4 15.2,21.6 8.8,32.8l-21.6,37.6C152,461.6 144,465.6 136,465.6z\"/>\n    <path android:fillColor=\"#5681FF\" android:pathData=\"M338.4,116c-4,0 -8,-0.8 -12,-3.2c-11.2,-6.4 -15.2,-21.6 -8.8,-32.8l21.6,-37.6c6.4,-11.2 21.6,-15.2 32.8,-8.8c11.2,6.4 15.2,21.6 8.8,32.8L359.2,104C354.4,111.2 346.4,116 338.4,116z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_round_cancel_24.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\"\n    android:tint=\"?attr/colorControlNormal\">\n  <path\n      android:fillColor=\"@android:color/white\"\n      android:pathData=\"M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM16.3,16.3c-0.39,0.39 -1.02,0.39 -1.41,0L12,13.41 9.11,16.3c-0.39,0.39 -1.02,0.39 -1.41,0 -0.39,-0.39 -0.39,-1.02 0,-1.41L10.59,12 7.7,9.11c-0.39,-0.39 -0.39,-1.02 0,-1.41 0.39,-0.39 1.02,-0.39 1.41,0L12,10.59l2.89,-2.89c0.39,-0.39 1.02,-0.39 1.41,0 0.39,0.39 0.39,1.02 0,1.41L13.41,12l2.89,2.89c0.38,0.38 0.38,1.02 0,1.41z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_share_open.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"32dp\"\n    android:height=\"32dp\" android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:fillColor=\"#FF3C64\" android:pathData=\"m304,232a24,24 0,0 1,-16.971 -40.971l160,-160a24,24 0,0 1,33.942 33.942l-160,160a23.926,23.926 0,0 1,-16.971 7.029z\"/>\n    <path android:fillColor=\"#FF3B63\" android:pathData=\"m464,200a24,24 0,0 1,-24 -24v-104h-104a24,24 0,0 1,0 -48h128a24,24 0,0 1,24 24v128a24,24 0,0 1,-24 24z\"/>\n    <path android:fillColor=\"#CE1CFF\" android:pathData=\"m464,488h-416a24,24 0,0 1,-24 -24v-416a24,24 0,0 1,24 -24h176a24,24 0,0 1,0 48h-152v368h368v-152a24,24 0,0 1,48 0v176a24,24 0,0 1,-24 24z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_song_placeholder.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"42dp\"\n    android:height=\"42dp\" android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m511.739,103.734 l-257,50.947v233.725c-10.733,-7.199 -23.633,-11.406 -37.5,-11.406 -37.22,0 -67.5,30.28 -67.5,67.5s30.28,67.5 67.5,67.5c34.684,0 63.329,-26.299 67.073,-60h0.427v-182.682l197,-39.053v98.141c-10.733,-7.199 -23.633,-11.406 -37.5,-11.406 -37.22,0 -67.5,30.28 -67.5,67.5s30.28,67.5 67.5,67.5c39.927,0 71.547,-34.762 67.073,-75h0.427zM217.239,482c-20.678,0 -37.5,-16.822 -37.5,-37.5s16.822,-37.5 37.5,-37.5 37.5,16.822 37.5,37.5 -16.822,37.5 -37.5,37.5zM444.239,422c-20.678,0 -37.5,-16.822 -37.5,-37.5s16.822,-37.5 37.5,-37.5 37.5,16.822 37.5,37.5 -16.822,37.5 -37.5,37.5zM481.739,199.682 L284.739,238.735v-59.416l197,-39.053z\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m182.179,159.75h30c0,-31.002 4.415,-66.799 -24.144,-95.356 -8.968,-8.968 -17.455,-16.07 -24.942,-22.336 -19.798,-16.57 -27.832,-24.012 -27.832,-42.058h-30v221.406c-10.734,-7.199 -23.634,-11.406 -37.5,-11.406 -37.22,0 -67.5,30.28 -67.5,67.5s30.28,67.5 67.5,67.5c34.684,0 63.329,-26.299 67.073,-60h0.427v-227.219c9.458,8.262 20.077,16.341 31.562,27.825 19.029,19.031 15.356,44.009 15.356,74.144zM67.761,315c-20.678,0 -37.5,-16.822 -37.5,-37.5s16.822,-37.5 37.5,-37.5 37.5,16.822 37.5,37.5 -16.823,37.5 -37.5,37.5z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_soundcloud.xml",
    "content": "<vector android:height=\"32dp\" android:viewportHeight=\"1386\"\n    android:viewportWidth=\"2500\" android:width=\"58dp\"\n    xmlns:aapt=\"http://schemas.android.com/aapt\"\n    xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:pathData=\"M0,1137.74c0,31.02 11.25,54.48 33.74,70.38 22.49,15.9 46.53,21.52 72.13,16.87 24.04,-4.65 40.91,-13.19 50.61,-25.59 9.69,-12.41 14.54,-32.96 14.54,-61.66L171.01,800.37c0,-24.04 -8.34,-44.4 -25.01,-61.08 -16.67,-16.68 -37.03,-25.01 -61.07,-25.01 -23.27,0 -43.24,8.34 -59.91,25.01C8.34,755.97 0,776.33 0,800.37zM267.57,1281.99c0,22.5 7.95,39.36 23.85,50.61 15.9,11.25 36.26,16.87 61.08,16.87 25.59,0 46.34,-5.62 62.24,-16.87 15.9,-11.24 23.85,-28.11 23.85,-50.61L438.58,495.58c0,-23.27 -8.34,-43.24 -25.01,-59.91 -16.67,-16.67 -37.03,-25.01 -61.08,-25.01 -23.27,0 -43.24,8.34 -59.91,25.01 -16.68,16.68 -25.01,36.65 -25.01,59.91zM533.97,1319.22c0,22.49 8.14,39.36 24.43,50.61 16.29,11.24 37.23,16.87 62.82,16.87 24.82,0 45.17,-5.62 61.07,-16.87 15.9,-11.25 23.85,-28.11 23.85,-50.61L706.14,601.44c0,-24.04 -8.34,-44.6 -25.01,-61.66 -16.67,-17.06 -36.64,-25.59 -59.91,-25.59 -24.04,0 -44.6,8.53 -61.66,25.59 -17.06,17.06 -25.59,37.62 -25.59,61.66v717.78zM801.54,1322.71c0,42.66 28.69,63.99 86.09,63.99 57.39,0 86.08,-21.33 86.08,-63.99L973.71,159.38c0,-65.15 -19.78,-101.99 -59.33,-110.52 -25.59,-6.2 -50.8,1.16 -75.62,22.1 -24.82,20.94 -37.23,50.41 -37.23,88.41v1163.33zM1073.76,1356.44L1073.76,90.74c0,-40.33 12.02,-64.37 36.06,-72.13C1161.78,6.2 1213.36,0 1264.54,0c118.66,0 229.18,27.92 331.55,83.76 102.37,55.84 185.16,132.04 248.37,228.59 63.21,96.56 99.85,203 109.94,319.34 47.31,-20.17 97.72,-30.25 151.23,-30.25 108.58,0 201.45,38.39 278.62,115.17 77.17,76.78 115.75,169.07 115.75,276.88 0,108.58 -38.59,201.26 -115.75,278.04 -77.17,76.78 -169.65,115.17 -277.45,115.17l-1012.1,-1.16c-6.98,-2.33 -12.22,-6.59 -15.71,-12.8s-5.23,-11.64 -5.23,-16.29z\">\n        <aapt:attr name=\"android:fillColor\">\n            <gradient android:endX=\"1252.675\" android:endY=\"1359.0215\"\n                android:startX=\"1252.675\" android:startY=\"37.73211\" android:type=\"linear\">\n                <item android:color=\"#FFFF8800\" android:offset=\"0\"/>\n                <item android:color=\"#FFFF3300\" android:offset=\"1\"/>\n            </gradient>\n        </aapt:attr>\n    </path>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_spotiflyer_logo.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:aapt=\"http://schemas.android.com/aapt\"\n    android:width=\"108dp\"\n    android:height=\"108dp\"\n    android:gravity=\"center\"\n    android:viewportWidth=\"108\"\n    android:viewportHeight=\"108\">\n    <group android:scaleX=\"0.10546875\"\n        android:scaleY=\"0.10546875\"\n        android:translateX=\"27\"\n        android:translateY=\"27\">\n        <path\n            android:pathData=\"M256,256m-256,0a256,256 0,1 1,512 0a256,256 0,1 1,-512 0\">\n            <aapt:attr name=\"android:fillColor\">\n                <gradient\n                    android:startY=\"437.0193\"\n                    android:startX=\"74.9807\"\n                    android:endY=\"74.9807\"\n                    android:endX=\"437.0193\"\n                    android:type=\"linear\">\n                    <item android:offset=\"0\" android:color=\"#FF736BFD\"/>\n                    <item android:offset=\"1\" android:color=\"#FFF54187\"/>\n                </gradient>\n            </aapt:attr>\n        </path>\n        <path\n            android:fillColor=\"#FF000000\"\n            android:pathData=\"M377,356.7c-68.9,-45.4 -155.6,-56.4 -257.6,-32.7c-20.5,4.8 -13.6,35.8 7.3,31.2C290.7,317 351.6,386 368.2,386C384,386 390.2,365.4 377,356.7z\"/>\n        <path\n            android:fillColor=\"#FF000000\"\n            android:pathData=\"M112.1,275.1C203.9,253.4 308.1,266 384,308c18.5,10.2 34,-17.8 15.5,-28c-82.7,-45.7 -195.6,-59.5 -294.7,-36C84.2,248.8 91.5,280 112.1,275.1L112.1,275.1z\"/>\n        <path\n            android:fillColor=\"#FF000000\"\n            android:pathData=\"M100,191.9c96.6,-29.6 232.2,-13.4 308.7,36.9c17.6,11.5 35.3,-15.1 17.6,-26.7c-84.9,-55.8 -229.2,-73.3 -335.6,-40.8C70.4,167.5 79.9,198.1 100,191.9L100,191.9z\"/>\n        <path\n            android:pathData=\"M507.8,438.2c-1.6,97.2 -141.9,97.1 -143.5,0C365.9,341 506.2,341 507.8,438.2z\">\n            <aapt:attr name=\"android:fillColor\">\n                <gradient\n                    android:startY=\"386.3741\"\n                    android:startX=\"487.8323\"\n                    android:endY=\"490.009\"\n                    android:endX=\"384.1974\"\n                    android:type=\"linear\">\n                    <item android:offset=\"0\" android:color=\"#FF736BFD\"/>\n                    <item android:offset=\"1\" android:color=\"#FFF54187\"/>\n                </gradient>\n            </aapt:attr>\n        </path>\n        <path\n            android:fillColor=\"#FF000000\"\n            android:pathData=\"M486.8,456.8c-0.6,-2.4 -6.9,-1 -8.5,-1.4c11.5,-82 -82.4,-86.7 -87.1,-22.2c0.3,1.8 -1,6.7 2.2,6.6c0,0 8.6,0 8.6,0c3.1,0.1 2,-4.7 2.2,-6.6c0.1,-23.3 35,-23.3 35.2,0c0,0 0,6.9 0,6.9c-0.1,2.8 4.4,2.8 4.3,0c5,-35.2 -43.8,-40.1 -43.8,-4.7h-4.3c-1.6,-53.7 77.2,-55.9 78.4,-2.2c0,0 0,24.4 0,24.4c-0.1,2.9 3.8,2.1 5.6,2.2l-20.7,21l-20.7,-21c1.8,-0.1 5.6,0.7 5.6,-2.2c0,0 0,-8.8 0,-8.8c0,-2.8 -4.4,-2.8 -4.3,0c0,0 0,6.6 0,6.6c-2.2,0.2 -11.3,-1.3 -8,3.7c0,0 25.9,26.3 25.9,26.3c0.8,0.9 2.2,0.9 3.1,0C460.6,484.4 489.4,458.3 486.8,456.8z\"\n            android:strokeWidth=\"0.75\"\n            android:strokeColor=\"#000000\"/>\n        <path\n            android:pathData=\"M510,437.5c-1.7,96.2 -142.1,96.2 -143.8,0C367.9,341.3 508.4,341.3 510,437.5z\"\n            android:strokeWidth=\"6\"\n            android:fillColor=\"#00000000\"\n            android:strokeColor=\"#000000\"/>\n    </group>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_spotify_logo.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"42dp\"\n    android:height=\"42dp\" android:viewportWidth=\"427.652\" android:viewportHeight=\"427.652\">\n    <path android:fillColor=\"#00D95F\" android:pathData=\"M213.826,0C95.733,0 0,95.733 0,213.826s95.733,213.826 213.826,213.826s213.826,-95.733 213.826,-213.826S331.919,0 213.826,0zM306.886,310.32c-2.719,4.652 -7.612,7.246 -12.638,7.247c-2.506,0 -5.044,-0.645 -7.364,-2c-38.425,-22.456 -82.815,-26.065 -113.295,-25.138c-33.763,1.027 -58.523,7.692 -58.769,7.76c-7.783,2.126 -15.826,-2.454 -17.961,-10.236c-2.134,-7.781 2.43,-15.819 10.209,-17.962c1.116,-0.307 27.76,-7.544 64.811,-8.766c21.824,-0.72 42.834,0.801 62.438,4.52c24.83,4.71 47.48,12.978 67.322,24.574C308.612,294.393 310.96,303.349 306.886,310.32zM334.07,253.861c-3.22,5.511 -9.016,8.583 -14.97,8.584c-2.968,0 -5.975,-0.763 -8.723,-2.369c-45.514,-26.6 -98.097,-30.873 -134.2,-29.776c-39.994,1.217 -69.323,9.112 -69.614,9.192c-9.217,2.515 -18.746,-2.906 -21.275,-12.124c-2.528,-9.218 2.879,-18.738 12.093,-21.277c1.322,-0.364 32.882,-8.937 76.77,-10.384c25.853,-0.852 50.739,0.949 73.96,5.354c29.412,5.58 56.241,15.373 79.744,29.108C336.115,234.995 338.897,245.603 334.07,253.861zM350.781,202.526c-3.641,0 -7.329,-0.936 -10.7,-2.906c-108.207,-63.238 -248.572,-25.643 -249.977,-25.255c-11.313,3.117 -23.008,-3.527 -26.124,-14.839c-3.117,-11.312 3.527,-23.008 14.839,-26.124c1.621,-0.447 40.333,-10.962 94.166,-12.737c31.713,-1.044 62.237,1.164 90.72,6.567c36.077,6.844 68.987,18.856 97.815,35.704c10.13,5.92 13.543,18.931 7.623,29.061C365.193,198.757 358.084,202.526 350.781,202.526z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_tick.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" xmlns:aapt=\"http://schemas.android.com/aapt\"\n    android:width=\"40dp\" android:height=\"40dp\"\n    android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:pathData=\"m512,256c0,141.387 -114.613,256 -256,256s-256,-114.613 -256,-256 114.613,-256 256,-256 256,114.613 256,256zM512,256\">\n        <aapt:attr name=\"android:fillColor\">\n            <gradient android:endX=\"512\" android:endY=\"256\"\n                android:startX=\"0\" android:startY=\"256\" android:type=\"linear\">\n                <item android:color=\"#748AFF\" android:offset=\"0\"/>\n                <item android:color=\"#FF3C64\" android:offset=\"1\"/>\n            </gradient>\n        </aapt:attr>\n    </path>\n    <path android:fillColor=\"#000000\" android:pathData=\"m175,395.246c-4.035,0 -7.902,-1.629 -10.727,-4.512l-81,-82.832c-5.789,-5.922 -5.684,-15.418 0.238,-21.211 5.922,-5.793 15.418,-5.688 21.211,0.238l70.273,71.859 232.277,-237.523c5.793,-5.922 15.289,-6.027 21.211,-0.234 5.926,5.789 6.031,15.289 0.238,21.211l-243,248.492c-2.82,2.883 -6.688,4.512 -10.723,4.512zM175,395.246\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_youtube.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector android:height=\"42dp\" android:viewportHeight=\"500\"\n    android:viewportWidth=\"500\" android:width=\"42dp\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:fillColor=\"#E11F23\" android:pathData=\"M236.966,236.966m-236.966,0a236.966,236.966 0,1 1,473.932 0a236.966,236.966 0,1 1,-473.932 0\"/>\n    <path android:fillColor=\"#E11F23\" android:pathData=\"M404.518,69.38c92.541,92.549 92.549,242.593 0,335.142c-92.541,92.541 -242.593,92.545 -335.142,0L404.518,69.38z\"/>\n    <path android:fillColor=\"#E11F23\" android:pathData=\"M469.168,284.426L351.886,167.148l-138.322,15.749l-83.669,129.532l156.342,156.338C378.157,449.322 450.422,376.612 469.168,284.426z\"/>\n    <path android:fillColor=\"#FFFFFF\" android:pathData=\"M360.971,191.238c0,-19.865 -16.093,-35.966 -35.947,-35.966H156.372c-19.85,0 -35.94,16.105 -35.94,35.966v96.444c0,19.865 16.093,35.966 35.94,35.966h168.649c19.858,0 35.947,-16.105 35.947,-35.966v-96.444H360.971zM216.64,280.146v-90.584l68.695,45.294L216.64,280.146z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/ic_youtube_music_logo.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector android:height=\"44dp\" android:viewportHeight=\"192\"\n    android:viewportWidth=\"192\" android:width=\"44dp\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:fillColor=\"#FF0000\" android:pathData=\"M96,96m-88,0a88,88 0,1 1,176 0a88,88 0,1 1,-176 0\"/>\n    <path android:fillColor=\"#FFFFFF\" android:pathData=\"M96,54.04c23.14,0 41.96,18.82 41.96,41.96S119.14,137.96 96,137.96S54.04,119.14 54.04,96S72.86,54.04 96,54.04M96,50c-25.41,0 -46,20.59 -46,46s20.59,46 46,46s46,-20.59 46,-46S121.41,50 96,50L96,50z\"/>\n    <path android:fillColor=\"#FFFFFF\" android:pathData=\"M80,119l39,-24l-39,-22z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/music.xml",
    "content": "<!--\n  ~ Copyright (c)  2021  Shabinder Singh\n  ~ This program is free software: you can redistribute it and/or modify\n  ~ it under the terms of the GNU General Public License as published by\n  ~ the Free Software Foundation, either version 3 of the License, or\n  ~ (at your option) any later version.\n  ~\n  ~ This program is distributed in the hope that it will be useful,\n  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~ GNU General Public License for more details.\n  ~\n  ~  You should have received a copy of the GNU General Public License\n  ~  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\" android:width=\"42dp\"\n    android:height=\"42dp\" android:viewportWidth=\"512\" android:viewportHeight=\"512\">\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m511.739,103.734 l-257,50.947v233.725c-10.733,-7.199 -23.633,-11.406 -37.5,-11.406 -37.22,0 -67.5,30.28 -67.5,67.5s30.28,67.5 67.5,67.5c34.684,0 63.329,-26.299 67.073,-60h0.427v-182.682l197,-39.053v98.141c-10.733,-7.199 -23.633,-11.406 -37.5,-11.406 -37.22,0 -67.5,30.28 -67.5,67.5s30.28,67.5 67.5,67.5c39.927,0 71.547,-34.762 67.073,-75h0.427zM217.239,482c-20.678,0 -37.5,-16.822 -37.5,-37.5s16.822,-37.5 37.5,-37.5 37.5,16.822 37.5,37.5 -16.822,37.5 -37.5,37.5zM444.239,422c-20.678,0 -37.5,-16.822 -37.5,-37.5s16.822,-37.5 37.5,-37.5 37.5,16.822 37.5,37.5 -16.822,37.5 -37.5,37.5zM481.739,199.682 L284.739,238.735v-59.416l197,-39.053z\"/>\n    <path android:fillColor=\"#A3787878\" android:pathData=\"m182.179,159.75h30c0,-31.002 4.415,-66.799 -24.144,-95.356 -8.968,-8.968 -17.455,-16.07 -24.942,-22.336 -19.798,-16.57 -27.832,-24.012 -27.832,-42.058h-30v221.406c-10.734,-7.199 -23.634,-11.406 -37.5,-11.406 -37.22,0 -67.5,30.28 -67.5,67.5s30.28,67.5 67.5,67.5c34.684,0 63.329,-26.299 67.073,-60h0.427v-227.219c9.458,8.262 20.077,16.341 31.562,27.825 19.029,19.031 15.356,44.009 15.356,74.144zM67.761,315c-20.678,0 -37.5,-16.822 -37.5,-37.5s16.822,-37.5 37.5,-37.5 37.5,16.822 37.5,37.5 -16.823,37.5 -37.5,37.5z\"/>\n</vector>\n"
  },
  {
    "path": "common/data-models/src/main/res/drawable/soundbound_app_logo.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"108dp\"\n    android:height=\"108dp\"\n    android:viewportWidth=\"198\"\n    android:viewportHeight=\"429\">\n  <group android:scaleX=\"0.2820513\"\n      android:scaleY=\"0.6111111\"\n      android:translateX=\"71.07692\"\n      android:translateY=\"83.416664\">\n    <path\n        android:pathData=\"m126,200 l-10,2 -4,-29c-18,12 -37,24 -55,38a75,75 0,0 0,-30 62,60 60,0 0,0 28,52 106,106 0,0 0,47 16l24,1 2,9c-23,1 -44,0 -65,-9a124,124 0,0 1,-35 -21,88 88,0 0,1 -26,-51c-6,-32 4,-58 27,-80 11,-10 24,-18 36,-26 23,-15 45,-29 67,-45a100,100 0,0 0,37 -50,71 71,0 0,0 -8,-64l-4,-4 1,-1 8,5a62,62 0,0 1,18 37c3,19 3,38 -2,56 -7,24 -23,42 -43,57a221,221 0,0 1,-12 8zM66,406c4,6 9,8 14,10a42,42 0,0 0,57 -36c1,-12 -1,-24 -2,-36l-8,-60 -6,-43c-6,2 -11,3 -16,6a79,79 0,0 0,-15 12,28 28,0 0,0 -3,37l13,17a29,29 0,0 1,-16 -6c-23,-18 -31,-56 -2,-80a72,72 0,0 1,79 -7c15,8 28,19 33,35 8,25 4,48 -14,67a97,97 0,0 1,-25 19l-1,-10a56,56 0,0 0,24 -33,45 45,0 0,0 -44,-59l13,90 5,42a55,55 0,0 1,-23 48,50 50,0 0,1 -76,-22c-5,-15 2,-28 17,-30 11,-2 21,6 23,16 1,9 -6,19 -17,21l-4,1zM104,125v-17c0,-15 -2,-30 1,-44a85,85 0,0 1,28 -49l12,-7h4a46,46 0,0 1,14 21l-1,1a68,68 0,0 0,-43 53l-3,30c-1,4 -1,6 -5,8z\"\n        android:fillColor=\"#559eff\"/>\n  </group>\n</vector>\n"
  },
  {
    "path": "common/database/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"android-setup\")\n    id(\"multiplatform-setup\")\n    id(\"multiplatform-setup-test\")\n    id(\"com.squareup.sqldelight\")\n}\n\nsqldelight {\n    database(\"Database\") {\n        packageName = \"com.shabinder.database\"\n    }\n}\n\nkotlin {\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(project(\":common:data-models\"))\n\n                // SQL Delight\n                with(deps.sqldelight) {\n                    implementation(runtime)\n                    api(coroutines.extension)\n                }\n            }\n        }\n\n        androidMain {\n            dependencies {\n                implementation(deps.sqldelight.android.driver)\n            }\n        }\n\n        desktopMain {\n            dependencies {\n                with(deps) {\n                    implementation(sqldelight.driver)\n                    implementation(sqlite.jdbc.driver)\n                }\n            }\n        }\n\n        if (HostOS.isMac) {\n            val iosMain by getting {\n                dependencies {\n                    implementation(deps.sqldelight.native.driver)\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/database/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.database\"/>\n"
  },
  {
    "path": "common/database/src/androidMain/kotlin/com/shabinder/common/database/ActualAndroid.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.database\n\nimport co.touchlab.kermit.LogcatLogger\nimport co.touchlab.kermit.Logger\nimport com.shabinder.database.Database\nimport com.squareup.sqldelight.android.AndroidSqliteDriver\nimport org.koin.dsl.module\n\n@Suppress(\"RedundantNullableReturnType\")\nactual fun databaseModule() = module {\n    single {\n        val driver = AndroidSqliteDriver(Database.Schema, get(), \"Database.db\")\n        SpotiFlyerDatabase(Database(driver))\n    }\n}\nactual fun getLogger(): Logger = LogcatLogger()\n"
  },
  {
    "path": "common/database/src/commonMain/kotlin/com/shabinder/common/database/Expect.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.database\n\nimport co.touchlab.kermit.Logger\nimport org.koin.core.module.Module\n\nexpect fun databaseModule(): Module\nexpect fun getLogger(): Logger\n"
  },
  {
    "path": "common/database/src/commonMain/kotlin/com/shabinder/common/database/SpotiFlyerDatabase.kt",
    "content": "package com.shabinder.common.database\n\nimport com.shabinder.database.Database\n\n/* Database Wrapper */\nclass SpotiFlyerDatabase(val instance: Database?)\n"
  },
  {
    "path": "common/database/src/commonMain/sqldelight/com/shabinder/common/database/DownloadRecordDatabase.sq",
    "content": "CREATE TABLE IF NOT EXISTS DownloadRecord (\n    id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n    type TEXT NOT NULL,\n    name TEXT NOT NULL,\n    link TEXT NOT NULL UNIQUE ON CONFLICT REPLACE ,\n    coverUrl TEXT NOT NULL,\n    totalFiles INTEGER NOT NULL DEFAULT 1\n);\n\nselectAll:\nSELECT *\nFROM DownloadRecord;\n\nselect:\nSELECT *\nFROM DownloadRecord\nWHERE link = :link;\n\nadd:\nINSERT OR REPLACE INTO DownloadRecord (type, name, link, coverUrl, totalFiles)\nVALUES (?,?,?,?,?);\n\ndelete:\nDELETE FROM DownloadRecord\nWHERE link = :link;\n\ngetLastInsertId:\nSELECT last_insert_rowid();\n\nclear:\nDELETE FROM DownloadRecord;\n"
  },
  {
    "path": "common/database/src/commonMain/sqldelight/com/shabinder/common/database/TokenDB.sq",
    "content": "CREATE TABLE IF NOT EXISTS Token (\n    tokenIndex INTEGER NOT NULL PRIMARY KEY ON CONFLICT REPLACE,\n    accessToken TEXT NOT NULL,\n    expiry INTEGER NOT NULL\n);\n\nadd:\nINSERT OR REPLACE INTO Token (tokenIndex,accessToken,expiry)\nVALUES (0,?,?);\n\nselect:\nSELECT * FROM Token\nWHERE tokenIndex = 0;\n\nclear:\nDELETE FROM Token;"
  },
  {
    "path": "common/database/src/desktopMain/kotlin/com/shabinder/common/database/ActualDesktop.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.database\n\nimport co.touchlab.kermit.CommonLogger\nimport co.touchlab.kermit.Logger\nimport com.shabinder.database.Database\nimport com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver\nimport org.koin.dsl.module\nimport java.io.File\n\n@Suppress(\"RedundantNullableReturnType\")\nactual fun databaseModule() = module {\n    single {\n        val databasePath = File(System.getProperty(\"user.home\") + File.separator + \"SpotiFlyer\" + File.separator + \"Database\", \"Database.db\")\n        databasePath.parentFile.mkdirs()\n        val driver = JdbcSqliteDriver(url = \"jdbc:sqlite:${databasePath.absolutePath}\")\n            .also { Database.Schema.create(it) }\n        SpotiFlyerDatabase(Database(driver))\n    }\n}\nactual fun getLogger(): Logger = CommonLogger()\n"
  },
  {
    "path": "common/database/src/iosMain/kotlin/com.shabinder.common.database/ActualIos.kt",
    "content": "package com.shabinder.common.database\n\nimport co.touchlab.kermit.Logger\nimport co.touchlab.kermit.NSLogLogger\nimport com.shabinder.database.Database\nimport com.squareup.sqldelight.drivers.native.NativeSqliteDriver\nimport org.koin.dsl.module\n\n@Suppress(\"RedundantNullableReturnType\")\nactual fun databaseModule() = module {\n    single {\n        val driver = NativeSqliteDriver(Database.Schema, \"Database.db\")\n        SpotiFlyerDatabase(Database(driver))\n    }\n}\n\nactual fun getLogger(): Logger = NSLogLogger()\n"
  },
  {
    "path": "common/database/src/jsMain/kotlin/com/shabinder/common/database/ActualJs.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.database\n\nimport co.touchlab.kermit.CommonLogger\nimport co.touchlab.kermit.Logger\nimport org.koin.dsl.module\n\nactual fun databaseModule() = module { single { SpotiFlyerDatabase(null) } }\nactual fun getLogger(): Logger = CommonLogger()\n"
  },
  {
    "path": "common/dependency-injection/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"android-setup\")\n    id(\"multiplatform-setup\")\n    id(\"multiplatform-setup-test\")\n    kotlin(\"plugin.serialization\")\n}\n\nkotlin {\n\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(project(\":common:data-models\"))\n                implementation(project(\":common:database\"))\n                implementation(project(\":common:providers\"))\n                implementation(project(\":common:core-components\"))\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/dependency-injection/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.di\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n</manifest>\n"
  },
  {
    "path": "common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/ApplicationInit.kt",
    "content": "package com.shabinder.common.di\n\nimport com.shabinder.common.models.dispatcherIO\nimport com.shabinder.common.providers.spotify.SpotifyProvider\nimport kotlinx.coroutines.DelicateCoroutinesApi\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.launch\nimport org.koin.dsl.module\n\nclass ApplicationInit(\n    private val spotifyProvider: SpotifyProvider,\n) {\n    companion object {\n        private var isFirstLaunch = true\n    }\n\n    /*\n    * Init Basic Necessary Items in here,\n    *  will be called,\n    *   Android / IOS: Splash Screen\n    *   Desktop: App Startup\n    * */\n    @OptIn(DelicateCoroutinesApi::class)\n    fun init() = GlobalScope.launch(dispatcherIO) {\n        isFirstLaunch = false\n        spotifyProvider.authenticateSpotifyClient()\n    }\n}\n\ninternal fun appInitModule() = module {\n    single {\n        ApplicationInit(get())\n    }\n}"
  },
  {
    "path": "common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/DI.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.di\n\nimport com.shabinder.common.core_components.coreComponentModules\nimport com.shabinder.common.database.databaseModule\nimport com.shabinder.common.providers.providersModule\nimport org.koin.core.KoinApplication\nimport org.koin.core.context.startKoin\nimport org.koin.core.module.Module\nimport org.koin.dsl.KoinAppDeclaration\n\nfun initKoin(enableNetworkLogs: Boolean = false, appDeclaration: KoinAppDeclaration = {}) =\n    startKoin {\n        appDeclaration()\n\n        modules(\n            coreComponentModules(enableNetworkLogs),\n            listOf(\n                providersModule(enableNetworkLogs),\n                databaseModule(),\n                appInitModule(),\n            )\n        )\n    }\n\n// Called by IOS\nfun initKoin() = initKoin(enableNetworkLogs = false) { }\n\nprivate fun KoinApplication.modules(vararg moduleLists: List<Module>): KoinApplication {\n    return modules(moduleLists.toList().flatten())\n}"
  },
  {
    "path": "common/list/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"android-setup\")\n    id(\"multiplatform-setup\")\n    id(\"multiplatform-setup-test\")\n    id(\"kotlin-parcelize\")\n}\n\nkotlin {\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(project(\":common:dependency-injection\"))\n                implementation(project(\":common:data-models\"))\n                implementation(project(\":common:database\"))\n                implementation(project(\":common:providers\"))\n                implementation(project(\":common:core-components\"))\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/list/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.list\"/>\n"
  },
  {
    "path": "common/list/src/commonMain/kotlin/com/shabinder/common/list/SpotiFlyerList.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.list\n\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.decompose.value.Value\nimport com.arkivanov.mvikotlin.core.store.StoreFactory\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.list.integration.SpotiFlyerListImpl\nimport com.shabinder.common.models.Consumer\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.PlatformQueryResult\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.providers.FetchPlatformQueryResult\nimport kotlinx.coroutines.flow.MutableSharedFlow\n\ninterface SpotiFlyerList {\n\n    val model: Value<State>\n\n    /*\n    * Download All Tracks(after filtering already Downloaded)\n    * */\n    fun onDownloadAllClicked(trackList: List<TrackDetails>)\n\n    /*\n    * Download All Tracks(after filtering already Downloaded)\n    * */\n    fun onDownloadClicked(track: TrackDetails)\n\n    /*\n    * To Pop and return back to Main Screen\n    * */\n    fun onBackPressed()\n\n    /*\n    * Load Image from cache/Internet and cache it\n    * */\n    suspend fun loadImage(url: String, isCover: Boolean = false): Picture\n\n    /*\n    * Sync Tracks Statuses\n    * */\n    fun onRefreshTracksStatuses()\n\n    /*\n    * Snooze Donation Dialog\n    * */\n    fun dismissDonationDialogSetOffset()\n\n    interface Dependencies {\n        val storeFactory: StoreFactory\n        val fetchQuery: FetchPlatformQueryResult\n        val fileManager: FileManager\n        val preferenceManager: PreferenceManager\n        val link: String\n        val listOutput: Consumer<Output>\n        val downloadProgressFlow: MutableSharedFlow<HashMap<String, DownloadStatus>>\n        val listAnalytics: Analytics\n    }\n\n    interface Analytics\n\n    sealed class Output {\n        object Finished : Output()\n    }\n\n    data class State(\n        val queryResult: PlatformQueryResult? = null,\n        val link: String = \"\",\n        val trackList: List<TrackDetails> = emptyList(),\n        val errorOccurred: Throwable? = null,\n        val askForDonation: Boolean = false,\n    )\n}\n\n@Suppress(\"FunctionName\") // Factory function\nfun SpotiFlyerList(componentContext: ComponentContext, dependencies: SpotiFlyerList.Dependencies): SpotiFlyerList =\n    SpotiFlyerListImpl(componentContext, dependencies)\n"
  },
  {
    "path": "common/list/src/commonMain/kotlin/com/shabinder/common/list/integration/SpotiFlyerListImpl.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.list.integration\n\nimport co.touchlab.stately.ensureNeverFrozen\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.decompose.value.Value\nimport com.arkivanov.essenty.lifecycle.doOnResume\nimport com.shabinder.common.caching.Cache\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.utils.asValue\nimport com.shabinder.common.list.SpotiFlyerList\nimport com.shabinder.common.list.SpotiFlyerList.Dependencies\nimport com.shabinder.common.list.SpotiFlyerList.State\nimport com.shabinder.common.list.store.SpotiFlyerListStore.Intent\nimport com.shabinder.common.list.store.SpotiFlyerListStoreProvider\nimport com.shabinder.common.list.store.getStore\nimport com.shabinder.common.models.TrackDetails\n\ninternal class SpotiFlyerListImpl(\n    componentContext: ComponentContext,\n    dependencies: Dependencies\n) : SpotiFlyerList, ComponentContext by componentContext, Dependencies by dependencies {\n\n    init {\n        instanceKeeper.ensureNeverFrozen()\n        lifecycle.doOnResume {\n            onRefreshTracksStatuses()\n        }\n    }\n\n    private val store =\n        instanceKeeper.getStore {\n            SpotiFlyerListStoreProvider(dependencies).provide()\n        }\n\n    private val cache = Cache.Builder\n        .newBuilder()\n        .maximumCacheSize(30)\n        .build<String, Picture>()\n\n    override val model: Value<State> = store.asValue()\n\n    override fun onDownloadAllClicked(trackList: List<TrackDetails>) {\n        store.accept(Intent.StartDownloadAll(trackList))\n    }\n\n    override fun onDownloadClicked(track: TrackDetails) {\n        store.accept(Intent.StartDownload(track))\n    }\n\n    override fun onBackPressed() {\n        listOutput.callback(SpotiFlyerList.Output.Finished)\n    }\n\n    override fun onRefreshTracksStatuses() {\n        store.accept(Intent.RefreshTracksStatuses)\n    }\n\n    override fun dismissDonationDialogSetOffset() {\n        preferenceManager.setDonationOffset(offset = 10)\n    }\n\n    override suspend fun loadImage(url: String, isCover: Boolean): Picture {\n        return cache.get(url) {\n            if (isCover) fileManager.loadImage(url, 350, 350)\n            else fileManager.loadImage(url, 150, 150)\n        }\n    }\n}\n"
  },
  {
    "path": "common/list/src/commonMain/kotlin/com/shabinder/common/list/store/InstanceKeeperExt.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.list.store\n\nimport com.arkivanov.essenty.instancekeeper.InstanceKeeper\nimport com.arkivanov.essenty.instancekeeper.getOrCreate\nimport com.arkivanov.mvikotlin.core.store.Store\n\nfun <T : Store<*, *, *>> InstanceKeeper.getStore(key: Any, factory: () -> T): T =\n    getOrCreate(key) { StoreHolder(factory()) }\n        .store\n\ninline fun <reified T :\n\n        Store<*, *, *>> InstanceKeeper.getStore(noinline factory: () -> T): T =\n    getStore(T::class, factory)\n\nprivate class StoreHolder<T : Store<*, *, *>>(\n    val store: T\n) : InstanceKeeper.Instance {\n    override fun onDestroy() {\n        store.dispose()\n    }\n}\n"
  },
  {
    "path": "common/list/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStore.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.list.store\n\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.shabinder.common.list.SpotiFlyerList.State\nimport com.shabinder.common.list.store.SpotiFlyerListStore.Intent\nimport com.shabinder.common.models.TrackDetails\n\ninternal interface SpotiFlyerListStore : Store<Intent, State, Nothing> {\n    sealed class Intent {\n        data class SearchLink(val link: String) : Intent()\n        data class StartDownload(val track: TrackDetails) : Intent()\n        data class StartDownloadAll(val trackList: List<TrackDetails>) : Intent()\n        object RefreshTracksStatuses : Intent()\n    }\n}\n"
  },
  {
    "path": "common/list/src/commonMain/kotlin/com/shabinder/common/list/store/SpotiFlyerListStoreProvider.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.list.store\n\nimport com.arkivanov.mvikotlin.core.store.Reducer\nimport com.arkivanov.mvikotlin.core.store.SimpleBootstrapper\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor\nimport com.shabinder.common.list.SpotiFlyerList\nimport com.shabinder.common.list.SpotiFlyerList.State\nimport com.shabinder.common.list.store.SpotiFlyerListStore.Intent\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.PlatformQueryResult\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.providers.downloadTracks\nimport com.shabinder.common.utils.runOnDefault\nimport com.shabinder.common.utils.runOnMain\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.flow.collect\nimport kotlinx.coroutines.withContext\n\ninternal class SpotiFlyerListStoreProvider(dependencies: SpotiFlyerList.Dependencies) :\n    SpotiFlyerList.Dependencies by dependencies {\n    fun provide(): SpotiFlyerListStore =\n        object :\n            SpotiFlyerListStore,\n            Store<Intent, State, Nothing> by storeFactory.create(\n                name = \"SpotiFlyerListStore\",\n                initialState = State(),\n                bootstrapper = SimpleBootstrapper(Unit),\n                executorFactory = ::ExecutorImpl,\n                reducer = ReducerImpl\n            ) {}\n\n    private sealed class Result {\n        data class ResultFetched(\n            val result: PlatformQueryResult,\n            val trackList: List<TrackDetails>\n        ) : Result()\n\n        data class UpdateTrackList(val list: List<TrackDetails>) : Result()\n        data class UpdateTrackItem(val item: TrackDetails) : Result()\n        data class ErrorOccurred(val error: Throwable) : Result()\n        data class AskForSupport(val isAllowed: Boolean) : Result()\n    }\n\n    private inner class ExecutorImpl : SuspendExecutor<Intent, Unit, State, Result, Nothing>() {\n\n        override suspend fun executeAction(action: Unit, getState: () -> State) {\n            executeIntent(Intent.SearchLink(link), getState)\n            runOnDefault {\n                fileManager.db?.downloadRecordDatabaseQueries?.getLastInsertId()\n                    ?.executeAsOneOrNull()?.also {\n                        // See if It's Time we can request for support for maintaining this project or not\n                        fetchQuery.logger.d(\n                            message = { \"Database List Last ID: $it\" },\n                            tag = \"Database Last ID\"\n                        )\n                        val offset = preferenceManager.getDonationOffset\n                        dispatchOnMain(\n                            Result.AskForSupport(\n                                // Every 3rd Interval or After some offset\n                                isAllowed = offset < 4 && (it % offset == 0L)\n                            )\n                        )\n                    }\n\n                downloadProgressFlow.collect { map ->\n                    // logger.d(map.size.toString(), \"ListStore: flow Updated\")\n                    getState().trackList.updateTracksStatuses(map).also {\n                        if (it.isNotEmpty())\n                            dispatchOnMain(Result.UpdateTrackList(it))\n                    }\n                }\n            }\n        }\n\n        override suspend fun executeIntent(intent: Intent, getState: () -> State) {\n            withContext(Dispatchers.Default) {\n                when (intent) {\n                    is Intent.SearchLink -> {\n                        val resp = fetchQuery.query(link)\n                        resp.fold(\n                            success = { result ->\n                                result.trackList =\n                                    result.trackList.toMutableList()\n                                        .updateTracksStatuses(\n                                            downloadProgressFlow.replayCache.getOrElse(0) { hashMapOf() }\n                                        )\n\n                                dispatchOnMain(\n                                    (Result.ResultFetched(\n                                        result,\n                                        result.trackList\n                                    ))\n                                )\n                                executeIntent(Intent.RefreshTracksStatuses, getState)\n                            },\n                            failure = {\n                                dispatchOnMain(Result.ErrorOccurred(it))\n                            }\n                        )\n                    }\n\n                    is Intent.StartDownloadAll -> {\n                        val list = intent.trackList.map {\n                            if (it.downloaded is DownloadStatus.NotDownloaded || it.downloaded is DownloadStatus.Failed)\n                                return@map it.copy(downloaded = DownloadStatus.Queued)\n                            it\n                        }\n                        dispatchOnMain(\n                            Result.UpdateTrackList(\n                                list.updateTracksStatuses(\n                                    downloadProgressFlow.replayCache.getOrElse(\n                                        0\n                                    ) { hashMapOf() })\n                            )\n                        )\n\n                        val finalList =\n                            intent.trackList.filter { it.downloaded == DownloadStatus.NotDownloaded }\n                        if (finalList.isEmpty()) Actions.instance.showPopUpMessage(\"All Songs are Processed\")\n                        else downloadTracks(finalList, fetchQuery, fileManager)\n                    }\n\n                    is Intent.StartDownload -> {\n                        dispatchOnMain(Result.UpdateTrackItem(intent.track.copy(downloaded = DownloadStatus.Queued)))\n                        downloadTracks(listOf(intent.track), fetchQuery, fileManager)\n                    }\n\n                    is Intent.RefreshTracksStatuses -> Actions.instance.queryActiveTracks()\n                }\n            }\n        }\n\n        private suspend fun dispatchOnMain(result: Result) = runOnMain { dispatch(result) }\n    }\n\n    private object ReducerImpl : Reducer<State, Result> {\n        override fun State.reduce(result: Result): State =\n            when (result) {\n                is Result.ResultFetched -> copy(\n                    queryResult = result.result,\n                    trackList = result.trackList,\n                    link = link\n                )\n                is Result.UpdateTrackList -> copy(trackList = result.list)\n                is Result.UpdateTrackItem -> updateTrackItem(result.item)\n                is Result.ErrorOccurred -> copy(errorOccurred = result.error)\n                is Result.AskForSupport -> copy(askForDonation = result.isAllowed)\n            }\n\n        private fun State.updateTrackItem(item: TrackDetails): State {\n            val position = this.trackList.map { it.title }.indexOf(item.title)\n            if (position != -1) {\n                return copy(trackList = trackList.toMutableList().apply { set(position, item) })\n            }\n            return this\n        }\n    }\n\n    private fun List<TrackDetails>.updateTracksStatuses(map: Map<String, DownloadStatus>): List<TrackDetails> {\n        // create a copy in order not to access real referenced ever-changing collections\n        val trackList = ArrayList(this)\n        val updatedMap = HashMap(map)\n\n        repeat(trackList.size) { index ->\n            trackList[index].also { oldTrack ->\n                updatedMap[oldTrack.title]?.also { newStatus ->\n                    trackList[index] = oldTrack.copy(downloaded = newStatus)\n                }\n            }\n        }\n\n        return trackList\n    }\n}\n"
  },
  {
    "path": "common/main/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"android-setup\")\n    id(\"multiplatform-setup\")\n    id(\"multiplatform-setup-test\")\n    id(\"kotlin-parcelize\")\n}\n\nkotlin {\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(project(\":common:dependency-injection\"))\n                implementation(project(\":common:data-models\"))\n                implementation(project(\":common:database\"))\n                implementation(project(\":common:providers\"))\n                implementation(project(\":common:core-components\"))\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/main/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.main\"/>\n"
  },
  {
    "path": "common/main/src/commonMain/kotlin/com/shabinder/common/main/SpotiFlyerMain.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.main\n\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.decompose.value.Value\nimport com.arkivanov.mvikotlin.core.store.StoreFactory\nimport com.shabinder.common.core_components.analytics.AnalyticsManager\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.main.integration.SpotiFlyerMainImpl\nimport com.shabinder.common.models.Consumer\nimport com.shabinder.common.models.DownloadRecord\nimport com.shabinder.database.Database\n\ninterface SpotiFlyerMain {\n\n    val model: Value<State>\n\n    val analytics: Analytics\n\n    /*\n    * We Intend to Move to List Screen\n    * Note: Implementation in Root\n    * */\n    fun onLinkSearch(link: String)\n\n    /*\n    * Update TextBox's Text\n    * */\n    fun onInputLinkChanged(link: String)\n\n    /*\n    * change TabBar Selected Category\n    * */\n    fun selectCategory(category: HomeCategory)\n\n    /*\n    * change TabBar Selected Category\n    * */\n    fun toggleAnalytics(enabled: Boolean)\n\n    /*\n    * Load Image from cache/Internet and cache it\n    * */\n    suspend fun loadImage(url: String): Picture\n\n    fun dismissDonationDialogOffset()\n\n    interface Dependencies {\n        val mainOutput: Consumer<Output>\n        val storeFactory: StoreFactory\n        val database: Database?\n        val fileManager: FileManager\n        val preferenceManager: PreferenceManager\n        val analyticsManager: AnalyticsManager\n        val mainAnalytics: Analytics\n    }\n\n    interface Analytics {\n        fun donationDialogVisit()\n    }\n\n    sealed class Output {\n        data class Search(val link: String) : Output()\n    }\n\n    data class State(\n        val records: List<DownloadRecord> = emptyList(),\n        val link: String = \"\",\n        val selectedCategory: HomeCategory = HomeCategory.About,\n        val isAnalyticsEnabled: Boolean = false\n    )\n\n    enum class HomeCategory {\n        About, History\n    }\n}\n\n@Suppress(\"FunctionName\") // Factory function\nfun SpotiFlyerMain(componentContext: ComponentContext, dependencies: SpotiFlyerMain.Dependencies): SpotiFlyerMain =\n    SpotiFlyerMainImpl(componentContext, dependencies)\n"
  },
  {
    "path": "common/main/src/commonMain/kotlin/com/shabinder/common/main/integration/SpotiFlyerMainImpl.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.main.integration\n\nimport co.touchlab.stately.ensureNeverFrozen\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.decompose.value.Value\nimport com.arkivanov.essenty.lifecycle.doOnResume\nimport com.shabinder.common.caching.Cache\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.utils.asValue\nimport com.shabinder.common.main.SpotiFlyerMain\nimport com.shabinder.common.main.SpotiFlyerMain.*\nimport com.shabinder.common.main.store.SpotiFlyerMainStore.Intent\nimport com.shabinder.common.main.store.SpotiFlyerMainStoreProvider\nimport com.shabinder.common.main.store.getStore\nimport com.shabinder.common.models.Actions\n\ninternal class SpotiFlyerMainImpl(\n    componentContext: ComponentContext,\n    dependencies: Dependencies\n) : SpotiFlyerMain, ComponentContext by componentContext, Dependencies by dependencies {\n\n    init {\n        instanceKeeper.ensureNeverFrozen()\n        lifecycle.doOnResume {\n            store.accept(Intent.ToggleAnalytics(preferenceManager.isAnalyticsEnabled))\n        }\n    }\n\n    private val store =\n        instanceKeeper.getStore {\n            SpotiFlyerMainStoreProvider(dependencies).provide()\n        }\n\n    private val cache = Cache.Builder\n        .newBuilder()\n        .maximumCacheSize(20)\n        .build<String, Picture>()\n\n    override val model: Value<State> = store.asValue()\n\n    override val analytics = mainAnalytics\n\n    override fun onLinkSearch(link: String) {\n        if (Actions.instance.isInternetAvailable) mainOutput.callback(Output.Search(link = link))\n        else Actions.instance.showPopUpMessage(\"Check Network Connection Please\")\n    }\n\n    override fun onInputLinkChanged(link: String) {\n        store.accept(Intent.SetLink(link))\n    }\n\n    override fun selectCategory(category: HomeCategory) {\n        store.accept(Intent.SelectCategory(category))\n    }\n\n    override fun toggleAnalytics(enabled: Boolean) {\n        store.accept(Intent.ToggleAnalytics(enabled))\n    }\n\n    override suspend fun loadImage(url: String): Picture {\n        return cache.get(url) {\n            fileManager.loadImage(url, 150, 150)\n        }\n    }\n\n    override fun dismissDonationDialogOffset() {\n        preferenceManager.setDonationOffset()\n    }\n}\n"
  },
  {
    "path": "common/main/src/commonMain/kotlin/com/shabinder/common/main/store/InstanceKeeperExt.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.main.store\n\nimport com.arkivanov.essenty.instancekeeper.InstanceKeeper\nimport com.arkivanov.essenty.instancekeeper.getOrCreate\nimport com.arkivanov.mvikotlin.core.store.Store\n\nfun <T : Store<*, *, *>> InstanceKeeper.getStore(key: Any, factory: () -> T): T =\n    getOrCreate(key) { StoreHolder(factory()) }\n        .store\n\ninline fun <reified T :\n        Store<*, *, *>> InstanceKeeper.getStore(noinline factory: () -> T): T =\n    getStore(T::class, factory)\n\nprivate class StoreHolder<T : Store<*, *, *>>(\n    val store: T\n) : InstanceKeeper.Instance {\n    override fun onDestroy() {\n        store.dispose()\n    }\n}\n"
  },
  {
    "path": "common/main/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStore.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.main.store\n\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.shabinder.common.main.SpotiFlyerMain\nimport com.shabinder.common.main.store.SpotiFlyerMainStore.Intent\n\ninternal interface SpotiFlyerMainStore : Store<Intent, SpotiFlyerMain.State, Nothing> {\n    sealed class Intent {\n        data class OpenPlatform(val platformID: String, val platformLink: String) : Intent()\n        data class SetLink(val link: String) : Intent()\n        data class SelectCategory(val category: SpotiFlyerMain.HomeCategory) : Intent()\n        data class ToggleAnalytics(val enabled: Boolean) : Intent()\n        object GiveDonation : Intent()\n        object ShareApp : Intent()\n    }\n}\n"
  },
  {
    "path": "common/main/src/commonMain/kotlin/com/shabinder/common/main/store/SpotiFlyerMainStoreProvider.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.main.store\n\nimport com.arkivanov.mvikotlin.core.store.Reducer\nimport com.arkivanov.mvikotlin.core.store.SimpleBootstrapper\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor\nimport com.shabinder.common.main.SpotiFlyerMain\nimport com.shabinder.common.main.SpotiFlyerMain.State\nimport com.shabinder.common.main.store.SpotiFlyerMainStore.Intent\nimport com.shabinder.common.models.DownloadRecord\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.utils.runOnMain\nimport com.squareup.sqldelight.runtime.coroutines.asFlow\nimport com.squareup.sqldelight.runtime.coroutines.mapToList\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.flow.Flow\nimport kotlinx.coroutines.flow.collect\nimport kotlinx.coroutines.flow.map\n\ninternal class SpotiFlyerMainStoreProvider(dependencies: SpotiFlyerMain.Dependencies): SpotiFlyerMain.Dependencies by dependencies {\n\n    fun provide(): SpotiFlyerMainStore =\n        object :\n            SpotiFlyerMainStore,\n            Store<Intent, State, Nothing> by storeFactory.create(\n                name = \"SpotiFlyerHomeStore\",\n                initialState = State(),\n                bootstrapper = SimpleBootstrapper(Unit),\n                executorFactory = ::ExecutorImpl,\n                reducer = ReducerImpl\n            ) {}\n\n    val updates: Flow<List<DownloadRecord>>? =\n        database?.downloadRecordDatabaseQueries\n            ?.selectAll()\n            ?.asFlow()\n            ?.mapToList(Dispatchers.Default)\n            ?.map {\n                it.map { record ->\n                    record.run {\n                        DownloadRecord(id, type, name, link, coverUrl, totalFiles)\n                    }\n                }\n            }\n\n    private sealed class Result {\n        data class ItemsLoaded(val items: List<DownloadRecord>) : Result()\n        data class CategoryChanged(val category: SpotiFlyerMain.HomeCategory) : Result()\n        data class LinkChanged(val link: String) : Result()\n        data class AnalyticsToggled(val isEnabled: Boolean) : Result()\n    }\n\n    private inner class ExecutorImpl : SuspendExecutor<Intent, Unit, State, Result, Nothing>() {\n        override suspend fun executeAction(action: Unit, getState: () -> State) {\n            dispatch(Result.AnalyticsToggled(preferenceManager.isAnalyticsEnabled))\n            updates?.collect {\n                dispatch(Result.ItemsLoaded(it))\n            }\n        }\n\n        override suspend fun executeIntent(intent: Intent, getState: () -> State) {\n            when (intent) {\n                is Intent.OpenPlatform -> Actions.instance.openPlatform(intent.platformID, intent.platformLink)\n                is Intent.GiveDonation -> Actions.instance.giveDonation()\n                is Intent.ShareApp -> Actions.instance.shareApp()\n                is Intent.SetLink -> dispatch(Result.LinkChanged(link = intent.link))\n                is Intent.SelectCategory -> dispatch(Result.CategoryChanged(intent.category))\n                is Intent.ToggleAnalytics -> {\n                    dispatch(Result.AnalyticsToggled(intent.enabled))\n                    preferenceManager.toggleAnalytics(intent.enabled)\n                }\n            }\n        }\n    }\n\n    private object ReducerImpl : Reducer<State, Result> {\n        override fun State.reduce(result: Result): State =\n            when (result) {\n                is Result.ItemsLoaded -> copy(records = result.items)\n                is Result.LinkChanged -> copy(link = result.link)\n                is Result.CategoryChanged -> copy(selectedCategory = result.category)\n                is Result.AnalyticsToggled -> copy(isAnalyticsEnabled = result.isEnabled)\n            }\n    }\n}\n"
  },
  {
    "path": "common/preference/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"android-setup\")\n    id(\"multiplatform-setup\")\n    id(\"multiplatform-setup-test\")\n    id(\"kotlin-parcelize\")\n}\n\nkotlin {\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(project(\":common:dependency-injection\"))\n                implementation(project(\":common:data-models\"))\n                implementation(project(\":common:database\"))\n                implementation(project(\":common:core-components\"))\n                implementation(project(\":common:providers\"))\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "common/preference/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.preference\"/>\n"
  },
  {
    "path": "common/preference/src/commonMain/kotlin/com/shabinder/common/preference/SpotiFlyerPreference.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.preference\n\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.decompose.value.Value\nimport com.arkivanov.mvikotlin.core.store.StoreFactory\nimport com.shabinder.common.core_components.analytics.AnalyticsManager\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.Consumer\nimport com.shabinder.common.models.spotify.SpotifyCredentials\nimport com.shabinder.common.preference.integration.SpotiFlyerPreferenceImpl\n\ninterface SpotiFlyerPreference {\n\n    val model: Value<State>\n\n    val analytics: Analytics\n\n    fun toggleAnalytics(enabled: Boolean)\n\n    fun selectNewDownloadDirectory()\n\n    fun setPreferredQuality(quality: AudioQuality)\n\n    fun updateSpotifyCredentials(credentials: SpotifyCredentials)\n\n    suspend fun loadImage(url: String): Picture\n\n    interface Dependencies {\n        val prefOutput: Consumer<Output>\n        val storeFactory: StoreFactory\n        val fileManager: FileManager\n        val preferenceManager: PreferenceManager\n        val analyticsManager: AnalyticsManager\n        val actions: Actions\n        val preferenceAnalytics: Analytics\n    }\n\n    interface Analytics\n\n    sealed class Output {\n        object Finished : Output()\n    }\n\n    data class State(\n        val preferredQuality: AudioQuality = AudioQuality.KBPS320,\n        val downloadPath: String = \"\",\n        val isAnalyticsEnabled: Boolean = false,\n        val spotifyCredentials: SpotifyCredentials = SpotifyCredentials()\n    )\n}\n\n@Suppress(\"FunctionName\") // Factory function\nfun SpotiFlyerPreference(\n    componentContext: ComponentContext,\n    dependencies: SpotiFlyerPreference.Dependencies\n): SpotiFlyerPreference =\n    SpotiFlyerPreferenceImpl(componentContext, dependencies)\n"
  },
  {
    "path": "common/preference/src/commonMain/kotlin/com/shabinder/common/preference/integration/SpotiFlyerPreferenceImpl.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.preference.integration\n\nimport co.touchlab.stately.ensureNeverFrozen\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.decompose.value.Value\nimport com.shabinder.common.caching.Cache\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.core_components.utils.asValue\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.spotify.SpotifyCredentials\nimport com.shabinder.common.preference.SpotiFlyerPreference\nimport com.shabinder.common.preference.SpotiFlyerPreference.Dependencies\nimport com.shabinder.common.preference.SpotiFlyerPreference.State\nimport com.shabinder.common.preference.store.SpotiFlyerPreferenceStore.Intent\nimport com.shabinder.common.preference.store.SpotiFlyerPreferenceStoreProvider\nimport com.shabinder.common.preference.store.getStore\n\ninternal class SpotiFlyerPreferenceImpl(\n    componentContext: ComponentContext,\n    dependencies: Dependencies\n) : SpotiFlyerPreference, ComponentContext by componentContext, Dependencies by dependencies {\n\n    init {\n        instanceKeeper.ensureNeverFrozen()\n    }\n\n    private val store =\n        instanceKeeper.getStore {\n            SpotiFlyerPreferenceStoreProvider(dependencies).provide()\n        }\n\n    private val cache = Cache.Builder\n        .newBuilder()\n        .maximumCacheSize(10)\n        .build<String, Picture>()\n\n    override val model: Value<State> = store.asValue()\n\n    override val analytics = preferenceAnalytics\n\n    override fun toggleAnalytics(enabled: Boolean) {\n        store.accept(Intent.ToggleAnalytics(enabled))\n    }\n\n    override fun selectNewDownloadDirectory() {\n        actions.setDownloadDirectoryAction {\n            store.accept(Intent.SetDownloadDirectory(it))\n        }\n    }\n\n    override fun setPreferredQuality(quality: AudioQuality) {\n        store.accept(Intent.SetPreferredAudioQuality(quality))\n    }\n\n    override fun updateSpotifyCredentials(credentials: SpotifyCredentials) {\n        store.accept(Intent.UpdateSpotifyCredentials(credentials))\n    }\n\n    override suspend fun loadImage(url: String): Picture {\n        return cache.get(url) {\n            fileManager.loadImage(url, 150, 150)\n        }\n    }\n}\n"
  },
  {
    "path": "common/preference/src/commonMain/kotlin/com/shabinder/common/preference/store/InstanceKeeperExt.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.preference.store\n\nimport com.arkivanov.essenty.instancekeeper.InstanceKeeper\nimport com.arkivanov.essenty.instancekeeper.getOrCreate\nimport com.arkivanov.mvikotlin.core.store.Store\n\nfun <T : Store<*, *, *>> InstanceKeeper.getStore(key: Any, factory: () -> T): T =\n    getOrCreate(key) { StoreHolder(factory()) }\n        .store\n\ninline fun <reified T : Store<*, *, *>> InstanceKeeper.getStore(noinline factory: () -> T): T =\n    getStore(T::class, factory)\n\nprivate class StoreHolder<T : Store<*, *, *>>(\n    val store: T\n) : InstanceKeeper.Instance {\n    override fun onDestroy() {\n        store.dispose()\n    }\n}\n"
  },
  {
    "path": "common/preference/src/commonMain/kotlin/com/shabinder/common/preference/store/SpotiFlyerPreferenceStore.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.preference.store\n\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.spotify.SpotifyCredentials\nimport com.shabinder.common.preference.SpotiFlyerPreference\n\ninternal interface SpotiFlyerPreferenceStore : Store<SpotiFlyerPreferenceStore.Intent, SpotiFlyerPreference.State, Nothing> {\n    sealed class Intent {\n        data class OpenPlatform(val platformID: String, val platformLink: String) : Intent()\n        data class ToggleAnalytics(val enabled: Boolean) : Intent()\n        data class SetDownloadDirectory(val path: String) : Intent()\n        data class SetPreferredAudioQuality(val quality: AudioQuality) : Intent()\n        data class UpdateSpotifyCredentials(val credentials: SpotifyCredentials) : Intent()\n        object GiveDonation : Intent()\n        object ShareApp : Intent()\n    }\n}\n"
  },
  {
    "path": "common/preference/src/commonMain/kotlin/com/shabinder/common/preference/store/SpotiFlyerPreferenceStoreProvider.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.preference.store\n\nimport com.arkivanov.mvikotlin.core.store.Reducer\nimport com.arkivanov.mvikotlin.core.store.SimpleBootstrapper\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.spotify.SpotifyCredentials\nimport com.shabinder.common.preference.SpotiFlyerPreference\nimport com.shabinder.common.preference.SpotiFlyerPreference.State\nimport com.shabinder.common.preference.store.SpotiFlyerPreferenceStore.Intent\n\ninternal class SpotiFlyerPreferenceStoreProvider(\n    dependencies: SpotiFlyerPreference.Dependencies\n) : SpotiFlyerPreference.Dependencies by dependencies {\n\n    fun provide(): SpotiFlyerPreferenceStore =\n        object :\n            SpotiFlyerPreferenceStore,\n            Store<Intent, State, Nothing> by storeFactory.create(\n                name = \"SpotiFlyerPreferenceStore\",\n                initialState = State(),\n                bootstrapper = SimpleBootstrapper(Unit),\n                executorFactory = ::ExecutorImpl,\n                reducer = ReducerImpl\n            ) {}\n\n    private sealed class Result {\n        data class AnalyticsToggled(val isEnabled: Boolean) : Result()\n        data class DownloadPathSet(val path: String) : Result()\n        data class PreferredAudioQualityChanged(val quality: AudioQuality) : Result()\n        data class SpotifyCredentialsUpdated(val spotifyCredentials: SpotifyCredentials) : Result()\n    }\n\n    private inner class ExecutorImpl : SuspendExecutor<Intent, Unit, State, Result, Nothing>() {\n        override suspend fun executeAction(action: Unit, getState: () -> State) {\n            dispatch(Result.AnalyticsToggled(preferenceManager.isAnalyticsEnabled))\n            dispatch(Result.PreferredAudioQualityChanged(preferenceManager.audioQuality))\n            dispatch(Result.SpotifyCredentialsUpdated(preferenceManager.spotifyCredentials))\n            dispatch(Result.DownloadPathSet(fileManager.defaultDir()))\n        }\n\n        override suspend fun executeIntent(intent: Intent, getState: () -> State) {\n            when (intent) {\n                is Intent.OpenPlatform -> Actions.instance.openPlatform(intent.platformID, intent.platformLink)\n                is Intent.GiveDonation -> Actions.instance.giveDonation()\n                is Intent.ShareApp -> Actions.instance.shareApp()\n                is Intent.ToggleAnalytics -> {\n                    dispatch(Result.AnalyticsToggled(intent.enabled))\n                    preferenceManager.toggleAnalytics(intent.enabled)\n                }\n                is Intent.SetDownloadDirectory -> {\n                    dispatch(Result.DownloadPathSet(intent.path))\n                    preferenceManager.setDownloadDirectory(intent.path)\n                }\n                is Intent.SetPreferredAudioQuality -> {\n                    dispatch(Result.PreferredAudioQualityChanged(intent.quality))\n                    preferenceManager.setPreferredAudioQuality(intent.quality)\n                }\n\n                is Intent.UpdateSpotifyCredentials -> {\n                    dispatch(Result.SpotifyCredentialsUpdated(intent.credentials))\n                    preferenceManager.setSpotifyCredentials(intent.credentials)\n                }\n            }\n        }\n    }\n\n    private object ReducerImpl : Reducer<State, Result> {\n        override fun State.reduce(result: Result): State =\n            when (result) {\n                is Result.AnalyticsToggled -> copy(isAnalyticsEnabled = result.isEnabled)\n                is Result.DownloadPathSet -> copy(downloadPath = result.path)\n                is Result.PreferredAudioQualityChanged -> copy(preferredQuality = result.quality)\n                is Result.SpotifyCredentialsUpdated -> copy(spotifyCredentials = result.spotifyCredentials)\n            }\n    }\n}\n"
  },
  {
    "path": "common/providers/build.gradle.kts",
    "content": "plugins {\n    id(\"multiplatform-setup\")\n    id(\"multiplatform-setup-test\")\n    kotlin(\"plugin.serialization\")\n}\n\nkotlin {\n    /* Targets configuration omitted. \n    *  To find out how to configure the targets, please follow the link:\n    *  https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets */\n\n    sourceSets {\n        commonMain {\n            dependencies {\n                with(deps) {\n                    implementation(project(\":common:data-models\"))\n                    implementation(project(\":common:database\"))\n                    implementation(project(\":common:core-components\"))\n                    implementation(youtube.downloader)\n                    implementation(fuzzy.wuzzy)\n                    implementation(kotlinx.datetime)\n                }\n            }\n        }\n        androidMain {\n            dependencies {\n                implementation(deps.mp3agic)\n            }\n        }\n        desktopMain {\n            dependencies {\n                implementation(deps.mp3agic)\n                implementation(deps.jaffree)\n            }\n        }\n        jsMain {\n            dependencies {\n                implementation(npm(\"browser-id3-writer\", \"4.4.0\"))\n                implementation(npm(\"file-saver\", \"2.0.4\"))\n            }\n        }\n    }\n}"
  },
  {
    "path": "common/providers/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.providers\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n</manifest>\n"
  },
  {
    "path": "common/providers/src/androidMain/kotlin/com/shabinder/common/providers/AndroidActual.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers\n\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.Actions\n\n\nactual suspend fun downloadTracks(\n    list: List<TrackDetails>,\n    fetcher: FetchPlatformQueryResult,\n    fileManager: FileManager\n) {\n    if (list.isNotEmpty()) {\n        Actions.instance.platformActions.sendTracksToService(ArrayList(list))\n    }\n}\n"
  },
  {
    "path": "common/providers/src/androidMain/kotlin/com/shabinder/common/providers/saavn/requests/decryptURL.kt",
    "content": "package com.shabinder.common.providers.saavn.requests\n\nimport android.annotation.SuppressLint\nimport io.ktor.util.*\nimport java.security.SecureRandom\nimport javax.crypto.Cipher\nimport javax.crypto.SecretKey\nimport javax.crypto.SecretKeyFactory\nimport javax.crypto.spec.DESKeySpec\n\n@SuppressLint(\"GetInstance\")\n@OptIn(InternalAPI::class)\nactual suspend fun decryptURL(url: String): String {\n    val dks = DESKeySpec(\"38346591\".toByteArray())\n    val keyFactory = SecretKeyFactory.getInstance(\"DES\")\n    val key: SecretKey = keyFactory.generateSecret(dks)\n\n    val cipher: Cipher = Cipher.getInstance(\"DES/ECB/PKCS5Padding\").apply {\n        init(Cipher.DECRYPT_MODE, key, SecureRandom())\n    }\n\n    return cipher.doFinal(url.decodeBase64Bytes())\n        .decodeToString()\n        .replace(\"_96.mp4\", \"_320.mp4\")\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/Expect.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers\n\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.models.TrackDetails\nimport kotlinx.coroutines.CoroutineDispatcher\nimport kotlinx.coroutines.Dispatchers\nimport kotlin.native.concurrent.SharedImmutable\n\nexpect suspend fun downloadTracks(\n    list: List<TrackDetails>,\n    fetcher: FetchPlatformQueryResult,\n    fileManager: FileManager\n)\n\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/FetchPlatformQueryResult.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.database.DownloadRecordDatabaseQueries\nimport com.shabinder.common.models.AudioFormat\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.PlatformQueryResult\nimport com.shabinder.common.models.SpotiFlyerException\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.dispatcherIO\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.event.coroutines.flatMapError\nimport com.shabinder.common.models.event.coroutines.onFailure\nimport com.shabinder.common.models.event.coroutines.onSuccess\nimport com.shabinder.common.models.event.coroutines.success\nimport com.shabinder.common.models.spotify.Source\nimport com.shabinder.common.providers.gaana.GaanaProvider\nimport com.shabinder.common.providers.saavn.SaavnProvider\nimport com.shabinder.common.providers.sound_cloud.SoundCloudProvider\nimport com.shabinder.common.providers.spotify.SpotifyProvider\nimport com.shabinder.common.providers.youtube.YoutubeProvider\nimport com.shabinder.common.providers.youtube_music.YoutubeMusic\nimport com.shabinder.common.providers.youtube_to_mp3.requests.YoutubeMp3\nimport com.shabinder.common.utils.appendPadded\nimport com.shabinder.common.utils.buildString\nimport com.shabinder.common.utils.requireNotNull\nimport kotlinx.coroutines.DelicateCoroutinesApi\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.launch\n\nclass FetchPlatformQueryResult(\n    private val gaanaProvider: GaanaProvider,\n    private val spotifyProvider: SpotifyProvider,\n    private val youtubeProvider: YoutubeProvider,\n    private val saavnProvider: SaavnProvider,\n    private val soundCloudProvider: SoundCloudProvider,\n    private val youtubeMusic: YoutubeMusic,\n    private val youtubeMp3: YoutubeMp3,\n    val fileManager: FileManager,\n    val preferenceManager: PreferenceManager,\n    val logger: Kermit\n) {\n    private val db: DownloadRecordDatabaseQueries?\n        get() = fileManager.db?.downloadRecordDatabaseQueries\n\n    suspend fun query(link: String): SuspendableEvent<PlatformQueryResult, Throwable> {\n        val result = when {\n            // SPOTIFY\n            link.contains(\"spotify\", true) ->\n                spotifyProvider.query(link)\n\n            // YOUTUBE\n            link.contains(\"youtube.com\", true) || link.contains(\"youtu.be\", true) ->\n                youtubeProvider.query(link)\n\n            // JioSaavn\n            link.contains(\"saavn\", true) ->\n                saavnProvider.query(link)\n\n            // GAANA\n            link.contains(\"gaana\", true) ->\n                gaanaProvider.query(link)\n\n            // SoundCloud\n            link.contains(\"soundcloud\", true) ->\n                soundCloudProvider.query(link)\n\n            else -> {\n                SuspendableEvent.error(SpotiFlyerException.LinkInvalid(link))\n            }\n        }\n        result.success {\n            addToDatabaseAsync(\n                link,\n                it.copy() // Send a copy in order to not freeze Result itself\n            )\n        }\n        return result\n    }\n\n    // 1) Try Finding on JioSaavn (better quality upto 320KBPS)\n    // 2) If Not found try finding on YouTube Music\n    suspend fun findBestDownloadLink(\n        track: TrackDetails,\n        preferredQuality: AudioQuality = preferenceManager.audioQuality\n    ): SuspendableEvent<Pair<String, AudioQuality>, Throwable> {\n        var downloadLink: String? = null\n        var audioQuality = AudioQuality.KBPS192\n        var audioFormat = AudioFormat.MP4\n\n        val errorTrace = buildString(track) {\n            if (track.videoID != null) {\n                // We Already have VideoID\n                downloadLink = when (track.source) {\n                    Source.JioSaavn -> {\n                        AudioFormat.MP4\n                        saavnProvider.getSongFromID(track.videoID.requireNotNull()).component1()\n                            ?.also { audioQuality = it.audioQuality }\n                            ?.media_url\n                    }\n                    Source.YouTube -> {\n                        youtubeMp3.getMp3DownloadLink(\n                            track.videoID.requireNotNull(),\n                            preferredQuality\n                        ).let { ytMp3LinkRes ->\n                            if (\n                                ytMp3LinkRes is SuspendableEvent.Failure\n                                ||\n                                ytMp3LinkRes.component1().isNullOrBlank()\n                            ) {\n                                appendPadded(\n                                    \"Yt1sMp3 Failed for ${track.videoID}:\",\n                                    ytMp3LinkRes.component2()?.stackTraceToString()\n                                        ?: \"couldn't fetch link for ${track.videoID} ,trying manual extraction\"\n                                )\n\n                                appendLine(\"Trying Local Extraction\")\n                                SuspendableEvent {\n                                    youtubeProvider.fetchVideoM4aLink(track.videoID.requireNotNull())\n                                }.onFailure { throwable ->\n                                    appendPadded(\"YT Manual Extraction Failed!\", throwable.stackTraceToString())\n                                }.onSuccess {\n                                    audioQuality = it.second\n                                    audioFormat = AudioFormat.MP4\n                                }.component1()?.first\n                            } else {\n                                audioFormat = AudioFormat.MP3\n                                ytMp3LinkRes.component1()\n                            }\n                        }\n                    }\n                    Source.SoundCloud -> {\n                        audioFormat = track.audioFormat\n                        soundCloudProvider.getDownloadURL(track).let {\n                            if (it is SuspendableEvent.Failure || it.component1().isNullOrEmpty()) {\n                                appendPadded(\n                                    \"SoundCloud Provider Failed for ${track.title}:\",\n                                    it.component2()?.stackTraceToString()\n                                        ?: \"couldn't fetch link for ${track.trackUrl}\"\n                                )\n                                null\n                            } else\n                                it.component1()\n                        }\n                    }\n                    else -> {\n                        appendPadded(\n                            \"Invalid Arguments\",\n                            \"VideoID with ${track.source} source is not defined how to be handled\"\n                        )\n                        /*We should never reach here for now*/\n                        null\n                    }\n                }\n            }\n            // if videoID wasn't present || fetching using video ID failed\n            if (downloadLink.isNullOrBlank()) {\n\n                // Try Fetching Track from Available Sources\n                saavnProvider.findBestSongDownloadURL(\n                    trackName = track.title,\n                    trackArtists = track.artists,\n                    preferredQuality = preferredQuality\n                ).onSuccess { (URL, quality) ->\n                    audioFormat = AudioFormat.MP4\n                    downloadLink = URL\n                    audioQuality = quality\n                }.flatMapError { saavnError ->\n                    appendPadded(\"Fetching From Saavn Failed:\", saavnError.stackTraceToString())\n                    // Saavn Failed, Lets Try Fetching Now From Youtube Music\n                    youtubeMusic.findSongDownloadURLYT(track, preferredQuality, this).onSuccess { (URL, quality, format) ->\n                        downloadLink = URL\n                        audioQuality = quality\n                        audioFormat = format\n                    }.onFailure {\n                        // Append Error To StackTrace\n                        appendPadded(\n                            \"Fetching From YT Failed:\",\n                            it.stackTraceToString()\n                        )\n                    }\n                }\n            }\n        }\n        return if (downloadLink.isNullOrBlank()) SuspendableEvent.error(\n            SpotiFlyerException.DownloadLinkFetchFailed(errorTrace)\n        ) else {\n            track.audioFormat = audioFormat\n            SuspendableEvent.success(Pair(downloadLink.requireNotNull(), audioQuality))\n        }\n    }\n\n    @OptIn(DelicateCoroutinesApi::class)\n    private fun addToDatabaseAsync(link: String, result: PlatformQueryResult) {\n        GlobalScope.launch(dispatcherIO) {\n            db?.add(\n                result.folderType,\n                result.title,\n                link,\n                result.coverUrl,\n                result.trackList.size.toLong()\n            )\n        }\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/ProvidersModule.kt",
    "content": "package com.shabinder.common.providers\n\nimport com.shabinder.common.providers.gaana.GaanaProvider\nimport com.shabinder.common.providers.saavn.SaavnProvider\nimport com.shabinder.common.providers.sound_cloud.SoundCloudProvider\nimport com.shabinder.common.providers.spotify.SpotifyProvider\nimport com.shabinder.common.providers.spotify.token_store.TokenStore\nimport com.shabinder.common.providers.youtube.YoutubeProvider\nimport com.shabinder.common.providers.youtube_music.YoutubeMusic\nimport com.shabinder.common.providers.youtube_to_mp3.requests.YoutubeMp3\nimport org.koin.dsl.module\n\n@Suppress(\"UNUSED_PARAMETER\")\nfun providersModule(enableNetworkLogs: Boolean) = module {\n    single { TokenStore(get(), get()) }\n    single { SpotifyProvider(get(), get(), get()) }\n    single { GaanaProvider(get(), get(), get()) }\n    single { SaavnProvider(get(), get(), get()) }\n    single { YoutubeProvider(get(), get(), get()) }\n    single { SoundCloudProvider(get(), get(), get()) }\n    single { YoutubeMp3(get(), get()) }\n    single { YoutubeMusic(get(), get(), get(), get(), get()) }\n    single { FetchPlatformQueryResult(get(), get(), get(), get(), get(), get(), get(), get(), get(), get()) }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/gaana/GaanaProvider.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers.gaana\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.file_manager.finalOutputDir\nimport com.shabinder.common.core_components.file_manager.getImageCachePath\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.PlatformQueryResult\nimport com.shabinder.common.models.SpotiFlyerException\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.gaana.GaanaTrack\nimport com.shabinder.common.models.spotify.Source\nimport com.shabinder.common.providers.gaana.requests.GaanaRequests\nimport io.ktor.client.*\n\nclass GaanaProvider(\n    override val httpClient: HttpClient,\n    private val logger: Kermit,\n    private val fileManager: FileManager,\n) : GaanaRequests {\n\n    private val gaanaPlaceholderImageUrl = \"https://a10.gaanacdn.com/images/social/gaana_social.jpg\"\n\n    suspend fun query(fullLink: String): SuspendableEvent<PlatformQueryResult, Throwable> = SuspendableEvent {\n        // Link Schema: https://gaana.com/type/link\n        val gaanaLink = fullLink.substringAfter(\"gaana.com/\")\n\n        val link = gaanaLink.substringAfterLast('/', \"error\")\n        val type = gaanaLink.substringBeforeLast('/', \"error\").substringAfterLast('/')\n\n        // Error\n        if (type == \"Error\" || link == \"Error\") {\n            throw SpotiFlyerException.LinkInvalid()\n        }\n\n        gaanaSearch(\n            type,\n            link\n        )\n    }\n\n    private suspend fun gaanaSearch(\n        type: String,\n        link: String,\n    ): PlatformQueryResult {\n        val result = PlatformQueryResult(\n            folderType = \"\",\n            subFolder = link,\n            title = link,\n            coverUrl = gaanaPlaceholderImageUrl,\n            trackList = listOf(),\n            Source.Gaana\n        )\n        logger.i { \"GAANA SEARCH: $type - $link\" }\n        with(result) {\n            when (type) {\n                \"song\" -> {\n                    getGaanaSong(seokey = link).tracks.firstOrNull()?.also {\n                        folderType = \"Tracks\"\n                        subFolder = \"\"\n                        trackList = listOf(it).toTrackDetailsList(folderType, subFolder)\n                        title = it.track_title\n                        coverUrl = it.artworkLink.replace(\"http:\", \"https:\")\n                    }\n                }\n                \"album\" -> {\n                    getGaanaAlbum(seokey = link).also {\n                        folderType = \"Albums\"\n                        subFolder = link\n                        trackList = it.tracks?.toTrackDetailsList(folderType, subFolder) ?: emptyList()\n                        title = link\n                        coverUrl = it.custom_artworks.size_480p.replace(\"http:\", \"https:\")\n                    }\n                }\n                \"playlist\" -> {\n                    getGaanaPlaylist(seokey = link).also {\n                        folderType = \"Playlists\"\n                        subFolder = link\n                        trackList = it.tracks.toTrackDetailsList(folderType, subFolder)\n                        title = link\n                        // coverUrl.value = \"TODO\"\n                        coverUrl = gaanaPlaceholderImageUrl\n                    }\n                }\n                \"artist\" -> {\n                    folderType = \"Artist\"\n                    subFolder = link\n                    coverUrl = gaanaPlaceholderImageUrl\n                    getGaanaArtistDetails(seokey = link).artist.firstOrNull()\n                        ?.also {\n                            title = it.name\n                            coverUrl = it.artworkLink?.replace(\"http:\", \"https:\") ?: gaanaPlaceholderImageUrl\n                        }\n                    getGaanaArtistTracks(seokey = link).also {\n                        trackList = it.tracks?.toTrackDetailsList(folderType, subFolder) ?: emptyList()\n                    }\n                }\n                else -> {\n                    // TODO Handle Error\n                }\n            }\n            return result\n        }\n    }\n\n    private fun List<GaanaTrack>.toTrackDetailsList(type: String, subFolder: String) = this.map {\n        TrackDetails(\n            title = it.track_title,\n            artists = it.artist.map { artist -> artist?.name.toString() },\n            durationSec = it.duration,\n            albumArtPath = fileManager.getImageCachePath(it.artworkLink),\n            albumName = it.album_title,\n            genre = it.genre?.mapNotNull { genre -> genre?.name } ?: emptyList(),\n            year = it.release_date,\n            comment = \"Genres:${it.genre?.map { genre -> genre?.name }?.reduceOrNull { acc, s -> acc + s }}\",\n            trackUrl = it.lyrics_url,\n            downloaded = it.updateStatusIfPresent(type, subFolder),\n            source = Source.Gaana,\n            albumArtURL = it.artworkLink.replace(\"http:\", \"https:\"),\n            outputFilePath = fileManager.finalOutputDir(\n                it.track_title,\n                type,\n                subFolder,\n                fileManager.defaultDir()/*,\".m4a\"*/\n            )\n        )\n    }\n\n    private fun GaanaTrack.updateStatusIfPresent(folderType: String, subFolder: String): DownloadStatus {\n        return if (fileManager.isPresent(\n                fileManager.finalOutputDir(\n                    track_title,\n                    folderType,\n                    subFolder,\n                    fileManager.defaultDir()\n                )\n            )\n        ) { // Download Already Present!!\n            DownloadStatus.Downloaded.also {\n                downloaded = it\n            }\n        } else downloaded ?: DownloadStatus.NotDownloaded\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/gaana/requests/GaanaRequests.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers.gaana.requests\n\nimport com.shabinder.common.models.corsApi\nimport com.shabinder.common.models.gaana.GaanaAlbum\nimport com.shabinder.common.models.gaana.GaanaArtistDetails\nimport com.shabinder.common.models.gaana.GaanaArtistTracks\nimport com.shabinder.common.models.gaana.GaanaPlaylist\nimport com.shabinder.common.models.gaana.GaanaSong\nimport io.ktor.client.*\nimport io.ktor.client.request.*\n\ninterface GaanaRequests {\n\n    companion object {\n        private const val TOKEN = \"b2e6d7fbc136547a940516e9b77e5990\"\n        private val BASE_URL get() = \"${corsApi}https://api.gaana.com\"\n    }\n\n    val httpClient: HttpClient\n\n    /*\n    * Api Request:  http://api.gaana.com/?type=playlist&subtype=playlist_detail&seokey=gaana-dj-hindi-top-50-1&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n    *\n    * subtype : [\"most_popular_playlist\" , \"playlist_home_featured\" ,\"playlist_detail\" ,\"user_playlist\" ,\"topCharts\"]\n    **/\n    suspend fun getGaanaPlaylist(\n        type: String = \"playlist\",\n        subtype: String = \"playlist_detail\",\n        seokey: String,\n        format: String = \"JSON\",\n        limit: Int = 2000\n    ): GaanaPlaylist {\n        return httpClient.get(\n            \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format&limit=$limit\"\n        )\n    }\n\n    /*\n    * Api Request:  http://api.gaana.com/?type=album&subtype=album_detail&seokey=kabir-singh&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n    *\n    * subtype : [\"most_popular\" , \"new_release\" ,\"featured_album\" ,\"similar_album\" ,\"all_albums\", \"album\" ,\"album_detail\" ,\"album_detail_info\"]\n    **/\n    suspend fun getGaanaAlbum(\n        type: String = \"album\",\n        subtype: String = \"album_detail\",\n        seokey: String,\n        format: String = \"JSON\",\n        limit: Int = 2000\n    ): GaanaAlbum {\n        return httpClient.get(\n            \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format&limit=$limit\"\n        )\n    }\n\n    /*\n    * Api Request:  http://api.gaana.com/?type=song&subtype=song_detail&seokey=pachtaoge&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n    *\n    * subtype : [\"most_popular\" , \"hot_songs\" ,\"recommendation\" ,\"song_detail\"]\n    **/\n    suspend fun getGaanaSong(\n        type: String = \"song\",\n        subtype: String = \"song_detail\",\n        seokey: String,\n        format: String = \"JSON\",\n    ): GaanaSong {\n        return httpClient.get(\n            \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format\"\n        )\n    }\n\n    /*\n    * Api Request:  https://api.gaana.com/?type=artist&subtype=artist_details_info&seokey=neha-kakkar&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n    *\n    * subtype : [\"most_popular\" , \"artist_list\" ,\"artist_track_listing\" ,\"artist_album\" ,\"similar_artist\",\"artist_details\" ,\"artist_details_info\"]\n    **/\n    suspend fun getGaanaArtistDetails(\n        type: String = \"artist\",\n        subtype: String = \"artist_details_info\",\n        seokey: String,\n        format: String = \"JSON\",\n    ): GaanaArtistDetails {\n        return httpClient.get(\n            \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format\"\n        )\n    }\n\n    /*\n    * Api Request:  http://api.gaana.com/?type=artist&subtype=artist_track_listing&seokey=neha-kakkar&limit=50&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n    *\n    * subtype : [\"most_popular\" , \"artist_list\" ,\"artist_track_listing\" ,\"artist_album\" ,\"similar_artist\",\"artist_details\" ,\"artist_details_info\"]\n    **/\n    suspend fun getGaanaArtistTracks(\n        type: String = \"artist\",\n        subtype: String = \"artist_track_listing\",\n        seokey: String,\n        format: String = \"JSON\",\n        limit: Int = 50\n    ): GaanaArtistTracks {\n        return httpClient.get(\n            \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format&limit=$limit\"\n        )\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/saavn/SaavnProvider.kt",
    "content": "package com.shabinder.common.providers.saavn\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.file_manager.finalOutputDir\nimport com.shabinder.common.core_components.file_manager.getImageCachePath\nimport com.shabinder.common.models.*\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.saavn.SaavnSong\nimport com.shabinder.common.models.spotify.Source\nimport com.shabinder.common.providers.saavn.requests.JioSaavnRequests\nimport com.shabinder.common.utils.removeIllegalChars\nimport io.ktor.client.*\n\nclass SaavnProvider(\n    override val httpClient: HttpClient,\n    override val logger: Kermit,\n    private val fileManager: FileManager\n) : JioSaavnRequests {\n\n    suspend fun query(fullLink: String): SuspendableEvent<PlatformQueryResult, Throwable> = SuspendableEvent {\n        PlatformQueryResult(\n            folderType = \"\",\n            subFolder = \"\",\n            title = \"\",\n            coverUrl = \"\",\n            trackList = listOf(),\n            Source.JioSaavn\n        ).apply {\n            val pageLink = fullLink.substringAfter(\"saavn.com/\").substringBefore(\"?\")\n            when {\n                pageLink.contains(\"song/\", true) -> {\n                    getSong(fullLink).value.let {\n                        folderType = \"Tracks\"\n                        subFolder = \"\"\n                        trackList = listOf(it).toTrackDetails(folderType, subFolder)\n                        title = it.song\n                        coverUrl = it.image.replace(\"http:\", \"https:\")\n                    }\n                }\n                pageLink.contains(\"album/\", true) -> {\n                    getAlbum(fullLink).value.let {\n                        folderType = \"Albums\"\n                        subFolder = removeIllegalChars(it.title)\n                        trackList = it.songs.toTrackDetails(folderType, subFolder)\n                        title = it.title\n                        coverUrl = it.image.replace(\"http:\", \"https:\")\n                    }\n                }\n                pageLink.contains(\"featured/\", true)\n                        || pageLink.contains(\"playlist/\", true) -> { // Playlist\n                    getPlaylist(fullLink).value.let {\n                        folderType = \"Playlists\"\n                        subFolder = removeIllegalChars(it.listname)\n                        trackList = it.songs.toTrackDetails(folderType, subFolder)\n                        coverUrl = it.image.replace(\"http:\", \"https:\")\n                        title = it.listname\n                    }\n                }\n                else -> {\n                    throw SpotiFlyerException.LinkInvalid(fullLink)\n                }\n            }\n        }\n    }\n\n    private fun List<SaavnSong>.toTrackDetails(type: String, subFolder: String): List<TrackDetails> = this.map {\n        TrackDetails(\n            title = it.song,\n            artists = it.artistMap.keys.toMutableSet().apply { addAll(it.singers.split(\",\")) }.toList(),\n            durationSec = it.duration.toInt(),\n            albumName = it.album,\n            albumArtPath = fileManager.getImageCachePath(it.image),\n            year = it.year,\n            comment = it.copyright_text,\n            trackUrl = it.perma_url,\n            videoID = it.id,\n            downloadLink = it.media_url, // Downloadable Link\n            downloaded = it.updateStatusIfPresent(type, subFolder),\n            albumArtURL = it.image.replace(\"http:\", \"https:\"),\n            lyrics = it.lyrics ?: it.lyrics_snippet,\n            source = Source.JioSaavn,\n            audioQuality = if (it.is320Kbps) AudioQuality.KBPS320 else AudioQuality.KBPS160,\n            outputFilePath = fileManager.finalOutputDir(it.song, type, subFolder, fileManager.defaultDir() /*\".m4a\"*/)\n        )\n    }\n\n    private fun SaavnSong.updateStatusIfPresent(folderType: String, subFolder: String): DownloadStatus {\n        return if (fileManager.isPresent(\n                fileManager.finalOutputDir(\n                    song,\n                    folderType,\n                    subFolder,\n                    fileManager.defaultDir()\n                )\n            )\n        ) { // Download Already Present!!\n            DownloadStatus.Downloaded.also {\n                downloaded = it\n            }\n        } else downloaded\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/saavn/requests/JioSaavnRequests.kt",
    "content": "package com.shabinder.common.providers.saavn.requests\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.SpotiFlyerException\nimport com.shabinder.common.models.corsApi\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.event.coroutines.map\nimport com.shabinder.common.models.event.coroutines.success\nimport com.shabinder.common.models.saavn.SaavnAlbum\nimport com.shabinder.common.models.saavn.SaavnPlaylist\nimport com.shabinder.common.models.saavn.SaavnSearchResult\nimport com.shabinder.common.models.saavn.SaavnSong\nimport com.shabinder.common.utils.globalJson\nimport com.shabinder.common.utils.requireNotNull\nimport io.github.shabinder.fuzzywuzzy.diffutils.FuzzySearch\nimport io.github.shabinder.utils.getBoolean\nimport io.github.shabinder.utils.getJsonArray\nimport io.github.shabinder.utils.getJsonObject\nimport io.github.shabinder.utils.getString\nimport io.ktor.client.HttpClient\nimport io.ktor.client.request.get\nimport kotlinx.serialization.json.Json\nimport kotlinx.serialization.json.JsonArray\nimport kotlinx.serialization.json.JsonObject\nimport kotlinx.serialization.json.JsonPrimitive\nimport kotlinx.serialization.json.buildJsonArray\nimport kotlinx.serialization.json.buildJsonObject\nimport kotlinx.serialization.json.jsonPrimitive\nimport kotlinx.serialization.json.put\nimport kotlin.collections.set\n\ninterface JioSaavnRequests {\n\n    val httpClient: HttpClient\n    val logger: Kermit\n\n    suspend fun findBestSongDownloadURL(\n        trackName: String,\n        trackArtists: List<String>,\n        preferredQuality: AudioQuality\n    ): SuspendableEvent<Pair<String, AudioQuality>, Throwable> = searchForSong(trackName).map { songs ->\n        val bestMatch = sortByBestMatch(songs, trackName, trackArtists).keys.firstOrNull()\n            ?: throw SpotiFlyerException.DownloadLinkFetchFailed(\"No SAAVN Match Found for $trackName\")\n\n        var audioQuality: AudioQuality = AudioQuality.KBPS160\n        val m4aLink: String by getSongFromID(bestMatch).map { song ->\n            val optimalQuality = if (song.is320Kbps && ((preferredQuality.kbps.toIntOrNull()\n                    ?: 0) > 160)\n            ) AudioQuality.KBPS320 else AudioQuality.KBPS160\n            audioQuality = optimalQuality\n\n            song.media_url.requireNotNull().replaceAfterLast(\"_\", \"${optimalQuality.kbps}.mp4\")\n        }\n\n        Pair(m4aLink, audioQuality)\n    }\n\n    suspend fun searchForSong(\n        query: String,\n        includeLyrics: Boolean = false\n    ): SuspendableEvent<List<SaavnSearchResult>, Throwable> = SuspendableEvent {\n\n        val searchURL = search_base_url + query\n        val results = mutableListOf<SaavnSearchResult>()\n\n        (globalJson.parseToJsonElement(httpClient.get(searchURL)) as JsonObject)\n            .getJsonObject(\"songs\")\n            .getJsonArray(\"data\").requireNotNull().forEach {\n                (it as JsonObject).formatData().let { jsonObject ->\n                    results.add(globalJson.decodeFromJsonElement(SaavnSearchResult.serializer(), jsonObject))\n                }\n            }\n\n        results\n    }\n\n    suspend fun getLyrics(ID: String): SuspendableEvent<String, Throwable> = SuspendableEvent {\n        (Json.parseToJsonElement(httpClient.get(lyrics_base_url + ID)) as JsonObject)\n            .getString(\"lyrics\").requireNotNull()\n    }\n\n    suspend fun getSong(\n        URL: String,\n        fetchLyrics: Boolean = false\n    ): SuspendableEvent<SaavnSong, Throwable> = SuspendableEvent {\n        val id = getSongID(URL)\n        val data =\n            ((globalJson.parseToJsonElement(httpClient.get(song_details_base_url + id)) as JsonObject)[id] as JsonObject)\n                .formatData(fetchLyrics)\n\n        globalJson.decodeFromJsonElement(SaavnSong.serializer(), data)\n    }\n\n    suspend fun getSongFromID(\n        ID: String,\n        fetchLyrics: Boolean = false\n    ): SuspendableEvent<SaavnSong, Throwable> = SuspendableEvent {\n        val data =\n            ((globalJson.parseToJsonElement(httpClient.get(song_details_base_url + ID)) as JsonObject)[ID] as JsonObject)\n                .formatData(fetchLyrics)\n\n        globalJson.decodeFromJsonElement(SaavnSong.serializer(), data)\n    }\n\n    private suspend fun getSongID(\n        URL: String,\n    ): String {\n        val res = httpClient.get<String>(URL)\n        return try {\n            res.split(\"\\\"song\\\":{\\\"type\\\":\\\"\")[1].split(\"\\\",\\\"image\\\":\")[0].split(\"\\\"id\\\":\\\"\").last()\n        } catch (e: IndexOutOfBoundsException) {\n            res.split(\"\\\"pid\\\":\\\"\")[1].split(\"\\\",\\\"\").first()\n        }\n    }\n\n    suspend fun getPlaylist(\n        URL: String,\n        includeLyrics: Boolean = false\n    ): SuspendableEvent<SaavnPlaylist, Throwable> = SuspendableEvent {\n        globalJson.decodeFromJsonElement(\n            SaavnPlaylist.serializer(),\n            (globalJson.parseToJsonElement(httpClient.get(playlist_details_base_url + getPlaylistID(URL).value)) as JsonObject)\n                .formatData(includeLyrics)\n        )\n    }\n\n    private suspend fun getPlaylistID(\n        URL: String\n    ): SuspendableEvent<String, Throwable> = SuspendableEvent {\n        val res = httpClient.get<String>(URL)\n        try {\n            res.split(\"\\\"type\\\":\\\"playlist\\\",\\\"id\\\":\\\"\")[1].split('\"')[0]\n        } catch (e: IndexOutOfBoundsException) {\n            res.split(\"\\\"page_id\\\",\\\"\")[1].split(\"\\\",\\\"\")[0]\n        }\n    }\n\n    suspend fun getAlbum(\n        URL: String,\n        includeLyrics: Boolean = false\n    ): SuspendableEvent<SaavnAlbum, Throwable> = SuspendableEvent {\n        globalJson.decodeFromJsonElement(\n            SaavnAlbum.serializer(),\n            (globalJson.parseToJsonElement(httpClient.get(album_details_base_url + getAlbumID(URL).value)) as JsonObject)\n                .formatData(includeLyrics)\n        )\n    }\n\n    private suspend fun getAlbumID(\n        URL: String\n    ): SuspendableEvent<String, Throwable> = SuspendableEvent {\n        val res = httpClient.get<String>(URL)\n        try {\n            res.split(\"\\\"album_id\\\":\\\"\")[1].split('\"')[0]\n        } catch (e: IndexOutOfBoundsException) {\n            res.split(\"\\\"page_id\\\",\\\"\")[1].split(\"\\\",\\\"\")[0]\n        }\n    }\n\n    private suspend fun JsonObject.formatData(\n        includeLyrics: Boolean = false\n    ): JsonObject {\n        return buildJsonObject {\n            // Accommodate Incoming Json Object Data\n            // And `Format` everything while iterating\n            this@formatData.forEach {\n                if (it.value is JsonPrimitive && it.value.jsonPrimitive.isString) {\n                    put(it.key, it.value.jsonPrimitive.content.format())\n                } else {\n                    // Format Songs Nested Collection Too\n                    if (it.key == \"songs\" && it.value is JsonArray) {\n                        put(\n                            it.key,\n                            buildJsonArray {\n                                getJsonArray(\"songs\")?.forEach { song ->\n                                    (song as? JsonObject)?.formatData(includeLyrics)?.let { formattedSong ->\n                                        add(formattedSong)\n                                    }\n                                }\n                            }\n                        )\n                    } else {\n                        put(it.key, it.value)\n                    }\n                }\n            }\n\n            try {\n                var url = getString(\"media_preview_url\")!!.replace(\"preview\", \"aac\") // We Will catch NPE\n                url = if (getBoolean(\"320kbps\") == true) {\n                    url.replace(\"_96_p.mp4\", \"_320.mp4\")\n                } else {\n                    url.replace(\"_96_p.mp4\", \"_160.mp4\")\n                }\n                // Add Media URL to JSON Object\n                put(\"media_url\", url)\n            } catch (e: Exception) {\n                // e.printStackTrace()\n                // DECRYPT Encrypted Media URL\n                getString(\"encrypted_media_url\")?.let {\n                    put(\"media_url\", decryptURL(it))\n                }\n                // Check if 320 Kbps is available or not\n                if (getBoolean(\"320kbps\") != true && containsKey(\"media_url\")) {\n                    put(\"media_url\", getString(\"media_url\")?.replace(\"_320.mp4\", \"_160.mp4\"))\n                }\n            }\n            // Increase Image Resolution\n            put(\n                \"image\",\n                getString(\"image\")\n                    ?.replace(\"150x150\", \"500x500\")\n                    ?.replace(\"50x50\", \"500x500\")\n            )\n\n            // Fetch Lyrics if Requested\n            // Lyrics is HTML Based\n            if (includeLyrics) {\n                if (getBoolean(\"has_lyrics\") == true && containsKey(\"id\")) {\n                    getLyrics(getString(\"id\").requireNotNull()).success {\n                        put(\"lyrics\", it)\n                    }\n                } else {\n                    put(\"lyrics\", \"\")\n                }\n            }\n        }\n    }\n\n    fun sortByBestMatch(\n        tracks: List<SaavnSearchResult>,\n        trackName: String,\n        trackArtists: List<String>,\n    ): Map<String, Float> {\n\n        /*\n        * \"linksWithMatchValue\" is map with Saavn VideoID and its rating/match with 100 as Max Value\n        **/\n        val linksWithMatchValue = mutableMapOf<String, Float>()\n\n        for (result in tracks) {\n            var hasCommonWord = false\n\n            val resultName = result.title.toLowerCase().replace(\"/\", \" \")\n            val trackNameWords = trackName.toLowerCase().split(\" \")\n\n            for (nameWord in trackNameWords) {\n                if (nameWord.isNotBlank() && FuzzySearch.partialRatio(nameWord, resultName) > 85) hasCommonWord = true\n            }\n\n            // Skip this Result if No Word is Common in Name\n            if (!hasCommonWord) {\n                // logger.i(\"Saavn Removing Common Word\") { result.toString() }\n                continue\n            }\n\n            // Find artist match\n            // Will Be Using Fuzzy Search Because YT Spelling might be mucked up\n            // match  = (no of artist names in result) / (no. of artist names on spotify) * 100\n            var artistMatchNumber = 0\n\n            // String Containing All Artist Names from JioSaavn Search Result\n            val artistListString = mutableSetOf<String>().apply {\n                result.more_info?.singers?.split(\",\")?.let { addAll(it) }\n                result.more_info?.primary_artists?.toLowerCase()?.split(\",\")?.let { addAll(it) }\n            }.joinToString(\" , \")\n\n            for (artist in trackArtists) {\n                if (FuzzySearch.partialRatio(artist.toLowerCase(), artistListString) > 85)\n                    artistMatchNumber++\n            }\n\n            if (artistMatchNumber == 0) {\n                // logger.i(\"Artist Match Saavn Removing\") { result.toString() }\n                continue\n            }\n            val artistMatch: Float = (artistMatchNumber.toFloat() / trackArtists.size) * 100\n            val nameMatch: Float = FuzzySearch.partialRatio(resultName, trackName).toFloat() / 100\n            val avgMatch = (artistMatch + nameMatch) / 2\n\n            linksWithMatchValue[result.id] = avgMatch\n        }\n        return linksWithMatchValue.toList().sortedByDescending { it.second }.toMap().also {\n            logger.i(TAG) { \"Match Found for $trackName - ${!it.isNullOrEmpty()}  ${it.keys.firstOrNull() ?: \"\"}\" }\n        }\n    }\n\n    companion object {\n        const val TAG = \"Saavn Request\"\n\n        // EndPoints\n        val search_base_url =\n            \"${corsApi}https://www.jiosaavn.com/api.php?__call=autocomplete.get&_format=json&_marker=0&cc=in&includeMetaTags=1&query=\"\n        val song_details_base_url =\n            \"${corsApi}https://www.jiosaavn.com/api.php?__call=song.getDetails&cc=in&_marker=0%3F_marker%3D0&_format=json&pids=\"\n        val album_details_base_url =\n            \"${corsApi}https://www.jiosaavn.com/api.php?__call=content.getAlbumDetails&_format=json&cc=in&_marker=0%3F_marker%3D0&albumid=\"\n        val playlist_details_base_url =\n            \"${corsApi}https://www.jiosaavn.com/api.php?__call=playlist.getDetails&_format=json&cc=in&_marker=0%3F_marker%3D0&listid=\"\n        val lyrics_base_url =\n            \"${corsApi}https://www.jiosaavn.com/api.php?__call=lyrics.getLyrics&ctx=web6dot0&api_version=4&_format=json&_marker=0%3F_marker%3D0&lyrics_id=\"\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/saavn/requests/JioSaavnUtils.kt",
    "content": "package com.shabinder.common.providers.saavn.requests\n\nimport com.shabinder.common.utils.unescape\n\nexpect suspend fun decryptURL(url: String): String\n\ninternal fun String.format(): String {\n    return this.unescape()\n        .replace(\"&quot;\", \"'\")\n        .replace(\"&amp;\", \"&\")\n        .replace(\"&#039;\", \"'\")\n        .replace(\"&copy;\", \"©\")\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/sound_cloud/SoundCloudProvider.kt",
    "content": "package com.shabinder.common.providers.sound_cloud\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.file_manager.finalOutputDir\nimport com.shabinder.common.core_components.file_manager.getImageCachePath\nimport com.shabinder.common.models.AudioFormat\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.PlatformQueryResult\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.soundcloud.resolvemodel.SoundCloudResolveResponseBase.SoundCloudResolveResponsePlaylist\nimport com.shabinder.common.models.soundcloud.resolvemodel.SoundCloudResolveResponseBase.SoundCloudResolveResponseTrack\nimport com.shabinder.common.models.spotify.Source\nimport com.shabinder.common.providers.sound_cloud.requests.SoundCloudRequests\nimport com.shabinder.common.providers.sound_cloud.requests.doAuthenticatedRequest\nimport com.shabinder.common.utils.requireNotNull\nimport io.github.shabinder.utils.getString\nimport io.ktor.client.HttpClient\nimport kotlinx.serialization.json.JsonObject\n\nclass SoundCloudProvider(\n    private val logger: Kermit,\n    private val fileManager: FileManager,\n    override val httpClient: HttpClient,\n) : SoundCloudRequests {\n    suspend fun query(fullURL: String) = SuspendableEvent {\n        PlatformQueryResult(\n            folderType = \"\",\n            subFolder = \"\",\n            title = \"\",\n            coverUrl = \"\",\n            trackList = listOf(),\n            Source.SoundCloud\n        ).apply {\n            when (val response = fetchResult(fullURL)) {\n                is SoundCloudResolveResponseTrack -> {\n                    folderType = \"Tracks\"\n                    subFolder = \"\"\n                    trackList = listOf(response).toTrackDetailsList(folderType, subFolder)\n                    coverUrl = response.artworkUrl\n                    title = response.title\n                }\n                is SoundCloudResolveResponsePlaylist -> {\n                    folderType = \"Playlists\"\n                    subFolder = response.title\n                    trackList = response.tracks.toTrackDetailsList(folderType, subFolder)\n                    coverUrl = response.artworkUrl.formatArtworkUrl()\n                        .ifBlank { response.calculatedArtworkUrl.formatArtworkUrl() }\n                    title = response.title\n                }\n            }\n        }\n    }\n\n    suspend fun getDownloadURL(trackDetails: TrackDetails) = SuspendableEvent {\n        doAuthenticatedRequest<JsonObject>(trackDetails.videoID.requireNotNull()).getString(\"url\")\n    }\n\n\n    private fun List<SoundCloudResolveResponseTrack>.toTrackDetailsList(\n        type: String,\n        subFolder: String\n    ): List<TrackDetails> =\n        map {\n            val downloadableInfo = it.getDownloadableLink()\n            TrackDetails(\n                title = it.title,\n                //trackNumber = it.track_number,\n                genre = listOf(it.genre),\n                artists = /*it.artists?.map { artist -> artist?.name.toString() } ?:*/ listOf(it.user.username.ifBlank { it.genre }),\n                albumArtists = /*it.album?.artists?.mapNotNull { artist -> artist?.name } ?:*/ emptyList(),\n                durationSec = (it.duration / 1000),\n                albumArtPath = fileManager.getImageCachePath(it.artworkUrl.formatArtworkUrl()),\n                albumName = \"\", //it.album?.name,\n                year = runCatching { it.displayDate.substring(0, 4) }.getOrNull(),\n                comment = it.caption,\n                trackUrl = it.permalinkUrl,\n                downloaded = it.updateStatusIfPresent(type, subFolder),\n                source = Source.SoundCloud,\n                albumArtURL = it.artworkUrl.formatArtworkUrl(),\n                outputFilePath = fileManager.finalOutputDir(\n                    it.title,\n                    type,\n                    subFolder,\n                    fileManager.defaultDir()/*,\".m4a\"*/\n                ),\n                audioQuality = AudioQuality.KBPS128,\n                videoID = downloadableInfo?.first,\n                audioFormat = downloadableInfo?.second ?: AudioFormat.MP3\n            )\n        }\n\n    private fun SoundCloudResolveResponseTrack.updateStatusIfPresent(\n        folderType: String,\n        subFolder: String\n    ): DownloadStatus {\n        return if (fileManager.isPresent(\n                fileManager.finalOutputDir(\n                    title,\n                    folderType,\n                    subFolder,\n                    fileManager.defaultDir()\n                )\n            )\n        ) { // Download Already Present!!\n            DownloadStatus.Downloaded\n        } else\n            DownloadStatus.NotDownloaded\n    }\n\n    private fun String.formatArtworkUrl(): String {\n        return if (isBlank()) \"\"\n        else substringBeforeLast(\"-\") + \"-t500x500.\" + substringAfterLast(\".\")\n    }\n}"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/sound_cloud/requests/SoundCloudRequests.kt",
    "content": "package com.shabinder.common.providers.sound_cloud.requests\n\nimport com.shabinder.common.core_components.utils.getFinalUrl\nimport com.shabinder.common.models.SpotiFlyerException\nimport com.shabinder.common.models.soundcloud.resolvemodel.SoundCloudResolveResponseBase\nimport com.shabinder.common.models.soundcloud.resolvemodel.SoundCloudResolveResponseBase.SoundCloudResolveResponsePlaylist\nimport com.shabinder.common.models.soundcloud.resolvemodel.SoundCloudResolveResponseBase.SoundCloudResolveResponseTrack\nimport com.shabinder.common.utils.globalJson\nimport io.ktor.client.HttpClient\nimport io.ktor.client.features.ClientRequestException\nimport io.ktor.client.request.get\nimport io.ktor.client.request.parameter\nimport kotlinx.coroutines.async\nimport kotlinx.coroutines.awaitAll\nimport kotlinx.coroutines.supervisorScope\nimport kotlinx.serialization.DeserializationStrategy\nimport kotlinx.serialization.InternalSerializationApi\nimport kotlinx.serialization.decodeFromString\nimport kotlinx.serialization.json.JsonContentPolymorphicSerializer\nimport kotlinx.serialization.json.JsonElement\nimport kotlinx.serialization.json.jsonObject\nimport kotlinx.serialization.json.jsonPrimitive\n\ninterface SoundCloudRequests {\n\n    val httpClient: HttpClient\n\n    suspend fun fetchResult(url: String): SoundCloudResolveResponseBase {\n        @Suppress(\"NAME_SHADOWING\")\n        var url = url\n\n        // Fetch Full URL if Input is Shortened URL from App\n        if (url.contains(\"soundcloud.app\"))\n            url = httpClient.getFinalUrl(url)\n\n        return getResponseObj(url).run {\n            when (this) {\n                is SoundCloudResolveResponseTrack -> {\n                    getTrack()\n                }\n                is SoundCloudResolveResponsePlaylist -> {\n                    populatePlaylist()\n                }\n                else -> throw SpotiFlyerException.FeatureNotImplementedYet()\n            }\n        }\n    }\n\n    @Suppress(\"NAME_SHADOWING\")\n    suspend fun SoundCloudResolveResponseTrack.getTrack() = apply {\n        val track = populateTrackInfo()\n\n        if (track.policy == \"BLOCK\")\n            throw SpotiFlyerException.GeoLocationBlocked(extraInfo = \"Use VPN to access ${track.title}\")\n\n        if (!track.streamable)\n            throw SpotiFlyerException.LinkInvalid(\"\\nSound Cloud Reports that ${track.title} is not streamable !\\n\")\n\n        return track\n    }\n\n    @Suppress(\"NAME_SHADOWING\")\n    suspend fun SoundCloudResolveResponsePlaylist.populatePlaylist(): SoundCloudResolveResponsePlaylist = apply {\n        supervisorScope {\n            try {\n                tracks = tracks.map {\n                    async {\n                        runCatching {\n                            it.populateTrackInfo()\n                        }.getOrNull() ?: it\n                    }\n                }.awaitAll()\n            } catch (e: Throwable) {\n                e.printStackTrace()\n            }\n        }\n    }\n\n\n    private suspend fun SoundCloudResolveResponseTrack.populateTrackInfo(): SoundCloudResolveResponseTrack {\n        if (media.transcodings.isNotEmpty())\n            return this\n\n        val infoURL = URLS.TRACK_INFO.buildURL(id)\n\n        val data: String = httpClient.get(infoURL) {\n            parameter(\"client_id\", CLIENT_ID)\n        }\n        return globalJson.decodeFromString(data)\n    }\n\n    private suspend fun getResponseObj(url: String, clientID: String = CLIENT_ID): SoundCloudResolveResponseBase {\n        val itemURL = URLS.RESOLVE.buildURL(url)\n        val resp: SoundCloudResolveResponseBase = try {\n            val data: String = httpClient.get(itemURL) {\n                parameter(\"client_id\", clientID)\n            }\n            globalJson.decodeFromString(SoundCloudSerializer, data)\n        } catch (e: ClientRequestException) {\n            if (clientID != ALT_CLIENT_ID)\n                return getResponseObj(url, ALT_CLIENT_ID)\n            throw e\n        }\n        val tracksPresent = (resp is SoundCloudResolveResponsePlaylist && resp.tracks.isNotEmpty())\n\n        if (!tracksPresent && clientID != ALT_CLIENT_ID)\n            return getResponseObj(ALT_CLIENT_ID)\n\n        return resp\n    }\n\n    @Suppress(\"unused\")\n    companion object {\n        private enum class URLS(val buildURL: (arg: String) -> String) {\n            RESOLVE({ \"https://api-v2.soundcloud.com/resolve?url=$it}\" }),\n            PLAYLIST_LIKED({ \"https://api-v2.soundcloud.com/users/$it/playlists/liked_and_owned?limit=200\" }),\n            FAVORITES({ \"'https://api-v2.soundcloud.com/users/$it/track_likes?limit=200\" }),\n            COMMENTED({ \"https://api-v2.soundcloud.com/users/$it/comments\" }),\n            TRACKS({ \"https://api-v2.soundcloud.com/users/$it/tracks?limit=200\" }),\n            ALL({ \"https://api-v2.soundcloud.com/profile/soundcloud:users:$it?limit=200\" }),\n            TRACK_INFO({ \"https://api-v2.soundcloud.com/tracks/$it\" }),\n            ORIGINAL_DOWNLOAD({ \"https://api-v2.soundcloud.com/tracks/$it/download\" }),\n            USER({ \"https://api-v2.soundcloud.com/users/$it\" }),\n            ME({ \"https://api-v2.soundcloud.com/me?oauth_token=$it\" }),\n        }\n\n        const val CLIENT_ID = \"a3e059563d7fd3372b49b37f00a00bcf\"\n        const val ALT_CLIENT_ID = \"2t9loNQH90kzJcsFCODdigxfp325aq4z\"\n\n        object SoundCloudSerializer :\n            JsonContentPolymorphicSerializer<SoundCloudResolveResponseBase>(SoundCloudResolveResponseBase::class) {\n            override fun selectDeserializer(element: JsonElement): DeserializationStrategy<out SoundCloudResolveResponseBase> =\n                when {\n                    \"track_count\" in element.jsonObject -> SoundCloudResolveResponsePlaylist.serializer()\n                    \"kind\" in element.jsonObject -> {\n                        val isTrack =\n                            element.jsonObject[\"kind\"]\n                                ?.jsonPrimitive?.content.toString()\n                                .contains(\"track\", true)\n                        when {\n                            isTrack || \"track_format\" in element.jsonObject -> SoundCloudResolveResponseTrack.serializer()\n                            else -> SoundCloudResolveResponsePlaylist.serializer()\n                        }\n                    }\n                    else -> SoundCloudResolveResponsePlaylist.serializer()\n                }\n        }\n    }\n}\n\n@OptIn(InternalSerializationApi::class)\nsuspend inline fun <reified T : Any> SoundCloudRequests.doAuthenticatedRequest(url: String): T {\n    var clientID: String = SoundCloudRequests.CLIENT_ID\n    return try {\n        httpClient.get(url) {\n            parameter(\"client_id\", clientID)\n        }\n    } catch (e: ClientRequestException) {\n        if (clientID != SoundCloudRequests.ALT_CLIENT_ID) {\n            clientID = SoundCloudRequests.ALT_CLIENT_ID\n            return httpClient.get(url) {\n                parameter(\"client_id\", clientID)\n            }\n        }\n        throw e\n    }\n}"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/spotify/SpotifyProvider.kt",
    "content": "/*\n * Copyright (c)  2021  Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers.spotify\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.file_manager.finalOutputDir\nimport com.shabinder.common.core_components.file_manager.getImageCachePath\nimport com.shabinder.common.core_components.utils.createHttpClient\nimport com.shabinder.common.models.*\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.spotify.PlaylistTrack\nimport com.shabinder.common.models.spotify.Source\nimport com.shabinder.common.models.spotify.Track\nimport com.shabinder.common.providers.spotify.requests.SpotifyRequests\nimport com.shabinder.common.providers.spotify.requests.authenticateSpotify\nimport com.shabinder.common.providers.spotify.token_store.TokenStore\nimport com.shabinder.common.utils.globalJson\nimport io.ktor.client.*\nimport io.ktor.client.features.*\nimport io.ktor.client.features.json.*\nimport io.ktor.client.features.json.serializer.*\nimport io.ktor.client.request.*\n\nclass SpotifyProvider(\n    private val tokenStore: TokenStore,\n    private val logger: Kermit,\n    private val fileManager: FileManager,\n) : SpotifyRequests {\n\n    override suspend fun authenticateSpotifyClient(override: Boolean) {\n        val token = if (override) authenticateSpotify().component1() else tokenStore.getToken()\n        if (token == null) {\n            logger.d { \"Spotify Auth Failed: Please Check your Network Connection\" }\n        } else {\n            logger.d { \"Spotify Provider Created with $token\" }\n            HttpClient {\n                defaultRequest {\n                    header(\"Authorization\", \"Bearer ${token.access_token}\")\n                }\n                install(JsonFeature) {\n                    serializer = KotlinxSerializer(globalJson)\n                }\n            }.also { httpClientRef.value = it }\n        }\n    }\n\n    override val httpClientRef = NativeAtomicReference(createHttpClient(true))\n\n    suspend fun query(fullLink: String): SuspendableEvent<PlatformQueryResult, Throwable> = SuspendableEvent {\n\n        var spotifyLink =\n            \"https://\" + fullLink.substringAfterLast(\"https://\").substringBefore(\" \").trim()\n\n        if (!spotifyLink.contains(\"open.spotify\")) {\n            // Very Rare instance\n            spotifyLink = resolveLink(spotifyLink)\n        }\n\n        val link = spotifyLink.substringAfterLast('/', \"Error\").substringBefore('?')\n        val type = spotifyLink.substringBeforeLast('/', \"Error\").substringAfterLast('/')\n\n        if (type == \"Error\" || link == \"Error\") {\n            throw SpotiFlyerException.LinkInvalid(fullLink)\n        }\n\n        if (type == \"episode\" || type == \"show\") {\n            throw SpotiFlyerException.FeatureNotImplementedYet(\n                \"Support for Spotify's ${type.toUpperCase()} isn't implemented yet\"\n            )\n        }\n\n        try {\n            spotifySearch(\n                type,\n                link\n            )\n        } catch (e: Exception) {\n            e.printStackTrace()\n            // Try Reinitialising Client // Handle 401 Token Expiry ,etc Exceptions\n            authenticateSpotifyClient(true)\n\n            spotifySearch(\n                type,\n                link\n            )\n        }\n    }\n\n    private suspend fun spotifySearch(\n        type: String,\n        link: String\n    ): PlatformQueryResult {\n        return PlatformQueryResult(\n            folderType = \"\",\n            subFolder = \"\",\n            title = \"\",\n            coverUrl = \"\",\n            trackList = listOf(),\n            Source.Spotify\n        ).apply {\n            when (type) {\n                \"track\" -> {\n                    getTrack(link).also {\n                        folderType = \"Tracks\"\n                        subFolder = \"\"\n                        trackList = listOf(it).toTrackDetailsList(folderType, subFolder)\n                        title = it.name.toString()\n                        coverUrl = it.album?.images?.elementAtOrNull(0)?.url.toString()\n                    }\n                }\n\n                \"album\" -> {\n                    val albumObject = getAlbum(link)\n                    folderType = \"Albums\"\n                    subFolder = albumObject.name.toString()\n                    albumObject.tracks?.items?.forEach { it.album = albumObject }\n\n                    albumObject.tracks?.items?.toTrackDetailsList(folderType, subFolder).let {\n                        if (it.isNullOrEmpty()) {\n                            // TODO Handle Error\n                        } else {\n                            trackList = it\n                            title = albumObject.name.toString()\n                            coverUrl = albumObject.images?.elementAtOrNull(0)?.url.toString()\n                        }\n                    }\n                }\n\n                \"playlist\" -> {\n                    val playlistObject = getPlaylist(link)\n                    folderType = \"Playlists\"\n                    subFolder = playlistObject.name.toString()\n                    val tempTrackList = mutableListOf<Track>().apply {\n                        // Add Fetched Tracks\n                        playlistObject.tracks?.items?.mapNotNull(PlaylistTrack::track)?.let {\n                            addAll(it)\n                        }\n                    }\n\n                    // Check For More Tracks If available\n                    var moreTracksAvailable = !playlistObject.tracks?.next.isNullOrBlank()\n                    while (moreTracksAvailable) {\n                        // Fetch Remaining Tracks\n                        val moreTracks =\n                            getPlaylistTracks(link, offset = tempTrackList.size)\n                        moreTracks.items?.mapNotNull(PlaylistTrack::track)?.let { remTracks ->\n                            tempTrackList.addAll(remTracks)\n                        }\n                        moreTracksAvailable = !moreTracks.next.isNullOrBlank()\n                    }\n\n                    // log(\"Total Tracks Fetched\", tempTrackList.size.toString())\n                    trackList = tempTrackList.toTrackDetailsList(folderType, subFolder)\n                    title = playlistObject.name.toString()\n                    coverUrl = playlistObject.images?.firstOrNull()?.url.toString()\n                }\n                \"episode\" -> { // TODO\n                    throw SpotiFlyerException.FeatureNotImplementedYet()\n                }\n                \"show\" -> { // TODO\n                    throw SpotiFlyerException.FeatureNotImplementedYet()\n                }\n                else -> {\n                    throw SpotiFlyerException.LinkInvalid(\"Provide: Spotify, Type:$type -> Link:$link\")\n                }\n            }\n        }\n    }\n\n    /*\n    * New Link Schema: https://link.tospotify.com/kqTBblrjQbb,\n    * Fetching Standard Link: https://open.spotify.com/playlist/37i9dQZF1DX9RwfGbeGQwP?si=iWz7B1tETiunDntnDo3lSQ&amp;_branch_match_id=862039436205270630\n    * */\n    private suspend fun resolveLink(\n        url: String\n    ): String {\n        val response = getResponse(url)\n        val regex = \"\"\"https://open\\.spotify\\.com.+\\w\"\"\".toRegex()\n        return regex.find(response)?.value.toString()\n    }\n\n    private fun List<Track>.toTrackDetailsList(type: String, subFolder: String) = this.map {\n        TrackDetails(\n            title = it.name.toString(),\n            trackNumber = it.track_number,\n            genre = it.album?.genres?.filterNotNull() ?: emptyList(),\n            artists = it.artists?.map { artist -> artist?.name.toString() } ?: listOf(),\n            albumArtists = it.album?.artists?.mapNotNull { artist -> artist?.name } ?: emptyList(),\n            durationSec = (it.duration_ms / 1000).toInt(),\n            albumArtPath = fileManager.getImageCachePath(it.album?.images?.maxByOrNull { img -> img?.width ?: 0 }?.url ?: \"\"),\n            albumName = it.album?.name,\n            year = it.album?.release_date,\n            comment = \"Genres:${it.album?.genres?.joinToString()}\",\n            trackUrl = it.href,\n            downloaded = it.updateStatusIfPresent(type, subFolder),\n            source = Source.Spotify,\n            albumArtURL = it.album?.images?.maxByOrNull { img -> img?.width ?: 0 }?.url.toString(),\n            outputFilePath = fileManager.finalOutputDir(\n                it.name.toString(),\n                type,\n                subFolder,\n                fileManager.defaultDir()/*,\".m4a\"*/\n            )\n        )\n    }\n\n    private fun Track.updateStatusIfPresent(folderType: String, subFolder: String): DownloadStatus {\n        return if (fileManager.isPresent(\n                fileManager.finalOutputDir(\n                    name.toString(),\n                    folderType,\n                    subFolder,\n                    fileManager.defaultDir()\n                )\n            )\n        ) { // Download Already Present!!\n            DownloadStatus.Downloaded.also {\n                downloaded = it\n            }\n        } else downloaded\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/spotify/requests/SpotifyAuth.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers.spotify.requests\n\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.models.SpotiFlyerException\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.spotify.TokenData\nimport com.shabinder.common.utils.globalJson\nimport io.ktor.client.*\nimport io.ktor.client.features.auth.*\nimport io.ktor.client.features.auth.providers.*\nimport io.ktor.client.features.json.*\nimport io.ktor.client.features.json.serializer.*\nimport io.ktor.client.request.*\nimport io.ktor.client.request.forms.*\nimport io.ktor.http.*\nimport kotlin.native.concurrent.SharedImmutable\n\nsuspend fun authenticateSpotify(): SuspendableEvent<TokenData, Throwable> = SuspendableEvent {\n    if (Actions.instance.isInternetAvailable) {\n        spotifyAuthClient.post(\"https://accounts.spotify.com/api/token\") {\n            body = FormDataContent(Parameters.build {\n                @Suppress(\"EXPERIMENTAL_API_USAGE_FUTURE_ERROR\")\n                append(\"grant_type\", \"client_credentials\")\n            })\n        }\n    } else throw SpotiFlyerException.NoInternetException()\n}\n\n@SharedImmutable\nprivate val spotifyAuthClient by lazy {\n    HttpClient {\n        val (clientId, clientSecret) = PreferenceManager.instance.spotifyCredentials\n\n        install(Auth) {\n            basic {\n                sendWithoutRequest { true }\n                credentials {\n                    BasicAuthCredentials(clientId, clientSecret)\n                }\n            }\n        }\n        install(JsonFeature) {\n            serializer = KotlinxSerializer(globalJson)\n        }\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/spotify/requests/SpotifyRequests.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers.spotify.requests\n\nimport com.shabinder.common.models.NativeAtomicReference\nimport com.shabinder.common.models.corsApi\nimport com.shabinder.common.models.spotify.Album\nimport com.shabinder.common.models.spotify.PagingObjectPlaylistTrack\nimport com.shabinder.common.models.spotify.Playlist\nimport com.shabinder.common.models.spotify.Track\nimport io.github.shabinder.TargetPlatforms\nimport io.github.shabinder.activePlatform\nimport io.ktor.client.*\nimport io.ktor.client.request.*\n\nprivate val BASE_URL get() = \"${corsApi}https://api.spotify.com/v1\"\n\ninterface SpotifyRequests {\n\n    val httpClientRef: NativeAtomicReference<HttpClient>\n    val httpClient: HttpClient get() = httpClientRef.value\n\n    suspend fun authenticateSpotifyClient(override: Boolean = activePlatform is TargetPlatforms.Js)\n\n    suspend fun getPlaylist(playlistID: String): Playlist {\n        return httpClient.get(\"$BASE_URL/playlists/$playlistID\")\n    }\n\n    suspend fun getPlaylistTracks(\n        playlistID: String?,\n        offset: Int = 0,\n        limit: Int = 100\n    ): PagingObjectPlaylistTrack {\n        return httpClient.get(\"$BASE_URL/playlists/$playlistID/tracks?offset=$offset&limit=$limit\")\n    }\n\n    suspend fun getTrack(id: String?): Track {\n        return httpClient.get(\"$BASE_URL/tracks/$id\")\n    }\n\n    suspend fun getEpisode(id: String?): Track {\n        return httpClient.get(\"$BASE_URL/episodes/$id\")\n    }\n\n    suspend fun getShow(id: String?): Track {\n        return httpClient.get(\"$BASE_URL/shows/$id\")\n    }\n\n    suspend fun getAlbum(id: String): Album {\n        return httpClient.get(\"$BASE_URL/albums/$id\")\n    }\n\n    suspend fun getResponse(url: String): String {\n        return httpClient.get(url)\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/spotify/token_store/TokenStore.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers.spotify.token_store\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.database.TokenDBQueries\nimport com.shabinder.common.models.spotify.TokenData\nimport com.shabinder.common.providers.spotify.requests.authenticateSpotify\nimport kotlinx.coroutines.DelicateCoroutinesApi\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.launch\nimport kotlinx.datetime.Clock\n\nclass TokenStore(\n    private val fileManager: FileManager,\n    private val logger: Kermit,\n) {\n    private val db: TokenDBQueries?\n        get() = fileManager.db?.tokenDBQueries\n\n    private fun save(token: TokenData) {\n        if (!token.access_token.isNullOrBlank() && token.expiry != null)\n            db?.add(token.access_token!!, token.expiry!! + Clock.System.now().epochSeconds)\n    }\n\n    @OptIn(DelicateCoroutinesApi::class)\n    suspend fun getToken(): TokenData? {\n        var token: TokenData? = db?.select()?.executeAsOneOrNull()?.let {\n            TokenData(it.accessToken, null, it.expiry)\n        }\n        logger.d { \"System Time:${Clock.System.now().epochSeconds} , Token Expiry:${token?.expiry}\" }\n        if ((Clock.System.now().epochSeconds > (token?.expiry ?: 0)) || token == null) {\n            logger.d { \"Requesting New Token\" }\n            token = authenticateSpotify().component1()\n            GlobalScope.launch { token?.access_token?.let { save(token) } }\n        }\n        return token\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/youtube/YoutubeProvider.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers.youtube\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.file_manager.finalOutputDir\nimport com.shabinder.common.core_components.file_manager.getImageCachePath\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.PlatformQueryResult\nimport com.shabinder.common.models.SpotiFlyerException\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.spotify.Source\nimport com.shabinder.common.utils.removeIllegalChars\nimport io.github.shabinder.YoutubeDownloader\nimport io.github.shabinder.models.Extension\nimport io.github.shabinder.models.YoutubeVideo\nimport io.github.shabinder.models.formats.Format\nimport io.github.shabinder.models.quality.AudioQuality\nimport io.ktor.client.HttpClient\nimport io.ktor.client.request.get\nimport io.ktor.client.statement.HttpStatement\nimport io.ktor.http.HttpStatusCode\nimport com.shabinder.common.models.AudioQuality as Quality\n\nclass YoutubeProvider(\n    private val httpClient: HttpClient,\n    private val logger: Kermit,\n    private val fileManager: FileManager,\n) {\n    val ytDownloader: YoutubeDownloader = YoutubeDownloader(\n        enableCORSProxy = true,\n        CORSProxyAddress = \"https://cors.spotiflyer.ml/cors/\"\n    )\n\n    /*\n    * YT Album Art Schema\n    * HI-RES Url: https://i.ytimg.com/vi/$searchId/maxresdefault.jpg\"\n    * Normal Url: https://i.ytimg.com/vi/$searchId/hqdefault.jpg\"\n    * */\n    private val sampleDomain1 = \"music.youtube.com\"\n    private val sampleDomain2 = \"youtube.com\"\n    private val sampleDomain3 = \"youtu.be\"\n\n    suspend fun query(fullLink: String): SuspendableEvent<PlatformQueryResult, Throwable> {\n        val link = fullLink.removePrefix(\"https://\").removePrefix(\"http://\")\n        if (link.contains(\"playlist\", true) || link.contains(\"list\", true)) {\n            // Given Link is of a Playlist\n            logger.i { link }\n            val playlistId =\n                link.substringAfter(\"?list=\").substringAfter(\"&list=\").substringBefore(\"&\").substringBefore(\"?\")\n            return getYTPlaylist(\n                playlistId\n            )\n        } else { // Given Link is of a Video\n            var searchId = \"error\"\n            when {\n                link.contains(sampleDomain1, true) -> { // Youtube Music\n                    searchId = link.substringAfterLast(\"/\", \"error\").substringBefore(\"&\").substringAfterLast(\"=\")\n                }\n                link.contains(sampleDomain2, true) -> { // Standard Youtube Link\n                    searchId = link.substringAfterLast(\"=\", \"error\").substringBefore(\"&\")\n                }\n                link.contains(sampleDomain3, true) -> { // Shortened Youtube Link\n                    searchId = link.substringAfterLast(\"/\", \"error\").substringBefore(\"&\")\n                }\n            }\n            return if (searchId != \"error\") {\n                getYTTrack(\n                    searchId\n                )\n            } else {\n                logger.d { \"Your Youtube Link is not of a Video!!\" }\n                SuspendableEvent.error(SpotiFlyerException.LinkInvalid(fullLink))\n            }\n        }\n    }\n\n    private suspend fun getYTPlaylist(\n        searchId: String\n    ): SuspendableEvent<PlatformQueryResult, Throwable> = SuspendableEvent {\n        PlatformQueryResult(\n            folderType = \"\",\n            subFolder = \"\",\n            title = \"\",\n            coverUrl = \"\",\n            trackList = listOf(),\n            Source.YouTube\n        ).apply {\n            val playlist = ytDownloader.getPlaylist(searchId)\n            val playlistDetails = playlist.details\n            val name = playlistDetails.title\n            subFolder = removeIllegalChars(name)\n            val videos = playlist.videos\n\n            coverUrl = \"https://i.ytimg.com/vi/${\n                videos.firstOrNull()?.videoId\n            }/hqdefault.jpg\"\n            title = name\n\n            trackList = videos.map {\n                val imageURL = \"https://i.ytimg.com/vi/${it.videoId}/hqdefault.jpg\"\n                TrackDetails(\n                    title = it.title ?: \"N/A\",\n                    artists = listOf(it.author ?: \"N/A\"),\n                    durationSec = it.lengthSeconds,\n                    albumArtPath = fileManager.getImageCachePath(imageURL),\n                    source = Source.YouTube,\n                    albumArtURL = imageURL,\n                    downloaded = if (fileManager.isPresent(\n                            fileManager.finalOutputDir(\n                                itemName = it.title ?: \"N/A\",\n                                type = folderType,\n                                subFolder = subFolder,\n                                fileManager.defaultDir()\n                            )\n                        )\n                    )\n                        DownloadStatus.Downloaded\n                    else {\n                        DownloadStatus.NotDownloaded\n                    },\n                    outputFilePath = fileManager.finalOutputDir(\n                        it.title ?: \"N/A\",\n                        folderType,\n                        subFolder,\n                        fileManager.defaultDir()/*,\".m4a\"*/\n                    ),\n                    videoID = it.videoId\n                )\n            }\n        }\n    }\n\n    @Suppress(\"DefaultLocale\")\n    private suspend fun getYTTrack(\n        searchId: String,\n    ): SuspendableEvent<PlatformQueryResult, Throwable> = SuspendableEvent {\n        PlatformQueryResult(\n            folderType = \"\",\n            subFolder = \"\",\n            title = \"\",\n            coverUrl = \"\",\n            trackList = listOf(),\n            Source.YouTube\n        ).apply {\n            val video = ytDownloader.getVideo(searchId)\n            coverUrl = \"https://i.ytimg.com/vi/$searchId/hqdefault.jpg\"\n            val detail = video.videoDetails\n            val name = detail.title?.replace(detail.author?.toUpperCase() ?: \"\", \"\", true)\n                ?: detail.title ?: \"\"\n            // logger.i{ detail.toString() }\n            trackList = listOf(\n                TrackDetails(\n                    title = name,\n                    artists = listOf(detail.author ?: \"N/A\"),\n                    durationSec = detail.lengthSeconds,\n                    albumArtPath = fileManager.getImageCachePath(coverUrl),\n                    source = Source.YouTube,\n                    albumArtURL = coverUrl,\n                    downloaded = if (fileManager.isPresent(\n                            fileManager.finalOutputDir(\n                                itemName = name,\n                                type = folderType,\n                                subFolder = subFolder,\n                                defaultDir = fileManager.defaultDir()\n                            )\n                        )\n                    )\n                        DownloadStatus.Downloaded\n                    else {\n                        DownloadStatus.NotDownloaded\n                    },\n                    outputFilePath = fileManager.finalOutputDir(\n                        name,\n                        folderType,\n                        subFolder,\n                        fileManager.defaultDir()/*,\".m4a\"*/\n                    ),\n                    videoID = searchId\n                )\n            )\n            title = name\n        }\n    }\n\n    suspend fun fetchVideoM4aLink(videoId: String, retryCount: Int = 3): Pair<String, Quality> {\n        @Suppress(\"NAME_SHADOWING\")\n        var retryCount = retryCount\n        var validM4aLink: String? = null\n        var audioQuality: Quality = Quality.KBPS128\n\n        val ex = SpotiFlyerException.DownloadLinkFetchFailed(\"Manual Extraction Failed for VideoID: $videoId\")\n        while (validM4aLink.isNullOrEmpty() && retryCount > 0) {\n            val m4aLink = ytDownloader.getVideo(videoId).getM4aLink()?.also {\n                audioQuality =\n                    if (it.bitrate > 160_000) Quality.KBPS192 else Quality.KBPS128\n            }?.url\n                ?: throw ex\n\n            if (validateLink(m4aLink)) {\n                validM4aLink = m4aLink\n            }\n            retryCount--\n        }\n\n        if (validM4aLink.isNullOrBlank())\n            throw ex\n\n        return validM4aLink to audioQuality\n    }\n\n    private suspend fun validateLink(link: String): Boolean {\n        var status = HttpStatusCode.BadRequest\n        httpClient.get<HttpStatement>(link).execute { res -> status = res.status }\n        return status == HttpStatusCode.OK\n    }\n\n    private fun YoutubeVideo.getM4aLink(): Format? {\n        return getAudioWithQuality(AudioQuality.high).firstOrNull { it.extension == Extension.M4A }\n            ?: getAudioWithQuality(AudioQuality.medium).firstOrNull { it.extension == Extension.M4A }\n            ?: getAudioWithQuality(AudioQuality.low).firstOrNull { it.extension == Extension.M4A }\n    }\n}\n\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/youtube_music/YoutubeMusic.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers.youtube_music\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.models.AudioFormat\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.SpotiFlyerException\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.YoutubeTrack\nimport com.shabinder.common.models.corsApi\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.event.coroutines.flatMap\nimport com.shabinder.common.models.event.coroutines.flatMapError\nimport com.shabinder.common.models.event.coroutines.map\nimport com.shabinder.common.models.event.coroutines.onFailure\nimport com.shabinder.common.providers.youtube.YoutubeProvider\nimport com.shabinder.common.providers.youtube_to_mp3.requests.YoutubeMp3\nimport com.shabinder.common.utils.appendPadded\nimport io.github.shabinder.fuzzywuzzy.diffutils.FuzzySearch\nimport io.ktor.client.HttpClient\nimport io.ktor.client.request.header\nimport io.ktor.client.request.headers\nimport io.ktor.client.request.post\nimport io.ktor.http.ContentType\nimport io.ktor.http.HttpHeaders\nimport io.ktor.http.contentType\nimport kotlinx.serialization.json.Json\nimport kotlinx.serialization.json.JsonArray\nimport kotlinx.serialization.json.buildJsonArray\nimport kotlinx.serialization.json.buildJsonObject\nimport kotlinx.serialization.json.contentOrNull\nimport kotlinx.serialization.json.jsonArray\nimport kotlinx.serialization.json.jsonObject\nimport kotlinx.serialization.json.jsonPrimitive\nimport kotlinx.serialization.json.put\nimport kotlinx.serialization.json.putJsonObject\nimport kotlin.collections.set\nimport kotlin.math.absoluteValue\n\nclass YoutubeMusic constructor(\n    private val logger: Kermit,\n    private val httpClient: HttpClient,\n    private val youtubeProvider: YoutubeProvider,\n    private val youtubeMp3: YoutubeMp3,\n    private val fileManager: FileManager,\n) {\n    companion object {\n        const val apiKey = \"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30\"\n        const val tag = \"YT Music\"\n    }\n\n    // Get Downloadable Link\n    suspend fun findSongDownloadURLYT(\n        trackDetails: TrackDetails,\n        preferredQuality: AudioQuality = fileManager.preferenceManager.audioQuality,\n        errorReportBuilder: StringBuilder? = null\n    ): SuspendableEvent<Triple<String, AudioQuality, AudioFormat>, Throwable> {\n        return getYTIDBestMatch(trackDetails).flatMap { videoID ->\n            // As YT compress Audio hence there is no benefit of quality for more than 192\n            val optimalQuality =\n                if ((preferredQuality.kbps.toIntOrNull()\n                        ?: 0) > 192\n                ) AudioQuality.KBPS192 else preferredQuality\n            // 1 Try getting Link from Yt1s\n            youtubeMp3.getMp3DownloadLink(videoID, optimalQuality).map {\n                Triple(it, optimalQuality, AudioFormat.MP3)\n            }.flatMapError {\n                errorReportBuilder?.appendPadded(\n                    \"Yt1sMp3 Failed for $videoID:\", it.stackTraceToString()\n                )\n                // 2 if Yt1s failed , Extract Manually\n                errorReportBuilder?.appendPadded(\"Extracting Manually...\")\n                SuspendableEvent {\n                    youtubeProvider.fetchVideoM4aLink(videoID)\n                }.onFailure { throwable ->\n                    errorReportBuilder?.appendPadded(\"YT Manual Extraction Failed!\", throwable.stackTraceToString())\n                }.map { (URL, quality) ->\n                    Triple(URL, quality, AudioFormat.MP4)\n                }\n            }\n        }\n    }\n\n    private suspend fun getYTIDBestMatch(\n        trackDetails: TrackDetails\n    ): SuspendableEvent<String, Throwable> =\n        getYTTracks(\"${trackDetails.title} - ${trackDetails.artists.joinToString(\",\")}\").map { matchList ->\n            sortByBestMatch(\n                matchList,\n                trackName = trackDetails.title,\n                trackArtists = trackDetails.artists,\n                trackDurationSec = trackDetails.durationSec\n            ).also { logger.d(\"YT-M Matches:\") { it.entries.joinToString(\"\\n\") { \"${it.key} --- ${it.value}\" } } }.keys.firstOrNull()\n                ?: throw SpotiFlyerException.NoMatchFound(trackDetails.title)\n        }\n\n    private suspend fun getYTTracks(query: String): SuspendableEvent<List<YoutubeTrack>, Throwable> =\n        getYoutubeMusicResponse(query).map { youtubeResponseData ->\n            val youtubeTracks = mutableListOf<YoutubeTrack>()\n            val responseObj = Json.parseToJsonElement(youtubeResponseData)\n            // logger.i { \"Youtube Music Response Received\" }\n            val contentBlocks = responseObj.jsonObject[\"contents\"]\n                ?.jsonObject?.get(\"tabbedSearchResultsRenderer\")\n                ?.jsonObject?.get(\"tabs\")?.jsonArray?.get(0)\n                ?.jsonObject?.get(\"tabRenderer\")\n                ?.jsonObject?.get(\"content\")\n                ?.jsonObject?.get(\"sectionListRenderer\")\n                ?.jsonObject?.get(\"contents\")?.jsonArray\n\n            val resultBlocks = mutableListOf<JsonArray>()\n            if (contentBlocks != null) {\n                for (cBlock in contentBlocks) {\n                    /**\n                     *Ignore user-suggestion\n                     *The 'itemSectionRenderer' field is for user notices (stuff like - 'showing\n                     *results for xyz, search for abc instead') we have no use for them, the for\n                     *loop below if throw a keyError if we don't ignore them\n                     */\n                    if (cBlock.jsonObject.containsKey(\"itemSectionRenderer\")) {\n                        continue\n                    }\n\n                    for (\n                    contents in cBlock.jsonObject[\"musicShelfRenderer\"]?.jsonObject?.get(\"contents\")?.jsonArray\n                        ?: listOf()\n                    ) {\n                        /**\n                         *  apparently content Blocks without an 'overlay' field don't have linkBlocks\n                         *  I have no clue what they are and why there even exist\n                         *\n                        if(!contents.containsKey(\"overlay\")){\n                        println(contents)\n                        continue\n                        TODO check and correct\n                        }*/\n\n                        val result = contents.jsonObject[\"musicResponsiveListItemRenderer\"]\n                            ?.jsonObject?.get(\"flexColumns\")?.jsonArray\n\n                        // Add the linkBlock\n                        val linkBlock = contents.jsonObject[\"musicResponsiveListItemRenderer\"]\n                            ?.jsonObject?.get(\"overlay\")\n                            ?.jsonObject?.get(\"musicItemThumbnailOverlayRenderer\")\n                            ?.jsonObject?.get(\"content\")\n                            ?.jsonObject?.get(\"musicPlayButtonRenderer\")\n                            ?.jsonObject?.get(\"playNavigationEndpoint\")\n\n                        // detailsBlock is always a list, so we just append the linkBlock to it\n                        // instead of carrying along all the other junk from \"musicResponsiveListItemRenderer\"\n                        val finalResult = buildJsonArray {\n                            result?.let { add(it) }\n                            linkBlock?.let { add(it) }\n                        }\n                        resultBlocks.add(finalResult)\n                    }\n                }\n\n                /* We only need results that are Songs or Videos, so we filter out the rest, since\n                ! Songs and Videos are supplied with different details, extracting all details from\n                ! both is just carrying on redundant data, so we also have to selectively extract\n                ! relevant details. What you need to know to understand how we do that here:\n                !\n                ! Songs details are ALWAYS in the following order:\n                !       0 - Name\n                !       1 - Type (Song)\n                !       2 - com.shabinder.spotiflyer.models.gaana.Artist\n                !       3 - Album\n                !       4 - Duration (mm:ss)\n                !\n                ! Video details are ALWAYS in the following order:\n                !       0 - Name\n                !       1 - Type (Video)\n                !       2 - Channel\n                !       3 - Viewers\n                !       4 - Duration (hh:mm:ss)\n                !\n                ! We blindly gather all the details we get our hands on, then\n                ! cherry-pick the details we need based on  their index numbers,\n                ! we do so only if their Type is 'Song' or 'Video\n                */\n\n                for (result in resultBlocks) {\n\n                    // Blindly gather available details\n                    val availableDetails = mutableListOf<String>()\n\n                    /*\n                    Filter Out dummies here itself\n                    ! 'musicResponsiveListItemFlexColumnRenderer' should have more that one\n                    ! sub-block, if not it is a dummy, why does the YTM response contain dummies?\n                    ! I have no clue. We skip these.\n\n                    ! Remember that we appended the linkBlock to result, treating that like the\n                    ! other constituents of a result block will lead to errors, hence the 'in\n                    ! result[:-1] ,i.e., skip last element in array '\n                    */\n                    for (detailArray in result.subList(0, result.size - 1)) {\n                        for (detail in detailArray.jsonArray) {\n                            if ((detail.jsonObject[\"musicResponsiveListItemFlexColumnRenderer\"]?.jsonObject?.size\n                                    ?: 0) < 2\n                            ) continue\n\n                            // if not a dummy, collect All Variables\n                            val details =\n                                detail.jsonObject[\"musicResponsiveListItemFlexColumnRenderer\"]\n                                    ?.jsonObject?.get(\"text\")\n                                    ?.jsonObject?.get(\"runs\")?.jsonArray ?: listOf()\n\n                            for (d in details) {\n                                d.jsonObject[\"text\"]?.jsonPrimitive?.contentOrNull?.let {\n                                    if (it != \" • \") {\n                                        availableDetails.add(it)\n                                    }\n                                }\n                            }\n                        }\n                    }\n                    // logger.d(\"YT Music details\"){availableDetails.toString()}\n                    /*\n                    ! Filter Out non-Song/Video results and incomplete results here itself\n                    ! From what we know about detail order, note that [1] - indicate result type\n                    */\n                    if (availableDetails.size == 5 && availableDetails[1] in listOf(\n                            \"Song\",\n                            \"Video\"\n                        )\n                    ) {\n\n                        // skip if result is in hours instead of minutes (no song is that long)\n                        if (availableDetails[4].split(':').size != 2) continue\n\n                        /*\n                        ! grab Video ID\n                        ! this is nested as [playlistEndpoint/watchEndpoint][videoId/playlistId/...]\n                        ! so hardcoding the dict keys for data look up is an ardours process, since\n                        ! the sub-block pattern is fixed even though the key isn't, we just\n                        ! reference the dict keys by index\n                        */\n\n                        val videoId: String? =\n                            result.last().jsonObject[\"watchEndpoint\"]?.jsonObject?.get(\"videoId\")?.jsonPrimitive?.content\n                        val ytTrack = YoutubeTrack(\n                            name = availableDetails[0],\n                            type = availableDetails[1],\n                            artist = availableDetails[2],\n                            duration = availableDetails[4],\n                            videoId = videoId\n                        )\n                        youtubeTracks.add(ytTrack)\n                    }\n                }\n            }\n            // logger.d {youtubeTracks.joinToString(\"\\n\")}\n            youtubeTracks\n        }\n\n    fun sortByBestMatch(\n        ytTracks: List<YoutubeTrack>,\n        trackName: String,\n        trackArtists: List<String>,\n        trackDurationSec: Int,\n    ): Map<String, Float> {\n        /*\n        * \"linksWithMatchValue\" is map with Youtube VideoID and its rating/match with 100 as Max Value\n        **/\n        val linksWithMatchValue = mutableMapOf<String, Float>()\n\n        for (result in ytTracks) {\n\n            // LoweCasing Name to match Properly\n            // most song results on youtube go by $artist - $songName or artist1/artist2\n            var hasCommonWord = false\n\n            val resultName = result.name?.toLowerCase()?.replace(\"-\", \" \")?.replace(\"/\", \" \") ?: \"\"\n            val trackNameWords = trackName.toLowerCase().split(\" \")\n\n            for (nameWord in trackNameWords) {\n                if (nameWord.isNotBlank() && FuzzySearch.partialRatio(\n                        nameWord,\n                        resultName\n                    ) > 85\n                ) hasCommonWord = true\n            }\n\n            // Skip this Result if No Word is Common in Name\n            if (!hasCommonWord) {\n                logger.d(\"YT Api Removing No common Word\") { result.toString() }\n                continue\n            }\n\n            // Find artist match\n            // Will Be Using Fuzzy Search Because YT Spelling might be mucked up\n            // match  = (no of artist names in result) / (no. of artist names on spotify) * 100\n            var artistMatchNumber = 0F\n\n            if (result.type == \"Song\") {\n                for (artist in trackArtists) {\n                    if (FuzzySearch.ratio(\n                            artist.toLowerCase(),\n                            result.artist?.toLowerCase() ?: \"\"\n                        ) > 85\n                    )\n                        artistMatchNumber++\n                }\n            } else { // i.e. is a Video\n                for (artist in trackArtists) {\n                    if (FuzzySearch.partialRatio(\n                            artist.toLowerCase(),\n                            result.name?.toLowerCase() ?: \"\"\n                        ) > 85\n                    )\n                        artistMatchNumber++\n                }\n            }\n\n            if (artistMatchNumber == 0F) {\n                logger.d { \"YT Api Removing Artist Match 0:   $result\" }\n                continue\n            }\n\n            val artistMatch = (artistMatchNumber / trackArtists.size.toFloat()) * 100F\n\n            // Duration Match\n            /*! time match = 100 - (delta(duration)**2 / original duration * 100)\n            ! difference in song duration (delta) is usually of the magnitude of a few\n            ! seconds, we need to amplify the delta if it is to have any meaningful impact\n            ! wen we calculate the avg match value*/\n            val difference: Float = result.duration?.split(\":\")?.get(0)?.toFloat()?.times(60)\n                ?.plus(result.duration?.split(\":\")?.get(1)?.toFloat() ?: 0F)\n                ?.minus(trackDurationSec)?.absoluteValue ?: 0F\n            val nonMatchValue: Float = ((difference * difference) / trackDurationSec.toFloat())\n            val durationMatch: Float = 100 - (nonMatchValue * 100F)\n\n            val avgMatch: Float = (artistMatch + durationMatch) / 2F\n            linksWithMatchValue[result.videoId.toString()] = avgMatch\n        }\n        // logger.d(\"YT Api Result\"){\"$trackName - $linksWithMatchValue\"}\n        return linksWithMatchValue.toList().sortedByDescending { it.second }.toMap().also {\n            logger.d(tag) { \"Match Found for $trackName - ${!it.isNullOrEmpty()}  ${it.keys.firstOrNull() ?: \"\"}\" }\n        }\n    }\n\n    private suspend fun getYoutubeMusicResponse(query: String): SuspendableEvent<String, Throwable> =\n        SuspendableEvent {\n            httpClient.post(\"${corsApi}https://music.youtube.com/youtubei/v1/search?alt=json&key=$apiKey\") {\n                headers {\n                    append(HttpHeaders.ContentType, ContentType.Application.Json.toString())\n                    append(\"referer\", \"https://music.youtube.com/search\")\n                }\n                body = buildJsonObject {\n                    putJsonObject(\"context\") {\n                        putJsonObject(\"client\") {\n                            put(\"clientName\", \"WEB_REMIX\")\n                            put(\"clientVersion\", \"0.1\")\n                        }\n                    }\n                    put(\"query\", query)\n                }\n            }\n        }\n}\n"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/youtube_to_mp3/requests/YoutubeMp3.kt",
    "content": "package com.shabinder.common.providers.youtube_to_mp3.requests\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.corsApi\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.event.coroutines.map\nimport io.ktor.client.*\n\nclass YoutubeMp3(\n    override val httpClient: HttpClient,\n    override val logger: Kermit\n) : Yt1sMp3 {\n    suspend fun getMp3DownloadLink(videoID: String, quality: AudioQuality): SuspendableEvent<String, Throwable> =\n        getLinkFromYt1sMp3(videoID, quality).map {\n            corsApi + it\n        }\n}"
  },
  {
    "path": "common/providers/src/commonMain/kotlin/com.shabinder.common.providers/youtube_to_mp3/requests/Yt1sMp3.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers.youtube_to_mp3.requests\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.corsApi\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.common.models.event.coroutines.flatMap\nimport com.shabinder.common.models.event.coroutines.map\nimport com.shabinder.common.utils.requireNotNull\nimport io.github.shabinder.utils.getJsonObject\nimport io.ktor.client.*\nimport io.ktor.client.request.*\nimport io.ktor.client.request.forms.*\nimport io.ktor.http.*\nimport kotlinx.serialization.json.JsonObject\nimport kotlinx.serialization.json.jsonPrimitive\n\n/*\n* site link: https://yt1s.com/youtube-to-mp3/en1\n* Provides Direct Mp3 , No Need For FFmpeg\n* */\ninterface Yt1sMp3 {\n\n    val httpClient: HttpClient\n    val logger: Kermit\n\n    /*\n    * Downloadable Mp3 Link for YT videoID.\n    * */\n    suspend fun getLinkFromYt1sMp3(videoID: String, quality: AudioQuality): SuspendableEvent<String, Throwable> = getKey(videoID, quality).flatMap { key ->\n        getConvertedMp3Link(videoID, key).map {\n            it[\"dlink\"].requireNotNull()\n                .jsonPrimitive.content.replace(\"\\\"\", \"\")\n        }\n    }\n\n    /*\n    * POST:https://yt1s.com/api/ajaxSearch/index\n    * Body Form= q:yt video link ,vt:format=mp3\n    * */\n    private suspend fun getKey(videoID: String, quality: AudioQuality): SuspendableEvent<String, Throwable> = SuspendableEvent {\n        val response: JsonObject = httpClient.post(\"${corsApi}https://yt1s.com/api/ajaxSearch/index\") {\n            body = FormDataContent(\n                Parameters.build {\n                    append(\"q\", \"https://www.youtube.com/watch?v=$videoID\")\n                    append(\"vt\", \"mp3\")\n                }\n            )\n        }\n\n        val mp3Keys = response.getJsonObject(\"links\")\n            .getJsonObject(\"mp3\")\n\n        // This Site now only gives 128kbps mp3 which is reasonable\n        val requestedKBPS = when (quality) {\n            AudioQuality.KBPS128 -> \"mp3128\"\n            else -> \"mp3128\"//quality.kbps\n        }\n\n        val specificQualityKey = mp3Keys.getJsonObject(requestedKBPS)\n            ?: // Try M4a Link\n            response.getJsonObject(\"links\").getJsonObject(\"m4a\").getJsonObject(\"140\")\n\n        specificQualityKey?.get(\"k\").requireNotNull().jsonPrimitive.content\n    }\n\n    private suspend fun getConvertedMp3Link(videoID: String, key: String): SuspendableEvent<JsonObject, Throwable> = SuspendableEvent {\n        httpClient.post(\"${corsApi}https://yt1s.com/api/ajaxConvert/convert\") {\n            body = FormDataContent(\n                Parameters.build {\n                    append(\"vid\", videoID)\n                    append(\"k\", key)\n                }\n            )\n        }\n    }\n}\n"
  },
  {
    "path": "common/providers/src/commonTest/kotlin/com/shabinder/common/providers/TestSpotifyTrackMatching.kt",
    "content": "package com.shabinder.common.providers\n\nimport com.shabinder.common.core_components.utils.createHttpClient\nimport com.shabinder.common.core_components.utils.getFinalUrl\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.providers.utils.CommonUtils\nimport com.shabinder.common.providers.utils.SpotifyUtils\nimport com.shabinder.common.providers.utils.SpotifyUtils.toTrackDetailsList\nimport io.github.shabinder.runBlocking\nimport kotlinx.serialization.InternalSerializationApi\nimport kotlin.test.Test\n\nclass TestSpotifyTrackMatching {\n\n    companion object {\n        const val SPOTIFY_TRACK_ID = \"58f4twRnbZOOVUhMUpplJ4\"\n        const val SPOTIFY_TRACK_LINK = \"https://open.spotify.com/track/$SPOTIFY_TRACK_ID?si=e45de595053e4ee2\"\n        const val EXPECTED_YT_VIDEO_ID = \"VNs_cCtdbPc\"\n    }\n\n    private val spotifyToken: String?\n        get() = null\n\n    //    get() = \"BQB41HqrLcrh5eRYaL97GvaH6tRe-1EktQ8VGTWUQuFnYVWBEoTcF7T_8ogqVn1GHl9HCcMiQ0HBT-ybC74\"\n    @OptIn(InternalSerializationApi::class)\n    @Test\n    fun testRandomThing() = runBlocking {\n        val res = createHttpClient().getFinalUrl(\"https://soundcloud.app.goo.gl/vrBzR\")\n        println(res)\n    }\n\n\n    @Test\n    fun matchVideo() = runBlocking {\n        val spotifyRequests = SpotifyUtils.getSpotifyRequests(spotifyToken)\n\n        val trackDetails: TrackDetails = spotifyRequests.getTrack(SPOTIFY_TRACK_ID).toTrackDetailsList()\n        println(\"TRACK_DETAILS: $trackDetails\")\n\n//        val matched = CommonUtils.youtubeMusic.getYTTracks(CommonUtils.getYTQueryString(trackDetails))\n//        println(\"YT-MATCHES: \\n ${matched.component1()?.joinToString(\"\\n\")} \\n\")\n        val ytMatch = CommonUtils.youtubeMusic.findSongDownloadURLYT(trackDetails)\n        println(\"YT MATCH: $ytMatch\")\n    }\n}"
  },
  {
    "path": "common/providers/src/commonTest/kotlin/com/shabinder/common/providers/placeholders/FileManager.kt",
    "content": "package com.shabinder.common.providers.placeholders\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.picture.Picture\nimport com.shabinder.common.database.getLogger\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\nimport com.shabinder.database.Database\n\nval FileManagerPlaceholder = object : FileManager {\n    override val logger: Kermit = Kermit(getLogger())\n    override val preferenceManager = PreferenceManagerPlaceholder\n    override val mediaConverter = MediaConverterPlaceholder\n\n    override val db: Database? = null\n\n    override fun isPresent(path: String): Boolean = false\n\n    override fun fileSeparator(): String  = \"/\"\n\n    override fun defaultDir(): String  = \"/\"\n\n    override fun imageCacheDir(): String = \"/\"\n\n    override fun createDirectory(dirPath: String) {}\n\n    override suspend fun cacheImage(image: Any, path: String) {}\n\n    override suspend fun loadImage(url: String, reqWidth: Int, reqHeight: Int): Picture {\n        TODO(\"Not yet implemented\")\n    }\n\n    override suspend fun clearCache() {}\n\n    override suspend fun saveFileWithMetadata(\n        mp3ByteArray: ByteArray,\n        trackDetails: TrackDetails,\n        postProcess: (track: TrackDetails) -> Unit\n    ): SuspendableEvent<String, Throwable> = SuspendableEvent.success(\"\")\n\n    override fun addToLibrary(path: String) {}\n}"
  },
  {
    "path": "common/providers/src/commonTest/kotlin/com/shabinder/common/providers/placeholders/MediaConverter.kt",
    "content": "package com.shabinder.common.providers.placeholders\n\nimport com.shabinder.common.core_components.media_converter.MediaConverter\nimport com.shabinder.common.models.AudioQuality\nimport com.shabinder.common.models.event.coroutines.SuspendableEvent\n\nval MediaConverterPlaceholder = object : MediaConverter() {\n    override suspend fun convertAudioFile(\n        inputFilePath: String,\n        outputFilePath: String,\n        audioQuality: AudioQuality,\n        progressCallbacks: (Long) -> Unit\n    ): SuspendableEvent<String, Throwable> = SuspendableEvent.success(\"\")\n}"
  },
  {
    "path": "common/providers/src/commonTest/kotlin/com/shabinder/common/providers/placeholders/PreferenceManager.kt",
    "content": "package com.shabinder.common.providers.placeholders\n\nimport com.russhwolf.settings.Settings\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\n\nprivate val settings = object : Settings {\n    override val keys: Set<String> = setOf()\n    override val size: Int = 0\n    override fun clear() {}\n    override fun getBoolean(key: String, defaultValue: Boolean): Boolean = false\n    override fun getBooleanOrNull(key: String): Boolean? = null\n    override fun getDouble(key: String, defaultValue: Double): Double = 0.0\n    override fun getDoubleOrNull(key: String): Double? = null\n    override fun getFloat(key: String, defaultValue: Float): Float = 0f\n    override fun getFloatOrNull(key: String): Float? = null\n    override fun getInt(key: String, defaultValue: Int): Int = 0\n    override fun getIntOrNull(key: String): Int? = null\n    override fun getLong(key: String, defaultValue: Long): Long = 0L\n    override fun getLongOrNull(key: String): Long? = null\n    override fun getString(key: String, defaultValue: String): String = \"\"\n    override fun getStringOrNull(key: String): String? = null\n    override fun hasKey(key: String): Boolean = false\n    override fun putBoolean(key: String, value: Boolean) {}\n    override fun putDouble(key: String, value: Double) {}\n    override fun putFloat(key: String, value: Float) {}\n    override fun putInt(key: String, value: Int) {}\n    override fun putLong(key: String, value: Long) {}\n    override fun putString(key: String, value: String) {}\n    override fun remove(key: String) {}\n}\nval PreferenceManagerPlaceholder = PreferenceManager(settings)\n"
  },
  {
    "path": "common/providers/src/commonTest/kotlin/com/shabinder/common/providers/utils/CommonUtils.kt",
    "content": "package com.shabinder.common.providers.utils\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.utils.createHttpClient\nimport com.shabinder.common.database.getLogger\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.providers.placeholders.FileManagerPlaceholder\nimport com.shabinder.common.providers.youtube.YoutubeProvider\nimport com.shabinder.common.providers.youtube_music.YoutubeMusic\nimport com.shabinder.common.providers.youtube_to_mp3.requests.YoutubeMp3\n\nobject CommonUtils {\n    val httpClient by lazy { createHttpClient() }\n    val logger by lazy { Kermit(getLogger()) }\n    val youtubeProvider by lazy { YoutubeProvider(httpClient, logger, FileManagerPlaceholder) }\n    val youtubeMp3 = YoutubeMp3(httpClient, logger)\n    val youtubeMusic = YoutubeMusic(logger, httpClient, youtubeProvider, youtubeMp3, FileManagerPlaceholder)\n\n    fun getYTQueryString(trackDetails: TrackDetails) = \"${trackDetails.title} - ${trackDetails.artists.joinToString(\",\")}\"\n}"
  },
  {
    "path": "common/providers/src/commonTest/kotlin/com/shabinder/common/providers/utils/SpotifyUtils.kt",
    "content": "package com.shabinder.common.providers.utils\n\nimport com.shabinder.common.core_components.file_manager.finalOutputDir\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.NativeAtomicReference\nimport com.shabinder.common.models.SpotiFlyerException\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.spotify.Source\nimport com.shabinder.common.models.spotify.Track\nimport com.shabinder.common.providers.spotify.requests.SpotifyRequests\nimport com.shabinder.common.providers.spotify.requests.authenticateSpotify\nimport com.shabinder.common.utils.globalJson\nimport io.ktor.client.*\nimport io.ktor.client.features.*\nimport io.ktor.client.features.json.*\nimport io.ktor.client.features.json.serializer.*\nimport io.ktor.client.request.*\n\nobject SpotifyUtils {\n\n    suspend fun getSpotifyRequests(spotifyToken: String? = null): SpotifyRequests {\n        val spotifyClient = getSpotifyClient(spotifyToken)\n        return object : SpotifyRequests {\n            override val httpClientRef: NativeAtomicReference<HttpClient> = NativeAtomicReference(spotifyClient)\n            override suspend fun authenticateSpotifyClient(override: Boolean) { httpClientRef.value = getSpotifyClient(spotifyToken) }\n        }\n    }\n\n    suspend fun getSpotifyClient(spotifyToken: String? = null): HttpClient {\n        val token = spotifyToken ?: authenticateSpotify().component1()?.access_token\n        return if (token == null) {\n            println(\"Spotify Auth Failed: Please Check your Network Connection\")\n            throw SpotiFlyerException.NoInternetException()\n        } else {\n            println(\"Spotify Token: $token\")\n            HttpClient {\n                defaultRequest {\n                    header(\"Authorization\", \"Bearer $token\")\n                }\n                install(JsonFeature) {\n                    serializer = KotlinxSerializer(globalJson)\n                }\n            }\n        }\n    }\n\n    fun Track.toTrackDetailsList(type: String = \"Track\", subFolder: String = \"SpotifyFolder\") = let {\n        TrackDetails(\n            title = it.name.toString(),\n            trackNumber = it.track_number,\n            genre = it.album?.genres?.filterNotNull() ?: emptyList(),\n            artists = it.artists?.map { artist -> artist?.name.toString() } ?: listOf(),\n            albumArtists = it.album?.artists?.mapNotNull { artist -> artist?.name } ?: emptyList(),\n            durationSec = (it.duration_ms / 1000).toInt(),\n            albumArtPath = (it.album?.images?.firstOrNull()?.url.toString()).substringAfterLast(\n                '/'\n            ) + \".jpeg\",\n            albumName = it.album?.name,\n            year = it.album?.release_date,\n            comment = \"Genres:${it.album?.genres?.joinToString()}\",\n            trackUrl = it.href,\n            downloaded = DownloadStatus.NotDownloaded,\n            source = Source.Spotify,\n            albumArtURL = it.album?.images?.firstOrNull()?.url.toString(),\n            outputFilePath = \"\"\n        )\n    }\n}"
  },
  {
    "path": "common/providers/src/desktopMain/kotlin/com/shabinder/common/providers/DesktopActual.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers\n\nimport com.shabinder.common.core_components.file_manager.DownloadProgressFlow\nimport com.shabinder.common.core_components.file_manager.DownloadScope\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.file_manager.downloadFile\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.SpotiFlyerException\nimport com.shabinder.common.models.TrackDetails\nimport kotlinx.coroutines.flow.collect\n\nactual suspend fun downloadTracks(\n    list: List<TrackDetails>,\n    fetcher: FetchPlatformQueryResult,\n    fileManager: FileManager\n) {\n    list.forEach { trackDetails ->\n        DownloadScope.executeSuspending { // Send Download to Pool.\n            fetcher.findBestDownloadLink(trackDetails).fold(\n                success = { res ->\n                    trackDetails.audioQuality = res.second\n                    downloadFile(res.first).collect {\n                        when (it) {\n                            is DownloadResult.Error -> {\n                                DownloadProgressFlow.emit(\n                                    DownloadProgressFlow.replayCache.getOrElse(\n                                        0\n                                    ) { hashMapOf() }.apply {\n                                        set(\n                                            trackDetails.title,\n                                            DownloadStatus.Failed(\n                                                it.cause ?: SpotiFlyerException.UnknownReason(it.cause)\n                                            )\n                                        )\n                                    }\n                                )\n                            }\n                            is DownloadResult.Progress -> {\n                                DownloadProgressFlow.emit(\n                                    DownloadProgressFlow.replayCache.getOrElse(\n                                        0\n                                    ) { hashMapOf() }\n                                        .apply { set(trackDetails.title, DownloadStatus.Downloading(it.progress)) }\n                                )\n                            }\n                            is DownloadResult.Success -> { // Todo clear map\n                                DownloadProgressFlow.emit(\n                                    DownloadProgressFlow.replayCache.getOrElse(\n                                        0\n                                    ) { hashMapOf() }.apply { set(trackDetails.title, DownloadStatus.Converting) }\n                                )\n                                fileManager.saveFileWithMetadata(it.byteArray, trackDetails).fold(\n                                    failure = {\n                                        DownloadProgressFlow.emit(\n                                            DownloadProgressFlow.replayCache.getOrElse(\n                                                0\n                                            ) { hashMapOf() }.apply { set(trackDetails.title, DownloadStatus.Failed(it)) }\n                                        )\n                                    },\n                                    success = {\n                                        DownloadProgressFlow.emit(\n                                            DownloadProgressFlow.replayCache.getOrElse(\n                                                0\n                                            ) { hashMapOf() }.apply { set(trackDetails.title, DownloadStatus.Downloaded) }\n                                        )\n                                    }\n                                )\n                            }\n                        }\n                    }\n                },\n                failure = { error ->\n                    DownloadProgressFlow.emit(\n                        DownloadProgressFlow.replayCache.getOrElse(\n                            0\n                        ) { hashMapOf() }.apply { set(trackDetails.title, DownloadStatus.Failed(error)) }\n                    )\n                }\n            )\n        }\n    }\n}\n"
  },
  {
    "path": "common/providers/src/desktopMain/kotlin/com/shabinder/common/providers/saavn/requests/decryptURL.kt",
    "content": "package com.shabinder.common.providers.saavn.requests\n\nimport io.ktor.util.*\nimport java.security.SecureRandom\nimport javax.crypto.Cipher\nimport javax.crypto.SecretKey\nimport javax.crypto.SecretKeyFactory\nimport javax.crypto.spec.DESKeySpec\n\n@Suppress(\"GetInstance\")\n@OptIn(InternalAPI::class)\nactual suspend fun decryptURL(url: String): String {\n    val dks = DESKeySpec(\"38346591\".toByteArray())\n    val keyFactory = SecretKeyFactory.getInstance(\"DES\")\n    val key: SecretKey = keyFactory.generateSecret(dks)\n\n    val cipher: Cipher = Cipher.getInstance(\"DES/ECB/PKCS5Padding\").apply {\n        init(Cipher.DECRYPT_MODE, key, SecureRandom())\n    }\n\n    return cipher.doFinal(url.decodeBase64Bytes())\n        .decodeToString()\n        .replace(\"_96.mp4\", \"_320.mp4\")\n}\n"
  },
  {
    "path": "common/providers/src/iosMain/kotlin/com.shabinder.common.providers/IOSActual.kt",
    "content": "package com.shabinder.common.di\n\nimport com.shabinder.common.di.utils.ParallelExecutor\nimport com.shabinder.common.models.AllPlatforms\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.Actions\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.flow.collect\n\n@SharedImmutable\nactual val dispatcherIO = Dispatchers.Default\n\n@SharedImmutable\nactual val currentPlatform: AllPlatforms = AllPlatforms.Native\n\n@SharedImmutable\nval Downloader = ParallelExecutor(dispatcherIO)\n\nactual suspend fun downloadTracks(\n    list: List<TrackDetails>,\n    fetcher: FetchPlatformQueryResult,\n    dir: Dir\n) {\n    dir.logger.i { \"Downloading ${list.size} Tracks\" }\n    for (track in list) {\n        Downloader.execute {\n            val url = fetcher.findMp3DownloadLink(track)\n            if (!url.isNullOrBlank()) { // Successfully Grabbed Mp3 URL\n                downloadFile(url).collect {\n                    fetcher.dir.logger.d { it.toString() }\n                    /*Construct a `NEW Map` from frozen Map to Modify for Native Platforms*/\n                    val map: MutableMap<String, DownloadStatus> = when (it) {\n                        is DownloadResult.Error -> {\n                            DownloadProgressFlow.replayCache.getOrElse(\n                                0\n                            ) { hashMapOf() }.toMutableMap().apply {\n                                set(track.title, DownloadStatus.Failed)\n                            }\n                        }\n                        is DownloadResult.Progress -> {\n                            DownloadProgressFlow.replayCache.getOrElse(\n                                0\n                            ) { hashMapOf() }.toMutableMap().apply {\n                                set(track.title, DownloadStatus.Downloading(it.progress))\n                            }\n                        }\n                        is DownloadResult.Success -> { // Todo clear map\n                            dir.saveFileWithMetadata(it.byteArray, track, Actions.instance::writeMp3Tags)\n                            DownloadProgressFlow.replayCache.getOrElse(\n                                0\n                            ) { hashMapOf() }.toMutableMap().apply {\n                                set(track.title, DownloadStatus.Downloaded)\n                            }\n                        }\n                        else -> { mutableMapOf() }\n                    }\n                    DownloadProgressFlow.emit(\n                        map as HashMap<String, DownloadStatus>\n                    )\n                }\n            } else {\n                DownloadProgressFlow.emit(\n                    DownloadProgressFlow.replayCache.getOrElse(\n                        0\n                    ) { hashMapOf() }.apply { set(track.title, DownloadStatus.Failed) }\n                )\n            }\n        }\n    }\n}\n\n@SharedImmutable\nval DownloadProgressFlow: MutableSharedFlow<HashMap<String, DownloadStatus>> = MutableSharedFlow(1)\n"
  },
  {
    "path": "common/providers/src/iosMain/kotlin/com.shabinder.common.providers/saavn.requests/decryptURL.kt",
    "content": "ackage com.shabinder.common.di.saavn\n\nactual suspend fun decryptURL(url: String): String {\n    TODO(\"Not yet implemented\")\n}\n"
  },
  {
    "path": "common/providers/src/jsMain/kotlin/com.shabinder.common.providers/WebActual.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.providers\n\nimport com.shabinder.common.core_components.file_manager.DownloadProgressFlow\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.file_manager.allTracksStatus\nimport com.shabinder.common.core_components.file_manager.downloadFile\nimport com.shabinder.common.models.*\nimport kotlinx.coroutines.flow.collect\nimport kotlinx.coroutines.withContext\n\nactual suspend fun downloadTracks(\n    list: List<TrackDetails>,\n    fetcher: FetchPlatformQueryResult,\n    fileManager: FileManager\n) {\n    list.forEach { track ->\n        withContext(dispatcherIO) {\n            allTracksStatus[track.title] = DownloadStatus.Queued\n            fetcher.findBestDownloadLink(track).fold(\n                success = { res ->\n                    track.audioQuality = res.second\n                    downloadFile(res.first).collect {\n                        when (it) {\n                            is DownloadResult.Success -> {\n                                println(\"Download Completed\")\n                                fileManager.saveFileWithMetadata(it.byteArray, track) {}\n                            }\n                            is DownloadResult.Error -> {\n                                allTracksStatus[track.title] =\n                                    DownloadStatus.Failed(it.cause ?: SpotiFlyerException.UnknownReason(it.cause))\n                                println(\"Download Error: ${track.title}\")\n                            }\n                            is DownloadResult.Progress -> {\n                                allTracksStatus[track.title] = DownloadStatus.Downloading(it.progress)\n                                println(\"Download Progress: ${it.progress}  : ${track.title}\")\n                            }\n                        }\n                        DownloadProgressFlow.emit(allTracksStatus)\n                    }\n                },\n                failure = { error ->\n                    allTracksStatus[track.title] = DownloadStatus.Failed(error)\n                    DownloadProgressFlow.emit(allTracksStatus)\n                }\n            )\n        }\n    }\n}\n"
  },
  {
    "path": "common/providers/src/jsMain/kotlin/com.shabinder.common.providers/saavn/requests/decryptURL.kt",
    "content": "package com.shabinder.common.providers.saavn.requests\n\nactual suspend fun decryptURL(url: String): String {\n    TODO(\"Not yet implemented\")\n}\n"
  },
  {
    "path": "common/root/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    id(\"android-setup\")\n    id(\"multiplatform-setup\")\n    id(\"multiplatform-setup-test\")\n    id(\"kotlin-parcelize\")\n}\n\nfun org.jetbrains.kotlin.gradle.dsl.KotlinNativeBinaryContainer.generateFramework() {\n    framework {\n        baseName = \"SpotiFlyer\"\n        linkerOpts.add(\"-lsqlite3\")\n        export(project(\":common:dependency-injection\"))\n        export(project(\":common:data-models\"))\n        export(project(\":common:database\"))\n        export(project(\":common:main\"))\n        export(project(\":common:core-components\"))\n        export(project(\":common:providers\"))\n        export(project(\":common:list\"))\n        export(project(\":common:preference\"))\n        with(deps) {\n            export(decompose.dep)\n            export(bundles.mviKotlin)\n        }\n    }\n}\n\nkotlin {\n\n    /*IOS Target Can be only built on Mac*/\n    if (HostOS.isMac) {\n        val sdkName: String? = System.getenv(\"SDK_NAME\")\n        val isiOSDevice = sdkName.orEmpty().startsWith(\"iphoneos\")\n        if (isiOSDevice) {\n            iosArm64(\"ios\") {\n                binaries {\n                    generateFramework()\n                }\n            }\n        } else {\n            iosX64(\"ios\") {\n                binaries {\n                    generateFramework()\n                }\n            }\n        }\n    }\n\n    sourceSets {\n        commonMain {\n            dependencies {\n                implementation(project(\":common:dependency-injection\"))\n                implementation(project(\":common:data-models\"))\n                implementation(project(\":common:database\"))\n                implementation(project(\":common:list\"))\n                implementation(project(\":common:main\"))\n                implementation(project(\":common:providers\"))\n                implementation(project(\":common:core-components\"))\n                implementation(project(\":common:preference\"))\n            }\n        }\n    }\n    if (HostOS.isMac) {\n        /*Required to Export `packForXcode`*/\n        sourceSets {\n            named(\"iosMain\") {\n                dependencies {\n                    api(project(\":common:dependency-injection\"))\n                    api(project(\":common:data-models\"))\n                    api(project(\":common:database\"))\n                    api(project(\":common:list\"))\n                    api(project(\":common:main\"))\n                    api(project(\":common:preference\"))\n                    with(deps) {\n                        api(decompose.dep)\n                        api(bundles.mviKotlin)\n                    }\n                }\n            }\n        }\n    }\n}\n\nval packForXcode by tasks.creating(Sync::class) {\n    if (HostOS.isMac) {\n        group = \"build\"\n        val mode = System.getenv(\"CONFIGURATION\") ?: \"DEBUG\"\n        val targetName = \"ios\"\n        val framework =\n            kotlin.targets.getByName<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>(\n                targetName\n            )\n                .binaries.getFramework(mode)\n        inputs.property(\"mode\", mode)\n        dependsOn(framework.linkTask)\n        val targetDir = File(buildDir, \"xcode-frameworks\")\n        from(framework.outputDirectory)\n        into(targetDir)\n    }\n}\n"
  },
  {
    "path": "common/root/src/androidMain/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<manifest package=\"com.shabinder.common.root\"/>\n"
  },
  {
    "path": "common/root/src/commonMain/kotlin/com/shabinder/common/root/SpotiFlyerRoot.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.root\n\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.decompose.router.RouterState\nimport com.arkivanov.decompose.value.Value\nimport com.arkivanov.mvikotlin.core.store.StoreFactory\nimport com.shabinder.common.core_components.analytics.AnalyticsManager\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.di.ApplicationInit\nimport com.shabinder.common.list.SpotiFlyerList\nimport com.shabinder.common.main.SpotiFlyerMain\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.preference.SpotiFlyerPreference\nimport com.shabinder.common.providers.FetchPlatformQueryResult\nimport com.shabinder.common.root.SpotiFlyerRoot.Dependencies\nimport com.shabinder.common.root.callbacks.SpotiFlyerRootCallBacks\nimport com.shabinder.common.root.integration.SpotiFlyerRootImpl\nimport com.shabinder.database.Database\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.flow.MutableStateFlow\n\ninterface SpotiFlyerRoot {\n\n    val routerState: Value<RouterState<*, Child>>\n\n    val toastState: MutableStateFlow<String>\n\n    val callBacks: SpotiFlyerRootCallBacks\n\n    sealed class Child {\n        data class Main(val component: SpotiFlyerMain) : Child()\n        data class List(val component: SpotiFlyerList) : Child()\n        data class Preference(val component: SpotiFlyerPreference) : Child()\n    }\n\n    interface Dependencies {\n        val appInit: ApplicationInit\n        val storeFactory: StoreFactory\n        val database: Database?\n        val fetchQuery: FetchPlatformQueryResult\n        val fileManager: FileManager\n        val preferenceManager: PreferenceManager\n        val analyticsManager: AnalyticsManager\n        val downloadProgressFlow: MutableSharedFlow<HashMap<String, DownloadStatus>>\n        val actions: Actions\n    }\n}\n\n@Suppress(\"FunctionName\") // Factory function\nfun SpotiFlyerRoot(componentContext: ComponentContext, dependencies: Dependencies): SpotiFlyerRoot =\n    SpotiFlyerRootImpl(componentContext, dependencies)\n"
  },
  {
    "path": "common/root/src/commonMain/kotlin/com/shabinder/common/root/callbacks/SpotiFlyerRootCallBacks.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.root.callbacks\n\ninterface SpotiFlyerRootCallBacks {\n    fun searchLink(link: String)\n    fun showToast(text: String)\n    fun popBackToHomeScreen()\n    fun openPreferenceScreen()\n}\n"
  },
  {
    "path": "common/root/src/commonMain/kotlin/com/shabinder/common/root/integration/SpotiFlyerRootImpl.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage com.shabinder.common.root.integration\n\nimport co.touchlab.stately.ensureNeverFrozen\nimport co.touchlab.stately.freeze\nimport com.arkivanov.decompose.*\nimport com.arkivanov.decompose.router.RouterState\nimport com.arkivanov.decompose.router.pop\nimport com.arkivanov.decompose.router.popWhile\nimport com.arkivanov.decompose.router.push\nimport com.arkivanov.decompose.router.router\nimport com.arkivanov.decompose.value.Value\nimport com.arkivanov.essenty.parcelable.Parcelable\nimport com.arkivanov.essenty.parcelable.Parcelize\nimport com.shabinder.common.core_components.analytics.AnalyticsEvent\nimport com.shabinder.common.core_components.analytics.AnalyticsView\nimport com.shabinder.common.list.SpotiFlyerList\nimport com.shabinder.common.main.SpotiFlyerMain\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.Consumer\nimport com.shabinder.common.preference.SpotiFlyerPreference\nimport com.shabinder.common.root.SpotiFlyerRoot\nimport com.shabinder.common.root.SpotiFlyerRoot.Child\nimport com.shabinder.common.root.SpotiFlyerRoot.Dependencies\nimport com.shabinder.common.root.callbacks.SpotiFlyerRootCallBacks\nimport kotlinx.coroutines.flow.MutableStateFlow\n\ninternal class SpotiFlyerRootImpl(\n    componentContext: ComponentContext,\n    dependencies: Dependencies,\n) : SpotiFlyerRoot, ComponentContext by componentContext, Dependencies by dependencies,\n    Actions by dependencies.actions {\n\n    init {\n        AnalyticsEvent.AppLaunch.track(analyticsManager)\n        instanceKeeper.ensureNeverFrozen()\n        Actions.instance = dependencies.actions.freeze()\n        appInit.init()\n    }\n\n    private val router =\n        router<Configuration, Child>(\n            initialConfiguration = Configuration.Main,\n            handleBackButton = true,\n            childFactory = ::createChild\n        )\n\n    override val routerState: Value<RouterState<*, Child>> = router.state\n\n    override val toastState = MutableStateFlow(\"\")\n\n    override val callBacks = object : SpotiFlyerRootCallBacks {\n        override fun searchLink(link: String) = onMainOutput(SpotiFlyerMain.Output.Search(link))\n        override fun popBackToHomeScreen() {\n            if (router.state.value.activeChild.instance !is Child.Main && router.state.value.backStack.isNotEmpty()) {\n                router.popWhile {\n                    it !is Configuration.Main\n                }\n            }\n        }\n\n        override fun openPreferenceScreen() {\n            router.push(Configuration.Preference)\n        }\n\n        override fun showToast(text: String) {\n            toastState.value = text\n        }\n    }\n\n    private fun createChild(\n        configuration: Configuration,\n        componentContext: ComponentContext,\n    ): Child =\n        when (configuration) {\n            is Configuration.Main -> Child.Main(\n                spotiFlyerMain(\n                    componentContext,\n                    Consumer(::onMainOutput),\n                )\n            )\n\n            is Configuration.List -> Child.List(\n                spotiFlyerList(\n                    componentContext,\n                    configuration.link,\n                    Consumer(::onListOutput),\n                )\n            )\n\n            is Configuration.Preference -> Child.Preference(\n                spotiFlyerPreference(\n                    componentContext,\n                    Consumer(::onPreferenceOutput),\n                )\n            )\n        }\n\n\n    private fun spotiFlyerMain(\n        componentContext: ComponentContext,\n        output: Consumer<SpotiFlyerMain.Output>,\n    ): SpotiFlyerMain =\n        SpotiFlyerMain(\n            componentContext = componentContext,\n            dependencies = object : SpotiFlyerMain.Dependencies, Dependencies by this {\n                override val mainOutput: Consumer<SpotiFlyerMain.Output> = output\n                override val mainAnalytics = object : SpotiFlyerMain.Analytics {\n                    override fun donationDialogVisit() {\n                        AnalyticsEvent.DonationDialogOpen.track(analyticsManager)\n                    }\n                }\n            }\n        )\n\n    private fun spotiFlyerList(\n        componentContext: ComponentContext,\n        link: String,\n        output: Consumer<SpotiFlyerList.Output>\n    ): SpotiFlyerList =\n        SpotiFlyerList(\n            componentContext = componentContext,\n            dependencies = object : SpotiFlyerList.Dependencies, Dependencies by this {\n                override val link: String = link\n                override val listOutput: Consumer<SpotiFlyerList.Output> = output\n                override val listAnalytics = object : SpotiFlyerList.Analytics {}\n            }\n        )\n\n    private fun spotiFlyerPreference(\n        componentContext: ComponentContext,\n        output: Consumer<SpotiFlyerPreference.Output>\n    ): SpotiFlyerPreference =\n        SpotiFlyerPreference(\n            componentContext = componentContext,\n            dependencies = object : SpotiFlyerPreference.Dependencies, Dependencies by this {\n                override val prefOutput: Consumer<SpotiFlyerPreference.Output> = output\n                override val preferenceAnalytics = object : SpotiFlyerPreference.Analytics {}\n            }\n        )\n\n    private fun onMainOutput(output: SpotiFlyerMain.Output) =\n        when (output) {\n            is SpotiFlyerMain.Output.Search -> {\n                router.push(Configuration.List(link = output.link))\n                AnalyticsView.ListScreen.track(analyticsManager)\n            }\n        }\n\n    private fun onListOutput(output: SpotiFlyerList.Output): Unit =\n        when (output) {\n            is SpotiFlyerList.Output.Finished -> {\n                if (router.state.value.activeChild.instance is Child.List && router.state.value.backStack.isNotEmpty()) {\n                    router.pop()\n                }\n                AnalyticsView.HomeScreen.track(analyticsManager)\n            }\n        }\n\n    private fun onPreferenceOutput(output: SpotiFlyerPreference.Output): Unit =\n        when (output) {\n            is SpotiFlyerPreference.Output.Finished -> {\n                if (router.state.value.activeChild.instance is Child.Preference && router.state.value.backStack.isNotEmpty()) {\n                    router.pop()\n                }\n                Unit\n            }\n        }\n\n    private sealed class Configuration : Parcelable {\n        @Parcelize\n        object Main : Configuration()\n\n        @Parcelize\n        object Preference : Configuration()\n\n        @Parcelize\n        data class List(val link: String) : Configuration()\n    }\n}\n"
  },
  {
    "path": "console-app/build.gradle.kts",
    "content": "plugins {\n    kotlin(\"jvm\")\n    kotlin(\"plugin.serialization\")\n    id(\"ktlint-setup\")\n    id(\"com.jakewharton.mosaic\")\n    application\n}\n\ngroup = \"com.shabinder\"\nversion = Versions.versionCode\n\nrepositories {\n    mavenCentral()\n}\n\napplication {\n    mainClass.set(\"MainKt\")\n    applicationName = \"spotiflyer-console-app\"\n}\n\ndependencies {\n    with(deps) {\n        implementation(Koin.core)\n        implementation(project(\":common:database\"))\n        implementation(project(\":common:data-models\"))\n        implementation(project(\":common:dependency-injection\"))\n        implementation(project(\":common:root\"))\n        implementation(project(\":common:main\"))\n        implementation(project(\":common:list\"))\n        implementation(project(\":common:list\"))\n\n        // Decompose\n        implementation(Decompose.decompose)\n        implementation(Decompose.extensionsCompose)\n\n        // MVI\n        implementation(MVIKotlin.mvikotlin)\n        implementation(MVIKotlin.mvikotlinMain)\n\n        // Koin\n        implementation(Koin.core)\n\n        // Matomo\n\n        implementation(Ktor.slf4j)\n        implementation(Ktor.clientCore)\n        implementation(Ktor.clientJson)\n        implementation(Ktor.clientApache)\n        implementation(Ktor.clientLogging)\n        implementation(Ktor.clientSerialization)\n        implementation(Serialization.json)\n        // testDeps\n        testImplementation(\"org.jetbrains.kotlin:kotlin-test-junit:1.5.21\")\n    }\n}\ntasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {\n    kotlinOptions {\n        jvmTarget = \"1.8\"\n        freeCompilerArgs = freeCompilerArgs.plus(\n            listOf(\n                \"-P\",\n                \"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true\"\n            )\n        )\n    }\n}\ntasks.test {\n    useJUnit()\n}\n"
  },
  {
    "path": "console-app/src/main/java/common/Common.kt",
    "content": "@file:Suppress(\"FunctionName\")\n\npackage common\n\nimport io.ktor.client.HttpClient\nimport io.ktor.client.features.HttpTimeout\nimport io.ktor.client.features.json.JsonFeature\nimport io.ktor.client.features.json.serializer.KotlinxSerializer\nimport io.ktor.client.features.logging.DEFAULT\nimport io.ktor.client.features.logging.LogLevel\nimport io.ktor.client.features.logging.Logger\nimport io.ktor.client.features.logging.Logging\nimport kotlinx.serialization.json.Json\n\ninternal val client = HttpClient {\n    install(HttpTimeout)\n    install(JsonFeature) {\n        serializer = KotlinxSerializer(\n            Json {\n                ignoreUnknownKeys = true\n                isLenient = true\n            }\n        )\n    }\n    install(Logging) {\n        logger = Logger.DEFAULT\n        level = LogLevel.INFO\n    }\n}\n"
  },
  {
    "path": "console-app/src/main/java/common/Parameters.kt",
    "content": "package common\n\nimport utils.byOptionalProperty\nimport utils.byProperty\n\ninternal data class Parameters(\n    val githubToken: String,\n    val ownerName: String,\n    val repoName: String,\n    val branchName: String,\n    val filePath: String,\n    val imageDescription: String,\n    val commitMessage: String,\n    val tagName: String\n) {\n    companion object {\n        fun initParameters() = Parameters(\n            githubToken = \"GH_TOKEN\".byProperty,\n            ownerName = \"OWNER_NAME\".byProperty,\n            repoName = \"REPO_NAME\".byProperty,\n            branchName = \"BRANCH_NAME\".byOptionalProperty ?: \"main\",\n            filePath = \"FILE_PATH\".byOptionalProperty ?: \"README.md\",\n            imageDescription = \"IMAGE_DESCRIPTION\".byOptionalProperty ?: \"IMAGE\",\n            commitMessage = \"COMMIT_MESSAGE\".byOptionalProperty ?: \"HTML-TO-IMAGE Update\",\n            tagName = \"TAG_NAME\".byOptionalProperty ?: \"HTI\"\n            // hctiKey = \"HCTI_KEY\".analytics_html_img.getByProperty\n        )\n    }\n}\n"
  },
  {
    "path": "console-app/src/main/java/main.kt",
    "content": "import androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.setValue\nimport com.jakewharton.mosaic.Text\nimport com.jakewharton.mosaic.runMosaic\nimport kotlinx.coroutines.delay\n\nfun main() = runMosaic {\n    // TODO https://github.com/JakeWharton/mosaic/issues/3\n    var count by mutableStateOf(0)\n\n    setContent {\n        Text(\"The count is: $count\")\n    }\n\n    for (i in 1..20) {\n        delay(250)\n        count = i\n    }\n}\n"
  },
  {
    "path": "console-app/src/main/java/utils/Exceptions.kt",
    "content": "@file:Suppress(\"ClassName\")\n\npackage utils\n\ndata class ENV_KEY_MISSING(\n    val keyName: String,\n    override val message: String? = \"$keyName was not found, please check your ENV variables\"\n) : Exception(message)\n\ndata class HCTI_URL_RESPONSE_ERROR(\n    val response: String,\n    override val message: String? = \"Server Error, We Recieved this Resp: $response\"\n) : Exception(message)\n\ndata class RETRY_LIMIT_EXHAUSTED(\n    override val message: String? = \"RETRY LIMIT EXHAUSTED!\"\n) : Exception(message)\n"
  },
  {
    "path": "console-app/src/main/java/utils/Ext.kt",
    "content": "package utils\n\nval String.byProperty: String get() = System.getenv(this)\n    ?: throw (ENV_KEY_MISSING(this))\n\nval String.byOptionalProperty: String? get() = System.getenv(this)\n\nfun debug(message: String) = println(\"\\n::debug::$message\")\nfun debug(tag: String, message: String) = println(\"\\n::debug::$tag:\\n$message\")\n"
  },
  {
    "path": "console-app/src/main/java/utils/TestClass.kt",
    "content": "package utils\n\nimport kotlinx.coroutines.runBlocking\n\n// Test Class- at development Time\nfun main(): Unit = runBlocking {}\n"
  },
  {
    "path": "desktop/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport org.jetbrains.compose.compose\nimport org.jetbrains.compose.desktop.application.dsl.TargetFormat\n\nplugins {\n    kotlin(\"multiplatform\")\n    id(\"org.jetbrains.compose\")\n    id(\"ktlint-setup\")\n}\n\ngroup = \"com.shabinder\"\nversion = Versions.versionName\n\nkotlin {\n    jvm {\n        compilations.all {\n            kotlinOptions.jvmTarget = \"1.8\"\n        }\n    }\n    tasks.named<Copy>(\"jvmProcessResources\") {\n        duplicatesStrategy = DuplicatesStrategy.EXCLUDE\n    }\n    sourceSets {\n        val jvmMain by getting {\n            resources.srcDirs(\"../common/data-models/src/main/res\")\n            dependencies {\n                implementation(compose.desktop.currentOs)\n                implementation(project(\":common:database\"))\n                implementation(project(\":common:dependency-injection\"))\n                implementation(project(\":common:core-components\"))\n                implementation(project(\":common:data-models\"))\n                implementation(project(\":common:compose\"))\n                implementation(project(\":common:providers\"))\n                implementation(project(\":common:root\"))\n\n                with(deps) {\n                    implementation(jaffree)\n\n                    with(decompose) {\n                        implementation(dep)\n                        implementation(extensions.compose)\n                    }\n                    with(mviKotlin) {\n                        implementation(dep)\n                        implementation(main)\n                    }\n\n                    implementation(koin.core)\n                }\n            }\n        }\n        val jvmTest by getting\n    }\n}\n\ncompose.desktop {\n    application {\n        mainClass = \"MainKt\"\n        description = \"Music Downloader for Spotify, Gaana, Jio Saavn, Youtube Music.\"\n        nativeDistributions {\n            modules(\"java.sql\", \"java.security.jgss\", \"jdk.crypto.ec\")\n            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)\n            packageName = \"SpotiFlyer\"\n            copyright = \"© 2021 Shabinder. All rights reserved.\"\n            vendor = \"Shabinder\"\n\n            val iconsRoot = project.file(\"src/jvmMain/resources/drawable\")\n            macOS {\n                bundleID = \"com.shabinder.spotiflyer\"\n                iconFile.set(iconsRoot.resolve(\"spotiflyer.icns\"))\n            }\n            windows {\n                iconFile.set(iconsRoot.resolve(\"spotiflyer.ico\"))\n                // Wondering what the heck is this? See : https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html\n                // https://www.guidgen.com/\n                upgradeUuid = \"50dac393-a24f-48a6-89c6-9218b24a5291\"\n                menuGroup = packageName\n            }\n            linux {\n                iconFile.set(iconsRoot.resolve(\"spotiflyer.png\"))\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "desktop/src/jvmMain/kotlin/Main.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport androidx.compose.desktop.DesktopMaterialTheme\nimport androidx.compose.foundation.layout.fillMaxSize\nimport androidx.compose.material.MaterialTheme\nimport androidx.compose.material.Surface\nimport androidx.compose.ui.Modifier\nimport androidx.compose.ui.awt.ComposeWindow\nimport androidx.compose.ui.graphics.Color\nimport androidx.compose.ui.graphics.painter.BitmapPainter\nimport androidx.compose.ui.res.loadImageBitmap\nimport androidx.compose.ui.res.useResource\nimport androidx.compose.ui.unit.dp\nimport androidx.compose.ui.window.*\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.decompose.DefaultComponentContext\nimport com.arkivanov.decompose.ExperimentalDecomposeApi\nimport com.arkivanov.decompose.extensions.compose.jetbrains.lifecycle.LifecycleController\nimport com.arkivanov.essenty.lifecycle.LifecycleRegistry\nimport com.arkivanov.mvikotlin.main.store.DefaultStoreFactory\nimport com.github.kokorin.jaffree.JaffreeException\nimport com.github.kokorin.jaffree.ffmpeg.FFmpeg\nimport com.shabinder.common.di.*\nimport com.shabinder.common.core_components.analytics.AnalyticsManager\nimport com.shabinder.common.core_components.file_manager.DownloadProgressFlow\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.core_components.utils.isInternetAccessible\nimport com.shabinder.common.models.PlatformActions\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.providers.FetchPlatformQueryResult\nimport com.shabinder.common.root.SpotiFlyerRoot\nimport com.shabinder.common.translations.Strings\nimport com.shabinder.common.uikit.SpotiFlyerLogo\nimport com.shabinder.common.uikit.configurations.SpotiFlyerColors\nimport com.shabinder.common.uikit.configurations.SpotiFlyerShapes\nimport com.shabinder.common.uikit.configurations.SpotiFlyerTypography\nimport com.shabinder.common.uikit.configurations.colorOffWhite\nimport com.shabinder.common.uikit.screens.SpotiFlyerRootContent\nimport com.shabinder.database.Database\nimport kotlinx.coroutines.runBlocking\nimport java.awt.Desktop\nimport java.awt.Toolkit\nimport java.awt.datatransfer.Clipboard\nimport java.awt.datatransfer.StringSelection\nimport java.net.URI\nimport javax.swing.JFileChooser\nimport javax.swing.JFileChooser.APPROVE_OPTION\n\nprivate val koin = initKoin(enableNetworkLogs = true).koin\nprivate lateinit var showToast: (String) -> Unit\nprivate lateinit var appWindow: ComposeWindow\n\n@OptIn(ExperimentalDecomposeApi::class)\nfun main() {\n    val lifecycle = LifecycleRegistry()\n    val rootComponent = spotiFlyerRoot(DefaultComponentContext(lifecycle))\n    val windowState = WindowState(width = 450.dp, height = 800.dp)\n    singleWindowApplication(\n        title = \"SpotiFlyer\",\n        state = windowState,\n        icon = BitmapPainter(useResource(\"drawable/spotiflyer.png\", ::loadImageBitmap))\n    ) {\n        appWindow = window\n        LifecycleController(lifecycle, windowState)\n        Surface(\n            modifier = Modifier.fillMaxSize(),\n            color = Color.Black,\n            contentColor = colorOffWhite\n        ) {\n            MaterialTheme(\n                colors = SpotiFlyerColors,\n                typography = SpotiFlyerTypography,\n                shapes = SpotiFlyerShapes\n            ) {\n                val root: SpotiFlyerRoot = SpotiFlyerRootContent(rootComponent)\n                showToast = root.callBacks::showToast\n\n\n                // FFmpeg WARNING\n                try {\n                    FFmpeg.atPath().addArgument(\"-version\").execute()\n                } catch (e: Exception) {\n                    if (e is JaffreeException) Actions.instance.showPopUpMessage(\"WARNING!\\nFFmpeg not found at path\")\n                }\n            }\n        }\n    }\n\n    // Download Tracking for Desktop Apps for Now will be measured using `GitHub Releases`\n    // https://tooomm.github.io/github-release-stats/?username=Shabinder&repository=SpotiFlyer\n}\n\nprivate fun spotiFlyerRoot(componentContext: ComponentContext): SpotiFlyerRoot =\n    SpotiFlyerRoot(\n        componentContext = componentContext,\n        dependencies = object : SpotiFlyerRoot.Dependencies {\n            override val appInit: ApplicationInit = koin.get()\n            override val storeFactory = DefaultStoreFactory()\n            override val fetchQuery: FetchPlatformQueryResult = koin.get()\n            override val fileManager: FileManager = koin.get()\n            override val database: Database? = fileManager.db\n            override val analyticsManager: AnalyticsManager = koin.get()\n            override val preferenceManager: PreferenceManager = koin.get<PreferenceManager>().also {\n                it.analyticsManager = analyticsManager\n                // Allow Analytics for Desktop\n                analyticsManager.giveConsent()\n            }\n            override val downloadProgressFlow = DownloadProgressFlow\n            override val actions: Actions = object : Actions {\n                override val platformActions = object : PlatformActions {}\n\n                override fun showPopUpMessage(string: String, long: Boolean) {\n                    if (::showToast.isInitialized) {\n                        showToast(string)\n                    }\n                }\n\n                override fun setDownloadDirectoryAction(callBack: (String) -> Unit) {\n                    val fileChooser = JFileChooser().apply {\n                        fileSelectionMode = JFileChooser.DIRECTORIES_ONLY\n                    }\n                    when (fileChooser.showOpenDialog(appWindow)) {\n                        APPROVE_OPTION -> {\n                            val directory = fileChooser.selectedFile\n                            if (directory.canWrite()) {\n                                preferenceManager.setDownloadDirectory(directory.absolutePath)\n                                callBack(directory.absolutePath)\n                                showPopUpMessage(\"${Strings.setDownloadDirectory()} \\n${fileManager.defaultDir()}\")\n                            } else {\n                                showPopUpMessage(Strings.noWriteAccess(\"\\n${directory.absolutePath} \"))\n                            }\n                        }\n                        else -> {\n                            showPopUpMessage(\"No Directory Selected\")\n                        }\n                    }\n                }\n\n                override fun queryActiveTracks() { /**/\n                }\n\n                override fun giveDonation() {\n                    openLink(\"https://razorpay.com/payment-button/pl_GnKuuDBdBu0ank/view/?utm_source=payment_button&utm_medium=button&utm_campaign=payment_button\")\n                }\n\n                override fun shareApp() = openLink(\"https://github.com/Shabinder/SpotiFlyer\")\n                override fun copyToClipboard(text: String) {\n                    val data = StringSelection(text)\n                    val cb: Clipboard = Toolkit.getDefaultToolkit().systemClipboard\n                    cb.setContents(data, data)\n                }\n\n                override fun openPlatform(packageID: String, platformLink: String) = openLink(platformLink)\n\n                fun openLink(link: String) {\n                    if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {\n                        Desktop.getDesktop().browse(URI(link))\n                    }\n                }\n\n                override fun writeMp3Tags(trackDetails: TrackDetails) {\n                    /*IMPLEMENTED*/\n                }\n\n                override val isInternetAvailable: Boolean\n                    get() = runBlocking {\n                        isInternetAccessible()\n                    }\n            }\n        }\n    )\n"
  },
  {
    "path": "fastlane/Appfile",
    "content": "package_name(\"com.shabinder.spotiflyer\")\n"
  },
  {
    "path": "fastlane/Fastfile",
    "content": "# This file contains the fastlane.tools configuration\n# You can find the documentation at https://docs.fastlane.tools\n#\n# For a list of all available actions, check out\n#\n#     https://docs.fastlane.tools/actions\n#\n# For a list of all available plugins, check out\n#\n#     https://docs.fastlane.tools/plugins/available-plugins\n#\n\n# Uncomment the line if you want fastlane to automatically update itself\n# update_fastlane\n\ndefault_platform(:android)\n\nplatform :android do\n  desc \"Runs all the tests\"\n  lane :test do\n    gradle(task: \"test\")\n  end\n\n  desc \"Build Android App\"\n  lane :build do\n    gradle(task: \":android:build\")\n  \n    # sh \"your_script.sh\"\n    # You can also use other beta testing services here\n  end\nend\n"
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/20.txt",
    "content": " - F-Droid Initial Release.\n - Size Reduced to 4.9 MB (14% smalled than previous apk).\n - Firebase Analytics/Crashlytics Removed, Self-Hosted Alternatives Used (100% Open Source).\n - Dependencies Updated.\n - Android Bitmap Compression (OOM Fixes)\n - Jio Saavn Support Added\n - 320KBPS Audio Quality is now available too.\n - Bug Fixes.\n"
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/21.txt",
    "content": " - YT Quality 128 -> 192 KBPS\n - Bug Fixes\n - Better Error Handling, and Bubbling upto the caller\n - Error Dialog with error info added\n - YT extraction fixed\n - Retry on Error Logo Added\n - Translations added for languages: Locales - de, en, es, fr, id, pt, ru, uk"
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/22.txt",
    "content": " - Android 11 Crash Fix (sdk 30)"
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/24.txt",
    "content": "  - Major Bug Fixes:\n    - YT Music Extraction,\n    - Error Handling Improv,\n    - Analytics, and Crashlytics Provider,\n    - Some translations Added.\n    - Many More... I cant remember now 🙃\n  - Now FFmpeg is custom built and added in-app : no more mp3 conversion errors\n"
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/25.txt",
    "content": "- File size less than 100 KB,\n- Crash Fixes when App Went in Background\n- Offloaded Many CPU Intensive tasks from Main Thread\n- Notification Handling Improved, Now Exits Gracefully\n- Some translations Added.\n- ImageVectors Caching Implemented Expect some performance gain"
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/26.txt",
    "content": "Hot Fixes:\n - Android App Crashes Fix when Toasting in background thread.\n - null Named directories creation stopped in desktop\n - Download Directory Chooser crashing fix in desktop.\n - Media Conversion Failing fix when Names have Special Characters"
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/27.txt",
    "content": " - Added SoundCloud Support.\n - Added YT manual extraction when YT1s fails fixing many critical bugs.\n - Optimised List Screen Download Progress UI, it now updates smoothly & accurately.\n - Fixed Concurrent Access Crashes.\n - Added Some Language Translations.\n - Some Code Cleanup"
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/28.txt",
    "content": " - Fixed SoundCloud Parsing Errors.\n - Fixed SSL Cert Validation Errors.\n - Compose, Kotlin and other Dependencies Updated.\n - Added Some Language Translations.\n - Code Cleanup."
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/29.txt",
    "content": " - Fixed Response Parsing Error which leaded download failure."
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/30.txt",
    "content": " - User Configurable Spotify Creds Support.\n - Crash & Visibility Fix for SettingsIcon.\n - Changed default Creds, thanks to spotDL."
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/31.txt",
    "content": " - Fix for Blurry Images."
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/32.txt",
    "content": " - Soundbound Feature Graphic."
  },
  {
    "path": "fastlane/metadata/android/en-US/full_description.txt",
    "content": "\"SpotiFlyer\" is an App(Written in Kotlin), which aims to work as:\n - Download: Albums, Tracks and Playlists,etc.\n - Save your Data, by not Streaming your Fav. Songs Online again & again(Just Download Them!).\n - No ADS!, 100% Open Source.\n - Works straight out of the box and does not require you to generate or mess with your API keys (already included).\n - Even a Web-App and Desktop Apps are available, Check Out: https://github.com/Shabinder/SpotiFlyer (Encourage Us by giving us a star here)\n\nSupported Platforms:\n - Spotify\n - Gaana\n - Youtube\n - Youtube Music\n - Jio-Saavn\n - SoundCloud\n - (more coming soon)\n\nNote:\n - The availability of YouTube Music in your country is IMPORTANT, if it isn't available consider using a VPN.\n"
  },
  {
    "path": "fastlane/metadata/android/en-US/short_description.txt",
    "content": "Download All your songs from Spotify, Gaana, Jio Saavn, Youtube Music, SoundCloud."
  },
  {
    "path": "fastlane/metadata/android/en-US/title.txt",
    "content": "SpotiFlyer"
  },
  {
    "path": "ffmpeg/android-ffmpeg/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/build.gradle.bak",
    "content": "apply plugin: 'com.android.library'\napply plugin: 'kotlin-android'\n\next {\n    publishedGroupId = 'nl.bravobit'\n    libraryName = 'Android FFmpeg'\n    artifact = 'android-ffmpeg'\n\n    libraryDescription = 'FFmpeg/FFprobe compiled for Android. Execute FFmpeg and FFprobe commands with ease in your Android project.'\n\n    siteUrl = 'https://github.com/bravobit/FFmpeg-Android'\n    gitUrl = 'https://github.com/bravobit/FFmpeg-Android.git'\n\n    libraryVersion = '1.1.7'\n\n    developerId = 'Bravobit'\n    developerName = 'Bravobit'\n    developerEmail = 'info@bravobit.nl'\n\n    licenseName = 'GNU General Public License v3.0'\n    licenseUrl = 'https://github.com/bravobit/FFmpeg-Android/blob/master/LICENSE'\n    allLicenses = [\"GPL-3.0\"]\n}\n\nandroid {\n    compileSdkVersion 29\n\n    defaultConfig {\n        minSdkVersion 16\n        targetSdkVersion 29\n        versionCode 18\n        versionName \"1.2.1\"\n    }\n\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_7\n        targetCompatibility JavaVersion.VERSION_1_7\n    }\n\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n\n}\n\ndependencies {\n    implementation fileTree(dir: 'libs', include: ['*.jar'])\n\n    implementation 'androidx.appcompat:appcompat:1.3.1'\n}\n\ntask sourcesJar(type: Jar) {\n    from android.sourceSets.main.java.srcDirs\n    classifier = 'sources'\n}\n\ntask javadoc(type: Javadoc) {\n    source = android.sourceSets.main.java.srcDirs\n    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))\n}\n\ntask javadocJar(type: Jar, dependsOn: javadoc) {\n    classifier = 'javadoc'\n    from javadoc.destinationDir\n}\n\nartifacts {\n    archives javadocJar\n    archives sourcesJar\n}"
  },
  {
    "path": "ffmpeg/android-ffmpeg/build.gradle.kts",
    "content": "plugins {\n    id(\"com.android.library\")\n    id(\"kotlin-android\")\n}\n\nandroid {\n    //ndkVersion \"22.0.7026061\"\n    compileSdk = Versions.compileSdkVersion\n    buildToolsVersion = \"30.0.3\"\n\n    defaultConfig {\n        consumerProguardFile(\"proguard-rules.pro\")\n\n        minSdk = Versions.minSdkVersion\n        targetSdk = Versions.targetSdkVersion\n\n        /*ndk {\n            abiFilters.addAll(setOf(\"x86\", \"x86_64\", \"armeabi-v7a\", \"arm64-v8a\"))\n        }*/\n    }\n\n    buildTypes {\n        getByName(\"release\") {\n            isMinifyEnabled = false\n            proguardFiles(\n                getDefaultProguardFile(\"proguard-android.txt\"),\n                \"proguard-rules.pro\"\n            )\n        }\n    }\n\n    compileOptions {\n        sourceCompatibility = JavaVersion.VERSION_1_8\n        targetCompatibility = JavaVersion.VERSION_1_8\n    }\n\n    packagingOptions {\n        resources {\n            excludes.apply {\n                add(\"META-INF/*\")\n            }\n            jniLibs.pickFirsts.apply {\n                add(\"**/*.so\")\n            }\n        }\n    }\n}\n\ndependencies { /**/ }\n\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/gradle.properties",
    "content": ""
  },
  {
    "path": "ffmpeg/android-ffmpeg/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguardFiles setting in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n\n# Uncomment this to preserve the line number information for\n# debugging stack traces.\n#-keepattributes SourceFile,LineNumberTable\n\n# If you keep the line number information, uncomment this to\n# hide the original source file name.\n#-renamesourcefileattribute SourceFile\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/AndroidManifest.xml",
    "content": "<manifest package=\"bravobit.nl.ffmpegandroid\" />\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/CommandResult.java",
    "content": "package nl.bravobit.ffmpeg;\n\nclass CommandResult {\n    final String output;\n    final boolean success;\n\n    CommandResult(boolean success, String output) {\n        this.success = success;\n        this.output = output;\n    }\n\n    static CommandResult getDummyFailureResponse() {\n        return new CommandResult(false, \"\");\n    }\n\n    static CommandResult getOutputFromProcess(Process process) {\n        String output;\n        if (success(process.exitValue())) {\n            output = Util.convertInputStreamToString(process.getInputStream());\n        } else {\n            output = Util.convertInputStreamToString(process.getErrorStream());\n        }\n        return new CommandResult(success(process.exitValue()), output);\n    }\n\n    static boolean success(Integer exitValue) {\n        return exitValue != null && exitValue == 0;\n    }\n\n}"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/CpuArch.java",
    "content": "package nl.bravobit.ffmpeg;\n\npublic enum CpuArch {\n    ARMv7, x86, x86_64, ARM_64, NONE\n}\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/CpuArchHelper.java",
    "content": "package nl.bravobit.ffmpeg;\n\nimport android.os.Build;\n\n@SuppressWarnings(\"deprecation\")\npublic class CpuArchHelper {\n    public static final String X86_CPU = \"x86\";\n    public static final String X86_64_CPU = \"x86_64\";\n    public static final String ARM_64_CPU = \"arm64-v8a\";\n    public static final String ARM_V7_CPU = \"armeabi-v7a\";\n\n    public static CpuArch getCpuArch() {\n        Log.d(\"Build.CPU_ABI : \" + Build.CPU_ABI);\n\n        switch (Build.CPU_ABI) {\n            case X86_CPU:\n                return CpuArch.x86;\n            case X86_64_CPU:\n                return CpuArch.x86_64;\n            case ARM_64_CPU:\n                return CpuArch.ARM_64;\n            case ARM_V7_CPU:\n                return CpuArch.ARMv7;\n            default:\n                return CpuArch.NONE;\n        }\n    }\n}\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/ExecuteBinaryResponseHandler.java",
    "content": "package nl.bravobit.ffmpeg;\n\npublic class ExecuteBinaryResponseHandler implements FFcommandExecuteResponseHandler {\n\n    @Override\n    public void onSuccess(String message) {\n\n    }\n\n    @Override\n    public void onProgress(String message) {\n\n    }\n\n    @Override\n    public void onFailure(String message) {\n\n    }\n\n    @Override\n    public void onStart() {\n\n    }\n\n    @Override\n    public void onFinish() {\n\n    }\n}\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/FFbinaryContextProvider.java",
    "content": "package nl.bravobit.ffmpeg;\n\nimport android.content.Context;\n\npublic interface FFbinaryContextProvider {\n\n    Context provide();\n}\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/FFbinaryInterface.java",
    "content": "package nl.bravobit.ffmpeg;\n\nimport java.util.Map;\n\ninterface FFbinaryInterface {\n\n    /**\n     * Executes a command\n     *\n     * @param environmentVars                 Environment variables\n     * @param cmd                             command to execute\n     * @param ffcommandExecuteResponseHandler {@link FFcommandExecuteResponseHandler}\n     * @return the task\n     */\n    FFtask execute(Map<String, String> environmentVars, String[] cmd, FFcommandExecuteResponseHandler ffcommandExecuteResponseHandler);\n\n    /**\n     * Executes a command\n     *\n     * @param cmd                             command to execute\n     * @param ffcommandExecuteResponseHandler {@link FFcommandExecuteResponseHandler}\n     * @return the task\n     */\n    FFtask execute(String[] cmd, FFcommandExecuteResponseHandler ffcommandExecuteResponseHandler);\n\n    /**\n     * Checks if FF binary is supported on this device\n     *\n     * @return true if FF binary is supported on this device\n     */\n    boolean isSupported();\n\n    /**\n     * Checks if a command with given task is currently running\n     *\n     * @param task - the task that you want to check\n     * @return true if a command is running\n     */\n    boolean isCommandRunning(FFtask task);\n\n    /**\n     * Kill given running process\n     *\n     * @param task - the task to kill\n     * @return true if process is killed successfully\n     */\n    boolean killRunningProcesses(FFtask task);\n\n    /**\n     * Timeout for binary process, should be minimum of 10 seconds\n     *\n     * @param timeout in milliseconds\n     */\n    void setTimeout(long timeout);\n}\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/FFbinaryObserver.java",
    "content": "package nl.bravobit.ffmpeg;\n\npublic interface FFbinaryObserver extends Runnable {\n\n    void cancel();\n}\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/FFcommandExecuteAsyncTask.java",
    "content": "package nl.bravobit.ffmpeg;\n\nimport android.os.AsyncTask;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.util.Map;\nimport java.util.concurrent.TimeoutException;\n\n@SuppressWarnings(\"deprecation\")\nclass FFcommandExecuteAsyncTask extends AsyncTask<Void, String, CommandResult> implements FFtask {\n\n    private final String[] cmd;\n    private final Map<String, String> environment;\n    private final StringBuilder outputStringBuilder = new StringBuilder();\n    private final FFcommandExecuteResponseHandler ffmpegExecuteResponseHandler;\n    private final ShellCommand shellCommand;\n    private final long timeout;\n    private long startTime;\n    private Process process;\n    private String output = \"\";\n    private boolean quitPending;\n\n    FFcommandExecuteAsyncTask(String[] cmd, Map<String, String> environment, long timeout, FFcommandExecuteResponseHandler ffmpegExecuteResponseHandler) {\n        this.cmd = cmd;\n        this.timeout = timeout;\n        this.environment = environment;\n        this.ffmpegExecuteResponseHandler = ffmpegExecuteResponseHandler;\n        this.shellCommand = new ShellCommand();\n    }\n\n    @Override\n    protected void onPreExecute() {\n        startTime = System.currentTimeMillis();\n        if (ffmpegExecuteResponseHandler != null) {\n            ffmpegExecuteResponseHandler.onStart();\n        }\n    }\n\n    @Override\n    protected CommandResult doInBackground(Void... params) {\n        CommandResult ret = CommandResult.getDummyFailureResponse();\n        try {\n            process = shellCommand.run(cmd, environment);\n            if (process == null) {\n                return CommandResult.getDummyFailureResponse();\n            }\n            Log.d(\"Running publishing updates method\");\n            checkAndUpdateProcess();\n            ret = CommandResult.getOutputFromProcess(process);\n            outputStringBuilder.append(ret.output);\n        } catch (TimeoutException e) {\n            Log.e(\"FFmpeg binary timed out\", e);\n            ret = new CommandResult(false, e.getMessage());\n            outputStringBuilder.append(ret.output);\n        } catch (Exception e) {\n            Log.e(\"Error running FFmpeg binary\", e);\n        } finally {\n            Util.destroyProcess(process);\n        }\n        output = outputStringBuilder.toString();\n        return ret;\n    }\n\n    @Override\n    protected void onProgressUpdate(String... values) {\n        if (values != null && values[0] != null && ffmpegExecuteResponseHandler != null) {\n            ffmpegExecuteResponseHandler.onProgress(values[0]);\n        }\n    }\n\n    @Override\n    protected void onPostExecute(CommandResult commandResult) {\n        if (ffmpegExecuteResponseHandler != null) {\n            if (commandResult.success) {\n                ffmpegExecuteResponseHandler.onSuccess(output);\n            } else {\n                ffmpegExecuteResponseHandler.onFailure(output);\n            }\n            ffmpegExecuteResponseHandler.onFinish();\n        }\n    }\n\n    private void checkAndUpdateProcess() throws TimeoutException, InterruptedException {\n        while (!Util.isProcessCompleted(process)) {\n\n            // checking if process is completed\n            if (Util.isProcessCompleted(process)) {\n                return;\n            }\n\n            // Handling timeout\n            if (timeout != Long.MAX_VALUE && System.currentTimeMillis() > startTime + timeout) {\n                throw new TimeoutException(\"FFmpeg binary timed out\");\n            }\n\n            try {\n                String line;\n                BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));\n                while ((line = reader.readLine()) != null) {\n                    if (isCancelled()) {\n                        process.destroy();\n                        process.waitFor();\n                        return;\n                    }\n\n                    if (quitPending) {\n                        sendQ();\n                        process = null;\n                        return;\n                    }\n\n                    outputStringBuilder.append(line); outputStringBuilder.append(\"\\n\");\n                    publishProgress(line);\n                }\n            } catch (IOException e) {\n                e.printStackTrace();\n            }\n        }\n    }\n\n    public boolean isProcessCompleted() {\n        return Util.isProcessCompleted(process);\n    }\n\n    @Override\n    public boolean killRunningProcess() {\n        return Util.killAsync(this);\n    }\n\n    @Override\n    public void sendQuitSignal() {\n        quitPending = true;\n    }\n\n    private void sendQ() {\n        OutputStream outputStream = process.getOutputStream();\n        try {\n            outputStream.write(\"q\\n\".getBytes());\n            outputStream.flush();\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n}"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/FFcommandExecuteResponseHandler.java",
    "content": "package nl.bravobit.ffmpeg;\n\npublic interface FFcommandExecuteResponseHandler extends ResponseHandler {\n\n    /**\n     * on Success\n     *\n     * @param message complete output of the binary command\n     */\n    void onSuccess(String message);\n\n    /**\n     * on Progress\n     *\n     * @param message current output of binary command\n     */\n    void onProgress(String message);\n\n    /**\n     * on Failure\n     *\n     * @param message complete output of the binary command\n     */\n    void onFailure(String message);\n\n}\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/FFmpeg.kt",
    "content": "package nl.bravobit.ffmpeg\n\nimport android.content.Context\nimport nl.bravobit.ffmpeg.Log.setDebug\nimport nl.bravobit.ffmpeg.Util.isDebug\nimport nl.bravobit.ffmpeg.FileUtils.getFFmpeg\nimport nl.bravobit.ffmpeg.Log.e\nimport nl.bravobit.ffmpeg.Log.d\nimport android.os.AsyncTask\nimport java.lang.IllegalArgumentException\n\nclass FFmpeg private constructor(private val context: FFbinaryContextProvider) : FFbinaryInterface {\n    private var timeout = Long.MAX_VALUE\n\n    init {\n        setDebug(isDebug(context.provide()))\n    }\n\n    override fun isSupported(): Boolean {\n        // get ffmpeg file\n        val ffmpeg = getFFmpeg(context.provide())\n\n        // check if ffmpeg can be executed\n        if (!ffmpeg.canExecute()) {\n            // try to make executable\n            e(\"ffmpeg cannot execute\")\n            return false\n        }\n        d(\"ffmpeg is ready!\")\n        return true\n    }\n\n    override fun execute(\n        environmentVars: Map<String, String>,\n        cmd: Array<String>,\n        ffmpegExecuteResponseHandler: FFcommandExecuteResponseHandler\n    ): FFtask {\n        return if (cmd.isNotEmpty()) {\n            val command = arrayOfNulls<String>(cmd.size + 1)\n            command[0] = getFFmpeg(context.provide()).absolutePath\n            System.arraycopy(cmd, 0, command, 1, cmd.size)\n            val task = FFcommandExecuteAsyncTask(\n                command,\n                environmentVars,\n                timeout,\n                ffmpegExecuteResponseHandler\n            )\n            task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)\n            task\n        } else {\n            throw IllegalArgumentException(\"shell command cannot be empty\")\n        }\n    }\n\n    override fun execute(\n        cmd: Array<String>,\n        ffmpegExecuteResponseHandler: FFcommandExecuteResponseHandler\n    ): FFtask {\n        return execute(emptyMap(), cmd, ffmpegExecuteResponseHandler)\n    }\n\n    override fun isCommandRunning(task: FFtask): Boolean {\n        return !task.isProcessCompleted\n    }\n\n    override fun killRunningProcesses(task: FFtask): Boolean {\n        return task.killRunningProcess()\n    }\n\n    override fun setTimeout(timeout: Long) {\n        if (timeout >= MINIMUM_TIMEOUT) {\n            this.timeout = timeout\n        }\n    }\n\n    companion object {\n        private const val MINIMUM_TIMEOUT = (10 * 1000).toLong()\n        private var instance: FFmpeg? = null\n\n        fun getInstance(context: Context): FFmpeg {\n            return instance ?: FFmpeg { context }.also {\n                instance = it\n            }\n        }\n    }\n}"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/FFprobe.java",
    "content": "package nl.bravobit.ffmpeg;\n\nimport android.content.Context;\nimport android.os.AsyncTask;\n\nimport java.io.File;\nimport java.util.Map;\n\n@SuppressWarnings(\"deprecation\")\npublic class FFprobe implements FFbinaryInterface {\n\n    private final FFbinaryContextProvider context;\n\n    private static final long MINIMUM_TIMEOUT = 10 * 1000;\n    private long timeout = Long.MAX_VALUE;\n\n    private static FFprobe instance = null;\n\n    private FFprobe(FFbinaryContextProvider context) {\n        this.context = context;\n        Log.setDebug(Util.isDebug(this.context.provide()));\n    }\n\n    public static FFprobe getInstance(final Context context) {\n        if (instance == null) {\n            instance = new FFprobe(() -> context);\n        }\n        return instance;\n    }\n\n    @Override\n    public boolean isSupported() {\n        // get ffprobe file\n        File ffprobe = FileUtils.getFFprobe(context.provide());\n\n        // check if ffprobe can be executed\n        if (!ffprobe.canExecute()) {\n            // try to make executable\n            Log.e(\"ffprobe cannot execute\");\n            return false;\n        }\n\n        Log.d(\"ffprobe is ready!\");\n\n        return true;\n    }\n\n    @Override\n    public FFtask execute(Map<String, String> environvenmentVars, String[] cmd, FFcommandExecuteResponseHandler ffcommandExecuteResponseHandler) {\n        if (cmd.length != 0) {\n            final String[] command = new String[cmd.length + 1];\n            command[0] = FileUtils.getFFprobe(context.provide()).getAbsolutePath();\n            System.arraycopy(cmd, 0, command, 1, cmd.length);\n            FFcommandExecuteAsyncTask task = new FFcommandExecuteAsyncTask(command, environvenmentVars, timeout, ffcommandExecuteResponseHandler);\n            task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);\n            return task;\n        } else {\n            throw new IllegalArgumentException(\"shell command cannot be empty\");\n        }\n    }\n\n    @Override\n    public FFtask execute(String[] cmd, FFcommandExecuteResponseHandler ffcommandExecuteResponseHandler) {\n        return execute(null, cmd, ffcommandExecuteResponseHandler);\n    }\n\n    public boolean isCommandRunning(FFtask task) {\n        return task != null && !task.isProcessCompleted();\n    }\n\n    @Override\n    public boolean killRunningProcesses(FFtask task) {\n        return task != null && task.killRunningProcess();\n    }\n\n    @Override\n    public void setTimeout(long timeout) {\n        if (timeout >= MINIMUM_TIMEOUT) {\n            this.timeout = timeout;\n        }\n    }\n}\n"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/FFtask.kt",
    "content": "package nl.bravobit.ffmpeg\n\ninterface FFtask {\n    /**\n     * Sends 'q' to the ff binary running process asynchronously\n     */\n    fun sendQuitSignal()\n\n    /**\n     * Checks if process is completed\n     * @return `true` if a process is running\n     */\n    val isProcessCompleted: Boolean\n\n    /**\n     * Kill given running process\n     *\n     * @return true if process is killed successfully\n     */\n    fun killRunningProcess(): Boolean\n}"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/FileUtils.kt",
    "content": "package nl.bravobit.ffmpeg\n\nimport android.content.Context\nimport java.io.File\n\ninternal object FileUtils {\n\n    private const val FFMPEG_FILE_NAME = \"lib..ffmpeg..so\"\n    private const val FFPROBE_FILE_NAME = \"lib..ffprobe..so\"\n\n    @JvmStatic\n    fun getFFmpeg(context: Context): File {\n        val folder = File(context.applicationInfo.nativeLibraryDir)\n        return File(folder, FFMPEG_FILE_NAME)\n    }\n\n    @JvmStatic\n    fun getFFprobe(context: Context): File {\n        val folder = File(context.applicationInfo.nativeLibraryDir)\n        return File(folder, FFPROBE_FILE_NAME)\n    }\n}"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/Log.kt",
    "content": "package nl.bravobit.ffmpeg\n\nimport android.util.Log\n\ninternal object Log {\n\n    private var TAG = FFmpeg::class.java.simpleName\n    private var DEBUG = false\n\n    @JvmStatic\n    fun setDebug(debug: Boolean) {\n        DEBUG = debug\n    }\n\n    fun setTag(tag: String) {\n        TAG = tag\n    }\n\n    @JvmStatic\n    fun d(obj: Any?) {\n        if (DEBUG) {\n            Log.d(TAG, obj?.toString() ?: \"\")\n        }\n    }\n\n    @JvmStatic\n    fun e(obj: Any?) {\n        if (DEBUG) {\n            Log.e(TAG, obj?.toString() ?: \"\")\n        }\n    }\n\n    @JvmStatic\n    fun w(obj: Any?) {\n        if (DEBUG) {\n            Log.w(TAG, obj?.toString() ?: \"\")\n        }\n    }\n\n    @JvmStatic\n    fun i(obj: Any?) {\n        if (DEBUG) {\n            Log.i(TAG, obj?.toString() ?: \"\")\n        }\n    }\n\n    @JvmStatic\n    fun v(obj: Any?) {\n        if (DEBUG) {\n            Log.v(TAG, obj?.toString() ?: \"\")\n        }\n    }\n\n    @JvmStatic\n    fun e(obj: Any?, throwable: Throwable?) {\n        if (DEBUG) {\n            Log.e(TAG, obj?.toString() ?: \"\", throwable)\n        }\n    }\n\n    @JvmStatic\n    fun e(throwable: Throwable?) {\n        if (DEBUG) {\n            Log.e(TAG, \"\", throwable)\n        }\n    }\n}"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/ResponseHandler.kt",
    "content": "package nl.bravobit.ffmpeg\n\ninterface ResponseHandler {\n    /**\n     * on Start\n     */\n    fun onStart()\n\n    /**\n     * on Finish\n     */\n    fun onFinish()\n}"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/ShellCommand.kt",
    "content": "package nl.bravobit.ffmpeg\n\ninternal class ShellCommand {\n    fun run(commandString: Array<String?>, environment: Map<String?, String?>?): Process? {\n        var process: Process? = null\n        try {\n            val processBuilder = ProcessBuilder(*commandString)\n            if (environment != null) {\n                processBuilder.environment().putAll(environment)\n            }\n            process = processBuilder.start()\n        } catch (t: Throwable) {\n            Log.e(\"Exception while trying to run: \" + commandString.contentToString(), t)\n        }\n        return process\n    }\n}"
  },
  {
    "path": "ffmpeg/android-ffmpeg/src/main/java/nl/bravobit/ffmpeg/Util.kt",
    "content": "package nl.bravobit.ffmpeg\n\nimport android.content.Context\nimport android.content.pm.ApplicationInfo\nimport android.os.AsyncTask\nimport android.os.Handler\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\n\ninternal object Util {\n\n    @JvmStatic\n    fun isDebug(context: Context): Boolean {\n        return context.applicationContext.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0\n    }\n\n    @JvmStatic\n    fun convertInputStreamToString(inputStream: InputStream?): String? {\n        try {\n            val r = BufferedReader(InputStreamReader(inputStream))\n            var str: String?\n            val sb = StringBuilder()\n            while (r.readLine().also { str = it } != null) {\n                sb.append(str)\n            }\n            return sb.toString()\n        } catch (e: IOException) {\n            Log.e(\"error converting input stream to string\", e)\n        }\n        return null\n    }\n\n    @JvmStatic\n    fun destroyProcess(process: Process?) {\n        if (process != null) {\n            try {\n                process.destroy()\n            } catch (e: Exception) {\n                Log.e(\"progress destroy error\", e)\n            }\n        }\n    }\n\n    @JvmStatic\n    fun killAsync(asyncTask: AsyncTask<*, *, *>?): Boolean {\n        return asyncTask != null && !asyncTask.isCancelled && asyncTask.cancel(true)\n    }\n\n    @JvmStatic\n    fun isProcessCompleted(process: Process?): Boolean {\n        try {\n            if (process == null) return true\n            process.exitValue()\n            return true\n        } catch (e: IllegalThreadStateException) {\n            // do nothing\n        }\n        return false\n    }\n\n    fun observeOnce(predicate: ObservePredicate, run: Runnable, timeout: Int): FFbinaryObserver {\n        val observer = Handler()\n        val observeAction: FFbinaryObserver = object : FFbinaryObserver {\n            private var canceled = false\n            private var timeElapsed = 0\n            override fun run() {\n                if (timeElapsed + 40 > timeout) cancel()\n                timeElapsed += 40\n                if (canceled) return\n                var readyToProceed = false\n                readyToProceed = try {\n                    predicate.isReadyToProceed\n                } catch (e: Exception) {\n                    Log.v(\"Observing \" + e.message)\n                    observer.postDelayed(this, 40)\n                    return\n                }\n                if (readyToProceed) {\n                    Log.v(\"Observed\")\n                    run.run()\n                } else {\n                    Log.v(\"Observing\")\n                    observer.postDelayed(this, 40)\n                }\n            }\n\n            override fun cancel() {\n                canceled = true\n            }\n        }\n        observer.post(observeAction)\n        return observeAction\n    }\n\n    interface ObservePredicate {\n        val isReadyToProceed: Boolean\n    }\n}"
  },
  {
    "path": "ffmpeg/copy-ffmpeg-executables.sh",
    "content": "#!/usr/bin/env bash\n\n# CD to script location\ncd \"$(dirname \"$0\")\" || echo \"cd to $(dirname \"$0\") Failed\"\n\n# Copy ffmpeg executables for all targets\nfor target in arm64-v8a armeabi-v7a x86 x86_64\ndo\n  mkdir -p ./android-ffmpeg/src/main/jniLibs/$target/\n  cp ./ffmpeg-android-maker/build/ffmpeg/$target/bin/ffmpeg  ./android-ffmpeg/src/main/jniLibs/$target/lib..ffmpeg..so\ndone\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\n#distributionSha256Sum=7faa7198769f872826c8ef4f1450f839ec27f0b4d5d1e51bade63667cbccd205\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-7.3.3-bin.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "gradle.properties",
    "content": "#\n#  * Copyright (c)  2021  Shabinder Singh\n#  * This program is free software: you can redistribute it and/or modify\n#  * it under the terms of the GNU General Public License as published by\n#  * the Free Software Foundation, either version 3 of the License, or\n#  * (at your option) any later version.\n#  *\n#  * This program is distributed in the hope that it will be useful,\n#  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n#  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n#  * GNU General Public License for more details.\n#  *\n#  *  You should have received a copy of the GNU General Public License\n#  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n#\n\n# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\norg.gradle.jvmargs=-Xmx2048m -XX:+UseParallelGC\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n# AndroidX package structure to make it clearer which packages are bundled with the\n# Android operating system, and which are packaged with your app\"s APK\n# https://developer.android.com/topic/libraries/support-library/androidx-rn\nandroid.useAndroidX=true\n# Automatically convert third-party libraries to use AndroidX\nandroid.enableJetifier=true\n# Kotlin code style for this project: \"official\" or \"obsolete\":\nkotlin.code.style=official\norg.gradle.parallel=true\norg.gradle.caching=true\nkotlin.native.disableCompilerDaemon=true\nkotlin.mpp.stability.nowarn=true\nkotlin.mpp.enableGranularSourceSetsMetadata=true\nkotlin.native.enableDependencyPropagation=false\nxcodeproj=./spotiflyer-ios\n#kotlin.native.cacheKind=none\n#org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env sh\n\n#\n# Copyright 2015 the original author or authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn () {\n    echo \"$*\"\n}\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\n  NONSTOP* )\n    nonstop=true\n    ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" -a \"$nonstop\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif [ \"$cygwin\" = \"true\" -o \"$msys\" = \"true\" ] ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=`expr $i + 1`\n    done\n    case $i in\n        0) set -- ;;\n        1) set -- \"$args0\" ;;\n        2) set -- \"$args0\" \"$args1\" ;;\n        3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Escape application args\nsave () {\n    for i do printf %s\\\\n \"$i\" | sed \"s/'/'\\\\\\\\''/g;1s/^/'/;\\$s/\\$/' \\\\\\\\/\" ; done\n    echo \" \"\n}\nAPP_ARGS=`save \"$@\"`\n\n# Collect all arguments for the java command, following the shell quoting and substitution rules\neval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS \"\\\"-Dorg.gradle.appname=$APP_BASE_NAME\\\"\" -classpath \"\\\"$CLASSPATH\\\"\" org.gradle.wrapper.GradleWrapperMain \"$APP_ARGS\"\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@rem\n@rem Copyright 2015 the original author or authors.\n@rem\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\n@rem you may not use this file except in compliance with the License.\n@rem You may obtain a copy of the License at\n@rem\n@rem      https://www.apache.org/licenses/LICENSE-2.0\n@rem\n@rem Unless required by applicable law or agreed to in writing, software\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n@rem See the License for the specific language governing permissions and\n@rem limitations under the License.\n@rem\n\n@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto execute\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto execute\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %*\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "infra/.terraform.lock.hcl",
    "content": "# This file is maintained automatically by \"terraform init\".\n# Manual edits may be lost in future updates.\n\nprovider \"registry.terraform.io/hashicorp/azurerm\" {\n  version = \"2.52.0\"\n  hashes = [\n    \"h1:bYwfAgIZFgbGVGYjnZ0OO+RumXn6UDNl2VmIm5gi8tI=\",\n    \"zh:1ee2dd8215919001736ae27473844c80a04ebbd56ddd12eca7f45aab6cda2274\",\n    \"zh:26791137ce5e7ea088caf75321aefb19f1ad5eb63dcc736342c99866a1b3af0e\",\n    \"zh:4903fda8700381ae7b91dc0c1e2fbea6ab63f56f14a09f7ba73c914d3f9d02b3\",\n    \"zh:5b6e49c9878d8586cbe38eae5188fb0a92319a5fdb33f51fe27ac50a7a8aa1f6\",\n    \"zh:64d5707955e73655e6aefaa6f9abce2fedd7e068cbe71fcc84a676263f39ef3e\",\n    \"zh:9646bef60395ceca137eea5bf87aa3a5b68a45e1018a6fa600a6d497a112b8ce\",\n    \"zh:9e0e716e08c433974c1b48084117762f59e5323d5de62b10cde53dec6e0bd6ae\",\n    \"zh:cc348e88922a82bd3ab6bab590735949f219fee9c021214861fed7c65546ec86\",\n    \"zh:d09368d44ee2f759ba3427c391e21aed2dda50cc39f079dea3160e5aad2f0ab0\",\n    \"zh:df88a810a6867d96d4452a0eb74e835e3c7c55522e53ee1d7a32af2e91e72abf\",\n    \"zh:f8fee4ec974e31b8eeaeb95dd1d844e58fdd121dbd37e2130586f61ed9a83ac2\",\n  ]\n}\n"
  },
  {
    "path": "infra/main.tf",
    "content": "terraform {\n  backend \"artifactory\" {\n    // -backend-config=\"username=xxx@xxx.com\" \\\n    // -backend-config=\"password=xxxxxx\" \\\n    url     = \"https://spotiflyer.jfrog.io/artifactory\"\n    repo    = \"terraform-state\"\n    subpath = \"SpotiFlyer\"\n  }\n}\n\nprovider \"azurerm\" {\n  features {}\n}\n\nresource \"azurerm_resource_group\" \"main\" {\n  location = \"westeurope\"\n  name     = \"SpotiFlyer\"\n}\n\nresource \"azurerm_application_insights\" \"main\" {\n  name                = azurerm_resource_group.main.name\n  location            = azurerm_resource_group.main.location\n  resource_group_name = azurerm_resource_group.main.name\n  application_type    = \"java\"\n}\n\nresource \"azurerm_app_service_plan\" \"main\" {\n  location            = azurerm_resource_group.main.location\n  name                = azurerm_resource_group.main.name\n  resource_group_name = azurerm_resource_group.main.name\n  kind                = \"Linux\"\n  reserved            = true\n  sku {\n    tier = \"Free\"\n    size = \"F1\"\n  }\n}\n\nresource \"azurerm_app_service\" \"main\" {\n  resource_group_name = azurerm_app_service_plan.main.resource_group_name\n  app_service_plan_id = azurerm_app_service_plan.main.id\n  location            = azurerm_app_service_plan.main.location\n  name                = azurerm_app_service_plan.main.name\n  https_only          = true\n\n  site_config {\n    use_32_bit_worker_process = true\n    app_command_line          = \"\"\n    linux_fx_version          = \"DOCKER|${var.docker_image_tag}\"\n    http2_enabled             = true\n    cors {\n      allowed_origins = [\"*\"]\n    }\n  }\n\n  app_settings = {\n    WEBSITES_ENABLE_APP_SERVICE_STORAGE = false\n    DOCKER_REGISTRY_SERVER_URL          = var.docker_registry\n    DOCKER_REGISTRY_SERVER_USERNAME     = var.docker_registry_username\n    DOCKER_REGISTRY_SERVER_PASSWORD     = var.docker_registry_password\n    AZURE_MONITOR_INSTRUMENTATION_KEY   = azurerm_application_insights.main.instrumentation_key\n    APPINSIGHTS_INSTRUMENTATIONKEY      = azurerm_application_insights.main.instrumentation_key\n    APPINSIGHTS_PROFILERFEATURE_VERSION = \"1.0.0\"\n    WEBSITE_HTTPLOGGING_RETENTION_DAYS  = \"35\"\n    CORSANYWHERE_ALLOWLIST  = var.cors_anywhere_allow_list\n    CORSANYWHERE_RATELIMIT  = var.cors_anywhere_rate_limit\n  }\n}\n"
  },
  {
    "path": "infra/outputs.tf",
    "content": "output \"app_service_name\" {\n  value = azurerm_app_service.main.name\n}\n\noutput \"app_service_default_hostname\" {\n  value = \"https://${azurerm_app_service.main.default_site_hostname}\"\n}\n"
  },
  {
    "path": "infra/variables.tf",
    "content": "variable \"docker_registry\" {\n  type    = string\n  default = \"https://docker.pkg.github.com\"\n}\n\nvariable \"docker_registry_username\" {\n  type    = string\n}\n\nvariable \"docker_registry_password\" {\n  type      = string\n  sensitive = true\n}\n\nvariable \"docker_image_tag\" {\n  type = string\n  default = \"docker.pkg.github.com/shabinder/cors-anywhere/server:latest\"\n}\n\nvariable \"cors_anywhere_allow_list\" {\n  type = string\n  default = \"\"\n}\n\nvariable \"cors_anywhere_rate_limit\" {\n  type = string\n  default = \"\"\n}\n\n"
  },
  {
    "path": "maintenance-tasks/build.gradle.kts",
    "content": "plugins {\n    kotlin(\"jvm\")\n    kotlin(\"plugin.serialization\")\n    id(\"ktlint-setup\")\n    application\n}\n\ngroup = \"com.shabinder\"\nversion = \"1.0\"\n\nrepositories {\n    mavenCentral()\n}\n\napplication {\n    mainClass.set(\"MainKt\")\n    applicationName = \"maintenance\"\n}\n\ndependencies {\n    with(deps) {\n        implementation(slf4j.simple)\n        implementation(bundles.ktor)\n        implementation(ktor.client.apache)\n        implementation(kotlinx.serialization.json)\n\n        // testDep\n        testImplementation(kotlin.kotlinTestJunit)\n    }\n}\n\ntasks.test {\n    useJUnit()\n}\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/common/Common.kt",
    "content": "@file:Suppress(\"FunctionName\")\n\npackage common\n\nimport io.ktor.client.HttpClient\nimport io.ktor.client.features.HttpTimeout\nimport io.ktor.client.features.json.JsonFeature\nimport io.ktor.client.features.json.serializer.KotlinxSerializer\nimport io.ktor.client.features.logging.DEFAULT\nimport io.ktor.client.features.logging.LogLevel\nimport io.ktor.client.features.logging.Logger\nimport io.ktor.client.features.logging.Logging\nimport kotlinx.serialization.json.Json\n\ninternal object Common {\n    const val GITHUB_API = \"https://api.github.com\"\n    fun START_SECTION(tagName: String = \"HTI\") = \"<!--START_SECTION:$tagName-->\"\n    fun END_SECTION(tagName: String = \"HTI\") = \"<!--END_SECTION:$tagName-->\"\n    const val USER_AGENT = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:88.0) Gecko/20100101 Firefox/88.0\"\n}\n\ninternal val client = HttpClient {\n    install(HttpTimeout)\n    install(JsonFeature) {\n        serializer = KotlinxSerializer(\n            Json {\n                ignoreUnknownKeys = true\n                isLenient = true\n            }\n        )\n    }\n    install(Logging) {\n        logger = Logger.DEFAULT\n        level = LogLevel.INFO\n    }\n}\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/common/ContentUpdation.kt",
    "content": "package common\n\n/*\n* Helper Function to Replace Obsolete Content with new Updated Content\n* */\nfun getUpdatedContent(\n    oldContent: String,\n    newInsertionText: String,\n    tagName: String\n): String {\n    return getReplaceableRegex(tagName).replace(\n        oldContent,\n        getReplacementText(tagName, newInsertionText)\n    )\n}\n\nprivate fun getReplaceableRegex(tagName: String): Regex {\n    return \"\"\"${Common.START_SECTION(tagName)}(?s)(.*)${Common.END_SECTION(tagName)}\"\"\".toRegex()\n}\n\nprivate fun getReplacementText(\n    tagName: String,\n    newInsertionText: String\n): String {\n    return \"\"\"\n            ${Common.START_SECTION(tagName)}\n            $newInsertionText\n            ${Common.END_SECTION(tagName)}\n    \"\"\".trimIndent()\n}\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/common/Date.kt",
    "content": "package common\n\nimport java.util.*\n\nfun getTodayDate(): String {\n    val c: Calendar = Calendar.getInstance()\n    val monthName = arrayOf(\n        \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\",\n        \"August\", \"September\", \"October\", \"November\",\n        \"December\"\n    )\n    val month = monthName[c.get(Calendar.MONTH)]\n    val year: Int = c.get(Calendar.YEAR)\n    val date: Int = c.get(Calendar.DATE)\n    return \" $date $month, $year\"\n}\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/common/GithubService.kt",
    "content": "package common\n\nimport io.ktor.client.request.get\nimport io.ktor.client.request.header\nimport io.ktor.client.request.headers\nimport io.ktor.client.request.put\nimport io.ktor.http.ContentType\nimport io.ktor.http.contentType\nimport io.ktor.util.InternalAPI\nimport io.ktor.util.encodeBase64\nimport kotlinx.serialization.json.JsonObject\nimport kotlinx.serialization.json.buildJsonObject\nimport kotlinx.serialization.json.jsonPrimitive\nimport kotlinx.serialization.json.put\nimport models.github.GithubFileContent\nimport models.github.GithubReleasesInfo\n\ninternal object GithubService {\n\n    private const val baseURL = Common.GITHUB_API\n\n    suspend fun getGithubRepoReleasesInfo(\n        ownerName: String,\n        repoName: String,\n    ): GithubReleasesInfo {\n        return client.get<GithubReleasesInfo>(\"$baseURL/repos/$ownerName/$repoName/releases\")\n    }\n\n    suspend fun getGithubFileContent(\n        secrets: Secrets,\n        fileName: String = \"README.md\"\n    ): GithubFileContent {\n        return getGithubFileContent(\n            token = secrets.githubToken,\n            ownerName = secrets.ownerName,\n            repoName = secrets.repoName,\n            branchName = secrets.branchName,\n            fileName = fileName\n        )\n    }\n\n    suspend fun getGithubFileContent(\n        token: String,\n        ownerName: String,\n        repoName: String,\n        branchName: String,\n        fileName: String,\n    ): GithubFileContent {\n        val resp = client.get<JsonObject>(\"$baseURL/repos/$ownerName/$repoName/contents/$fileName?ref=$branchName\") {\n            headers {\n                header(\"Authorization\", \"token $token\")\n            }\n        }\n        // Get Raw Readme File\n        val decodedString = client.get<String>(\"https://raw.githubusercontent.com/$ownerName/$repoName/$branchName/$fileName\") {\n            headers {\n                header(\"Authorization\", \"token $token\")\n            }\n        }\n        return GithubFileContent(\n            decryptedContent = decodedString,\n            sha = resp[\"sha\"]?.jsonPrimitive.toString()\n                .removeSurrounding(\"\\\"\")\n        )\n    }\n\n    @OptIn(InternalAPI::class)\n    suspend fun updateGithubFileContent(\n        token: String,\n        ownerName: String,\n        repoName: String,\n        branchName: String,\n        fileName: String,\n        commitMessage: String,\n        rawContent: String,\n        sha: String\n    ): JsonObject {\n        return client.put<JsonObject>(\"$baseURL/repos/$ownerName/$repoName/contents/$fileName\") {\n            body = buildJsonObject {\n                put(\"branch\", branchName)\n                put(\"message\", commitMessage)\n                put(\"content\", rawContent.encodeBase64())\n                put(\"sha\", sha)\n                /*put(\"committer\", buildJsonObject {\n                    put(\"name\",\"Shabinder Singh\")\n                    put(\"email\",\"dev.shabinder@gmail.com\")\n                })*/\n            }\n\n            headers {\n                header(\"Authorization\", \"token $token\")\n                contentType(ContentType.Application.Json)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/common/HCTIService.kt",
    "content": "package common\n\nimport io.ktor.client.request.header\nimport io.ktor.client.request.headers\nimport io.ktor.client.request.post\nimport io.ktor.http.ContentType\nimport io.ktor.http.contentType\nimport io.ktor.http.userAgent\nimport kotlinx.serialization.json.JsonObject\nimport kotlinx.serialization.json.buildJsonObject\nimport kotlinx.serialization.json.jsonPrimitive\nimport kotlinx.serialization.json.put\nimport utils.HCTI_URL_RESPONSE_ERROR\n\ninternal object HCTIService {\n\n    private const val baseURL = \"https://htmlcsstoimage.com/demo_run\"\n\n    /*\n    * - When Using Either Viewport Width/Height(in Pixels) , Both are required\n    * */\n    suspend fun getImageURLFromHtml(\n        html: String,\n        css: String = \"\",\n        delayInMilliSeconds: Int = 250,\n        viewPortHeight: String = \"\",\n        viewPortWidth: String = \"\",\n        deviceScale: Int = 2\n    ) = getImageURL(\n        mode = \"html\",\n        data = html,\n        css = css,\n        delayInMilliSeconds = delayInMilliSeconds,\n        viewPortHeight = viewPortHeight,\n        viewPortWidth = viewPortWidth,\n        deviceScale = deviceScale\n    )\n\n    suspend fun getImageURLFromURL(\n        url: String,\n        delayInMilliSeconds: Int = 250,\n        viewPortHeight: String = \"\",\n        viewPortWidth: String = \"\",\n        deviceScale: Int = 2\n    ) = getImageURL(\n        mode = \"url\",\n        data = url,\n        delayInMilliSeconds = delayInMilliSeconds,\n        viewPortHeight = viewPortHeight,\n        viewPortWidth = viewPortWidth,\n        deviceScale = deviceScale\n    )\n\n    private suspend fun getImageURL(\n        mode: String, // html/url\n        data: String,\n        css: String = \"\",\n        viewPortHeight: String = \"\",\n        viewPortWidth: String = \"\",\n        delayInMilliSeconds: Int = 250,\n        deviceScale: Int = 2,\n    ): String {\n        val resp = client.post<JsonObject>(baseURL) {\n            body = buildJsonObject {\n                put(mode, data)\n                put(\"console_mode\", \"\")\n                put(\"css\", css)\n                put(\"selector\", \"\")\n                put(\"ms_delay\", \"$delayInMilliSeconds\")\n                put(\"render_when_ready\", \"\")\n                put(\"viewport_width\", viewPortWidth)\n                put(\"viewport_height\", viewPortHeight)\n                put(\"google_fonts\", \"\")\n                put(\"device_scale\", \"$deviceScale\")\n            }\n            headers {\n                contentType(ContentType.Application.Json)\n                userAgent(Common.USER_AGENT)\n                header(\"Referer\", \"https://htmlcsstoimage.com/demo\")\n                header(\"Origin\", \"https://htmlcsstoimage.com\")\n                header(\"Host\", \"htmlcsstoimage.com\")\n            }\n        }\n        val url = resp[\"url\"] ?: throw HCTI_URL_RESPONSE_ERROR(response = resp.toString())\n        // bubble-up exceptions\n        return url.jsonPrimitive.toString().removeSurrounding(\"\\\"\")\n    }\n}\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/common/Secrets.kt",
    "content": "package common\n\nimport utils.byOptionalProperty\nimport utils.byProperty\n\ninternal data class Secrets(\n    val githubToken: String,\n    val ownerName: String,\n    val repoName: String,\n    val branchName: String,\n    val filePath: String,\n    val imageDescription: String,\n    val commitMessage: String,\n    val tagName: String\n) {\n    companion object {\n        fun initSecrets() = Secrets(\n            githubToken = \"GH_TOKEN\".byProperty,\n            ownerName = \"OWNER_NAME\".byProperty,\n            repoName = \"REPO_NAME\".byProperty,\n            branchName = \"BRANCH_NAME\".byOptionalProperty ?: \"main\",\n            filePath = \"FILE_PATH\".byOptionalProperty ?: \"README.md\",\n            imageDescription = \"IMAGE_DESCRIPTION\".byOptionalProperty ?: \"IMAGE\",\n            commitMessage = \"COMMIT_MESSAGE\".byOptionalProperty ?: \"HTML-TO-IMAGE Update\",\n            tagName = \"TAG_NAME\".byOptionalProperty ?: \"HTI\"\n            // hctiKey = \"HCTI_KEY\".analytics_html_img.getByProperty\n        )\n    }\n}\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/main.kt",
    "content": "import common.GithubService\nimport common.Secrets\nimport kotlinx.coroutines.runBlocking\nimport scripts.updateAnalyticsImage\nimport scripts.updateDownloadCards\nimport utils.debug\n\nfun main(args: Array<String>) {\n    debug(\"fun main: args -> ${args.joinToString(\";\")}\")\n    val secrets = Secrets.initSecrets()\n\n    runBlocking {\n\n        val githubFileContent = GithubService.getGithubFileContent(\n            secrets = secrets,\n            fileName = \"README.md\"\n        )\n\n        // Content To be Processed\n        var updatedGithubContent: String = githubFileContent.decryptedContent\n\n        // TASK -> Update Analytics Image in Readme\n        try {\n            updatedGithubContent = updateAnalyticsImage(\n                updatedGithubContent,\n                secrets\n            )\n        } catch (e: Exception) {\n            debug(\"Analytics Image Updation Failed\", e.message.toString())\n        }\n\n        // TASK -> Update Total Downloads Card\n        try {\n            updatedGithubContent = updateDownloadCards(\n                updatedGithubContent,\n                secrets.copy(tagName = \"DCI\")\n            )\n        } catch (e: Exception) {\n            debug(\"Download Card Updation Failed\", e.message.toString())\n        }\n\n        // Write New Updated README.md\n        GithubService.updateGithubFileContent(\n            token = secrets.githubToken,\n            ownerName = secrets.ownerName,\n            repoName = secrets.repoName,\n            branchName = secrets.branchName,\n            fileName = secrets.filePath,\n            commitMessage = secrets.commitMessage,\n            rawContent = updatedGithubContent,\n            sha = githubFileContent.sha\n        )\n    }\n}\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/models/github/Asset.kt",
    "content": "package models.github\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Asset(\n    val browser_download_url: String,\n    val content_type: String,\n    val created_at: String,\n    val download_count: Int,\n    val id: Int,\n//    val label: Any,\n    val name: String,\n    val node_id: String,\n    val size: Int,\n    val state: String,\n    val updated_at: String,\n    val uploader: Uploader,\n    val url: String\n)\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/models/github/Author.kt",
    "content": "package models.github\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Author(\n    val avatar_url: String,\n    val events_url: String,\n    val followers_url: String,\n    val following_url: String,\n    val gists_url: String,\n    val gravatar_id: String,\n    val html_url: String,\n    val id: Int,\n    val login: String,\n    val node_id: String,\n    val organizations_url: String,\n    val received_events_url: String,\n    val repos_url: String,\n    val site_admin: Boolean,\n    val starred_url: String,\n    val subscriptions_url: String,\n    val type: String,\n    val url: String\n)\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/models/github/GithubFileContent.kt",
    "content": "package models.github\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GithubFileContent(\n    val decryptedContent: String,\n    val sha: String\n)\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/models/github/GithubReleaseInfoItem.kt",
    "content": "package models.github\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GithubReleaseInfoItem(\n    val assets: List<Asset>,\n    val assets_url: String,\n    val author: Author,\n    val body: String,\n    val created_at: String,\n    val draft: Boolean,\n    val html_url: String,\n    val id: Int,\n    val name: String,\n    val node_id: String,\n    val prerelease: Boolean,\n    val published_at: String,\n    val reactions: Reactions? = null,\n    val tag_name: String,\n    val tarball_url: String,\n    val target_commitish: String,\n    val upload_url: String,\n    val url: String,\n    val zipball_url: String\n)\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/models/github/GithubReleasesInfo.kt",
    "content": "package models.github\n\ntypealias GithubReleasesInfo = ArrayList<GithubReleaseInfoItem>\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/models/github/Reactions.kt",
    "content": "package models.github\n\nimport kotlinx.serialization.Serializable\nimport kotlinx.serialization.json.JsonNames\n\n@Serializable\ndata class Reactions(\n    @JsonNames(\"+1\") val upVotes: Int = 0,\n    @JsonNames(\"-1\") val downVotes: Int = 0,\n    val confused: Int = 0,\n    val eyes: Int = 0,\n    val heart: Int = 0,\n    val hooray: Int = 0,\n    val laugh: Int = 0,\n    val rocket: Int = 0,\n    val total_count: Int = 0,\n    val url: String? = null\n)\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/models/github/Uploader.kt",
    "content": "package models.github\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Uploader(\n    val avatar_url: String,\n    val events_url: String,\n    val followers_url: String,\n    val following_url: String,\n    val gists_url: String,\n    val gravatar_id: String,\n    val html_url: String,\n    val id: Int,\n    val login: String,\n    val node_id: String,\n    val organizations_url: String,\n    val received_events_url: String,\n    val repos_url: String,\n    val site_admin: Boolean,\n    val starred_url: String,\n    val subscriptions_url: String,\n    val type: String,\n    val url: String\n)\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/models/matomo/MatomoDownloads.kt",
    "content": "package models.matomo\n\ntypealias MatomoDownloads = ArrayList<MatomoDownloadsItem>\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/models/matomo/MatomoDownloadsItem.kt",
    "content": "package models.matomo\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class MatomoDownloadsItem(\n    val idsubdatatable: Int = 0,\n    val label: String = \"com.shabinder.spotiflyer\",\n    val nb_hits: Int = 0,\n    val nb_visits: Int = 0,\n    val sum_time_spent: Int = 0\n)\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/scripts/UpdateAnalyticsImage.kt",
    "content": "package scripts\n\nimport common.*\nimport io.ktor.client.features.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport utils.RETRY_LIMIT_EXHAUSTED\nimport utils.debug\n\ninternal suspend fun updateAnalyticsImage(\n    fileContent: String? = null,\n    secrets: Secrets\n): String {\n    // debug(\"fun main: secrets -> $secrets\")\n\n    val oldContent = fileContent ?: GithubService.getGithubFileContent(\n        secrets = secrets,\n        fileName = \"README.md\"\n    ).decryptedContent\n\n    // debug(\"OLD FILE CONTENT\",oldGithubFile)\n    val imageURL = getAnalyticsImage().also {\n        debug(\"Updated IMAGE\", it)\n    }\n\n    return getUpdatedContent(\n        oldContent,\n        \"![Today's Analytics]($imageURL)\",\n        secrets.tagName\n    )\n}\n\ninternal suspend fun getAnalyticsImage(): String {\n    var contentLength: Long\n    var analyticsImage: String\n    var retryCount = 5\n\n    do {\n        /*\n        * Get a new Image from Analytics,\n        * -  Use Any Random useless query param ,\n        *    As HCTI Demo, `caches value for a specific Link`\n        * */\n        val randomID = (1..100000).random()\n        analyticsImage = HCTIService.getImageURLFromURL(\n            url = \"https://matomo.spotiflyer.ml/index.php?module=Widgetize&action=iframe&containerId=VisitOverviewWithGraph&disableLink=0&widget=1&moduleToWidgetize=CoreHome&actionToWidgetize=renderWidgetContainer&idSite=1&period=day&date=yesterday&disableLink=1&widget=$randomID\",\n            delayInMilliSeconds = 5000\n        )\n\n        // Sometimes we get incomplete image, hence verify `content-length`\n        val req = client.head<HttpResponse>(analyticsImage) {\n            timeout {\n                socketTimeoutMillis = 100_000\n            }\n        }\n        contentLength = req.headers[\"Content-Length\"]?.toLong() ?: 0\n        debug(\"Content Length for Analytics Image\", contentLength.toString())\n\n        if (retryCount-- == 0) {\n            // FAIL Gracefully\n            throw(RETRY_LIMIT_EXHAUSTED())\n        }\n    } while (contentLength <1_20_000)\n\n    return analyticsImage\n}\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/scripts/UpdateDownloadCards.kt",
    "content": "package scripts\n\nimport common.*\nimport io.ktor.client.features.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport models.matomo.MatomoDownloads\nimport utils.RETRY_LIMIT_EXHAUSTED\nimport utils.debug\n\ninternal suspend fun updateDownloadCards(\n    fileContent: String? = null,\n    secrets: Secrets\n): String {\n\n    val oldContent = fileContent ?: GithubService.getGithubFileContent(\n        secrets = secrets,\n        fileName = \"README.md\"\n    ).decryptedContent\n\n    var totalDownloads: Int = GithubService.getGithubRepoReleasesInfo(\n        secrets.ownerName,\n        secrets.repoName\n    ).let { allReleases ->\n        var totalCount = 0\n\n        for (release in allReleases) {\n            release.assets.forEach {\n                // debug(\"${it.name}: ${release.tag_name}\" ,\"Downloads: ${it.download_count}\")\n                totalCount += it.download_count\n            }\n        }\n\n        debug(\"Total Download Count:   $totalCount\")\n\n        return@let totalCount\n    }\n\n    // Add Matomo Downloads\n    client.get<MatomoDownloads>(\"https://matomo.spotiflyer.ml/?module=API&method=Actions.getDownloads&idSite=1&period=year&date=today&format=JSON&token_auth=anonymous\").forEach {\n        totalDownloads += it.nb_hits\n    }\n\n    return getUpdatedContent(\n        oldContent,\n        \"\"\"<a href=\"https://github.com/Shabinder/SpotiFlyer/releases/latest\"><img src=\"${getDownloadCard(totalDownloads)}\" height=\"125\" width=\"280\" alt=\"Total Downloads\"></a>\"\"\",\n        secrets.tagName\n    )\n}\n\nprivate suspend fun getDownloadCard(\n    count: Int\n): String {\n    var contentLength: Long\n    var downloadCard: String\n    var retryCount = 5\n\n    do {\n        downloadCard = HCTIService.getImageURLFromHtml(\n            html = getDownloadCardHtml(\n                count = count,\n                date = getTodayDate()\n            ),\n            css = downloadCardCSS,\n            viewPortHeight = \"170\",\n            viewPortWidth = \"385\"\n        )\n\n        // Sometimes we get incomplete image, hence verify `content-length`\n        val req = client.head<HttpResponse>(downloadCard) {\n            timeout {\n                socketTimeoutMillis = 100_000\n            }\n        }\n        contentLength = req.headers[\"Content-Length\"]?.toLong() ?: 0\n        // debug(contentLength.toString())\n\n        if (retryCount-- == 0) {\n            // FAIL Gracefully\n            throw(RETRY_LIMIT_EXHAUSTED())\n        }\n    } while (contentLength <40_000)\n    return downloadCard\n}\n\nfun getDownloadCardHtml(\n    count: Int,\n    date: String, // ex: 06 Jun 2021\n): String {\n    return \"\"\"\n        <div class=\"card-container\">\n          <div id=\"card\" class=\"dark-bg\">\n            <img id=\"profile-photo\" src=\"https://www.lupusresearch.org/wp-content/uploads/2017/09/resource-downloads-icon.png\">\n            <div class=\"text-wrapper\">\n              <p id=\"title\">Total Downloads</p>\n              <p id=\"source\">Github & F-Droid</p>\n              <div class=\"contact-wrapper\">\n                <a id=\"count\" href=\"#\">\n                  $count\n                </a>\n                <a id=\"date\" href=\"#\">\n                  Updated on: $date\n                </a>\n              </div>\n            </div>\n          </div>\n        </div>\n    \"\"\".trimIndent()\n}\n\nval downloadCardCSS =\n    \"\"\"\n        @import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');\n\n        * {\n          margin: 0;\n          padding: 0;\n        }\n\n        html,\n        body {\n          overflow: hidden;\n        }\n\n        .card-container {\n          height: 150px;\n          width: 360px;\n          padding: 8px 12px;\n          display: flex;\n          transition: 0.3s;\n        }\n\n        #card {\n          display: flex;\n          align-self: center;\n          width: fit-content;\n          background: linear-gradient(120deg, #f0f0f0 20%, #f9f9f9 30%); \n          border-radius: 22px;\n          padding: 20px 40px;\n          margin: 0 auto;\n          box-shadow: 4px 8px 20px rgba(0, 0, 0, 0.06);\n          transition: 0.3s;\n        }\n\n        #card:hover {\n          box-shadow: none;\n          cursor: pointer;\n          transform: translateY(2px)\n        }\n\n        #card:hover > #profile-photo {\n          opacity: 1\n        }\n\n        #profile-photo {\n          height: 90px;\n          width: 90px;\n          border-radius: 100px;\n          align-self: center;\n          box-shadow: 0 6px 30px rgba(199, 199, 199, 0.5);\n          opacity: 0.8;\n          transition: 0.3s;\n        }\n\n        .text-wrapper {\n          font-family: 'Poppins', sans-serif;\n          line-height: 0;\n          align-self: center;\n          margin-left: 20px;\n        }\n\n        .text-wrapper p {\n          margin: 0;\n        }\n\n        .contact-wrapper a {\n          display: block;\n          white-space: nowrap;\n          text-decoration: none;\n        }\n\n        #title {\n          font-size: 20px;\n          color: #5f5f5f;\n          margin-bottom: 20px;\n        }\n\n        #source {\n          font-size: 12px;\n          color: #9B9B9B;\n          margin-bottom: 22px;\n        }\n\n        #count {\n          padding-top: 8px;\n          font-size: 30px;\n          color: #615F5F;\n          margin-top: 15px;\n          transition: 0.3s;\n        }\n        #date {\n          padding-top: 12px;\n          font-size: 14px;\n          color: #615F5F;\n          margin-top: 15px;\n          transition: 0.3s;\n        }\n\n        #count:hover,\n        #date:hover {\n          color: #9B9B9B;\n        }\n    \"\"\".trimIndent()\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/utils/Exceptions.kt",
    "content": "@file:Suppress(\"ClassName\")\n\npackage utils\n\ndata class ENV_KEY_MISSING(\n    val keyName: String,\n    override val message: String? = \"$keyName was not found, please check your ENV variables\"\n) : Exception(message)\n\ndata class HCTI_URL_RESPONSE_ERROR(\n    val response: String,\n    override val message: String? = \"Server Error, We Recieved this Resp: $response\"\n) : Exception(message)\n\ndata class RETRY_LIMIT_EXHAUSTED(\n    override val message: String? = \"RETRY LIMIT EXHAUSTED!\"\n) : Exception(message)\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/utils/Ext.kt",
    "content": "package utils\n\nval String.byProperty: String get() = System.getenv(this)\n    ?: throw (ENV_KEY_MISSING(this))\n\nval String.byOptionalProperty: String? get() = System.getenv(this)\n\nfun debug(message: String) = println(\"\\n::debug::$message\")\nfun debug(tag: String, message: String) = println(\"\\n::debug::$tag:\\n$message\")\n"
  },
  {
    "path": "maintenance-tasks/src/main/java/utils/TestClass.kt",
    "content": "package utils\n\nimport kotlinx.coroutines.runBlocking\n\n// Test Class- at development Time\nfun main(): Unit = runBlocking {\n\n}\n"
  },
  {
    "path": "scripts/build-ffmpeg.sh",
    "content": "#!/bin/bash\n\n./../ffmpeg-kit/android.sh \\\n  --lts \\\n  --disable-everything \\\n  --disable-network \\\n  --disable-autodetect \\\n  --enable-small \\\n  --enable-decoder=aac*,ac3*,opus,vorbis \\\n  --enable-demuxer=mov,m4v,matroska \\\n  --enable-muxer=mp3,mp4 \\\n  --enable-protocol=file \\\n  --enable-encoder=mp3 \\\n  --enable-filter=aresample \\\n  --enable-gpl \\\n  --enable-version3 \\\n  --enable-cross-compile \\\n  --enable-pic \\\n  --enable-jni \\\n  --enable-optimizations \\\n  --enable-v4l2-m2m"
  },
  {
    "path": "settings.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nenableFeaturePreview(\"VERSION_CATALOGS\")\ndependencyResolutionManagement {\n    @Suppress(\"UnstableApiUsage\")\n    versionCatalogs {\n        create(\"deps\") {\n            from(files(\"buildSrc/deps.versions.toml\"))\n        }\n    }\n}\n\nrootProject.name = \"spotiflyer\"\n\ninclude(\n    \":common:database\",\n    \":common:compose\",\n    \":common:root\",\n    \":common:main\",\n    \":common:list\",\n    \":common:preference\",\n    \":common:data-models\",\n    \":common:providers\",\n    \":common:core-components\",\n    \":common:dependency-injection\",\n    \":ffmpeg:android-ffmpeg\",\n    \":android\",\n    \":desktop\",\n    \":web-app\",\n    //\":console-app\",\n    \":maintenance-tasks\",\n)\n"
  },
  {
    "path": "translations/Strings_cn.properties.xml",
    "content": "title = SpotiFlyer\nabout = 关于\nhistory = 历史记录\ndonate = 捐赠\npreferences = 个性化\nsearch = 搜索\nsupportedPlatforms = 支持的平台\nsupportDevelopment = 支持此项目\nopenProjectRepo = 打开项目回购\nstarOrForkProject = Github项目地址\nhelp = 帮助\ntranslate = 翻译\nhelpTranslateDescription = 帮助我们将此软件翻译为其他语言\nsupportDeveloper = 支持开发者\ndonateDescription = 如果你认为我的工作应该得到报酬，你可以在这里支持我。\nshare = 分享\nshareDescription = 与您的朋友和家人分享这个应用程序。\nwhatWentWrong = 发生错误\ncopyToClipboard = 复制到剪切板\ncopyCodeInGithubIssue = 在创建 Github 问题，或报告此问题以获得更好的帮助 时，粘贴以下代码。\nstatus = 状态\nanalytics = 分析\nanalyticsDescription = 您的数据是匿名的，永远不会与第 3 方服务共享。\nnoHistoryAvailable = 无历史记录\ncleaningAndExiting = 正在清理并退出\ntotal = 统计\ncompleted = 已完成\nfailed = 失败\nexit = 退出\ndownloading = 正在下载\nprocessing = 处理中\nqueued = 已加入下载队列\nsetDownloadDirectory = 设置下载目录\ndownloadDirectorySetTo = 下载目录设置为: {0}\nnoWriteAccess = 无访问权限: {0} , 正在恢复到上一个\nshareMessage = 嘿，看看这个给力的音乐下载器 http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = 赠款分析\nnoInternetConnection = 无网络连接！\ncheckInternetConnection = 请检查网络连接。\ngrantPermissions = 授予权限\nrequiredPermissions = 需要以下权限:\nstoragePermission = 储存权限.\nstoragePermissionReason = 将您喜爱的歌曲下载到此设备。\nbackgroundRunning = 正在后台运行。\nbackgroundRunningReason = 在没有任何系统中断的情况下在后台下载所有歌曲。\nno = 无\nyes = 有\n\nacraNotificationTitle = SpotiFlyer 崩溃了。\nacraNotificationText = 请将崩溃报告发送给应用程序开发人员，因此这种不幸的事件可能不会再次发生。\n\nalbumArt = 专辑封面\ntracks = 曲目\ncoverImage = 封面\nreSearch = 重新搜索\nloading = 加载中\ndownloadAll = 全部下载\nbutton = 按钮\nerrorOccurred = 发生错误，请检查您的链接/网络连接。\ndownloadDone = 下载完成\ndownloadError = 发生错误！ 无法下载此曲目。\ndownloadStart = 开始下载\nsupportUs = 我们需要你的帮助！\ndonation = 捐赠\nworldWideDonations = 全球捐赠\nindianDonations = 印度捐赠\ndismiss = 忽略\nremindLater = 稍后提醒\n\nmp3ConverterBusy = MP3 转换器无法访问，可能很忙！\nunknownError = 未知错误\nnoMatchFound = 未找到匹配项！\nnoLinkFound = 未找到链接！\nlinkNotValid = 链接不可用！\nfeatureUnImplemented = 功能尚未实现。\n\nminute = 分\nsecond = 秒\n\nspotiflyerLogo = SpotiFlyer 图标\nbackButton = 后退键\ninfoTab = 详情\nhistoryTab = 历史\nlinkTextBox = 链接\npasteLinkHere = 在这里粘贴链接\nenterALink = 请输入链接！\nmadeWith = 用\nlove = 喜欢\ninIndia = 在印度\nopen = 打开\nbyDeveloperName = 开发者: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_cro.properties",
    "content": "title = SpotiFlyer\nabout = O aplikaciji\nhistory = Povijest\ndonate = Doniraj\npreferences = Izbori\nsearch = Pretraži\nsupportedPlatforms = Podržane platforme\nsupportDevelopment = Podržani razvoj\nopenProjectRepo = Otvori projekt repo\nstarOrForkProject = Označi / Uredi projekt na platformi Github.\nhelp = Pomoć\ntranslate = Prevedi\nhelpTranslateDescription = Pomozite nam prevesti ovu aplikaciju na vaš jezik.\nsupportDeveloper = Podržite razvojnog programera.\ndonateDescription = Ako mislite da zaslužujem biti plaćen za svoj rad, možete me podržati ovdje.\nshare = Podijeli\nshareDescription = Podijeli ovu aplikaciju sa obitelji i prijateljima.\nwhatWentWrong = Nešto nije u redu...\ncopyToClipboard = Kopiraj u međuspremnik\ncopyCodeInGithubIssue = Kopiraj Zalijepi Kod Ispod kada stvarate problem na Github / Prijavite ovaj problem za bolju pomoć.\nstatus = Status\nanalytics = Analitike\nanalyticsDescription = Vaši podatci su anonimni i nikad se ne dijele sa trećim aplikacijama.\nnoHistoryAvailable = Nema povijesti\ncleaningAndExiting = Čistim i izlazim\ntotal = Ukupno\ncompleted = Dovršeno\nfailed = Neuspjelo\nexit = Izlaz\ndownloading = Preuzimam\nprocessing = U postupku\nqueued = Čeka se\nsetDownloadDirectory = Postavi mjesto preuzimanja\ndownloadDirectorySetTo = Mjesto preuzimanja postavljeno u: {0}\nnoWriteAccess = NEMA PRISTUP za: {0} , Vraćam na prethodno\nshareMessage = Hej, pogledaj ovu odličnu aplikaciju za preuzimanje glazbe http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Dozvoli analitike\nnoInternetConnection = Nema internetske veze!\ncheckInternetConnection = Molimo provjerite svoju vezu s internetom.\ngrantPermissions = Dozvoli dopuštenja\nrequiredPermissions = Potrebna dopuštenja:\nstoragePermission = Dopuštenje za pohranu.\nstoragePermissionReason = Za preuzeti svoje najdraže pjesme na vaš uređaj.\nbackgroundRunning = Radi u pozadini.\nbackgroundRunningReason = Za preuzeti sve pjesme u pozadini bez sistemskog ometanja.\nno = Ne\nyes = Naravno\n\nacraNotificationTitle = UPS, SpotiFlyer se srušio\nacraNotificationText = Molim vas pošaljite iskaz o rušenju Programerima Aplikacije, Tako da se ovaj događaj ne ponovi.\n\nalbumArt = Albumska umjetnsot\ntracks = Naslovi\ncoverImage = Naslovna slika\nreSearch = Ponovno pretraži\nloading = Učitavam\ndownloadAll = Preuzmi sve\nbutton = Gumb\nerrorOccurred = Dogodila se greška, Provjerite svoj link / Vezu s internetom\ndownloadDone = Preuzimanje završeno\ndownloadError = Greška! Ne mogu preuzeti ovaj naslov\ndownloadStart = Pokreni preuzimanje\nsupportUs = Trebamo Vašu Podršku!\ndonation = Donacija\nworldWideDonations = Donacije diljem svijeta\nindianDonations = Donacije samo iz Indije\ndismiss = Odbaci\nremindLater = Podsjeti me kasnije\n\nmp3ConverterBusy = MP3 Pretvarač se ne može dohvatiti, najvjerovatnije je ZAUZET !\nunknownError = Nepoznata Greška\nnoMatchFound = NIJE nađena podudaranost!\nnoLinkFound = NIJE nađen link za preuzimanje\nlinkNotValid = Uneseni link NE vrijedi!\nfeatureUnImplemented = Značajka još nije uvedena.\n\nminute = minuta\nsecond = sekundi/a\n\nspotiflyerLogo = SpotiFlyer Logotip\nbackButton = Vrati se natrag gumb\ninfoTab = Tabulator informacija\nhistoryTab = Tabulator povijesti\nlinkTextBox = Prostor Za Link\npasteLinkHere = Zalijepite link ovdje...\nenterALink = Unesite Link!\nmadeWith = Napravljeno s\nlove = Ljubavlju\ninIndia = iz Indije\nopen = Otvorite\nbyDeveloperName = kreirao: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_cs.properties",
    "content": "title = SpotiFlyer\nabout = Informace\nhistory = Historie\ndonate = Přispět\npreferences = Předvolby\nsearch = Hledat\nsupportedPlatforms = Podporované platformy\nsupportDevelopment = Podpoř rozvoj\nopenProjectRepo = Otevřít Github repo projektu\nstarOrForkProject = Ohvězdičkuj / Forkni si projekt na Githubu.\nhelp = Podpora\ntranslate = Přeložit\nhelpTranslateDescription = Pomož nám přeložit tuto aplikaci do tvého jazyku.\nsupportDeveloper = Podpořit vývojáře\ndonateDescription = Pokud si myslíš, že si zasloužím za svou práci dostat zaplaceno, můžeš mě podpořit zde.\nshare = Sdílet\nshareDescription = Sdílej tento projekt se svou rodinou a kamarády.\nwhatWentWrong = Co se pokazilo...\ncopyToClipboard = Zkopírovat do schránky\ncopyCodeInGithubIssue = Zkopířuj a vlož tento kód při vytváření Github problému / nahlašování chyby pro lepší pomoc.\nstatus = Status\nanalytics = Analytika\nanalyticsDescription = Tvé data jsou anonymní a nejsou nikdy sdílena se službami třetích stran.\nnoHistoryAvailable = Žádná dostupná historie\ncleaningAndExiting = Čištění a uzavírání\ntotal = Dohromady\ncompleted = Dokončeno\nfailed = Nezdařeno\nexit = Ukončit\ndownloading = Stahování\nprocessing = Zpracovávání\nqueued = Ve frontě\nsetDownloadDirectory = Nastavit adresář pro stažené skladby\ndownloadDirectorySetTo = Adresář stažených souborů nastaven na: {0}\nnoWriteAccess = BEZ PŘÍSTUPU K ZÁPISU v: {0} , Navrácení k předchozímu\nshareMessage = Hej, podívej se na tento dokonalý stahovač hudby http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Povolit analytika\nnoInternetConnection = Bez internetového připojení!\ncheckInternetConnection = Zkontroluj si prosím připojení k síti.\ngrantPermissions = Udělit oprávnění\nrequiredPermissions = Požadovaná oprávnění:\nstoragePermission = Oprávnění úložiště.\nstoragePermissionReason = Ke stažení tvých oblíbených skladeb do tohoto zařízení.\nbackgroundRunning = Běží na pozadí.\nbackgroundRunningReason = Jestli chcete stáhnout všechny skladby na pozadí, bez přerušení systémem.\nno = Ne\nyes = Ano\n\nacraNotificationTitle = JEJDA, SpotiFlyer spadl\nacraNotificationText = Prosím pošli hlášení o selhání vyvojářům aplikace, Aby se tato nešťastná událost nemusela opakovat.\n\nalbumArt = Obal alba\ntracks = Skladby\ncoverImage = Titulní obrázek\nreSearch = Hledat znova\nloading = Načítání\ndownloadAll = Stáhnout vše\nbutton = Talčítko\nerrorOccurred = Došlo k chybě, zkontroluj odkaz skladby / internetové připojení\ndownloadDone = Stahování dokončeno\ndownloadError = Chyba! Skladbu se nepodařilo stáhnout\ndownloadStart = Zahájit stažení\nsupportUs = Potřebujeme tvoji podporu!\ndonation = Příspěvek\nworldWideDonations = Celosvětových příspěvků\nindianDonations = Pouze příspěvky z Indie\ndismiss = Zavřít\nremindLater = Připomenout později\n\nmp3ConverterBusy = MP3 Konvertor je nedostupný, pravděpodobně ZANEPRÁZDNĚNÝ!\nunknownError = Neznámá chyba\nnoMatchFound = Žádná shoda nenalezena!\nnoLinkFound = Nebyl nalezen žádný odkaz ke stažení\nlinkNotValid = Zadaný odkaz není platný!\nfeatureUnImplemented = Funkce dosud nebyla zahrnuta.\n\nminute = min\nsecond = sek\n\nspotiflyerLogo = SpotiFlyer Logo\nbackButton = Tlačítko zpět\ninfoTab = Záložka info\nhistoryTab = Záložka historie\nlinkTextBox = Textové pole odkazu\npasteLinkHere = Sem vlož odkaz...\nenterALink = Zadej odkaz!\nmadeWith = Vytvořeno s\nlove = Láskou\ninIndia = v Indii\nopen = Otevřeno\nbyDeveloperName = od: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_de.properties",
    "content": "title = SpotiFlyer\nabout = Über\nhistory = Verlauf\ndonate = Spenden\npreferences = Einstellungen\nsearch = Suche\nsupportedPlatforms = Unterstützte Plattformen\nsupportDevelopment = Entwicklung unterstützen\nopenProjectRepo = Projekt Repository öffnen\nstarOrForkProject = Gib einen Stern oder \"Forke\" das Projekt auf Github.\nhelp = Hilfe\ntranslate = Übersetzen\nhelpTranslateDescription = Hilf uns, SpotiFlyer in deine Sprache zu übersetzen.\nsupportDeveloper = Entwickler unterstützen\ndonateDescription = Wenn du denkst, dass ich für meine Arbeit eine kleine Spende verdiene, kannst du mich hier unterstützen.\nshare = Teilen\nshareDescription = Teile diese App mit deinen Freunden oder deiner Familie.\nwhatWentWrong = Etwas ist schief gelaufen.\ncopyToClipboard = In die Zwischenablage kopieren\ncopyCodeInGithubIssue = Kopiere die untenstehende Fehlermeldung und füge sie in einem Github Issue ein.\nstatus = Status\nanalytics = Analyse\nanalyticsDescription = Deine Daten sind anonym und werden nicht mit Dritten geteilt.\nnoHistoryAvailable = Kein Verlauf verfügbar\ncleaningAndExiting = Leeren und Verlassen\ntotal = Insgesamt\ncompleted = Fertig\nfailed = Fehlgeschlagen\nexit = Verlassen\ndownloading = Herunterladen\nprocessing = In Bearbeitung\nqueued = In der Warteschlange\nsetDownloadDirectory = Downloadverzeichnis einstellen\ndownloadDirectorySetTo = Downloadvezeichnis zu {0} geändert\nnoWriteAccess = KEIN SCHREIBZUGRIFF auf: {0} , SpotiFlyer kehrt auf vorheriges Verzeichnis zurück\nshareMessage = Hey, schau dir mal diesen hervorragenden Musik-Downloader an: http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Analyse gewähren\nnoInternetConnection = Keine Internetverbindung!\ncheckInternetConnection = Bitte überprüfe deine Internetverbindung.\ngrantPermissions = Berechtigungen erteilen\nrequiredPermissions = Notwendige Berechtigungen:\nstoragePermission = Speichererlaubnis\nstoragePermissionReason = um deine Lieblingssongs auf diesem Gerät zu speichern.\nbackgroundRunning = Ausführung im Hintergrund.\nbackgroundRunningReason = Um alle Titel im Hintergrund ohne Systemunterbrechung herunterladen zu können.\nno = Nein\nyes = Ja\n\nacraNotificationTitle = UUPS, SpotiFlyer ist abgestürzt, :-(\nacraNotificationText = Bitte Senden Sie einen Absturzbericht an den App-Entwickler, sodass es in Zukunft nicht mehr passiert.\n\nalbumArt = Album Art\ntracks = Tracks\ncoverImage = Cover Bild\nreSearch = Erneut suchen\nloading = Laden\ndownloadAll = Alle herunterladen\nbutton = Taste\nerrorOccurred = Ein Fehler ist aufgetreten, bitte überprüfe den Link / deine Verbindung\ndownloadDone = Download abgeschlossen\ndownloadError = Fehler! Dieser Track kann nicht heruntergeladen werden\ndownloadStart = Herunterladen starten \nsupportUs = Wir brauchen deine Unterstützung!\ndonation = Spenden\nworldWideDonations = Weltweite Spenden\nindianDonations = Nur indische Spenden\ndismiss = Ablehnen\nremindLater = Später erinnern\n\nmp3ConverterBusy = MP3 Konverter nicht erreichbar. Versuche es später erneut!\nunknownError = Unbekannter Fehler\nnoMatchFound = KEINE Übereinstimmungen gefunden!\nnoLinkFound = Kein herunterladbarer Link gefunden!\nlinkNotValid = Eingegebener Link ist nicht gültig!\nfeatureUnImplemented = Funktion ist noch nicht implementiert.\n\nminute = min\nsecond = sec\n\nspotiflyerLogo = SpotiFlyer Logo\nbackButton = Zurück Taste\ninfoTab = Info Tab\nhistoryTab = Verlauf Tab\nlinkTextBox = Link-Textfeld\npasteLinkHere = Füge hier einen Link ein...\nenterALink = Gib einen Link ein!\nmadeWith = Gemacht mit\nlove = Liebe\ninIndia = in Indien\nopen = geöffnet\nbyDeveloperName = von: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_en.properties",
    "content": "title = SpotiFlyer\nabout = About\nhistory = History\ndonate = Donate\npreferences = Preferences\nsearch = Search\nsupportedPlatforms = Supported platforms\nsupportDevelopment = Support development\nopenProjectRepo = Open Project Repo\nstarOrForkProject = Star / Fork the project on Github.\nhelp = Help\ntranslate = Translate\nhelpTranslateDescription = Help us translate this app in your local language.\nsupportDeveloper = Support developer\ndonateDescription = If you think I deserve to get paid for my work, you can support me here.\nshare = Share\nshareDescription = Share this app with your friends and family.\nwhatWentWrong = What went wrong...\ncopyToClipboard = Copy to clipboard\ncopyCodeInGithubIssue = Copy and paste the code below when creating a GitHub issue / Reporting this issue for better help.\nstatus = Status\nanalytics = Analytics\nanalyticsDescription = Your data is anonymized and never shared with 3rd party services.\nnoHistoryAvailable = No history available\ncleaningAndExiting = Cleaning and exiting\ntotal = Total\ncompleted = Completed\nfailed = Failed\nexit = Exit\ndownloading = Downloading\nprocessing = Processing\nqueued = Queued\nsetDownloadDirectory = Set download directory\ndownloadDirectorySetTo = Download directory set to: {0}\nnoWriteAccess = NO WRITE ACCESS on: {0} , Reverting back to previous\nshareMessage = Hey, checkout this excellent music downloader http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Allow analytics\nnoInternetConnection = No internet connection!\ncheckInternetConnection = Please check your network connection.\ngrantPermissions = Grant permissions\nrequiredPermissions = Required permissions:\nstoragePermission = Storage permissions.\nspotifyCreds = Spotify credentials.\nclientID = Client ID\nclientSecret = Client Secret\ndefaultString = Default\nuserSet = UserSet\nsave = Save\nreset = Reset\nrequestAppRestart = You need to restart the app for changes to take effect\nstoragePermissionReason = To download your favourite songs to this device.\nbackgroundRunning = Background running.\nbackgroundRunningReason = To download all songs in background without any system interruptions.\nno = Nope\nyes = Sure\n\nacraNotificationTitle = OOPS, SpotiFlyer crashed\nacraNotificationText = Please send crash report to app developers, So this unfortunate event may not happen again.\n\nalbumArt = Album art\ntracks = Tracks\ncoverImage = Cover image\nreSearch = Search again\nloading = Loading\ndownloadAll = Download all\nbutton = Button\nerrorOccurred = An error Occurred, Check your Link / Connection\ndownloadDone = Download done\ndownloadError = Error! Cant download this track\ndownloadStart = Start download\nsupportUs = We need your support!\ndonation = Donation\nworldWideDonations = World-wide donations\nindianDonations = Indian donations only\ndismiss = Dismiss\nremindLater = Remind me later\n\nmp3ConverterBusy = MP3 Converter unreachable, probably BUSY !\nunknownError = Unknown error\nnoMatchFound = No match found!\nnoLinkFound = No downloadable link found\nlinkNotValid = Entered link is not valid!\nfeatureUnImplemented = Feature not yet implemented.\n\nminute = min\nsecond = sec\n\nspotiflyerLogo = SpotiFlyer Logo\nbackButton = Back button\ninfoTab = Info tab\nhistoryTab = History tab\nlinkTextBox = Link text box\npasteLinkHere = Paste link here...\nenterALink = Enter a link!\nmadeWith = Made with\nlove = Love\ninIndia = in India\nopen = Open\nbyDeveloperName = by: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_es.properties",
    "content": "title = SpotiFlyer\nabout = Acerca de\nhistory = Historial\ndonate = Donar\npreferences = Preferencias\nsearch = Buscar\nsupportedPlatforms = Plataformas Soportadas\nsupportDevelopment = Apoya al Desarrollo\nopenProjectRepo = Abrir repositorio del proyecto\nstarOrForkProject = Da estrella / Crea una rama en Github.\nhelp = Ayuda\ntranslate = Traduce\nhelpTranslateDescription = Ayudanos a traducir esta aplicación en tu idioma.\nsupportDeveloper = Apoya al desarollador\ndonateDescription = Si crees que merezco una paga por mi trabajo, aquí puedes apoyarme.\nshare = Comparte\nshareDescription = Comparte esta aplicación con tus familiares y amigos.\nwhatWentWrong = Qué salió mal...\ncopyToClipboard = Copiar al portapapeles\ncopyCodeInGithubIssue = Copie Pegar debajo del código mientras crea Github Issue / Reportando este problema para obtener una mejor ayuda.\nstatus = Estatus\nanalytics = Analiticos\nanalyticsDescription = Tus datos son anonimizados y nunca se compartiran con servicios de terceros.\nnoHistoryAvailable = Sin historial disponible\ncleaningAndExiting = Limpiando y Saliendo\ntotal = Total\ncompleted = Completedo\nfailed = Falló\nexit = Salir\ndownloading = Descargando\nprocessing = Procesando\nqueued = En Cola\nsetDownloadDirectory = Elige Directorio de Descargas\ndownloadDirectorySetTo = Directorio de descargas configurado a: {0}\nnoWriteAccess = SIN ACCESO DE ESCRITURA en: {0} , Devolviendo al anterior\nshareMessage = Hey, checa esta excelente aplicación para descargar música http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Obtener Analiticos\nnoInternetConnection = ¡No hay conexión a internet!\ncheckInternetConnection = Por favor revisa tu conexión.\ngrantPermissions = Obtener Permisos\nrequiredPermissions = Permisos Requeridos:\nstoragePermission = Permisos de Almacenamiento.\nstoragePermissionReason = Para descargar tus canciones favoritas en este disositivo.\nbackgroundRunning = Corriendo en segundo plano.\nbackgroundRunningReason = Para descargar todas las canciones en segundo plano, sin Interrupciones al Sistema.\nno = No\nyes = Seguro\n\nacraNotificationTitle = UPS, SpotiFlyer Falló\nacraNotificationText = Por favor envia un reporte de fallas a los desarolladores, Asi este desafortunado evento no volvera a pasar.\n\nalbumArt = Portada\ntracks = Pistas\ncoverImage = Cubierta\nreSearch = Volver a buscar\nloading = Cargando\ndownloadAll = Descargar Todo\nbutton = Botón\nerrorOccurred = Ocurrió un error, Revisa tu Enlace / Conexión\ndownloadDone = Descarga Completada\ndownloadError = ¡Error! No puedo descargar esta Pista\ndownloadStart = Iniciar Descarga\nsupportUs = ¡Necesitamos tu apoyo!\ndonation = Donaciones\nworldWideDonations = Donaciones Insternacionales\nindianDonations = Indian Donations Only\ndismiss = Cerrar\nremindLater = Recuerdame despúes\n\nmp3ConverterBusy = ¡Convertidos MP3 no disponible, probablemente OCUPADO!\nunknownError = Error desconocido\nnoMatchFound = ¡Sin resultados!\nnoLinkFound = No hay enlace de descarga\nlinkNotValid = ¡El enlace introducido NO es valido!\nfeatureUnImplemented = Función no implementada aún.\n\nminute = min\nsecond = sec\n\nspotiflyerLogo = SpotiFlyer Logo\nbackButton = Botón Atras\ninfoTab = Pestaña de información\nhistoryTab = Perstaña de historial\nlinkTextBox = Campo de enlace\npasteLinkHere = Pega tu enlace aquí\nenterALink = ¡Coloca un enlace!\nmadeWith = Hecho con\nlove = Amor\ninIndia = en India\nopen = Abrir\nbyDeveloperName = por: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_fa.properties",
    "content": "title = SpotiFlyer\nabout = درباره\nhistory = تاریخچه\ndonate = اهدا\npreferences = تنظیمات\nsearch = جست‌وجو\nsupportedPlatforms = پلتفرم‌های پشتیبانی شده\nsupportDevelopment = حمایت از توسعه\nopenProjectRepo = بازکردن ریپازیتوری پروژه\nstarOrForkProject = ستاره دادن / فورک کردن پروژه در گیت‌هاب\nhelp = راهنما\ntranslate = ترجمه\nhelpTranslateDescription = به ما در ترجمه این نرم‌افزار به زبان محلی خود کمک کنید.\nsupportDeveloper = حمایت از توسعه‌دهنده\ndonateDescription = اگر فکر می‌کنید که شایسته دریافت هزینه برای این کار خود هستم، می‌توانید اینجا از من حمایت کنید.\nshare = به‌اشتراک گذاری\nshareDescription = این نرم‌افزار را با دوستان و خانواده خود به اشتراک بگذارید.\nwhatWentWrong = آنچه اشتباه پیش رفت...\ncopyToClipboard = کپی در کلیپ‌بورد\ncopyCodeInGithubIssue = کد زیر را هنگام ساخت مشکلات / گزارش مشکلات در گیت‌هاب برای کمک بهتر کپی و پیست کنید.\nstatus = وضعیت\nanalytics = تحلیل‌ها\nanalyticsDescription = داده‌های شما ناشناس شده و هرگز با سرویس‌های شخص ثالث به اشتراک گذاشته نمی‌شود.\nnoHistoryAvailable = تاریخچه‌ای موجود نیست\ncleaningAndExiting = پاک‌سازی و خارج شدن\ntotal = همه\ncompleted = کامل شد\nfailed = شکست خورد\nexit = خروج\ndownloading = در حال دانلود\nprocessing = در حال پردازش\nqueued = در صف\nsetDownloadDirectory = تنظیم پوشه دانلود\ndownloadDirectorySetTo = تنظیم پوشه دانلود: {0}\nnoWriteAccess = دسترسی نوشتن در: {0} وجود ندارد, بازگردانی به قبلی\nshareMessage = سلام. این نرم‌افزار دانلود موزیک معرکه رو امتحان کن http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = دادن تحلیل‌ها\nnoInternetConnection = اتصال اینرنت موجود نیست!\ncheckInternetConnection = لطفا اتصال شبکه خود را چک کنید\ngrantPermissions = دادن دسترسی‌ها\nrequiredPermissions = دسترسی‌های لازم:\nstoragePermission = دسترسی حافظه\nstoragePermissionReason = برای دانلود آهنگ‌های مورد علاقه خود در دستگاه\nbackgroundRunning = اجرا در پس‌زمینه\nbackgroundRunningReason = برای دانلود تمامی آهنگ‌ها در پس‌زمینه بدون دخالت سیستم.\nno = نه\nyes = بله\n\nacraNotificationTitle = اوه , اسپاتیفلایر متوقف شد\nacraNotificationText = لطفا مشکل را به سازندگان برنامه گزارش کنید , تا در صورت امکان از رخ دادن این اتفاق جلوگیری شود.\n\nalbumArt = تصویر آلبوم\ntracks = ترک‌ها\ncoverImage = تصویر کاور\nreSearch = جست‌وجوی مجدد\nloading = درحال بارگذاری\ndownloadAll = دانلود همه\nbutton = دکمه\nerrorOccurred = خطایی رخ داد، لینک / اتصال اینرنت خود را چک کنید\ndownloadDone = دانلود انجام شد\ndownloadError = خطا! نمی‌توان این ترک را دانلود کرد\ndownloadStart = آغاز دانلود\nsupportUs = ما به حمایت شما نیازمندیم!\ndonation = اهدا\nworldWideDonations = اهداهای سراسر جهان\nindianDonations = فقط اهداهای هند\ndismiss = رد کردن\nremindLater = یادآوری\n\nmp3ConverterBusy = مبدل فایل ام پی تری در دسترس نیست , احتمالا مشغول است\nunknownError = خطای ناشناخته\nnoMatchFound = موردی یافت نشد!\nnoLinkFound = لینک قابل دانلودی پیدا نشد\nlinkNotValid = لینک وارد شده معتبر نیست!\nfeatureUnImplemented = قابلیت هنوز ایجاد نشده است.\n\nminute = دقیقه\nsecond = ثانیه\n\nspotiflyerLogo = لگو SpotiFlyer\nbackButton = دکمه برگشت\ninfoTab = تب اطلاعات\nhistoryTab = تب تاریخچه\nlinkTextBox = جعبه متن لینک\npasteLinkHere = لینک را اینجا درج کنید...\nenterALink = یک لینک وارد کنید!\nmadeWith = ساخته شده با\nlove = عشق\ninIndia = در هند\nopen = باز کردن\nbyDeveloperName = توسط : Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_fr.properties",
    "content": "title = SpotiFlyer\nabout = À propos\nhistory = Historique\ndonate = Faire un don\npreferences = Préférences\nsearch = Rechercher\nsupportedPlatforms = Platformes Supportées\nsupportDevelopment = Soutenir le Développement\nopenProjectRepo = Ouvrir le Dépot du Project\nstarOrForkProject = Donnez une étoile / Dupliquez le projet sur Github.\nhelp = Aide\ntranslate = Traduire\nhelpTranslateDescription = Aidez-nous à traduire cette application dans votre langue locale.\nsupportDeveloper = Soutenir le Développeur\ndonateDescription = Si vous pensez que je mérite d'être payé pour mon travail, vous pouvez me soutenir ici.\nshare = Partager\nshareDescription = Partagez cette application avec vos amis et votre famille.\nwhatWentWrong = Qu'est ce qui ne s'est pas bien passé...\ncopyToClipboard = Copier dans le presse-papier\ncopyCodeInGithubIssue = Copiez et collez le code ci-dessous lors de la création d'un problème Github / Signalement de ce problème pour une meilleure aide.\nstatus = Statut\nanalytics = Analyses\nanalyticsDescription = Vos données sont anonymes et ne sont jamais partagées avec des services tiers.\nnoHistoryAvailable = Auncun historique disponible\ncleaningAndExiting = Nettoyer et Quitter\ntotal = Total\ncompleted = Terminé\nfailed = Échoué\nexit = Quitter\ndownloading = Téléchargement\nprocessing = En cours de traitement\nqueued = En file d'attente\nsetDownloadDirectory = Définir le répertoire de téléchargement\ndownloadDirectorySetTo = Répertoire de téléchargement défini sur : {0}\nnoWriteAccess = PAS D'ACCÈS A L'ÉCRITURE sur : {0} , Retour à la page précédente\nshareMessage = Hé, regarde cet excellent téléchargeur de musique http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Accorder les Analyses\nnoInternetConnection = Aucune connexion à Internet !\ncheckInternetConnection = Veuillez vérifier votre connexion à Internet.\ngrantPermissions = Accorder les autorisations\nrequiredPermissions = Autorisations requises :\nstoragePermission = Autorisation du stockage.\nstoragePermissionReason = Pour télécharger vos chansons préférées sur cet appareil.\nbackgroundRunning = Exécution en arrière-plan\nbackgroundRunningReason = Pour télécharger toutes les chansons en arrière-plan sans aucune interruption du système.\nno = Non\nyes = Oui\n\nacraNotificationTitle = Oups, SpotiFlyer s'est arrêté\nacraNotificationText = Veuillez envoyer un rapport de crash aux développeurs de l'application, afin que cet événement malheureux ne se reproduise plus.\n\nalbumArt = Pochette d'album\ntracks = Titres\ncoverImage = Image de couverture\nreSearch = Recherche à nouveau\nloading = Chargement\ndownloadAll = Tout Télécharger\nbutton = Bouton\nerrorOccurred = Une erreur s'est produite, vérifiez votre connexion.\ndownloadDone = Téléchargement terminé\ndownloadError = Erreur ! Impossible de télécharger ce titre\ndownloadStart = Démarrer le téléchargement\nsupportUs = Nous avons besoin de votre soutien !\ndonation = Dons\nworldWideDonations = Dons dans le monde entier\nindianDonations = Donations indiennes\ndismiss = Décliner\nremindLater = Me rappeler plus tard\n\nmp3ConverterBusy = Convertisseur MP3 inaccessible, probablement occupé !\nunknownError = Erreur inconnue\nnoMatchFound = Aucun résultat trouvé !\nnoLinkFound = Aucun lien téléchargeable trouvé\nlinkNotValid = Le lien saisi n'est PAS valide !\nfeatureUnImplemented = Fonctionnalité pas encore implémentée.\n\nminute = min\nsecond = sec\n\nspotiflyerLogo = SpotiFlyer Logo\nbackButton = Bouton retour\ninfoTab = Onglet Info\nhistoryTab = Onglet Historique\nlinkTextBox = Zone de texte du lien\npasteLinkHere = Collez le lien ici...\nenterALink = Entrez un lien !\nmadeWith = Fait avec\nlove = amour\ninIndia = en Inde\nopen = Ouvrir\nbyDeveloperName = par : Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_hi.properties",
    "content": "title = स्पॉटीफ्लायर\nabout = के बारे में\nhistory = इतिहास\ndonate = दान करना\npreferences = पसंद\nsearch = खोज\nsupportedPlatforms = समर्थित प्लेटफार्म\nsupportDevelopment = समर्थन विकास\nopenProjectRepo = ओपन प्रोजेक्ट रेपो\nstarOrForkProject = जीथब पर प्रोजेक्ट को स्टार / फोर्क करें।\nhelp = मदद\ntranslate = अनुवाद करना\nhelpTranslateDescription = इस ऐप को अपनी स्थानीय भाषा में अनुवाद करने में हमारी सहायता करें।\nsupportDeveloper = समर्थन डेवलपर\ndonateDescription = अगर आपको लगता है कि मैं अपने काम के लिए भुगतान पाने का हकदार हूं, तो आप यहां मेरा समर्थन कर सकते हैं।\nshare = साझा करना\nshareDescription = इस ऐप को अपने दोस्तों और परिवार के साथ साझा करें।\nwhatWentWrong = क्या गलत हुआ...\ncopyToClipboard = क्लिपबोर्ड पर कॉपी करें\ncopyCodeInGithubIssue = बेहतर मदद के लिए जीथब इश्यू बनाते / इस मुद्दे की रिपोर्ट करते समय कोड के नीचे कॉपी पेस्ट करें।\nstatus = स्थिति\nanalytics = एनालिटिक्स\nanalyticsDescription = आपका डेटा अनाम है और इसे कभी भी तृतीय पक्ष सेवा के साथ साझा नहीं किया जाता है।\nnoHistoryAvailable = कोई इतिहास उपलब्ध नहीं\ncleaningAndExiting = सफाई और निकास\ntotal = कुल\ncompleted = पूरा हुआ\nfailed = अनुत्तीर्ण होना\nexit = बाहर जाएं\ndownloading = डाउनलोड\nprocessing = प्रसंस्करण\nqueued = कतारबद्ध\nsetDownloadDirectory = डाउनलोड निर्देशिका सेट करें\ndownloadDirectorySetTo = डाउनलोड निर्देशिका इस पर सेट करें: {0}\nnoWriteAccess = इस पर कोई लेखन पहुंच नहीं: {0} , पिछले पर वापस जाना\nshareMessage = अरे, इस उत्कृष्ट संगीत डाउनलोडर को चेकआउट करें http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = अनुदान विश्लेषिकी\nnoInternetConnection = कोई इंटरनेट कनेक्शन नहीं!\ncheckInternetConnection = कृपया अपने नेटवर्क कनेक्शन की जाँच करें।\ngrantPermissions = अनुदान अनुमतियाँ\nrequiredPermissions = आवश्यक अनुमतियाँ:\nstoragePermission = भंडारण अनुमति।\nstoragePermissionReason = इस डिवाइस पर अपने पसंदीदा गाने डाउनलोड करने के लिए।\nbackgroundRunning = पृष्ठभूमि चल रहा है।\nbackgroundRunningReason = बिना किसी सिस्टम रुकावट के बैकग्राउंड में सभी गाने डाउनलोड करने के लिए।\nno = नहीं\nyes = ज़रूर\n\nacraNotificationTitle = ओओपीएस, स्पॉटीफ्लायर क्रैश हो गया\nacraNotificationText = कृपया ऐप डेवलपर्स को क्रैश रिपोर्ट भेजें, ताकि यह दुर्भाग्यपूर्ण घटना दोबारा न हो।\n\nalbumArt = एलबम कला\ntracks = पटरियों\ncoverImage = कवर छवि\nreSearch = अनुसंधान\nloading = लोड हो रहा है\ndownloadAll = सभी डाउनलोड\nbutton = बटन\nerrorOccurred = एक त्रुटि हुई, अपना लिंक / कनेक्शन जांचें\ndownloadDone = डाउनलोड हो गया\ndownloadError = त्रुटि! इस ट्रैक को डाउनलोड नहीं कर सकते\ndownloadStart = डाउनलोड शुरू करें\nsupportUs = हमें आपका समर्थन चाहिए!\ndonation = दान\nworldWideDonations = वर्ल्ड वाइड डोनेशन\nindianDonations = केवल भारतीय दान\ndismiss = खारिज\nremindLater = बाद में याद दिलाना\n\nmp3ConverterBusy = MP3 कन्वर्टर पहुंच योग्य नहीं है, शायद व्यस्त!\nunknownError = अज्ञात त्रुटि\nnoMatchFound = कोई मेल नहीं मिला!\nnoLinkFound = कोई डाउनलोड करने योग्य लिंक नहीं मिला\nlinkNotValid = दर्ज किया गया लिंक मान्य नहीं है!\nfeatureUnImplemented = सुविधा अभी लागू नहीं हुई है।\n\nminute = मिनट\nsecond = सेकंड\n\nspotiflyerLogo = स्पॉटीफ्लायर लोगो\nbackButton = पिछला बटन\ninfoTab = टैब जानकारी\nhistoryTab = इतिहास टैब\nlinkTextBox = लिंक टेक्स्ट बॉक्स\npasteLinkHere = लिंक यहां चिपकाएं...\nenterALink = एक लिंक दर्ज करें!\nmadeWith = का बना हुआ\nlove = प्रेम\ninIndia = भारत में\nopen = खोलना\nbyDeveloperName = द्वारा: शबिन्दर सिंह\n"
  },
  {
    "path": "translations/Strings_id.properties",
    "content": "title = SpotiFlyer\nabout = Tentang\nhistory = Riwayat\ndonate = Donasi\npreferences = Preferensi\nsearch = Cari\nsupportedPlatforms = Platform yang didukung\nsupportDevelopment = Dukung Pengembangan\nopenProjectRepo = Buka Proyek Repository\nstarOrForkProject = Beri bintang / fork proyek ini di GitHub.\nhelp = Bantuan\ntranslate = Terjemahan\nhelpTranslateDescription = Bantu kami menerjemahkan aplikasi ini ke bahasa Anda.\nsupportDeveloper = Dukung Developer\ndonateDescription = Jika Anda ingin memberi donasi ke developer apl. ini, Anda bisa donasi disini.\nshare = Bagikan\nshareDescription = Bagikan aplikasi ini kepada teman / keluarga anda.\nwhatWentWrong = Apa yang salah...\ncopyToClipboard = Menyalin ke clipboard\ncopyCodeInGithubIssue = Salin Tempel Kode Di Bawah Saat membuat Masalah Github / Melaporkan masalah ini untuk bantuan yang lebih baik.\nstatus = Status\nanalytics = Analytics\nanalyticsDescription = Data Anda tidak dapat dilihat oleh orang lain dan TIDAK akan dibagikan ke pihak ketiga.\nnoHistoryAvailable = Tidak ada riwayat yang tercatat.\ncleaningAndExiting = Cleaning And Exiting\ntotal = Total\ncompleted = Selesai\nfailed = Gagal\nexit = Keluar\ndownloading = Mengunduh\nprocessing = Mem-proses\nqueued = Ditambahkan ke antrian\nsetDownloadDirectory = Ubah folder unduhan\ndownloadDirectorySetTo = Folder unduhan telah diubah ke: {0}\nnoWriteAccess = Tidak ada akses WRITE untuk: {0}, mengembalikan ke folder sebelumnya...\nshareMessage = Hey, cek aplikasi pengunduh lagu Spotify ini! http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Izinkan Analytics\nnoInternetConnection = Tidak ada Koneksi Internet\ncheckInternetConnection = Cek sambungan internet Anda, lalu buka ulang aplikasi ini.\ngrantPermissions = Aplikasi ini membutuhkan izin dibawah ini.\nrequiredPermissions = Izin yang diperlukan:\nstoragePermission = Mengakses penyimpanan Anda\nstoragePermissionReason = Untuk menyimpan unduhan lagu favorit Anda di penyimpanan Anda.\nbackgroundRunning = Berjalan di background\nbackgroundRunningReason = Untuk mengunduh semua lagu tanpa gangguan.\nno = Tidak\nyes = Oke\n\nacraNotificationTitle = Oops, SpotiFlyer baru saja crash.\nacraNotificationText = Tolong kirim crash report ini ke pengembang apl. ini, sehingga hal ini tidak terjadi lagi :D\n\nalbumArt = Album Art\ntracks = Tracks\ncoverImage = Cover Gambar\nreSearch = Cari ulang\nloading = Memuat\ndownloadAll = Unduh semua\nbutton = Tombol\nerrorOccurred = Terjadi kesalahan, cek koneksi Anda / link yang ingin Anda unduh.\ndownloadDone = Unduhan selesai!\ndownloadError = Tidak bisa mengunduh lagu ini!\ndownloadStart = Mulai mengunduh\nsupportUs = Kami butuh dukungan Anda!\ndonation = Donasi\nworldWideDonations = Donasi seluruh dunia\nindianDonations = Hanya donasi India saja\ndismiss = Jangan tampilkan ini lagi\nremindLater = Ingatkan saya nanti\n\nmp3ConverterBusy = MP3 Converter lagi sibuk!\nunknownError = Kesalahan tidak diketahui\nnoMatchFound = Tidak ditemukan\nnoLinkFound = Tidak ada yang bisa diunduh.\nlinkNotValid = Link yang Anda masukkan tidak valid!\nfeatureUnImplemented = Fitur ini belum di-implementasikan.\n\nminute = mnt\nsecond = dtk\n\nspotiflyerLogo = Logo SpotiFlyer\nbackButton = Kembali\ninfoTab = Informasi\nhistoryTab = Riwayat\nlinkTextBox = Link\npasteLinkHere = Tempel link yang Anda salin disini...\nenterALink = Masukkan link yang Anda salin!\nmadeWith = Made with\nlove = Love\ninIndia = di India\nopen = Buka\nbyDeveloperName = oleh Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_it.properties",
    "content": "title = SpotiFlyer\nabout = Informazioni su SpotiFlyer\nhistory = Recenti\ndonate = Dona\npreferences = Preferenze\nsearch = Cerca\nsupportedPlatforms = Piattaforme supportate\nsupportDevelopment = Sviluppo\nopenProjectRepo = Apri repo del progetto\nstarOrForkProject = Copia il progetto su Github\nhelp = Aiuto\ntranslate = Traduci\nhelpTranslateDescription = Aiutaci a tradurre questa app nella tua lingua.\nsupportDeveloper = Sviluppatore\ndonateDescription = Se credi che io meriti di essere pagato per il mio lavoro, puoi contribuire qui.\nshare = Condividi\nshareDescription = Condividi questa app con i tuoi amici e la tua famiglia.\nwhatWentWrong = Qualcosa è andato storto...\ncopyToClipboard = Copia negli appunti\ncopyCodeInGithubIssue = Copia/Incolla il codice sottostante quando crei una richiesta di aiuto su GitHub.\nstatus = Stato\nanalytics = Statistiche\nanalyticsDescription = I tuoi dati sono anonmimi e non saranno mai condivisi con servizi di terze parti.\nnoHistoryAvailable = Nessun dato disponibile\ncleaningAndExiting = Pulizia e chiusura in corso\ntotal = Totale\ncompleted = Completato\nfailed = Fallito\nexit = Esci\ndownloading = In download\nprocessing = In elaborazione\nqueued = In coda\nsetDownloadDirectory = Imposta la cartella di download\ndownloadDirectorySetTo = Cartella: {0}\nnoWriteAccess = NESSUN PERMESSO DI ACCESSO su: {0} , imposto la cartella precedente\nshareMessage = Ehi, dai uno sguardo a questo eccellente downloader http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Concedi dati per statistiche\nnoInternetConnection = Nessuna connessione a internet!\ncheckInternetConnection = Per favore controlla la tua connessione internet.\ngrantPermissions = Concedi autorizzazione\nrequiredPermissions = Autorizzazioni necessarie:\nstoragePermission = Autorizzazione alla memoria\nstoragePermissionReason = Per scaricare le tue canzoni preferite su questo dispositivo.\nbackgroundRunning = Autorizzazione ad essere eseguita in background\nbackgroundRunningReason = Per scaricare le tue canzoni senza interruzioni da parte del sistema operativo.\nno = No\nyes = Sì\n\nacraNotificationTitle = Ops, SpotiFlyer è crashato\nacraNotificationText = Per favore invia il report agli sviluppatori, in modo da non far accadere più questo evento.\n\nalbumArt = Copertina\ntracks = Tracce\ncoverImage = Copertina\nreSearch = Cerca di nuovo\nloading = Caricamento\ndownloadAll = Scarica tutto\nbutton = Bottone\nerrorOccurred = Si è verificato un errore, controlla il tuo link o la tua connessione\ndownloadDone = Download effettuato\ndownloadError = Errore! Non è possibile scaricare questa canzone\ndownloadStart = Inizia il download\nsupportUs = Abbiamo bisogno del tuo aiuto!\ndonation = Donazione\nworldWideDonations = Donazioni internazionali\nindianDonations = Solo donazioni da India\ndismiss = Rifiuta\nremindLater = Ricordalo più tardi\n\nmp3ConverterBusy = Convertitore MP3 non disponibile\nunknownError = Errore sconosciuto\nnoMatchFound = Nessuna corrispondenza trovata!\nnoLinkFound = Nessun link scaricabile trovato!\nlinkNotValid = Il link inserito non è valido!\nfeatureUnImplemented = Caratteristica non ancora implementata.\n\nminute = min\nsecond = sec\n\nspotiflyerLogo = Logo SpotiFlyer\nbackButton = Pulsante indietro\ninfoTab = Tab informazioni\nhistoryTab = Tab recenti\nlinkTextBox = Casella di testo per link\npasteLinkHere = Incolla il link qui...\nenterALink = Inserisci un link!\nmadeWith = Fatto con\nlove = Amore\ninIndia = in India\nopen = Apri\nbyDeveloperName = da: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_ja.properties.xml",
    "content": "title = SpotiFlyer\nabout = アプリケーションについて\nhistory = 履歴\ndonate = 寄付する\npreferences = 設定\nsearch = 検索する\nsupportedPlatforms = サポート済みのサービス\nsupportDevelopment = 開発を支援する\nopenProjectRepo = プロジェクトのリポジトリを開く\nstarOrForkProject = Githubで Star/Forkを行う \nhelp = ヘルプ\ntranslate = 翻訳\nhelpTranslateDescription = 翻訳を手伝う\nsupportDeveloper = 開発者をサポートする\ndonateDescription = 開発者が報酬を受け取るに値する仕事を成し遂げたと思うのであれば、開発者はここでサポートされます。\nshare = 共有する\nshareDescription = 友達や家族とこのアプリをシェアしよう。\nwhatWentWrong = What Went Wrong...\ncopyToClipboard = クリップボードにコピー\ncopyCodeInGithubIssue = Githubにissueを作成する際に、以下のコードを貼り付けてください。あなたの報告がアプリをより良いものにします。\nstatus = 状態\nanalytics = 分析\nanalyticsDescription = あなたのデータは匿名であり、第三者と共有されることはありません。\nnoHistoryAvailable = 利用可能な履歴が存在しません\ncleaningAndExiting = クリーンアップと終了\ntotal = 合計\ncompleted = 完了\nfailed = 失敗\nexit = 終了\ndownloading = ダウンロード中\nprocessing = プロセス中\nqueued = キューへ追加済み\nsetDownloadDirectory = ダウンロード場所を指定\ndownloadDirectorySetTo = ダウンロード場所は次の通りです: {0}\nnoWriteAccess = 次の場所には書き込み権限が与えられていません: {0} 、 設定を戻しています。\nshareMessage = さあ、この至高のダウンローダーを見てみてください！  http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = アクセス権限を与える\nnoInternetConnection = インターネット接続がありません!\ncheckInternetConnection = インターネットに接続できているか確認してください。\ngrantPermissions = 権限を与える\nrequiredPermissions = 要求された権限:\nstoragePermission = 保存域の権限。\nstoragePermissionReason = あなたの好きな曲を保存するのに必要です。\nbackgroundRunning = バックグラウンドで動作しています。\nbackgroundRunningReason = システムに中断させられることなくすべてのダウンロードを行うために必要です。\nno = 許可しない\nyes = 許可する\n\nacraNotificationTitle = 申し訳ありません、 SpotiFlyerがクラッシュしました。\nacraNotificationText = アプリ開発者に是非クラッシュレポートを送信してください。 このような残念な出来事は起こらなくなるでしょう。\n\nalbumArt = アルバムアート\ntracks = トラック\ncoverImage = カバーイメージ\nreSearch = 再検索\nloading = ロード中\ndownloadAll = すべてダウンロードする\nbutton = ボタン\nerrorOccurred = エラーが発生しました。 貼り付けたリンクやインターネット接続を確認してみてください。\ndownloadDone = ダウンロードが終了しました\ndownloadError = Error! Cant Download this track\ndownloadStart = ダウンロード開始\nsupportUs = あなたの助けが必要です!\ndonation = 寄付\nworldWideDonations = World Wide Donations\nindianDonations = Indian Donations Only\ndismiss = 無視する\nremindLater = また今度知らせる\n\nmp3ConverterBusy = MP3 Converter unreachable, probably BUSY !\nunknownError = Unknown Error\nnoMatchFound = NO Match Found!\nnoLinkFound = No Downloadable link found\nlinkNotValid = Entered Link is NOT Valid!\nfeatureUnImplemented = Feature not yet implemented.\n\nminute = min\nsecond = sec\n\nspotiflyerLogo = SpotiFlyer Logo\nbackButton = Back Button\ninfoTab = Info Tab\nhistoryTab = History Tab\nlinkTextBox = Link Text Box\npasteLinkHere = Paste Link Here...\nenterALink = Enter A Link!\nmadeWith = Made with\nlove = Love\ninIndia = in India\nopen = Open\nbyDeveloperName = by: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_jp.properties",
    "content": "\ntitle = SpotiFlyer\nabout = 約\nhistory = 歴史\ndonate = 寄付\npreferences = 好み\nsearch = Kensaku\nsupportedPlatforms = サポートされているプラットフォーム\nsupportDevelopment = 開発をサポート\nopenProjectRepo =  プロジェクトリポジトリを開く\nstarOrForkProject = Github でプロジェクトをスター/フォークします。\nhelp = 手\ntranslate = 翻訳\nhelpTranslateDescription = このアプリをあなたの母国語に翻訳するのを手伝ってください。\nsupportDeveloper = サポート開発者\ndonateDescription = 私が私の仕事に対して報酬を得るに値すると思うなら、あなたはここで私をサポートすることができます。\nシェア = シェア\nshareDescription = このアプリを友達や家族と共有しましょう。\nwhatWentWrong = 何が悪かったのか...\ncopyToClipboard = クリップボードにコピー\ncopyCodeInGithubIssue = Github の問題の作成中/この問題の報告中にコードの下に貼り付けをコピーしてください。\nステータス = ステータス\nanalytics = 分析\nanalyticsDescription = あなたのデータは匿名化され、サードパーティのサービスと共有されることはありません。\nnoHistoryAvailable = 利用可能な履歴はありません\ncleaningAndExiting = クリーニングと終了\ntotal = 合計\ncompleted = 完了\nfailed = 失敗した\nexit = 出口\ndownloading = ダウンロード\nprocessing = 処理\nqueued = キューに入れられました\nsetDownloadDirectory = ダウンロードディレクトリを設定する\ndownloadDirectorySetTo = ディレクトリセットのダウンロード：{0}\nnoWriteAccess = 書き込みアクセスなし：{0}、前に戻る\nshareMessage = ねえ、この優れた音楽ダウンローダーをチェックアウト http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = 分析を許可する\nnoInternetConnection = インターネットに接続できません！\ncheckInternetConnection = ネットワーク接続を確認してください。\ngrantPermissions = 権限を付与する\nrequiredPermissions = 必要な権限：\nstoragePermission = ストレージ権限。\nstoragePermissionReason = お気に入りの曲をこのデバイスにダウンロードします。\nbackgroundRunning = バックグラウンド実行。\nbackgroundRunningReason = システムを中断せずにバックグラウンドですべての曲をダウンロードします。\nいいえ = いいえ\nはい = もちろん\n\nacraNotificationTitle = おっとっと、SpotiFlyerがクラッシュしました\nacraNotificationText = クラッシュレポートをアプリ開発者に送信してください。このような不幸な出来事が二度と起こらない可能性があります。\nalbumArt = アルバムアート\ntracks = トラック\ncoverImage = 表紙画像\nreSearch = リサーチ\nloading = 読み込み中\ndownloadAll = すべてダウンロード\nbutton = ボタン\nerrorOccurred = エラーが発生しました。リンク/接続を確認してください\ndownloadDone = ダウンロード完了\ndownloadError = エラー！ このトラックをダウンロードできません\ndownloadStart = ダウンロード開始\nsupportUs = 皆様のご支援が必要です！\ndonation = 寄付\nworldWideDonations = 世界的な寄付\nindianDonations = インドの寄付のみ\ndismiss = 解散\nremindLater = 後で思い出させる\n\nmp3ConverterBusy = MP3コンバーターに到達できません、おそらく忙しいです！\nunknownError = 不明なエラー\nnoMatchFound = 一致するものが見つかりません！\nnoLinkFound = ダウンロード可能なリンクが見つかりません\nlinkNotValid = 入力されたリンクは無効です！\nfeatureUnImplemented = 機能はまだ実装されていません。\n\nminute = 分\nsecond = 秒\n\nspotiflyerLogo = SpotiFlyer ロゴ\nbackButton = 戻るボタン\ninfoTab = 情報タブ\nhistoryTab = [履歴]タブ\nlinkTextBox = リンクテキストボックス\npasteLinkHere = ここにリンクを貼り付け...\nenterALink = リンクを入力してください！\nmadeWith = メイド を以て\nlove = 愛情\ninIndia = で インド\nopen = 開ける\nbyDeveloperName = 沿って: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_ml.properties",
    "content": "title = SpotiFlyer\n\nabout = ഞങ്ങളെക്കുറിച്ച്\n\nhistory = ഹിസ്റ്ററി\n\ndonate = സംഭാവനചെയ്യുക\n\npreferences = ക്രമീകരണങ്ങൾ\n\nsearch = തിരയുക\n\nsupportedPlatforms = ലഭ്യമായ പ്ലാറ്റ്ഫോമുകൾ\n\nsupportDevelopment = നിർമ്മാണത്തിൽ സഹായിക്കുക\n\nopenProjectRepo = പ്രോജക്ട് റിപ്പോ തുറക്കുക\n\nstarOrForkProject = ഗിറ്റ് ഹബ്. ൽ സ്റ്റാർ / ഫോർക് ചെയ്യുക\n\nhelp = സഹായങ്ങൾ\n\ntranslate = പരിഭാഷപ്പെടുത്തുക\n\nhelpTranslateDescription = നിങ്ങളുടെ പ്രാദേശിക ഭാഷയിൽ ഈ ആപ്പ് വിവർത്തനം ചെയ്യാൻ ഞങ്ങളെ സഹായിക്കൂ..\n\nsupportDeveloper = ഡെവലപ്പർ നെ സപ്പോർട്ട് ചെയ്യുക\n\ndonateDescription = എന്റെ ജോലിക്ക് പ്രതിഫലം ലഭിക്കാൻ ഞാൻ അർഹനാണെന്ന് നിങ്ങൾ കരുതുന്നുവെങ്കിൽ, നിങ്ങൾക്ക് എന്നെ ഇവിടെ പിന്തുണയ്ക്കാം.\n\nshare = പങ്കിടുക\n\nshareDescription = നിങ്ങളുടെ സുഹൃത്തുക്കളുമായും കുടുംബവുമായും ഈ ആപ്പ് പങ്കിടുക.\n\nwhatWentWrong = എന്താണ് തെറ്റിയത്...\n\ncopyToClipboard = ക്ലിപ്പ്ബോർഡിലേയ്ക്ക് പകർത്തുക\n\ncopyCodeInGithubIssue = മികച്ച സഹായത്തിനായി Githubൽ പുതിയ പ്രശ്നം സൃഷ്ടിക്കുമ്പോൾ / ഈ പ്രശ്നം റിപ്പോർട്ട് ചെയ്യുമ്പോൾ താഴെ ഉള്ള കോഡ് കൂടെ ഒട്ടിക്കുക.\n\nstatus = നിലവിലെ അവസ്ഥ\n\nanalytics = അനലിറ്റിക്സ്\n\nanalyticsDescription = നിങ്ങളുടെ ഡാറ്റ അജ്ഞാതമാക്കിയിരിക്കുന്നു, ഒരിക്കലും മൂന്നാം കക്ഷികളുമായി/ സേവനവുമായി പങ്കിടുകയുമില്ല.\n\nnoHistoryAvailable = ഇവിടെ കാണാൻ ഒന്നും ഇല്ല \n\ncleaningAndExiting = എല്ലാം കളഞ്ഞ് പോകാം\n\ntotal = ആകെ\n\ncompleted = കഴിഞ്ഞു \n\nfailed = പരാജയപ്പെട്ടു\n\nexit = പുറത്ത് പോകുക\n\ndownloading = ഡൗൺലോഡ് ചെയ്യുന്നു\n\nprocessing = പ്രോസസ് ചെയ്യുന്നു\n\nqueued = ക്യൂ വിലാണ്\n\nsetDownloadDirectory = എവിടെ സൂക്ഷിക്കണം?\n\ndownloadDirectorySetTo = ഇനിമുതൽ സൂക്ഷിക്കുന്ന സ്ഥലം: {0}\n\nnoWriteAccess = NO WRITE ACCESS (അനുമതി ലഭിച്ചില്ല) on: {0} , പഴയ സ്ഥലത്ത് തന്നെ വെക്കാം\n\nshareMessage = ഇതൊരു മനോഹരമായ ആപ്പ് ആണ്, പാട്ടുകൾ ഡൗൺലോഡ് ചെയ്യാം http://github.com/Shabinder/SpotiFlyer\n\ngrantAnalytics = വിശദാംശങ്ങൾ നൽകുക\n\nnoInternetConnection = ഇൻ്റർനെറ്റ് ഇല്ല മാഷേ\n\ncheckInternetConnection =  ദയവായി നിങ്ങളുടെ ഇൻ്റർനെറ്റ് പരിശോധിക്കുക \n\ngrantPermissions = സമ്മതം നൽകുക\n\nrequiredPermissions = അനിവാര്യമായ അനുമതികൾ:\n\nstoragePermission = Storage Permission.\n\nstoragePermissionReason = പാട്ടുകൾ സൂക്ഷിക്കാൻ\n\nbackgroundRunning = Background Running.\n\nbackgroundRunningReason = തടസ്സങ്ങൾ ഇല്ലാതെ ഡൗൺലോഡ് ചെയ്യാൻ\n\nno = ഇല്ല\n\nyes = തീർച്ചയായും\n\nacraNotificationTitle = അയ്യോ Spotiflyer ക്രാഷ് ആയി\n\nacraNotificationText = ദയവായി ആപ്പ് ഡെവലപ്പർമാർക്ക് ക്രാഷ് റിപ്പോർട്ട് അയയ്ക്കുക, ഈ നിർഭാഗ്യകരമായ സംഭവം ഇനി ആവർത്തിക്കാതിരിക്കട്ടെ\n\nalbumArt = ആൽബം ചിത്രം\n\ntracks = പാട്ടുകൾ\n\ncoverImage = കവർ ചിത്രം\n\nreSearch = വീണ്ടും തിരയുക\n\nloading = ലോഡിംഗ്\n\ndownloadAll = എല്ലാം ഡൗൺലോഡ് ചെയ്യുക\n\nbutton = Button\n\nerrorOccurred = ഒരു പിശക് സംഭവിച്ചു, നിങ്ങളുടെ ലിങ്ക് / കണക്ഷൻ പരിശോധിക്കുക\n\ndownloadDone = ഡൗൺലോഡ് പൂർത്തിയായി\n\ndownloadError = അയ്യോ! ഈ ട്രാക്ക് ഡൗൺലോഡ് ചെയ്യാൻ കഴിയില്ല\n\ndownloadStart = ഡൗൺലോഡ് ആരംഭിക്കുക\n\nsupportUs = ഞങ്ങൾക്ക് നിങ്ങളുടെ പിന്തുണ ആവശ്യമാണ്!\n\ndonation = ഡൊണേഷൻ\n\nworldWideDonations = ലോകവ്യാപകമായ സംഭാവനകൾ\n\nindianDonations = ഇന്ത്യൻ സംഭാവനകൾ മാത്രം\n\ndismiss = പിരിച്ചുവിടുക\n\nremindLater = പിന്നീട് ഓർമ്മിപ്പിക്കുക\n\nmp3ConverterBusy = MP3 കൺവെർട്ടർ ലഭ്യമല്ല, ഒരുപക്ഷേ തിരക്കിൽ ആയിരിക്കാം !\n\nunknownError = അജ്ഞാത പിശക്\n\nnoMatchFound = കാണുന്നില്ല!\n\nnoLinkFound = ഡൗൺലോഡ് ചെയ്യാവുന്ന ലിങ്ക് കണ്ടെത്തിയില്ല\n\nlinkNotValid = നൽകിയ ലിങ്ക് സാധുതയുള്ളതല്ല!\n\nfeatureUnImplemented = ഫീച്ചർ ഇതുവരെ നടപ്പിലാക്കിയിട്ടില്ല.\n\nminute = min\n\nsecond = sec\n\nspotiflyerLogo = SpotiFlyer Logo\n\nbackButton = Back Button\n\ninfoTab = Info Tab\n\nhistoryTab = History Tab\n\nlinkTextBox = Link Text Box\n\npasteLinkHere = ലിങ്ക് ഇവിടെ ഒട്ടിക്കുക ...\n\nenterALink = Enter A Link!\n\nmadeWith = സ്നേഹപൂർവ്വം\n\nlove = Love\n\ninIndia = ഭാരതത്തിൽ നിന്ന്\n\nopen = Open\n\nbyDeveloperName = by: ശബീന്ദർ സിംഗ്\n"
  },
  {
    "path": "translations/Strings_ne.properties",
    "content": "title = स्पोटीफ्लायर\nabout = यस बारे\nhistory = इतिहास\ndonate = दान गर्नुहोस्\npreferences = रोजाई\nsearch = खोज्नुहोस\nsupportedPlatforms = समर्थित प्लेटफर्म\nsupportDevelopment = बिकासमा सहयोग गर्नुहोस\nopenProjectRepo = प्रोजेक्ट रिपो खोल्नुहोस्\nstarOrForkProject = गिटहबमा प्रोजेक्टलाई स्टार / फोर्क गर्नुहोस।\nhelp = मद्दत\ntranslate = अनुवाद गर्नुहोस्\nhelpTranslateDescription = हामीलाई यो एप तपाईंको स्थानीय भाषामा अनुवाद गर्न मद्दत गर्नुहोस्।\nsupportDeveloper = विकासकर्तालाई समर्थन गर्नुहोस।\ndonateDescription = यदि तपाईलाई लाग्छ कि म मेरो कामको लागि भुक्तानी पाउन योग्य छु, तपाईले मलाई यहाँ समर्थन गर्न सक्नुहुन्छ।\nshare = शेयर\nshareDescription = आफ्नो साथी र परिवार संग यो एप शेयर गर्नुहोस्।\nwhatWentWrong = के गल्ती भयाे...\ncopyToClipboard = क्लिपबोर्डमा कपि गर्नुहोस्\ncopyCodeInGithubIssue = गिटहबममा मुद्दा सिर्जना गर्दा / यो मुद्दा रिपोर्ट गर्दा राम्रो मद्दतको लागि तलको कोड कपि पेस्ट गर्नुहोस्।\nstatus = स्थिति\nanalytics = एनालिटिक्स\nanalyticsDescription = तपाईंको डाटा बेनामी छ र तेस्रो पक्ष सेवासँग कहिल्यै साझेदारी गरिएको छैन।\nnoHistoryAvailable = कुनै इतिहास उपलब्ध छैन\ncleaningAndExiting = सफा गर्दै र बाहिर निस्कँदै\ntotal = कुल\ncompleted = पुरा भएको\nfailed = असफल\nexit = बाहिर निस्कनुहोस्\ndownloading = डाउनलोड गर्दै\nprocessing = प्रोसेस गर्दै\nqueued = लाम लागेको\nsetDownloadDirectory = डाउनलोड डाइरेक्टरी सेट गर्नुहोस्\ndownloadDirectorySetTo = डाउनलोड डाइरेक्टरी {0} मा सेट भयो\nnoWriteAccess = {0} मा लेख्ने अनुमति छैन , अघिल्लोमा फर्कदै\nshareMessage = हे, यो उत्कृष्ट संगीत डाउनलोडर जाँच गर्नुहोस् http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = एनालिटिक्स प्रदान गर्नुहोस्\nnoInternetConnection = इन्टरनेट जडान छैन!\ncheckInternetConnection = कृपया आफ्नो नेटवर्क जडान जाँच गर्नुहोस्।\ngrantPermissions = अनुमतिहरू प्रदान गर्नुहोस्\nrequiredPermissions = आवश्यक अनुमतिहरू:\nstoragePermission = भण्डारण अनुमति।\nstoragePermissionReason = यस उपकरणमा आफ्नो मनपर्ने गीतहरू डाउनलोड गर्न।\nbackgroundRunning = पृष्ठभूमिमा चलिरहेको छ।\nbackgroundRunningReason = कुनै पनि प्रणाली अवरोध बिना पृष्ठभूमिमा सबै गीतहरू डाउनलोड गर्न।\nno = हुदैन\nyes = हुन्छ\n\nacraNotificationTitle = ओह, स्पोटीफ्लायर क्र्यास भयो\nacraNotificationText = कृपया एप विकासकर्ताहरूलाई क्र्यास रिपोर्ट पठाउनुहोस्, ताकि यो दुर्भाग्यपूर्ण घटना फेरि नदोहोरियोस्।\n\nalbumArt = एल्बम कला\ntracks = ट्रयाकहरू\ncoverImage = आवरण छवि\nreSearch = पुन: खोजी गर्नुहोस्\nloading = लोड गर्दै\ndownloadAll = सबै डाउनलोड गर्नुहोस्\nbutton = बटन\nerrorOccurred = एउटा त्रुटि देखा पर्यो, आफ्नो लिङ्क / जडान जाँच गर्नुहोस्\ndownloadDone = डाउनलोड गरियो\ndownloadError = त्रुटि! यो ट्रयाक डाउनलोड गर्न सकिँदैन\ndownloadStart = डाउनलोड सुरु गर्नुहोस्\nsupportUs = हामीलाई तपाईंको समर्थन चाहिन्छ!\ndonation = अनुदान\nworldWideDonations = विश्वव्यापी अनुदान\nindianDonations = भारतीय अनुदान मात्र\ndismiss = खारेज गर्नुहोस्\nremindLater = पछि सम्झाउनुहोस्\n\nmp3ConverterBusy = MP3 कन्भर्टर पहुँचयोग्य छैन, सम्भवतः व्यस्त !\nunknownError = अज्ञात त्रुटि\nnoMatchFound = कुनै मिल्दो फेला परेन!\nnoLinkFound = कुनै डाउनलोड योग्य लिङ्क फेला परेन\nlinkNotValid = इन्टर गरिएको लिङ्क मान्य छैन!\nfeatureUnImplemented = विशेषता अझै लागू भएको छैन।\n\nminute = मिनेट\nsecond = सेकन्ड\n\nspotiflyerLogo = स्पोटिफ्लायर लोगो\nbackButton = पछाडि बटन\ninfoTab = जानकारी ट्याब\nhistoryTab = इतिहास ट्याब\nlinkTextBox = लिङ्क पाठ बक्स\npasteLinkHere = यहाँ लिङ्क पेस्ट गर्नुहोस्...\nenterALink = एउटा लिङ्क इन्टर गर्नुहोस्!\nmadeWith = भारत मा\nlove = प्रेम\ninIndia = संग निर्मित\nopen = खोल्नुहोस्\nbyDeveloperName = द्वारा: शबिंदर सिंह\n"
  },
  {
    "path": "translations/Strings_nl.properties",
    "content": "title = SpotiFlyer\nabout = Over\nhistory = Geschiedenis\ndonate = Doneren\npreferences = Voorkeuren\nsearch = Zoeken\nsupportedPlatforms = Ondersteunde platformen\nsupportDevelopment = Ontwikkeling steunen\nopenProjectRepo = Project Repo Openen\nstarOrForkProject = Star / Fork het project op Github.\nhelp = Hulp\ntranslate = Vertalen\nhelpTranslateDescription = Help ons deze app te vertalen in je lokale taal.\nsupportDeveloper = Ontwikkelaar steunen\ndonateDescription = Als je geloofd dat ik verdien betaald te worden voor mijn werk, kan je me hier steunen.\nshare = Delen\nshareDescription = Deze app delen met je familie en vrienden.\nwhatWentWrong = Wat is er fout gegaan...\ncopyToClipboard = Kopieer naar klembord\ncopyCodeInGithubIssue = Kopieer en plak de onderstaande code bij het maken van (en/of het melden) van dit probleem op GitHub voor betere hulp.\nstatus = Status\nanalytics = Analytics\nanalyticsDescription = Je data is geanonimiseerd en wordt niet gedeeld met derde partijen.\nnoHistoryAvailable = Geen geschiedenis beschikbaar\ncleaningAndExiting = Schoonmaken en sluiten\ntotal = Totaal\ncompleted = Voltooid\nfailed = Gefaald\nexit = Sluiten\ndownloading = Aan het downloaden\nprocessing = Aan het verwerken\nqueued = In de wachtrij gezet\nsetDownloadDirectory = Download map instellen\ndownloadDirectorySetTo = Download map ingesteld als: {0}\nnoWriteAccess = GEEN TOEGANG TOT SCHRIJVEN naar: {0} , Vorig pad herstellen\nshareMessage = Hey, check deze geweldige muziekdownloader http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Analytics toestaan\nnoInternetConnection = Geen internet verbinding!\ncheckInternetConnection = Check alstublieft uw internetverbinding.\ngrantPermissions = Permissies toestaan\nrequiredPermissions = Benodigde permissies:\nstoragePermission = Opslag Permissie.\nstoragePermissionReason = Om uw favoriete nummers op dit apperaat te downloaden.\nbackgroundRunning = Werkend op de achtergrond.\nbackgroundRunningReason = Om alle nummers op de achtergrond te downloaden zonder onderbroken te worden door het systeem.\nno = Nee\nyes = Ja\n\nacraNotificationTitle = OEPS, SpotiFlyer is gecrasht\nacraNotificationText = Stuur alstublieft dit crashrapport naar de ontwikkelaars van de app, zodat we dit ongelukkig moment in de toekomst kunnen voorkomen.\n\nalbumArt = Albumhoes\ntracks = Nummers\ncoverImage = Omslagfoto\nreSearch = Opnieuw zoeken\nloading = Laden\ndownloadAll = Alles downloaden\nbutton = Knop\nerrorOccurred = Er is een fout opgetreden, check uw link / connectie\ndownloadDone = Downloaden klaar\ndownloadError = Foutmelding! Kan dit nummer niet downloaden\ndownloadStart = Download starten\nsupportUs = We hebben uw steun nodig!\ndonation = Donatie\nworldWideDonations = Wereldwijde donaties\nindianDonations = Exclusief donaties uit India\ndismiss = Afwijzen\nremindLater = Herinner me later\n\nmp3ConverterBusy = MP3 Omzetter onbereikbaar, waarschijnlijk BEZIG !\nunknownError = Onbekende fout\nnoMatchFound = GEEN overeenkomst gevonden!\nnoLinkFound = Geen downloadbare link gevonden\nlinkNotValid = De ingevoerde link is NIET geldig!\nfeatureUnImplemented = Onderdeel nog niet geïmplementeerd.\n\nminute = min\nsecond = sec\n\nspotiflyerLogo = SpotiFlyer Logo\nbackButton = Terug Knop\ninfoTab = Info Tabblad\nhistoryTab = Geschiedenis Tabblad\nlinkTextBox = Link Tekstvak\npasteLinkHere = Link hier plakken...\nenterALink = Voer een link in!\nmadeWith = Gemaakt met\nlove = Liefde\ninIndia = in India\nopen = Open\nbyDeveloperName = door: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_pl.properties",
    "content": "title = SpotiFlyer\nabout = Opis\nhistory = Historia\ndonate = Złóż donację\npreferences = Ustawienia\nsearch = Szukaj\nsupportedPlatforms = Obsługiwane Platformy\nsupportDevelopment = Wesprzyj Rozwój\nopenProjectRepo = Otwórz repozytorium projektu\nstarOrForkProject = Gwiazdkuj / Rozwidl pojekt na GitHubie.\nhelp = Pomoc\ntranslate = Przetłumacz\nhelpTranslateDescription = Pomóż nam pretłumaczyć tę aplikację na swój lokalny język.\nsupportDeveloper = Wesprzyj programistę\ndonateDescription = Jeśli uważasz, że zasługuję na wynagrodzenie za swoją pracę, możesz tutaj mnie wesprzeć.\nshare = Udostępnij\nshareDescription = Udostępnij tę aplikację znajomym i rodzinie.\nwhatWentWrong = Co poszło nie tak...\ncopyToClipboard = Skopiuj do schowka\ncopyCodeInGithubIssue = Copy Paste Below Code while creating Github Issue / Reporting this issue for better help.\nstatus = Status\nanalytics = Analityka\nanalyticsDescription = Twoje dane są anonimizowane i nigdy nie są udostępniane usługom stron trzecich.\nnoHistoryAvailable = Brak dostępnej historii\ncleaningAndExiting = Czyszczę i wychodzę\ntotal = Całość\ncompleted = Ukończono\nfailed = Nieudane\nexit = Wyjście\ndownloading = Pobieranie\nprocessing = Przetwarzanie\nqueued = W kolejce\nsetDownloadDirectory = Ustaw folder pobierania\ndownloadDirectorySetTo = Folder pobierania ustawiony na: {0}\nnoWriteAccess = Brak dostępu do zapisu w: {0} , Powracam to poprzedniego\nshareMessage = Hej, zobacz ten świetny program do pobierania muzyki http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Zezwół na zbieranie danych analitycznych\nnoInternetConnection = Nie podłączono do internetu!\ncheckInternetConnection = Prosze sprawdź swoje połączenie do internetu.\ngrantPermissions = Przyznaj uprawnienia\nrequiredPermissions = Wymagane uprawnienia:\nstoragePermission = Zezwolenie na przechowywanie.\nstoragePermissionReason = Aby było można pobierać utwory.\nbackgroundRunning = Zezwolenie na działanie w tle.\nbackgroundRunningReason = Aby było można pobierać utworów w tle bez zakłócenia.\nno = Nie\nyes = Tak\n\nacraNotificationTitle = Ups! Spotiflyer uległ awarii\nacraNotificationText = Wyślij raport o awarii do programistów aplikacji, aby zapobiec tej awarii w przyszłości.\n\nalbumArt = Okładki albumów\ntracks = Utwory\ncoverImage = Okładka\nreSearch = Szukaj ponownie\nloading = Wczytuję\ndownloadAll = Pobierz wszystkie\nbutton = Przycisk\nerrorOccurred = Ustąpił błąd, prosze sprawdz swoje połączenie\ndownloadDone = Pobieranie skończone\ndownloadError = Błąd! Nie można ściągnąć tego utworu\ndownloadStart = Zacznij pobieranie\nsupportUs = Potrzebujemy twojego wsparcia!\ndonation = Donacja\nworldWideDonations = Podarunki międzynarodowe\nindianDonations = Donacje z Indii\ndismiss = Odrzuć\nremindLater = Przypomnij póżniej\n\nmp3ConverterBusy = Konwerter MP3 nieosiągalny, najprawdopodobnie zajęty!\nunknownError = Nieznany błąd\nnoMatchFound = Nie znaleziono dopasowania!\nnoLinkFound = Nie znaleziono linku do pobrania\nlinkNotValid = Wpisany link nie jest prawidłowy!\nfeatureUnImplemented = Funkcja jeszcze nie zaimplementowana.\n\nminute = min\nsecond = sek\n\nspotiflyerLogo = Logo SpotiFlyer\nbackButton = Przycisk wstecz\ninfoTab = Zakładka informacji\nhistoryTab = Zakładka historii\nlinkTextBox = Pole tekstowe linku\npasteLinkHere = Wklej link tutaj...\nenterALink = Wpisz link\nmadeWith = Made with\nlove = Love\ninIndia = in India\nopen = Otwórz\nbyDeveloperName = by: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_pt.properties",
    "content": "title = SpotiFlyer\r\nabout = Sobre\r\nhistory = Histórico\r\ndonate = Doar\r\npreferences = Preferências\r\nsearch = Pesquisar\r\nsupportedPlatforms = Plataformas Suportadas\r\nsupportDevelopment = Ajude o Desenvolvimento\r\nopenProjectRepo = Abrir Repositórido do Projeto\r\nstarOrForkProject = Star / Fork do projeto no GitHub.\r\nhelp = Ajuda\r\ntranslate = Traduzir\r\nhelpTranslateDescription = Ajude-nos a traduzir esse app para seu idioma local.\r\nsupportDeveloper = Ajude o Desenvolvedor\r\ndonateDescription = Se você acha que mereço ser pago pelo meu trabalho, você pode me ajudar aqui.\r\nshare = Compartilhar\r\nshareDescription = Compartilhe este app com seus amigos e família.\r\nwhatWentWrong = O que deu errado...\r\ncopyToClipboard = Copiar para área de transferência\r\ncopyCodeInGithubIssue = Copiar e colar abaixo do código ao criar o problema no Github / relatar esse problema para obter ajuda melhor.\r\nstatus = Status\r\nanalytics = Estatísticas\r\nanalyticsDescription = Seus dados enviados são anônimos e nunca serão compartilhados com serviços de terceiros.\r\nnoHistoryAvailable = Histórico Indisponível.\r\ncleaningAndExiting = Limpando e Saindo\r\ntotal = Total\r\ncompleted = Completo\r\nfailed = Falhou\r\nexit = Sair\r\ndownloading = Baixando\r\nprocessing = Processando\r\nqueued = Na Fila\r\nsetDownloadDirectory = Definir Pasta de Download\r\ndownloadDirectorySetTo = Pasta de Download Definida para: {0}\r\nnoWriteAccess = NO WRITE ACCESS em: {0} , Revertendo Para o Anterior\r\nshareMessage = Ei, dá uma olhada nesse excelente Baixador de Músicas http://github.com/Shabinder/SpotiFlyer\r\ngrantAnalytics = Permitir Estatísticas\r\nnoInternetConnection = Sem conexão com a Internet!\r\ncheckInternetConnection = Por Favor, Checar Sua Conexão com a Internet.\r\ngrantPermissions = Autorizar Permissões\r\nrequiredPermissions = Permissões Necessárias:\r\nstoragePermission = Permissão de Armazenamento.\r\nstoragePermissionReason = Para baixar suas músicas favoritas para este dispositivo.\r\nbackgroundRunning = Executando Em Segundo Plano.\r\nbackgroundRunningReason = Para baixar todas as músicas em segundo plano sem Interrupções do Sistema.\r\nno = Não\r\nyes = Sim\r\n\r\nacraNotificationTitle = OOPS, SpotiFlyer Parou de Funcionar!\r\nacraNotificationText = Por Favor, Enviar Relatório para os Desenvolvedores do App, Para que este evento inesperado não aconteça novamente.\r\n\r\nalbumArt = Arte do Álbum \r\ntracks = Faixas\r\ncoverImage = Imagem de Capa\r\nreSearch = Buscar Novamente\r\nloading = Carregando\r\ndownloadAll = Baixar Todas\r\nbutton = Botão\r\nerrorOccurred = Aconteceu Um Erro, Checar seu Link / Conexão\r\ndownloadDone = Download Completo\r\ndownloadError = Erro! Não foi Possível Baixar essa Faixa!\r\ndownloadStart = Iniciar Download\r\nsupportUs = Precisamos Do Seu Apoio!\r\ndonation = Doação\r\nworldWideDonations = Doações Mundo Afora\r\nindianDonations = Apenas Doações da Índia\r\ndismiss = Descartar\r\nremindLater = Lembrar Depois\r\n\r\nmp3ConverterBusy = Conversor MP3 indisponível, provavelmente está CONGESTIONADO !\r\nunknownError = Erro Desconhecido\r\nnoMatchFound = NÃO Encontrado!\r\nnoLinkFound = Link de Download Não Encontrado\r\nlinkNotValid = Link Inserido NÃO é Válido!\r\nfeatureUnImplemented = Esta funcionalidade ainda não foi implementada.\r\n\r\nminute = min\r\nsecond = seg\r\n\r\nspotiflyerLogo = Logo do SpotiFlyer \r\nbackButton = Botão Voltar\r\ninfoTab = Aba de Informações\r\nhistoryTab = Aba de Histórico\r\nlinkTextBox = Caixa de Texto de Link\r\npasteLinkHere = Colar o Link Aqui...\r\nenterALink = Inserir Um Link!\r\nmadeWith = Feito com\r\nlove = Amor\r\ninIndia = na Índia\r\nopen = Abrir\r\nbyDeveloperName = por: Shabinder Singh\r\n"
  },
  {
    "path": "translations/Strings_pt_BR.properties",
    "content": "title = SpotiFlyer\nabout = Sobre\nhistory = Histórico\ndonate = Doar\npreferences = Preferências\nsearch = Pesquisar\nsupportedPlatforms = Plataformas Suportadas\nsupportDevelopment = Ajude o Desenvolvimento\nopenProjectRepo = Abrir Repositórido do Projeto\nstarOrForkProject = Star / Fork do projeto no GitHub.\nhelp = Ajuda\ntranslate = Traduzir\nhelpTranslateDescription = Ajude-nos a traduzir esse app para seu idioma local.\nsupportDeveloper = Ajude o Desenvolvedor\ndonateDescription = Se você acha que mereço ser pago pelo meu trabalho, você pode me ajudar aqui.\nshare = Compartilhar\nshareDescription = Compartilhe este app com seus amigos e família.\nstatus = Status\nanalytics = Estatísticas\nanalyticsDescription = Seus dados enviados são anônimos e nunca serão compartilhados com serviços de terceiros.\nnoHistoryAvailable = Histórico Indisponível.\ncleaningAndExiting = Limpando e Saindo\ntotal = Total\ncompleted = Completo\nfailed = Falhou\nexit = Sair\ndownloading = Baixando\nprocessing = Processando\nqueued = Na Fila\nsetDownloadDirectory = Definir Pasta de Download\ndownloadDirectorySetTo = Pasta de Download Definida para: {0}\nnoWriteAccess = NO WRITE ACCESS em: {0} , Revertendo Para o Anterior\nshareMessage = Ei, dá uma olhada nesse excelente Baixador de Músicas http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Permitir Estatísticas\nnoInternetConnection = Sem conexão com a Internet!\ncheckInternetConnection = Por Favor, Checar Sua Conexão com a Internet.\ngrantPermissions = Autorizar Permissões\nrequiredPermissions = Permissões Necessárias:\nstoragePermission = Permissão de Armazenamento.\nstoragePermissionReason = Para baixar suas músicas favoritas para este dispositivo.\nbackgroundRunning = Executando Em Segundo Plano.\nbackgroundRunningReason = Para baixar todas as músicas em segundo plano sem Interrupções do Sistema.\nno = Não\nyes = Sim\n\nacraNotificationTitle = OOPS, SpotiFlyer Parou de Funcionar!\nacraNotificationText = Por Favor, Enviar Relatório para os Desenvolvedores do App, Para que este evento inesperado não aconteça novamente.\n\nalbumArt = Arte do Álbum \ntracks = Faixas\ncoverImage = Imagem de Capa\nreSearch = Buscar Novamente\nloading = Carregando\ndownloadAll = Baixar Todas\nbutton = Botão\nerrorOccurred = Aconteceu Um Erro, Checar seu Link / Conexão\ndownloadDone = Download Completo\ndownloadError = Erro! Não foi Possível Baixar essa Faixa!\ndownloadStart = Iniciar Download\nsupportUs = Precisamos Do Seu Apoio!\ndonation = Doação\nworldWideDonations = Doações Mundo Afora\nindianDonations = Apenas Doações da Índia\ndismiss = Descartar\nremindLater = Lembrar Depois\n\nmp3ConverterBusy = Conversor MP3 indisponível, provavelmente está CONGESTIONADO !\nunknownError = Erro Desconhecido\nnoMatchFound = NÃO Encontrado!\nnoLinkFound = Link de Download Não Encontrado\nlinkNotValid = Link Inserido NÃO é Válido!\nfeatureUnImplemented = Esta funcionalidade ainda não foi implementada.\n\nminute = min\nsecond = seg\n\nspotiflyerLogo = Logo do SpotiFlyer \nbackButton = Botão Voltar\ninfoTab = Aba de Informações\nhistoryTab = Aba de Histórico\nlinkTextBox = Caixa de Texto de Link\npasteLinkHere = Colar o Link Aqui...\nenterALink = Inserir Um Link!\nmadeWith = Feito com\nlove = Amor\ninIndia = na Índia\nopen = Abrir\nbyDeveloperName = por: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_ro.properties",
    "content": "\ntitle = SpotiFlyer\nabout = Despre\nhistory = Istoric\ndonate = Doneaza\npreferences = Preferinte\nsearch = Cautare\nsupportedPlatforms = Platforme Compatibile\nsupportDevelopment = Sustine Dezvoltatea\nopenProjectRepo = Repo-ul proiectului\nstarOrForkProject = Apasa pe Star/Fork pe Github pentru a contribui la acest proiect.\nhelp = Ajutor\ntranslate = Tradu\nhelpTranslateDescription = Ajuta-ne sa traducem în limba ta locala.\nsupportDeveloper = Sustine Dezvoltatorul\ndonateDescription = Daca crezi ca merit sa fiu platit pentru munca mea, poti dona aici\nshare = Distribuie\nshareDescription = Distribuie aceasta aplicatie cu familia si prietenii tai.\nwhatWentWrong = Ce s-a întamplat...\ncopyToClipboard = Copiaza în fundal\ncopyCodeInGithubIssue = Copiaza acest cod când creezi o cerere de ajutor În GitHub.\nstatus = Status\nanalytics = Analize\nanalyticsDescription = Datele tale sunt anonimizate si nu sunt împartasite cu firme 3rd Party.\nnoHistoryAvailable = Nu exista Istoric.\ncleaningAndExiting = Se curata si se iese.\ntotal = Total\ncompleted = Terminat\nfailed = Esuat\nexit = Iesire\ndownloading = Se descarca\nprocessing = Se proceseaza\nqueued = In asteptare\nsetDownloadDirectory = Seteaza calea descarcarilor\ndownloadDirectorySetTo = Calea descarcarilor este setata la: {0}\nnoWriteAccess = NU SE POATE ACCESA ACEASTA CALE: {0} , Se revine la calea veche.\nshareMessage = Hey, uite-te la aceasta aplicatie grozava pentru descarcarea muzicii: http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Permite analizare.\nnoInternetConnection = Nu exista conexiune la internet!\ncheckInternetConnection = Te rog verifica conexiunea la internet!\ngrantPermissions = Acorda permisiuni\nrequiredPermissions = Permisiuni necesare:\nstoragePermission = Permisiune de stocare.\nstoragePermissionReason = Pentru a descarca melodiile tale preferate pe acest dispozitiv..\nbackgroundRunning = Rulare În fundal.\nbackgroundRunningReason = Pentru a descarca toate melodiile in fundal fara întreruperi.\nno = Nu, mutlumesc\nyes = Desigur\n\nacraNotificationTitle = OOPS, SpotiFlyer a dat eroare\nacraNotificationText = Te rog trimite raportul de eroare dezvoltatorilor ca acest lucru sa nu se mai întample în viitor..\n\nalbumArt = Arta albumului\ntracks = Piese\ncoverImage = Poza de coperta\nreSearch = Cautare din nou\nloading = Se Încarca\ndownloadAll = Descarca tot\nbutton = Buton\nerrorOccurred = A aparut o eroare te rog sa Îti verific link-ul sau conexiunea.\ndownloadDone = Descarcare completa\ndownloadError = Eroare! Aceasta piesa nu poate fi descarcata.\ndownloadStart = Începe descarcarea\nsupportUs = Avem nevoie de sustinerea ta!\ndonation = Donari\nworldWideDonations = Donatii globale\nindianDonations = Doar donatii Indiene\ndismiss = Nu, multumesc\nremindLater = Aminteste-mi mai tarziu\n\nmp3ConverterBusy = Convertorul Mp3 nu este valabil, probabil ocupat.\nunknownError = Eroare necunoscuta.\nnoMatchFound = Nu s-a gasit nicio potrivire\nnoLinkFound = Nu s-a gasit niciun link carr poate fi descarcat\nlinkNotValid = Link-ul introdus este invalid\nfeatureUnImplemented = Aceasta functie înca nu a fost implementata.\n\nminute = min\nsecond = sec\n\nspotiflyerLogo = SpotiFlyer Logo\nbackButton = Buton Înapoi\ninfoTab = Tabela Info\nhistoryTab = Tabela Istoric\nlinkTextBox = Casuta de Link\npasteLinkHere = Introdu un link aici...\nenterALink = Introdu un Link!\nmadeWith = Creeat cu\nlove = Iubire\ninIndia = în India\nopen = Open\nbyDeveloperName = De catre: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_ru.properties",
    "content": "title = SpotiFlyer\nabout = О приложении\nhistory = История\ndonate = Пожертвовать\npreferences = Предпочтения\nsearch = Поиск\nsupportedPlatforms = Поддерживаемые платформы\nsupportDevelopment = Поддержи разработчика \nopenProjectRepo = Открыть проект repo\nstarOrForkProject = Учавствуй в разработке и помогай дополнять проект на GitHub.\nhelp = Помощь\ntranslate = Локализация\nhelpTranslateDescription = Помоги перевести приложение на родной или другой язык.\nsupportDeveloper = Поддержи разработчика\ndonateDescription = Если считаешь, что я заслуживаю этого, ты можешь поддержать меня здесь.\nshare = Поделиться\nshareDescription = Расскажи об этом приложении знакомым - поделись полезным инструментом.\nwhatWentWrong = Что пошло не так...\ncopyToClipboard = Скопировать в буфер обмена\ncopyCodeInGithubIssue = Скопируйте вставьте ниже код при создании проблемы Github / Сообщите об этой проблеме для лучшей помощи.\nstatus = Статус\nanalytics = Аналитика\nanalyticsDescription = Предоставить анонимные данные для улучшения приложения. Они не будут переданы третьим лицам.\nnoHistoryAvailable = В истории пусто\ncleaningAndExiting = Очистка и выход\ntotal = Итог\ncompleted = Успешно выполнено\nfailed = Возникла ошибка\nexit = Выход\ndownloading = Загрузка\nprocessing = В процессе\nqueued = В очереди\nsetDownloadDirectory = Назначить расположение для загруженных файлов \ndownloadDirectorySetTo = Каталог загрузки изменен на {0} \nnoWriteAccess = Нет доступа для записи в: {0}, SpotiFlyer возвращается к предыдущему значению \nshareMessage = Надёжный, функциональный загрузчик музыки для YouTube, Spotify и пррчих стриминговых сервисов для Windows, Android, Mac, Linux можно установить с: http://github.com/Shabinder/SpotiFlyer \ngrantAnalytics = Разрешить отправлять данные для улучшения приложения \nnoInternetConnection = Нет стабильного интернет-соединения\ncheckInternetConnection = Проверь подключение к сети\ngrantPermissions = Предоставить разрешения \nrequiredPermissions = Необходимые разрешения:\nstoragePermission = Доступ к хранилищу\nstoragePermissionReason = Для загрузки файлов во внутреннее хранилище необходимо разрешение на использоаание хранилища.\nbackgroundRunning = Работа в фоновом режиме\nbackgroundRunningReason = Для стабильной работы в фоновом режиме требуется отключить автоматическое закрывание приложения.\nno = Нет\nyes = Да\n\nacraNotificationTitle = Упс, кажется в SpotiFlyer возникла ошибка  \nacraNotificationText = Отправь отчет о сбое разработчику приложения, чтобы проблема была замечена исправлена.\n\nalbumArt = Обоожка альбома\ntracks = Треки\ncoverImage = Обложка\nreSearch = Искать снова \nloading = Загрузка\ndownloadAll = Скачать все\nbutton = Кнопка\n\n\nerrorOccurred = Возникла какая-то ошибка. Проверь правильность ссылки и наличие подключение к сети.\ndownloadDone = Загрузка выполнена\ndownloadError = Ошибка: этот трек нельзя скачать \ndownloadStart =  Начать загрузку \nsupportUs = Нам нужна твоя поддержка\ndonation = Пожертвовать\nworldWideDonations = По всему мира \nindianDonations = Индия\ndismiss = Отклонить\nremindLater = Напомнить позже\n\n# Exceptions\nmp3ConverterBusy = В данный момент конвертер MP3 недоступен \nunknownError = Неизвестная ошибка \nnoMatchFound = Совпадений не найдено\nnoLinkFound = Ссылка для скачивания не найдена\nlinkNotValid = Введенная ссылка недействительна\nfeatureUnImplemented = Функция еще не реализована\n\nminute = мин\nsecond = сек\n\nspotiflyerLogo = SpotiFlyer лого\nbackButton = Кнопка назад\ninfoTab = Вкладка со информацией\nhistoryTab = Вкладка истории\nlinkTextBox = Поле для ссылки\npasteLinkHere = Вставь ссылку сюда\nenterALink = Введи ссылку\nmadeWith = Сделано с\nlove = любовью\ninIndia = в Индии\nopen = открыть\nbyDeveloperName = от: Шабиндера Сингха \n"
  },
  {
    "path": "translations/Strings_tl.properties",
    "content": "title = SpotiFlyer\nabout = Impormasyon\nhistory = Resulta\ndonate = Mag-Abuloy\npreferences = Mga Setting\nsearch = hanapin\nsupportedPlatforms = Suportadong Platform\nsupportDevelopment = Sumuporta sa Developer\nopenProjectRepo = Buksan ang proyekto ng repo\nstarOrForkProject = Bigyan ng Star / Fork ang proyekto sa Github.\nhelp = Tumulong\ntranslate = Isalin ang Wika\nhelpTranslateDescription = Tulungan kaming isalin ang app na ito sa iyong lokal na wika.\nsupportDeveloper = Sumuporta sa Developer\ndonateDescription = Kung sa tingin mo ay karapat-dapat akong mabayaran para sa aking trabaho, maaari mo akong suportahan dito.\nshare = Ibahagi\nshareDescription = Ibahagi ang app na ito sa iyong mga kaibigan at pamilya.\nwhatWentWrong = What Went Wrong...\ncopyToClipboard = Copy to Clipboard\ncopyCodeInGithubIssue = Copy Paste Below Code while creating Github Issue / Reporting this issue for better help.\nstatus = Kalagayan\nanalytics = analitika\nanalyticsDescription = Ang iyong Data ay hindi pinapakilala at hindi kailanman ibinahagi sa serbisyo ng 3rd party.\nnoHistoryAvailable = Walang History na Magagamit\ncleaningAndExiting = Nililinis at Ilalabas\ntotal = Total\ncompleted = Nakumpleto\nfailed = Nabigo\nexit = ilabas\ndownloading = Nagda-download\nprocessing = Pinoproseso\nqueued = Nakapila\nsetDownloadDirectory = Itakda ang Direktoryo ng Pag-download\ndownloadDirectorySetTo = I-download ng Direkta sa: {0}\nnoWriteAccess = NO WRITE ACCESS on: {0} , Reverting Back to Previous\nshareMessage = Uy, tingnan ang napakahusay na Music Downloader na ito http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Bigyan ng Analitika\nnoInternetConnection = Walang Koneksyon sa Internet!\ncheckInternetConnection = Suriin ang Iyong Koneksyon sa Network.\ngrantPermissions = Grant Permissions\nrequiredPermissions = Required na Permissions:\nstoragePermission = Storage Permission.\nstoragePermissionReason = Upang i-download ang iyong mga paboritong kanta sa device na ito.\nbackgroundRunning = Background Running.\nbackgroundRunningReason = Upang i-download ang lahat ng mga kanta sa background nang walang anumang Mga Pagkagambala sa System.\nno = Nope\nyes = Sure\n\nacraNotificationTitle = OOPS, SpotiFlyer Crashed\nacraNotificationText = Magpadala ng Ulat ng Pag-crash sa Mga Developer ng App, Para hindi na maulit ang kapus-palad na kaganapang ito.\n\nalbumArt = Album Art\ntracks = Tracks\ncoverImage = Cover Image\nreSearch = hanapin ulit\nloading = Loading\ndownloadAll = i Download lahat\nbutton = Button\nerrorOccurred = May Error na Naganap, Suriin ang iyong Link / Koneksyon\ndownloadDone = Tapos na idownload\ndownloadError = Error! Hindi ma-download ang track na ito\ndownloadStart = Simulan i Download\nsupportUs = Kailangan namin ang Iyong Suporta!\ndonation = donasyon\nworldWideDonations = World Wide Donations\nindianDonations = Indian Donations Only\ndismiss = Dismiss\nremindLater = paalalahanin mamaya\n\nmp3ConverterBusy = MP3 Converter unreachable, probably BUSY !\nunknownError = Unknown Error\nnoMatchFound = Walang nahanap na kapares!\nnoLinkFound = Walang nahanap na link na nada-download\nlinkNotValid = HINDI Wasto ang inilagay na Link!\nfeatureUnImplemented = Feature not yet implemented.\n\nminute = min\nsecond = sec\n\nspotiflyerLogo = SpotiFlyer Logo\nbackButton = Back Button\ninfoTab = Info Tab\nhistoryTab = History Tab\nlinkTextBox = Link Text Box\npasteLinkHere = Paste Link Here...\nenterALink = Enter A Link!\nmadeWith = Made with\nlove = Love\ninIndia = in India\nopen = Open\nbyDeveloperName = by: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_tr.properties",
    "content": "title = SpotiFlyer\nabout = Hakkında\nhistory = Geçmiş\ndonate = Bağış Yap\npreferences = Tercihler\nsearch = Ara\nsupportedPlatforms = Desteklenen Platformlar\nsupportDevelopment = Geliştirmeyi Destekleyin\nopenProjectRepo = Proje Deposunu Aç\nstarOrForkProject = Projeyi GitHub'ta Yıldızlayın / Fork'layın\nhelp = Yardım\ntranslate = Çeviri\nhelpTranslateDescription = Bu uygulamayı kendi diline çevirmek için bizlere yardım et.\nsupportDeveloper = Geliştiriciyi Destekle\ndonateDescription = Eğer ki emeğim için para almayı hak ettiğimi düşünüyorsan, buradan beni destekle.\nshare = Paylaş\nshareDescription = Bu uygulamayı arkadaşların ve ailenle paylaş.\nwhatWentWrong = Yanlış giden şey ne...\ncopyToClipboard = Panoya Kopyala\ncopyCodeInGithubIssue = GitHub Sorunu / Raporu oluştururken daha iyi yardım almak için aşağıdaki kopyala ve yapıştır.\nstatus = Durum\nanalytics = Analizler\nanalyticsDescription = Veriniz anonim kalır ve asla 3. parti servislerle paylaşılmaz.\nnoHistoryAvailable = Görülecek Geçmiş Yok\ncleaningAndExiting = Temizleniyor ve Çıkış Yapılıyor\ntotal = Toplam\ncompleted = Tamamlandı\nfailed = Başarısız\nexit = Çıkış\ndownloading = İndiriliyor\nprocessing = İşleniyor\nqueued = Sıraya Alındı\nsetDownloadDirectory = İndirme Konumunu Belirle\ndownloadDirectorySetTo = İndirme konumu şuraya ayarlandı: {0}\nnoWriteAccess = Şu Konumda YAZMA İZNİ YOK: {0} , Önceki Konuma Geri Dönülüyor\nshareMessage = Hey, bu mükemmel müzik indiriciye bir göz at http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Analizleri Yolla\nnoInternetConnection = İnternet Bağlantısı Yok!\ncheckInternetConnection = Lütfen internet bağlantınızı kontrol edin.\ngrantPermissions = İzin Ver\nrequiredPermissions = Gerekli İzinler:\nstoragePermission = Depolama İzni.\nstoragePermissionReason = Favori müziklerini cihazına indirebilmen için.\nbackgroundRunning = Arka Plan İzni\nbackgroundRunningReason = Tüm şarkıları hiçbir sistem kesintisi olmadan indirebilmek için.\nno = Almayayım\nyes = Tabii Ki\n\nacraNotificationTitle = ABOO, SpotiFlyer çöktü.\nacraNotificationText = Lütfen uygulama geliştiricilerine çökme raporunu yollayın ki böyle bir talihsiz olay bir daha yaşanmasın.\n\nalbumArt = Albüm Resmi\ntracks = Parça\ncoverImage = Kapak Resmi\nreSearch = Yeniden Arat\nloading = Yükleniyor\ndownloadAll = Hepsini indir\nbutton = Buton\nerrorOccurred = Bir hata meydana geldi, linkini / bağlantını kontrol et.\ndownloadDone = İndirme Tamamlandı\ndownloadError = Hata! Bu parça indirilemiyor\ndownloadStart = İndirmeyi Başlat\nsupportUs = Desteğine ihtiyacımız var!\ndonation = Bağış\nworldWideDonations = Dünya Çapında Bağışlar\nindianDonations = Sadece Hint Bağışları\ndismiss = Reddet\nremindLater = Daha Sonra Hatırlat\n\nmp3ConverterBusy = MP3 dönüştürücüye ulaşılamıyor, büyük ihtimalle MEŞGUL!\nunknownError = Bilinmeyen Hata\nnoMatchFound = HİÇBİR eşleşme bulunamadı!\nnoLinkFound = İndirilebilir Link Bulunamadı\nlinkNotValid = Girilen Link Geçerli DEĞİL!\nfeatureUnImplemented = Özellik henüz uygulanmadı.\n\nminute = dk\nsecond = sn\n\nspotiflyerLogo = SpotiFlyer Logosu\nbackButton = Geri butonu\ninfoTab = Bilgi Sekmesi\nhistoryTab = Geçmiş Sekmesi\nlinkTextBox = Link Metni Kutusu\npasteLinkHere = Linki Buraya Yapıştır...\nenterALink = Bir Link Gir!\nmadeWith = Hindistan'da\nlove = Aşk\ninIndia = ile yapıldı\nopen = Aç\nbyDeveloperName = geliştirici: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_tw.properties",
    "content": "title = SpotiFlyer\nabout = 關於\nhistory = 歷史紀錄\ndonate = 捐贈\npreferences = 個人化\nsearch = 搜索\nsupportedPlatforms = 受支援的平台\nsupportDevelopment = 給我們動力\nopenProjectRepo = 打開項目回購\nstarOrForkProject = Github 目標地址\nhelp = 找尋使用技巧\ntranslate = 翻譯\nhelpTranslateDescription = 幫助我們翻譯別國語言\nsupportDeveloper = 現在開始抖內！\ndonateDescription = 你若認可此專案，歡迎抖內！！\nshare = 分享\nshareDescription = 這麼好用的工具，還不快分享！？\nwhatWentWrong = 我出錯了……\ncopyToClipboard = 複製到剪貼簿\ncopyCodeInGithubIssue = 到 Github 上報告此問題，這樣可以更快獲得解方，貼上以下代碼。\nstatus = 狀態\nanalytics = 分析\nanalyticsDescription = 你的資料是受保護的，我們不會與黑市做交易…\nnoHistoryAvailable = 還沒搜過任何東西…\ncleaningAndExiting = 我先去睡了…\ntotal = 統計\ncompleted = 已完成\nfailed = 失敗\nexit = 讓我休眠\ndownloading = 正在下載…\nprocessing = 處理中，請稍後…\nqueued = 已加入下載!\nsetDownloadDirectory = 設置下載目錄\ndownloadDirectorySetTo = 下載目錄設置為: {0}\nnoWriteAccess = 沒辦法設這！: {0} , 正在回到上一頁…\nshareMessage = 你若不參考看看，就是你吃虧 http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = 乾爹，數鈔中…\nnoInternetConnection = 你跑到宇宙去了！！\ncheckInternetConnection = 快回來地球吧～\ngrantPermissions = 給我力量！\nrequiredPermissions = 我需要:\nstoragePermission =儲存權限\nstoragePermissionReason = 讓你在宇宙也能放歌～\nbackgroundRunning = 後台運行\nbackgroundRunningReason = 在你做別的事情時也能照樣載歌\nno = 無\nyes = 有\n\nacraNotificationTitle = SpotiFlyer 爆炸了!!!\nacraNotificationText = 把這次爆炸的原因回報 Github,造福全人類吧！\n\nalbumArt = 專輯封面\ntracks = 曲目\ncoverImage = 封面\nreSearch = 重新搜索\nloading = 讀取中…\ndownloadAll = 我全都要!\nbutton = 按鈕\nerrorOccurred = 出現錯誤，檢查一下貼上的鏈接或是有沒有網路\ndownloadDone = 下載完成～\ndownloadError = 出錯了！沒辦法下載這歌…\ndownloadStart = 開始下載\nsupportUs = 我們需要你的幫助!\ndonation = 抖內\nworldWideDonations = 全球抖內\nindianDonations = 印度抖內\ndismiss = 忽略\nremindLater = 等等再提醒\n\nmp3ConverterBusy = MP3 轉譯器不知道在幹嘛？等等再試一次…\nunknownError = 我不知道哪裡出錯!!\nnoMatchFound = 沒找到匹配項目…\nnoLinkFound = 沒找到鏈接!\nlinkNotValid = 鏈接不可用!\nfeatureUnImplemented = 這是未來科技……\n\nminute = 分\nsecond = 秒\n\nspotiflyerLogo = SpotiFlyer 圖標\nbackButton = 返回鍵\ninfoTab = 詳情\nhistoryTab = 歷史\nlinkTextBox = 鏈接\npasteLinkHere = 在這裡輸入鏈接~\nenterALink = 請輸入鏈接!\nmadeWith = 用\nlove = 喜歡\ninIndia = 於印度\nopen = 打開\nbyDeveloperName = 開發者: Shabinder Singh 翻譯(TW):唐懂\n"
  },
  {
    "path": "translations/Strings_uk.properties",
    "content": "title = SpotiFlyer\nabout = Про програму\nhistory = Історія\ndonate = Донат\npreferences = Налаштування\nsearch = Пошук\nsupportedPlatforms = Підтримувані платформи\nsupportDevelopment = Підтримати розробку\nopenProjectRepo = Відкрити репозиторій\nstarOrForkProject = Fork проекта на GitHub\nhelp = Допомога\ntranslate = Переклад\nhelpTranslateDescription = Допоможіть перекласти цю програму на вашу мову.\nsupportDeveloper = Підтримати розробника\ndonateDescription = Якщо ви вважаєте, що я заслуговую на отримання грошей за свою роботу, ви можете підтримати мене тут.\nshare = Поділитися\nshareDescription = Поділися цією програмою зі своїми друзями та родиною.\nwhatWentWrong = Що пішло не так...\ncopyToClipboard = Копіювати в буфер обміну\ncopyCodeInGithubIssue = Скопіюйте вставку нижче коду під час створення випуску Github / звітування про цю проблему, щоб отримати кращу допомогу.\nstatus = Статус\nanalytics = Аналіз\nanalyticsDescription = Ваші дані анонімні та ніколи не передаються стороннім сервісам.\nnoHistoryAvailable = Поки немає історії\ncleaningAndExiting = Очистка та завершення\ntotal = Всього\ncompleted = Завершенно\nfailed = Помилка\nexit = Вихід\ndownloading = Завантаження\nprocessing = Обробка\nqueued = В черзі\nsetDownloadDirectory = Вкажіть директорію завантаження\ndownloadDirectorySetTo = Директорія завантаження: {0}\nnoWriteAccess = NO WRITE ACCESS on: {0} , Повернення\nshareMessage = Привіт, хочу поділитися з вами, цим чудовим проектом, який дозволяє завантажувати музику http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = Перевірка дозволів\nnoInternetConnection = Немає підключення до інтернету!\ncheckInternetConnection = Перевірте з'єднання з інтернетом.\ngrantPermissions = Надати дозволи\nrequiredPermissions = Необхідні дозволи:\nstoragePermission = Дозвіл до пам'яті.\nstoragePermissionReason = Щоб завантажити улюблені пісні на цей пристрій.\nbackgroundRunning = Працює в фоні.\nbackgroundRunningReason = Завантажувати всі пісні у фоновому режимі без будь-яких системних перебоїв.\nno = Ні\nyes = Звичайно\n\nacraNotificationTitle = Упс, SpotiFlyer крашнувся :(\nacraNotificationText = Надішліть звіт про аварійне завершення, розробникам додатку.\n\nalbumArt = Зображення альбому\ntracks = Треки\ncoverImage = Зображення обкладинки\nreSearch = Повторний пошук\nloading = Завантаження...\ndownloadAll = Завантажити все\nbutton = Кнопка\nerrorOccurred = Сталася помилка, перевірте своє з’єднання\ndownloadDone = Завантаження завершенно\ndownloadError = Помилка! Неможливо завантажити цю композицію\ndownloadStart = Початок завантаження\nsupportUs = Нам потрібна ваша підтримка!\ndonation = Донат\nworldWideDonations = Світові пожертви\nindianDonations = Тільки індійські пожертви\ndismiss = Відхилити\nremindLater = Нагадати пізніше\n\n# Exceptions\nmp3ConverterBusy = MP3 Конвентер недоступний, напевне ЗАЙНЯТИЙ!\nunknownError = Невідома \nnoMatchFound = Нічого не знайденно!\nnoLinkFound = Посилання для завантаження не знайденно!\nlinkNotValid = Це посилання не підходить!\nfeatureUnImplemented = Функція ще не реалізована.\n\nminute = хв\nsecond = сек\n\nspotiflyerLogo = SpotiFlyer Логотип\nbackButton = Кнопка назад\ninfoTab = Інформація\nhistoryTab = Історія\nlinkTextBox = Поле для посилання\npasteLinkHere = Вставте посилання сюди...\nenterALink = Вставте посилання!\nmadeWith = Зроблено з\nlove = Любовю\ninIndia = в Індії\nopen = Відкрити\nbyDeveloperName = від: Shabinder Singh\n"
  },
  {
    "path": "translations/Strings_ur.properties.xml",
    "content": "title = SpotiFlyer\nabout = کے بارے میں\nhistory = تاریخ\ndonate = عطیہ کریں\npreferences = ترجیحات\nsearch = تلاش کریں\nsupportedPlatforms = تائید شدہ پلیٹ فارمز\nsupportDevelopment = سپورٹ ڈویلپمنٹ\nopenProjectRepo = پروجیکٹ ریپو کھولیں\nstarOrForkProject = سٹار / Github پر پروجیکٹ کو فورک کریں\nhelp = مدد\ntranslate = ترجمہ کریں\nhelpTranslateDescription = اس ایپ کا اپنی مقامی زبان میں ترجمہ کرنے میں ہماری مدد کریں\nsupportDeveloper = سپورٹ ڈویلپر\ndonateDescription = اگر آپ کو لگتا ہے کہ میں اپنے کام کے لیے معاوضہ لینے کا مستحق ہوں، تو آپ یہاں میری مدد کر سکتے ہیں۔\nshare = شیئر\nshareDescription = اس ایپ کو اپنے دوستوں اور خاندان کے ساتھ شیئر کریں۔\nwhatWentWrong = کیا غلط ہوا۔۔۔\ncopyToClipboard = کلپ بورڈ پر کاپی کریں۔\ncopyCodeInGithubIssue = بہتر مدد کے لیے گیتھب ایشو بناتے وقت / اس مسئلے کو رپورٹ کرتے وقت نیچے کوڈ کاپی پیسٹ کریں۔\nstatus = حالت\nanalytics = تجزیات\nanalyticsDescription = آپ کا ڈیٹا گمنام ہے اور فریق ثالث سروس کے ساتھ کبھی شیئر نہیں کیا گیا ہے۔\nnoHistoryAvailable = کوئی تاریخ دستیاب نہیں ہے۔\ncleaningAndExiting = صفائی اور باہر نکلنا\ntotal = کل\ncompleted = مکمل\nfailed = ناکام\nexit = باہر نکلیں\ndownloading = ڈاؤن لوڈ ہو رہا ہے\nprocessing = پروسیسنگ\nqueued = قطار میں لگ گیا\nsetDownloadDirectory = ڈاؤن لوڈ ڈائرکٹری سیٹ کریں\ndownloadDirectorySetTo =  ڈاؤن لوڈ ڈائرکٹری اس پر سیٹ ھوگیا ھے: {0}\nnoWriteAccess = ٰٓاس پر رائٹ رسائی نھیں ھے: {0}، واپس پچھلے پر واپس جارھاھے\nshareMessage = ارے، اس بہترین میوزک ڈاؤنلوڈر کو چیک کریں http://github.com/Shabinder/SpotiFlyer\ngrantAnalytics = تجزیات کو گرانٹ کریں\nnoInternetConnection = کوئی انٹرنیٹ کنکشن نہیں\ncheckInternetConnection = براہ کرم اپنا نیٹ ورک کنکشن چیک کریں۔\ngrantPermissions = اجازتیں دیں\nrequiredPermissions = مطلوبہ اجازتیں:\nstoragePermission = اسٹوریج کی اجازت۔\nstoragePermissionReason = اس ڈیوائس پر اپنے پسندیدہ گانے ڈاؤن لوڈ کرنے کے لیے۔\nbackgroundRunning = پس منظر چل رہا ہے.\nbackgroundRunningReason = سسٹم میں رکاوٹ کے بغیر تمام گانوں کو بیک گراؤنڈ میں ڈاؤن لوڈ کرنے کے لیے۔\nno = نھیں\nyes = ضرور\n\nacraNotificationTitle = SpotiFlyer کریش ہو گیا۔\nacraNotificationText = براہ کرم کریش رپورٹ ایپ ڈیولپرز کو ارسال کریں، تاکہ یہ افسوسناک واقعہ دوبارہ پیش نہ آئے۔\n\nalbumArt = البم آرٹ\ntracks = ٹریکس\ncoverImage = کور امیج\nreSearch = دوبارہ تلاش کریں\nloading = لوڈ ہو رہا ہے\ndownloadAll = تمام ڈاؤن لوڈ کریں\nbutton = بٹن\nerrorOccurred = ایک خرابی پیش آگئی، اپنا لنک / کنکشن چیک کریں\ndownloadDone = ڈاؤن لوڈ ہو گیا\ndownloadError = غلطی! اس ٹریک کو ڈاؤن لوڈ نہیں کر سکتے\ndownloadStart = ڈاون لوڈ کرنا شروع کریں\nsupportUs = ہمیں آپ کے تعاون کی ضرورت ہے\ndonation = عطیہ\nworldWideDonations = عالمی سطح پر عطیات\nindianDonations = صرف ہندوستانی عطیات\ndismiss = برطرف کرنا\nremindLater = بعد میں یاد دلائیں\n\nmp3ConverterBusy = mp3 کنورٹر ناقابل رسائی، شاید مصروف\nunknownError = نامعلوم خامی\nnoMatchFound = کوئی مماثلت نہیں ملی\nnoLinkFound = کوئی ڈاؤن لوڈ کے قابل لنک نہیں ملا\nlinkNotValid = درج کردہ لنک درست نہیں ہے\nfeatureUnImplemented = خصوصیت ابھی لاگو نہیں ہوا۔\n\nminute = منٹ\nsecond = سیکنڈ\n\nspotiflyerLogo = SpotiFlyer لوگو\nbackButton = پیچھے جانے کا بٹن\ninfoTab = معلومات کا ٹیب\nhistoryTab = تاریخ ٹیب\nlinkTextBox = لنک ٹیکسٹ باکس\npasteLinkHere = لنک یہاں چسپاں کریں۔۔۔\nenterALink = ایک لنک درج کریں\nmadeWith = کے ساتھ بنایا گیا\nlove = محبت\ninIndia = بھارت میں\nopen = کھولیں\nbyDeveloperName = از: شبندر سنگھ\n"
  },
  {
    "path": "web-app/build.gradle.kts",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nplugins {\n    kotlin(\"js\")\n}\n\ngroup = \"com.shabinder\"\nversion = \"0.1\"\n\ndependencies {\n    with(deps) {\n        implementation(koin.core)\n        implementation(decompose.dep)\n        implementation(ktor.client.js)\n        with(bundles) {\n            implementation(mviKotlin)\n            implementation(ktor)\n            implementation(kotlin.js.wrappers)\n        }\n    }\n    implementation(project(\":common:root\"))\n    implementation(project(\":common:main\"))\n    implementation(project(\":common:list\"))\n    implementation(project(\":common:database\"))\n    implementation(project(\":common:data-models\"))\n    implementation(project(\":common:providers\"))\n    implementation(project(\":common:core-components\"))\n    implementation(project(\":common:dependency-injection\"))\n    implementation(\"org.jetbrains.kotlin:kotlin-stdlib-js:${deps.kotlin.kotlinGradlePlugin.get().versionConstraint.requiredVersion}\")\n}\n\nkotlin {\n    js(IR) {\n        //useCommonJs()\n        browser {\n            webpackTask {\n                cssSupport.enabled = true\n            }\n            runTask {\n                cssSupport.enabled = true\n            }\n            testTask {\n                useKarma {\n                    useChromeHeadless()\n                    webpackConfig.cssSupport.enabled = true\n                }\n            }\n        }\n        binaries.executable()\n    }\n    // WorkAround: https://youtrack.jetbrains.com/issue/KT-49124\n    rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin> {\n        rootProject.the<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension>().apply {\n            resolution(\"@webpack-cli/serve\", \"1.5.2\")\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/App.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport com.arkivanov.decompose.DefaultComponentContext\nimport com.arkivanov.essenty.lifecycle.LifecycleRegistry\nimport com.arkivanov.essenty.lifecycle.destroy\nimport com.arkivanov.essenty.lifecycle.resume\nimport com.arkivanov.mvikotlin.core.store.StoreFactory\nimport com.arkivanov.mvikotlin.logging.store.LoggingStoreFactory\nimport com.arkivanov.mvikotlin.main.store.DefaultStoreFactory\nimport com.shabinder.common.core_components.file_manager.DownloadProgressFlow\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.di.ApplicationInit\nimport com.shabinder.common.models.Actions\nimport com.shabinder.common.models.PlatformActions\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.root.SpotiFlyerRoot\nimport com.shabinder.database.Database\nimport extras.renderableChild\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.RComponent\nimport react.State\nimport root.RootR\n\nexternal interface AppProps : PropsWithChildren {\n    var dependencies: AppDependencies\n}\n\n@Suppress(\"FunctionName\")\nfun RBuilder.App(attrs: AppProps.() -> Unit) {\n    return child(App::class) {\n        this.attrs(attrs)\n    }\n}\n\n@Suppress(\"EXPERIMENTAL_IS_NOT_ENABLED\", \"NON_EXPORTABLE_TYPE\")\n@OptIn(ExperimentalJsExport::class)\n@JsExport\nclass App(props: AppProps) : RComponent<AppProps, State>(props) {\n\n    private val lifecycle = LifecycleRegistry()\n    private val ctx = DefaultComponentContext(lifecycle = lifecycle)\n    private val dependencies = props.dependencies\n\n    override fun RBuilder.render() {\n        renderableChild(RootR::class, root)\n    }\n\n    private val root = SpotiFlyerRoot(ctx,\n        object : SpotiFlyerRoot.Dependencies {\n            override val storeFactory: StoreFactory = LoggingStoreFactory(DefaultStoreFactory)\n            override val fetchQuery = dependencies.fetchPlatformQueryResult\n            override val fileManager = dependencies.fileManager\n            override val analyticsManager = dependencies.analyticsManager\n            override val appInit: ApplicationInit = dependencies.appInit\n            override val preferenceManager: PreferenceManager = dependencies.preferenceManager\n            override val database: Database? = fileManager.db\n            override val downloadProgressFlow = DownloadProgressFlow\n            override val actions = object : Actions {\n                override val platformActions = object : PlatformActions {}\n\n                override fun showPopUpMessage(string: String, long: Boolean) {\n                    /*TODO(\"Not yet implemented\")*/\n                }\n\n                override fun copyToClipboard(text: String) {}\n\n                override fun setDownloadDirectoryAction(callBack: (String) -> Unit) {}\n\n                override fun queryActiveTracks() {}\n\n                override fun giveDonation() {}\n\n                override fun shareApp() {}\n\n                override fun openPlatform(packageID: String, platformLink: String) {}\n\n                override fun writeMp3Tags(trackDetails: TrackDetails) {/*IMPLEMENTED*/\n                }\n\n                override val isInternetAvailable: Boolean = true\n            }\n        }\n    )\n\n    override fun componentDidMount() {\n        lifecycle.resume()\n    }\n\n    override fun componentWillUnmount() {\n        lifecycle.destroy()\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/Styles.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport kotlinx.css.Align\nimport kotlinx.css.BorderStyle\nimport kotlinx.css.Color\nimport kotlinx.css.Display\nimport kotlinx.css.JustifyContent\nimport kotlinx.css.alignContent\nimport kotlinx.css.alignItems\nimport kotlinx.css.backgroundColor\nimport kotlinx.css.borderBottomColor\nimport kotlinx.css.borderBottomStyle\nimport kotlinx.css.borderColor\nimport kotlinx.css.borderRadius\nimport kotlinx.css.borderRightColor\nimport kotlinx.css.borderWidth\nimport kotlinx.css.color\nimport kotlinx.css.display\nimport kotlinx.css.justifyContent\nimport kotlinx.css.margin\nimport kotlinx.css.padding\nimport kotlinx.css.px\nimport styled.StyleSheet\n\nval colorPrimary = Color(\"#FC5C7D\")\nval colorPrimaryDark = Color(\"#CE1CFF\")\nval colorAccent = Color(\"#9AB3FF\")\nval colorOffWhite = Color(\"#E7E7E7\")\n\nobject Styles: StyleSheet(\"Searchbar\", isStatic = true) {\n    val makeRow by css {\n        display = Display.flex\n        alignItems = Align.center\n        alignContent = Align.center\n        justifyContent = JustifyContent.center\n    }\n    val darkMode by css {\n        backgroundColor = Color.black\n        color = Color.white\n    }\n    val circular by css {\n        borderRadius = 30.px\n        borderWidth = 5.px\n        borderBottomStyle = BorderStyle.solid\n    }\n    val circularGradient by css {\n        apply(circular)\n        borderColor = Color.aqua\n        borderBottomColor = colorPrimary\n        borderRightColor = colorPrimary\n    }\n    val largePadding by css { padding(20.px) }\n    val mediumPadding by css { padding(14.px) }\n    val smallPadding by css { padding(4.px) }\n    val largeMargin by css { margin(20.px) }\n    val mediumMargin by css { margin(12.px) }\n    val smallMargin by css { margin(4.px) }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/client.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.core_components.analytics.AnalyticsManager\nimport com.shabinder.common.core_components.file_manager.FileManager\nimport com.shabinder.common.core_components.preference_manager.PreferenceManager\nimport com.shabinder.common.di.ApplicationInit\nimport com.shabinder.common.di.initKoin\nimport com.shabinder.common.providers.FetchPlatformQueryResult\nimport kotlinx.browser.document\nimport kotlinx.browser.window\nimport org.koin.core.component.KoinComponent\nimport org.koin.core.component.get\nimport react.dom.render\n\nfun main() {\n    window.onload = {\n        render(document.getElementById(\"root\")) {\n            App {\n                dependencies = AppDependencies\n            }\n        }\n    }\n}\n\nobject AppDependencies : KoinComponent {\n    val logger: Kermit\n    val fileManager: FileManager\n    val fetchPlatformQueryResult: FetchPlatformQueryResult\n    val preferenceManager: PreferenceManager\n    val analyticsManager: AnalyticsManager\n    val appInit: ApplicationInit\n    init {\n        initKoin()\n        fileManager = get()\n        logger = get()\n        fetchPlatformQueryResult = get()\n        preferenceManager = get()\n        analyticsManager = get()\n        appInit = get()\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/extras/RenderableComponent.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage extras\n\nimport com.arkivanov.decompose.value.Value\nimport com.arkivanov.decompose.value.ValueObserver\nimport react.PropsWithChildren\nimport react.RComponent\nimport react.State\nimport react.setState\n\n\n@Suppress(\"EXPERIMENTAL_IS_NOT_ENABLED\", \"NON_EXPORTABLE_TYPE\")\n@OptIn(ExperimentalJsExport::class)\n@JsExport\nabstract class RenderableComponent<T : Any, S : State>(\n    props: Props<T>,\n    initialState: S\n) : RComponent<Props<T>, S>(props) {\n\n    private val subscriptions = ArrayList<Subscription<*>>()\n    protected val component: T get() = props.component\n\n    init {\n        state = initialState\n    }\n\n    override fun componentDidMount() {\n        subscriptions.forEach { subscribe(it) }\n    }\n\n    private fun <T : Any> subscribe(subscription: Subscription<T>) {\n        subscription.value.subscribe(subscription.observer)\n    }\n\n    override fun componentWillUnmount() {\n        subscriptions.forEach { unsubscribe(it) }\n    }\n\n    private fun <T : Any> unsubscribe(subscription: Subscription<T>) {\n        subscription.value.unsubscribe(subscription.observer)\n    }\n\n    protected fun <T : Any> Value<T>.bindToState(buildState: S.(T) -> Unit) {\n        subscriptions += Subscription(this) { data -> setState { buildState(data) } }\n    }\n\n\n    protected class Subscription<T : Any>(\n        val value: Value<T>,\n        val observer: ValueObserver<T>\n    )\n}\n\n@Suppress(\"EXPERIMENTAL_IS_NOT_ENABLED\", \"NON_EXPORTABLE_TYPE\")\n@OptIn(ExperimentalJsExport::class)\n@JsExport\nclass RStateWrapper<T>(\n    var model: T\n) : State\n\nexternal interface Props<T : Any> : PropsWithChildren {\n    var component: T\n}"
  },
  {
    "path": "web-app/src/main/kotlin/extras/UniqueId.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage extras\n\nimport kotlinext.js.Object\nimport kotlinext.js.jsObject\n\nvar uniqueId: Long = 0L\n\ninternal fun Any.uniqueId(): Long {\n    var id: dynamic = asDynamic().__unique_id\n    if (id == undefined) {\n        id = ++uniqueId\n        Object.defineProperty<Any, Long>(this, \"__unique_id\", jsObject { value = id })\n    }\n\n    return id\n}\n"
  },
  {
    "path": "web-app/src/main/kotlin/extras/Utils.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage extras\n\nimport react.RBuilder\nimport kotlin.reflect.KClass\n\nfun <M : Any, T : RenderableComponent<M, *>> RBuilder.renderableChild(clazz: KClass<out T>, model: M) {\n    child(clazz) {\n        key = model.uniqueId().toString()\n        attrs.component = model\n    }\n}\n"
  },
  {
    "path": "web-app/src/main/kotlin/home/HomeScreen.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage home\n\nimport com.shabinder.common.main.SpotiFlyerMain\nimport extras.Props\nimport extras.RStateWrapper\nimport extras.RenderableComponent\nimport kotlinx.browser.document\nimport kotlinx.css.*\nimport kotlinx.dom.appendElement\nimport react.RBuilder\nimport styled.css\nimport styled.styledDiv\n\nclass HomeScreen(\n    props: Props<SpotiFlyerMain>,\n) : RenderableComponent<SpotiFlyerMain, RStateWrapper<SpotiFlyerMain.State>>(\n    props,\n    initialState = RStateWrapper(props.component.model.value)\n) {\n\n    init {\n        component.model.bindToState {\n            model = it\n        }\n    }\n\n    override fun componentDidMount() {\n        super.componentDidMount()\n        // RazorPay Button\n        val form = document.getElementById(\"razorpay-form\")!!\n        repeat(form.childNodes.length){\n            form.childNodes.item(0)?.let { it1 -> form.removeChild(it1) }\n            form.childNodes.item(it)?.let { it1 -> form.removeChild(it1) }\n        }\n        form.appendElement(\"script\"){\n            this.setAttribute(\"src\",\"https://checkout.razorpay.com/v1/payment-button.js\")\n            this.setAttribute(\"async\", true.toString())\n            this.setAttribute(\"data-payment_button_id\", \"pl_GnKuuDBdBu0ank\")\n        }\n    }\n\n    override fun RBuilder.render() {\n        styledDiv{\n            css {\n                display = Display.flex\n                flexDirection = FlexDirection.column\n                flexGrow = 1.0\n                justifyContent = JustifyContent.center\n                alignItems = Align.center\n            }\n\n            Message {\n                text = \"Your Gateway to Nirvana, for FREE!\"\n            }\n\n            SearchBar {\n                link = state.model.link\n                search = component::onLinkSearch\n                onLinkChange = component::onInputLinkChanged\n            }\n\n            IconList {\n                iconsAndPlatforms = platformIconList\n                isBadge = false\n            }\n        }\n        IconList {\n            iconsAndPlatforms = badges\n            isBadge = true\n        }\n    }\n}\n\n\nprivate val platformIconList = mapOf(\n    \"spotify.svg\" to \"https://open.spotify.com/\",\n    \"gaana.svg\" to \"https://www.gaana.com/\",\n    //\"youtube.svg\" to \"https://www.youtube.com/\",\n    //\"youtube_music.svg\" to \"https://music.youtube.com/\"\n)\nprivate val badges = mapOf(\n    \"https://img.shields.io/github/v/release/Shabinder/SpotiFlyer?color=7885FF&label=SpotiFlyer&logo=android&style=for-the-badge\"\n            to \"https://github.com/Shabinder/SpotiFlyer/releases/latest/\",\n    \"https://img.shields.io/github/downloads/Shabinder/SpotiFlyer/total?style=for-the-badge&logo=android&color=17B2E7\"\n            to \"https://github.com/Shabinder/SpotiFlyer/releases/latest/\"\n)"
  },
  {
    "path": "web-app/src/main/kotlin/home/IconList.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage home\n\nimport Styles\nimport kotlinx.css.borderRadius\nimport kotlinx.css.height\nimport kotlinx.css.margin\nimport kotlinx.css.px\nimport kotlinx.css.width\nimport kotlinx.html.id\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.dom.attrs\nimport react.functionComponent\nimport styled.css\nimport styled.styledA\nimport styled.styledDiv\nimport styled.styledForm\nimport styled.styledImg\n\nexternal interface IconListProps : PropsWithChildren {\n    var iconsAndPlatforms: Map<String, String>\n    var isBadge: Boolean\n}\n\n@Suppress(\"FunctionName\")\nfun RBuilder.IconList(handler: IconListProps.() -> Unit) {\n    return child(iconList) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nprivate val iconList = functionComponent<IconListProps>(\"IconList\") { props ->\n\n    styledDiv {\n        css {\n            margin(18.px)\n            if (props.isBadge) {\n                classes.add(\"info-banners\")\n            }\n            +Styles.makeRow\n        }\n        val firstElem = props.iconsAndPlatforms.keys.elementAt(1)\n        for ((icon, platformLink) in props.iconsAndPlatforms) {\n            if (icon == firstElem && props.isBadge) {\n                //<form><script src=\"https://checkout.razorpay.com/v1/payment-button.js\" data-payment_button_id=\"pl_GnKuuDBdBu0ank\" async> </script> </form>\n                styledForm {\n                    attrs {\n                        id = \"razorpay-form\"\n                    }\n                }\n            }\n            styledA(href = platformLink, target = \"_blank\") {\n                styledImg {\n                    attrs {\n                        src = icon\n                    }\n                    css {\n                        classes.add(\"glow-button\")\n                        margin(8.px)\n                        if (!props.isBadge) {\n                            height = 42.px\n                            width = 42.px\n                            borderRadius = 50.px\n                        }\n                    }\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/home/Message.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage home\n\nimport kotlinx.css.em\nimport kotlinx.css.fontSize\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.functionComponent\nimport styled.css\nimport styled.styledDiv\nimport styled.styledH1\n\nexternal interface MessageProps : PropsWithChildren {\n    var text: String\n}\n\n@Suppress(\"FunctionName\")\nfun RBuilder.Message(handler: MessageProps.() -> Unit) {\n    return child(message) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nprivate val message = functionComponent<MessageProps>(\"Message\") { props ->\n    styledDiv {\n        styledH1 {\n            +props.text\n            css {\n                classes.add(\"headingTitle\")\n                fontSize = 2.6.em\n            }\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/home/Searchbar.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage home\n\nimport kotlinx.browser.window\nimport kotlinx.html.InputType\nimport kotlinx.html.js.onChangeFunction\nimport kotlinx.html.js.onClickFunction\nimport kotlinx.html.js.onKeyDownFunction\nimport org.w3c.dom.HTMLInputElement\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.dom.attrs\nimport react.functionComponent\nimport styled.css\nimport styled.styledButton\nimport styled.styledDiv\nimport styled.styledImg\nimport styled.styledInput\n\nexternal interface SearchbarProps : PropsWithChildren {\n    var link: String\n    var search: (String) -> Unit\n    var onLinkChange: (String) -> Unit\n}\n\n@Suppress(\"FunctionName\")\nfun RBuilder.SearchBar(handler: SearchbarProps.() -> Unit) = child(searchbar) {\n    attrs {\n        handler()\n    }\n}\n\nval searchbar = functionComponent<SearchbarProps>(\"SearchBar\") { props ->\n    styledDiv {\n        css {\n            classes.add(\"searchBox\")\n        }\n        styledInput(type = InputType.url) {\n            attrs {\n                placeholder = \"Search\"\n                onChangeFunction = {\n                    val target = it.target as HTMLInputElement\n                    props.onLinkChange(target.value)\n                }\n                this.onKeyDownFunction = {\n                    if (it.asDynamic().key == \"Enter\") {\n                        if (props.link.isEmpty()) window.alert(\"Enter a Link from Supported Platforms\")\n                        else props.search(props.link)\n                    }\n                }\n                value = props.link\n            }\n            css {\n                classes.add(\"searchInput\")\n            }\n        }\n        styledButton {\n            attrs {\n                onClickFunction = {\n                    if (props.link.isEmpty()) window.alert(\"Enter a Link from Supported Platforms\")\n                    else props.search(props.link)\n                }\n            }\n            css {\n                classes.add(\"searchButton\")\n            }\n            styledImg(src = \"search.svg\") {\n                css {\n                    classes.add(\"search-icon\")\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "web-app/src/main/kotlin/list/CircularProgressBar.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage list\n\nimport kotlinx.css.Display\nimport kotlinx.css.JustifyContent\nimport kotlinx.css.display\nimport kotlinx.css.justifyContent\nimport kotlinx.css.marginBottom\nimport kotlinx.css.px\nimport kotlinx.css.width\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.functionComponent\nimport styled.css\nimport styled.styledDiv\nimport styled.styledSpan\n\n@Suppress(\"FunctionName\")\nfun RBuilder.CircularProgressBar(handler: CircularProgressBarProps.() -> Unit) {\n    return child(circularProgressBar) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nexternal interface CircularProgressBarProps : PropsWithChildren {\n    var progress: Int\n}\n\nprivate val circularProgressBar = functionComponent<CircularProgressBarProps>(\"Circular-Progress-Bar\") { props ->\n    styledDiv {\n        styledSpan { +\"${props.progress}%\" }\n        styledDiv {\n            css {\n                classes.add(\"left-half-clipper\")\n            }\n            styledDiv { css { classes.add(\"first50-bar\") } }\n            styledDiv { css { classes.add(\"value-bar\") } }\n        }\n        css {\n            display = Display.flex\n            justifyContent = JustifyContent.center\n            classes.addAll(\n                mutableListOf(\n                    \"progress-circle\",\n                    \"p${props.progress}\"\n                ).apply { if (props.progress > 50) add(\"over50\") })\n            width = 50.px\n            marginBottom = 65.px\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/list/CoverImage.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage list\n\nimport kotlinx.css.Align\nimport kotlinx.css.Display\nimport kotlinx.css.FlexDirection\nimport kotlinx.css.TextAlign\nimport kotlinx.css.alignItems\nimport kotlinx.css.display\nimport kotlinx.css.flexDirection\nimport kotlinx.css.height\nimport kotlinx.css.marginTop\nimport kotlinx.css.px\nimport kotlinx.css.textAlign\nimport kotlinx.css.width\nimport kotlinx.html.id\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.dom.attrs\nimport react.functionComponent\nimport styled.css\nimport styled.styledDiv\nimport styled.styledH1\nimport styled.styledImg\n\nexternal interface CoverImageProps : PropsWithChildren {\n    var coverImageURL: String\n    var coverName: String\n}\n\n@Suppress(\"FunctionName\")\nfun RBuilder.CoverImage(handler: CoverImageProps.() -> Unit) {\n    return child(coverImage) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nprivate val coverImage = functionComponent<CoverImageProps>(\"CoverImage\") { props ->\n    styledDiv {\n        styledImg(src = props.coverImageURL) {\n            css {\n                height = 220.px\n                width = 220.px\n            }\n        }\n        styledH1 {\n            +props.coverName\n            css {\n                textAlign = TextAlign.center\n            }\n        }\n        attrs {\n            id = \"cover-image\"\n        }\n        css {\n            display = Display.flex\n            alignItems = Align.center\n            flexDirection = FlexDirection.column\n            marginTop = 12.px\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/list/DownloadAllButton.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage list\n\nimport kotlinx.css.Align\nimport kotlinx.css.Display\nimport kotlinx.css.JustifyContent\nimport kotlinx.css.WhiteSpace\nimport kotlinx.css.alignItems\nimport kotlinx.css.display\nimport kotlinx.css.fontSize\nimport kotlinx.css.height\nimport kotlinx.css.justifyContent\nimport kotlinx.css.px\nimport kotlinx.css.whiteSpace\nimport kotlinx.html.id\nimport kotlinx.html.js.onClickFunction\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.dom.attrs\nimport react.functionComponent\nimport react.useEffect\nimport react.useState\nimport styled.css\nimport styled.styledDiv\nimport styled.styledH5\nimport styled.styledImg\n\nexternal interface DownloadAllButtonProps : PropsWithChildren {\n    var isActive: Boolean\n    var link: String\n    var downloadAll: () -> Unit\n}\n\n@Suppress(\"FunctionName\")\nfun RBuilder.DownloadAllButton(handler: DownloadAllButtonProps.() -> Unit) {\n    return child(downloadAllButton) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nprivate val downloadAllButton = functionComponent<DownloadAllButtonProps>(\"DownloadAllButton\") { props ->\n\n    val (isClicked, setClicked) = useState(false)\n\n    useEffect(mutableListOf(props.link)) {\n        setClicked(false)\n    }\n\n    if (props.isActive) {\n        if (isClicked) {\n            styledDiv {\n                css {\n                    display = Display.flex\n                    alignItems = Align.center\n                    justifyContent = JustifyContent.center\n                    height = 52.px\n                }\n                LoadingSpinner { }\n            }\n        } else {\n            styledDiv {\n                attrs {\n                    onClickFunction = {\n                        props.downloadAll()\n                        setClicked(true)\n                    }\n                }\n                styledDiv {\n\n                    styledImg(src = \"download.svg\", alt = \"Download All Button\") {\n                        css {\n                            classes.add(\"download-all-icon\")\n                            height = 32.px\n                        }\n                    }\n\n                    styledH5 {\n                        attrs {\n                            id = \"download-all-text\"\n                        }\n                        +\"Download All\"\n                        css {\n                            whiteSpace = WhiteSpace.nowrap\n                            fontSize = 15.px\n                        }\n                    }\n\n                    css {\n                        classes.add(\"download-icon\")\n                        display = Display.flex\n                        alignItems = Align.center\n                    }\n                }\n                css {\n                    classes.add(\"download-button\")\n                    display = Display.flex\n                    alignItems = Align.center\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "web-app/src/main/kotlin/list/DownloadButton.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage list\n\nimport com.shabinder.common.models.DownloadStatus\nimport kotlinx.css.borderRadius\nimport kotlinx.css.em\nimport kotlinx.css.margin\nimport kotlinx.css.px\nimport kotlinx.css.width\nimport kotlinx.html.js.onClickFunction\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.dom.attrs\nimport react.functionComponent\nimport styled.css\nimport styled.styledDiv\nimport styled.styledImg\n\n@Suppress(\"FunctionName\")\nfun RBuilder.DownloadButton(handler: DownloadButtonProps.() -> Unit) {\n    return child(downloadButton) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nexternal interface DownloadButtonProps : PropsWithChildren {\n    var onClick: () -> Unit\n    var status: DownloadStatus\n}\n\nprivate val downloadButton = functionComponent<DownloadButtonProps>(\"Circular-Progress-Bar\") { props ->\n    styledDiv {\n        val src = when (props.status) {\n            is DownloadStatus.NotDownloaded -> \"download-gradient.svg\"\n            is DownloadStatus.Downloaded -> \"check.svg\"\n            is DownloadStatus.Failed -> \"error.svg\"\n            else -> \"\"\n        }\n        styledImg(src = src) {\n            attrs {\n                onClickFunction = {\n                    props.onClick()\n                }\n            }\n            css {\n                width = (2.5).em\n                margin(8.px)\n            }\n        }\n        css {\n            classes.add(\"glow-button\")\n            borderRadius = 100.px\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/list/ListScreen.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage list\n\nimport com.shabinder.common.list.SpotiFlyerList\nimport com.shabinder.common.list.SpotiFlyerList.State\nimport extras.Props\nimport extras.RStateWrapper\nimport extras.RenderableComponent\nimport kotlinx.css.*\nimport kotlinx.html.id\nimport react.RBuilder\nimport react.dom.attrs\nimport styled.css\nimport styled.styledDiv\nimport styled.styledSection\n\n\nclass ListScreen(\n    props: Props<SpotiFlyerList>,\n) : RenderableComponent<SpotiFlyerList, RStateWrapper<State>>(\n    props,\n    initialState = RStateWrapper(props.component.model.value)\n) {\n    init {\n        component.model.bindToState {\n            model = it\n        }\n    }\n\n    override fun RBuilder.render() {\n\n        val queryResult = state.model.queryResult\n\n        styledSection {\n            attrs {\n                id = \"list-screen\"\n            }\n\n            if(queryResult == null) {\n                LoadingAnim {  }\n            }else {\n                CoverImage {\n                    coverImageURL = queryResult.coverUrl\n                    coverName = queryResult.title\n                }\n\n                DownloadAllButton {\n                    isActive = state.model.trackList.size > 1\n                    downloadAll = {\n                        component.onDownloadAllClicked(state.model.trackList)\n                    }\n                    link = state.model.link\n                }\n\n                styledDiv {\n                    css {\n                        display =Display.flex\n                        flexGrow = 1.0\n                        flexDirection = FlexDirection.column\n                        color = Color.white\n                    }\n                    state.model.trackList.forEachIndexed{ _, trackDetails ->\n                        TrackItem {\n                            details = trackDetails\n                            downloadTrack = component::onDownloadClicked\n                        }\n                    }\n                }\n            }\n\n            css {\n                classes.add(\"list-screen\")\n                display = Display.flex\n                padding(8.px)\n                flexDirection = FlexDirection.column\n                flexGrow = 1.0\n            }\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/list/LoadingAnim.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage list\n\nimport kotlinx.css.Align\nimport kotlinx.css.Display\nimport kotlinx.css.alignItems\nimport kotlinx.css.display\nimport kotlinx.css.flexGrow\nimport kotlinx.css.height\nimport kotlinx.css.px\nimport kotlinx.css.width\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.functionComponent\nimport styled.css\nimport styled.styledDiv\n\n@Suppress(\"FunctionName\")\nfun RBuilder.LoadingAnim(handler: PropsWithChildren.() -> Unit) {\n    return child(loadingAnim) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nprivate val loadingAnim = functionComponent<PropsWithChildren>(\"Loading Animation\") {\n    styledDiv {\n        css {\n            flexGrow = 1.0\n            display = Display.flex\n            alignItems = Align.center\n        }\n        styledDiv {\n            styledDiv { css { classes.add(\"sk-cube sk-cube1\") } }\n            styledDiv { css { classes.add(\"sk-cube sk-cube2\") } }\n            styledDiv { css { classes.add(\"sk-cube sk-cube3\") } }\n            styledDiv { css { classes.add(\"sk-cube sk-cube4\") } }\n            styledDiv { css { classes.add(\"sk-cube sk-cube5\") } }\n            styledDiv { css { classes.add(\"sk-cube sk-cube6\") } }\n            styledDiv { css { classes.add(\"sk-cube sk-cube7\") } }\n            styledDiv { css { classes.add(\"sk-cube sk-cube8\") } }\n            styledDiv { css { classes.add(\"sk-cube sk-cube9\") } }\n\n            css {\n                classes.add(\"sk-cube-grid\")\n                height = 60.px\n                width = 60.px\n            }\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/list/LoadingSpinner.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage list\n\nimport kotlinx.css.marginRight\nimport kotlinx.css.px\nimport kotlinx.css.width\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.functionComponent\nimport styled.css\nimport styled.styledDiv\n\n@Suppress(\"FunctionName\")\nfun RBuilder.LoadingSpinner(handler: PropsWithChildren.() -> Unit) {\n    return child(loadingSpinner) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nprivate val loadingSpinner = functionComponent<PropsWithChildren>(\"Loading-Spinner\") {\n    styledDiv {\n        styledDiv {}\n        styledDiv {}\n        styledDiv {}\n        styledDiv {}\n        css {\n            classes.add(\"lds-ring\")\n            width = 50.px\n            marginRight = 8.px\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/list/TrackItem.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage list\n\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.TrackDetails\nimport kotlinx.css.Align\nimport kotlinx.css.Display\nimport kotlinx.css.FlexDirection\nimport kotlinx.css.Overflow\nimport kotlinx.css.TextAlign\nimport kotlinx.css.TextOverflow\nimport kotlinx.css.WhiteSpace\nimport kotlinx.css.alignItems\nimport kotlinx.css.display\nimport kotlinx.css.em\nimport kotlinx.css.flexDirection\nimport kotlinx.css.flexGrow\nimport kotlinx.css.fontSize\nimport kotlinx.css.height\nimport kotlinx.css.margin\nimport kotlinx.css.minWidth\nimport kotlinx.css.overflow\nimport kotlinx.css.padding\nimport kotlinx.css.paddingRight\nimport kotlinx.css.px\nimport kotlinx.css.textAlign\nimport kotlinx.css.textOverflow\nimport kotlinx.css.whiteSpace\nimport kotlinx.css.width\nimport kotlinx.html.id\nimport react.PropsWithChildren\nimport react.RBuilder\nimport react.dom.attrs\nimport react.functionComponent\nimport react.useEffect\nimport react.useState\nimport styled.css\nimport styled.styledDiv\nimport styled.styledH3\nimport styled.styledH4\nimport styled.styledImg\n\nexternal interface TrackItemProps : PropsWithChildren {\n    var details: TrackDetails\n    var downloadTrack: (TrackDetails) -> Unit\n}\n\n@Suppress(\"FunctionName\")\nfun RBuilder.TrackItem(handler: TrackItemProps.() -> Unit) {\n    return child(trackItem) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nprivate val trackItem = functionComponent<TrackItemProps>(\"Track-Item\") { props ->\n    val (downloadStatus, setDownloadStatus) = useState(props.details.downloaded)\n    val details = props.details\n    useEffect(listOf(props.details)) {\n        setDownloadStatus(props.details.downloaded)\n    }\n    styledDiv {\n        styledImg(src = details.albumArtURL) {\n            css {\n                height = 90.px\n                width = 90.px\n            }\n        }\n\n        styledDiv {\n            attrs {\n                id = \"text-details\"\n            }\n            css {\n                flexGrow = 1.0\n                minWidth = 0.px\n                display = Display.flex\n                flexDirection = FlexDirection.column\n                margin(8.px)\n            }\n            styledDiv {\n                css {\n                    height = 40.px\n                    alignItems = Align.center\n                    display = Display.flex\n                }\n                styledH3 {\n                    +details.title\n                    css {\n                        padding(8.px)\n                        fontSize = 1.3.em\n                        textOverflow = TextOverflow.ellipsis\n                        whiteSpace = WhiteSpace.nowrap\n                        overflow = Overflow.hidden\n                    }\n                }\n            }\n            styledDiv {\n                css {\n                    height = 40.px\n                    alignItems = Align.center\n                    display = Display.flex\n                }\n                styledH4 {\n                    +details.artists.joinToString(\",\")\n                    css {\n                        flexGrow = 1.0\n                        padding(8.px)\n                        minWidth = 4.em\n                        fontSize = 1.1.em\n                        textOverflow = TextOverflow.ellipsis\n                        whiteSpace = WhiteSpace.nowrap\n                        overflow = Overflow.hidden\n                    }\n                }\n                styledH4 {\n                    css {\n                        textAlign = TextAlign.end\n                        flexGrow = 1.0\n                        padding(8.px)\n                        minWidth = 4.em\n                        fontSize = 1.1.em\n                        textOverflow = TextOverflow.ellipsis\n                        whiteSpace = WhiteSpace.nowrap\n                        overflow = Overflow.hidden\n                    }\n                    +\"${details.durationSec / 60} min, ${details.durationSec % 60} sec\"\n                }\n            }\n        }\n        when (downloadStatus) {\n            is DownloadStatus.NotDownloaded -> {\n                DownloadButton {\n                    onClick = {\n                        setDownloadStatus(DownloadStatus.Queued)\n                        props.downloadTrack(details)\n                    }\n                    status = downloadStatus\n                }\n            }\n            //TODO Fix Progress Indicator\n            /*is DownloadStatus.Downloading -> {\n                CircularProgressBar {\n                    progress = downloadStatus.progress\n                }\n            }\n            is DownloadStatus.Converting -> {\n                LoadingSpinner {}\n            }\n            is DownloadStatus.Queued -> {\n                LoadingSpinner {}\n            }*/\n            is DownloadStatus.Downloaded -> {\n                DownloadButton {\n                    onClick = {}\n                    status = downloadStatus\n                }\n            }\n            is DownloadStatus.Failed -> {\n                DownloadButton {\n                    onClick = {}\n                    status = downloadStatus\n                }\n            }\n            else -> LoadingSpinner { }\n        }\n\n        css {\n            alignItems = Align.center\n            display = Display.flex\n            paddingRight = 16.px\n        }\n    }\n}\n"
  },
  {
    "path": "web-app/src/main/kotlin/navbar/NavBar.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage navbar\n\nimport kotlinx.css.Align\nimport kotlinx.css.Display\nimport kotlinx.css.LinearDimension\nimport kotlinx.css.alignItems\nimport kotlinx.css.display\nimport kotlinx.css.filter\nimport kotlinx.css.fontSize\nimport kotlinx.css.height\nimport kotlinx.css.margin\nimport kotlinx.css.marginLeft\nimport kotlinx.css.marginRight\nimport kotlinx.css.px\nimport kotlinx.css.width\nimport kotlinx.html.id\nimport kotlinx.html.js.onBlurFunction\nimport kotlinx.html.js.onClickFunction\nimport react.RBuilder\nimport react.RProps\nimport react.dom.attrs\nimport react.functionComponent\nimport styled.css\nimport styled.styledA\nimport styled.styledDiv\nimport styled.styledH1\nimport styled.styledImg\nimport styled.styledNav\n\n@Suppress(\"FunctionName\")\nfun RBuilder.NavBar(handler: NavBarProps.() -> Unit) {\n    return child(navBar) {\n        attrs {\n            handler()\n        }\n    }\n}\n\nexternal interface NavBarProps : RProps {\n    var isBackVisible: Boolean\n    var popBackToHomeScreen: () -> Unit\n}\n\n\nprivate val navBar = functionComponent<NavBarProps>(\"NavBar\") { props ->\n\n    styledNav {\n        css {\n            +NavBarStyles.nav\n        }\n        styledDiv {\n            attrs {\n                onClickFunction = {\n                    props.popBackToHomeScreen()\n                }\n                onBlurFunction = {\n                    props.popBackToHomeScreen()\n                }\n            }\n            styledImg(src = \"left-arrow.svg\", alt = \"Back Arrow\") {\n                css {\n                    height = 42.px\n                    width = 42.px\n                    display = if (props.isBackVisible) Display.inline else Display.none\n                    filter = \"invert(100)\"\n                    marginRight = 12.px\n                }\n            }\n        }\n        styledA(href = \"https://shabinder.github.io/SpotiFlyer/\", target = \"_blank\") {\n            css {\n                display = Display.flex\n                alignItems = Align.center\n            }\n            styledImg(src = \"spotiflyer.svg\", alt = \"Logo\") {\n                css {\n                    height = 42.px\n                    width = 42.px\n                }\n            }\n            styledH1 {\n                +\"SpotiFlyer\"\n                attrs {\n                    id = \"appName\"\n                }\n                css {\n                    fontSize = 46.px\n                    margin(horizontal = 14.px)\n                }\n            }\n        }\n\n        /*val (corsMode,setCorsMode) = useState(CorsProxy.SelfHostedCorsProxy() as CorsProxy)\n\n        useEffect {\n            setCorsMode(corsProxy)\n        }*/\n\n        styledDiv {\n\n            /*styledH4 { + \"Extension\" }\n\n            styledDiv {\n                styledInput(type = InputType.checkBox) {\n                    attrs{\n                        id = \"cmn-toggle-4\"\n                        value = \"Extension\"\n                        checked = corsMode.extensionMode()\n                        onChangeFunction = {\n                            val state = it.target as HTMLInputElement\n                            if(state.checked){\n                                setCorsMode(corsProxy.toggle(CorsProxy.PublicProxyWithExtension()))\n                            } else{\n                                setCorsMode(corsProxy.toggle(CorsProxy.SelfHostedCorsProxy()))\n                            }\n                            println(\"Active Proxy:  ${corsProxy.url}\")\n                        }\n                    }\n                    css{\n                        classes = mutableListOf(\"cmn-toggle\",\"cmn-toggle-round-flat\")\n                    }\n                }\n                styledLabel { attrs { htmlFor = \"cmn-toggle-4\" } }\n                css{\n                    classes = mutableListOf(\"switch\")\n                    marginLeft = 8.px\n                    marginRight = 16.px\n                }\n            }*/\n\n            styledA(href = \"https://github.com/Shabinder/SpotiFlyer/\") {\n                styledImg(src = \"github.svg\") {\n                    css {\n                        height = 42.px\n                        width = 42.px\n                    }\n                }\n            }\n            css {\n                display = Display.flex\n                alignItems = Align.center\n                marginLeft = LinearDimension.auto\n            }\n        }\n    }\n}"
  },
  {
    "path": "web-app/src/main/kotlin/navbar/NavBarStyles.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage navbar\n\nimport kotlinx.css.*\nimport styled.StyleSheet\n\nobject NavBarStyles : StyleSheet(\"WelcomeStyles\", isStatic = true) {\n    val nav by css{\n        padding(horizontal = 16.px)\n        marginTop = 10.px\n        backgroundColor = Color.transparent\n        height = 56.px\n        display = Display.flex\n        flexDirection = FlexDirection.row\n        alignItems = Align.center\n        alignSelf = Align.stretch\n    }\n} \n"
  },
  {
    "path": "web-app/src/main/kotlin/root/RootR.kt",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\npackage root\n\nimport com.arkivanov.decompose.RouterState\nimport com.shabinder.common.root.SpotiFlyerRoot\nimport com.shabinder.common.root.SpotiFlyerRoot.Child\nimport extras.Props\nimport extras.RenderableComponent\nimport extras.renderableChild\nimport home.HomeScreen\nimport list.ListScreen\nimport navbar.NavBar\nimport react.RBuilder\n\nclass RootR(props: Props<SpotiFlyerRoot>) : RenderableComponent<SpotiFlyerRoot, State>(\n    props = props,\n    initialState = State(routerState = props.component.routerState.value)\n) {\n    private val child: Child\n        get() = component.routerState.value.activeChild.instance\n\n    private val callBacks get() = component.callBacks\n\n    init {\n        component.routerState.bindToState { routerState = it }\n    }\n\n    override fun RBuilder.render() {\n        NavBar {\n            isBackVisible = (child is Child.List)\n            popBackToHomeScreen = callBacks::popBackToHomeScreen\n        }\n        when(child){\n            is Child.Main -> renderableChild(HomeScreen::class, (child as Child.Main).component)\n            is Child.List -> renderableChild(ListScreen::class, (child as Child.List).component)\n        }\n    }\n}\n\n@Suppress(\"NON_EXPORTABLE_TYPE\", \"EXPERIMENTAL_IS_NOT_ENABLED\")\n@OptIn(ExperimentalJsExport::class)\n@JsExport\nclass State(\n    var routerState: RouterState<*, Child>\n) : react.State\n"
  },
  {
    "path": "web-app/src/main/resources/css-circular-prog-bar.css",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n.progress-circle {\n   margin: 20px;\n}\n\n.progress-circle:after{\n    border: none;\n    position: absolute;\n    text-align: center;\n    display: block;\n    border-radius: 50%;\n    width: 4.3em;\n    height: 4.3em;\n    background-color: white;\n    content: \" \";\n    margin-top: 0.35em;\n}\n/* Text inside the control */\n.progress-circle span {\n    position: absolute;\n    line-height: 5em;\n    width: 5em;\n    text-align: center;\n    display: block;\n    color: #53777A;\n    z-index: 2;\n}\n.left-half-clipper { \n   /* a round circle */\n   border-radius: 50%;\n   width: 5em;\n   height: 5em;\n   position: absolute; /* needed for clipping */\n   clip: rect(0, 5em, 5em, 2.5em); /* clips the whole left half*/ \n}\n/* when p>50, don't clip left half*/\n.progress-circle.over50 .left-half-clipper {\n   clip: rect(auto,auto,auto,auto);\n}\n.value-bar {\n   /*This is an overlayed square, that is made round with the border radius,\n   then it is cut to display only the left half, then rotated clockwise\n   to escape the outer clipping path.*/ \n   position: absolute; /*needed for clipping*/\n   clip: rect(0, 2.5em, 5em, 0);\n   width: 5em;\n   height: 5em;\n   border-radius: 50%;\n   border: 0.45em solid #53777A; /*The border is 0.35 but making it larger removes visual artifacts */\n   /*background-color: #4D642D;*/ /* for debug */\n   box-sizing: border-box;\n  \n}\n/* Progress bar filling the whole right half for values above 50% */\n.progress-circle.over50 .first50-bar {\n   /*Progress bar for the first 50%, filling the whole right half*/\n   position: absolute; /*needed for clipping*/\n   clip: rect(0, 5em, 5em, 2.5em);\n   background-color: #53777A;\n   border-radius: 50%;\n   width: 5em;\n   height: 5em;\n}\n.progress-circle:not(.over50) .first50-bar{ display: none; }\n\n\n/* Progress bar rotation position */\n.progress-circle.p0 .value-bar { display: none; }\n.progress-circle.p1 .value-bar { transform: rotate(4deg); }\n.progress-circle.p2 .value-bar { transform: rotate(7deg); }\n.progress-circle.p3 .value-bar { transform: rotate(11deg); }\n.progress-circle.p4 .value-bar { transform: rotate(14deg); }\n.progress-circle.p5 .value-bar { transform: rotate(18deg); }\n.progress-circle.p6 .value-bar { transform: rotate(22deg); }\n.progress-circle.p7 .value-bar { transform: rotate(25deg); }\n.progress-circle.p8 .value-bar { transform: rotate(29deg); }\n.progress-circle.p9 .value-bar { transform: rotate(32deg); }\n.progress-circle.p10 .value-bar { transform: rotate(36deg); }\n.progress-circle.p11 .value-bar { transform: rotate(40deg); }\n.progress-circle.p12 .value-bar { transform: rotate(43deg); }\n.progress-circle.p13 .value-bar { transform: rotate(47deg); }\n.progress-circle.p14 .value-bar { transform: rotate(50deg); }\n.progress-circle.p15 .value-bar { transform: rotate(54deg); }\n.progress-circle.p16 .value-bar { transform: rotate(58deg); }\n.progress-circle.p17 .value-bar { transform: rotate(61deg); }\n.progress-circle.p18 .value-bar { transform: rotate(65deg); }\n.progress-circle.p19 .value-bar { transform: rotate(68deg); }\n.progress-circle.p20 .value-bar { transform: rotate(72deg); }\n.progress-circle.p21 .value-bar { transform: rotate(76deg); }\n.progress-circle.p22 .value-bar { transform: rotate(79deg); }\n.progress-circle.p23 .value-bar { transform: rotate(83deg); }\n.progress-circle.p24 .value-bar { transform: rotate(86deg); }\n.progress-circle.p25 .value-bar { transform: rotate(90deg); }\n.progress-circle.p26 .value-bar { transform: rotate(94deg); }\n.progress-circle.p27 .value-bar { transform: rotate(97deg); }\n.progress-circle.p28 .value-bar { transform: rotate(101deg); }\n.progress-circle.p29 .value-bar { transform: rotate(104deg); }\n.progress-circle.p30 .value-bar { transform: rotate(108deg); }\n.progress-circle.p31 .value-bar { transform: rotate(112deg); }\n.progress-circle.p32 .value-bar { transform: rotate(115deg); }\n.progress-circle.p33 .value-bar { transform: rotate(119deg); }\n.progress-circle.p34 .value-bar { transform: rotate(122deg); }\n.progress-circle.p35 .value-bar { transform: rotate(126deg); }\n.progress-circle.p36 .value-bar { transform: rotate(130deg); }\n.progress-circle.p37 .value-bar { transform: rotate(133deg); }\n.progress-circle.p38 .value-bar { transform: rotate(137deg); }\n.progress-circle.p39 .value-bar { transform: rotate(140deg); }\n.progress-circle.p40 .value-bar { transform: rotate(144deg); }\n.progress-circle.p41 .value-bar { transform: rotate(148deg); }\n.progress-circle.p42 .value-bar { transform: rotate(151deg); }\n.progress-circle.p43 .value-bar { transform: rotate(155deg); }\n.progress-circle.p44 .value-bar { transform: rotate(158deg); }\n.progress-circle.p45 .value-bar { transform: rotate(162deg); }\n.progress-circle.p46 .value-bar { transform: rotate(166deg); }\n.progress-circle.p47 .value-bar { transform: rotate(169deg); }\n.progress-circle.p48 .value-bar { transform: rotate(173deg); }\n.progress-circle.p49 .value-bar { transform: rotate(176deg); }\n.progress-circle.p50 .value-bar { transform: rotate(180deg); }\n.progress-circle.p51 .value-bar { transform: rotate(184deg); }\n.progress-circle.p52 .value-bar { transform: rotate(187deg); }\n.progress-circle.p53 .value-bar { transform: rotate(191deg); }\n.progress-circle.p54 .value-bar { transform: rotate(194deg); }\n.progress-circle.p55 .value-bar { transform: rotate(198deg); }\n.progress-circle.p56 .value-bar { transform: rotate(202deg); }\n.progress-circle.p57 .value-bar { transform: rotate(205deg); }\n.progress-circle.p58 .value-bar { transform: rotate(209deg); }\n.progress-circle.p59 .value-bar { transform: rotate(212deg); }\n.progress-circle.p60 .value-bar { transform: rotate(216deg); }\n.progress-circle.p61 .value-bar { transform: rotate(220deg); }\n.progress-circle.p62 .value-bar { transform: rotate(223deg); }\n.progress-circle.p63 .value-bar { transform: rotate(227deg); }\n.progress-circle.p64 .value-bar { transform: rotate(230deg); }\n.progress-circle.p65 .value-bar { transform: rotate(234deg); }\n.progress-circle.p66 .value-bar { transform: rotate(238deg); }\n.progress-circle.p67 .value-bar { transform: rotate(241deg); }\n.progress-circle.p68 .value-bar { transform: rotate(245deg); }\n.progress-circle.p69 .value-bar { transform: rotate(248deg); }\n.progress-circle.p70 .value-bar { transform: rotate(252deg); }\n.progress-circle.p71 .value-bar { transform: rotate(256deg); }\n.progress-circle.p72 .value-bar { transform: rotate(259deg); }\n.progress-circle.p73 .value-bar { transform: rotate(263deg); }\n.progress-circle.p74 .value-bar { transform: rotate(266deg); }\n.progress-circle.p75 .value-bar { transform: rotate(270deg); }\n.progress-circle.p76 .value-bar { transform: rotate(274deg); }\n.progress-circle.p77 .value-bar { transform: rotate(277deg); }\n.progress-circle.p78 .value-bar { transform: rotate(281deg); }\n.progress-circle.p79 .value-bar { transform: rotate(284deg); }\n.progress-circle.p80 .value-bar { transform: rotate(288deg); }\n.progress-circle.p81 .value-bar { transform: rotate(292deg); }\n.progress-circle.p82 .value-bar { transform: rotate(295deg); }\n.progress-circle.p83 .value-bar { transform: rotate(299deg); }\n.progress-circle.p84 .value-bar { transform: rotate(302deg); }\n.progress-circle.p85 .value-bar { transform: rotate(306deg); }\n.progress-circle.p86 .value-bar { transform: rotate(310deg); }\n.progress-circle.p87 .value-bar { transform: rotate(313deg); }\n.progress-circle.p88 .value-bar { transform: rotate(317deg); }\n.progress-circle.p89 .value-bar { transform: rotate(320deg); }\n.progress-circle.p90 .value-bar { transform: rotate(324deg); }\n.progress-circle.p91 .value-bar { transform: rotate(328deg); }\n.progress-circle.p92 .value-bar { transform: rotate(331deg); }\n.progress-circle.p93 .value-bar { transform: rotate(335deg); }\n.progress-circle.p94 .value-bar { transform: rotate(338deg); }\n.progress-circle.p95 .value-bar { transform: rotate(342deg); }\n.progress-circle.p96 .value-bar { transform: rotate(346deg); }\n.progress-circle.p97 .value-bar { transform: rotate(349deg); }\n.progress-circle.p98 .value-bar { transform: rotate(353deg); }\n.progress-circle.p99 .value-bar { transform: rotate(356deg); }\n.progress-circle.p100 .value-bar { transform: rotate(360deg); }"
  },
  {
    "path": "web-app/src/main/resources/index.html",
    "content": "<!--\n  ~  * Copyright (c)  2021  Shabinder Singh\n  ~  * This program is free software: you can redistribute it and/or modify\n  ~  * it under the terms of the GNU General Public License as published by\n  ~  * the Free Software Foundation, either version 3 of the License, or\n  ~  * (at your option) any later version.\n  ~  *\n  ~  * This program is distributed in the hope that it will be useful,\n  ~  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n  ~  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n  ~  * GNU General Public License for more details.\n  ~  *\n  ~  *  You should have received a copy of the GNU General Public License\n  ~  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n  -->\n\n<!DOCTYPE html>\n<html lang=\"en\" class=\"has-navbar-fixed-top\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <title>SpotiFlyer</title>\n    <script src=\"web-app.js\"></script>\n    <link rel=\"icon\" href=\"spotiflyer.svg\" type=\"image/icon type\">\n    <link rel=\"stylesheet\" href=\"styles.css\">\n    <link href=\"css-circular-prog-bar.css\" rel=\"stylesheet\">\n    <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\">\n    <link href=\"https://fonts.googleapis.com/css2?family=RocknRoll+One&display=swap\" rel=\"stylesheet\">\n    <!-- Global site tag (gtag.js) - Google Analytics -->\n    <script async src=\"https://www.googletagmanager.com/gtag/js?id=G-PGSYNZHSS7\"></script>\n    <script>\n        window.dataLayer = window.dataLayer || [];\n        function gtag(){dataLayer.push(arguments);}\n        gtag('js', new Date());\n\n        gtag('config', 'G-PGSYNZHSS7');\n    </script>\n</head>\n<body>\n<div style=\"display: flex;flex-direction: column; height: inherit; color: white;\" id=\"root\"></div>\n</body>\n</html>\n"
  },
  {
    "path": "web-app/src/main/resources/styles.css",
    "content": "/*\n *  * Copyright (c)  2021  Shabinder Singh\n *  * This program is free software: you can redistribute it and/or modify\n *  * it under the terms of the GNU General Public License as published by\n *  * the Free Software Foundation, either version 3 of the License, or\n *  * (at your option) any later version.\n *  *\n *  * This program is distributed in the hope that it will be useful,\n *  * but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  * GNU General Public License for more details.\n *  *\n *  *  You should have received a copy of the GNU General Public License\n *  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n@font-face {\n    font-family: pristine;\n    src: url(\"pristine_script.ttf\");\n}\n\nhtml {\n    background-image: url(\"header-dark.jpg\");\n    font-family: Lora,Helvetica Neue,Helvetica,Arial,sans-serif;\n}\na:link, a:visited {\n    color: white;\n    text-decoration: none;\n}\nbody, html {\n    width: 100%;\n    height: 100%;\n    margin: 0;\n    background-repeat: no-repeat;\n    background-size: 100% 100%;\n    background-attachment: fixed;\n    position: relative;\n    color: #fff;\n    caret-color: crimson;\n    /*background-image: linear-gradient(180deg,rgba(221,0,221,0.50),rgba(221,0,221,0.32),rgba(221,0,221,0.16),rgba(221,0,221,0.08),rgba(221,0,221,0.04),rgba(0,0,0,0));*/\n}\n#appName{\n    font-family: pristine, cursive;\n    font-weight: 100;\n    text-shadow: 0.3px 0.5px #ffffff;\n}\n\n.headingTitle{\n    text-align: center;\n    margin: 10px;\n    font-family: 'RocknRoll One', sans-serif;\n}\n.glow-button, .PaymentButton  {\n    transition: all .2s ease-in-out;\n}\n.glow-button:hover, .PaymentButton:hover {\n    color: rgba(255, 255, 255, 1);\n    box-shadow: 0 5px 15px rgb(105, 44, 143);\n    transform: scale(1.1);\n}\n\n/*Loading Spinner*/\n.lds-ring {\n    align-items: center;\n    justify-content: center;\n    display: flex;\n}\n.lds-ring div {\n    box-sizing: border-box;\n    display: block;\n    position: absolute;\n    width: 3.5em;\n    height: 3.5em;\n    border: 8px solid #fff;\n    border-radius: 50%;\n    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n    border-color: #fff transparent transparent transparent;\n}\n.lds-ring div:nth-child(1) {\n    animation-delay: -0.45s;\n}\n.lds-ring div:nth-child(2) {\n    animation-delay: -0.3s;\n}\n.lds-ring div:nth-child(3) {\n    animation-delay: -0.15s;\n}\n@keyframes lds-ring {\n    0% {\n        transform: rotate(0deg);\n    }\n    100% {\n        transform: rotate(360deg);\n    }\n}\n\n.button {\n    text-decoration: none;\n    color: rgba(255, 255, 255, 0.8);\n    //background: rgb(145, 92, 182);\n    padding: 15px 40px;\n    border-radius: 4px;\n    font-weight: normal;\n    text-transform: uppercase;\n    transition: all 0.2s ease-in-out;\n}\n.searchBox {;\n    background: #2f3640;\n    height: 42px;\n    border-radius: 40px;\n    padding: 10px;\n    align-self: center;\n    margin: 24px;\n}\n\n.searchBox:hover > .searchInput {\n    width: 35vw;\n    padding: 0 6px;\n}\n\n.searchBox:hover .search-icon {\n    filter: none;\n}\n\n.searchBox:hover > .searchButton {\n    background: white;\n    color : #2f3640;\n}\n\n.search-icon {\n    filter: invert(100%);\n}\n\n.searchButton {\n    color: white;\n    float: right;\n    width: 40px;\n    height: 40px;\n    border-radius: 50%;\n    background: #2f3640;\n    display: flex;\n    outline: none;\n    justify-content: center;\n    align-items: center;\n    transition: 0.4s;\n}\n.searchInput {\n    border:none;\n    background: none;\n    outline:none;\n    float:left;\n    padding: 0;\n    color: white;\n    font-size: 16px;\n    transition: 0.4s;\n    line-height: 40px;\n    width: 0px;\n}\n\n/*Download All Button*/\n#download-all-text {\n    color: black;\n    display: none;\n}\n.download-button {\n    font-size: 1.5rem;\n    border: 2px solid white;\n    border-radius: 100px;\n    width: 40px;\n    height: 40px;\n    padding: 5px;\n    margin: 12px auto;\n    transition: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);\n    justify-content: center;\n}\n\n.download-button:hover {\n    width: 150px;\n    background-color: white;\n    box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.2);\n    color: black;\n    transition: 0.3s;\n    justify-content: flex-start;\n}\n\n.download-button:hover #download-all-text {\n    display: inline;\n    color: black;\n}\n\n.download-button:hover .download-all-icon {\n    filter: none;\n    margin-right: 8px;\n}\n.download-button:not(hover) .download-all-icon {\n    filter: invert(100);\n}\n\n.sk-cube-grid {\n    width: 40px;\n    height: 40px;\n    margin: 100px auto;\n}\n\n.sk-cube-grid .sk-cube {\n    width: 33%;\n    height: 33%;\n    background-color: rgb(240, 90, 220);\n    float: left;\n    -webkit-animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out;\n    animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out;\n}\n.sk-cube-grid .sk-cube1 {\n    -webkit-animation-delay: 0.2s;\n    animation-delay: 0.2s; }\n.sk-cube-grid .sk-cube2 {\n    -webkit-animation-delay: 0.3s;\n    animation-delay: 0.3s; }\n.sk-cube-grid .sk-cube3 {\n    -webkit-animation-delay: 0.4s;\n    animation-delay: 0.4s; }\n.sk-cube-grid .sk-cube4 {\n    -webkit-animation-delay: 0.1s;\n    animation-delay: 0.1s; }\n.sk-cube-grid .sk-cube5 {\n    -webkit-animation-delay: 0.2s;\n    animation-delay: 0.2s; }\n.sk-cube-grid .sk-cube6 {\n    -webkit-animation-delay: 0.3s;\n    animation-delay: 0.3s; }\n.sk-cube-grid .sk-cube7 {\n    -webkit-animation-delay: 0s;\n    animation-delay: 0s; }\n.sk-cube-grid .sk-cube8 {\n    -webkit-animation-delay: 0.1s;\n    animation-delay: 0.1s; }\n.sk-cube-grid .sk-cube9 {\n    -webkit-animation-delay: 0.2s;\n    animation-delay: 0.2s; }\n\n@-webkit-keyframes sk-cubeGridScaleDelay {\n    0%, 70%, 100% {\n        -webkit-transform: scale3D(1, 1, 1);\n        transform: scale3D(1, 1, 1);\n    } 35% {\n          -webkit-transform: scale3D(0, 0, 1);\n          transform: scale3D(0, 0, 1);\n      }\n}\n\n@keyframes sk-cubeGridScaleDelay {\n    0%, 70%, 100% {\n        -webkit-transform: scale3D(1, 1, 1);\n        transform: scale3D(1, 1, 1);\n    } 35% {\n          -webkit-transform: scale3D(0, 0, 1);\n          transform: scale3D(0, 0, 1);\n      }\n}\n\n/*Extension Switch*/\n.cmn-toggle {\n    position: absolute;\n    margin-left: -9999px;\n    visibility: hidden;\n}\n\n.cmn-toggle + label {\n    display: block;\n    position: relative;\n    cursor: pointer;\n    outline: none;\n    user-select: none;\n}\n\ninput.cmn-toggle-round-flat + label {\n    /* width = 2*height or 2*border-radius */\n    padding: 2px;\n    width: 40px;\n    height: 20px;\n    border: 3px solid #dddddd;\n    border-radius: 60px;\n    transition: border-color 0.3s;\n}\n\ninput.cmn-toggle-round-flat + label:before,\ninput.cmn-toggle-round-flat + label:after {\n    display: block;\n    position: absolute;\n    content: \"\";\n}\n\ninput.cmn-toggle-round-flat + label:after {\n    /* width = 2*border-radius */\n    top: 4px;\n    left: 4px;\n    bottom: 4px;\n    width: 16px;\n    background-color: #dddddd;\n    border-radius: 52px;\n    transition: margin 0.3s, background 0.3s;\n}\n\ninput.cmn-toggle-round-flat:checked + label {\n    border-color: #8ce196;\n}\n\ninput.cmn-toggle-round-flat:checked + label:after {\n    /* margin-left = border-radius from 'input.cmn-toggle-round-flat + label' */\n    margin-left: 20px;\n    background-color: #8ce196;\n}\n@media screen and (max-width: 600px) {\n    /* CSS HERE ONLY ON PHONE */\n    .info-banners {\n        flex-direction: column;\n    }\n    .searchBox:hover > .searchInput {\n        width: 60vw;\n        padding: 0 6px;\n    }\n    .searchInput {\n        width: 55vw;\n        padding: 0 6px;\n    }\n    .search-icon {\n        filter: none;\n    }\n    .searchButton {\n        background: white;\n        color : #2f3640;\n    }\n}\n"
  }
]