Author SHA1 Message Date
J Francisco Rader 6b23079d97 Add terminal integration lulz 2021-03-24 15:59:31 -03:00
J Francisco Rader f5b4484c1a Merge branch 'master' into license/change-license 2021-03-24 15:56:45 -03:00
J Francisco Rader 1437234fe2 Add license notice to README and update to real values 2021-03-24 15:55:45 -03:00
Dillon Skaggs b789e73447 fix(readme): fix typo (#180)
auguest kek
2021-03-24 14:24:03 -04:00
Taso 6c2eae7f5d fix(phone/settings): Fixed localStorage persistence 2021-03-22 19:14:53 -04:00
J Francisco Rader a3d7c19f44 Tweaks / Message notifications (#174)
* Remove msg notifications when opening one | Dont alert notifications when inside that conversation

* Fix msg events

* Fix goToConversation util

* Fix nuiEvents for messages
2021-03-22 18:57:20 -03:00
J Francisco Rader 02608e937e Changed to only GPL instead of AGPL to avoid server restrictions 2021-03-22 18:56:51 -03:00
Christopher b42ee97450 feat(resources/cl_utils): NuiCallback 2021-03-22 22:45:47 +01:00
Taso 4e7e6b3e92 fix(client/marketplace): Fixed typo preventing listings from being sent 2021-03-22 14:44:34 -04:00
J Francisco Rader 74c1657fd7 Change license to AGPL which is much widely use than the current one, and ensures that modifications preserve the open source and freedom philosophy. Also prevents any server-side integration to use incompatible licenses which dont follow open source and freedom ideals 2021-03-22 15:26:51 -03:00
Taso 0f61088999 refactor(events): Events are now tied to a common enum typings (#167)
* chore(scripts/twitter): Refactored twitter to use event enums

* chore(scripts/marketplace): Refactored marketplace to use event enums

* chore(scripts/messages): Refactored messages to use event enums

* chore(scripts/contacts): Refactored contacts to use event enums

* chore(scripts/calls): Refactored calls to use event enums

* chore(scripts/notes): Refactored notes to use event enums

* chore(scripts/photos): Refactored photos to use event enums

* chore(scripts/bank): Refactored bank to use event enums

* chore(scripts/phone): Refactored phone to use event enums

* chore(events): Removed old events object

* refactor(phone/nui-events): Attached NUI events to respective enum

* tweak(event-enums): Added npwd prefix to all events

* tweak(phone/serve): Added craco to override CRA without eject

Also bumped react-scripts to 4.0.1, with seemingly no issues

* fix(typings/twitter): Fixed method enums for twitter
2021-03-22 13:37:07 -04:00
Erik 53d5bb459d Merge pull request #170 from project-error/feature/default-profile-names
Feature/default profile names
2021-03-22 10:40:22 -04:00
Kire fe1e685f6f fix(phone/twitter): Fix crash on broadcast with no profile set 2021-03-22 10:37:56 -04:00
Kire c8f680fdfb update for PR feedback 2021-03-22 10:37:10 -04:00
Kire f3f055944c handle twitter profile updating 2021-03-22 10:37:10 -04:00
Kire 21a2f8912d initial PR review changes 2021-03-22 10:37:10 -04:00
Kire 97f5c99cc0 handle all configuration cases 2021-03-22 10:37:10 -04:00
Kire 8000cc3d3f added UI for choosing a default profile name 2021-03-22 10:37:10 -04:00
Christopher 9261025b4f fix typo = 2021-03-22 10:58:54 +01:00
Erik a52ffc4e79 Feature/twitter refresh (#160)
* receive and process broadcasted tweets to the clients

* removing profile fetch and cleaning up unused functions

* defend against null profile

* move defenseive check to top pof notifications

* fix bug where delete was visible for non owners

* remove polling implementation
2021-03-20 18:17:14 -04:00
Taso 2a4457b323 feat(phone/settings): Schema validation & Reset Settings
You can now reset your settings to default using the action in the Settings App

Setting schema validation has been added that will temporarily reset to default settings if
the JSON string contains unexpected values. A alert will pop up informing the user
that they should reset to default settings using the action in the settings app,
as a permanent solution.
2021-03-20 12:57:22 -04:00
J Francisco Rader 97c308f550 Add useNuiEventCallback hook (#173)
* Add useNuiEventCallback hook
2021-03-19 11:54:26 -03:00
Christopher Gjelten 769f5a3d21 Merge pull request #169 from project-error/tweak/dialer
tweak(dialer): Several fixes and improvements
2021-03-19 12:08:16 +01:00
Christopher 73f057b55b dont call if no value 2021-03-19 10:01:25 +01:00
J Francisco Rader 0ec2b682e7 Messages bugfix again :D (#164)
* Handle offline messages | Fetch messages when broadcasted | Fetch message groups

* Fetch messages on notification click

* Dont fetch groups if duplicate group

* Only submit new message on click submit

* Fix infinite loading when duplicated group is creatded

* Fix infinite loading when group already existed

* Make code prettier

* Centralize fetch messages on goToConversation

* Remove duplicated event

* Improve message groups mapping to include yourself for unreadCount + Fix redirection after adding contact + General improvements

* Remove conflicts

* Fix media paths
2021-03-18 23:01:54 -03:00
Taso a2c0f94bd8 fix(whoops): Forgot to remove the string-parser change from last commit 2021-03-17 20:27:25 -04:00
Taso e8d28359a9 chore(server): Bumped deps & tweaked build
We are now ignoring the Cardinal and parse-connection-string warnings
that used to pop up after build.

Deps were bumped using standard `yarn upgrade`
2021-03-17 20:11:37 -04:00
Taso 67b557b7c3 fix(phone/sourcemaps): Add .map to client files 2021-03-17 17:36:45 -04:00
Taso 4b29cbbce3 fix(phone/home): Fixed incorrect props for Grid item 2021-03-17 13:59:53 -04:00
Taso 06137d77ad fix(phone/notifications): Fixed error when setting for app is not defined 2021-03-17 13:55:45 -04:00
Taso 279778e4f3 tweak(phone/webpack): Generate source maps 2021-03-17 11:18:37 -04:00
Taso f1f6a05981 tweak(dialer): Several fixes and improvements
Time has been changed to a relative format. Locale specifics are pending
merge of #168.

Several typos have been fixed where "DAILER" was referenced instead of
"DIALER"

A translation key was added for when a user has no call history.

The input box has been unlocked so users can use their keyboard directly
rather than using the dial pad.
2021-03-17 10:26:52 -04:00
Taso a6e8c769c0 feat(locale): Added a locale setting in Settings app
This removes the need to rebuild the phone in order to change language
2021-03-17 10:24:28 -04:00
Bombay 5c6538b340 Fix : Typo (#171) 2021-03-17 06:37:48 -04:00
Taso 1ecdb7a4a8 fix(locales): Fixed Bosnian Alpha-2 code 2021-03-16 21:14:52 -04:00
Taso d5d483eee8 tweak(phone/settings): Enabled copy and paste for number 2021-03-16 17:56:40 -04:00
Taso ef30daeb65 fix(phone/twitter): Altered transform on ShowMore
I wasn't sure what the comment was referring to, but changed this to a
standard top offset, and it fixed a issue with the transform being
screwed up between tweets.
2021-03-16 17:45:54 -04:00
Taso 19e228894d tweak(phone/settings): Added streamer mode desc 2021-03-16 17:31:41 -04:00
Taso a244183976 fix(server/types): Fixed type on Tweet create sql resp 2021-03-16 16:24:27 -04:00
Taso e01057d818 refactor(server/tweets): Slight tweaks to twitter handling on server 2021-03-16 16:24:27 -04:00
Taso 9ffca0d14e chore(server/messages): Type create message response 2021-03-16 16:24:27 -04:00
Taso 1a9c21f89d fix/cleanup(server/twitter): Fix for fetch after tweet & gen cleanup 2021-03-16 16:24:27 -04:00
Taso 3031e650e3 cleanup(server/marketplace): General cleanup of marketplace
Tweaked SQL tables to reference 'marketplace' and not 'sellout'

Removed if/else in favor of if/return
2021-03-16 16:24:27 -04:00
Taso 23ef9b8cd6 chore(server/photo): Added try/catch to missing sql query 2021-03-16 16:24:27 -04:00
Taso 598bcd2eb3 chore(server/notes): Removed redundant pSource call 2021-03-16 16:24:27 -04:00
Taso 78961b788f tweak(server/messages): General cleanup changes and added missing docs
I personally don't like if else chains, so changed to if checks
2021-03-16 16:24:27 -04:00
Taso adf9758d9f tweak(server/calls): Tweaked call handling
Added Sanity checks

Switched timestamp creation to server
2021-03-16 16:24:27 -04:00
Christopher Gjelten bc8a89d825 Update discord.ts 2021-03-16 16:55:11 +01:00
122 changed files with 7820 additions and 5825 deletions

No files matched your search

+2
View File
@@ -3,6 +3,8 @@
resources/html
phone/.eslintcache
# Node Modules and Built Folders
node_modules
build
+5
View File
@@ -0,0 +1,5 @@
Kidz
ItsChip
ROCKY_southpaw
Kire
TasoOneAsia
+577 -80
View File
@@ -1,97 +1,594 @@
Copyright (c) Kidz, ItsChip, ROCKY_southpaw, Kire and TasoOneAsia
GNU General Public License
==========================
All rights reserved.
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
_Version 3, 29 June 2007_
_Copyright © 2007 Free Software Foundation, Inc. &lt;<http://fsf.org/>&gt;_
Section 1 – Definitions.
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 – Scope.
## Preamble
License grant.
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
Term. The term of this Public License is specified in Section 6(a).
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
Downstream recipients.
Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
Other rights.
The GNU General Public License is a free, copyleft license for software and other
kinds of works.
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
Patent and trademark rights are not licensed under this Public License.
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
Section 3 – License Conditions.
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.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
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.
Attribution.
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.
If You Share the Licensed Material (including in modified form), You must:
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.
retain the following if it is supplied by the Licensor with the Licensed Material:
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
a copyright notice;
a notice that refers to this Public License;
a notice that refers to the disclaimer of warranties;
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
ShareAlike.
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
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.
The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 – Sui Generis Database Rights.
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.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
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.
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 – Disclaimer of Warranties and Limitation of Liability.
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.
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 – Term and Termination.
The precise terms and conditions for copying, distribution and modification follow.
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
## TERMS AND CONDITIONS
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 – Other Terms and Conditions.
### 0. Definitions
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 – Interpretation.
“This License” refers to version 3 of the GNU General Public License.
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
“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.
New-Phone-Who-Dis (NPWD) Copyright (C) 2021 - Kidz, Chip, ROCKY_southpaw, Kire, TasoOneAsia
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 <http://www.gnu.org/licenses/>.
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:
New-Phone-Who-Dis (NPWD) Copyright (C) 2021 - Kidz, Chip, ROCKY_southpaw, Kire, TasoOneAsia
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
&lt;<http://www.gnu.org/licenses/>&gt;.
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
&lt;<http://www.gnu.org/philosophy/why-not-lgpl.html>&gt;.
+20 -2
View File
@@ -2,8 +2,7 @@
<img src="https://beta.iodine.gg/zVkK7.png" width="500" height="300" />
NPWD is our current running project. Our team has been working on the project since Auguest, 2020. This resource isn’t complete yet and currently has no ETA for release. Feel free to test it out in a dev enviorment by following the installation guide.
NPWD is our current running project. Our team has been working on the project since August, 2020. This resource isn’t complete yet and currently has no ETA for release. Feel free to test it out in a dev environment by following the installation guide.
Written completely by the Project Error Dev Team in [React](https://reactjs.org/) with a [TypeScript](https://www.typescriptlang.org/) client/server environment.
@@ -46,3 +45,22 @@ Most of these apps have UI that does **not** represent the final product and are
- [**Phone**](https://beta.iodine.gg/z0ii9.png)
- [**Settings**](https://beta.iodine.gg/mZAIt.png)
- [**Twitter**](https://beta.iodine.gg/rQZFR.png)
## License
New-Phone-Who-Dis (NPWD)
Copyright (C) 2021 - Kidz, Chip, ROCKY_southpaw, Kire, TasoOneAsia
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 <http://www.gnu.org/licenses/>.
+1
View File
@@ -16,5 +16,6 @@ ui_page 'resources/html/index.html'
files {
'resources/html/index.html',
'resources/html/*.js',
'resources/html/*.map',
'resources/html/media/**/*'
}
+2 -11
View File
@@ -63,7 +63,7 @@ CREATE TABLE IF NOT EXISTS npwd_notes (
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS npwd_sellout_listings (
CREATE TABLE IF NOT EXISTS npwd_marketplace_listings (
id int(11) NOT NULL AUTO_INCREMENT,
identifier varchar(255) DEFAULT NULL,
username varchar(255) DEFAULT NULL,
@@ -75,12 +75,6 @@ CREATE TABLE IF NOT EXISTS npwd_sellout_listings (
createdAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
updatedAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
ENGINE = INNODB,
AUTO_INCREMENT = 31,
AVG_ROW_LENGTH = 2048,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_general_ci;
);
CREATE TABLE IF NOT EXISTS npwd_marketplace_reports (
@@ -88,10 +82,7 @@ CREATE TABLE IF NOT EXISTS npwd_marketplace_reports (
listing_id int(11) DEFAULT NULL,
profile varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_general_ci;
);
CREATE TABLE IF NOT EXISTS `npwd_twitter_reports` (
`id` int NOT NULL AUTO_INCREMENT,
+58
View File
@@ -0,0 +1,58 @@
const {
addAfterLoader,
removeLoaders,
loaderByName,
getLoaders,
throwUnexpectedConfigError,
} = require('@craco/craco');
const throwError = (message) =>
throwUnexpectedConfigError({
packageName: 'craco',
githubRepo: 'gsoft-inc/craco',
message,
githubIssueQuery: 'webpack',
});
module.exports = {
webpack: {
configure: (webpackConfig, { paths }) => {
const { hasFoundAny, matches } = getLoaders(webpackConfig, loaderByName('babel-loader'));
if (!hasFoundAny) throwError('failed to find babel-loader');
const { hasRemovedAny, removedCount } = removeLoaders(
webpackConfig,
loaderByName('babel-loader'),
);
if (!hasRemovedAny) throwError('no babel-loader to remove');
if (removedCount !== 2) throwError('had expected to remove 2 babel loader instances');
webpackConfig.resolve.plugins = webpackConfig.resolve.plugins.filter(
({ constructor: c }) => !c || c.name !== 'ModuleScopePlugin',
);
const tsLoader = {
test: /\.tsx?$/,
loader: require.resolve('ts-loader'),
options: { transpileOnly: true },
};
const { isAdded: tsLoaderIsAdded } = addAfterLoader(
webpackConfig,
loaderByName('url-loader'),
tsLoader,
);
if (!tsLoaderIsAdded) throwError('failed to add ts-loader');
const { isAdded: babelLoaderIsAdded } = addAfterLoader(
webpackConfig,
loaderByName('ts-loader'),
matches[1].loader, // babel-loader
);
if (!babelLoaderIsAdded) throwError('failed to add back babel-loader for non-application JS');
return webpackConfig;
},
},
};
+6 -3
View File
@@ -24,6 +24,7 @@
"enzyme-adapter-react-16": "^1.15.5",
"howler": "^2.2.1",
"i18next": "^19.7.0",
"jsonschema": "^1.4.0",
"parse-url": "^5.0.2",
"qs": "^6.9.6",
"react": "^16.13.1",
@@ -32,7 +33,7 @@
"react-i18next": "^11.7.1",
"react-popper": "^2.2.3",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"react-scripts": "4.0.1",
"recoil": "^0.1.2"
},
"devDependencies": {
@@ -42,6 +43,7 @@
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@craco/craco": "^6.1.1",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
@@ -62,6 +64,7 @@
"cra-build-watch": "^3.2.0",
"cross-env": "^7.0.2",
"css-loader": "^2.1.1",
"customize-cra": "^1.0.0",
"file-loader": "^3.0.1",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^4.3.0",
@@ -78,11 +81,11 @@
"scripts": {
"i18n:missing": "node --experimental-json-modules i18n.missingKeys.js",
"copy:config": "cp-cli ../config.json ./src/config.autogen.json",
"start": "yarn copy:config && react-scripts start",
"start": "craco start",
"watch": "cra-build-watch --disable-chunks --build-path ../resources/html --output-filename dev.js",
"build": "yarn copy:config && cross-env NODE_ENV=production webpack --config webpack/prod.config.js --color -p --progress --hide-modules --display-optimization-bailout",
"build:dev": "cross-env NODE_ENV=development webpack --config webpack/dev.config.js --color -p --progress --hide-modules --display-optimization-bailout --analyze",
"test": "react-scripts test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}",
"test": "craco test --watchAll=false --testMatch **/src/**/*.test.{ts,js,tsx}",
"test:watch": "react-scripts test --watchAll --testMatch **/src/**/*.test.{ts,js,tsx}",
"eject": "react-scripts eject"
},
+27 -5
View File
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import './Phone.css';
import './i18n';
import { Route } from 'react-router-dom';
@@ -20,7 +20,7 @@ import { useBankService } from './apps/bank/hooks/useBankService';
import { useMessagesService } from './apps/messages/hooks/useMessageService';
import { useNotesService } from './apps/notes/hooks/useNotesService';
import { usePhotoService } from './apps/camera/hooks/usePhotoService';
import { useSettings } from './apps/settings/hooks/useSettings';
import { isSettingsSchemaValid, useSettings } from './apps/settings/hooks/useSettings';
import { useCallService } from './os/call/hooks/useCallService';
import { useDialService } from './apps/dialer/hooks/useDialService';
import InjectDebugData from './os/debug/InjectDebugData';
@@ -31,13 +31,35 @@ import { useCallModal } from './os/call/hooks/useCallModal';
import WindowSnackbar from './ui/components/WindowSnackbar';
import { usePhone } from './os/phone/hooks/usePhone';
import { useTranslation } from 'react-i18next';
import { useSnackbar } from './ui/hooks/useSnackbar';
function Phone() {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const { apps } = useApps();
const [settings] = useSettings();
const { addAlert } = useSnackbar();
// Set language from local storage
// This will only trigger on first mount & settings changes
useEffect(() => {
i18n.changeLanguage(settings.language.value).catch((e) => console.error(e));
}, [i18n, settings.language]);
useEffect(() => {
if (!isSettingsSchemaValid()) {
addAlert({
message: t('SETTINGS.MESSAGES.INVALID_SETTINGS'),
type: 'error',
});
}
// We only want to run this on first mount of the phone,
// so we leave an empty dep array. Otherwise, we hit a max depth error.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useNuiService();
useKeyboardService();
usePhoneService();
@@ -73,14 +95,14 @@ function Phone() {
<div
className="PhoneFrame"
style={{
backgroundImage: `url(./media/frames/${settings.frame.value})`,
backgroundImage: `url(media/frames/${settings.frame.value})`,
}}
/>
<div
id="phone"
className="PhoneScreen"
style={{
backgroundImage: `url(./media/backgrounds/${settings.wallpaper.value})`,
backgroundImage: `url(media/backgrounds/${settings.wallpaper.value})`,
}}
>
{isPhoneReady ? (
@@ -5,6 +5,7 @@ import { Button, List, ListItem, TextField, makeStyles } from '@material-ui/core
import Nui from '../../../../os/nui-events/utils/Nui';
import { useBankModal } from '../../hooks/useBankModal';
import { BankEvents } from '../../../../../../typings/bank';
const useStyles = makeStyles((theme) => ({
input: {
@@ -43,7 +44,7 @@ export const TransferModal = () => {
const addTransfer = () => {
const transferAmount = parseInt(amount);
Nui.send('phone:addTransfer', {
Nui.send(BankEvents.ADD_TRANSFER, {
targetID,
transferAmount,
message,
@@ -8,6 +8,7 @@ import { useHistory } from 'react-router-dom';
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
import { addQueryToLocation } from '../../../../common/utils/addQueryToLocation';
import { getLocationFromUrl } from '../../../../common/utils/getLocationFromUrl';
import { PhotoEvents } from '../../../../../../typings/photo';
export const GalleryGrid = () => {
const classes = useStyles();
@@ -19,7 +20,7 @@ export const GalleryGrid = () => {
const photos = usePhotos();
const handleCamera = () => {
Nui.send('phone:TakePhoto', {});
Nui.send(PhotoEvents.TAKE_PHOTO, {});
};
const handlePhotoOpen = (photo) => {
@@ -9,6 +9,7 @@ import { useHistory } from 'react-router-dom';
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
import { ICameraPhoto } from '../../hooks/usePhotos';
import { ShareModal } from './ShareModal';
import { PhotoEvents } from '../../../../../../typings/photo';
export const GalleryModal = () => {
const classes = useStyles();
@@ -28,7 +29,7 @@ export const GalleryModal = () => {
};
const handleDeletePhoto = () => {
Nui.send('photo:deletePhoto', {
Nui.send(PhotoEvents.DELETE_PHOTO, {
image: meta.image,
});
history.push(referal);
@@ -10,6 +10,7 @@ import Nui from '../../../../os/nui-events/utils/Nui';
import { SearchContacts } from './SearchContacts';
import { useHistory } from 'react-router-dom';
import LogDebugEvent from '../../../../os/debug/LogDebugEvents';
import { CallEvents } from '../../../../../../typings/call';
export const ContactList = () => {
const { filteredContacts } = useFilteredContacts();
@@ -27,7 +28,7 @@ export const ContactList = () => {
level: 2,
data: true,
});
Nui.send('phone:beginCall', {
Nui.send(CallEvents.INITIALIZE_CALL, {
number,
});
};
@@ -8,6 +8,7 @@ import Nui from '../../../../os/nui-events/utils/Nui';
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
import LogDebugEvent from '../../../../os/debug/LogDebugEvents';
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
import { ContactEvents } from '../../../../../../typings/contact';
interface ContactInfoRouteParams {
mode: string;
@@ -79,7 +80,7 @@ const ContactsInfoPage = () => {
data: contact,
level: 2,
});
Nui.send('phone:addContacts', {
Nui.send(ContactEvents.ADD_CONTACT, {
display: name,
number,
avatar,
@@ -93,7 +94,7 @@ const ContactsInfoPage = () => {
data: contact,
level: 2,
});
Nui.send('phone:updateContact', {
Nui.send(ContactEvents.UPDATE_CONTACT, {
id: contact.id,
display: name,
number,
@@ -108,7 +109,7 @@ const ContactsInfoPage = () => {
data: contact,
level: 2,
});
Nui.send('phone:deleteContact', {
Nui.send(ContactEvents.DELETE_CONTACT, {
id: contact.id,
});
history.goBack();
@@ -28,7 +28,7 @@ export const DialerApp = () => {
<Route exact path="/phone">
<DialerHistory calls={history} />
</Route>
<Route path="/phone/contacts" component={ContactList}></Route>
<Route path="/phone/contacts" component={ContactList} />
</Switch>
</AppContent>
<DialerNavBar />
@@ -39,18 +39,18 @@ export const DialerApp = () => {
InjectDebugData([
{
app: 'DAILER',
app: 'DIALER',
method: 'setHistory',
data: [
{
id: 1,
transmitter: '636-6496',
start: 1612301545782,
start: 1615946292,
},
{
id: 2,
transmitter: '777-7777',
start: 1612301545782,
start: 1615946292,
},
],
},
@@ -3,9 +3,10 @@ import { Box, IconButton, InputBase, Paper } from '@material-ui/core';
import { makeStyles, Theme } from '@material-ui/core/styles';
import PhoneIcon from '@material-ui/icons/Phone';
import PersonAddIcon from '@material-ui/icons/PersonAdd';
import { DialInputCtx } from '../context/InputContext';
import { DialInputCtx, IDialInputCtx } from '../context/InputContext';
import Nui from '../../../os/nui-events/utils/Nui';
import { useHistory } from 'react-router-dom';
import { CallEvents } from '../../../../../typings/call';
const useStyles = makeStyles((theme: Theme) => ({
root: {
@@ -30,10 +31,10 @@ export const DialerInput = () => {
const classes = useStyles();
const history = useHistory();
const { inputVal } = useContext(DialInputCtx);
const { inputVal, set } = useContext<IDialInputCtx>(DialInputCtx);
const handleCall = (number: string) => {
Nui.send('phone:beginCall', {
Nui.send(CallEvents.INITIALIZE_CALL, {
number,
});
};
@@ -44,8 +45,13 @@ export const DialerInput = () => {
return (
<Box component={Paper} className={classes.root}>
<InputBase placeholder="Enter a number" className={classes.input} value={inputVal} />
<IconButton color="primary" className={classes.iconBtn}>
<InputBase
placeholder="Enter a number"
className={classes.input}
value={inputVal}
onChange={(e) => set(e.target.value)}
/>
<IconButton color="primary" className={classes.iconBtn} disabled={inputVal <= ''}>
<PhoneIcon fontSize="large" onClick={() => handleCall(inputVal)} />
</IconButton>
<IconButton className={classes.iconBtn}>
@@ -28,6 +28,7 @@ const DialPage = () => {
add: (val: string) => setInputVal(inputVal + val),
removeOne: () => setInputVal(inputVal.slice(0, -1)),
clear: () => setInputVal(''),
set: (val: string) => setInputVal(val),
}}
>
<DialerInput />
@@ -8,12 +8,12 @@ import { ListItem } from '../../../../ui/components/ListItem';
import Nui from '../../../../os/nui-events/utils/Nui';
import { useSimcard } from '../../../../os/simcard/hooks/useSimcard';
import { useContacts } from '../../../contacts/hooks/useContacts';
import { ICall } from '../../../../../../typings/call';
import dayjs from 'dayjs';
import { CallEvents, ICall } from '../../../../../../typings/call';
import { useTranslation } from 'react-i18next';
import { Box, IconButton, ListItemIcon, ListItemText } from '@material-ui/core';
import { useHistory } from 'react-router-dom';
import { makeStyles, Theme } from '@material-ui/core/styles';
import dayjs from 'dayjs';
const useStyles = makeStyles((theme: Theme) => ({
callForward: {
@@ -25,7 +25,7 @@ const useStyles = makeStyles((theme: Theme) => ({
}));
export const DialerHistory = ({ calls }) => {
const { number } = useSimcard();
const { number: myNumber } = useSimcard();
const { getDisplayByNumber } = useContacts();
const classes = useStyles();
@@ -35,7 +35,7 @@ export const DialerHistory = ({ calls }) => {
const { t } = useTranslation();
const handleCall = (phoneNumber) => {
Nui.send('phone:beginCall', {
Nui.send(CallEvents.INITIALIZE_CALL, {
number: phoneNumber,
});
};
@@ -44,9 +44,9 @@ export const DialerHistory = ({ calls }) => {
return (
<Box display="flex" justifyContent="center" alignItems="center" paddingTop={35}>
<p>
You got no friends!
<span role="img" aria-label="deal with it">
😎
{t('APPS_DIALER_NO_HISTORY')}
<span role="img" aria-label="sad">
😞
</span>
</p>
</Box>
@@ -56,45 +56,57 @@ export const DialerHistory = ({ calls }) => {
return (
<List disablePadding>
{calls.map((call: ICall) =>
call.transmitter === number ? (
call.transmitter === myNumber ? (
<ListItem key={call.id} divider>
<ListItemIcon>{<PhoneForwardedIcon className={classes.callForward} />}</ListItemIcon>
<ListItemIcon>
<PhoneForwardedIcon className={classes.callForward} />
</ListItemIcon>
<ListItemText
primary={getDisplayByNumber(call.receiver)}
secondary={dayjs.unix(call.start).format(t('DATE_TIME_FORMAT'))}
secondary={
// TODO: Locale changes are pending #168 merge
dayjs().to(dayjs.unix(call.start))
}
/>
<IconButton onClick={() => handleCall(call.receiver)}>{<PhoneIcon />}</IconButton>
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
{getDisplayByNumber(call.transmitter) === call.transmitter && (
<IconButton
onClick={() =>
history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)
}
>
{<PersonAddIcon />}
<PersonAddIcon />
</IconButton>
) : null}
)}
</ListItem>
) : (
<ListItem key={call.id} divider>
<ListItemIcon>{<PhoneCallbackIcon className={classes.callBack} />}</ListItemIcon>
<ListItemIcon>
<PhoneCallbackIcon className={classes.callBack} />
</ListItemIcon>
<ListItemText
primary={getDisplayByNumber(call.transmitter)}
secondary={dayjs.unix(call.start).format(t('DATE_TIME_FORMAT'))}
secondary={
// TODO: Locale changes are pending #168 merge
dayjs().to(dayjs.unix(call.start))
}
/>
<IconButton onClick={() => handleCall(call.transmitter)}>{<PhoneIcon />}</IconButton>
<IconButton onClick={() => handleCall(call.transmitter)}>
<PhoneIcon />
</IconButton>
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
{getDisplayByNumber(call.transmitter) === call.transmitter && (
<IconButton
onClick={() =>
history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)
}
>
{<PersonAddIcon />}
<PersonAddIcon />
</IconButton>
) : null}
)}
</ListItem>
),
)}
@@ -5,6 +5,7 @@ export interface IDialInputCtx {
add: (char: string | number) => void;
removeOne: () => void;
clear: () => void;
set: (val) => void;
}
export const DialInputCtx = createContext(null);
@@ -1,11 +1,7 @@
import { useRecoilValue } from 'recoil';
import { ICall } from '../../../../../typings/call';
import { dialState } from './state';
interface ICallUI {
history: ICall[];
}
export const useDialHistory = (): ICallUI[] => {
const history = useRecoilValue(dialState.history);
return history;
export const useDialHistory = () => {
return useRecoilValue<ICall[]>(dialState.history);
};
@@ -4,5 +4,5 @@ import { dialState } from './state';
export const useDialService = () => {
const setHistory = useSetRecoilState(dialState.history);
useNuiEvent('DAILER', 'setHistory', setHistory);
useNuiEvent('DIALER', 'setHistory', setHistory);
};
@@ -16,7 +16,7 @@ export const ExampleApp = () => {
const exampleString = useExample();
const example = useApp('EXAMPLE');
const [soundName, setSound] = useState('pixel.ogg');
const { play, playing, stop } = useSound('./media/ringtones/' + soundName);
const { play, playing, stop } = useSound('media/ringtones/' + soundName);
const toggleSound = () => {
if (soundName === 'pixel.ogg') {
@@ -11,13 +11,14 @@ import InjectDebugData from '../../../os/debug/InjectDebugData';
import NewMessageGroupButton from './form/NewMessageGroupButton';
import Nui from '../../../os/nui-events/utils/Nui';
import { MessagesThemeProvider } from '../providers/MessagesThemeProvider';
import { MessageEvents } from '../../../../../typings/messages';
export const MessagesApp = () => {
const messages = useApp('MESSAGES');
const history = useHistory();
useEffect(() => {
Nui.send('phone:fetchMessageGroups');
Nui.send(MessageEvents.FETCH_MESSAGE_GROUPS);
}, []);
return (
@@ -4,6 +4,7 @@ import { Paper, Box, makeStyles, TextField, Button } from '@material-ui/core';
import SendIcon from '@material-ui/icons/Send';
import ImageIcon from '@material-ui/icons/Image';
import Nui from '../../../../os/nui-events/utils/Nui';
import { MessageEvents } from '../../../../../../typings/messages';
interface IProps {
onAddImageClick(): void;
@@ -25,7 +26,7 @@ const MessageInput = ({ messageGroupId, onAddImageClick }: IProps) => {
if (message.trim()) {
// don't allow the user to submit white space
Nui.send('phone:sendMessage', {
Nui.send(MessageEvents.SEND_MESSAGE, {
groupId: messageGroupId,
message,
});
@@ -1,4 +1,4 @@
import React, { FormEvent, useCallback, useEffect, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Box, Button, TextField } from '@material-ui/core';
@@ -7,6 +7,7 @@ import { useHistory } from 'react-router-dom';
import { Autocomplete } from '@material-ui/lab';
import { useContacts } from '../../../contacts/hooks/useContacts';
import { Contact } from '../../../../../../typings/contact';
import { MessageEvents } from '../../../../../../typings/messages';
const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
const history = useHistory();
@@ -24,27 +25,22 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
const isGroupChat = participants.length > 1;
const handleSubmit = useCallback(
(event: FormEvent) => {
event.preventDefault();
const handleSubmit = useCallback(() => {
// handles phone numbers in a csv format and strips all spaces and
// external characters out of them:
// 123-4567, 987-6543, 333-4444
const phoneNumbers = participants.map(({ number }) => number.replace(/[^0-9]/g, ''));
const labelValue = isGroupChat ? label.trim() : null;
// handles phone numbers in a csv format and strips all spaces and
// external characters out of them:
// 123-4567, 987-6543, 333-4444
const phoneNumbers = participants.map(({ number }) => number.replace(/[^0-9]/g, ''));
const labelValue = isGroupChat ? label.trim() : null;
if (phoneNumbers.length) {
Nui.send('phone:createMessageGroup', {
phoneNumbers,
label: labelValue,
});
setParticipants([]);
history.push('/messages');
}
},
[history, label, participants, isGroupChat],
);
if (phoneNumbers.length) {
Nui.send(MessageEvents.CREATE_MESSAGE_GROUP, {
phoneNumbers,
label: labelValue,
});
setParticipants([]);
history.push('/messages');
}
}, [history, label, participants, isGroupChat]);
const onAutocompleteChange = (_e, value: any) => {
const lastIdx = value.length - 1;
@@ -77,7 +73,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
const submitDisabled = !participants.length || (isGroupChat && !label);
return (
<form onSubmit={handleSubmit}>
<Box>
<Box px={2} py={3}>
<Autocomplete<Contact, boolean, boolean, boolean>
value={participants}
@@ -102,6 +98,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
)}
<Box px={2} py={3}>
<Button
onClick={() => handleSubmit()}
disabled={submitDisabled}
variant="contained"
fullWidth
@@ -111,7 +108,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
{t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')}
</Button>
</Box>
</form>
</Box>
);
};
@@ -23,7 +23,7 @@ const MessageGroupItem = ({ messageGroup, handleClick }: IProps): any => {
<ListItem key={messageGroup.groupId} onClick={handleClick(messageGroup)} divider button>
<ListItemAvatar>
<Badge color="error" variant="dot" invisible={!hasUnread}>
<MuiAvatar src={messageGroup?.avatar} />
<MuiAvatar src={messageGroup.avatar} />
</Badge>
</ListItemAvatar>
<ListItemText>{messageGroup.label || messageGroup.groupDisplay}</ListItemText>
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { Box, List } from '@material-ui/core';
import { MessageGroup } from '../../../../../../typings/messages';
import { MessageEvents, MessageGroup } from '../../../../../../typings/messages';
import Nui from '../../../../os/nui-events/utils/Nui';
import useMessages from '../../hooks/useMessages';
import MessageGroupItem from './MessageGroupItem';
@@ -15,7 +15,13 @@ const MessagesList = (): any => {
const history = useHistory();
const { t } = useTranslation();
const { messageGroups, createMessageGroupResult, clearMessageGroupResult } = useMessages();
const {
messageGroups,
createMessageGroupResult,
clearMessageGroupResult,
getMessageGroupById,
setActiveMessageGroup,
} = useMessages();
const [searchValue, setSearchValue] = useState('');
@@ -32,18 +38,24 @@ const MessagesList = (): any => {
useEffect(() => {
if (createMessageGroupResult?.groupId) {
const findGroup = messageGroups.find((g) => g.groupId === createMessageGroupResult.groupId);
const findGroup = getMessageGroupById(createMessageGroupResult.groupId);
clearMessageGroupResult();
if (findGroup) {
goToConversation(findGroup, history);
}
}
}, [messageGroups, createMessageGroupResult, clearMessageGroupResult, history]);
}, [
messageGroups,
createMessageGroupResult,
clearMessageGroupResult,
history,
setActiveMessageGroup,
getMessageGroupById,
]);
if (!messageGroups) return null;
const handleClick = (messageGroup: MessageGroup) => () => {
Nui.send('phone:fetchMessages', { groupId: messageGroup.groupId });
goToConversation(messageGroup, history);
};
@@ -10,6 +10,7 @@ import { useHistory, useLocation } from 'react-router-dom';
import { ContextMenu } from '../../../../ui/components/ContextMenu';
import { deleteQueryFromLocation } from '../../../../common/utils/deleteQueryFromLocation';
import { PictureResponsive } from '../../../../ui/components/PictureResponsive';
import { MessageEvents } from '../../../../../../typings/messages';
interface IProps {
isOpen: boolean;
@@ -34,7 +35,7 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
const sendImageMessage = useCallback(
(m) => {
Nui.send('phone:sendMessage', {
Nui.send(MessageEvents.SEND_MESSAGE, {
groupId: messageGroupId,
message: m,
});
@@ -23,6 +23,7 @@ import { useTranslation } from 'react-i18next';
import Modal from '../../../../ui/components/Modal';
import { useContacts } from '../../../contacts/hooks/useContacts';
import { useSimcard } from '../../../../os/simcard/hooks/useSimcard';
import { MessageEvents } from '../../../../../../typings/messages';
const LARGE_HEADER_CHARS = 30;
const MAX_HEADER_CHARS = 80;
@@ -77,7 +78,6 @@ export const MessageModal = () => {
useEffect(() => {
if (!groupId) return;
setActiveMessageGroup(groupId);
}, [groupId, setActiveMessageGroup]);
@@ -93,7 +93,7 @@ export const MessageModal = () => {
// sends all unread messages
useEffect(() => {
if (activeMessageGroup?.groupId && activeMessageGroup.unreadCount > 0) {
Nui.send('phone:setReadMessages', {
Nui.send(MessageEvents.SET_MESSAGE_READ, {
groupId: activeMessageGroup.groupId,
});
}
@@ -109,10 +109,11 @@ export const MessageModal = () => {
const handleAddContact = (number) => {
const exists = getContactByNumber(number);
const referal = encodeURIComponent(pathname);
if (exists) {
return history.push(`/contacts/${exists.id}/?referal=${pathname}`);
return history.push(`/contacts/${exists.id}/?referal=${referal}`);
}
return history.push(`/contacts/-1/?addNumber=${number}&referal=${pathname}`);
return history.push(`/contacts/-1/?addNumber=${number}&referal=${referal}`);
};
const phoneNumbers = activeMessageGroup?.phoneNumbers || [];
@@ -157,14 +158,14 @@ export const MessageModal = () => {
</Button>
) : null}
{!activeMessageGroup?.isGroupChat &&
getDisplayByNumber(targetNumber) == targetNumber ? (
getDisplayByNumber(targetNumber) === targetNumber ? (
<Button>
<PersonAddIcon onClick={() => handleAddContact(targetNumber)} fontSize="large" />
</Button>
) : null}
</Box>
</Paper>
{isLoaded ? (
{isLoaded && activeMessageGroup ? (
<Conversation
onClickDisplay={handleAddContact}
messages={messages}
@@ -1,5 +1,6 @@
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import { matchPath, useHistory } from 'react-router-dom';
import { useApp } from '../../../os/apps/hooks/useApps';
import { useNotifications } from '../../../os/notifications/hooks/useNotifications';
import { goToConversation } from '../utils/goToConversation';
@@ -10,13 +11,22 @@ const NOTIFICATION_ID = 'messages:broadcast';
export const useMessageNotifications = () => {
const { t } = useTranslation();
const history = useHistory();
const {
removeId,
addNotification,
addNotificationAlert,
} = useNotifications();
const { removeId, addNotification, addNotificationAlert } = useNotifications();
const { icon, notificationIcon } = useApp('MESSAGES');
const { getMessageGroupById } = useMessages();
const { getMessageGroupById, activeMessageGroup } = useMessages();
// Remove notifications from groups when opening them
history.listen((location) => {
if (
activeMessageGroup?.groupId &&
matchPath(location.pathname, {
path: `/messages/conversations/${activeMessageGroup.groupId}`,
exact: true,
})
) {
removeId(`${NOTIFICATION_ID}:${activeMessageGroup.groupId}`);
}
});
const setNotification = ({ groupId, message }) => {
const group = getMessageGroupById(groupId);
@@ -1,12 +1,19 @@
import { useSetRecoilState } from 'recoil';
import { useRecoilState, useSetRecoilState } from 'recoil';
import { messageState } from './state';
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
import { useTranslation } from 'react-i18next';
import { useMessageNotifications } from './useMessageNotifications';
import { useCallback } from 'react';
import Nui from '../../../os/nui-events/utils/Nui';
import { useLocation } from 'react-router';
import { MessageEvents } from '../../../../../typings/messages';
export const useMessagesService = () => {
const { pathname } = useLocation();
const [activeMessageGroup, setActiveMessageGroup] = useRecoilState(
messageState.activeMessageGroup,
);
const setMessageGroups = useSetRecoilState(messageState.messageGroups);
const setMessages = useSetRecoilState(messageState.messages);
const setCreateMessageGroupResult = useSetRecoilState(messageState.createMessageGroupResult);
@@ -24,10 +31,36 @@ export const useMessagesService = () => {
[addAlert, t],
);
useNuiEvent('MESSAGES', 'phone:fetchMessageGroupsSuccess', setMessageGroups);
useNuiEvent('MESSAGES', 'phone:fetchMessagesSuccess', setMessages);
useNuiEvent('MESSAGES', 'phone:createMessageGroupSuccess', setCreateMessageGroupResult);
useNuiEvent('MESSAGES', 'phone:createMessageGroupFailed', setCreateMessageGroupResult);
useNuiEvent('MESSAGES', 'createMessagesBroadcast', setNotification);
useNuiEvent('MESSAGES', 'phone:setMessagesAlert', handleAddAlert);
const handleMessageBroadcast = useCallback(
({ groupId, message }) => {
if (groupId === activeMessageGroup?.groupId) {
Nui.send(MessageEvents.FETCH_MESSAGES, { groupId: activeMessageGroup.groupId });
if (pathname.includes('messages/conversations')) {
// Dont trigger notification if conversation is open.
return;
}
}
setNotification({ groupId, message });
},
[activeMessageGroup, pathname, setNotification],
);
const _setMessageGroups = useCallback(
(groups) => {
if (activeMessageGroup && activeMessageGroup.groupId) {
setActiveMessageGroup(
(curr) => groups.find((g) => g.groupId === activeMessageGroup.groupId) || curr,
);
}
setMessageGroups(groups);
},
[activeMessageGroup, setActiveMessageGroup, setMessageGroups],
);
useNuiEvent('MESSAGES', MessageEvents.FETCH_MESSAGE_GROUPS_SUCCESS, _setMessageGroups);
useNuiEvent('MESSAGES', MessageEvents.FETCH_MESSAGES_SUCCESS, setMessages);
useNuiEvent('MESSAGES', MessageEvents.CREATE_MESSAGE_GROUP_SUCCESS, setCreateMessageGroupResult);
useNuiEvent('MESSAGES', MessageEvents.CREATE_MESSAGE_GROUP_FAILED, setCreateMessageGroupResult);
useNuiEvent('MESSAGES', MessageEvents.CREATE_MESSAGE_BROADCAST, handleMessageBroadcast);
useNuiEvent('MESSAGES', MessageEvents.ACTION_RESULT, handleAddAlert);
};
@@ -1,2 +1,8 @@
export const goToConversation = (messageGroup, history) =>
import { MessageEvents } from '../../../../../typings/messages';
import Nui from '../../../os/nui-events/utils/Nui';
export const goToConversation = (messageGroup, history) => {
if (!messageGroup?.groupId || !history) return;
history.push(`/messages/conversations/${messageGroup.groupId}`);
Nui.send(MessageEvents.FETCH_MESSAGES, { groupId: messageGroup.groupId });
};
@@ -3,31 +3,40 @@ import { AppWrapper } from '../../ui/components/AppWrapper';
import { AppContent } from '../../ui/components/AppContent';
import { AppTitle } from '../../ui/components/AppTitle';
import { useApp } from '../../os/apps/hooks/useApps';
import NoteList from './list/NoteList';
import { NoteModal } from './modal/NoteModal';
import { Fab } from '@material-ui/core';
import AddIcon from '@material-ui/icons/Add';
import { useNoteDetail } from './hooks/useNoteDetail';
import useStyles from './documents.styles';
import useStyles from './notes.styles';
import InjectDebugData from '../../os/debug/InjectDebugData';
import { DocumentsThemeProvider } from './providers/DoucmentsThemeProvider';
import { NotesThemeProvider } from './providers/NotesThemeProvider';
import { Route, useHistory } from 'react-router-dom';
import DocumentList from './list/DoucmentList';
import NoteList from './list/NoteList';
export const NotesApp = () => {
const documentsApp = useApp('DOCUMENTS');
const classes = useStyles();
const history = useHistory();
const notesApp = useApp('NOTES');
const { setDetail } = useNoteDetail();
const onClickCreate = () => {
setDetail({ title: '', content: '' });
history.push('/notes/detail');
};
return (
<DocumentsThemeProvider>
<AppWrapper id="documents-app">
<AppTitle app={documentsApp} />
<Route path="/documents/notes/detail" component={NoteModal} />
<NotesThemeProvider>
<AppWrapper id="notes-app">
<AppTitle app={notesApp} />
<Route path="/notes/detail" component={NoteModal} />
<AppContent>
<Route path="/documents" exact component={DocumentList} />
<Route path="/documents/notes" exact component={NoteList} />
<Route path="/notes" component={NoteList} />
<Fab className={classes.absolute} onClick={onClickCreate} color="primary">
<AddIcon />
</Fab>
</AppContent>
</AppWrapper>
</DocumentsThemeProvider>
</NotesThemeProvider>
);
};
@@ -1,7 +1,8 @@
import React from 'react';
import { makeStyles, Paper } from '@material-ui/core';
import FolderIcon from '@material-ui/icons/Folder';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faStickyNote } from '@fortawesome/free-solid-svg-icons';
const useStyles = makeStyles((theme) => ({
header: {
@@ -23,7 +24,7 @@ const NotesTitle = () => {
const classes = useStyles();
return (
<Paper elevation={24} square variant="outlined" className={classes.header}>
<FolderIcon fontSize="large" />
<FontAwesomeIcon icon={faStickyNote} className={classes.icon} size="lg" />
</Paper>
);
};
-18
View File
@@ -1,18 +0,0 @@
import { common, yellow } from '@material-ui/core/colors';
export const DOCUMENTS_APP_PRIMARY_COLOR = yellow[800];
export const DOCUMENTS_APP_ICON_COLOR = common.white;
export const DOCUMENTS_APP_TEXT_COLOR = common.black;
const theme = {
palette: {
primary: {
main: DOCUMENTS_APP_PRIMARY_COLOR,
dark: yellow[900],
light: yellow[500],
contrastText: DOCUMENTS_APP_TEXT_COLOR,
},
},
};
export default theme;
@@ -1,37 +0,0 @@
import { List, ListItem, ListItemIcon, ListItemText } from '@material-ui/core';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import NoteIcon from '@material-ui/icons/Note';
import RecentActorsIcon from '@material-ui/icons/RecentActors';
import { useHistory } from 'react-router';
export default function DoucmentList() {
const { t } = useTranslation();
const history = useHistory();
const [list, setList] = useState([
{
id: 1,
name: t('APPS_DOCUMENTS_NOTES_TITLE'),
icon: <NoteIcon />,
route: '/documents/notes',
},
{
id: 2,
name: t('APPS_DOCUMENTS_LICENSE_TITLE'),
icon: <RecentActorsIcon />,
route: '/documents/licenses',
},
]);
return (
<List disablePadding>
{list.map((l) => (
<ListItem divider button key={l.id} onClick={() => history.push(l.route)}>
<ListItemIcon>{l.icon}</ListItemIcon>
<ListItemText primary={l.name} />
</ListItem>
))}
</List>
);
}
+9 -22
View File
@@ -1,10 +1,8 @@
import React from 'react';
import { Fab, List, ListItem, ListItemText, Box, Typography } from '@material-ui/core';
import { List, ListItem, ListItemText } from '@material-ui/core';
import { useNoteDetail } from '../hooks/useNoteDetail';
import { useNotes } from '../hooks/useNotes';
import { useHistory } from 'react-router-dom';
import useStyles from '../documents.styles';
import AddIcon from '@material-ui/icons/Add';
// add search bar later
// TODO: Add interface for note
@@ -12,31 +10,20 @@ const NoteList = () => {
const history = useHistory();
const { notes } = useNotes();
const { setDetail } = useNoteDetail();
const classes = useStyles();
const handleNoteModal = (note) => {
setDetail(note);
history.push('/documents/notes/detail');
};
const onClickCreate = () => {
setDetail({ title: '', content: '' });
history.push('/documents/notes/detail');
history.push('/notes/detail');
};
return (
<div>
<List disablePadding>
{notes.map((note) => (
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
<ListItemText primary={note.title} secondary={`${note.content.slice(0, 35)}...`} />
</ListItem>
))}
</List>
<Fab className={classes.absolute} onClick={onClickCreate} color="primary">
<AddIcon />
</Fab>
</div>
<List disablePadding>
{notes.map((note) => (
<ListItem key={note.id} button divider onClick={() => handleNoteModal(note)}>
<ListItemText>{note.title}</ListItemText>
</ListItem>
))}
</List>
);
};
+6 -50
View File
@@ -8,7 +8,7 @@ import {
CircularProgress,
Box,
} from '@material-ui/core';
import React, { useState } from 'react';
import React from 'react';
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
import { useNoteDetail } from '../hooks/useNoteDetail';
import useStyles from './modal.styles';
@@ -16,9 +16,7 @@ import Nui from '../../../os/nui-events/utils/Nui';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import { StatusButton } from '../../../ui/components/StatusButton';
import ShareIcon from '@material-ui/icons/Share';
import Modal from '../../../ui/components/Modal';
import { Autocomplete } from '@material-ui/lab';
import { NotesEvents } from '../../../../../typings/notes';
export const NoteModal = () => {
const classes = useStyles();
@@ -26,9 +24,6 @@ export const NoteModal = () => {
const { t } = useTranslation();
const { detail, setDetail } = useNoteDetail();
const [open, setOpen] = useState(false);
const [number, setNumber] = useState('');
const onClose = () => history.goBack();
const _handleClose = () => {
@@ -37,14 +32,14 @@ export const NoteModal = () => {
};
const handleNoteSave = () => {
Nui.send('phone:addNote', detail);
Nui.send(NotesEvents.ADD_NOTE, detail);
setDetail(null);
onClose();
};
const handleDeleteNote = () => {
const id = detail.id;
Nui.send('phone:deleteNote', {
Nui.send(NotesEvents.DELETE_NOTE, {
id,
});
setDetail(null);
@@ -52,48 +47,14 @@ export const NoteModal = () => {
};
const handleUpdateNote = () => {
Nui.send('phone:updateNote', detail);
Nui.send(NotesEvents.UPDATE_NOTE, detail);
setDetail(null);
onClose();
};
const handleShareNoteModal = () => setOpen(true);
const NoteShareModal = () => {
const opts = [
{
title: 'Nice',
},
{
title: 'wtf',
},
];
const handleShareNote = () => {
Nui.send('phone:shareNote', {});
};
return (
<Modal visible={open} handleClose={() => setOpen(false)}>
<Autocomplete
freeSolo
disableClearable
options={opts.map((op) => op.title)}
onChange={(e: any) => setNumber(e.currentTarget.value)}
renderInput={(params) => (
<TextField {...params} label="Search contacts" margin="normal" />
)}
/>
<Button onClick={handleShareNote}>Share</Button>
</Modal>
);
};
return (
<Slide direction="left" in={!!detail}>
<Paper className={classes.modalRoot}>
<NoteShareModal />
<div className={open ? classes.backgroundModal : undefined} />
{!detail ? (
<CircularProgress />
) : (
@@ -106,7 +67,7 @@ export const NoteModal = () => {
startIcon={<ArrowBackIcon fontSize="large" />}
onClick={_handleClose}
>
{t('APPS_DOCUMENTS_NOTES_TITLE')}
{t('APPS_NOTES')}
</Button>
</Box>
<TextField
@@ -166,11 +127,6 @@ export const NoteModal = () => {
{t('GENERIC_DELETE')}
</StatusButton>
</Box>
<Box display="inline" p={1}>
<Button color="primary" onClick={handleShareNoteModal}>
<ShareIcon />
</Button>
</Box>
</>
)}
</Box>
@@ -18,16 +18,6 @@ const useStyles = makeStyles((theme) => ({
fontSize: 20,
lineHeight: 1.2,
},
backgroundModal: {
background: 'black',
opacity: '0.6',
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
zIndex: 5,
},
}));
export default useStyles;
+18
View File
@@ -0,0 +1,18 @@
import { common, yellow } from '@material-ui/core/colors';
export const NOTES_APP_PRIMARY_COLOR = yellow[800];
export const NOTES_APP_ICON_COLOR = common.white;
export const NOTES_APP_TEXT_COLOR = common.black;
const theme = {
palette: {
primary: {
main: NOTES_APP_PRIMARY_COLOR,
dark: yellow[900],
light: yellow[500],
contrastText: NOTES_APP_TEXT_COLOR,
},
},
};
export default theme;
@@ -1,4 +0,0 @@
import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider';
import notesTheme from '../documents.theme';
export const DocumentsThemeProvider = createAppThemeProvider(notesTheme);
@@ -0,0 +1,4 @@
import { createAppThemeProvider } from '../../../os/apps/utils/createAppThemeProvider';
import notesTheme from '../notes.theme';
export const NotesThemeProvider = createAppThemeProvider(notesTheme);
@@ -1,7 +1,7 @@
import { Box, Tooltip, Button } from '@material-ui/core';
import { makeStyles, Theme } from '@material-ui/core/styles';
import React from 'react';
import { MarketplaceListing } from '../../../../../../typings/marketplace';
import { MarketplaceEvents, MarketplaceListing } from '../../../../../../typings/marketplace';
import { useSimcard } from '../../../../os/simcard/hooks/useSimcard';
import DeleteIcon from '@material-ui/icons/Delete';
import ReportIcon from '@material-ui/icons/Report';
@@ -10,6 +10,7 @@ import PhoneIcon from '@material-ui/icons/Phone';
import Nui from '../../../../os/nui-events/utils/Nui';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router';
import { CallEvents } from '../../../../../../typings/call';
const useStyles = makeStyles((theme: Theme) => ({
icon: {
@@ -24,17 +25,17 @@ export const ListingActions = ({ listing }: { listing: MarketplaceListing }) =>
const history = useHistory();
const handleDeleteListing = () => {
Nui.send('phone:marketplaceDeleteListing', {
Nui.send(MarketplaceEvents.DELETE_LISTING, {
id: listing.id,
});
};
const handleReportListing = () => {
Nui.send('phone:reportListing', listing);
Nui.send(MarketplaceEvents.REPORT_LISTING, listing);
};
const handleCall = () => {
Nui.send('phone:beginCall', {
Nui.send(CallEvents.INITIALIZE_CALL, {
number: listing.number,
});
};
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { makeStyles, Button, TextField } from '@material-ui/core';
import Nui from '../../../../os/nui-events/utils/Nui';
import { MarketplaceEvents } from '../../../../../../typings/marketplace';
const useStyles = makeStyles((theme) => ({
root: {
@@ -34,7 +35,7 @@ export const ListingForm = () => {
const [description, setDescription] = useState('');
const addListing = () => {
Nui.send('phone:addListing', {
Nui.send(MarketplaceEvents.ADD_LISTING, {
title,
url,
description,
@@ -67,12 +67,13 @@ interface ISettingSwitch {
value: boolean;
onClick: any;
icon: JSX.Element;
secondary: string;
}
export const SettingSwitch = ({ label, value, onClick, icon }: ISettingSwitch) => (
export const SettingSwitch = ({ label, value, onClick, icon, secondary }: ISettingSwitch) => (
<ListItem divider button>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={label} />
<ListItemText primary={label} secondary={secondary} />
<ListItemSecondaryAction>
<Switch color="primary" checked={value} onChange={() => onClick(value)} />
</ListItemSecondaryAction>
@@ -25,10 +25,15 @@ import {
LibraryMusic,
VolumeUp,
FileCopy,
Book,
DeleteForever,
} from '@material-ui/icons';
import { ListSubheader } from '@material-ui/core';
import { useSettings } from '../hooks/useSettings';
import { useResetSettings, useSettings } from '../hooks/useSettings';
import { setClipboard } from '../../../os/phone/hooks/useClipboard';
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
import { IContextMenuOption } from '../../../ui/components/ContextMenu';
const SubHeaderComp = (props: { text: string }) => (
<ListSubheader color="primary" component="div" disableSticky>
@@ -42,8 +47,10 @@ export const SettingsApp = () => {
const simcard = useSimcard();
const [settings, setSettings] = useSettings();
const { t } = useTranslation();
// TODO: Uncomment when #135 is merged
// const { addAlert } = useSnackbar();
const { addAlert } = useSnackbar();
const resetSettings = useResetSettings();
const handleSettingChange = (key: string | number, value: unknown) => {
setSettings({ ...settings, [key]: value });
@@ -84,16 +91,35 @@ export const SettingsApp = () => {
),
);
const languages = config.languages.map(
MapSettingItem(settings.language, (val: SettingOption) => handleSettingChange('language', val)),
);
const handleResetOptions = () => {
resetSettings();
addAlert({
message: t('SETTINGS.MESSAGES.SETTINGS_RESET'),
type: 'success',
});
};
const resetSettingsOpts: IContextMenuOption[] = [
{
selected: false,
onClick: () => handleResetOptions(),
key: 'RESET_SETTINGS',
label: t('SETTINGS.OPTIONS.RESET_SETTINGS'),
},
];
const handleCopyPhoneNumber = () => {
// TODO: Dependent on #132 merge
// setClipboard(simcard.number)
// TODO: Dependent on #135 merge
// addAlert({
// message: t('GENERIC_WRITE_TO_CLIPBOARD_MESSAGE', {
// content: 'number',
// }),
// type: 'success',
// });
setClipboard(simcard.number);
addAlert({
message: t('GENERIC_WRITE_TO_CLIPBOARD_MESSAGE', {
content: 'number',
}),
type: 'success',
});
};
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
@@ -101,7 +127,7 @@ export const SettingsApp = () => {
<AppWrapper>
<AppTitle app={settingsApp} />
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
<List disablePadding subheader={<SubHeaderComp text="Phone" />}>
<List disablePadding subheader={<SubHeaderComp text={t('SETTINGS.CATEGORY.PHONE')} />}>
<SettingItemIconAction
label={t('APPS_SETTINGS_PHONE_NUMBER')}
labelSecondary={simcard.number}
@@ -140,12 +166,20 @@ export const SettingsApp = () => {
/>
<SettingSwitch
label={t('APPS_SETTINGS_OPTION_STREAMER_MODE')}
secondary={t('APPS_SETTING_STREAMER_MODE_DESC')}
icon={<VisibilityOffIcon />}
value={settings.streamerMode}
onClick={(curr) => handleSettingChange('streamerMode', !curr)}
/>
</List>
<List disablePadding subheader={<SubHeaderComp text="Appearance" />}>
<List disablePadding subheader={<SubHeaderComp text={t('SETTINGS.CATEGORY.APPEARANCE')} />}>
<SettingItem
label={t('SETTINGS.OPTIONS.LANGUAGE')}
value={settings.language.label}
options={languages}
onClick={openMenu}
icon={<Book />}
/>
<SettingItem
label={t('APPS_SETTINGS_OPTION_THEME')}
value={settings.theme.label}
@@ -197,6 +231,15 @@ export const SettingsApp = () => {
icon={<VolumeUp />}
/>
</List>
<List disablePadding subheader={<SubHeaderComp text={t('SETTINGS.CATEGORY.ACTIONS')} />}>
<SettingItem
label={t('SETTINGS.OPTIONS.RESET_SETTINGS')}
value={`${t('SETTINGS.OPTIONS.RESET_SETTINGS_DESC')}`}
icon={<DeleteForever />}
onClick={openMenu}
options={resetSettingsOpts}
/>
</List>
</AppContent>
<ContextMenu />
</AppWrapper>
+93 -20
View File
@@ -1,31 +1,67 @@
import { atom, DefaultValue, SetterOrUpdater, useRecoilState } from 'recoil';
import { atom, DefaultValue, useRecoilState, useResetRecoilState } from 'recoil';
import { SETTINGS_ALL_TWEETS, SETTING_MENTIONS } from '../../../../../typings/twitter';
import config from '../../../config/default.json';
import { SettingOption } from '../../../ui/hooks/useContextMenu';
import { Schema, Validator } from 'jsonschema';
const localStorageEffect = (key) => ({ setSelf, onSet }) => {
const savedVal = localStorage.getItem(key);
if (savedVal != null) {
setSelf(JSON.parse(savedVal));
}
const NPWD_STORAGE_KEY = 'npwd_settings';
onSet((newValue) => {
if (newValue instanceof DefaultValue) {
localStorage.removeItem(key);
} else {
localStorage.setItem(key, JSON.stringify(newValue));
}
});
const v = new Validator();
const settingOptionSchema: Schema = {
id: '/SettingOption',
type: 'object',
properties: {
label: { type: 'string' },
val: { type: 'string' },
},
required: true,
};
export const settingsState = atom({
key: 'settings',
default: config.defaultSettings,
effects_UNSTABLE: [localStorageEffect('npwd_settings')],
});
const settingsSchema: Schema = {
type: 'object',
properties: {
language: { $ref: '/SettingOption' },
wallpaper: { $ref: '/SettingOption' },
frame: { $ref: '/SettingOption' },
theme: { $ref: '/SettingOption' },
zoom: { $ref: '/SettingOption' },
streamerMode: { type: 'boolean' },
ringtone: { $ref: '/SettingOption' },
ringtoneVol: { type: 'number' },
notiSound: { $ref: '/SettingOption' },
notiSoundVol: { type: 'number' },
TWITTER_notiFilter: { $ref: '/SettingOption' },
TWITTER_notiSound: { $ref: '/SettingOption' },
TWITTER_notiSoundVol: { type: 'number' },
TWITTER_notifyNewFeedTweet: { type: 'boolean' },
},
required: true,
};
v.addSchema(settingOptionSchema, '/SettingOption');
function isSchemaValid(schema: string): boolean {
const storedSettings = JSON.parse(schema);
const resp = v.validate(storedSettings, settingsSchema);
return resp.valid;
}
export function isSettingsSchemaValid(): boolean {
const localStore = localStorage.getItem(NPWD_STORAGE_KEY);
if (localStore) {
try {
const parsedSettings = JSON.parse(localStore);
return v.validate(parsedSettings, settingsSchema).valid;
} catch (e) {
console.error('Unable to parse settings JSON', e);
}
}
return true;
}
export interface IPhoneSettings {
language: SettingOption;
wallpaper: SettingOption;
frame: SettingOption;
theme: SettingOption;
@@ -41,6 +77,43 @@ export interface IPhoneSettings {
TWITTER_notifyNewFeedTweet: boolean;
}
export const useSettings = (): [IPhoneSettings, SetterOrUpdater<any>] => {
const localStorageEffect = (key) => ({ setSelf, onSet }) => {
const savedVal = localStorage.getItem(key);
if (savedVal) {
try {
const validString = isSchemaValid(savedVal);
if (validString) {
setSelf(JSON.parse(savedVal));
} else {
console.error('Settings Schema was invalid, applying default settings');
setSelf(config.defaultSettings);
}
} catch (e) {
// If we are unable to parse the json string, we set default settings
console.error('Unable to parse JSON');
setSelf(config.defaultSettings);
}
}
onSet((newValue) => {
if (newValue instanceof DefaultValue) {
localStorage.removeItem(key);
} else {
localStorage.setItem(key, JSON.stringify(newValue));
}
});
};
export const settingsState = atom({
key: 'settings',
default: config.defaultSettings,
effects_UNSTABLE: [localStorageEffect(NPWD_STORAGE_KEY)],
});
export const useSettings = () => {
return useRecoilState(settingsState);
};
export const useResetSettings = () => {
return useResetRecoilState(settingsState);
};
@@ -1,4 +1,3 @@
export const getRingtonePath = (name?: string) => `./media/ringtones/${name || 'pixel'}.ogg`;
export const getRingtonePath = (name?: string) => `media/ringtones/${name || 'pixel'}.ogg`;
export const getNotificationPath = (name?: string) =>
`./media/notifications/${name || 'online'}.ogg`;
export const getNotificationPath = (name?: string) => `media/notifications/${name || 'online'}.ogg`;
@@ -15,7 +15,7 @@ import ControlButtons from './buttons/ControlButtons';
import IconButtons from './buttons/IconButtons';
import { usePhone } from '../../../os/phone/hooks/usePhone';
import { getNewLineCount } from '../utils/message';
import { NewTweet } from '../../../../../typings/twitter';
import { NewTweet, TwitterEvents } from '../../../../../typings/twitter';
const useStyles = makeStyles((theme) => ({
root: {
@@ -110,7 +110,7 @@ export const AddTweetModal = () => {
images:
images && images.length > 0 ? images.map((image) => image.link).join(IMAGE_DELIMITER) : '',
};
Nui.send('phone:createTweet', data);
Nui.send(TwitterEvents.CREATE_TWEET, data);
_handleClose();
};
@@ -20,6 +20,7 @@ import { useProfile } from '../hooks/useProfile';
import ProfilePrompt from './profile/ProfilePrompt';
import InjectDebugData from '../../../os/debug/InjectDebugData';
import { TwitterThemeProvider } from '../providers/TwitterThemeProvider';
import { TwitterEvents } from '../../../../../typings/twitter';
const useStyles = makeStyles(() => ({
backgroundModal: {
@@ -34,31 +35,15 @@ const useStyles = makeStyles(() => ({
},
}));
const TWEETS_REFRESH_RATE = 15000; // TODO move this to twitter config
export const TwitterApp = () => {
const classes = useStyles();
const { modalVisible, setModalVisible } = useModal();
const [activePage, setActivePage] = useState(0);
const { profile } = useProfile();
useEffect(() => {
// this is a polling implementation. It is possible that
// there is some interaction where, on a new tweet, all
// clients are sent the updated query data. Until that can
// be accomplished this is naive but robust.
//
// TODO don't call fetchTweets - implement a function that only
// returns tweets that we don't already have
const timeout = window.setTimeout(() => {
Nui.send('phone:fetchTweets', {});
}, TWEETS_REFRESH_RATE);
return () => window.clearTimeout(timeout);
}, []);
// before any other action can be taken by the user we force
// them have a profile name
const promptProfileName = profile && (!profile.profile_name || !profile.profile_name.trim());
// them have a profile name.
const promptProfileName = !profile || !profile.profile_name || !profile.profile_name.trim();
const openModal = () => setModalVisible(true);
const handlePageChange = (e, page) => setActivePage(page);
@@ -7,6 +7,7 @@ import TweetList from './tweet/TweetList';
import Nui from '../../../os/nui-events/utils/Nui';
import SearchButton from './buttons/SearchButton';
import { useFilteredTweets } from '../hooks/useFilteredTweets';
import { TwitterEvents } from '../../../../../typings/twitter';
const useStyles = makeStyles({
root: {
@@ -32,7 +33,7 @@ function TwitterSearch() {
const cleanedSearchValue = searchValue.trim();
if (!cleanedSearchValue) return;
Nui.send('phone:fetchTweetsFiltered', cleanedSearchValue);
Nui.send(TwitterEvents.FETCH_TWEETS_FILTERED, cleanedSearchValue);
};
const filteredTweets = tweets || [];
@@ -4,6 +4,7 @@ import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder';
import FavoriteIcon from '@material-ui/icons/Favorite';
import Nui from '../../../../os/nui-events/utils/Nui';
import { TwitterEvents } from '../../../../../../typings/twitter';
const LOADING_TIME = 1250;
@@ -12,7 +13,7 @@ function LikeButton({ tweetId, isLiked }) {
const [loading, setLoading] = useState(false);
const handleClick = () => {
Nui.send('phone:toggleLike', tweetId);
Nui.send(TwitterEvents.TOGGLE_LIKE, tweetId);
setLoading(true);
window.setTimeout(() => {
setLiked(!liked);
@@ -4,6 +4,7 @@ import { Button, CircularProgress, MenuItem } from '@material-ui/core';
import DoneIcon from '@material-ui/icons/Done';
import Nui from '../../../../os/nui-events/utils/Nui';
import { TwitterEvents } from '../../../../../../typings/twitter';
const LOADING_TIME = 1250;
@@ -12,7 +13,7 @@ function ReportButton({ handleClose, tweetId, isReported }) {
const [loading, setLoading] = useState(false);
const handleClick = () => {
Nui.send('phone:reportTweet', tweetId);
Nui.send(TwitterEvents.REPORT, tweetId);
setLoading(true);
window.setTimeout(() => {
setLoading(false);
@@ -3,6 +3,7 @@ import { CircularProgress, makeStyles, Button } from '@material-ui/core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faRetweet } from '@fortawesome/free-solid-svg-icons';
import Nui from '../../../../os/nui-events/utils/Nui';
import { TwitterEvents } from '../../../../../../typings/twitter';
interface IProps {
tweetId: number;
@@ -33,7 +34,7 @@ export const RetweetButton = ({ tweetId, isRetweet, retweetId }: IProps) => {
// if someone is retweeting something that is itself a retweet
// then we want to retweet the original post (if we haven't already)
const idToRetweet = isRetweet ? retweetId : tweetId;
Nui.send('phone:retweet', idToRetweet);
Nui.send(TwitterEvents.RETWEET, idToRetweet);
setLoading(true);
window.setTimeout(() => {
setRetweeted(true);
@@ -0,0 +1,70 @@
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import InputLabel from '@material-ui/core/InputLabel';
import FormControl from '@material-ui/core/FormControl';
import Select from '@material-ui/core/Select';
import { useTranslation } from 'react-i18next';
import ProfileUpdateButton from '../buttons/ProfileUpdateButton';
interface IProps {
handleUpdate: () => void;
profileName: string;
setProfileName: (name: string) => void;
defaultProfileNames: string[];
}
const useStyles = makeStyles((theme) => ({
root: {
position: 'relative',
width: '100%',
height: '100%',
padding: '15px',
},
formControl: {
width: '100%',
},
}));
export function DefaultProfilePrompt({
profileName,
setProfileName,
handleUpdate,
defaultProfileNames,
}: IProps): JSX.Element {
const classes = useStyles();
const { t } = useTranslation();
const handleChange = (event: React.ChangeEvent<any>): void => {
event.preventDefault();
setProfileName(event.target.value);
};
return (
<div className={classes.root}>
<FormControl className={classes.formControl}>
<InputLabel htmlFor="profile-name">
{t('APPS_TWITTER_EDIT_DEFAULT_PROFILE_NAME')}
</InputLabel>
<Select
value={profileName}
onChange={handleChange}
inputProps={{
name: 'profileName',
id: 'profile-name',
}}
>
<option value="" />
{defaultProfileNames.map((name) => (
<option key={name} value={name}>
{name}
</option>
))}
</Select>
</FormControl>
<ProfileUpdateButton handleClick={handleUpdate} />
</div>
);
}
export default DefaultProfilePrompt;
@@ -8,6 +8,7 @@ import Avatar from '../Avatar';
import ProfileField from './ProfileField';
import ProfileUpdateButton from '../buttons/ProfileUpdateButton';
import { usePhone } from '../../../../os/phone/hooks/usePhone';
import { TwitterEvents } from '../../../../../../typings/twitter';
const useStyles = makeStyles((theme) => ({
root: {
@@ -46,7 +47,7 @@ export function Profile() {
location,
job,
};
Nui.send('phone:updateTwitterProfile', data);
Nui.send(TwitterEvents.UPDATE_PROFILE, data);
};
// fetching the config is an asynchronous call so defend against it
@@ -5,7 +5,12 @@ import { useTranslation } from 'react-i18next';
import Nui from '../../../../os/nui-events/utils/Nui';
import { useProfile } from '../../hooks/useProfile';
import ProfileField from './ProfileField';
import DefaultProfilePrompt from './DefaultProfilePrompt';
import ProfileUpdateButton from '../buttons/ProfileUpdateButton';
import { useRecoilValue } from 'recoil';
import { twitterState } from '../../hooks/state';
import { usePhone } from '../../../../os/phone/hooks/usePhone';
import { TwitterEvents } from '../../../../../../typings/twitter';
const useStyles = makeStyles((theme) => ({
root: {
@@ -23,23 +28,43 @@ export function ProfilePrompt() {
const classes = useStyles();
const { t } = useTranslation();
const { profile } = useProfile();
const defaultProfileNames = useRecoilValue(twitterState.defaultProfileNames);
const [profileName, setProfileName] = useState(profile?.profile_name || '');
const { config } = usePhone();
const [name, handleNameChange] = useState(profile.profile_name || '');
const showDefaultProfileNames = !config.twitter.allowEdtiableProfileName && !profile;
const eventName = showDefaultProfileNames
? TwitterEvents.CREATE_PROFILE
: TwitterEvents.UPDATE_PROFILE;
const handleUpdate = () => {
const data = {
Nui.send(eventName, {
...profile,
profile_name: name,
};
Nui.send('phone:updateTwitterProfile', data);
profile_name: profileName,
});
};
// case where profile doesn't exist, couldn't be created automatically
// and the player is not allowed to edit their own profile name
if (showDefaultProfileNames) {
return (
<DefaultProfilePrompt
profileName={profileName}
defaultProfileNames={defaultProfileNames}
setProfileName={setProfileName}
handleUpdate={handleUpdate}
/>
);
}
// case where profile doesn't exist, couldn't be created automatically
// but the player IS allowed to edit their own profile name
return (
<div className={classes.root}>
<ProfileField
label={t('APPS_TWITTER_EDIT_PROFILE_NAME')}
value={name}
handleChange={handleNameChange}
value={profileName}
handleChange={setProfileName}
allowChange
/>
<ProfileUpdateButton handleClick={handleUpdate} />
@@ -5,31 +5,10 @@ import MoreIcon from '@material-ui/icons/MoreVert';
import { usePhone } from '../../../../os/phone/hooks/usePhone';
import Nui from '../../../../os/nui-events/utils/Nui';
import ReportButton from '../buttons/ReportButton';
/**
* Ok this is some bullshit. Due to either scaling issues or the NUI
* overlay being different than the display resolution just letting
* material-ui determine what the anchor positioning of the popover
* is not reliable and has some error that appears to scale vertically.
*
* This vertical offset raises the popover positioning implementing the
* transformOrigin prop that material-ui's Popover element provides.
*
* These coefficients are NOT based on any known offsets or calc()
* functions. They are empiricallly determined. The actual scaling issue
* does NOT appear to be linear, but over the comparatively low height
* of the phone compared to the window it produces results that are within
* acceptable tolerances from the player's perspective.
* @param top - the computed distance from the top of the window to the top
* of the anchor element
*/
function calculateVerticalOffset(top: number): number {
return top * 0.2 - 38;
}
import { TwitterEvents } from '../../../../../../typings/twitter';
export const ShowMore = ({ id, isReported, isMine }) => {
const [anchorEl, setAnchorEl] = useState<Element | null>(null);
const [verticalOffset, setVerticalOffset] = useState(0);
const { t } = useTranslation();
const { config } = usePhone();
@@ -38,18 +17,14 @@ export const ShowMore = ({ id, isReported, isMine }) => {
const handleClick = (event: React.MouseEvent) => {
const element = event.currentTarget;
setAnchorEl(element);
const top = window.pageYOffset + element.getBoundingClientRect().top;
setVerticalOffset(calculateVerticalOffset(top));
};
const handleClose = () => {
setAnchorEl(null);
setVerticalOffset(0);
};
const handleDeleteTweet = () => {
Nui.send('phone:deleteTweet', id);
Nui.send(TwitterEvents.DELETE_TWEET, id);
handleClose();
};
@@ -72,7 +47,7 @@ export const ShowMore = ({ id, isReported, isMine }) => {
open={Boolean(anchorEl)}
onClose={handleClose}
transformOrigin={{
vertical: verticalOffset,
vertical: -30,
horizontal: 'left',
}}
>
@@ -4,13 +4,14 @@ import Nui from '../../../../os/nui-events/utils/Nui';
import { useTweets } from '../../hooks/useTweets';
import { useTwitterNotifications } from '../../hooks/useTwitterNotifications';
import TweetList from './TweetList';
import { TwitterEvents } from '../../../../../../typings/twitter';
export function TweetListContainer() {
const { tweets } = useTweets();
const { setUnreadCount } = useTwitterNotifications();
useEffect(() => {
Nui.send('phone:fetchTweets', {});
Nui.send(TwitterEvents.FETCH_TWEETS, {});
}, []);
useEffect(() => {
+4
View File
@@ -5,6 +5,10 @@ export const twitterState = {
key: 'profile',
default: null,
}),
defaultProfileNames: atom({
key: 'defaultProfileNames',
default: null,
}),
tweets: atom({
key: 'tweets',
default: null,
@@ -1,6 +1,7 @@
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import { useRecoilState, useRecoilValue } from 'recoil';
import { Tweet, Profile } from '../../../../../typings/twitter';
import { useApp } from '../../../os/apps/hooks/useApps';
import { useNotifications } from '../../../os/notifications/hooks/useNotifications';
@@ -11,7 +12,7 @@ import { twitterState } from './state';
const NOTIFICATION_ID = 'twitter:broadcast';
function isMentioned(profileName: string, message: string) {
return !message.toLowerCase().includes(profileName.toLowerCase());
return message.toLowerCase().includes(profileName.toLowerCase());
}
export const useTwitterNotifications = () => {
@@ -24,14 +25,21 @@ export const useTwitterNotifications = () => {
const { icon, notificationIcon } = useApp('TWITTER');
const [unreadCount, setUnreadCount] = useRecoilState(twitterState.unreadTweetsCount);
const profile = useRecoilValue(twitterState.profile);
const profile: Profile | null = useRecoilValue(twitterState.profile);
const setNotification = ({ profile_name, message, isRetweet }) => {
const setNotification = ({ profile_name, message, isRetweet }: Tweet) => {
const titleStr = isRetweet
? 'APPS_TWITTER_NEW_RETWEET_BROADCAST'
: 'APPS_TWITTER_NEW_BROADCAST';
const currentProfileName = profile.profile_name;
// profile defaults to null, if for some reason it is not initialized
// defend against this case
if (!profile) return;
// Prevents a crash if there is no current profile
// set and a Twitter broadcast occurs.
const currentProfileName = profile?.profile_name;
// we don't want notifications of our own tweets
if (currentProfileName === profile_name) return;
@@ -39,7 +47,7 @@ export const useTwitterNotifications = () => {
// mentioned in
if (
settings.TWITTER_notiFilter.value === SETTING_MENTIONS &&
isMentioned(currentProfileName, message)
!isMentioned(currentProfileName, message)
)
return;
@@ -1,4 +1,4 @@
import { useSetRecoilState } from 'recoil';
import { useRecoilState, useSetRecoilState } from 'recoil';
import { v4 as uuidv4 } from 'uuid';
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
@@ -8,13 +8,14 @@ import { twitterState } from './state';
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
import { useTwitterNotifications } from './useTwitterNotifications';
import { useTranslation } from 'react-i18next';
import { Tweet, FormattedTweet, Profile } from '../../../../../typings/twitter';
/**
* Perform all necessary processing/transforms from the raw database
* data to what the frontend expects
* @param {object} tweet - full JSON returned from the server/database
*/
function processTweet(tweet) {
function processTweet(tweet: Tweet): FormattedTweet {
// we store images in the database as a varchar field with
// comma separated links to images, so here we split them
// back into their distinct members
@@ -23,6 +24,23 @@ function processTweet(tweet) {
return { ...tweet, images };
}
/**
* in the case a tweet is broadcasted we can make some assumptions
* that it is brand new and hasn't been liked. We should also need
* to overwrite isMine since that will be true (sourced from another
* player's tweet)
}
* @param tweet - tweet to process
* @param playerIdentifier - the current player's identifier
* @returns Formatted Tweet
*/
function processBroadcastedTweet(tweet: Tweet, profile: Profile): FormattedTweet {
const processedTweet = processTweet(tweet);
const isLiked = false;
const isMine = profile?.identifier === tweet.identifier;
return { ...processedTweet, isMine, isLiked };
}
/**
* Service to handle all NUI <> client interactions. We take
* this opportunity to act as a middleware layer between the
@@ -35,12 +53,13 @@ export const useTwitterService = () => {
const { setNotification } = useTwitterNotifications();
const { t } = useTranslation();
const setProfile = useSetRecoilState(twitterState.profile);
const [profile, setProfile] = useRecoilState<Profile>(twitterState.profile);
const setUpdateProfileLoading = useSetRecoilState(twitterState.updateProfileLoading);
const setTweets = useSetRecoilState(twitterState.tweets);
const [currentTweets, setTweets] = useRecoilState(twitterState.tweets);
const setFilteredTweets = useSetRecoilState(twitterState.filteredTweets);
const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading);
const setDefaultProfileNames = useSetRecoilState(twitterState.defaultProfileNames);
const _setTweets = (tweets) => {
setTweets(tweets.map(processTweet));
@@ -49,6 +68,14 @@ export const useTwitterService = () => {
setFilteredTweets(tweets.map(processTweet));
};
// these tweets are coming directly from other player clients
const handleTweetBroadcast = (tweet: Tweet) => {
setNotification(tweet);
const processedTweet = processBroadcastedTweet(tweet, profile);
const updatedTweets = [processedTweet].concat(currentTweets);
setTweets(updatedTweets);
};
const handleAddAlert = ({ message, type }: IAlert) => {
addAlert({
message: t(`APPS_${message}`),
@@ -57,12 +84,14 @@ export const useTwitterService = () => {
};
useNuiEvent(APP_TWITTER, 'getOrCreateTwitterProfile', setProfile);
useNuiEvent(APP_TWITTER, 'getOrCreateTwitterProfileNull', setDefaultProfileNames);
useNuiEvent(APP_TWITTER, 'phone:createProfileResult', handleAddAlert);
useNuiEvent(APP_TWITTER, 'updateProfileLoading', setUpdateProfileLoading);
useNuiEvent(APP_TWITTER, 'updateProfileResult', handleAddAlert);
useNuiEvent(APP_TWITTER, 'fetchTweets', _setTweets);
useNuiEvent(APP_TWITTER, 'fetchTweetsFiltered', _setFilteredTweets);
useNuiEvent(APP_TWITTER, 'createTweetLoading', setCreateLoading);
useNuiEvent(APP_TWITTER, 'createTweetResult', handleAddAlert);
useNuiEvent(APP_TWITTER, 'createTweetBroadcast', setNotification);
useNuiEvent(APP_TWITTER, 'createTweetBroadcast', handleTweetBroadcast);
useNuiEvent(APP_TWITTER, 'phone:retweetExists', handleAddAlert);
};
+2 -2
View File
@@ -1,5 +1,5 @@
export const IMG_DEFAULT_AVATAR = './media/twitter/egg.png';
export const IMG_INVALID_AVATAR = './media/twitter/invalid.png';
export const IMG_DEFAULT_AVATAR = 'media/twitter/egg.png';
export const IMG_INVALID_AVATAR = 'media/twitter/invalid.png';
export const APP_TWITTER = 'TWITTER';
export const SETTING_MENTIONS = 'mentions';
+44 -2
View File
@@ -1,6 +1,6 @@
{
"cellProvider": "AT&T",
"language": "en",
"defaultLanguage": "en",
"wallpapers": [
{
"label": "Minimal",
@@ -67,6 +67,44 @@
"value": 0.7
}
],
"languages": [
{
"label": "English",
"value": "en"
},
{
"label": "Español",
"value": "es"
},
{
"label": "Français",
"value": "fr"
},
{
"label": "Türk",
"value": "tr"
},
{
"label": "Norsk",
"value": "no"
},
{
"label": "Svenska",
"value": "sv"
},
{
"label": "Português",
"value": "pt"
},
{
"label": "Português (BR)",
"value": "ptbr"
},
{
"label": "Bosanski",
"value": "ba"
}
],
"ringtones": [
{
"label": "Marimba",
@@ -98,6 +136,10 @@
}
],
"defaultSettings": {
"language": {
"label": "English",
"value": "en"
},
"wallpaper": {
"label": "Project Error",
"value": "projecterror.jpg"
@@ -107,7 +149,7 @@
"value": "default.png"
},
"theme": {
"label": "taso-dark",
"label": "Taso Dark",
"value": "taso-dark"
},
"zoom": {
+7 -5
View File
@@ -3,7 +3,7 @@ import { initReactI18next } from 'react-i18next';
import en from './locale/en.json';
import es from './locale/es.json';
import fr from './locale/fr.json';
import bs from './locale/bs.json';
import ba from './locale/ba.json';
import sv from './locale/sv.json';
import no from './locale/no.json';
import tr from './locale/tr.json';
@@ -15,7 +15,7 @@ const resources = {
en,
es,
fr,
bs,
ba,
no,
sv,
tr,
@@ -27,9 +27,11 @@ i18n
.use(initReactI18next) // passes i18n down to react-i18next
.init({
resources,
lng: config.language,
keySeparator: false, // we do not use keys in form messages.welcome
lng: config.defaultLanguage,
react: {
bindI18n: 'languageChanged',
},
keySeparator: '.', // we do not use keys in form messages.welcome
interpolation: {
escapeValue: false, // react already safes from xss
+6
View File
@@ -9,6 +9,12 @@ import './main.css';
import PhoneConfig from './config/default.json';
import { PhoneContainer } from './PhoneContainer';
import attachMockNuiEvent from './os/debug/AttachMockNuiEvent';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import updateLocale from 'dayjs/plugin/updateLocale';
dayjs.extend(relativeTime);
dayjs.extend(updateLocale);
// Enable Sentry when config setting is true and when in prod
if (PhoneConfig.SentryErrorMetrics && process.env.NODE_ENV !== 'development') {
@@ -11,7 +11,7 @@
"APPS_CALCULATOR": "Calculator",
"APPS_SETTINGS": "Postavke",
"APPS_BANK": "WhoDis Banka",
"APPS_DOCUMENTS": "Bilješke",
"APPS_NOTES": "Bilješke",
"APPS_EXAMPLE": "Primjerna Aplikacija",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
@@ -97,12 +97,12 @@
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Dodajte kontakt",
"APPS_DOCUMENTS_ADD_SUCCESS": "Bilješka je uspješno spremljena.",
"APPS_DOCUMENTS_ADD_FAILED": "Spremanje bilješke nije uspjelo.",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Bilješka je uspješno ažurirana.",
"APPS_DOCUMENTS_UPDATE_FAILED": "Ažuriranje bilješke nije uspjelo.",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Bilješka je uspješno izbrisana.",
"APPS_DOCUMENTS_DELETE_FAILED": "Brisanje bilješke nije uspjelo.",
"APPS_NOTES_ADD_SUCCESS": "Bilješka je uspješno spremljena.",
"APPS_NOTES_ADD_FAILED": "Spremanje bilješke nije uspjelo.",
"APPS_NOTES_UPDATE_SUCCESS": "Bilješka je uspješno ažurirana.",
"APPS_NOTES_UPDATE_FAILED": "Ažuriranje bilješke nije uspjelo.",
"APPS_NOTES_DELETE_SUCCESS": "Bilješka je uspješno izbrisana.",
"APPS_NOTES_DELETE_FAILED": "Brisanje bilješke nije uspjelo.",
"APPS_CALCULATOR_COPIED": "Rezultat je kopiran u međuspremnik!",
-127
View File
@@ -1,127 +0,0 @@
{
"translation": {
"DATE_FORMAT": "MM/DD/YYYY",
"DATE_TIME_FORMAT": "MM/DD/YYYY hh:mm A",
"COMING_SOON": "Coming soon...",
"APPS_DIALER": "Telephone",
"APPS_CONTACTS": "Contacti",
"APPS_MESSAGES": "Poruke",
"APPS_CALCULATOR": "Calculator",
"APPS_SETTINGS": "Postavke",
"APPS_BANK": "WhoDis Banka",
"APPS_DOCUMENTS": "Bilješke",
"APPS_EXAMPLE": "Primjerna Aplikacija",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
"APPS_CAMERA": "Camera",
"APPS_DIALER_INCOMING_CALL_TITLE": "Incoming Phone Call",
"APPS_DIALER_CURRENT_CALL_TITLE": "Current Phone Call",
"APPS_DIALER_CURRENT_CALL_WITH": "In call with {{ transmitter }}",
"APPS_DIALER_TRANSMITTER_IS_CALLING": "{{ transmitter }} is calling you!",
"APPS_DIALER_ACCEPT_CALL": "Accept",
"APPS_DIALER_REJECT_CALL": "Reject",
"APPS_DIALER_END_CALL": "End",
"APPS_TWITTER_TWEET": "Tweet",
"APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "Šta ima?",
"APPS_TWITTER_IMAGE_PLACEHOLDER": "Link do vašeg slike ili gifa",
"APPS_TWITTER_SUBMIT_IMAGE": "Dodati Slike",
"APPS_TWITTER_CLOSE_IMAGE": "Zatvori",
"APPS_TWITTER_CLOSE": "Zatvori",
"APPS_TWITTER_DELETE": "Izbriši",
"APPS_TWITTER_REPORT": "Prijavi",
"APPS_TWITTER_REPORTED": "Prijavio",
"APPS_TWITTER_JUST_NOW": "Tek Sada",
"APPS_TWITTER_SEARCH_TWEETS": "Potražite za tweet",
"APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER": "Pretražite sa imenom profila ili poruke",
"APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT": "Poruka ide preko ograničenje broj Slova",
"APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT": "Message is over the new line limit",
"APPS_TWITTER_CREATE_SUCCESS": "Vaš tweet je uspješno poslan",
"APPS_TWITTER_CREATE_FAILED": "Slanje vašeg tweeta nije uspjelo",
"APPS_TWITTER_EDIT_PROFILE_AVATAR": "URL za avatar",
"APPS_TWITTER_EDIT_PROFILE_NAME": "Ime profila",
"APPS_TWITTER_EDIT_PROFILE_BIO": "Descriptcia",
"APPS_TWITTER_EDIT_PROFILE_LOCATION": "Lokacija",
"APPS_TWITTER_EDIT_PROFILE_JOB": "Posao",
"APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Ažuriran vam je profil!",
"APPS_TWITTER_EDIT_PROFILE_FAILURE": "Nismo uspjeli ažurirati vaš profil!",
"APPS_TWITTER_TIME_JUST_NOW": "Tek Sada",
"APPS_TWITTER_TIME_MINUTES": "m",
"APPS_TWITTER_TIME_HOURS": "h",
"APPS_TWITTER_TIME_DAYS": "d",
"APPS_TWITTER_NEW_BROADCAST": "New tweet from @{{ profile_name }}!",
"APPS_TWITTER_UNREAD_MESSAGES": "You have {{ count }} new tweets in your timeline!",
"APPS_BANK_TRANSFER": "Prebaciti Novac",
"APPS_BANK_HOME_TITLE": "Dobrodošli!",
"APPS_BANK_ACCOUNT_LINK": "Račun",
"APPS_BANK_TIME_JUST_NOW": "Tek Sada",
"APPS_BANK_ACCOUNT_TITLE": "Sažetak računa",
"APPS_BANK_ACCOUNT_TRANSACTIONS": "Transakcije",
"APPS_BANK_ACCOUNT_SEE_TRANSACTION": "Vidjeti sve",
"APPS_BANK_ACTIONS_TRANSFER": "Prebaciti Novac",
"APPS_BANK_ALERT_TRANSFER_SUCCESS": "uspješno prebacio novac!",
"APPS_BANK_ALERT_TRANSFER_FAILURE": "Nismo uspjeli prebaciti novac!",
"APPS_MESSAGES_SEARCH_PLACEHOLDER": "Po tražiti poruke ...",
"APPS_MESSAGES_NEW_MESSAGE": "Poruka...",
"APPS_MESSAGES_NEW_MESSAGE_FAILED:": "Failed to send message",
"APPS_MESSAGES_NEW_MESSAGE_GROUP": "Brojevi Telephona...",
"APPS_MESSAGES_GROUP_CHAT_LABEL": "Oznaka grupnog chata...",
"APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT": "Pošalji",
"APPS_MESSAGES_INVALID_PHONE_NUMBER": "Nije validan brok telephona: ",
"APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE": "Ova groupa već postoji!",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED": "Nismo mogli napraviti ovu groupu!",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "Ne možete sami sebe dodati u grupu!",
"APPS_MESSAGES_INPUT_NAME_OR_NUMBER": "Search contacts or type number and press enter",
"APPS_CONTACT_FORM_NAME": "Ime",
"APPS_CONTACT_FORM_NUMBER": "Brok",
"APPS_CONTACT_FORM_AVATAR": "URL za avatar",
"APPS_CONTACT_ADD_SUCCESS": "Uspješno napravili novi kontakt!",
"APPS_CONTACT_ADD_FAILED": "Nismo uspjeli stvoriti novi kontakt!",
"APPS_CONTACT_UPDATE_SUCCESS": "Uspješno ažurirali kontakt!",
"APPS_CONTACT_UPDATE_FAILED": "Nismo uspjeli ažurirati kontakt!",
"APPS_CONTACT_DELETE_SUCCESS": "Uspješno izbrisali kontakt!",
"APPS_CONTACT_DELETE_FAILED": "Nismo uspjeli izbrisati ovaj kontakt!",
"APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS": "Search contacts",
"APPS_CONTACT_MODAL_PLACEHOLDER_NAME": "Name",
"APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Number",
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Add Contact",
"APPS_DOCUMENTS_ADD_SUCCESS": "Successfully saved note.",
"APPS_DOCUMENTS_ADD_FAILED": "Failed to save note.",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_DOCUMENTS_UPDATE_FAILED": "Failed to update note.",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_DOCUMENTS_DELETE_FAILED": "Failed to delete note.",
"APPS_CALCULATOR_COPIED": "Result was copied to clipboard!",
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Successfully created a new listing",
"APPS_MARKETPALCE_CREATE_LISTING_FAILED": "Failed to create a new listing",
"APPS_SETTINGS_PHONE_NUMBER": "Phone Number",
"APPS_SETTINGS_OPTION_WALLPAPER": "Wallpaper",
"APPS_SETTINGS_OPTION_FRAME": "Frame",
"APPS_SETTINGS_OPTION_THEME": "Theme",
"APPS_SETTINGS_OPTION_ZOOM": "Zoom",
"APPS_SETTINGS_OPTION_RINGTONE": "Ringtone",
"APPS_SETTINGS_OPTION_RINGTONEVOL": "Ringtone Volume",
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notification",
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Notification Volume",
"GENERIC_SAVE": "Save",
"GENERIC_UPDATE": "Update",
"GENERIC_DELETE": "Delete",
"GENERIC_CLOSE": "Close",
"GENERIC_CANCEL": "Cancel",
"GENERIC_TITLE": "Title",
"GENERIC_CONTENT": "Content"
}
}
+43 -9
View File
@@ -2,6 +2,37 @@
"translation": {
"DATE_FORMAT": "MM/DD/YYYY",
"DATE_TIME_FORMAT": "MM/DD/YYYY hh:mm A",
"SETTINGS": {
"CATEGORY": {
"APPEARANCE": "Appearance",
"PHONE": "Phone",
"ACTIONS": "Actions"
},
"OPTIONS": {
"LANGUAGE": "Language",
"RESET_SETTINGS": "Reset Settings",
"RESET_SETTINGS_DESC": "This will clear your locally stored data"
},
"MESSAGES": {
"INVALID_SETTINGS": "Invalid stored settings! Please reset in the Settings App.",
"SETTINGS_RESET": "Settings have been reset!"
}
},
"RELATIVE_TIME": {
"future": "in %s",
"past": "%s ago",
"s": "a few seconds",
"m": "a minute",
"mm": "%d minutes",
"h": "an hour",
"hh": "%d hours",
"d": "a day",
"dd": "%d days",
"M": "a month",
"MM": "%d months",
"y": "a year",
"yy": "%d years"
},
"COMING_SOON": "Coming soon...",
"INITIALIZING": "Initializing",
@@ -12,7 +43,7 @@
"APPS_CALCULATOR": "Calculator",
"APPS_SETTINGS": "Settings",
"APPS_BANK": "WhoDis Banking",
"APPS_DOCUMENTS": "Documents",
"APPS_NOTES": "Notes",
"APPS_EXAMPLE": "Example app",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
@@ -25,6 +56,7 @@
"APPS_DIALER_ACCEPT_CALL": "Accept",
"APPS_DIALER_REJECT_CALL": "Reject",
"APPS_DIALER_END_CALL": "End",
"APPS_DIALER_NO_HISTORY": "You have no call history",
"APPS_TWITTER_TWEET": "Tweet",
"APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "What's happening?",
@@ -45,9 +77,12 @@
"APPS_TWITTER_CREATE_FAILED": "Failed to send your tweet",
"APPS_TWITTER_EDIT_PROFILE_AVATAR": "Avatar URL",
"APPS_TWITTER_EDIT_PROFILE_NAME": "Profile name",
"APPS_TWITTER_EDIT_DEFAULT_PROFILE_NAME": "Choose Profile Name",
"APPS_TWITTER_EDIT_PROFILE_BIO": "Bio",
"APPS_TWITTER_EDIT_PROFILE_LOCATION": "Location",
"APPS_TWITTER_EDIT_PROFILE_JOB": "Job",
"APPS_TWITTER_CREATE_PROFILE_SUCCESS": "Successfully created your profile",
"APPS_TWITTER_CREATE_PROFILE_FAILURE": "Failed to create your profile",
"APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Successfully updated your profile",
"APPS_TWITTER_EDIT_PROFILE_FAILURE": "Failed to update your profile",
"APPS_TWITTER_RETWEET_EXISTS": "You have already retweeted this tweet!",
@@ -101,14 +136,12 @@
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Add Contact",
"APPS_DOCUMENTS_NOTES_TITLE": "Notes",
"APPS_DOCUMENTS_LICENSE_TITLE": "Licenses",
"APPS_DOCUMENTS_ADD_SUCCESS": "Successfully saved note.",
"APPS_DOCUMENTS_ADD_FAILED": "Failed to save note.",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_DOCUMENTS_UPDATE_FAILED": "Failed to update note.",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_DOCUMENTS_DELETE_FAILED": "Failed to delete note.",
"APPS_NOTES_ADD_SUCCESS": "Successfully saved note.",
"APPS_NOTES_ADD_FAILED": "Failed to save note.",
"APPS_NOTES_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_NOTES_UPDATE_FAILED": "Failed to update note.",
"APPS_NOTES_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_NOTES_DELETE_FAILED": "Failed to delete note.",
"APPS_CALCULATOR_COPIED": "Result was copied to clipboard!",
@@ -123,6 +156,7 @@
"APPS_SETTINGS_OPTION_NOTIFICATION_FILTER": "Notification Filters",
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notification",
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Notification Volume",
"APPS_SETTING_STREAMER_MODE_DESC": "Hide images before they are shown",
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Successfully created a new listing",
"APPS_MARKETPALCE_CREATE_LISTING_FAILED": "Failed to create a new listing",
+7 -7
View File
@@ -11,7 +11,7 @@
"APPS_CALCULATOR": "Calculadora",
"APPS_SETTINGS": "Ajustes",
"APPS_BANK": "Banco WhoDis",
"APPS_DOCUMENTS": "Notas",
"APPS_NOTES": "Notas",
"APPS_EXAMPLE": "App de Ejemplo",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Mercado",
@@ -94,12 +94,12 @@
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Agregar contacto",
"APPS_DOCUMENTS_ADD_SUCCESS": "Se ha guardado la nota.",
"APPS_DOCUMENTS_ADD_FAILED": "Hubo un error al guardar la nota.",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Se ha actualizado la nota.",
"APPS_DOCUMENTS_UPDATE_FAILED": "Hubo un error al actualizar la nota.",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Se ha borrado la nota.",
"APPS_DOCUMENTS_DELETE_FAILED": "Hubo un error al borrar la nota.",
"APPS_NOTES_ADD_SUCCESS": "Se ha guardado la nota.",
"APPS_NOTES_ADD_FAILED": "Hubo un error al guardar la nota.",
"APPS_NOTES_UPDATE_SUCCESS": "Se ha actualizado la nota.",
"APPS_NOTES_UPDATE_FAILED": "Hubo un error al actualizar la nota.",
"APPS_NOTES_DELETE_SUCCESS": "Se ha borrado la nota.",
"APPS_NOTES_DELETE_FAILED": "Hubo un error al borrar la nota.",
"APPS_CALCULATOR_COPIED": "Se ha copiado el resultado!",
+8 -8
View File
@@ -12,7 +12,7 @@
"APPS_CALCULATOR": "Calculatrice",
"APPS_SETTINGS": "Paramètres",
"APPS_BANK": "WhoDis Banque",
"APPS_DOCUMENTS": "Notes",
"APPS_NOTES": "Notes",
"APPS_EXAMPLE": "App test",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Marché",
@@ -101,12 +101,12 @@
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Photo",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Ajouter un contact",
"APPS_DOCUMENTS_ADD_SUCCESS": "Note sauvegardée avec succès.",
"APPS_DOCUMENTS_ADD_FAILED": "Erreur lors de la suppression d'une note.",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Mise à jour d'une note réalisée avec succès.",
"APPS_DOCUMENTS_UPDATE_FAILED": "Erreur lors de la mise à jour d'une note.",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Note supprimée avec succès.",
"APPS_DOCUMENTS_DELETE_FAILED": "Erreur lors de la suppression d'une note.",
"APPS_NOTES_ADD_SUCCESS": "Note sauvegardée avec succès.",
"APPS_NOTES_ADD_FAILED": "Erreur lors de la suppression d'une note.",
"APPS_NOTES_UPDATE_SUCCESS": "Mise à jour d'une note réalisée avec succès.",
"APPS_NOTES_UPDATE_FAILED": "Erreur lors de la mise à jour d'une note.",
"APPS_NOTES_DELETE_SUCCESS": "Note supprimée avec succès.",
"APPS_NOTES_DELETE_FAILED": "Erreur lors de la suppression d'une note.",
"APPS_CALCULATOR_COPIED": "Résultat copié dans le presse-papier!",
@@ -120,7 +120,7 @@
"APPS_SETTINGS_OPTION_NOTIFICATION_FILTER": "Filtre de notification",
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notification",
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Volume des notifications",
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Nouvelle liste créée avec succès!",
"APPS_MARKETPALCE_CREATE_LISTING_FAILED": "Échec lors de la création d'une nouvelle liste",
"APPS_MARKETPLACE_DELETE_LISTING_SUCCESS": "Liste supprimée avec succès",
+7 -7
View File
@@ -12,7 +12,7 @@
"APPS_CALCULATOR": "Kalkulator",
"APPS_SETTINGS": "Instillinger",
"APPS_BANK": "WhoDis Bank",
"APPS_DOCUMENTS": "Notater",
"APPS_NOTES": "Notater",
"APPS_EXAMPLE": "Example app",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Marked",
@@ -101,12 +101,12 @@
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Legg til",
"APPS_DOCUMENTS_ADD_SUCCESS": "Lagret notat!",
"APPS_DOCUMENTS_ADD_FAILED": "Kunne ikke lagre notatet!",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Oppdatert notat!",
"APPS_DOCUMENTS_UPDATE_FAILED": "Kunne ikke oppdatere notatet!",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Slettet notat!",
"APPS_DOCUMENTS_DELETE_FAILED": "Kunne ikke slette notatet!",
"APPS_NOTES_ADD_SUCCESS": "Lagret notat!",
"APPS_NOTES_ADD_FAILED": "Kunne ikke lagre notatet!",
"APPS_NOTES_UPDATE_SUCCESS": "Oppdatert notat!",
"APPS_NOTES_UPDATE_FAILED": "Kunne ikke oppdatere notatet!",
"APPS_NOTES_DELETE_SUCCESS": "Slettet notat!",
"APPS_NOTES_DELETE_FAILED": "Kunne ikke slette notatet!",
"APPS_CALCULATOR_COPIED": "Teskten ble kopiert til utklippstavle",
+7 -7
View File
@@ -11,7 +11,7 @@
"APPS_CALCULATOR": "Calculadora",
"APPS_SETTINGS": "Definições",
"APPS_BANK": "WhoDis Banco",
"APPS_DOCUMENTS": "Notas",
"APPS_NOTES": "Notas",
"APPS_EXAMPLE": "Aplicativo exemplo",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
@@ -94,12 +94,12 @@
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Adicionar contacto",
"APPS_DOCUMENTS_ADD_SUCCESS": "Successfully saved note.",
"APPS_DOCUMENTS_ADD_FAILED": "Failed to save note.",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_DOCUMENTS_UPDATE_FAILED": "Failed to update note.",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_DOCUMENTS_DELETE_FAILED": "Failed to delete note.",
"APPS_NOTES_ADD_SUCCESS": "Successfully saved note.",
"APPS_NOTES_ADD_FAILED": "Failed to save note.",
"APPS_NOTES_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_NOTES_UPDATE_FAILED": "Failed to update note.",
"APPS_NOTES_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_NOTES_DELETE_FAILED": "Failed to delete note.",
"APPS_CALCULATOR_COPIED": "Result was copied to clipboard!",
+7 -7
View File
@@ -12,7 +12,7 @@
"APPS_CALCULATOR": "Calculadora",
"APPS_SETTINGS": "Configurações​",
"APPS_BANK": "Banco WhoDis",
"APPS_DOCUMENTS": "Notas",
"APPS_NOTES": "Notas",
"APPS_EXAMPLE": "Aplicativo de exemplo",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
@@ -112,12 +112,12 @@
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Foto de perfil",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Adcionar contato",
"APPS_DOCUMENTS_ADD_SUCCESS": "Nota salva com sucesso.",
"APPS_DOCUMENTS_ADD_FAILED": "Falha em salvar nota.",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Nota atualizada com sucesso.",
"APPS_DOCUMENTS_UPDATE_FAILED": "Falha em atualizar nota.",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Nota deletada com sucesso.",
"APPS_DOCUMENTS_DELETE_FAILED": "Falha em deletar nota.",
"APPS_NOTES_ADD_SUCCESS": "Nota salva com sucesso.",
"APPS_NOTES_ADD_FAILED": "Falha em salvar nota.",
"APPS_NOTES_UPDATE_SUCCESS": "Nota atualizada com sucesso.",
"APPS_NOTES_UPDATE_FAILED": "Falha em atualizar nota.",
"APPS_NOTES_DELETE_SUCCESS": "Nota deletada com sucesso.",
"APPS_NOTES_DELETE_FAILED": "Falha em deletar nota.",
"APPS_CALCULATOR_COPIED": "Resultado foi copiado para a área de transferência!",
+7 -7
View File
@@ -11,7 +11,7 @@
"APPS_CALCULATOR": "Kalkylator",
"APPS_SETTINGS": "Inställningar",
"APPS_BANK": "WhoDis Bank",
"APPS_DOCUMENTS": "Anteckningar",
"APPS_NOTES": "Anteckningar",
"APPS_EXAMPLE": "Exempel app",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
@@ -94,12 +94,12 @@
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Add Contact",
"APPS_DOCUMENTS_ADD_SUCCESS": "Successfully saved note.",
"APPS_DOCUMENTS_ADD_FAILED": "Failed to save note.",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_DOCUMENTS_UPDATE_FAILED": "Failed to update note.",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_DOCUMENTS_DELETE_FAILED": "Failed to delete note.",
"APPS_NOTES_ADD_SUCCESS": "Successfully saved note.",
"APPS_NOTES_ADD_FAILED": "Failed to save note.",
"APPS_NOTES_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_NOTES_UPDATE_FAILED": "Failed to update note.",
"APPS_NOTES_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_NOTES_DELETE_FAILED": "Failed to delete note.",
"APPS_CALCULATOR_COPIED": "Result was copied to clipboard!",
+7 -7
View File
@@ -11,7 +11,7 @@
"APPS_CALCULATOR": "Hesap makinesi",
"APPS_SETTINGS": "Ayarlar",
"APPS_BANK": "WhoDis Bankası",
"APPS_DOCUMENTS": "Notlar",
"APPS_NOTES": "Notlar",
"APPS_EXAMPLE": "Örnek uygulama",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
@@ -94,12 +94,12 @@
"APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Avatar",
"APPS_CONTACT_MODAL_BUTTON_ADD": "Add Contact",
"APPS_DOCUMENTS_ADD_SUCCESS": "Successfully saved note.",
"APPS_DOCUMENTS_ADD_FAILED": "Failed to save note.",
"APPS_DOCUMENTS_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_DOCUMENTS_UPDATE_FAILED": "Failed to update note.",
"APPS_DOCUMENTS_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_DOCUMENTS_DELETE_FAILED": "Failed to delete note.",
"APPS_NOTES_ADD_SUCCESS": "Successfully saved note.",
"APPS_NOTES_ADD_FAILED": "Failed to save note.",
"APPS_NOTES_UPDATE_SUCCESS": "Successfully updated note.",
"APPS_NOTES_UPDATE_FAILED": "Failed to update note.",
"APPS_NOTES_DELETE_SUCCESS": "Successfully deleted note.",
"APPS_NOTES_DELETE_FAILED": "Failed to delete note.",
"APPS_CALCULATOR_COPIED": "Result was copied to clipboard!",
@@ -3,7 +3,7 @@ import Nui from '../../nui-events/utils/Nui';
export const AppWithStartup = ({ children, id }) => {
useEffect(() => {
Nui.send(`phone:app:${id}`);
Nui.send(`npwd:app:${id}`);
}, [id]);
return children;
};
+9 -13
View File
@@ -12,7 +12,6 @@ import { faTwitter } from '@fortawesome/free-brands-svg-icons';
import ContactsIcon from '@material-ui/icons/Contacts';
import SettingsIcon from '@material-ui/icons/Settings';
import FolderIcon from '@material-ui/icons/Folder';
import MessageIcon from '@material-ui/icons/Message';
import { CalculatorIcon } from '../../../apps/calculator/components/CalculatorIcon';
import CameraAltIcon from '@material-ui/icons/CameraAlt';
@@ -25,7 +24,7 @@ import { MessagesApp } from '../../../apps/messages/components/MessagesApp';
import { TwitterApp } from '../../../apps/twitter/components/TwitterApp';
import { ExampleApp } from '../../../apps/example/components/ExampleApp';
import { SelloutApp } from '../../../apps/sellout/components/SelloutApp';
import { NotesApp } from '../../../apps/notes/DoucmentsApp';
import { NotesApp } from '../../../apps/notes/NotesApp';
import CameraApp from '../../../apps/camera/components/CameraApp';
import { AppRoute } from '../components/AppRoute';
@@ -41,10 +40,7 @@ import {
SELLOUT_APP_PRIMARY_COLOR,
SELLOUT_APP_ICON_COLOR,
} from '../../../apps/sellout/sellout.theme';
import {
DOCUMENTS_APP_ICON_COLOR,
DOCUMENTS_APP_PRIMARY_COLOR,
} from '../../../apps/notes/documents.theme';
import { NOTES_APP_ICON_COLOR, NOTES_APP_PRIMARY_COLOR } from '../../../apps/notes/notes.theme';
import { DIALER_APP_PRIMARY_COLOR, DIALER_APP_TEXT_COLOR } from '../../../apps/dialer/dialer.theme';
import {
TWITTER_APP_PRIMARY_COLOR,
@@ -144,14 +140,14 @@ export const APPS: IAppConfig[] = [
Route: () => <AppRoute id="SELLOUT" path="/sellout" component={SelloutApp} />,
},
{
id: 'DOCUMENTS',
nameLocale: 'APPS_DOCUMENTS',
icon: <FolderIcon fontSize="large" />,
id: 'NOTES',
nameLocale: 'APPS_NOTES',
icon: <FontAwesomeIcon icon={faStickyNote} fixedWidth />,
notificationIcon: <FontAwesomeIcon icon={faStickyNote} fixedWidth size="xs" />,
backgroundColor: DOCUMENTS_APP_PRIMARY_COLOR,
color: DOCUMENTS_APP_ICON_COLOR,
path: '/documents',
Route: () => <AppRoute id="DOCUMENTS" path="/documents" component={NotesApp} />,
backgroundColor: NOTES_APP_PRIMARY_COLOR,
color: NOTES_APP_ICON_COLOR,
path: '/notes',
Route: () => <AppRoute id="NOTES" path="/notes" component={NotesApp} />,
},
{
id: 'CAMERA',
+4 -3
View File
@@ -2,6 +2,7 @@ import { useRecoilState } from 'recoil';
import { CallProps } from '../../../../../typings/call';
import Nui from '../../nui-events/utils/Nui';
import { callerState } from './state';
import { CallEvents } from '../../../../../typings/call';
interface CallHook {
call: CallProps;
@@ -15,19 +16,19 @@ export const useCall = (): CallHook => {
const [call, setCall] = useRecoilState(callerState.currentCall);
const acceptCall = () => {
Nui.send('phone:acceptCall', {
Nui.send(CallEvents.ACCEPT_CALL, {
transmitterNumber: call.transmitter,
});
};
const rejectCall = () => {
Nui.send('phone:rejectCall', {
Nui.send(CallEvents.REJECTED, {
phoneNumber: call.transmitter,
});
};
const endCall = () => {
Nui.send('phone:endCall', {
Nui.send(CallEvents.END_CALL, {
transmitterNumber: call.transmitter,
});
};
@@ -0,0 +1,104 @@
import { FetchData } from '@sentry/tracing/dist/browser/request';
import { useCallback, useEffect, useRef, useState } from 'react';
import Nui, { IAbortableFetch } from '../utils/Nui';
import { eventNameFactory } from '../utils/nuiUtils';
import { useNuiEvent } from './useNuiEvent';
type UseNuiEventCallbackResponse<I, R> = [
(d?: I) => void,
{ loading: boolean; error: any; response: R },
];
export const useNuiEventCallback = <I = FetchData, R = FetchData>(
app: string,
method: string,
handler?: (res: R) => void,
errHandler?: Function,
): UseNuiEventCallbackResponse<I, R> => {
const fetchRef = useRef<IAbortableFetch>();
const timeoutRef = useRef<NodeJS.Timeout>();
// These are Refs to avoid re renders.
// We dont care if "app" and "method" arguments change.
const eventNameRef = useRef<string>(eventNameFactory(app, method));
const methodNameRef = useRef<string>(method);
const appNameRef = useRef<string>(app);
const [timedOut, setTimedOut] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
const [error, setError] = useState<any>(null);
const [response, setResponse] = useState<R>(null);
const onSuccess = useCallback(
(data: R) => {
if (!loading) {
return;
}
// If we receive eventNameSuccess event, clear timeout
timeoutRef.current && clearTimeout(timeoutRef.current);
// If already timed out, don't do shit :)
if (timedOut) {
return;
}
// Set new state after success event received
setResponse(data);
setError(null);
setLoading(false);
handler?.(data);
},
[handler, timedOut, loading],
);
const onError = useCallback(
(err: any) => {
if (!loading) {
return;
}
// If we receive eventNameSuccess event, clear timeout
timeoutRef.current && clearTimeout(timeoutRef.current);
// If already timed out, don't do shit :)
if (timedOut) {
return;
}
// Set new state after error event received
setError(err);
setResponse(null);
setLoading(false);
errHandler?.(err);
},
[errHandler, timedOut, loading],
);
// React to loading change and starting timeout timer.
useEffect(() => {
if (loading && !timeoutRef.current) {
clearTimeout(timeoutRef.current);
timeoutRef.current = setTimeout(() => {
setTimedOut(true);
onError(
new Error(`${eventNameRef.current} NUI Event Callback timed out after 10000 seconds`),
);
fetchRef.current && fetchRef.current.abort();
timeoutRef.current = undefined;
fetchRef.current = undefined;
}, 10000);
}
}, [loading, onError]);
// Handle the success and error events for this method
useNuiEvent(appNameRef.current, `${methodNameRef.current}Success`, onSuccess);
useNuiEvent(appNameRef.current, `${methodNameRef.current}Error`, onError);
// Only fetch if we are not loading/waiting the events.
const fetch = useCallback((data?: I) => {
setLoading((curr) => {
if (!curr) {
fetchRef.current = Nui.sendAbortable(methodNameRef.current, data);
return true;
}
return curr;
});
}, []);
return [fetch, { loading, response, error }];
};
+29 -6
View File
@@ -1,13 +1,36 @@
// eslint-disable-next-line
export default {
async send(event: any, data = {}) {
/* eslint-disable no-unreachable */
return fetch(`https://new-phone-who-dis/${event}`, {
export interface IAbortableFetch {
abort: () => void;
promise: Promise<Response>;
}
function abortableFetch(request, opts): IAbortableFetch {
const controller = new AbortController();
const signal = controller.signal;
return {
abort: () => controller.abort(),
promise: fetch(request, { ...opts, signal }),
};
}
function getParams(event, data): [RequestInfo, RequestInit] {
return [
`https://new-phone-who-dis/${event}`,
{
method: 'post',
headers: {
'Content-Type': 'application/json; charset=UTF-8',
},
body: JSON.stringify(data),
});
},
];
}
export default {
async send(event: any, data = {}) {
return fetch(...getParams(event, data));
},
sendAbortable(event: any, data = {}): IAbortableFetch {
return abortableFetch(...getParams(event, data));
},
};
+3 -2
View File
@@ -1,2 +1,3 @@
export const eventNameFactory = (app: any, method: any) => `${app}:${method}`;
export const eventNameMethod = (name: any) => name.split(':')[1] || null;
export const eventNameFactory = (app: string, method: string) => `${app}:${method}`;
export const eventNameMethod = (name: string) => name.split(':')[1] || null;
+3 -2
View File
@@ -4,6 +4,7 @@ import ServerConfig from '../../../config.autogen.json';
import { useNotifications } from '../../notifications/hooks/useNotifications';
import Nui from '../../nui-events/utils/Nui';
import { phoneState } from './state';
import { PhoneEvents } from '../../../../../typings/phone';
interface IUsePhone {
config?: IServerConfig;
@@ -21,10 +22,10 @@ export const usePhone = (): IUsePhone => {
const closePhone = () => {
removeAlerts();
Nui.send('phone:close');
Nui.send(PhoneEvents.CLOSE_PHONE);
};
const openPhone = () => {
Nui.send('phone:open');
Nui.send(PhoneEvents.OPEN_PHONE);
};
return { config: ServerConfig as any, closePhone, openPhone, isPhoneOpen, isPhoneReady };
+1 -1
View File
@@ -17,7 +17,7 @@ export const getSoundSettings = (
try {
return app
? {
sound: getPath[type](settings[`${app}_${type}`].value || settings[type].value),
sound: getPath[type](settings[`${app}_${type}`]?.value || settings[type].value),
volume: (settings[`${app}_${type}Vol`] || settings[`${type}Vol`]) / 100,
}
: {
+1 -1
View File
@@ -9,7 +9,7 @@ export const GridMenu = ({ items, Component = AppIcon, xs = undefined }) => {
{items &&
items.length &&
items.map((item) => (
<Grid item xs={xs} key={item.id} alignItems="center" justify="center">
<Grid item xs={xs} key={item.id}>
<Box textAlign="center">
<Link to={item.path}>
<Component {...item} />
+10 -3
View File
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
@@ -16,7 +20,10 @@
"noEmit": true,
"jsx": "react",
"strictNullChecks": false,
"sourceMap": true
"sourceMap": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
"include": [
"src"
]
}
+1
View File
@@ -4,6 +4,7 @@ const webpack = require('webpack');
module.exports = (options) => ({
mode: options.mode,
entry: options.entry,
devtool: 'source-maps',
output: {
path: path.resolve(process.cwd(), '../resources/html'),
filename: '[name].js',
+4026 -2833
View File
File diff suppressed because it is too large. Load diff
+10 -10
View File
@@ -1,7 +1,7 @@
import { IAlertProps } from '../../typings/alerts';
import events from '../utils/events';
import { BankEvents } from '../../typings/bank';
onNet(events.BANK_SEND_TRANSFERS, (transfer: any) => {
onNet(BankEvents.SEND_TRANSFERS, (transfer: any) => {
SendNuiMessage(
JSON.stringify({
app: 'BANK',
@@ -11,7 +11,7 @@ onNet(events.BANK_SEND_TRANSFERS, (transfer: any) => {
);
});
onNet(events.BANK_SEND_CREDENTIALS, (credentials: any) => {
onNet(BankEvents.SEND_CREDENTIALS, (credentials: any) => {
SendNuiMessage(
JSON.stringify({
app: 'BANK',
@@ -21,17 +21,17 @@ onNet(events.BANK_SEND_CREDENTIALS, (credentials: any) => {
);
});
RegisterNuiCallbackType(events.BANK_ADD_TRANSFER);
on(`__cfx_nui:${events.BANK_ADD_TRANSFER}`, (data: any, cb: Function) => {
emitNet(events.BANK_ADD_TRANSFER, data);
RegisterNuiCallbackType(BankEvents.ADD_TRANSFER);
on(`__cfx_nui:${BankEvents.ADD_TRANSFER}`, (data: any, cb: Function) => {
emitNet(BankEvents.ADD_TRANSFER, data);
cb();
});
onNet(events.BANK_ADD_TRANSFER_SUCCESS, () => {
emitNet(events.BANK_FETCH_TRANSACTIONS);
onNet(BankEvents.ADD_TRANSFER_SUCCESS, () => {
emitNet(BankEvents.FETCH_TRANSACTIONS);
});
onNet(events.BANK_TRANSACTION_ALERT, (result: IAlertProps) => {
onNet(BankEvents.TRANSACTION_ALERT, (result: IAlertProps) => {
SendNuiMessage(
JSON.stringify({
app: 'BANK',
@@ -41,7 +41,7 @@ onNet(events.BANK_TRANSACTION_ALERT, (result: IAlertProps) => {
);
});
onNet(events.BANK_TRANSACTION_NOTIFICATION, (transfer: any) => {
onNet(BankEvents.TRANSACTION_NOTIFICATION, (transfer: any) => {
SendNuiMessage(
JSON.stringify({
app: 'BANK',
+36 -41
View File
@@ -1,17 +1,16 @@
import events from '../utils/events';
import { CallEvents } from '../../typings/call';
import { ICall } from '../../typings/call';
import { phoneCallStartAnim, phoneCallEndAnim } from './functions';
const exp = (global as any).exports;
RegisterNuiCallbackType(events.PHONE_INITIALIZE_CALL); // Fires when the call is started.
on(`__cfx_nui:${events.PHONE_INITIALIZE_CALL}`, (data: any, cb: Function) => {
const start = Date.now();
emitNet(events.PHONE_INITIALIZE_CALL, data.number, start);
RegisterNuiCallbackType(CallEvents.INITIALIZE_CALL); // Fires when the call is started.
on(`__cfx_nui:${CallEvents.INITIALIZE_CALL}`, (data: any, cb: Function) => {
emitNet(CallEvents.INITIALIZE_CALL, data.number);
cb();
});
onNet(events.PHONE_START_CALL, (transmitter: string, receiver: string, isTransmitter: boolean) => {
onNet(CallEvents.START_CALL, (transmitter: string, receiver: string, isTransmitter: boolean) => {
openCallModal(true);
SendNuiMessage(
@@ -29,41 +28,37 @@ onNet(events.PHONE_START_CALL, (transmitter: string, receiver: string, isTransmi
);
});
RegisterNuiCallbackType(events.PHONE_ACCEPT_CALL); // Fires when the TARGET accepts.
on(`__cfx_nui:${events.PHONE_ACCEPT_CALL}`, (data: any, cb: Function) => {
emitNet(events.PHONE_ACCEPT_CALL, data.transmitterNumber);
RegisterNuiCallbackType(CallEvents.ACCEPT_CALL); // Fires when the TARGET accepts.
on(`__cfx_nui:${CallEvents.ACCEPT_CALL}`, (data: any, cb: Function) => {
emitNet(CallEvents.ACCEPT_CALL, data.transmitterNumber);
cb();
});
onNet(
events.PHONE_CALL_WAS_ACCEPTED,
(channelId: number, currentCall: ICall, isTransmitter: boolean) => {
exp['mumble-voip'].SetCallChannel(channelId);
phoneCallStartAnim(); // Trigger call animation only if the call was accepted.
SendNuiMessage(
JSON.stringify({
app: 'CALL',
method: 'setCaller',
data: {
active: true,
transmitter: currentCall.transmitter,
receiver: currentCall.receiver,
isTransmitter: isTransmitter,
accepted: true,
},
}),
);
},
);
onNet(CallEvents.WAS_ACCEPTED, (channelId: number, currentCall: ICall, isTransmitter: boolean) => {
exp['mumble-voip'].SetCallChannel(channelId);
phoneCallStartAnim(); // Trigger call animation only if the call was accepted.
SendNuiMessage(
JSON.stringify({
app: 'CALL',
method: 'setCaller',
data: {
active: true,
transmitter: currentCall.transmitter,
receiver: currentCall.receiver,
isTransmitter: isTransmitter,
accepted: true,
},
}),
);
});
RegisterNuiCallbackType(events.PHONE_CALL_REJECTED); // Fires when cancelling and rejecting a call.
on(`__cfx_nui:${events.PHONE_CALL_REJECTED}`, (data: any, cb: Function) => {
const end = Date.now();
emitNet(events.PHONE_CALL_REJECTED, data.phoneNumber, end);
RegisterNuiCallbackType(CallEvents.REJECTED); // Fires when cancelling and rejecting a call.
on(`__cfx_nui:${CallEvents.REJECTED}`, (data: any, cb: Function) => {
emitNet(CallEvents.REJECTED, data.phoneNumber);
cb();
});
onNet(events.PHONE_CALL_WAS_REJECTED, () => {
onNet(CallEvents.WAS_REJECTED, () => {
openCallModal(false);
SendNuiMessage(
JSON.stringify({
@@ -80,18 +75,18 @@ onNet(events.PHONE_CALL_WAS_REJECTED, () => {
);
});
onNet(events.PHONE_CALL_SEND_HANGUP_ANIM, () => {
onNet(CallEvents.SEND_HANGUP_ANIM, () => {
phoneCallEndAnim();
});
RegisterNuiCallbackType(events.PHONE_END_CALL); // Fires when ending an ACTIVE call
on(`__cfx_nui:${events.PHONE_END_CALL}`, (data: any, cb: Function) => {
RegisterNuiCallbackType(CallEvents.END_CALL); // Fires when ending an ACTIVE call
on(`__cfx_nui:${CallEvents.END_CALL}`, (data: any, cb: Function) => {
const end = Date.now();
emitNet(events.PHONE_END_CALL, data.transmitterNumber, end);
emitNet(CallEvents.END_CALL, data.transmitterNumber, end);
cb();
});
onNet(events.PHONE_CALL_WAS_ENDED, () => {
onNet(CallEvents.WAS_ENDED, () => {
exp['mumble-voip'].SetCallChannel(0);
openCallModal(false);
@@ -120,10 +115,10 @@ function openCallModal(show: boolean) {
);
}
onNet(events.PHONE_CALL_SEND_HISTORY, (calls: ICall) => {
onNet(CallEvents.SEND_HISTORY, (calls: ICall) => {
SendNuiMessage(
JSON.stringify({
app: 'DAILER',
app: 'DIALER',
method: 'setHistory',
data: calls,
}),
+18 -18
View File
@@ -1,40 +1,40 @@
import events from '../utils/events';
import { ContactEvents } from '../../typings/contact';
import { sendContactsEvent } from '../utils/messages';
onNet(events.CONTACTS_SEND_CONTACTS, (contacts: any) => {
onNet(ContactEvents.SEND_CONTACTS, (contacts: any) => {
sendContactsEvent('setContacts', contacts);
});
RegisterNuiCallbackType(events.CONTACTS_ADD_CONTACT);
on(`__cfx_nui:${events.CONTACTS_ADD_CONTACT}`, (data: any, cb: Function) => {
emitNet(events.CONTACTS_ADD_CONTACT, data.number, data.display, data.avatar);
RegisterNuiCallbackType(ContactEvents.ADD_CONTACT);
on(`__cfx_nui:${ContactEvents.ADD_CONTACT}`, (data: any, cb: Function) => {
emitNet(ContactEvents.ADD_CONTACT, data.number, data.display, data.avatar);
cb();
});
onNet(events.CONTACTS_ADD_CONTACT_SUCCESS, () => {
emitNet(events.CONTACTS_GET_CONTACTS);
onNet(ContactEvents.ADD_CONTACT_SUCCESS, () => {
emitNet(ContactEvents.GET_CONTACTS);
});
RegisterNuiCallbackType(events.CONTACTS_UPDATE_CONTACT);
on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any, cb: Function) => {
emitNet(events.CONTACTS_UPDATE_CONTACT, data);
RegisterNuiCallbackType(ContactEvents.UPDATE_CONTACT);
on(`__cfx_nui:${ContactEvents.UPDATE_CONTACT}`, (data: any, cb: Function) => {
emitNet(ContactEvents.UPDATE_CONTACT, data);
cb();
});
onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
emitNet(events.CONTACTS_GET_CONTACTS);
onNet(ContactEvents.UPDATE_CONTACT_SUCCESS, () => {
emitNet(ContactEvents.GET_CONTACTS);
});
RegisterNuiCallbackType(events.CONTACTS_DELETE_CONTACT);
on(`__cfx_nui:${events.CONTACTS_DELETE_CONTACT}`, (data: any, cb: Function) => {
emitNet(events.CONTACTS_DELETE_CONTACT, data);
RegisterNuiCallbackType(ContactEvents.DELETE_CONTACT);
on(`__cfx_nui:${ContactEvents.DELETE_CONTACT}`, (data: any, cb: Function) => {
emitNet(ContactEvents.DELETE_CONTACT, data);
cb();
});
onNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, () => {
emitNet(events.CONTACTS_GET_CONTACTS);
onNet(ContactEvents.DELETE_CONTACT_SUCCESS, () => {
emitNet(ContactEvents.GET_CONTACTS);
});
onNet(events.CONTACTS_ACTION_RESULT, (alert: any) => {
onNet(ContactEvents.ACTION_RESULT, (alert: any) => {
sendContactsEvent('setAlert', alert);
});
+32 -23
View File
@@ -1,7 +1,15 @@
import config from '../utils/config';
import events from '../utils/events';
import { sendMessage } from '../utils/messages';
import { PhoneEvents } from '../../typings/phone';
import { TwitterEvents } from '../../typings/twitter';
import { ContactEvents } from '../../typings/contact';
import { MarketplaceEvents } from '../../typings/marketplace';
import { phoneCloseAnim, phoneOpenAnim, removePhoneProp } from './functions';
import { MessageEvents } from '../../typings/messages';
import { NotesEvents } from '../../typings/notes';
import { BankEvents } from '../../typings/bank';
import { PhotoEvents } from '../../typings/photo';
import { CallEvents } from '../../typings/call';
let isPhoneOpen = false;
let isPhoneReady = false;
@@ -13,10 +21,11 @@ let isPhoneReady = false;
* * * * * * * * * * * * */
function fetchOnInitialize() {
isPhoneReady = true;
emitNet(events.CONTACTS_GET_CONTACTS);
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
emitNet(ContactEvents.GET_CONTACTS);
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS);
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE);
sendMessage('PHONE', 'setPhoneReady', isPhoneReady);
sendMessage('PHONE', 'phoneConfig', config);
}
RegisterKeyMapping('phone', 'Open Phone', 'keyboard', 'f1');
@@ -87,7 +96,7 @@ async function Phone(): Promise<void> {
}
// triggerd when the player is ready
onNet(events.PLAYER_IS_READY, fetchOnInitialize);
onNet(PhoneEvents.PLAYER_IS_READY, fetchOnInitialize);
AddEventHandler('onResourceStop', function (resource: string) {
if (resource === GetCurrentResourceName()) {
@@ -110,39 +119,39 @@ onNet('phone:sendCredentials', (number: string) => {
* NUI Service Callback Registration
*
* * * * * * * * * * * * */
RegisterNuiCallbackType(events.OPEN_APP_LISTINGS);
on(`__cfx_nui:${events.OPEN_APP_LISTINGS}`, (data: any, cb: Function) => {
emitNet(events.SELLOUT_FETCH_LISTING);
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_LISTINGS);
on(`__cfx_nui:${PhoneEvents.OPEN_APP_LISTINGS}`, (data: any, cb: Function) => {
emitNet(MarketplaceEvents.FETCH_LISTING);
cb();
});
RegisterNuiCallbackType(events.OPEN_APP_NOTES);
on(`__cfx_nui:${events.OPEN_APP_NOTES}`, (data: any, cb: Function) => {
emitNet(events.NOTE_FETCH_ALL_NOTES);
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_NOTES);
on(`__cfx_nui:${PhoneEvents.OPEN_APP_NOTES}`, (data: any, cb: Function) => {
emitNet(NotesEvents.FETCH_ALL_NOTES);
cb();
});
RegisterNuiCallbackType(events.OPEN_APP_BANK);
on(`__cfx_nui:${events.OPEN_APP_BANK}`, (data: any, cb: Function) => {
emitNet(events.BANK_FETCH_TRANSACTIONS);
emitNet(events.BANK_GET_CREDENTIALS);
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_BANK);
on(`__cfx_nui:${PhoneEvents.OPEN_APP_BANK}`, (data: any, cb: Function) => {
emitNet(BankEvents.FETCH_TRANSACTIONS);
emitNet(BankEvents.GET_CREDENTIALS);
cb();
});
RegisterNuiCallbackType(events.OPEN_APP_CAMERA);
on(`__cfx_nui:${events.OPEN_APP_CAMERA}`, (data: any, cb: Function) => {
emitNet(events.CAMERA_FETCH_PHOTOS);
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_CAMERA);
on(`__cfx_nui:${PhoneEvents.OPEN_APP_CAMERA}`, (data: any, cb: Function) => {
emitNet(PhotoEvents.FETCH_PHOTOS);
cb();
});
RegisterNuiCallbackType(events.OPEN_APP_DAILER);
on(`__cfx_nui:${events.OPEN_APP_DAILER}`, (data: any, cb: Function) => {
emitNet(events.PHONE_CALL_FETCH_CALLS);
RegisterNuiCallbackType(PhoneEvents.OPEN_APP_DAILER);
on(`__cfx_nui:${PhoneEvents.OPEN_APP_DAILER}`, (data: any, cb: Function) => {
emitNet(CallEvents.FETCH_CALLS);
cb();
});
RegisterNuiCallbackType('phone:close');
on(`__cfx_nui:phone:close`, async (data: any, cb: Function) => {
RegisterNuiCallbackType(PhoneEvents.CLOSE_PHONE);
on(`__cfx_nui:${PhoneEvents.CLOSE_PHONE}`, async (data: any, cb: Function) => {
await hidePhone();
cb();
}); // Called for when the phone is closed via the UI.
+41 -41
View File
@@ -1,7 +1,7 @@
import events from '../utils/events';
import {
CreateMessageBroadcast,
Message,
MessageEvents,
MessageGroup,
SetMessageRead,
} from '../../typings/messages';
@@ -10,90 +10,90 @@ import { sendMessageEvent } from '../utils/messages';
/**
* Messages get message groups
*/
RegisterNuiCallbackType(events.MESSAGES_FETCH_MESSAGE_GROUPS);
on(`__cfx_nui:${events.MESSAGES_FETCH_MESSAGE_GROUPS}`, (): void => {
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
RegisterNuiCallbackType(MessageEvents.FETCH_MESSAGE_GROUPS);
on(`__cfx_nui:${MessageEvents.FETCH_MESSAGE_GROUPS}`, (): void => {
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS);
});
onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS, (messageGroups: MessageGroup[]): void => {
sendMessageEvent(events.MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS, messageGroups);
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_SUCCESS);
onNet(MessageEvents.FETCH_MESSAGE_GROUPS_SUCCESS, (messageGroups: MessageGroup[]): void => {
sendMessageEvent(MessageEvents.FETCH_MESSAGE_GROUPS_SUCCESS, messageGroups);
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS_SUCCESS);
});
onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_FAILED, () => {
sendMessageEvent(events.MESSAGES_FETCH_MESSAGE_GROUPS_FAILED);
onNet(MessageEvents.FETCH_MESSAGE_GROUPS_FAILED, () => {
sendMessageEvent(MessageEvents.FETCH_MESSAGE_GROUPS_FAILED);
});
onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, () => {
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
onNet(MessageEvents.FETCH_MESSAGE_GROUPS, () => {
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS);
});
/**
* Messages create message group
*/
RegisterNuiCallbackType(events.MESSAGES_CREATE_MESSAGE_GROUP);
RegisterNuiCallbackType(MessageEvents.CREATE_MESSAGE_GROUP);
on(
`__cfx_nui:${events.MESSAGES_CREATE_MESSAGE_GROUP}`,
`__cfx_nui:${MessageEvents.CREATE_MESSAGE_GROUP}`,
({ phoneNumbers, label }: any, cb: Function): void => {
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP, phoneNumbers, label);
emitNet(MessageEvents.CREATE_MESSAGE_GROUP, phoneNumbers, label);
cb();
},
);
onNet(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, (result: any): void => {
sendMessageEvent(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, result);
emitNet(events.MESSAGES_FETCH_MESSAGE_GROUPS);
onNet(MessageEvents.CREATE_MESSAGE_GROUP_SUCCESS, (result: any): void => {
sendMessageEvent(MessageEvents.CREATE_MESSAGE_GROUP_SUCCESS, result);
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS);
});
onNet(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, (result: any): void => {
sendMessageEvent(events.MESSAGES_CREATE_MESSAGE_GROUP_FAILED, result);
onNet(MessageEvents.CREATE_MESSAGE_GROUP_FAILED, (result: any): void => {
sendMessageEvent(MessageEvents.CREATE_MESSAGE_GROUP_FAILED, result);
});
/**
* Messages fetch messages
*/
RegisterNuiCallbackType(events.MESSAGES_FETCH_MESSAGES);
on(`__cfx_nui:${events.MESSAGES_FETCH_MESSAGES}`, ({ groupId }: any, cb: Function): void => {
emitNet(events.MESSAGES_FETCH_MESSAGES, groupId);
RegisterNuiCallbackType(MessageEvents.FETCH_MESSAGES);
on(`__cfx_nui:${MessageEvents.FETCH_MESSAGES}`, ({ groupId }: any, cb: Function): void => {
emitNet(MessageEvents.FETCH_MESSAGES, groupId);
cb();
});
RegisterNuiCallbackType(events.MESSAGES_SET_MESSAGE_READ);
on(`__cfx_nui:${events.MESSAGES_SET_MESSAGE_READ}`, (data: SetMessageRead, cb: Function) => {
emitNet(events.MESSAGES_SET_MESSAGE_READ, data.groupId);
RegisterNuiCallbackType(MessageEvents.SET_MESSAGE_READ);
on(`__cfx_nui:${MessageEvents.SET_MESSAGE_READ}`, (data: SetMessageRead, cb: Function) => {
emitNet(MessageEvents.SET_MESSAGE_READ, data.groupId);
cb();
});
onNet(events.MESSAGES_FETCH_MESSAGES_SUCCESS, (messages: Message[]): void => {
sendMessageEvent(events.MESSAGES_FETCH_MESSAGES_SUCCESS, messages);
onNet(MessageEvents.FETCH_MESSAGES_SUCCESS, (messages: Message[]): void => {
sendMessageEvent(MessageEvents.FETCH_MESSAGES_SUCCESS, messages);
});
onNet(events.MESSAGES_FETCH_MESSAGES_FAILED, (): void => {
sendMessageEvent(events.MESSAGES_FETCH_MESSAGES_FAILED);
onNet(MessageEvents.FETCH_MESSAGES_FAILED, (): void => {
sendMessageEvent(MessageEvents.FETCH_MESSAGES_FAILED);
});
/**
* Messages send message
*/
RegisterNuiCallbackType(events.MESSAGES_SEND_MESSAGE);
on(`__cfx_nui:${events.MESSAGES_SEND_MESSAGE}`, (data: any, cb: Function) => {
emitNet(events.MESSAGES_SEND_MESSAGE, data.groupId, data.message, data.groupName);
RegisterNuiCallbackType(MessageEvents.SEND_MESSAGE);
on(`__cfx_nui:${MessageEvents.SEND_MESSAGE}`, (data: any, cb: Function) => {
emitNet(MessageEvents.SEND_MESSAGE, data.groupId, data.message, data.groupName);
cb();
});
onNet(events.MESSAGES_SEND_MESSAGE_SUCCESS, (groupId: string) => {
sendMessageEvent(events.MESSAGES_SEND_MESSAGE_SUCCESS);
emitNet(events.MESSAGES_FETCH_MESSAGES, groupId);
onNet(MessageEvents.SEND_MESSAGE_SUCCESS, (groupId: string) => {
sendMessageEvent(MessageEvents.SEND_MESSAGE_SUCCESS);
emitNet(MessageEvents.FETCH_MESSAGES, groupId);
});
onNet(events.MESSAGES_SEND_MESSAGE_FAILED, () => {
sendMessageEvent(events.MESSAGES_SEND_MESSAGE_FAILED);
onNet(MessageEvents.SEND_MESSAGE_FAILED, () => {
sendMessageEvent(MessageEvents.SEND_MESSAGE_FAILED);
});
onNet(events.MESSAGES_ACTION_RESULT, (result: any) => {
sendMessageEvent(events.MESSAGES_ACTION_RESULT, result);
onNet(MessageEvents.ACTION_RESULT, (result: any) => {
sendMessageEvent(MessageEvents.ACTION_RESULT, result);
});
onNet(events.MESSAGES_CREATE_MESSAGE_BROADCAST, (result: CreateMessageBroadcast) => {
sendMessageEvent(events.MESSAGES_CREATE_MESSAGE_BROADCAST, result);
onNet(MessageEvents.CREATE_MESSAGE_BROADCAST, (result: CreateMessageBroadcast) => {
sendMessageEvent(MessageEvents.CREATE_MESSAGE_BROADCAST, result);
});
+19 -19
View File
@@ -1,39 +1,39 @@
import events from '../utils/events';
import { NotesEvents } from '../../typings/notes';
import { sendNotesEvent } from '../utils/messages';
onNet(events.NOTE_SEND_NOTE, (notes: any) => {
onNet(NotesEvents.SEND_NOTE, (notes: any) => {
sendNotesEvent('setNotes', notes);
});
RegisterNuiCallbackType(events.NOTE_ADD_NOTE);
on(`__cfx_nui:${events.NOTE_ADD_NOTE}`, (data: any) => {
emitNet(events.NOTE_ADD_NOTE, data);
RegisterNuiCallbackType(NotesEvents.ADD_NOTE);
on(`__cfx_nui:${NotesEvents.ADD_NOTE}`, (data: any) => {
emitNet(NotesEvents.ADD_NOTE, data);
});
onNet(events.NOTE_SEND_NOTE_SUCCESS, () => {
emitNet(events.NOTE_FETCH_ALL_NOTES);
onNet(NotesEvents.SEND_NOTE_SUCCESS, () => {
emitNet(NotesEvents.FETCH_ALL_NOTES);
});
onNet(events.NOTE_DELETE_NOTE_SUCCESS, () => {
emitNet(events.NOTE_FETCH_ALL_NOTES);
onNet(NotesEvents.DELETE_NOTE_SUCCESS, () => {
emitNet(NotesEvents.FETCH_ALL_NOTES);
});
RegisterNuiCallbackType(events.NOTE_DELETE_NOTE);
on(`__cfx_nui:${events.NOTE_DELETE_NOTE}`, (data: any) => {
emitNet(events.NOTE_DELETE_NOTE, data);
RegisterNuiCallbackType(NotesEvents.DELETE_NOTE);
on(`__cfx_nui:${NotesEvents.DELETE_NOTE}`, (data: any) => {
emitNet(NotesEvents.DELETE_NOTE, data);
emitNet(events.NOTE_FETCH_ALL_NOTES);
emitNet(NotesEvents.FETCH_ALL_NOTES);
});
RegisterNuiCallbackType(events.NOTE_UPDATE_NOTE);
on(`__cfx_nui:${events.NOTE_UPDATE_NOTE}`, (data: any) => {
emitNet(events.NOTE_UPDATE_NOTE, data);
RegisterNuiCallbackType(NotesEvents.UPDATE_NOTE);
on(`__cfx_nui:${NotesEvents.UPDATE_NOTE}`, (data: any) => {
emitNet(NotesEvents.UPDATE_NOTE, data);
});
onNet(events.NOTE_UPDATE_NOTE_SUCCESS, () => {
emitNet(events.NOTE_FETCH_ALL_NOTES);
onNet(NotesEvents.UPDATE_NOTE_SUCCESS, () => {
emitNet(NotesEvents.FETCH_ALL_NOTES);
});
onNet(events.NOTE_ACTION_RESULT, (alert: any) => {
onNet(NotesEvents.ACTION_RESULT, (alert: any) => {
sendNotesEvent('setAlert', alert);
});
+12 -12
View File
@@ -1,4 +1,4 @@
import events from '../utils/events';
import { PhotoEvents } from '../../typings/photo';
import { Delay } from '../utils/fivem';
import { sendMessage, sendCameraEvent } from '../utils/messages';
const SCREENSHOT_BASIC_TOKEN = GetConvar('SCREENSHOT_BASIC_TOKEN', 'none');
@@ -28,8 +28,8 @@ const displayHelperText = () => {
EndTextCommandDisplayHelp(0, true, false, -1);
};
RegisterNuiCallbackType(events.CAMERA_TAKE_PHOTO);
on(`__cfx_nui:${events.CAMERA_TAKE_PHOTO}`, async (data: any, cb: Function) => {
RegisterNuiCallbackType(PhotoEvents.TAKE_PHOTO);
on(`__cfx_nui:${PhotoEvents.TAKE_PHOTO}`, async (data: any, cb: Function) => {
cb();
// Create Phone Prop
let frontCam = false;
@@ -75,7 +75,7 @@ const handleCameraExit = () => {
inCameraMode = false;
};
onNet(events.CAMERA_SEND_PHOTOS, (photos: string[]) => {
onNet(PhotoEvents.SEND_PHOTOS, (photos: string[]) => {
sendCameraEvent('setPhotos', photos);
});
@@ -95,23 +95,23 @@ function takePhoto() {
},
(data: string) => {
const imageLink = JSON.parse(data).data.link;
emitNet(events.CAMERA_UPLOAD_PHOTO, imageLink);
emitNet(PhotoEvents.UPLOAD_PHOTO, imageLink);
},
);
}
onNet(events.CAMERA_UPLOAD_PHOTO_SUCCESS, () => {
emitNet(events.CAMERA_FETCH_PHOTOS);
onNet(PhotoEvents.UPLOAD_PHOTO_SUCCESS, () => {
emitNet(PhotoEvents.FETCH_PHOTOS);
});
// delete photo
RegisterNuiCallbackType(events.CAMERA_DELETE_PHOTO);
on(`__cfx_nui:${events.CAMERA_DELETE_PHOTO}`, (data: any, cb: Function) => {
emitNet(events.CAMERA_DELETE_PHOTO, data);
RegisterNuiCallbackType(PhotoEvents.DELETE_PHOTO);
on(`__cfx_nui:${PhotoEvents.DELETE_PHOTO}`, (data: any, cb: Function) => {
emitNet(PhotoEvents.DELETE_PHOTO, data);
cb();
});
onNet(events.CAMERA_DELETE_PHOTO_SUCCESS, () => {
emitNet(events.CAMERA_FETCH_PHOTOS);
onNet(PhotoEvents.DELETE_PHOTO_SUCCESS, () => {
emitNet(PhotoEvents.FETCH_PHOTOS);
});
+17 -18
View File
@@ -1,38 +1,37 @@
import events from '../utils/events';
import { MarketplaceListing } from '../../typings/marketplace';
import { MarketplaceEvents, MarketplaceListing } from '../../typings/marketplace';
import { IAlertProps } from '../../typings/alerts';
import { sendMarketplaceEvent } from '../utils/messages';
onNet(events.SELLOUT_SEND_LISTING, (listing: MarketplaceListing) => {
sendMarketplaceEvent('setListing', listing);
onNet(MarketplaceEvents.SEND_LISTING, (listings: MarketplaceListing[]) => {
sendMarketplaceEvent('setListings', listings);
});
RegisterNuiCallbackType(events.SELLOUT_ADD_LISTING);
on(`__cfx_nui:${events.SELLOUT_ADD_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(events.SELLOUT_ADD_LISTING, data);
RegisterNuiCallbackType(MarketplaceEvents.ADD_LISTING);
on(`__cfx_nui:${MarketplaceEvents.ADD_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(MarketplaceEvents.ADD_LISTING, data);
cb();
});
RegisterNuiCallbackType(events.SELLOUT_DELETE_LISTING);
on(`__cfx_nui:${events.SELLOUT_DELETE_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(events.SELLOUT_DELETE_LISTING, data.id);
RegisterNuiCallbackType(MarketplaceEvents.DELETE_LISTING);
on(`__cfx_nui:${MarketplaceEvents.DELETE_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(MarketplaceEvents.DELETE_LISTING, data.id);
cb();
});
RegisterNuiCallbackType(events.SELLOUT_REPORT_LISTING);
on(`__cfx_nui:${events.SELLOUT_REPORT_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(events.SELLOUT_REPORT_LISTING, data);
RegisterNuiCallbackType(MarketplaceEvents.REPORT_LISTING);
on(`__cfx_nui:${MarketplaceEvents.REPORT_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(MarketplaceEvents.REPORT_LISTING, data);
cb();
});
onNet(events.SELLOUT_ADD_LISTING_SUCCESS, () => {
emitNet(events.SELLOUT_FETCH_LISTING);
onNet(MarketplaceEvents.ADD_LISTING_SUCCESS, () => {
emitNet(MarketplaceEvents.FETCH_LISTING);
});
onNet(events.SELLOUT_DELETE_LISTING_SUCCESS, () => {
emitNet(events.SELLOUT_FETCH_LISTING);
onNet(MarketplaceEvents.DELETE_LISTING_SUCCESS, () => {
emitNet(MarketplaceEvents.FETCH_LISTING);
});
onNet(events.SELLOUT_ACTION_RESULT, (alert: IAlertProps) => {
onNet(MarketplaceEvents.ACTION_RESULT, (alert: IAlertProps) => {
sendMarketplaceEvent('setAlert', alert);
});
+81 -61
View File
@@ -1,137 +1,157 @@
import events from '../utils/events';
import { TwitterEvents } from '../../typings/twitter';
import { sendTwitterMessage } from '../utils/messages';
import { IAlertProps } from '../../typings/alerts';
/**
* Twitter get or create profile
*/
RegisterNuiCallbackType(events.TWITTER_GET_OR_CREATE_PROFILE);
on(`__cfx_nui:${events.TWITTER_GET_OR_CREATE_PROFILE}`, () => {
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
RegisterNuiCallbackType(TwitterEvents.GET_OR_CREATE_PROFILE);
on(`__cfx_nui:${TwitterEvents.GET_OR_CREATE_PROFILE}`, () => {
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE);
});
onNet(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, (profile: any) => {
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_SUCCESS, profile);
onNet(TwitterEvents.GET_OR_CREATE_PROFILE_SUCCESS, (profile: any) => {
sendTwitterMessage(TwitterEvents.GET_OR_CREATE_PROFILE_SUCCESS, profile);
});
onNet(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE, () => {
sendTwitterMessage(events.TWITTER_GET_OR_CREATE_PROFILE_FAILURE);
onNet(TwitterEvents.GET_OR_CREATE_PROFILE_FAILURE, () => {
sendTwitterMessage(TwitterEvents.GET_OR_CREATE_PROFILE_FAILURE);
});
onNet(TwitterEvents.GET_OR_CREATE_PROFILE_NULL, (defaultProfileNames: string[]): void => {
sendTwitterMessage(TwitterEvents.GET_OR_CREATE_PROFILE_NULL, defaultProfileNames);
});
/**
* Twitter create profile
*/
RegisterNuiCallbackType(TwitterEvents.CREATE_PROFILE);
on(`__cfx_nui:${TwitterEvents.CREATE_PROFILE}`, (data: any) => {
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_LOADING, true);
emitNet(TwitterEvents.CREATE_PROFILE, data);
});
onNet(TwitterEvents.CREATE_PROFILE_RESULT, (alert: IAlertProps) => {
sendTwitterMessage(TwitterEvents.CREATE_PROFILE_RESULT, alert);
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_LOADING, false);
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE);
});
/**
* Twitter update profile
*/
RegisterNuiCallbackType(events.TWITTER_UPDATE_PROFILE);
on(`__cfx_nui:${events.TWITTER_UPDATE_PROFILE}`, (data: string) => {
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_LOADING, true);
emitNet(events.TWITTER_UPDATE_PROFILE, data);
RegisterNuiCallbackType(TwitterEvents.UPDATE_PROFILE);
on(`__cfx_nui:${TwitterEvents.UPDATE_PROFILE}`, (data: string) => {
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_LOADING, true);
emitNet(TwitterEvents.UPDATE_PROFILE, data);
});
onNet(events.TWITTER_UPDATE_PROFILE_RESULT, (alert: IAlertProps) => {
sendTwitterMessage(events.TWITTER_UPDATE_PROFILE_RESULT, alert);
emitNet(events.TWITTER_GET_OR_CREATE_PROFILE);
onNet(TwitterEvents.UPDATE_PROFILE_RESULT, (alert: IAlertProps) => {
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_RESULT, alert);
sendTwitterMessage(TwitterEvents.UPDATE_PROFILE_LOADING, false);
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE);
});
/**
* Twitter fetch tweets
*/
RegisterNuiCallbackType(events.TWITTER_FETCH_TWEETS);
on(`__cfx_nui:${events.TWITTER_FETCH_TWEETS}`, () => {
emitNet(events.TWITTER_FETCH_TWEETS);
RegisterNuiCallbackType(TwitterEvents.FETCH_TWEETS);
on(`__cfx_nui:${TwitterEvents.FETCH_TWEETS}`, () => {
emitNet(TwitterEvents.FETCH_TWEETS);
});
onNet(events.TWITTER_FETCH_TWEETS_SUCCESS, (tweets: any) => {
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_SUCCESS, tweets);
onNet(TwitterEvents.FETCH_TWEETS_SUCCESS, (tweets: any) => {
sendTwitterMessage(TwitterEvents.FETCH_TWEETS_SUCCESS, tweets);
});
onNet(events.TWITTER_FETCH_TWEETS_FAILURE, () => {
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FAILURE);
onNet(TwitterEvents.FETCH_TWEETS_FAILURE, () => {
sendTwitterMessage(TwitterEvents.FETCH_TWEETS_FAILURE);
});
/**
* Twitter fetch filtered tweets
*/
RegisterNuiCallbackType(events.TWITTER_FETCH_TWEETS_FILTERED);
on(`__cfx_nui:${events.TWITTER_FETCH_TWEETS_FILTERED}`, (searchValue: string) => {
emitNet(events.TWITTER_FETCH_TWEETS_FILTERED, searchValue);
RegisterNuiCallbackType(TwitterEvents.FETCH_TWEETS_FILTERED);
on(`__cfx_nui:${TwitterEvents.FETCH_TWEETS_FILTERED}`, (searchValue: string) => {
emitNet(TwitterEvents.FETCH_TWEETS_FILTERED, searchValue);
});
onNet(events.TWITTER_FETCH_TWEETS_FILTERED_SUCCESS, (tweets: any) => {
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FILTERED_SUCCESS, tweets);
onNet(TwitterEvents.FETCH_TWEETS_FILTERED_SUCCESS, (tweets: any) => {
sendTwitterMessage(TwitterEvents.FETCH_TWEETS_FILTERED_SUCCESS, tweets);
});
onNet(events.TWITTER_FETCH_TWEETS_FILTERED_FAILURE, () => {
sendTwitterMessage(events.TWITTER_FETCH_TWEETS_FILTERED_FAILURE);
onNet(TwitterEvents.FETCH_TWEETS_FILTERED_FAILURE, () => {
sendTwitterMessage(TwitterEvents.FETCH_TWEETS_FILTERED_FAILURE);
});
/**
* Twitter create tweet
*/
RegisterNuiCallbackType(events.TWITTER_CREATE_TWEET);
on(`__cfx_nui:${events.TWITTER_CREATE_TWEET}`, (data: string) => {
sendTwitterMessage(events.TWITTER_CREATE_TWEET_LOADING, true);
emitNet(events.TWITTER_CREATE_TWEET, data);
RegisterNuiCallbackType(TwitterEvents.CREATE_TWEET);
on(`__cfx_nui:${TwitterEvents.CREATE_TWEET}`, (data: string) => {
sendTwitterMessage(TwitterEvents.CREATE_TWEET_LOADING, true);
emitNet(TwitterEvents.CREATE_TWEET, data);
});
onNet(events.TWITTER_CREATE_TWEET_RESULT, (alert: IAlertProps) => {
sendTwitterMessage(events.TWITTER_CREATE_TWEET_RESULT, alert);
emitNet(events.TWITTER_FETCH_TWEETS);
onNet(TwitterEvents.CREATE_TWEET_RESULT, (alert: IAlertProps) => {
sendTwitterMessage(TwitterEvents.CREATE_TWEET_RESULT, alert);
emitNet(TwitterEvents.FETCH_TWEETS);
});
onNet(events.TWITTER_CREATE_TWEET_FAILURE, () => {
sendTwitterMessage(events.TWITTER_CREATE_TWEET_FAILURE);
onNet(TwitterEvents.CREATE_TWEET_FAILURE, () => {
sendTwitterMessage(TwitterEvents.CREATE_TWEET_FAILURE);
});
onNet(events.TWITTER_CREATE_TWEET_BROADCAST, (tweet: any) => {
sendTwitterMessage(events.TWITTER_CREATE_TWEET_BROADCAST, tweet);
onNet(TwitterEvents.CREATE_TWEET_BROADCAST, (tweet: any) => {
sendTwitterMessage(TwitterEvents.CREATE_TWEET_BROADCAST, tweet);
});
/**
* Twitter delete tweet
*/
RegisterNuiCallbackType(events.TWITTER_DELETE_TWEET);
on(`__cfx_nui:${events.TWITTER_DELETE_TWEET}`, (tweetId: number) => {
emitNet(events.TWITTER_DELETE_TWEET, tweetId);
RegisterNuiCallbackType(TwitterEvents.DELETE_TWEET);
on(`__cfx_nui:${TwitterEvents.DELETE_TWEET}`, (tweetId: number) => {
emitNet(TwitterEvents.DELETE_TWEET, tweetId);
});
onNet(events.TWITTER_DELETE_TWEET_SUCCESS, () => {
sendTwitterMessage(events.TWITTER_DELETE_TWEET_SUCCESS);
emitNet(events.TWITTER_FETCH_TWEETS);
onNet(TwitterEvents.DELETE_TWEET_SUCCESS, () => {
sendTwitterMessage(TwitterEvents.DELETE_TWEET_SUCCESS);
emitNet(TwitterEvents.FETCH_TWEETS);
});
onNet(events.TWITTER_DELETE_TWEET_FAILURE, () => {
sendTwitterMessage(events.TWITTER_DELETE_TWEET_FAILURE);
onNet(TwitterEvents.DELETE_TWEET_FAILURE, () => {
sendTwitterMessage(TwitterEvents.DELETE_TWEET_FAILURE);
});
/**
* Twitter likes
*/
RegisterNuiCallbackType(events.TWITTER_TOGGLE_LIKE);
on(`__cfx_nui:${events.TWITTER_TOGGLE_LIKE}`, (tweetId: number) => {
emitNet(events.TWITTER_TOGGLE_LIKE, tweetId);
RegisterNuiCallbackType(TwitterEvents.TOGGLE_LIKE);
on(`__cfx_nui:${TwitterEvents.TOGGLE_LIKE}`, (tweetId: number) => {
emitNet(TwitterEvents.TOGGLE_LIKE, tweetId);
});
/**
* Twitter retweets
*/
RegisterNuiCallbackType(events.TWITTER_RETWEET);
on(`__cfx_nui:${events.TWITTER_RETWEET}`, (tweetId: number, cb: Function) => {
emitNet(events.TWITTER_RETWEET, tweetId);
RegisterNuiCallbackType(TwitterEvents.RETWEET);
on(`__cfx_nui:${TwitterEvents.RETWEET}`, (tweetId: number, cb: Function) => {
emitNet(TwitterEvents.RETWEET, tweetId);
cb();
});
onNet(events.TWITTER_RETWEET_EXISTS, (alert: IAlertProps) => {
sendTwitterMessage(events.TWITTER_RETWEET_EXISTS, alert);
onNet(TwitterEvents.RETWEET_EXISTS, (alert: IAlertProps) => {
sendTwitterMessage(TwitterEvents.RETWEET_EXISTS, alert);
});
/**
* Twitter reporting tweets
*/
RegisterNuiCallbackType(events.TWITTER_REPORT);
on(`__cfx_nui:${events.TWITTER_REPORT}`, (tweetId: number) => {
emitNet(events.TWITTER_REPORT, tweetId);
RegisterNuiCallbackType(TwitterEvents.REPORT);
on(`__cfx_nui:${TwitterEvents.REPORT}`, (tweetId: number) => {
emitNet(TwitterEvents.REPORT, tweetId);
});
onNet(events.TWITTER_REPORT_SUCCESS, () => {
emitNet(events.TWITTER_FETCH_TWEETS);
onNet(TwitterEvents.REPORT_SUCCESS, () => {
emitNet(TwitterEvents.FETCH_TWEETS);
});
+7
View File
@@ -52,3 +52,10 @@ export default class ClientUtils {
});
}
}
export const NuiCallback = (event: string, callback: Function) => {
RegisterRawNuiCallback(event, (data: any) => {
const parsed = JSON.parse(data?.body);
callback(parsed);
});
};
+1 -1
View File
@@ -35,7 +35,7 @@ const postToWebhook = async (content: DiscordMessage): Promise<AxiosResponse | v
// If convar isnt set
if (!DISCORD_WEBHOOK) {
discordLogger.warn(
'Got a request to report a listing but discord is not configures. See README o how to configure discord endpoints.',
'Got a request to report a listing but discord is not configures. See README on how to configure discord endpoints.',
);
return;
}
Loaded 100 of 122 files, more files were not shown because too many files have changed in this diff. Show more