Repository: OhMyGuus/BetterCrewlink-mobile Branch: master Commit: b413a906c42e Files: 131 Total size: 233.9 KB Directory structure: gitextract_kajwd_tq/ ├── .github/ │ ├── FUNDING.yml │ └── ISSUE_TEMPLATE/ │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md ├── .gitignore ├── .httaccess ├── .prettierignore ├── .prettierrc.yaml ├── LICENSE ├── README.md ├── TODO.md ├── android/ │ ├── .gitignore │ ├── app/ │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── capacitor.build.gradle │ │ ├── proguard-rules.pro │ │ └── src/ │ │ ├── androidTest/ │ │ │ └── java/ │ │ │ └── com/ │ │ │ └── getcapacitor/ │ │ │ └── myapp/ │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main/ │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets/ │ │ │ │ ├── capacitor.config.json │ │ │ │ └── capacitor.plugins.json │ │ │ ├── java/ │ │ │ │ └── io/ │ │ │ │ └── bettercrewlink/ │ │ │ │ └── app/ │ │ │ │ └── MainActivity.java │ │ │ └── res/ │ │ │ ├── drawable/ │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── drawable-v24/ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── layout/ │ │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26/ │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── values/ │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ └── xml/ │ │ │ ├── config.xml │ │ │ └── file_paths.xml │ │ └── test/ │ │ └── java/ │ │ └── com/ │ │ └── getcapacitor/ │ │ └── myapp/ │ │ └── ExampleUnitTest.java │ ├── build.gradle │ ├── capacitor.settings.gradle │ ├── gradle/ │ │ └── wrapper/ │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── variables.gradle ├── angular.json ├── browserslist ├── capacitor.config.json ├── e2e/ │ ├── protractor.conf.js │ ├── src/ │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.json ├── ionic.config.json ├── karma.conf.js ├── ngsw-config.json ├── package.json ├── plugins/ │ └── bcl-mobile-overlay/ │ ├── .eslintignore │ ├── .gitignore │ ├── .prettierignore │ ├── BclMobileOverlay.podspec │ ├── CONTRIBUTING.md │ ├── Package.swift │ ├── README.md │ ├── android/ │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── gradle/ │ │ │ └── wrapper/ │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── gradle.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ ├── proguard-rules.pro │ │ ├── settings.gradle │ │ └── src/ │ │ ├── androidTest/ │ │ │ └── java/ │ │ │ └── com/ │ │ │ └── getcapacitor/ │ │ │ └── android/ │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main/ │ │ │ ├── AndroidManifest.xml │ │ │ ├── java/ │ │ │ │ └── io/ │ │ │ │ └── bettercrewlink/ │ │ │ │ └── plugin/ │ │ │ │ ├── BetterCrewlinkNativeService.java │ │ │ │ ├── BetterCrewlinkNativeServicePlugin.java │ │ │ │ └── OverlayService.java │ │ │ └── res/ │ │ │ ├── .gitkeep │ │ │ └── layout/ │ │ │ └── overlay_layout.xml │ │ └── test/ │ │ └── java/ │ │ └── com/ │ │ └── getcapacitor/ │ │ └── ExampleUnitTest.java │ ├── ios/ │ │ ├── .gitignore │ │ ├── Sources/ │ │ │ └── BetterCrewlinkNativeServicePlugin/ │ │ │ ├── BetterCrewlinkNativeService.swift │ │ │ └── BetterCrewlinkNativeServicePlugin.swift │ │ └── Tests/ │ │ └── BetterCrewlinkNativeServicePluginTests/ │ │ └── BetterCrewlinkNativeServicePluginTests.swift │ ├── package.json │ ├── rollup.config.mjs │ ├── src/ │ │ ├── definitions.ts │ │ ├── index.ts │ │ └── web.ts │ └── tsconfig.json ├── src/ │ ├── app/ │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── compontents/ │ │ │ ├── avatar/ │ │ │ │ ├── avatar.component.html │ │ │ │ ├── avatar.component.scss │ │ │ │ ├── avatar.component.spec.ts │ │ │ │ └── avatar.component.ts │ │ │ ├── global-footer/ │ │ │ │ ├── global-footer.component.html │ │ │ │ ├── global-footer.component.scss │ │ │ │ └── global-footer.component.ts │ │ │ └── global-header/ │ │ │ ├── global-header.component.html │ │ │ ├── global-header.component.scss │ │ │ ├── global-header.component.spec.ts │ │ │ └── global-header.component.ts │ │ ├── pages/ │ │ │ ├── game/ │ │ │ │ ├── game.component.html │ │ │ │ ├── game.component.scss │ │ │ │ └── game.component.ts │ │ │ └── settings/ │ │ │ ├── settings.component.html │ │ │ ├── settings.component.scss │ │ │ └── settings.component.ts │ │ └── services/ │ │ ├── AmongUsState.ts │ │ ├── AudioController.service.ts │ │ ├── ConnectionController.service.ts │ │ ├── game-helper.service.ts │ │ ├── settings.service.ts │ │ ├── smallInterfaces.ts │ │ ├── turnServers.ts │ │ └── vad.ts │ ├── environments/ │ │ └── environment.ts │ ├── global.scss │ ├── index.html │ ├── main.ts │ ├── manifest.webmanifest │ ├── polyfills.ts │ ├── test.ts │ ├── theme/ │ │ └── variables.scss │ ├── web.config │ └── zone-flags.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/FUNDING.yml ================================================ # These are supported funding model platforms to help and support BetterCrewLink project github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: ohmyguus # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username custom: paypal.com/donate/?hosted_button_id=KS43BDTGN76JQ # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug Report about: Create a report to help us improve. title: "[BUG REPORT]" labels: bug assignees: '' --- # You MUST use this template or your issue will be deleted. **Before reporting a bug, always look at the [FAQ](https://discord.gg/qDqTzvj4SH) in Discord Server that there usually has a solution for your bug** **If your problem is with BetterCrewLink on your PC, [click here](https://github.com/OhMyGuus/BetterCrewLink/issues) and make an issue there, if your problem is with BetterCrewLink on your mobile or the web version, ignore that and continue with your bug report** # Pre-Flight Checklist Please use this checklist to avoid spamming: 1. [ ] I am not asking a question => use the [Discord](https://discord.gg/qDqTzvj4SH) if you are 2. [ ] I have tried to use an [alternative voice server](https://bettercrewl.ink/) 3. [ ] I have checked everyone in my lobby is on the same BetterCrewLink/CrewLink server 4. [ ] I have clicked in `Refresh` on the BetterCrewLink mobile app when I can't hear some people (this is a known issue) 5. [ ] I have checked that the BetterCrewLink/CrewLink server I'm using is up to date 6. [ ] I have a screenshot of any errors 7. [ ] I have checked that someone else has not reported this using the [search bar](https://github.com/OhMyGuus/BetterCrewlink-mobile/issues?q=is%3Aissue) **Describe the bug** **To Reproduce** Steps to reproduce the behaviour: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behaviour** **Screenshots** **Smartphone (please complete the following information):** - Device: [e.g. Motorola G8 Play] - OS: [e.g. Android 11] - Version: [e.g. 1.0.20] - Browser: [e.g. Chrome] (optional, only if you use the [web version](https://web.bettercrewl.ink/)) **Additional context** ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: false contact_links: - name: YOU MUST USE ONE OF THE ABOVE TEMPLATES OR YOUR ISSUE WILL BE DELETED! url: https://github.com/OhMyGuus/BetterCrewlink-mobile/issues/new/choose about: This is to prevent duplicate issues and spam. - name: I need help url: https://discord.gg/qDqTzvj4SH about: Please ask and answer questions here. - name: Security issue url: https://discordapp.com/users/508426414387757057 about: Please report security vulnerabilities directly to ThaGuus#2140 in Discord. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature Request about: Suggest an idea for this project. title: "[FEATURE]" labels: enhancement assignees: '' --- # Pre-Flight Checklist Please use this checklist to avoid spamming: 1. [ ] I am not asking a question => use the [Discord](https://discord.gg/qDqTzvj4SH) if you are 2. [ ] I have checked that someone else has not suggested this using the [search bar](https://github.com/OhMyGuus/BetterCrewlink-mobile/issues?q=is%3Aissue) 3. [ ] My feature request is not one of the **commonly suggested features**: - iOS app (its already being development) **Is your feature request related to a problem? Please describe.** **Describe the solution you'd like** **Describe alternatives you've considered** **Additional context** ================================================ FILE: .gitignore ================================================ # Specifies intentionally untracked files to ignore when using Git # http://git-scm.com/docs/gitignore # Angular build and cache /.angular/cache /.angular/* # Capacitor /ios/ # Environment files /src/environments/environment.*.ts # OS generated files ehthumbs.db Icon? Desktop.ini # VSCode settings .vscode/ # Mac *.DS_Store # Windows Thumbs.db $RECYCLE.BIN/ # Logs *.log log.txt npm-debug.log* # Node node_modules/ # Build output /dist/ /www/ /coverage/ # IDEs .idea/ *.sublime-project *.sublime-workspace # Misc *~ *.sw[mnpcod] .tmp *.tmp *.tmp.* .sass-cache/ .sourcemaps/ .versions/ /platforms/ # /plugins/ UserInterfaceState.xcuserstate ================================================ FILE: .httaccess ================================================ RewriteEngine on # Don’t rewrite files or directories RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] # Rewrite everything else to index.html to allow HTML5 state links RewriteRule ^ index.html [L] ================================================ FILE: .prettierignore ================================================ ================================================ FILE: .prettierrc.yaml ================================================ trailingComma: 'es5' useTabs: true semi: true singleQuote: true printWidth: 120 ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: README.md ================================================ [![GitHub Downloads][github-shield]][github-url] [![GPL-3.0 License][license-shield]][license-url] [![Support BetterCrewLink][paypal-shield]][paypal-url] [![Support BetterCrewLink][kofi-shield]][kofi-url] [![Discord Server][discord-shield]][discord-url] [![Contributors][contributors-shield]][contributors-url]

Logo

BetterCrewLink Mobile is here!

Free, open, Among Us proximity voice chat.
Report Bug · Request Feature · Installation Instructions

Donate to BetterCrewLink
(all donations will be used for the apple developer license and extra servers)
Donate to ottomated (offical crewlink)


Notes:
- This is an unofficial fork of CrewLink, for any problem, question, issue or suggestion you have with BetterCrewLink talk to us on our [Discord](https://discord.gg/qDqTzvj4SH), or [GitHub](https://github.com/OhMyGuus/BetterCrewlink-mobile/issues) or message me on Discord ([ThaGuus#2140](https://discordapp.com/users/508426414387757057)) do not report any problems to the official Discord or GitHub project of CrewLink as they will not support you. - To get the most of BetterCrewLink use the voice server: `https://bettercrewl.ink`

## Table of Contents * [About the Project](#about-the-project) * [Installation](#installation) * [Setup Instructions](#setup-instructions) * [Android](#android) * [iOS](#ios) * [Development](#development) * [Prerequisites](#prerequisites) * [Setup](#setup) * [Contributing](#contributing) * [Contributors](#contributors) * [License](#license) ## About The Project This project implements proximity voice chat for mobile users in Among Us. As long as there is a PC user with "Mobile Host" enabled in your lobby, you will be able to hear people near you. ## Installation Download the latest version from [releases](https://github.com/OhMyGuus/BetterCrewlink-mobile/releases/latest) and run the `Bettercrewlink-v-X-X-X-a.apk` file on your phone. You may have to allow chrome to install apps on your phone. You can also use the web version in your browser [here](https://web.bettercrewl.ink/). If you have a PC and want to download the PC version of BetterCrewLink (without being the Bluestacks) go to category [Windows](https://github.com/OhMyGuus/BetterCrewLink#windows). ## Setup Instructions ### Android * Open the app. * Ensure there is one person in the lobby with "Mobile Host" enabled on their PC (they must use [BetterCrewLink](https://github.com/OhMyGuus/BetterCrewLink)). * Fill in the required information (make sure you have a unique name in your lobby). * Hit the connect button. * If you are waiting on the connecting screen for a while you may want to check that all the information is correct and the is a pc user with "Mobile Host" enabled in the lobby. * All done! ### iOS An iOS version is still being developed and will be released soon, but you can use in the meantime the [web version](https://web.bettercrewl.ink/). (requires a PC player) ## Development You only need to follow the below instructions if you are trying to modify this software. Otherwise, please download the latest version from the [github releases](https://github.com/OhMyGuus/BetterCrewlink-mobile/releases). Server code is located at [OhMyGuus/BetterCrewLink-server](https://github.com/OhMyGuus/BetterCrewLink-server). Please use a local server for development purposes. ### Prerequisites This is an example of how to list things you need to use the software and how to install them. * [node.js](https://nodejs.org/en/download/) * Ionic cli ```sh npm install -g @ionic/cli ``` ### Setup 1. Clone the repo ```sh git clone https://github.com/OhMyGuus/BetterCrewlink-mobile.git cd BetterCrewlink-mobile ``` 2. Install packages and sync ```sh npm install ionic capacitor sync ``` 3. Run the project ```JS ionic serve ``` ## Contributing Any contributions you make are greatly appreciated. 1. [Fork the Project](https://github.com/OhMyGuus/BetterCrewlink-mobile/fork) 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) 4. Push to the Branch (`git push origin feature/AmazingFeature`) 5. Open a Pull Request ## Contributors [![Contributors][contributors-shield]][contributors-url] * [OhMyGuus](https://github.com/OhMyGuus) for make various things for [BetterCrewLink](https://github.com/OhMyGuus/BetterCrewLink), example: NAT Fix, more overlays, support for Mobile and owner of project * [ottomated](https://github.com/ottomated) for make [CrewLink](https://github.com/ottomated/CrewLink) * [vrnagy](https://github.com/vrnagy) for make WebRTC reconnects automatically for [BetterCrewLink](https://github.com/OhMyGuus/BetterCrewLink) * [TheGreatMcPain](https://github.com/TheGreatMcPain) & [Donokami](https://github.com/Donokami) for make support for Linux * [squarebracket](https://github.com/squarebracket) for make support overlay for Linux * [JKohlman](https://github.com/JKohlman) for make various things for [BetterCrewLink](https://github.com/OhMyGuus/BetterCrewLink), example: push to mute, visual changes and making Multi Stage builds for [BetterCrewLink Server](https://github.com/OhMyGuus/BetterCrewLink-server) * [Diemo-zz](https://github.com/Diemo-zz) for make the default Voice Server for: `https://bettercrewl.ink` * [KadenBiel](https://github.com/KadenBiel) for make various things for [BetterCrewLink Mobile](https://github.com/OhMyGuus/BetterCrewlink-mobile), example: Better UI, Settings page * [adofou](https://github.com/adofou) for make new parameters for node-turn server for [BetterCrewLink-Server](https://github.com/OhMyGuus/BetterCrewLink-server) * [Kore-Development](https://github.com/Kore-Development) for make support for Repl.it and gitignore changes for [BetterCrewLink-Server](https://github.com/OhMyGuus/BetterCrewLink-server) * [cybershard](https://github.com/cybershard) & [edqx](https://github.com/edqx) for make Only hear people in vision, Walls block voice and Hear through cameras * [electron-overlay-window](https://github.com/SnosMe/electron-overlay-window) for make it easier to do overlays * [node-keyboard-watcher](https://github.com/OhMyGuus/node-keyboard-watcher) for make it easy to push to talk and push to mute * [MatadorProBr](https://github.com/MatadorProBr) for make this list of Contribuators, better README.md, wiki A big thank you to all those people who contributed and still contribute to this project to stay alive, thank you for being part of this BetterCrewLink community! ## License Distributed under the GNU General Public License v3.0. See `LICENSE` for more information. [github-shield]: https://img.shields.io/github/downloads/OhMyGuus/BetterCrewlink-mobile/total?label=Downloads [github-url]: https://github.com/OhMyGuus/BetterCrewlink-mobile/releases/ [license-shield]: https://img.shields.io/github/license/OhMyGuus/BetterCrewlink-mobile?label=License [license-url]: https://github.com/OhMyGuus/BetterCrewlink-mobile/blob/master/LICENSE [paypal-shield]: https://img.shields.io/badge/Support-BetterCrewLink-purple?logo=PayPal [paypal-url]: https://www.paypal.com/donate?hosted_button_id=KS43BDTGN76JQ [kofi-shield]: https://img.shields.io/badge/Support-BetterCrewLink-purple?logo=Ko-fi&logoColor=white [kofi-url]: https://ko-fi.com/ohmyguus [discord-shield]: https://img.shields.io/discord/791516611143270410?color=cornflowerblue&label=Discord&logo=Discord&logoColor=white [discord-url]: https://discord.gg/qDqTzvj4SH [contributors-shield]: https://img.shields.io/github/contributors/OhMyGuus/BetterCrewlink-mobile?label=Contributors [contributors-url]: https://github.com/OhMyGuus/BetterCrewlink-mobile/graphs/contributors ================================================ FILE: TODO.md ================================================ # TODO ## Server - [x] Migrate from socket.io to a raw websocket connection. Ensure it auto-reconnects. - [x] Move the default server to a better host. - [x] Rewrite all error messages to be even more human-readable. - [ ] Integrate an official server list into the client. - [x] Detect the reason *why* the server can't provide offsets: i.e. Among Us just updated, it's an old version of Among Us, the server hasn't updated, etc. - [x] Repl.it support. ### Stretch - [ ] Distribute the server load, with a centralized matchmaking database. - [ ] Re-write the server in Rust. ## Voice / WebRTC - [ ] Add a microphone mute button. - [x] Add a microphone boost slider. - [x] Add a speaker adjustment slider. - [x] Add individual adjustment sliders to each of the players. - [x] Add an OBS Overlay. - [x] Add an option in "Host Settings" for hearing through cams. - [x] Add an option in "Host Settings" to disable talking through walls. - [x] Handle all RTC errors to make it unnecessary to ever re-open an RTC connection. - [x] Detect reason for RTC failure: NAT type, etc? - [x] Re-enable all `navigator.getUserMedia` functions that can be re-enabled with autoGainControl kicking in. - [x] Move all player-to-player communication logic to RTC data channels, versus sending them over the websocket. - [ ] Change VAD to send the status towards the server. ### Stretch - [x] Implement an optional TURN server. ## Game Reader - [x] Fix unicode characters in player names - [ ] Indicate to the user when it can't read memory properly. Example: screen displays `MENU` while in lobby due to some misplaced offset. - [x] Don't use the Unity Analytics file to read the game version. Use either a hash of the GameAssembly dll, or DMA it from the process. ### Stretch - [ ] Move away from DMA and towards a different method. Probably network packet sniffing? Maybe DLL injection? - [x] Add Android Support. - [ ] Add iOS Support. - [x] Add Linux Support. - [ ] Support for other languages. - [ ] Customizable Window Size. - [ ] Support for Local games. - [ ] Ask to update and not auto update. - [x] Custom Color Support. ================================================ FILE: android/.gitignore ================================================ # Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore # Built application files *.apk *.aar *.ap_ *.aab # Files for the ART/Dalvik VM *.dex # Java class files *.class # Generated files bin/ gen/ out/ # Uncomment the following line in case you need and you don't have the release build type files in your app # release/ # Gradle files .gradle/ build/ # Local configuration file (sdk path, etc) local.properties # Proguard folder generated by Eclipse proguard/ # Log Files *.log # Android Studio Navigation editor temp files .navigation/ # Android Studio captures folder captures/ # IntelliJ *.iml .idea/workspace.xml .idea/tasks.xml .idea/gradle.xml .idea/assetWizardSettings.xml .idea/dictionaries .idea/libraries # Android Studio 3 in .gitignore file. .idea/caches .idea/modules.xml # Comment next line if keeping position of elements in Navigation Editor is relevant for you .idea/navEditor.xml # Keystore files # Uncomment the following lines if you do not want to check your keystore files in. #*.jks #*.keystore # External native build folder generated in Android Studio 2.2 and later .externalNativeBuild .cxx/ # Google Services (e.g. APIs or Firebase) # google-services.json # Freeline freeline.py freeline/ freeline_project_description.json # fastlane fastlane/report.xml fastlane/Preview.html fastlane/screenshots fastlane/test_output fastlane/readme.md # Version control vcs.xml # lint lint/intermediates/ lint/generated/ lint/outputs/ lint/tmp/ # lint/reports/ # Android Profiling *.hprof # Cordova plugins for Capacitor capacitor-cordova-android-plugins # Copied web assets app/src/main/assets/public # Generated Config files app/src/main/assets/capacitor.config.json app/src/main/assets/capacitor.plugins.json app/src/main/res/xml/config.xml ================================================ FILE: android/app/.gitignore ================================================ /build/* !/build/.npmkeep ================================================ FILE: android/app/build.gradle ================================================ apply plugin: 'com.android.application' android { namespace "io.bettercrewlink.app" compileSdk rootProject.ext.compileSdkVersion defaultConfig { applicationId "io.bettercrewlink.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 32 versionName "1.0.32" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61 ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { flatDir{ dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs' } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion" implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion" implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion" implementation project(':capacitor-android') testImplementation "junit:junit:$junitVersion" androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" implementation project(':capacitor-cordova-android-plugins') } apply from: 'capacitor.build.gradle' try { def servicesJSON = file('google-services.json') if (servicesJSON.text) { apply plugin: 'com.google.gms.google-services' } } catch(Exception e) { logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work") } ================================================ FILE: android/app/capacitor.build.gradle ================================================ // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN android { compileOptions { sourceCompatibility JavaVersion.VERSION_21 targetCompatibility JavaVersion.VERSION_21 } } apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" dependencies { implementation project(':bcl-mobile-overlay') } if (hasProperty('postBuildExtras')) { postBuildExtras() } ================================================ FILE: android/app/proguard-rules.pro ================================================ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the # proguardFiles setting in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} # Uncomment this to preserve the line number information for # debugging stack traces. #-keepattributes SourceFile,LineNumberTable # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile ================================================ FILE: android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java ================================================ package com.getcapacitor.myapp; import static org.junit.Assert.*; import android.content.Context; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.platform.app.InstrumentationRegistry; import org.junit.Test; import org.junit.runner.RunWith; /** * Instrumented test, which will execute on an Android device. * * @see Testing documentation */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.getcapacitor.app", appContext.getPackageName()); } } ================================================ FILE: android/app/src/main/AndroidManifest.xml ================================================ ================================================ FILE: android/app/src/main/assets/capacitor.config.json ================================================ { "appId": "io.bettercrewlink.app", "appName": "BetterCrewlinkMobile", "bundledWebRuntime": false, "npmClient": "npm", "webDir": "www", "plugins": { "SplashScreen": { "launchShowDuration": 0 } }, "overrideUserAgent": "CrewLink/2.0.1 (win32)", "cordova": { "preferences": { "APP_SECRET": "968c50f3-eb43-4ceb-9b3d-55458601a601" } }, "android": { "minSdkVersion": 24, "compileSdkVersion": 34, "targetSdkVersion": 34 } } ================================================ FILE: android/app/src/main/assets/capacitor.plugins.json ================================================ [ { "pkg": "bcl-mobile-overlay", "classpath": "io.bettercrewlink.plugin.BetterCrewlinkNativeServicePlugin" } ] ================================================ FILE: android/app/src/main/java/io/bettercrewlink/app/MainActivity.java ================================================ package io.bettercrewlink.app; import com.getcapacitor.BridgeActivity; public class MainActivity extends BridgeActivity {} ================================================ FILE: android/app/src/main/res/drawable/ic_launcher_background.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml ================================================ ================================================ FILE: android/app/src/main/res/layout/activity_main.xml ================================================ ================================================ FILE: android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml ================================================ ================================================ FILE: android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml ================================================ ================================================ FILE: android/app/src/main/res/values/ic_launcher_background.xml ================================================ #FFFFFF ================================================ FILE: android/app/src/main/res/values/strings.xml ================================================ BetterCrewlinkMobile BetterCrewlinkMobile io.bettercrewlink.app io.bettercrewlink.app ================================================ FILE: android/app/src/main/res/values/styles.xml ================================================ ================================================ FILE: android/app/src/main/res/xml/config.xml ================================================ ================================================ FILE: android/app/src/main/res/xml/file_paths.xml ================================================ ================================================ FILE: android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java ================================================ package com.getcapacitor.myapp; import static org.junit.Assert.*; import org.junit.Test; /** * Example local unit test, which will execute on the development machine (host). * * @see Testing documentation */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } } ================================================ FILE: android/build.gradle ================================================ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:8.7.2' classpath 'com.google.gms:google-services:4.4.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } apply from: "variables.gradle" allprojects { repositories { google() mavenCentral() } } task clean(type: Delete) { delete rootProject.buildDir } ================================================ FILE: android/capacitor.settings.gradle ================================================ // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN include ':capacitor-android' project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') include ':bcl-mobile-overlay' project(':bcl-mobile-overlay').projectDir = new File('../plugins/bcl-mobile-overlay/android') ================================================ FILE: android/gradle/wrapper/gradle-wrapper.properties ================================================ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists ================================================ FILE: android/gradle.properties ================================================ # Project-wide Gradle settings. # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true # AndroidX package structure to make it clearer which packages are bundled with the # Android operating system, and which are packaged with your app's APK # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true ================================================ FILE: android/gradlew ================================================ #!/bin/sh # # Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # SPDX-License-Identifier: Apache-2.0 # ############################################################################## # # Gradle start up script for POSIX generated by Gradle. # # Important for running: # # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is # noncompliant, but you have some other compliant shell such as ksh or # bash, then to run this script, type that shell name before the whole # command line, like: # # ksh Gradle # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», # «${var#prefix}», «${var%suffix}», and «$( cmd )»; # * compound commands having a testable exit status, especially «case»; # * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # # (2) This script targets any POSIX shell, so it avoids extensions provided # by Bash, Ksh, etc; in particular arrays are avoided. # # The "traditional" practice of packing multiple parameters into a # space-separated string is a well documented source of bugs and security # problems, so this is (mostly) avoided, by progressively accumulating # options in "$@", and eventually passing that to Java. # # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; # see the in-line comments for details. # # There are tweaks for specific operating systems such as AIX, CygWin, # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. # ############################################################################## # Attempt to set APP_HOME # Resolve links: $0 may be a link app_path=$0 # Need this for daisy-chained symlinks. while APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path [ -h "$app_path" ] do ls=$( ls -ld "$app_path" ) link=${ls#*' -> '} case $link in #( /*) app_path=$link ;; #( *) app_path=$APP_HOME$link ;; esac done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s ' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum warn () { echo "$*" } >&2 die () { echo echo "$*" echo exit 1 } >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false case "$( uname )" in #( CYGWIN* ) cygwin=true ;; #( Darwin* ) darwin=true ;; #( MSYS* | MINGW* ) msys=true ;; #( NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD=$JAVA_HOME/jre/sh/java else JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else JAVACMD=java if ! command -v java >/dev/null 2>&1 then die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi # Collect all arguments for the java command, stacking in reverse order: # * args from the command line # * the main class name # * -classpath # * -D...appname settings # * --module-path (only if needed) # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) # Now convert the arguments - kludge to limit ourselves to /bin/sh for arg do if case $arg in #( -*) false ;; # don't mess with options #( /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath [ -e "$t" ] ;; #( *) false ;; esac then arg=$( cygpath --path --ignore --mixed "$arg" ) fi # Roll the args list around exactly as many times as the number of # args, so each arg winds up back in the position where it started, but # possibly modified. # # NB: a `for` loop captures its iteration list before it begins, so # changing the positional parameters here affects neither the number of # iterations, nor the values presented in `arg`. shift # remove old arg set -- "$@" "$arg" # push replacement arg done fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ org.gradle.wrapper.GradleWrapperMain \ "$@" # Stop when "xargs" is not available. if ! command -v xargs >/dev/null 2>&1 then die "xargs is not available" fi # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. # # In Bash we could simply go: # # readarray ARGS < <( xargs -n1 <<<"$var" ) && # set -- "${ARGS[@]}" "$@" # # but POSIX shell has neither arrays nor command substitution, so instead we # post-process each arg (as a line of input to sed) to backslash-escape any # character that might be a shell metacharacter, then use eval to reverse # that process (while maintaining the separation between arguments), and wrap # the whole thing up as a single "set" statement. # # This will of course break if any of these variables contains a newline or # an unmatched quote. # eval "set -- $( printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | xargs -n1 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | tr '\n' ' ' )" '"$@"' exec "$JAVACMD" "$@" ================================================ FILE: android/gradlew.bat ================================================ @rem @rem Copyright 2015 the original author or authors. @rem @rem Licensed under the Apache License, Version 2.0 (the "License"); @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem @rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS, @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem @rem SPDX-License-Identifier: Apache-2.0 @rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @rem @rem ########################################################################## @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Resolve any "." and ".." in APP_HOME to make it shorter. for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute echo. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 goto fail :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute echo. 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! set EXIT_CODE=%ERRORLEVEL% if %EXIT_CODE% equ 0 set EXIT_CODE=1 if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal :omega ================================================ FILE: android/settings.gradle ================================================ include ':app' include ':capacitor-cordova-android-plugins' project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/') apply from: 'capacitor.settings.gradle' ================================================ FILE: android/variables.gradle ================================================ ext { minSdkVersion = 23 compileSdkVersion = 35 targetSdkVersion = 35 androidxActivityVersion = '1.9.2' androidxAppCompatVersion = '1.7.0' androidxCoordinatorLayoutVersion = '1.2.0' androidxCoreVersion = '1.15.0' androidxFragmentVersion = '1.8.4' coreSplashScreenVersion = '1.0.1' androidxWebkitVersion = '1.12.1' junitVersion = '4.13.2' androidxJunitVersion = '1.2.1' androidxEspressoCoreVersion = '3.6.1' cordovaAndroidVersion = '10.1.1' } ================================================ FILE: angular.json ================================================ { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "app": { "root": "", "sourceRoot": "src", "projectType": "application", "prefix": "app", "schematics": {}, "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "www", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "assets": [ { "glob": "**/*", "input": "src/assets", "output": "assets" }, { "glob": "**/*.svg", "input": "node_modules/ionicons/dist/ionicons/svg", "output": "./svg" }, "src/manifest.webmanifest" ], "styles": [ { "input": "src/theme/variables.scss" }, { "input": "src/global.scss" } ], "scripts": [] }, "configurations": { "production": { "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } ], "optimization": true, "outputHashing": "all", "sourceMap": true, "namedChunks": false, "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, "budgets": [ { "type": "initial", "maximumWarning": "2mb", "maximumError": "5mb" } ], "serviceWorker": true, "ngswConfigPath": "ngsw-config.json" }, "ci": { }, "development": { "optimization": false, "sourceMap": true, "namedChunks": true, "aot": false, "extractLicenses": false, "vendorChunk": true, "buildOptimizer": false } } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { "buildTarget": "app:build" }, "configurations": { "production": { "buildTarget": "app:build:production" }, "ci": { } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { "buildTarget": "app:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "main": "src/test.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", "styles": [], "scripts": [], "assets": [ { "glob": "favicon.ico", "input": "src/", "output": "/" }, { "glob": "**/*", "input": "src/assets", "output": "/assets" }, "src/manifest.webmanifest" ] }, "configurations": { "ci": { "progress": false, "watch": false } } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ "tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json" ], "exclude": ["**/node_modules/**"] } }, "e2e": { "builder": "@angular-devkit/build-angular:protractor", "options": { "protractorConfig": "e2e/protractor.conf.js", "devServerTarget": "app:serve" }, "configurations": { "production": { "devServerTarget": "app:serve:production" }, "ci": { "devServerTarget": "app:serve:ci" } } }, "ionic-cordova-build": { "builder": "@ionic/angular-toolkit:cordova-build", "options": { "browserTarget": "app:build" }, "configurations": { "production": { "browserTarget": "app:build:production" } } }, "ionic-cordova-serve": { "builder": "@ionic/angular-toolkit:cordova-serve", "options": { "cordovaBuildTarget": "app:ionic-cordova-build", "devServerTarget": "app:serve" }, "configurations": { "production": { "cordovaBuildTarget": "app:ionic-cordova-build:production", "devServerTarget": "app:serve:production" } } } } } }, "cli": { "analytics": false, "schematicCollections": [ "@ionic/angular-toolkit" ] }, "schematics": { "@ionic/angular-toolkit:component": { "styleext": "scss" }, "@ionic/angular-toolkit:page": { "styleext": "scss" } } } ================================================ FILE: browserslist ================================================ # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. # For additional information regarding the format and rule options, please see: # https://github.com/browserslist/browserslist#queries # You can see what browsers were selected by your queries by running: # npx browserslist > 0.5% last 2 versions Firefox ESR not dead not IE 9-11 # For IE 9-11 support, remove 'not'. ================================================ FILE: capacitor.config.json ================================================ { "appId": "io.bettercrewlink.app", "appName": "BetterCrewlinkMobile", "bundledWebRuntime": false, "npmClient": "npm", "webDir": "www", "plugins": { "SplashScreen": { "launchShowDuration": 0 } }, "overrideUserAgent": "CrewLink/2.0.1 (win32)", "cordova": { "preferences": { "APP_SECRET": "968c50f3-eb43-4ceb-9b3d-55458601a601" } }, "android": { "minSdkVersion": 24, "compileSdkVersion": 34, "targetSdkVersion": 34 } } ================================================ FILE: e2e/protractor.conf.js ================================================ // @ts-check // Protractor configuration file, see link for more information // https://github.com/angular/protractor/blob/master/lib/config.ts const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); /** * @type { import("protractor").Config } */ exports.config = { allScriptsTimeout: 11000, specs: [ './src/**/*.e2e-spec.ts' ], capabilities: { browserName: 'chrome' }, directConnect: true, baseUrl: 'http://localhost:4200/', framework: 'jasmine', jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, print: function() {} }, onPrepare() { require('ts-node').register({ project: require('path').join(__dirname, './tsconfig.json') }); jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: StacktraceOption.PRETTY } })); } }; ================================================ FILE: e2e/src/app.e2e-spec.ts ================================================ import { AppPage } from './app.po'; describe('new App', () => { let page: AppPage; beforeEach(() => { page = new AppPage(); }); describe('default screen', () => { beforeEach(() => { page.navigateTo('/Inbox'); }); it('should say Inbox', () => { expect(page.getParagraphText()).toContain('Inbox'); }); }); }); ================================================ FILE: e2e/src/app.po.ts ================================================ import { browser, by, element } from 'protractor'; export class AppPage { navigateTo(destination) { return browser.get(destination); } getParagraphText() { return element(by.deepCss('app-root ion-content')).getText(); } } ================================================ FILE: e2e/tsconfig.json ================================================ { "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/app", "module": "commonjs", "target": "es5", "types": [ "jasmine", "jasminewd2", "node" ] } } ================================================ FILE: ionic.config.json ================================================ { "name": "BetterCrewlinkMobile", "integrations": { "capacitor": {}, "cordova": {} }, "type": "angular", "id": "f5ec6ee4" } ================================================ FILE: karma.conf.js ================================================ // Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), require('@angular-devkit/build-angular/plugins/karma') ], client: { clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { dir: require('path').join(__dirname, '../coverage'), reports: ['html', 'lcovonly', 'text-summary'], fixWebpackSourcePaths: true }, reporters: ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false }); }; ================================================ FILE: ngsw-config.json ================================================ { "$schema": "./node_modules/@angular/service-worker/config/schema.json", "index": "/index.html", "assetGroups": [ { "name": "app", "installMode": "prefetch", "resources": { "files": [ "/favicon.ico", "/index.html", "/manifest.webmanifest", "/*.css", "/*.js" ] } }, { "name": "assets", "installMode": "lazy", "updateMode": "prefetch", "resources": { "files": [ "/assets/**", "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)" ] } } ] } ================================================ FILE: package.json ================================================ { "name": "better-crewlink-mobile", "version": "0.0.5", "author": "OhMyGuus", "homepage": "https://bettercrewlink.app", "scripts": { "ng": "ng", "start": "ng serve", "ngbuild": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "dev": "ionic serve --external --ssl --configuration=development", "build": "ionic capacitor build android --prod" }, "private": true, "dependencies": { "@angular/common": "~17.3.12", "@angular/core": "~17.3.12", "@angular/forms": "^17.3.12", "@angular/platform-browser": "~17.3.12", "@angular/platform-browser-dynamic": "~17.3.12", "@angular/platform-server": "~17.3.12", "@angular/service-worker": "~17.3.12", "@awesome-cordova-plugins/android-permissions": "^6.16.0", "@awesome-cordova-plugins/background-mode": "^6.16.0", "@awesome-cordova-plugins/core": "^6.16.0", "@capacitor/android": "^7.0.0", "@capacitor/core": "^7.0.0", "@ionic/angular": "^8.5.8", "@ionic/angular-server": "^8.5.8", "@ionic/storage": "^4.0.0", "@ionic/storage-angular": "^4.0.0", "bcl-mobile-overlay": "file:plugins/bcl-mobile-overlay", "cordova-plugin-android-permissions": "^1.1.5", "cordova-plugin-background-mode": "github:OhMyGuus/cordova-plugin-background-mode", "cordova-plugin-device": "^2.0.3", "jetifier": "^1.6.6", "rxjs": "~7.8.0", "simple-peer": "^9.9.3", "socket.io-client": "^2.3.1", "tslib": "^2.0.0", "zone.js": "~0.14.10" }, "devDependencies": { "@angular-devkit/build-angular": "~17.3.17", "@angular/cli": "~17.3.17", "@angular/compiler": "~17.3.12", "@angular/compiler-cli": "~17.3.12", "@angular/language-service": "~17.3.12", "@angular/router": "^17.3.12", "@capacitor/cli": "^7.0.0", "@ionic/angular-toolkit": "^11.0.1", "@types/angular": "^1.8.9", "@types/jasmine": "~3.5.0", "@types/jasminewd2": "~2.0.3", "@types/node": "^12.19.11", "@types/socket.io-client": "^1.4.34", "codelyzer": "^6.0.0", "jasmine-core": "~3.8.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~3.3.0", "karma-jasmine-html-reporter": "^1.7.0", "protractor": "~7.0.0", "ts-node": "~8.3.0", "tslint": "~6.1.0", "typescript": "~5.4.5" }, "description": "Bettercrewlink mobile" } ================================================ FILE: plugins/bcl-mobile-overlay/.eslintignore ================================================ build dist example-app ================================================ FILE: plugins/bcl-mobile-overlay/.gitignore ================================================ # node files dist node_modules # iOS files Pods Podfile.lock Package.resolved Build xcuserdata /.build /Packages xcuserdata/ DerivedData/ .swiftpm/configuration/registries.json .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata .netrc # macOS files .DS_Store # Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore # Built application files *.apk *.ap_ # Files for the ART/Dalvik VM *.dex # Java class files *.class # Generated files bin gen out # Gradle files .gradle build # Local configuration file (sdk path, etc) local.properties # Proguard folder generated by Eclipse proguard # Log Files *.log # Android Studio Navigation editor temp files .navigation # Android Studio captures folder captures # IntelliJ *.iml .idea # Keystore files # Uncomment the following line if you do not want to check your keystore files in. #*.jks # External native build folder generated in Android Studio 2.2 and later .externalNativeBuild ================================================ FILE: plugins/bcl-mobile-overlay/.prettierignore ================================================ example-app ================================================ FILE: plugins/bcl-mobile-overlay/BclMobileOverlay.podspec ================================================ require 'json' package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) Pod::Spec.new do |s| s.name = 'BclMobileOverlay' s.version = package['version'] s.summary = package['description'] s.license = package['license'] s.homepage = package['repository']['url'] s.author = package['author'] s.source = { :git => package['repository']['url'], :tag => s.version.to_s } s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' s.swift_version = '5.1' end ================================================ FILE: plugins/bcl-mobile-overlay/CONTRIBUTING.md ================================================ # Contributing This guide provides instructions for contributing to this Capacitor plugin. ## Developing ### Local Setup 1. Fork and clone the repo. 1. Install the dependencies. ```shell npm install ``` 1. Install SwiftLint if you're on macOS. ```shell brew install swiftlint ``` ### Scripts #### `npm run build` Build the plugin web assets and generate plugin API documentation using [`@capacitor/docgen`](https://github.com/ionic-team/capacitor-docgen). It will compile the TypeScript code from `src/` into ESM JavaScript in `dist/esm/`. These files are used in apps with bundlers when your plugin is imported. Then, Rollup will bundle the code into a single file at `dist/plugin.js`. This file is used in apps without bundlers by including it as a script in `index.html`. #### `npm run verify` Build and validate the web and native projects. This is useful to run in CI to verify that the plugin builds for all platforms. #### `npm run lint` / `npm run fmt` Check formatting and code quality, autoformat/autofix if possible. This template is integrated with ESLint, Prettier, and SwiftLint. Using these tools is completely optional, but the [Capacitor Community](https://github.com/capacitor-community/) strives to have consistent code style and structure for easier cooperation. ## Publishing There is a `prepublishOnly` hook in `package.json` which prepares the plugin before publishing, so all you need to do is run: ```shell npm publish ``` > **Note**: The [`files`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files) array in `package.json` specifies which files get published. If you rename files/directories or add files elsewhere, you may need to update it. ================================================ FILE: plugins/bcl-mobile-overlay/Package.swift ================================================ // swift-tools-version: 5.9 import PackageDescription let package = Package( name: "BclMobileOverlay", platforms: [.iOS(.v14)], products: [ .library( name: "BclMobileOverlay", targets: ["BetterCrewlinkNativeServicePlugin"]) ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0") ], targets: [ .target( name: "BetterCrewlinkNativeServicePlugin", dependencies: [ .product(name: "Capacitor", package: "capacitor-swift-pm"), .product(name: "Cordova", package: "capacitor-swift-pm") ], path: "ios/Sources/BetterCrewlinkNativeServicePlugin"), .testTarget( name: "BetterCrewlinkNativeServicePluginTests", dependencies: ["BetterCrewlinkNativeServicePlugin"], path: "ios/Tests/BetterCrewlinkNativeServicePluginTests") ] ) ================================================ FILE: plugins/bcl-mobile-overlay/README.md ================================================ # bcl-mobile-overlay overlay for bcl mobile ## Install ```bash npm install bcl-mobile-overlay npx cap sync ``` ## API * [`disconnect()`](#disconnect) * [`showTalking(...)`](#showtalking) * [`showNotification(...)`](#shownotification) ### disconnect() ```typescript disconnect() => Promise<{ value: string; }> ``` **Returns:** Promise<{ value: string; }> -------------------- ### showTalking(...) ```typescript showTalking(options: { color: number; talking: boolean; }) => Promise<{ value: string; }> ``` | Param | Type | | ------------- | ------------------------------------------------- | | **`options`** | { color: number; talking: boolean; } | **Returns:** Promise<{ value: string; }> -------------------- ### showNotification(...) ```typescript showNotification(options: { audiomuted: boolean; micmuted: boolean; overlayEnabled: boolean; }) => Promise<{ value: string; }> ``` | Param | Type | | ------------- | --------------------------------------------------------------------------------- | | **`options`** | { audiomuted: boolean; micmuted: boolean; overlayEnabled: boolean; } | **Returns:** Promise<{ value: string; }> -------------------- ================================================ FILE: plugins/bcl-mobile-overlay/android/.gitignore ================================================ /build ================================================ FILE: plugins/bcl-mobile-overlay/android/build.gradle ================================================ ext { junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2' androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0' androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1' androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1' } buildscript { repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:8.7.2' } } apply plugin: 'com.android.library' android { namespace "io.bettercrewlink.plugin" compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35 defaultConfig { minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23 targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } lintOptions { abortOnError false } compileOptions { sourceCompatibility JavaVersion.VERSION_21 targetCompatibility JavaVersion.VERSION_21 } } repositories { google() mavenCentral() } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':capacitor-android') implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion" testImplementation "junit:junit:$junitVersion" androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" } ================================================ FILE: plugins/bcl-mobile-overlay/android/gradle/wrapper/gradle-wrapper.properties ================================================ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists ================================================ FILE: plugins/bcl-mobile-overlay/android/gradle.properties ================================================ # Project-wide Gradle settings. # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true # AndroidX package structure to make it clearer which packages are bundled with the # Android operating system, and which are packaged with your app's APK # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true ================================================ FILE: plugins/bcl-mobile-overlay/android/gradlew ================================================ #!/bin/sh # # Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # SPDX-License-Identifier: Apache-2.0 # ############################################################################## # # Gradle start up script for POSIX generated by Gradle. # # Important for running: # # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is # noncompliant, but you have some other compliant shell such as ksh or # bash, then to run this script, type that shell name before the whole # command line, like: # # ksh Gradle # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», # «${var#prefix}», «${var%suffix}», and «$( cmd )»; # * compound commands having a testable exit status, especially «case»; # * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # # (2) This script targets any POSIX shell, so it avoids extensions provided # by Bash, Ksh, etc; in particular arrays are avoided. # # The "traditional" practice of packing multiple parameters into a # space-separated string is a well documented source of bugs and security # problems, so this is (mostly) avoided, by progressively accumulating # options in "$@", and eventually passing that to Java. # # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; # see the in-line comments for details. # # There are tweaks for specific operating systems such as AIX, CygWin, # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. # ############################################################################## # Attempt to set APP_HOME # Resolve links: $0 may be a link app_path=$0 # Need this for daisy-chained symlinks. while APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path [ -h "$app_path" ] do ls=$( ls -ld "$app_path" ) link=${ls#*' -> '} case $link in #( /*) app_path=$link ;; #( *) app_path=$APP_HOME$link ;; esac done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s ' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum warn () { echo "$*" } >&2 die () { echo echo "$*" echo exit 1 } >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false case "$( uname )" in #( CYGWIN* ) cygwin=true ;; #( Darwin* ) darwin=true ;; #( MSYS* | MINGW* ) msys=true ;; #( NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD=$JAVA_HOME/jre/sh/java else JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else JAVACMD=java if ! command -v java >/dev/null 2>&1 then die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi # Collect all arguments for the java command, stacking in reverse order: # * args from the command line # * the main class name # * -classpath # * -D...appname settings # * --module-path (only if needed) # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) # Now convert the arguments - kludge to limit ourselves to /bin/sh for arg do if case $arg in #( -*) false ;; # don't mess with options #( /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath [ -e "$t" ] ;; #( *) false ;; esac then arg=$( cygpath --path --ignore --mixed "$arg" ) fi # Roll the args list around exactly as many times as the number of # args, so each arg winds up back in the position where it started, but # possibly modified. # # NB: a `for` loop captures its iteration list before it begins, so # changing the positional parameters here affects neither the number of # iterations, nor the values presented in `arg`. shift # remove old arg set -- "$@" "$arg" # push replacement arg done fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ org.gradle.wrapper.GradleWrapperMain \ "$@" # Stop when "xargs" is not available. if ! command -v xargs >/dev/null 2>&1 then die "xargs is not available" fi # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. # # In Bash we could simply go: # # readarray ARGS < <( xargs -n1 <<<"$var" ) && # set -- "${ARGS[@]}" "$@" # # but POSIX shell has neither arrays nor command substitution, so instead we # post-process each arg (as a line of input to sed) to backslash-escape any # character that might be a shell metacharacter, then use eval to reverse # that process (while maintaining the separation between arguments), and wrap # the whole thing up as a single "set" statement. # # This will of course break if any of these variables contains a newline or # an unmatched quote. # eval "set -- $( printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | xargs -n1 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | tr '\n' ' ' )" '"$@"' exec "$JAVACMD" "$@" ================================================ FILE: plugins/bcl-mobile-overlay/android/gradlew.bat ================================================ @rem @rem Copyright 2015 the original author or authors. @rem @rem Licensed under the Apache License, Version 2.0 (the "License"); @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem @rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS, @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem @rem SPDX-License-Identifier: Apache-2.0 @rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @rem @rem ########################################################################## @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Resolve any "." and ".." in APP_HOME to make it shorter. for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute echo. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 goto fail :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute echo. 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! set EXIT_CODE=%ERRORLEVEL% if %EXIT_CODE% equ 0 set EXIT_CODE=1 if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal :omega ================================================ FILE: plugins/bcl-mobile-overlay/android/proguard-rules.pro ================================================ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the # proguardFiles setting in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} # Uncomment this to preserve the line number information for # debugging stack traces. #-keepattributes SourceFile,LineNumberTable # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile ================================================ FILE: plugins/bcl-mobile-overlay/android/settings.gradle ================================================ include ':capacitor-android' project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') ================================================ FILE: plugins/bcl-mobile-overlay/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java ================================================ package com.getcapacitor.android; import static org.junit.Assert.*; import android.content.Context; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.platform.app.InstrumentationRegistry; import org.junit.Test; import org.junit.runner.RunWith; /** * Instrumented test, which will execute on an Android device. * * @see Testing documentation */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.getcapacitor.android", appContext.getPackageName()); } } ================================================ FILE: plugins/bcl-mobile-overlay/android/src/main/AndroidManifest.xml ================================================ ================================================ FILE: plugins/bcl-mobile-overlay/android/src/main/java/io/bettercrewlink/plugin/BetterCrewlinkNativeService.java ================================================ package io.bettercrewlink.plugin; import android.app.IntentService; import android.content.Intent; import com.getcapacitor.Bridge; public class BetterCrewlinkNativeService extends IntentService { public static final String REFRESH = "REFRESH"; public static final String MUTEAUDIO = "MUTEAUDIO"; public static final String MUTEMICROPHONE = "MUTEMICROPHONE"; public static final String DISCONNECT = "DISCONNECT"; // public static final String ACTION2 = "ACTION2"; Bridge bridge; public BetterCrewlinkNativeService() { super("BetterCrewlinkNativeService"); } public void setBridge(Bridge bridge) { this.bridge = bridge; } @Override public void onHandleIntent(Intent intent) { android.util.Log.d("BetterCrewlinkNativeService", "onHandleIntent called with action: " + (intent != null ? intent.getAction() : "null")); if(BetterCrewlinkNativeServicePlugin.bridgeP != null) { final String action = intent.getAction(); BetterCrewlinkNativeServicePlugin.bridgeP.triggerWindowJSEvent("bettercrewlink_notification", "{ 'action': '"+action+"' }"); } } } ================================================ FILE: plugins/bcl-mobile-overlay/android/src/main/java/io/bettercrewlink/plugin/BetterCrewlinkNativeServicePlugin.java ================================================ package io.bettercrewlink.plugin; import com.getcapacitor.JSObject; import com.getcapacitor.Plugin; import com.getcapacitor.PluginCall; import com.getcapacitor.PluginMethod; import com.getcapacitor.annotation.CapacitorPlugin; import com.getcapacitor.Bridge; import android.Manifest; import android.annotation.SuppressLint; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.provider.Settings; import android.net.Uri; import android.text.Html; import android.text.SpannableString; import java.util.Timer; import java.util.TimerTask; import static androidx.core.content.ContextCompat.getSystemService; import androidx.core.app.ActivityCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; @CapacitorPlugin(name = "BetterCrewlinkNativeService") public class BetterCrewlinkNativeServicePlugin extends Plugin { static Bridge bridgeP; private Boolean audionMuted = false; private boolean micMuted = false; private boolean timmerRunning = false; private boolean running = false; private boolean overlayShown = false; @PluginMethod() public void showNotification(PluginCall call) { Boolean audioMuted = call.getBoolean("audiomuted"); Boolean micMuted = call.getBoolean("micmuted"); Boolean overlayEnabled = call.getBoolean("overlayEnabled"); this.audionMuted = audioMuted; this.micMuted = micMuted; String message = call.getString("message"); String CallbackId = call.getCallbackId(); JSObject ret = new JSObject(); ret.put("result", "ok"); CreateNotification(); call.resolve(ret); CreateTimer(); OverlayService.updateMuteIcons(micMuted, audioMuted); if ((!overlayShown) && overlayEnabled && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (!Settings.canDrawOverlays(this.getContext())) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + this.getContext().getPackageName())); startActivityForResult(call, intent, 0); } else { Context context = this.getContext(); context.startService(new Intent(context, OverlayService.class)); overlayShown = true; } } if (overlayShown) { OverlayService.HideShow(false); } running = true; } @PluginMethod() public void showTalking(PluginCall call) { int color = call.getInt("color"); Boolean talking = call.getBoolean("talking"); Context context = this.getContext(); OverlayService.setVisible(color, talking); } @PluginMethod() public void disconnect(PluginCall call) { if (overlayShown) OverlayService.HideShow(true); running = false; } private void CreateTimer() { if (timmerRunning) { return; } timmerRunning = true; Timer t = new Timer(); t.scheduleAtFixedRate(new TimerTask() { @Override public void run() { OnTimerTick(); } }, 1000, 5000); } private void OnTimerTick() { if (running) CreateNotification(); } boolean NotifactionChannelCreated = false; private void createNotificationChannel() { if (NotifactionChannelCreated) { return; } // Create the NotificationChannel, but only on API 26+ because // the NotificationChannel class is new and not in the support library if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { CharSequence name = "1"; String description = "2"; int importance = NotificationManager.IMPORTANCE_DEFAULT; NotificationChannel channel = new NotificationChannel("1", name, importance); channel.setSound(null, null); channel.setDescription(description); // Register the channel with the system; you can't change the importance // or other notification behaviors after this NotificationManager notificationManager = getSystemService(this.getContext(), NotificationManager.class); notificationManager.createNotificationChannel(channel); } } public PendingIntent createAction(String action) { Intent intent = new Intent(this.getContext(), BetterCrewlinkNativeService.class); intent.setAction(action); PendingIntent piAction1 = PendingIntent.getService( this.getContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE ); return piAction1; } int notificationCount = 0; public void CreateNotification() { // createNotificationChannel(); bridgeP = bridge; BetterCrewlinkNativeService service = getSystemService(this.getContext(), BetterCrewlinkNativeService.class); PendingIntent refreshAction = createAction(BetterCrewlinkNativeService.REFRESH); String body = "Guus(red) talking
player2(lime) talking"; SpannableString spannableString = new SpannableString( Build.VERSION.SDK_INT < Build.VERSION_CODES.N ? Html.fromHtml(body) : Html.fromHtml(body, Html.FROM_HTML_MODE_LEGACY)); NotificationCompat.Builder builder = new NotificationCompat.Builder(this.getContext(), "bettercrewlink-background-id") .setSmallIcon(R.drawable.ic_notification) .setContentIntent(refreshAction) .setContentTitle("BetterCrewlink") .setContentText("Click to refresh or expand for more") // .setStyle(new // NotificationCompat.BigTextStyle().bigText(spannableString).setBigContentTitle("BetterCrewlink")) .addAction(0, "refresh", refreshAction) .addAction(0, this.micMuted ? "unmute" : "mute", createAction(BetterCrewlinkNativeService.MUTEMICROPHONE)) .addAction(0, this.audionMuted ? "undeafen" : "deafen", createAction(BetterCrewlinkNativeService.MUTEAUDIO)) .setAutoCancel(false) .setPriority(NotificationCompat.PRIORITY_DEFAULT); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this.getContext()); // notificationId is a unique int for each notification that you must define notificationManager.notify(-574543954, builder.build()); } } ================================================ FILE: plugins/bcl-mobile-overlay/android/src/main/java/io/bettercrewlink/plugin/OverlayService.java ================================================ package io.bettercrewlink.plugin; import android.app.Service; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.PixelFormat; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.view.GestureDetector; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ImageView; import android.widget.LinearLayout; import java.util.ArrayList; import java.util.List; import io.bettercrewlink.plugin.R; public class OverlayService extends Service { private WindowManager windowManager; private View iconsContainerView; private static List imageViews = new ArrayList(); private static ImageView audioImageView; private static ImageView micImageView; private static ImageView refreshImageview; private static boolean mic_muted = false; private static boolean audio_muted = false; enum OVERLAY_BUTTON { MICROPHONE, AUDIO, REFRESH } @Override public IBinder onBind(Intent intent) { return null; } public static void setVisible(int color, boolean visible) { if (color >= 0 && color <= 12) { runOnUiThread(new Runnable() { @Override public void run() { if (color < imageViews.size()) imageViews.get(color).setVisibility(visible ? View.VISIBLE : View.GONE); } }); } } public static void HideShow(boolean hide){ runOnUiThread(new Runnable() { @Override public void run() { if (audioImageView != null && micImageView != null && refreshImageview != null) { audioImageView.setVisibility(hide ? View.GONE : View.VISIBLE); micImageView.setVisibility(hide ? View.GONE : View.VISIBLE); refreshImageview.setVisibility(hide ? View.GONE : View.VISIBLE); } } }); } public static void updateMuteIcons(boolean mic_muted, boolean audio_muted) { OverlayService.mic_muted = mic_muted; OverlayService.audio_muted = audio_muted; runOnUiThread(new Runnable() { @Override public void run() { if (audioImageView != null && micImageView != null) { audioImageView.setImageResource(audio_muted ? R.drawable.audio_off : R.drawable.audio_on); micImageView.setImageResource(mic_muted ? R.drawable.mic_off : R.drawable.mic_on); } } }); } ImageView addImage(int resId, boolean addToViewList) { return addImage(resId, addToViewList, 40, 40); } ImageView addImage(int resId, boolean addToViewList, int width, int height) { float density = Resources.getSystem().getDisplayMetrics().density; int calcWidth = (int) (width * density); int calcHeight = (int) (height * density); LinearLayout row = iconsContainerView.findViewById(R.id.overlay_player_container); ImageView img = new ImageView(this); img.setImageResource(resId); row.addView(img); img.requestLayout(); ViewGroup.LayoutParams layoutParams = img.getLayoutParams(); layoutParams.width = calcWidth; layoutParams.height = calcHeight; if (addToViewList) { imageViews.add(img); } return img; } public void pressOverlayButton(OVERLAY_BUTTON button) { BetterCrewlinkNativeServicePlugin.bridgeP.triggerWindowJSEvent("press_overlay", "{ 'action': '" + button + "' }"); } @Override public void onCreate() { super.onCreate(); windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); iconsContainerView = LayoutInflater.from(this).inflate(R.layout.overlay_layout, null); refreshImageview = addImage(R.drawable.refresh_button, false); micImageView = addImage(mic_muted ? R.drawable.mic_off : R.drawable.mic_on, false); audioImageView = addImage(audio_muted ? R.drawable.audio_off : R.drawable.audio_on, false); for (int i = 0; i < 12; i++) { ImageView view = addImage(this.getResources().getIdentifier("playericon_" + i, "drawable", this.getPackageName()), true); view.setVisibility(View.GONE); } WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSPARENT); Context context = this; params.gravity = Gravity.TOP | Gravity.LEFT; params.x = 0; params.y = 100; AddTouchEventListner(context, iconsContainerView, params); windowManager.addView(iconsContainerView, params); } public void AddTouchEventListner(Context context, View view, WindowManager.LayoutParams params) { iconsContainerView.setOnTouchListener(new View.OnTouchListener() { private int initialX; private int initialY; private float initialTouchX; private float initialTouchY; private boolean side = false; private GestureDetector gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onDoubleTap(MotionEvent e) { LinearLayout row = iconsContainerView.findViewById(R.id.overlay_player_container); if (!side) { row.setOrientation(LinearLayout.VERTICAL); side = true; } else { row.setOrientation(LinearLayout.HORIZONTAL); side = false; } params.x = 0; params.y = 0; windowManager.updateViewLayout(iconsContainerView, params); return super.onDoubleTap(e); } }); boolean clickingOnVolume = false; boolean clickingOnMic = false; boolean clickingOnRefresh = false; @Override public boolean onTouch(View v, MotionEvent event) { // Log.w("OOF", "volumeImageView x: " + volumeImageView.getX() + " y:" + volumeImageView.getY() + " w: " + volumeImageView.getWidth() + " h: " + volumeImageView.getHeight() + " --> " + event.getX() + " -- " + event.getY()); gestureDetector.onTouchEvent(event); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: initialX = params.x; initialY = params.y; initialTouchX = event.getRawX(); initialTouchY = event.getRawY(); clickingOnVolume = event.getX() >= audioImageView.getX() && event.getX() <= audioImageView.getX() + audioImageView.getWidth() && event.getY() >= audioImageView.getY() && event.getY() <= audioImageView.getY() + audioImageView.getHeight(); clickingOnMic = event.getX() >= micImageView.getX() && event.getX() <= micImageView.getX() + micImageView.getWidth() && event.getY() >= micImageView.getY() && event.getY() <= micImageView.getY() + micImageView.getHeight(); clickingOnRefresh = event.getX() >= refreshImageview.getX() && event.getX() <= refreshImageview.getX() + refreshImageview.getWidth() && event.getY() >= refreshImageview.getY() && event.getY() <= refreshImageview.getY() + refreshImageview.getHeight(); return false; case MotionEvent.ACTION_UP: int movedPixels = Math.abs(initialX - params.x) + Math.abs(initialY - params.y); if (movedPixels > 10) { return false; } if (clickingOnMic) { pressOverlayButton(OVERLAY_BUTTON.MICROPHONE); } if (clickingOnVolume) { pressOverlayButton(OVERLAY_BUTTON.AUDIO); } if (clickingOnRefresh) { pressOverlayButton(OVERLAY_BUTTON.REFRESH); } return false; case MotionEvent.ACTION_MOVE: params.x = initialX + (int) (event.getRawX() - initialTouchX); params.y = initialY + (int) (event.getRawY() - initialTouchY); windowManager.updateViewLayout(iconsContainerView, params); return false; } return false; } }); } @Override public void onDestroy() { super.onDestroy(); if (iconsContainerView != null) windowManager.removeView(iconsContainerView); } private static void runOnUiThread(Runnable action) { new Handler(Looper.getMainLooper()).post(action); } } ================================================ FILE: plugins/bcl-mobile-overlay/android/src/main/res/.gitkeep ================================================ ================================================ FILE: plugins/bcl-mobile-overlay/android/src/main/res/layout/overlay_layout.xml ================================================ ================================================ FILE: plugins/bcl-mobile-overlay/android/src/test/java/com/getcapacitor/ExampleUnitTest.java ================================================ package com.getcapacitor; import static org.junit.Assert.*; import org.junit.Test; /** * Example local unit test, which will execute on the development machine (host). * * @see Testing documentation */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } } ================================================ FILE: plugins/bcl-mobile-overlay/ios/.gitignore ================================================ .DS_Store .build /Packages xcuserdata/ DerivedData/ .swiftpm/configuration/registries.json .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata .netrc ================================================ FILE: plugins/bcl-mobile-overlay/ios/Sources/BetterCrewlinkNativeServicePlugin/BetterCrewlinkNativeService.swift ================================================ import Foundation @objc public class BetterCrewlinkNativeService: NSObject { @objc public func echo(_ value: String) -> String { print(value) return value } } ================================================ FILE: plugins/bcl-mobile-overlay/ios/Sources/BetterCrewlinkNativeServicePlugin/BetterCrewlinkNativeServicePlugin.swift ================================================ import Foundation import Capacitor /** * Please read the Capacitor iOS Plugin Development Guide * here: https://capacitorjs.com/docs/plugins/ios */ @objc(BetterCrewlinkNativeServicePlugin) public class BetterCrewlinkNativeServicePlugin: CAPPlugin, CAPBridgedPlugin { public let identifier = "BetterCrewlinkNativeServicePlugin" public let jsName = "BetterCrewlinkNativeService" public let pluginMethods: [CAPPluginMethod] = [ CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise) ] private let implementation = BetterCrewlinkNativeService() @objc func echo(_ call: CAPPluginCall) { let value = call.getString("value") ?? "" call.resolve([ "value": implementation.echo(value) ]) } } ================================================ FILE: plugins/bcl-mobile-overlay/ios/Tests/BetterCrewlinkNativeServicePluginTests/BetterCrewlinkNativeServicePluginTests.swift ================================================ import XCTest @testable import BetterCrewlinkNativeServicePlugin class BetterCrewlinkNativeServiceTests: XCTestCase { func testEcho() { // This is an example of a functional test case for a plugin. // Use XCTAssert and related functions to verify your tests produce the correct results. let implementation = BetterCrewlinkNativeService() let value = "Hello, World!" let result = implementation.echo(value) XCTAssertEqual(value, result) } } ================================================ FILE: plugins/bcl-mobile-overlay/package.json ================================================ { "name": "bcl-mobile-overlay", "version": "0.0.1", "description": "overlay for bcl mobile", "main": "dist/plugin.cjs.js", "module": "dist/esm/index.js", "types": "dist/esm/index.d.ts", "unpkg": "dist/plugin.js", "files": [ "android/src/main/", "android/build.gradle", "dist/", "ios/Sources", "ios/Tests", "Package.swift", "BclMobileOverlay.podspec" ], "author": "", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/OhMyGuus/bcl-mobile-overlay.git" }, "bugs": { "url": "https://github.com/OhMyGuus/bcl-mobile-overlay/issues" }, "keywords": [ "capacitor", "plugin", "native" ], "scripts": { "verify": "npm run verify:ios && npm run verify:android && npm run verify:web", "verify:ios": "xcodebuild -scheme BclMobileOverlay -destination generic/platform=iOS", "verify:android": "cd android && ./gradlew clean build test && cd ..", "verify:web": "npm run build", "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint", "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format", "eslint": "eslint . --ext ts", "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java", "swiftlint": "node-swiftlint", "docgen": "docgen --api BetterCrewlinkNativeServicePlugin --output-readme README.md --output-json dist/docs.json", "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs", "clean": "rimraf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build" }, "devDependencies": { "@capacitor/android": "^7.0.0", "@capacitor/core": "^7.0.0", "@capacitor/docgen": "^0.3.0", "@capacitor/ios": "^7.0.0", "@ionic/eslint-config": "^0.4.0", "@ionic/prettier-config": "^4.0.0", "@ionic/swiftlint-config": "^2.0.0", "eslint": "^8.57.0", "prettier": "^3.4.2", "prettier-plugin-java": "^2.6.6", "rimraf": "^6.0.1", "rollup": "^4.30.1", "swiftlint": "^2.0.0", "typescript": "~4.1.5" }, "peerDependencies": { "@capacitor/core": ">=7.0.0" }, "prettier": "@ionic/prettier-config", "swiftlint": "@ionic/swiftlint-config", "eslintConfig": { "extends": "@ionic/eslint-config/recommended" }, "capacitor": { "ios": { "src": "ios" }, "android": { "src": "android" } } } ================================================ FILE: plugins/bcl-mobile-overlay/rollup.config.mjs ================================================ export default { input: 'dist/esm/index.js', output: [ { file: 'dist/plugin.js', format: 'iife', name: 'capacitorBetterCrewlinkNativeService', globals: { '@capacitor/core': 'capacitorExports', }, sourcemap: true, inlineDynamicImports: true, }, { file: 'dist/plugin.cjs.js', format: 'cjs', sourcemap: true, inlineDynamicImports: true, }, ], external: ['@capacitor/core'], }; ================================================ FILE: plugins/bcl-mobile-overlay/src/definitions.ts ================================================ export interface BetterCrewlinkNativeServicePlugin { disconnect(): Promise<{ value: string }>; showTalking(options: { color: number, talking: boolean }): Promise<{ value: string }>; showNotification(options: { audiomuted: boolean, micmuted: boolean, overlayEnabled: boolean }): Promise<{ value: string }>; } ================================================ FILE: plugins/bcl-mobile-overlay/src/index.ts ================================================ import { registerPlugin } from '@capacitor/core'; import type { BetterCrewlinkNativeServicePlugin } from './definitions'; const BetterCrewlinkNativeService = registerPlugin('BetterCrewlinkNativeService', { web: () => import('./web').then((m) => new m.BetterCrewlinkNativeServiceWeb()), }); export * from './definitions'; export { BetterCrewlinkNativeService }; ================================================ FILE: plugins/bcl-mobile-overlay/src/web.ts ================================================ import { WebPlugin } from '@capacitor/core'; import type { BetterCrewlinkNativeServicePlugin } from './definitions'; export class BetterCrewlinkNativeServiceWeb extends WebPlugin implements BetterCrewlinkNativeServicePlugin { disconnect(): Promise<{ value: string; }> { console.log('disconnect'); return Promise.resolve({ value: 'Disconnected' }); } showTalking({ color, talking }: { color: number; talking: boolean; }): Promise<{ value: string; }> { console.log('showTalking', { color, talking }); return Promise.resolve({ value: `Talking: ${talking}, Color: ${color}` }); } showNotification(_options: { audiomuted: boolean; micmuted: boolean; overlayEnabled: boolean; }): Promise<{ value: string; }> { console.log('showNotification', _options); return Promise.resolve({ value: 'Notification shown' }); } async echo(options: { value: string }): Promise<{ value: string }> { console.log('ECHO', options); return options; } } ================================================ FILE: plugins/bcl-mobile-overlay/tsconfig.json ================================================ { "compilerOptions": { "allowUnreachableCode": false, "declaration": true, "esModuleInterop": true, "inlineSources": true, "lib": ["dom", "es2017"], "module": "esnext", "moduleResolution": "node", "noFallthroughCasesInSwitch": true, "noUnusedLocals": true, "noUnusedParameters": true, "outDir": "dist/esm", "pretty": true, "sourceMap": true, "strict": true, "target": "es2017" }, "files": ["src/index.ts"] } ================================================ FILE: src/app/app-routing.module.ts ================================================ import { NgModule } from '@angular/core'; import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; import { SettingsComponent } from './pages/settings/settings.component'; import { GameComponent } from './pages/game/game.component'; const routes: Routes = [ { path: '', redirectTo: 'settings', pathMatch: 'full', }, { path: 'game', component: GameComponent, }, { path: 'settings', component: SettingsComponent, }, { path: '**', redirectTo: '/settings', pathMatch: 'full' }, ]; @NgModule({ imports: [RouterModule.forRoot(routes, {})], exports: [RouterModule], }) export class AppRoutingModule {} ================================================ FILE: src/app/app.component.html ================================================ BetterCrewlink Mobile v1.0.35 {{ p.title }} ================================================ FILE: src/app/app.component.scss ================================================ ion-menu ion-content { --background: var(--ion-item-background, var(--ion-background-color, #fff)); } ion-menu.md ion-content { --padding-start: 8px; --padding-end: 8px; --padding-top: 20px; --padding-bottom: 20px; } ion-menu.md ion-list { padding: 20px 0; } ion-menu.md ion-note { margin-bottom: 30px; } ion-menu.md ion-list-header, ion-menu.md ion-note { padding-left: 10px; } ion-menu.md ion-list#inbox-list { border-bottom: 1px solid var(--ion-color-step-150, #d7d8da); } ion-menu.md ion-list#inbox-list ion-list-header { font-size: 22px; font-weight: 600; min-height: 20px; } ion-menu.md ion-list#labels-list ion-list-header { font-size: 16px; margin-bottom: 18px; color: #757575; min-height: 26px; } ion-menu.md ion-item { --padding-start: 10px; --padding-end: 10px; border-radius: 4px; } ion-menu.md ion-item.selected { --background: rgba(var(--ion-color-primary-rgb), 0.14); } ion-menu.md ion-item.selected ion-icon { color: var(--ion-color-primary); } ion-menu.md ion-item ion-icon { color: #616e7e; } ion-menu.md ion-item ion-label { font-weight: 500; } ion-menu.ios ion-content { --padding-bottom: 20px; } ion-menu.ios ion-list { padding: 20px 0 0 0; } ion-menu.ios ion-note { line-height: 24px; margin-bottom: 20px; } ion-menu.ios ion-item { --padding-start: 16px; --padding-end: 16px; --min-height: 50px; } ion-menu.ios ion-item.selected ion-icon { color: var(--ion-color-primary); } ion-menu.ios ion-item ion-icon { font-size: 24px; color: #73849a; } ion-menu.ios ion-list#labels-list ion-list-header { margin-bottom: 8px; } ion-menu.ios ion-list-header, ion-menu.ios ion-note { padding-left: 16px; padding-right: 16px; } ion-menu.ios ion-note { margin-bottom: 8px; } ion-note { display: inline-block; font-size: 16px; color: var(--ion-color-medium-shade); } ion-item.selected { --color: var(--ion-color-primary); } .full-width-select{ max-width: unset !important; width: 100% !important; } .footer { position: fixed; bottom:0; width: 100%; justify-content : center; } ================================================ FILE: src/app/app.component.spec.ts ================================================ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { TestBed, waitForAsync } from '@angular/core/testing'; import { Platform } from '@ionic/angular'; import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; describe('AppComponent', () => { // tslint:disable-next-line let platformReadySpy, platformSpy; beforeEach(waitForAsync(() => { platformReadySpy = Promise.resolve(); platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy }); TestBed.configureTestingModule({ declarations: [AppComponent], imports: [RouterTestingModule], providers: [ { provide: Platform, useValue: platformSpy }, ], schemas: [CUSTOM_ELEMENTS_SCHEMA], }).compileComponents(); })); it('should create the app', async () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; expect(app).toBeTruthy(); }); it('should initialize the app', async () => { TestBed.createComponent(AppComponent); expect(platformSpy.ready).toHaveBeenCalled(); await platformReadySpy; }); it('should have menu labels', async () => { const fixture = await TestBed.createComponent(AppComponent); await fixture.detectChanges(); const app = fixture.nativeElement; const menuItems = app.querySelectorAll('ion-label'); expect(menuItems.length).toEqual(12); expect(menuItems[0].textContent).toContain('Inbox'); expect(menuItems[1].textContent).toContain('Outbox'); }); it('should have urls', async () => { const fixture = await TestBed.createComponent(AppComponent); await fixture.detectChanges(); const app = fixture.nativeElement; const menuItems = app.querySelectorAll('ion-item'); expect(menuItems.length).toEqual(12); expect(menuItems[0].getAttribute('ng-reflect-router-link')).toEqual('/folder/Inbox'); expect(menuItems[1].getAttribute('ng-reflect-router-link')).toEqual('/folder/Outbox'); }); }); ================================================ FILE: src/app/app.component.ts ================================================ import { Component, Inject, OnInit } from '@angular/core'; import { Storage } from '@ionic/storage'; import { SettingsService } from './services/settings.service'; @Component({ selector: 'app-root', templateUrl: 'app.component.html', styleUrls: ['app.component.scss'], }) export class AppComponent implements OnInit { public selectedIndex = 0; public appPages = [ { title: 'game', url: '/game', icon: 'home', }, { title: 'settings', url: '/settings', icon: 'settings', }, ]; constructor(private settingsService: SettingsService) { this.initializeApp(); } initializeApp() {} async ngOnInit() { console.log('AppComponent initialized'); this.settingsService.load(); } } ================================================ FILE: src/app/app.module.ts ================================================ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { RouteReuseStrategy } from '@angular/router'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; import { AppComponent } from './app.component'; import { AppRoutingModule } from './app-routing.module'; import { IonicStorageModule } from '@ionic/storage-angular'; import { Platform } from '@ionic/angular'; import { ServiceWorkerModule } from '@angular/service-worker'; import { environment } from '../environments/environment'; import { SettingsComponent } from './pages/settings/settings.component'; import { GameComponent } from './pages/game/game.component'; import { FormsModule } from '@angular/forms'; import { GlobalFooterComponent } from './compontents/global-footer/global-footer.component'; import { GlobalHeaderComponent } from './compontents/global-header/global-header.component'; import { AvatarComponent } from './compontents/avatar/avatar.component'; import { AndroidPermissions } from '@awesome-cordova-plugins/android-permissions/ngx'; import { BackgroundMode } from '@awesome-cordova-plugins/background-mode/ngx'; @NgModule({ declarations: [ AppComponent, GlobalFooterComponent, AvatarComponent, GlobalHeaderComponent, SettingsComponent, GameComponent, ], imports: [ BrowserModule, IonicModule.forRoot(), AppRoutingModule, IonicStorageModule.forRoot(), ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), FormsModule, ], providers: [ BackgroundMode, AndroidPermissions, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, Platform, ], bootstrap: [AppComponent], }) export class AppModule {} ================================================ FILE: src/app/compontents/avatar/avatar.component.html ================================================

{{ player.name }}

================================================ FILE: src/app/compontents/avatar/avatar.component.scss ================================================ .no-drag-img { user-select: none; -moz-user-select: none; -webkit-user-drag: none; -webkit-user-select: none; -ms-user-select: none; } .avatar { width: 100%; position: relative; transition: border-color 0.2s ease-out; border-style: solid; border-radius: 50%; padding-bottom: 100%; border-width: 2px; border-color: transparent; } .avatar-2 { cursor: pointer; overflow: hidden; position: absolute; // top: -2.5px; // left: -2.5px; border-width: 2px; transform: unset; } .volumeslider { position: absolute; width: 100%; border-radius: 20px; // height: 20px; background-color: #000000; //60 z-index: 40; height: 30px; } .volumeslider-1 { position: absolute; width: 90%; } .volumeSliderThingy { padding: 0px; margin-top: -5px; margin-left: 10px; } .skin { top: calc(33% + 22%); width: 105%; z-index: 3; position: absolute; left: -7px; } .base { width: 105%; position: absolute; top: 22%; left: -7px; z-index: 2; } .hat { cursor: pointer; position: absolute; display: block; left: -6px; top: -11%; z-index: 3; width: 100%; } .backlayerd-hat { z-index: 1; } .avatarBase { position: relative; // max-width: 75px // height: 500px; } .avatar.talking { border-color: limegreen !important; } .playername_container { width: 100%; z-index: 20; bottom: -6px; position: absolute; text-align: center; } .playername { font-weight: bold; color: white; text-align: center; padding: 5px 10px 5px 10px; background-color: rgb(0 0 0 / 69%); border-radius: 20px; } .noselect { -webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Safari */ -khtml-user-select: none; /* Konqueror HTML */ -moz-user-select: none; /* Old versions of Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */ user-select: none; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */ } ================================================ FILE: src/app/compontents/avatar/avatar.component.spec.ts ================================================ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; import { AvatarComponent } from './avatar.component'; describe('AvatarComponent', () => { let component: AvatarComponent; let fixture: ComponentFixture; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [AvatarComponent], imports: [IonicModule.forRoot()], }).compileComponents(); fixture = TestBed.createComponent(AvatarComponent); component = fixture.componentInstance; fixture.detectChanges(); })); it('should create', () => { expect(component).toBeTruthy(); }); }); ================================================ FILE: src/app/compontents/avatar/avatar.component.ts ================================================ import { Component, Input, OnInit } from '@angular/core'; import { Player } from '../../services/AmongUsState'; import { SocketElement, PlayerSetting } from '../../services/smallInterfaces'; import { SettingsService } from '../../services/settings.service'; const hatOffsets: { [key in number]: number | undefined } = { 7: -50, 21: -50, 28: -50, 35: -50, 77: -50, 90: -50, 94: -15, 103: -50, }; const coloredHats: number[] = [77, 90]; @Component({ selector: 'app-avatar', templateUrl: './avatar.component.html', styleUrls: ['./avatar.component.scss'], }) export class AvatarComponent implements OnInit { backLayerHats =new Set([39, 4, 6, 15, 29, 42, 75, 85, 102, 105, 106, 104, 103]); @Input() player: Player; @Input() talking: boolean; @Input() isDead: boolean = false; @Input() settings: PlayerSetting = undefined; volumeOpen: boolean; readonly MAXVOLUME = 500; constructor(private settingsService: SettingsService) {} clickable() { return this.settings !== undefined; } getHatY(): string { return `${(hatOffsets[this.player.hatId] || -33) + 22}%`; } getHatImage(): string { return coloredHats.includes(this.player.hatId) ? `${this.player.hatId}-${this.player.colorId}` : `${this.player.hatId}`; } openVolume(state = !this.volumeOpen) { console.log(this.settings); if (!this.settings) { return; } this.volumeOpen = state; } onVolumeChange() { console.log("Volume: ",this.player.nameHash, this.settings ) if (this.settings) { console.log("Volume: ",this.player.nameHash, this.settings ) this.settingsService.savePlayerSetting(this.player.nameHash, this.settings); } } ngOnInit() {} } ================================================ FILE: src/app/compontents/global-footer/global-footer.component.html ================================================ ================================================ FILE: src/app/compontents/global-footer/global-footer.component.scss ================================================ .round { width: 60px; height: 60px; justify-self: center !important; --border-radius: 30px; --vertical-align: middle; } ================================================ FILE: src/app/compontents/global-footer/global-footer.component.ts ================================================ import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-footer', templateUrl: './global-footer.component.html', styleUrls: ['./global-footer.component.scss'], }) export class GlobalFooterComponent implements OnInit { constructor() {} ngOnInit() {} } ================================================ FILE: src/app/compontents/global-header/global-header.component.html ================================================ Disconnect
BetterCrewlink
================================================ FILE: src/app/compontents/global-header/global-header.component.scss ================================================ .small-title { // font-size: 25px; //font-size: 2vw; } @media screen and (min-width: 1200px) { .small-title { // /-size: 25px; } } ================================================ FILE: src/app/compontents/global-header/global-header.component.spec.ts ================================================ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; import { GlobalHeaderComponent } from './global-header.component'; describe('GlobalHeaderComponent', () => { let component: GlobalHeaderComponent; let fixture: ComponentFixture; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [GlobalHeaderComponent], imports: [IonicModule.forRoot()], }).compileComponents(); fixture = TestBed.createComponent(GlobalHeaderComponent); component = fixture.componentInstance; fixture.detectChanges(); })); it('should create', () => { expect(component).toBeTruthy(); }); }); ================================================ FILE: src/app/compontents/global-header/global-header.component.ts ================================================ import { Component, OnInit } from '@angular/core'; import { GameHelperService } from 'src/app/services/game-helper.service'; @Component({ selector: 'app-header', templateUrl: './global-header.component.html', styleUrls: ['./global-header.component.scss'], }) export class GlobalHeaderComponent implements OnInit { constructor(public gameHelper: GameHelperService) {} ngOnInit(): void { } } ================================================ FILE: src/app/pages/game/game.component.html ================================================

Please go to the settings page to setup Crewlink

Settings Reconnect

{{gameHelper.getConnectionStage()}}

**Please make sure there is a PC user with "Mobile Host" enabled on Crewlink in the lobby**

refresh Settings Disconnect

Error

{{ gameHelper.getError() }}

refresh Settings
{{ gameHelper.cManager?.localPLayer?.name }} {{ gameHelper.cManager.currentGameCode }}
Refresh Disconnect
================================================ FILE: src/app/pages/game/game.component.scss ================================================ .masters { background-color: #25232a; } .fixedLabel { min-width: 20% !important; max-width: 20% !important; } .playerGrid { max-width: 450px; } .playersGrid { min-height: 400px; } .localPLayerRow { border-bottom: solid 1px #00000041; } @media only screen and (max-width: 1024) { .playerGrid { max-width: unset !important; } } .nameCode-code { width: fit-content; margin: 5px auto; display: block; padding: 5px; font-size: 28px; font-family: 'Source Code Pro', monospace; border-radius: 5px; } .nameCode-username { display: block; font-size: 20px; text-align: center; } .nameCode-Container { height: 100%; display: flex; align-items: center; flex-direction: column; justify-content: center; } .nameCode-Container1 { height: 100%; display: flex; align-items: center; flex-direction: column; justify-content: center; } .nameCode-Container { float: left; height: 100%; display: flex; align-items: center; flex-direction: column; justify-content: center; } .muteIcon { font-size: 200px; } .muteAndDeafenIcons-Container { float: left; width: 10px; height: 100%; display: flex; align-items: center; flex-direction: column; justify-content: center; } .testButtons { position: absolute; bottom:85px; left:5px } ================================================ FILE: src/app/pages/game/game.component.ts ================================================ import { Component, OnInit, ChangeDetectorRef } from '@angular/core'; import Peer from 'simple-peer'; import { GameHelperService } from 'src/app/services/game-helper.service'; import { IDeviceInfo } from 'src/app/services/smallInterfaces'; import { SocketElement } from '../../services/smallInterfaces'; import { Player } from '../../services/AmongUsState'; @Component({ selector: 'app-game', templateUrl: './game.component.html', styleUrls: ['./game.component.scss'], }) export class GameComponent implements OnInit { client: SocketIOClient.Socket; peerConnections: Array = []; constructor(public gameHelper: GameHelperService, private changeDetectorRef: ChangeDetectorRef) {} compareFn(e1: IDeviceInfo, e2: IDeviceInfo): boolean { return e1 && e2 ? e1.id === e2.id : false; } getValues(map) { return Array.from(map.values()); } getPlayers() { return Array.from(this.gameHelper.cManager.socketElements.values()) .filter((o) => o.player !== undefined) .sort((a, b) => a.player?.colorId - b.player?.colorId); } getValues2(map): SocketElement[] { return Array.from(map.values()); } ngOnInit() { console.log('ngOninit'); this.gameHelper.events.on('onChange', () => { this.changeDetectorRef.detectChanges(); }); } } ================================================ FILE: src/app/pages/settings/settings.component.html ================================================
Connection Settings: Voice server Better-Crewlink Custom server Custom server Ingame name Lobby code Overlay enabled NAT FIX Microphone {{ microphone.label }}
Connect Refresh disconnect
================================================ FILE: src/app/pages/settings/settings.component.scss ================================================ ion-label { max-width: 300px; min-width: 100px; border-right: 1px solid rgba(56, 49, 49, 0.274); margin-right: 5px; } ion-select { padding-left: 9px; max-width: unset !important; } ion-checkbox { margin-left: 9px; } .settingLabelCol { max-width: 200px !important; } .settingInputCol { max-width: 300px !important; } ================================================ FILE: src/app/pages/settings/settings.component.ts ================================================ import { Component, OnInit, ChangeDetectorRef } from '@angular/core'; import { GameHelperService } from 'src/app/services/game-helper.service'; import { IDeviceInfo } from 'src/app/services/smallInterfaces'; import { SettingsService } from '../../services/settings.service'; // const { OverlayPlugin } = Plugins; // const { BetterCrewlinkNativePlugin } = Plugins; @Component({ selector: 'app-settings', templateUrl: './settings.component.html', styleUrls: ['./settings.component.scss'], }) export class SettingsComponent implements OnInit { constructor( public gameHelper: GameHelperService, private changeDetectorRef: ChangeDetectorRef, private settings: SettingsService ) {} getSettings() { return this.settings.get(); } onSettingsChange() { this.settings.save(); console.log('Settings changed:', this.settings.get()); } compareFn(e1: IDeviceInfo, e2: IDeviceInfo): boolean { return e1 && e2 ? e1.id === e2.id : false; } // async test() { // alert((await BetterCrewlinkNativePlugin.showNotification({ message: 'CUSTOM MESSAGE' })).result); // // alert((await OverlayPlugin.echo({value: 'somefilter'})).value); // } ngOnInit() { this.gameHelper.events.on('onChange', () => { this.changeDetectorRef.detectChanges(); }); } } ================================================ FILE: src/app/services/AmongUsState.ts ================================================ import { ILobbySettings } from './smallInterfaces'; export interface MobileData { gameState: AmongUsState; lobbySettings: ILobbySettings; } export interface AmongUsState { gameState: GameState; oldGameState: GameState; lobbyCode: string; players: Player[]; isHost: boolean; clientId: number; hostId: number; comsSabotaged: boolean; lightRadius: number; } export interface Player { ptr: number; id: number; clientId: number; name: string; colorId: number; hatId: number; petId: number; skinId: number; disconnected: boolean; isImpostor: boolean; isDead: boolean; taskPtr: number; objectPtr: number; isLocal: boolean; nameHash: number; x: number; y: number; inVent: boolean; isbetter: boolean; } export enum GameState { LOBBY, TASKS, DISCUSSION, MENU, UNKNOWN, } ================================================ FILE: src/app/services/AudioController.service.ts ================================================ import { EventEmitter as EventEmitterO } from 'events'; import { AmongUsState, GameState, Player } from './AmongUsState'; import { SocketElement, AudioElement, IDeviceInfo } from './smallInterfaces'; import { ConnectingStage, ConnectionController } from './ConnectionController.service'; import VAD from './vad'; export default class AudioController { localTalking: boolean; constructor(private connectionController: ConnectionController) { this.audioElementsCotainer = document.getElementById('AudioElements'); } audioDeviceId = 'default'; stream: MediaStream; audioElementsCotainer: HTMLElement; permissionRequested: boolean; audioMuted: boolean; microphoneMuted: boolean; public events: EventEmitterO = new EventEmitterO(); async startAudio() { if (this.stream) { this.connectionController.updateConnectingStage(ConnectingStage.startingMicrophone); return; } const audio: MediaTrackConstraintSet = { deviceId: this.connectionController.deviceID, autoGainControl: false, echoCancellation: true, noiseSuppression: true, }; this.stream = await navigator.mediaDevices.getUserMedia({ video: false, audio }); const AudioContext = window.webkitAudioContext || window.AudioContext; const context = new AudioContext(); VAD(context, context.createMediaStreamSource(this.stream), undefined, { onVoiceStart: () => { this.localTalking = true; this.events.emit('local_talk', true); this.connectionController?.socketIOClient?.emit('VAD', true); }, onVoiceStop: () => { this.localTalking = false; this.events.emit('local_talk', false); this.connectionController?.socketIOClient?.emit('VAD', false); }, stereo: false, }); this.stream.getAudioTracks()[0].enabled = !this.microphoneMuted && !this.audioMuted; this.connectionController.updateConnectingStage(ConnectingStage.startingMicrophone); } changeMuteState(microphoneMuted: boolean, audioMuted: boolean) { this.microphoneMuted = microphoneMuted; this.audioMuted = audioMuted; if (this.audioMuted) { this.connectionController.socketElements.forEach((value) => { if (value?.audioElement?.gain?.gain) { value.audioElement.gain.gain.value = 0; } }); } this.stream.getAudioTracks()[0].enabled = !this.microphoneMuted && !this.audioMuted; // this might needs to be diffrent since it might open the app. } createAudioElement(stream: MediaStream, update: (bool: boolean) => void): AudioElement { console.log('[createAudioElement]'); const htmlAudioElement = document.createElement('audio'); htmlAudioElement.setAttribute('playsinline', 'true'); htmlAudioElement.setAttribute('controls', 'true'); this.audioElementsCotainer.appendChild(htmlAudioElement); htmlAudioElement.srcObject = stream; const AudioContext = window.webkitAudioContext || window.AudioContext; const context = new AudioContext(); const source = context.createMediaStreamSource(stream); const gain = context.createGain(); const pan = context.createPanner(); pan.refDistance = 0.1; pan.panningModel = 'equalpower'; pan.distanceModel = 'linear'; pan.maxDistance = this.connectionController.lobbySettings.maxDistance; pan.rolloffFactor = 1; gain.gain.value = 0; htmlAudioElement.volume = 1; const muffle = context.createBiquadFilter(); muffle.type = 'lowpass'; muffle.Q.value = 0; // const reverb = context.createConvolver(); // reverb.buffer = convolverBuffer.current; source.connect(pan); pan.connect(gain); const audioContext = pan.context; const panPos = [3, 0]; if (pan.positionZ) { pan.positionZ.setValueAtTime(-0.5, audioContext.currentTime); pan.positionX.setValueAtTime(panPos[0], audioContext.currentTime); pan.positionY.setValueAtTime(panPos[1], audioContext.currentTime); } else { pan.setPosition(panPos[0], panPos[1], -0.5); } gain.connect(context.destination); return { htmlAudioElement, audioContext: context, mediaStreamAudioSource: source, gain, pan, muffle, destination: context.destination, muffleConnected: false, } as AudioElement; } applyEffect(gain: AudioNode, effectNode: AudioNode, destination: AudioNode, player: Player) { try { gain.disconnect(destination); gain.connect(effectNode); effectNode.connect(destination); } catch { console.log('error with applying effect: ', player.name, effectNode); } } restoreEffect(gain: AudioNode, effectNode: AudioNode, destination: AudioNode, player: Player) { try { effectNode.disconnect(destination); gain.disconnect(effectNode); gain.connect(destination); } catch { console.log('error with applying effect: ', player.name, effectNode); } } // move to different controller updateAudioLocation(state: AmongUsState, element: SocketElement, localPLayer: Player): number { if (!element.audioElement || !element.client || !element.player || !localPLayer || this.audioMuted) { return 0; } // console.log('[updateAudioLocation]'); const pan = element.audioElement.pan; const gain = element.audioElement.gain; const muffle = element.audioElement.muffle; const audioContext = pan.context; // const reverb = element.audioElement.reverb; const destination = element.audioElement.destination; const lobbySettings = this.connectionController.lobbySettings; let maxdistance = lobbySettings.maxDistance; const other = element.player; // this.getPlayer(element.client?.clientId); let panPos = [other.x - localPLayer.x, other.y - localPLayer.y]; let endGain = 0; switch (state.gameState) { case GameState.MENU: endGain = 0; break; case GameState.LOBBY: endGain = 1; break; case GameState.TASKS: endGain = 1; if (lobbySettings.meetingGhostOnly) { endGain = 0; } if (!localPLayer.isDead && lobbySettings.commsSabotage && state.comsSabotaged && !localPLayer.isImpostor) { endGain = 0; } // Mute other players which are in a vent if ( other.inVent && !(lobbySettings.hearImpostorsInVents || (lobbySettings.impostersHearImpostersInvent && localPLayer.inVent)) ) { endGain = 0; } // if ( // lobbySettings.wallsBlockAudio && // !me.isDead && // poseCollide({ x: me.x, y: me.y }, { x: other.x, y: other.y }, gameState.map) // ) { // endGain = 0; // } if (!localPLayer.isDead && other.isDead && localPLayer.isImpostor && lobbySettings.haunting) { // if (!element.audioElement.reverbConnected) { // element.audioElement.reverbConnected = true; // this.applyEffect(gain, reverb, destination, other); // } endGain = 0.2; } else { if (other.isDead && !localPLayer.isDead) { endGain = 0; } } break; case GameState.DISCUSSION: panPos = [0, 0]; endGain = 1; // Mute dead players for still living players if (!localPLayer.isDead && other.isDead) { endGain = 0; } break; case GameState.UNKNOWN: default: endGain = 0; break; } if (!other.isDead || state.gameState !== GameState.TASKS || !localPLayer.isImpostor || localPLayer.isDead) { // if (element.audioElement.reverbConnected && reverb) { // element.audioElement.reverbConnected = false; // this.restoreEffect(gain, reverb, destination, other); // } } if (lobbySettings.deadOnly) { panPos = [0, 0]; if (!localPLayer.isDead || !other.isDead) { endGain = 0; } } const isOnCamera = false; // Muffling in vents if ( ((localPLayer.inVent && !localPLayer.isDead) || (other.inVent && !other.isDead)) && state.gameState === GameState.TASKS ) { if (!element.audioElement.muffleConnected) { element.audioElement.muffleConnected = true; this.applyEffect(gain, muffle, destination, other); } maxdistance = isOnCamera ? 3 : 0.8; muffle.frequency.value = isOnCamera ? 2300 : 2000; muffle.Q.value = isOnCamera ? -15 : 20; if (endGain === 1) { endGain = isOnCamera ? 0.8 : 0.5; } // Too loud at 1 } else { if (element.audioElement.muffleConnected) { element.audioElement.muffleConnected = false; this.restoreEffect(gain, muffle, destination, other); } } // Mute players if distancte between two players is too big // console.log({ x: other.x, y: other.y }, Math.sqrt(panPos[0] * panPos[0] + panPos[1] * panPos[1])); //console.log(state.currentCamera); if (Math.sqrt(panPos[0] * panPos[0] + panPos[1] * panPos[1]) > maxdistance) { return 0; } // if (!settings.enableSpatialAudio) { // panPos = [0, 0]; // } if (pan.positionZ) { pan.positionZ.setValueAtTime(-0.5, audioContext.currentTime); pan.positionX.setValueAtTime(panPos[0], audioContext.currentTime); pan.positionY.setValueAtTime(panPos[1], audioContext.currentTime); } else { pan.setPosition(panPos[0], panPos[1], -0.5); } return endGain; } disconnect() { if (this.stream) { this.stream.getTracks().forEach((track) => track.stop()); this.stream = undefined; } } disconnectElement(socketElement: SocketElement) { console.log('disconnectElement'); if (!socketElement.audioElement) { console.log('disconnectElement -> !socketElement.audioElement -> ', socketElement); return; } console.log('disconnectElement -> !uff?'); socketElement?.audioElement?.muffle?.disconnect(); socketElement?.audioElement?.pan?.disconnect(); socketElement?.audioElement?.gain?.disconnect(); socketElement?.audioElement?.mediaStreamAudioSource?.disconnect(); socketElement?.audioElement?.audioContext ?.close() .then(() => {}) .catch(() => {}); console.log('socketElement?.audioElement?.htmlAudioElement'); if (socketElement?.audioElement?.htmlAudioElement) { console.log('remove_element'); socketElement?.audioElement?.htmlAudioElement.remove(); } socketElement.peer?.destroy(); socketElement.audioElement = undefined; socketElement.peer = undefined; } async requestPermissions() { if (!this.permissionRequested) { const stream = await navigator.mediaDevices.getUserMedia({ video: false, audio: true }); stream.getTracks().forEach((track) => { track.stop(); }); this.permissionRequested = true; } } async getDevices(output: boolean = true): Promise { await this.requestPermissions(); let deviceId = 0; return (await navigator.mediaDevices.enumerateDevices()) .filter((o) => (o.kind === 'audiooutput' && output) || o.kind === 'audioinput') .sort((a, b) => b.kind.localeCompare(a.kind)) .map((o) => { const id = deviceId++; return { id, kind: o.kind, label: o.label || `mic ${o.kind.charAt(5)} ${id}`, deviceId: o.deviceId, }; }); } } ================================================ FILE: src/app/services/ConnectionController.service.ts ================================================ import { EventEmitter as EventEmitterO } from 'events'; import Peer from 'simple-peer'; import * as io from 'socket.io-client'; import { AmongUsState, GameState, Player, MobileData } from './AmongUsState'; import { SocketElementMap, SocketElement, Client, AudioElement, SocketClientMap, ILobbySettings, DEFAULT_LOBBYSETTINGS, } from './smallInterfaces'; import { DEFAULT_ICE_CONFIG, DEFAULT_ICE_CONFIG_TURN } from './turnServers'; import { Injectable } from '@angular/core'; import AudioController from './AudioController.service'; import { SettingsService } from './settings.service'; export enum ConnectionState { disconnected = 0, connecting = 1, conencted = 2, error = 3, } export enum ConnectingStage { connectingToVoiceServer = 0, startingMicrophone = 1, searchingForHost = 2, waitingForHostToEnable = 3, WaitingForGameData = 4, waitingForYouToJoin = 5, parsingGameData = 6, FullyConnected = 7, } interface mobileHostInfo { mobileHostInfo: { isHostingMobile: boolean; isGameHost: boolean; }; } export declare interface IConnectionController { currentGameState: AmongUsState; connectionState: ConnectionState; connectingStage: ConnectingStage; connect(voiceserver: string, gamecode: string, username: string, deviceID: string, natFix: boolean); } @Injectable({ providedIn: 'root', }) export class ConnectionController implements IConnectionController { socketIOClient: SocketIOClient.Socket; public currentGameState: AmongUsState; public oldGameState: AmongUsState; socketElements: SocketElementMap = new SocketElementMap(); amongusUsername: string; currentGameCode: string; connectingStage = 0; connectionState = ConnectionState.disconnected; gamecode: string; lastPing: number = -1; localPLayer: Player; deviceID: string; public lobbySettings: ILobbySettings = DEFAULT_LOBBYSETTINGS; natFix: boolean = false; public audioController: AudioController; public mobileHosts: Map = new Map(); private currentHost: string; private triedGameHost: boolean; private lastHostIndex = -1; public error: string | undefined; public events = new EventEmitterO(); constructor(private settingsService: SettingsService) { this.audioController = new AudioController(this); this.ConnectionCheck(); } updateConnectingStage(state: ConnectingStage) { if (this.connectingStage === state) { this.connectingStage += 1; } this.updateViews(); } private ConnectionCheck() { const recievedDataLength = Date.now() - this.lastPing; if (this.connectionState !== ConnectionState.disconnected && this.lastPing !== -1 && recievedDataLength > 2000) { let index = 0; const nextIndex = this.mobileHosts.size > this.lastHostIndex ? this.lastHostIndex + 1 : 0; this.mobileHosts.forEach((mobiledata, from) => { if (mobiledata.mobileHostInfo.isGameHost || (this.triedGameHost && index++ === nextIndex)) { this.currentHost = from; this.lastHostIndex = this.triedGameHost ? nextIndex : -1; this.socketIOClient?.emit('signal', { to: from, data: { mobilePlayerInfo: { code: this.gamecode, askingForHost: true } }, }); this.updateConnectingStage(ConnectingStage.waitingForHostToEnable); } }); this.triedGameHost = true; } else { this.triedGameHost = false; } setTimeout(() => this.ConnectionCheck(), 8000); } private getSocketElement(socketId: string): SocketElement { if (!this.socketElements.has(socketId)) { this.socketElements.set(socketId, new SocketElement(socketId)); } return this.socketElements.get(socketId); } public getSocketElementByClientID(clientId: number): SocketElement | undefined { return Array.from(this.socketElements.values()).find((o) => o.client?.clientId === clientId); } getPlayer(clientId: number): Player { // cache clientid & socketid return this.currentGameState.players.find((o) => o.clientId === clientId); } connect(voiceserver: string, gamecode: string, username: string, deviceID: string, natFix: boolean) { console.log('Connect called??'); this.socketElements.clear(); this.lobbySettings = DEFAULT_LOBBYSETTINGS; this.connectingStage = 0; this.lastPing = Date.now(); this.lastHostIndex = -1; this.connectionState = ConnectionState.connecting; this.gamecode = gamecode; this.amongusUsername = username; this.deviceID = deviceID; this.mobileHosts.clear(); this.natFix = natFix; this.currentGameState = undefined; this.oldGameState = undefined; this.initialize(voiceserver); } disconnect(disconnectAudio: boolean) { if (this.connectionState === ConnectionState.disconnected) { return; } this.connectionState = ConnectionState.disconnected; this.gamecode = ''; this.amongusUsername = ''; this.socketIOClient?.emit('leave'); this.socketIOClient?.disconnect(); this.disconnectSockets(); if (disconnectAudio) { this.audioController.disconnect(); } } private disconnectElement(element: SocketElement) { console.log('disconnectElement!!!'); if (!element) { return; } console.log('removing socket element form the list...'); this.socketElements.delete(element.socketId); this.audioController.disconnectElement(element); } private disconnectSockets() { for (const element of this.socketElements.values()) { this.disconnectElement(element); } } // move to different controller private async startAudio() { this.socketIOClient.on('join', async (peerId: string, client: Client) => { console.log('[client.join]', { peerId, client }); const elementByClient = this.getSocketElementByClientID(client.clientId); if (elementByClient) { this.disconnectElement(elementByClient); } const element = this.getSocketElement(peerId); element.client = client; this.ensurePeerConnection(element, true); }); } private ensurePeerConnection(element: SocketElement, initiator: boolean) { if (!element.peer) { element.peer = this.createPeerConnection(element.socketId, this.audioController.stream, initiator); } } private updateViews() { this.events.emit('onChange'); } private createPeerConnection(socketId: string, stream: MediaStream, initiator): Peer { console.log('[createPeerConnection1], ', { peerId: socketId }); const peer: Peer = new Peer({ stream, initiator, // @ts-ignore-line config: this.natFix ? DEFAULT_ICE_CONFIG_TURN : DEFAULT_ICE_CONFIG, objectMode: true, }); peer.on('connect', () => {}); peer.on('stream', (recievedDtream: MediaStream) => { console.log('stream recieved', { recievedDtream }); const socketElement = this.getSocketElement(socketId); const audioElement = this.audioController.createAudioElement(recievedDtream, (bool: boolean) => { socketElement.talking = bool; this.events.emit('player_talk', socketElement.client?.clientId ?? -1, bool); }); socketElement.audioElement = audioElement; console.log('ONSTREAM, ', socketElement, audioElement); }); peer.on('signal', (data) => { this.socketIOClient.emit('signal', { data, to: socketId, }); }); peer.on('close', () => { console.log('PEER ON CLOSE?'); const socketElement = this.getSocketElement(socketId); this.audioController.disconnectElement(socketElement); }); peer.on('error', (err) => { console.log('PEER ON error? : ', err); }); console.log(peer); console.log('peerConnections', this.socketElements); return peer; } private onLobbySettingsChange(settings: ILobbySettings) { let changed = false; Object.keys(this.lobbySettings).forEach((field: string) => { if (field in settings) { if (this.lobbySettings[field] !== settings[field]) { changed = true; this.lobbySettings[field] = settings[field]; } } }); if (changed) { this.socketElements.forEach((value) => { if (value.audioElement?.pan?.maxDistance) { value.audioElement.pan.maxDistance = this.lobbySettings.maxDistance; } }); } } private muteAll() { this.socketElements.forEach((value) => { if (value?.audioElement?.gain) { value.audioElement.gain.gain.value = 0; } }); } private onGameStateChange(amongUsState: AmongUsState) { try { // console.log(this.socketElements); this.oldGameState = this.currentGameState; this.currentGameState = amongUsState; const newLocalplayer = amongUsState.players.filter( (o) => o.name.replace(' ', '') === this.amongusUsername.replace(' ', '') )[0]; this.updateConnectingStage(ConnectingStage.WaitingForGameData); if (!newLocalplayer) { this.muteAll(); // if localplayer not found mute all players in lobby. return; } else { this.updateConnectingStage(ConnectingStage.waitingForYouToJoin); } if ( this.connectionState === ConnectionState.conencted && this.localPLayer && (this.localPLayer.id !== newLocalplayer.id || this.localPLayer.clientId !== newLocalplayer.clientId) ) { this.socketIOClient.emit('id', newLocalplayer.id, newLocalplayer.clientId); } this.localPLayer = newLocalplayer; if (this.connectionState === ConnectionState.connecting || this.currentGameCode !== this.gamecode) { this.currentGameCode = this.gamecode; console.log(this.localPLayer); this.startAudio().then(() => { this.socketIOClient.emit('join', this.gamecode, this.localPLayer.id, this.localPLayer.clientId); this.socketIOClient.emit('id', this.localPLayer.id, this.localPLayer.clientId); }); this.updateConnectingStage(ConnectingStage.parsingGameData); this.connectionState = ConnectionState.conencted; } this.socketElements.forEach((value) => { if (value.client?.clientId === this.localPLayer?.clientId) { return; } value.updatePLayer(this); if (value.player) { value.player.isbetter = this.mobileHosts.has(value.socketId); } if (!value.settings && value.player) { value.settings = this.settingsService.getPlayerSettings(value.player?.nameHash); } if (value?.audioElement?.gain) { let endGain = this.audioController.updateAudioLocation(this.currentGameState, value, this.localPLayer); if (value.settings && endGain > 0) { endGain *= value.settings.volume / 100; } value.audioElement.gain.gain.value = endGain; value.audible = endGain > 0; } }); } catch (e) { console.error("ERROR:", e); this.error = e.message; this.connectionState = ConnectionState.error; } } private initialize(serverUrl: string) { this.socketIOClient?.disconnect(); console.log('[Connect] got called'); this.socketIOClient = io(serverUrl, { transports: ['websocket'], }); this.socketIOClient.on('error', (error: string) => { console.log('[client.error', error); }); this.socketIOClient.on('connect', () => { console.log('[client.connect]'); if (this.connectionState !== ConnectionState.disconnected) { this.updateConnectingStage(ConnectingStage.connectingToVoiceServer); this.connectionState = ConnectionState.connecting; // resetting it to connecting since connection to voice server got reset; this.audioController.startAudio().then(() => { this.socketIOClient.emit('join', this.gamecode + '_mobile', Number(Date.now()), Number(Date.now())); }); } }); this.socketIOClient.on('disconnect', () => { console.log('[client.disconnect]'); }); this.socketIOClient.on('setClient', (socketId: string, client: Client) => { console.log('[client.setClient]', { socketId, client }); const socketElement = this.getSocketElementByClientID(client.clientId); if (socketElement && socketElement.socketId !== socketId) { this.disconnectElement(socketElement); } this.getSocketElement(socketId).client = client; }); this.socketIOClient.on('setClients', (clients: SocketClientMap) => { console.log('[client.setClients]', { clients }); for (const socketId of Object.keys(clients)) { const socketElement = this.getSocketElementByClientID(clients[socketId].clientId); if (socketElement && socketElement.socketId !== socketId) { this.disconnectElement(socketElement); } else { this.getSocketElement(socketId).client = clients[socketId]; } } }); this.socketIOClient.on('VAD', (data: { activity: boolean; client: Client; socketId: string }) => { let socketElement = this.getSocketElementByClientID(data.client.clientId); if (socketElement) { socketElement.talking = data.activity; this.events.emit('player_talk', socketElement.client?.clientId ?? -1, data.activity); } }); this.socketIOClient.on('signal', ({ data, from }: { data: any; from: string }) => { if (data.hasOwnProperty('mobileHostInfo')) { const mobiledata = data as mobileHostInfo; this.mobileHosts.set(from, mobiledata); this.updateConnectingStage(ConnectingStage.searchingForHost); return; } if (data.hasOwnProperty('gameState')) { this.lastPing = Date.now(); this.updateConnectingStage(ConnectingStage.waitingForHostToEnable); const mobiledata = data as MobileData; this.onLobbySettingsChange(mobiledata.lobbySettings); this.onGameStateChange(mobiledata.gameState); return; } if (!this.audioController.stream) { return; } const socketElement = this.getSocketElement(from); this.ensurePeerConnection(socketElement, false); socketElement.peer.signal(data); }); } } ================================================ FILE: src/app/services/game-helper.service.ts ================================================ import { ChangeDetectorRef, Injectable } from '@angular/core'; import { ISettings, IDeviceInfo, VoiceServerOption } from './smallInterfaces'; import { AndroidPermissions } from '@awesome-cordova-plugins/android-permissions/ngx';import { Platform } from '@ionic/angular'; import { ConnectingStage, ConnectionController, ConnectionState } from './ConnectionController.service'; import { EventEmitter as EventEmitterO } from 'events'; import { BackgroundMode } from '@awesome-cordova-plugins/background-mode/ngx'; import { element } from 'protractor'; import { SettingsService } from './settings.service'; import { BetterCrewlinkNativeService } from 'bcl-mobile-overlay'; export declare interface IGameHelperService { } @Injectable({ providedIn: 'root', }) export class GameHelperService implements IGameHelperService { microphones: IDeviceInfo[] = []; IsMobile: boolean = false; error: string; events: EventEmitterO = new EventEmitterO(); audioMuted = () => this.cManager.audioController.audioMuted ?? false; microphoneMuted = () => (this.cManager.audioController.microphoneMuted || this.cManager.audioController.audioMuted) ?? false; localTalking = () => this.cManager?.audioController?.localTalking ?? false; constructor( private androidPermissions: AndroidPermissions, public platform: Platform, public cManager: ConnectionController, private backgroundMode: BackgroundMode, private settings: SettingsService ) { this.IsMobile = true;//this.platform.is('cordova') || this.platform.is('android') || this.platform.is('mobile'); this.load(); } reconnect() { this.cManager.disconnect(false); this.cManager.connect( this.settings.getVoiceServer(), this.settings.get().gamecode.toUpperCase(), this.settings.get().username, this.settings.get().selectedMicrophone.deviceId, this.settings.get().natFix ); setTimeout(() => { this.updateViews(); }, 1500); } connect() { this.disconnect(false); this.requestPermissions().then((haspermissions) => { if (!haspermissions) { console.error('permissions failed'); this.cManager.connectionState = ConnectionState.error; this.error = 'No permissions to use microphone.'; return; } this.backgroundMode.enable(); this.cManager.connect( this.settings.getVoiceServer(), this.settings.get().gamecode.toUpperCase(), this.settings.get().username, this.settings.get().selectedMicrophone.deviceId, this.settings.get().natFix ); this.showNotification(); }); setTimeout(() => { this.updateViews(); }, 1500); } disconnect(disableBackgroundMode = true) { if (disableBackgroundMode) { this.backgroundMode.disable(); if (this.IsMobile) { BetterCrewlinkNativeService.disconnect(); } } this.cManager.disconnect(true); } muteMicrophone() { this.cManager.audioController.changeMuteState(!this.cManager.audioController.microphoneMuted, false); this.showNotification(); } muteAudio() { this.cManager.audioController.changeMuteState( this.cManager.audioController.microphoneMuted, !this.cManager.audioController.audioMuted ); this.showNotification(); } async showNotification() { if (!this.IsMobile) return; console.log('showNotification BCL PLUGIN'); await BetterCrewlinkNativeService.showNotification({ audiomuted: this.audioMuted(), micmuted: this.microphoneMuted(), overlayEnabled: this.settings.get().overlayEnabled, }); } getError(): string { return this.error; } async requestPermissions(): Promise { if (this.platform.is('cordova') || this.platform.is('android')) { const PERMISSIONS_NEEDED = [ 'android.permission.BLUETOOTH', // this.androidPermissions.PERMISSION.RECORD_AUDIO, // this.androidPermissions.PERMISSION.INTERNET, ]; try { const reqPermissionRespons = await this.androidPermissions.requestPermissions(PERMISSIONS_NEEDED); for (const permission of PERMISSIONS_NEEDED) { const permissionResponse = await this.androidPermissions.checkPermission(permission); if (!permissionResponse.hasPermission) { return true; } } } catch (exception) { // this.error = 'Bluetooth audio permission denied'; return true; } } try { await this.cManager.audioController.requestPermissions(); } catch (exception) { this.error = 'No permission to use microphone'; return false; } return true; } getConnectionStage() { const test = ['LOBBY', 'TASKS', 'DISCUSSION', 'MENU', 'UNKNOWN']; switch (this.cManager.connectingStage) { case ConnectingStage.connectingToVoiceServer: return 'Connecting to voice server..'; case ConnectingStage.startingMicrophone: return 'Initializing audio/microphone'; case ConnectingStage.searchingForHost: return `Searching for bettercrewlink PC players in lobby: ${this.cManager.gamecode}`; case ConnectingStage.waitingForHostToEnable: return 'Waiting for a PC player to respond'; case ConnectingStage.WaitingForGameData: return 'Waiting to recieve gamedata from player'; case ConnectingStage.waitingForYouToJoin: return `Waiting for you to join with the name ${this.cManager.amongusUsername} --> ${ test[this.cManager.oldGameState.gameState.toString()] }`; case ConnectingStage.parsingGameData: return 'Waiting for gamedata...'; case ConnectingStage.FullyConnected: return 'Connected to the game...'; default: return `unkown state ${this.cManager.connectingStage}`; } } updateViews() { this.events.emit('onChange'); } load() { console.log('load??'); this.cManager.events.on('onchange', () => { this.updateViews(); }); this.cManager.audioController.getDevices(this.IsMobile).then((devices) => { this.microphones = devices; if (!this.microphones.some((o) => o.id === this.settings.get().selectedMicrophone?.id)) { this.settings.get().selectedMicrophone = devices.filter((o) => o.kind === 'audioinput')[0] ?? { id: 0, label: 'default', deviceId: 'default', kind: 'audioinput', }; } else { this.settings.get().selectedMicrophone = this.microphones.find( (o) => o.id === this.settings.get().selectedMicrophone.id ); } }); // this.connect(); window.addEventListener('bettercrewlink_notification', (info: any) => { console.log('[EVENT] bettercrewlink_notification: ', JSON.stringify(info)); switch (info.action) { case 'REFRESH': { this.reconnect(); break; } case 'MUTEAUDIO': { this.muteAudio(); break; } case 'MUTEMICROPHONE': { this.muteMicrophone(); break; } case 'DISCONNECT': { this.disconnect(true); break; } default: { console.log('unkown notification action: ', info); break; } } console.log('Notification action done'); }); this.cManager.events.on('player_talk', async (clientId: number, talking: boolean) => { if (!this.IsMobile) { return; } setTimeout( () => { const sElement = this.cManager.getSocketElementByClientID(clientId); if (sElement && sElement.player && sElement.talking === talking) { BetterCrewlinkNativeService.showTalking({ color: sElement.player?.colorId, talking, }); } }, talking ? 0 : 2000 ); }); this.cManager.audioController.events.on('local_talk', async (talking: boolean) => { if (!this.IsMobile) { return; } setTimeout( () => { if (talking === this.localTalking() && this.cManager.localPLayer) { BetterCrewlinkNativeService.showTalking({ color: this.cManager.localPLayer.colorId, talking, }); } }, talking ? 0 : 2000 ); }); window.addEventListener('press_overlay', (info: any) => { console.log('[EVENT] press_overlay: ', JSON.stringify(info)); if (info.action === 'MICROPHONE') { this.muteMicrophone(); } else if (info.action === 'AUDIO') { this.muteAudio(); } else if (info.action === 'REFRESH') { this.reconnect(); } }); // LocalNotifications.on('yes').subscribe((notification) => { // this.connect(); // this.showNotification(); // }); // LocalNotifications.on('click').subscribe((notification) => { // this.connect(); // this.showNotification(); // }); } } ================================================ FILE: src/app/services/settings.service.ts ================================================ import { Injectable, OnInit } from '@angular/core'; import { VoiceServerOption, ISettings, PlayerSettingsMap, PlayerSetting } from './smallInterfaces'; import { Platform } from '@ionic/angular'; import { Storage } from '@ionic/storage'; const DEFAULTSETTINGS: ISettings = { gamecode: '', voiceServerOption: VoiceServerOption.BETTERCREWLINK, customVoiceServer: 'https://bettercrewl.ink', username: '', selectedMicrophone: { id: 0, label: 'default', deviceId: 'default', kind: 'audioinput' }, natFix: false, playerSettings: new PlayerSettingsMap(), overlayEnabled: false, isMobile: false }; const DEFAULTPLAYERSETTING: PlayerSetting = { volume: 100, }; @Injectable({ providedIn: 'root', }) export class SettingsService { private settings: ISettings | undefined = DEFAULTSETTINGS; IsMobile: boolean; loaded = false; constructor(private storage: Storage, private platform: Platform) { this.IsMobile = this.platform.is('cordova') || this.platform.is('capacitor'); } get() { if (this.settings.isMobile !== this.IsMobile) { this.settings.isMobile = this.IsMobile; } return this.settings; } getPlayerSettings(nameHash: number): PlayerSetting { if (!this.settings.playerSettings.has(nameHash)) { return { ...DEFAULTPLAYERSETTING }; } return this.settings.playerSettings.get(nameHash); } savePlayerSetting(nameHash: number, playerSetting: PlayerSetting) { this.settings.playerSettings.set(nameHash, playerSetting); this.save(); } getVoiceServer() { switch (this.settings.voiceServerOption) { case VoiceServerOption.ORIGINALCREWLINK: case VoiceServerOption.BETTERCREWLINK: return 'https://bettercrewl.ink'; case VoiceServerOption.CUSTOM: return !this.IsMobile && this.settings.customVoiceServer.includes('//crewl.ink') ? 'https://ubuntu1.guus.info' : this.settings.customVoiceServer; } } save() { this.storage.set('settings', this.settings); } async load() { if (this.loaded) { return; } this.storage.create(); this.loaded = true; const loadedSettings = await this.storage.get('settings'); console.log('loaded settings: ', loadedSettings); if (loadedSettings && loadedSettings !== null) { for (const key of Object.keys(this.settings)) { if (key in loadedSettings) { this.settings[key] = loadedSettings[key]; } } } } } ================================================ FILE: src/app/services/smallInterfaces.ts ================================================ import Peer from 'simple-peer'; import { Player, GameState } from './AmongUsState'; import { ConnectionController } from './ConnectionController.service'; export enum VoiceServerOption { ORIGINALCREWLINK = 0, BETTERCREWLINK = 1, CUSTOM = 2, } export interface PlayerSetting { volume: number; } export interface ISettings { voiceServerOption: VoiceServerOption; customVoiceServer: string; username: string; gamecode: string; selectedMicrophone: IDeviceInfo; natFix: boolean; playerSettings: PlayerSettingsMap; overlayEnabled: boolean; isMobile: boolean; } export interface Client { playerId: number; clientId: number; } export interface SocketClientMap { [socketId: string]: Client; } export interface IDeviceInfo { kind: string; label: string; deviceId: string; id: number; } export interface AudioElement { htmlAudioElement: HTMLAudioElement; audioContext: AudioContext; mediaStreamAudioSource: MediaStreamAudioSourceNode; gain: GainNode; pan: PannerNode; muffle: BiquadFilterNode; // reverb: ConvolverNode; destination: AudioNode; // reverbConnected: boolean; muffleConnected: boolean; } export interface ILobbySettings { maxDistance: number; haunting: boolean; hearImpostorsInVents: boolean; impostersHearImpostersInvent: boolean; commsSabotage: boolean; deadOnly: boolean; meetingGhostOnly: boolean; hearThroughCameras: boolean; wallsBlockAudio: boolean; } export const DEFAULT_LOBBYSETTINGS: ILobbySettings = { maxDistance: 5.32, haunting: false, hearImpostorsInVents: false, impostersHearImpostersInvent: false, commsSabotage: false, deadOnly: false, hearThroughCameras: false, wallsBlockAudio: false, meetingGhostOnly: false, }; export class SocketElement { socketId: string; peer?: Peer; client?: Client; audioElement?: AudioElement; player?: Player; talking: boolean = false; audible: boolean = false; isDead: boolean; settings: PlayerSetting | undefined; constructor(socketId: string, peer?: Peer, client?: Client, audioElement?: AudioElement, player?: Player) { this.socketId = socketId; this.peer = peer; this.client = client; this.audioElement = audioElement; this.player = player; } updatePLayer(connectionController: ConnectionController) { this.player = this.client ? connectionController.getPlayer(this.client?.clientId) : undefined; if (this.isDead && !this.player?.isDead) { this.isDead = false; } else if ( this.player?.isDead && (connectionController.localPLayer.isDead || connectionController.oldGameState?.gameState === GameState.DISCUSSION || connectionController.oldGameState.gameState === GameState.LOBBY) ) { this.isDead = true; } if (this.player && this.client && this.player.disconnected) { this.client.clientId = -100; this.player.clientId = -100; } } } export class SocketElementMap extends Map {} export class PlayerSettingsMap extends Map {} ================================================ FILE: src/app/services/turnServers.ts ================================================ export const DEFAULT_ICE_CONFIG: RTCConfiguration = { iceTransportPolicy: 'all', iceServers: [ { urls: 'stun:stun.l.google.com:19302', }, ], }; export const DEFAULT_ICE_CONFIG_TURN: RTCConfiguration = { iceTransportPolicy: 'relay', iceServers: [ { urls: 'turn:turn.bettercrewl.ink:3478', username: 'M9DRVaByiujoXeuYAAAG', credential: 'TpHR9HQNZ8taxjb3', } ], }; ================================================ FILE: src/app/services/vad.ts ================================================ export interface VADOptions { fftSize: number; bufferLen: number; smoothingTimeConstant: number; minCaptureFreq: number; maxCaptureFreq: number; noiseCaptureDuration: number; minNoiseLevel: number; maxNoiseLevel: number; avgNoiseMultiplier: number; onVoiceStart: () => void; onVoiceStop: () => void; onUpdate: (val: number) => void; stereo: boolean; } function clamp(value: number, min: number, max: number): number { return min < max ? (value < min ? min : value > max ? max : value) : value < max ? max : value > min ? min : value; } // https://github.com/Jam3/audio-frequency-to-index function frequencyToIndex(frequency: number, sampleRate: number, frequencyBinCount: number): number { const nyquist = sampleRate / 2; const index = Math.round((frequency / nyquist) * frequencyBinCount); return clamp(index, 0, frequencyBinCount); } // https://github.com/Jam3/analyser-frequency-average function analyserFrequency(analyser: AnalyserNode, frequencies: Uint8Array, minHz: number, maxHz: number): number { const sampleRate = analyser.context.sampleRate; const binCount = analyser.frequencyBinCount; let start = frequencyToIndex(minHz, sampleRate, binCount); const end = frequencyToIndex(maxHz, sampleRate, binCount); const count = end - start; let sum = 0; for (; start < end; start++) { sum += frequencies[start] / 255; } return count === 0 ? 0 : sum / count; } export default function ( audioContext: AudioContext, source: AudioNode, destination: AudioNode | undefined, opts: Partial ): { destination: AudioNode; connect: () => void; destroy: () => void; init: () => void; options: VADOptions; } { opts = opts || {}; const defaults: VADOptions = { fftSize: 1024, bufferLen: 1024, smoothingTimeConstant: 0.2, minCaptureFreq: 85, // in Hz maxCaptureFreq: 255, // in Hz noiseCaptureDuration: 1000, // in ms minNoiseLevel: 0.15, // from 0 to 1 maxNoiseLevel: 0.7, // from 0 to 1 avgNoiseMultiplier: 1.2, onVoiceStart: function () { /* DO NOTHING */ }, onVoiceStop: function () { /* DO NOTHING */ }, onUpdate: function () { /* DO NOTHING */ }, stereo: true }; const options: VADOptions = Object.assign({}, defaults, opts); let baseLevel = 0; let voiceScale = 1; let activityCounter = 0; const activityCounterMin = 0; const activityCounterMax = 30; const activityCounterThresh = 5; let envFreqRange: number[] = []; let isNoiseCapturing = true; let prevVadState: boolean | undefined = undefined; let vadState = false; let captureTimeout: number | null = null; // var source = audioContext.createMediaStreamSource(stream); const analyser = audioContext.createAnalyser(); analyser.smoothingTimeConstant = options.smoothingTimeConstant; analyser.fftSize = options.fftSize; const channels = options.stereo ? 2 : 1; const scriptProcessorNode = audioContext.createScriptProcessor(options.bufferLen, channels, channels); connect(); scriptProcessorNode.onaudioprocess = monitor; if (isNoiseCapturing) { //console.log('VAD: start noise capturing'); captureTimeout = (setTimeout(init, options.noiseCaptureDuration) as unknown) as number; } function init() { //console.log('VAD: stop noise capturing'); isNoiseCapturing = false; envFreqRange = envFreqRange .filter(function (val) { return val; }) .sort(); const averageEnvFreq = envFreqRange.length ? envFreqRange.reduce(function (p, c) { return Math.min(p, c); }, 1) : options.minNoiseLevel || 0.1; baseLevel = averageEnvFreq * options.avgNoiseMultiplier; if (options.minNoiseLevel && baseLevel < options.minNoiseLevel) baseLevel = options.minNoiseLevel; if (options.maxNoiseLevel && baseLevel > options.maxNoiseLevel) baseLevel = options.maxNoiseLevel; voiceScale = 1 - baseLevel; // console.log('VAD: base level:', options.minNoiseLevel); } function connect() { source.connect(analyser); analyser.connect(scriptProcessorNode); if (destination) scriptProcessorNode.connect(destination); else scriptProcessorNode.connect(audioContext.destination); } function disconnect() { scriptProcessorNode.disconnect(); analyser.disconnect(); source.disconnect(); if (destination) { destination.disconnect(); source.connect(destination); } } function destroy() { captureTimeout && clearTimeout(captureTimeout); disconnect(); scriptProcessorNode.onaudioprocess = null; } function monitor(event: AudioProcessingEvent) { if (destination) { for (let channel = 0; channel < event.outputBuffer.numberOfChannels; channel++) { const inputData = event.inputBuffer.getChannelData(channel); const outputData = event.outputBuffer.getChannelData(channel); for (let sample = 0; sample < event.inputBuffer.length; sample++) { // make output equal to the same as the input outputData[sample] = inputData[sample]; } } } const frequencies = new Uint8Array(analyser.frequencyBinCount); analyser.getByteFrequencyData(frequencies); const average = analyserFrequency(analyser, frequencies, options.minCaptureFreq, options.maxCaptureFreq); if (isNoiseCapturing) { envFreqRange.push(average); return; } if (average >= baseLevel && activityCounter < activityCounterMax) { activityCounter++; } else if (average < baseLevel && activityCounter > activityCounterMin) { activityCounter--; } vadState = activityCounter > activityCounterThresh; if (prevVadState !== vadState) { vadState ? onVoiceStart() : onVoiceStop(); prevVadState = vadState; } options.onUpdate(Math.max(0, average - baseLevel) / voiceScale); } function onVoiceStart() { options.onVoiceStart(); } function onVoiceStop() { options.onVoiceStop(); } return { destination: analyser, connect, destroy, options, init }; } ================================================ FILE: src/environments/environment.ts ================================================ // This file can be replaced during build by using the `fileReplacements` array. // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. // The list of file replacements can be found in `angular.json`. export const environment = { production: false, }; /* * For easier debugging in development mode, you can import the following file * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. * * This import should be commented out in production mode because it will have a negative impact * on performance if an error is thrown. */ // import 'zone.js/dist/zone-error'; // Included with Angular CLI. ================================================ FILE: src/global.scss ================================================ /* * App Global CSS * ---------------------------------------------------------------------------- * Put style rules here that you want to apply globally. These styles are for * the entire app and not just one component. Additionally, this file can be * used as an entry point to import other CSS/Sass files to be included in the * output CSS. * For more information on global stylesheets, visit the documentation: * https://ionicframework.com/docs/layout/global-stylesheets */ /* Core CSS required for Ionic components to work properly */ @import '~@ionic/angular/css/core.css'; /* Basic CSS for apps built with Ionic */ @import '~@ionic/angular/css/normalize.css'; @import '~@ionic/angular/css/structure.css'; @import '~@ionic/angular/css/typography.css'; @import '~@ionic/angular/css/display.css'; /* Optional CSS utils that can be commented out */ @import '~@ionic/angular/css/padding.css'; @import '~@ionic/angular/css/float-elements.css'; @import '~@ionic/angular/css/text-alignment.css'; @import '~@ionic/angular/css/text-transformation.css'; @import '~@ionic/angular/css/flex-utils.css'; :root { --ion-item-color: #ffffff; --ion-item-background: #25232a; --ion-color-primary: #1d1a23; --ion-color-primary-contrast: #ba68c8; --ion-color-secondary: #25232a; --ion-color-secondary-contrast: #ffffff; --ion-color-secondary-shade: #121114; --ion-color-secondary-tint: #464250; --ion-color-light: #dfdfdf; } .masters { background-color: #25232a; } .alert-wrapper { width: 100% !important; max-width: 20vw !important; } .ion-page > ion-content { //top: 56px;//your headers height } #main-content{ height: calc(100% - 78px); // overflow:visible !important; } #main-content .ion-page{ top:56px; // height: calc(100% - 53px); // margin-bottom: 80px; } ================================================ FILE: src/index.html ================================================ BetterCrewlink - App ================================================ FILE: src/main.ts ================================================ import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; if (environment.production) { enableProdMode(); } platformBrowserDynamic() .bootstrapModule(AppModule) .catch((err) => console.log(err)); ================================================ FILE: src/manifest.webmanifest ================================================ { "name": "BetterCrewlink-PWA", "short_name": "BetterCrewlink-PWA", "theme_color": "#1976d2", "background_color": "#fafafa", "display": "standalone", "scope": "./", "start_url": "./", "icons": [ { "src": "assets/icons/icon-192x192.png", "sizes": "192x192", "type": "image/png" }, { "src": "assets/icons/icon-256x256.png", "sizes": "256x256", "type": "image/png" }, { "src": "assets/icons/icon-384x384.png", "sizes": "384x384", "type": "image/png" }, { "src": "assets/icons/icon-512x512.png", "sizes": "512x512", "type": "image/png" } ] } ================================================ FILE: src/polyfills.ts ================================================ /** * This file includes polyfills needed by Angular and is loaded before the app. * You can add your own extra polyfills to this file. * * This file is divided into 2 sections: * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. * 2. Application imports. Files imported after ZoneJS that should be loaded before your main * file. * * The current setup is for so-called "evergreen" browsers; the last versions of browsers that * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. * * Learn more in https://angular.io/guide/browser-support */ /*************************************************************************************************** * BROWSER POLYFILLS */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */ // import 'classlist.js'; // Run `npm install --save classlist.js`. /** * Web Animations `@angular/platform-browser/animations` * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). */ // import 'web-animations-js'; // Run `npm install --save web-animations-js`. /** * By default, zone.js will patch all possible macroTask and DomEvents * user can disable parts of macroTask/DomEvents patch by setting following flags * because those flags need to be set before `zone.js` being loaded, and webpack * will put import in the top of bundle, so user need to create a separate file * in this directory (for example: zone-flags.ts), and put the following flags * into that file, and then add the following code before importing zone.js. * import './zone-flags.ts'; * * The flags allowed in zone-flags.ts are listed here. * * The following flags will work for all browsers. * * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames * * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js * with the following flag, it will bypass `zone.js` patch for IE/Edge * * (window as any).__Zone_enable_cross_context_check = true; * */ import './zone-flags'; /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ import 'zone.js'; // Updated for Angular 17+ /*************************************************************************************************** * APPLICATION IMPORTS */ (window as any).global = window; (window as any).process = (window as any).process || { env: { DEBUG: undefined }, nextTick() { return null; }, }; declare global { interface Window { webkitAudioContext: typeof AudioContext; } } // navigator.getUserMedia = // navigator.getUserMedia || // navigator.webkitGetUserMedia || // navigator.mozGetUserMedia || // navigator.msGetUserMedia; ================================================ FILE: src/test.ts ================================================ // This file is required by karma.conf.js and loads recursively all the .spec and framework files import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); ================================================ FILE: src/theme/variables.scss ================================================ // Ionic Variables and Theming. For more info, please see: // http://ionicframework.com/docs/theming/ /** Ionic CSS Variables **/ :root { /** primary **/ --ion-color-primary: #3880FF; --ion-color-primary-rgb: 56, 128, 255; --ion-color-primary-contrast: #ffffff; --ion-color-primary-contrast-rgb: 255, 255, 255; --ion-color-primary-shade: #3171e0; --ion-color-primary-tint: #4c8dff; /** secondary **/ --ion-color-secondary: #3dc2ff; --ion-color-secondary-rgb: 61, 194, 255; --ion-color-secondary-contrast: #ffffff; --ion-color-secondary-contrast-rgb: 255, 255, 255; --ion-color-secondary-shade: #36abe0; --ion-color-secondary-tint: #50c8ff; /** tertiary **/ --ion-color-tertiary: #5260ff; --ion-color-tertiary-rgb: 82, 96, 255; --ion-color-tertiary-contrast: #ffffff; --ion-color-tertiary-contrast-rgb: 255, 255, 255; --ion-color-tertiary-shade: #4854e0; --ion-color-tertiary-tint: #6370ff; /** success **/ --ion-color-success: #2dd36f; --ion-color-success-rgb: 45, 211, 111; --ion-color-success-contrast: #ffffff; --ion-color-success-contrast-rgb: 255, 255, 255; --ion-color-success-shade: #28ba62; --ion-color-success-tint: #42d77d; /** warning **/ --ion-color-warning: #ffc409; --ion-color-warning-rgb: 255, 196, 9; --ion-color-warning-contrast: #000000; --ion-color-warning-contrast-rgb: 0, 0, 0; --ion-color-warning-shade: #e0ac08; --ion-color-warning-tint: #ffca22; /** danger **/ --ion-color-danger: #eb445a; --ion-color-danger-rgb: 235, 68, 90; --ion-color-danger-contrast: #ffffff; --ion-color-danger-contrast-rgb: 255, 255, 255; --ion-color-danger-shade: #cf3c4f; --ion-color-danger-tint: #ed576b; /** dark **/ --ion-color-dark: #222428; --ion-color-dark-rgb: 34, 36, 40; --ion-color-dark-contrast: #ffffff; --ion-color-dark-contrast-rgb: 255, 255, 255; --ion-color-dark-shade: #1e2023; --ion-color-dark-tint: #383a3e; /** medium **/ --ion-color-medium: #92949c; --ion-color-medium-rgb: 146, 148, 156; --ion-color-medium-contrast: #ffffff; --ion-color-medium-contrast-rgb: 255, 255, 255; --ion-color-medium-shade: #808289; --ion-color-medium-tint: #9d9fa6; /** light **/ --ion-color-light: #f4f5f8; --ion-color-light-rgb: 244, 245, 248; --ion-color-light-contrast: #000000; --ion-color-light-contrast-rgb: 0, 0, 0; --ion-color-light-shade: #d7d8da; --ion-color-light-tint: #f5f6f9; } @media (prefers-color-scheme: dark_DISABLE) { /* * Dark Colors * ------------------------------------------- */ body { --ion-color-primary: #afccff; --ion-color-primary-rgb: 175, 204, 255; --ion-color-primary-contrast: #000000; --ion-color-primary-contrast-rgb: 0, 0, 0; --ion-color-primary-shade: #9ab4e0; --ion-color-primary-tint: #b7d1ff; --ion-color-secondary: #50c8ff; --ion-color-secondary-rgb: 80,200,255; --ion-color-secondary-contrast: #ffffff; --ion-color-secondary-contrast-rgb: 255,255,255; --ion-color-secondary-shade: #46b0e0; --ion-color-secondary-tint: #62ceff; --ion-color-tertiary: #6a64ff; --ion-color-tertiary-rgb: 106,100,255; --ion-color-tertiary-contrast: #ffffff; --ion-color-tertiary-contrast-rgb: 255,255,255; --ion-color-tertiary-shade: #5d58e0; --ion-color-tertiary-tint: #7974ff; --ion-color-success: #2fdf75; --ion-color-success-rgb: 47,223,117; --ion-color-success-contrast: #000000; --ion-color-success-contrast-rgb: 0,0,0; --ion-color-success-shade: #29c467; --ion-color-success-tint: #44e283; --ion-color-warning: #ffd534; --ion-color-warning-rgb: 255,213,52; --ion-color-warning-contrast: #000000; --ion-color-warning-contrast-rgb: 0,0,0; --ion-color-warning-shade: #e0bb2e; --ion-color-warning-tint: #ffd948; --ion-color-danger: #ff4961; --ion-color-danger-rgb: 255,73,97; --ion-color-danger-contrast: #ffffff; --ion-color-danger-contrast-rgb: 255,255,255; --ion-color-danger-shade: #e04055; --ion-color-danger-tint: #ff5b71; --ion-color-dark: #f4f5f8; --ion-color-dark-rgb: 244,245,248; --ion-color-dark-contrast: #000000; --ion-color-dark-contrast-rgb: 0,0,0; --ion-color-dark-shade: #d7d8da; --ion-color-dark-tint: #f5f6f9; --ion-color-medium: #989aa2; --ion-color-medium-rgb: 152,154,162; --ion-color-medium-contrast: #000000; --ion-color-medium-contrast-rgb: 0,0,0; --ion-color-medium-shade: #86888f; --ion-color-medium-tint: #a2a4ab; --ion-color-light: #222428; --ion-color-light-rgb: 34,36,40; --ion-color-light-contrast: #ffffff; --ion-color-light-contrast-rgb: 255,255,255; --ion-color-light-shade: #1e2023; --ion-color-light-tint: #383a3e; } /* * iOS Dark Theme * ------------------------------------------- */ .ios body { --ion-background-color: #000000; --ion-background-color-rgb: 0,0,0; --ion-text-color: #ffffff; --ion-text-color-rgb: 255,255,255; --ion-color-step-50: #0d0d0d; --ion-color-step-100: #1a1a1a; --ion-color-step-150: #262626; --ion-color-step-200: #333333; --ion-color-step-250: #404040; --ion-color-step-300: #4d4d4d; --ion-color-step-350: #595959; --ion-color-step-400: #666666; --ion-color-step-450: #737373; --ion-color-step-500: #808080; --ion-color-step-550: #8c8c8c; --ion-color-step-600: #999999; --ion-color-step-650: #a6a6a6; --ion-color-step-700: #b3b3b3; --ion-color-step-750: #bfbfbf; --ion-color-step-800: #cccccc; --ion-color-step-850: #d9d9d9; --ion-color-step-900: #e6e6e6; --ion-color-step-950: #f2f2f2; --ion-toolbar-background: #0d0d0d; --ion-item-background: #000000; --ion-card-background: #1c1c1d; } /* * Material Design Dark Theme * ------------------------------------------- */ .md body { --ion-background-color: #121212; --ion-background-color-rgb: 18,18,18; --background: #121212; --ion-text-color: #ffffff; --ion-text-color-rgb: 255,255,255; --ion-border-color: #222222; --ion-color-step-50: #1e1e1e; --ion-color-step-100: #2a2a2a; --ion-color-step-150: #363636; --ion-color-step-200: #414141; --ion-color-step-250: #4d4d4d; --ion-color-step-300: #595959; --ion-color-step-350: #656565; --ion-color-step-400: #717171; --ion-color-step-450: #7d7d7d; --ion-color-step-500: #898989; --ion-color-step-550: #949494; --ion-color-step-600: #a0a0a0; --ion-color-step-650: #acacac; --ion-color-step-700: #b8b8b8; --ion-color-step-750: #c4c4c4; --ion-color-step-800: #d0d0d0; --ion-color-step-850: #dbdbdb; --ion-color-step-900: #e7e7e7; --ion-color-step-950: #f3f3f3; --ion-item-background: #1e1e1e; --ion-toolbar-background: #1f1f1f; --ion-tab-bar-background: #1f1f1f; --ion-card-background: #1e1e1e; } } ================================================ FILE: src/web.config ================================================ ================================================ FILE: src/zone-flags.ts ================================================ /** * Prevents Angular change detection from * running with certain Web Component callbacks */ (window as any).__Zone_disable_customElements = true; ================================================ FILE: tsconfig.app.json ================================================ { "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/app", "types": [] }, "files": [ "src/main.ts", "src/polyfills.ts" ], "include": [ "src/**/*.ts", "src/**/*.d.ts" ], "exclude": [ "src/**/*.spec.ts" ] } ================================================ FILE: tsconfig.json ================================================ { "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "module": "esnext", "moduleResolution": "node", "importHelpers": true, "target": "ES2022", "lib": [ "es2018", "dom" ], "useDefineForClassFields": false }, "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true }, } ================================================ FILE: tsconfig.spec.json ================================================ { "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/spec", "types": [ "jasmine", "node" ] }, "files": [ "src/test.ts", "src/polyfills.ts" ], "include": [ "src/**/*.spec.ts", "src/**/*.d.ts" ] } ================================================ FILE: tslint.json ================================================ { "extends": "tslint:recommended", "rules": { "align": { "options": ["parameters", "statements"] }, "array-type": false, "arrow-return-shorthand": true, "curly": true, "deprecation": { "severity": "warning" }, "component-class-suffix": [true, "Page", "Component"], "contextual-lifecycle": true, "directive-class-suffix": true, "directive-selector": [true, "attribute", "app", "camelCase"], "component-selector": [true, "element", "app", "kebab-case"], "eofline": true, "import-blacklist": [true, "rxjs/Rx"], "import-spacing": true, "indent": { "options": ["tabs"] }, "max-classes-per-file": false, "max-line-length": [true, 140], "member-ordering": [ true, { "order": ["static-field", "instance-field", "static-method", "instance-method"] } ], "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], "no-empty": false, "no-inferrable-types": [false, "ignore-params"], "no-non-null-assertion": true, "no-redundant-jsdoc": true, "no-switch-case-fall-through": true, "no-var-requires": false, "object-literal-key-quotes": [true, "as-needed"], "quotemark": [true, "single"], "semicolon": { "options": ["always"] }, "space-before-function-paren": { "options": { "anonymous": "never", "asyncArrow": "always", "constructor": "never", "method": "never", "named": "never" } }, "typedef-whitespace": { "options": [ { "call-signature": "nospace", "index-signature": "nospace", "parameter": "nospace", "property-declaration": "nospace", "variable-declaration": "nospace" }, { "call-signature": "onespace", "index-signature": "onespace", "parameter": "onespace", "property-declaration": "onespace", "variable-declaration": "onespace" } ] }, "variable-name": { "options": ["ban-keywords", "check-format", "allow-pascal-case"] }, "whitespace": { "options": ["check-branch", "check-decl", "check-operator", "check-separator", "check-type", "check-typecast"] }, "no-conflicting-lifecycle": true, "no-host-metadata-property": true, "no-input-rename": true, "no-inputs-metadata-property": true, "no-output-native": true, "no-output-on-prefix": true, "no-output-rename": true, "no-outputs-metadata-property": true, "template-banana-in-box": true, "template-no-negated-async": true, "use-lifecycle-interface": true, "use-pipe-transform-interface": true, "object-literal-sort-keys": false }, "rulesDirectory": ["codelyzer"] }