Compare commits

..

25 Commits

Author SHA1 Message Date
Hadrian Burkhardt 73f6373b84 licence 2026-05-25 12:51:18 +02:00
Hadrian Burkhardt 469baa99bb release notes 2026-05-25 12:47:23 +02:00
Hadrian Burkhardt 338bca798c version code update 2026-05-25 12:13:49 +02:00
Hadrian Burkhardt e9d8c9d88e video + hashid 2026-05-25 11:59:16 +02:00
Hadrian Burkhardt 5bfc769121 keystore added 2026-05-10 21:18:29 +02:00
Hadrian Burkhardt 7bfffd6b82 10in screenshots 2026-05-10 19:59:44 +02:00
Hadrian Burkhardt cef84c818f 7in outline 2026-05-10 11:58:19 +02:00
Hadrian Burkhardt ad3cbd2ee4 7in screenshots 2026-05-10 11:45:25 +02:00
Hadrian Burkhardt e38a4044a7 changed package naming 2026-05-10 11:26:54 +02:00
Hadrian Burkhardt 5d5284d76e view alignment 2026-05-10 11:05:06 +02:00
Hadrian Burkhardt d822e54f91 phone screen shots 2026-05-10 10:53:37 +02:00
Hadrian Burkhardt 1eb389ea5e nicer visual aperance 2026-05-10 10:31:51 +02:00
Hadrian Burkhardt 120d1672a3 feature graphic added 2026-05-10 08:49:07 +02:00
Hadrian Burkhardt f6ad944988 APP_OVERVIEW 2026-05-10 01:32:59 +02:00
Hadrian Burkhardt 9c295532df privacy policy 2026-05-10 01:09:25 +02:00
Hadrian Burkhardt cd73c35c4d base64 enocding + display 2026-05-10 00:13:43 +02:00
Hadrian Burkhardt 1b610f6c4d added contact email address 2026-05-08 18:46:19 +02:00
Hadrian Burkhardt 01922c16e7 in app reviews 2026-05-08 18:41:07 +02:00
Hadrian Burkhardt ad45c7ef27 updates to newer version 2026-05-08 18:30:42 +02:00
Hadrian Burkhardt 00e485da6e Upgrade AGP dependency from 9.0.1 to 9.2.1
Upgrade Gradle version to 9.4.1
2026-05-08 18:15:19 +02:00
Hadrian Burkhardt 4c443a0b86 better url risk scorer, icon, language, views reduced. 2026-05-08 18:09:57 +02:00
Hadrian Burkhardt a0646273bc event ticketing whitelist 2026-03-03 16:11:28 +01:00
Hadrian Burkhardt 3d7620954f removed batchmode from personal usecase
update ticketing and events view
2026-03-03 14:13:25 +01:00
Hadrian Burkhardt fb94b7214a more responsive bounding box 2026-02-26 05:42:07 +01:00
Hadrian Burkhardt 229244d878 wifi icon + qrcode stamps 2026-02-26 05:29:45 +01:00
113 changed files with 8897 additions and 1331 deletions
+3
View File
@@ -9,6 +9,9 @@ build/
# Local machine config # Local machine config
local.properties local.properties
keystore.properties
*.jks
*.keystore
# OS files # OS files
.DS_Store .DS_Store
+81
View File
@@ -0,0 +1,81 @@
# Private QR Scanner Overview
Private QR Scanner is an Android QR code and barcode scanner focused on fast scanning, practical result actions, and local-first privacy. The app is designed for people who want to read codes without ads, tracking, accounts, or unnecessary network access.
## Purpose
The purpose of Private QR Scanner is to give users a simple, trustworthy way to scan QR codes and barcodes in everyday situations. It helps users inspect scanned content before acting on it, copy or share results, open supported content types, and keep an optional local history when they want a record of previous scans.
The app is built around three product principles:
- Privacy first: scanning and parsing happen on the device.
- Low friction: common actions are available directly after a scan.
- User control: history, warnings, scan feedback, and use-case views are configurable.
## Core Features
### QR and Barcode Scanning
Private QR Scanner uses the device camera to scan QR codes and common barcode formats. The scanner includes a live camera preview, center aiming frame, flashlight support, pinch-to-zoom support, and scan stability handling to reduce accidental repeat scans.
### Scan From Image
Users can choose an image from the device and scan QR codes or barcodes inside it. If multiple codes are detected in one image, the app shows a result picker so the user can choose the correct code.
### Practical Result Actions
After a scan, the app shows the scanned content and provides relevant actions. Depending on the content type, users can copy, share, open a link, call a number, send SMS, send email, open Wi-Fi settings, add a contact, or add a calendar event.
### Structured Content Support
The app recognizes common structured QR content, including URLs, phone numbers, SMS, email, Wi-Fi configuration, contacts, and calendar events. Contact QR codes such as vCard and MECARD are parsed into a clearer contact-style view before the user chooses an action.
### Local Security Warnings
For URLs, the app can show a local warning when a link looks unusual or potentially risky. These warnings are calculated on the device and are meant to help users pause and inspect a link before opening it.
### Optional Local History
Scan history is optional and off by default. When enabled, scanned content, content type, and scan time are stored locally on the device. Users can search history, delete individual entries, clear all entries, and export history as TXT, CSV, or JSON.
### Batch Mode
Batch mode lets users scan multiple codes in one continuous flow. Captures are shown newest-first and can be copied or shared. This is useful for faster workflows where the user does not want to leave the scanner after every scan.
### Event and Ticketing View
The Event & Ticketing use-case view supports venue or event workflows. It emphasizes batch scanning, repeated-ticket detection, optional whitelist import, and quick sharing of batch captures for reconciliation.
### Configurable Settings
Users can control whether history is saved, whether local security warnings are enabled, whether scan feedback is active, and which use-case view is shown. The settings screen also includes app information and the privacy policy.
## Privacy Model
Private QR Scanner is designed as a local-first app:
- No ads.
- No analytics.
- No tracking SDKs.
- No developer backend.
- No account creation.
- No Android Internet permission requested by the app.
- Optional scan history stays in app-private storage on the device.
Data can leave the device only when the user chooses an external Android action, such as opening a link, sharing text, sending an email, adding a contact, adding a calendar event, or reviewing the app on Google Play.
See [PRIVACY_POLICY.md](PRIVACY_POLICY.md) for the full privacy policy.
## Primary Use Cases
### Everyday Personal Use
Users can scan restaurant menus, product labels, Wi-Fi QR codes, contact cards, calendar invitations, and website links. The app provides quick result actions while keeping history optional and local.
### Event and Ticketing
Organizers can scan ticket codes, process attendees quickly with batch mode, detect repeated entries, import a whitelist of valid IDs, and share scan batches for follow-up or reconciliation.
## What Makes It Different
Many scanner apps add ads, analytics, account flows, broad permissions, or network-based features. Private QR Scanner is intentionally narrower: it focuses on scanning, inspecting, acting on results, and optionally keeping a local record. That makes it a good fit for users who prefer a simple scanner with a clear privacy posture.
+674
View File
@@ -0,0 +1,674 @@
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
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
+58
View File
@@ -0,0 +1,58 @@
# Privacy Policy
Last updated: 2026-05-10
Private QR Scanner is provided by SoftwareApp-HB.
Contact: softwareapp.hb@gmail.com
This policy explains how Private QR Scanner handles data on your device.
## What the App Accesses
Camera: The app uses the camera only to scan QR codes and barcodes. Camera frames are processed on your device and are not saved by the app.
Selected images: If you choose to scan from an image, the app reads that selected image only to detect QR codes or barcodes. The app does not keep a copy of the image.
Scanned content: The app displays scanned content on your device. If you enable Save history (local), the scanned content, content type, and scan time are stored locally on your device. History is off by default.
Settings: The app stores your local preferences, such as whether history, security warnings, scan feedback, and the selected use-case view are enabled.
Event and ticketing data: Imported whitelist IDs and batch scan results are processed locally. Whitelist IDs are kept in memory for the current app session and are not uploaded by the app.
## How Data Is Used
Data is used to scan codes, show scan results, provide local security warnings, support optional local history, support event and ticketing workflows, and run actions that you choose.
## Data Collection and Sharing
Private QR Scanner does not create accounts, show ads, use analytics, use tracking SDKs, use crash reporting SDKs, or send app data to a developer backend. The app does not request the Android Internet permission.
The developer does not receive, collect, sell, or share your scanned content, selected images, history, settings, or whitelist data.
Data can leave your device only when you choose an Android or third-party action, such as Open, Share, Call, SMS, Email, Add contact, Add calendar event, Wi-Fi settings, or Google Play review. Those actions are handled by Android, Google Play, or the app or service you choose, and their privacy practices apply.
## Storage, Retention, and Deletion
Optional scan history and settings are stored in app-private storage on your device. Android app backup is disabled for this app.
Scan history remains on your device until you delete individual entries, delete all history, turn history off and choose to delete existing history, clear the app data, or uninstall the app.
Settings remain on your device until you change them, clear the app data, or uninstall the app.
Camera frames, selected images, imported whitelist IDs, and batch scan results are not retained by the app after the active use or app session ends, unless the resulting scanned content is saved to local history because you enabled that setting.
## Security
The app relies on Android app-private storage and Android permission controls. Keep your device screen lock and operating system security updates enabled to protect local data.
## Children
The app is not directed to children and does not knowingly collect personal data from anyone.
## Changes
If this policy changes, the updated policy will be included in the app and in the public policy copy for the app.
## Contact
For privacy questions or deletion requests about data that may have been sent through an external action you chose, contact the relevant external service. For questions about this app, contact SoftwareApp-HB at softwareapp.hb@gmail.com.
+7 -1
View File
@@ -1,4 +1,4 @@
# Clean Scanner (MVP) # Private QR Scanner (MVP)
Offline-first, ad-free QR/barcode scanner built with Kotlin, Jetpack Compose, CameraX, and on-device ML Kit. Offline-first, ad-free QR/barcode scanner built with Kotlin, Jetpack Compose, CameraX, and on-device ML Kit.
@@ -23,6 +23,12 @@ Offline-first, ad-free QR/barcode scanner built with Kotlin, Jetpack Compose, Ca
- Keine Tracker/Analytics/Crashlytics - Keine Tracker/Analytics/Crashlytics
- Kein Backend, keine Servercalls - Kein Backend, keine Servercalls
- Keine `INTERNET`-Permission im Manifest - Keine `INTERNET`-Permission im Manifest
- Datenschutzerklärung in der App und als [PRIVACY_POLICY.md](PRIVACY_POLICY.md)
## Lizenz
Copyright (C) 2026 SoftwareApp-HB.
Private QR Scanner is licensed under the GNU General Public License v3.0. See [LICENSE](LICENSE).
## MVP Features ## MVP Features
- Home: Scan-Button, lokaler Historie-Toggle (Default: OFF), Datenschutz-Dialog - Home: Scan-Button, lokaler Historie-Toggle (Default: OFF), Datenschutz-Dialog
+7 -43
View File
@@ -1,4 +1,9 @@
# Clean Scanner Use Cases # Private QR Scanner Use Cases
## Use-Case Views
- [Done] Each use case has an individual view profile that shows only relevant functions.
- [Done] Default profile is **Everyday Personal Use**.
- [Done] Only **Everyday Personal Use** and **Event & Ticketing** can be selected in **Settings**.
## 1. Everyday Personal Use ## 1. Everyday Personal Use
- [Done] Scan restaurant menus, product QR labels, and website links quickly. - [Done] Scan restaurant menus, product QR labels, and website links quickly.
@@ -7,47 +12,6 @@
## 2. Event & Ticketing ## 2. Event & Ticketing
- [Done] Scan tickets at venues and quickly validate repeated entries. - [Done] Scan tickets at venues and quickly validate repeated entries.
- [Done] Enable **Stapelmodus (Batch Mode)** by default in this view for fast check-in flow.
- [Done] Use batch mode to process multiple attendees without leaving the camera. - [Done] Use batch mode to process multiple attendees without leaving the camera.
- [Done] Share batch captures to organizers for quick reconciliation. - [Done] Share batch captures to organizers for quick reconciliation.
## 3. Inventory & Operations
- [Done] Scan product barcodes in stock rooms.
- [Done] Use batch mode for continuous scanning of many items.
- [Done] Export and share history (TXT/CSV/JSON) for downstream reporting.
## 4. Field Work & Service Teams
- [Done] Scan device labels/serials on-site.
- [Done] Save local history for audit trails when enabled.
- [Done] Share captured codes with support teams in real time.
## 5. Office & Admin Workflows
- [Done] Scan contact QR/vCard and add to contacts.
- [Done] Scan Wi-Fi setup QR and jump to Wi-Fi settings.
- [Done] Scan calendar/event data and create calendar entries.
## 6. Communication Shortcuts
- [Done] Scan phone/SMS/email QR data.
- [Done] One-tap actions: call, send SMS, send email.
- [Done] Reduce manual entry errors for phone numbers and addresses.
## 7. Security-Conscious Browsing
- [Done] Scan URL QR codes and get local warning prompts for suspicious patterns.
- [Done] Decide whether to open risky links with explicit confirmation.
- [Done] Keep scanning offline-first without backend calls.
## 8. Offline / Low-Connectivity Scenarios
- [Done] Use the scanner with no internet dependency for core scanning.
- [Done] Keep data local-first and share outputs when connectivity returns.
- [Done] Useful for travel, warehouses, and remote job sites.
## 9. Accessibility & Speed
- [Done] Launch directly into camera for 0-click scan flow.
- [Done] Pinch-to-zoom for small or distant QR/barcodes.
- [Done] Friendly scanner guide with immediate feedback on successful scans.
## 10. Team Handover & Data Transfer
- Export scan history in multiple formats:
- [Done] TXT for human-readable logs
- [Done] CSV for spreadsheets/BI tools
- [Done] JSON for system integrations
- [Done] Share exports to teammates via native Android share sheet.
+65 -4
View File
@@ -1,18 +1,60 @@
import java.util.Properties
plugins { plugins {
id("com.android.application") id("com.android.application")
id("com.google.devtools.ksp") id("com.google.devtools.ksp")
id("org.jetbrains.kotlin.plugin.compose") id("org.jetbrains.kotlin.plugin.compose")
} }
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties().apply {
if (keystorePropertiesFile.exists()) {
keystorePropertiesFile.inputStream().use(::load)
}
}
fun signingValue(propertyName: String, envName: String): String? {
return (keystoreProperties[propertyName] as? String)
?.takeIf { it.isNotBlank() }
?: System.getenv(envName)?.takeIf { it.isNotBlank() }
}
val releaseStoreFile = signingValue("storeFile", "RELEASE_STORE_FILE")
val releaseStorePassword = signingValue("storePassword", "RELEASE_STORE_PASSWORD")
val releaseKeyAlias = signingValue("keyAlias", "RELEASE_KEY_ALIAS")
val releaseKeyPassword = signingValue("keyPassword", "RELEASE_KEY_PASSWORD")
val hasReleaseSigning = listOf(
releaseStoreFile,
releaseStorePassword,
releaseKeyAlias,
releaseKeyPassword
).all { !it.isNullOrBlank() }
gradle.taskGraph.whenReady {
val releaseBundleRequested = allTasks.any {
it.path == ":app:bundleRelease" || it.name == "bundleRelease"
}
val releaseApkRequested = allTasks.any {
it.path == ":app:assembleRelease" || it.name == "assembleRelease"
}
if ((releaseBundleRequested || releaseApkRequested) && !hasReleaseSigning) {
throw GradleException(
"Release signing is not configured. Fill storePassword, keyAlias, and keyPassword " +
"in keystore.properties, or set RELEASE_STORE_FILE, RELEASE_STORE_PASSWORD, " +
"RELEASE_KEY_ALIAS, and RELEASE_KEY_PASSWORD."
)
}
}
android { android {
namespace = "com.clean.scanner" namespace = "de.softwareapp_hb.privateqrscanner"
compileSdk = 36 compileSdk = 36
defaultConfig { defaultConfig {
applicationId = "com.clean.scanner" applicationId = "de.softwareapp_hb.privateqrscanner"
minSdk = 24 minSdk = 24
targetSdk = 36 targetSdk = 36
versionCode = 1 versionCode = 2
versionName = "1.0.0" versionName = "1.0.0"
buildConfigField("boolean", "FEATURE_PAYWALL_ENABLED", "false") buildConfigField("boolean", "FEATURE_PAYWALL_ENABLED", "false")
@@ -22,9 +64,26 @@ android {
} }
} }
signingConfigs {
if (hasReleaseSigning) {
create("release") {
storeFile = file(releaseStoreFile!!)
storePassword = releaseStorePassword
keyAlias = releaseKeyAlias
keyPassword = releaseKeyPassword
}
}
}
buildTypes { buildTypes {
release { release {
isMinifyEnabled = true isMinifyEnabled = true
if (hasReleaseSigning) {
signingConfig = signingConfigs.getByName("release")
}
ndk {
debugSymbolLevel = "SYMBOL_TABLE"
}
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro" "proguard-rules.pro"
@@ -87,7 +146,9 @@ dependencies {
implementation("androidx.camera:camera-view:1.5.3") implementation("androidx.camera:camera-view:1.5.3")
implementation("com.google.mlkit:barcode-scanning:17.3.0") implementation("com.google.mlkit:barcode-scanning:17.3.0")
implementation("com.github.bitfireAT:vcard4android:main-SNAPSHOT") implementation("com.google.android.play:review:2.0.2")
implementation("com.google.android.play:review-ktx:2.0.2")
implementation("com.github.bitfireAT:vcard4android:7dbab269865e99eb4f46a25313d6397b51cd6ba8")
implementation("androidx.room:room-runtime:2.8.4") implementation("androidx.room:room-runtime:2.8.4")
implementation("androidx.room:room-ktx:2.8.4") implementation("androidx.room:room-ktx:2.8.4")
@@ -1,4 +1,4 @@
package com.clean.scanner.util package de.softwareapp_hb.privateqrscanner.util
import android.provider.ContactsContract import android.provider.ContactsContract
import android.provider.ContactsContract.CommonDataKinds.Organization import android.provider.ContactsContract.CommonDataKinds.Organization
+11 -4
View File
@@ -1,14 +1,21 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:name="android.hardware.camera.any" android:required="false" /> <uses-feature android:name="android.hardware.camera.any" android:required="false" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" tools:node="remove" />
<uses-permission android:name="android.permission.INTERNET" tools:node="remove" />
<uses-permission android:name="android.permission.READ_CONTACTS" tools:node="remove" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" tools:node="remove" />
<application <application
tools:targetApi="33"
android:name=".CleanScannerApp" android:name=".CleanScannerApp"
android:allowBackup="true" android:allowBackup="false"
android:icon="@android:drawable/ic_menu_camera" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@android:drawable/ic_menu_camera" android:localeConfig="@xml/locales_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.CleanScanner"> android:theme="@style/Theme.CleanScanner">
<activity <activity
@@ -1,6 +0,0 @@
package com.clean.scanner.domain
data class ScanResult(
val content: String,
val type: String
)
@@ -1,169 +0,0 @@
package com.clean.scanner.ui.screens
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.SwipeToDismissBox
import androidx.compose.material3.SwipeToDismissBoxValue
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.rememberSwipeToDismissBoxState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.clean.scanner.R
import com.clean.scanner.domain.ScanRecord
import com.clean.scanner.util.HistoryExportFormatter
import com.clean.scanner.util.Intents
import java.text.DateFormat
import java.util.Date
@Composable
fun HistoryScreen(
query: String,
history: List<ScanRecord>,
onQueryChange: (String) -> Unit,
onDelete: (Long) -> Unit,
onClearAll: () -> Unit
) {
val context = LocalContext.current
val showDeleteAll = remember { mutableStateOf(false) }
val selectedItem = remember { mutableStateOf<ScanRecord?>(null) }
if (showDeleteAll.value) {
AlertDialog(
onDismissRequest = { showDeleteAll.value = false },
title = { Text(stringResource(R.string.delete_all)) },
text = { Text(stringResource(R.string.confirm_delete_all)) },
confirmButton = {
TextButton(onClick = {
onClearAll()
showDeleteAll.value = false
}) { Text(stringResource(R.string.confirm)) }
},
dismissButton = {
TextButton(onClick = { showDeleteAll.value = false }) {
Text(stringResource(R.string.cancel))
}
}
)
}
val detail = selectedItem.value
if (detail != null) {
AlertDialog(
onDismissRequest = { selectedItem.value = null },
title = { Text(text = detail.type) },
text = { Text(text = detail.content) },
confirmButton = {
TextButton(onClick = { selectedItem.value = null }) {
Text(text = stringResource(R.string.confirm))
}
}
)
}
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
verticalArrangement = Arrangement.Top
) {
OutlinedTextField(
value = query,
onValueChange = onQueryChange,
modifier = Modifier.fillMaxWidth(),
label = { Text(stringResource(R.string.search)) }
)
Row(modifier = Modifier.fillMaxWidth()) {
TextButton(
onClick = {
val exportText = HistoryExportFormatter.formatText(history)
Intents.shareContent(context, exportText, "text/plain")
},
enabled = history.isNotEmpty()
) {
Text(stringResource(R.string.share_txt))
}
TextButton(
onClick = {
val exportCsv = HistoryExportFormatter.formatCsv(history)
Intents.shareContent(context, exportCsv, "text/csv")
},
enabled = history.isNotEmpty()
) {
Text(stringResource(R.string.share_csv))
}
TextButton(
onClick = {
val exportJson = HistoryExportFormatter.formatJson(history)
Intents.shareContent(context, exportJson, "application/json")
},
enabled = history.isNotEmpty()
) {
Text(stringResource(R.string.share_json))
}
TextButton(onClick = { showDeleteAll.value = true }) {
Text(stringResource(R.string.delete_all))
}
}
LazyColumn {
items(history, key = { it.id }) { item ->
HistoryRow(
item = item,
onDelete = onDelete,
onOpenDetails = { selectedItem.value = item }
)
}
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun HistoryRow(
item: ScanRecord,
onDelete: (Long) -> Unit,
onOpenDetails: () -> Unit
) {
val dismissState = rememberSwipeToDismissBoxState(
confirmValueChange = {
if (it == SwipeToDismissBoxValue.EndToStart || it == SwipeToDismissBoxValue.StartToEnd) {
onDelete(item.id)
true
} else {
false
}
}
)
SwipeToDismissBox(
state = dismissState,
backgroundContent = {},
content = {
Column(modifier = Modifier
.fillMaxWidth()
.clickable { onOpenDetails() }
.padding(vertical = 12.dp)) {
Text(text = item.type)
Text(text = item.content, maxLines = 2)
Text(text = DateFormat.getDateTimeInstance().format(Date(item.timestamp)))
}
}
)
}
@@ -1,610 +0,0 @@
package com.clean.scanner.ui.screens
import android.Manifest
import android.app.Activity
import android.content.Intent
import android.media.AudioManager
import android.media.ToneGenerator
import android.net.Uri
import android.provider.Settings
import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ViewList
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material.icons.filled.FlashOff
import androidx.compose.material.icons.filled.FlashOn
import androidx.compose.material.icons.filled.PersonAdd
import androidx.compose.material.icons.filled.Share
import androidx.compose.material.icons.filled.ViewModule
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SnackbarResult
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.dp
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.clean.scanner.R
import com.clean.scanner.data.scanner.DetectionBox
import com.clean.scanner.data.scanner.DetectionPoint
import com.clean.scanner.domain.ScanResult
import com.clean.scanner.ui.BatchScanRecord
import com.clean.scanner.ui.components.CameraPreview
import com.clean.scanner.util.ClipboardUtil
import com.clean.scanner.util.Intents
import com.clean.scanner.util.ScanContentParsers
import com.clean.scanner.util.UrlRiskScorer
import com.google.mlkit.vision.barcode.BarcodeScanning
import com.google.mlkit.vision.barcode.BarcodeScannerOptions
import com.google.mlkit.vision.barcode.common.Barcode
import com.google.mlkit.vision.common.InputImage
import kotlin.math.max
internal data class GalleryScanCandidate(
val result: ScanResult,
val box: DetectionBox?
)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ScannerScreen(
analysisEnabled: Boolean,
lastResult: ScanResult?,
batchMode: Boolean,
batchResults: List<BatchScanRecord>,
duplicateFeedbackNonce: Int,
scanFeedbackNonce: Int,
warningsEnabled: Boolean,
scanFeedbackEnabled: Boolean,
onScan: (ScanResult) -> Unit,
onScanAgain: () -> Unit,
onBatchModeChange: (Boolean) -> Unit,
onClearBatchResults: () -> Unit,
onOpenHistory: () -> Unit
) {
val context = LocalContext.current
val haptic = LocalHapticFeedback.current
val duplicateSnackbarHostState = remember { SnackbarHostState() }
val toneGenerator = remember { ToneGenerator(AudioManager.STREAM_NOTIFICATION, 70) }
var cameraGranted by remember {
mutableStateOf(
ContextCompat.checkSelfPermission(
context,
Manifest.permission.CAMERA
) == android.content.pm.PackageManager.PERMISSION_GRANTED
)
}
var showSettingsHint by remember { mutableStateOf(false) }
var torchEnabled by remember { mutableStateOf(false) }
var torchAvailable by remember { mutableStateOf(false) }
var showRiskWarning by remember { mutableStateOf(false) }
var pendingOpenUrl by remember { mutableStateOf<String?>(null) }
var showImageScanFailed by remember { mutableStateOf(false) }
var imageScanCandidates by remember { mutableStateOf<List<GalleryScanCandidate>>(emptyList()) }
var imageScanPreviewUri by remember { mutableStateOf<Uri?>(null) }
var hasPotentialInView by remember { mutableStateOf(false) }
var hasReadableInView by remember { mutableStateOf(false) }
var detectionBoxes by remember { mutableStateOf<List<DetectionBox>>(emptyList()) }
var detectionSourceWidth by remember { mutableIntStateOf(0) }
var detectionSourceHeight by remember { mutableIntStateOf(0) }
val activity = context as? Activity
val imageScanner = remember {
BarcodeScanning.getClient(
BarcodeScannerOptions.Builder()
.setBarcodeFormats(Barcode.FORMAT_ALL_FORMATS)
.enableAllPotentialBarcodes()
.build()
)
}
val permissionLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.RequestPermission()
) { granted ->
cameraGranted = granted
if (!granted && activity != null) {
showSettingsHint = !ActivityCompat.shouldShowRequestPermissionRationale(
activity,
Manifest.permission.CAMERA
)
}
}
val imagePicker = rememberLauncherForActivityResult(
contract = ActivityResultContracts.GetContent()
) { uri ->
if (uri == null) return@rememberLauncherForActivityResult
val image = try {
InputImage.fromFilePath(context, uri)
} catch (_: Exception) {
showImageScanFailed = true
return@rememberLauncherForActivityResult
}
imageScanPreviewUri = uri
imageScanCandidates = emptyList()
imageScanner.process(image)
.addOnSuccessListener { barcodes ->
val candidates = barcodes.mapNotNull { barcode ->
val raw = barcode.rawValue?.takeIf { it.isNotBlank() } ?: return@mapNotNull null
val normalizedBox = barcode.boundingBox?.let { bounds ->
val corners = barcode.cornerPoints?.map { p ->
DetectionPoint(
x = (p.x / image.width.toFloat()).coerceIn(0f, 1f),
y = (p.y / image.height.toFloat()).coerceIn(0f, 1f)
)
} ?: emptyList()
DetectionBox(
left = (bounds.left / image.width.toFloat()).coerceIn(0f, 1f),
top = (bounds.top / image.height.toFloat()).coerceIn(0f, 1f),
right = (bounds.right / image.width.toFloat()).coerceIn(0f, 1f),
bottom = (bounds.bottom / image.height.toFloat()).coerceIn(0f, 1f),
corners = corners
)
}
GalleryScanCandidate(
result = ScanResult(content = raw, type = barcode.valueType.toHumanType()),
box = normalizedBox
)
}.distinctBy { "${it.result.type}|${it.result.content}" }
imageScanCandidates = candidates
}
.addOnFailureListener {
showImageScanFailed = true
}
}
LaunchedEffect(Unit) {
if (!cameraGranted) permissionLauncher.launch(Manifest.permission.CAMERA)
}
LaunchedEffect(duplicateFeedbackNonce) {
if (duplicateFeedbackNonce > 0) {
Toast.makeText(
context,
context.getString(R.string.already_scanned),
Toast.LENGTH_SHORT
).show()
val result = duplicateSnackbarHostState.showSnackbar(
message = context.getString(R.string.already_scanned),
actionLabel = context.getString(R.string.view_history),
withDismissAction = true
)
if (result == SnackbarResult.ActionPerformed) {
onOpenHistory()
}
}
}
LaunchedEffect(scanFeedbackNonce, scanFeedbackEnabled) {
if (scanFeedbackEnabled && scanFeedbackNonce > 0) {
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
toneGenerator.startTone(ToneGenerator.TONE_PROP_BEEP, 120)
}
}
DisposableEffect(Unit) {
onDispose {
imageScanner.close()
toneGenerator.release()
}
}
var containerSize by remember { mutableStateOf(IntSize.Zero) }
Box(
modifier = Modifier
.fillMaxSize()
.onSizeChanged { containerSize = it }
) {
val density = LocalDensity.current
val viewW = containerSize.width.toFloat()
val viewH = containerSize.height.toFloat()
val galleryOpen = imageScanPreviewUri != null
val aimW = viewW * 0.62f
val aimH = with(density) { 200.dp.toPx() }
val aimLeft = (viewW - aimW) / 2f
val aimTop = (viewH - aimH) / 2f
val aimRight = aimLeft + aimW
val aimBottom = aimTop + aimH
if (cameraGranted && !galleryOpen) {
CameraPreview(
modifier = Modifier.fillMaxSize(),
analysisEnabled = analysisEnabled,
torchEnabled = torchEnabled,
onTorchAvailabilityChanged = { torchAvailable = it },
onDetectionStateChanged = { hasPotential, hasReadable, boxes, sourceWidth, sourceHeight ->
hasPotentialInView = hasPotential
hasReadableInView = hasReadable
detectionBoxes = boxes
detectionSourceWidth = sourceWidth
detectionSourceHeight = sourceHeight
},
onScan = { content, type, readableBox, sourceWidth, sourceHeight ->
val box = readableBox ?: return@CameraPreview
if (sourceWidth <= 0 || sourceHeight <= 0 || viewW <= 0f || viewH <= 0f) {
return@CameraPreview
}
val srcW = sourceWidth.toFloat()
val srcH = sourceHeight.toFloat()
val scale = max(viewW / srcW, viewH / srcH)
val scaledW = srcW * scale
val scaledH = srcH * scale
val offsetX = (viewW - scaledW) / 2f
val offsetY = (viewH - scaledH) / 2f
val centerX = offsetX + (((box.left + box.right) * 0.5f) * srcW * scale)
val centerY = offsetY + (((box.top + box.bottom) * 0.5f) * srcH * scale)
val insideAim = centerX in aimLeft..aimRight && centerY in aimTop..aimBottom
if (!insideAim) return@CameraPreview
onScan(ScanResult(content = content, type = type))
}
)
if (detectionBoxes.isNotEmpty()) {
Canvas(
modifier = Modifier
.fillMaxSize()
) {
val sourceW = detectionSourceWidth.toFloat()
val sourceH = detectionSourceHeight.toFloat()
if (sourceW <= 0f || sourceH <= 0f) return@Canvas
val scale = max(size.width / sourceW, size.height / sourceH)
val scaledW = sourceW * scale
val scaledH = sourceH * scale
val offsetX = (size.width - scaledW) / 2f
val offsetY = (size.height - scaledH) / 2f
val boxColor = if (hasReadableInView) Color(0xFF4AE3A3) else Color(0xFFFFC857)
detectionBoxes.forEach { box ->
val left = offsetX + (box.left * sourceW * scale)
val top = offsetY + (box.top * sourceH * scale)
val right = offsetX + (box.right * sourceW * scale)
val bottom = offsetY + (box.bottom * sourceH * scale)
val mappedCorners = box.corners.map { p ->
Offset(
x = offsetX + (p.x * sourceW * scale),
y = offsetY + (p.y * sourceH * scale)
)
}
if (mappedCorners.size >= 4) {
val outline = Path().apply {
moveTo(mappedCorners.first().x, mappedCorners.first().y)
mappedCorners.drop(1).forEach { pt -> lineTo(pt.x, pt.y) }
close()
}
drawPath(
path = outline,
color = boxColor.copy(alpha = 0.96f),
style = Stroke(width = 4f)
)
} else if (right > left && bottom > top) {
drawRoundRect(
color = boxColor.copy(alpha = 0.95f),
topLeft = Offset(left, top),
size = Size(right - left, bottom - top),
cornerRadius = CornerRadius(14f, 14f),
style = Stroke(width = 4f)
)
}
}
}
}
Canvas(
modifier = Modifier
.align(Alignment.Center)
.fillMaxWidth(0.62f)
.height(200.dp)
) {
val guideColor = when {
hasReadableInView -> Color(0xFF4AE3A3)
hasPotentialInView -> Color(0xFFFFC857)
else -> Color(0xFF7CE6C6)
}
drawRoundRect(
color = guideColor.copy(alpha = 0.08f),
cornerRadius = CornerRadius(22f, 22f)
)
drawRoundRect(
color = guideColor.copy(alpha = 0.90f),
cornerRadius = CornerRadius(22f, 22f),
style = Stroke(width = 3.5f)
)
}
Text(
text = when {
hasReadableInView -> stringResource(R.string.live_readable_detected)
hasPotentialInView -> stringResource(R.string.live_potential_detected)
else -> stringResource(R.string.aim_center_hint)
},
color = Color.White,
textAlign = TextAlign.Center,
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(bottom = if (batchMode) 190.dp else 56.dp)
.background(
color = Color.Black.copy(alpha = 0.35f),
shape = RoundedCornerShape(18.dp)
)
.padding(horizontal = 14.dp, vertical = 8.dp)
)
IconButton(
onClick = { imagePicker.launch("image/*") },
modifier = Modifier
.align(Alignment.TopEnd)
.padding(top = 12.dp, end = 12.dp)
.background(
color = Color.Black.copy(alpha = 0.35f),
shape = RoundedCornerShape(14.dp)
)
) {
Icon(
painter = painterResource(id = android.R.drawable.ic_menu_gallery),
contentDescription = stringResource(R.string.scan_from_image),
tint = Color.White
)
}
Column(
modifier = Modifier
.align(Alignment.TopStart)
.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
if (torchAvailable) {
OverlayIconToggle(
checked = torchEnabled,
onCheckedChange = { torchEnabled = it },
label = stringResource(R.string.flashlight),
checkedImageVector = Icons.Default.FlashOn,
uncheckedImageVector = Icons.Default.FlashOff,
showLabel = false
)
}
OverlayIconToggle(
checked = batchMode,
onCheckedChange = onBatchModeChange,
label = stringResource(R.string.batch_mode),
checkedImageVector = Icons.Default.ViewModule,
uncheckedImageVector = Icons.AutoMirrored.Filled.ViewList
)
}
if (batchMode) {
Box(modifier = Modifier.align(Alignment.BottomCenter)) {
BatchResultsPanel(
results = batchResults,
onClear = onClearBatchResults
)
}
}
SnackbarHost(
hostState = duplicateSnackbarHostState,
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(bottom = if (batchMode) 12.dp else 80.dp)
)
} else if (!galleryOpen) {
PermissionContent(
showSettingsHint = showSettingsHint,
onRequestPermission = { permissionLauncher.launch(Manifest.permission.CAMERA) },
onOpenSettings = {
val intent = Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", context.packageName, null)
)
context.startActivity(intent)
}
)
} else {
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Black)
)
}
if (lastResult != null && !batchMode) {
val parsedContact = remember(lastResult.content) { ScanContentParsers.parseContact(lastResult.content) }
val parsedEvent = remember(lastResult.content) { ScanContentParsers.parseCalendarEvent(lastResult.content) }
ModalBottomSheet(onDismissRequest = onScanAgain) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
if (parsedContact == null) {
Text(text = "${stringResource(R.string.content_type)}: ${lastResult.type}")
}
ResultVisualCard(result = lastResult)
Row(
modifier = Modifier
.fillMaxWidth()
.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
if (parsedContact != null) {
IconButton(onClick = {
Intents.addContact(context, parsedContact, lastResult.content)
}) {
Icon(
imageVector = Icons.Default.PersonAdd,
contentDescription = stringResource(R.string.add_contact)
)
}
}
IconButton(onClick = { ClipboardUtil.copy(context, lastResult.content) }) {
Icon(
imageVector = Icons.Default.ContentCopy,
contentDescription = stringResource(R.string.copy)
)
}
if (lastResult.type == "URL") {
Button(onClick = {
val risk = UrlRiskScorer.score(lastResult.content)
val risky = warningsEnabled && risk.score >= 3
if (risky) {
pendingOpenUrl = lastResult.content
showRiskWarning = true
} else {
Intents.openUrl(context, lastResult.content)
}
}) {
Text(stringResource(R.string.open))
}
}
IconButton(onClick = { Intents.shareText(context, lastResult.content) }) {
Icon(
imageVector = Icons.Default.Share,
contentDescription = stringResource(R.string.share)
)
}
}
when (lastResult.type) {
"Phone" -> {
Button(onClick = {
Intents.dialPhone(context, ScanContentParsers.extractPhoneNumber(lastResult.content))
}) {
Text(stringResource(R.string.call_number))
}
}
"SMS" -> {
Button(onClick = {
val smsData = ScanContentParsers.parseSms(lastResult.content)
Intents.sendSms(context, smsData.first, smsData.second)
}) {
Text(stringResource(R.string.send_sms))
}
}
"Email" -> {
Button(onClick = {
Intents.sendEmail(context, ScanContentParsers.extractEmail(lastResult.content), null)
}) {
Text(stringResource(R.string.send_email))
}
}
"WiFi" -> {
Button(onClick = { Intents.openWifiSettings(context) }) {
Text(stringResource(R.string.open_wifi_settings))
}
}
"Calendar" -> {
Button(onClick = {
Intents.addCalendarEvent(context, parsedEvent, lastResult.content)
}) {
Text(stringResource(R.string.add_calendar_event))
}
}
}
}
}
}
if (showRiskWarning && pendingOpenUrl != null) {
AlertDialog(
onDismissRequest = { showRiskWarning = false },
text = { Text(stringResource(R.string.risk_warning)) },
confirmButton = {
TextButton(onClick = {
Intents.openUrl(context, pendingOpenUrl!!)
showRiskWarning = false
}) { Text(stringResource(R.string.open_anyway)) }
},
dismissButton = {
TextButton(onClick = { showRiskWarning = false }) {
Text(stringResource(R.string.cancel))
}
}
)
}
if (imageScanPreviewUri != null) {
GalleryScanPreviewDialog(
imageUri = imageScanPreviewUri,
candidates = imageScanCandidates,
onPick = { candidate ->
onScan(candidate.result)
imageScanCandidates = emptyList()
imageScanPreviewUri = null
},
onDismiss = {
imageScanCandidates = emptyList()
imageScanPreviewUri = null
}
)
}
if (showImageScanFailed) {
AlertDialog(
onDismissRequest = { showImageScanFailed = false },
text = { Text(stringResource(R.string.image_scan_failed)) },
confirmButton = {
TextButton(onClick = { showImageScanFailed = false }) {
Text(stringResource(R.string.confirm))
}
}
)
}
}
}
@@ -1,142 +0,0 @@
package com.clean.scanner.ui.screens
import android.widget.Toast
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.clean.scanner.R
import com.clean.scanner.util.Intents
@Composable
fun SettingsScreen(
historyEnabled: Boolean,
warningsEnabled: Boolean,
scanFeedbackEnabled: Boolean,
onHistoryToggle: (Boolean, Boolean) -> Unit,
onWarningsToggle: (Boolean) -> Unit,
onScanFeedbackToggle: (Boolean) -> Unit
) {
val context = LocalContext.current
val showDeleteConfirm = remember { mutableStateOf(false) }
val showFeatureRequestForm = remember { mutableStateOf(false) }
val requesterNeed = remember { mutableStateOf("") }
if (showDeleteConfirm.value) {
AlertDialog(
onDismissRequest = { showDeleteConfirm.value = false },
title = { Text(stringResource(R.string.settings)) },
text = { Text(stringResource(R.string.delete_history_on_disable)) },
confirmButton = {
TextButton(onClick = {
onHistoryToggle(false, true)
showDeleteConfirm.value = false
}) { Text(stringResource(R.string.confirm)) }
},
dismissButton = {
TextButton(onClick = {
onHistoryToggle(false, false)
showDeleteConfirm.value = false
}) { Text(stringResource(R.string.cancel)) }
}
)
}
if (showFeatureRequestForm.value) {
AlertDialog(
onDismissRequest = { showFeatureRequestForm.value = false },
title = { Text(stringResource(R.string.feature_request_title)) },
text = {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
OutlinedTextField(
value = requesterNeed.value,
onValueChange = { requesterNeed.value = it },
label = { Text(stringResource(R.string.feature_request_details)) }
)
}
},
confirmButton = {
TextButton(
onClick = {
val body = buildString {
appendLine("Request:")
append(requesterNeed.value.trim())
}
Intents.sendEmail(
context = context,
email = context.getString(R.string.support_email),
subject = context.getString(R.string.feature_request_subject),
body = body
)
showFeatureRequestForm.value = false
requesterNeed.value = ""
Toast.makeText(
context,
context.getString(R.string.feature_request_sent),
Toast.LENGTH_SHORT
).show()
},
enabled = requesterNeed.value.isNotBlank()
) { Text(stringResource(R.string.send_request)) }
},
dismissButton = {
TextButton(onClick = { showFeatureRequestForm.value = false }) {
Text(stringResource(R.string.cancel))
}
}
)
}
Column(
modifier = Modifier
.fillMaxSize()
.padding(24.dp),
verticalArrangement = Arrangement.Top
) {
Text(text = stringResource(R.string.save_history))
Switch(
checked = historyEnabled,
onCheckedChange = { enabled ->
if (!enabled && historyEnabled) {
showDeleteConfirm.value = true
} else {
onHistoryToggle(enabled, false)
}
}
)
Spacer(modifier = Modifier.height(16.dp))
Text(text = stringResource(R.string.security_warnings))
Switch(checked = warningsEnabled, onCheckedChange = onWarningsToggle)
Spacer(modifier = Modifier.height(16.dp))
Text(text = stringResource(R.string.scan_feedback))
Switch(checked = scanFeedbackEnabled, onCheckedChange = onScanFeedbackToggle)
Spacer(modifier = Modifier.height(24.dp))
Text(text = stringResource(R.string.about))
Text(text = stringResource(R.string.version))
Text(text = stringResource(R.string.licenses))
Text(text = stringResource(R.string.contact))
Spacer(modifier = Modifier.height(12.dp))
TextButton(onClick = { showFeatureRequestForm.value = true }) {
Text(text = stringResource(R.string.feature_request))
}
}
}
@@ -1,31 +0,0 @@
package com.clean.scanner.ui.theme
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
private val LightColors = lightColorScheme()
private val DarkColors = darkColorScheme()
@Composable
fun CleanScannerTheme(content: @Composable () -> Unit) {
val darkTheme = isSystemInDarkTheme()
val context = LocalContext.current
val colorScheme = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
} else {
if (darkTheme) DarkColors else LightColors
}
MaterialTheme(
colorScheme = colorScheme,
content = content
)
}
@@ -1,45 +0,0 @@
package com.clean.scanner.util
import com.clean.scanner.domain.UrlRiskResult
import java.net.URI
object UrlRiskScorer {
fun score(raw: String): UrlRiskResult {
val uri = runCatching { URI(raw.trim()) }.getOrNull() ?: return UrlRiskResult(0, emptyList())
val host = uri.host.orEmpty()
val reasons = mutableListOf<String>()
var score = 0
if (host.matches(Regex("^\\d{1,3}(\\.\\d{1,3}){3}$"))) {
score += 2
reasons += "Host is an IP address"
}
if (uri.scheme.equals("http", ignoreCase = true)) {
score += 2
reasons += "URL uses HTTP"
}
if (host.contains("xn--", ignoreCase = true)) {
score += 2
reasons += "Host contains punycode"
}
if (host.length > 40) {
score += 1
reasons += "Host is unusually long"
}
if ((uri.rawQuery?.length ?: 0) > 120) {
score += 1
reasons += "Query is unusually long"
}
val percentEncodedCount = Regex("%[0-9a-fA-F]{2}").findAll(raw).count()
if (percentEncodedCount > 10) {
score += 1
reasons += "Many percent-encodings"
}
if (!uri.userInfo.isNullOrBlank()) {
score += 2
reasons += "Contains userinfo"
}
return UrlRiskResult(score = score, reasons = reasons)
}
}
@@ -1,10 +1,10 @@
package com.clean.scanner package de.softwareapp_hb.privateqrscanner
import android.content.Context import android.content.Context
import androidx.room.Room import androidx.room.Room
import com.clean.scanner.data.local.CleanScannerDatabase import de.softwareapp_hb.privateqrscanner.data.local.CleanScannerDatabase
import com.clean.scanner.data.repository.ScanRepository import de.softwareapp_hb.privateqrscanner.data.repository.ScanRepository
import com.clean.scanner.settings.SettingsRepository import de.softwareapp_hb.privateqrscanner.settings.SettingsRepository
class AppContainer(context: Context) { class AppContainer(context: Context) {
private val appContext = context.applicationContext private val appContext = context.applicationContext
@@ -1,4 +1,4 @@
package com.clean.scanner package de.softwareapp_hb.privateqrscanner
import android.app.Application import android.app.Application
@@ -1,12 +1,12 @@
package com.clean.scanner package de.softwareapp_hb.privateqrscanner
import android.os.Bundle import android.os.Bundle
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import com.clean.scanner.ui.CleanScannerAppRoot import de.softwareapp_hb.privateqrscanner.ui.CleanScannerAppRoot
import com.clean.scanner.ui.theme.CleanScannerTheme import de.softwareapp_hb.privateqrscanner.ui.theme.CleanScannerTheme
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@@ -1,4 +1,4 @@
package com.clean.scanner.data.local package de.softwareapp_hb.privateqrscanner.data.local
import androidx.room.Database import androidx.room.Database
import androidx.room.RoomDatabase import androidx.room.RoomDatabase
@@ -1,4 +1,4 @@
package com.clean.scanner.data.local package de.softwareapp_hb.privateqrscanner.data.local
import androidx.room.Dao import androidx.room.Dao
import androidx.room.Insert import androidx.room.Insert
@@ -1,4 +1,4 @@
package com.clean.scanner.data.local package de.softwareapp_hb.privateqrscanner.data.local
import androidx.room.Entity import androidx.room.Entity
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
@@ -1,9 +1,9 @@
package com.clean.scanner.data.repository package de.softwareapp_hb.privateqrscanner.data.repository
import com.clean.scanner.data.local.ScanDao import de.softwareapp_hb.privateqrscanner.data.local.ScanDao
import com.clean.scanner.data.local.ScanEntity import de.softwareapp_hb.privateqrscanner.data.local.ScanEntity
import com.clean.scanner.domain.ScanRecord import de.softwareapp_hb.privateqrscanner.domain.ScanRecord
import com.clean.scanner.settings.SettingsRepository import de.softwareapp_hb.privateqrscanner.settings.SettingsRepository
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
@@ -1,10 +1,11 @@
package com.clean.scanner.data.scanner package de.softwareapp_hb.privateqrscanner.data.scanner
import android.graphics.Rect import android.graphics.Rect
import android.os.SystemClock import android.os.SystemClock
import androidx.camera.core.ImageAnalysis import androidx.camera.core.ImageAnalysis
import androidx.camera.core.ImageProxy import androidx.camera.core.ImageProxy
import com.clean.scanner.domain.ScanResult import de.softwareapp_hb.privateqrscanner.domain.ScanResult
import de.softwareapp_hb.privateqrscanner.util.readableBarcodePayload
import com.google.mlkit.vision.barcode.BarcodeScanning import com.google.mlkit.vision.barcode.BarcodeScanning
import com.google.mlkit.vision.barcode.BarcodeScannerOptions import com.google.mlkit.vision.barcode.BarcodeScannerOptions
import com.google.mlkit.vision.barcode.common.Barcode import com.google.mlkit.vision.barcode.common.Barcode
@@ -46,10 +47,10 @@ class MlKitBarcodeAnalyzer(
) : ImageAnalysis.Analyzer, AutoCloseable { ) : ImageAnalysis.Analyzer, AutoCloseable {
private companion object { private companion object {
const val MATCH_DISTANCE_THRESHOLD = 0.18f const val MATCH_DISTANCE_THRESHOLD = 0.18f
const val BOX_SMOOTHING_ALPHA = 0.35f const val BOX_SMOOTHING_ALPHA = 0.65f
const val MAX_MISSED_FRAMES = 2 const val MAX_MISSED_FRAMES = 1
const val MIN_ANALYSIS_INTERVAL_MS = 45L const val MIN_ANALYSIS_INTERVAL_MS = 30L
const val MIN_STATE_PUBLISH_INTERVAL_MS = 66L const val MIN_STATE_PUBLISH_INTERVAL_MS = 33L
} }
private val scanner = BarcodeScanning.getClient( private val scanner = BarcodeScanning.getClient(
@@ -116,7 +117,7 @@ class MlKitBarcodeAnalyzer(
scanner.process(image) scanner.process(image)
.addOnSuccessListener { barcodes -> .addOnSuccessListener { barcodes ->
val readable = barcodes.firstOrNull { !it.rawValue.isNullOrBlank() } val readable = barcodes.firstOrNull { it.readableBarcodePayload() != null }
val boxes = barcodes.mapNotNull { barcode -> val boxes = barcodes.mapNotNull { barcode ->
val bounds = barcode.boundingBox ?: return@mapNotNull null val bounds = barcode.boundingBox ?: return@mapNotNull null
val normalized = normalizeBoundingBox( val normalized = normalizeBoundingBox(
@@ -143,6 +144,7 @@ class MlKitBarcodeAnalyzer(
sourceHeight = sourceHeight sourceHeight = sourceHeight
) )
if (readable != null) { if (readable != null) {
val payload = readable.readableBarcodePayload() ?: return@addOnSuccessListener
val readableBox = readable.boundingBox?.let { bounds -> val readableBox = readable.boundingBox?.let { bounds ->
val normalized = normalizeBoundingBox( val normalized = normalizeBoundingBox(
rect = bounds, rect = bounds,
@@ -164,8 +166,9 @@ class MlKitBarcodeAnalyzer(
} }
onDetected( onDetected(
ScanResult( ScanResult(
content = readable.rawValue.orEmpty(), content = payload.content,
type = readable.valueType.toHumanType() type = readable.valueType.toHumanType(),
isBase64Encoded = payload.isBase64Encoded
), ),
gatedReadableBox, gatedReadableBox,
sourceWidth, sourceWidth,
@@ -1,4 +1,4 @@
package com.clean.scanner.domain package de.softwareapp_hb.privateqrscanner.domain
data class ScanRecord( data class ScanRecord(
val id: Long, val id: Long,
@@ -0,0 +1,14 @@
package de.softwareapp_hb.privateqrscanner.domain
data class ScanResult(
val content: String,
val type: String,
val isBase64Encoded: Boolean = false
) {
val displayType: String
get() = if (isBase64Encoded && !type.contains("base64", ignoreCase = true)) {
"$type (Base64)"
} else {
type
}
}
@@ -1,4 +1,4 @@
package com.clean.scanner.domain package de.softwareapp_hb.privateqrscanner.domain
data class UrlRiskResult( data class UrlRiskResult(
val score: Int, val score: Int,
@@ -1,9 +1,11 @@
package com.clean.scanner.settings package de.softwareapp_hb.privateqrscanner.settings
import android.content.Context import android.content.Context
import androidx.datastore.preferences.core.booleanPreferencesKey import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.preferencesDataStore import androidx.datastore.preferences.preferencesDataStore
import de.softwareapp_hb.privateqrscanner.ui.UseCaseView
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
@@ -14,6 +16,7 @@ class SettingsRepository(private val context: Context) {
val historyEnabled = booleanPreferencesKey("history_enabled") val historyEnabled = booleanPreferencesKey("history_enabled")
val warningsEnabled = booleanPreferencesKey("warnings_enabled") val warningsEnabled = booleanPreferencesKey("warnings_enabled")
val scanFeedbackEnabled = booleanPreferencesKey("scan_feedback_enabled") val scanFeedbackEnabled = booleanPreferencesKey("scan_feedback_enabled")
val useCaseView = stringPreferencesKey("use_case_view")
} }
val historyEnabled: Flow<Boolean> = context.dataStore.data.map { prefs -> val historyEnabled: Flow<Boolean> = context.dataStore.data.map { prefs ->
@@ -28,6 +31,10 @@ class SettingsRepository(private val context: Context) {
prefs[Keys.scanFeedbackEnabled] ?: true prefs[Keys.scanFeedbackEnabled] ?: true
} }
val useCaseView: Flow<UseCaseView> = context.dataStore.data.map { prefs ->
UseCaseView.fromStorageKey(prefs[Keys.useCaseView])
}
suspend fun setHistoryEnabled(enabled: Boolean) { suspend fun setHistoryEnabled(enabled: Boolean) {
context.dataStore.edit { it[Keys.historyEnabled] = enabled } context.dataStore.edit { it[Keys.historyEnabled] = enabled }
} }
@@ -39,4 +46,8 @@ class SettingsRepository(private val context: Context) {
suspend fun setScanFeedbackEnabled(enabled: Boolean) { suspend fun setScanFeedbackEnabled(enabled: Boolean) {
context.dataStore.edit { it[Keys.scanFeedbackEnabled] = enabled } context.dataStore.edit { it[Keys.scanFeedbackEnabled] = enabled }
} }
suspend fun setUseCaseView(useCaseView: UseCaseView) {
context.dataStore.edit { it[Keys.useCaseView] = useCaseView.storageKey }
}
} }
@@ -1,10 +1,10 @@
package com.clean.scanner.ui package de.softwareapp_hb.privateqrscanner.ui
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.clean.scanner.AppContainer import de.softwareapp_hb.privateqrscanner.AppContainer
import com.clean.scanner.domain.ScanRecord import de.softwareapp_hb.privateqrscanner.domain.ScanRecord
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
@@ -16,6 +16,7 @@ data class AppUiState(
val historyEnabled: Boolean = false, val historyEnabled: Boolean = false,
val warningsEnabled: Boolean = true, val warningsEnabled: Boolean = true,
val scanFeedbackEnabled: Boolean = true, val scanFeedbackEnabled: Boolean = true,
val useCaseView: UseCaseView = UseCaseView.default,
val history: List<ScanRecord> = emptyList(), val history: List<ScanRecord> = emptyList(),
val searchQuery: String = "" val searchQuery: String = ""
) )
@@ -24,19 +25,39 @@ class AppViewModel(
private val container: AppContainer private val container: AppContainer
) : ViewModel() { ) : ViewModel() {
private data class SettingsState(
val historyEnabled: Boolean,
val warningsEnabled: Boolean,
val scanFeedbackEnabled: Boolean,
val useCaseView: UseCaseView
)
private val query = MutableStateFlow("") private val query = MutableStateFlow("")
val uiState: StateFlow<AppUiState> = combine( private val settingsState = combine(
container.settingsRepository.historyEnabled, container.settingsRepository.historyEnabled,
container.settingsRepository.warningsEnabled, container.settingsRepository.warningsEnabled,
container.settingsRepository.scanFeedbackEnabled, container.settingsRepository.scanFeedbackEnabled,
container.scanRepository.observeHistory(), container.settingsRepository.useCaseView
query ) { historyEnabled, warningsEnabled, scanFeedbackEnabled, useCaseView ->
) { historyEnabled, warningsEnabled, scanFeedbackEnabled, history, q -> SettingsState(
AppUiState(
historyEnabled = historyEnabled, historyEnabled = historyEnabled,
warningsEnabled = warningsEnabled, warningsEnabled = warningsEnabled,
scanFeedbackEnabled = scanFeedbackEnabled, scanFeedbackEnabled = scanFeedbackEnabled,
useCaseView = useCaseView
)
}
val uiState: StateFlow<AppUiState> = combine(
settingsState,
container.scanRepository.observeHistory(),
query
) { settings, history, q ->
AppUiState(
historyEnabled = settings.historyEnabled,
warningsEnabled = settings.warningsEnabled,
scanFeedbackEnabled = settings.scanFeedbackEnabled,
useCaseView = settings.useCaseView,
history = if (q.isBlank()) history else history.filter { history = if (q.isBlank()) history else history.filter {
it.content.contains(q, ignoreCase = true) || it.type.contains(q, ignoreCase = true) it.content.contains(q, ignoreCase = true) || it.type.contains(q, ignoreCase = true)
}, },
@@ -69,6 +90,12 @@ class AppViewModel(
} }
} }
fun setUseCaseView(useCaseView: UseCaseView) {
viewModelScope.launch {
container.settingsRepository.setUseCaseView(useCaseView)
}
}
fun deleteHistoryItem(id: Long) { fun deleteHistoryItem(id: Long) {
viewModelScope.launch { viewModelScope.launch {
container.scanRepository.deleteById(id) container.scanRepository.deleteById(id)
@@ -1,9 +1,15 @@
package com.clean.scanner.ui package de.softwareapp_hb.privateqrscanner.ui
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.History
import androidx.compose.material.icons.filled.QrCodeScanner
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.Icon
import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.NavigationBarItemDefaults
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@@ -15,11 +21,12 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
import com.clean.scanner.AppContainer import de.softwareapp_hb.privateqrscanner.AppContainer
import com.clean.scanner.R import de.softwareapp_hb.privateqrscanner.R
import com.clean.scanner.ui.screens.HistoryScreen import de.softwareapp_hb.privateqrscanner.ui.screens.HistoryScreen
import com.clean.scanner.ui.screens.ScannerScreen import de.softwareapp_hb.privateqrscanner.ui.screens.ScannerScreen
import com.clean.scanner.ui.screens.SettingsScreen import de.softwareapp_hb.privateqrscanner.ui.screens.SettingsScreen
import de.softwareapp_hb.privateqrscanner.ui.theme.PrivateQrColors
private enum class RootTab { Scanner, History, Settings } private enum class RootTab { Scanner, History, Settings }
@@ -33,8 +40,16 @@ fun CleanScannerAppRoot(container: AppContainer) {
var activeTab by remember { mutableStateOf(RootTab.Scanner) } var activeTab by remember { mutableStateOf(RootTab.Scanner) }
Scaffold( Scaffold(
containerColor = PrivateQrColors.AppBackground,
bottomBar = { bottomBar = {
NavigationBar { val navColors = NavigationBarItemDefaults.colors(
selectedIconColor = PrivateQrColors.Teal700,
selectedTextColor = PrivateQrColors.Teal700,
indicatorColor = PrivateQrColors.Mint,
unselectedIconColor = PrivateQrColors.TextSecondary,
unselectedTextColor = PrivateQrColors.TextSecondary
)
NavigationBar(containerColor = PrivateQrColors.Surface) {
NavigationBarItem( NavigationBarItem(
selected = activeTab == RootTab.Scanner, selected = activeTab == RootTab.Scanner,
onClick = { onClick = {
@@ -42,7 +57,8 @@ fun CleanScannerAppRoot(container: AppContainer) {
scannerViewModel.resumeScanning() scannerViewModel.resumeScanning()
}, },
label = { Text(stringResource(R.string.scan)) }, label = { Text(stringResource(R.string.scan)) },
icon = {} icon = { Icon(Icons.Default.QrCodeScanner, contentDescription = null) },
colors = navColors
) )
NavigationBarItem( NavigationBarItem(
selected = activeTab == RootTab.History, selected = activeTab == RootTab.History,
@@ -50,7 +66,8 @@ fun CleanScannerAppRoot(container: AppContainer) {
activeTab = RootTab.History activeTab = RootTab.History
}, },
label = { Text(stringResource(R.string.history)) }, label = { Text(stringResource(R.string.history)) },
icon = {} icon = { Icon(Icons.Default.History, contentDescription = null) },
colors = navColors
) )
NavigationBarItem( NavigationBarItem(
selected = activeTab == RootTab.Settings, selected = activeTab == RootTab.Settings,
@@ -58,7 +75,8 @@ fun CleanScannerAppRoot(container: AppContainer) {
activeTab = RootTab.Settings activeTab = RootTab.Settings
}, },
label = { Text(stringResource(R.string.settings)) }, label = { Text(stringResource(R.string.settings)) },
icon = {} icon = { Icon(Icons.Default.Settings, contentDescription = null) },
colors = navColors
) )
} }
} }
@@ -70,11 +88,17 @@ fun CleanScannerAppRoot(container: AppContainer) {
lastResult = scannerState.lastResult, lastResult = scannerState.lastResult,
batchMode = scannerState.batchMode, batchMode = scannerState.batchMode,
batchResults = scannerState.batchResults, batchResults = scannerState.batchResults,
eventTicketWhitelistCount = scannerState.eventTicketWhitelistCount,
duplicateFeedbackNonce = scannerState.duplicateFeedbackNonce, duplicateFeedbackNonce = scannerState.duplicateFeedbackNonce,
scanFeedbackNonce = scannerState.scanFeedbackNonce, scanFeedbackNonce = scannerState.scanFeedbackNonce,
warningsEnabled = appState.warningsEnabled, warningsEnabled = appState.warningsEnabled,
scanFeedbackEnabled = appState.scanFeedbackEnabled, scanFeedbackEnabled = appState.scanFeedbackEnabled,
useCaseView = appState.useCaseView,
onScan = scannerViewModel::onScan, onScan = scannerViewModel::onScan,
onEvaluateEventTicketScan = scannerViewModel::evaluateEventTicketScan,
onAuditDuplicateTicket = scannerViewModel::auditDuplicateTicketScan,
onAuditUnregisteredTicket = scannerViewModel::auditUnregisteredTicketScan,
onReplaceEventTicketWhitelist = scannerViewModel::replaceEventTicketWhitelist,
onScanAgain = scannerViewModel::resumeScanning, onScanAgain = scannerViewModel::resumeScanning,
onBatchModeChange = scannerViewModel::setBatchMode, onBatchModeChange = scannerViewModel::setBatchMode,
onClearBatchResults = scannerViewModel::clearBatchResults, onClearBatchResults = scannerViewModel::clearBatchResults,
@@ -84,18 +108,27 @@ fun CleanScannerAppRoot(container: AppContainer) {
RootTab.History -> HistoryScreen( RootTab.History -> HistoryScreen(
query = appState.searchQuery, query = appState.searchQuery,
history = appState.history, history = appState.history,
useCaseView = appState.useCaseView,
historyEnabled = appState.historyEnabled,
warningsEnabled = appState.warningsEnabled,
scanFeedbackEnabled = appState.scanFeedbackEnabled,
onQueryChange = appViewModel::setQuery, onQueryChange = appViewModel::setQuery,
onDelete = appViewModel::deleteHistoryItem, onDelete = appViewModel::deleteHistoryItem,
onClearAll = appViewModel::clearHistory onClearAll = appViewModel::clearHistory,
onHistoryToggle = appViewModel::setHistoryEnabled,
onWarningsToggle = appViewModel::setWarningsEnabled,
onScanFeedbackToggle = appViewModel::setScanFeedbackEnabled
) )
RootTab.Settings -> SettingsScreen( RootTab.Settings -> SettingsScreen(
historyEnabled = appState.historyEnabled, historyEnabled = appState.historyEnabled,
warningsEnabled = appState.warningsEnabled, warningsEnabled = appState.warningsEnabled,
scanFeedbackEnabled = appState.scanFeedbackEnabled, scanFeedbackEnabled = appState.scanFeedbackEnabled,
selectedUseCaseView = appState.useCaseView,
onHistoryToggle = appViewModel::setHistoryEnabled, onHistoryToggle = appViewModel::setHistoryEnabled,
onWarningsToggle = appViewModel::setWarningsEnabled, onWarningsToggle = appViewModel::setWarningsEnabled,
onScanFeedbackToggle = appViewModel::setScanFeedbackEnabled onScanFeedbackToggle = appViewModel::setScanFeedbackEnabled,
onUseCaseViewSelected = appViewModel::setUseCaseView
) )
} }
} }
@@ -1,10 +1,10 @@
package com.clean.scanner.ui package de.softwareapp_hb.privateqrscanner.ui
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.clean.scanner.AppContainer import de.softwareapp_hb.privateqrscanner.AppContainer
import com.clean.scanner.domain.ScanResult import de.softwareapp_hb.privateqrscanner.domain.ScanResult
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
@@ -21,11 +21,19 @@ data class ScannerUiState(
val lastScanTimestamp: Long = 0L, val lastScanTimestamp: Long = 0L,
val batchMode: Boolean = false, val batchMode: Boolean = false,
val batchResults: List<BatchScanRecord> = emptyList(), val batchResults: List<BatchScanRecord> = emptyList(),
val eventTicketWhitelistCount: Int = 0,
val recentScanKeys: List<String> = emptyList(), val recentScanKeys: List<String> = emptyList(),
val duplicateFeedbackNonce: Int = 0, val duplicateFeedbackNonce: Int = 0,
val scanFeedbackNonce: Int = 0 val scanFeedbackNonce: Int = 0
) )
enum class EventTicketScanDecision {
Accept,
Unregistered,
DuplicateAlert,
Ignore
}
class ScannerViewModel( class ScannerViewModel(
private val saveScan: suspend (content: String, type: String) -> Unit, private val saveScan: suspend (content: String, type: String) -> Unit,
private val nowProvider: () -> Long = { System.currentTimeMillis() } private val nowProvider: () -> Long = { System.currentTimeMillis() }
@@ -33,12 +41,17 @@ class ScannerViewModel(
private companion object { private companion object {
const val GENERAL_DEBOUNCE_MS = 800L const val GENERAL_DEBOUNCE_MS = 800L
const val SAME_CODE_HOLDOFF_MS = 2500L const val SAME_CODE_HOLDOFF_MS = 2500L
const val EVENT_TICKET_HOLDOFF_MS = 30_000L
} }
private val _uiState = MutableStateFlow(ScannerUiState()) private val _uiState = MutableStateFlow(ScannerUiState())
val uiState: StateFlow<ScannerUiState> = _uiState.asStateFlow() val uiState: StateFlow<ScannerUiState> = _uiState.asStateFlow()
private val recentScanKeySet = LinkedHashSet<String>(200) private val recentScanKeySet = LinkedHashSet<String>(200)
private val batchKeySet = LinkedHashSet<String>(100) private val batchKeySet = LinkedHashSet<String>(100)
private val eventTicketSeenKeys = HashSet<String>()
private val eventTicketWhitelistIds = HashSet<String>()
private val eventTicketDuplicateCooldowns = HashMap<String, Long>()
private val eventTicketRecentlyAccepted = HashMap<String, Long>()
private var lastAcceptedKey: String? = null private var lastAcceptedKey: String? = null
private var lastAcceptedTimestamp: Long = 0L private var lastAcceptedTimestamp: Long = 0L
@@ -47,7 +60,7 @@ class ScannerViewModel(
val current = _uiState.value val current = _uiState.value
if (!current.analysisEnabled) return if (!current.analysisEnabled) return
val key = "${result.type}|${result.content}" val key = "${result.displayType}|${result.content}"
if (now - current.lastScanTimestamp < GENERAL_DEBOUNCE_MS) return if (now - current.lastScanTimestamp < GENERAL_DEBOUNCE_MS) return
if (key == lastAcceptedKey && now - lastAcceptedTimestamp < SAME_CODE_HOLDOFF_MS) return if (key == lastAcceptedKey && now - lastAcceptedTimestamp < SAME_CODE_HOLDOFF_MS) return
@@ -94,7 +107,7 @@ class ScannerViewModel(
} }
viewModelScope.launch { viewModelScope.launch {
saveScan(result.content, result.type) saveScan(result.content, result.displayType)
} }
} }
@@ -112,9 +125,61 @@ class ScannerViewModel(
fun clearBatchResults() { fun clearBatchResults() {
batchKeySet.clear() batchKeySet.clear()
eventTicketSeenKeys.clear()
eventTicketDuplicateCooldowns.clear()
eventTicketRecentlyAccepted.clear()
_uiState.value = _uiState.value.copy(batchResults = emptyList()) _uiState.value = _uiState.value.copy(batchResults = emptyList())
} }
fun auditDuplicateTicketScan(result: ScanResult) {
viewModelScope.launch {
saveScan(result.content, "Duplicate ticket (${result.displayType})")
}
}
fun auditUnregisteredTicketScan(result: ScanResult) {
viewModelScope.launch {
saveScan(result.content, "Unregistered ticket (${result.displayType})")
}
}
fun replaceEventTicketWhitelist(ids: Set<String>) {
eventTicketWhitelistIds.clear()
eventTicketWhitelistIds.addAll(ids.map(::normalizeWhitelistId).filter { it.isNotBlank() })
_uiState.value = _uiState.value.copy(eventTicketWhitelistCount = eventTicketWhitelistIds.size)
}
fun evaluateEventTicketScan(result: ScanResult): EventTicketScanDecision {
val key = "${result.displayType}|${result.content}"
val normalizedContent = normalizeWhitelistId(result.content)
val now = nowProvider()
if (eventTicketWhitelistIds.isNotEmpty() && normalizedContent !in eventTicketWhitelistIds) {
return EventTicketScanDecision.Unregistered
}
if (key !in eventTicketSeenKeys) {
eventTicketSeenKeys.add(key)
eventTicketRecentlyAccepted[key] = now
return EventTicketScanDecision.Accept
}
val acceptedAt = eventTicketRecentlyAccepted[key] ?: 0L
if (now - acceptedAt < EVENT_TICKET_HOLDOFF_MS) {
return EventTicketScanDecision.Ignore
}
val cooldownUntil = eventTicketDuplicateCooldowns[key] ?: 0L
if (now < cooldownUntil) {
return EventTicketScanDecision.Ignore
}
eventTicketDuplicateCooldowns[key] = now + EVENT_TICKET_HOLDOFF_MS
return EventTicketScanDecision.DuplicateAlert
}
private fun normalizeWhitelistId(value: String): String {
return value.trim().lowercase()
}
class Factory(private val container: AppContainer) : ViewModelProvider.Factory { class Factory(private val container: AppContainer) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(modelClass: Class<T>): T { override fun <T : ViewModel> create(modelClass: Class<T>): T {
@@ -0,0 +1,69 @@
package de.softwareapp_hb.privateqrscanner.ui
import de.softwareapp_hb.privateqrscanner.R
enum class UseCaseView(
val storageKey: String,
val titleRes: Int
) {
EverydayPersonal(
storageKey = "everyday_personal",
titleRes = R.string.use_case_everyday_personal
),
EventTicketing(
storageKey = "event_ticketing",
titleRes = R.string.use_case_event_ticketing
);
companion object {
val default = EverydayPersonal
fun fromStorageKey(value: String?): UseCaseView {
return entries.firstOrNull { it.storageKey == value } ?: default
}
}
}
data class UseCaseCapabilities(
val allowScanFromImage: Boolean = true,
val allowBatchMode: Boolean = false,
val allowCopy: Boolean = true,
val allowShare: Boolean = true,
val allowOpenUrl: Boolean = true,
val allowAddContact: Boolean = false,
val allowDialPhone: Boolean = false,
val allowSendSms: Boolean = false,
val allowSendEmail: Boolean = false,
val allowOpenWifiSettings: Boolean = false,
val allowAddCalendarEvent: Boolean = false,
val allowHistoryExport: Boolean = false,
val allowBatchShare: Boolean = true
)
fun UseCaseView.capabilities(): UseCaseCapabilities {
return when (this) {
UseCaseView.EverydayPersonal -> UseCaseCapabilities(
allowScanFromImage = true,
allowBatchMode = false,
allowCopy = true,
allowShare = true,
allowOpenUrl = true,
allowAddContact = true,
allowDialPhone = true,
allowSendSms = true,
allowSendEmail = true,
allowOpenWifiSettings = true,
allowAddCalendarEvent = true,
allowHistoryExport = true
)
UseCaseView.EventTicketing -> UseCaseCapabilities(
allowScanFromImage = false,
allowBatchMode = true,
allowCopy = true,
allowShare = true,
allowOpenUrl = false,
allowBatchShare = true
)
}
}
@@ -1,4 +1,4 @@
package com.clean.scanner.ui.components package de.softwareapp_hb.privateqrscanner.ui.components
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.util.Size import android.util.Size
@@ -7,6 +7,8 @@ import android.view.ScaleGestureDetector
import androidx.camera.core.CameraSelector import androidx.camera.core.CameraSelector
import androidx.camera.core.ImageAnalysis import androidx.camera.core.ImageAnalysis
import androidx.camera.core.Preview import androidx.camera.core.Preview
import androidx.camera.core.resolutionselector.ResolutionSelector
import androidx.camera.core.resolutionselector.ResolutionStrategy
import androidx.camera.core.UseCaseGroup import androidx.camera.core.UseCaseGroup
import androidx.camera.lifecycle.ProcessCameraProvider import androidx.camera.lifecycle.ProcessCameraProvider
import androidx.camera.view.PreviewView import androidx.camera.view.PreviewView
@@ -22,8 +24,9 @@ import androidx.compose.ui.platform.LocalContext
import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.clean.scanner.data.scanner.DetectionBox import de.softwareapp_hb.privateqrscanner.data.scanner.DetectionBox
import com.clean.scanner.data.scanner.MlKitBarcodeAnalyzer import de.softwareapp_hb.privateqrscanner.data.scanner.MlKitBarcodeAnalyzer
import de.softwareapp_hb.privateqrscanner.domain.ScanResult
import java.util.concurrent.ExecutorService import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors import java.util.concurrent.Executors
import kotlin.math.max import kotlin.math.max
@@ -43,7 +46,7 @@ fun CameraPreview(
sourceWidth: Int, sourceWidth: Int,
sourceHeight: Int sourceHeight: Int
) -> Unit = { _, _, _, _, _ -> }, ) -> Unit = { _, _, _, _, _ -> },
onScan: (String, String, DetectionBox?, Int, Int) -> Unit onScan: (ScanResult, DetectionBox?, Int, Int) -> Unit
) { ) {
val context = LocalContext.current val context = LocalContext.current
val lifecycleOwner = LocalLifecycleOwner.current val lifecycleOwner = LocalLifecycleOwner.current
@@ -70,7 +73,7 @@ fun CameraPreview(
} }
}, },
onDetected = { result, readableBox, sourceWidth, sourceHeight -> onDetected = { result, readableBox, sourceWidth, sourceHeight ->
latestOnScan.value(result.content, result.type, readableBox, sourceWidth, sourceHeight) latestOnScan.value(result, readableBox, sourceWidth, sourceHeight)
} }
) )
} }
@@ -81,9 +84,9 @@ fun CameraPreview(
override fun onScale(detector: ScaleGestureDetector): Boolean { override fun onScale(detector: ScaleGestureDetector): Boolean {
val camera = cameraRef.value ?: return false val camera = cameraRef.value ?: return false
val zoomState = camera.cameraInfo.zoomState.value ?: return false val zoomState = camera.cameraInfo.zoomState.value ?: return false
val nextZoom = zoomRatio.value * detector.scaleFactor val nextZoom = zoomRatio.floatValue * detector.scaleFactor
val clampedZoom = max(zoomState.minZoomRatio, min(nextZoom, zoomState.maxZoomRatio)) val clampedZoom = max(zoomState.minZoomRatio, min(nextZoom, zoomState.maxZoomRatio))
zoomRatio.value = clampedZoom zoomRatio.floatValue = clampedZoom
camera.cameraControl.setZoomRatio(clampedZoom) camera.cameraControl.setZoomRatio(clampedZoom)
return true return true
} }
@@ -104,12 +107,21 @@ fun CameraPreview(
provider.unbindAll() provider.unbindAll()
val preview = Preview.Builder().build().apply { val preview = Preview.Builder().build().apply {
setSurfaceProvider(previewView.surfaceProvider) surfaceProvider = previewView.surfaceProvider
} }
val imageAnalysis = ImageAnalysis.Builder() val imageAnalysis = ImageAnalysis.Builder()
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST) .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.setTargetResolution(Size(1280, 720)) .setResolutionSelector(
ResolutionSelector.Builder()
.setResolutionStrategy(
ResolutionStrategy(
Size(1280, 720),
ResolutionStrategy.FALLBACK_RULE_CLOSEST_HIGHER_THEN_LOWER
)
)
.build()
)
.build().apply { .build().apply {
setAnalyzer(cameraExecutor, analyzer) setAnalyzer(cameraExecutor, analyzer)
} }
@@ -134,7 +146,7 @@ fun CameraPreview(
onTorchAvailabilityChanged(camera.cameraInfo.hasFlashUnit()) onTorchAvailabilityChanged(camera.cameraInfo.hasFlashUnit())
cameraRef.value = camera cameraRef.value = camera
zoomRatio.value = camera.cameraInfo.zoomState.value?.zoomRatio ?: 1f zoomRatio.floatValue = camera.cameraInfo.zoomState.value?.zoomRatio ?: 1f
} }
LaunchedEffect(torchEnabled) { LaunchedEffect(torchEnabled) {
@@ -1,4 +1,4 @@
package com.clean.scanner.ui.screens package de.softwareapp_hb.privateqrscanner.ui.screens
import com.google.mlkit.vision.barcode.common.Barcode import com.google.mlkit.vision.barcode.common.Barcode
@@ -0,0 +1,683 @@
package de.softwareapp_hb.privateqrscanner.ui.screens
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Email
import androidx.compose.material.icons.filled.History
import androidx.compose.material.icons.filled.Link
import androidx.compose.material.icons.filled.Search
import androidx.compose.material.icons.filled.Wifi
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.SwipeToDismissBox
import androidx.compose.material3.SwipeToDismissBoxValue
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.rememberSwipeToDismissBoxState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import de.softwareapp_hb.privateqrscanner.R
import de.softwareapp_hb.privateqrscanner.domain.ScanRecord
import de.softwareapp_hb.privateqrscanner.ui.UseCaseView
import de.softwareapp_hb.privateqrscanner.ui.capabilities
import de.softwareapp_hb.privateqrscanner.ui.theme.PrivateQrColors
import de.softwareapp_hb.privateqrscanner.util.HistoryExportFormatter
import de.softwareapp_hb.privateqrscanner.util.Intents
import java.text.DateFormat
import java.util.Date
@Composable
fun HistoryScreen(
query: String,
history: List<ScanRecord>,
useCaseView: UseCaseView,
historyEnabled: Boolean,
warningsEnabled: Boolean,
scanFeedbackEnabled: Boolean,
onQueryChange: (String) -> Unit,
onDelete: (Long) -> Unit,
onClearAll: () -> Unit,
onHistoryToggle: (Boolean, Boolean) -> Unit,
onWarningsToggle: (Boolean) -> Unit,
onScanFeedbackToggle: (Boolean) -> Unit
) {
val context = LocalContext.current
val capabilities = useCaseView.capabilities()
val showDeleteAll = remember { mutableStateOf(false) }
val selectedItem = remember { mutableStateOf<ScanRecord?>(null) }
if (showDeleteAll.value) {
AlertDialog(
onDismissRequest = { showDeleteAll.value = false },
title = { Text(stringResource(R.string.delete_all)) },
text = { Text(stringResource(R.string.confirm_delete_all)) },
confirmButton = {
TextButton(onClick = {
onClearAll()
showDeleteAll.value = false
}) { Text(stringResource(R.string.confirm)) }
},
dismissButton = {
TextButton(onClick = { showDeleteAll.value = false }) {
Text(stringResource(R.string.cancel))
}
}
)
}
val detail = selectedItem.value
if (detail != null) {
val detailIsBase64 = detail.isBase64Encoded()
AlertDialog(
onDismissRequest = { selectedItem.value = null },
title = { Text(text = detail.type) },
text = {
if (detailIsBase64) {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(text = stringResource(R.string.base64_encoded_notice))
Text(text = detail.content)
}
} else {
Text(text = detail.content)
}
},
confirmButton = {
TextButton(onClick = { selectedItem.value = null }) {
Text(text = stringResource(R.string.confirm))
}
}
)
}
BoxWithConstraints(
modifier = Modifier
.fillMaxSize()
.background(PrivateQrColors.AppBackground)
) {
val wideLayout = maxWidth >= 600.dp
if (wideLayout) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 20.dp),
verticalArrangement = Arrangement.spacedBy(18.dp)
) {
Spacer(modifier = Modifier.height(18.dp))
HistoryHeader()
Row(
modifier = Modifier
.fillMaxWidth()
.weight(1f),
horizontalArrangement = Arrangement.spacedBy(24.dp)
) {
Column(
modifier = Modifier
.weight(1.1f)
.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = stringResource(R.string.history),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.headlineMedium,
fontWeight = FontWeight.ExtraBold
)
TextButton(
onClick = { showDeleteAll.value = true },
enabled = history.isNotEmpty(),
colors = ButtonDefaults.textButtonColors(
contentColor = Color(0xFFBE123C),
disabledContentColor = PrivateQrColors.TextSecondary.copy(alpha = 0.45f)
)
) {
Text(stringResource(R.string.delete_all), fontWeight = FontWeight.Bold)
}
}
HistorySearchField(query = query, onQueryChange = onQueryChange)
HistoryList(
history = history,
onDelete = onDelete,
onOpenDetails = { selectedItem.value = it },
modifier = Modifier.weight(1f)
)
}
Column(
modifier = Modifier.weight(0.95f),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
Text(
text = stringResource(R.string.local_controls),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.headlineMedium,
fontWeight = FontWeight.ExtraBold
)
LocalControlsCard(
history = history,
historyEnabled = historyEnabled,
warningsEnabled = warningsEnabled,
scanFeedbackEnabled = scanFeedbackEnabled,
allowHistoryExport = capabilities.allowHistoryExport,
onHistoryToggle = onHistoryToggle,
onWarningsToggle = onWarningsToggle,
onScanFeedbackToggle = onScanFeedbackToggle
)
}
}
Spacer(modifier = Modifier.height(12.dp))
}
} else {
LazyColumn(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 20.dp),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
item {
Spacer(modifier = Modifier.height(18.dp))
HistoryHeader()
Spacer(modifier = Modifier.height(18.dp))
Text(
text = stringResource(R.string.history),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.headlineMedium,
fontWeight = FontWeight.ExtraBold
)
Spacer(modifier = Modifier.height(12.dp))
HistorySearchField(query = query, onQueryChange = onQueryChange)
Spacer(modifier = Modifier.height(10.dp))
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
if (capabilities.allowHistoryExport) {
ExportButton(
text = stringResource(R.string.share_txt),
enabled = history.isNotEmpty(),
onClick = {
val exportText = HistoryExportFormatter.formatText(history)
Intents.shareContent(context, exportText, "text/plain")
}
)
ExportButton(
text = stringResource(R.string.share_csv),
enabled = history.isNotEmpty(),
onClick = {
val exportCsv = HistoryExportFormatter.formatCsv(history)
Intents.shareContent(context, exportCsv, "text/csv")
}
)
ExportButton(
text = stringResource(R.string.share_json),
enabled = history.isNotEmpty(),
onClick = {
val exportJson = HistoryExportFormatter.formatJson(history)
Intents.shareContent(context, exportJson, "application/json")
}
)
}
Spacer(modifier = Modifier.weight(1f))
TextButton(
onClick = { showDeleteAll.value = true },
enabled = history.isNotEmpty(),
colors = ButtonDefaults.textButtonColors(
contentColor = Color(0xFFBE123C),
disabledContentColor = PrivateQrColors.TextSecondary.copy(alpha = 0.45f)
)
) {
Text(stringResource(R.string.delete_all), fontWeight = FontWeight.Bold)
}
}
Spacer(modifier = Modifier.height(4.dp))
}
if (history.isEmpty()) {
item {
EmptyHistoryCard()
}
} else {
items(history, key = { it.id }) { item ->
HistoryRow(
item = item,
onDelete = onDelete,
onOpenDetails = { selectedItem.value = item }
)
}
}
item {
Spacer(modifier = Modifier.height(24.dp))
}
}
}
}
}
@Composable
private fun HistorySearchField(
query: String,
onQueryChange: (String) -> Unit
) {
OutlinedTextField(
value = query,
onValueChange = onQueryChange,
modifier = Modifier.fillMaxWidth(),
leadingIcon = {
Icon(
imageVector = Icons.Default.Search,
contentDescription = null,
tint = PrivateQrColors.Teal700
)
},
placeholder = { Text(stringResource(R.string.search)) },
singleLine = true,
shape = RoundedCornerShape(20.dp),
colors = OutlinedTextFieldDefaults.colors(
focusedBorderColor = PrivateQrColors.Teal300,
unfocusedBorderColor = PrivateQrColors.Divider,
focusedContainerColor = PrivateQrColors.Surface,
unfocusedContainerColor = PrivateQrColors.Surface
)
)
}
@Composable
private fun HistoryList(
history: List<ScanRecord>,
onDelete: (Long) -> Unit,
onOpenDetails: (ScanRecord) -> Unit,
modifier: Modifier = Modifier
) {
LazyColumn(
modifier = modifier.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
if (history.isEmpty()) {
item {
EmptyHistoryCard()
}
} else {
items(history, key = { it.id }) { item ->
HistoryRow(
item = item,
onDelete = onDelete,
onOpenDetails = { onOpenDetails(item) }
)
}
}
}
}
@Composable
private fun LocalControlsCard(
history: List<ScanRecord>,
historyEnabled: Boolean,
warningsEnabled: Boolean,
scanFeedbackEnabled: Boolean,
allowHistoryExport: Boolean,
onHistoryToggle: (Boolean, Boolean) -> Unit,
onWarningsToggle: (Boolean) -> Unit,
onScanFeedbackToggle: (Boolean) -> Unit
) {
val context = LocalContext.current
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(containerColor = PrivateQrColors.Surface),
shape = RoundedCornerShape(28.dp),
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
) {
Column(
modifier = Modifier.padding(20.dp),
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
LocalControlRow(
title = stringResource(R.string.save_history),
checked = historyEnabled,
onCheckedChange = { onHistoryToggle(it, false) }
)
LocalControlRow(
title = stringResource(R.string.security_warnings),
checked = warningsEnabled,
onCheckedChange = onWarningsToggle
)
LocalControlRow(
title = stringResource(R.string.scan_feedback),
checked = scanFeedbackEnabled,
onCheckedChange = onScanFeedbackToggle
)
}
}
if (allowHistoryExport) {
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
ExportButton(
text = stringResource(R.string.share_txt),
enabled = history.isNotEmpty(),
onClick = {
Intents.shareContent(context, HistoryExportFormatter.formatText(history), "text/plain")
}
)
ExportButton(
text = stringResource(R.string.share_csv),
enabled = history.isNotEmpty(),
onClick = {
Intents.shareContent(context, HistoryExportFormatter.formatCsv(history), "text/csv")
}
)
ExportButton(
text = stringResource(R.string.share_json),
enabled = history.isNotEmpty(),
onClick = {
Intents.shareContent(context, HistoryExportFormatter.formatJson(history), "application/json")
}
)
}
}
}
@Composable
private fun LocalControlRow(
title: String,
checked: Boolean,
onCheckedChange: (Boolean) -> Unit
) {
Row(
modifier = Modifier
.fillMaxWidth()
.height(58.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = title,
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.ExtraBold
)
Switch(
checked = checked,
onCheckedChange = onCheckedChange,
colors = SwitchDefaults.colors(
checkedThumbColor = PrivateQrColors.Surface,
checkedTrackColor = PrivateQrColors.Teal700,
uncheckedThumbColor = PrivateQrColors.Surface,
uncheckedTrackColor = PrivateQrColors.TextSecondary.copy(alpha = 0.35f)
)
)
}
}
@Composable
private fun HistoryHeader() {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(14.dp),
verticalAlignment = Alignment.CenterVertically
) {
Image(
painter = painterResource(id = R.drawable.ic_launcher_legacy),
contentDescription = null,
modifier = Modifier.size(64.dp)
)
Column {
Text(
text = stringResource(R.string.app_name),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.headlineSmall,
fontWeight = FontWeight.ExtraBold
)
Text(
text = stringResource(R.string.history_header_subtitle),
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Bold
)
}
}
Spacer(modifier = Modifier.height(18.dp))
Card(
colors = CardDefaults.cardColors(containerColor = Color.Transparent),
shape = RoundedCornerShape(30.dp)
) {
Column(
modifier = Modifier
.background(
Brush.linearGradient(
colors = listOf(PrivateQrColors.Navy, PrivateQrColors.Teal900)
)
)
.padding(24.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
Text(
text = stringResource(R.string.history_hero_title),
color = PrivateQrColors.Surface,
style = MaterialTheme.typography.headlineMedium,
fontWeight = FontWeight.ExtraBold
)
Text(
text = stringResource(R.string.history_hero_subtitle),
color = PrivateQrColors.Mint,
style = MaterialTheme.typography.titleMedium
)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
PrivacyPill(stringResource(R.string.privacy_pill_no_ads))
PrivacyPill(stringResource(R.string.privacy_pill_no_tracking))
PrivacyPill(stringResource(R.string.privacy_pill_no_account))
}
}
}
}
@Composable
private fun PrivacyPill(text: String) {
Box(
modifier = Modifier
.background(
color = PrivateQrColors.Mint.copy(alpha = 0.12f),
shape = RoundedCornerShape(16.dp)
)
.padding(horizontal = 14.dp, vertical = 9.dp),
contentAlignment = Alignment.Center
) {
Text(
text = text,
color = PrivateQrColors.Mint,
style = MaterialTheme.typography.labelLarge,
fontWeight = FontWeight.ExtraBold
)
}
}
@Composable
private fun ExportButton(
text: String,
enabled: Boolean,
onClick: () -> Unit
) {
TextButton(
onClick = onClick,
enabled = enabled,
colors = ButtonDefaults.textButtonColors(
containerColor = PrivateQrColors.Mint,
contentColor = PrivateQrColors.Teal700,
disabledContainerColor = PrivateQrColors.Mint.copy(alpha = 0.45f),
disabledContentColor = PrivateQrColors.Teal700.copy(alpha = 0.45f)
),
shape = RoundedCornerShape(15.dp)
) {
Text(text = text, fontWeight = FontWeight.ExtraBold)
}
}
@Composable
private fun EmptyHistoryCard() {
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(containerColor = PrivateQrColors.Surface),
shape = RoundedCornerShape(24.dp)
) {
Column(
modifier = Modifier.padding(20.dp),
verticalArrangement = Arrangement.spacedBy(6.dp)
) {
Text(
text = stringResource(R.string.no_saved_scans_yet),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.ExtraBold
)
Text(
text = stringResource(R.string.empty_history_description),
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.bodyMedium
)
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun HistoryRow(
item: ScanRecord,
onDelete: (Long) -> Unit,
onOpenDetails: () -> Unit
) {
val dismissState = rememberSwipeToDismissBoxState(
confirmValueChange = {
if (it == SwipeToDismissBoxValue.EndToStart || it == SwipeToDismissBoxValue.StartToEnd) {
onDelete(item.id)
true
} else {
false
}
}
)
SwipeToDismissBox(
state = dismissState,
backgroundContent = {},
content = {
Card(
modifier = Modifier
.fillMaxWidth()
.clickable { onOpenDetails() },
colors = CardDefaults.cardColors(containerColor = PrivateQrColors.Surface),
shape = RoundedCornerShape(24.dp),
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
) {
Row(
modifier = Modifier.padding(18.dp),
horizontalArrangement = Arrangement.spacedBy(14.dp),
verticalAlignment = Alignment.CenterVertically
) {
Box(
modifier = Modifier
.size(52.dp)
.background(
color = PrivateQrColors.Mint.copy(alpha = 0.55f),
shape = RoundedCornerShape(16.dp)
),
contentAlignment = Alignment.Center
) {
Icon(
imageVector = iconForType(item.type),
contentDescription = null,
tint = PrivateQrColors.Teal700
)
}
Column(modifier = Modifier.weight(1f)) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = item.type,
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.ExtraBold
)
Text(
text = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)
.format(Date(item.timestamp)),
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.labelMedium,
maxLines = 1
)
}
Text(
text = if (item.isBase64Encoded()) {
stringResource(R.string.base64_encoded_inline, item.content)
} else {
item.content
},
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.bodyLarge,
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
}
}
}
}
)
}
private fun iconForType(type: String): ImageVector {
return when {
type.equals("URL", ignoreCase = true) -> Icons.Default.Link
type.equals("Email", ignoreCase = true) -> Icons.Default.Email
type.equals("WiFi", ignoreCase = true) -> Icons.Default.Wifi
else -> Icons.Default.History
}
}
private fun ScanRecord.isBase64Encoded(): Boolean {
return type.contains("base64", ignoreCase = true)
}
@@ -1,4 +1,4 @@
package com.clean.scanner.ui.screens package de.softwareapp_hb.privateqrscanner.ui.screens
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch import androidx.compose.material3.Switch
@@ -20,7 +19,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.clean.scanner.R import de.softwareapp_hb.privateqrscanner.R
@Composable @Composable
fun HomeScreen( fun HomeScreen(
@@ -31,16 +30,7 @@ fun HomeScreen(
val showPrivacyDialog = remember { mutableStateOf(false) } val showPrivacyDialog = remember { mutableStateOf(false) }
if (showPrivacyDialog.value) { if (showPrivacyDialog.value) {
AlertDialog( PrivacyPolicyDialog(onDismiss = { showPrivacyDialog.value = false })
onDismissRequest = { showPrivacyDialog.value = false },
title = { Text(text = stringResource(R.string.privacy)) },
text = { Text(text = stringResource(R.string.privacy_text)) },
confirmButton = {
TextButton(onClick = { showPrivacyDialog.value = false }) {
Text(text = stringResource(R.string.confirm))
}
}
)
} }
Column( Column(
@@ -0,0 +1,47 @@
package de.softwareapp_hb.privateqrscanner.ui.screens
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import de.softwareapp_hb.privateqrscanner.R
@Composable
fun PrivacyPolicyDialog(onDismiss: () -> Unit) {
val context = LocalContext.current
val configuration = LocalConfiguration.current
val policyText = remember(context, configuration) {
context.resources.openRawResource(R.raw.privacy_policy)
.bufferedReader()
.use { it.readText() }
}
AlertDialog(
onDismissRequest = onDismiss,
title = { Text(text = stringResource(R.string.privacy_policy)) },
text = {
Text(
text = policyText,
modifier = Modifier
.heightIn(max = 420.dp)
.verticalScroll(rememberScrollState()),
style = MaterialTheme.typography.bodyMedium
)
},
confirmButton = {
TextButton(onClick = onDismiss) {
Text(text = stringResource(R.string.close))
}
}
)
}
@@ -1,4 +1,4 @@
package com.clean.scanner.ui.screens package de.softwareapp_hb.privateqrscanner.ui.screens
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
@@ -9,16 +9,23 @@ import android.os.Build
import androidx.compose.foundation.Canvas import androidx.compose.foundation.Canvas
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTransformGestures import androidx.compose.foundation.gestures.detectTransformGestures
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog import androidx.compose.material3.AlertDialog
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@@ -46,14 +53,17 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.clean.scanner.R import de.softwareapp_hb.privateqrscanner.R
import com.clean.scanner.data.scanner.DetectionBox import de.softwareapp_hb.privateqrscanner.data.scanner.DetectionBox
import com.clean.scanner.data.scanner.DetectionPoint import de.softwareapp_hb.privateqrscanner.data.scanner.DetectionPoint
import com.clean.scanner.domain.ScanResult import de.softwareapp_hb.privateqrscanner.domain.ScanResult
import de.softwareapp_hb.privateqrscanner.ui.theme.PrivateQrColors
import de.softwareapp_hb.privateqrscanner.util.readableBarcodePayload
import com.google.mlkit.vision.barcode.BarcodeScanning import com.google.mlkit.vision.barcode.BarcodeScanning
import com.google.mlkit.vision.barcode.BarcodeScanner import com.google.mlkit.vision.barcode.BarcodeScanner
import com.google.mlkit.vision.barcode.BarcodeScannerOptions import com.google.mlkit.vision.barcode.BarcodeScannerOptions
@@ -103,6 +113,7 @@ internal fun GalleryScanPreviewDialog(
val context = LocalContext.current val context = LocalContext.current
val bitmap = remember(imageUri) { imageUri?.let { loadBitmapFromUri(context, it) } } val bitmap = remember(imageUri) { imageUri?.let { loadBitmapFromUri(context, it) } }
var liveCandidates by remember(imageUri, candidates) { mutableStateOf(candidates) } var liveCandidates by remember(imageUri, candidates) { mutableStateOf(candidates) }
var selectedIndex by remember(imageUri) { mutableIntStateOf(0) }
var zoom by remember(imageUri) { mutableFloatStateOf(1f) } var zoom by remember(imageUri) { mutableFloatStateOf(1f) }
var pan by remember(imageUri) { mutableStateOf(Offset.Zero) } var pan by remember(imageUri) { mutableStateOf(Offset.Zero) }
var viewportSize by remember { mutableStateOf(IntSize.Zero) } var viewportSize by remember { mutableStateOf(IntSize.Zero) }
@@ -129,6 +140,14 @@ internal fun GalleryScanPreviewDialog(
onDispose { scanner.close() } onDispose { scanner.close() }
} }
LaunchedEffect(liveCandidates.size) {
selectedIndex = if (liveCandidates.isEmpty()) {
0
} else {
selectedIndex.coerceIn(0, liveCandidates.lastIndex)
}
}
LaunchedEffect(bitmap, viewportSize, zoom, pan, scanTick) { LaunchedEffect(bitmap, viewportSize, zoom, pan, scanTick) {
val bmp = bitmap ?: return@LaunchedEffect val bmp = bitmap ?: return@LaunchedEffect
val vw = viewportSize.width.toFloat() val vw = viewportSize.width.toFloat()
@@ -174,7 +193,7 @@ internal fun GalleryScanPreviewDialog(
} }
val live = barcodes.mapNotNull { barcode -> val live = barcodes.mapNotNull { barcode ->
val raw = barcode.rawValue?.takeIf { it.isNotBlank() } ?: return@mapNotNull null val payload = barcode.readableBarcodePayload() ?: return@mapNotNull null
val normalizedBox = barcode.boundingBox?.let { bounds -> val normalizedBox = barcode.boundingBox?.let { bounds ->
val leftN = ((bounds.left + cropLeft) / imgW).coerceIn(0f, 1f) val leftN = ((bounds.left + cropLeft) / imgW).coerceIn(0f, 1f)
val topN = ((bounds.top + cropTop) / imgH).coerceIn(0f, 1f) val topN = ((bounds.top + cropTop) / imgH).coerceIn(0f, 1f)
@@ -189,24 +208,47 @@ internal fun GalleryScanPreviewDialog(
DetectionBox(leftN, topN, rightN, bottomN, corners) DetectionBox(leftN, topN, rightN, bottomN, corners)
} }
GalleryScanCandidate( GalleryScanCandidate(
result = ScanResult(content = raw, type = barcode.valueType.toHumanType()), result = ScanResult(
content = payload.content,
type = barcode.valueType.toHumanType(),
isBase64Encoded = payload.isBase64Encoded
),
box = normalizedBox box = normalizedBox
) )
}.distinctBy { "${it.result.type}|${it.result.content}" } }.distinctBy { "${it.result.displayType}|${it.result.content}" }
liveCandidates = live liveCandidates = live
} }
AlertDialog( AlertDialog(
onDismissRequest = onDismiss, onDismissRequest = onDismiss,
title = { Text(stringResource(R.string.image_scan_pick_title, liveCandidates.size)) }, containerColor = PrivateQrColors.Surface,
shape = RoundedCornerShape(30.dp),
title = {
Text(
text = stringResource(R.string.image_scan_pick_title, liveCandidates.size),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.headlineSmall,
fontWeight = FontWeight.ExtraBold
)
},
text = { text = {
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.verticalScroll(rememberScrollState()), .verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(8.dp) verticalArrangement = Arrangement.spacedBy(12.dp)
) { ) {
Text(
text = if (liveCandidates.isEmpty()) {
stringResource(R.string.no_code_found_in_image)
} else {
stringResource(R.string.image_scan_pick_subtitle)
},
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.SemiBold
)
if (bitmap != null) { if (bitmap != null) {
Box( Box(
modifier = Modifier modifier = Modifier
@@ -223,7 +265,7 @@ internal fun GalleryScanPreviewDialog(
scanTick++ scanTick++
} }
} }
.background(Color.Black.copy(alpha = 0.32f), RoundedCornerShape(12.dp)), .background(PrivateQrColors.Navy, RoundedCornerShape(24.dp)),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
Image( Image(
@@ -262,7 +304,7 @@ internal fun GalleryScanPreviewDialog(
liveCandidates.forEachIndexed { index, candidate -> liveCandidates.forEachIndexed { index, candidate ->
val box = candidate.box ?: return@forEachIndexed val box = candidate.box ?: return@forEachIndexed
val color = Color(0xFF4AE3A3).copy(alpha = 0.96f) val color = PrivateQrColors.Teal300.copy(alpha = 0.96f)
val points = box.corners.map { p -> val points = box.corners.map { p ->
imageToScreen(p.x * imageW, p.y * imageH) imageToScreen(p.x * imageW, p.y * imageH)
} }
@@ -317,27 +359,57 @@ internal fun GalleryScanPreviewDialog(
} }
} }
if (liveCandidates.isEmpty()) { if (liveCandidates.isNotEmpty()) {
Text(text = stringResource(R.string.no_code_found_in_image))
} else {
Text(text = stringResource(R.string.image_scan_pick_subtitle))
liveCandidates.forEachIndexed { index, candidate -> liveCandidates.forEachIndexed { index, candidate ->
TextButton( val selected = index == selectedIndex
onClick = { onPick(candidate) }, Row(
modifier = Modifier.fillMaxWidth() modifier = Modifier
.fillMaxWidth()
.background(
color = if (selected) Color(0xFFECFDF5) else PrivateQrColors.AppBackground,
shape = RoundedCornerShape(24.dp)
)
.border(
width = 2.dp,
color = if (selected) PrivateQrColors.Teal300 else Color.Transparent,
shape = RoundedCornerShape(24.dp)
)
.clickable { selectedIndex = index }
.padding(18.dp),
horizontalArrangement = Arrangement.spacedBy(14.dp),
verticalAlignment = Alignment.CenterVertically
) { ) {
Column(modifier = Modifier.fillMaxWidth()) { Box(
modifier = Modifier
.size(54.dp)
.background(PrivateQrColors.Mint, RoundedCornerShape(16.dp)),
contentAlignment = Alignment.Center
) {
Text( Text(
text = "${index + 1}. ${candidate.result.type}", text = "${index + 1}",
textAlign = TextAlign.Start, color = PrivateQrColors.Teal700,
modifier = Modifier.fillMaxWidth() style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.ExtraBold
)
}
Column(modifier = Modifier.weight(1f)) {
Text(
text = candidate.result.displayType,
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.ExtraBold
) )
Text( Text(
text = candidate.result.content, text = if (candidate.result.isBase64Encoded) {
stringResource(R.string.base64_encoded_inline, candidate.result.content)
} else {
candidate.result.content
},
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.SemiBold,
maxLines = 2, maxLines = 2,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis
textAlign = TextAlign.Start,
modifier = Modifier.fillMaxWidth()
) )
} }
} }
@@ -345,9 +417,29 @@ internal fun GalleryScanPreviewDialog(
} }
} }
}, },
confirmButton = {}, confirmButton = {
val selected = liveCandidates.getOrNull(selectedIndex)
TextButton(
onClick = {
if (selected != null) onPick(selected)
},
enabled = selected != null,
colors = ButtonDefaults.textButtonColors(
containerColor = PrivateQrColors.Teal700,
contentColor = PrivateQrColors.Surface,
disabledContainerColor = PrivateQrColors.TextSecondary.copy(alpha = 0.18f),
disabledContentColor = PrivateQrColors.TextSecondary
),
shape = RoundedCornerShape(18.dp)
) {
Text(stringResource(R.string.image_scan_use_selected))
}
},
dismissButton = { dismissButton = {
TextButton(onClick = onDismiss) { TextButton(
onClick = onDismiss,
colors = ButtonDefaults.textButtonColors(contentColor = PrivateQrColors.Teal700)
) {
Text(stringResource(R.string.cancel)) Text(stringResource(R.string.cancel))
} }
} }
@@ -1,4 +1,4 @@
package com.clean.scanner.ui.screens package de.softwareapp_hb.privateqrscanner.ui.screens
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
@@ -13,9 +13,12 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ContentCopy import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material.icons.filled.Share import androidx.compose.material.icons.filled.Share
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.IconToggleButton import androidx.compose.material3.IconToggleButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@@ -25,12 +28,14 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.clean.scanner.R import de.softwareapp_hb.privateqrscanner.R
import com.clean.scanner.ui.BatchScanRecord import de.softwareapp_hb.privateqrscanner.ui.BatchScanRecord
import com.clean.scanner.util.ClipboardUtil import de.softwareapp_hb.privateqrscanner.ui.theme.PrivateQrColors
import com.clean.scanner.util.Intents import de.softwareapp_hb.privateqrscanner.util.ClipboardUtil
import de.softwareapp_hb.privateqrscanner.util.Intents
import java.text.DateFormat import java.text.DateFormat
import java.util.Date import java.util.Date
@@ -75,7 +80,8 @@ internal fun OverlayIconToggle(
@Composable @Composable
internal fun BatchResultsPanel( internal fun BatchResultsPanel(
results: List<BatchScanRecord>, results: List<BatchScanRecord>,
onClear: () -> Unit onClear: () -> Unit,
allowShare: Boolean
) { ) {
val context = LocalContext.current val context = LocalContext.current
val timeFormat = remember { DateFormat.getTimeInstance(DateFormat.SHORT) } val timeFormat = remember { DateFormat.getTimeInstance(DateFormat.SHORT) }
@@ -90,17 +96,46 @@ internal fun BatchResultsPanel(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.background( .background(
color = Color.Black.copy(alpha = 0.42f), color = PrivateQrColors.Deep.copy(alpha = 0.88f),
shape = RoundedCornerShape(14.dp) shape = RoundedCornerShape(28.dp)
) )
.padding(12.dp), .padding(20.dp),
verticalArrangement = Arrangement.spacedBy(8.dp) verticalArrangement = Arrangement.spacedBy(12.dp)
) { ) {
Text( Row(
text = stringResource(R.string.batch_captures_count, results.size), modifier = Modifier.fillMaxWidth(),
color = Color.White horizontalArrangement = Arrangement.SpaceBetween,
) verticalAlignment = Alignment.CenterVertically
) {
Text(
text = stringResource(R.string.batch_captures_count, results.size),
color = Color.White,
style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.ExtraBold
)
if (allowShare) {
TextButton(
onClick = { Intents.shareText(context, buildBatchExport(results)) },
enabled = results.isNotEmpty(),
colors = ButtonDefaults.textButtonColors(
containerColor = PrivateQrColors.Mint,
contentColor = PrivateQrColors.Teal700,
disabledContainerColor = PrivateQrColors.Mint.copy(alpha = 0.32f),
disabledContentColor = PrivateQrColors.Teal700.copy(alpha = 0.45f)
),
shape = RoundedCornerShape(18.dp)
) {
Text(stringResource(R.string.share_batch), fontWeight = FontWeight.ExtraBold)
}
}
}
results.take(3).forEach { item -> results.take(3).forEach { item ->
val contentText = if (item.result.isBase64Encoded) {
stringResource(R.string.base64_encoded_inline, item.result.content)
} else {
item.result.content
}
HorizontalDivider(color = Color.White.copy(alpha = 0.12f))
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
@@ -108,13 +143,17 @@ internal fun BatchResultsPanel(
) { ) {
Column(modifier = Modifier.weight(1f)) { Column(modifier = Modifier.weight(1f)) {
Text( Text(
text = "${item.result.type}: ${item.result.content}", text = "${item.result.displayType}: $contentText",
color = Color.White.copy(alpha = 0.92f), color = Color.White.copy(alpha = 0.92f),
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Bold,
maxLines = 1 maxLines = 1
) )
Text( Text(
text = timeFormat.format(Date(item.timestamp)), text = timeFormat.format(Date(item.timestamp)),
color = Color.White.copy(alpha = 0.7f) color = Color.White.copy(alpha = 0.7f),
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.SemiBold
) )
} }
Row { Row {
@@ -125,26 +164,55 @@ internal fun BatchResultsPanel(
tint = Color.White tint = Color.White
) )
} }
IconButton(onClick = { Intents.shareText(context, item.result.content) }) { if (allowShare) {
Icon( IconButton(onClick = { Intents.shareText(context, item.result.content) }) {
imageVector = Icons.Default.Share, Icon(
contentDescription = stringResource(R.string.share), imageVector = Icons.Default.Share,
tint = Color.White contentDescription = stringResource(R.string.share),
) tint = Color.White
)
}
} }
} }
} }
} }
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { Row(
TextButton(onClick = onClear, enabled = results.isNotEmpty()) { modifier = Modifier
Text(stringResource(R.string.clear_batch)) .fillMaxWidth()
} .background(Color(0xFF831843).copy(alpha = 0.42f), RoundedCornerShape(18.dp))
TextButton( .padding(horizontal = 14.dp, vertical = 12.dp),
onClick = { Intents.shareText(context, buildBatchExport(results)) }, horizontalArrangement = Arrangement.spacedBy(10.dp),
enabled = results.isNotEmpty() verticalAlignment = Alignment.CenterVertically
) { ) {
Text(stringResource(R.string.share_batch)) Text(text = "", color = Color(0xFFFF7A9A), fontWeight = FontWeight.ExtraBold)
} Text(
text = stringResource(R.string.batch_ticket_privacy_note),
color = Color.White,
style = MaterialTheme.typography.labelLarge,
fontWeight = FontWeight.ExtraBold,
modifier = Modifier.weight(1f)
)
}
TextButton(
onClick = onClear,
enabled = results.isNotEmpty(),
colors = ButtonDefaults.textButtonColors(contentColor = PrivateQrColors.Mint)
) {
Text(stringResource(R.string.clear_batch), fontWeight = FontWeight.Bold)
}
if (results.isEmpty()) {
Text(
text = stringResource(R.string.aim_center_hint),
color = Color.White.copy(alpha = 0.68f),
style = MaterialTheme.typography.bodyMedium
)
}
if (!allowShare && results.isNotEmpty()) {
Text(
text = stringResource(R.string.batch_ticket_privacy_note),
color = Color.White.copy(alpha = 0.68f),
style = MaterialTheme.typography.bodyMedium
)
} }
} }
} }
@@ -154,7 +222,8 @@ private fun buildBatchExport(results: List<BatchScanRecord>): String {
if (results.isEmpty()) return "" if (results.isEmpty()) return ""
val formatter = DateFormat.getDateTimeInstance() val formatter = DateFormat.getDateTimeInstance()
return results.joinToString(separator = "\n\n") { item -> return results.joinToString(separator = "\n\n") { item ->
"${formatter.format(Date(item.timestamp))}\n${item.result.type}\n${item.result.content}" val encoding = if (item.result.isBase64Encoded) "\nEncoding: Base64" else ""
"${formatter.format(Date(item.timestamp))}\n${item.result.displayType}$encoding\n${item.result.content}"
} }
} }
@@ -1,5 +1,6 @@
package com.clean.scanner.ui.screens package de.softwareapp_hb.privateqrscanner.ui.screens
import androidx.compose.foundation.clickable
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
@@ -8,8 +9,11 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Wifi
import androidx.compose.material3.Card import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@@ -18,12 +22,16 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.clean.scanner.domain.ScanResult import de.softwareapp_hb.privateqrscanner.R
import com.clean.scanner.util.ParsedContact import de.softwareapp_hb.privateqrscanner.domain.ScanResult
import com.clean.scanner.util.ScanContentParsers import de.softwareapp_hb.privateqrscanner.ui.theme.PrivateQrColors
import com.clean.scanner.util.UrlRiskScorer import de.softwareapp_hb.privateqrscanner.util.ParsedContact
import de.softwareapp_hb.privateqrscanner.util.ScanContentParsers
import de.softwareapp_hb.privateqrscanner.util.UrlRiskScorer
import java.text.DateFormat import java.text.DateFormat
import java.util.Date import java.util.Date
@@ -35,10 +43,13 @@ private data class ResultField(
@Composable @Composable
internal fun ResultVisualCard( internal fun ResultVisualCard(
result: ScanResult, result: ScanResult,
onOpenUrl: ((String) -> Unit)? = null,
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
val contact = remember(result.content) { ScanContentParsers.parseContact(result.content) } val contact = remember(result) {
if (contact != null || result.type == "Contact") { if (result.isBase64Encoded) null else ScanContentParsers.parseContact(result.content)
}
if (!result.isBase64Encoded && (contact != null || result.type == "Contact")) {
ContactVisualCard( ContactVisualCard(
contact = contact, contact = contact,
rawContent = result.content, rawContent = result.content,
@@ -50,17 +61,61 @@ internal fun ResultVisualCard(
val fields = remember(result) { buildResultFields(result) } val fields = remember(result) { buildResultFields(result) }
Card( Card(
modifier = modifier.fillMaxWidth(), modifier = modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(containerColor = Color(0xFFF2F7FF)), colors = CardDefaults.cardColors(containerColor = PrivateQrColors.SoftSurface),
shape = RoundedCornerShape(14.dp) shape = RoundedCornerShape(26.dp)
) { ) {
Column( Column(
modifier = Modifier.padding(14.dp), modifier = Modifier.padding(22.dp),
verticalArrangement = Arrangement.spacedBy(8.dp) verticalArrangement = Arrangement.spacedBy(14.dp)
) { ) {
Text( if (!result.isBase64Encoded && result.type == "WiFi") {
text = result.type, Row(
style = MaterialTheme.typography.titleMedium horizontalArrangement = Arrangement.spacedBy(10.dp),
) verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.Default.Wifi,
contentDescription = null,
tint = PrivateQrColors.Teal700
)
Text(
text = "Wi-Fi",
style = MaterialTheme.typography.headlineSmall
)
}
} else {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(10.dp),
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = result.displayType,
style = MaterialTheme.typography.headlineSmall,
color = PrivateQrColors.TextPrimary
)
if (!result.isBase64Encoded && result.type == "URL") {
Text(
text = stringResource(R.string.result_local_check),
color = PrivateQrColors.Teal700,
style = MaterialTheme.typography.labelLarge,
modifier = Modifier
.background(
color = PrivateQrColors.Mint,
shape = RoundedCornerShape(50)
)
.padding(horizontal = 12.dp, vertical = 6.dp)
)
}
}
}
if (result.isBase64Encoded) {
Text(
text = stringResource(R.string.base64_encoded_notice),
style = MaterialTheme.typography.bodySmall,
color = PrivateQrColors.TextSecondary
)
}
if (fields.isEmpty()) { if (fields.isEmpty()) {
Text( Text(
text = result.content, text = result.content,
@@ -72,17 +127,51 @@ internal fun ResultVisualCard(
Text( Text(
text = field.label, text = field.label,
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.labelMedium,
color = Color(0xFF4F6277) color = PrivateQrColors.TextSecondary
) )
val isClickableUrl = result.type == "URL" &&
field.label == "Link" &&
onOpenUrl != null
Text( Text(
text = field.value, text = field.value,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
color = if (isClickableUrl) Color(0xFF1D4ED8) else PrivateQrColors.TextPrimary,
textDecoration = if (isClickableUrl) TextDecoration.Underline else null,
modifier = if (isClickableUrl) {
Modifier.clickable { onOpenUrl(field.value) }
} else {
Modifier
},
maxLines = 3, maxLines = 3,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
} }
} }
} }
if (!result.isBase64Encoded && result.type == "URL") {
Row(
modifier = Modifier
.fillMaxWidth()
.background(
color = Color(0xFFECFDF5),
shape = RoundedCornerShape(18.dp)
)
.padding(horizontal = 14.dp, vertical = 12.dp),
horizontalArrangement = Arrangement.spacedBy(10.dp),
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = "",
color = PrivateQrColors.Teal700,
style = MaterialTheme.typography.titleMedium
)
Text(
text = stringResource(R.string.result_checked_on_device),
color = PrivateQrColors.Teal700,
style = MaterialTheme.typography.labelLarge
)
}
}
} }
} }
} }
@@ -247,6 +336,9 @@ private fun selectContactTemplate(contact: ParsedContact?, rawContent: String):
} }
private fun buildResultFields(result: ScanResult): List<ResultField> { private fun buildResultFields(result: ScanResult): List<ResultField> {
if (result.isBase64Encoded) {
return listOf(ResultField("Encoded data", result.content))
}
return when (result.type) { return when (result.type) {
"Contact" -> { "Contact" -> {
val contact = ScanContentParsers.parseContact(result.content) val contact = ScanContentParsers.parseContact(result.content)
@@ -0,0 +1,951 @@
package de.softwareapp_hb.privateqrscanner.ui.screens
import android.Manifest
import android.app.Activity
import android.content.Intent
import android.media.AudioManager
import android.media.ToneGenerator
import android.net.Uri
import android.provider.Settings
import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.OpenInNew
import androidx.compose.material.icons.automirrored.filled.ViewList
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material.icons.filled.FlashOff
import androidx.compose.material.icons.filled.FlashOn
import androidx.compose.material.icons.filled.PersonAdd
import androidx.compose.material.icons.filled.Share
import androidx.compose.material.icons.filled.UploadFile
import androidx.compose.material.icons.filled.ViewModule
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SnackbarResult
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.dp
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import de.softwareapp_hb.privateqrscanner.R
import de.softwareapp_hb.privateqrscanner.data.scanner.DetectionBox
import de.softwareapp_hb.privateqrscanner.data.scanner.DetectionPoint
import de.softwareapp_hb.privateqrscanner.domain.ScanResult
import de.softwareapp_hb.privateqrscanner.ui.BatchScanRecord
import de.softwareapp_hb.privateqrscanner.ui.EventTicketScanDecision
import de.softwareapp_hb.privateqrscanner.ui.UseCaseView
import de.softwareapp_hb.privateqrscanner.ui.components.CameraPreview
import de.softwareapp_hb.privateqrscanner.ui.capabilities
import de.softwareapp_hb.privateqrscanner.ui.theme.PrivateQrColors
import de.softwareapp_hb.privateqrscanner.util.ClipboardUtil
import de.softwareapp_hb.privateqrscanner.util.Intents
import de.softwareapp_hb.privateqrscanner.util.ScanContentParsers
import de.softwareapp_hb.privateqrscanner.util.UrlRiskScorer
import de.softwareapp_hb.privateqrscanner.util.readableBarcodePayload
import com.google.mlkit.vision.barcode.BarcodeScanning
import com.google.mlkit.vision.barcode.BarcodeScannerOptions
import com.google.mlkit.vision.barcode.common.Barcode
import com.google.mlkit.vision.common.InputImage
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlin.math.max
internal data class GalleryScanCandidate(
val result: ScanResult,
val box: DetectionBox?
)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ScannerScreen(
analysisEnabled: Boolean,
lastResult: ScanResult?,
batchMode: Boolean,
batchResults: List<BatchScanRecord>,
eventTicketWhitelistCount: Int,
duplicateFeedbackNonce: Int,
scanFeedbackNonce: Int,
warningsEnabled: Boolean,
scanFeedbackEnabled: Boolean,
useCaseView: UseCaseView,
onScan: (ScanResult) -> Unit,
onEvaluateEventTicketScan: (ScanResult) -> EventTicketScanDecision,
onAuditDuplicateTicket: (ScanResult) -> Unit,
onAuditUnregisteredTicket: (ScanResult) -> Unit,
onReplaceEventTicketWhitelist: (Set<String>) -> Unit,
onScanAgain: () -> Unit,
onBatchModeChange: (Boolean) -> Unit,
onClearBatchResults: () -> Unit,
onOpenHistory: () -> Unit
) {
val context = LocalContext.current
val haptic = LocalHapticFeedback.current
val capabilities = remember(useCaseView) { useCaseView.capabilities() }
val forceBatchMode = useCaseView == UseCaseView.EventTicketing
val showBatchModeToggle = capabilities.allowBatchMode && !forceBatchMode
val isBatchModeActive = forceBatchMode || batchMode
val duplicateSnackbarHostState = remember { SnackbarHostState() }
val toneGenerator = remember { ToneGenerator(AudioManager.STREAM_NOTIFICATION, 70) }
LaunchedEffect(forceBatchMode, showBatchModeToggle, batchMode) {
when {
forceBatchMode && !batchMode -> onBatchModeChange(true)
!forceBatchMode && !showBatchModeToggle && batchMode -> onBatchModeChange(false)
}
}
var cameraGranted by remember {
mutableStateOf(
ContextCompat.checkSelfPermission(
context,
Manifest.permission.CAMERA
) == android.content.pm.PackageManager.PERMISSION_GRANTED
)
}
var showSettingsHint by remember { mutableStateOf(false) }
var torchEnabled by remember { mutableStateOf(false) }
var torchAvailable by remember { mutableStateOf(false) }
var showRiskWarning by remember { mutableStateOf(false) }
var pendingOpenUrl by remember { mutableStateOf<String?>(null) }
var showDuplicateTicketAlert by remember { mutableStateOf(false) }
var showUnregisteredTicketAlert by remember { mutableStateOf(false) }
var duplicateTicketAlertContent by remember { mutableStateOf<String?>(null) }
var unregisteredTicketAlertContent by remember { mutableStateOf<String?>(null) }
var showImageScanFailed by remember { mutableStateOf(false) }
var imageScanCandidates by remember { mutableStateOf<List<GalleryScanCandidate>>(emptyList()) }
var imageScanPreviewUri by remember { mutableStateOf<Uri?>(null) }
var hasPotentialInView by remember { mutableStateOf(false) }
var hasReadableInView by remember { mutableStateOf(false) }
var detectionBoxes by remember { mutableStateOf<List<DetectionBox>>(emptyList()) }
var detectionSourceWidth by remember { mutableIntStateOf(0) }
var detectionSourceHeight by remember { mutableIntStateOf(0) }
var lastHandledScanFeedbackNonce by remember { mutableIntStateOf(scanFeedbackNonce) }
val scope = rememberCoroutineScope()
val activity = context as? Activity
val imageScanner = remember {
BarcodeScanning.getClient(
BarcodeScannerOptions.Builder()
.setBarcodeFormats(Barcode.FORMAT_ALL_FORMATS)
.enableAllPotentialBarcodes()
.build()
)
}
fun ScanResult.visibleAlertContent(): String {
return if (isBase64Encoded) {
context.getString(R.string.base64_encoded_inline, content)
} else {
content
}
}
fun requestOpenUrl(url: String) {
val risk = UrlRiskScorer.score(url)
val risky = warningsEnabled && risk.score >= 3
if (risky) {
pendingOpenUrl = url
showRiskWarning = true
} else {
Intents.openUrl(context, url)
}
}
val permissionLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.RequestPermission()
) { granted ->
cameraGranted = granted
if (!granted && activity != null) {
showSettingsHint = !ActivityCompat.shouldShowRequestPermissionRationale(
activity,
Manifest.permission.CAMERA
)
}
}
val imagePicker = rememberLauncherForActivityResult(
contract = ActivityResultContracts.GetContent()
) { uri ->
if (uri == null) return@rememberLauncherForActivityResult
val image = try {
InputImage.fromFilePath(context, uri)
} catch (_: Exception) {
showImageScanFailed = true
return@rememberLauncherForActivityResult
}
imageScanPreviewUri = uri
imageScanCandidates = emptyList()
imageScanner.process(image)
.addOnSuccessListener { barcodes ->
val candidates = barcodes.mapNotNull { barcode ->
val payload = barcode.readableBarcodePayload() ?: return@mapNotNull null
val normalizedBox = barcode.boundingBox?.let { bounds ->
val corners = barcode.cornerPoints?.map { p ->
DetectionPoint(
x = (p.x / image.width.toFloat()).coerceIn(0f, 1f),
y = (p.y / image.height.toFloat()).coerceIn(0f, 1f)
)
} ?: emptyList()
DetectionBox(
left = (bounds.left / image.width.toFloat()).coerceIn(0f, 1f),
top = (bounds.top / image.height.toFloat()).coerceIn(0f, 1f),
right = (bounds.right / image.width.toFloat()).coerceIn(0f, 1f),
bottom = (bounds.bottom / image.height.toFloat()).coerceIn(0f, 1f),
corners = corners
)
}
GalleryScanCandidate(
result = ScanResult(
content = payload.content,
type = barcode.valueType.toHumanType(),
isBase64Encoded = payload.isBase64Encoded
),
box = normalizedBox
)
}.distinctBy { "${it.result.displayType}|${it.result.content}" }
imageScanCandidates = candidates
}
.addOnFailureListener {
showImageScanFailed = true
}
}
val whitelistPicker = rememberLauncherForActivityResult(
contract = ActivityResultContracts.GetContent()
) { uri ->
if (uri == null) return@rememberLauncherForActivityResult
scope.launch {
val ids = withContext(Dispatchers.IO) {
runCatching {
context.contentResolver.openInputStream(uri)?.bufferedReader()?.use { reader ->
parseWhitelistIds(reader.readText())
} ?: emptySet()
}.getOrElse { emptySet() }
}
if (ids.isEmpty()) {
Toast.makeText(
context,
context.getString(R.string.whitelist_import_empty),
Toast.LENGTH_SHORT
).show()
} else {
onReplaceEventTicketWhitelist(ids)
Toast.makeText(
context,
context.getString(R.string.whitelist_import_success, ids.size),
Toast.LENGTH_SHORT
).show()
}
}
}
LaunchedEffect(Unit) {
if (!cameraGranted) permissionLauncher.launch(Manifest.permission.CAMERA)
}
LaunchedEffect(duplicateFeedbackNonce) {
if (duplicateFeedbackNonce > 0) {
if (useCaseView == UseCaseView.EventTicketing) return@LaunchedEffect
Toast.makeText(
context,
context.getString(R.string.already_scanned),
Toast.LENGTH_SHORT
).show()
val result = duplicateSnackbarHostState.showSnackbar(
message = context.getString(R.string.already_scanned),
actionLabel = context.getString(R.string.view_history),
withDismissAction = true
)
if (result == SnackbarResult.ActionPerformed) {
onOpenHistory()
}
}
}
LaunchedEffect(scanFeedbackNonce, scanFeedbackEnabled) {
if (scanFeedbackEnabled && scanFeedbackNonce > lastHandledScanFeedbackNonce) {
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
toneGenerator.startTone(ToneGenerator.TONE_PROP_BEEP, 120)
}
if (scanFeedbackNonce > lastHandledScanFeedbackNonce) {
lastHandledScanFeedbackNonce = scanFeedbackNonce
}
}
DisposableEffect(Unit) {
onDispose {
imageScanner.close()
toneGenerator.release()
}
}
var containerSize by remember { mutableStateOf(IntSize.Zero) }
Box(
modifier = Modifier
.fillMaxSize()
.background(PrivateQrColors.Deep)
.onSizeChanged { containerSize = it }
) {
val density = LocalDensity.current
val viewW = containerSize.width.toFloat()
val viewH = containerSize.height.toFloat()
val galleryOpen = imageScanPreviewUri != null
val aimW = viewW * 0.70f
val aimH = with(density) { 230.dp.toPx() }
val aimLeft = (viewW - aimW) / 2f
val aimTop = (viewH - aimH) / 2f
val aimRight = aimLeft + aimW
val aimBottom = aimTop + aimH
if (cameraGranted && !galleryOpen) {
CameraPreview(
modifier = Modifier.fillMaxSize(),
analysisEnabled = analysisEnabled,
torchEnabled = torchEnabled,
onTorchAvailabilityChanged = { torchAvailable = it },
onDetectionStateChanged = { hasPotential, hasReadable, boxes, sourceWidth, sourceHeight ->
hasPotentialInView = hasPotential
hasReadableInView = hasReadable
detectionBoxes = boxes
detectionSourceWidth = sourceWidth
detectionSourceHeight = sourceHeight
},
onScan = { scanResult, readableBox, sourceWidth, sourceHeight ->
val box = readableBox ?: return@CameraPreview
if (sourceWidth <= 0 || sourceHeight <= 0 || viewW <= 0f || viewH <= 0f) {
return@CameraPreview
}
val srcW = sourceWidth.toFloat()
val srcH = sourceHeight.toFloat()
val scale = max(viewW / srcW, viewH / srcH)
val scaledW = srcW * scale
val scaledH = srcH * scale
val offsetX = (viewW - scaledW) / 2f
val offsetY = (viewH - scaledH) / 2f
val centerX = offsetX + (((box.left + box.right) * 0.5f) * srcW * scale)
val centerY = offsetY + (((box.top + box.bottom) * 0.5f) * srcH * scale)
val insideAim = centerX in aimLeft..aimRight && centerY in aimTop..aimBottom
if (!insideAim) return@CameraPreview
if (forceBatchMode) {
when (onEvaluateEventTicketScan(scanResult)) {
EventTicketScanDecision.Accept -> Unit
EventTicketScanDecision.Unregistered -> {
onAuditUnregisteredTicket(scanResult)
unregisteredTicketAlertContent = scanResult.visibleAlertContent()
showUnregisteredTicketAlert = true
return@CameraPreview
}
EventTicketScanDecision.DuplicateAlert -> {
onAuditDuplicateTicket(scanResult)
duplicateTicketAlertContent = scanResult.visibleAlertContent()
showDuplicateTicketAlert = true
return@CameraPreview
}
EventTicketScanDecision.Ignore -> return@CameraPreview
}
}
onScan(scanResult)
}
)
Box(
modifier = Modifier
.fillMaxSize()
.background(
Brush.verticalGradient(
colors = listOf(
PrivateQrColors.Deep.copy(alpha = 0.72f),
PrivateQrColors.Teal900.copy(alpha = 0.34f),
PrivateQrColors.Deep.copy(alpha = 0.78f)
)
)
)
)
if (detectionBoxes.isNotEmpty()) {
Canvas(
modifier = Modifier
.fillMaxSize()
) {
val sourceW = detectionSourceWidth.toFloat()
val sourceH = detectionSourceHeight.toFloat()
if (sourceW <= 0f || sourceH <= 0f) return@Canvas
val scale = max(size.width / sourceW, size.height / sourceH)
val scaledW = sourceW * scale
val scaledH = sourceH * scale
val offsetX = (size.width - scaledW) / 2f
val offsetY = (size.height - scaledH) / 2f
val boxColor = if (hasReadableInView) Color(0xFF4AE3A3) else Color(0xFFFFC857)
detectionBoxes.forEach { box ->
val left = offsetX + (box.left * sourceW * scale)
val top = offsetY + (box.top * sourceH * scale)
val right = offsetX + (box.right * sourceW * scale)
val bottom = offsetY + (box.bottom * sourceH * scale)
val mappedCorners = box.corners.map { p ->
Offset(
x = offsetX + (p.x * sourceW * scale),
y = offsetY + (p.y * sourceH * scale)
)
}
if (mappedCorners.size >= 4) {
val outline = Path().apply {
moveTo(mappedCorners.first().x, mappedCorners.first().y)
mappedCorners.drop(1).forEach { pt -> lineTo(pt.x, pt.y) }
close()
}
drawPath(
path = outline,
color = boxColor.copy(alpha = 0.96f),
style = Stroke(width = 5.5f)
)
} else if (right > left && bottom > top) {
drawRoundRect(
color = boxColor.copy(alpha = 0.95f),
topLeft = Offset(left, top),
size = Size(right - left, bottom - top),
cornerRadius = CornerRadius(22f, 22f),
style = Stroke(width = 5.5f)
)
}
}
}
}
Canvas(
modifier = Modifier
.align(Alignment.Center)
.fillMaxWidth(0.70f)
.height(230.dp)
) {
val guideColor = when {
hasReadableInView -> Color(0xFF4AE3A3)
hasPotentialInView -> PrivateQrColors.Warning
else -> PrivateQrColors.Teal300
}
drawRoundRect(
color = guideColor.copy(alpha = 0.12f),
cornerRadius = CornerRadius(32f, 32f)
)
drawRoundRect(
color = guideColor.copy(alpha = 0.90f),
cornerRadius = CornerRadius(32f, 32f),
style = Stroke(width = 5f)
)
}
Text(
text = when {
hasReadableInView -> stringResource(R.string.live_readable_detected)
hasPotentialInView -> stringResource(R.string.live_potential_detected)
else -> stringResource(R.string.aim_center_hint)
},
color = Color.White,
style = MaterialTheme.typography.labelLarge,
textAlign = TextAlign.Center,
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(bottom = if (isBatchModeActive) 190.dp else 56.dp)
.background(
color = Color.Black.copy(alpha = 0.45f),
shape = RoundedCornerShape(24.dp)
)
.padding(horizontal = 18.dp, vertical = 10.dp)
)
if (capabilities.allowScanFromImage) {
IconButton(
onClick = { imagePicker.launch("image/*") },
modifier = Modifier
.align(Alignment.TopEnd)
.padding(top = 12.dp, end = 12.dp)
.background(
color = Color.Black.copy(alpha = 0.38f),
shape = RoundedCornerShape(18.dp)
)
) {
Icon(
painter = painterResource(id = android.R.drawable.ic_menu_gallery),
contentDescription = stringResource(R.string.scan_from_image),
tint = Color.White
)
}
}
if (useCaseView == UseCaseView.EventTicketing) {
IconButton(
onClick = { whitelistPicker.launch("*/*") },
modifier = Modifier
.align(Alignment.TopEnd)
.padding(top = 12.dp, end = if (capabilities.allowScanFromImage) 64.dp else 12.dp)
.background(
color = Color.Black.copy(alpha = 0.38f),
shape = RoundedCornerShape(18.dp)
)
) {
Icon(
imageVector = Icons.Default.UploadFile,
contentDescription = stringResource(R.string.import_whitelist),
tint = Color.White
)
}
}
Text(
text = stringResource(useCaseView.titleRes),
color = Color.White,
style = MaterialTheme.typography.titleMedium,
textAlign = TextAlign.Center,
modifier = Modifier
.align(Alignment.TopCenter)
.padding(top = 16.dp, start = 64.dp, end = 64.dp)
.background(
color = Color.Black.copy(alpha = 0.52f),
shape = RoundedCornerShape(22.dp)
)
.padding(horizontal = 18.dp, vertical = 10.dp)
)
if (useCaseView == UseCaseView.EventTicketing) {
Text(
text = stringResource(R.string.whitelist_loaded_count, eventTicketWhitelistCount),
color = Color.White,
textAlign = TextAlign.Center,
modifier = Modifier
.align(Alignment.TopCenter)
.padding(top = 56.dp, start = 64.dp, end = 64.dp)
.background(
color = Color.Black.copy(alpha = 0.35f),
shape = RoundedCornerShape(12.dp)
)
.padding(horizontal = 10.dp, vertical = 4.dp)
)
}
Column(
modifier = Modifier
.align(Alignment.TopStart)
.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
if (torchAvailable) {
OverlayIconToggle(
checked = torchEnabled,
onCheckedChange = { torchEnabled = it },
label = stringResource(R.string.flashlight),
checkedImageVector = Icons.Default.FlashOn,
uncheckedImageVector = Icons.Default.FlashOff,
showLabel = false
)
}
if (showBatchModeToggle) {
OverlayIconToggle(
checked = batchMode,
onCheckedChange = onBatchModeChange,
label = stringResource(R.string.batch_mode),
checkedImageVector = Icons.Default.ViewModule,
uncheckedImageVector = Icons.AutoMirrored.Filled.ViewList
)
}
}
if (isBatchModeActive && (showBatchModeToggle || forceBatchMode)) {
Box(modifier = Modifier.align(Alignment.BottomCenter)) {
BatchResultsPanel(
results = batchResults,
onClear = onClearBatchResults,
allowShare = capabilities.allowBatchShare
)
}
}
SnackbarHost(
hostState = duplicateSnackbarHostState,
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(bottom = if (isBatchModeActive) 12.dp else 80.dp)
)
} else if (!galleryOpen) {
PermissionContent(
showSettingsHint = showSettingsHint,
onRequestPermission = { permissionLauncher.launch(Manifest.permission.CAMERA) },
onOpenSettings = {
val intent = Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", context.packageName, null)
)
context.startActivity(intent)
}
)
} else {
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Black)
)
}
if (lastResult != null && !isBatchModeActive) {
val parsedContact = remember(lastResult) {
if (lastResult.isBase64Encoded) null else ScanContentParsers.parseContact(lastResult.content)
}
val parsedEvent = remember(lastResult) {
if (lastResult.isBase64Encoded) null else ScanContentParsers.parseCalendarEvent(lastResult.content)
}
ModalBottomSheet(
onDismissRequest = onScanAgain,
containerColor = PrivateQrColors.Surface,
shape = RoundedCornerShape(topStart = 32.dp, topEnd = 32.dp)
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(start = 20.dp, top = 4.dp, end = 20.dp, bottom = 28.dp),
verticalArrangement = Arrangement.spacedBy(14.dp)
) {
ResultVisualCard(
result = lastResult,
onOpenUrl = ::requestOpenUrl
)
val hasQuickActions = capabilities.allowCopy ||
capabilities.allowShare ||
(capabilities.allowAddContact && parsedContact != null) ||
(capabilities.allowOpenUrl && !lastResult.isBase64Encoded && lastResult.type == "URL")
if (hasQuickActions) {
Row(
modifier = Modifier
.fillMaxWidth()
.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
if (capabilities.allowAddContact && parsedContact != null) {
ResultActionPill(
text = stringResource(R.string.add_contact),
imageVector = Icons.Default.PersonAdd,
onClick = { Intents.addContact(context, parsedContact, lastResult.content) },
primary = true
)
}
if (capabilities.allowCopy) {
ResultActionPill(
text = stringResource(R.string.copy),
imageVector = Icons.Default.ContentCopy,
onClick = { ClipboardUtil.copy(context, lastResult.content) }
)
}
if (capabilities.allowShare) {
ResultActionPill(
text = stringResource(R.string.share),
imageVector = Icons.Default.Share,
onClick = { Intents.shareText(context, lastResult.content) }
)
}
if (capabilities.allowOpenUrl && !lastResult.isBase64Encoded && lastResult.type == "URL") {
ResultActionPill(
text = stringResource(R.string.open),
imageVector = Icons.AutoMirrored.Filled.OpenInNew,
onClick = { requestOpenUrl(lastResult.content) },
primary = true
)
}
}
}
if (!lastResult.isBase64Encoded) {
when (lastResult.type) {
"Phone" -> {
if (capabilities.allowDialPhone) {
Button(
onClick = {
Intents.dialPhone(context, ScanContentParsers.extractPhoneNumber(lastResult.content))
},
colors = ButtonDefaults.buttonColors(
containerColor = PrivateQrColors.Teal700
)
) {
Text(stringResource(R.string.call_number))
}
}
}
"SMS" -> {
if (capabilities.allowSendSms) {
Button(
onClick = {
val smsData = ScanContentParsers.parseSms(lastResult.content)
Intents.sendSms(context, smsData.first, smsData.second)
},
colors = ButtonDefaults.buttonColors(
containerColor = PrivateQrColors.Teal700
)
) {
Text(stringResource(R.string.send_sms))
}
}
}
"Email" -> {
if (capabilities.allowSendEmail) {
Button(
onClick = {
Intents.sendEmail(context, ScanContentParsers.extractEmail(lastResult.content), null)
},
colors = ButtonDefaults.buttonColors(
containerColor = PrivateQrColors.Teal700
)
) {
Text(stringResource(R.string.send_email))
}
}
}
"WiFi" -> {
if (capabilities.allowOpenWifiSettings) {
Button(
onClick = { Intents.openWifiSettings(context) },
colors = ButtonDefaults.buttonColors(
containerColor = PrivateQrColors.Teal700
)
) {
Text(stringResource(R.string.open_wifi_settings))
}
}
}
"Calendar" -> {
if (capabilities.allowAddCalendarEvent) {
Button(
onClick = {
Intents.addCalendarEvent(context, parsedEvent, lastResult.content)
},
colors = ButtonDefaults.buttonColors(
containerColor = PrivateQrColors.Teal700
)
) {
Text(stringResource(R.string.add_calendar_event))
}
}
}
}
}
}
}
}
if (showRiskWarning && pendingOpenUrl != null) {
AlertDialog(
onDismissRequest = { showRiskWarning = false },
containerColor = PrivateQrColors.Surface,
shape = RoundedCornerShape(28.dp),
title = {
Text(
text = stringResource(R.string.risk_warning_title),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.headlineSmall
)
},
text = {
Text(
text = stringResource(R.string.risk_warning),
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.bodyLarge
)
},
confirmButton = {
TextButton(
onClick = {
Intents.openUrl(context, pendingOpenUrl!!)
showRiskWarning = false
},
colors = ButtonDefaults.textButtonColors(
containerColor = PrivateQrColors.Teal700,
contentColor = PrivateQrColors.Surface
),
shape = RoundedCornerShape(18.dp)
) {
Text(stringResource(R.string.open_anyway))
}
},
dismissButton = {
TextButton(
onClick = { showRiskWarning = false },
colors = ButtonDefaults.textButtonColors(
contentColor = PrivateQrColors.Teal700
)
) {
Text(stringResource(R.string.cancel))
}
}
)
}
if (showDuplicateTicketAlert && useCaseView == UseCaseView.EventTicketing) {
AlertDialog(
onDismissRequest = { showDuplicateTicketAlert = false },
title = { Text(text = stringResource(R.string.duplicate_ticket_alert_title), color = Color(0xFFB00020)) },
text = {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(text = stringResource(R.string.duplicate_ticket_alert_message))
if (!duplicateTicketAlertContent.isNullOrBlank()) {
Text(
text = stringResource(R.string.duplicate_ticket_alert_code, duplicateTicketAlertContent!!),
color = Color(0xFFB00020)
)
}
}
},
confirmButton = {
TextButton(onClick = { showDuplicateTicketAlert = false }) {
Text(stringResource(R.string.confirm))
}
}
)
}
if (showUnregisteredTicketAlert && useCaseView == UseCaseView.EventTicketing) {
AlertDialog(
onDismissRequest = { showUnregisteredTicketAlert = false },
title = { Text(text = stringResource(R.string.unregistered_ticket_alert_title), color = Color(0xFFB00020)) },
text = {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(text = stringResource(R.string.unregistered_ticket_alert_message))
if (!unregisteredTicketAlertContent.isNullOrBlank()) {
Text(
text = stringResource(R.string.unregistered_ticket_alert_code, unregisteredTicketAlertContent!!),
color = Color(0xFFB00020)
)
}
}
},
confirmButton = {
TextButton(onClick = { showUnregisteredTicketAlert = false }) {
Text(stringResource(R.string.confirm))
}
}
)
}
if (imageScanPreviewUri != null) {
GalleryScanPreviewDialog(
imageUri = imageScanPreviewUri,
candidates = imageScanCandidates,
onPick = { candidate ->
onScan(candidate.result)
imageScanCandidates = emptyList()
imageScanPreviewUri = null
},
onDismiss = {
imageScanCandidates = emptyList()
imageScanPreviewUri = null
}
)
}
if (showImageScanFailed) {
AlertDialog(
onDismissRequest = { showImageScanFailed = false },
text = { Text(stringResource(R.string.image_scan_failed)) },
confirmButton = {
TextButton(onClick = { showImageScanFailed = false }) {
Text(stringResource(R.string.confirm))
}
}
)
}
}
}
private fun parseWhitelistIds(raw: String): Set<String> {
if (raw.isBlank()) return emptySet()
return raw
.split('\n', '\r', ',', ';', '\t')
.asSequence()
.map { it.trim().lowercase() }
.filter { it.isNotBlank() }
.toSet()
}
@Composable
private fun ResultActionPill(
text: String,
imageVector: ImageVector,
onClick: () -> Unit,
primary: Boolean = false
) {
TextButton(
onClick = onClick,
colors = ButtonDefaults.textButtonColors(
containerColor = if (primary) PrivateQrColors.Teal700 else PrivateQrColors.AppBackground,
contentColor = if (primary) PrivateQrColors.Surface else PrivateQrColors.TextPrimary
),
shape = RoundedCornerShape(18.dp)
) {
Icon(
imageVector = imageVector,
contentDescription = null,
modifier = Modifier.size(18.dp)
)
Text(
text = text,
fontWeight = FontWeight.ExtraBold,
modifier = Modifier.padding(start = 8.dp)
)
}
}
@@ -0,0 +1,423 @@
package de.softwareapp_hb.privateqrscanner.ui.screens
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import de.softwareapp_hb.privateqrscanner.R
import de.softwareapp_hb.privateqrscanner.ui.UseCaseView
import de.softwareapp_hb.privateqrscanner.ui.theme.PrivateQrColors
import de.softwareapp_hb.privateqrscanner.util.InAppReviewRequester
@Composable
fun SettingsScreen(
historyEnabled: Boolean,
warningsEnabled: Boolean,
scanFeedbackEnabled: Boolean,
selectedUseCaseView: UseCaseView,
onHistoryToggle: (Boolean, Boolean) -> Unit,
onWarningsToggle: (Boolean) -> Unit,
onScanFeedbackToggle: (Boolean) -> Unit,
onUseCaseViewSelected: (UseCaseView) -> Unit
) {
val context = LocalContext.current
val showDeleteConfirm = remember { mutableStateOf(false) }
val showPrivacyPolicy = remember { mutableStateOf(false) }
if (showDeleteConfirm.value) {
AlertDialog(
onDismissRequest = { showDeleteConfirm.value = false },
title = { Text(stringResource(R.string.settings)) },
text = { Text(stringResource(R.string.delete_history_on_disable)) },
confirmButton = {
TextButton(onClick = {
onHistoryToggle(false, true)
showDeleteConfirm.value = false
}) { Text(stringResource(R.string.confirm)) }
},
dismissButton = {
TextButton(onClick = {
onHistoryToggle(false, false)
showDeleteConfirm.value = false
}) { Text(stringResource(R.string.cancel)) }
}
)
}
if (showPrivacyPolicy.value) {
PrivacyPolicyDialog(onDismiss = { showPrivacyPolicy.value = false })
}
BoxWithConstraints(
modifier = Modifier
.fillMaxSize()
.background(PrivateQrColors.AppBackground)
) {
val wideLayout = maxWidth >= 600.dp
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.padding(20.dp),
verticalArrangement = Arrangement.spacedBy(18.dp)
) {
SettingsHeader()
if (wideLayout) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(24.dp),
verticalAlignment = Alignment.Top
) {
Column(
modifier = Modifier.weight(1f),
verticalArrangement = Arrangement.spacedBy(18.dp)
) {
SettingsToggleCard(
historyEnabled = historyEnabled,
warningsEnabled = warningsEnabled,
scanFeedbackEnabled = scanFeedbackEnabled,
onHistoryToggle = onHistoryToggle,
onWarningsToggle = onWarningsToggle,
onScanFeedbackToggle = onScanFeedbackToggle,
onRequestDisableHistory = { showDeleteConfirm.value = true }
)
AboutCard(
onPrivacyClick = { showPrivacyPolicy.value = true },
onReviewClick = { InAppReviewRequester.requestReview(context) }
)
}
UseCaseSelectionCard(
selectedUseCaseView = selectedUseCaseView,
onUseCaseViewSelected = onUseCaseViewSelected,
modifier = Modifier.weight(0.9f)
)
}
} else {
SettingsToggleCard(
historyEnabled = historyEnabled,
warningsEnabled = warningsEnabled,
scanFeedbackEnabled = scanFeedbackEnabled,
onHistoryToggle = onHistoryToggle,
onWarningsToggle = onWarningsToggle,
onScanFeedbackToggle = onScanFeedbackToggle,
onRequestDisableHistory = { showDeleteConfirm.value = true }
)
UseCaseSelectionCard(
selectedUseCaseView = selectedUseCaseView,
onUseCaseViewSelected = onUseCaseViewSelected
)
AboutCard(
onPrivacyClick = { showPrivacyPolicy.value = true },
onReviewClick = { InAppReviewRequester.requestReview(context) }
)
}
Spacer(modifier = Modifier.height(12.dp))
}
}
}
@Composable
private fun SettingsToggleCard(
historyEnabled: Boolean,
warningsEnabled: Boolean,
scanFeedbackEnabled: Boolean,
onHistoryToggle: (Boolean, Boolean) -> Unit,
onWarningsToggle: (Boolean) -> Unit,
onScanFeedbackToggle: (Boolean) -> Unit,
onRequestDisableHistory: () -> Unit
) {
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(containerColor = PrivateQrColors.Surface),
shape = RoundedCornerShape(28.dp),
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
) {
Column(modifier = Modifier.padding(horizontal = 20.dp, vertical = 8.dp)) {
SettingsToggleRow(
title = stringResource(R.string.save_history),
checked = historyEnabled,
onCheckedChange = { enabled ->
if (!enabled && historyEnabled) {
onRequestDisableHistory()
} else {
onHistoryToggle(enabled, false)
}
}
)
SettingsDivider()
SettingsToggleRow(
title = stringResource(R.string.security_warnings),
checked = warningsEnabled,
onCheckedChange = onWarningsToggle
)
SettingsDivider()
SettingsToggleRow(
title = stringResource(R.string.scan_feedback),
checked = scanFeedbackEnabled,
onCheckedChange = onScanFeedbackToggle
)
}
}
}
@Composable
private fun UseCaseSelectionCard(
selectedUseCaseView: UseCaseView,
onUseCaseViewSelected: (UseCaseView) -> Unit,
modifier: Modifier = Modifier
) {
Column(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
Text(
text = stringResource(R.string.select_use_case_view),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.headlineSmall,
fontWeight = FontWeight.ExtraBold
)
UseCaseView.entries.forEach { candidate ->
UseCasePickerOption(
candidate = candidate,
selected = candidate == selectedUseCaseView,
onClick = { onUseCaseViewSelected(candidate) }
)
}
}
}
@Composable
private fun AboutCard(
onPrivacyClick: () -> Unit,
onReviewClick: () -> Unit
) {
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(containerColor = PrivateQrColors.Surface),
shape = RoundedCornerShape(28.dp),
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
) {
Column(modifier = Modifier.padding(20.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
Text(
text = stringResource(R.string.about),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.ExtraBold
)
InfoLine(stringResource(R.string.version))
InfoLine(stringResource(R.string.licenses))
InfoLine(stringResource(R.string.contact))
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
TextButton(
onClick = onPrivacyClick,
colors = ButtonDefaults.textButtonColors(contentColor = PrivateQrColors.Teal700)
) {
Text(text = stringResource(R.string.privacy_policy), fontWeight = FontWeight.Bold)
}
TextButton(
onClick = onReviewClick,
colors = ButtonDefaults.textButtonColors(contentColor = PrivateQrColors.Teal700)
) {
Text(text = stringResource(R.string.review_app), fontWeight = FontWeight.Bold)
}
}
}
}
}
@Composable
private fun UseCasePickerOption(
candidate: UseCaseView,
selected: Boolean,
onClick: () -> Unit
) {
val borderColor = if (selected) PrivateQrColors.Teal300 else Color.Transparent
val backgroundColor = if (selected) Color(0xFFECFDF5) else PrivateQrColors.AppBackground
Row(
modifier = Modifier
.fillMaxWidth()
.background(backgroundColor, RoundedCornerShape(24.dp))
.border(2.dp, borderColor, RoundedCornerShape(24.dp))
.clickable(onClick = onClick)
.padding(18.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp),
verticalAlignment = Alignment.CenterVertically
) {
Box(
modifier = Modifier
.size(58.dp)
.background(PrivateQrColors.Mint, RoundedCornerShape(16.dp)),
contentAlignment = Alignment.Center
) {
Text(
text = if (selected) "" else "",
color = PrivateQrColors.Teal700,
style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.ExtraBold
)
}
Column(modifier = Modifier.weight(1f)) {
Text(
text = stringResource(candidate.titleRes),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.ExtraBold
)
Text(
text = stringResource(candidate.descriptionRes()),
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.SemiBold
)
}
}
}
private fun UseCaseView.descriptionRes(): Int {
return when (this) {
UseCaseView.EverydayPersonal -> R.string.use_case_everyday_description
UseCaseView.EventTicketing -> R.string.use_case_event_ticketing_description
}
}
@Composable
private fun SettingsHeader() {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(14.dp),
verticalAlignment = Alignment.CenterVertically
) {
Image(
painter = painterResource(id = R.drawable.ic_launcher_legacy),
contentDescription = null,
modifier = Modifier.size(64.dp)
)
Column {
Text(
text = stringResource(R.string.app_name),
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.headlineSmall,
fontWeight = FontWeight.ExtraBold
)
Text(
text = stringResource(R.string.settings_header_subtitle),
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Bold
)
}
}
Spacer(modifier = Modifier.height(18.dp))
Card(
colors = CardDefaults.cardColors(containerColor = Color.Transparent),
shape = RoundedCornerShape(30.dp)
) {
Column(
modifier = Modifier
.background(
Brush.linearGradient(
colors = listOf(PrivateQrColors.Navy, PrivateQrColors.Teal900)
)
)
.padding(24.dp),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
Text(
text = stringResource(R.string.settings_hero_title),
color = PrivateQrColors.Surface,
style = MaterialTheme.typography.headlineMedium,
fontWeight = FontWeight.ExtraBold
)
Text(
text = stringResource(R.string.settings_hero_subtitle),
color = PrivateQrColors.Mint,
style = MaterialTheme.typography.titleMedium
)
}
}
}
@Composable
private fun SettingsToggleRow(
title: String,
checked: Boolean,
onCheckedChange: (Boolean) -> Unit
) {
Row(
modifier = Modifier
.fillMaxWidth()
.height(74.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = title,
color = PrivateQrColors.TextPrimary,
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.ExtraBold
)
Switch(
checked = checked,
onCheckedChange = onCheckedChange,
colors = SwitchDefaults.colors(
checkedThumbColor = PrivateQrColors.Surface,
checkedTrackColor = PrivateQrColors.Teal700,
uncheckedThumbColor = PrivateQrColors.Surface,
uncheckedTrackColor = PrivateQrColors.TextSecondary.copy(alpha = 0.35f)
)
)
}
}
@Composable
private fun SettingsDivider() {
HorizontalDivider(color = PrivateQrColors.Divider)
}
@Composable
private fun InfoLine(text: String) {
Text(
text = text,
color = PrivateQrColors.TextSecondary,
style = MaterialTheme.typography.bodyMedium
)
}
@@ -0,0 +1,21 @@
package de.softwareapp_hb.privateqrscanner.ui.theme
import androidx.compose.ui.graphics.Color
object PrivateQrColors {
val Deep = Color(0xFF07111F)
val Navy = Color(0xFF0B1220)
val Teal900 = Color(0xFF123B3F)
val Teal800 = Color(0xFF155E63)
val Teal700 = Color(0xFF0F766E)
val Teal300 = Color(0xFF2DD4BF)
val Mint = Color(0xFFDFF7F2)
val AppBackground = Color(0xFFF6FBFA)
val Surface = Color(0xFFFFFFFF)
val SoftSurface = Color(0xFFF2F7FF)
val TextPrimary = Color(0xFF0B1220)
val TextSecondary = Color(0xFF607080)
val Divider = Color(0xFFDCE8E6)
val Success = Color(0xFF10B981)
val Warning = Color(0xFFFFC857)
}
@@ -0,0 +1,44 @@
package de.softwareapp_hb.privateqrscanner.ui.theme
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
private val LightColors = lightColorScheme(
primary = PrivateQrColors.Teal700,
onPrimary = PrivateQrColors.Surface,
secondary = PrivateQrColors.Teal300,
onSecondary = PrivateQrColors.Navy,
background = PrivateQrColors.AppBackground,
onBackground = PrivateQrColors.TextPrimary,
surface = PrivateQrColors.Surface,
onSurface = PrivateQrColors.TextPrimary,
surfaceVariant = PrivateQrColors.Mint,
onSurfaceVariant = PrivateQrColors.TextSecondary
)
private val DarkColors = darkColorScheme(
primary = PrivateQrColors.Teal300,
onPrimary = PrivateQrColors.Navy,
secondary = PrivateQrColors.Mint,
onSecondary = PrivateQrColors.Navy,
background = PrivateQrColors.Deep,
onBackground = PrivateQrColors.Surface,
surface = PrivateQrColors.Navy,
onSurface = PrivateQrColors.Surface,
surfaceVariant = PrivateQrColors.Teal900,
onSurfaceVariant = PrivateQrColors.Mint
)
@Composable
fun CleanScannerTheme(content: @Composable () -> Unit) {
val darkTheme = isSystemInDarkTheme()
val colorScheme = if (darkTheme) DarkColors else LightColors
MaterialTheme(
colorScheme = colorScheme,
content = content
)
}
@@ -0,0 +1,86 @@
package de.softwareapp_hb.privateqrscanner.util
import com.google.mlkit.vision.barcode.common.Barcode
import java.util.Base64
internal data class ReadableBarcodePayload(
val content: String,
val isBase64Encoded: Boolean
)
fun Barcode.readablePayload(): String? {
return readableBarcodePayload()?.content
}
internal fun Barcode.readableBarcodePayload(): ReadableBarcodePayload? {
return readablePayload(rawValue, displayValue, rawBytes)
}
internal fun readablePayload(
rawValue: String?,
displayValue: String?,
rawBytes: ByteArray?
): ReadableBarcodePayload? {
val bytes = rawBytes?.takeIf { it.isNotEmpty() }
rawValue?.trim()?.takeIf { it.isNotBlank() }?.let { value ->
return if (value.isLikelyHumanReadable()) {
ReadableBarcodePayload(content = value, isBase64Encoded = false)
} else {
value.asBase64Payload(bytes)
}
}
displayValue?.trim()?.takeIf { it.isNotBlank() }?.let { value ->
return if (value.isLikelyHumanReadable()) {
ReadableBarcodePayload(content = value, isBase64Encoded = false)
} else {
value.asBase64Payload(bytes)
}
}
bytes ?: return null
val utf8 = bytes.toString(Charsets.UTF_8).trim()
if (utf8.isLikelyHumanReadable()) {
return ReadableBarcodePayload(content = utf8, isBase64Encoded = false)
}
return bytes.asBase64Payload()
}
private fun String.isLikelyHumanReadable(): Boolean {
if (isBlank()) return false
var index = 0
while (index < length) {
val codePoint = codePointAt(index)
val charCount = Character.charCount(codePoint)
if (
Character.isISOControl(codePoint) && codePoint != '\n'.code &&
codePoint != '\r'.code && codePoint != '\t'.code
) {
return false
}
if (
codePoint == '\uFFFD'.code ||
(this[index].isSurrogate() && charCount == 1) ||
codePoint.isNonCharacter()
) {
return false
}
index += charCount
}
return true
}
private fun String.asBase64Payload(rawBytes: ByteArray?): ReadableBarcodePayload {
return rawBytes?.asBase64Payload() ?: toByteArray(Charsets.UTF_8).asBase64Payload()
}
private fun ByteArray.asBase64Payload(): ReadableBarcodePayload {
return ReadableBarcodePayload(
content = Base64.getEncoder().encodeToString(this),
isBase64Encoded = true
)
}
private fun Int.isNonCharacter(): Boolean {
return this in 0xFDD0..0xFDEF || (this and 0xFFFE) == 0xFFFE
}
@@ -1,4 +1,4 @@
package com.clean.scanner.util package de.softwareapp_hb.privateqrscanner.util
import android.content.ClipData import android.content.ClipData
import android.content.ClipboardManager import android.content.ClipboardManager
@@ -1,6 +1,6 @@
package com.clean.scanner.util package de.softwareapp_hb.privateqrscanner.util
import com.clean.scanner.domain.ScanRecord import de.softwareapp_hb.privateqrscanner.domain.ScanRecord
import java.text.DateFormat import java.text.DateFormat
import java.util.Date import java.util.Date
@@ -0,0 +1,26 @@
package de.softwareapp_hb.privateqrscanner.util
import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import com.google.android.play.core.review.ReviewManagerFactory
object InAppReviewRequester {
fun requestReview(context: Context) {
val activity = context.findActivity() ?: return
val manager = ReviewManagerFactory.create(activity)
manager.requestReviewFlow().addOnCompleteListener { request ->
if (request.isSuccessful) {
manager.launchReviewFlow(activity, request.result)
}
}
}
private tailrec fun Context.findActivity(): Activity? {
return when (this) {
is Activity -> this
is ContextWrapper -> baseContext.findActivity()
else -> null
}
}
}
@@ -1,4 +1,4 @@
package com.clean.scanner.util package de.softwareapp_hb.privateqrscanner.util
import android.content.ContentValues import android.content.ContentValues
import android.content.Context import android.content.Context
@@ -1,4 +1,4 @@
package com.clean.scanner.util package de.softwareapp_hb.privateqrscanner.util
import at.bitfire.vcard4android.Contact import at.bitfire.vcard4android.Contact
import java.io.StringReader import java.io.StringReader
@@ -0,0 +1,598 @@
package de.softwareapp_hb.privateqrscanner.util
import de.softwareapp_hb.privateqrscanner.domain.UrlRiskResult
import java.net.IDN
import java.net.URI
import java.net.URLDecoder
import java.util.Locale
object UrlRiskScorer {
fun score(raw: String): UrlRiskResult {
val trimmed = raw.trim()
val uri = runCatching { URI(trimmed) }.getOrNull() ?: return UrlRiskResult(0, emptyList())
val scheme = uri.scheme?.lowercase(Locale.US) ?: return UrlRiskResult(0, emptyList())
val hostDetails = extractHost(uri)
val host = hostDetails.asciiHost
val labels = host.split('.').filter { it.isNotBlank() }
val reasons = mutableListOf<String>()
var score = 0
fun add(points: Int, reason: String) {
if (reason !in reasons) {
score += points
reasons += reason
}
}
if (trimmed.any { it.isISOControl() || it.isWhitespace() }) {
add(3, "Contains whitespace or control characters")
}
when (scheme) {
"http" -> add(2, "URL uses HTTP")
"https" -> Unit
in HIGH_RISK_SCHEMES -> add(5, "Uses a potentially unsafe URL scheme")
else -> add(2, "Uses a non-web URL scheme")
}
if (scheme in WEB_SCHEMES && hostDetails.rawHost.isBlank()) {
add(3, "Web URL has no host")
}
if (!uri.userInfo.isNullOrBlank() || uri.rawAuthority.orEmpty().contains("@")) {
add(2, "Contains userinfo")
}
if (PERCENT_ENCODING.containsMatchIn(hostDetails.rawHost)) {
add(2, "Host contains percent-encoding")
}
if (hostDetails.hasPunycode) {
add(2, "Host contains punycode")
}
if (hostDetails.hasUnicode) {
add(2, "Host contains non-ASCII characters")
}
if (host.length > 40) {
add(1, "Host is unusually long")
}
val ipv4 = parseIpv4(host)
if (ipv4 != null) {
add(2, "Host is an IP address")
if (isPrivateOrReservedIpv4(ipv4)) {
add(2, "Host is a private or reserved IP address")
}
} else if (isIpv6Literal(hostDetails.rawHost)) {
add(2, "Host is an IP address")
if (isPrivateOrReservedIpv6(hostDetails.rawHost)) {
add(2, "Host is a private or reserved IP address")
}
} else if (host.isNotBlank()) {
scoreDomainShape(host, labels, ::add)
scoreKnownRiskyDomains(host, labels, ::add)
scoreBrandImpersonation(host, labels, ::add)
}
scoreUrlStructure(trimmed, uri, host, ::add)
return UrlRiskResult(score = score, reasons = reasons)
}
private fun scoreDomainShape(
host: String,
labels: List<String>,
add: (Int, String) -> Unit
) {
val registeredDomain = registrableDomain(labels)
val registeredLabel = registeredDomain?.substringBefore('.').orEmpty()
if (host == "localhost" || host.endsWith(".localhost") || host.endsWith(".local")) {
add(2, "Host points to a local name")
}
if (labels.size == 1 && host != "localhost") {
add(1, "Host has no public suffix")
}
if (labels.size > 4) {
add(1, "Host has many subdomains")
}
if (labels.any { it.length > 30 }) {
add(1, "Host contains an unusually long label")
}
if (labels.any { it.contains('_') }) {
add(1, "Host contains invalid hostname characters")
}
if (registeredLabel.count { it == '-' } >= 3) {
add(1, "Registered domain contains many hyphens")
}
if (registeredLabel.length >= 10 && registeredLabel.count(Char::isDigit) * 100 / registeredLabel.length >= 35) {
add(1, "Registered domain contains many digits")
}
if (labels.any { REPEATED_CHARACTER.containsMatchIn(it) }) {
add(1, "Host contains repeated characters")
}
}
private fun scoreKnownRiskyDomains(
host: String,
labels: List<String>,
add: (Int, String) -> Unit
) {
val tld = labels.lastOrNull().orEmpty()
val registeredDomain = registrableDomain(labels)
if (registeredDomain in URL_SHORTENERS) {
add(2, "Host is a URL shortener")
}
if (tld in WATCHLIST_TLDS) {
add(1, "Host uses a commonly abused top-level domain")
}
}
private fun scoreBrandImpersonation(
host: String,
labels: List<String>,
add: (Int, String) -> Unit
) {
val registeredDomain = registrableDomain(labels)
val labelsToInspect = labels.filterNot { it in PUBLIC_SUFFIX_PARTS }
for (brand in BRAND_PROFILES) {
if (brand.officialDomains.any { host == it || host.endsWith(".$it") }) continue
val registeredLabel = registeredDomain?.substringBefore('.').orEmpty()
if (registeredLabel == brand.name) continue
val exactBrandLabel = labelsToInspect.any { it == brand.name }
val embeddedBrand = labelsToInspect.any { label ->
label != brand.name && label.contains(brand.name)
}
if (exactBrandLabel || embeddedBrand) {
add(3, "Host embeds a known brand outside its official domain")
return
}
val candidateLabels = (labelsToInspect + registeredLabel).filter { it.length >= 4 }.distinct()
if (candidateLabels.any { isLookalikeBrandLabel(it, brand.name) }) {
add(3, "Host resembles a known brand")
return
}
}
}
private fun scoreUrlStructure(
raw: String,
uri: URI,
host: String,
add: (Int, String) -> Unit
) {
val rawPath = uri.rawPath.orEmpty()
val rawQuery = uri.rawQuery.orEmpty()
val lowerPathAndQuery = "$rawPath?$rawQuery".lowercase(Locale.US)
val lowerRaw = raw.lowercase(Locale.US)
when {
raw.length > 500 -> add(2, "URL is extremely long")
raw.length > 250 -> add(1, "URL is unusually long")
}
if (uri.port != -1 && !isStandardPort(uri.scheme.orEmpty(), uri.port)) {
add(1, "URL uses a non-standard port")
}
if (rawPath.length > 120) {
add(1, "Path is unusually long")
}
if ((uri.rawQuery?.length ?: 0) > 120) {
add(1, "Query is unusually long")
}
if (rawPath.split('/').count { it.isNotBlank() } > 8) {
add(1, "Path has many segments")
}
val percentEncodedCount = PERCENT_ENCODING.findAll(raw).count()
if (percentEncodedCount > 10) {
add(1, "Many percent-encodings")
}
if (ENCODED_CONTROL_CHARACTER.containsMatchIn(raw)) {
add(3, "URL contains encoded control characters")
}
if (raw.contains('\\')) {
add(2, "URL contains backslashes")
}
if (rawPath.contains("//")) {
add(1, "Path contains nested URL separators")
}
if (rawPath.contains('@') || rawQuery.contains('@')) {
add(1, "Path or query contains an at-sign")
}
if (DANGEROUS_FILE_EXTENSIONS.any { lowerPathAndQuery.contains(it) }) {
add(2, "URL points to a potentially executable file")
} else if (ARCHIVE_FILE_EXTENSIONS.any { lowerPathAndQuery.contains(it) }) {
add(1, "URL points to an archive file")
}
if (CREDENTIAL_KEYWORDS.any { lowerPathAndQuery.contains(it) }) {
add(1, "URL contains account or credential keywords")
}
if (hasExternalRedirect(rawQuery, host)) {
add(2, "Query redirects to another domain")
}
if (hasLongOpaqueToken(rawPath) || hasLongOpaqueToken(rawQuery)) {
add(1, "URL contains a long opaque token")
}
if (lowerRaw.contains("%2f%2f") || lowerRaw.contains("%5c")) {
add(1, "URL contains encoded path separators")
}
}
private fun extractHost(uri: URI): HostDetails {
val rawAuthority = uri.rawAuthority.orEmpty()
val rawHostFromAuthority = if (rawAuthority.isBlank()) {
""
} else {
val withoutUserInfo = rawAuthority.substringAfterLast('@')
when {
withoutUserInfo.startsWith("[") -> withoutUserInfo.substringAfter('[').substringBefore(']')
withoutUserInfo.count { it == ':' } == 1 &&
withoutUserInfo.substringAfterLast(':').all(Char::isDigit) ->
withoutUserInfo.substringBeforeLast(':')
else -> withoutUserInfo
}
}
val rawHost = (uri.host ?: rawHostFromAuthority)
.trim()
.trim('.')
.replace('\u3002', '.')
.replace('\uFF0E', '.')
.replace('\uFF61', '.')
val asciiHost = toAsciiHost(rawHost)
return HostDetails(
rawHost = rawHost,
asciiHost = asciiHost,
hasUnicode = rawHost.any { it.code > 127 },
hasPunycode = asciiHost.split('.').any { it.startsWith("xn--") } ||
rawHost.contains("xn--", ignoreCase = true)
)
}
private fun toAsciiHost(rawHost: String): String {
if (rawHost.isBlank()) return ""
return rawHost
.removeSurrounding("[", "]")
.split('.')
.filter { it.isNotBlank() }
.joinToString(".") { label ->
runCatching { IDN.toASCII(label, IDN.ALLOW_UNASSIGNED).lowercase(Locale.US) }
.getOrElse { label.lowercase(Locale.US) }
}
}
private fun parseIpv4(host: String): IntArray? {
if (!IPV4_PATTERN.matches(host)) return null
val octets = host.split('.').mapNotNull { it.toIntOrNull() }
if (octets.size != 4 || octets.any { it !in 0..255 }) return null
return octets.toIntArray()
}
private fun isPrivateOrReservedIpv4(octets: IntArray): Boolean {
val first = octets[0]
val second = octets[1]
val third = octets[2]
return first == 0 ||
first == 10 ||
first == 127 ||
first >= 224 ||
(first == 100 && second in 64..127) ||
(first == 169 && second == 254) ||
(first == 172 && second in 16..31) ||
(first == 192 && second == 168) ||
(first == 192 && second == 0 && third == 0) ||
(first == 192 && second == 0 && third == 2) ||
(first == 198 && second in 18..19) ||
(first == 198 && second == 51 && third == 100) ||
(first == 203 && second == 0 && third == 113)
}
private fun isIpv6Literal(rawHost: String): Boolean {
val host = rawHost.removeSurrounding("[", "]")
return host.contains(':') && host.all {
it == ':' || it == '.' || it.isDigit() || it.lowercaseChar() in 'a'..'f'
}
}
private fun isPrivateOrReservedIpv6(rawHost: String): Boolean {
val host = rawHost.removeSurrounding("[", "]").lowercase(Locale.US)
return host == "::" ||
host == "::1" ||
host.startsWith("fc") ||
host.startsWith("fd") ||
host.startsWith("fe80") ||
host.startsWith("2001:db8")
}
private fun registrableDomain(labels: List<String>): String? {
if (labels.isEmpty()) return null
if (labels.size == 1) return labels.first()
val lastTwo = labels.takeLast(2).joinToString(".")
return if (lastTwo in COMMON_SECOND_LEVEL_SUFFIXES && labels.size >= 3) {
labels.takeLast(3).joinToString(".")
} else {
lastTwo
}
}
private fun isLookalikeBrandLabel(label: String, brand: String): Boolean {
if (label == brand) return false
val normalized = normalizeLookalikes(label)
if (normalized == brand) return true
if (kotlin.math.abs(normalized.length - brand.length) > 1) return false
return levenshteinDistance(normalized, brand) <= 1
}
private fun normalizeLookalikes(value: String): String {
return value
.replace('0', 'o')
.replace('1', 'l')
.replace('3', 'e')
.replace('5', 's')
.replace('7', 't')
.replace("rn", "m")
}
private fun levenshteinDistance(left: String, right: String): Int {
if (left == right) return 0
if (left.isEmpty()) return right.length
if (right.isEmpty()) return left.length
var previous = IntArray(right.length + 1) { it }
var current = IntArray(right.length + 1)
for (i in left.indices) {
current[0] = i + 1
for (j in right.indices) {
val substitutionCost = if (left[i] == right[j]) 0 else 1
current[j + 1] = minOf(
current[j] + 1,
previous[j + 1] + 1,
previous[j] + substitutionCost
)
}
val swap = previous
previous = current
current = swap
}
return previous[right.length]
}
private fun isStandardPort(scheme: String, port: Int): Boolean {
return (scheme.equals("http", ignoreCase = true) && port == 80) ||
(scheme.equals("https", ignoreCase = true) && port == 443)
}
private fun hasExternalRedirect(rawQuery: String, sourceHost: String): Boolean {
if (rawQuery.isBlank()) return false
return queryParams(rawQuery).any { (key, value) ->
key in REDIRECT_PARAMETER_NAMES && value.startsWith("http", ignoreCase = true) &&
runCatching {
val destinationHost = extractHost(URI(value)).asciiHost
val sourceDomain = registrableDomain(sourceHost.split('.').filter { it.isNotBlank() })
val destinationDomain = registrableDomain(destinationHost.split('.').filter { it.isNotBlank() })
destinationDomain != null && sourceDomain != null && destinationDomain != sourceDomain
}.getOrDefault(true)
}
}
private fun queryParams(rawQuery: String): List<Pair<String, String>> {
return rawQuery
.split('&', ';')
.mapNotNull { token ->
val key = token.substringBefore('=', "").takeIf { it.isNotBlank() } ?: return@mapNotNull null
val value = token.substringAfter('=', "")
decodeUrlComponent(key).lowercase(Locale.US) to decodeUrlComponent(value)
}
}
private fun decodeUrlComponent(value: String): String {
return runCatching { URLDecoder.decode(value, Charsets.UTF_8.name()) }.getOrDefault(value)
}
private fun hasLongOpaqueToken(value: String): Boolean {
return value
.split('/', '&', '=', '?', '-', '_')
.any { token ->
token.length >= 48 &&
token.toSet().size >= 8 &&
token.count { it.isLetterOrDigit() || it == '+' || it == '/' } * 100 / token.length >= 85
}
}
private data class HostDetails(
val rawHost: String,
val asciiHost: String,
val hasUnicode: Boolean,
val hasPunycode: Boolean
)
private data class BrandProfile(
val name: String,
val officialDomains: Set<String>
)
private val WEB_SCHEMES = setOf("http", "https")
private val HIGH_RISK_SCHEMES = setOf("javascript", "data", "file", "content", "intent")
private val IPV4_PATTERN = Regex("""^\d{1,3}(\.\d{1,3}){3}$""")
private val PERCENT_ENCODING = Regex("""%[0-9a-fA-F]{2}""")
private val ENCODED_CONTROL_CHARACTER = Regex("""(?i)%(00|0a|0d|09)""")
private val REPEATED_CHARACTER = Regex("""(.)\1{3,}""")
private val COMMON_SECOND_LEVEL_SUFFIXES = setOf(
"ac.uk",
"co.in",
"co.jp",
"co.nz",
"co.uk",
"com.au",
"com.br",
"com.cn",
"com.hk",
"com.mx",
"com.sg",
"com.tr",
"ne.jp",
"net.au",
"org.uk"
)
private val PUBLIC_SUFFIX_PARTS = setOf(
"ac",
"co",
"com",
"edu",
"gov",
"mil",
"ne",
"net",
"org"
)
private val URL_SHORTENERS = setOf(
"bit.ly",
"buff.ly",
"cutt.ly",
"goo.gl",
"is.gd",
"lnkd.in",
"ow.ly",
"rebrand.ly",
"s.id",
"t.co",
"tiny.cc",
"tinyurl.com",
"trib.al",
"v.gd"
)
private val WATCHLIST_TLDS = setOf(
"cam",
"click",
"country",
"download",
"gq",
"kim",
"loan",
"men",
"ml",
"mov",
"quest",
"rest",
"surf",
"tk",
"top",
"work",
"xyz",
"zip"
)
private val CREDENTIAL_KEYWORDS = setOf(
"2fa",
"account",
"auth",
"billing",
"confirm",
"login",
"mfa",
"password",
"payment",
"recovery",
"reset",
"secure",
"security",
"signin",
"sign-in",
"unlock",
"update",
"verify",
"wallet"
)
private val REDIRECT_PARAMETER_NAMES = setOf(
"continue",
"dest",
"destination",
"next",
"redirect",
"redirect_uri",
"return",
"return_url",
"target",
"u",
"url"
)
private val DANGEROUS_FILE_EXTENSIONS = setOf(
".apk",
".bat",
".cmd",
".dmg",
".exe",
".jar",
".js",
".msi",
".ps1",
".scr",
".vbs"
)
private val ARCHIVE_FILE_EXTENSIONS = setOf(
".7z",
".gz",
".rar",
".tar",
".zip"
)
private val BRAND_PROFILES = listOf(
BrandProfile("adobe", setOf("adobe.com")),
BrandProfile("amazon", setOf("amazon.com")),
BrandProfile("apple", setOf("apple.com")),
BrandProfile("binance", setOf("binance.com")),
BrandProfile("chase", setOf("chase.com")),
BrandProfile("citibank", setOf("citibank.com")),
BrandProfile("coinbase", setOf("coinbase.com")),
BrandProfile("discord", setOf("discord.com", "discord.gg")),
BrandProfile("docusign", setOf("docusign.com")),
BrandProfile("dropbox", setOf("dropbox.com")),
BrandProfile("ebay", setOf("ebay.com")),
BrandProfile("facebook", setOf("facebook.com", "fb.com")),
BrandProfile("github", setOf("github.com")),
BrandProfile("google", setOf("google.com")),
BrandProfile("instagram", setOf("instagram.com")),
BrandProfile("microsoft", setOf("microsoft.com", "microsoftonline.com", "office.com", "live.com")),
BrandProfile("netflix", setOf("netflix.com")),
BrandProfile("paypal", setOf("paypal.com")),
BrandProfile("steam", setOf("steampowered.com", "steamcommunity.com")),
BrandProfile("telegram", setOf("telegram.org", "t.me")),
BrandProfile("whatsapp", setOf("whatsapp.com", "wa.me")),
BrandProfile("wellsfargo", setOf("wellsfargo.com"))
)
}
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#0B1220"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#123B3F"
android:pathData="M0,66C19,54 31,51 49,56C69,62 82,58 108,38V108H0z" />
<path
android:fillColor="#165A61"
android:fillAlpha="0.74"
android:pathData="M0,0H108V29C86,43 70,47 52,42C33,36 17,40 0,52z" />
</vector>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#F8FAFC"
android:pathData="M54,19L80,29V50C80,67 69,82 54,89C39,82 28,67 28,50V29z" />
<path
android:fillColor="#DFF7F2"
android:pathData="M54,24L74,31.8V50C74,63.5 65.8,75.4 54,81.8C42.2,75.4 34,63.5 34,50V31.8z" />
<path
android:fillColor="#0B1220"
android:pathData="M41,39h8v8h-8zM53,39h8v8h-8zM65,39h8v8h-8zM41,51h8v8h-8zM65,51h8v8h-8zM41,63h8v8h-8zM53,63h8v8h-8zM65,63h8v8h-8z" />
<path
android:fillColor="#2DD4BF"
android:pathData="M53,51h8v8h-8z" />
<path
android:fillColor="#2DD4BF"
android:pathData="M31,34h5v-5h13v5h-8v5h-10zM72,29v5h5v13h-5v-8h-5v-10zM31,74v-5h5v-8h-5v13h13v-5h-8v5zM77,74h-13v-5h8v-8h5z" />
</vector>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#0B1220"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#123B3F"
android:pathData="M0,66C19,54 31,51 49,56C69,62 82,58 108,38V108H0z" />
<path
android:fillColor="#165A61"
android:fillAlpha="0.74"
android:pathData="M0,0H108V29C86,43 70,47 52,42C33,36 17,40 0,52z" />
<path
android:fillColor="#F8FAFC"
android:pathData="M54,19L80,29V50C80,67 69,82 54,89C39,82 28,67 28,50V29z" />
<path
android:fillColor="#DFF7F2"
android:pathData="M54,24L74,31.8V50C74,63.5 65.8,75.4 54,81.8C42.2,75.4 34,63.5 34,50V31.8z" />
<path
android:fillColor="#0B1220"
android:pathData="M41,39h8v8h-8zM53,39h8v8h-8zM65,39h8v8h-8zM41,51h8v8h-8zM65,51h8v8h-8zM41,63h8v8h-8zM53,63h8v8h-8zM65,63h8v8h-8z" />
<path
android:fillColor="#2DD4BF"
android:pathData="M53,51h8v8h-8z" />
<path
android:fillColor="#2DD4BF"
android:pathData="M31,34h5v-5h13v5h-8v5h-10zM72,29v5h5v13h-5v-8h-5v-10zM31,74v-5h5v-8h-5v13h13v-5h-8v5zM77,74h-13v-5h8v-8h5z" />
</vector>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_launcher_legacy" />
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_launcher_legacy" />
@@ -0,0 +1,57 @@
Datenschutzerklärung
Stand: 10.05.2026
Private QR Scanner wird von SoftwareApp-HB bereitgestellt.
Kontakt: softwareapp.hb@gmail.com
Diese Erklärung beschreibt, wie Private QR Scanner Daten auf deinem Gerät verarbeitet.
Worauf die App zugreift
Kamera: Die App nutzt die Kamera nur zum Scannen von QR-Codes und Barcodes. Kamerabilder werden auf deinem Gerät verarbeitet und nicht von der App gespeichert.
Ausgewählte Bilder: Wenn du ein Bild zum Scannen auswählst, liest die App dieses ausgewählte Bild nur zur Erkennung von QR-Codes oder Barcodes. Die App behält keine Kopie des Bildes.
Gescannte Inhalte: Die App zeigt gescannte Inhalte auf deinem Gerät an. Wenn du Historie speichern (lokal) aktivierst, werden gescannter Inhalt, Inhaltstyp und Scanzeit lokal auf deinem Gerät gespeichert. Die Historie ist standardmäßig ausgeschaltet.
Einstellungen: Die App speichert lokale Einstellungen, zum Beispiel ob Historie, Sicherheitswarnungen, Scan-Feedback und die gewählte Use-Case-Ansicht aktiviert sind.
Event- und Ticketdaten: Importierte Whitelist-IDs und Stapel-Scans werden lokal verarbeitet. Whitelist-IDs bleiben im Arbeitsspeicher der aktuellen App-Sitzung und werden von der App nicht hochgeladen.
Wie Daten genutzt werden
Daten werden genutzt, um Codes zu scannen, Scan-Ergebnisse anzuzeigen, lokale Sicherheitswarnungen bereitzustellen, die optionale lokale Historie zu ermöglichen, Event- und Ticketing-Abläufe zu unterstützen und von dir gewählte Aktionen auszuführen.
Datenerhebung und Weitergabe
Private QR Scanner erstellt keine Konten, zeigt keine Werbung, verwendet keine Analysefunktionen, nutzt keine Tracking-SDKs, nutzt keine Crash-Reporting-SDKs und sendet keine App-Daten an ein Entwickler-Backend. Die App fordert keine Android-Berechtigung für Internetzugriff an.
Der Entwickler erhält, erhebt, verkauft oder teilt keine gescannten Inhalte, ausgewählten Bilder, Historie, Einstellungen oder Whitelist-Daten.
Daten können dein Gerät nur verlassen, wenn du eine Android- oder Drittanbieteraktion auswählst, zum Beispiel Öffnen, Teilen, Anrufen, SMS, E-Mail, Kontakt hinzufügen, Kalendereintrag hinzufügen, WLAN-Einstellungen oder Google-Play-Bewertung. Diese Aktionen werden von Android, Google Play oder der von dir gewählten App beziehungsweise dem gewählten Dienst verarbeitet. Deren Datenschutzpraktiken gelten dann.
Speicherung, Aufbewahrung und Löschung
Optionale Scan-Historie und Einstellungen werden im privaten App-Speicher auf deinem Gerät gespeichert. Android-App-Backups sind für diese App deaktiviert.
Die Scan-Historie bleibt auf deinem Gerät, bis du einzelne Einträge löschst, die gesamte Historie löschst, die Historie deaktivierst und vorhandene Einträge löschen lässt, die App-Daten löschst oder die App deinstallierst.
Einstellungen bleiben auf deinem Gerät, bis du sie änderst, die App-Daten löschst oder die App deinstallierst.
Kamerabilder, ausgewählte Bilder, importierte Whitelist-IDs und Stapel-Scans werden von der App nach der aktiven Nutzung oder App-Sitzung nicht aufbewahrt, außer der daraus erkannte gescannte Inhalt wird in der lokalen Historie gespeichert, weil du diese Einstellung aktiviert hast.
Sicherheit
Die App nutzt den privaten App-Speicher und die Berechtigungssteuerung von Android. Nutze eine Gerätesperre und aktuelle Sicherheitsupdates deines Betriebssystems, um lokale Daten zu schützen.
Kinder
Die App richtet sich nicht an Kinder und erhebt wissentlich keine personenbezogenen Daten von Personen.
Änderungen
Wenn sich diese Erklärung ändert, wird die aktualisierte Erklärung in die App und in die öffentliche Kopie der Datenschutzerklärung aufgenommen.
Kontakt
Bei Datenschutzfragen oder Löschanfragen zu Daten, die durch eine von dir gewählte externe Aktion übertragen wurden, wende dich an den jeweiligen externen Dienst. Bei Fragen zu dieser App kontaktiere SoftwareApp-HB unter softwareapp.hb@gmail.com.
+57
View File
@@ -0,0 +1,57 @@
Privacy Policy
Last updated: 2026-05-10
Private QR Scanner is provided by SoftwareApp-HB.
Contact: softwareapp.hb@gmail.com
This policy explains how Private QR Scanner handles data on your device.
What the app accesses
Camera: The app uses the camera only to scan QR codes and barcodes. Camera frames are processed on your device and are not saved by the app.
Selected images: If you choose to scan from an image, the app reads that selected image only to detect QR codes or barcodes. The app does not keep a copy of the image.
Scanned content: The app displays scanned content on your device. If you enable Save history (local), the scanned content, content type, and scan time are stored locally on your device. History is off by default.
Settings: The app stores your local preferences, such as whether history, security warnings, scan feedback, and the selected use-case view are enabled.
Event and ticketing data: Imported whitelist IDs and batch scan results are processed locally. Whitelist IDs are kept in memory for the current app session and are not uploaded by the app.
How data is used
Data is used to scan codes, show scan results, provide local security warnings, support optional local history, support event and ticketing workflows, and run actions that you choose.
Data collection and sharing
Private QR Scanner does not create accounts, show ads, use analytics, use tracking SDKs, use crash reporting SDKs, or send app data to a developer backend. The app does not request the Android Internet permission.
The developer does not receive, collect, sell, or share your scanned content, selected images, history, settings, or whitelist data.
Data can leave your device only when you choose an Android or third-party action, such as Open, Share, Call, SMS, Email, Add contact, Add calendar event, Wi-Fi settings, or Google Play review. Those actions are handled by Android, Google Play, or the app or service you choose, and their privacy practices apply.
Storage, retention, and deletion
Optional scan history and settings are stored in app-private storage on your device. Android app backup is disabled for this app.
Scan history remains on your device until you delete individual entries, delete all history, turn history off and choose to delete existing history, clear the app data, or uninstall the app.
Settings remain on your device until you change them, clear the app data, or uninstall the app.
Camera frames, selected images, imported whitelist IDs, and batch scan results are not retained by the app after the active use or app session ends, unless the resulting scanned content is saved to local history because you enabled that setting.
Security
The app relies on Android app-private storage and Android permission controls. Keep your device screen lock and operating system security updates enabled to protect local data.
Children
The app is not directed to children and does not knowingly collect personal data from anyone.
Changes
If this policy changes, the updated policy will be included in the app and in the public policy copy for the app.
Contact
For privacy questions or deletion requests about data that may have been sent through an external action you chose, contact the relevant external service. For questions about this app, contact SoftwareApp-HB at softwareapp.hb@gmail.com.
+44 -14
View File
@@ -1,12 +1,13 @@
<resources> <resources>
<string name="app_name">Clean Scanner</string> <string name="app_name">Private QR Scanner</string>
<string name="scan">Scannen</string> <string name="scan">Scannen</string>
<string name="scan_again">Nochmal scannen</string> <string name="scan_again">Nochmal scannen</string>
<string name="history">Historie</string> <string name="history">Historie</string>
<string name="settings">Einstellungen</string> <string name="settings">Einstellungen</string>
<string name="save_history">Historie speichern (lokal)</string> <string name="save_history">Historie speichern (lokal)</string>
<string name="privacy">Datenschutz</string> <string name="privacy">Datenschutz</string>
<string name="privacy_text">Keine Datenübertragung, keine Werbung, kein Tracking.</string> <string name="privacy_policy">Datenschutzerklärung</string>
<string name="privacy_text">Lokale Verarbeitung, keine Werbung, kein Tracking. Details stehen in der Datenschutzerklärung.</string>
<string name="security_warnings">Sicherheitswarnungen</string> <string name="security_warnings">Sicherheitswarnungen</string>
<string name="scan_feedback">Scan-Feedback (Ton + Vibration)</string> <string name="scan_feedback">Scan-Feedback (Ton + Vibration)</string>
<string name="about">Über</string> <string name="about">Über</string>
@@ -15,10 +16,12 @@
<string name="open">Öffnen</string> <string name="open">Öffnen</string>
<string name="cancel">Abbrechen</string> <string name="cancel">Abbrechen</string>
<string name="open_anyway">Trotzdem öffnen</string> <string name="open_anyway">Trotzdem öffnen</string>
<string name="risk_warning">Diese URL wirkt ungewöhnlich. Prüfe sie, bevor du öffnest.</string> <string name="risk_warning_title">Diese URL wirkt ungewöhnlich</string>
<string name="risk_warning">Prüfe den Link vor dem Öffnen. Die Warnung wird auf deinem Gerät berechnet, ohne den Scan irgendwohin zu senden.</string>
<string name="delete_all">Alles löschen</string> <string name="delete_all">Alles löschen</string>
<string name="confirm_delete_all">Alle Historie-Einträge löschen?</string> <string name="confirm_delete_all">Alle Historie-Einträge löschen?</string>
<string name="confirm">Bestätigen</string> <string name="confirm">Bestätigen</string>
<string name="close">Schließen</string>
<string name="search">Suchen</string> <string name="search">Suchen</string>
<string name="flashlight">Taschenlampe</string> <string name="flashlight">Taschenlampe</string>
<string name="camera_permission_title">Kamerazugriff erforderlich</string> <string name="camera_permission_title">Kamerazugriff erforderlich</string>
@@ -28,9 +31,11 @@
<string name="delete_history_on_disable">Vorhandene Historie beim Deaktivieren löschen?</string> <string name="delete_history_on_disable">Vorhandene Historie beim Deaktivieren löschen?</string>
<string name="version">Version 1.0.0</string> <string name="version">Version 1.0.0</string>
<string name="licenses">Open-Source-Lizenzen</string> <string name="licenses">Open-Source-Lizenzen</string>
<string name="contact">Kontakt: support@example.com</string> <string name="contact">Kontakt: softwareapp.hb@gmail.com</string>
<string name="content_type">Typ</string> <string name="content_type">Typ</string>
<string name="content_value">Inhalt</string> <string name="content_value">Inhalt</string>
<string name="base64_encoded_notice">Als Base64 angezeigt, weil die gescannten Daten nicht als Text dargestellt werden können.</string>
<string name="base64_encoded_inline">Base64-codiert: %1$s</string>
<string name="request_camera">Kamera erlauben</string> <string name="request_camera">Kamera erlauben</string>
<string name="pinch_to_zoom_hint">Zum Zoomen bei kleinen Codes mit zwei Fingern aufziehen</string> <string name="pinch_to_zoom_hint">Zum Zoomen bei kleinen Codes mit zwei Fingern aufziehen</string>
<string name="aim_center_hint">Code im mittleren Rahmen ausrichten.</string> <string name="aim_center_hint">Code im mittleren Rahmen ausrichten.</string>
@@ -40,16 +45,36 @@
<string name="share_txt">TXT</string> <string name="share_txt">TXT</string>
<string name="share_csv">CSV</string> <string name="share_csv">CSV</string>
<string name="share_json">JSON</string> <string name="share_json">JSON</string>
<string name="history_header_subtitle">Optionale Historie bleibt auf deinem Gerät</string>
<string name="history_hero_title">Vergangene Scans lokal prüfen</string>
<string name="history_hero_subtitle">Gespeicherte Scans jederzeit suchen, exportieren oder löschen.</string>
<string name="privacy_pill_no_ads">Keine Werbung</string>
<string name="privacy_pill_no_tracking">Kein Tracking</string>
<string name="privacy_pill_no_account">Kein Konto</string>
<string name="local_controls">Lokale Kontrolle</string>
<string name="no_saved_scans_yet">Noch keine gespeicherten Scans</string>
<string name="empty_history_description">Aktiviere lokale Historie in den Einstellungen, um private Einträge auf diesem Gerät zu speichern.</string>
<string name="scan_from_image">Aus Bild scannen</string> <string name="scan_from_image">Aus Bild scannen</string>
<string name="import_whitelist">Whitelist importieren</string>
<string name="whitelist_loaded_count">Geladene registrierte IDs: %1$d</string>
<string name="whitelist_import_success">%1$d IDs importiert.</string>
<string name="whitelist_import_empty">IDs konnten aus dieser Datei nicht importiert werden.</string>
<string name="batch_mode">Stapelmodus</string> <string name="batch_mode">Stapelmodus</string>
<string name="batch_captures_count">Stapel-Scans: %1$d</string> <string name="batch_captures_count">Stapel-Scans: %1$d</string>
<string name="clear_batch">Stapel leeren</string> <string name="clear_batch">Stapel leeren</string>
<string name="share_batch">Stapel teilen</string> <string name="share_batch">Stapel teilen</string>
<string name="no_code_found_in_image">Im gewählten Bild wurde kein QR- oder Barcode gefunden.</string> <string name="no_code_found_in_image">Im gewählten Bild wurde kein QR- oder Barcode gefunden.</string>
<string name="image_scan_pick_title">%1$d Codes im Bild gefunden</string> <string name="image_scan_pick_title">%1$d Codes im Bild gefunden</string>
<string name="image_scan_pick_subtitle">Wähle ein Ergebnis aus:</string> <string name="image_scan_pick_subtitle">Wähle das Ergebnis, das du verwenden möchtest. Erkennung und Auswertung erfolgen lokal.</string>
<string name="image_scan_use_selected">Ausgewähltes verwenden</string>
<string name="image_scan_failed">Dieses Bild konnte nicht gelesen werden. Bitte anderes Bild versuchen.</string> <string name="image_scan_failed">Dieses Bild konnte nicht gelesen werden. Bitte anderes Bild versuchen.</string>
<string name="already_scanned">Bereits gescannt</string> <string name="already_scanned">Bereits gescannt</string>
<string name="duplicate_ticket_alert_title">Doppeltes Ticket erkannt</string>
<string name="duplicate_ticket_alert_message">Dieser Ticket-/Code wurde bereits gescannt. Bitte Eintritt sofort prüfen, um Betrug zu verhindern.</string>
<string name="duplicate_ticket_alert_code">Code: %1$s</string>
<string name="unregistered_ticket_alert_title">Nicht registriertes Ticket erkannt</string>
<string name="unregistered_ticket_alert_message">Dieser Ticket-/Code ist nicht in der importierten Whitelist. Bitte Registrierung prüfen.</string>
<string name="unregistered_ticket_alert_code">Code: %1$s</string>
<string name="view_history">Historie anzeigen</string> <string name="view_history">Historie anzeigen</string>
<string name="call_number">Nummer anrufen</string> <string name="call_number">Nummer anrufen</string>
<string name="send_sms">SMS senden</string> <string name="send_sms">SMS senden</string>
@@ -57,13 +82,18 @@
<string name="open_wifi_settings">WLAN-Einstellungen öffnen</string> <string name="open_wifi_settings">WLAN-Einstellungen öffnen</string>
<string name="add_contact">Kontakt hinzufügen</string> <string name="add_contact">Kontakt hinzufügen</string>
<string name="add_calendar_event">Kalendereintrag hinzufügen</string> <string name="add_calendar_event">Kalendereintrag hinzufügen</string>
<string name="support_email">support@example.com</string> <string name="review_app">Bei Google Play bewerten</string>
<string name="feature_request">Feature-Request-Formular</string> <string name="active_use_case_view">Aktive Use-Case-Ansicht</string>
<string name="feature_request_title">Feature-Request</string> <string name="select_use_case_view">Use-Case-Ansicht wählen</string>
<string name="feature_request_name">Dein Name</string> <string name="use_case_everyday_personal">Alltägliche private Nutzung</string>
<string name="feature_request_email">Deine E-Mail</string> <string name="use_case_event_ticketing">Events &amp; Ticketing</string>
<string name="feature_request_details">Was brauchst du?</string> <string name="use_case_everyday_description">Vollständiger privater Scanner mit lokalem Verlauf und üblichen Ergebnisaktionen.</string>
<string name="feature_request_subject">Feature-Request von App-Nutzer</string> <string name="use_case_event_ticketing_description">Batch-Scanning, Duplikaterkennung, Whitelist-Import und Batch-Teilen.</string>
<string name="send_request">Anfrage senden</string> <string name="settings_header_subtitle">Einstellungen, die dir Kontrolle geben</string>
<string name="feature_request_sent">E-Mail-App wird geöffnet...</string> <string name="settings_hero_title">Deine Privatsphäre-Einstellungen</string>
<string name="settings_hero_subtitle">Wähle lokale Historie, Sicherheitswarnungen, Feedback und die Scanneransicht, die zu deinem Workflow passt.</string>
<string name="result_local_check">Lokale Prüfung</string>
<string name="result_checked_on_device">Vor dem Öffnen auf dem Gerät geprüft</string>
<string name="result_encoded_data">Codierte Daten</string>
<string name="batch_ticket_privacy_note">Warnungen zu doppelten und nicht registrierten Tickets bleiben auf dem Gerät.</string>
</resources> </resources>
+44 -14
View File
@@ -1,12 +1,13 @@
<resources> <resources>
<string name="app_name">Clean Scanner</string> <string name="app_name">Private QR Scanner</string>
<string name="scan">Scan</string> <string name="scan">Scan</string>
<string name="scan_again">Scan again</string> <string name="scan_again">Scan again</string>
<string name="history">History</string> <string name="history">History</string>
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="save_history">Save history (local)</string> <string name="save_history">Save history (local)</string>
<string name="privacy">Privacy</string> <string name="privacy">Privacy</string>
<string name="privacy_text">No data transfer, no ads, no tracking.</string> <string name="privacy_policy">Privacy Policy</string>
<string name="privacy_text">Local processing, no ads, no tracking. See the privacy policy for details.</string>
<string name="security_warnings">Security warnings</string> <string name="security_warnings">Security warnings</string>
<string name="scan_feedback">Scan feedback (beep + haptic)</string> <string name="scan_feedback">Scan feedback (beep + haptic)</string>
<string name="about">About</string> <string name="about">About</string>
@@ -15,10 +16,12 @@
<string name="open">Open</string> <string name="open">Open</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="open_anyway">Open anyway</string> <string name="open_anyway">Open anyway</string>
<string name="risk_warning">This URL looks unusual. Check it before opening.</string> <string name="risk_warning_title">This URL looks unusual</string>
<string name="risk_warning">Check the link before opening. The warning is calculated on your device, without sending the scan anywhere.</string>
<string name="delete_all">Delete all</string> <string name="delete_all">Delete all</string>
<string name="confirm_delete_all">Delete all history entries?</string> <string name="confirm_delete_all">Delete all history entries?</string>
<string name="confirm">Confirm</string> <string name="confirm">Confirm</string>
<string name="close">Close</string>
<string name="search">Search</string> <string name="search">Search</string>
<string name="flashlight">Flashlight</string> <string name="flashlight">Flashlight</string>
<string name="camera_permission_title">Camera access required</string> <string name="camera_permission_title">Camera access required</string>
@@ -28,9 +31,11 @@
<string name="delete_history_on_disable">Delete existing history when disabling?</string> <string name="delete_history_on_disable">Delete existing history when disabling?</string>
<string name="version">Version 1.0.0</string> <string name="version">Version 1.0.0</string>
<string name="licenses">Open-source licenses</string> <string name="licenses">Open-source licenses</string>
<string name="contact">Contact: support@example.com</string> <string name="contact">Contact: softwareapp.hb@gmail.com</string>
<string name="content_type">Type</string> <string name="content_type">Type</string>
<string name="content_value">Content</string> <string name="content_value">Content</string>
<string name="base64_encoded_notice">Displayed as Base64 because the scanned data cannot be shown as text.</string>
<string name="base64_encoded_inline">Base64 encoded: %1$s</string>
<string name="request_camera">Allow camera</string> <string name="request_camera">Allow camera</string>
<string name="pinch_to_zoom_hint">Pinch to zoom for small codes</string> <string name="pinch_to_zoom_hint">Pinch to zoom for small codes</string>
<string name="aim_center_hint">Aim the code inside the center frame.</string> <string name="aim_center_hint">Aim the code inside the center frame.</string>
@@ -40,16 +45,36 @@
<string name="share_txt">TXT</string> <string name="share_txt">TXT</string>
<string name="share_csv">CSV</string> <string name="share_csv">CSV</string>
<string name="share_json">JSON</string> <string name="share_json">JSON</string>
<string name="history_header_subtitle">Optional history stays on your device</string>
<string name="history_hero_title">Review past scans locally</string>
<string name="history_hero_subtitle">Search, export, or delete saved scans whenever you choose.</string>
<string name="privacy_pill_no_ads">No ads</string>
<string name="privacy_pill_no_tracking">No tracking</string>
<string name="privacy_pill_no_account">No account</string>
<string name="local_controls">Local controls</string>
<string name="no_saved_scans_yet">No saved scans yet</string>
<string name="empty_history_description">Enable local history in settings to keep a private record on this device.</string>
<string name="scan_from_image">Scan from image</string> <string name="scan_from_image">Scan from image</string>
<string name="import_whitelist">Import whitelist</string>
<string name="whitelist_loaded_count">Registered IDs loaded: %1$d</string>
<string name="whitelist_import_success">Imported %1$d IDs.</string>
<string name="whitelist_import_empty">Could not import IDs from this file.</string>
<string name="batch_mode">Batch mode</string> <string name="batch_mode">Batch mode</string>
<string name="batch_captures_count">Batch captures: %1$d</string> <string name="batch_captures_count">Batch captures: %1$d</string>
<string name="clear_batch">Clear batch</string> <string name="clear_batch">Clear batch</string>
<string name="share_batch">Share batch</string> <string name="share_batch">Share batch</string>
<string name="no_code_found_in_image">No QR or barcode found in the selected image.</string> <string name="no_code_found_in_image">No QR or barcode found in the selected image.</string>
<string name="image_scan_pick_title">Found %1$d codes in image</string> <string name="image_scan_pick_title">Found %1$d codes in image</string>
<string name="image_scan_pick_subtitle">Choose a result to use:</string> <string name="image_scan_pick_subtitle">Choose the result you want to use. Detection and parsing happen locally.</string>
<string name="image_scan_use_selected">Use selected</string>
<string name="image_scan_failed">Could not read this image. Try another one.</string> <string name="image_scan_failed">Could not read this image. Try another one.</string>
<string name="already_scanned">Already scanned</string> <string name="already_scanned">Already scanned</string>
<string name="duplicate_ticket_alert_title">Duplicate ticket detected</string>
<string name="duplicate_ticket_alert_message">This ticket/code was scanned before. Verify entry immediately to prevent fraud.</string>
<string name="duplicate_ticket_alert_code">Code: %1$s</string>
<string name="unregistered_ticket_alert_title">Unregistered ticket detected</string>
<string name="unregistered_ticket_alert_message">This ticket/code is not in the imported whitelist. Verify attendee registration.</string>
<string name="unregistered_ticket_alert_code">Code: %1$s</string>
<string name="view_history">View history</string> <string name="view_history">View history</string>
<string name="call_number">Call number</string> <string name="call_number">Call number</string>
<string name="send_sms">Send SMS</string> <string name="send_sms">Send SMS</string>
@@ -57,13 +82,18 @@
<string name="open_wifi_settings">Open Wi-Fi settings</string> <string name="open_wifi_settings">Open Wi-Fi settings</string>
<string name="add_contact">Add contact</string> <string name="add_contact">Add contact</string>
<string name="add_calendar_event">Add calendar event</string> <string name="add_calendar_event">Add calendar event</string>
<string name="support_email">support@example.com</string> <string name="review_app">Review on Google Play</string>
<string name="feature_request">Feature request form</string> <string name="active_use_case_view">Active use-case view</string>
<string name="feature_request_title">Feature request</string> <string name="select_use_case_view">Select use-case view</string>
<string name="feature_request_name">Your name</string> <string name="use_case_everyday_personal">Everyday personal use</string>
<string name="feature_request_email">Your email</string> <string name="use_case_event_ticketing">Event &amp; ticketing</string>
<string name="feature_request_details">What do you need?</string> <string name="use_case_everyday_description">Full personal scanner with local history and common result actions.</string>
<string name="feature_request_subject">Feature request from app user</string> <string name="use_case_event_ticketing_description">Batch scanning, duplicate detection, whitelist import, and batch sharing.</string>
<string name="send_request">Send request</string> <string name="settings_header_subtitle">Settings that keep you in control</string>
<string name="feature_request_sent">Opening email app...</string> <string name="settings_hero_title">Privacy settings are yours</string>
<string name="settings_hero_subtitle">Choose local history, security warnings, feedback, and the scanner view that fits your workflow.</string>
<string name="result_local_check">Local check</string>
<string name="result_checked_on_device">Checked on device before opening</string>
<string name="result_encoded_data">Encoded data</string>
<string name="batch_ticket_privacy_note">Duplicate and unregistered ticket alerts stay on device.</string>
</resources> </resources>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en-US" />
<locale android:name="de" />
</locale-config>
@@ -1,76 +0,0 @@
package com.clean.scanner.util
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
class UrlRiskScorerTest {
@Test
fun `https domain has low risk`() {
val result = UrlRiskScorer.score("https://example.com")
assertEquals(0, result.score)
}
@Test
fun `http adds two points`() {
val result = UrlRiskScorer.score("http://example.com")
assertEquals(2, result.score)
}
@Test
fun `ip host adds two points`() {
val result = UrlRiskScorer.score("https://192.168.1.1/path")
assertEquals(2, result.score)
}
@Test
fun `punycode host adds two points`() {
val result = UrlRiskScorer.score("https://xn--pple-43d.com")
assertEquals(2, result.score)
}
@Test
fun `long host adds one point`() {
val result = UrlRiskScorer.score("https://averyveryveryveryveryveryveryverylonghostname.com")
assertTrue(result.score >= 1)
}
@Test
fun `long query adds one point`() {
val query = "a".repeat(121)
val result = UrlRiskScorer.score("https://example.com/?q=$query")
assertEquals(1, result.score)
}
@Test
fun `many percent encodings adds one point`() {
val encoded = (1..11).joinToString("") { "%20" }
val result = UrlRiskScorer.score("https://example.com/$encoded")
assertEquals(1, result.score)
}
@Test
fun `userinfo adds two points`() {
val result = UrlRiskScorer.score("https://user:pass@example.com")
assertEquals(2, result.score)
}
@Test
fun `combined risk can exceed threshold`() {
val result = UrlRiskScorer.score("http://user:pass@192.168.0.1")
assertTrue(result.score >= 6)
}
@Test
fun `invalid url returns zero`() {
val result = UrlRiskScorer.score("not a url")
assertEquals(0, result.score)
}
@Test
fun `reasons list is populated for risky urls`() {
val result = UrlRiskScorer.score("http://xn--pple-43d.com")
assertTrue(result.reasons.isNotEmpty())
}
}
@@ -1,4 +1,4 @@
package com.clean.scanner.testutil package de.softwareapp_hb.privateqrscanner.testutil
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -1,7 +1,7 @@
package com.clean.scanner.ui package de.softwareapp_hb.privateqrscanner.ui
import com.clean.scanner.domain.ScanResult import de.softwareapp_hb.privateqrscanner.domain.ScanResult
import com.clean.scanner.testutil.MainDispatcherRule import de.softwareapp_hb.privateqrscanner.testutil.MainDispatcherRule
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
@@ -115,4 +115,21 @@ class ScannerViewModelTest {
assertEquals(1, saved.size) assertEquals(1, saved.size)
assertEquals(1, state.batchResults.size) assertEquals(1, state.batchResults.size)
} }
@Test
fun onScan_base64EncodedScan_savesTypeWithBase64Marker() = runTest {
val saved = mutableListOf<Pair<String, String>>()
val viewModel = ScannerViewModel(
saveScan = { content, type -> saved += content to type },
nowProvider = { 1_000L }
)
viewModel.onScan(ScanResult(content = "AAEC", type = "Text", isBase64Encoded = true))
advanceUntilIdle()
val state = viewModel.uiState.value
assertEquals("Text (Base64)", state.lastResult?.displayType)
assertEquals(listOf("Text (Base64)|AAEC"), state.recentScanKeys)
assertEquals(listOf("AAEC" to "Text (Base64)"), saved)
}
} }
@@ -0,0 +1,71 @@
package de.softwareapp_hb.privateqrscanner.util
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class BarcodePayloadTest {
@Test
fun readablePayload_prefersDisplayableRawValue() {
val payload = readablePayload(
rawValue = " hello world ",
displayValue = null,
rawBytes = null
)
assertEquals("hello world", payload?.content)
assertFalse(payload?.isBase64Encoded ?: true)
}
@Test
fun readablePayload_keepsDisplayableUtf8Bytes() {
val text = "Ticket \uD83D\uDE00"
val payload = readablePayload(
rawValue = null,
displayValue = null,
rawBytes = text.toByteArray(Charsets.UTF_8)
)
assertEquals(text, payload?.content)
assertFalse(payload?.isBase64Encoded ?: true)
}
@Test
fun readablePayload_base64EncodesBinaryBytes() {
val payload = readablePayload(
rawValue = null,
displayValue = null,
rawBytes = byteArrayOf(0x00, 0x01, 0x02, 0x03, 0xFF.toByte())
)
assertEquals("AAECA/8=", payload?.content)
assertTrue(payload?.isBase64Encoded ?: false)
}
@Test
fun readablePayload_base64EncodesRawBytesWhenRawValueContainsReplacementCharacter() {
val payload = readablePayload(
rawValue = "broken \uFFFD",
displayValue = null,
rawBytes = byteArrayOf(0x00, 0x01, 0x02)
)
assertEquals("AAEC", payload?.content)
assertTrue(payload?.isBase64Encoded ?: false)
}
@Test
fun readablePayload_base64EncodesRawValueWhenNoBytesAreAvailable() {
val payload = readablePayload(
rawValue = "A\u0000B",
displayValue = null,
rawBytes = null
)
assertEquals("QQBC", payload?.content)
assertTrue(payload?.isBase64Encoded ?: false)
}
}
@@ -1,6 +1,6 @@
package com.clean.scanner.util package de.softwareapp_hb.privateqrscanner.util
import com.clean.scanner.domain.ScanRecord import de.softwareapp_hb.privateqrscanner.domain.ScanRecord
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue
import org.junit.Test import org.junit.Test
@@ -1,4 +1,4 @@
package com.clean.scanner.util package de.softwareapp_hb.privateqrscanner.util
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse import org.junit.Assert.assertFalse
@@ -0,0 +1,150 @@
package de.softwareapp_hb.privateqrscanner.util
import de.softwareapp_hb.privateqrscanner.domain.UrlRiskResult
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
class UrlRiskScorerTest {
@Test
fun `https domain has low risk`() {
val result = UrlRiskScorer.score("https://example.com")
assertEquals(0, result.score)
}
@Test
fun `http adds two points`() {
val result = UrlRiskScorer.score("http://example.com")
assertEquals(2, result.score)
}
@Test
fun `ip host adds two points`() {
val result = UrlRiskScorer.score("https://93.184.216.34/path")
assertEquals(2, result.score)
}
@Test
fun `private ip host adds extra risk`() {
val result = UrlRiskScorer.score("https://192.168.1.1/path")
assertAtLeast(4, result.score)
assertReasonContains(result, "private or reserved IP")
}
@Test
fun `punycode host adds two points`() {
val result = UrlRiskScorer.score("https://xn--pple-43d.com")
assertAtLeast(2, result.score)
assertReasonContains(result, "punycode")
}
@Test
fun `long host adds one point`() {
val result = UrlRiskScorer.score("https://averyveryveryveryveryveryveryverylonghostname.com")
assertTrue(result.score >= 1)
}
@Test
fun `long query adds one point`() {
val query = "a".repeat(121)
val result = UrlRiskScorer.score("https://example.com/?q=$query")
assertEquals(1, result.score)
}
@Test
fun `many percent encodings adds one point`() {
val encoded = (1..11).joinToString("") { "%20" }
val result = UrlRiskScorer.score("https://example.com/$encoded")
assertEquals(1, result.score)
}
@Test
fun `userinfo adds two points`() {
val result = UrlRiskScorer.score("https://user:pass@example.com")
assertEquals(2, result.score)
}
@Test
fun `url shortener adds risk`() {
val result = UrlRiskScorer.score("https://bit.ly/privateqr")
assertAtLeast(2, result.score)
assertReasonContains(result, "shortener")
}
@Test
fun `non web scheme is high risk`() {
val result = UrlRiskScorer.score("javascript:alert(1)")
assertAtLeast(5, result.score)
assertReasonContains(result, "unsafe URL scheme")
}
@Test
fun `official brand login stays below warning threshold`() {
val result = UrlRiskScorer.score("https://accounts.google.com/login")
assertTrue(result.score < 3)
}
@Test
fun `regional brand domain does not trigger impersonation heuristic`() {
val result = UrlRiskScorer.score("https://google.de/login")
assertTrue(result.score < 3)
}
@Test
fun `brand embedded in unofficial host is risky`() {
val result = UrlRiskScorer.score("https://paypal-security.example.com/login")
assertAtLeast(3, result.score)
assertReasonContains(result, "known brand")
}
@Test
fun `lookalike brand host is risky`() {
val result = UrlRiskScorer.score("https://paypa1.com")
assertAtLeast(3, result.score)
assertReasonContains(result, "resembles a known brand")
}
@Test
fun `external redirect parameter is risky`() {
val result = UrlRiskScorer.score("https://example.com/login?redirect=https%3A%2F%2Fevil.test")
assertAtLeast(3, result.score)
assertReasonContains(result, "redirects to another domain")
}
@Test
fun `downloadable executable path is risky`() {
val result = UrlRiskScorer.score("https://example.com/security-update.apk")
assertAtLeast(3, result.score)
assertReasonContains(result, "executable file")
}
@Test
fun `combined risk can exceed threshold`() {
val result = UrlRiskScorer.score("http://user:pass@192.168.0.1")
assertTrue(result.score >= 6)
}
@Test
fun `invalid url returns zero`() {
val result = UrlRiskScorer.score("not a url")
assertEquals(0, result.score)
}
@Test
fun `reasons list is populated for risky urls`() {
val result = UrlRiskScorer.score("http://xn--pple-43d.com")
assertTrue(result.reasons.isNotEmpty())
}
private fun assertAtLeast(expectedMinimum: Int, actual: Int) {
assertTrue("Expected score >= $expectedMinimum but was $actual", actual >= expectedMinimum)
}
private fun assertReasonContains(result: UrlRiskResult, text: String) {
assertTrue(
"Expected reasons to contain '$text' but were ${result.reasons}",
result.reasons.any { it.contains(text, ignoreCase = true) }
)
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
plugins { plugins {
id("com.android.application") version "9.0.1" apply false id("com.android.application") version "9.2.1" apply false
id("com.google.devtools.ksp") version "2.3.5" apply false id("com.google.devtools.ksp") version "2.3.5" apply false
id("org.jetbrains.kotlin.plugin.compose") version "2.3.10" apply false id("org.jetbrains.kotlin.plugin.compose") version "2.3.21" apply false
} }
@@ -0,0 +1,11 @@
<en-US>
Initial release of Private QR Scanner.
Scan QR codes and barcodes with local processing, optional on-device history, scan-from-image support, URL safety warnings, and practical actions for links, contacts, Wi-Fi codes, email, SMS, phone numbers, and calendar events.
</en-US>
<de-DE>
Erste Version von Private QR Scanner.
Scanne QR-Codes und Barcodes mit lokaler Verarbeitung, optionalem Verlauf auf dem Gerät, Bild-Scan, URL-Sicherheitswarnungen und praktischen Aktionen für Links, Kontakte, WLAN-Codes, E-Mail, SMS, Telefonnummern und Kalenderereignisse.
</de-DE>
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored Regular → Executable
View File
+1 -1
View File
@@ -18,5 +18,5 @@ dependencyResolutionManagement {
} }
} }
rootProject.name = "CleanScanner" rootProject.name = "PrivateQRScanner"
include(":app") include(":app")
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 KiB

@@ -0,0 +1,42 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1800, height=3200, initial-scale=1">
<title>Private QR Scanner 10-inch Tablet Screenshots</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
width: 1800px;
height: 3200px;
margin: 0;
overflow: hidden;
background: #f6fbfa;
}
iframe {
position: absolute;
inset: 0 auto auto 0;
width: 1440px;
height: 2560px;
border: 0;
transform: scale(1.25);
transform-origin: top left;
pointer-events: none;
}
</style>
</head>
<body>
<iframe id="source" title="Private QR Scanner screenshot source"></iframe>
<script>
const params = new URLSearchParams(window.location.search);
const screen = params.get("screen") || "1";
document.getElementById("source").src =
`private-qr-scanner-7in-tablet-screenshots.html?screen=${encodeURIComponent(screen)}`;
</script>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 902 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -0,0 +1,389 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1024, height=500, initial-scale=1">
<title>Private QR Scanner Feature Graphic</title>
<style>
:root {
--ink: #f8fafc;
--muted: #cbe7e3;
--deep: #07111f;
--navy: #0b1220;
--teal-900: #0f3f45;
--teal-700: #155e63;
--teal-300: #2dd4bf;
--mint: #dff7f2;
}
* {
box-sizing: border-box;
}
html,
body {
width: 1024px;
height: 500px;
margin: 0;
overflow: hidden;
background: var(--deep);
font-family: Inter, "DejaVu Sans", Arial, sans-serif;
}
body {
display: grid;
place-items: stretch;
}
.feature {
position: relative;
width: 1024px;
height: 500px;
overflow: hidden;
color: var(--ink);
background:
radial-gradient(circle at 78% 34%, rgba(45, 212, 191, 0.24), transparent 29%),
radial-gradient(circle at 12% 86%, rgba(223, 247, 242, 0.12), transparent 24%),
linear-gradient(132deg, #0b1220 0%, #103a42 50%, #07111f 100%);
}
.feature::before,
.feature::after {
content: "";
position: absolute;
left: -80px;
right: -80px;
pointer-events: none;
}
.feature::before {
top: 210px;
height: 210px;
background: #061525;
clip-path: polygon(0 58%, 16% 29%, 33% 20%, 51% 33%, 70% 36%, 88% 21%, 100% 8%, 100% 100%, 0 100%);
opacity: 0.82;
}
.feature::after {
top: -32px;
height: 214px;
background: #1f7778;
clip-path: polygon(0 0, 100% 0, 100% 46%, 83% 65%, 67% 58%, 51% 40%, 31% 35%, 15% 54%, 0 75%);
opacity: 0.36;
}
.grid {
position: relative;
z-index: 1;
display: grid;
grid-template-columns: 506px 1fr;
gap: 38px;
height: 100%;
padding: 56px 64px 48px 74px;
align-items: center;
}
.copy {
align-self: center;
}
.kicker {
display: inline-flex;
align-items: center;
gap: 10px;
height: 38px;
padding: 0 16px 0 12px;
border-radius: 999px;
color: var(--mint);
background: rgba(223, 247, 242, 0.1);
border: 1px solid rgba(223, 247, 242, 0.22);
font-size: 17px;
font-weight: 700;
letter-spacing: 0;
}
.kicker svg {
width: 20px;
height: 20px;
flex: 0 0 auto;
}
h1 {
margin: 18px 0 0;
color: var(--ink);
font-size: 68px;
line-height: 0.98;
font-weight: 850;
letter-spacing: 0;
}
.subtitle {
width: 445px;
margin: 22px 0 0;
color: var(--muted);
font-size: 28px;
line-height: 1.23;
font-weight: 520;
letter-spacing: 0;
}
.checks {
display: flex;
gap: 12px;
margin-top: 32px;
}
.check {
display: inline-flex;
align-items: center;
gap: 9px;
height: 48px;
padding: 0 17px 0 14px;
border-radius: 14px;
color: #061525;
background: var(--mint);
font-size: 22px;
font-weight: 800;
white-space: nowrap;
box-shadow: 0 10px 24px rgba(2, 6, 23, 0.22);
}
.check:nth-child(2) {
background: var(--teal-300);
}
.check:nth-child(3) {
background: #f8fafc;
}
.check svg {
width: 19px;
height: 19px;
flex: 0 0 auto;
}
.visual {
position: relative;
height: 390px;
}
.halo {
position: absolute;
inset: 16px 5px 12px 34px;
border-radius: 44px;
background: rgba(223, 247, 242, 0.06);
border: 1px solid rgba(223, 247, 242, 0.08);
transform: rotate(-5deg);
}
.phone {
position: absolute;
right: 40px;
top: 9px;
width: 238px;
height: 374px;
border-radius: 36px;
padding: 15px;
background: linear-gradient(145deg, #e5fbf7, #f8fafc);
box-shadow: 0 28px 48px rgba(2, 6, 23, 0.42);
}
.phone::before {
content: "";
position: absolute;
top: 9px;
left: 91px;
width: 56px;
height: 7px;
border-radius: 999px;
background: #0b1220;
opacity: 0.8;
}
.screen {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
border-radius: 25px;
background:
linear-gradient(90deg, rgba(45, 212, 191, 0.12) 1px, transparent 1px) 0 0 / 28px 28px,
linear-gradient(0deg, rgba(45, 212, 191, 0.12) 1px, transparent 1px) 0 0 / 28px 28px,
radial-gradient(circle at 47% 42%, rgba(45, 212, 191, 0.18), transparent 27%),
linear-gradient(160deg, #07111f 0%, #123b3f 100%);
}
.scan-window {
position: absolute;
left: 39px;
top: 77px;
width: 132px;
height: 132px;
}
.corner {
position: absolute;
width: 36px;
height: 36px;
border-color: var(--teal-300);
border-style: solid;
}
.corner.tl {
top: 0;
left: 0;
border-width: 7px 0 0 7px;
border-radius: 13px 0 0 0;
}
.corner.tr {
top: 0;
right: 0;
border-width: 7px 7px 0 0;
border-radius: 0 13px 0 0;
}
.corner.bl {
left: 0;
bottom: 0;
border-width: 0 0 7px 7px;
border-radius: 0 0 0 13px;
}
.corner.br {
right: 0;
bottom: 0;
border-width: 0 7px 7px 0;
border-radius: 0 0 13px 0;
}
.qr {
position: absolute;
inset: 21px;
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 6px;
padding: 5px;
border-radius: 8px;
background: rgba(248, 250, 252, 0.96);
}
.qr span {
border-radius: 2px;
background: #08111f;
}
.qr span:nth-child(5n+3),
.qr span:nth-child(7),
.qr span:nth-child(18) {
background: var(--teal-300);
}
.scan-line {
position: absolute;
left: 25px;
right: 25px;
top: 139px;
height: 4px;
border-radius: 999px;
background: linear-gradient(90deg, transparent, var(--teal-300), transparent);
box-shadow: 0 0 22px rgba(45, 212, 191, 0.8);
}
.result {
position: absolute;
left: 23px;
right: 23px;
bottom: 25px;
height: 76px;
padding: 14px 15px;
border-radius: 18px;
background: rgba(248, 250, 252, 0.94);
color: var(--navy);
box-shadow: 0 14px 28px rgba(2, 6, 23, 0.22);
}
.result strong {
display: block;
font-size: 18px;
line-height: 1;
font-weight: 850;
}
.result span {
display: block;
margin-top: 8px;
color: #155e63;
font-size: 13px;
line-height: 1.1;
font-weight: 700;
}
</style>
</head>
<body>
<main class="feature">
<section class="grid">
<div class="copy">
<div class="kicker">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M12 3L19 6V11C19 15.7 16.1 19.9 12 21.8C7.9 19.9 5 15.7 5 11V6L12 3Z" fill="#2DD4BF"/>
<path d="M9 12L11.1 14.1L15.5 9.7" stroke="#061525" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Local-first privacy
</div>
<h1>Private QR<br>Scanner</h1>
<p class="subtitle">Scan QR codes and barcodes without ads, tracking, or accounts.</p>
<div class="checks" aria-label="Feature highlights">
<div class="check">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M20 6L9 17L4 12" stroke="#061525" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Local
</div>
<div class="check">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M20 6L9 17L4 12" stroke="#061525" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
No ads
</div>
<div class="check">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M20 6L9 17L4 12" stroke="#061525" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
No tracking
</div>
</div>
</div>
<div class="visual" aria-hidden="true">
<div class="halo"></div>
<div class="phone">
<div class="screen">
<div class="scan-window">
<div class="qr">
<span></span><span></span><span></span><span></span><span></span>
<span></span><span></span><span></span><span></span><span></span>
<span></span><span></span><span></span><span></span><span></span>
<span></span><span></span><span></span><span></span><span></span>
<span></span><span></span><span></span><span></span><span></span>
</div>
<div class="corner tl"></div>
<div class="corner tr"></div>
<div class="corner bl"></div>
<div class="corner br"></div>
</div>
<div class="scan-line"></div>
<div class="result">
<strong>Ready to scan</strong>
<span>Inspect first</span>
</div>
</div>
</div>
</div>
</section>
</main>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" role="img" aria-label="Private QR Scanner app icon">
<rect width="512" height="512" fill="#0B1220"/>
<path d="M0 313C90 257 148 242 232 268C327 297 389 274 512 180V512H0Z" fill="#123B3F"/>
<path d="M0 0H512V138C407 205 331 224 246 199C157 172 80 190 0 247Z" fill="#165A61" opacity="0.74"/>
<path d="M256 88L379 136V236C379 316 326 387 256 421C186 387 133 316 133 236V136Z" fill="#F8FAFC"/>
<path d="M256 112L351 149V236C351 300 312 356 256 387C200 356 161 300 161 236V149Z" fill="#DFF7F2"/>
<path d="M194 184H232V222H194Z M251 184H289V222H251Z M308 184H346V222H308Z M194 241H232V279H194Z M308 241H346V279H308Z M194 298H232V336H194Z M251 298H289V336H251Z M308 298H346V336H308Z" fill="#0B1220"/>
<path d="M251 241H289V279H251Z" fill="#2DD4BF"/>
<path d="M146 162H170V138H232V162H194V186H146Z M342 138V162H366V224H342V186H318V138Z M146 350V326H170V288H146V350H208V326H170V350Z M366 350H304V326H342V288H366Z" fill="#2DD4BF"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,515 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1080, height=1920, initial-scale=1">
<title>Private QR Scanner Screenshot 1</title>
<style>
:root {
--bg: #07111f;
--surface: #f8fafc;
--surface-2: #eef7f5;
--ink: #0b1220;
--muted: #5e7282;
--teal: #2dd4bf;
--mint: #dff7f2;
--blue: #1d4ed8;
}
* {
box-sizing: border-box;
}
html,
body {
width: 1080px;
height: 1920px;
margin: 0;
overflow: hidden;
font-family: Inter, "DejaVu Sans", Arial, sans-serif;
background: var(--bg);
color: var(--surface);
}
.shot {
position: relative;
width: 1080px;
height: 1920px;
overflow: hidden;
background:
radial-gradient(circle at 72% 17%, rgba(45, 212, 191, 0.22), transparent 27%),
radial-gradient(circle at 22% 70%, rgba(223, 247, 242, 0.10), transparent 24%),
linear-gradient(180deg, #0b1220 0%, #103840 52%, #07111f 100%);
}
.camera {
position: absolute;
inset: 0;
overflow: hidden;
background:
linear-gradient(90deg, rgba(45, 212, 191, 0.09) 1px, transparent 1px) 0 0 / 68px 68px,
linear-gradient(0deg, rgba(45, 212, 191, 0.08) 1px, transparent 1px) 0 0 / 68px 68px,
radial-gradient(circle at 58% 38%, rgba(45, 212, 191, 0.17), transparent 22%),
linear-gradient(150deg, rgba(8, 17, 31, 0.15), rgba(8, 17, 31, 0.78));
}
.camera::before,
.camera::after {
content: "";
position: absolute;
left: -120px;
right: -120px;
pointer-events: none;
}
.camera::before {
top: 314px;
height: 424px;
background: rgba(223, 247, 242, 0.10);
clip-path: polygon(0 63%, 19% 42%, 38% 48%, 58% 33%, 78% 42%, 100% 21%, 100% 100%, 0 100%);
}
.camera::after {
top: 642px;
height: 470px;
background: rgba(2, 6, 23, 0.58);
clip-path: polygon(0 23%, 18% 10%, 36% 28%, 54% 18%, 73% 31%, 100% 13%, 100% 100%, 0 100%);
}
.status {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 5;
display: flex;
justify-content: space-between;
align-items: center;
height: 92px;
padding: 22px 44px 0;
color: #f8fafc;
font-size: 24px;
font-weight: 760;
}
.system-icons {
display: flex;
align-items: center;
gap: 10px;
}
.signal {
display: flex;
align-items: end;
gap: 4px;
height: 22px;
}
.signal span {
width: 5px;
border-radius: 999px;
background: #f8fafc;
}
.signal span:nth-child(1) { height: 8px; }
.signal span:nth-child(2) { height: 12px; }
.signal span:nth-child(3) { height: 16px; }
.signal span:nth-child(4) { height: 21px; }
.battery {
width: 42px;
height: 20px;
border: 2px solid #f8fafc;
border-radius: 6px;
padding: 3px;
}
.battery::after {
content: "";
display: block;
width: 27px;
height: 10px;
border-radius: 3px;
background: var(--teal);
}
.top-chip {
position: absolute;
top: 118px;
left: 212px;
right: 212px;
z-index: 3;
display: flex;
justify-content: center;
align-items: center;
min-height: 56px;
padding: 11px 18px;
border-radius: 18px;
color: white;
background: rgba(0, 0, 0, 0.45);
font-size: 23px;
font-weight: 700;
text-align: center;
box-shadow: 0 18px 42px rgba(2, 6, 23, 0.24);
}
.gallery {
position: absolute;
top: 112px;
right: 42px;
z-index: 3;
display: grid;
place-items: center;
width: 64px;
height: 64px;
border: 1px solid rgba(248, 250, 252, 0.22);
border-radius: 18px;
background: rgba(0, 0, 0, 0.38);
}
.gallery svg {
width: 32px;
height: 32px;
}
.aim {
position: absolute;
top: 392px;
left: 166px;
z-index: 2;
width: 748px;
height: 480px;
border-radius: 54px;
background: rgba(45, 212, 191, 0.06);
border: 7px solid rgba(45, 212, 191, 0.9);
box-shadow:
inset 0 0 0 2px rgba(223, 247, 242, 0.20),
0 0 72px rgba(45, 212, 191, 0.27);
}
.qr-target {
position: absolute;
top: 478px;
left: 332px;
z-index: 3;
width: 416px;
height: 300px;
border-radius: 26px;
padding: 26px;
background: rgba(248, 250, 252, 0.97);
box-shadow: 0 28px 70px rgba(2, 6, 23, 0.36);
}
.qr-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
grid-template-rows: repeat(5, 1fr);
gap: 13px;
width: 100%;
height: 100%;
}
.qr-grid span {
border-radius: 5px;
background: #07111f;
}
.qr-grid span:nth-child(4),
.qr-grid span:nth-child(10),
.qr-grid span:nth-child(18),
.qr-grid span:nth-child(25),
.qr-grid span:nth-child(32) {
background: var(--teal);
}
.detect-box {
position: absolute;
top: 466px;
left: 314px;
z-index: 4;
width: 452px;
height: 336px;
border: 5px solid #4ae3a3;
border-radius: 32px;
box-shadow: 0 0 0 999px rgba(2, 6, 23, 0.07);
}
.scan-line {
position: absolute;
top: 642px;
left: 214px;
right: 214px;
z-index: 5;
height: 7px;
border-radius: 999px;
background: linear-gradient(90deg, transparent, #2dd4bf, transparent);
box-shadow: 0 0 34px rgba(45, 212, 191, 0.92);
}
.hint {
position: absolute;
left: 238px;
right: 238px;
bottom: 616px;
z-index: 6;
min-height: 58px;
padding: 13px 22px;
border-radius: 24px;
background: rgba(0, 0, 0, 0.45);
color: #f8fafc;
font-size: 25px;
font-weight: 660;
text-align: center;
}
.sheet {
position: absolute;
left: 0;
right: 0;
bottom: 118px;
z-index: 8;
min-height: 612px;
padding: 22px 38px 34px;
border-radius: 42px 42px 0 0;
background: #f8fafc;
color: var(--ink);
box-shadow: 0 -34px 72px rgba(2, 6, 23, 0.35);
}
.handle {
width: 94px;
height: 8px;
margin: 0 auto 26px;
border-radius: 999px;
background: #cbd5e1;
}
.result-card {
padding: 28px;
border-radius: 26px;
background: #f2f7ff;
}
.result-title {
display: flex;
align-items: center;
gap: 14px;
margin: 0 0 24px;
color: #172033;
font-size: 32px;
font-weight: 800;
}
.badge {
display: inline-flex;
align-items: center;
height: 36px;
padding: 0 14px;
border-radius: 999px;
background: var(--mint);
color: #0f766e;
font-size: 18px;
font-weight: 820;
}
.field {
margin-top: 18px;
}
.field-label {
color: #526879;
font-size: 19px;
font-weight: 760;
}
.field-value {
margin-top: 6px;
color: var(--blue);
font-size: 24px;
line-height: 1.28;
font-weight: 640;
text-decoration: underline;
}
.risk {
display: flex;
align-items: center;
gap: 14px;
margin-top: 22px;
padding: 16px 18px;
border-radius: 20px;
background: #ecfdf5;
color: #065f46;
font-size: 22px;
font-weight: 740;
}
.risk svg {
width: 28px;
height: 28px;
flex: 0 0 auto;
}
.actions {
display: flex;
gap: 18px;
margin-top: 26px;
}
.action {
display: grid;
place-items: center;
width: 70px;
height: 70px;
border-radius: 50%;
background: #eef2f7;
color: #1e293b;
}
.action svg {
width: 32px;
height: 32px;
}
.primary {
margin-left: auto;
width: 250px;
border-radius: 22px;
background: #0f766e;
color: #f8fafc;
font-size: 24px;
font-weight: 820;
}
.nav {
position: absolute;
left: 0;
right: 0;
bottom: 0;
z-index: 9;
display: grid;
grid-template-columns: repeat(3, 1fr);
height: 118px;
padding: 12px 56px 18px;
background: #fcfffe;
color: #607080;
border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.nav-item {
display: grid;
place-items: center;
align-content: center;
gap: 7px;
font-size: 20px;
font-weight: 740;
}
.nav-item svg {
width: 28px;
height: 28px;
}
.nav-item.active {
color: #0f766e;
}
</style>
</head>
<body>
<main class="shot">
<div class="camera"></div>
<div class="status">
<div>9:41</div>
<div class="system-icons">
<div class="signal"><span></span><span></span><span></span><span></span></div>
<div class="battery"></div>
</div>
</div>
<div class="top-chip">Everyday personal use</div>
<div class="gallery" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none">
<path d="M4 5H20V19H4V5Z" stroke="white" stroke-width="2" stroke-linejoin="round"/>
<path d="M7 16L10.6 12.4L13 14.8L15 12.8L19 16.8" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M15.5 9.2H15.52" stroke="white" stroke-width="3" stroke-linecap="round"/>
</svg>
</div>
<div class="aim"></div>
<div class="qr-target">
<div class="qr-grid">
<span></span><span></span><span></span><span></span><span></span><span></span><span></span>
<span></span><span></span><span></span><span></span><span></span><span></span><span></span>
<span></span><span></span><span></span><span></span><span></span><span></span><span></span>
<span></span><span></span><span></span><span></span><span></span><span></span><span></span>
<span></span><span></span><span></span><span></span><span></span><span></span><span></span>
</div>
</div>
<div class="detect-box"></div>
<div class="scan-line"></div>
<div class="hint">Readable code detected.</div>
<section class="sheet">
<div class="handle"></div>
<div class="result-card">
<h1 class="result-title">URL <span class="badge">Local check</span></h1>
<div class="field">
<div class="field-label">Link</div>
<div class="field-value">https://example.org/menu</div>
</div>
<div class="field">
<div class="field-label">Risk score</div>
<div class="field-value" style="color:#0f172a;text-decoration:none">0</div>
</div>
<div class="risk">
<svg viewBox="0 0 24 24" fill="none">
<path d="M12 3L19 6V11C19 15.7 16.1 19.9 12 21.8C7.9 19.9 5 15.7 5 11V6L12 3Z" fill="#10B981"/>
<path d="M9 12L11.1 14.1L15.5 9.7" stroke="white" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Checked on device before opening
</div>
</div>
<div class="actions">
<div class="action" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none">
<path d="M8 8H6C5.4 8 5 8.4 5 9V19C5 19.6 5.4 20 6 20H16C16.6 20 17 19.6 17 19V17" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
<path d="M8 4H18C18.6 4 19 4.4 19 5V15C19 15.6 18.6 16 18 16H8C7.4 16 7 15.6 7 15V5C7 4.4 7.4 4 8 4Z" stroke="currentColor" stroke-width="2"/>
</svg>
</div>
<div class="action" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none">
<path d="M18 8C19.7 8 21 6.7 21 5C21 3.3 19.7 2 18 2C16.3 2 15 3.3 15 5C15 5.2 15 5.4 15.1 5.6L8.6 9.2C8.1 8.5 7.1 8 6 8C4.3 8 3 9.3 3 11C3 12.7 4.3 14 6 14C7.1 14 8.1 13.5 8.6 12.8L15.1 16.4C15 16.6 15 16.8 15 17C15 18.7 16.3 20 18 20C19.7 20 21 18.7 21 17C21 15.3 19.7 14 18 14C16.9 14 15.9 14.5 15.4 15.2L8.9 11.6C9 11.4 9 11.2 9 11C9 10.8 9 10.6 8.9 10.4L15.4 6.8C15.9 7.5 16.9 8 18 8Z" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
</svg>
</div>
<div class="action primary">Open</div>
</div>
</section>
<nav class="nav">
<div class="nav-item active">
<svg viewBox="0 0 24 24" fill="none">
<path d="M5 7V5H9M15 5H19V9M19 15V19H15M9 19H5V15" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"/>
<path d="M8 12H16" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"/>
</svg>
Scan
</div>
<div class="nav-item">
<svg viewBox="0 0 24 24" fill="none">
<path d="M5 5H19V19H5V5Z" stroke="currentColor" stroke-width="2"/>
<path d="M8 9H16M8 13H16M8 17H13" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
History
</div>
<div class="nav-item">
<svg viewBox="0 0 24 24" fill="none">
<path d="M12 15.5C13.9 15.5 15.5 13.9 15.5 12C15.5 10.1 13.9 8.5 12 8.5C10.1 8.5 8.5 10.1 8.5 12C8.5 13.9 10.1 15.5 12 15.5Z" stroke="currentColor" stroke-width="2"/>
<path d="M19 12H21M3 12H5M12 3V5M12 19V21M17 7L18.4 5.6M5.6 18.4L7 17M17 17L18.4 18.4M5.6 5.6L7 7" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
Settings
</div>
</nav>
</main>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB

@@ -0,0 +1,525 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1080, height=1920, initial-scale=1">
<title>Private QR Scanner Screenshot 2</title>
<style>
:root {
--bg: #f6fbfa;
--surface: #ffffff;
--surface-2: #edf8f5;
--ink: #0b1220;
--muted: #607080;
--line: #dce8e6;
--teal: #0f766e;
--teal-bright: #2dd4bf;
--mint: #dff7f2;
--blue: #1d4ed8;
}
* {
box-sizing: border-box;
}
html,
body {
width: 1080px;
height: 1920px;
margin: 0;
overflow: hidden;
font-family: Inter, "DejaVu Sans", Arial, sans-serif;
background: var(--bg);
color: var(--ink);
}
.shot {
position: relative;
width: 1080px;
height: 1920px;
overflow: hidden;
background:
radial-gradient(circle at 92% -4%, rgba(45, 212, 191, 0.20), transparent 31%),
linear-gradient(180deg, #f6fbfa 0%, #eff8f6 100%);
}
.status {
display: flex;
justify-content: space-between;
align-items: center;
height: 92px;
padding: 22px 44px 0;
color: var(--ink);
font-size: 24px;
font-weight: 760;
}
.system-icons {
display: flex;
align-items: center;
gap: 10px;
}
.signal {
display: flex;
align-items: end;
gap: 4px;
height: 22px;
}
.signal span {
width: 5px;
border-radius: 999px;
background: var(--ink);
}
.signal span:nth-child(1) { height: 8px; }
.signal span:nth-child(2) { height: 12px; }
.signal span:nth-child(3) { height: 16px; }
.signal span:nth-child(4) { height: 21px; }
.battery {
width: 42px;
height: 20px;
border: 2px solid var(--ink);
border-radius: 6px;
padding: 3px;
}
.battery::after {
content: "";
display: block;
width: 27px;
height: 10px;
border-radius: 3px;
background: var(--teal-bright);
}
.content {
padding: 30px 48px 144px;
}
.app-head {
display: flex;
align-items: center;
gap: 18px;
margin-bottom: 28px;
}
.app-icon {
width: 80px;
height: 80px;
border-radius: 20px;
box-shadow: 0 14px 28px rgba(15, 118, 110, 0.18);
}
.app-title {
margin: 0;
font-size: 34px;
line-height: 1.08;
font-weight: 850;
letter-spacing: 0;
}
.app-subtitle {
margin-top: 5px;
color: var(--muted);
font-size: 20px;
font-weight: 660;
}
.hero {
margin-bottom: 28px;
padding: 28px;
border-radius: 34px;
background:
radial-gradient(circle at 88% 20%, rgba(45, 212, 191, 0.18), transparent 34%),
linear-gradient(145deg, #0b1220, #123b3f);
color: #f8fafc;
box-shadow: 0 22px 44px rgba(7, 17, 31, 0.18);
}
.hero-row {
display: grid;
grid-template-columns: 1fr 152px;
gap: 20px;
align-items: center;
}
.hero h1 {
margin: 0;
font-size: 47px;
line-height: 1.04;
font-weight: 850;
letter-spacing: 0;
}
.hero p {
margin: 16px 0 0;
color: #cbe7e3;
font-size: 25px;
line-height: 1.25;
font-weight: 560;
}
.safe-card {
display: grid;
place-items: center;
width: 152px;
height: 152px;
border-radius: 30px;
background: rgba(223, 247, 242, 0.12);
border: 1px solid rgba(223, 247, 242, 0.18);
}
.safe-card svg {
width: 86px;
height: 86px;
}
.privacy-strip {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 13px;
margin-top: 26px;
}
.privacy-pill {
display: flex;
align-items: center;
justify-content: center;
min-height: 58px;
border-radius: 18px;
background: rgba(223, 247, 242, 0.12);
color: #dff7f2;
font-size: 20px;
font-weight: 820;
text-align: center;
}
.section-title {
margin: 0 0 18px;
color: #132032;
font-size: 31px;
font-weight: 850;
}
.search {
display: flex;
align-items: center;
gap: 14px;
height: 72px;
margin-bottom: 16px;
padding: 0 22px;
border: 2px solid #cfe0de;
border-radius: 20px;
background: var(--surface);
color: var(--muted);
font-size: 22px;
font-weight: 640;
}
.search svg {
width: 26px;
height: 26px;
color: var(--teal);
}
.export-row {
display: flex;
gap: 12px;
margin-bottom: 20px;
}
.export {
height: 50px;
padding: 0 18px;
border: 0;
border-radius: 15px;
background: var(--mint);
color: var(--teal);
font-size: 18px;
font-weight: 840;
}
.delete {
margin-left: auto;
background: #fff1f2;
color: #be123c;
}
.history-list {
display: grid;
gap: 14px;
}
.history-item {
display: grid;
grid-template-columns: 58px 1fr;
gap: 16px;
padding: 19px;
border-radius: 24px;
background: var(--surface);
border: 1px solid rgba(15, 23, 42, 0.06);
box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}
.type-icon {
display: grid;
place-items: center;
width: 58px;
height: 58px;
border-radius: 16px;
background: var(--surface-2);
color: var(--teal);
}
.type-icon svg {
width: 30px;
height: 30px;
}
.row-top {
display: flex;
justify-content: space-between;
gap: 18px;
align-items: baseline;
}
.type {
color: #132032;
font-size: 24px;
font-weight: 850;
}
.time {
color: #7b8b98;
font-size: 18px;
font-weight: 680;
white-space: nowrap;
}
.value {
margin-top: 7px;
color: #41566a;
font-size: 21px;
line-height: 1.25;
font-weight: 620;
}
.settings-panel {
margin-top: 30px;
padding: 24px;
border-radius: 30px;
background: var(--surface);
box-shadow: 0 18px 38px rgba(15, 23, 42, 0.07);
}
.setting {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 74px;
border-bottom: 1px solid var(--line);
color: #172033;
font-size: 24px;
font-weight: 780;
}
.setting:last-child {
border-bottom: 0;
}
.switch {
position: relative;
width: 70px;
height: 40px;
border-radius: 999px;
background: var(--teal);
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.switch::after {
content: "";
position: absolute;
top: 5px;
right: 5px;
width: 30px;
height: 30px;
border-radius: 50%;
background: #ffffff;
box-shadow: 0 4px 8px rgba(15, 23, 42, 0.24);
}
.nav {
position: absolute;
left: 0;
right: 0;
bottom: 0;
z-index: 9;
display: grid;
grid-template-columns: repeat(3, 1fr);
height: 118px;
padding: 12px 56px 18px;
background: #fcfffe;
color: #607080;
border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.nav-item {
display: grid;
place-items: center;
align-content: center;
gap: 7px;
font-size: 20px;
font-weight: 740;
}
.nav-item svg {
width: 28px;
height: 28px;
}
.nav-item.active {
color: var(--teal);
}
</style>
</head>
<body>
<main class="shot">
<div class="status">
<div>9:41</div>
<div class="system-icons">
<div class="signal"><span></span><span></span><span></span><span></span></div>
<div class="battery"></div>
</div>
</div>
<section class="content">
<header class="app-head">
<img class="app-icon" src="./private-qr-scanner-icon.svg" alt="">
<div>
<h1 class="app-title">Private QR Scanner</h1>
<div class="app-subtitle">Optional history stays on your device</div>
</div>
</header>
<section class="hero">
<div class="hero-row">
<div>
<h1>Review past scans locally</h1>
<p>Search, export, or delete saved scans whenever you choose.</p>
</div>
<div class="safe-card" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none">
<path d="M12 3L19 6V11C19 15.7 16.1 19.9 12 21.8C7.9 19.9 5 15.7 5 11V6L12 3Z" fill="#2DD4BF"/>
<path d="M8.6 12.2L10.9 14.5L15.8 9.5" stroke="#07111F" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
</div>
<div class="privacy-strip">
<div class="privacy-pill">No ads</div>
<div class="privacy-pill">No tracking</div>
<div class="privacy-pill">No account</div>
</div>
</section>
<h2 class="section-title">History</h2>
<div class="search">
<svg viewBox="0 0 24 24" fill="none">
<path d="M10.8 18.2C14.9 18.2 18.2 14.9 18.2 10.8C18.2 6.7 14.9 3.4 10.8 3.4C6.7 3.4 3.4 6.7 3.4 10.8C3.4 14.9 6.7 18.2 10.8 18.2Z" stroke="currentColor" stroke-width="2.2"/>
<path d="M16.4 16.4L21 21" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/>
</svg>
Search saved scans
</div>
<div class="export-row">
<button class="export">TXT</button>
<button class="export">CSV</button>
<button class="export">JSON</button>
<button class="export delete">Delete all</button>
</div>
<div class="history-list">
<article class="history-item">
<div class="type-icon">
<svg viewBox="0 0 24 24" fill="none">
<path d="M10 13A5 5 0 0 0 17.1 13L20 10.1A5 5 0 0 0 12.9 3L11.8 4.1" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
<path d="M14 11A5 5 0 0 0 6.9 11L4 13.9A5 5 0 0 0 11.1 21L12.2 19.9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
</div>
<div>
<div class="row-top"><div class="type">URL</div><div class="time">Today, 9:38 AM</div></div>
<div class="value">https://example.org/menu</div>
</div>
</article>
<article class="history-item">
<div class="type-icon">
<svg viewBox="0 0 24 24" fill="none">
<path d="M4 8L12 13L20 8" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5 6H19C19.6 6 20 6.4 20 7V17C20 17.6 19.6 18 19 18H5C4.4 18 4 17.6 4 17V7C4 6.4 4.4 6 5 6Z" stroke="currentColor" stroke-width="2.2"/>
</svg>
</div>
<div>
<div class="row-top"><div class="type">Email</div><div class="time">Today, 9:21 AM</div></div>
<div class="value">support@example.org</div>
</div>
</article>
<article class="history-item">
<div class="type-icon">
<svg viewBox="0 0 24 24" fill="none">
<path d="M5 12.5C8.9 8.7 15.1 8.7 19 12.5" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/>
<path d="M8.2 15.4C10.3 13.4 13.7 13.4 15.8 15.4" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/>
<path d="M12 19H12.02" stroke="currentColor" stroke-width="3.2" stroke-linecap="round"/>
</svg>
</div>
<div>
<div class="row-top"><div class="type">Wi-Fi</div><div class="time">Yesterday</div></div>
<div class="value">SSID: Guest Network</div>
</div>
</article>
</div>
<section class="settings-panel">
<div class="setting">
<span>Save history (local)</span>
<span class="switch"></span>
</div>
<div class="setting">
<span>Security warnings</span>
<span class="switch"></span>
</div>
<div class="setting">
<span>Scan feedback</span>
<span class="switch"></span>
</div>
</section>
</section>
<nav class="nav">
<div class="nav-item">
<svg viewBox="0 0 24 24" fill="none">
<path d="M5 7V5H9M15 5H19V9M19 15V19H15M9 19H5V15" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"/>
<path d="M8 12H16" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"/>
</svg>
Scan
</div>
<div class="nav-item active">
<svg viewBox="0 0 24 24" fill="none">
<path d="M5 5H19V19H5V5Z" stroke="currentColor" stroke-width="2"/>
<path d="M8 9H16M8 13H16M8 17H13" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
History
</div>
<div class="nav-item">
<svg viewBox="0 0 24 24" fill="none">
<path d="M12 15.5C13.9 15.5 15.5 13.9 15.5 12C15.5 10.1 13.9 8.5 12 8.5C10.1 8.5 8.5 10.1 8.5 12C8.5 13.9 10.1 15.5 12 15.5Z" stroke="currentColor" stroke-width="2"/>
<path d="M19 12H21M3 12H5M12 3V5M12 19V21M17 7L18.4 5.6M5.6 18.4L7 17M17 17L18.4 18.4M5.6 5.6L7 7" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
Settings
</div>
</nav>
</main>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More