mirror of
https://github.com/K3vinb5/Unyo.git
synced 2026-06-13 05:49:42 +00:00
rewrite: Changed license, added support for multiple repositories
This commit is contained in:
19
EULA.txt
Normal file
19
EULA.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
UNYO - END USER LICENSE AGREEMENT (EULA)
|
||||
Copyright (c) 2026, Kevin Rodrigues Borges
|
||||
|
||||
By downloading, installing, or using the Unyo application, you agree to the following terms:
|
||||
|
||||
1. LICENSE GRANT
|
||||
Kevin Rodrigues Borges grants you a personal, non-exclusive, non-transferable license to use the compiled Unyo software for personal, non-commercial purposes.
|
||||
|
||||
2. RESTRICTIONS ON PROPRIETARY COMPONENTS
|
||||
The user interface (unyo-app) is provided under the BSD-3-Clause license. However, the underlying core architecture, libraries, and custom JVM layers (unyo-core and unyo-lib) bundled within this application are proprietary and closed-source.
|
||||
You may not:
|
||||
- Decompile, reverse engineer, disassemble, or attempt to derive the source code of the proprietary backend components.
|
||||
- Extract or reuse the proprietary backend libraries (unyo-core, unyo-lib) for use in other applications or competing products.
|
||||
- Modify or create derivative works based on the proprietary components.
|
||||
|
||||
3. DISCLAIMER OF WARRANTY
|
||||
This software is provided "AS IS", without warranty of any kind, express or implied.
|
||||
|
||||
Contact: kevinborgborges555@gmail.com
|
||||
666
LICENSE
666
LICENSE
@@ -1,637 +1,29 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Unyo Copyright (C) 2024 Kevin Borges
|
||||
This app merely scrapes the internet providing you an experience
|
||||
managing, watching and reading media, we don't host any content found in the app
|
||||
and therefore hold no responsability about the legality of such content.
|
||||
This program comes with ABSOLUTELY NO WARRANTY.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under the following conditions:
|
||||
|
||||
- In addition to the requirements of the GNU General Public License version 3.0 (GPL-3.0),
|
||||
any distribution or modification of this software must include
|
||||
prominent attribution to the original project name.
|
||||
|
||||
|
||||
|
||||
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2026, Kevin Rodrigues Borges
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:unyo/core/services/api/http/http_exception.dart';
|
||||
import 'package:unyo/domain/entities/extension.dart';
|
||||
import 'package:unyo/domain/entities/user.dart';
|
||||
import 'package:unyo/domain/repositories/extension_repository.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_utils.dart';
|
||||
|
||||
class ExtensionsCubit extends Cubit<ExtensionsState> with EffectMixin<ExtensionsState> {
|
||||
final Logger _logger = sl<Logger>();
|
||||
@@ -54,21 +55,22 @@ class ExtensionsCubit extends Cubit<ExtensionsState> with EffectMixin<Extensions
|
||||
|
||||
void _init() {
|
||||
_loggedUserSubscription = _loggedUserNotifier.userStream.listen((loggedUser) {
|
||||
emit(state.copyWith(
|
||||
loggedUser: loggedUser
|
||||
));
|
||||
emit(state.copyWith(loggedUser: loggedUser));
|
||||
if (!state.userLoaded) {
|
||||
_fetchAvailableAnimeExtensions(loggedUser);
|
||||
_fetchAvailableMangaExtensions(loggedUser);
|
||||
_fetchInstaledAnimeExtensions(loggedUser);
|
||||
_fetchInstaledMangaExtensions(loggedUser);
|
||||
_fetchAnimeExtensionUpdates(loggedUser);
|
||||
_fetchMangaExtensionUpdates(loggedUser);
|
||||
emit(state.copyWith(userLoaded: true));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> downloadExtension(Extension extension) async {
|
||||
if (state.installedAnimeExtensions.contains(extension) || state.installedMangaExtensions.contains(extension)) {
|
||||
if (state.installedAnimeExtensions.contains(extension) ||
|
||||
state.installedMangaExtensions.contains(extension)) {
|
||||
handleError("This version of ${extension.name} is already installed.");
|
||||
return;
|
||||
}
|
||||
@@ -77,11 +79,17 @@ class ExtensionsCubit extends Cubit<ExtensionsState> with EffectMixin<Extensions
|
||||
if (extension.type == ExtensionType.ANIYOMI) {
|
||||
_fetchInstaledAnimeExtensions(state.loggedUser);
|
||||
_fetchAvailableAnimeExtensions(state.loggedUser);
|
||||
_fetchAnimeExtensionUpdates(state.loggedUser);
|
||||
} else {
|
||||
_fetchInstaledMangaExtensions(state.loggedUser);
|
||||
_fetchAvailableMangaExtensions(state.loggedUser);
|
||||
_fetchMangaExtensionUpdates(state.loggedUser);
|
||||
}
|
||||
showSnackBarEffect("${extension.name} Installed!", message: "${extension.name} was installed successfully", contentType: ContentType.success);
|
||||
showSnackBarEffect(
|
||||
"${extension.name} Installed!",
|
||||
message: "${extension.name} was installed successfully",
|
||||
contentType: ContentType.success,
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
if (extension.type == ExtensionType.ANIYOMI) {
|
||||
_fetchAvailableAnimeExtensions(state.loggedUser);
|
||||
@@ -93,7 +101,8 @@ class ExtensionsCubit extends Cubit<ExtensionsState> with EffectMixin<Extensions
|
||||
}
|
||||
|
||||
Future<void> removeExtension(Extension extension) async {
|
||||
if (!state.installedAnimeExtensions.contains(extension) && !state.installedMangaExtensions.contains(extension)) {
|
||||
if (!state.installedAnimeExtensions.contains(extension) &&
|
||||
!state.installedMangaExtensions.contains(extension)) {
|
||||
handleError("This version of ${extension.name} is already uninstalled.");
|
||||
return;
|
||||
}
|
||||
@@ -102,11 +111,17 @@ class ExtensionsCubit extends Cubit<ExtensionsState> with EffectMixin<Extensions
|
||||
if (extension.type == ExtensionType.ANIYOMI) {
|
||||
_fetchInstaledAnimeExtensions(state.loggedUser);
|
||||
_fetchAvailableAnimeExtensions(state.loggedUser);
|
||||
_fetchAnimeExtensionUpdates(state.loggedUser);
|
||||
} else {
|
||||
_fetchInstaledMangaExtensions(state.loggedUser);
|
||||
_fetchAvailableMangaExtensions(state.loggedUser);
|
||||
_fetchMangaExtensionUpdates(state.loggedUser);
|
||||
}
|
||||
showSnackBarEffect("${extension.name} Removed!", message: "${extension.name} was removed successfully", contentType: ContentType.success);
|
||||
showSnackBarEffect(
|
||||
"${extension.name} Removed!",
|
||||
message: "${extension.name} was removed successfully",
|
||||
contentType: ContentType.success,
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
if (extension.type == ExtensionType.ANIYOMI) {
|
||||
_fetchInstaledAnimeExtensions(state.loggedUser);
|
||||
@@ -117,14 +132,54 @@ class ExtensionsCubit extends Cubit<ExtensionsState> with EffectMixin<Extensions
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateExtension(Extension installedExtension) async {
|
||||
final Extension? newExtension = installedExtension.type == ExtensionType.ANIYOMI
|
||||
? state.animeExtensionUpdates[installedExtension.pkg]
|
||||
: state.mangaExtensionUpdates[installedExtension.pkg];
|
||||
|
||||
if (newExtension == null) {
|
||||
handleError("No update available for ${installedExtension.name}.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await _extensionRepositoryAniyomi.updateExtension(installedExtension, newExtension);
|
||||
if (installedExtension.type == ExtensionType.ANIYOMI) {
|
||||
_fetchInstaledAnimeExtensions(state.loggedUser);
|
||||
_fetchAvailableAnimeExtensions(state.loggedUser);
|
||||
_fetchAnimeExtensionUpdates(state.loggedUser);
|
||||
} else {
|
||||
_fetchInstaledMangaExtensions(state.loggedUser);
|
||||
_fetchAvailableMangaExtensions(state.loggedUser);
|
||||
_fetchMangaExtensionUpdates(state.loggedUser);
|
||||
}
|
||||
showSnackBarEffect(
|
||||
"${installedExtension.name} Updated!",
|
||||
message: "Updated to version ${newExtension.version}",
|
||||
contentType: ContentType.success,
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
handleError("Failed to update extension ${installedExtension.pkg}: $e", stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> getAvailableRepositories() {
|
||||
return state.loggedUser.settings.aniyomiExtensionsRepositories
|
||||
.map((e) => TextUtils.extractRepoName(e))
|
||||
.toSet()
|
||||
.union(
|
||||
state.loggedUser.settings.tachiyomiExtensionsRepositories
|
||||
.map((e) => TextUtils.extractRepoName(e))
|
||||
.toSet(),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _fetchAvailableAnimeExtensions(User loggedUser) async {
|
||||
try {
|
||||
_logger.i("Fetching available anime extensions for Aniyomi");
|
||||
Set<Extension> availableAniyomiExtensions = await _extensionRepositoryAniyomi
|
||||
.getAvailableAnimeExtensions(loggedUser);
|
||||
emit(state.copyWith(
|
||||
availableAnimeExtensions: availableAniyomiExtensions.toList()
|
||||
));
|
||||
emit(state.copyWith(availableAnimeExtensions: availableAniyomiExtensions.toList()));
|
||||
} on HttpServerException catch (e, stackTrace) {
|
||||
handleError(
|
||||
"Failed to fetch available anime extensions:",
|
||||
@@ -141,9 +196,7 @@ class ExtensionsCubit extends Cubit<ExtensionsState> with EffectMixin<Extensions
|
||||
_logger.i("Fetching available manga extensions for Aniyomi");
|
||||
Set<Extension> availableTachiyomiExtensions = await _extensionRepositoryAniyomi
|
||||
.getAvailableMangaExtensions(loggedUser);
|
||||
emit(state.copyWith(
|
||||
availableMangaExtensions: availableTachiyomiExtensions.toList()
|
||||
));
|
||||
emit(state.copyWith(availableMangaExtensions: availableTachiyomiExtensions.toList()));
|
||||
} on HttpServerException catch (e, stackTrace) {
|
||||
handleError(
|
||||
"Failed to fetch available manga extensions:",
|
||||
@@ -160,9 +213,7 @@ class ExtensionsCubit extends Cubit<ExtensionsState> with EffectMixin<Extensions
|
||||
_logger.i("Fetching installed anime extensions for Aniyomi");
|
||||
Set<Extension> installedAniyomiExtensions = await _extensionRepositoryAniyomi
|
||||
.getInstalledAnimeExtensions(loggedUser);
|
||||
emit(state.copyWith(
|
||||
installedAnimeExtensions: installedAniyomiExtensions.toList()
|
||||
));
|
||||
emit(state.copyWith(installedAnimeExtensions: installedAniyomiExtensions.toList()));
|
||||
} catch (e, stackTrace) {
|
||||
handleError("Failed to fetch installed anime extensions $e", stackTrace: stackTrace);
|
||||
}
|
||||
@@ -173,12 +224,29 @@ class ExtensionsCubit extends Cubit<ExtensionsState> with EffectMixin<Extensions
|
||||
_logger.i("Fetching installed manga extensions for Aniyomi");
|
||||
Set<Extension> installedTachiyomiExtensions = await _extensionRepositoryAniyomi
|
||||
.getInstalledMangaExtensions(loggedUser);
|
||||
emit(state.copyWith(
|
||||
installedMangaExtensions: installedTachiyomiExtensions.toList()
|
||||
));
|
||||
emit(state.copyWith(installedMangaExtensions: installedTachiyomiExtensions.toList()));
|
||||
} catch (e, stackTrace) {
|
||||
handleError("Failed to fetch installed manga extensions $e", stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _fetchAnimeExtensionUpdates(User loggedUser) async {
|
||||
try {
|
||||
_logger.i("Fetching anime extension updates");
|
||||
final updates = await _extensionRepositoryAniyomi.getAnimeExtensionUpdates(loggedUser);
|
||||
emit(state.copyWith(animeExtensionUpdates: updates));
|
||||
} catch (e, stackTrace) {
|
||||
_logger.w("Failed to fetch anime extension updates", stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _fetchMangaExtensionUpdates(User loggedUser) async {
|
||||
try {
|
||||
_logger.i("Fetching manga extension updates");
|
||||
final updates = await _extensionRepositoryAniyomi.getMangaExtensionUpdates(loggedUser);
|
||||
emit(state.copyWith(mangaExtensionUpdates: updates));
|
||||
} catch (e, stackTrace) {
|
||||
_logger.w("Failed to fetch manga extension updates", stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import 'package:unyo/data/models/local_user_model.dart';
|
||||
import 'package:unyo/data/repositories/repositories.dart';
|
||||
import 'package:unyo/domain/entities/settings.dart';
|
||||
import 'package:unyo/domain/entities/user.dart';
|
||||
import 'package:unyo/presentation/dialogs/textfield_dialog.dart';
|
||||
import 'package:unyo/presentation/dialogs/extensions_dialog.dart';
|
||||
import 'package:unyo/presentation/widgets/styled/dark_unyo_button.dart';
|
||||
import 'package:unyo/presentation/widgets/styled/light_unyo_button.dart';
|
||||
|
||||
@@ -243,18 +243,18 @@ class SettingsCubit extends Cubit<SettingsState> with EffectMixin<SettingsState>
|
||||
|
||||
void openAniyomiExtensionsDialog() {
|
||||
showWidgetDialogEffect(
|
||||
dialog: TextFieldDialog(
|
||||
width: 500.w,
|
||||
height: 200.h,
|
||||
dialog: ExtensionsDialog(
|
||||
width: 600.w,
|
||||
height: 400.h,
|
||||
title: "Aniyomi extensions repository URL",
|
||||
hint: state.loggedUser.settings.aniyomiExtensionsRepositoryUrl,
|
||||
onSubmitted: (newExtensionsUrl) {
|
||||
if (newExtensionsUrl == null || newExtensionsUrl.isEmpty) {
|
||||
currentRepositoriesUrls: state.loggedUser.settings.aniyomiExtensionsRepositories,
|
||||
onSubmitted: (newExtensionsRepositories) {
|
||||
if (newExtensionsRepositories.isEmpty) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Settings updatedSettings = (state.loggedUser.settings as SettingsModel).copyWith(
|
||||
aniyomiExtensionsRepositoryUrl: newExtensionsUrl,
|
||||
aniyomiExtensionsRepositories: newExtensionsRepositories.where((url) => _isValidRepoUrl(url)).toList(),
|
||||
);
|
||||
_updateUserInfo(updatedSettings);
|
||||
} catch (e, stackTrace) {
|
||||
@@ -268,18 +268,18 @@ class SettingsCubit extends Cubit<SettingsState> with EffectMixin<SettingsState>
|
||||
|
||||
void openTachiyomiExtensionsDialog() {
|
||||
showWidgetDialogEffect(
|
||||
dialog: TextFieldDialog(
|
||||
width: 500.w,
|
||||
height: 200.h,
|
||||
dialog: ExtensionsDialog(
|
||||
width: 600.w,
|
||||
height: 400.h,
|
||||
title: "Tachiyomi extensions repository URL",
|
||||
hint: state.loggedUser.settings.tachiyomiExtensionsRepositoryUrl,
|
||||
onSubmitted: (newExtensionsUrl) {
|
||||
if (newExtensionsUrl == null || newExtensionsUrl.isEmpty) {
|
||||
currentRepositoriesUrls: state.loggedUser.settings.tachiyomiExtensionsRepositories,
|
||||
onSubmitted: (newExtensionsRepositories) {
|
||||
if (newExtensionsRepositories.isEmpty) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Settings updatedSettings = (state.loggedUser.settings as SettingsModel).copyWith(
|
||||
tachiyomiExtensionsRepositoryUrl: newExtensionsUrl,
|
||||
tachiyomiExtensionsRepositories: newExtensionsRepositories.where((url) => _isValidRepoUrl(url)).toList(),
|
||||
);
|
||||
_updateUserInfo(updatedSettings);
|
||||
} catch (e, stackTrace) {
|
||||
@@ -363,4 +363,17 @@ class SettingsCubit extends Cubit<SettingsState> with EffectMixin<SettingsState>
|
||||
handleError("Error updating user info", stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
bool _isValidRepoUrl(String url) {
|
||||
final uri = Uri.tryParse(url);
|
||||
if (uri == null) return false;
|
||||
|
||||
// Structural rules
|
||||
if (!uri.isAbsolute) return false;
|
||||
if (uri.scheme != 'https') return false;
|
||||
if (uri.host.isEmpty) return false;
|
||||
if (!url.toLowerCase().endsWith('.json')) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ abstract class ExtensionsState with _$ExtensionsState implements HasEffects{
|
||||
required List<Extension> availableAnimeExtensions,
|
||||
required List<Extension> availableMangaExtensions,
|
||||
required bool userLoaded,
|
||||
@Default({}) Map<String, Extension> animeExtensionUpdates,
|
||||
@Default({}) Map<String, Extension> mangaExtensionUpdates,
|
||||
@Default(<AppEffect>[]) List<AppEffect> effects,
|
||||
}) = _ExtensionsState;
|
||||
|
||||
@@ -22,4 +24,4 @@ abstract class ExtensionsState with _$ExtensionsState implements HasEffects{
|
||||
|
||||
@override
|
||||
List<AppEffect> get stateEffects => effects;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ExtensionsState {
|
||||
|
||||
User get loggedUser; List<Extension> get installedAnimeExtensions; List<Extension> get installedMangaExtensions; List<Extension> get availableAnimeExtensions; List<Extension> get availableMangaExtensions; bool get userLoaded; List<AppEffect> get effects;
|
||||
User get loggedUser; List<Extension> get installedAnimeExtensions; List<Extension> get installedMangaExtensions; List<Extension> get availableAnimeExtensions; List<Extension> get availableMangaExtensions; bool get userLoaded; Map<String, Extension> get animeExtensionUpdates; Map<String, Extension> get mangaExtensionUpdates; List<AppEffect> get effects;
|
||||
/// Create a copy of ExtensionsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $ExtensionsStateCopyWith<ExtensionsState> get copyWith => _$ExtensionsStateCopyW
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ExtensionsState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other.installedAnimeExtensions, installedAnimeExtensions)&&const DeepCollectionEquality().equals(other.installedMangaExtensions, installedMangaExtensions)&&const DeepCollectionEquality().equals(other.availableAnimeExtensions, availableAnimeExtensions)&&const DeepCollectionEquality().equals(other.availableMangaExtensions, availableMangaExtensions)&&(identical(other.userLoaded, userLoaded) || other.userLoaded == userLoaded)&&const DeepCollectionEquality().equals(other.effects, effects));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ExtensionsState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other.installedAnimeExtensions, installedAnimeExtensions)&&const DeepCollectionEquality().equals(other.installedMangaExtensions, installedMangaExtensions)&&const DeepCollectionEquality().equals(other.availableAnimeExtensions, availableAnimeExtensions)&&const DeepCollectionEquality().equals(other.availableMangaExtensions, availableMangaExtensions)&&(identical(other.userLoaded, userLoaded) || other.userLoaded == userLoaded)&&const DeepCollectionEquality().equals(other.animeExtensionUpdates, animeExtensionUpdates)&&const DeepCollectionEquality().equals(other.mangaExtensionUpdates, mangaExtensionUpdates)&&const DeepCollectionEquality().equals(other.effects, effects));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(installedAnimeExtensions),const DeepCollectionEquality().hash(installedMangaExtensions),const DeepCollectionEquality().hash(availableAnimeExtensions),const DeepCollectionEquality().hash(availableMangaExtensions),userLoaded,const DeepCollectionEquality().hash(effects));
|
||||
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(installedAnimeExtensions),const DeepCollectionEquality().hash(installedMangaExtensions),const DeepCollectionEquality().hash(availableAnimeExtensions),const DeepCollectionEquality().hash(availableMangaExtensions),userLoaded,const DeepCollectionEquality().hash(animeExtensionUpdates),const DeepCollectionEquality().hash(mangaExtensionUpdates),const DeepCollectionEquality().hash(effects));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ExtensionsState(loggedUser: $loggedUser, installedAnimeExtensions: $installedAnimeExtensions, installedMangaExtensions: $installedMangaExtensions, availableAnimeExtensions: $availableAnimeExtensions, availableMangaExtensions: $availableMangaExtensions, userLoaded: $userLoaded, effects: $effects)';
|
||||
return 'ExtensionsState(loggedUser: $loggedUser, installedAnimeExtensions: $installedAnimeExtensions, installedMangaExtensions: $installedMangaExtensions, availableAnimeExtensions: $availableAnimeExtensions, availableMangaExtensions: $availableMangaExtensions, userLoaded: $userLoaded, animeExtensionUpdates: $animeExtensionUpdates, mangaExtensionUpdates: $mangaExtensionUpdates, effects: $effects)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $ExtensionsStateCopyWith<$Res> {
|
||||
factory $ExtensionsStateCopyWith(ExtensionsState value, $Res Function(ExtensionsState) _then) = _$ExtensionsStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, List<AppEffect> effects
|
||||
User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, Map<String, Extension> animeExtensionUpdates, Map<String, Extension> mangaExtensionUpdates, List<AppEffect> effects
|
||||
});
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class _$ExtensionsStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ExtensionsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = null,Object? installedAnimeExtensions = null,Object? installedMangaExtensions = null,Object? availableAnimeExtensions = null,Object? availableMangaExtensions = null,Object? userLoaded = null,Object? effects = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = null,Object? installedAnimeExtensions = null,Object? installedMangaExtensions = null,Object? availableAnimeExtensions = null,Object? availableMangaExtensions = null,Object? userLoaded = null,Object? animeExtensionUpdates = null,Object? mangaExtensionUpdates = null,Object? effects = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
loggedUser: null == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
|
||||
as User,installedAnimeExtensions: null == installedAnimeExtensions ? _self.installedAnimeExtensions : installedAnimeExtensions // ignore: cast_nullable_to_non_nullable
|
||||
@@ -70,7 +70,9 @@ as List<Extension>,installedMangaExtensions: null == installedMangaExtensions ?
|
||||
as List<Extension>,availableAnimeExtensions: null == availableAnimeExtensions ? _self.availableAnimeExtensions : availableAnimeExtensions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,availableMangaExtensions: null == availableMangaExtensions ? _self.availableMangaExtensions : availableMangaExtensions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,userLoaded: null == userLoaded ? _self.userLoaded : userLoaded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,effects: null == effects ? _self.effects : effects // ignore: cast_nullable_to_non_nullable
|
||||
as bool,animeExtensionUpdates: null == animeExtensionUpdates ? _self.animeExtensionUpdates : animeExtensionUpdates // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, Extension>,mangaExtensionUpdates: null == mangaExtensionUpdates ? _self.mangaExtensionUpdates : mangaExtensionUpdates // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, Extension>,effects: null == effects ? _self.effects : effects // ignore: cast_nullable_to_non_nullable
|
||||
as List<AppEffect>,
|
||||
));
|
||||
}
|
||||
@@ -156,10 +158,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, List<AppEffect> effects)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, Map<String, Extension> animeExtensionUpdates, Map<String, Extension> mangaExtensionUpdates, List<AppEffect> effects)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ExtensionsState() when $default != null:
|
||||
return $default(_that.loggedUser,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.availableAnimeExtensions,_that.availableMangaExtensions,_that.userLoaded,_that.effects);case _:
|
||||
return $default(_that.loggedUser,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.availableAnimeExtensions,_that.availableMangaExtensions,_that.userLoaded,_that.animeExtensionUpdates,_that.mangaExtensionUpdates,_that.effects);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -177,10 +179,10 @@ return $default(_that.loggedUser,_that.installedAnimeExtensions,_that.installedM
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, List<AppEffect> effects) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, Map<String, Extension> animeExtensionUpdates, Map<String, Extension> mangaExtensionUpdates, List<AppEffect> effects) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ExtensionsState():
|
||||
return $default(_that.loggedUser,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.availableAnimeExtensions,_that.availableMangaExtensions,_that.userLoaded,_that.effects);case _:
|
||||
return $default(_that.loggedUser,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.availableAnimeExtensions,_that.availableMangaExtensions,_that.userLoaded,_that.animeExtensionUpdates,_that.mangaExtensionUpdates,_that.effects);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -197,10 +199,10 @@ return $default(_that.loggedUser,_that.installedAnimeExtensions,_that.installedM
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, List<AppEffect> effects)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, Map<String, Extension> animeExtensionUpdates, Map<String, Extension> mangaExtensionUpdates, List<AppEffect> effects)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ExtensionsState() when $default != null:
|
||||
return $default(_that.loggedUser,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.availableAnimeExtensions,_that.availableMangaExtensions,_that.userLoaded,_that.effects);case _:
|
||||
return $default(_that.loggedUser,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.availableAnimeExtensions,_that.availableMangaExtensions,_that.userLoaded,_that.animeExtensionUpdates,_that.mangaExtensionUpdates,_that.effects);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -212,7 +214,7 @@ return $default(_that.loggedUser,_that.installedAnimeExtensions,_that.installedM
|
||||
|
||||
|
||||
class _ExtensionsState extends ExtensionsState {
|
||||
const _ExtensionsState({required this.loggedUser, required final List<Extension> installedAnimeExtensions, required final List<Extension> installedMangaExtensions, required final List<Extension> availableAnimeExtensions, required final List<Extension> availableMangaExtensions, required this.userLoaded, final List<AppEffect> effects = const <AppEffect>[]}): _installedAnimeExtensions = installedAnimeExtensions,_installedMangaExtensions = installedMangaExtensions,_availableAnimeExtensions = availableAnimeExtensions,_availableMangaExtensions = availableMangaExtensions,_effects = effects,super._();
|
||||
const _ExtensionsState({required this.loggedUser, required final List<Extension> installedAnimeExtensions, required final List<Extension> installedMangaExtensions, required final List<Extension> availableAnimeExtensions, required final List<Extension> availableMangaExtensions, required this.userLoaded, final Map<String, Extension> animeExtensionUpdates = const {}, final Map<String, Extension> mangaExtensionUpdates = const {}, final List<AppEffect> effects = const <AppEffect>[]}): _installedAnimeExtensions = installedAnimeExtensions,_installedMangaExtensions = installedMangaExtensions,_availableAnimeExtensions = availableAnimeExtensions,_availableMangaExtensions = availableMangaExtensions,_animeExtensionUpdates = animeExtensionUpdates,_mangaExtensionUpdates = mangaExtensionUpdates,_effects = effects,super._();
|
||||
|
||||
|
||||
@override final User loggedUser;
|
||||
@@ -245,6 +247,20 @@ class _ExtensionsState extends ExtensionsState {
|
||||
}
|
||||
|
||||
@override final bool userLoaded;
|
||||
final Map<String, Extension> _animeExtensionUpdates;
|
||||
@override@JsonKey() Map<String, Extension> get animeExtensionUpdates {
|
||||
if (_animeExtensionUpdates is EqualUnmodifiableMapView) return _animeExtensionUpdates;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_animeExtensionUpdates);
|
||||
}
|
||||
|
||||
final Map<String, Extension> _mangaExtensionUpdates;
|
||||
@override@JsonKey() Map<String, Extension> get mangaExtensionUpdates {
|
||||
if (_mangaExtensionUpdates is EqualUnmodifiableMapView) return _mangaExtensionUpdates;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_mangaExtensionUpdates);
|
||||
}
|
||||
|
||||
final List<AppEffect> _effects;
|
||||
@override@JsonKey() List<AppEffect> get effects {
|
||||
if (_effects is EqualUnmodifiableListView) return _effects;
|
||||
@@ -263,16 +279,16 @@ _$ExtensionsStateCopyWith<_ExtensionsState> get copyWith => __$ExtensionsStateCo
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ExtensionsState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other._installedAnimeExtensions, _installedAnimeExtensions)&&const DeepCollectionEquality().equals(other._installedMangaExtensions, _installedMangaExtensions)&&const DeepCollectionEquality().equals(other._availableAnimeExtensions, _availableAnimeExtensions)&&const DeepCollectionEquality().equals(other._availableMangaExtensions, _availableMangaExtensions)&&(identical(other.userLoaded, userLoaded) || other.userLoaded == userLoaded)&&const DeepCollectionEquality().equals(other._effects, _effects));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ExtensionsState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other._installedAnimeExtensions, _installedAnimeExtensions)&&const DeepCollectionEquality().equals(other._installedMangaExtensions, _installedMangaExtensions)&&const DeepCollectionEquality().equals(other._availableAnimeExtensions, _availableAnimeExtensions)&&const DeepCollectionEquality().equals(other._availableMangaExtensions, _availableMangaExtensions)&&(identical(other.userLoaded, userLoaded) || other.userLoaded == userLoaded)&&const DeepCollectionEquality().equals(other._animeExtensionUpdates, _animeExtensionUpdates)&&const DeepCollectionEquality().equals(other._mangaExtensionUpdates, _mangaExtensionUpdates)&&const DeepCollectionEquality().equals(other._effects, _effects));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(_installedAnimeExtensions),const DeepCollectionEquality().hash(_installedMangaExtensions),const DeepCollectionEquality().hash(_availableAnimeExtensions),const DeepCollectionEquality().hash(_availableMangaExtensions),userLoaded,const DeepCollectionEquality().hash(_effects));
|
||||
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(_installedAnimeExtensions),const DeepCollectionEquality().hash(_installedMangaExtensions),const DeepCollectionEquality().hash(_availableAnimeExtensions),const DeepCollectionEquality().hash(_availableMangaExtensions),userLoaded,const DeepCollectionEquality().hash(_animeExtensionUpdates),const DeepCollectionEquality().hash(_mangaExtensionUpdates),const DeepCollectionEquality().hash(_effects));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ExtensionsState(loggedUser: $loggedUser, installedAnimeExtensions: $installedAnimeExtensions, installedMangaExtensions: $installedMangaExtensions, availableAnimeExtensions: $availableAnimeExtensions, availableMangaExtensions: $availableMangaExtensions, userLoaded: $userLoaded, effects: $effects)';
|
||||
return 'ExtensionsState(loggedUser: $loggedUser, installedAnimeExtensions: $installedAnimeExtensions, installedMangaExtensions: $installedMangaExtensions, availableAnimeExtensions: $availableAnimeExtensions, availableMangaExtensions: $availableMangaExtensions, userLoaded: $userLoaded, animeExtensionUpdates: $animeExtensionUpdates, mangaExtensionUpdates: $mangaExtensionUpdates, effects: $effects)';
|
||||
}
|
||||
|
||||
|
||||
@@ -283,7 +299,7 @@ abstract mixin class _$ExtensionsStateCopyWith<$Res> implements $ExtensionsState
|
||||
factory _$ExtensionsStateCopyWith(_ExtensionsState value, $Res Function(_ExtensionsState) _then) = __$ExtensionsStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, List<AppEffect> effects
|
||||
User loggedUser, List<Extension> installedAnimeExtensions, List<Extension> installedMangaExtensions, List<Extension> availableAnimeExtensions, List<Extension> availableMangaExtensions, bool userLoaded, Map<String, Extension> animeExtensionUpdates, Map<String, Extension> mangaExtensionUpdates, List<AppEffect> effects
|
||||
});
|
||||
|
||||
|
||||
@@ -300,7 +316,7 @@ class __$ExtensionsStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ExtensionsState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = null,Object? installedAnimeExtensions = null,Object? installedMangaExtensions = null,Object? availableAnimeExtensions = null,Object? availableMangaExtensions = null,Object? userLoaded = null,Object? effects = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = null,Object? installedAnimeExtensions = null,Object? installedMangaExtensions = null,Object? availableAnimeExtensions = null,Object? availableMangaExtensions = null,Object? userLoaded = null,Object? animeExtensionUpdates = null,Object? mangaExtensionUpdates = null,Object? effects = null,}) {
|
||||
return _then(_ExtensionsState(
|
||||
loggedUser: null == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
|
||||
as User,installedAnimeExtensions: null == installedAnimeExtensions ? _self._installedAnimeExtensions : installedAnimeExtensions // ignore: cast_nullable_to_non_nullable
|
||||
@@ -308,7 +324,9 @@ as List<Extension>,installedMangaExtensions: null == installedMangaExtensions ?
|
||||
as List<Extension>,availableAnimeExtensions: null == availableAnimeExtensions ? _self._availableAnimeExtensions : availableAnimeExtensions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,availableMangaExtensions: null == availableMangaExtensions ? _self._availableMangaExtensions : availableMangaExtensions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,userLoaded: null == userLoaded ? _self.userLoaded : userLoaded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,effects: null == effects ? _self._effects : effects // ignore: cast_nullable_to_non_nullable
|
||||
as bool,animeExtensionUpdates: null == animeExtensionUpdates ? _self._animeExtensionUpdates : animeExtensionUpdates // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, Extension>,mangaExtensionUpdates: null == mangaExtensionUpdates ? _self._mangaExtensionUpdates : mangaExtensionUpdates // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, Extension>,effects: null == effects ? _self._effects : effects // ignore: cast_nullable_to_non_nullable
|
||||
as List<AppEffect>,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -244,7 +244,6 @@ void setupLocator() async{
|
||||
void setupLocatorAfterHiveInit() {
|
||||
sl.registerSingleton<ExtensionRepositoryAniyomi>(
|
||||
ExtensionRepositoryAniyomi(
|
||||
sl<UserRepositoryAnilist>(),
|
||||
sl<UserNotifier>(instanceName: config.loggedUserNotifier),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -259,7 +259,7 @@ class AnimeRepositoryAnilist with RepositoryMixin implements AnimeRepository {
|
||||
filters.addAll({
|
||||
'genres': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistGenreFilters.values
|
||||
.map((enumElement) {
|
||||
// Special handling for sci_fi to display as "Sci-fi"
|
||||
@@ -275,7 +275,7 @@ class AnimeRepositoryAnilist with RepositoryMixin implements AnimeRepository {
|
||||
filters.addAll({
|
||||
'seasons': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistSeasonFilters.values.map((enumElement) => enumElement.name).toList(),
|
||||
),
|
||||
),
|
||||
@@ -283,7 +283,7 @@ class AnimeRepositoryAnilist with RepositoryMixin implements AnimeRepository {
|
||||
filters.addAll({
|
||||
'formats': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistFormatFilters.values.map((enumElement) => enumElement.name.replaceAll('_', ' ')).toList(),
|
||||
),
|
||||
),
|
||||
@@ -291,7 +291,7 @@ class AnimeRepositoryAnilist with RepositoryMixin implements AnimeRepository {
|
||||
filters.addAll({
|
||||
'airingStatuses': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistAiringStatusFilters.values
|
||||
.map((enumElement) => enumElement.name.replaceAll('_', ' '))
|
||||
.toList(),
|
||||
@@ -310,7 +310,7 @@ class AnimeRepositoryAnilist with RepositoryMixin implements AnimeRepository {
|
||||
filters.addAll({
|
||||
'sortOptions': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistSortOptions.values.map((enumElement) => enumElement.name.replaceAll('_', ' ')).toList(),
|
||||
),
|
||||
),
|
||||
@@ -318,7 +318,7 @@ class AnimeRepositoryAnilist with RepositoryMixin implements AnimeRepository {
|
||||
filters.addAll({
|
||||
'sortOrders': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistSortOrder.values.map((enumElement) => enumElement.name.replaceAll('_', ' ')).toList(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:hive_ce/hive.dart';
|
||||
import 'package:unyo_lib/aniyomi_bridge.dart';
|
||||
@@ -16,11 +17,7 @@ import 'package:unyo/core/services/api/dto/extensions/aniyomi_repo_json_entity.d
|
||||
import 'package:unyo/core/services/api/dto/extensions/tachiyomi_repo_json_entity.dart';
|
||||
import 'package:unyo/core/services/api/http/api_response.dart';
|
||||
import 'package:unyo/core/services/api/http/http_service.dart';
|
||||
import 'package:unyo/data/models/anilist_user_model.dart';
|
||||
import 'package:unyo/data/models/local_user_model.dart';
|
||||
import 'package:unyo/data/repositories/user_repository_anilist.dart';
|
||||
import 'package:unyo/domain/entities/extension.dart';
|
||||
import 'package:unyo/domain/entities/settings.dart';
|
||||
import 'package:unyo/domain/entities/user.dart';
|
||||
import 'package:unyo/domain/repositories/extension_repository.dart';
|
||||
|
||||
@@ -31,13 +28,11 @@ class ExtensionRepositoryAniyomi implements ExtensionRepository {
|
||||
final AniyomiBridge _aniyomiBridge = sl<AniyomiBridge>();
|
||||
// Boxes
|
||||
late Box<Extension> _aniyomiExtensionsBox;
|
||||
// Repositories
|
||||
final UserRepositoryAnilist _userRepositoryAnilist;
|
||||
// Notifiers
|
||||
final UserNotifier _loggedUserNotifier;
|
||||
late StreamSubscription<User> _loggedUserSubscription;
|
||||
|
||||
ExtensionRepositoryAniyomi(this._userRepositoryAnilist, this._loggedUserNotifier) {
|
||||
ExtensionRepositoryAniyomi(this._loggedUserNotifier) {
|
||||
_init();
|
||||
}
|
||||
|
||||
@@ -49,58 +44,115 @@ class ExtensionRepositoryAniyomi implements ExtensionRepository {
|
||||
});
|
||||
}
|
||||
|
||||
Future<Set<Extension>> _fetchAllAnimeExtensions(User user) async {
|
||||
final Set<Extension> allExtensions = {};
|
||||
for (final String repoUrl in user.settings.aniyomiExtensionsRepositories) {
|
||||
try {
|
||||
ApiResponse<List<AniyomiRepoJsonEntity>> repositoryResponse = await _httpService.get(
|
||||
repoUrl,
|
||||
fromJson: _parseAniyomiRepoJsonList,
|
||||
);
|
||||
allExtensions.addAll(
|
||||
repositoryResponse.data.map(
|
||||
(aniyomiRepoJsonEntity) => ExtensionModel(
|
||||
name: aniyomiRepoJsonEntity.name.replaceFirst("Aniyomi: ", ""),
|
||||
pkg: aniyomiRepoJsonEntity.pkg,
|
||||
apk: "${repoUrl.replaceFirst("index.min.json", "apk/")}${aniyomiRepoJsonEntity.apk}",
|
||||
icon: "${repoUrl.replaceFirst("index.min.json", "icon/")}${aniyomiRepoJsonEntity.pkg}.png",
|
||||
lang: aniyomiRepoJsonEntity.lang,
|
||||
version: aniyomiRepoJsonEntity.version,
|
||||
nsfw: aniyomiRepoJsonEntity.nsfw.toInt(),
|
||||
type: ExtensionType.ANIYOMI,
|
||||
repositoryUrl: repoUrl,
|
||||
),
|
||||
),
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
_logger.w("Failed to fetch anime extensions from $repoUrl", stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
return allExtensions;
|
||||
}
|
||||
|
||||
Future<Set<Extension>> _fetchAllMangaExtensions(User user) async {
|
||||
final Set<Extension> allExtensions = {};
|
||||
for (final String repoUrl in user.settings.tachiyomiExtensionsRepositories) {
|
||||
try {
|
||||
ApiResponse<List<TachiyomiRepoJsonEntity>> repositoryResponse = await _httpService.get(
|
||||
repoUrl,
|
||||
fromJson: _parseTachiyomiRepoJsonList,
|
||||
);
|
||||
allExtensions.addAll(
|
||||
repositoryResponse.data.map(
|
||||
(tachiyomiRepoJsonEntity) => ExtensionModel(
|
||||
name: tachiyomiRepoJsonEntity.name.replaceFirst("Tachiyomi: ", ""),
|
||||
pkg: tachiyomiRepoJsonEntity.pkg,
|
||||
apk: "${repoUrl.replaceFirst("index.min.json", "apk/")}${tachiyomiRepoJsonEntity.apk}",
|
||||
icon: "${repoUrl.replaceFirst("index.min.json", "icon/")}${tachiyomiRepoJsonEntity.pkg}.png",
|
||||
lang: tachiyomiRepoJsonEntity.lang,
|
||||
version: tachiyomiRepoJsonEntity.version,
|
||||
nsfw: tachiyomiRepoJsonEntity.nsfw.toInt(),
|
||||
type: ExtensionType.TACHIYOMI,
|
||||
repositoryUrl: repoUrl,
|
||||
),
|
||||
),
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
_logger.w("Failed to fetch manga extensions from $repoUrl", stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
return allExtensions;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Set<Extension>> getAvailableAnimeExtensions(User user) async {
|
||||
_logger.d("Fetching available anime extensions for AniyomiBridge.");
|
||||
final String aniyomiExtensionsRepositoryUrl = user.settings.aniyomiExtensionsRepositoryUrl;
|
||||
ApiResponse<List<AniyomiRepoJsonEntity>> repositoryResponse = await _httpService.get(
|
||||
aniyomiExtensionsRepositoryUrl,
|
||||
fromJson: _parseAniyomiRepoJsonList,
|
||||
);
|
||||
return repositoryResponse.data
|
||||
.map(
|
||||
(aniyomiRepoJsonEntity) => ExtensionModel(
|
||||
name: aniyomiRepoJsonEntity.name.replaceFirst("Aniyomi: ", ""),
|
||||
pkg: aniyomiRepoJsonEntity.pkg,
|
||||
apk:
|
||||
"${aniyomiExtensionsRepositoryUrl.replaceFirst("index.min.json", "apk/")}${aniyomiRepoJsonEntity.apk}",
|
||||
icon:
|
||||
"${aniyomiExtensionsRepositoryUrl.replaceFirst("index.min.json", "icon/")}${aniyomiRepoJsonEntity.pkg}.png",
|
||||
lang: aniyomiRepoJsonEntity.lang,
|
||||
version: aniyomiRepoJsonEntity.version,
|
||||
nsfw: aniyomiRepoJsonEntity.nsfw.toInt(),
|
||||
type: ExtensionType.ANIYOMI,
|
||||
),
|
||||
)
|
||||
.toSet()
|
||||
.difference(await getInstalledAnimeExtensions(user));
|
||||
final allExtensions = await _fetchAllAnimeExtensions(user);
|
||||
final installedPkgs = (await getInstalledAnimeExtensions(user)).map((e) => e.pkg).toSet();
|
||||
return allExtensions.where((e) => !installedPkgs.contains(e.pkg)).toSet();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Set<Extension>> getAvailableMangaExtensions(User user) async {
|
||||
_logger.i("Fetching available manga extensions for AniyomiBridge.");
|
||||
final String tachiyomiExtensionsRepositoryUrl = user.settings.tachiyomiExtensionsRepositoryUrl;
|
||||
ApiResponse<List<TachiyomiRepoJsonEntity>> repositoryResponse = await _httpService.get(
|
||||
tachiyomiExtensionsRepositoryUrl,
|
||||
fromJson: _parseTachiyomiRepoJsonList,
|
||||
);
|
||||
return repositoryResponse.data
|
||||
.map(
|
||||
(tachiyomiRepoJsonEntity) => ExtensionModel(
|
||||
name: tachiyomiRepoJsonEntity.name.replaceFirst("Tachiyomi: ", ""),
|
||||
pkg: tachiyomiRepoJsonEntity.pkg,
|
||||
apk:
|
||||
"${tachiyomiExtensionsRepositoryUrl.replaceFirst("index.min.json", "apk/")}${tachiyomiRepoJsonEntity.apk}",
|
||||
icon:
|
||||
"${tachiyomiExtensionsRepositoryUrl.replaceFirst("index.min.json", "icon/")}${tachiyomiRepoJsonEntity.pkg}.png",
|
||||
lang: tachiyomiRepoJsonEntity.lang,
|
||||
version: tachiyomiRepoJsonEntity.version,
|
||||
nsfw: tachiyomiRepoJsonEntity.nsfw.toInt(),
|
||||
type: ExtensionType.TACHIYOMI,
|
||||
),
|
||||
)
|
||||
.toSet()
|
||||
.difference(await getInstalledMangaExtensions(user));
|
||||
final allExtensions = await _fetchAllMangaExtensions(user);
|
||||
final installedPkgs = (await getInstalledMangaExtensions(user)).map((e) => e.pkg).toSet();
|
||||
return allExtensions.where((e) => !installedPkgs.contains(e.pkg)).toSet();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, Extension>> getAnimeExtensionUpdates(User user) async {
|
||||
_logger.d("Checking for anime extension updates.");
|
||||
final allAvailable = await _fetchAllAnimeExtensions(user);
|
||||
final installed = await getInstalledAnimeExtensions(user);
|
||||
return _computeUpdates(allAvailable, installed);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, Extension>> getMangaExtensionUpdates(User user) async {
|
||||
_logger.d("Checking for manga extension updates.");
|
||||
final allAvailable = await _fetchAllMangaExtensions(user);
|
||||
final installed = await getInstalledMangaExtensions(user);
|
||||
return _computeUpdates(allAvailable, installed);
|
||||
}
|
||||
|
||||
Map<String, Extension> _computeUpdates(Set<Extension> allAvailable, Set<Extension> installed) {
|
||||
final Map<String, Extension> updates = {};
|
||||
for (final ext in installed) {
|
||||
// Only look for updates from the SAME repository the extension was installed from
|
||||
Extension? latest;
|
||||
for (final avail in allAvailable) {
|
||||
if (avail.pkg == ext.pkg && avail.repositoryUrl == ext.repositoryUrl) {
|
||||
if (latest == null || _compareVersions(avail.version, latest.version) > 0) {
|
||||
latest = avail;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (latest != null && _compareVersions(latest.version, ext.version) > 0) {
|
||||
updates[ext.pkg] = latest;
|
||||
}
|
||||
}
|
||||
return updates;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -117,30 +169,6 @@ class ExtensionRepositoryAniyomi implements ExtensionRepository {
|
||||
.toSet();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateAnimeRepositoryUrl(String newUrl, User user) async {
|
||||
switch (user) {
|
||||
case AnilistUserModel():
|
||||
SettingsModel userSettings = user.settings as SettingsModel;
|
||||
await _userRepositoryAnilist.updateUserInfo(
|
||||
user.copyWith(settings: userSettings.copyWith(aniyomiExtensionsRepositoryUrl: newUrl)),
|
||||
);
|
||||
case LocalUserModel():
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateMangaRepositoryUrl(String newUrl, User user) async {
|
||||
switch (user) {
|
||||
case AnilistUserModel():
|
||||
SettingsModel userSettings = user.settings as SettingsModel;
|
||||
await _userRepositoryAnilist.updateUserInfo(
|
||||
user.copyWith(settings: userSettings.copyWith(tachiyomiExtensionsRepositoryUrl: newUrl)),
|
||||
);
|
||||
case LocalUserModel():
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> addExtension(Extension extension) async {
|
||||
_aniyomiExtensionsBox = await Hive.openBox<Extension>('aniyomiExtensions');
|
||||
@@ -169,6 +197,13 @@ class ExtensionRepositoryAniyomi implements ExtensionRepository {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateExtension(Extension oldExtension, Extension newExtension) async {
|
||||
_logger.i("Updating extension ${oldExtension.pkg} from ${oldExtension.version} to ${newExtension.version}");
|
||||
await removeExtension(oldExtension);
|
||||
await addExtension(newExtension);
|
||||
}
|
||||
|
||||
Future<List<JSAnime>> getAnimeSearchResults(String query, Extension extension) async {
|
||||
return _aniyomiBridge.getAnimeSearchResults(query, 1, extension.pkg);
|
||||
}
|
||||
@@ -205,6 +240,17 @@ class ExtensionRepositoryAniyomi implements ExtensionRepository {
|
||||
.toList();
|
||||
}
|
||||
|
||||
int _compareVersions(String a, String b) {
|
||||
final pa = a.split('.').map(int.tryParse).map((v) => v ?? 0).toList();
|
||||
final pb = b.split('.').map(int.tryParse).map((v) => v ?? 0).toList();
|
||||
for (int i = 0; i < max(pa.length, pb.length); i++) {
|
||||
final va = i < pa.length ? pa[i] : 0;
|
||||
final vb = i < pb.length ? pb[i] : 0;
|
||||
if (va != vb) return va.compareTo(vb);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Future<void> _loadInstalledAnimeExtensions(User loggedUser) async {
|
||||
Set<Extension> installedExtensions = await getInstalledAnimeExtensions(loggedUser);
|
||||
if (!_aniyomiBridge.isReady()) {
|
||||
|
||||
@@ -138,7 +138,7 @@ class MangaRepositoryAnilist with RepositoryMixin implements MangaRepository {
|
||||
filters.addAll({
|
||||
'genres': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnlistGenreFilters.values
|
||||
.map((enumElement) {
|
||||
// Special handling for sci_fi to display as "Sci-fi"
|
||||
@@ -154,7 +154,7 @@ class MangaRepositoryAnilist with RepositoryMixin implements MangaRepository {
|
||||
filters.addAll({
|
||||
'seasons': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistSeasonFilters.values.map((enumElement) => enumElement.name).toList(),
|
||||
),
|
||||
),
|
||||
@@ -162,7 +162,7 @@ class MangaRepositoryAnilist with RepositoryMixin implements MangaRepository {
|
||||
filters.addAll({
|
||||
'formats': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistFormatFilters.values.map((enumElement) => enumElement.name.replaceAll('_', ' ')).toList(),
|
||||
),
|
||||
),
|
||||
@@ -170,7 +170,7 @@ class MangaRepositoryAnilist with RepositoryMixin implements MangaRepository {
|
||||
filters.addAll({
|
||||
'countries': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistCountryFilters.values.map((enumElement) => enumElement.name.replaceAll('_', ' ')).toList(),
|
||||
),
|
||||
),
|
||||
@@ -178,7 +178,7 @@ class MangaRepositoryAnilist with RepositoryMixin implements MangaRepository {
|
||||
filters.addAll({
|
||||
'airingStatuses': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistAiringStatusFilters.values
|
||||
.map((enumElement) => enumElement.name.replaceAll('_', ' '))
|
||||
.toList(),
|
||||
@@ -188,7 +188,7 @@ class MangaRepositoryAnilist with RepositoryMixin implements MangaRepository {
|
||||
filters.addAll({
|
||||
'sortOptions': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistSortOptions.values
|
||||
.map((enumElement) => enumElement.name.replaceAll('_', ' '))
|
||||
.toList(),
|
||||
@@ -198,7 +198,7 @@ class MangaRepositoryAnilist with RepositoryMixin implements MangaRepository {
|
||||
filters.addAll({
|
||||
'sortOrders': (
|
||||
true,
|
||||
TextUtils.upperCaseFirstCharacter(
|
||||
TextUtils.capitalizeList(
|
||||
AnilistSortOrder.values
|
||||
.map((enumElement) => enumElement.name.replaceAll('_', ' '))
|
||||
.toList(),
|
||||
|
||||
@@ -17,6 +17,7 @@ abstract class Extension {
|
||||
final String version;
|
||||
final int nsfw;
|
||||
final String type;
|
||||
final String repositoryUrl;
|
||||
|
||||
const Extension({
|
||||
required this.name,
|
||||
@@ -27,11 +28,12 @@ abstract class Extension {
|
||||
required this.version,
|
||||
required this.nsfw,
|
||||
required this.type,
|
||||
required this.repositoryUrl,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Extension()';
|
||||
return 'Extension{name: $name, pkg: $pkg, apk: $apk, icon: $icon, lang: $lang, version: $version, nsfw: $nsfw, type: $type, repositoryUrl: $repositoryUrl}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +49,7 @@ abstract class ExtensionModel with _$ExtensionModel implements Extension {
|
||||
@HiveField(5) required String version,
|
||||
@HiveField(6) required int nsfw,
|
||||
@HiveField(7) required String type,
|
||||
@HiveField(8) @Default("") String repositoryUrl,
|
||||
}) = _ExtensionModel;
|
||||
|
||||
factory ExtensionModel.empty() => const ExtensionModel(
|
||||
@@ -58,6 +61,7 @@ abstract class ExtensionModel with _$ExtensionModel implements Extension {
|
||||
version: '',
|
||||
nsfw: 0,
|
||||
type: ExtensionType.ANIYOMI,
|
||||
repositoryUrl: '',
|
||||
);
|
||||
|
||||
factory ExtensionModel.fromJson(Map<String, dynamic> json) => _$ExtensionModelFromJson(json);
|
||||
|
||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ExtensionModel {
|
||||
|
||||
@HiveField(0) String get name;@HiveField(1) String get pkg;@HiveField(2) String get apk;@HiveField(3) String get icon;@HiveField(4) String get lang;@HiveField(5) String get version;@HiveField(6) int get nsfw;@HiveField(7) String get type;
|
||||
@HiveField(0) String get name;@HiveField(1) String get pkg;@HiveField(2) String get apk;@HiveField(3) String get icon;@HiveField(4) String get lang;@HiveField(5) String get version;@HiveField(6) int get nsfw;@HiveField(7) String get type;@HiveField(8) String get repositoryUrl;
|
||||
/// Create a copy of ExtensionModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -28,12 +28,12 @@ $ExtensionModelCopyWith<ExtensionModel> get copyWith => _$ExtensionModelCopyWith
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ExtensionModel&&(identical(other.name, name) || other.name == name)&&(identical(other.pkg, pkg) || other.pkg == pkg)&&(identical(other.apk, apk) || other.apk == apk)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.lang, lang) || other.lang == lang)&&(identical(other.version, version) || other.version == version)&&(identical(other.nsfw, nsfw) || other.nsfw == nsfw)&&(identical(other.type, type) || other.type == type));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ExtensionModel&&(identical(other.name, name) || other.name == name)&&(identical(other.pkg, pkg) || other.pkg == pkg)&&(identical(other.apk, apk) || other.apk == apk)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.lang, lang) || other.lang == lang)&&(identical(other.version, version) || other.version == version)&&(identical(other.nsfw, nsfw) || other.nsfw == nsfw)&&(identical(other.type, type) || other.type == type)&&(identical(other.repositoryUrl, repositoryUrl) || other.repositoryUrl == repositoryUrl));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,pkg,apk,icon,lang,version,nsfw,type);
|
||||
int get hashCode => Object.hash(runtimeType,name,pkg,apk,icon,lang,version,nsfw,type,repositoryUrl);
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ abstract mixin class $ExtensionModelCopyWith<$Res> {
|
||||
factory $ExtensionModelCopyWith(ExtensionModel value, $Res Function(ExtensionModel) _then) = _$ExtensionModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
@HiveField(0) String name,@HiveField(1) String pkg,@HiveField(2) String apk,@HiveField(3) String icon,@HiveField(4) String lang,@HiveField(5) String version,@HiveField(6) int nsfw,@HiveField(7) String type
|
||||
@HiveField(0) String name,@HiveField(1) String pkg,@HiveField(2) String apk,@HiveField(3) String icon,@HiveField(4) String lang,@HiveField(5) String version,@HiveField(6) int nsfw,@HiveField(7) String type,@HiveField(8) String repositoryUrl
|
||||
});
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class _$ExtensionModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ExtensionModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? pkg = null,Object? apk = null,Object? icon = null,Object? lang = null,Object? version = null,Object? nsfw = null,Object? type = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? pkg = null,Object? apk = null,Object? icon = null,Object? lang = null,Object? version = null,Object? nsfw = null,Object? type = null,Object? repositoryUrl = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,pkg: null == pkg ? _self.pkg : pkg // ignore: cast_nullable_to_non_nullable
|
||||
@@ -71,6 +71,7 @@ as String,lang: null == lang ? _self.lang : lang // ignore: cast_nullable_to_non
|
||||
as String,version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
|
||||
as String,nsfw: null == nsfw ? _self.nsfw : nsfw // ignore: cast_nullable_to_non_nullable
|
||||
as int,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||
as String,repositoryUrl: null == repositoryUrl ? _self.repositoryUrl : repositoryUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
@@ -156,10 +157,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@HiveField(0) String name, @HiveField(1) String pkg, @HiveField(2) String apk, @HiveField(3) String icon, @HiveField(4) String lang, @HiveField(5) String version, @HiveField(6) int nsfw, @HiveField(7) String type)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@HiveField(0) String name, @HiveField(1) String pkg, @HiveField(2) String apk, @HiveField(3) String icon, @HiveField(4) String lang, @HiveField(5) String version, @HiveField(6) int nsfw, @HiveField(7) String type, @HiveField(8) String repositoryUrl)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ExtensionModel() when $default != null:
|
||||
return $default(_that.name,_that.pkg,_that.apk,_that.icon,_that.lang,_that.version,_that.nsfw,_that.type);case _:
|
||||
return $default(_that.name,_that.pkg,_that.apk,_that.icon,_that.lang,_that.version,_that.nsfw,_that.type,_that.repositoryUrl);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -177,10 +178,10 @@ return $default(_that.name,_that.pkg,_that.apk,_that.icon,_that.lang,_that.versi
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@HiveField(0) String name, @HiveField(1) String pkg, @HiveField(2) String apk, @HiveField(3) String icon, @HiveField(4) String lang, @HiveField(5) String version, @HiveField(6) int nsfw, @HiveField(7) String type) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@HiveField(0) String name, @HiveField(1) String pkg, @HiveField(2) String apk, @HiveField(3) String icon, @HiveField(4) String lang, @HiveField(5) String version, @HiveField(6) int nsfw, @HiveField(7) String type, @HiveField(8) String repositoryUrl) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ExtensionModel():
|
||||
return $default(_that.name,_that.pkg,_that.apk,_that.icon,_that.lang,_that.version,_that.nsfw,_that.type);case _:
|
||||
return $default(_that.name,_that.pkg,_that.apk,_that.icon,_that.lang,_that.version,_that.nsfw,_that.type,_that.repositoryUrl);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -197,10 +198,10 @@ return $default(_that.name,_that.pkg,_that.apk,_that.icon,_that.lang,_that.versi
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@HiveField(0) String name, @HiveField(1) String pkg, @HiveField(2) String apk, @HiveField(3) String icon, @HiveField(4) String lang, @HiveField(5) String version, @HiveField(6) int nsfw, @HiveField(7) String type)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@HiveField(0) String name, @HiveField(1) String pkg, @HiveField(2) String apk, @HiveField(3) String icon, @HiveField(4) String lang, @HiveField(5) String version, @HiveField(6) int nsfw, @HiveField(7) String type, @HiveField(8) String repositoryUrl)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ExtensionModel() when $default != null:
|
||||
return $default(_that.name,_that.pkg,_that.apk,_that.icon,_that.lang,_that.version,_that.nsfw,_that.type);case _:
|
||||
return $default(_that.name,_that.pkg,_that.apk,_that.icon,_that.lang,_that.version,_that.nsfw,_that.type,_that.repositoryUrl);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -212,7 +213,7 @@ return $default(_that.name,_that.pkg,_that.apk,_that.icon,_that.lang,_that.versi
|
||||
@JsonSerializable()
|
||||
|
||||
class _ExtensionModel implements ExtensionModel {
|
||||
const _ExtensionModel({@HiveField(0) required this.name, @HiveField(1) required this.pkg, @HiveField(2) required this.apk, @HiveField(3) required this.icon, @HiveField(4) required this.lang, @HiveField(5) required this.version, @HiveField(6) required this.nsfw, @HiveField(7) required this.type});
|
||||
const _ExtensionModel({@HiveField(0) required this.name, @HiveField(1) required this.pkg, @HiveField(2) required this.apk, @HiveField(3) required this.icon, @HiveField(4) required this.lang, @HiveField(5) required this.version, @HiveField(6) required this.nsfw, @HiveField(7) required this.type, @HiveField(8) this.repositoryUrl = ""});
|
||||
factory _ExtensionModel.fromJson(Map<String, dynamic> json) => _$ExtensionModelFromJson(json);
|
||||
|
||||
@override@HiveField(0) final String name;
|
||||
@@ -223,6 +224,7 @@ class _ExtensionModel implements ExtensionModel {
|
||||
@override@HiveField(5) final String version;
|
||||
@override@HiveField(6) final int nsfw;
|
||||
@override@HiveField(7) final String type;
|
||||
@override@JsonKey()@HiveField(8) final String repositoryUrl;
|
||||
|
||||
/// Create a copy of ExtensionModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -237,12 +239,12 @@ Map<String, dynamic> toJson() {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ExtensionModel&&(identical(other.name, name) || other.name == name)&&(identical(other.pkg, pkg) || other.pkg == pkg)&&(identical(other.apk, apk) || other.apk == apk)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.lang, lang) || other.lang == lang)&&(identical(other.version, version) || other.version == version)&&(identical(other.nsfw, nsfw) || other.nsfw == nsfw)&&(identical(other.type, type) || other.type == type));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ExtensionModel&&(identical(other.name, name) || other.name == name)&&(identical(other.pkg, pkg) || other.pkg == pkg)&&(identical(other.apk, apk) || other.apk == apk)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.lang, lang) || other.lang == lang)&&(identical(other.version, version) || other.version == version)&&(identical(other.nsfw, nsfw) || other.nsfw == nsfw)&&(identical(other.type, type) || other.type == type)&&(identical(other.repositoryUrl, repositoryUrl) || other.repositoryUrl == repositoryUrl));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,name,pkg,apk,icon,lang,version,nsfw,type);
|
||||
int get hashCode => Object.hash(runtimeType,name,pkg,apk,icon,lang,version,nsfw,type,repositoryUrl);
|
||||
|
||||
|
||||
|
||||
@@ -253,7 +255,7 @@ abstract mixin class _$ExtensionModelCopyWith<$Res> implements $ExtensionModelCo
|
||||
factory _$ExtensionModelCopyWith(_ExtensionModel value, $Res Function(_ExtensionModel) _then) = __$ExtensionModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
@HiveField(0) String name,@HiveField(1) String pkg,@HiveField(2) String apk,@HiveField(3) String icon,@HiveField(4) String lang,@HiveField(5) String version,@HiveField(6) int nsfw,@HiveField(7) String type
|
||||
@HiveField(0) String name,@HiveField(1) String pkg,@HiveField(2) String apk,@HiveField(3) String icon,@HiveField(4) String lang,@HiveField(5) String version,@HiveField(6) int nsfw,@HiveField(7) String type,@HiveField(8) String repositoryUrl
|
||||
});
|
||||
|
||||
|
||||
@@ -270,7 +272,7 @@ class __$ExtensionModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ExtensionModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? pkg = null,Object? apk = null,Object? icon = null,Object? lang = null,Object? version = null,Object? nsfw = null,Object? type = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? pkg = null,Object? apk = null,Object? icon = null,Object? lang = null,Object? version = null,Object? nsfw = null,Object? type = null,Object? repositoryUrl = null,}) {
|
||||
return _then(_ExtensionModel(
|
||||
name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,pkg: null == pkg ? _self.pkg : pkg // ignore: cast_nullable_to_non_nullable
|
||||
@@ -280,6 +282,7 @@ as String,lang: null == lang ? _self.lang : lang // ignore: cast_nullable_to_non
|
||||
as String,version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
|
||||
as String,nsfw: null == nsfw ? _self.nsfw : nsfw // ignore: cast_nullable_to_non_nullable
|
||||
as int,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||
as String,repositoryUrl: null == repositoryUrl ? _self.repositoryUrl : repositoryUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -25,13 +25,14 @@ class ExtensionModelAdapter extends TypeAdapter<ExtensionModel> {
|
||||
version: fields[5] as String,
|
||||
nsfw: (fields[6] as num).toInt(),
|
||||
type: fields[7] as String,
|
||||
repositoryUrl: fields[8] == null ? '' : fields[8] as String,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, ExtensionModel obj) {
|
||||
writer
|
||||
..writeByte(8)
|
||||
..writeByte(9)
|
||||
..writeByte(0)
|
||||
..write(obj.name)
|
||||
..writeByte(1)
|
||||
@@ -47,7 +48,9 @@ class ExtensionModelAdapter extends TypeAdapter<ExtensionModel> {
|
||||
..writeByte(6)
|
||||
..write(obj.nsfw)
|
||||
..writeByte(7)
|
||||
..write(obj.type);
|
||||
..write(obj.type)
|
||||
..writeByte(8)
|
||||
..write(obj.repositoryUrl);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -75,6 +78,7 @@ _ExtensionModel _$ExtensionModelFromJson(Map<String, dynamic> json) =>
|
||||
version: json['version'] as String,
|
||||
nsfw: (json['nsfw'] as num).toInt(),
|
||||
type: json['type'] as String,
|
||||
repositoryUrl: json['repositoryUrl'] as String? ?? "",
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ExtensionModelToJson(_ExtensionModel instance) =>
|
||||
@@ -87,4 +91,5 @@ Map<String, dynamic> _$ExtensionModelToJson(_ExtensionModel instance) =>
|
||||
'version': instance.version,
|
||||
'nsfw': instance.nsfw,
|
||||
'type': instance.type,
|
||||
'repositoryUrl': instance.repositoryUrl,
|
||||
};
|
||||
|
||||
@@ -20,8 +20,8 @@ abstract class Settings {
|
||||
final String episodeTitleLanguage;
|
||||
final Service service;
|
||||
final EpisodeService episodeService;
|
||||
final String aniyomiExtensionsRepositoryUrl;
|
||||
final String tachiyomiExtensionsRepositoryUrl;
|
||||
final List<String> aniyomiExtensionsRepositories;
|
||||
final List<String> tachiyomiExtensionsRepositories;
|
||||
final bool enableDiscordRichPresence;
|
||||
final bool automaticallySkipOpening;
|
||||
final bool automaticallySkipEnding;
|
||||
@@ -42,8 +42,8 @@ abstract class Settings {
|
||||
required this.language,
|
||||
required this.mediaTitleLanguage,
|
||||
required this.episodeTitleLanguage,
|
||||
required this.aniyomiExtensionsRepositoryUrl,
|
||||
required this.tachiyomiExtensionsRepositoryUrl,
|
||||
required this.aniyomiExtensionsRepositories,
|
||||
required this.tachiyomiExtensionsRepositories,
|
||||
required this.enableDiscordRichPresence,
|
||||
required this.automaticallySkipOpening,
|
||||
required this.automaticallySkipEnding,
|
||||
@@ -69,8 +69,6 @@ abstract class SettingsModel with _$SettingsModel implements Settings {
|
||||
@HiveField(2) @Default(EpisodeService.anizip) EpisodeService episodeService,
|
||||
@HiveField(3) @ExtensionConverter() @Default([]) List<Extension> installedAnimeExtensions,
|
||||
@HiveField(4) @ExtensionConverter() @Default([]) List<Extension> installedMangaExtensions,
|
||||
@HiveField(5) @Default(config.aniyomiExtensionsRepositoryUrl) String aniyomiExtensionsRepositoryUrl,
|
||||
@HiveField(6) @Default(config.tachiyomiExtensionsRepositoryUrl) String tachiyomiExtensionsRepositoryUrl,
|
||||
@HiveField(7) @ExtensionConverter() @Default({}) Map<String, Extension> mediaExtensionConfigs,
|
||||
@HiveField(8) @Default('userPreferred') String mediaTitleLanguage,
|
||||
@HiveField(9) @Default('en') String episodeTitleLanguage,
|
||||
@@ -83,6 +81,8 @@ abstract class SettingsModel with _$SettingsModel implements Settings {
|
||||
@HiveField(16) @Default(false) bool enableNsfwContent,
|
||||
@HiveField(17) @ColorConverter() @Default(Color(0xFF2196F3)) Color themeColor,
|
||||
@HiveField(18) @Default(true) bool useWallpaperAsThemeColor,
|
||||
@HiveField(19) @Default([config.aniyomiExtensionsRepositoryUrl]) List<String> aniyomiExtensionsRepositories,
|
||||
@HiveField(20) @Default([config.tachiyomiExtensionsRepositoryUrl]) List<String> tachiyomiExtensionsRepositories,
|
||||
}) = _SettingsModel;
|
||||
|
||||
factory SettingsModel.empty() =>
|
||||
|
||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$SettingsModel {
|
||||
|
||||
@HiveField(0) String get language;@HiveField(1) Service get service;@HiveField(2) EpisodeService get episodeService;@HiveField(3)@ExtensionConverter() List<Extension> get installedAnimeExtensions;@HiveField(4)@ExtensionConverter() List<Extension> get installedMangaExtensions;@HiveField(5) String get aniyomiExtensionsRepositoryUrl;@HiveField(6) String get tachiyomiExtensionsRepositoryUrl;@HiveField(7)@ExtensionConverter() Map<String, Extension> get mediaExtensionConfigs;@HiveField(8) String get mediaTitleLanguage;@HiveField(9) String get episodeTitleLanguage;@HiveField(10) bool get enableDiscordRichPresence;@HiveField(11) bool get automaticallySkipOpening;@HiveField(12) bool get automaticallySkipEnding;@HiveField(13) int get manualSkipTime;@HiveField(14) bool get autoPlayNextEpisode;@HiveField(15) bool get enableOpenSubtitlesIntegration;@HiveField(16) bool get enableNsfwContent;@HiveField(17)@ColorConverter() Color get themeColor;@HiveField(18) bool get useWallpaperAsThemeColor;
|
||||
@HiveField(0) String get language;@HiveField(1) Service get service;@HiveField(2) EpisodeService get episodeService;@HiveField(3)@ExtensionConverter() List<Extension> get installedAnimeExtensions;@HiveField(4)@ExtensionConverter() List<Extension> get installedMangaExtensions;@HiveField(7)@ExtensionConverter() Map<String, Extension> get mediaExtensionConfigs;@HiveField(8) String get mediaTitleLanguage;@HiveField(9) String get episodeTitleLanguage;@HiveField(10) bool get enableDiscordRichPresence;@HiveField(11) bool get automaticallySkipOpening;@HiveField(12) bool get automaticallySkipEnding;@HiveField(13) int get manualSkipTime;@HiveField(14) bool get autoPlayNextEpisode;@HiveField(15) bool get enableOpenSubtitlesIntegration;@HiveField(16) bool get enableNsfwContent;@HiveField(17)@ColorConverter() Color get themeColor;@HiveField(18) bool get useWallpaperAsThemeColor;@HiveField(19) List<String> get aniyomiExtensionsRepositories;@HiveField(20) List<String> get tachiyomiExtensionsRepositories;
|
||||
/// Create a copy of SettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -28,16 +28,16 @@ $SettingsModelCopyWith<SettingsModel> get copyWith => _$SettingsModelCopyWithImp
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SettingsModel&&(identical(other.language, language) || other.language == language)&&(identical(other.service, service) || other.service == service)&&(identical(other.episodeService, episodeService) || other.episodeService == episodeService)&&const DeepCollectionEquality().equals(other.installedAnimeExtensions, installedAnimeExtensions)&&const DeepCollectionEquality().equals(other.installedMangaExtensions, installedMangaExtensions)&&(identical(other.aniyomiExtensionsRepositoryUrl, aniyomiExtensionsRepositoryUrl) || other.aniyomiExtensionsRepositoryUrl == aniyomiExtensionsRepositoryUrl)&&(identical(other.tachiyomiExtensionsRepositoryUrl, tachiyomiExtensionsRepositoryUrl) || other.tachiyomiExtensionsRepositoryUrl == tachiyomiExtensionsRepositoryUrl)&&const DeepCollectionEquality().equals(other.mediaExtensionConfigs, mediaExtensionConfigs)&&(identical(other.mediaTitleLanguage, mediaTitleLanguage) || other.mediaTitleLanguage == mediaTitleLanguage)&&(identical(other.episodeTitleLanguage, episodeTitleLanguage) || other.episodeTitleLanguage == episodeTitleLanguage)&&(identical(other.enableDiscordRichPresence, enableDiscordRichPresence) || other.enableDiscordRichPresence == enableDiscordRichPresence)&&(identical(other.automaticallySkipOpening, automaticallySkipOpening) || other.automaticallySkipOpening == automaticallySkipOpening)&&(identical(other.automaticallySkipEnding, automaticallySkipEnding) || other.automaticallySkipEnding == automaticallySkipEnding)&&(identical(other.manualSkipTime, manualSkipTime) || other.manualSkipTime == manualSkipTime)&&(identical(other.autoPlayNextEpisode, autoPlayNextEpisode) || other.autoPlayNextEpisode == autoPlayNextEpisode)&&(identical(other.enableOpenSubtitlesIntegration, enableOpenSubtitlesIntegration) || other.enableOpenSubtitlesIntegration == enableOpenSubtitlesIntegration)&&(identical(other.enableNsfwContent, enableNsfwContent) || other.enableNsfwContent == enableNsfwContent)&&(identical(other.themeColor, themeColor) || other.themeColor == themeColor)&&(identical(other.useWallpaperAsThemeColor, useWallpaperAsThemeColor) || other.useWallpaperAsThemeColor == useWallpaperAsThemeColor));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SettingsModel&&(identical(other.language, language) || other.language == language)&&(identical(other.service, service) || other.service == service)&&(identical(other.episodeService, episodeService) || other.episodeService == episodeService)&&const DeepCollectionEquality().equals(other.installedAnimeExtensions, installedAnimeExtensions)&&const DeepCollectionEquality().equals(other.installedMangaExtensions, installedMangaExtensions)&&const DeepCollectionEquality().equals(other.mediaExtensionConfigs, mediaExtensionConfigs)&&(identical(other.mediaTitleLanguage, mediaTitleLanguage) || other.mediaTitleLanguage == mediaTitleLanguage)&&(identical(other.episodeTitleLanguage, episodeTitleLanguage) || other.episodeTitleLanguage == episodeTitleLanguage)&&(identical(other.enableDiscordRichPresence, enableDiscordRichPresence) || other.enableDiscordRichPresence == enableDiscordRichPresence)&&(identical(other.automaticallySkipOpening, automaticallySkipOpening) || other.automaticallySkipOpening == automaticallySkipOpening)&&(identical(other.automaticallySkipEnding, automaticallySkipEnding) || other.automaticallySkipEnding == automaticallySkipEnding)&&(identical(other.manualSkipTime, manualSkipTime) || other.manualSkipTime == manualSkipTime)&&(identical(other.autoPlayNextEpisode, autoPlayNextEpisode) || other.autoPlayNextEpisode == autoPlayNextEpisode)&&(identical(other.enableOpenSubtitlesIntegration, enableOpenSubtitlesIntegration) || other.enableOpenSubtitlesIntegration == enableOpenSubtitlesIntegration)&&(identical(other.enableNsfwContent, enableNsfwContent) || other.enableNsfwContent == enableNsfwContent)&&(identical(other.themeColor, themeColor) || other.themeColor == themeColor)&&(identical(other.useWallpaperAsThemeColor, useWallpaperAsThemeColor) || other.useWallpaperAsThemeColor == useWallpaperAsThemeColor)&&const DeepCollectionEquality().equals(other.aniyomiExtensionsRepositories, aniyomiExtensionsRepositories)&&const DeepCollectionEquality().equals(other.tachiyomiExtensionsRepositories, tachiyomiExtensionsRepositories));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hashAll([runtimeType,language,service,episodeService,const DeepCollectionEquality().hash(installedAnimeExtensions),const DeepCollectionEquality().hash(installedMangaExtensions),aniyomiExtensionsRepositoryUrl,tachiyomiExtensionsRepositoryUrl,const DeepCollectionEquality().hash(mediaExtensionConfigs),mediaTitleLanguage,episodeTitleLanguage,enableDiscordRichPresence,automaticallySkipOpening,automaticallySkipEnding,manualSkipTime,autoPlayNextEpisode,enableOpenSubtitlesIntegration,enableNsfwContent,themeColor,useWallpaperAsThemeColor]);
|
||||
int get hashCode => Object.hashAll([runtimeType,language,service,episodeService,const DeepCollectionEquality().hash(installedAnimeExtensions),const DeepCollectionEquality().hash(installedMangaExtensions),const DeepCollectionEquality().hash(mediaExtensionConfigs),mediaTitleLanguage,episodeTitleLanguage,enableDiscordRichPresence,automaticallySkipOpening,automaticallySkipEnding,manualSkipTime,autoPlayNextEpisode,enableOpenSubtitlesIntegration,enableNsfwContent,themeColor,useWallpaperAsThemeColor,const DeepCollectionEquality().hash(aniyomiExtensionsRepositories),const DeepCollectionEquality().hash(tachiyomiExtensionsRepositories)]);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsModel(language: $language, service: $service, episodeService: $episodeService, installedAnimeExtensions: $installedAnimeExtensions, installedMangaExtensions: $installedMangaExtensions, aniyomiExtensionsRepositoryUrl: $aniyomiExtensionsRepositoryUrl, tachiyomiExtensionsRepositoryUrl: $tachiyomiExtensionsRepositoryUrl, mediaExtensionConfigs: $mediaExtensionConfigs, mediaTitleLanguage: $mediaTitleLanguage, episodeTitleLanguage: $episodeTitleLanguage, enableDiscordRichPresence: $enableDiscordRichPresence, automaticallySkipOpening: $automaticallySkipOpening, automaticallySkipEnding: $automaticallySkipEnding, manualSkipTime: $manualSkipTime, autoPlayNextEpisode: $autoPlayNextEpisode, enableOpenSubtitlesIntegration: $enableOpenSubtitlesIntegration, enableNsfwContent: $enableNsfwContent, themeColor: $themeColor, useWallpaperAsThemeColor: $useWallpaperAsThemeColor)';
|
||||
return 'SettingsModel(language: $language, service: $service, episodeService: $episodeService, installedAnimeExtensions: $installedAnimeExtensions, installedMangaExtensions: $installedMangaExtensions, mediaExtensionConfigs: $mediaExtensionConfigs, mediaTitleLanguage: $mediaTitleLanguage, episodeTitleLanguage: $episodeTitleLanguage, enableDiscordRichPresence: $enableDiscordRichPresence, automaticallySkipOpening: $automaticallySkipOpening, automaticallySkipEnding: $automaticallySkipEnding, manualSkipTime: $manualSkipTime, autoPlayNextEpisode: $autoPlayNextEpisode, enableOpenSubtitlesIntegration: $enableOpenSubtitlesIntegration, enableNsfwContent: $enableNsfwContent, themeColor: $themeColor, useWallpaperAsThemeColor: $useWallpaperAsThemeColor, aniyomiExtensionsRepositories: $aniyomiExtensionsRepositories, tachiyomiExtensionsRepositories: $tachiyomiExtensionsRepositories)';
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract mixin class $SettingsModelCopyWith<$Res> {
|
||||
factory $SettingsModelCopyWith(SettingsModel value, $Res Function(SettingsModel) _then) = _$SettingsModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
@HiveField(0) String language,@HiveField(1) Service service,@HiveField(2) EpisodeService episodeService,@HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions,@HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions,@HiveField(5) String aniyomiExtensionsRepositoryUrl,@HiveField(6) String tachiyomiExtensionsRepositoryUrl,@HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs,@HiveField(8) String mediaTitleLanguage,@HiveField(9) String episodeTitleLanguage,@HiveField(10) bool enableDiscordRichPresence,@HiveField(11) bool automaticallySkipOpening,@HiveField(12) bool automaticallySkipEnding,@HiveField(13) int manualSkipTime,@HiveField(14) bool autoPlayNextEpisode,@HiveField(15) bool enableOpenSubtitlesIntegration,@HiveField(16) bool enableNsfwContent,@HiveField(17)@ColorConverter() Color themeColor,@HiveField(18) bool useWallpaperAsThemeColor
|
||||
@HiveField(0) String language,@HiveField(1) Service service,@HiveField(2) EpisodeService episodeService,@HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions,@HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions,@HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs,@HiveField(8) String mediaTitleLanguage,@HiveField(9) String episodeTitleLanguage,@HiveField(10) bool enableDiscordRichPresence,@HiveField(11) bool automaticallySkipOpening,@HiveField(12) bool automaticallySkipEnding,@HiveField(13) int manualSkipTime,@HiveField(14) bool autoPlayNextEpisode,@HiveField(15) bool enableOpenSubtitlesIntegration,@HiveField(16) bool enableNsfwContent,@HiveField(17)@ColorConverter() Color themeColor,@HiveField(18) bool useWallpaperAsThemeColor,@HiveField(19) List<String> aniyomiExtensionsRepositories,@HiveField(20) List<String> tachiyomiExtensionsRepositories
|
||||
});
|
||||
|
||||
|
||||
@@ -65,16 +65,14 @@ class _$SettingsModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of SettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? language = null,Object? service = null,Object? episodeService = null,Object? installedAnimeExtensions = null,Object? installedMangaExtensions = null,Object? aniyomiExtensionsRepositoryUrl = null,Object? tachiyomiExtensionsRepositoryUrl = null,Object? mediaExtensionConfigs = null,Object? mediaTitleLanguage = null,Object? episodeTitleLanguage = null,Object? enableDiscordRichPresence = null,Object? automaticallySkipOpening = null,Object? automaticallySkipEnding = null,Object? manualSkipTime = null,Object? autoPlayNextEpisode = null,Object? enableOpenSubtitlesIntegration = null,Object? enableNsfwContent = null,Object? themeColor = null,Object? useWallpaperAsThemeColor = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? language = null,Object? service = null,Object? episodeService = null,Object? installedAnimeExtensions = null,Object? installedMangaExtensions = null,Object? mediaExtensionConfigs = null,Object? mediaTitleLanguage = null,Object? episodeTitleLanguage = null,Object? enableDiscordRichPresence = null,Object? automaticallySkipOpening = null,Object? automaticallySkipEnding = null,Object? manualSkipTime = null,Object? autoPlayNextEpisode = null,Object? enableOpenSubtitlesIntegration = null,Object? enableNsfwContent = null,Object? themeColor = null,Object? useWallpaperAsThemeColor = null,Object? aniyomiExtensionsRepositories = null,Object? tachiyomiExtensionsRepositories = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
||||
as String,service: null == service ? _self.service : service // ignore: cast_nullable_to_non_nullable
|
||||
as Service,episodeService: null == episodeService ? _self.episodeService : episodeService // ignore: cast_nullable_to_non_nullable
|
||||
as EpisodeService,installedAnimeExtensions: null == installedAnimeExtensions ? _self.installedAnimeExtensions : installedAnimeExtensions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,installedMangaExtensions: null == installedMangaExtensions ? _self.installedMangaExtensions : installedMangaExtensions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,aniyomiExtensionsRepositoryUrl: null == aniyomiExtensionsRepositoryUrl ? _self.aniyomiExtensionsRepositoryUrl : aniyomiExtensionsRepositoryUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String,tachiyomiExtensionsRepositoryUrl: null == tachiyomiExtensionsRepositoryUrl ? _self.tachiyomiExtensionsRepositoryUrl : tachiyomiExtensionsRepositoryUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String,mediaExtensionConfigs: null == mediaExtensionConfigs ? _self.mediaExtensionConfigs : mediaExtensionConfigs // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,mediaExtensionConfigs: null == mediaExtensionConfigs ? _self.mediaExtensionConfigs : mediaExtensionConfigs // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, Extension>,mediaTitleLanguage: null == mediaTitleLanguage ? _self.mediaTitleLanguage : mediaTitleLanguage // ignore: cast_nullable_to_non_nullable
|
||||
as String,episodeTitleLanguage: null == episodeTitleLanguage ? _self.episodeTitleLanguage : episodeTitleLanguage // ignore: cast_nullable_to_non_nullable
|
||||
as String,enableDiscordRichPresence: null == enableDiscordRichPresence ? _self.enableDiscordRichPresence : enableDiscordRichPresence // ignore: cast_nullable_to_non_nullable
|
||||
@@ -86,7 +84,9 @@ as bool,enableOpenSubtitlesIntegration: null == enableOpenSubtitlesIntegration ?
|
||||
as bool,enableNsfwContent: null == enableNsfwContent ? _self.enableNsfwContent : enableNsfwContent // ignore: cast_nullable_to_non_nullable
|
||||
as bool,themeColor: null == themeColor ? _self.themeColor : themeColor // ignore: cast_nullable_to_non_nullable
|
||||
as Color,useWallpaperAsThemeColor: null == useWallpaperAsThemeColor ? _self.useWallpaperAsThemeColor : useWallpaperAsThemeColor // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
as bool,aniyomiExtensionsRepositories: null == aniyomiExtensionsRepositories ? _self.aniyomiExtensionsRepositories : aniyomiExtensionsRepositories // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,tachiyomiExtensionsRepositories: null == tachiyomiExtensionsRepositories ? _self.tachiyomiExtensionsRepositories : tachiyomiExtensionsRepositories // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -171,10 +171,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@HiveField(0) String language, @HiveField(1) Service service, @HiveField(2) EpisodeService episodeService, @HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions, @HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions, @HiveField(5) String aniyomiExtensionsRepositoryUrl, @HiveField(6) String tachiyomiExtensionsRepositoryUrl, @HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs, @HiveField(8) String mediaTitleLanguage, @HiveField(9) String episodeTitleLanguage, @HiveField(10) bool enableDiscordRichPresence, @HiveField(11) bool automaticallySkipOpening, @HiveField(12) bool automaticallySkipEnding, @HiveField(13) int manualSkipTime, @HiveField(14) bool autoPlayNextEpisode, @HiveField(15) bool enableOpenSubtitlesIntegration, @HiveField(16) bool enableNsfwContent, @HiveField(17)@ColorConverter() Color themeColor, @HiveField(18) bool useWallpaperAsThemeColor)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@HiveField(0) String language, @HiveField(1) Service service, @HiveField(2) EpisodeService episodeService, @HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions, @HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions, @HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs, @HiveField(8) String mediaTitleLanguage, @HiveField(9) String episodeTitleLanguage, @HiveField(10) bool enableDiscordRichPresence, @HiveField(11) bool automaticallySkipOpening, @HiveField(12) bool automaticallySkipEnding, @HiveField(13) int manualSkipTime, @HiveField(14) bool autoPlayNextEpisode, @HiveField(15) bool enableOpenSubtitlesIntegration, @HiveField(16) bool enableNsfwContent, @HiveField(17)@ColorConverter() Color themeColor, @HiveField(18) bool useWallpaperAsThemeColor, @HiveField(19) List<String> aniyomiExtensionsRepositories, @HiveField(20) List<String> tachiyomiExtensionsRepositories)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SettingsModel() when $default != null:
|
||||
return $default(_that.language,_that.service,_that.episodeService,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.aniyomiExtensionsRepositoryUrl,_that.tachiyomiExtensionsRepositoryUrl,_that.mediaExtensionConfigs,_that.mediaTitleLanguage,_that.episodeTitleLanguage,_that.enableDiscordRichPresence,_that.automaticallySkipOpening,_that.automaticallySkipEnding,_that.manualSkipTime,_that.autoPlayNextEpisode,_that.enableOpenSubtitlesIntegration,_that.enableNsfwContent,_that.themeColor,_that.useWallpaperAsThemeColor);case _:
|
||||
return $default(_that.language,_that.service,_that.episodeService,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.mediaExtensionConfigs,_that.mediaTitleLanguage,_that.episodeTitleLanguage,_that.enableDiscordRichPresence,_that.automaticallySkipOpening,_that.automaticallySkipEnding,_that.manualSkipTime,_that.autoPlayNextEpisode,_that.enableOpenSubtitlesIntegration,_that.enableNsfwContent,_that.themeColor,_that.useWallpaperAsThemeColor,_that.aniyomiExtensionsRepositories,_that.tachiyomiExtensionsRepositories);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -192,10 +192,10 @@ return $default(_that.language,_that.service,_that.episodeService,_that.installe
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@HiveField(0) String language, @HiveField(1) Service service, @HiveField(2) EpisodeService episodeService, @HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions, @HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions, @HiveField(5) String aniyomiExtensionsRepositoryUrl, @HiveField(6) String tachiyomiExtensionsRepositoryUrl, @HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs, @HiveField(8) String mediaTitleLanguage, @HiveField(9) String episodeTitleLanguage, @HiveField(10) bool enableDiscordRichPresence, @HiveField(11) bool automaticallySkipOpening, @HiveField(12) bool automaticallySkipEnding, @HiveField(13) int manualSkipTime, @HiveField(14) bool autoPlayNextEpisode, @HiveField(15) bool enableOpenSubtitlesIntegration, @HiveField(16) bool enableNsfwContent, @HiveField(17)@ColorConverter() Color themeColor, @HiveField(18) bool useWallpaperAsThemeColor) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@HiveField(0) String language, @HiveField(1) Service service, @HiveField(2) EpisodeService episodeService, @HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions, @HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions, @HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs, @HiveField(8) String mediaTitleLanguage, @HiveField(9) String episodeTitleLanguage, @HiveField(10) bool enableDiscordRichPresence, @HiveField(11) bool automaticallySkipOpening, @HiveField(12) bool automaticallySkipEnding, @HiveField(13) int manualSkipTime, @HiveField(14) bool autoPlayNextEpisode, @HiveField(15) bool enableOpenSubtitlesIntegration, @HiveField(16) bool enableNsfwContent, @HiveField(17)@ColorConverter() Color themeColor, @HiveField(18) bool useWallpaperAsThemeColor, @HiveField(19) List<String> aniyomiExtensionsRepositories, @HiveField(20) List<String> tachiyomiExtensionsRepositories) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SettingsModel():
|
||||
return $default(_that.language,_that.service,_that.episodeService,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.aniyomiExtensionsRepositoryUrl,_that.tachiyomiExtensionsRepositoryUrl,_that.mediaExtensionConfigs,_that.mediaTitleLanguage,_that.episodeTitleLanguage,_that.enableDiscordRichPresence,_that.automaticallySkipOpening,_that.automaticallySkipEnding,_that.manualSkipTime,_that.autoPlayNextEpisode,_that.enableOpenSubtitlesIntegration,_that.enableNsfwContent,_that.themeColor,_that.useWallpaperAsThemeColor);case _:
|
||||
return $default(_that.language,_that.service,_that.episodeService,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.mediaExtensionConfigs,_that.mediaTitleLanguage,_that.episodeTitleLanguage,_that.enableDiscordRichPresence,_that.automaticallySkipOpening,_that.automaticallySkipEnding,_that.manualSkipTime,_that.autoPlayNextEpisode,_that.enableOpenSubtitlesIntegration,_that.enableNsfwContent,_that.themeColor,_that.useWallpaperAsThemeColor,_that.aniyomiExtensionsRepositories,_that.tachiyomiExtensionsRepositories);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -212,10 +212,10 @@ return $default(_that.language,_that.service,_that.episodeService,_that.installe
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@HiveField(0) String language, @HiveField(1) Service service, @HiveField(2) EpisodeService episodeService, @HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions, @HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions, @HiveField(5) String aniyomiExtensionsRepositoryUrl, @HiveField(6) String tachiyomiExtensionsRepositoryUrl, @HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs, @HiveField(8) String mediaTitleLanguage, @HiveField(9) String episodeTitleLanguage, @HiveField(10) bool enableDiscordRichPresence, @HiveField(11) bool automaticallySkipOpening, @HiveField(12) bool automaticallySkipEnding, @HiveField(13) int manualSkipTime, @HiveField(14) bool autoPlayNextEpisode, @HiveField(15) bool enableOpenSubtitlesIntegration, @HiveField(16) bool enableNsfwContent, @HiveField(17)@ColorConverter() Color themeColor, @HiveField(18) bool useWallpaperAsThemeColor)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@HiveField(0) String language, @HiveField(1) Service service, @HiveField(2) EpisodeService episodeService, @HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions, @HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions, @HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs, @HiveField(8) String mediaTitleLanguage, @HiveField(9) String episodeTitleLanguage, @HiveField(10) bool enableDiscordRichPresence, @HiveField(11) bool automaticallySkipOpening, @HiveField(12) bool automaticallySkipEnding, @HiveField(13) int manualSkipTime, @HiveField(14) bool autoPlayNextEpisode, @HiveField(15) bool enableOpenSubtitlesIntegration, @HiveField(16) bool enableNsfwContent, @HiveField(17)@ColorConverter() Color themeColor, @HiveField(18) bool useWallpaperAsThemeColor, @HiveField(19) List<String> aniyomiExtensionsRepositories, @HiveField(20) List<String> tachiyomiExtensionsRepositories)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SettingsModel() when $default != null:
|
||||
return $default(_that.language,_that.service,_that.episodeService,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.aniyomiExtensionsRepositoryUrl,_that.tachiyomiExtensionsRepositoryUrl,_that.mediaExtensionConfigs,_that.mediaTitleLanguage,_that.episodeTitleLanguage,_that.enableDiscordRichPresence,_that.automaticallySkipOpening,_that.automaticallySkipEnding,_that.manualSkipTime,_that.autoPlayNextEpisode,_that.enableOpenSubtitlesIntegration,_that.enableNsfwContent,_that.themeColor,_that.useWallpaperAsThemeColor);case _:
|
||||
return $default(_that.language,_that.service,_that.episodeService,_that.installedAnimeExtensions,_that.installedMangaExtensions,_that.mediaExtensionConfigs,_that.mediaTitleLanguage,_that.episodeTitleLanguage,_that.enableDiscordRichPresence,_that.automaticallySkipOpening,_that.automaticallySkipEnding,_that.manualSkipTime,_that.autoPlayNextEpisode,_that.enableOpenSubtitlesIntegration,_that.enableNsfwContent,_that.themeColor,_that.useWallpaperAsThemeColor,_that.aniyomiExtensionsRepositories,_that.tachiyomiExtensionsRepositories);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -227,7 +227,7 @@ return $default(_that.language,_that.service,_that.episodeService,_that.installe
|
||||
@JsonSerializable()
|
||||
|
||||
class _SettingsModel implements SettingsModel {
|
||||
const _SettingsModel({@HiveField(0) this.language = 'en', @HiveField(1) this.service = Service.anilist, @HiveField(2) this.episodeService = EpisodeService.anizip, @HiveField(3)@ExtensionConverter() final List<Extension> installedAnimeExtensions = const [], @HiveField(4)@ExtensionConverter() final List<Extension> installedMangaExtensions = const [], @HiveField(5) this.aniyomiExtensionsRepositoryUrl = config.aniyomiExtensionsRepositoryUrl, @HiveField(6) this.tachiyomiExtensionsRepositoryUrl = config.tachiyomiExtensionsRepositoryUrl, @HiveField(7)@ExtensionConverter() final Map<String, Extension> mediaExtensionConfigs = const {}, @HiveField(8) this.mediaTitleLanguage = 'userPreferred', @HiveField(9) this.episodeTitleLanguage = 'en', @HiveField(10) this.enableDiscordRichPresence = true, @HiveField(11) this.automaticallySkipOpening = false, @HiveField(12) this.automaticallySkipEnding = false, @HiveField(13) this.manualSkipTime = 85, @HiveField(14) this.autoPlayNextEpisode = false, @HiveField(15) this.enableOpenSubtitlesIntegration = false, @HiveField(16) this.enableNsfwContent = false, @HiveField(17)@ColorConverter() this.themeColor = const Color(0xFF2196F3), @HiveField(18) this.useWallpaperAsThemeColor = true}): _installedAnimeExtensions = installedAnimeExtensions,_installedMangaExtensions = installedMangaExtensions,_mediaExtensionConfigs = mediaExtensionConfigs;
|
||||
const _SettingsModel({@HiveField(0) this.language = 'en', @HiveField(1) this.service = Service.anilist, @HiveField(2) this.episodeService = EpisodeService.anizip, @HiveField(3)@ExtensionConverter() final List<Extension> installedAnimeExtensions = const [], @HiveField(4)@ExtensionConverter() final List<Extension> installedMangaExtensions = const [], @HiveField(7)@ExtensionConverter() final Map<String, Extension> mediaExtensionConfigs = const {}, @HiveField(8) this.mediaTitleLanguage = 'userPreferred', @HiveField(9) this.episodeTitleLanguage = 'en', @HiveField(10) this.enableDiscordRichPresence = true, @HiveField(11) this.automaticallySkipOpening = false, @HiveField(12) this.automaticallySkipEnding = false, @HiveField(13) this.manualSkipTime = 85, @HiveField(14) this.autoPlayNextEpisode = false, @HiveField(15) this.enableOpenSubtitlesIntegration = false, @HiveField(16) this.enableNsfwContent = false, @HiveField(17)@ColorConverter() this.themeColor = const Color(0xFF2196F3), @HiveField(18) this.useWallpaperAsThemeColor = true, @HiveField(19) final List<String> aniyomiExtensionsRepositories = const [config.aniyomiExtensionsRepositoryUrl], @HiveField(20) final List<String> tachiyomiExtensionsRepositories = const [config.tachiyomiExtensionsRepositoryUrl]}): _installedAnimeExtensions = installedAnimeExtensions,_installedMangaExtensions = installedMangaExtensions,_mediaExtensionConfigs = mediaExtensionConfigs,_aniyomiExtensionsRepositories = aniyomiExtensionsRepositories,_tachiyomiExtensionsRepositories = tachiyomiExtensionsRepositories;
|
||||
factory _SettingsModel.fromJson(Map<String, dynamic> json) => _$SettingsModelFromJson(json);
|
||||
|
||||
@override@JsonKey()@HiveField(0) final String language;
|
||||
@@ -247,8 +247,6 @@ class _SettingsModel implements SettingsModel {
|
||||
return EqualUnmodifiableListView(_installedMangaExtensions);
|
||||
}
|
||||
|
||||
@override@JsonKey()@HiveField(5) final String aniyomiExtensionsRepositoryUrl;
|
||||
@override@JsonKey()@HiveField(6) final String tachiyomiExtensionsRepositoryUrl;
|
||||
final Map<String, Extension> _mediaExtensionConfigs;
|
||||
@override@JsonKey()@HiveField(7)@ExtensionConverter() Map<String, Extension> get mediaExtensionConfigs {
|
||||
if (_mediaExtensionConfigs is EqualUnmodifiableMapView) return _mediaExtensionConfigs;
|
||||
@@ -267,6 +265,20 @@ class _SettingsModel implements SettingsModel {
|
||||
@override@JsonKey()@HiveField(16) final bool enableNsfwContent;
|
||||
@override@JsonKey()@HiveField(17)@ColorConverter() final Color themeColor;
|
||||
@override@JsonKey()@HiveField(18) final bool useWallpaperAsThemeColor;
|
||||
final List<String> _aniyomiExtensionsRepositories;
|
||||
@override@JsonKey()@HiveField(19) List<String> get aniyomiExtensionsRepositories {
|
||||
if (_aniyomiExtensionsRepositories is EqualUnmodifiableListView) return _aniyomiExtensionsRepositories;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_aniyomiExtensionsRepositories);
|
||||
}
|
||||
|
||||
final List<String> _tachiyomiExtensionsRepositories;
|
||||
@override@JsonKey()@HiveField(20) List<String> get tachiyomiExtensionsRepositories {
|
||||
if (_tachiyomiExtensionsRepositories is EqualUnmodifiableListView) return _tachiyomiExtensionsRepositories;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_tachiyomiExtensionsRepositories);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of SettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -281,16 +293,16 @@ Map<String, dynamic> toJson() {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SettingsModel&&(identical(other.language, language) || other.language == language)&&(identical(other.service, service) || other.service == service)&&(identical(other.episodeService, episodeService) || other.episodeService == episodeService)&&const DeepCollectionEquality().equals(other._installedAnimeExtensions, _installedAnimeExtensions)&&const DeepCollectionEquality().equals(other._installedMangaExtensions, _installedMangaExtensions)&&(identical(other.aniyomiExtensionsRepositoryUrl, aniyomiExtensionsRepositoryUrl) || other.aniyomiExtensionsRepositoryUrl == aniyomiExtensionsRepositoryUrl)&&(identical(other.tachiyomiExtensionsRepositoryUrl, tachiyomiExtensionsRepositoryUrl) || other.tachiyomiExtensionsRepositoryUrl == tachiyomiExtensionsRepositoryUrl)&&const DeepCollectionEquality().equals(other._mediaExtensionConfigs, _mediaExtensionConfigs)&&(identical(other.mediaTitleLanguage, mediaTitleLanguage) || other.mediaTitleLanguage == mediaTitleLanguage)&&(identical(other.episodeTitleLanguage, episodeTitleLanguage) || other.episodeTitleLanguage == episodeTitleLanguage)&&(identical(other.enableDiscordRichPresence, enableDiscordRichPresence) || other.enableDiscordRichPresence == enableDiscordRichPresence)&&(identical(other.automaticallySkipOpening, automaticallySkipOpening) || other.automaticallySkipOpening == automaticallySkipOpening)&&(identical(other.automaticallySkipEnding, automaticallySkipEnding) || other.automaticallySkipEnding == automaticallySkipEnding)&&(identical(other.manualSkipTime, manualSkipTime) || other.manualSkipTime == manualSkipTime)&&(identical(other.autoPlayNextEpisode, autoPlayNextEpisode) || other.autoPlayNextEpisode == autoPlayNextEpisode)&&(identical(other.enableOpenSubtitlesIntegration, enableOpenSubtitlesIntegration) || other.enableOpenSubtitlesIntegration == enableOpenSubtitlesIntegration)&&(identical(other.enableNsfwContent, enableNsfwContent) || other.enableNsfwContent == enableNsfwContent)&&(identical(other.themeColor, themeColor) || other.themeColor == themeColor)&&(identical(other.useWallpaperAsThemeColor, useWallpaperAsThemeColor) || other.useWallpaperAsThemeColor == useWallpaperAsThemeColor));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SettingsModel&&(identical(other.language, language) || other.language == language)&&(identical(other.service, service) || other.service == service)&&(identical(other.episodeService, episodeService) || other.episodeService == episodeService)&&const DeepCollectionEquality().equals(other._installedAnimeExtensions, _installedAnimeExtensions)&&const DeepCollectionEquality().equals(other._installedMangaExtensions, _installedMangaExtensions)&&const DeepCollectionEquality().equals(other._mediaExtensionConfigs, _mediaExtensionConfigs)&&(identical(other.mediaTitleLanguage, mediaTitleLanguage) || other.mediaTitleLanguage == mediaTitleLanguage)&&(identical(other.episodeTitleLanguage, episodeTitleLanguage) || other.episodeTitleLanguage == episodeTitleLanguage)&&(identical(other.enableDiscordRichPresence, enableDiscordRichPresence) || other.enableDiscordRichPresence == enableDiscordRichPresence)&&(identical(other.automaticallySkipOpening, automaticallySkipOpening) || other.automaticallySkipOpening == automaticallySkipOpening)&&(identical(other.automaticallySkipEnding, automaticallySkipEnding) || other.automaticallySkipEnding == automaticallySkipEnding)&&(identical(other.manualSkipTime, manualSkipTime) || other.manualSkipTime == manualSkipTime)&&(identical(other.autoPlayNextEpisode, autoPlayNextEpisode) || other.autoPlayNextEpisode == autoPlayNextEpisode)&&(identical(other.enableOpenSubtitlesIntegration, enableOpenSubtitlesIntegration) || other.enableOpenSubtitlesIntegration == enableOpenSubtitlesIntegration)&&(identical(other.enableNsfwContent, enableNsfwContent) || other.enableNsfwContent == enableNsfwContent)&&(identical(other.themeColor, themeColor) || other.themeColor == themeColor)&&(identical(other.useWallpaperAsThemeColor, useWallpaperAsThemeColor) || other.useWallpaperAsThemeColor == useWallpaperAsThemeColor)&&const DeepCollectionEquality().equals(other._aniyomiExtensionsRepositories, _aniyomiExtensionsRepositories)&&const DeepCollectionEquality().equals(other._tachiyomiExtensionsRepositories, _tachiyomiExtensionsRepositories));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hashAll([runtimeType,language,service,episodeService,const DeepCollectionEquality().hash(_installedAnimeExtensions),const DeepCollectionEquality().hash(_installedMangaExtensions),aniyomiExtensionsRepositoryUrl,tachiyomiExtensionsRepositoryUrl,const DeepCollectionEquality().hash(_mediaExtensionConfigs),mediaTitleLanguage,episodeTitleLanguage,enableDiscordRichPresence,automaticallySkipOpening,automaticallySkipEnding,manualSkipTime,autoPlayNextEpisode,enableOpenSubtitlesIntegration,enableNsfwContent,themeColor,useWallpaperAsThemeColor]);
|
||||
int get hashCode => Object.hashAll([runtimeType,language,service,episodeService,const DeepCollectionEquality().hash(_installedAnimeExtensions),const DeepCollectionEquality().hash(_installedMangaExtensions),const DeepCollectionEquality().hash(_mediaExtensionConfigs),mediaTitleLanguage,episodeTitleLanguage,enableDiscordRichPresence,automaticallySkipOpening,automaticallySkipEnding,manualSkipTime,autoPlayNextEpisode,enableOpenSubtitlesIntegration,enableNsfwContent,themeColor,useWallpaperAsThemeColor,const DeepCollectionEquality().hash(_aniyomiExtensionsRepositories),const DeepCollectionEquality().hash(_tachiyomiExtensionsRepositories)]);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsModel(language: $language, service: $service, episodeService: $episodeService, installedAnimeExtensions: $installedAnimeExtensions, installedMangaExtensions: $installedMangaExtensions, aniyomiExtensionsRepositoryUrl: $aniyomiExtensionsRepositoryUrl, tachiyomiExtensionsRepositoryUrl: $tachiyomiExtensionsRepositoryUrl, mediaExtensionConfigs: $mediaExtensionConfigs, mediaTitleLanguage: $mediaTitleLanguage, episodeTitleLanguage: $episodeTitleLanguage, enableDiscordRichPresence: $enableDiscordRichPresence, automaticallySkipOpening: $automaticallySkipOpening, automaticallySkipEnding: $automaticallySkipEnding, manualSkipTime: $manualSkipTime, autoPlayNextEpisode: $autoPlayNextEpisode, enableOpenSubtitlesIntegration: $enableOpenSubtitlesIntegration, enableNsfwContent: $enableNsfwContent, themeColor: $themeColor, useWallpaperAsThemeColor: $useWallpaperAsThemeColor)';
|
||||
return 'SettingsModel(language: $language, service: $service, episodeService: $episodeService, installedAnimeExtensions: $installedAnimeExtensions, installedMangaExtensions: $installedMangaExtensions, mediaExtensionConfigs: $mediaExtensionConfigs, mediaTitleLanguage: $mediaTitleLanguage, episodeTitleLanguage: $episodeTitleLanguage, enableDiscordRichPresence: $enableDiscordRichPresence, automaticallySkipOpening: $automaticallySkipOpening, automaticallySkipEnding: $automaticallySkipEnding, manualSkipTime: $manualSkipTime, autoPlayNextEpisode: $autoPlayNextEpisode, enableOpenSubtitlesIntegration: $enableOpenSubtitlesIntegration, enableNsfwContent: $enableNsfwContent, themeColor: $themeColor, useWallpaperAsThemeColor: $useWallpaperAsThemeColor, aniyomiExtensionsRepositories: $aniyomiExtensionsRepositories, tachiyomiExtensionsRepositories: $tachiyomiExtensionsRepositories)';
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +313,7 @@ abstract mixin class _$SettingsModelCopyWith<$Res> implements $SettingsModelCopy
|
||||
factory _$SettingsModelCopyWith(_SettingsModel value, $Res Function(_SettingsModel) _then) = __$SettingsModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
@HiveField(0) String language,@HiveField(1) Service service,@HiveField(2) EpisodeService episodeService,@HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions,@HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions,@HiveField(5) String aniyomiExtensionsRepositoryUrl,@HiveField(6) String tachiyomiExtensionsRepositoryUrl,@HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs,@HiveField(8) String mediaTitleLanguage,@HiveField(9) String episodeTitleLanguage,@HiveField(10) bool enableDiscordRichPresence,@HiveField(11) bool automaticallySkipOpening,@HiveField(12) bool automaticallySkipEnding,@HiveField(13) int manualSkipTime,@HiveField(14) bool autoPlayNextEpisode,@HiveField(15) bool enableOpenSubtitlesIntegration,@HiveField(16) bool enableNsfwContent,@HiveField(17)@ColorConverter() Color themeColor,@HiveField(18) bool useWallpaperAsThemeColor
|
||||
@HiveField(0) String language,@HiveField(1) Service service,@HiveField(2) EpisodeService episodeService,@HiveField(3)@ExtensionConverter() List<Extension> installedAnimeExtensions,@HiveField(4)@ExtensionConverter() List<Extension> installedMangaExtensions,@HiveField(7)@ExtensionConverter() Map<String, Extension> mediaExtensionConfigs,@HiveField(8) String mediaTitleLanguage,@HiveField(9) String episodeTitleLanguage,@HiveField(10) bool enableDiscordRichPresence,@HiveField(11) bool automaticallySkipOpening,@HiveField(12) bool automaticallySkipEnding,@HiveField(13) int manualSkipTime,@HiveField(14) bool autoPlayNextEpisode,@HiveField(15) bool enableOpenSubtitlesIntegration,@HiveField(16) bool enableNsfwContent,@HiveField(17)@ColorConverter() Color themeColor,@HiveField(18) bool useWallpaperAsThemeColor,@HiveField(19) List<String> aniyomiExtensionsRepositories,@HiveField(20) List<String> tachiyomiExtensionsRepositories
|
||||
});
|
||||
|
||||
|
||||
@@ -318,16 +330,14 @@ class __$SettingsModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of SettingsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? language = null,Object? service = null,Object? episodeService = null,Object? installedAnimeExtensions = null,Object? installedMangaExtensions = null,Object? aniyomiExtensionsRepositoryUrl = null,Object? tachiyomiExtensionsRepositoryUrl = null,Object? mediaExtensionConfigs = null,Object? mediaTitleLanguage = null,Object? episodeTitleLanguage = null,Object? enableDiscordRichPresence = null,Object? automaticallySkipOpening = null,Object? automaticallySkipEnding = null,Object? manualSkipTime = null,Object? autoPlayNextEpisode = null,Object? enableOpenSubtitlesIntegration = null,Object? enableNsfwContent = null,Object? themeColor = null,Object? useWallpaperAsThemeColor = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? language = null,Object? service = null,Object? episodeService = null,Object? installedAnimeExtensions = null,Object? installedMangaExtensions = null,Object? mediaExtensionConfigs = null,Object? mediaTitleLanguage = null,Object? episodeTitleLanguage = null,Object? enableDiscordRichPresence = null,Object? automaticallySkipOpening = null,Object? automaticallySkipEnding = null,Object? manualSkipTime = null,Object? autoPlayNextEpisode = null,Object? enableOpenSubtitlesIntegration = null,Object? enableNsfwContent = null,Object? themeColor = null,Object? useWallpaperAsThemeColor = null,Object? aniyomiExtensionsRepositories = null,Object? tachiyomiExtensionsRepositories = null,}) {
|
||||
return _then(_SettingsModel(
|
||||
language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
||||
as String,service: null == service ? _self.service : service // ignore: cast_nullable_to_non_nullable
|
||||
as Service,episodeService: null == episodeService ? _self.episodeService : episodeService // ignore: cast_nullable_to_non_nullable
|
||||
as EpisodeService,installedAnimeExtensions: null == installedAnimeExtensions ? _self._installedAnimeExtensions : installedAnimeExtensions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,installedMangaExtensions: null == installedMangaExtensions ? _self._installedMangaExtensions : installedMangaExtensions // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,aniyomiExtensionsRepositoryUrl: null == aniyomiExtensionsRepositoryUrl ? _self.aniyomiExtensionsRepositoryUrl : aniyomiExtensionsRepositoryUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String,tachiyomiExtensionsRepositoryUrl: null == tachiyomiExtensionsRepositoryUrl ? _self.tachiyomiExtensionsRepositoryUrl : tachiyomiExtensionsRepositoryUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String,mediaExtensionConfigs: null == mediaExtensionConfigs ? _self._mediaExtensionConfigs : mediaExtensionConfigs // ignore: cast_nullable_to_non_nullable
|
||||
as List<Extension>,mediaExtensionConfigs: null == mediaExtensionConfigs ? _self._mediaExtensionConfigs : mediaExtensionConfigs // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, Extension>,mediaTitleLanguage: null == mediaTitleLanguage ? _self.mediaTitleLanguage : mediaTitleLanguage // ignore: cast_nullable_to_non_nullable
|
||||
as String,episodeTitleLanguage: null == episodeTitleLanguage ? _self.episodeTitleLanguage : episodeTitleLanguage // ignore: cast_nullable_to_non_nullable
|
||||
as String,enableDiscordRichPresence: null == enableDiscordRichPresence ? _self.enableDiscordRichPresence : enableDiscordRichPresence // ignore: cast_nullable_to_non_nullable
|
||||
@@ -339,7 +349,9 @@ as bool,enableOpenSubtitlesIntegration: null == enableOpenSubtitlesIntegration ?
|
||||
as bool,enableNsfwContent: null == enableNsfwContent ? _self.enableNsfwContent : enableNsfwContent // ignore: cast_nullable_to_non_nullable
|
||||
as bool,themeColor: null == themeColor ? _self.themeColor : themeColor // ignore: cast_nullable_to_non_nullable
|
||||
as Color,useWallpaperAsThemeColor: null == useWallpaperAsThemeColor ? _self.useWallpaperAsThemeColor : useWallpaperAsThemeColor // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
as bool,aniyomiExtensionsRepositories: null == aniyomiExtensionsRepositories ? _self._aniyomiExtensionsRepositories : aniyomiExtensionsRepositories // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,tachiyomiExtensionsRepositories: null == tachiyomiExtensionsRepositories ? _self._tachiyomiExtensionsRepositories : tachiyomiExtensionsRepositories // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@ class SettingsModelAdapter extends TypeAdapter<SettingsModel> {
|
||||
installedMangaExtensions: fields[4] == null
|
||||
? []
|
||||
: (fields[4] as List).cast<Extension>(),
|
||||
aniyomiExtensionsRepositoryUrl: fields[5] == null
|
||||
? 'https://gitea.k3vinb5.dev/Backups/kohi-den-extensions/raw/branch/main/index.min.json'
|
||||
: fields[5] as String,
|
||||
tachiyomiExtensionsRepositoryUrl: fields[6] == null
|
||||
? 'https://gitea.k3vinb5.dev/Backups/keiyoushi-extensions/raw/branch/repo/index.min.json'
|
||||
: fields[6] as String,
|
||||
mediaExtensionConfigs: fields[7] == null
|
||||
? {}
|
||||
: (fields[7] as Map).cast<String, Extension>(),
|
||||
@@ -54,6 +48,16 @@ class SettingsModelAdapter extends TypeAdapter<SettingsModel> {
|
||||
? const Color(4280391411)
|
||||
: fields[17] as Color,
|
||||
useWallpaperAsThemeColor: fields[18] == null ? true : fields[18] as bool,
|
||||
aniyomiExtensionsRepositories: fields[19] == null
|
||||
? [
|
||||
'https://gitea.k3vinb5.dev/Backups/kohi-den-extensions/raw/branch/main/index.min.json',
|
||||
]
|
||||
: (fields[19] as List).cast<String>(),
|
||||
tachiyomiExtensionsRepositories: fields[20] == null
|
||||
? [
|
||||
'https://gitea.k3vinb5.dev/Backups/keiyoushi-extensions/raw/branch/repo/index.min.json',
|
||||
]
|
||||
: (fields[20] as List).cast<String>(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -71,10 +75,6 @@ class SettingsModelAdapter extends TypeAdapter<SettingsModel> {
|
||||
..write(obj.installedAnimeExtensions)
|
||||
..writeByte(4)
|
||||
..write(obj.installedMangaExtensions)
|
||||
..writeByte(5)
|
||||
..write(obj.aniyomiExtensionsRepositoryUrl)
|
||||
..writeByte(6)
|
||||
..write(obj.tachiyomiExtensionsRepositoryUrl)
|
||||
..writeByte(7)
|
||||
..write(obj.mediaExtensionConfigs)
|
||||
..writeByte(8)
|
||||
@@ -98,7 +98,11 @@ class SettingsModelAdapter extends TypeAdapter<SettingsModel> {
|
||||
..writeByte(17)
|
||||
..write(obj.themeColor)
|
||||
..writeByte(18)
|
||||
..write(obj.useWallpaperAsThemeColor);
|
||||
..write(obj.useWallpaperAsThemeColor)
|
||||
..writeByte(19)
|
||||
..write(obj.aniyomiExtensionsRepositories)
|
||||
..writeByte(20)
|
||||
..write(obj.tachiyomiExtensionsRepositories);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -141,12 +145,6 @@ _SettingsModel _$SettingsModelFromJson(
|
||||
)
|
||||
.toList() ??
|
||||
const [],
|
||||
aniyomiExtensionsRepositoryUrl:
|
||||
json['aniyomiExtensionsRepositoryUrl'] as String? ??
|
||||
config.aniyomiExtensionsRepositoryUrl,
|
||||
tachiyomiExtensionsRepositoryUrl:
|
||||
json['tachiyomiExtensionsRepositoryUrl'] as String? ??
|
||||
config.tachiyomiExtensionsRepositoryUrl,
|
||||
mediaExtensionConfigs:
|
||||
(json['mediaExtensionConfigs'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(
|
||||
@@ -169,6 +167,16 @@ _SettingsModel _$SettingsModelFromJson(
|
||||
? const Color(0xFF2196F3)
|
||||
: const ColorConverter().fromJson((json['themeColor'] as num).toInt()),
|
||||
useWallpaperAsThemeColor: json['useWallpaperAsThemeColor'] as bool? ?? true,
|
||||
aniyomiExtensionsRepositories:
|
||||
(json['aniyomiExtensionsRepositories'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList() ??
|
||||
const [config.aniyomiExtensionsRepositoryUrl],
|
||||
tachiyomiExtensionsRepositories:
|
||||
(json['tachiyomiExtensionsRepositories'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList() ??
|
||||
const [config.tachiyomiExtensionsRepositoryUrl],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SettingsModelToJson(
|
||||
@@ -183,8 +191,6 @@ Map<String, dynamic> _$SettingsModelToJson(
|
||||
'installedMangaExtensions': instance.installedMangaExtensions
|
||||
.map(const ExtensionConverter().toJson)
|
||||
.toList(),
|
||||
'aniyomiExtensionsRepositoryUrl': instance.aniyomiExtensionsRepositoryUrl,
|
||||
'tachiyomiExtensionsRepositoryUrl': instance.tachiyomiExtensionsRepositoryUrl,
|
||||
'mediaExtensionConfigs': instance.mediaExtensionConfigs.map(
|
||||
(k, e) => MapEntry(k, const ExtensionConverter().toJson(e)),
|
||||
),
|
||||
@@ -199,6 +205,8 @@ Map<String, dynamic> _$SettingsModelToJson(
|
||||
'enableNsfwContent': instance.enableNsfwContent,
|
||||
'themeColor': const ColorConverter().toJson(instance.themeColor),
|
||||
'useWallpaperAsThemeColor': instance.useWallpaperAsThemeColor,
|
||||
'aniyomiExtensionsRepositories': instance.aniyomiExtensionsRepositories,
|
||||
'tachiyomiExtensionsRepositories': instance.tachiyomiExtensionsRepositories,
|
||||
};
|
||||
|
||||
const _$ServiceEnumMap = {
|
||||
|
||||
@@ -6,8 +6,11 @@ abstract class ExtensionRepository {
|
||||
Future<Set<Extension>> getAvailableMangaExtensions(User loggedUser);
|
||||
Future<Set<Extension>> getInstalledAnimeExtensions(User loggedUser);
|
||||
Future<Set<Extension>> getInstalledMangaExtensions(User loggedUser);
|
||||
Future<void> updateAnimeRepositoryUrl(String newUrl, User user);
|
||||
Future<void> updateMangaRepositoryUrl(String newUrl, User user);
|
||||
|
||||
Future<Map<String, Extension>> getAnimeExtensionUpdates(User loggedUser);
|
||||
Future<Map<String, Extension>> getMangaExtensionUpdates(User loggedUser);
|
||||
|
||||
Future<void> addExtension(Extension extension);
|
||||
Future<void> removeExtension(Extension extension);
|
||||
}
|
||||
Future<void> updateExtension(Extension oldExtension, Extension newExtension);
|
||||
}
|
||||
|
||||
138
lib/presentation/dialogs/extensions_dialog.dart
Normal file
138
lib/presentation/dialogs/extensions_dialog.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:unyo/presentation/widgets/styled/light_unyo_button.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_utils.dart';
|
||||
import 'package:unyo/presentation/widgets/styled/dark_unyo_button.dart';
|
||||
import 'package:unyo/presentation/widgets/styled/unyo_textfield.dart';
|
||||
|
||||
class ExtensionsDialog extends StatefulWidget {
|
||||
final double width;
|
||||
final double height;
|
||||
final String title;
|
||||
final List<String> currentRepositoriesUrls;
|
||||
final void Function(List<String>) onSubmitted;
|
||||
|
||||
const ExtensionsDialog({
|
||||
super.key,
|
||||
required this.width,
|
||||
required this.height,
|
||||
required this.title,
|
||||
required this.currentRepositoriesUrls,
|
||||
required this.onSubmitted,
|
||||
});
|
||||
|
||||
@override
|
||||
State<ExtensionsDialog> createState() => _ExtensionsDialogState();
|
||||
}
|
||||
|
||||
class _ExtensionsDialogState extends State<ExtensionsDialog> {
|
||||
late List<String> _currentRepositoriesUrls;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_currentRepositoriesUrls = List.from(widget.currentRepositoriesUrls);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: const Color.fromARGB(255, 30, 30, 30),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.0.w, vertical: 16.0.h),
|
||||
child: SizedBox(
|
||||
width: widget.width,
|
||||
height: widget.height,
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5.0.w, vertical: 5.0.h),
|
||||
child: ListView(
|
||||
children: [
|
||||
SizedBox(height: 5.h),
|
||||
Text(widget.title, style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 25.h),
|
||||
..._currentRepositoriesUrls.mapIndexed(
|
||||
(index, repoUrl) =>
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
TextUtils.extractRepoName(repoUrl),
|
||||
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: UnyoTextfield(
|
||||
label: null,
|
||||
hint: repoUrl,
|
||||
debounceMilliseconds: 0,
|
||||
onChange: (newValue) {
|
||||
setState(() {
|
||||
_currentRepositoriesUrls[index] = newValue;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.w),
|
||||
DarkUnyoButton(
|
||||
text: "Remove",
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (_currentRepositoriesUrls.length == 1) {
|
||||
return;
|
||||
} else {
|
||||
_currentRepositoriesUrls.removeAt(index);
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
LightUnyoButton(text: "Add Repository", onPressed: () {
|
||||
setState(() {
|
||||
_currentRepositoriesUrls.add("");
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
DarkUnyoButton(
|
||||
text: "Cancel",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
SizedBox(width: 8.w),
|
||||
LightUnyoButton(
|
||||
text: "Confirm",
|
||||
onPressed: () {
|
||||
widget.onSubmitted(_currentRepositoriesUrls);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import 'package:unyo/core/di/locator.dart';
|
||||
import 'package:unyo/core/notification/user_notifier.dart';
|
||||
import 'package:unyo/domain/entities/user.dart' show User;
|
||||
import 'package:unyo/presentation/widgets/styled/user_option_drawer_selection.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_utils.dart';
|
||||
|
||||
class UserOptionsDrawer extends StatefulWidget {
|
||||
const UserOptionsDrawer({super.key, required this.cubit, required this.loggedUser});
|
||||
@@ -75,7 +76,7 @@ class _UserOptionsDrawerState extends State<UserOptionsDrawer> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 12.0),
|
||||
child: Text(
|
||||
widget.loggedUser.settings.service.name.substring(0,1).toUpperCase() + widget.loggedUser.settings.service.name.substring(1),
|
||||
TextUtils.capitalize(widget.loggedUser.settings.service.name),
|
||||
style: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -2,13 +2,18 @@ import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:fuzzywuzzy/fuzzywuzzy.dart';
|
||||
import 'package:unyo/application/cubits/extensions_cubit.dart';
|
||||
import 'package:unyo/application/states/extensions_state.dart';
|
||||
import 'package:unyo/core/di/locator.dart';
|
||||
import 'package:unyo/domain/entities/extension.dart';
|
||||
import 'package:unyo/core/services/effects/app_effect_handler.dart';
|
||||
import 'package:unyo/presentation/widgets/styled/unyo_dropdown.dart';
|
||||
import 'package:unyo/presentation/widgets/styled/unyo_extension_button.dart';
|
||||
import 'package:unyo/presentation/widgets/styled/unyo_textfield.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_body_large.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_headline_medium.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_utils.dart';
|
||||
|
||||
@RoutePage()
|
||||
class ExtensionsScreen extends StatelessWidget {
|
||||
@@ -49,6 +54,24 @@ class _ExtensionsView extends StatefulWidget {
|
||||
|
||||
class _ExtensionsViewState extends State<_ExtensionsView> with TickerProviderStateMixin {
|
||||
late TabController tabController;
|
||||
String _searchQuery = '';
|
||||
String? _selectedRepo;
|
||||
|
||||
List<Extension> _filter(List<Extension> extensions) {
|
||||
var filtered = extensions;
|
||||
if (_selectedRepo != null) {
|
||||
filtered = filtered.where((e) => TextUtils.extractRepoName(e.repositoryUrl) == _selectedRepo).toList();
|
||||
}
|
||||
if (_searchQuery.isEmpty) return filtered;
|
||||
final results = extractTop(
|
||||
query: _searchQuery,
|
||||
choices: filtered,
|
||||
limit: filtered.length,
|
||||
cutoff: 30,
|
||||
getter: (e) => '${e.name} ${e.lang}',
|
||||
);
|
||||
return results.map((r) => r.choice).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -143,8 +166,39 @@ class _ExtensionsViewState extends State<_ExtensionsView> with TickerProviderSta
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 1.sh - 135,
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 32.w, right: 32.w, top: 16.h),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: UnyoTextfield(
|
||||
label: "Search extensions...",
|
||||
debounceMilliseconds: 300,
|
||||
onChange: (value) {
|
||||
setState(() {
|
||||
_searchQuery = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.w),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: UnyoDropdown(
|
||||
label: "Repository...",
|
||||
selectedValue: _selectedRepo,
|
||||
reactOnCancel: true,
|
||||
children: context.read<ExtensionsCubit>().getAvailableRepositories().toList(),
|
||||
onPressed: (repo) => setState(() {
|
||||
_selectedRepo = repo;
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 15.0.w, right: 15.0.w, top: 15.0.h),
|
||||
child: TabBarView(
|
||||
@@ -153,14 +207,16 @@ class _ExtensionsViewState extends State<_ExtensionsView> with TickerProviderSta
|
||||
ListView(
|
||||
scrollDirection: Axis.vertical,
|
||||
children: [
|
||||
...state.availableAnimeExtensions.map(
|
||||
..._filter(state.availableAnimeExtensions).map(
|
||||
(extension) => UnyoExtensionButton(
|
||||
iconUrl: extension.icon,
|
||||
name: extension.name,
|
||||
lang: extension.lang,
|
||||
version: extension.version,
|
||||
nsfw: extension.nsfw,
|
||||
onDownloadPressed: () => context.read<ExtensionsCubit>().downloadExtension(extension),
|
||||
repoUrl: extension.repositoryUrl,
|
||||
onDownloadPressed: () =>
|
||||
context.read<ExtensionsCubit>().downloadExtension(extension),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -168,14 +224,16 @@ class _ExtensionsViewState extends State<_ExtensionsView> with TickerProviderSta
|
||||
ListView(
|
||||
scrollDirection: Axis.vertical,
|
||||
children: [
|
||||
...state.availableMangaExtensions.map(
|
||||
..._filter(state.availableMangaExtensions).map(
|
||||
(extension) => UnyoExtensionButton(
|
||||
iconUrl: extension.icon,
|
||||
name: extension.name,
|
||||
lang: extension.lang,
|
||||
version: extension.version,
|
||||
nsfw: extension.nsfw,
|
||||
onDownloadPressed: () => context.read<ExtensionsCubit>().downloadExtension(extension),
|
||||
repoUrl: extension.repositoryUrl,
|
||||
onDownloadPressed: () =>
|
||||
context.read<ExtensionsCubit>().downloadExtension(extension),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -183,15 +241,19 @@ class _ExtensionsViewState extends State<_ExtensionsView> with TickerProviderSta
|
||||
ListView(
|
||||
scrollDirection: Axis.vertical,
|
||||
children: [
|
||||
...state.installedAnimeExtensions.map(
|
||||
..._filter(state.installedAnimeExtensions).map(
|
||||
(extension) => UnyoExtensionButton(
|
||||
iconUrl: extension.icon,
|
||||
name: extension.name,
|
||||
lang: extension.lang,
|
||||
version: extension.version,
|
||||
nsfw: extension.nsfw,
|
||||
repoUrl: extension.repositoryUrl,
|
||||
onUpdatePressed: state.animeExtensionUpdates.containsKey(extension.pkg)
|
||||
? () => context.read<ExtensionsCubit>().updateExtension(extension)
|
||||
: null,
|
||||
onDeletePressed: () => context.read<ExtensionsCubit>().removeExtension(extension),
|
||||
onSettingsPressed: (){},
|
||||
onSettingsPressed: () {},
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -199,13 +261,17 @@ class _ExtensionsViewState extends State<_ExtensionsView> with TickerProviderSta
|
||||
ListView(
|
||||
scrollDirection: Axis.vertical,
|
||||
children: [
|
||||
...state.installedMangaExtensions.map(
|
||||
..._filter(state.installedMangaExtensions).map(
|
||||
(extension) => UnyoExtensionButton(
|
||||
iconUrl: extension.icon,
|
||||
name: extension.name,
|
||||
lang: extension.lang,
|
||||
version: extension.version,
|
||||
nsfw: extension.nsfw,
|
||||
repoUrl: extension.repositoryUrl,
|
||||
onUpdatePressed: state.mangaExtensionUpdates.containsKey(extension.pkg)
|
||||
? () => context.read<ExtensionsCubit>().updateExtension(extension)
|
||||
: null,
|
||||
onDeletePressed: () => context.read<ExtensionsCubit>().removeExtension(extension),
|
||||
onSettingsPressed: () {},
|
||||
),
|
||||
|
||||
@@ -19,6 +19,7 @@ import 'package:unyo/presentation/widgets/styled/unyo_settings_selection_slider.
|
||||
import 'package:unyo/presentation/widgets/styled/unyo_settings_selection_toggle.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_body_large.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_headline_medium.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_utils.dart';
|
||||
|
||||
@RoutePage()
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
@@ -165,14 +166,11 @@ class _SettingsViewState extends State<_SettingsView> with TickerProviderStateMi
|
||||
icon: Icons.image_search_rounded,
|
||||
label: "Select a service",
|
||||
defaultValue:
|
||||
state.loggedUser.settings.service.name.substring(0, 1).toUpperCase() +
|
||||
state.loggedUser.settings.service.name.substring(1),
|
||||
TextUtils.capitalize(state.loggedUser.settings.service.name),
|
||||
children:
|
||||
Service.values
|
||||
.map(
|
||||
(service) =>
|
||||
service.name.substring(0, 1).toUpperCase() +
|
||||
service.name.substring(1),
|
||||
(service) => TextUtils.capitalize(service.name),
|
||||
)
|
||||
.toList(),
|
||||
onPressed: context.read<SettingsCubit>().updateMediaMetadataService,
|
||||
@@ -183,14 +181,11 @@ class _SettingsViewState extends State<_SettingsView> with TickerProviderStateMi
|
||||
icon: Icons.movie_filter_rounded,
|
||||
label: "Select a service",
|
||||
defaultValue:
|
||||
state.loggedUser.settings.episodeService.name.substring(0, 1).toUpperCase() +
|
||||
state.loggedUser.settings.episodeService.name.substring(1),
|
||||
TextUtils.capitalize(state.loggedUser.settings.episodeService.name),
|
||||
children:
|
||||
EpisodeService.values
|
||||
.map(
|
||||
(service) =>
|
||||
service.name.substring(0, 1).toUpperCase() +
|
||||
service.name.substring(1),
|
||||
(service) => TextUtils.capitalize(service.name),
|
||||
)
|
||||
.toList(),
|
||||
onPressed: context.read<SettingsCubit>().updateEpisodeMetadataService,
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:unyo/presentation/widgets/styled/unyo_pill.dart';
|
||||
import 'package:unyo/presentation/widgets/text/text_utils.dart';
|
||||
|
||||
class UnyoExtensionButton extends StatelessWidget {
|
||||
final void Function()? onDownloadPressed;
|
||||
final void Function()? onUpdatePressed;
|
||||
final void Function()? onDeletePressed;
|
||||
final void Function()? onSettingsPressed;
|
||||
final String iconUrl;
|
||||
@@ -10,15 +14,18 @@ class UnyoExtensionButton extends StatelessWidget {
|
||||
final String lang;
|
||||
final String version;
|
||||
final int nsfw;
|
||||
final String repoUrl;
|
||||
|
||||
const UnyoExtensionButton({
|
||||
super.key,
|
||||
this.onDownloadPressed,
|
||||
this.onUpdatePressed,
|
||||
required this.iconUrl,
|
||||
required this.name,
|
||||
required this.lang,
|
||||
required this.version,
|
||||
required this.nsfw,
|
||||
required this.repoUrl,
|
||||
this.onDeletePressed,
|
||||
this.onSettingsPressed,
|
||||
});
|
||||
@@ -59,25 +66,13 @@ class UnyoExtensionButton extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
nsfw == 1
|
||||
? Container(
|
||||
? const UnyoPill(
|
||||
text: "NFSW",
|
||||
color: Colors.amber,
|
||||
height: 14,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.amber.withValues(alpha: 0.3),
|
||||
),
|
||||
child: const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: Text(
|
||||
"NFSW",
|
||||
style: TextStyle(
|
||||
fontSize: 8,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
fontSize: 8,
|
||||
fontWeight: FontWeight.w700,
|
||||
horizontalPadding: 4,
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
],
|
||||
@@ -85,46 +80,20 @@ class UnyoExtensionButton extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: 22,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: ColorScheme.of(context).primary.withValues(alpha: 0.3),
|
||||
),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6.0),
|
||||
child: Text(
|
||||
"${lang.substring(0, 1).toUpperCase()}${lang.substring(1)}",
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
UnyoPill(
|
||||
text: TextUtils.capitalize(lang),
|
||||
color: ColorScheme.of(context).primary,
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
Container(
|
||||
height: 22,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: ColorScheme.of(context).tertiary.withValues(alpha: 0.3),
|
||||
),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6.0),
|
||||
child: Text(
|
||||
version,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
UnyoPill(
|
||||
text: version,
|
||||
color: ColorScheme.of(context).tertiary,
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
UnyoPill(
|
||||
height: 16,
|
||||
text: TextUtils.extractRepoName(repoUrl),
|
||||
color: Colors.blue.harmonizeWith(ColorScheme.of(context).secondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -155,6 +124,27 @@ class UnyoExtensionButton extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
onUpdatePressed != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(left: 10.0.w),
|
||||
child: Tooltip(
|
||||
waitDuration: const Duration(milliseconds: 1000),
|
||||
message: "Update",
|
||||
child: InkWell(
|
||||
onTap: onUpdatePressed,
|
||||
child: Container(
|
||||
width: 45,
|
||||
height: 45,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.green.withValues(alpha: 0.2),
|
||||
),
|
||||
child: Icon(Icons.sync_rounded, color: Colors.greenAccent.withValues(alpha: 0.8)),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
onSettingsPressed != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(left: 10.0.w),
|
||||
|
||||
44
lib/presentation/widgets/styled/unyo_pill.dart
Normal file
44
lib/presentation/widgets/styled/unyo_pill.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UnyoPill extends StatelessWidget {
|
||||
final String text;
|
||||
final Color color;
|
||||
final double height;
|
||||
final double fontSize;
|
||||
final FontWeight fontWeight;
|
||||
final double horizontalPadding;
|
||||
|
||||
const UnyoPill({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.color,
|
||||
this.height = 22,
|
||||
this.fontSize = 11,
|
||||
this.fontWeight = FontWeight.bold,
|
||||
this.horizontalPadding = 6,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: color.withValues(alpha: 0.3),
|
||||
),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: fontSize,
|
||||
fontWeight: fontWeight,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -46,12 +46,38 @@ class TextUtils {
|
||||
}
|
||||
}
|
||||
|
||||
static List<String> upperCaseFirstCharacter(List<String> list) {
|
||||
return list
|
||||
.map(
|
||||
(strElement) =>
|
||||
strElement.isNotEmpty ? strElement[0].toUpperCase() + strElement.substring(1) : strElement,
|
||||
)
|
||||
.toList();
|
||||
static List<String> capitalizeList(List<String> list) {
|
||||
return list.map(capitalize).toList();
|
||||
}
|
||||
|
||||
static String extractRepoName(String repoUrl) {
|
||||
try {
|
||||
final uri = Uri.parse(repoUrl);
|
||||
final hostname = uri.host.toLowerCase();
|
||||
|
||||
final paths = uri.pathSegments.where((s) => s.isNotEmpty).toList();
|
||||
if (hostname == 'raw.githubusercontent.com' || hostname == 'gist.githubusercontent.com') {
|
||||
return paths.isNotEmpty ? capitalize(paths.first) : 'GitHub Repo';
|
||||
}
|
||||
|
||||
if (hostname.contains('github.io') || hostname.contains('gitlab.io')) {
|
||||
final username = hostname.split('.').first;
|
||||
return capitalize(username.replaceAll('-', ' '));
|
||||
}
|
||||
|
||||
final domainParts = hostname.replaceFirst('www.', '').split('.');
|
||||
if (domainParts.length >= 2) {
|
||||
final mainDomain = domainParts[domainParts.length - 2];
|
||||
return capitalize(mainDomain);
|
||||
}
|
||||
return 'Custom Repo';
|
||||
} catch (e) {
|
||||
// Fallback if the URL is completely malformed or unparseable
|
||||
return 'Unknown Repo';
|
||||
}
|
||||
}
|
||||
|
||||
static String capitalize(String str) {
|
||||
return str.isNotEmpty ? '${str[0].toUpperCase()}${str.substring(1)}' : str;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user