Code import

This commit is contained in:
Artur Savitskiy 2024-01-29 16:26:13 +01:00
parent 5f4600920f
commit 2d757b925f
429 changed files with 24996 additions and 34 deletions

48
.gitignore vendored
View File

@ -1,35 +1,15 @@
# ---> Android
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Log/OS Files
*.log
# Android Studio generated files and folders
captures/
.externalNativeBuild/
.cxx/
*.apk
output.json
# IntelliJ
*.iml
.idea/
misc.xml
deploymentTargetDropDown.xml
render.experimental.xml
# Keystore files
*.jks
*.keystore
# Google Services (e.g. APIs or Firebase)
google-services.json
# Android Profiling
*.hprof
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

1
.idea/.name Normal file
View File

@ -0,0 +1 @@
Befund

6
.idea/compiler.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\Ar4i\.android\avd\Pixel_5_API_34.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-09-01T16:36:10.445111300Z" />
</component>
</project>

19
.idea/gradle.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

79
.idea/misc.xml Normal file
View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/activity_faq.xml" value="0.20697463768115942" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/activity_labor.xml" value="0.16168478260869565" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/activity_login.xml" value="0.536" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/activity_main.xml" value="0.20697463768115942" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/activity_pdf_viewer.xml" value="0.11614583333333334" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/activity_settings.xml" value="0.1" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/activity_splash.xml" value="0.16168478260869565" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/activity_support.xml" value="0.1" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/fragment_labor.xml" value="0.16168478260869565" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/fragment_labor_qrcode_select.xml" value="0.2" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/fragment_message.xml" value="0.171875" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/password_activity.xml" value="0.20697463768115942" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/popup_confirm_delete.xml" value="0.20697463768115942" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/popup_confirm_password.xml" value="0.20697463768115942" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/popup_cwa_policy.xml" value="0.1" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/popup_menu.xml" value="0.171875" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/popup_new_pgs.xml" value="0.20697463768115942" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/popup_pdf_viewer_options.xml" value="0.2" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/popup_privacy_policy.xml" value="0.259375" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/popup_push_explain.xml" value="0.2" />
<entry key="..\:/AndroidStudio/Befund/Android/app/src/main/res/layout/results_table_row.xml" value="0.259375" />
<entry key="..\:/git/Befund/Android/app/src/main/res/drawable-v24/ic_launcher.xml" value="0.4296875" />
<entry key="..\:/git/Befund/Android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.19895833333333332" />
<entry key="..\:/git/Befund/Android/app/src/main/res/drawable/bottom_border.xml" value="0.4453125" />
<entry key="..\:/git/Befund/Android/app/src/main/res/drawable/dashed_border.xml" value="0.4453125" />
<entry key="..\:/git/Befund/Android/app/src/main/res/drawable/ic_launcher.xml" value="0.4296875" />
<entry key="..\:/git/Befund/Android/app/src/main/res/drawable/ic_launcher_round.xml" value="0.19895833333333332" />
<entry key="..\:/git/Befund/Android/app/src/main/res/drawable/popup_border.xml" value="0.4453125" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_edit_oegd.xml" value="0.33559782608695654" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_eid.xml" value="0.31023550724637683" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_labor.xml" value="0.321875" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_login.xml" value="0.31023550724637683" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_main.xml" value="0.33" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_new_oegd.xml" value="0.33559782608695654" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_oegd.xml" value="0.33559782608695654" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_pdf_viewer.xml" value="0.321875" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_settings.xml" value="0.28351449275362317" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_splash.xml" value="0.321875" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/activity_support.xml" value="0.2625" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/content_main.xml" value="0.3365036231884058" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/fragment_labor.xml" value="0.3183876811594203" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/fragment_labor_qrcode_select.xml" value="0.3183876811594203" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/fragment_message.xml" value="0.31302083333333336" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/fragment_oegd_code.xml" value="0.33559782608695654" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/password_activity.xml" value="0.3234375" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_confirm_delete.xml" value="0.33559782608695654" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_confirm_password.xml" value="0.26145833333333335" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_cwa_policy.xml" value="0.33559782608695654" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_eid_options.xml" value="0.31023550724637683" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_menu.xml" value="0.2765625" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_new_pgs.xml" value="0.33" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_oegd_options.xml" value="0.33559782608695654" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_password_reset.xml" value="0.32608695652173914" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_pdf_viewer_options.xml" value="0.32653985507246375" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_privacy_policy.xml" value="0.3038949275362319" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/popup_push_explain.xml" value="0.3061594202898551" />
<entry key="..\:/git/Befund/Android/app/src/main/res/layout/results_table_row.xml" value="0.33" />
<entry key="..\:/git/Befund/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.4296875" />
<entry key="..\:/git/Befund/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.328125" />
<entry key="..\:/git/Befund/Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.xml" value="0.19895833333333332" />
<entry key="..\:/git/Befund/Android/app/src/main/res/mipmap-mdpi/ic_launcher_round.xml" value="0.19895833333333332" />
<entry key="..\:/git/Befund/Android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.xml" value="0.19895833333333332" />
<entry key="..\:/git/Befund/Android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.xml" value="0.19895833333333332" />
<entry key="..\:/git/Befund/Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.xml" value="0.19895833333333332" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

7
.idea/vcs.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/Android" vcs="Git" />
</component>
</project>

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
https://github.com/barteksc/AndroidPdfViewer
Apache-2.0 license

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2014-present tom zhou<appnet.link@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,682 @@
https://github.com/signalapp/curve25519-java
https://mvnrepository.com/artifact/org.whispersystems/curve25519-java/0.5.0
/**
* Based on open sourcce
* https://github.com/java-crypto/cross_platform_crypto
**/
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>.

BIN
app/Documents/QR-Codes.docx Normal file

Binary file not shown.

5
app/Documents/README.txt Normal file
View File

@ -0,0 +1,5 @@
*** WORK WITH DEVELOPMENT HOST (OUTSIDE_SERVICE) ***
Set the host in befund.Core.Models.Settings ->load by labor to development:
/** REMOVE BY PRODUCTIVE **/
result.labor.host = Servers.DEVELOPMENT;

View File

@ -0,0 +1,164 @@
<!DOCTYPE html>
<!-- saved from url=(0065)https://www.limbachgruppe.com/fileadmin/downloads/6406135946.html -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<style type="text/css">
body {
background-color: #FFFFFF;
font-size: 14px;
font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif;
padding: 20px;
}
ul li{
margin-bottom: 10px;
font-size: 18px;
}
ul
{
list-style: none;
}
</style>
</head>
<body>
<h1>Datenschutzerkl&auml;rung Limbach Patienten App</h1>
<p style="font-size:24px">Inhalt</p>
<ul style="padding:0px;">
<li><a href="#_Toc122328941">ALLGEMEIN</a></li>
<li><a href="#_Toc122328942">VERANTWORTLICHER</a></li>
<li><a href="#_Toc122328943">DIE APP</a>
<ul>
<li><a href="#_Toc122328943">COVID-19</a></li>
<li><a href="#_Toc122328945">Was ist der Funktionsumfang</a></li>
<li><a href="#_Toc122328946">Welche Daten werden verarbeitet</a></li>
</ul>
</li>
<li><a href="#_Toc122328947">Welche Berechtigungen ben&ouml;tigt die App</a></li>
<li><a href="#_Toc122328948">ZWECKE DER VERARBEITUNG PERSONENBEZOGENER DATEN UND FREIWILLIGE ANGABEN</a></li>
<li><a href="#_Toc122328949">AUFBEWAHRUNG</a></li>
<li><a href="#_Toc122328950">AUSKUNFT, L&Ouml;SCHUNG UND BERICHTIGUNG</a></li>
<li><a href="#_Toc122328951">ERWEITERTE FUNKTIONEN</a></li>
<li><a href="#_Toc122328952">WERBUNG</a></li>
<li><a href="#_Toc122328953">EMPF&Auml;NGER / WEITERGABE VON DATEN</a></li>
<li><a href="#_Toc122328954">DATENVERARBEITUNG AUSSERHALB DER EUROP&Auml;ISCHEN UNION</a></li>
<li><a href="#_Toc122328955">DATENSCHUTZ-BEAUFTRAGTER</a></li>
<li><a href="#_Toc122328956">IHRE RECHTE ALS BETROFFENER</a></li>
<li><a href="#_Toc122328957">BESCHWERDERECHT BEI EINER AUFSICHTSBEH&Ouml;RDE</a></li>
<li><a href="#_Toc122328958">&Auml;NDERUNG DIESER DATENSCHUTZHINWEISE</a></li>
</ul>
<p>&nbsp;</p>
<h2><a name="_Toc122328941"></a>ALLGEMEIN</h2>
<p>Wir nehmen den Schutz Ihrer personenbezogenen Daten sehr ernst und behandeln diese vertraulich und entsprechend der gesetzlichen Datenschutzvorschriften sowie dieser Datenschutzerkl&auml;rung. Diese Datenschutzerkl&auml;rung gilt f&uuml;r unsere mobilen iPhone- und Android-Apps (im Folgenden &bdquo;Limbach Patienten App&ldquo;, &bdquo;Befund-App&ldquo; oder kurz &bdquo;App&ldquo;). In ihr werden Art, Zweck und Umfang der Datenerhebung im Rahmen der APP-Nutzung erl&auml;utert. Wir weisen darauf hin, dass die Daten&uuml;bertragung im Internet Sicherheitsl&uuml;cken aufweisen kann. Ein l&uuml;ckenloser Schutz der Daten vor dem Zugriff durch Dritte ist nicht m&ouml;glich.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328942">VERANTWORTLICHER</a></h2>
<p>Als Verantwortlicher i.S.d. geltenden Datenschutzgesetze f&uuml;r diese Anwendung ergreifen wir,<br /><br />MVZ Dr. Stein + Kollegen GbR<br />Tomphecke 45<br />41169 M&ouml;nchengladbach<br />Tel:&nbsp;02161/ 8194 -0<br />Fax:&nbsp;02161/ 8194 -50<br /><br />alle nach geltendem Datenschutzrecht erforderlichen Ma&szlig;nahmen, um den Schutz Ihrer personenbezogenen Daten zu gew&auml;hrleisten. Bei allen Fragen bez&uuml;glich dieser Datenschutzerkl&auml;rung bitten wir Sie, sich an unseren Datenschutzbeauftragten zu wenden.<br /><br />2B Advice GmbH<br />Volker Schr&ouml;dter<br />Joseph-Schumpeter-Allee 27<br />53227 Bonn<br />E-Mail:&nbsp;<a href="mailto:stein@2b-advice.com">stein@2b-advice.com</a></p>
<p>Weitere Angaben zu unserem Unternehmen k&ouml;nnen Sie im Impressum auf unserer Website <a href="https://www.labor-stein.de/impressum/">https://www.labor-stein.de/impressum/</a> entnehmen.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328943">DIE APP</a></h2>
<p>Die Limbach Patienten App wird zur Verf&uuml;gung gestellt, um Testergebnisse, darunter auch COVID-19 Testergebnisse, schnell und einfach an Getestete zu &uuml;bermitteln.</p>
<h2><a name="_Toc122328945">Was ist der Funktionsumfang</a></h2>
<p>Die App erm&ouml;glicht dem Nutzer Befunde von Laborauftr&auml;gen digital innerhalb einer App zug&auml;nglich zu machen, insofern der Laborauftrag bei einem der teilnehmenden Labore der Limbach Gruppe SE beauftragt wurde.</p>
<p>Dar&uuml;ber hinaus bietet die App die optionale M&ouml;glichkeit, unter dem Reiter &bdquo;Meine Patientendaten&ldquo; die pers&ouml;nlichen Informationen anzugeben, die notwendig sind, um einen Laborauftrag zu erstellen. Durch Angabe aller Pflichtfelder wird ein QR-Code erzeugt, der bei teilnehmenden Teststellen zur Erstellung eines Analyseauftrags ausgelesen werden kann, um eine schnelle, bequeme und weniger fehleranf&auml;llige Angabe der Daten, die ansonsten z.B. in Testzentren eine Ansprechperson vor Ort zu erm&ouml;glichen.</p>
<h2><a name="_Toc122328946">Welche Daten werden verarbeitet</a></h2>
<p>Wenn Sie unsere Patienten App nutzen, verarbeiten wir die folgenden Daten f&uuml;r die Bereitstellung der App und der Befunde sowie zur Wahrung der Sicherheit bei dem Betrieb der App:</p>
<ul >
<li>Name und Vorname &nbsp;<b>(Optional)</b></li>
<li>Adresse &nbsp;<b>(Optional)</b></li>
<li>Telefonnummer &nbsp;<b>(Optional)</b></li>
<li>E-Mail-Adresse &nbsp;<b>(Optional)</b></li>
<li>Geburtsdatum &nbsp;<b>(Optional)</b></li>
<li>Auftragsnummer &nbsp;<b>(Optional)</b></li>
<li>Fingerprint und FaceID &nbsp;(Funktional)</li>
<li>Kennung und Passwort &nbsp;(Funktional)</li>
<li>Ger&auml;te-ID &nbsp;(Funktional)</li>
<li>APP-ID &nbsp;(Funktional)</li>
<li>Gesundheitsdaten (Befund*) &nbsp;(Funktional)</li>
<li>Labor-Auftragsnummer &nbsp;(Funktional)</li>
<li>Vorsatzwort &nbsp;<b>(Optional)</b></li>
<li>Geschlecht &nbsp;<b>(Optional)</b></li>
</ul>
<p>*Die Befunddaten verbleiben auch bei einem Abruf der Daten auf eigenen Servern der Limbach Gruppe SE, die sich in Deutschland befinden. Sofern Sie die Daten nicht aus dem Ausland heraus abrufen, ist eine &Uuml;bermittlung in Drittstaaten nicht geplant und auch technisch nicht erforderlich. Die Verbindung zwischen der App und unseren Servern ist nach dem Stand der Technik gesichert. Wir weisen an dieser Stelle noch einmal darauf hin, dass der sichere Betrieb der Befund-App zu einem erheblichen Teil davon abh&auml;ngt, dass Sie ihre Zugangsdaten geheim halten und die Zugangsdaten nicht auf dem Ger&auml;t, mit dem Sie die Befund-App nutzen, speichern.</p>
<p>Ganz wichtig: Auf keinen Fall verkaufen wir Ihre personenbezogenen Daten an Dritte!</p>
<p><h3>Funktional:</h3></p>
<p>Die Verarbeitung dieser personenbezogenen Daten ist erforderlich, um die Funktionalit&auml;ten der APP zu gew&auml;hrleisten. Rechtsgrundlage f&uuml;r diese Datenverarbeitung ist unser berechtigtes Interesse im Sinne von Art. 6 Abs. 1 lit. f DSGVO, &ndash; sofern ein Vertrag geschlossen wurde &ndash; die Erf&uuml;llung unserer vertraglichen Verpflichtungen (Art. 6 Abs. 1 lit. b DSGVO).</p>
<p><h3>Optional:</h3></p>
<p>Die optionalen personenbezogene Daten k&ouml;nnen Sie angeben, falls Sie die Funktion &bdquo;Meine Patientendaten erfassen&ldquo; nutzen m&ouml;chten (Zweck: bequeme Daten&uuml;bermittlung via generiertem QR-Code zur Erstellung eines Testauftrags). Dies ist <strong>nicht erforderlich</strong>, um die Funktionalit&auml;t der &Uuml;bermittlung Ihres Befunds an die App zu nutzen. Rechtsgrundlage f&uuml;r diese Datenverarbeitung ist unser berechtigtes Interesse im Sinne von Art. 6 Abs. 1 lit. f DSGVO, ggf. Ihre Einwilligung im Sinne des Art. 6 Abs. 1 lit. a DSGVO.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328947">Welche Berechtigungen ben&ouml;tigt die App</a></h2>
<p>Zur Bereitstellung unserer Dienste &uuml;ber die APP ben&ouml;tigen wir die im folgenden aufgez&auml;hlten</p>
<p>Zugriffsrechte, die es uns erm&ouml;glichen, auf bestimmte Funktionen Ihres Ger&auml;ts zuzugreifen. Der Zugriff auf die Ger&auml;tefunktionen ist erforderlich, um die Funktionalit&auml;ten der APP zu gew&auml;hrleisten. Rechtsgrundlage f&uuml;r diese Datenverarbeitung ist unser berechtigtes Interesse im Sinne von Art. 6 Abs. 1 lit. f DSGVO, Ihre Einwilligung im Sinne des Art. 6 Abs. 1 lit. a DSGVO und/oder &ndash; sofern ein Vertrag geschlossen wurde &ndash; die Erf&uuml;llung unserer vertraglichen Verpflichtungen (Art. 6 Abs. 1 lit. b DSGVO).</p>
<p>&nbsp;</p>
<p><h3 style="padding-left: 20px;">Kamera</h3>
<p style="padding-left: 20px;">Um den Nutzer dem richtigen Laborstandort zuordnen zu k&ouml;nnen, muss der Nutzer als ersten Schritt einen QR-Code scannen. Dieser wird ihm vom Teststandort z.B. in Form eines Flyers bereitgestellt. Durch Scannen des QR-Codes wird die Labor-ID ausgelesen und der Nutzer dem richtigen Laborstandort zugeordnet, damit die Anfrage des Nutzers am richtigen Labor landet und damit die Voraussetzungen erf&uuml;llt sind, dass dieses Labor letztendlich den Befund erfolgreich zustellen kann. Der Scan des QR-Codes innerhalb der App durch den App-Nutzer erfordert deshalb vor&uuml;bergehend die Berechtigung f&uuml;r die Nutzung des Kamera-Sensors. Im Zuge des Scans eines QR-Codes werden au&szlig;er der genannten Labor-ID keinerlei Bildinformationen gespeichert. Die Berechtigung f&uuml;r die Nutzung des Kamera-Sensors wird nicht dauerhaft ben&ouml;tigt und kann nach Abschluss des Scan-Vorgangs &uuml;ber die Systemeinstellungen wieder entzogen werden, ohne dass sich eine Einschr&auml;nkung der weiteren Nutzung der App ergibt.</p></p>
<p>&nbsp;</p>
<p><h3 style="padding-left: 20px;">Push-Benachrichtigungen</h3>
<p style="padding-left: 20px;">Die Berechtigung der App zum Senden von Push-Benachrichtigungen ist nicht zwingend notwendig zur Verwendung der App, der Erhalt von Befunden ist grunds&auml;tzlich auch ohne diese Berechtigung m&ouml;glich. Es wird dem Nutzer jedoch stark empfohlen, der App diese Berechtigung zu geben, da er damit &uuml;ber das Vorliegen des Befundes oder auch Probleme mit der &Uuml;bermittlung informiert werden kann. Eine ausreichende Informations&uuml;bermittlung kann ohne die Berechtigung zur &Uuml;bermittlung von Push-Nachrichten nicht gew&auml;hrleistet werden. Im Zweifelsfall k&ouml;nnen Informationen jedoch auch &uuml;ber den Support angefragt werden.</p></p>
<p>&nbsp;</p>
<p><h3 style="padding-left: 20px;">Ger&auml;tekennung Ihres Smartphones</h3>
<p style="padding-left: 20px;">Die Ger&auml;tekennung wird bei der Registrierung durch den Nutzer im Laborinformationssystem mit dem jeweiligen Laborauftrag des Nutzers verkn&uuml;pft, damit zu einem sp&auml;teren Zeitpunkt (bei Fertigstellung des Befunds) dem Nutzer via der Ger&auml;tekennung (als eindeutiges Merkmal) der Befund auf seine App &uuml;bertragen werden kann.</p></p>
<p>&nbsp;</p>
<h2><a name="_Toc122328948">ZWECKE DER VERARBEITUNG PERSONENBEZOGENER DATEN UND FREIWILLIGE ANGABEN</a></h2>
<p>Die App dient prim&auml;r dem Zweck, dem Nutzer Befunde von Laborauftr&auml;gen digital innerhalb einer App zug&auml;nglich zu machen, insofern der Laborauftrag bei einem der teilnehmenden Labore der Limbach Gruppe SE beauftragt wurde. Damit der Nutzer Befunde abrufen kann, muss eine Registrierung stattfinden. Diese erf&uuml;llt zwei Zwecke:</p>
<ol>
<li>Durch die Vergabe eines Passworts sch&uuml;tzen Sie Ihren entstehenden Zugang zur App und damit k&uuml;nftige pers&ouml;nliche Daten innerhalb der App.</li>
<li>Durch die Angabe der pers&ouml;nlichen PLZ, Geburtsdatum und Auftragsnummer stellt der Nutzer eine Anfrage an das Labor zum Abruf seines Befunds. Die Angabe dieser pers&ouml;nlichen Daten dient dem Zweck der eindeutigen Verifizierung des Nutzers und sch&uuml;tzt damit den Abruf von Befunddaten durch Unbefugte.</li>
</ol>
<p>Dar&uuml;ber hinaus bietet die App die optionale M&ouml;glichkeit, unter dem Reiter &bdquo;Meine Patientendaten&ldquo; die pers&ouml;nlichen Informationen anzugeben, die notwendig sind, um einen Laborauftrag zu erstellen. Durch Angabe aller Pflichtfelder wird ein QR-Code erzeugt, der bei teilnehmenden Teststellen zur Erstellung eines Analyseauftrags ausgelesen werden kann. Der Zweck ist hierbei eine schnelle, bequeme und weniger fehleranf&auml;llige Angabe der Daten, die ansonsten z.B. in Testzentren eine Ansprechperson vor Ort &uuml;bernimmt.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328949">AUFBEWAHRUNG</a></h2>
<p>Allgemeine Speicherdauer personenbezogener Daten Vorbehaltlich abweichender oder konkretisierender Angaben innerhalb dieser Datenschutzerkl&auml;rung werden die von dieser APP erhobenen personenbezogenen Daten gespeichert, bis Sie uns zur L&ouml;schung auffordern, Ihre Einwilligung zur Speicherung widerrufen, die App l&ouml;schen oder der Zweck f&uuml;r die Datenspeicherung entf&auml;llt. Sofern eine gesetzliche Pflicht zur Aufbewahrung oder ein sonstiger gesetzlich anerkannter Grund zur Speicherung der Daten (z.B. berechtigtes Interesse) besteht, werden die betreffenden personenbezogenen Daten nicht vor Wegfall des jeweiligen Aufbewahrungsgrundes gel&ouml;scht.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328950">AUSKUNFT, L&Ouml;SCHUNG UND BERICHTIGUNG</a></h2>
<p>Sie haben jederzeit das Recht auf unentgeltliche Auskunft &uuml;ber Ihre gespeicherten</p>
<p>personenbezogenen Daten, deren Herkunft und Empf&auml;nger und den Zweck der</p>
<p>Datenverarbeitung sowie ein Recht auf Berichtigung oder L&ouml;schung dieser Daten. Hierzu sowie</p>
<p>zu weiteren Fragen zum Thema personenbezogene Daten k&ouml;nnen Sie sich jederzeit unter der im</p>
<p>Impressum angegebenen Adresse an uns wenden.</p>
<p>Eine L&ouml;schung dieser Daten erfolgt unter Umst&auml;nden in folgenden F&auml;llen:</p>
<ul style="list-style:disc">
<li>Bei einem Reset der Datenbank aus software- und entwicklungsseitigen Gr&uuml;nden</li>
<li>Wahrnehmung des L&ouml;schanspruchs des Nutzers.</li>
</ul>
<p>&nbsp;</p>
<h2><a name="_Toc122328951">ERWEITERTE FUNKTIONEN</a></h2>
<p>Die Anwendung erstellt bei der Verwendung eine Protokolldatei, welche unter anderem anonyme Nutzungsdaten enth&auml;lt. Diese Datei wird niemals automatisch an uns oder Dritte gesendet.</p>
<h2><a name="_Toc122328952">WERBUNG</a></h2>
<p>Ihre Daten werden zu keinem Zeitpunkt zu kommerziellen Zwecken verwendet. Die Limbach Gruppe SE speichert nur die Informationen, die sie ben&ouml;tigt, um den sicheren und funktionierenden Betrieb der Anwendung zu gew&auml;hrleisten.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328953">EMPF&Auml;NGER / WEITERGABE VON DATEN</a></h2>
<p>Daten, die Sie uns gegen&uuml;ber angeben, werden grunds&auml;tzlich nicht an Dritte weitergegeben, es sei denn, dass dies zum Zwecke der Vertragsabwicklung oder Informationsbereitstellung erforderlich ist.</p>
<p>Wir setzen jedoch ggf. Dienstleister und Auftragsverarbeiter f&uuml;r den Betrieb dieser Anwendung oder f&uuml;r weitere Produkte von uns ein. Hier kann es vorkommen, dass ein Dienstleister Kenntnis von personenbezogenen Daten erh&auml;lt. Wir w&auml;hlen unsere Dienstleister sorgf&auml;ltig aus &ndash; insbesondere im Hinblick auf Datenschutz und Datensicherheit &ndash; und treffen alle datenschutzrechtlich erforderlichen Ma&szlig;nahmen f&uuml;r eine zul&auml;ssige Datenverarbeitung.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328954">DATENVERARBEITUNG AUSSERHALB DER EUROP&Auml;ISCHEN UNION</a></h2>
<p>Eine Datenverarbeitung au&szlig;erhalb der europ&auml;ischen Union im Rahmen der Nutzung der App findet grunds&auml;tzlich nicht statt.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328955">DATENSCHUTZ-BEAUFTRAGTER</a></h2>
<p>Unseren Datenschutzbeauftragten erreichen Sie unter:</p>
<p>2B Advice GmbH<br />Volker Schr&ouml;dter<br />Joseph-Schumpeter-Allee 27<br />53227 Bonn<br />E-Mail:&nbsp;<a href="mailto:stein@2b-advice.com">stein@2b-advice.com</a></p>
<p>&nbsp;</p>
<h2><a name="_Toc122328956">IHRE RECHTE ALS BETROFFENER</a></h2>
<p>Die DSGVO gew&auml;hrt Betroffenen, deren personenbezogene Daten von uns verarbeitet werden, bestimmte Rechte, &uuml;ber die wir Sie an dieser Stelle aufkl&auml;ren m&ouml;chten:</p>
<p>&nbsp;</p>
<p><strong>Widerruf Ihrer Einwilligung zur Datenverarbeitung</strong></p>
<p>Viele Datenverarbeitungsvorg&auml;nge sind nur mit Ihrer Einwilligung m&ouml;glich. Diese werden wir vor Beginn der Datenverarbeitung ausdr&uuml;cklich bei Ihnen einholen. Sie k&ouml;nnen diese Einwilligung jederzeit widerrufen. Dazu reicht eine formlose Mitteilung per E-Mail an <a href="mailto:it@labor-stein.de">it@labor-stein.de</a> . Die Rechtm&auml;&szlig;igkeit der bis zum Widerruf erfolgten Datenverarbeitungsvorg&auml;nge bleibt vom Widerruf unber&uuml;hrt.</p>
<p>&nbsp;</p>
<p><strong>WIDERSPRUCHSRECHT GEGEN DIE DATENERHEBUNG IN BESONDEREN F&Auml;LLEN</strong></p>
<p><strong>SOWIE GEGEN DIREKTWERBUNG (ART. 21 DSGVO)</strong></p>
<p><strong>&nbsp;</strong></p>
<p>WENN DIE DATENVERARBEITUNG AUF GRUNDLAGE VON ART. 6 ABS. 1 LIT. E ODER F DSGVO ERFOLGT, HABEN SIE JEDERZEIT DAS RECHT, AUS GR&Uuml;NDEN, DIE SICH AUS IHRER BESONDEREN SITUATION ERGEBEN, GEGEN DIE VERARBEITUNG SIE BETREFFENDER PERSONENBEZOGENER DATEN WIDERSPRUCH EINZULEGEN; DIES GILT AUCH F&Uuml;R EIN AUF DIESE BESTIMMUNGEN GEST&Uuml;TZTES PROFILING. DIE JEWEILIGE RECHTSGRUNDLAGEN, AUF DENEN EINE VERARBEITUNG BERUHT, ENTNEHMEN SIE DIESER DATENSCHUTZERKL&Auml;RUNG. WENN SIE WIDERSPRUCH EINLEGEN, WERDEN WIR DIE BETROFFENEN PERSONENBEZOGENEN DATEN NICHT MEHR VERARBEITEN, ES SEI DENN, WIR K&Ouml;NNEN ZWINGENDE SCHUTZW&Uuml;RDIGE GR&Uuml;NDE F&Uuml;R DIE VERARBEITUNG NACHWEISEN, DIE IHRE INTERESSEN, RECHTE UND FREIHEITEN &Uuml;BERWIEGEN ODER DIE DER VERARBEITUNG DER GELTENDMACHUNG, AUS&Uuml;BUNG ODER VERTEIDIGUNG VON RECHTSANSPR&Uuml;CHEN DIENEN.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328957">BESCHWERDERECHT BEI EINER AUFSICHTSBEH&Ouml;RDE</a></h2>
<p>Im Falle von Verst&ouml;&szlig;en gegen die DSGVO steht den Betroffenen ein Beschwerderecht bei einer Aufsichtsbeh&ouml;rde zu. Diese finden Sie unter <a href="https://www.bfdi.bund.de/DE/">https://www.bfdi.bund.de/DE/</a>.<br>
Das Beschwerderecht besteht unbeschadet anderweitiger verwaltungsrechtlicher oder gerichtlicher Rechtsbehelfe.</p>
<p>&nbsp;</p>
<h2><a name="_Toc122328958">&Auml;NDERUNG DIESER DATENSCHUTZHINWEISE</a></h2>
<p>Wir &uuml;berarbeiten diese Datenschutzhinweise bei &Auml;nderungen an dieser Anwendung oder bei sonstigen Anl&auml;ssen, die dies erforderlich machen. Die jeweils aktuelle Fassung finden Sie stets unter dem Reiter Datenschutz in dieser Anwendung.</p>
<p>&nbsp;</p>
<p>Stand: 19.12.2022</p>
</body></html>

BIN
app/Documents/~$-Codes.docx Normal file

Binary file not shown.

57
app/build.gradle Normal file
View File

@ -0,0 +1,57 @@
plugins {
id 'com.android.application'
}
android {
compileSdk 34
defaultConfig {
applicationId "de.labor_stein.befund"
minSdk 26
targetSdk 34
versionCode 11
versionName "1.9"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.navigation:navigation-fragment:2.4.2'
implementation 'androidx.navigation:navigation-ui:2.4.2'
implementation 'com.google.firebase:firebase-messaging:21.1.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.camera:camera-core:1.1.0-alpha03'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'org.whispersystems:curve25519-java:0.5.0'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.google.crypto.tink:tink-android:1.6.1'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
implementation("androidx.biometric:biometric:1.1.0")
implementation platform('com.google.firebase:firebase-bom:30.2.0')
}

39
app/google-services.json Normal file
View File

@ -0,0 +1,39 @@
{
"project_info": {
"project_number": "127283607700",
"project_id": "befund-01",
"storage_bucket": "befund-01.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:127283607700:android:c2f0153fc4c20ef87a5c81",
"android_client_info": {
"package_name": "de.labor_stein.befund"
}
},
"oauth_client": [
{
"client_id": "127283607700-phvfe3dp6d41ej37b2m543ng16as8bki.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBkmPBIyKCsYilMNH6lxjlgfNPxm3OPyoo"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "127283607700-phvfe3dp6d41ej37b2m543ng16as8bki.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

21
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

BIN
app/release/app-release.aab Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
package de.labor_stein.befund;public class ButtonNewPGS {
}

View File

@ -0,0 +1,15 @@
//
// BaseTestController.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 23.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Controllers;
public class BaseTestController
{
protected final String ServiceOutsideHost = "https://localhost";
protected final String DeviceToken = "2490374d42c895fb1f3619a4436c6b4ba5f4e824af1eec3a16c2ab5a1135679b";
protected final String DeviceUDID = "0D36D896-F44E-4A7C-B886-2895866D3DE1";
}

View File

@ -0,0 +1,37 @@
//
// ExchangeControllerTest.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 23.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Controllers;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.labor_stein.befund.Core.Https.Request;
import de.labor_stein.befund.Core.Https.Servers;
public class ExchangeControllerTest
{
@Test
public void KeyExchangeAsync()
{
Request.KeyExchangeAsync(Servers.DEVELOPMENT,
null,
(publicKey) ->
{
assertNotNull(publicKey);
assertNotNull(publicKey.key);
},
(error) ->
{
assertNull(error);
});
}
}

View File

@ -0,0 +1,75 @@
//
// ResultsControllerTest.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 24.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Controllers;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import android.service.controls.DeviceTypes;
import org.junit.Assert;
import org.junit.Test;
import java.util.Locale;
import java.util.UUID;
import de.labor_stein.befund.Core.Https.Request;
import de.labor_stein.befund.Core.Https.Servers;
import de.labor_stein.befund.Core.Models.Database.Results;
import de.labor_stein.befund.Core.Models.Request.EncryptedRequest;
import de.labor_stein.befund.Core.Models.Request.Subscribe;
import de.labor_stein.befund.Core.Models.Response.Success;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Curve25519;
import de.labor_stein.befund.Core.Security.SHA512;
public class ResultsControllerTest extends BaseTestController
{
@Test
public void Subscribe()
{
Request.KeyExchangeAsync(Servers.DEVELOPMENT,
null,
(publicKey) ->
{
assertNotNull(publicKey);
assertNotNull(publicKey.key);
Curve25519.KeyPair keyPair = Curve25519.GenerateKeyPair();
Subscribe subscribe = new Subscribe();
subscribe.device_token = this.DeviceToken;
subscribe.udid = UUID.randomUUID().toString().substring(0, 25);
subscribe.pgs = SHA512.Encrypt(UUID.randomUUID().toString());
subscribe.client_public_key = keyPair.PublicKey;
subscribe.device_type = Results.DeviceTypes.ANDROID.ordinal();
subscribe.verificator_hash = SHA512.HMAC("Test", AES.GetKey("TEST"));
EncryptedRequest request = new EncryptedRequest("Subscribe", subscribe, keyPair.GetSharedKey(publicKey.key));
Request.EncryptedRequestAsync(Servers.DEVELOPMENT,
"results",
"subscribe",
request,
publicKey,
keyPair,
(encryptedResponse) ->
{
Success success = (Success)encryptedResponse.Decrypt(keyPair.GetSharedKey(publicKey.key), Success.class);
Assert.assertTrue(encryptedResponse.descriptor.equals("success"));
},
(error) ->
{
assertNull(error);
});
},
(error) ->
{
assertNull(error);
});
}
}

View File

@ -0,0 +1,30 @@
package de.labor_stein.befund;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest
{
@Test
public void useAppContext()
{
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("de.labor_stein.befund", appContext.getPackageName());
}
}

View File

@ -0,0 +1,70 @@
//
// AESTest.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Security;
import static org.junit.Assert.assertEquals;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.nio.charset.StandardCharsets;
import java.util.Random;
import de.labor_stein.befund.Core.Security.AES;
@RunWith(AndroidJUnit4.class)
public class AESTest
{
@Test
public void EncryptDecryptPasswordShort32Length()
{
String password = "a";
String input = "Hello World";
String encrypted = AES.Encrypt(input, AES.GetKey(password));
String decrypted = AES.Decrypt(encrypted, AES.GetKey(password));
assertEquals(input, decrypted);
}
@Test
public void EncryptPasswordLong32Length()
{
String password = "aASKDJ ALSKDJLKASJDLKASJDLKJASLKDJASLKJD ASÖLKJ DKJASHDKJASH D KLJ H A S LK J DHASKJLHDKAJSHD K";
String input = "Hello World";
String encrypted = AES.Encrypt(input, AES.GetKey(password));
String decrypted = AES.Decrypt(encrypted, AES.GetKey(password));
assertEquals(input, decrypted);
}
@Test
public void EncryptDecrypt()
{
for(int i = 0; i < 1000; i++)
{
int KeySize = new Random().nextInt(4096);
byte[] random = new byte[KeySize];
new Random().nextBytes(random);
String password = new String(random, StandardCharsets.UTF_8);
String input = "Hello World";
String encrypted = AES.Encrypt(input, AES.GetKey(password));
String decrypted = AES.Decrypt(encrypted, AES.GetKey(password));
assertEquals(input, decrypted);
}
}
@Test
public void EncryptDecryptFixedValues()
{
String input = "Befundapp";
String encrypted = "yd/P1usL9VszgMyhk3d7NJCfwat0PppGWWesFzLOj8NZbLMFWw==";
String password = "a";
String decrypted = AES.Decrypt(encrypted, AES.GetKey(password));
assertEquals(input, decrypted);
}
}

View File

@ -0,0 +1,41 @@
//
// Base64Test.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Security;
import static org.junit.Assert.assertEquals;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.nio.charset.StandardCharsets;
import de.labor_stein.befund.Core.Security.Base64;
@RunWith(AndroidJUnit4.class)
public class Base64Test
{
@Test
public void EncryptDecrypt()
{
String input = "Hello World";
String encrypted = Base64.ToBase64String(input.getBytes(StandardCharsets.US_ASCII));
String decrypted = new String(Base64.FromBase64String(encrypted), StandardCharsets.US_ASCII);
assertEquals(input, decrypted);
}
@Test
public void EncryptDecryptFixedValues()
{
String input = "Hello World";
String encrypted = "SGVsbG8gV29ybGQ=";
String decrypted = new String(Base64.FromBase64String(encrypted), StandardCharsets.US_ASCII);
assertEquals(input, decrypted);
}
}

View File

@ -0,0 +1,193 @@
//
// Curve25519Test.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Security;
import org.junit.Assert;
import org.junit.Test;
import org.whispersystems.curve25519.JCESha512Provider;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Random;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Base64;
import de.labor_stein.befund.Core.Security.Curve25519;
import de.labor_stein.befund.Core.Security.Curve25519.KeyPair;
import de.labor_stein.befund.Core.Security.Ed25519;
import de.labor_stein.befund.Core.Security.HKDF;
import de.labor_stein.befund.Core.Security.SHA512;
import de.labor_stein.befund.Core.Security.TweetNaclFast;
public class Curve25519Test
{
@Test
public void SharedKeys()
{
KeyPair aliceKey = de.labor_stein.befund.Core.Security.Curve25519.GenerateKeyPair();
KeyPair bobKey = de.labor_stein.befund.Core.Security.Curve25519.GenerateKeyPair();
byte[] aliceSharedKey = aliceKey.GetSharedKey(bobKey.PublicKey);
byte[] bobSharedKey = bobKey.GetSharedKey(aliceKey.PublicKey);
Assert.assertArrayEquals(aliceSharedKey, bobSharedKey);
}
@Test
public void AliceSendsToBob()
{
KeyPair aliceKey = de.labor_stein.befund.Core.Security.Curve25519.GenerateKeyPair();
KeyPair bobKey = de.labor_stein.befund.Core.Security.Curve25519.GenerateKeyPair();
byte[] aliceSharedKey = aliceKey.GetSharedKey(bobKey.PublicKey);
byte[] bobSharedKey = bobKey.GetSharedKey(aliceKey.PublicKey);
String key = "a dasdas djakl jdklas jdlkjakldhsajkdhsakdhkajhdkjgahkdgsagdas gdj sadag jdsaj gdg jasdagj dgsa gdsa dsga dgsja gdjagdgasj gjhdga gdja";
String input = "Hello World";
String encrypted = AES.Encrypt(input, aliceSharedKey);
String decrypted = AES.Decrypt(encrypted, bobSharedKey);
Assert.assertTrue(input.equals(decrypted));
}
@Test
public void BobSendsToAlice()
{
KeyPair aliceKey = de.labor_stein.befund.Core.Security.Curve25519.GenerateKeyPair();
KeyPair bobKey = de.labor_stein.befund.Core.Security.Curve25519.GenerateKeyPair();
byte[] aliceSharedKey = aliceKey.GetSharedKey(bobKey.PublicKey);
byte[] bobSharedKey = bobKey.GetSharedKey(aliceKey.PublicKey);
String key = "a dasdas djakl jdklas jdlkjakldhsajkdhsakdhkajhdkjgahkdgsagdas gdj sadag jdsaj gdg jasdagj dgsa gdsa dsga dgsja gdjagdgasj gjhdga gdja";
String input = "Hello World";
String encrypted = AES.Encrypt(input, bobSharedKey);
String decrypted = AES.Decrypt(encrypted, aliceSharedKey);
Assert.assertTrue(input.equals(decrypted));
}
@Test
public void BobVerifiesAlicasSignature()
{
KeyPair aliceKey = de.labor_stein.befund.Core.Security.Curve25519.GenerateKeyPair();
KeyPair bobKey = de.labor_stein.befund.Core.Security.Curve25519.GenerateKeyPair();
String message = "a dasdas djakl jdklas jdlkjakldhsajkdhsakdhkajhdkjgahkdgsagdas gdj sadag jdsaj gdg jasdagj dgsa gdsa dsga dgsja gdjagdgasj gjhdga gdjaa dasdas djakl jdklas jdlkjakldhsajkdhsakdhk";
String aliceSignature = aliceKey.GetSignature(message);
Assert.assertTrue(bobKey.VerifySignature(message, aliceSignature, aliceKey.SigningPublicKey));
}
@Test
public void FixedKeys()
{
byte[] bobDefinedPrivateKey = Base64.FromBase64String("sl+zJ6XehkmHhr9GUgdtNGItpBrWy2y9zqUNkxQ+2nc=");
byte[] bobPrivate = Curve25519.ClampPrivateKey(bobDefinedPrivateKey);
byte[] bobPublicKey = Curve25519.GetPublicKey(bobPrivate);
byte[] alicePublicKey = Base64.FromBase64String("Q6eZkHPevsEB7cpoMRQ4TY0ggjdB4etV+X6aOqqeymc=");
byte[] bobSharedSecret = Curve25519.GetSharedSecret(bobPrivate, alicePublicKey);
String bobSharedSecretBase64 = Base64.ToBase64String(bobSharedSecret);
byte[] bobSharedKey = HKDF.DeriveKey(bobSharedSecret, 32);
String bobSharedKeyBase64 = Base64.ToBase64String(bobSharedKey);
String bobSecretMessage = "XhK7GpN6JqbFgSl4h2J6kjpwEi+aFGzTPDehrdF/qvEupBUHYPJI9zOWPhbWBi4IZ2i9";
String bobSecretMessageDecrypted = AES.Decrypt(bobSecretMessage, bobSharedKey);
System.out.println("Bob Private Key: " + Base64.ToBase64String(bobPrivate));
System.out.println("Bob Public Key: " + Base64.ToBase64String(bobPublicKey));
System.out.println("Alice Public Key: " + Base64.ToBase64String(alicePublicKey));
System.out.println("Bob Shared Secret: " + Base64.ToBase64String(bobSharedSecret));
System.out.println("Bob Shared Key(Base64): " + Base64.ToBase64String(bobSharedKey));
System.out.println("Bob Shared Key(ASCII): " + new String(bobSharedKey, StandardCharsets.US_ASCII));
System.out.println("Bob Secret Message(Clearly): " + bobSecretMessageDecrypted);
System.out.println("Alice HMAC: " + SHA512.HMAC(bobSecretMessage, bobSharedKey));
Assert.assertTrue(SHA512.isValidAuthenticationCode(SHA512.HMAC(bobSecretMessage, bobSharedKey), bobSecretMessage, bobSharedKey));
}
@Test
public void VerifyFixedSignature()
{
TweetNaclFast.Signature.KeyPair keyPair = generateEd25519KeyPair();
byte[] privateKey = keyPair.getSecretKey();
byte[] publicKey = keyPair.getPublicKey();
System.out.println("privateKey (Base64): " + base64Encoding(privateKey));
System.out.println("publicKey (Base64): " + base64Encoding(publicKey));
System.out.println("\nderive the publicKey from the privateKey");
byte[] publicKeyDerived = deriveEd25519PublicKey(privateKey);
System.out.println("publicKey (Base64): " + base64Encoding(publicKeyDerived));
System.out.println("Libsodium detached signature string");
String dataToSign = "The quick brown fox jumps over the lazy dog";
System.out.println("plaintext: " + dataToSign);
// usually we would load the private and public key from a file or keystore
// here we use hardcoded keys for demonstration - don't do this in real programs
System.out.println("* * * sign the plaintext with the ED25519 private key * * *");
//byte [] privateKey = loadEd25519PrivateKey();
String signatureBase64 = libsodiumSignDetachedToBase64(privateKey, dataToSign);
System.out.println("signature (Base64): " + signatureBase64);
System.out.println("signature expected: x41mufah/9VO347W+nPXu5FYeSJOI894YClbbTiX0pwRrvfAPMymxEvyMMsDFMI0R0sulCnuCRSgN0WOKnZBDg==");
System.out.println("\n* * * verify the signature against the plaintext with the ED25519 public key * * *");
//byte[] publicKey = loadEd25519PublicKey();
System.out.println("signature (Base64): " + signatureBase64);
boolean signatureVerified = libsodiumVerifyDetachedFromBase64(publicKeyDerived, dataToSign, signatureBase64);
System.out.println("signature (Base64) verified: " + signatureVerified);
}
private static TweetNaclFast.Signature.KeyPair generateEd25519KeyPair() {
SecureRandom secureRandom = new SecureRandom();
byte[] key = new byte[64];
secureRandom.nextBytes(key);
TweetNaclFast.Signature.KeyPair keyPair = TweetNaclFast.Signature.keyPair_fromSecretKey(key);
return keyPair;
}
private static byte[] deriveEd25519PublicKey(byte[] privateKey) {
TweetNaclFast.Signature.KeyPair keyPair = TweetNaclFast.Signature.keyPair_fromSecretKey(privateKey);
return keyPair.getPublicKey();
}
private static String base64Encoding(byte[] input) {return Base64.ToBase64String(input);}
private static String libsodiumSignDetachedToBase64(byte[] privateKey, String dataToSign) {
TweetNaclFast.Signature sig = new TweetNaclFast.Signature(new byte[32], privateKey);
return base64Encoding(sig.detached(dataToSign.getBytes(StandardCharsets.UTF_8)));
};
private static boolean libsodiumVerifyDetachedFromBase64(byte[] publicKey, String dataToSign, String signatureBase64) {
TweetNaclFast.Signature sig = new TweetNaclFast.Signature(publicKey, new byte[64]);
return sig.detached_verify(dataToSign.getBytes(StandardCharsets.UTF_8), base64Decoding(signatureBase64));
}
private static byte[] loadEd25519PrivateKey() {
// this is a sample key - don't worry !
return base64Decoding("Gjho7dILimbXJY8RvmQZEBczDzCYbZonGt/e5QQ3Vro2sjTp95EMxOrgEaWiprPduR/KJFBRA+RlDDpkvmhVfw==");
}
private static byte[] loadEd25519PublicKey() {
// this is a sample key - don't worry !
return base64Decoding("NrI06feRDMTq4BGloqaz3bkfyiRQUQPkZQw6ZL5oVX8=");
}
private static byte[] base64Decoding(String input) {return Base64.FromBase64String(input);
}
}

View File

@ -0,0 +1,42 @@
//
// Ed25519Test.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Security;
import com.google.crypto.tink.subtle.Ed25519Sign;
import org.junit.Assert;
import org.junit.Test;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.SecureRandom;
import java.security.Signature;
import de.labor_stein.befund.Core.Security.Base64;
import de.labor_stein.befund.Core.Security.Ed25519;
public class Ed25519Test
{
@Test
public void VerifySignature() throws Exception
{
byte[] signingPrivateKey = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".getBytes(StandardCharsets.US_ASCII);
byte[] publicKey = Ed25519.PublicKey(signingPrivateKey);
byte[] message = "Test".getBytes(StandardCharsets.UTF_8);
String publicKeyBase64 = Base64.ToBase64String(publicKey);
byte[] signature = Ed25519.Signature(message, signingPrivateKey);
String signatureBase64 = Base64.ToBase64String(signature);
Assert.assertTrue(Ed25519.CheckValid(signature, message, publicKey));
}
}

View File

@ -0,0 +1,43 @@
//
// MD5Test.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Security;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.nio.charset.StandardCharsets;
import java.util.Random;
import de.labor_stein.befund.Core.Security.MD5;
@RunWith(AndroidJUnit4.class)
public class MD5Test
{
@Test
public void EncryptDecrypt()
{
assertEquals(MD5.Encrypt("dasd hsadhuiahdiashd uihas uidhasi hdiuashd uihasid asd asd sa"), "63754a7803f653217f6b46e048e5c286");
assertEquals(MD5.Encrypt("Hello world"), "3e25960a79dbc69b674cd4ec67a72c62");
for (int i = 0; i < 1000; i++)
{
int KeySize = new Random().nextInt(4096);
byte[] random = new byte[KeySize];
new Random().nextBytes(random);
String key = new String(random, StandardCharsets.UTF_8);
assertTrue(MD5.Encrypt(key).length() == 32);
}
assertEquals(MD5.Encrypt("Hello world".getBytes(StandardCharsets.UTF_8)), "3e25960a79dbc69b674cd4ec67a72c62");
}
}

View File

@ -0,0 +1,58 @@
//
// SHA512Test.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Security;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.whispersystems.curve25519.JCESecureRandomProvider;
import org.whispersystems.curve25519.JCESha512Provider;
import org.whispersystems.curve25519.JavaCurve25519Provider;
import java.nio.charset.StandardCharsets;
import java.util.Random;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Base64;
import de.labor_stein.befund.Core.Security.SHA512;
@RunWith(AndroidJUnit4.class)
public class SHA512Test
{
@Test
public void Encrypt()
{
assertEquals(SHA512.Encrypt("dasd hsadhuiahdiashd uihas uidhasi hdiuashd uihasid asd asd sa"), "a93500a760ec2ad79d540bea6828fc8e740d7a9c63cd0b7911486949051df53a36438887827e05d3f23a57fc4c149b6f6323d63ffc92c63be35a06108b3d6155");
assertEquals(SHA512.Encrypt("Hello world"), "b7f783baed8297f0db917462184ff4f08e69c2d5e5f79a942600f9725f58ce1f29c18139bf80b06c0fff2bdd34738452ecf40c488c22a7e3d80cdf6f9c1c0d47");
for (int i = 0; i < 1000; i++)
{
int KeySize = new Random().nextInt(4096);
byte[] random = new byte[KeySize];
new Random().nextBytes(random);
String key = new String(random, StandardCharsets.UTF_8);
assertTrue(SHA512.Encrypt(key).length() == 128);
}
assertEquals(SHA512.Encrypt("Hello world".getBytes(StandardCharsets.UTF_8)), "b7f783baed8297f0db917462184ff4f08e69c2d5e5f79a942600f9725f58ce1f29c18139bf80b06c0fff2bdd34738452ecf40c488c22a7e3d80cdf6f9c1c0d47");
}
@Test
public void HMAC()
{
String input = "Hello World";
String password = "Test";
String hmac = SHA512.HMAC(input, AES.GetKey(password));
assertTrue(SHA512.isValidAuthenticationCode(hmac, input, AES.GetKey(password)));
assertTrue(hmac.length() == 128);
}
}

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.labor_stein.befund">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<application
android:hardwareAccelerated="true"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Befund">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SplashActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="befund" android:host="labor" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<activity
android:name=".PDFViewerActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<activity
android:name=".LaborActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<activity
android:name=".OEGDActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<activity
android:name=".NewOEGDActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<activity
android:name=".EditOEGDActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<activity
android:name=".SettingsActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<activity
android:name=".PasswordActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<activity
android:name=".SupportActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<activity
android:name=".FAQActivity"
android:screenOrientation="portrait"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Befund.NoActionBar"></activity>
<service
android:name=".Services.PushNotificationService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"></action>
</intent-filter>
</service>
</application>
</manifest>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<!-- saved from url=(0065)https://www.limbachgruppe.com/fileadmin/downloads/6406135946.html -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>[NO_CONNECTION]</title>
</head>
<body style="overflow:hidden;padding:0px;margin:0px;overflow:hidden;">
<div style="width: 100%; position:absolute; top:50%; margin-top:-100px; text-align: center;">
<div>
<img width="64px" style="margin:auto" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAC3NJREFUeF7tnXvwd8Ucx1/bTehCyZgSXWQyyhQyFTOiVA8elUJCnnKt8ZCe3HoIpQvqUUboKhohKhq3mCcxkoQZMgilGVOueVK5jNsxb2d/5uuZ3/Pd3XP2nLNn9+zM75/fd8+e3c/ndfby2c9+1jCloiVgim791HgmAAqHYAJgAqBwCRTe/KkHmAAoXAKFN3/qASYACpdA4c3Pugeo4MHA9sAOwNbAQ4AtgU2BjeyfEPgH8HfgXuAu+3cn8Ev9GfhDrpxkAUAFmwCbAw8FngrsDTwJeGQkxQmGG4EbgOuAXwP3CBgDVaR3DFLMaAGo4H7APsB+wO7AjsDDgQ06luS/gDuA24AfAKuBaw38ueP3dlL8qACoYGPbjb8CWE7dxaeQ7gM+DJwL/NbAX1OolE8dRgFABQ8DDgaW2q/+AT6NGyCP5hHfAD4PXGngVwPUIeiVSQNQwYbA0cC77Jcf1LiBM2uOcBpwjoG/DVyXdb4+SQCqejL3QuDlwC6pCs+zXr8ALgQuS7FHSA6ACp4OXAQ8AljPU8ipZ/u3XTksN3BVSpVNBoCq/tJfD7wUWD8lIUWuy+XAmQZuilxuo+IGB6Cqv/JlwHuALSB7HwXZDf4EnAqcbeCfjTQX6aFBAahgW2ClnehpwldSkuI/BbzDgOYJg6TBAKhgT+BiYOcCvvp5yr0VOMbAV4cgoHcArAVvCXA+sNUQjU7wnRoSXgt8xsBf+qxfrwBU9eTuLcCJwP37bOgI3qUNqfcDb+5zXtAbAHbD5q3Am0agjCGrqGFxhYG7+6hELwBUINPt+4BX9tGoDN7xScnK1NvTnabOAbDKV9f2sk5bkl/h2k84omsIOgXAdvtnTV9+Yzq1TNQKYU3jEhwPdgaAnfDJ2DGN+e209xE7HHRiMOoEALvUW2GtXe2aPz0tCagXPamLJWJXABwEfGJa6kWjV0tETQoviVaiLSg6ANbCd/Vk5Imtqv/6IB5u4EsxS44KgLXtXwM8JmYlp7L+JwF5KR9o4GexZBINALur90E7449WbqyGZlSOtpNfbGpX9tYpmqKq2nVLjpGl7eq1VkJgAfJK1g6i3ORapygAWGcO+cvr0MWUupeANo+eaeBbbV8VCwC5cB1V+LZuW12EPC+nkqtN7SndKrUGwPrwfWUEblw/B37oKa3HATt55h0ym+YCH29TgVYAWO9dHZnark0lenp2lQEZp5ypqg0vxzszDp/hd8Bepj6l1Ci1BeB1wKqReO/mCICGgncCJzc9o9gYAHto4/sj8tvPEQB99bcDuxrQ8bTg1AaAV9llX/BLB3ogVwAkztNM7VwbnBoBYM/q3Tyy41o5AyA/wt0MaKIblJoC8GrgQ0FvGj5zzgBIuitNfRYxKAUDYI9oXyFDRNCbhs+cOwDftPsEQXEKmgCgIAy3UPv5jSnlDoBMxBoGfhSilCYAaNlxUshLEsmbOwAS8yWmtsh6pyAArKeP4uOkEpnDu6GyV2RoCFq7/QpQsU1IUKtQAA4Avhwi9YTylgCAxB1kHg4F4L3ACQkpNaQqpQCgjTm5jykmgTN5A2BdvD8L7OssNc0MpQCgvZklvq7kIQBsA2ipMYaNn8UQLAUABbXcw9QmYmcKAUCx+L7TQxw+Z6UbZigFAIlnf9/j5iEAHGfP9zWU/+CPlQSAQtC8wUfiIQDIGfF5PoUmmqckAK438BQfPYQAoDElVuxdn7rFzlMSADIHb2HqANhzkxcANur2H12FJf57SQBIFTub2mQfBYDHA99zFZb476UBIK9h5yki3x7gMODTiSvYVb3SADjWeGzZ+wKgAEbnuCSc+O+lAXCqAYXkiTIEnAy8zVVY4r+XBsB5BuS4EwUAxcE/1lVY4r+XBoBCzjmX7b5DwMeAlySuYFf1SgPgC8BzXJtCvgAoatULXBJO/PfSANC2/VJXzEFfAK4EDklcwa7qlQaAjusJgLnGoAmARbAZ0dGwedBHBUDhyp7v+sQS/720HiDqEHCpXI0SV7CreqUB8EU7CZS38DqT7xCg0C/HuCSc+O+lAXCFAVlwo9gBTsHDquR62cC/lwbABcYjNrNvDzB2ZxCxp82sr3tCqOtnn+CZN9VsZ5g6NH+UHkATQE0EpzQeCeiGsg+4quvbA+xh/QFd5U2/pyMB2QAUcTxKD6Br13/vKmz6PSkJPNbAj1018uoBVEhV35i9tavA6fckJKDLq+US5ryyNgSAHMzBSWinh0rcaOpb2ZwpBAC5GetyxymlLwFdWK2VmzOFAKCJ4A0jiAfobHQBGZ5lQJZAZwoBQIEhrreXOjsLnjIMJgF5bz/RgCKLO1MIAJsBnwP2cZY6ZRhSAt+1oWLu8qlECADKq6vfFBxySulKQN5bRxuYuwm0UH1vAPRABUsVpDjdts+tme7m9bVmyvK5/0jbKeXroimvFArAA4HfAJt4lZ5WphI2g3SJxHYG7vQVfRAAthcYa5SQEgC43AT6bjYBQAEidOZsI1/KEsmXOwAKCbOngZtC5N0EAN36rXnAfiEvSiBv7gAoeMe+oUGjgwGww4BWAmcnoNSQKuQOwCmmQfzGpgBsSx2RUraBsaScAZDr9+4+u39rK6sRALYX0J3AZ4xF+5kHipTP5muaXBrRBoCNAYWMf9RIIMi1B1Dk1l0MNArg0RiAmV5AIcrXGwEEOQKgK2PeDZzY5OuXztoCoLmAdggVQzD1lCMA+uqfbOCnTYXfCgDbC+jMoJxFUk8arr7tWUk5U+zqmXfIbMuBc5t+/a17gIWWV7WNXWfRWwM1pDRH9u7VJoItJorCKpCziA4jPmhkQhxrde8FDjZwbdsGRAHADgWKIn76iEPJtpVlX8/L5Kt4TSvadP0LlY0JwAa6sQJ4UV+SKPQ9cvU6zIA8f1unaADYXkA2AR1L3rF1zaYCFpOAXPMV/8/3DmSnFKMCYCF4ho0puLnz7VOGEAnoi18m2cbo+qMPAbMtqeBI4EJgw5AWTnnXKQGN+yeY2iUvaoreA9heQFfKKbag123dUVuUZ2H6mI43oNl/1NQJABYCTQrPk4Ni1BqXV5jCvT3XFeypqVg6A8BCILuArpg9vGkFC39OM/5lpsODuZ0CYCHYFLgMeHbhygxtvjx8NOP38u8PLbzTSeDalalAEFyQQbDJpnIOfU5f/pFdK1+V6rwHWGi5vXTiLAKvNg2VXAb5NeYf1WW3Pyuj3gCYmRjKi0jh56cl4v/TqqWeLn2UZ4/zqpdYoPcKwMwSUSdvZM8ek09hLJkvVo6MPCtlO+liqTev4r0DMDMkHAjIl237LiU7grJl3tUaX7ey9Z4GA8D2Bo8GFIPw0ALjDqjL176JQrndHNO8G0LRoABYCDQXkIextpM1JAxepxABNswri56seytj7eo1rEc6wq5gb+CNwEFNGzOS51YDcqT92lBf/WCrAB8FVbU/wSpgq4x6A3nvrgHe7hO80UdOsfIk2d1WsIO9okbbn2O9rXxBR/Lb/6j9uyWFrz7pHmBmlSA4FY9AkyRFvNIO45iS1vIa53Xb2prUFL8gyCR7gLW1XMFO1ut4CbBXwisGzewVo+caQPcs/SRVxY8KgJleQT2C7AbyMzgioRgFisxxFXCmVfp9Y+mqRtEDLCbMChS/+ADgaTobZ/0Q9b8+kiZ0t1LH4r1OX3xIWJY+Kuj7jtECMNMr6Fyi/A/1p6FCwZ00TOxm5xC+spiXT6ZaOWLqZJGCTUnx9wB3+0bjilGJLsoYPQDrEkpVh7DRcKEVhVYSOr+oHmJLQFFO1p851KqxW39StM7baQ9eJtrbgdv05xN4uQsFdV1mtgDME1xVn2Ze+FNWKb8a+9fcBJYiAWgiqFyfmQDIVbOe7ZoA8BRUrtkmAHLVrGe7JgA8BZVrtgmAXDXr2a4JAE9B5ZptAiBXzXq26z8ih2WfzsHxigAAAABJRU5ErkJggg==">
</div>
<h4>[NO_CONNECTION]</h4>
</div>
</body>
</html>

View File

@ -0,0 +1,186 @@
<!DOCTYPE html>
<!-- saved from url=(0065)https://www.limbachgruppe.com/fileadmin/downloads/6406135946.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<p>Datenschutz</p>
<p>Datenschutzhinweise<br>
Datenschutzhinweise Stand: 30.04.2019<br>
<br>
Vorwort<br>
Unabhängig davon, ob Sie Kunde, Interessent, Bewerber oder Besucher unserer Website sind: Wir, MVZ Dr. Stein + Kollegen GbR (im Folgenden: „MVZ Dr. Stein“, „wir“) nehmen den Schutz Ihrer personenbezogenen Daten sehr wichtig. Doch was bedeutet dies konkret? Im Folgenden ermöglichen wir Ihnen, sich einen Einblick darüber zu verschaffen, welche personenbezogenen Daten wir von Ihnen erheben und in welcher Form wir sie verarbeiten. Des Weiteren erhalten Sie eine Übersicht über die Ihnen zustehenden Rechte nach geltendem Datenschutzrecht. Zudem nennen wir Ihnen Ihre Ansprechpartner, falls Sie noch Fragen haben sollten.<br>
Als Verantwortlicher i.S.d. geltenden Datenschutzgesetze ergreifen wir,<br>
<br>
MVZ Dr. Stein + Kollegen GbR<br>
Tomphecke 45<br>
41169 Mönchengladbach<br>
Tel:&nbsp;02161/ 8194 -0<br>
Fax:&nbsp;02161/ 8194 -50 <br>
<br>
alle nach geltendem Datenschutzrecht erforderlichen Maßnahmen, um den Schutz Ihrer personenbezogenen Daten zu gewährleisten. Bei allen Fragen bezüglich dieser Datenschutzerklärung bitten wir Sie, sich an unseren Datenschutzbeauftragten zu wenden.<br>
<br>
2B Advice GmbH<br>
Volker Schrödter<br>
Joseph-Schumpeter-Allee 27<br>
53227 Bonn<br>
E-Mail:&nbsp;<a href="mailto:stein@2b-advice.com" title="Opens internal link in current window">stein@2b-advice.com</a><br>
<br>
Anwendungsbereich der Datenschutzerklärung<br>
Unter der Verarbeitung personenbezogener Daten versteht der Gesetzgeber Tätigkeiten wie das Erheben, das Erfassen, die Organisation, das Ordnen, die Speicherung, die Anpassung oder Veränderung, das Auslesen, das Abfragen, die Verwendung, die Offenlegung durch Übermittlung, Verbreitung oder eine andere Form der Bereitstellung, den Abgleich oder die Verknüpfung, die Einschränkung, das Löschen oder die Vernichtung personenbezogener Daten. Personenbezogene Daten sind alle Informationen, die sich auf eine identifizierte oder identifizierbare natürliche Person beziehen. In dieser Datenschutzerklärung geht es um die personenbezogenen Daten von Kunden, Interessenten, Bewerbern oder Besuchern.<br>
<br>
Welche personenbezogenen Daten verarbeiten wir?<br>
Ihre personenbezogenen Daten werden von uns erhoben, wenn Sie mit uns, z.B. als Interessent oder Kunde, in Kontakt treten. Dies kann beispielsweise geschehen, indem Sie sich für unsere Produkte interessieren, sich für unsere Online-Dienste registrieren, sich über unsere Kommunikationskanäle an uns wenden, oder wenn Sie im Rahmen bestehender Geschäftsbeziehungen unsere Produkte oder Dienstleistungen nutzen.<br>
<br>
Folgende Arten personenbezogenen Daten werden bei uns verarbeitet:<br>
• Angaben zur persönlichen Identifikation z.B. Vor- und Nachname, Anschriftendaten, E-Mail-Adresse, Telefonnummer, Faxnummer<br>
• Unternehmensbezogene Daten z.B. Firmierung, Abteilung, Tätigkeit<br>
• Daten zu Ihrem Online-Verhalten z.B. IP-Adressen, Benutzernamen, Daten zu Ihren Besuchen auf unserer Webseite, in den Kundenportalen oder in der App, ausgeführte Aktionen auf unseren Webseiten und in den Kundenportalen,<br>
Ort des Zugriffs<br>
• Informationen zu Ihren Interessen und Wünschen, welche Sie uns mitteilen z.B. über unser Kontaktformular oder über sonstige Kommunikationskanäle<br>
• Informationen über Ihren beruflichen Werdegang z.B. Berufsausbildung, bisherige Arbeitgeber, sonstige Qualifikationen sowie weitere mit diesen Datenkategorien vergleichbare Informationen.<br>
<br>
Sensible Daten<br>
Sensible Daten, also besondere Kategorien personenbezogener Daten wie z.B. Informationen zur Religions- oder Gewerkschaftszugehörigkeit, werden über diesen Weg nicht erhoben.<br>
<br>
Nutzung von Cookies<br>
Was sind Cookies?<br>
Cookies sind Dateien, die von unserer Webseite oder von den Kundenportalen auf Ihren Computer abgelegt werden, während Sie die Seite aufrufen. Diese Dateien speichern Informationen, die Ihre Nutzung dieser Seite effizienter gestalten. Wir verwenden als Webanalysedienst Matomo(PIWIK), um das Nutzungsverhalten auf der Webseite und in den Kundenportalen zu analysieren. Für diese Analyse werden die durch den Cookie erzeugten Nutzungsinformationen (einschließlich der gekürzten IP-Adresse des Nutzers) an unsere Server übertragen und zu Nutzungsanalysezwecken gespeichert. Die Nutzungsanalyse verwenden wir, um die eigenen Webseiten, die Kundenportale, die Kundenansprache und sonstige Werbemaßnahmen zu optimieren sowie zu Marktforschungszwecken. Die IP-Adresse der Nutzer wird bei diesem Vorgang umgehend verkürzt, so dass die Identifikation der Nutzer über die IP-Adresse nicht mehr möglich ist. Jeder Nutzer, der mit der Speicherung und Auswertung seiner anonymisierten Nutzerdaten zu seinem Besuch auf unserer Webseite nicht einverstanden ist, kann dieser Speicherung und Nutzung jederzeit widersprechen. Eine anonymisierte Nutzung der Kundenportale ist nicht möglich.<br>
Wofür verarbeiten wir Ihre personenbezogenen Daten und auf Basis welcher Rechtsgrundlage?<br>
<br>
Vertragserfüllung<br>
Wir verarbeiten Ihre Daten, um unsere Verträge erfüllen zu können. Das gilt ebenso für Angaben, die Sie uns gegenüber im Rahmen vorvertraglicher Korrespondenz machen. Die konkreten Zwecke der Datenverarbeitung hängen vom jeweiligen Produkt und oder dem von Ihnen gestellten Antrag ab.<br>
<br>
Durchführung des Vertragsverhältnisses<br>
Zur Durchführung des Vertragsverhältnisses benötigen wir Ihren Namen, Ihre Anschrift, Ihre Telefonnummer bzw. Ihre E-Mail-Adresse, damit wir Sie kontaktieren können.<br>
<br>
Anbieten von Waren- und Dienstleistungen<br>
Wir benötigen Ihre personenbezogenen Daten ebenfalls, um prüfen zu können, ob und welche Produkte und Dienstleistungen wir Ihnen anbieten können und dürfen. Einzelheiten zu den jeweiligen Zwecken der Datenverarbeitung können Sie den Vertragsunterlagen und unseren Allgemeinen Geschäftsbedingungen entnehmen.<br>
<br>
Durchführung des Bewerbungsverfahrens<br>
Wir verarbeiten Ihre Daten, die Sie uns im Rahmen Ihrer Bewerbung übersandt haben, um zu prüfen, ob Ihre fachlichen Qualifikationen für die ausgeschriebene Stelle geeignet sind. Wir nutzen Ihre Informationen lediglich für das Bewerbungsverfahren und überführen diese bei einem Vertragsschluss in Ihre Personalakte. Falls es nicht zu einer Übereinkunft kommen sollte, werden Ihre Informationen gelöscht bzw. vernichtet. Wir werden Ihre Bewerberinformationen für keine anderen Zwecke verwenden als für die Durchführung des Bewerbungsverfahrens.<br>
<br>
Datenverarbeitung und -analyse zu Marketingzwecken<br>
Ihre Bedürfnisse sind uns wichtig, und wir versuchen, Ihnen Informationen zu Produkten und Dienstleistungen zu geben, die genau zu Ihnen passen. Dafür verwenden wir die Erkenntnisse aus unserer gemeinsamen Geschäftsbeziehung sowie aus der Marktforschung. Wesentliches Ziel ist dabei die Anpassung unserer Produktvorschläge an Ihre Bedürfnisse. In diesem Zusammenhang garantieren wir, dass wir die Daten immer in Übereinstimmung mit geltendem Datenschutzrecht verarbeiten. Wichtig: Sie können jederzeit der Nutzung Ihrer personenbezogenen Daten zu diesem Zweck widersprechen.<br>
<br>
Was analysieren und verarbeiten wir konkret?<br>
• Ergebnisse unserer Marketingaktionen, um die Effizienz und Relevanz unserer Kampagnen zu messen;<br>
• Informationen aus Ihren Besuchen auf unserer Webseite;<br>
• Wir analysieren den möglichen Bedarf unserer Produkte und Dienstleistungen.<br>
Maßnahmen, die Ihrer Sicherheit dienen<br>
<br>
Wir nutzen Ihre personenbezogenen Daten unter anderem in den folgenden Fällen:<br>
• Um Sie bzw. Ihr Unternehmen vor betrügerischen Aktivitäten zu schützen, analysieren wir Ihre Daten. Dies kann z.B. vorkommen, wenn Sie Opfer eines Identitätsdiebstahls geworden sind oder sich Unberechtigte auf andere Weise Zugriff auf Ihr Benutzerkonto verschafft haben;<br>
• Um die Zuverlässigkeit unserer Webanwendungen zu verbessern, arbeitet unser IT-Support eng mit Ihnen im Falle von technischen Problemen zusammen. In diesem Zusammenhang werten wir auch Protokollierungen von Seitenzugriffen, durchgeführten Aktionen usw. aus;<br>
• Um die IT-Sicherheit gewährleisten zu können;<br>
• Um im Falle möglicher Rechtsstreitigkeiten Sachverhalte erfassen und nachweisen zu können.<br>
Aufgrund Ihrer Einwilligung<br>
Sofern Sie in die Verarbeitung Ihrer personenbezogenen Daten für einen oder mehrere konkretisierte Zwecke eingewilligt haben, ist die Verarbeitung Ihrer Daten durch uns zulässig. Sie können diese Einwilligung mit Blick auf die Zukunft jederzeit widerrufen, ohne dass Ihnen hierfür andere als die Übermittlungskosten nach den Basistarifen (Kosten Ihres Internet-Anschlusses) entstehen. Der Widerruf der Einwilligung berührt jedoch nicht die Rechtmäßigkeit der bis zum Widerruf erfolgten Verarbeitungen. Aufgrund gesetzlicher Vorgaben oder im öffentlichen Interesse<br>
Als Unternehmen unterliegen wir den unterschiedlichsten gesetzlichen Anforderungen (bspw. aus der Steuergesetzgebung).<br>
Um unseren gesetzlichen Verpflichtungen nachzukommen, verarbeiten wir Ihre personenbezogenen Daten.<br>
<br>
Wohin wir Daten übermitteln und warum Datennutzung innerhalb MVZ Dr. Stein<br>
Innerhalb von MVZ Dr. Stein erhalten nur die Stellen Zugriff auf Ihre personenbezogenen Daten, die diese benötigen, um unsere vertraglichen oder gesetzlichen Verpflichtungen zu erfüllen, oder um unsere berechtigten Interessen zu wahren.<br>
<br>
Datennutzung außerhalb MVZ Dr. Stein<br>
Wir achten den Schutz Ihrer personenbezogenen Daten und geben Informationen über Sie nur dann weiter, wenn gesetzliche Bestimmungen dies gebieten, Sie eingewilligt haben, oder zur Erfüllung vertraglicher Verpflichtungen. Bei folgenden Empfängern kommt eine gesetzliche Verpflichtung zur Weitergabe Ihrer personenbezogenen Daten beispielsweise in Betracht:<br>
- Öffentliche Stellen oder Aufsichtsbehörden, z.B. Steuerbehörden, Zollbehörden;<br>
- Justiz- und Strafverfolgungsbehörden, z.B. Polizei, Gerichte, Staatsanwaltschaft;<br>
- Anwälte oder Notare, z.B. in Rechtsstreitigkeiten;<br>
- Wirtschaftsprüfer.<br>
Damit wir unsere vertraglichen Verpflichtungen erfüllen können, kooperieren wir mit anderen Unternehmen.<br>
Dazu gehören:<br>
- Transportdienstleister und Speditionen;<br>
- Veranstalter und Schulungsdienstleister, wenn Sie sich über uns für bestimmte Messen oder Events angemeldet haben;<br>
- Banken und Finanzdienstleister zur Abwicklung aller finanziellen Angelegenheiten.<br>
<br>
Eigene Dienstleister<br>
Um unseren Betrieb effizient gestalten zu können, greifen wir auf die Dienste externer Dienstleister zurück, die zur Erfüllung der beschriebenen Zwecke personenbezogene Daten von Ihnen erhalten können, darunter IT-Dienstleister, Druck- und Telekommunikationsdienstleister, Inkasso-, Beratungs- oder Vertriebsunternehmen.<br>
<br>
Befund-Applikation (APP)<br>
Wenn Sie Nutzer der Befund-App sind, verarbeiten wir die folgenden Daten für die Bereitstellung der App und der Befunde sowie zur Wahrung der Sicherheit bei dem Betrieb der App:<br>
- Fingerprint und mit FaceID (Sicheres Öffnen der APP).<br>
- Kennung und Passwort (Zur Anmeldung am Dienst)<br>
- Mac-Adresse (hin und wieder auch Hardware-Adresse Ihres mobilen Endgerätes genannt) und Mobilnummer (zur Wahrung der Sicherheit bei der Anmeldung)<br>
- Zur Anzeige der Befunde wird an Apple und Google eine Pushnachricht gesendet.<br>
Der Inhalt ist nur die APP-ID, die Geräte-ID und die Labor-Tagesnummer.<br>
- Die APP greift auf die Kamera und auf die Bilder zu. (Zum Scannen von Auftragsbarcodes). Die Befunddaten verbleiben auch bei einem Abruf der Daten auf unseren eigenen Servern, die sich in Deutschland befinden. Sofern Sie die Daten nicht aus dem Ausland heraus abrufen, ist eine Übermittlung in Drittsaaten nicht geplant und auch technisch nicht erforderlich. Die Verbindung zwischen der App und unseren Servern ist nach dem Stand der Technik gesichert. Wir weisen an dieser Stelle noch einmal darauf hin, dass der sichere Betrieb der Befund-App zu einem erheblichen Teil davon abhängt, dass Sie ihre Zugangsdaten geheim halten und die Zugangsdaten nicht auf dem Gerät, mit dem Sie die Befund-App nutzen, speichern. Im Falle einer Wartung und Pflege der Systeme hat gegebenenfalls der Hersteller der Befund-App Zugang zu den gespeicherten personenbezogenen Daten. Wir haben mit dem Hersteller einen entsprechenden Vertrag zur Auftragsverarbeitung gemäß Artikel 28 Datenschutz-Grundverordnung (DS-GVO) geschlossen.<br>
Wichtig: Wir achten genau auf Ihre personenbezogenen Daten! Um sicherzustellen, dass bei den Dienstleistern dieselben datenschutzrechtlichen Standards wie in unserem Haus eingehalten werden, haben wir entsprechende Verträge zur Auftragsverarbeitung abgeschlossen.<br>
Diese Verträge regeln u.a.:<br>
- dass Dritte nur Zugriff auf die Daten erhalten, die sie zur Erledigung der an sich übertragenen Aufgaben benötigen;<br>
- dass bei den Dienstleistern nur Mitarbeiter Zugriff auf Ihre Daten erhalten, die sich explizit zur Einhaltung der datenschutzrechtlichen Regelungen verpflichtet haben;<br>
- dass bei den Dienstleistern technische und organisatorische Maßnahmen eingehalten werden, welche die Datensicherheit und den Datenschutz gewährleisten;<br>
- was mit den Daten geschieht, wenn das Geschäftsverhältnis zwischen dem Dienstleister und uns beendet wird. Bei Dienstleistern, die ihren Sitz außerhalb des Europäischen Wirtschaftsraums (EWR) haben, nehmen wir spezielle Sicherheitsmaßnahmen (z.B. durch die Verwendung besonderer Vertragsklauseln) vor, um zu gewährleisten, dass die Daten mit demselben Maß an Umsicht behandelt werden wie im EWR. Wir überprüfen alle unsere Dienstleister regelmäßig auf die Einhaltung unserer Vorgaben.<br>
Ganz wichtig: Auf keinen Fall verkaufen wir Ihre personenbezogenen Daten an Dritte!<br>
<br>
Sind Sie verpflichtet, uns personenbezogene Daten zur Verfügung zu stellen?<br>
Im Kontext der Geschäftsbeziehung zwischen Ihnen und MVZ Dr. Stein benötigen wir von Ihnen folgende Kategorien personenbezogener Daten:<br>
- alle notwendigen Daten für die Aufnahme und die Durchführung einer Geschäftsbeziehung;<br>
- Daten, die zur Erfüllung von vertraglichen Pflichten benötigt werden;<br>
- Daten, zu deren Erhebung wir gesetzlich verpflichtet sind.<br>
Ohne diese Daten ist es uns nicht möglich, Verträge mit Ihnen einzugehen oder durchzuführen. Löschfristen Gemäß den geltenden Datenschutzbestimmungen speichern wir Ihre personenbezogenen Daten nicht länger, als wir sie für die Zwecke der jeweiligen Verarbeitung benötigen. Sofern die Daten nicht mehr zur Erfüllung vertraglicher oder gesetzlicher Pflichten benötigt werden, werden sie von uns regelmäßig gelöscht, außer, ihre befristete Aufbewahrung ist weiter notwendig.<br>
Folgende Gründe können für eine weitere Aufbewahrung vorliegen:<br>
- Es müssen handels- bzw. steuerrechtliche Aufbewahrungspflichten eingehalten werden:<br>
Die Fristen zur Aufbewahrung vorrangig nach den Regelungen des Handelsgesetzbuches und der Abgabenordnung liegen bei bis zu 10 Jahren.<br>
- Zum Erhalt von Beweismitteln im Falle rechtlicher Streitigkeiten im Rahmen der gesetzlichen Verjährungsvorschriften: Verjährungsfristen können im Zivilrecht bis zu 30 Jahre betragen, wobei die regelmäßige Verjährung nach drei Jahren eintritt.<br>
<br>
Ihre Rechte<br>
Im Rahmen der Verarbeitung Ihrer personenbezogenen Daten stehen Ihnen auch bestimmte Rechte zu. Genaueres ergibt sich aus den entsprechenden Regelungen der Datenschutz-Grundverordnung (dort in den Artikeln 15 bis 21). Recht auf Auskunft und Berichtigung Sie haben das Recht, von uns darüber Auskunft zu erhalten, welche Ihrer personenbezogenen Daten wir verarbeiten. Sofern diese Informationen nicht (mehr) stimmen sollten, können Sie von uns die Berichtigung der Daten verlangen, bei unvollständigen Angaben deren Ergänzung. Sofern wir Ihre Daten an Dritte weitergegeben haben, informieren wir die entsprechenden Dritten bei entsprechender Rechtslage.<br>
<br>
Recht auf Löschung<br>
Unter folgenden Umständen können Sie die unverzügliche Löschung Ihrer personenbezogenen Daten verlangen:<br>
- Wenn Ihre personenbezogenen Daten nicht länger für die Zwecke, für die sie erhoben wurden, benötigt werden;<br>
- Wenn Sie Ihre Einwilligung widerrufen haben und es an einer sonstigen Rechtsgrundlage zur Datenverarbeitung fehlt;<br>
- Wenn Sie der Verarbeitung widersprechen und es keine vorrangigen berechtigten Gründe für eine Datenverarbeitung gibt;<br>
- Wenn Ihre Daten unrechtmäßig verarbeitet werden;<br>
- Wenn Ihre personenbezogenen Daten zur Erfüllung gesetzlicher Pflichten gelöscht werden müssen.<br>
Beachten Sie bitte, dass wir vor der Löschung Ihrer Daten prüfen müssen, ob kein legitimer Grund zur Verarbeitung Ihrer personenbezogenen Daten vorliegt.<br>
<br>
Recht auf Einschränkung der Verarbeitung („Recht auf Sperrung“)<br>
Aus einem der folgenden Gründe können Sie von uns die Einschränkung der Verarbeitung Ihrer personenbezogenen Daten verlangen:<br>
- Wenn Sie die Richtigkeit der Daten bestreiten, bis wir die Gelegenheit hatten, uns von der Richtigkeit der Daten zu überzeugen;<br>
- Wenn die Daten unrechtmäßig verarbeitet werden, Sie aber anstelle der Löschung lediglich die Einschränkung der Nutzung der personenbezogenen Daten verlangen;<br>
- Wenn wir die personenbezogenen Daten zwar nicht mehr für die Zwecke der Verarbeitung benötigen, Sie diese aber noch zur Geltendmachung, Ausübung oder Verteidigung von Rechtsansprüchen benötigen;<br>
- Wenn Sie Widerspruch gegen die Verarbeitung eingelegt haben und noch nicht feststeht, ob Ihre berechtigen Interessen gegenüber unseren überwiegen.<br>
Recht auf Widerspruch<br>
Einzelfallbezogenes Widerspruchsrecht Sofern die Verarbeitung im öffentlichen Interesse oder auf Grundlage einer Interessenabwägung erfolgt, haben Sie das Recht, aus Gründen, die sich aus Ihrer besonderen Situation ergeben, Widerspruch gegen die Verarbeitung einzulegen. Bei erfolgtem Widerspruch werden wir Ihre personenbezogenen Daten nicht weiter verarbeiten, es sei denn, wir können zwingende schutzwürdige Gründe für die Verarbeitung Ihrer Daten nachweisen, die Ihren Interessen, Rechten und Freiheiten überwiegen, oder weil Ihre personenbezogenen Daten der Geltendmachung, Ausübung oder Verteidigung von Rechtsansprüchen dienen. Der Widerspruch steht der Rechtmäßigkeit der bis zum Widerspruch erfolgten Verarbeitung nicht entgegen.<br>
<br>
Werbewiderspruch<br>
In den Fällen, in denen Ihre personenbezogenen Daten für Werbemaßnahmen verwendet werden, können Sie jederzeit gegen diese Form der Verarbeitung Widerspruch einlegen. Wir werden dann Ihre personenbezogenen Daten nicht länger für diese Zwecke verarbeiten. Der Widerspruch kann formfrei erfolgen und sollte adressiert werden an:&nbsp;<a href="mailto:info@labor-stein.de" title="Opens internal link in current window">info(at)labor-stein.de</a><br>
<br>
Recht auf Datenübertragbarkeit<br>
Sie haben das Recht, personenbezogene Daten, die Sie uns zur Verarbeitung gegeben haben, auf Anfrage in einem übertragbaren und maschinenlesbaren Format zu erhalten. Recht auf Beschwerde bei der Aufsichtsbehörde (Art. 77 DS-GVO) Wir versuchen, Ihre Anfragen und Ansprüche immer schnellstmöglich zu bearbeiten, um Ihre Rechte entsprechend zu wahren. Je nach Häufigkeit der Anfragen kann es jedoch sein, dass bis zu 30 Tage vergehen, ehe wir Sie über Ihr Anliegen weiter informieren können. Falls es länger dauern sollte, werden wir Sie zeitnah über die Gründe für die Verzögerung benachrichtigen und das weitere Verfahren mit Ihnen besprechen. In einigen Fällen dürfen oder können wir Ihnen keine Auskunft geben. Sofern rechtlich zulässig, teilen wir Ihnen den Grund für die Verweigerung der Auskunft mit. Sofern Sie dennoch nicht mit unseren Antworten und Reaktionen zufrieden sind oder der Ansicht sind, dass wir gegen geltendes Datenschutzrecht verstoßen, steht es Ihnen frei, sowohl bei unserem Datenschutzbeauftragten als auch bei der zuständigen Aufsichtsbehörde Beschwerde einzureichen.<br>
Die für uns zuständige Aufsichtsbehörde ist:<br>
<br>
Landesbeauftragte für Datenschutz und Informationsfreiheit Nordrhein-Westfalen<br>
Postfach 20 04 44<br>
40102 Düsseldorf<br>
Tel.:&nbsp;0211/38424-0<br>
Fax:&nbsp;0211/38424-10<br>
E-Mail:&nbsp;<a href="mailto:poststelle@ldi.nrw.de" title="Opens external link in new window">poststelle(at)ldi.nrw.de</a><br>
<br>
Matomo Statistikauswertung<br>
Die folgenden von uns verwendeten Tracking-Maßnahmen werden gemäß Artikel 6 Absatz 1 Buchstabe f der DSGVO durchgeführt. Durch die Tracking-Maßnahmen wollen wir die bedarfsgerechte Gestaltung und laufende Optimierung unserer Website sicherstellen. Wir verwenden diese Tracking-Maßnahmen auch, um die Nutzung unserer Website statistisch zu erfassen und zu bewerten, wie wir unseren Service optimieren können. Diese Interessen können gemäß der vorgenannten Regelung als legitim angesehen werden. Wir verwenden die Open-Source-Software Matomo, um die Nutzung unserer Website zu analysieren und statistisch auszuwerten. Hierbei werden Cookies verwendet. Die durch den Cookie erzeugten Informationen über die Benutzung der Website werden an unseren Server übermittelt und in pseudonymen Benutzerprofilen zusammengefasst. Die Informationen werden verwendet, um die Nutzung unserer Website zu bewerten und eine bedarfsgerechte Gestaltung unserer Website zu ermöglichen. Informationen werden nicht an Dritte weitergegeben. Die IP-Adresse wird in keinem Fall mit anderen Daten des Benutzers in Verbindung gebracht. Die IP-Adressen werden anonymisiert, so dass eine Zuordnung nicht möglich ist (IP-Maskierung). Ihre Tracking-Optionen werden in der Cookie-Richtlinie festgelegt. Bitte wählen Sie die bevorzugte Option mithilfe des Cookie-Banners oben auf dieser Website. Sie können Ihre Einstellungen jederzeit ändern, indem Sie auf das kleine Cookie-Richtlinienbanner oben links auf der Website klicken.<br>
<br>
</p>
<p>Version<br>
Diese Datenschutzerklärung ist vom Stand 30.04.2019.<br>
Frühere Versionen der Datenschutzerklärung sind über unseren Datenschutzbeauftragten erhältlich.<br>
Nutzungsbedingungen<br>
1. Inhalt des Onlineangebotes<br>
Der Autor übernimmt keinerlei Gewähr für die Aktualität, Korrektheit, Vollständigkeit oder Qualität der bereitgestellten Informationen. Haftungsansprüche gegen den Autor, welche sich auf Schäden materieller oder ideeller Art beziehen, die durch die Nutzung oder Nichtnutzung der dargebotenen Informationen bzw. durch die Nutzung fehlerhafter und unvollständiger Informationen verursacht wurden sind grundsätzlich ausgeschlossen, sofern seitens des Autors kein nachweislich vorsätzliches oder grob varlässiges Verschulden vorliegt. Alle Angebote sind freibleibend und unverbindlich. Der Autor behält es sich ausdrücklich vor, Teile der Seiten oder das gesamte Angebot ohne gesonderte Ankündigung zu verändern, zu ergänzen, zu löschen oder die Veröffentlichung zeitweise oder entgültig einzustellen.<br>
2. Verweise und Links<br>
Bei direkten oder indirekten Verweisen auf fremde Internetseiten ("Links"), die außerhalb des Verantwortungsbereiches des Autors liegen, würde eine Haftungsverpflichtung ausschließlich in dem Fall in Kraft treten, in dem der Autor von den Inhalten Kenntnis hat und es ihm technisch möglich und zumutbar wäre, die Nutzung im Falle rechtswidriger Inhalte zu verhindern. Der Autor erklärt daher ausdrücklich, dass zum Zeitpunkt der Linksetzung die entsprechenden verlinkten Seiten frei von illegalen Inhalten waren. Der Autor hat keinerlei Einfluss auf die aktuelle und zukünftige gestaltung und auf die Inhalte der gelinkten/verknüpften Seiten. Deshalb distanziert er sich hiermit ausdrücklich von allen Inhalten aller gelinkten/verknüpften Seiten, die nach der Linksetzung verändert wurden. Diese Feststellung gilt für alle innerhalb des eigenen Internetangebotes gesetzten Links und Verweise sowie für Fremdeinträge in vom Autor eingerichteten Gästebüchern, Diskussionsforen und Mailinglisten. Für illegale, fehlerhafte oder unvollständige Inhalte und insbesondere für Schäden, die aus der Nutzung oder Nichtnutzung solcherart dargebotener Informationen entstehen, haftet allein der Anbieter der Seite, auf welche verwiesen wurde, nicht derjenige, der über Links auf die jeweilige Veröffentlichung lediglich verweist.<br>
3. Urheber- und Kennzeichenrecht<br>
Der Autor ist bestrebt, in allen Publikationen die Urheberrechte der verwendeten Grafiken, Tondokumente, Videosequenzen und Texte zu beachten, von ihm selbst erstellte Grafiken, Tondokumente, Videosequenzen und Texte zu nutzen oder auf lizenzfreie Grafiken, Tondokumente, Viedeosequenzen und Texte zurückzugreifen. Alle innerhalb des Internetangebotes genannten und ggf. durch dritte geschützten Marken- und Warenzeichen unterliegen uneingeschränkt den Bestimmungen des jeweils gültigen Kennzeichenrechts und den Besitzrechten der jeweiligen eingetragenenEigentümer. Allein aufgrund der bloßen Nennung ist nicht der Schluß zu ziehen, dass Markenzeichen nicht durch die Rechte Dritter geschützt sind! Das Copyright für veröffentlichte, vom Autor selbst erstellte Objekte bleibt allein beim Autor der Seiten. Eine Vervielfältigung oder Verwendung solcher Grafiken, Tondokumente, Videosequenzen und Texte in anderen elektronischen oder gedruckten Publikationenist ohne ausdrückliche Zustimmung des Autors nicht gestattet.<br>
4. Datenschutz<br>
Sofern innerhalb des Internetangebotes die Möglichkeit zur Eingabe persönlicher oder geschäftlicher Daten (Emailadressen, Namen, Anschriften) besteht, so erfolgt die Preisgabe dieser Daten seitens des Nutzers auf ausdrücklich freiwilliger Basis. Die Inanspruchnahme und Bezahlung aller angebotenen Dienste ist -soweit technisch möglich und zumutbar - auch ohne Angabe solcher Daten bzw. unter Angabe anonymisierter Daten oder eines Pseudonyms gestattet.<br>
5. Rechtswirksamkeit dieses Haftungsausschlusses<br>
Dieser Haftungsausschluss ist als Teil des Internetangebotes zu betrachten, von dem aus auf diese Seite verwiesen wurde. Sofern Teile oder einzelne Formulierungen dieses Textes der geltenden Rechtslage nicht, nicht mehr oder nicht vollständig entsprechen sollten, bleiben die übrigen Teile des Dokumentes in ihrem Inhalt und ihrer Gültigkeit davon unberührt. &nbsp;</p>
<p>&nbsp;</p>
</body></html>

View File

@ -0,0 +1,265 @@
//
// ResultsTableAdapter.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 30.06.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Adapters;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Models.Database.Results;
import de.labor_stein.befund.MainActivity;
import de.labor_stein.befund.R;
public class ResultsTableAdapter extends RecyclerView.Adapter<ResultsTableAdapter.TableRow>
{
private RecyclerView RecyclerView;;
private List<Results> Results;
private MainActivity MainActivity;
public ResultsTableAdapter(List<Results> results, MainActivity mainActivity, RecyclerView recyclerView)
{
this.Results = (results == null ? results = new ArrayList<>() : results);
this.MainActivity = mainActivity;
this.RecyclerView = recyclerView;
}
/**
* Sets the status for results
*
* @param results - results for status
* @param status - status of results row
* @param icon - icon of results row
* @param downloading - flag of downloading
* @param newState - newState of results
*/
public void SetStatusForRow(Results results, String status, Drawable icon, Boolean downloading, Results newState)
{
if(results != null && Results != null && Results.size() > 0)
{
TableRow row = this.GetRowForResult(results);
if(row != null)
{
row.Results = newState;
row.Results.downloading = downloading;
row.CustomStatus = true;
row.txtSubtitle.setText(status);
if(icon != null)
{
row.imgIcon.setImageDrawable(icon);
row.imgIcon.setPadding(0, 0, 0, 0);
row.imgIcon.setScaleX(0.7f);
row.imgIcon.setScaleY(0.7f);
}
}
}
}
/**
* Sets the downloading status for results
*
* @param results - results that is downloading
*/
public void SetDownloadingForRow(Results results)
{
if(results != null && Results != null && Results.size() > 0)
{
TableRow row = this.GetRowForResult(results);
if(row != null)
{
row.Results.downloading = true;
row.CustomStatus = true;
row.txtSubtitle.setText(Lang.Get("LBL_DOWNLOADING"));
Glide.with(this.MainActivity)
.load(R.drawable.ic_downloading)
.into(row.imgIcon);
row.imgIcon.setPadding(20, 20, 20, 20);
}
}
}
/***
* Returns TableRow for results
*
* @param results - results for row
* @return returns TableRow
*/
public TableRow GetRowForResult(Results results)
{
TableRow result = null;
if(results != null && Results != null && Results.size() > 0)
{
int index = -1;
for(int i = 0; i < Results.size(); i++)
{
if(Results.get(i).pgs.equals(results.pgs))
{
index = i;
break;
}
}
if(index >= 0 && index < Results.size())
{
result = (TableRow)this.RecyclerView.findViewHolderForAdapterPosition(index);
}
}
return result;
}
/**
* Delete results at index
* @param position
*/
public void deleteItem(int position)
{
if(position >= 0 && position <= this.Results.size())
{
Results results = this.Results.get(position);
if(results != null)
{
this.Results.remove(results);
this.MainActivity.DeleteResults(results);
TableRow row = (TableRow)this.RecyclerView.findViewHolderForAdapterPosition(position);
if(row != null)
{
row.CustomStatus = false;
}
notifyDataSetChanged();
}
}
}
/**
* Refresh results
* @param results - new results
*/
public void reloadData(List<Results> results)
{
this.Results.clear();
if(results != null)
{
this.Results.addAll(results);
}
notifyDataSetChanged();
}
@Override
public ResultsTableAdapter.TableRow onCreateViewHolder(ViewGroup parent, int viewType)
{
Context context = parent.getContext();
LayoutInflater inflater = LayoutInflater.from(context);
View rowView = inflater.inflate(R.layout.results_table_row, parent, false);
TableRow viewHolder = new TableRow(rowView, this.MainActivity);
return viewHolder;
}
@Override
public void onBindViewHolder(ResultsTableAdapter.TableRow tableRow, int position)
{
Results results = Results.get(position);
if(!tableRow.CustomStatus)
{
tableRow.Results = results;
tableRow.txtTitle.setText(results.GetFormatedCreatedDate());
tableRow.txtSubtitle.setText(results.GetStatusText());
tableRow.txtIdentifier.setText((results != null && results.pgs != null ? results.pgs.substring(0, 40) + "..." : ""));
tableRow.txtIdentifier.setVisibility(View.INVISIBLE);
tableRow.imgIcon.setImageDrawable(results.GetStatusIcon(this.MainActivity));
tableRow.imgIcon.setPadding(0, 0, 0, 0);
tableRow.imgIcon.setScaleX(0.7f);
tableRow.imgIcon.setScaleY(0.7f);
}
}
@Override
public int getItemCount()
{
return Results.size();
}
public class TableRow extends RecyclerView.ViewHolder
{
private MainActivity MainActivity;
public Results Results;
public TextView txtTitle;
public TextView txtSubtitle;
public TextView txtIdentifier;
public ImageView imgIcon;
public boolean CustomStatus = false;
public TableRow(View rowView, MainActivity mainActivity)
{
super(rowView);
this.MainActivity = mainActivity;
txtTitle = (TextView)itemView.findViewById(R.id.ResultsTableTitle);
txtSubtitle = (TextView)itemView.findViewById(R.id.ResultsTableSubtitle);
txtIdentifier = (TextView)itemView.findViewById(R.id.ResultsTableIdentifier);
imgIcon = (ImageView)itemView.findViewById(R.id.ResultsTableIcon);
imgIcon.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
if(Results != null)
{
if(Results.GetStatus() == de.labor_stein.befund.Core.Models.Database.Results.ResultsStatus.COMPLETED &&
Results.available &&
!Results.picked_up &&
!Results.downloaded &&
!Results.downloading)
{
MainActivity.Download(Results);
}
else if(Results.GetStatus() == de.labor_stein.befund.Core.Models.Database.Results.ResultsStatus.COMPLETED &&
Results.available &&
(Results.picked_up || Results.downloaded))
{
MainActivity.EncryptResults(Results);
}
}
return false;
}
});
}
}
}

View File

@ -0,0 +1,118 @@
//
// ResultsTableAdapterSwipeToDeleteCallback.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 30.06.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Adapters;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import de.labor_stein.befund.Core.Lang.Lang;
public class ResultsTableAdapterSwipeToDeleteCallback extends ItemTouchHelper.Callback
{
private ResultsTableAdapter Adapter;
private Context Context;
private Paint mClearPaint;
private ColorDrawable mBackground;
private int backgroundColor;
/***
* Constructor of ResultsTableAdapterSwipeToDeleteCallback
* @param adapter - ResultsTableAdapter
*/
public ResultsTableAdapterSwipeToDeleteCallback(ResultsTableAdapter adapter, Context context)
{
this.Adapter = adapter;
this.Context = context;;
mBackground = new ColorDrawable();
backgroundColor = Color.RED;
mClearPaint = new Paint();
mClearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
}
@Override
public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder)
{
return makeMovementFlags(0, ItemTouchHelper.LEFT);
}
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target)
{
return false;
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction)
{
int position = viewHolder.getAdapterPosition();
this.Adapter.deleteItem(position);
}
@Override
public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
View itemView = viewHolder.itemView;
int itemHeight = itemView.getHeight();
boolean isCancelled = dX == 0 && !isCurrentlyActive;
if (isCancelled)
{
clearCanvas(c, itemView.getRight() + dX, (float) itemView.getTop(), (float) itemView.getRight(), (float) itemView.getBottom());
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
return;
}
mBackground.setColor(backgroundColor);
mBackground.setBounds(itemView.getRight() + (int) dX, itemView.getTop(), itemView.getRight(), itemView.getBottom());
mBackground.draw(c);
String text = Lang.Get("BTN_DELETE");
int spSize = 15;
float scaledSizeInPixels = spSize * this.Context.getResources().getDisplayMetrics().scaledDensity;
Paint textPaint = new Paint();
textPaint.setColor(Color.WHITE);
textPaint.setTextSize(scaledSizeInPixels);
textPaint.setTextAlign(Paint.Align.LEFT);
Rect bounds = new Rect();
textPaint.getTextBounds(text, 0, text.length(), bounds);
float textSize = textPaint.measureText(text);
float x = (itemView.getRight() - (textSize + 20));
float y = itemView.getTop() + ((itemView.getHeight() / 2) + (bounds.height() / 2));
c.drawText(text, x, y, textPaint);
}
private void clearCanvas(Canvas c, Float left, Float top, Float right, Float bottom)
{
c.drawRect(left, top, right, bottom, mClearPaint);
}
@Override
public float getSwipeThreshold(@NonNull RecyclerView.ViewHolder viewHolder)
{
return 0.7f;
}
}

View File

@ -0,0 +1,259 @@
//
// Logs.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Database.DbLog;
import de.labor_stein.befund.Core.System;
public class Logs extends SQLiteOpenHelper
{
private static final int DATABASE_VERSION = 1;
private Context CurrentContext = null;
public Logs(Context context)
{
super(context, System.LogsDatabasePath(context), null, DATABASE_VERSION);
CurrentContext = context;
}
public boolean CreateDBIfNotExists()
{
boolean result = false;
try
{
if(!this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if (con != null)
{
String Logs_Table = "create table if not exists logs(" +
"id integer primary key autoincrement not null, " +
"guid text not null, " +
"message text not null, " +
"type text not null, " +
"created datetime not null " +
")";
con.execSQL(Logs_Table);
con.close();
result = true;
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "Core.Database.Logs", "CreateDBIfNotExists(Context)");
}
return result;
}
public boolean Create(DbLog log)
{
boolean result = false;
try
{
if(log != null && log.message != null && !log.message.isEmpty() && log.type != null)
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if (con != null)
{
ContentValues values = new ContentValues();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String guid = (log.guid != null ? log.guid : UUID.randomUUID().toString());
values.put("guid", guid);
values.put("message", log.message);
values.put("type", log.type);
values.put("created", dateFormat.format(new Date()));
con.insert("logs", null, values);
con.close();
result = true;
}
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Logs", "Create(DbLog)");
}
return result;
}
public List<DbLog> GetLogs()
{
List<DbLog> result = null;
try
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if (con != null)
{
Cursor cursor = con.rawQuery("select id, guid, message, type, created from logs order by created desc", null);
if(cursor != null && cursor.moveToFirst())
{
result = new ArrayList<DbLog>();
do
{
DbLog log = new DbLog();
log.id = cursor.getInt(0);
log.guid = cursor.getString(1);
log.message = cursor.getString(2);
log.type = cursor.getString(3);
String created_str = cursor.getString(4);
if(created_str != null && created_str != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
log.created = dateFormat.parse(created_str);
}
if(log.id > 0)
{
result.add(log);
}
}
while (cursor.moveToNext());
}
con.close();
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Logs", "GetLogs");
}
return result;
}
public List<DbLog> GetLogs(String type)
{
List<DbLog> result = null;
try
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if (con != null)
{
Cursor cursor = con.rawQuery("select id, guid, message, type, created from logs where type = ? order by created desc", new String[] { type });
if(cursor != null && cursor.moveToFirst())
{
result = new ArrayList<DbLog>();
do
{
DbLog log = new DbLog();
log.id = cursor.getInt(0);
log.guid = cursor.getString(1);
log.message = cursor.getString(2);
log.type = cursor.getString(3);
String created_str = cursor.getString(4);
if(created_str != null && created_str != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
log.created = dateFormat.parse(created_str);
}
if(log.id > 0)
{
result.add(log);
}
}
while (cursor.moveToNext());
}
con.close();
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Logs", "GetLogs(String)");
}
return result;
}
private boolean DeleteLogs()
{
boolean result = false;
String dbPath = System.LogsDatabasePath(CurrentContext);
if(dbPath != null)
{
result = System.DeleteFile(dbPath);
}
return result;
}
private boolean DatabaseExists()
{
String dbPath = System.LogsDatabasePath(CurrentContext);
return (dbPath != null && System.FileExists(dbPath));
}
private SQLiteDatabase CreateConnection()
{
SQLiteDatabase result = null;
String dbPath = System.LogsDatabasePath(CurrentContext);
if(dbPath != null)
{
result = SQLiteDatabase.openOrCreateDatabase(dbPath, null);
}
return result;
}
@Override
public void onCreate(SQLiteDatabase db)
{
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
}
}

View File

@ -0,0 +1,701 @@
//
// Results.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.System;
public class Results extends SQLiteOpenHelper
{
private static final int DATABASE_VERSION = 1;
private Context CurrentContext = null;
public Results(Context context)
{
super(context, System.ResultsDatabasePath(context), null, DATABASE_VERSION);
CurrentContext = context;
}
/**
* Creates database if it does not exist
*
* @return returns true if database successfully created or it already exists
*/
public boolean CreateDBIfNotExists()
{
boolean result = false;
try
{
if(!this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if(con != null)
{
String Results_Table = "create table if not exists results(" +
"pgs text primary key not null," +
"available integer not null default 0," +
"available_ts datetime default null," +
"picked_up bit(1) not null default 0," +
"picked_up_ts datetime default null," +
"downloaded bit(1) not null default 0," +
"downloaded_ts datetime default null," +
"downloaded_file text default null," +
"server_public_key text default null," +
"file_checksum text default null," +
"status text not null," +
"modified datetime default null," +
"created datetime not null" +
")";
con.execSQL(Results_Table);
con.close();
result = true;
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Database", "CreateDBIfNotExists(Context)");
}
return result;
}
/**
* Creates results in the database
*
* @param results - results that should be inserted in the database
* @return retursn true if successfully inserted
*/
public Boolean Create(de.labor_stein.befund.Core.Models.Database.Results results)
{
Boolean result = false;
try
{
if(results != null && results.pgs != null && !results.pgs.equals(""))
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if(con != null)
{
ContentValues values = new ContentValues();
values.put("pgs", results.pgs);
values.put("available", (results.available ? 1 : 0));
if(results.available_ts != null && !results.available_ts.equals(""))
{
values.put("available_ts", results.available_ts);
}
else
{
values.putNull("available_ts");
}
values.put("picked_up", (results.picked_up ? 1 : 0));
if(results.picked_up_ts != null && !results.picked_up_ts.equals(""))
{
values.put("picked_up_ts", results.picked_up_ts);
}
else
{
values.putNull("picked_up_ts");
}
if(results.file_checksum != null && !results.file_checksum.equals(""))
{
values.put("file_checksum", results.file_checksum);
}
else
{
values.putNull("file_checksum");
}
values.put("downloaded", (results.downloaded ? 1 : 0));
if(results.downloaded_ts != null && !results.downloaded_ts.equals(""))
{
values.put("downloaded_ts", results.downloaded_ts);
}
else
{
values.putNull("downloaded_ts");
}
if(results.downloaded_file != null && !results.downloaded_file.equals(""))
{
values.put("downloaded_file", results.downloaded_file);
}
else
{
values.putNull("downloaded_file");
}
if(results.server_public_key != null && !results.server_public_key.equals(""))
{
values.put("server_public_key", results.server_public_key);
}
else
{
values.putNull("server_public_key");
}
values.put("status", results.status);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
values.put("created", dateFormat.format(new Date()));
con.insert("results", null, values);
con.close();
result = true;
}
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Results", "Create(Results)");
}
return result;
}
/**
* Updates results in the database
*
* @param results - results that should be updated in the database
* @param update_server_public_key - flag if server_public_key has to be updated in the db
* @return returns true if successfully updated
*/
public Boolean Update(de.labor_stein.befund.Core.Models.Database.Results results, boolean update_server_public_key)
{
Boolean result = false;
try
{
if(results != null && results.pgs != null && !results.pgs.equals(""))
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if(con != null)
{
ContentValues values = new ContentValues();
values.put("available", (results.available ? 1 : 0));
if(results.available_ts != null && !results.available_ts.equals(""))
{
values.put("available_ts", results.available_ts);
}
else
{
values.putNull("available_ts");
}
values.put("picked_up", (results.picked_up ? 1 : 0));
if(results.picked_up_ts != null && !results.picked_up_ts.equals(""))
{
values.put("picked_up_ts", results.picked_up_ts);
}
else
{
values.putNull("picked_up_ts");
}
if(results.file_checksum != null && !results.file_checksum.equals(""))
{
values.put("file_checksum", results.file_checksum);
}
else
{
values.putNull("file_checksum");
}
values.put("downloaded", (results.downloaded ? 1 : 0));
if(results.downloaded_ts != null && !results.downloaded_ts.equals(""))
{
values.put("downloaded_ts", results.downloaded_ts);
}
else
{
values.putNull("downloaded_ts");
}
if(results.downloaded_file != null && !results.downloaded_file.equals(""))
{
values.put("downloaded_file", results.downloaded_file);
}
else
{
values.putNull("downloaded_file");
}
if(update_server_public_key)
{
if(results.server_public_key != null && !results.server_public_key.equals(""))
{
values.put("server_public_key", results.server_public_key);
}
else
{
values.putNull("server_public_key");
}
}
values.put("status", results.status);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
values.put("modified", dateFormat.format(new Date()));
con.update("results", values, "pgs = ?", new String[] { results.pgs });
con.close();
result = true;
}
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Database", "Update(Results)");
}
return result;
}
/**
* Deletes results from the database
*
* @param results - results that should be deleted from the database
* @return returns true if successfully deleted
*/
public Boolean Delete(de.labor_stein.befund.Core.Models.Database.Results results)
{
Boolean result = false;
try
{
if(results != null && results.pgs != null && !results.pgs.equals(""))
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if(con != null)
{
con.delete("results", "pgs = ?", new String[] { results.pgs });
con.close();
result = System.DeleteFile(System.GetPathForStorageEncryptedFile(results.pgs, CurrentContext));
}
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Database", "Delete(Results)");
}
return result;
}
/**
* Creates or updates results in the database
*
* @param results - results that should be ether inserted or updated in the database
* @return returns true if successfully inserted/updated
*/
public Boolean CreateOrUpdate(de.labor_stein.befund.Core.Models.Database.Results results)
{
de.labor_stein.befund.Core.Models.Database.Results dbResults = this.GetResults(results.pgs);
if(dbResults != null)
{
return this.Update(results, false);
}
else
{
return this.Create(results);
}
}
/**
* Returns results from the datbase by pgs
*
* @param pgs - pgs of results
* @return returns results
*/
public de.labor_stein.befund.Core.Models.Database.Results GetResults(String pgs)
{
de.labor_stein.befund.Core.Models.Database.Results result = null;
try
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if(con != null)
{
Cursor cursor = con.rawQuery("select " +
"pgs," +
"available," +
"available_ts," +
"picked_up, " +
"picked_up_ts, " +
"file_checksum, " +
"status, " +
"downloaded, " +
"downloaded_ts, " +
"downloaded_file, " +
"server_public_key, " +
"modified, " +
"created" +
" from " +
" results " +
" where " +
"pgs = ?", new String[] { pgs });
if(cursor != null && cursor.moveToFirst())
{
result = new de.labor_stein.befund.Core.Models.Database.Results();
result.pgs = cursor.getString(0);
result.available = (cursor.getInt(1) == 1);
result.available_ts = cursor.getString(2);
result.picked_up = (cursor.getInt(3) == 1);
result.picked_up_ts = cursor.getString(4);
result.file_checksum = cursor.getString(5);
result.status = cursor.getString(6);
result.downloaded = (cursor.getInt(7) == 1);
result.downloaded_ts = cursor.getString(8);
result.downloaded_file = cursor.getString(9);
result.server_public_key = cursor.getString(10);
result.modified = cursor.getString(11);
result.created = cursor.getString(12);
con.close();
}
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Database", "GetResults(String)");
}
return result;
}
/**
* Returns results from the database
*
* @return returns List of results
*/
public List<de.labor_stein.befund.Core.Models.Database.Results> GetResults()
{
List<de.labor_stein.befund.Core.Models.Database.Results> result = null;
try
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if(con != null)
{
Cursor cursor = con.rawQuery("select " +
"pgs," +
"available," +
"available_ts," +
"picked_up, " +
"picked_up_ts, " +
"file_checksum, " +
"status, " +
"downloaded, " +
"downloaded_ts, " +
"downloaded_file, " +
"server_public_key, " +
"modified, " +
"created" +
" from " +
"results " +
"order by " +
"created desc", null);
if(cursor != null && cursor.moveToFirst())
{
result = new ArrayList<de.labor_stein.befund.Core.Models.Database.Results>();
do
{
de.labor_stein.befund.Core.Models.Database.Results results = new de.labor_stein.befund.Core.Models.Database.Results();
results.pgs = cursor.getString(0);
results.available = (cursor.getInt(1) == 1);
results.available_ts = cursor.getString(2);
results.picked_up = (cursor.getInt(3) == 1);
results.picked_up_ts = cursor.getString(4);
results.file_checksum = cursor.getString(5);
results.status = cursor.getString(6);
results.downloaded = (cursor.getInt(7) == 1);
results.downloaded_ts = cursor.getString(8);
results.downloaded_file = cursor.getString(9);
results.server_public_key = cursor.getString(10);
results.modified = cursor.getString(11);
results.created = cursor.getString(12);
if(results.pgs != null)
{
result.add(results);
}
}
while (cursor.moveToNext());
}
con.close();
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Database", "GetResults");
}
return result;
}
/**
* Returns all active results from the database
*
* @return returns List of results
*/
public List<de.labor_stein.befund.Core.Models.Database.Results> GetResults(boolean activeOnly)
{
List<de.labor_stein.befund.Core.Models.Database.Results> result = null;
try
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if(con != null)
{
Cursor cursor = con.rawQuery("select " +
"pgs," +
"available," +
"available_ts," +
"picked_up, " +
"picked_up_ts, " +
"file_checksum, " +
"status, " +
"downloaded, " +
"downloaded_ts, " +
"downloaded_file, " +
"server_public_key, " +
"modified, " +
"created" +
" from " +
"results " +
"order by " +
"created desc", null);
if(cursor != null && cursor.moveToFirst())
{
result = new ArrayList<de.labor_stein.befund.Core.Models.Database.Results>();
do
{
de.labor_stein.befund.Core.Models.Database.Results results = new de.labor_stein.befund.Core.Models.Database.Results();
results.pgs = cursor.getString(0);
results.available = (cursor.getInt(1) == 1);
results.available_ts = cursor.getString(2);
results.picked_up = (cursor.getInt(3) == 1);
results.picked_up_ts = cursor.getString(4);
results.file_checksum = cursor.getString(5);
results.status = cursor.getString(6);
results.downloaded = (cursor.getInt(7) == 1);
results.downloaded_ts = cursor.getString(8);
results.downloaded_file = cursor.getString(9);
results.server_public_key = cursor.getString(10);
results.modified = cursor.getString(11);
results.created = cursor.getString(12);
if(results.pgs != null)
{
if(activeOnly)
{
de.labor_stein.befund.Core.Models.Database.Results.ResultsStatus status = results.GetStatus();
if((status == de.labor_stein.befund.Core.Models.Database.Results.ResultsStatus.COMPLETED ||
status == de.labor_stein.befund.Core.Models.Database.Results.ResultsStatus.EXPIRED) &&
(results.picked_up || results.available))
{
result.add(results);
}
}
else
{
result.add(results);
}
}
}
while (cursor.moveToNext());
}
con.close();
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Database", "GetResults");
}
return result;
}
/**
* Deletes all inactive results from the database, that are older than 24h and have status pending
*
* @return returns List of results
*/
public void DeleteOldInactiveResults()
{
try
{
if(this.DatabaseExists())
{
SQLiteDatabase con = this.CreateConnection();
if(con != null)
{
Cursor cursor = con.rawQuery("select " +
"pgs," +
"available," +
"available_ts," +
"picked_up, " +
"picked_up_ts, " +
"file_checksum, " +
"status, " +
"downloaded, " +
"downloaded_ts, " +
"downloaded_file, " +
"server_public_key, " +
"modified, " +
"created" +
" from " +
"results " +
"order by " +
"created desc", null);
if(cursor != null && cursor.moveToFirst())
{
do
{
de.labor_stein.befund.Core.Models.Database.Results results = new de.labor_stein.befund.Core.Models.Database.Results();
results.pgs = cursor.getString(0);
results.available = (cursor.getInt(1) == 1);
results.available_ts = cursor.getString(2);
results.picked_up = (cursor.getInt(3) == 1);
results.picked_up_ts = cursor.getString(4);
results.file_checksum = cursor.getString(5);
results.status = cursor.getString(6);
results.downloaded = (cursor.getInt(7) == 1);
results.downloaded_ts = cursor.getString(8);
results.downloaded_file = cursor.getString(9);
results.server_public_key = cursor.getString(10);
results.modified = cursor.getString(11);
results.created = cursor.getString(12);
if(results.pgs != null && results.created != null)
{
de.labor_stein.befund.Core.Models.Database.Results.ResultsStatus status = results.GetStatus();
Date created = results.GetCreated();
Date now = new Date();
long difference = Math.abs(created.getTime() - now.getTime());
long differenceHours = difference / (60 * 60 * 1000);
if(status != de.labor_stein.befund.Core.Models.Database.Results.ResultsStatus.COMPLETED &&
status != de.labor_stein.befund.Core.Models.Database.Results.ResultsStatus.EXPIRED &&
!results.picked_up && !results.available && differenceHours >= 24)
{
this.Delete(results);
}
}
}
while (cursor.moveToNext());
}
con.close();
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Database.Database", "DeleteOldInactiveResults");
}
}
/**
* Check if database exists
*
* @return returns true if database exists
*/
private boolean DatabaseExists()
{
String dbPath = System.ResultsDatabasePath(CurrentContext);
return (dbPath != null && System.FileExists(dbPath));
}
/**
* Creates sqldatabase context
*
* @return retursn SQLiteDatabase context
*/
private SQLiteDatabase CreateConnection()
{
SQLiteDatabase result = null;
String dbPath = System.ResultsDatabasePath(CurrentContext);
if(dbPath != null)
{
result = SQLiteDatabase.openOrCreateDatabase(dbPath, null);
}
return result;
}
@Override
public void onCreate(SQLiteDatabase db)
{
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
}
}

View File

@ -0,0 +1,75 @@
//
// DateHelper.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Helpers;
import android.widget.DatePicker;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
public class DateHelper
{
/**
* Gets Date from datepicker
* @param datePicker - datepicker that contains date
* @return returns Date
*/
public static Date getDateFromDatePicket(DatePicker datePicker)
{
int day = datePicker.getDayOfMonth();
int month = datePicker.getMonth();
int year = datePicker.getYear();
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day);
return calendar.getTime();
}
/**
* Gets full year by date
* @param date - date
* @return returns year in full format - yyyy
*/
public static int GetFullYearFromDate(Date date)
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df = new SimpleDateFormat("yyyy");
return Integer.parseInt(df.format(date));
}
/**
* Gets full month by date
* @param date - date
* @return returns month in full format - MM
*/
public static int GetFullMonthFromDate(Date date)
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df = new SimpleDateFormat("MM");
return Integer.parseInt(df.format(date));
}
/**
* Gets full day of month by date
* @param date - date
* @return returns day of month in full format dd
*/
public static int GetFullDayFromDate(Date date)
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df = new SimpleDateFormat("dd");
return Integer.parseInt(df.format(date));
}
}

View File

@ -0,0 +1,51 @@
//
// ImageHelper.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Helpers;
import android.graphics.Bitmap;
import android.graphics.Color;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.common.BitMatrix;
import de.labor_stein.befund.Core.Log;
public class ImageHelper
{
public static Bitmap QRCode(String content, int width, int height)
{
Bitmap result = null;
try
{
if(content != null && !content.isEmpty())
{
MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, width, height);
result = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
result.setPixel(i, j, bitMatrix.get(i,j) ? Color.BLACK : Color.WHITE);
}
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "ImageHelper", "QRCode(String)");
}
return result;
}
}

View File

@ -0,0 +1,667 @@
//
// Request.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Https;
import android.os.AsyncTask;
import com.google.gson.Gson;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.lang.reflect.Method;
import java.net.URL;
import java.nio.channels.AsynchronousChannelGroup;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.security.Security;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import de.labor_stein.befund.BuildConfig;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Request.EncryptedRequest;
import de.labor_stein.befund.Core.Models.Request.KeyExchange;
import de.labor_stein.befund.Core.Models.Response.EncryptedResponse;
import de.labor_stein.befund.Core.Models.Response.PublicKey;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Curve25519;
public class Request
{
/**
* Low Level Header protector
*/
private static final String HeaderSecureHash = "3HzKQw/&>*VH^?cAR{Qd5pP~6w(V5%aZ";
private static final String HeaderValueSecureHash = "7*R3P!f:sC4Q8XS:@*J/z:4/sS;V3GnM";
/**
* Sends Key Exchange Request to the server in async mode and calls callback(onSucces or onError)
* @param host - Servers.Host that should get this request
* @param keyPair - Client keyPair(if not given it will create a new one)
* @param onSuccess - onSuccess Handler
* @param onError - onError Handler
*/
public static void KeyExchangeAsync(Servers host, Curve25519.KeyPair keyPair, Consumer<PublicKey> onSuccess, Consumer<String> onError)
{
try
{
new PostKeyExchangeRequestAsync().RunAsync(host, "exchange", "key", keyPair, onSuccess, onError);
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.Https.Request", "KeyExchangeAsync(KeyPair, Consumer<PublicKey>)");
}
}
/**
* Sends Encrypted Request to the server in async mode and calls callback(onSucces or onError)
* @param host - Servers.Host that should get this request
* @param controller - controller of the request
* @param action - controller action of the request
* @param request - Encrypted Request that should be sent to the server
* @param serverPublicKey - Server Public Key from Exchange Request
* @param keyPair - Client KeyPair (if not given it will create a new one)
* @param onSuccess - onSuccess Handler
* @param onError - onError Handler
*/
public static void EncryptedRequestAsync(Servers host, String controller, String action, EncryptedRequest request, PublicKey serverPublicKey, Curve25519.KeyPair keyPair, Consumer<EncryptedResponse> onSuccess, Consumer<String> onError)
{
try
{
new PostEncryptedRequestAsync().RunAsync(host, controller, action, request, keyPair, serverPublicKey, onSuccess, onError);
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.Https.Request", "EncryptedRequestAsync(KeyPair, Consumer<EncryptedResponse>)");
}
}
/**
* Gets http response of an url
*/
public static void GetResponseAsync(String url, String method, Consumer<String> onSuccess, Consumer<String> onError)
{
try
{
new HttpsRequestAsync().RunAsync(url, method, onSuccess, onError);
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.Https.Request", "GetResponseAsync(String, String, Consumer, Consumer<EncryptedResponse>)");
}
}
/**
* Sends EncryptedRequest to the server in async mode and calls callback(onSucces or onError)
*/
public static class PostEncryptedRequestAsync extends AsyncTask<Void, String, Boolean>
{
private Servers Host = null;
private String Controller = null;
private String Action = null;
private EncryptedRequest EncryptedRequest = null;
private Curve25519.KeyPair KeyPair = null;
private PublicKey ServerPublicKey = null;
private Consumer<EncryptedResponse> OnSuccess = null;
private Consumer<String> OnError = null;
private String Url = null;
/**
* Construct all necessary parameters for the async request
* @param host - Host that should get the request
* @param controller - Controller that should be called
* @param action - Controller Action that should be called
* @param encryptedRequest - Encrypted request
* @param keyPair - KeyPair of the client(if not given, it will create a new one)
* @param serverPublicKey - Server Public Key from Exchange Request
* @param onSuccess - onSuccess Handler
* @param onError - onError Handler
*/
public void RunAsync(Servers host, String controller, String action, EncryptedRequest encryptedRequest, Curve25519.KeyPair keyPair, PublicKey serverPublicKey, Consumer<EncryptedResponse>onSuccess, Consumer<String> onError)
{
this.Host = host;
this.Controller = controller;
this.Action = action;
this.EncryptedRequest = encryptedRequest;
this.KeyPair = (keyPair != null ? keyPair : Curve25519.GenerateKeyPair());
this.ServerPublicKey = serverPublicKey;
this.OnSuccess = onSuccess;
this.OnError = onError;
this.Url = wellFormedControllerAction(host, controller, action);
this.doInBackground();
}
/**
* Runs the https request in the background and calls ether onSuccess or onError Callbacks
* @param params
* @return
*/
protected Boolean doInBackground(Void... params)
{
boolean result = false;
try
{
URL uri = new URL(this.Url);
HttpsURLConnection client = (HttpsURLConnection)uri.openConnection();
client.setRequestMethod("POST");
client.setRequestProperty("Host", this.Host.getUrl());
client.setRequestProperty("User-Agent", "BefundApp");
client.setRequestProperty("Content-Type", "application/json");
client.setRequestProperty("Client-Hash", AES.Encrypt(HeaderValueSecureHash, AES.GetKey(HeaderSecureHash)));
client.setRequestProperty("Client-Key", this.KeyPair.PublicKey);
client.setRequestProperty("Client-Signature-Key", this.KeyPair.SigningPublicKey);
client.setRequestProperty("Client-Signature", this.KeyPair.GetSignature((this.EncryptedRequest.encrypted_content != null ? this.EncryptedRequest.encrypted_content : this.EncryptedRequest.descriptor)));
String json = new Gson().toJson(this.EncryptedRequest);
client.setDoOutput(true);
client.setDoInput(true);
OutputStream os = client.getOutputStream();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
writer.write(json);
writer.flush();
writer.close();
os.flush();
os.close();
int responseCode = client.getResponseCode();
if (responseCode == 429)
{
Session.Maintenance = false;
Session.MaintenanceNotified = false;
this.responseError(Lang.Get("ERROR_TOO_MANY_REQUESTS"));
}
else if (responseCode == 503)
{
Session.Maintenance = true;
this.responseError(Lang.Get("MSG_MAINTENANCE"));
}
else
{
Session.Maintenance = false;
Session.MaintenanceNotified = false;
if(!validServerHeaders(client))
{
this.responseError(Lang.Get("ERROR_INVALID_RESPONSE"));
}
else
{
String jsonResponse = responseJson(client);
if(jsonResponse != null && !jsonResponse.isEmpty())
{
EncryptedResponse encryptedResponse = new Gson().fromJson(jsonResponse, EncryptedResponse.class);
if(validServerSignature(client, encryptedResponse, this.KeyPair.GetSharedKey(this.ServerPublicKey.key)))
{
this.responseEncryptedResponse(encryptedResponse);
}
}
}
}
client.disconnect();
result = true;
}
catch(Exception ex)
{
Log.Error(ex.getMessage(), "Core.Https.Request.PostEncryptedRequestAsync", "doInBackground");
this.responseError(Lang.Get("ERROR_SERVER_NOT_REACHABLE"));
}
return result;
}
/**
* Calls OnError Handler with a error message
* @param message - error message
*/
private void responseError(String message)
{
if(this.OnError != null)
{
this.OnError.accept(message);
}
}
/**
* Calls OnSuccess Handler with a EncryptedResponse
* @param encryptedResponse - EncryptedResponse of the server
*/
private void responseEncryptedResponse(EncryptedResponse encryptedResponse)
{
if(this.OnSuccess != null)
{
this.OnSuccess.accept(encryptedResponse);
}
}
}
/**
* Sends Key Exchange Post request to the server in async mode and calls callback(onSucces or onError)
*/
public static class PostKeyExchangeRequestAsync extends AsyncTask<Void, Void, Boolean>
{
private Servers Host = null;
private String Controller = null;
private String Action = null;
private Curve25519.KeyPair KeyPair = null;
private Consumer<PublicKey> OnSuccess = null;
private Consumer<String> OnError = null;
private String Url = null;
/**
* Construct all necessary parameters for the async request
* @param host - Host that should get the request
* @param controller - Controller that should be called
* @param action - Controller Action that should be called
* @param keyPair - KeyPair of the client(if not given, it will create a new one)
* @param onSuccess - onSuccess Handler
* @param onError - onError Handler
*/
public void RunAsync(Servers host, String controller, String action, Curve25519.KeyPair keyPair, Consumer<PublicKey>onSuccess, Consumer<String> onError)
{
this.Host = host;
this.Controller = controller;
this.Action = action;
this.KeyPair = (keyPair != null ? keyPair : Curve25519.GenerateKeyPair());
this.OnSuccess = onSuccess;
this.OnError = onError;
this.Url = wellFormedControllerAction(host, "exchange", "key");
this.doInBackground();
}
/**
* Runs the https request in the background and calls ether onSuccess or onError Callbacks
* @param params
* @return
*/
protected Boolean doInBackground(Void... params)
{
boolean result = false;
try
{
trustSelfSignedCertificateInDebugMode();
URL uri = new URL(this.Url);
HttpsURLConnection client = (HttpsURLConnection)uri.openConnection();
client.setRequestMethod("POST");
client.setRequestProperty("Host", this.Host.getUrl());
client.setRequestProperty("User-Agent", "BefundApp");
client.setRequestProperty("Content-Type", "application/json");
client.setRequestProperty("Client-Hash", AES.Encrypt(HeaderValueSecureHash, AES.GetKey(HeaderSecureHash)));
client.setRequestProperty("Client-Key", this.KeyPair.PublicKey);
String json = new Gson().toJson(new KeyExchange());
client.setDoOutput(true);
client.setDoInput(true);
OutputStream os = client.getOutputStream();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
writer.write(json);
writer.flush();
writer.close();
os.flush();
os.close();
int responseCode = client.getResponseCode();
if (responseCode == 429)
{
Session.Maintenance = false;
Session.MaintenanceNotified = false;
this.responseError(Lang.Get("ERROR_TOO_MANY_REQUESTS"));
}
else if (responseCode == 503)
{
Session.Maintenance = true;
this.responseError(Lang.Get("MSG_MAINTENANCE"));
}
else
{
Session.Maintenance = false;
Session.MaintenanceNotified = false;
if(!validServerHeaders(client))
{
this.responseError(Lang.Get("ERROR_INVALID_RESPONSE"));
}
else
{
String jsonResponse = responseJson(client);
if(jsonResponse != null && !jsonResponse.isEmpty())
{
this.responsePublicKey(new Gson().fromJson(jsonResponse, PublicKey.class));
}
else
{
this.responseError(Lang.Get("ERROR_INVALID_RESPONSE"));
}
}
}
client.disconnect();
result = true;
}
catch(Exception ex)
{
Log.Error(ex.getMessage(), "Core.Https.Request.PostKeyExchangeRequestAsync", "doInBackground");
this.responseError(Lang.Get("ERROR_SERVER_NOT_REACHABLE"));
}
return result;
}
/**
* Calls OnError Handler with a error message
* @param message - error message
*/
private void responseError(String message)
{
if(this.OnError != null)
{
this.OnError.accept(message);
}
}
/**
* Calls OnSuccess Handler with a PublicKey
* @param publicKey - Public Key of the server
*/
private void responsePublicKey(PublicKey publicKey)
{
if(this.OnSuccess != null)
{
this.OnSuccess.accept(publicKey);
}
}
}
/**
* Gets http response of an url
*/
public static class HttpsRequestAsync extends AsyncTask<Void, Void, Boolean>
{
private String Url = null;
private String Method = "GET";
private Consumer<String> OnSuccess = null;
private Consumer<String> OnError = null;
/**
* Construct all necessary parameters for the async request
* @param url - Url of request
* @param method - method of http request
* @param onSuccess - onSuccess Handler
* @param onError - onError Handler
*/
public void RunAsync(String url, String method, Consumer<String>onSuccess, Consumer<String> onError)
{
this.Url = url;
this.Method = (method != null ? method : "GET");
this.OnSuccess = onSuccess;
this.OnError = onError;
this.doInBackground();
}
protected Boolean doInBackground(Void... params)
{
boolean result = false;
try
{
trustSelfSignedCertificateInDebugMode();
URL uri = new URL(this.Url);
HttpsURLConnection client = (HttpsURLConnection)uri.openConnection();
client.setRequestMethod(this.Method);
client.setRequestProperty("Host", uri.getHost());
client.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36");
int responseCode = client.getResponseCode();
if (responseCode == 200)
{
String response = responseJson(client);
if(response != null && !response.isEmpty())
{
this.responseSuccess(response);
}
}
else
{
this.responseError("Not available");
}
client.disconnect();
result = true;
}
catch(Exception ex)
{
Log.Error(ex.getMessage(), "Core.Https.Request.HttpsRequestAsync", "doInBackground");
this.responseError(Lang.Get("ERROR_SERVER_NOT_REACHABLE"));
}
return result;
}
/**
* Calls OnSuccess Handler with a content of response
* @param message - error message
*/
private void responseSuccess(String message)
{
if(this.OnSuccess != null)
{
this.OnSuccess.accept(message);
}
}
/**
* Calls OnError Handler with a error message
* @param message - error message
*/
private void responseError(String message)
{
if(this.OnError != null)
{
this.OnError.accept(message);
}
}
}
/**
* Trusts self signed SSL/HTTPS Certificate in the DEBUG Mode
*/
public static void trustSelfSignedCertificateInDebugMode()
{
try
{
// Trust self signed certificate on debug mode
if(BuildConfig.DEBUG)
{
TrustManager[] trustAllCerts = new TrustManager[]
{
new X509TrustManager()
{
public X509Certificate[] getAcceptedIssuers()
{
X509Certificate[] trusted = new X509Certificate[0];
return trusted;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType)
{
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType)
{
}
}
};
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier()
{
@Override
public boolean verify(String arg0, SSLSession arg1)
{
return true;
}
});
}
}
catch (Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Https.Request", "verifyCertificate");
}
}
/**
* Verifies server header
* @param server - server that sends response to the client
* @return returns true if server header and signature are valid
*/
private static boolean validServerHeaders(HttpsURLConnection server)
{
boolean result = false;
if(server != null)
{
String userAgent = server.getHeaderField("User-Agent");
String contentType = server.getHeaderField("Content-Type");
String serverHash = server.getHeaderField("Server-Hash");
String serverKey = server.getHeaderField("Server-Key");
if(userAgent != null &&
userAgent.equals("BefundAppServer") &&
contentType != null &&
contentType.equals("application/json") &&
serverHash != null &&
HeaderValueSecureHash.equals(AES.Decrypt(serverHash, AES.GetKey(HeaderSecureHash)))
&& serverKey != null)
{
result = true;
}
}
return result;
}
/**
* Validates the server response by signature and HMAC
*
* @param server - server that sends response to the client
* @param encryptedResponse - encrypted response with hmac
* @param deriveKey - derive key with server
* @return returns true if valid
*/
private static boolean validServerSignature(HttpsURLConnection server, EncryptedResponse encryptedResponse, byte[] deriveKey)
{
boolean result = false;
if(server != null && encryptedResponse != null)
{
String signature = server.getHeaderField("Server-Signature");
String signatureKey = server.getHeaderField("Server-Signature-Key");
if(signature != null && signatureKey != null && encryptedResponse.ValidSignature(deriveKey, signature, signatureKey))
{
result = true;
}
}
return result;
}
/**
* Response json from the client stream
* @param client - client that contains json response
*/
private static String responseJson(HttpsURLConnection client)
{
String result = null;
try
{
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
InputStream in = client.getInputStream();
while ((len = in.read(buffer)) != -1)
{
outStream.write(buffer, 0, len);
}
byte[] data = outStream.toByteArray();
if(data != null)
{
result = new String(data, StandardCharsets.UTF_8);
}
in.close();
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.Https.Request", "responseJson(HttpsURLConnection)");
}
return result;
}
/**
* Forms a controller action for the request
* @param host - Host of URL
* @param controller - Controller of request
* @param action - Action of Controller, that should be called
* @return returns well formed url for the request
*/
private static String wellFormedControllerAction(Servers host, String controller, String action)
{
String result = "https://" + host.getUrl();
if(controller != null && !controller.isEmpty())
{
result = result + "/" + controller;
}
if(action != null && !action.isEmpty())
{
result = result + "/" + action;
}
return result;
}
}

View File

@ -0,0 +1,61 @@
//
// Servers.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Https;
public enum Servers
{
// Development server change ip to your local ip
DEVELOPMENT("192.168.10.26"),
//DEVELOPMENT("172.21.200.145"),
/**
* HOST´s of productive outside services
*/
LIS_SIMULATOR("pba-simulator.patientenbefundapp.labor-limbach-hannover.de:8443"),
LABOR_HEIDELBERG("patientenbefundapp.labor-limbach.de"),
LABOR_LUDWIGSBURG("patientenbefundapp.mvz-labor-lb.de"),
LABOR_ULM("patientenbefundapp.humangenetik-ulm.de"),
LABOR_AACHEN("patientenbefundapp.labor-aachen.de"),
LABOR_BERLIN("patientenbefundapp.mdi-limbach-berlin.de"),
LABOR_COTTBUS("patientenbefundapp.labor-cottbus.de"),
LABOR_DESSAU("patientenbefundapp.laborpraxis-dessau.de"),
LABOR_DORTMUND("patientenbefundapp.labor-dortmund.de"),
LABOR_DRESDEN("patientenbefundapp.labordresden.de"),
LABOR_ERFURT("patientenbefundapp.labor-erfurt.de"),
LABOR_ESSEN("patientenbefundapp.labor-eveld.de"),
LABOR_FREIBURG("patientenbefundapp.mvz-clotten.de"),
LABOR_HANNOVER("patientenbefundapp.labor-limbach-hannover.de"),
LABOR_HOFHEIM("patientenbefundapp.labor-hofheim.de"),
LABOR_KARLSRUHE("patientenbefundapp.laborvolkmann.de"),
LABOR_LEIPZIG("patientenbefundapp.labor-leipzig.de"),
LABOR_MOENCHENGLADBACH("patientenbefundapp.labor-stein.de"),
LABOR_MUENCHEN("patientenbefundapp.labor-limbach-muenchen.de"),
LABOR_MUENSTER("patientenbefundapp.labor-muenster.de"),
LABOR_NUERBERG("patientenbefundapp.labor-limbach-nuernberg.de"),
LABOR_PASSAU("patientenbefundapp.labor-passau.de"),
LABOR_RAVENSBURG("patientenbefundapp.labor-gaertner.de"),
LABOR_ROSENHEIM("patientenbefundapp.medlabor.de"),
LABOR_SCHWEINFURT("patientenbefundapp.laboraerzte-schweinfurt.de"),
LABOR_SCHWERIN("patientenbefundapp.labor-schwerin.de"),
LABOR_STRALSUND("patientenbefundapp.labor-stralsund.de"),
LABOR_SUHL("patientenbefundapp.labor-suhl.de"),
LABOR_KASSEL("MISSING"),
LABOR_HANNOVER_MLM("patientenbefundapp.mlh.de"),
LABOR_MAINZ("patientenbefundapp.medgen-mainz.de"),
LABOR_FRANKFURT("patientenbefundapp.laborarztpraxis.de");
private String Url;
Servers(String url)
{
this.Url = url;
}
public String getUrl()
{
return this.Url;
}
}

View File

@ -0,0 +1,201 @@
//
// DE.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Lang;
import java.util.HashMap;
public class DE
{
public static HashMap<String, String> GetDict()
{
HashMap<String, String> result = new HashMap<String, String>();
//MARK: LABELS
result.put("LBL_MY_RESULTS", "Meine Befunde");
result.put("LBL_ZIP", "PLZ");
result.put("LBL_BIRTHDAY", "Geb. Datum");
result.put("LBL_SAMPLEID", "Auftragsnummer");
result.put("LBL_PASSWORD", "Passwort");
result.put("LBL_PASSWORD_CONFIRM", "Passwort bestätigen");
result.put("LBL_PENDING", "Ausstehend");
result.put("LBL_READY_TO_DOWNLOAD", "Bereit zum Herunterladen");
result.put("LBL_ALREADY_DOWNLOAD", "Heruntergeladen");
result.put("LBL_REJECTED", "Abgelehnt");
result.put("LBL_EXPIRED", "Abgelaufen");
result.put("LBL_NO_RESULTS", "Sie haben aktuell keinen Befund");
//result.put("LBL_OLD_PASSWORD", "Altes Passwort");
//result.put("LBL_SUPPORT_CODE", "Support Code");
result.put("LBL_PRIVACY_POLICY", "AGB und Datenschutzerklärung");
result.put("LBL_DOWNLOADING", "Wird geladen...");
result.put("LBL_SELECT_LABOR", "Wählen Sie Ihr Labor aus");
result.put("LBL_SELECT_LABOR_MANUEL", "Für die manuelle Auswahl wischen Sie nach rechts");
result.put("LBL_MENU", "MENU");
result.put("LBL_BIOMETRICAL_AUTHENTIFICATION", "Biometrische Authentifizierung");
//result.put("LBL_ERROR", "Fehler");
result.put("LBL_PIN", "PIN");
result.put("LBL_CURRENT_PASSWORD", "Aktuelles Passwort");
result.put("LBL_NEW_PASSWORD", "Neues Passwort");
result.put("LBL_NEW_PASSWORD_CONFIRM", "Passwort bestätigen");
result.put("LBL_NEW_PIN", "Neue PIN");
result.put("LBL_OEGD", "Meine Patientendaten");
result.put("LBL_NO_OEGD", "Sie haben Ihre Patientendaten noch nicht erfasst.\nWählen Sie das Menü unten aus, um Ihre persönlichen Daten zu erfassen.");
result.put("LBL_SCAN_QR_CODE", "Bitte klicken Sie auf das QR-Code-Symbol, um den QR-Code zu scannen.\n\nDamit wird Ihre App automatisch mit dem passenden Labor verknüpft");
result.put("LBL_NEW_OEGD", "Meine Patientendaten erfassen");
result.put("LBL_TITLE", "Titel");
result.put("LBL_FIRSTNAME", "Vorname");
result.put("LBL_LASTNAME", "Nachname");
result.put("LBL_NAME_PREFIX", "Vorsatzwort");
result.put("LBL_ADDITION_NAME", "Zusatzname");
result.put("LBL_GENDER", "Geschlecht");
result.put("LBL_STREET", "Straße");
result.put("LBL_STREET_NUMBER", "HausNr.");
result.put("LBL_CITY", "Ort");
result.put("LBL_GENDER_M", "Männlich");
result.put("LBL_GENDER_W", "Weiblich");
result.put("LBL_GENDER_D", "Divers");
result.put("LBL_GENDER_X", "Unbekannt");
result.put("LBL_TELEFON", "Telefon");
result.put("LBL_CWA_POLICY", "CWA Einverständniserklärung");
result.put("LBL_EDIT_OEGD", "Meine Patientendaten bearbeiten");
result.put("LBL_SETTINGS", "Einstellungen");
result.put("LBL_YOUR_LABOR", "Ihr Labor");
result.put("LBL_CONNECTED", "Verbindung erfolgreich");
result.put("LBL_DISCONNECTED", "Verbindung nicht erfolgreich");
result.put("LBL_LANGUAGE", "Sprache");
result.put("LBL_PASSWORD_CHANGE", "Passwort ändern");
result.put("LBL_SUPPORT", "Support");
result.put("LBL_EMAIL", "E-Mail");
result.put("LBL_TEXT", "Text");
result.put("LBL_SUPPORT_TOPIC_INFO", "Information");
result.put("LBL_SUPPORT_TOPIC_TROUBLE", "Störung");
result.put("LBL_SUPPORT_TOPIC_ACCOUNT_DELETE", "Account löschen");
result.put("LBL_REFERENCE_NUMBER", "Referenznummer");
result.put("LBL_PUSH_NOTIFICATION_EXPLAIN_HEADER", "App-Benachrichtigungen");
result.put("LBL_MAINTENANCE", "App-Wartungsarbeiten");
result.put("LBL_FAQ", "FAQ");
result.put("LBL_RESULTS_NOTICE", "Die Übermittlung eines Befundes ersetzt kein Gespräch mit Ihrem Arzt.");
//MARK: BUTTONS
result.put("BTN_NEW_RESULTS", "Neuer Befund");
result.put("BTN_MY_RESULT", "Mein Befund");
result.put("BTN_PRIVACY_POLICY", "Datenschutzerklärung");
result.put("BTN_ADD", "Registrieren");
result.put("BTN_NEXT", "Weiter");
//result.put("BTN_DONE", "Fertig");
result.put("BTN_CANCEL", "Abbrechen");
result.put("BTN_BACK", "Zurück");
//result.put("BTN_ENCRYPT", "Entschlüsseln");
result.put("BTN_DELETE", "Löschen");
//result.put("BTN_TAKE_OVER", "Übernehmen");
result.put("BTN_ACCEPT_PRIVACY_POLICY", "Ich akzeptiere die AGB und Datenschutzerklärung");
result.put("BTN_SELECT", "Auswählen");
result.put("BTN_SETTINGS", "Einstellungen");
result.put("BTN_CHANGE_PASSWORD", "Passwort ändern");
result.put("BTN_OEGD", "Meine Patientendaten erfassen");
result.put("BTN_SUPPORT", "Support");
result.put("BTN_FAQ", "FAQ");
result.put("BTN_CLOSE", "Schließen");
result.put("BTN_LOGIN", "Login");
result.put("BTN_FORGOT", "Vergessen");
result.put("BTN_EDIT", "Bearbeiten");
result.put("BTN_CHANGE", "Ändern");
result.put("BTN_PIN_REQUEST", "PIN anfordern");
result.put("BTN_PRINT", "Drucken");
result.put("BTN_FILE_SHARE", "Dateifreigabe");
result.put("BTN_CREATE", "Erstellen");
result.put("BTN_ACCEPT_CWA_POLICY", "CWA Einverständniserklärung");
result.put("BTN_NO", "Nein");
result.put("BTN_YES", "Ja");
result.put("BTN_SAVE", "Speichern");
result.put("BTN_SEND", "Senden");
result.put("BTN_HIDE_KEYBOARD", "Tastatur aus");
result.put("BTN_OK", "OK");
//MARK: ERRORS
result.put("ERROR_ENTER_ZIP", "Bitte geben Sie die PLZ Ihres Wohnortes ein.");
result.put("ERROR_ENTER_BIRTHDAY", "Bitte geben Sie Ihr Geburtsdatum ein.");
result.put("ERROR_ENTER_SAMPLEID", "Bitte geben Sie eine Auftragsnummer ein.");
result.put("ERROR_ENTER_PASSWORD", "Bitte geben Sie Ihr persönliches Kennwort ein.");
result.put("ERROR_ENTER_STRONG_PASSWORD", "Das Passwort muss min. 8 Zeichen, darunter min. 1 Großbuchstabe, 1 Kleinbuchstabe, 1 Ziffer und 1 Sonderzeichen enthalten.");
result.put("ERROR_CONFIRM_PASSWORD", "Die Passwörter stimmen nicht überein.");
result.put("ERROR_COULD_NOT_SAVE", "Die Daten konnten auf dem Gerät nicht geschrieben werden. Bitte prüfen Sie, ob die Berechtigung zum Datenschreiben erlaubt ist.");
result.put("ERROR_ENCRYPTION_NOT_SUPPORTED", "Leider Ihr Gerät unterstützt keine Verschlüsselung und kann für unsere Applikation nicht verwendet werden.");
result.put("ERROR_SERVER_NOT_REACHABLE", "Leider ist aktuell der Server nicht erreichbar. Bitte versuchen Sie es später erneut.");
result.put("ERROR_ENTER_VALID_ZIP", "Bitte geben Sie eine gültige PLZ ein.");
result.put("ERROR_ENTER_VALID_BIRTHDAY", "Bitte geben Sie ein gültiges Geburtsdatum ein.");
result.put("ERROR_ENTER_VALID_SAMPLEID", "Bitte geben Sie eine gültige Auftragsnummer ein.");
result.put("ERROR_INVALID_RESPONSE", "Die Antwort vom Server konnte nicht validiert werden. Bitte versuchen Sie es später erneut.");
//result.put("ERROR_KEYS_COULD_NOT_EXCHANGED", "Der Sicherheitsschlüssel konnte mit dem Server nicht ausgetauscht werden.");
result.put("ERROR_COULD_NOT_REGISTER_PGS", "Leider konnte Ihre Anfrage für diesen Auftrag nicht registriert werden.");
result.put("ERROR_MAX_OPENED_REQUEST_LIMIT", "Sie haben die Anzahl der maximalen zulässigen öffenen Anfragen überschritten. (Max. 10 offenen Anfragen erlaubt).");
result.put("ERROR_ALREADY_SUBSCRIBTED", "Die von Ihnen eingegebene Auftragsnummer wurde bereits auf einem anderen Gerät registriert. Sollte die App neu installiert worden sein, kann das Problem ebenfalls auftreten. Wenden Sie sich in diesem Fall bitte an den Support (siehe Menü), um an Ihren Befund zu kommen.");
result.put("ERROR_TOO_MANY_REQUESTS", "Sie haben in letzter Zeit zu viele Anfragen gesendet. Bitte warten Sie und versuchen Sie es später erneut.");
result.put("ERROR_INVALID_PASSWORD", "Das eingegebene Passwort ist ungültig.");
//result.put("ERROR_DOWNLOAD_NOT_FOUND", "Der Befund konnte leider nicht heruntergeladen werden. Bitte versuchen Sie es später erneut.");
result.put("ERROR_COULD_NOT_DECRYPT", "Der Befund konnte leider nicht entschlüsselt werden. Bitte versuchen Sie es später erneut.");
result.put("ERROR_COULD_NOT_SAVE_ENCRYPTED", "Der Befund konnte nicht gespeichert werden.");
result.put("ERROR_ENCRYPTED_FILE_NOT_FOUND", "Die Befunddatei wurde auf Ihrem Gerät nicht gefunden.");
//result.put("ERROR_ENTER_OLD_PASSWORD", "Bitte geben Sie das alte Passwort ein.");
//result.put("ERROR_NOT_AUTHORIZED_TO_TAKE_OVER", "Leider konnte der Befund nicht übernommen werden. Bitte wenden Sie sich an unseren Support.");
//result.put("ERROR_SUPPORT_CODE_NEEDED", "Bitte wenden Sie sich an unseren Support, um diesen Befund übernehmen zu können.");
//result.put("ERROR_ENTER_SUPPORT_CODE_PASSWORD", "Bitte geben Sie einen Support Code ein. Wenn Sie noch keinen Support Code erhalten haben, wenden Sie sich dafür an unseren Support.");
result.put("ERROR_ACCEPT_PRIVACY_POLICY", "Bitte akzeptieren Sie die AGB und Datenschutzerklärung.");
//result.put("ERROR_CAMERA_PERMISSION_DENIED", "Die Berechtigung für Kamera wurde verweigert.");
//result.put("ERROR_PUSH_PERMISSION_DENIED", "Die Berechtigung für PUSH-Benachrichtigungen wurde verweigert.");
result.put("ERROR_RESULTS_COULD_NOT_DOWNLOADED", "Download nicht möglich.");
result.put("ERROR_COULD_NOT_READ_QRCODE", "QR-Code konnte nicht gelesen werden.");
result.put("ERROR_COULD_NOT_READ_BARCODE", "Barcode konnte nicht gelesen werden.");
result.put("ERROR_BIOMETRICAL_AUTHENTIFICATION_COULD_NOT_ACTIVATED", "Die biometrische Authentifizierung konnte nicht aktiviert werden.");
result.put("ERROR_ENTER_PIN", "Bitte geben Sie eine PIN ein.");
result.put("ERROR_ENTER_NEW_PIN", "Bitte geben Sie eine neue PIN ein.");
result.put("ERROR_PIN_LENGTH", "PIN muss aus 5 Ziffern bestehen.");
result.put("ERROR_ENTER_YOUR_PIN", "Bitte geben Sie Ihre PIN ein.");
result.put("ERROR_ENTER_YOUR_CURRENT_PASSWORD", "Bitte geben Sie Ihr aktuelles Passwort ein.");
result.put("ERROR_INVALID_PASSWORD_RESET_PIN", "Die von Ihnen eingegebene PIN ist nicht gültig.");
result.put("ERROR_COULD_NOT_GET_PIN", "PIN konnte vom Server nicht empfangen werden.");
result.put("ERROR_COULD_NOT_CHANGE_PASSWORD", "Das Passwort konnte nicht geändert werden.");
//result.put("ERROR_ACCEPT_CWA_POLICY", "Für die Erfassung der Patientendaten benötigen wir Ihre Einverständniserklärung.");
result.put("ERROR_COULD_NOT_SAVE_OEGD", "Die Patientendaten konnten nicht gespeichert werden.");
result.put("ERROR_ENTER_FIRSTNAME", "Bitte geben Sie Ihren Vornamen ein.");
result.put("ERROR_ENTER_LASTNAME", "Bitte geben Sie Ihren Nachnamen ein.");
result.put("ERROR_ENTER_GENDER", "Bitte geben Sie Ihr Geschlecht ein.");
result.put("ERROR_ENTER_STREET", "Bitte geben Sie die Straße ein.");
result.put("ERROR_ENTER_STREET_NUMBER", "Bitte geben Sie die HausNr. ein.");
result.put("ERROR_ENTER_CITY", "Bitte geben Sie Ihren Wohnort ein.");
result.put("ERROR_YOUR_CURRENT_PASSWORD_IS_INVALID", "Ihr aktuelles Passwort ist leider nicht gültig.");
result.put("ERROR_ENTER_EMAIL", "Bitte geben Sie Ihre E-Mail ein.");
result.put("ERROR_ENTER_TOPIC", "Bitte wählen Sie ein Thema aus.");
result.put("ERROR_ENTER_TEXT", "Bitte geben Sie den Text ein.");
result.put("ERROR_ACCOUNT_COULD_NOT_DELETED", "Account konnte nicht gelöscht werden. Bitte versuchen Sie es später erneut.");
result.put("ERROR_SUPPORT_COULD_NOT_SENT", "Ihre Anfrage konnte leider nicht versendet werden. Bitte versuchen Sie es später erneut.");
result.put("ERROR_PRIVACY_POLICY_NEEDS_CONNECTION", "Um unsere Datenschutzerklärung lesen und akzeptieren zu können müssen Sie mit dem Internet verbunden sein");
result.put("ERROR_FAQ_NEEDS_CONNECTION", "Um unsere FAQ lesen zu können müssen Sie mit dem Internet verbunden sein");
//MARK: MESSAGES
result.put("MSG_PGS_ALREADY_EXISTS", "Es liegt aktuell noch kein Befund vor. Sie werden per Push-Nachricht informiert, sobald Ihr Befund vorliegt.");
result.put("MSG_PGS_SUCCESSFULLY_CREATED", "Vielen Dank, Ihre Anfrage wird nun bearbeitet. Wir werden Sie über einen neuen Status zu Ihrem Befund benachrichtigen. (Bitte beachten Sie, dass die App dazu die Berechtigung benötigt, Ihnen Nachrichten zu senden.).");
//result.put("MSG_DATA_REFRESHING", "Daten werden aktualisiert...");
result.put("MSG_PGS_ALREADY_AVAILABLE", "Vielen Dank. Ein Status zu Ihrem Befund ist bereits vorhanden.");
//result.put("MSG_ENTER_OLD_PASSWORD", "Bitte geben Sie das Passwort von Ihrem alten Gerät ein.");
//result.put("MSG_PGS_SUCCESSFULLY_OVER_TOOK", "Der Befund wurde aus Ihrem alten Gerät erfolgreich übernommen.");
result.put("MSG_YOU_ARE_NOT_REGISTERED", "Sie sind noch nicht registriert.");
result.put("MSG_PASSWORD_HAS_BEEN_CHANGED", "Ihr Passwort wurde erfolgreich geändert.");
result.put("MSG_SURE_WANT_DELETE", "Möchten Sie den ausgewählten Eintrag([ITEM]) wirklick löschen?");
result.put("MSG_SUPPORT_SUCCESSFULLY_SENT", "Vielen Dank, Ihre Anfrage wurde erfolgreich versendet.");
result.put("MSG_ACCOUNT_SUCCESSFULLY_DELETED", "Ihr Account wurde erfolgreich gelöscht.");
result.put("MSG_REQUESTED_RESULTS_NOT_FOUND", "Zu den von Ihnen gemachten Angaben konnte kein Auftrag gefunden werden. Bitte überprüfen Sie Ihre Angaben.");
result.put("MSG_REQUESTED_RESULTS_REJECTED", " Ihr Befund konnte im Labor bisher nicht eindeutig zugeordnet werden. Bitte prüfen Sie ihre gemachten Angaben. Sollten Sie trotz korrekter Angaben weiterhin dieses Ergebnis erhalten, wenden Sie sich bitte an den Support.");
result.put("MSG_PUSH_NOTIFICATION_EXPLAIN_TEXT", "Damit Sie direkt bei Vorliegen Ihres Befundes informiert werden können, ist es wichtig, dass diese App Ihnen Push-Nachrichten senden kann.");
result.put("MSG_MAINTENANCE", "Aktuell führen wir Wartungsarbeiten durch. Bitte beachten Sie, dass unsere App nur eingeschränkt zur Verfügung steht.");
result.put("MSG_CAMERA_PERMISSION_TITLE", "Befundapp möchte auf deine Kamera zugreifen");
result.put("MSG_CAMERA_PERMISSION_MSG", "Die Kamera wird verwendet, um den QR-Code des Labors zu scannen.");
return result;
}
}

View File

@ -0,0 +1,200 @@
//
// EN.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Lang;
import java.util.HashMap;
public class EN
{
public static HashMap<String, String> GetDict()
{
HashMap<String, String> result = new HashMap<String, String>();
//MARK: LABELS
result.put("LBL_MY_RESULTS", "My Findings");
result.put("LBL_ZIP", "ZIP CODE");
result.put("LBL_BIRTHDAY", "Date Born");
result.put("LBL_SAMPLEID", "Order number");
result.put("LBL_PASSWORD", "Password");
result.put("LBL_PASSWORD_CONFIRM", "Confirm Password");
result.put("LBL_PENDING", "Pending");
result.put("LBL_READY_TO_DOWNLOAD", "Ready to download");
result.put("LBL_ALREADY_DOWNLOAD", "Downloaded");
result.put("LBL_REJECTED", "Rejected");
result.put("LBL_EXPIRED", "Expired");
result.put("LBL_NO_RESULTS", "You currently have no findings");
result.put("LBL_OLD_PASSWORD", "Old Password");
result.put("LBL_SUPPORT_CODE", "Support Code");
result.put("LBL_PRIVACY_POLICY", "T&C and Privacy Policy");
result.put("LBL_DOWNLOADING", "Loading...");
result.put("LBL_SELECT_LABOR", "Select your lab");
result.put("LBL_SELECT_LABOR_MANUEL", "For manual selection, swipe right");
result.put("LBL_MENU", "MENU");
result.put("LBL_BIOMETRICAL_AUTHENTIFICATION", "Biometric Authentication");
result.put("LBL_ERROR", "Error");
result.put("LBL_PIN", "PIN");
result.put("LBL_CURRENT_PASSWORD", "Current password");
result.put("LBL_NEW_PASSWORD", "New password");
result.put("LBL_NEW_PASSWORD_CONFIRM", "Confirm Password");
result.put("LBL_NEW_PIN", "New PIN");
result.put("LBL_OEGD", "My patient data");
result.put("LBL_NO_OEGD", "You have not yet entered your patient data.\nSelect the menu below to enter your personal data.");
result.put("LBL_SCAN_QR_CODE", "Please click the QR code icon to scan the QR code.\nThis will automatically link your app to the appropriate lab.");
result.put("LBL_NEW_OEGD", "Capture my patient data");
result.put("LBL_TITLE", "Title");
result.put("LBL_FIRSTNAME", "FirstName");
result.put("LBL_LASTNAME", "LastName");
result.put("LBL_NAME_PREFIX", "prefix");
result.put("LBL_ADDITION_NAME", "additional name");
result.put("LBL_GENDER", "Gender");
result.put("LBL_STREET", "Street");
result.put("LBL_STREET_NUMBER", "HOUSE NO.");
result.put("LBL_CITY", "City");
result.put("LBL_GENDER_M", "Male");
result.put("LBL_GENDER_W", "Female");
result.put("LBL_GENDER_D", "Various");
result.put("LBL_GENDER_X", "unknown");
result.put("LBL_TELEFON", "telephone");
result.put("LBL_CWA_POLICY", "CWA Consent Form");
result.put("LBL_EDIT_OEGD", "Edit My Patient Data");
result.put("LBL_SETTINGS", "Settings");
result.put("LBL_YOUR_LABOR", "Your Lab");
result.put("LBL_CONNECTED", "Connection successful");
result.put("LBL_DISCONNECTED", "Connection not successful");
result.put("LBL_LANGUAGE", "Language");
result.put("LBL_PASSWORD_CHANGE", "Change Password");
result.put("LBL_SUPPORT", "Support");
result.put("LBL_EMAIL", "E-mail");
result.put("LBL_TEXT", "text");
result.put("LBL_SUPPORT_TOPIC_INFO", "information");
result.put("LBL_SUPPORT_TOPIC_TROUBLE", " malfunction");
result.put("LBL_SUPPORT_TOPIC_ACCOUNT_DELETE", "Delete Account");
result.put("LBL_REFERENCE_NUMBER", "reference number");
result.put("LBL_PUSH_NOTIFICATION_EXPLAIN_HEADER", "App notifications");
result.put("LBL_MAINTENANCE", "App Maintenance");
result.put("LBL_FAQ", "FAQ");
result.put("LBL_RESULTS_NOTICE", "Submitting a report does not replace a conversation with your doctor.");
//MARK: BUTTONS
result.put("BTN_NEW_RESULTS", "New finding");
result.put("BTN_MY_RESULT", "My Findings");
result.put("BTN_PRIVACY_POLICY", "Privacy Policy");
result.put("BTN_ADD", "Register");
result.put("BTN_NEXT", "Next");
result.put("BTN_DONE", "Done");
result.put("BTN_CANCEL", "Cancel");
result.put("BTN_BACK", "Back");
result.put("BTN_ENCRYPT", "Decrypt");
result.put("BTN_DELETE", "Delete");
result.put("BTN_TAKE_OVER", "Apply");
result.put("BTN_ACCEPT_PRIVACY_POLICY", "I accept the terms and conditions and privacy policy");
result.put("BTN_SELECT", "Select");
result.put("BTN_SETTINGS", "Settings");
result.put("BTN_CHANGE_PASSWORD", "Change Password");
result.put("BTN_OEGD", "Enter my patient data");
result.put("BTN_SUPPORT", "Support");
result.put("BTN_FAQ", "FAQ");
result.put("BTN_CLOSE", "Close");
result.put("BTN_LOGIN", "Login");
result.put("BTN_FORGOT", "Forget");
result.put("BTN_EDIT", "Edit");
result.put("BTN_CHANGE", "Modify");
result.put("BTN_PIN_REQUEST", "Request PIN");
result.put("BTN_PRINT", "Print");
result.put("BTN_FILE_SHARE", "File Share");
result.put("BTN_CREATE", "Create");
result.put("BTN_ACCEPT_CWA_POLICY", "CWA Consent Form");
result.put("BTN_NO", "No");
result.put("BTN_YES", "Yes");
result.put("BTN_SAVE", "Save");
result.put("BTN_SEND", "Send");
result.put("BTN_HIDE_KEYBOARD", "Keyboard off");
result.put("BTN_OK", "OK");
//MARK: ERRORS
result.put("ERROR_ENTER_ZIP", "Please enter the zip code of your city of residence.");
result.put("ERROR_ENTER_BIRTHDAY", "Please enter your date of birth.");
result.put("ERROR_ENTER_SAMPLEID", "Please enter an order number.");
result.put("ERROR_ENTER_PASSWORD", "Please enter your personal password.");
result.put("ERROR_ENTER_STRONG_PASSWORD", "The password must contain min. 8 characters, including min. 1 uppercase letter, 1 lowercase letter, 1 digit and 1 special character.");
result.put("ERROR_CONFIRM_PASSWORD", "The passwords do not match.");
result.put("ERROR_COULD_NOT_SAVE", "The data could not be written on the device. Please check if the permission to write data is allowed.");
result.put("ERROR_ENCRYPTION_NOT_SUPPORTED", "Unfortunately your device does not support encryption and cannot be used for our application.");
result.put("ERROR_SERVER_NOT_REACHABLE", "Unfortunately, currently the server is not accessible. Please try again later.");
result.put("ERROR_ENTER_VALID_ZIP", "Please enter a valid zip code.");
result.put("ERROR_ENTER_VALID_BIRTHDAY", "Please enter a valid date of birth.");
result.put("ERROR_ENTER_VALID_SAMPLEID", "Please enter a valid order number.");
result.put("ERROR_INVALID_RESPONSE", "The response from the server could not be validated. Please try again later.");
result.put("ERROR_KEYS_COULD_NOT_EXCHANGED", "The security key could not be exchanged with the server.");
result.put("ERROR_COULD_NOT_REGISTER_PGS", "Unfortunately, your request could not be registered for this job.");
result.put("ERROR_MAX_OPENED_REQUEST_LIMIT", "You have exceeded the maximum number of open requests allowed. (Max 10 open requests allowed).");
result.put("ERROR_ALREADY_SUBSCRIBTED", "The order number you entered has already been registered on another device. If the app has been newly installed, the problem may also occur. In this case, please contact support (see menu) to get your finding.");
result.put("ERROR_TOO_MANY_REQUESTS", "You have sent too many requests recently. Please wait and try again later.");
result.put("ERROR_INVALID_PASSWORD", "The password you entered is invalid.");
result.put("ERROR_DOWNLOAD_NOT_FOUND", "Sorry, the finding could not be downloaded. Please try again later.");
result.put("ERROR_COULD_NOT_DECRYPT", "Sorry, the finding could not be decrypted. Please try again later.");
result.put("ERROR_COULD_NOT_SAVE_ENCRYPTED", "The findings could not be saved.");
result.put("ERROR_ENCRYPTED_FILE_NOT_FOUND", "The findings file was not found on your device.");
result.put("ERROR_ENTER_OLD_PASSWORD", "Please enter the old password.");
result.put("ERROR_NOT_AUTHORIZED_TO_TAKE_OVER", "Unfortunately, the findings could not be transferred. Please contact our support.");
result.put("ERROR_SUPPORT_CODE_NEEDED", "Please contact our support to be able to adopt this finding.");
result.put("ERROR_ENTER_SUPPORT_CODE_PASSWORD", "Please enter a support code. If you have not received a support code yet, please contact our support for it.");
result.put("ERROR_ACCEPT_PRIVACY_POLICY", "Please accept the terms and conditions and privacy policy.");
result.put("ERROR_CAMERA_PERMISSION_DENIED", "Authorization for camera has been denied.");
result.put("ERROR_PUSH_PERMISSION_DENIED", "Permission for PUSH notifications has been denied.");
result.put("ERROR_RESULTS_COULD_NOT_DOWNLOADED", "Unable to download.");
result.put("ERROR_COULD_NOT_READ_QRCODE", "QR code could not be read.");
result.put("ERROR_COULD_NOT_READ_BARCODE", "Barcode could not be read.");
result.put("ERROR_BIOMETRICAL_AUTHENTIFICATION_COULD_NOT_ACTIVATED", "Biometric authentication could not be enabled.");
result.put("ERROR_ENTER_PIN", "Please enter a PIN.");
result.put("ERROR_ENTER_NEW_PIN", "Please enter a new PIN.");
result.put("ERROR_PIN_LENGTH", "PIN must consist of 5 digits.");
result.put("ERROR_ENTER_YOUR_PIN", "Please enter your PIN.");
result.put("ERROR_ENTER_YOUR_CURRENT_PASSWORD", "Please enter your current password.");
result.put("ERROR_INVALID_PASSWORD_RESET_PIN", "The PIN you entered is not valid.");
result.put("ERROR_COULD_NOT_GET_PIN", "PIN could not be received from the server.");
result.put("ERROR_COULD_NOT_CHANGE_PASSWORD", "Password could not be changed.");
result.put("ERROR_ACCEPT_CWA_POLICY", "We need your consent form to record the patient data.");
result.put("ERROR_COULD_NOT_SAVE_OEGD", "The patient data could not be saved.");
result.put("ERROR_ENTER_FIRSTNAME", "Please enter your first name.");
result.put("ERROR_ENTER_LASTNAME", "Please enter your last name.");
result.put("ERROR_ENTER_GENDER", "Please enter your gender.");
result.put("ERROR_ENTER_STREET", "Please enter the street.");
result.put("ERROR_ENTER_STREET_NUMBER", "Please enter the house no.");
result.put("ERROR_ENTER_CITY", "Please enter your city of residence.");
result.put("ERROR_YOUR_CURRENT_PASSWORD_IS_INVALID", "Sorry, your current password is not valid.");
result.put("ERROR_ENTER_EMAIL", "Please enter your email.");
result.put("ERROR_ENTER_TOPIC", "Please select a topic.");
result.put("ERROR_ENTER_TEXT", "Please enter the text.");
result.put("ERROR_ACCOUNT_COULD_NOT_DELETED", "Account could not be deleted. Please try again later.");
result.put("ERROR_SUPPORT_COULD_NOT_SENT", "Sorry, your request could not be sent. Please try again later.");
result.put("ERROR_PRIVACY_POLICY_NEEDS_CONNECTION", "To read and accept our privacy policy you must be connected to the Internet.");
//MARK: MESSAGES
result.put("MSG_PGS_ALREADY_EXISTS", "There are currently no findings. You will be notified via push message as soon as your findings are available.");
result.put("MSG_PGS_SUCCESSFULLY_CREATED", "Thank you, your request is now being processed. We will notify you of a new status on your finding. (Please note that the app needs permission to send you messages to do this.)");
result.put("MSG_DATA_REFRESHING", "Data is being updated...");
result.put("MSG_PGS_ALREADY_AVAILABLE", "Thank you. A status to your findings is already available.");
result.put("MSG_ENTER_OLD_PASSWORD", "Please enter the password from your old device.");
result.put("MSG_PGS_SUCCESSFULLY_OVER_TOOK", "The finding has been successfully transferred from your old device.");
result.put("MSG_YOU_ARE_NOT_REGISTERED", "You are not registered yet.");
result.put("MSG_PASSWORD_HAS_BEEN_CHANGED", "Your password has been successfully changed.");
result.put("MSG_SURE_WANT_DELETE", "Do you really want to delete the selected entry([ITEM]) ?");
result.put("MSG_SUPPORT_SUCCESSFULLY_SENT", "Thank you, your request has been sent successfully.");
result.put("MSG_ACCOUNT_SUCCESSFULLY_DELETED", "Your account has been successfully deleted.");
result.put("MSG_REQUESTED_RESULTS_NOT_FOUND", "No order could be found for the information you provided. Please check your information.");
result.put("MSG_REQUESTED_RESULTS_REJECTED", " Your findings could not be clearly assigned in the laboratory so far. Please check the information you have provided. If you still receive this result despite correct information, please contact support.");
result.put("MSG_PUSH_NOTIFICATION_EXPLAIN_TEXT", "So that you can be informed directly when your findings are available, it is important that this app can send you push messages.");
result.put("MSG_MAINTENANCE", "Currently, we are performing maintenance. Please note that our app is only available on a limited basis.");
result.put("MSG_CAMERA_PERMISSION_TITLE", "Befundapp wants to access your camera");
result.put("MSG_CAMERA_PERMISSION_MSG", "The camera is used to scan the lab's QR code.");
return result;
}
}

View File

@ -0,0 +1,108 @@
//
// Lang.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Lang;
import java.util.HashMap;
import java.util.Locale;
import de.labor_stein.befund.Core.Log;
public class Lang
{
public enum Languages { DE, EN }
private static String _locale = "de_DE";
private static HashMap<String, String> _dict = null;
/**
* Sets the language of application UI
* @param lang - lang that should be set
*/
public static void SetLanguage(Languages lang)
{
switch(lang)
{
case DE:
_dict = DE.GetDict();
_locale = "de_DE";
break;
case EN:
_dict = EN.GetDict();
_locale = "en_GB";
break;
}
}
/**
* Gets the translated word of ey
* @param key - key of word that should return translated value
* @return
*/
public static String Get(String key)
{
String result = key;
if(_dict != null)
{
String value = _dict.get(key);
if(value != null)
{
result = value;
}
}
return result;
}
/**
* Returns language locale
* @return returns string locale
*/
public static String GetLocale()
{
return _locale;
}
/**
* Returns lang depended on system language
* @return
*/
public static Languages GetSystemLang()
{
Languages result = Languages.EN;
try
{
String sysLang = Locale.getDefault().getLanguage();
if(sysLang != null && !sysLang.isEmpty())
{
sysLang = sysLang.toLowerCase();
switch (sysLang)
{
case "de":
result = Languages.DE;
break;
default:
result = Languages.EN;
break;
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.Lang", "GetSystemLang");
}
return result;
}
}

View File

@ -0,0 +1,99 @@
//
// Log.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core;
import android.content.Context;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
import de.labor_stein.befund.Core.Database.Logs;
import de.labor_stein.befund.Core.Models.Database.DbLog;
import de.labor_stein.befund.Core.Models.Response.Exception;
public class Log
{
private static Context CurrentContext = null;
private static Logs _dbLogs = null;
public enum LogTypes { CRITICAL, ERROR, INFO, LOG, DEBUG, WARNING }
public static void Initialize(Context context)
{
_dbLogs = new Logs(context);
}
public static void Critical(Exception err, String namespace, String method)
{
String message = "(" + namespace + "->" + method + "): " + err.message;
Write(message, LogTypes.CRITICAL);
}
public static void Critical(String msg, String namespace, String method)
{
String message = "(" + namespace + "->" + method + "): " + msg;
Write(message, LogTypes.CRITICAL);
}
public static void Error(Exception err, String namespace, String method)
{
String message = "(" + namespace + "->" + method + "): " + err.message;
Write(message, LogTypes.ERROR);
}
public static void Error(String msg, String namespace, String method)
{
String message = "(" + namespace + "->" + method + "): " + msg;
Write(message, LogTypes.ERROR);
}
public static void Info(String msg, String namespace, String method)
{
String message = "(" + namespace + "->" + method + "): " + msg;
Write(message, LogTypes.INFO);
}
public static void Debug(String msg, String namespace, String method)
{
String message = "(" + namespace + "->" + method + "): " + msg;
Write(message, LogTypes.DEBUG);
}
public static void Warning(String msg, String namespace, String method)
{
String message = "(" + namespace + "->" + method + "): " + msg;
Write(message, LogTypes.WARNING);
}
public static void Write(String message, LogTypes type)
{
try
{
Date now = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String msg = dateFormat.format(now) + " [" + type.name() + "]:" + message + "\r\n";
if(type == LogTypes.DEBUG)
{
java.lang.System.out.println(msg);
}
DbLog dbLog = new DbLog();
dbLog.guid = UUID.randomUUID().toString();
dbLog.message = msg;
dbLog.type = type.name();
_dbLogs.Create(dbLog);
}
catch (java.lang.Exception ex)
{
java.lang.System.out.println(ex.getLocalizedMessage());
}
}
}

View File

@ -0,0 +1,19 @@
//
// DbLog.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Database;
import java.util.Date;
public class DbLog
{
public int id = 0;
public String guid = null;
public String message = null;
public String type = null;
public Date created = null;
}

View File

@ -0,0 +1,350 @@
//
// Results.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Database;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import java.text.SimpleDateFormat;
import java.util.Date;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Request.Subscribe;
import de.labor_stein.befund.R;
public class Results
{
public enum DeviceTypes { NONE, IOS, ANDROID }
public enum ResultsStatus { NONE, CREATED, REJECTED, EXPIRED, COMPLETED, DELETED }
public String pgs = null;
public Boolean available = false;
public String available_ts = null;
public Boolean picked_up = false;
public String picked_up_ts = null;
public Boolean downloaded = false;
public String downloaded_ts = null;
public String downloaded_file = null;
public String server_public_key = null;
public String file_checksum = null;
public String status = null;
public String modified = null;
public String created = null;
/** Runtime flag not stored in the database **/
public Boolean downloading = false;
public ResultsStatus GetStatus()
{
switch(this.status)
{
case "CREATED": return ResultsStatus.CREATED;
case "REJECTED": return ResultsStatus.REJECTED;
case "EXPIRED": return ResultsStatus.EXPIRED;
case "COMPLETED": return ResultsStatus.COMPLETED;
case "DELETED": return ResultsStatus.DELETED;
default: return ResultsStatus.NONE;
}
}
public String GetStatusText()
{
String result = Lang.Get("LBL_PENDING");
if(this.available && this.GetStatus() == ResultsStatus.COMPLETED && this.downloaded)
{
result = Lang.Get("LBL_ALREADY_DOWNLOAD");
}
else if(this.available && this.GetStatus() == ResultsStatus.COMPLETED && !this.picked_up)
{
result = Lang.Get("LBL_READY_TO_DOWNLOAD");
}
else if(this.available && this.GetStatus() == ResultsStatus.COMPLETED && this.picked_up)
{
result = Lang.Get("LBL_ALREADY_DOWNLOAD");
}
else if(!this.available && this.GetStatus() == ResultsStatus.REJECTED)
{
result = Lang.Get("LBL_REJECTED");
}
else if(!this.available && this.GetStatus() == ResultsStatus.EXPIRED)
{
result = Lang.Get("LBL_EXPIRED");
}
return result;
}
public Drawable GetStatusIcon(Context context)
{
Drawable result = context.getDrawable(R.drawable.ic_opacity);
if(this.available && this.GetStatus() == ResultsStatus.COMPLETED && this.downloaded)
{
result = context.getDrawable(R.drawable.ic_picture_as_pdf);
}
else if(this.available && this.GetStatus() == ResultsStatus.COMPLETED && !this.picked_up)
{
result = context.getDrawable(R.drawable.ic_file_download);
}
else if(this.available && this.GetStatus() == ResultsStatus.COMPLETED && this.picked_up)
{
result = context.getDrawable(R.drawable.ic_picture_as_pdf);
}
else if(!this.available && this.GetStatus() == ResultsStatus.REJECTED)
{
result = context.getDrawable(R.drawable.ic_do_not_disturb_on);
}
else if(!this.available && this.GetStatus() == ResultsStatus.EXPIRED)
{
result = context.getDrawable(R.drawable.ic_av_timer);
}
return result;
}
public Color GetStatusColor()
{
Color result = Color.valueOf(192/255, 192/255, 192/255, 1);
if(this.available && this.GetStatus() == ResultsStatus.COMPLETED && this.downloaded)
{
result = Color.valueOf(250/255, 138/255, 47/255, 1);
}
else if(this.available && this.GetStatus() == ResultsStatus.COMPLETED && !this.picked_up)
{
result = Color.valueOf(101/255, 246/255, 107/255, 1);
}
else if(this.available && this.GetStatus() == ResultsStatus.COMPLETED && this.picked_up)
{
result = Color.valueOf(250/255, 138/255, 47/255, 1);
}
else if(!this.available && this.GetStatus() == ResultsStatus.REJECTED)
{
result = Color.valueOf(250/255, 46/255, 46/255, 1);
}
else if(!this.available && this.GetStatus() == ResultsStatus.EXPIRED)
{
result = Color.valueOf(250/255, 46/255, 46/255, 1);
}
return result;
}
public Date GetModified()
{
Date result = null;
try
{
if(this.modified != null && this.modified != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
result = dateFormat.parse(this.modified);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Database.Results", "GetModified");
}
return result;
}
public Date GetCreated()
{
Date result = null;
try
{
if(this.created != null && this.created != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
result = dateFormat.parse(this.created);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Database.Results", "GetCreated");
}
return result;
}
public Date GetAvailableTS()
{
Date result = null;
try
{
if(this.available_ts != null && this.available_ts != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
result = dateFormat.parse(this.available_ts);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Database.Results", "GetAvailableTS");
}
return result;
}
public Date GetPickedUpTS()
{
Date result = null;
try
{
if(this.picked_up_ts != null && this.picked_up_ts != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
result = dateFormat.parse(this.picked_up_ts);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Database.Results", "GetPickedUpTS");
}
return result;
}
public Date GetDownloadedTS()
{
Date result = null;
try
{
if(this.downloaded_ts != null && this.downloaded_ts != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
result = dateFormat.parse(this.downloaded_ts);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Database.Results", "GetDownloadedTS");
}
return result;
}
public String GetFormatedModifiedDate()
{
String result = null;
try
{
Date date = this.GetModified();
if(date != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
result = dateFormat.format(date);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Results", "GetFormatedModifiedDate");
}
return result;
}
public String GetFormatedCreatedDate()
{
String result = null;
try
{
Date date = this.GetCreated();
if(date != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
result = dateFormat.format(date);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Results", "GetFormatedCreatedDate");
}
return result;
}
public String GetFormatedAvailableTSDate()
{
String result = null;
try
{
Date date = this.GetAvailableTS();
if(date != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
result = dateFormat.format(date);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Results", "GetFormatedAvailableTSDate");
}
return result;
}
public String GetFormatedPickedUpTSDate()
{
String result = null;
try
{
Date date = this.GetPickedUpTS();
if(date != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
result = dateFormat.format(date);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Results", "GetFormatedPickedUpTSDate");
}
return result;
}
public String GetFormatedDownloadedTSDate()
{
String result = null;
try
{
Date date = this.GetDownloadedTS();
if(date != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
result = dateFormat.format(date);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Results", "GetFormatedDownloadedTSDate");
}
return result;
}
}

View File

@ -0,0 +1,122 @@
//
// Status.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Database;
import java.text.SimpleDateFormat;
import java.util.Date;
import de.labor_stein.befund.Core.Log;
public class Status
{
public String pgs = null;
public Boolean available = false;
public String available_ts = null;
public Boolean picked_up = false;
public String picked_up_ts = null;
public Boolean notified = false;
public String notified_ts = null;
public String results_status = Results.ResultsStatus.NONE.name();
public String results_message = null;
public String file_checksum = null;
public String created = null;
public Date GetAvailableTS()
{
Date result = null;
try
{
if(this.available_ts != null && this.available_ts != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
result = dateFormat.parse(this.available_ts);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Database.Status", "GetAvailableTS");
}
return result;
}
public Date GetPickedUpTS()
{
Date result = null;
try
{
if(this.picked_up_ts != null && this.picked_up_ts != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
result = dateFormat.parse(this.picked_up_ts);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Database.Status", "GetPickedUpTS");
}
return result;
}
public Date GetNotifiedTS()
{
Date result = null;
try
{
if(this.notified_ts != null && this.notified_ts != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
result = dateFormat.parse(this.notified_ts);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Database.Status", "GetNotifiedTS");
}
return result;
}
public Date GetCreated()
{
Date result = null;
try
{
if(this.created != null && this.created != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
result = dateFormat.parse(this.created);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Database.Status", "GetCreated");
}
return result;
}
public Results ToResults()
{
Results result = new Results();
result.pgs = this.pgs;
result.available = this.available;
result.available_ts = this.available_ts;
result.picked_up = this.picked_up;
result.picked_up_ts = this.picked_up_ts;
result.status = this.results_status;
result.file_checksum = this.file_checksum;
result.created = this.created;
return result;
}
}

View File

@ -0,0 +1,512 @@
//
// Labor.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 04.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models;
import java.util.ArrayList;
import java.util.List;
import de.labor_stein.befund.Core.Https.Servers;
import de.labor_stein.befund.R;
public class Labor
{
public String id;
public String name;
public String street;
public String city;
public String zip;
public String tel;
public String web;
public int logo;
public Servers host;
public boolean active = false;
/**
* Returns labor by id
*
* @param id - id of labor
* @return Labor object
*/
public static Labor GetLaborByName(String id)
{
Labor result = null;
List<Labor> labors = Labors();
for(int i = 0; i < labors.size(); i++)
{
Labor l = labors.get(i);
if(l.id.toLowerCase().equals(id.toLowerCase()))
{
result = l;
break;
}
}
return result;
}
/**
* Returns list of all available labors
*/
public static List<Labor> Labors()
{
List<Labor> result = new ArrayList<Labor>();
/** QRCode selektor : befund://labor?id=LABOR_HEIDELBERG **/
/** LIS Simulator **/
Labor lis_simulator = new Labor();
lis_simulator.id = "LIS_SIMULATOR";
lis_simulator.name = "LIS Simulator";
lis_simulator.street = "Teststr. 7";
lis_simulator.city = "Testort";
lis_simulator.zip = "77777";
lis_simulator.tel = "+49 77 123 456";
lis_simulator.web = "pba-simulator.patientenbefundapp.labor-limbach-hannover.de";
lis_simulator.logo = R.drawable.labor_hannover;
lis_simulator.host = Servers.LIS_SIMULATOR;
lis_simulator.active = true;
result.add(lis_simulator);
/** MVZ Labor Dr. Limbach & Kollegen GbR **/
Labor labor_heidelberg = new Labor();
labor_heidelberg.id = "LABOR_HEIDELBERG";
labor_heidelberg.name = "MVZ Labor Dr. Limbach & Kollegen GbR";
labor_heidelberg.street = "Im Breitspiel 16";
labor_heidelberg.city = "Heidelberg";
labor_heidelberg.zip = "69126";
labor_heidelberg.tel = "+49 6221 3432-0";
labor_heidelberg.web = "www.labor-limbach.de";
labor_heidelberg.logo = R.drawable.labor_heidelberg;
labor_heidelberg.host = Servers.LABOR_HEIDELBERG;
labor_heidelberg.active = true;
result.add(labor_heidelberg);
/** MVZ Labor Ludwigsburg GbR **/
Labor labor_ludwigsburg = new Labor();
labor_ludwigsburg.id = "LABOR_LUDWIGSBURG";
labor_ludwigsburg.name = "MVZ Labor Ludwigsburg GbR";
labor_ludwigsburg.street = "Wernerstraße 33";
labor_ludwigsburg.city = "Ludwigsburg";
labor_ludwigsburg.zip = "71636";
labor_ludwigsburg.tel = "+49 7141 966-0";
labor_ludwigsburg.web = "www.mvz-labor-lb.de";
labor_ludwigsburg.logo = R.drawable.labor_ludwigsburg;
labor_ludwigsburg.host = Servers.LABOR_LUDWIGSBURG;
labor_ludwigsburg.active = true;
result.add(labor_ludwigsburg);
/** MVZ Humangenetik Ulm **/
Labor labor_ulm = new Labor();
labor_ulm.id = "LABOR_ULM";
labor_ulm.name = "MVZ Humangenetik Ulm";
labor_ulm.street = "Karlstraße 31-33";
labor_ulm.city = "Ulm";
labor_ulm.zip = "89073";
labor_ulm.tel = "+49 731 850773-0";
labor_ulm.web = "www.humangenetik-ulm.de";
labor_ulm.logo = R.drawable.labor_ulm;
labor_ulm.host = Servers.LABOR_ULM;
labor_ulm.active = true;
result.add(labor_ulm);
/** MVZ Labor Limbach Aachen **/
Labor labor_aachen = new Labor();
labor_aachen.id = "LABOR_AACHEN";
labor_aachen.name = "MVZ Labor Limbach Aachen";
labor_aachen.street = "Karl-Carstens-Straße 19";
labor_aachen.city = "Würselen";
labor_aachen.zip = "52146";
labor_aachen.tel = "+49 2405 4891-0";
labor_aachen.web = "www.labor-aachen.de";
labor_aachen.logo = R.drawable.labor_aachen;
labor_aachen.host = Servers.LABOR_AACHEN;
labor_aachen.active = true;
result.add(labor_aachen);
/** MDI Limbach Berlin GmbH **/
Labor labor_berlin = new Labor();
labor_berlin.id = "LABOR_BERLIN";
labor_berlin.name = "MDI Limbach Berlin GmbH";
labor_berlin.street = "Aroser Allee 84";
labor_berlin.city = "Berlin";
labor_berlin.zip = "13407";
labor_berlin.tel = "+49 30 890645-0";
labor_berlin.web = "www.mdi-limbach-berlin.de";
labor_berlin.logo = R.drawable.labor_berlin;
labor_berlin.host = Servers.LABOR_BERLIN;
labor_berlin.active = true;
result.add(labor_berlin);
/** MVZ Gemeinschaftslabor Cottbus GbR **/
Labor labor_cottbus = new Labor();
labor_cottbus.id = "LABOR_COTTBUS";
labor_cottbus.name = "MVZ Gemeinschaftslabor Cottbus GbR";
labor_cottbus.street = "Uhlandstraße 53";
labor_cottbus.city = "Cottbus";
labor_cottbus.zip = "03050";
labor_cottbus.tel = "+49 355 58402-0";
labor_cottbus.web = "www.labor-cottbus.de";
labor_cottbus.logo = R.drawable.labor_cottbus;
labor_cottbus.host = Servers.LABOR_COTTBUS;
labor_cottbus.active = true;
result.add(labor_cottbus);
/** MVZ Medizinische Labore Dessau Kassel GmbH **/
Labor labor_dessau = new Labor();
labor_dessau.id = "LABOR_DESSAU";
labor_dessau.name = "MVZ Medizinische Labore Dessau Kassel GmbH";
labor_dessau.street = "Bauhüttenstraße 6";
labor_dessau.city = "Dessau";
labor_dessau.zip = "06847";
labor_dessau.tel = "+49 340 54053-0";
labor_dessau.web = "www.laborpraxis-dessau.de";
labor_dessau.logo = R.drawable.labor_dessau;
labor_dessau.host = Servers.LABOR_DESSAU;
labor_dessau.active = true;
result.add(labor_dessau);
/** MVZ Labor Dortmund Leopoldstraße GmbH **/
Labor labor_dortmund = new Labor();
labor_dortmund.id = "LABOR_DORTMUND";
labor_dortmund.name = "MVZ Labor Dortmund Leopoldstraße GmbH";
labor_dortmund.street = "Leopoldstraße 10";
labor_dortmund.city = "Dortmund";
labor_dortmund.zip = "44147";
labor_dortmund.tel = "+49 231 86027-0";
labor_dortmund.web = "www.labor-dortmund.de";
labor_dortmund.logo = R.drawable.labor_dortmund;
labor_dortmund.host = Servers.LABOR_DORTMUND;
labor_dortmund.active = true;
result.add(labor_dortmund);
/** MVZ Labor Limbach Dresden GbR **/
Labor labor_dresden = new Labor();
labor_dresden.id = "LABOR_DRESDEN";
labor_dresden.name = "MVZ Labor Limbach Dresden GbR";
labor_dresden.street = "Köhlerstraße 14 A";
labor_dresden.city = "Dresden";
labor_dresden.zip = "01239";
labor_dresden.tel = "+49 351 47049-0";
labor_dresden.web = "www.labordresden.de";
labor_dresden.logo = R.drawable.labor_dresden;
labor_dresden.host = Servers.LABOR_DRESDEN;
labor_dresden.active = true;
result.add(labor_dresden);
/** MVZ Labor Limbach Erfurt GmbH **/
Labor labor_erfurt = new Labor();
labor_erfurt.id = "LABOR_ERFURT";
labor_erfurt.name = "MVZ Labor Limbach Erfurt GmbH";
labor_erfurt.street = "Nordhäuser Straße 74";
labor_erfurt.city = "Erfurt";
labor_erfurt.zip = "99089";
labor_erfurt.tel = "+49 361 781-2701";
labor_erfurt.web = "www.labor-erfurt.de";
labor_erfurt.logo = R.drawable.labor_erfurt;
labor_erfurt.host = Servers.LABOR_ERFURT;
labor_erfurt.active = true;
result.add(labor_erfurt);
/** MVZ Labor Limbach Erfurt GmbH **/
Labor labor_essen = new Labor();
labor_essen.id = "LABOR_ESSEN";
labor_essen.name = "MVZ Labor Essen Nienkampstraße GmbH";
labor_essen.street = "Nienkampstraße 1";
labor_essen.city = "Essen";
labor_essen.zip = "45326";
labor_essen.tel = "+49 201 8379-0";
labor_essen.web = "www.labor-eveld.de";
labor_essen.logo = R.drawable.labor_essen;
labor_essen.host = Servers.LABOR_ESSEN;
labor_essen.active = true;
result.add(labor_essen);
/** MVZ Clotten Labor Dr. Haas, Dr. Raif & Kollegen GbR **/
Labor labor_freiburg = new Labor();
labor_freiburg.id = "LABOR_FREIBURG";
labor_freiburg.name = "MVZ Clotten Labor Dr. Haas, Dr. Raif & Kollegen GbR";
labor_freiburg.street = "Merzhauser Straße 112 a";
labor_freiburg.city = "Freiburg";
labor_freiburg.zip = "79100";
labor_freiburg.tel = "+49 761 31905-0";
labor_freiburg.web = "www.mvz-clotten.de";
labor_freiburg.logo = R.drawable.labor_freiburg;
labor_freiburg.host = Servers.LABOR_FREIBURG;
labor_freiburg.active = true;
result.add(labor_freiburg);
/** MVZ Labor Limbach Hannover GbR **/
Labor labor_hannover = new Labor();
labor_hannover.id = "LABOR_HANNOVER";
labor_hannover.name = "MVZ Labor Limbach Hannover GbR";
labor_hannover.street = "Auf den Pohläckern 12";
labor_hannover.city = "Lehrte";
labor_hannover.zip = "31275";
labor_hannover.tel = "+49 5132 8695-0";
labor_hannover.web = "www.labor-limbach-hannover.de";
labor_hannover.logo = R.drawable.labor_hannover;
labor_hannover.host = Servers.LABOR_HANNOVER;
labor_hannover.active = true;
result.add(labor_hannover);
/** MVZ Medizinisches Labor Main-Taunus GbR **/
Labor labor_hofheim = new Labor();
labor_hofheim.id = "LABOR_HOFHEIM";
labor_hofheim.name = "MVZ Medizinisches Labor Main-Taunus GbR";
labor_hofheim.street = "Hofheimer Straße 71";
labor_hofheim.city = "Hofheim";
labor_hofheim.zip = "65719";
labor_hofheim.tel = "+49 6192 9924-0";
labor_hofheim.web = "www.labor-hofheim.de";
labor_hofheim.logo = R.drawable.labor_hofheim;
labor_hofheim.host = Servers.LABOR_HOFHEIM;
labor_hofheim.active = true;
result.add(labor_hofheim);
/** MVZ Labor PD Dr. Volkmann und Kollegen GbR **/
Labor labor_karlsruhe = new Labor();
labor_karlsruhe.id = "LABOR_KARLSRUHE";
labor_karlsruhe.name = "MVZ Labor PD Dr. Volkmann und Kollegen GbR";
labor_karlsruhe.street = "Gerwigstraße 67";
labor_karlsruhe.city = "Karlsruhe";
labor_karlsruhe.zip = "76131";
labor_karlsruhe.tel = "+49 721 85000-0";
labor_karlsruhe.web = "www.laborvolkmann.de";
labor_karlsruhe.logo = R.drawable.labor_karlsruhe;
labor_karlsruhe.host = Servers.LABOR_KARLSRUHE;
labor_karlsruhe.active = true;
result.add(labor_karlsruhe);
/** MVZ Labor Dr. Reising-Ackermann und Kollegen GbR **/
Labor labor_leipzig = new Labor();
labor_leipzig.id = "LABOR_LEIPZIG";
labor_leipzig.name = "MVZ Labor Dr. Reising-Ackermann und Kollegen GbR";
labor_leipzig.street = "Strümpellstraße 40";
labor_leipzig.city = "Leipzig";
labor_leipzig.zip = "04289";
labor_leipzig.tel = "+49 341 6565-100";
labor_leipzig.web = "www.labor-leipzig.de";
labor_leipzig.logo = R.drawable.labor_leipzig;
labor_leipzig.host = Servers.LABOR_LEIPZIG;
labor_leipzig.active = true;
result.add(labor_leipzig);
/** MVZ Dr. Stein + Kollegen GbR **/
Labor labor_moenchengladbach = new Labor();
labor_moenchengladbach.id = "LABOR_MOENCHENGLADBACH";
labor_moenchengladbach.name = "MVZ Dr. Stein + Kollegen GbR";
labor_moenchengladbach.street = "Tomphecke 45";
labor_moenchengladbach.city = "Mönchengladbach";
labor_moenchengladbach.zip = "41169";
labor_moenchengladbach.tel = "+49 2161 8194-0";
labor_moenchengladbach.web = "www.labor-stein.de";
labor_moenchengladbach.logo = R.drawable.labor_moenchengladbach;
labor_moenchengladbach.host = Servers.LABOR_MOENCHENGLADBACH;
labor_moenchengladbach.active = true;
result.add(labor_moenchengladbach);
/** MVZ Labor Limbach München GmbH **/
Labor labor_muenchen = new Labor();
labor_muenchen.id = "LABOR_MUENCHEN";
labor_muenchen.name = "MVZ Labor Limbach München GmbH";
labor_muenchen.street = "Richard-Strauss-Straße 80 82";
labor_muenchen.city = "München";
labor_muenchen.zip = "81679";
labor_muenchen.tel = "+49 89 9992970-0";
labor_muenchen.web = "www.labor-limbach-muenchen.de";
labor_muenchen.logo = R.drawable.labor_muenchen;
labor_muenchen.host = Servers.LABOR_MUENCHEN;
labor_muenchen.active = true;
result.add(labor_muenchen);
/** MVZ Labor Münster Hafenweg GmbH **/
Labor labor_muenster = new Labor();
labor_muenster.id = "LABOR_MUENSTER";
labor_muenster.name = "MVZ Labor Münster Hafenweg GmbH";
labor_muenster.street = "Hafenweg 9 11";
labor_muenster.city = "Münster";
labor_muenster.zip = "48155";
labor_muenster.tel = "+49 251 60916-0";
labor_muenster.web = "www.labor-muenster.de";
labor_muenster.logo = R.drawable.labor_muenster;
labor_muenster.host = Servers.LABOR_MUENSTER;
labor_muenster.active = true;
result.add(labor_muenster);
/** MVZ Labor Limbach Nürnberg GmbH **/
Labor labor_nuernberg = new Labor();
labor_nuernberg.id = "LABOR_NUERBERG";
labor_nuernberg.name = "MVZ Labor Limbach Nürnberg GmbH";
labor_nuernberg.street = "Handwerkerweg 1";
labor_nuernberg.city = "Wendelstein";
labor_nuernberg.zip = "90530";
labor_nuernberg.tel = "+49 9129 90570-0";
labor_nuernberg.web = "www.labor-limbach-nuernberg.de";
labor_nuernberg.logo = R.drawable.labor_nuernberg;
labor_nuernberg.host = Servers.LABOR_NUERBERG;
labor_nuernberg.active = true;
result.add(labor_nuernberg);
/** MVZ Labor Passau GbR **/
Labor labor_passau = new Labor();
labor_passau.id = "LABOR_PASSAU";
labor_passau.name = "MVZ Labor Passau GbR";
labor_passau.street = "Wörth 15";
labor_passau.city = "Passau";
labor_passau.zip = "94034";
labor_passau.tel = "+49 851 9593-00";
labor_passau.web = "www.labor-passau.de";
labor_passau.logo = R.drawable.labor_passau;
labor_passau.host = Servers.LABOR_PASSAU;
labor_passau.active = true;
result.add(labor_passau);
/** MVZ Labor Ravensburg GbR **/
Labor labor_ravensburg = new Labor();
labor_ravensburg.id = "LABOR_RAVENSBURG";
labor_ravensburg.name = "MVZ Labor Ravensburg GbR";
labor_ravensburg.street = "Elisabethenstraße 11";
labor_ravensburg.city = "Ravensburg";
labor_ravensburg.zip = "88212";
labor_ravensburg.tel = "+49 751 502-0";
labor_ravensburg.web = "www.labor-gaertner.de";
labor_ravensburg.logo = R.drawable.labor_ravensburg;
labor_ravensburg.host = Servers.LABOR_RAVENSBURG;
labor_ravensburg.active = true;
result.add(labor_ravensburg);
/** Medizinisches Labor Rosenheim MVZ GbR **/
Labor labor_rosenheim = new Labor();
labor_rosenheim.id = "LABOR_ROSENHEIM";
labor_rosenheim.name = "Medizinisches Labor Rosenheim MVZ GbR";
labor_rosenheim.street = "Brückenstraße 1";
labor_rosenheim.city = "Rosenheim";
labor_rosenheim.zip = "83022";
labor_rosenheim.tel = "+49 8031 8005-0";
labor_rosenheim.web = "www.medlabor.de";
labor_rosenheim.logo = R.drawable.labor_rosenheim;
labor_rosenheim.host = Servers.LABOR_ROSENHEIM;
labor_rosenheim.active = true;
result.add(labor_rosenheim);
/** MVZ Labor Schweinfurt GmbH **/
Labor labor_schweinfurt = new Labor();
labor_schweinfurt.id = "LABOR_SCHWEINFURT";
labor_schweinfurt.name = "MVZ Labor Schweinfurt GmbH";
labor_schweinfurt.street = "Gustav-Adolf-Straße 8";
labor_schweinfurt.city = "Schweinfurt";
labor_schweinfurt.zip = "97422";
labor_schweinfurt.tel = "+49 9721 533320";
labor_schweinfurt.web = "www.laboraerzte-schweinfurt.de";
labor_schweinfurt.logo = R.drawable.labor_schweinfurt;
labor_schweinfurt.host = Servers.LABOR_SCHWEINFURT;
labor_schweinfurt.active = true;
result.add(labor_schweinfurt);
/** Labor MVZ Westmecklenburg GbR **/
Labor labor_schwerin = new Labor();
labor_schwerin.id = "LABOR_SCHWERIN";
labor_schwerin.name = "Labor MVZ Westmecklenburg GbR";
labor_schwerin.street = "Ellerried 5 7";
labor_schwerin.city = "Schwerin";
labor_schwerin.zip = "19061";
labor_schwerin.tel = "+49 385 64424-0";
labor_schwerin.web = "www.labor-schwerin.de";
labor_schwerin.logo = R.drawable.labor_schwerin;
labor_schwerin.host = Servers.LABOR_SCHWERIN;
labor_schwerin.active = true;
result.add(labor_schwerin);
/** MVZ Labor Limbach Vorpommern-Rügen GmbH **/
Labor labor_stralsrund = new Labor();
labor_stralsrund.id = "LABOR_STRALSUND";
labor_stralsrund.name = "MVZ Labor Limbach Vorpommern-Rügen GmbH";
labor_stralsrund.street = "Große-Parower-Straße 47-53";
labor_stralsrund.city = "Stralsund";
labor_stralsrund.zip = "18435";
labor_stralsrund.tel = "+49 3831 668770";
labor_stralsrund.web = "www.labor-stralsund.de";
labor_stralsrund.logo = R.drawable.labor_stralsrund;
labor_stralsrund.host = Servers.LABOR_STRALSUND;
labor_stralsrund.active = true;
result.add(labor_stralsrund);
/** MVZ Gemeinschaftslabor Suhl Dr. Siegmund & Kollegen GbR **/
Labor labor_suhl = new Labor();
labor_suhl.id = "LABOR_SUHL";
labor_suhl.name = "MVZ Gemeinschaftslabor Suhl Dr. Siegmund & Kollegen GbR";
labor_suhl.street = "Albert-Schweitzer-Straße 4";
labor_suhl.city = "Suhl";
labor_suhl.zip = "98527";
labor_suhl.tel = "+49 3681 39860";
labor_suhl.web = "www.labor-suhl.de";
labor_suhl.logo = R.drawable.labor_suhl;
labor_suhl.host = Servers.LABOR_SUHL;
labor_suhl.active = true;
result.add(labor_suhl);
/** MVZ Medizinische Labore Dessau Kassel GmbH **/
Labor labor_kassel = new Labor();
labor_kassel.id = "LABOR_KASSEL";
labor_kassel.name = "MVZ Medizinische Labore Dessau Kassel GmbH";
labor_kassel.street = "Marburger Straße 85";
labor_kassel.city = "Kassel";
labor_kassel.zip = "34127";
labor_kassel.logo = R.drawable.labor_kassel;
labor_kassel.host = Servers.LABOR_KASSEL;
labor_kassel.active = true;
result.add(labor_kassel);
/** MVZ Medizinisches Labor Hannover **/
Labor labor_hannover_mlh = new Labor();
labor_hannover_mlh.id = "LABOR_HANNOVER_MLM";
labor_hannover_mlh.name = "MVZ Medizinisches Labor Hannover";
labor_hannover_mlh.street = "Am TÜV 6";
labor_hannover_mlh.city = "Hannover";
labor_hannover_mlh.zip = "30519";
labor_hannover_mlh.tel = "+49 511 85622-0";
labor_hannover_mlh.web = "www.mlh.de";
labor_hannover_mlh.logo = R.drawable.labor_hannover_mlh;
labor_hannover_mlh.host = Servers.LABOR_HANNOVER_MLM;
labor_hannover_mlh.active = true;
result.add(labor_hannover_mlh);
/** Medizinische Genetik Mainz **/
Labor labor_mainz = new Labor();
labor_mainz.id = "LABOR_MAINZ";
labor_mainz.name = "Medizinische Genetik Mainz";
labor_mainz.street = "Haifa-Allee 38";
labor_mainz.city = "Mainz";
labor_mainz.zip = "55128";
labor_mainz.tel = "+49 6131 27661-0";
labor_mainz.web = "www.medgen-mainz.de";
labor_mainz.logo = R.drawable.labor_mainz;
labor_mainz.host = Servers.LABOR_MAINZ;
labor_mainz.active = true;
result.add(labor_mainz);
/** Laborarztpraxis Rhein-Main MVZ GbR **/
Labor labor_frankfurt = new Labor();
labor_frankfurt.id = "LABOR_FRANKFURT";
labor_frankfurt.name = "Laborarztpraxis Rhein-Main MVZ GbR";
labor_frankfurt.street = "Berner Straße 117";
labor_frankfurt.city = "Frankfurt";
labor_frankfurt.zip = "60437";
labor_frankfurt.tel = "+49 69 669003-900";
labor_frankfurt.web = "www.laborarztpraxis.de";
labor_frankfurt.logo = R.drawable.labor_frankfurt;
labor_frankfurt.host = Servers.LABOR_FRANKFURT;
labor_frankfurt.active = true;
result.add(labor_frankfurt);
return result;
}
}

View File

@ -0,0 +1,90 @@
//
// OEGD.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 05.07.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models;
import java.text.SimpleDateFormat;
import java.util.Date;
import de.labor_stein.befund.Core.Log;
public class OEGD
{
public String last_name;
public String first_name;
public String birthdate;
public String gender;
public String title;
public String name_addition;
public String prefix;
public Address address;
public boolean cwa_consent_flag;
public String phone;
public static class Address
{
public String zip_code;
public String city;
public String street_number;
public String country_code;
public static Address createInstance()
{
return new Address();
}
}
/**
* Returns Birthday from settings
* @return returns Date
*/
public Date GetBirthday()
{
Date result = null;
try
{
if(this.birthdate != null && this.birthdate != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
result = dateFormat.parse(this.birthdate);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.OEGD", "GetBirthday");
}
return result;
}
/**
* Returns Birthday as string from settings
* @return returns string
*/
public String GetFormatedBirthday()
{
String result = null;
try
{
Date date = this.GetBirthday();
if(date != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
result = dateFormat.format(date);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.OEGD", "GetFormatedBirthday");
}
return result;
}
}

View File

@ -0,0 +1,14 @@
//
// OEGDFile.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 07.07.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models;
public class OEGDFile
{
public OEGD OEGD;
public String filename;
}

View File

@ -0,0 +1,16 @@
//
// ChangeVerificatorHash.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 06.07.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Request;
public class ChangeVerificatorHash
{
public String udid;
public String old_verificator_hash;
public String new_verificator_hash;
public String pin;
}

View File

@ -0,0 +1,19 @@
//
// CheckFileChecksum.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Request;
public class CheckFileChecksum
{
public String pgs = null;
public String udid = null;
public String device_token = null;
public int device_type = 2;
public String client_public_key = null;
public String verificator_hash = null;
public String file_checksum = null;
}

View File

@ -0,0 +1,15 @@
//
// DeviceToken.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 30.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Request;
public class DeviceToken
{
public String udid = null;
public String verificator_hash = null;
public String device_token = null;
}

View File

@ -0,0 +1,74 @@
//
// EncryptedRequest.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Request;
import com.google.gson.Gson;
import java.nio.charset.StandardCharsets;
import javax.crypto.SecretKey;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Base64;
import de.labor_stein.befund.Core.Security.Ed25519;
import de.labor_stein.befund.Core.Security.SHA512;
public class EncryptedRequest
{
public String descriptor = null;
public String encrypted_content = null;
public String hmac = null;
/**
* Constructor for EncryptedRequest
* @param descriptor - descriptor of the content object
* @param contentObject - content object that should be encrypted
* @param deriveKey - shared deriveKey that should be used in the encrption
*/
public EncryptedRequest(String descriptor, Object contentObject, byte[] deriveKey)
{
String encrypted_content = null;
if(contentObject != null)
{
encrypted_content = new Gson().toJson(contentObject);
}
this.Encrypt(descriptor, encrypted_content, deriveKey);
}
/**
* Encrypts the content of request with derive key
*
* @param descriptor - descriptor of object
* @param encrypted_content - content that should be encrypted
* @param deriveKey - derive key that should be used for the encryption
*/
public void Encrypt(String descriptor, String encrypted_content, byte[] deriveKey)
{
if(descriptor != null && deriveKey != null)
{
this.descriptor = AES.Encrypt(descriptor, deriveKey);
if(encrypted_content != null)
{
this.encrypted_content = AES.Encrypt(encrypted_content, deriveKey);
if(this.encrypted_content != null)
{
this.hmac = SHA512.HMAC(this.encrypted_content, deriveKey);
}
}
else
{
this.hmac = SHA512.HMAC(this.descriptor, deriveKey);
}
}
}
}

View File

@ -0,0 +1,14 @@
//
// GetOpened.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 30.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Request;
public class GetOpened
{
public String udid = null;
public String verificator_hash = null;
}

View File

@ -0,0 +1,14 @@
//
// GetPIN.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 06.07.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Request;
public class GetPIN
{
public String udid = null;
public String verificator_hash = null;
}

View File

@ -0,0 +1,13 @@
//
// KeyExchange.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Request;
public class KeyExchange
{
public String key_type = "PublicKey";
}

View File

@ -0,0 +1,29 @@
//
// Subscribe.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Request;
import de.labor_stein.befund.Core.Models.Database.Results;
public class Subscribe
{
public String pgs = null;
public String pgs_hash = null;
public String udid = null;
public String device_token = null;
public int device_type = 2;
public String client_public_key = null;
public String verificator_hash = null;
public String pin = null;
public Results ToResults()
{
Results result = new Results();
result.pgs = this.pgs;
result.status = Results.ResultsStatus.NONE.name();
return result;
}
}

View File

@ -0,0 +1,18 @@
//
// Support.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 11.07.2022
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Request;
public class Support
{
public String udid = null;
public String verificator_hash = null;
public String email;
public String topic;
public String text;
public boolean delete_device;
}

View File

@ -0,0 +1,14 @@
//
// Download.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Response;
public class Download
{
public String encrypted_content = null;
public String server_public_key = null;
}

View File

@ -0,0 +1,157 @@
//
// EncryptedResponse.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 25.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Response;
import com.google.gson.Gson;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Database.Status;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Base64;
import de.labor_stein.befund.Core.Security.Ed25519;
import de.labor_stein.befund.Core.Security.SHA512;
public class EncryptedResponse
{
public String descriptor = null;
public String encrypted_content = null;
public String hmac = null;
/**
* Decrypts the encrypted content
*
* @param deriveKey - shared deriveKey for the decryption
* @return returns decrypted object
*/
public Object Decrypt(byte[] deriveKey, Class objClass)
{
Object result = null;
try
{
if (deriveKey != null && deriveKey.length > 0 && this.descriptor != null && !this.descriptor.isEmpty())
{
this.descriptor = AES.Decrypt(this.descriptor, deriveKey);
if (this.encrypted_content != null && !this.encrypted_content.isEmpty())
{
String json = AES.Decrypt(this.encrypted_content, deriveKey);
if (json != null && !json.isEmpty())
{
result = new Gson().fromJson(json, objClass);
}
}
}
}
catch (java.lang.Exception ex)
{
Log.Error(ex.getMessage(), "Core.Models.Response.EncryptedResponse", "Decrypt(byte[], Class)");
}
return result;
}
/**
* Decrypts the encrypted content yb descriptor
*
* @param deriveKey - shared deriveKey for the decryption
* @return returns decrypted object
*/
public Object Decrypt(byte[] deriveKey)
{
Object result = null;
try
{
if (deriveKey != null && deriveKey.length > 0 && this.descriptor != null && !this.descriptor.isEmpty())
{
this.descriptor = AES.Decrypt(this.descriptor, deriveKey);
if (this.encrypted_content != null && !this.encrypted_content.isEmpty())
{
String json = AES.Decrypt(this.encrypted_content, deriveKey);
if (json != null && !json.isEmpty())
{
switch (this.descriptor.toLowerCase())
{
case "success":
result = new Gson().fromJson(json, Success.class);
break;
case "responseexception":
result = new Gson().fromJson(json, Exception.class);
break;
case "list<status>":
result = Arrays.asList(new Gson().fromJson(json, Status[].class));
break;
case "download":
result = new Gson().fromJson(json, Download.class);
break;
case "pin":
result = new Gson().fromJson(json, PIN.class);
break;
}
}
}
}
}
catch (java.lang.Exception ex)
{
Log.Error(ex.getMessage(), "Core.Models.Response.EncryptedResponse", "Decrypt(byte[])");
}
return result;
}
/**
* Validates the encrypted response by HMAC and Ed25519
*
* @param deriveKey - shared derive key, that should be used for the HMAC Authentification
* @param serverSignature - server signature, that should be verified
* @param serverSignatureKey - server public signature key, that was used in client signature
* @return returns true if request is valid
*/
public boolean ValidSignature(byte[] deriveKey, String serverSignature, String serverSignatureKey)
{
if (this.encrypted_content != null && !this.encrypted_content.isEmpty())
{
return
// Validate over HMAC
(this.hmac != null && !this.hmac.isEmpty() &&
deriveKey != null &&
deriveKey.length > 0 &&
SHA512.isValidAuthenticationCode(hmac, this.encrypted_content, deriveKey)) &&
//Validate over Ed25519
(serverSignature != null && !serverSignature.isEmpty() &&
Ed25519.CheckValid(Base64.FromBase64String(serverSignature), this.encrypted_content.getBytes(StandardCharsets.UTF_8), Base64.FromBase64String(serverSignatureKey)));
}
else
{
return
// Validate over HMAC
(this.hmac != null && !this.hmac.isEmpty() &&
deriveKey != null &&
deriveKey.length > 0 &&
SHA512.isValidAuthenticationCode(hmac, this.descriptor, deriveKey)) &&
//Validate over Ed25519
(serverSignature != null && !serverSignature.isEmpty() &&
Ed25519.CheckValid(Base64.FromBase64String(serverSignature), this.descriptor.getBytes(StandardCharsets.UTF_8), Base64.FromBase64String(serverSignatureKey)));
}
}
}

View File

@ -0,0 +1,30 @@
//
// Exception.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Response;
public class Exception
{
public String response_type;
public int error_type = Types.NONE;
public String message;
public static class Types
{
public static final int NONE = 0;
public static final int InvalidClient = 1000;
public static final int InvalidRequest= 1001;
public static final int MissingArgument = 1002;
public static final int InvalidArgument = 1003;
public static final int Unknown = 1004;
public static final int AlreadySubscribted = 1005;
public static final int NotAuthorized = 1007;
public static final int MaxOpenedRequestLimit = 1008;
public static final int NotAvailable = 1009;
public static final int WrongFileChecksum = 1010;
}
}

View File

@ -0,0 +1,13 @@
//
// PIN.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 06.07.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Response;
public class PIN
{
public String code = null;
}

View File

@ -0,0 +1,13 @@
//
// PublicKey.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Response;
public class PublicKey
{
public String key = null;
}

View File

@ -0,0 +1,13 @@
//
// Success.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.Response;
public class Success
{
public String message = null;
}

View File

@ -0,0 +1,29 @@
//
// Session.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 05.07.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models;
import de.labor_stein.befund.Core.Models.System.Device;
public class Session
{
public static Boolean NotificationGranted = false;
public static Boolean CameraGranted = false;
public static Device Device = null;
public static String DevicePassword = null;
public static boolean Maintenance = false;
public static boolean MaintenanceNotified = false;
/**
* Checks if user has been logged in by password/biomedical authentication
* @return returns true if successfully
*/
public static boolean IsLoggedIn()
{
return (Session.DevicePassword != null && !Session.DevicePassword.isEmpty());
}
}

View File

@ -0,0 +1,307 @@
//
// Settings.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 05.07.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
import de.labor_stein.befund.Core.Https.Servers;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
public class Settings
{
// Change this variable to enforce Privacy Policy Popup on update to this version
public static String PrivacyPolicyAcceptedKey = "privacy_policy_accepted_2";
public String public_key = null;
public String hashed_private_key = null;
public String verificator_hash = null;
public String password_hash = null;
public String password_reset_hash = null;
public String zip = null;
public String birthday = null;
public String udid = null;
public Lang.Languages lang = Lang.Languages.DE;
public Labor labor = null;
private String privacy_policy_url_de = "https://www.limbachgruppe.com/fileadmin/downloads/pba-datenschutz.html";
private String faq_url_de = "https://www.limbachgruppe.com/fileadmin/downloads/098672600.html";
private String privacy_policy_url_en = "https://www.limbachgruppe.com/fileadmin/downloads/pba-data-protection.html";
private String faq_url_en = "https://www.limbachgruppe.com/fileadmin/downloads/098235490.html";
public boolean PushNotificationExplained = false;
public boolean PushNotificationAccepted = false;
public boolean PrivacyPolicyAccepted = false;
/**
* Loads settings from the file
* @param context - Current context, that using the settings
* @return returns settings object
*/
public static Settings load(Context context)
{
Settings result = null;
try
{
if(context != null)
{
Activity CurrentActivity = (Activity)context;
SharedPreferences dic = CurrentActivity.getSharedPreferences("befund_pref", Context.MODE_PRIVATE);
if(dic != null)
{
result = new Settings();
result.public_key = dic.getString("public_key", null);
result.hashed_private_key = dic.getString("hashed_private_key", null);
result.verificator_hash = dic.getString("verificator_hash", null);
result.password_hash = dic.getString("password_hash", null);
result.password_reset_hash = dic.getString("password_reset_hash", null);
result.zip = dic.getString("zip", null);
result.birthday = dic.getString("birthday", null);
result.udid = dic.getString("udid", null);
result.lang = Lang.Languages.valueOf(dic.getString("lang", Lang.Languages.DE.name()));
result.PushNotificationExplained = dic.getBoolean("push_explained", false);
result.PushNotificationAccepted = dic.getBoolean("push_accepted", false);
result.PrivacyPolicyAccepted = dic.getBoolean(PrivacyPolicyAcceptedKey, false);
String labor_id = dic.getString("labor", null);
if(labor_id != null && !labor_id.isEmpty())
{
result.labor = Labor.GetLaborByName(labor_id);
/** REMOVE FOR PRODUCTIVE **/
//result.labor.host = Servers.DEVELOPMENT;
}
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Settings", "load(Context)");
}
return result;
}
/**
* Saves settings to the file
* @param context - current context, that using the settings
* @return returns true if successfully saved
*/
public boolean save(Context context)
{
boolean result = false;
try
{
if(context != null)
{
Activity CurrentActivity = (Activity)context;
SharedPreferences sharedPref = CurrentActivity.getSharedPreferences("befund_pref", Context.MODE_PRIVATE);
if(sharedPref != null)
{
/** generates a new udid **/
if(this.udid == null)
{
this.udid = android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID) + "_" + UUID.randomUUID().toString();
}
SharedPreferences.Editor dic = sharedPref.edit();
dic.putString("public_key", this.public_key);
dic.putString("hashed_private_key", this.hashed_private_key);
dic.putString("verificator_hash", this.verificator_hash);
dic.putString("password_hash", this.password_hash);
dic.putString("password_reset_hash", this.password_reset_hash);
dic.putString("zip", this.zip);
dic.putString("birthday", this.birthday);
dic.putString("udid", this.udid);
dic.putString("lang", this.lang.name());
if(this.labor != null)
{
dic.putString("labor", this.labor.id);
}
dic.putBoolean("push_explained", this.PushNotificationExplained);
dic.putBoolean("push_accepted", this.PushNotificationAccepted);
dic.putBoolean(PrivacyPolicyAcceptedKey, this.PrivacyPolicyAccepted);
dic.commit();
result = (CurrentActivity.getSharedPreferences("befund_pref", Context.MODE_PRIVATE) != null);
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Settings", "save(Context)");
}
return result;
}
/**
* delete settings
*
* @param context - current context, that using the settings
* @return returns true if successfully saved
*/
public boolean delete(Context context)
{
boolean result = false;
try
{
if(context != null)
{
Activity CurrentActivity = (Activity)context;
SharedPreferences sharedPref = CurrentActivity.getSharedPreferences("befund_pref", Context.MODE_PRIVATE);
if(sharedPref != null)
{
SharedPreferences.Editor dic = sharedPref.edit();
dic.remove("udid");
dic.remove("public_key");
dic.remove("hashed_private_key");
dic.remove("verificator_hash");
dic.remove("password_hash");
dic.remove("password_reset_hash");
dic.remove("zip");
dic.remove("birthday");
dic.remove("udid");
dic.remove("lang");
dic.remove("labor");
dic.commit();
result = (CurrentActivity.getSharedPreferences("befund_pref", Context.MODE_PRIVATE) != null);
}
}
}
catch(Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Settings", "delete(Context)");
}
return result;
}
/**
* Returns Birthday from settings
* @return returns Date
*/
public Date GetBirthday()
{
Date result = null;
try
{
if(this.birthday != null && this.birthday != "")
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
result = dateFormat.parse(this.birthday);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Settings", "GetBirthday");
}
return result;
}
/**
* Returns Birthday as string from settings
* @return returns string
*/
public String GetFormatedBirthday()
{
String result = null;
try
{
Date date = this.GetBirthday();
if(date != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
result = dateFormat.format(date);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Settings", "GetFormatedBirthday");
}
return result;
}
/**
* Sets birthday to the settings
* @param date - date that should be set to the settings
*/
public void SetBirthday(Date date)
{
String result = null;
try
{
if(date != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
this.birthday = dateFormat.format(date);
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), " de.labor_stein.befund.Core.Models.Settings", "SetBirthday(Date)");
}
}
/**
* Gets privacy policy URL depended on lang
*/
public String GetPrivacyPolicyURL()
{
switch (this.lang)
{
case DE:
return this.privacy_policy_url_de;
default:
return this.privacy_policy_url_en;
}
}
/**
* Gets FAQ URL depended on lang
*/
public String GetFAQURL()
{
switch (this.lang)
{
case DE:
return this.faq_url_de;
default:
return this.faq_url_en;
}
}
}

View File

@ -0,0 +1,18 @@
//
// Device.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.System;
public class Device
{
public String udid = null;
public String name = null;
public String model = null;
public String manufacturer = null;
public String os = null;
public String token = null;
}

View File

@ -0,0 +1,27 @@
//
// StorageInfo.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Models.System;
public class StorageInfo
{
public Double total = 0.0;
public Double free = 0.0;
public Double used = 0.0;
public Double GetStoragePercent()
{
if(this.free > 0.0 && this.total > 0.0)
{
return (this.free / this.total);
}
else
{
return 0.0;
}
}
}

View File

@ -0,0 +1,153 @@
//
// AES.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Security;
import java.io.ByteArrayInputStream;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import de.labor_stein.befund.Core.Log;
public class AES
{
private static final int MAX_NONCE_SIZE = 12;
private static final int MAX_TAG_SIZE = 16;
public static final String PGS_ENCRYPT_PARTIAL_KEY = "wA6j@x.CcmM>~5Ss^C_!#,zch)$YsDsd59,::>dW#F`@U]Ye5ETZcMT7}&+#*!%z";
/**
* Encrypts string with key
*
* @param value - string value that should be encrypted
* @param deriveKey - shared deriveKey that should be used for encryption(max. 32 bytes)
* @return - returns encrypted base64 string
*/
public static String Encrypt(String value, byte[] deriveKey)
{
String result = null;
try
{
if(value != null && deriveKey != null)
{
byte[] nonce = new byte[MAX_NONCE_SIZE];
new SecureRandom().nextBytes(nonce);
byte[] tag = new byte[MAX_TAG_SIZE];
new SecureRandom().nextBytes(tag);
byte[] plainText = value.getBytes(StandardCharsets.UTF_8);
GCMParameterSpec gcmSpec = new GCMParameterSpec(MAX_TAG_SIZE * 8, nonce);
SecretKey key = new SecretKeySpec(deriveKey, "AES");
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, key, gcmSpec);
byte[] chiperText = cipher.doFinal(plainText);
ByteBuffer byteBuffer = ByteBuffer.allocate(nonce.length + chiperText.length);
byteBuffer.put(nonce);
byteBuffer.put(chiperText);
result = Base64.ToBase64String(byteBuffer.array());
}
}
catch (Exception ex)
{
result = null;
}
return result;
}
/**
* Decrypts encrypted base64 string with key
*
* @param value - base64 string that should be decrypted
* @param deriveKey - key that should be used for the decryption(max. 32 bytes)
* @return
*/
public static String Decrypt(String value, byte[] deriveKey)
{
String result = null;
try
{
if(value != null && deriveKey != null)
{
byte[] combined = Base64.FromBase64String(value);
ByteArrayInputStream byteReader = new ByteArrayInputStream(combined);
byte[] nonce = new byte[MAX_NONCE_SIZE];
//byte[] tag = new byte[MAX_TAG_SIZE];
byte[] chiperText = new byte[combined.length - nonce.length];
byteReader.read(nonce, 0, MAX_NONCE_SIZE);
byteReader.read(chiperText, 0, chiperText.length);
final Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
GCMParameterSpec parameterSpec = new GCMParameterSpec(MAX_TAG_SIZE * 8, nonce);
SecretKey secretKey = new SecretKeySpec(deriveKey, "AES");
cipher.init(Cipher.DECRYPT_MODE, secretKey, parameterSpec);
byte[] plainText = cipher.doFinal(chiperText);
result = new String(plainText, StandardCharsets.UTF_8);
}
}
catch (Exception ex)
{
result = null;
}
return result;
}
/**
* Converts the text passed password to the 32 byte array
*
* @param password - Text based password
* @return returns password as byte array
*/
public static byte[] GetKey(String password)
{
byte[] result = null;
try
{
if(password != null && !password.isEmpty())
{
if(password.length() < 32)
{
StringBuilder padded = new StringBuilder(password);
while (padded.length() < 32)
{
padded.append("@");
}
password = padded.toString();
}
else if(password.length() > 32)
{
password = MD5.Encrypt(password);
}
result = password.getBytes(StandardCharsets.US_ASCII);
}
}
catch (Exception ex)
{
result = null;
}
return result;
}
}

View File

@ -0,0 +1,44 @@
//
// Base64.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Security;
public class Base64
{
/**
* Converts byte array to the base64 String
*
* @param data - byte array that should be converted in to base64 string
* @return returns base64 String
*/
public static String ToBase64String(byte[] data)
{
String result = null;
try
{
result = android.util.Base64.encodeToString(data, android.util.Base64.NO_WRAP);
}
catch (Exception ex)
{
result = null;
}
return result;
}
/**
* Converts base64 string in to byte array
*
* @param base64 - base64 String, that should be converted in to byte array
* @return returns byte array
*/
public static byte[] FromBase64String(String base64)
{
return android.util.Base64.decode(base64, android.util.Base64.NO_WRAP);
}
}

View File

@ -0,0 +1,276 @@
//
// Curve25519.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Security;
import org.whispersystems.curve25519.JCESha512Provider;
import org.whispersystems.curve25519.java.curve_sigs;
import org.whispersystems.curve25519.java.scalarmult;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import de.labor_stein.befund.Core.Log;
public class Curve25519
{
private static final int KeySize = 32;
/**
* Generates the KeyPair with Private & Public Keys
*
* @return returns KeyPair with Public & Private Keys(incl. Signing Private & Public Keys)
*/
public static Curve25519.KeyPair GenerateKeyPair()
{
byte[] random = new byte[KeySize];
new SecureRandom().nextBytes(random);
byte[] privateKey = Curve25519.ClampPrivateKey(random);
byte[] publicKey = Curve25519.GetPublicKey(privateKey);
return new KeyPair(privateKey, publicKey);
}
/**
* Creates KeyPair from private and public key
*
* @param _privateKey - private key of KeyPair
* @param _publicKey - public key of KeyPair
* @return returns KeyPair
*/
public static Curve25519.KeyPair CreateKeyPair(String _privateKey, String _publicKey)
{
KeyPair result = null;
try
{
byte[] privateKey = ClampPrivateKey(Base64.FromBase64String(_privateKey));
byte[] publicKey = Base64.FromBase64String(_publicKey);
result = new KeyPair(privateKey, publicKey);
}
catch (Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Security.Curve25519", "CreateKeyPair(string, string)");
}
return result;
}
/**
* Private key clamping
*
* @param rawKey - rawKey
* @return returns Curve25519 Private Key
*/
public static byte[] ClampPrivateKey(byte[] rawKey)
{
byte[] privateKey = new byte[32];
System.arraycopy(rawKey, 0, privateKey, 0, 32);
privateKey[0] &= 248;
privateKey[31] &= 127;
privateKey[31] |= 64;
return privateKey;
}
/**
* Generates the public key out of the clamped private key
*
* @param privateKey - private key (must use ClampPrivateKey first!)
* @return returns Curve25519 Private Key
*/
public static byte[] GetPublicKey(byte[] privateKey)
{
byte[] publicKey = new byte[32];
curve_sigs.curve25519_keygen(publicKey, privateKey);
return publicKey;
}
/**
* Generates a shared secret by private & public keys
*
* @param privateKey - private key
* @param peerPublicKey - public key
* @return returns shared secret for private & public keys
*/
public static byte[] GetSharedSecret(byte[] privateKey, byte[] peerPublicKey)
{
byte[] agreement = new byte[32];
scalarmult.crypto_scalarmult(agreement, privateKey, peerPublicKey);
return agreement;
}
/**
* Generates a signature for the given message
*
* @param message - message that should signed
* @param privateKey - private key for signature
* @return byte array of signature
*/
public static byte[] GetSignature(byte[] message, byte[] privateKey)
{
byte[] result = null;
try
{
result = new byte[64];
byte[] random = new byte[64];
new SecureRandom().nextBytes(random);
org.whispersystems.curve25519.java.Sha512 sha512provider = new JCESha512Provider();
if (curve_sigs.curve25519_sign(sha512provider, result, privateKey, message, message.length, random) != 0)
{
throw new IllegalArgumentException("Message exceeds max length!");
}
}
catch (Exception ex)
{
result = null;
}
return result;
}
/**
* Verifies a signature with public key
*
* @param publicKey - public key of signature
* @param message - message that should be verify the signature
* @param signature - signature of the message
* @return returns true if valid signature
*/
public static boolean verifySignature(byte[] publicKey, byte[] message, byte[] signature)
{
boolean result = false;
try
{
org.whispersystems.curve25519.java.Sha512 sha512provider = new JCESha512Provider();
result = curve_sigs.curve25519_verify(sha512provider, signature, publicKey, message, message.length) == 0;
}
catch (Exception ex)
{
result = false;
}
return result;
}
/**
* KeyPair with Private & Public Key and Signature Keys
*/
public static class KeyPair
{
public String PrivateKey = null;
public String PublicKey = null;
public String SigningPublicKey = null;
public String SigningPrivateKey = null;
/**
* Constructor for KeyPair
*
* @param privateKey - Private Key
* @param publicKey - Public Key
*/
public KeyPair(byte[] privateKey, byte[] publicKey)
{
this.PrivateKey = Base64.ToBase64String(privateKey);
this.PublicKey = Base64.ToBase64String(publicKey);
byte[] signingPrivateKey = new byte[32];
new SecureRandom().nextBytes(signingPrivateKey);
byte[] signingPublicKey = Ed25519.PublicKey(signingPrivateKey);
this.SigningPrivateKey = Base64.ToBase64String(signingPrivateKey);
this.SigningPublicKey = Base64.ToBase64String(signingPublicKey);
}
/**
* Returns a shared key with the public key
*
* @param peerPublicKeyBase64 - Public key of peer in base64 string format
* @return returns shared key as byte array
*/
public byte[] GetSharedKey(String peerPublicKeyBase64)
{
byte[] result = null;
try
{
byte[] privateKey = Base64.FromBase64String(this.PrivateKey);
byte[] peerPublicKey = Base64.FromBase64String(peerPublicKeyBase64);
byte[] sharedSecret = Curve25519.GetSharedSecret(privateKey, peerPublicKey);
result = HKDF.DeriveKey(sharedSecret, 32);
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.Security.Curve25519.KeyPair", "GetSharedKey(String)");
}
return result;
}
/**
* Returns a Signature as base64 string for a string value
*
* @param signingValue - string value that should be signed
* @return returns base64 signed value hash
*/
public String GetSignature(String signingValue)
{
String result = null;
try
{
byte[] signingData = signingValue.getBytes(StandardCharsets.UTF_8);
byte[] privateKey = Base64.FromBase64String(this.SigningPrivateKey);
byte[] signature = Ed25519.Signature(signingData, privateKey);
if(signature != null)
{
result = Base64.ToBase64String(signature);
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.Security.Curve25519.KeyPair", "GetSignature(String)");
}
return result;
}
/**
* Verify signature hash(base64) with shared key
*
* @param signingValue - string value that should be signed
* @param signatureValue - signature Hash that should be verified
* @param peerPublicKeyBase64 - Public key of peer in base64 string format
* @return returns true if signature is valid
*/
public boolean VerifySignature(String signingValue, String signatureValue, String peerPublicKeyBase64)
{
boolean result = false;
try
{
byte[] signingData = signingValue.getBytes(StandardCharsets.UTF_8);
byte[] signingPublicKey = Base64.FromBase64String(peerPublicKeyBase64);
byte[] signature = Base64.FromBase64String(signatureValue);
result = Ed25519.CheckValid(signature, signingData, signingPublicKey);
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.Security.Curve25519.KeyPair", "VerifySignature(String, String, String)");
}
return result;
}
}
}

View File

@ -0,0 +1,87 @@
//
// Ed25519.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 25.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Security;
import com.google.crypto.tink.subtle.Ed25519Sign;
import com.google.crypto.tink.subtle.Ed25519Verify;
public class Ed25519
{
/**
* Generates Ed25519 Public Key for signing
*
* @param privateKey - private key for public key
* @return returns public key for the signature
*/
public static byte[] PublicKey(byte[] privateKey)
{
byte[] result = null;
try
{
Ed25519Sign.KeyPair keyPair = Ed25519Sign.KeyPair.newKeyPairFromSeed(privateKey);
result = keyPair.getPublicKey();
}
catch (Exception ex)
{
result = null;
}
return result;
}
/**
* Generates a Ed25519 Signature by private key
*
* @param message - message that should be signed
* @param privateKey - private key for the signature
* @return returns signature
*/
public static byte[] Signature(byte[] message, byte[] privateKey)
{
byte[] result = null;
try
{
Ed25519Sign signer = new Ed25519Sign(privateKey);
result = signer.sign(message);
}
catch (Exception ex)
{
result = null;
}
return result;
}
/**
* Validates a ED25519 Signature with message and public key of sender
*
* @param signature - signature that should be validated
* @param message - message that was signed
* @param publicKey - public key that was used by sender for the message to sign it
* @return returns true if valid
*/
public static boolean CheckValid(byte[] signature, byte[] message, byte[] publicKey)
{
boolean result = false;
try
{
Ed25519Verify verifier = new Ed25519Verify(publicKey);
verifier.verify(signature, message);
result = true;
}
catch (Exception ex)
{
result = false;
}
return result;
}
}

View File

@ -0,0 +1,88 @@
//
// HKDF.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 25.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Security;
import java.io.ByteArrayOutputStream;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
// Git: https://github.com/signalapp/libsignal-protocol-java/blob/master/java/src/main/java/org/whispersystems/libsignal/kdf/HKDF.java
public class HKDF
{
private static final int HASH_OUTPUT_SIZE = 32;
public static byte[] DeriveKey(byte[] inputKeyMaterial, int outputLength)
{
byte[] salt = new byte[HASH_OUTPUT_SIZE];
return deriveSecrets(inputKeyMaterial, salt, outputLength);
}
public static byte[] deriveSecrets(byte[] inputKeyMaterial, byte[] salt, int outputLength)
{
byte[] prk = extract(salt, inputKeyMaterial);
return expand(prk, outputLength);
}
private static byte[] extract(byte[] salt, byte[] inputKeyMaterial)
{
byte[] result = null;
try
{
Mac mac = Mac.getInstance("HmacSHA512");
mac.init(new SecretKeySpec(salt, "HmacSHA512"));
return mac.doFinal(inputKeyMaterial);
}
catch (Exception ex)
{
result = null;
}
return result;
}
private static byte[] expand(byte[] prk, int outputSize)
{
byte[] result = null;
try
{
int iterations = (int) Math.ceil((double) outputSize / (double) HASH_OUTPUT_SIZE);
byte[] mixin = new byte[0];
ByteArrayOutputStream results = new ByteArrayOutputStream();
int remainingBytes = outputSize;
for (int i= 1; i<iterations + 1; i++)
{
Mac mac = Mac.getInstance("HmacSHA512");
mac.init(new SecretKeySpec(prk, "HmacSHA512"));
mac.update(mixin);
mac.update((byte)i);
byte[] stepResult = mac.doFinal();
int stepSize = Math.min(remainingBytes, stepResult.length);
results.write(stepResult, 0, stepSize);
mixin = stepResult;
remainingBytes -= stepSize;
}
result = results.toByteArray();
}
catch (Exception ex)
{
result = null;
}
return result;
}
}

View File

@ -0,0 +1,99 @@
//
// MD5.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Security;
import java.security.MessageDigest;
public class MD5
{
/**
* Encrypts the given String in to MD5 Hash
*
* @param value - String that should be converted in to MD5 hash String
* @return returns MD5 String
*/
public static String Encrypt(String value)
{
String result = null;
try
{
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(value.getBytes());
byte[] bytes = digest.digest();
if(bytes != null)
{
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < bytes.length; i++)
{
String h = Integer.toHexString(0xFF & bytes[i]);
while (h.length() < 2)
{
h = "0" + h;
}
hexString.append(h);
}
result = hexString.toString();
}
}
catch (Exception ex)
{
result = null;
}
return result;
}
/**
* Encrypts the given byte array in to MD5 Hash
*
* @param value - byte array that should be converted in to MD5 hash String
* @return returns MD5 String
*/
public static String Encrypt(byte[] value)
{
String result = null;
try
{
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
digest.update(value);
byte[] bytes = digest.digest();
if(bytes != null)
{
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < bytes.length; i++)
{
String h = Integer.toHexString(0xFF & bytes[i]);
while (h.length() < 2)
{
h = "0" + h;
}
hexString.append(h);
}
result = hexString.toString();
}
}
catch (Exception ex)
{
result = null;
}
return result;
}
}

View File

@ -0,0 +1,166 @@
//
// SHA512.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 21.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core.Security;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import de.labor_stein.befund.Core.Log;
public class SHA512
{
public static final String VerificatorHashingValue = "U{u)DT~!CV@y9P8U4#,T%KY~D>YRj388";
private static final int HKDF_HASH_OUTPUT_SIZE = 32;
/**
* Encrypts a string value in SHA512 hash
*
* @param value - string value that should be encrypted in SHA512 hash
* @return - Returns SHA512 hash
*/
public static String Encrypt(String value)
{
String result = null;
try
{
MessageDigest digest = java.security.MessageDigest.getInstance("SHA-512");
digest.update(value.getBytes());
byte[] bytes = digest.digest();
if(bytes != null)
{
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < bytes.length; i++)
{
String h = Integer.toHexString(0xFF & bytes[i]);
while (h.length() < 2)
{
h = "0" + h;
}
hexString.append(h);
}
result = hexString.toString();
}
}
catch (Exception ex)
{
result = null;
}
return result;
}
/**
* Encrypts a byte array in SHA512 hash
*
* @param value - byte array that should be encrypted in SHA512 hash
* @return - Returns SHA512 hash
*/
public static String Encrypt(byte[] value)
{
String result = null;
try
{
MessageDigest digest = java.security.MessageDigest.getInstance("SHA-512");
digest.update(value);
byte[] bytes = digest.digest();
if(bytes != null)
{
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < bytes.length; i++)
{
String h = Integer.toHexString(0xFF & bytes[i]);
while (h.length() < 2)
{
h = "0" + h;
}
hexString.append(h);
}
result = hexString.toString();
}
}
catch (Exception ex)
{
result = null;
}
return result;
}
/**
* Generates SHA512 HMAC Hash with key
*
* @param message - message that should be signed by sha512 hmac
* @param key - key that should be used for signing
* @return returns SHA512 HMAC
*/
public static String HMAC(String message, byte[] key)
{
String result = null;
try
{
SecretKeySpec secretKeySpec = new SecretKeySpec(key, "SHA-512");
Mac mac = Mac.getInstance("HmacSHA512");
mac.init(secretKeySpec);
result = toHex(mac.doFinal(message.getBytes(StandardCharsets.UTF_8)));
}
catch(Exception ex)
{
Log.Critical(ex.getMessage(), "Core.Security.SHA512", "HMAC");
}
return result;
}
/**
* Validates HMAC with message and key
*
* @param hmac - HMAC from the partner
* @param message - message that should be signed by sha512 hmac
* @param key - key that should be used for signing
* @return returns true if success
*/
public static boolean isValidAuthenticationCode(String hmac, String message, byte[] key)
{
return (hmac != null && HMAC(message, key).equals(hmac));
}
/**
* Converts bytes array to hex string
*
* @param bytes - bytes array that should be converted in to hex string
* @return returns hex string
*/
public static String toHex(final byte[] bytes)
{
StringBuilder sb = new StringBuilder();
for(byte b : bytes)
{
sb.append(String.format("%02x", b&0xff));
}
return sb.toString();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,751 @@
//
// System.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 13.06.22
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Core;
import android.content.Context;
import android.content.res.AssetManager;
import android.os.Build;
import android.os.Environment;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import de.labor_stein.befund.Core.Models.System.Device;
import de.labor_stein.befund.Core.Models.System.StorageInfo;
public class System
{
public static String ApplicationDirectoryPath = null;
/**
* Returns path of application directory
* @param context - current context
* @return returns path as string
*/
public static String ApplicationDirectoryPath(Context context)
{
String result = null;
if(ApplicationDirectoryPath != null)
{
result = ApplicationDirectoryPath;
}
else
{
result = GetInternalStorage(context);
if(result == null)
{
File file = context.getFilesDir();
if(file != null)
{
result = file.getAbsolutePath();
}
}
ApplicationDirectoryPath = result;
}
return result;
}
/**
* Returns path of settings.json
* @param context - current context
* @return returns path as string
*/
public static String SettingsPath(Context context)
{
return ApplicationDirectoryPath(context) + "/settings.json";
}
/**
* Returns path of storage
* @param context - current context
* @return returns path as string
*/
public static String StorageDirectoryPath(Context context)
{
String result = ApplicationDirectoryPath(context) + "/storage";
try
{
File fileManager = new File(result);
if(!fileManager.exists())
{
fileManager.mkdir();
}
if(!fileManager.exists() || !fileManager.isDirectory())
{
result = null;
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "StorageDirectoryPath(Context)");
}
return result;
}
/**
* Returns path of encrypted path
* @param context - current context
* @return returns path as string
*/
public static String EncryptedStorageDirectoryPath(Context context)
{
String result = StorageDirectoryPath(context) + "/encrypted";
try
{
File fileManager = new File(result);
if(!fileManager.exists())
{
fileManager.mkdir();
}
if(!fileManager.exists() || !fileManager.isDirectory())
{
result = null;
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "EncryptedStorageDirectoryPath(Context)");
}
return result;
}
/**
* Returns path of databases directory
* @param context - current context
* @return returns directory path as string
*/
public static String DatabaseDirectoryPath(Context context)
{
String result = ApplicationDirectoryPath(context) + "/databases";
try
{
File fileManager = new File(result);
if(!fileManager.exists())
{
fileManager.mkdir();
}
if(!fileManager.exists() || !fileManager.isDirectory())
{
result = null;
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "DatabaseDirectoryPath(Context)");
}
return result;
}
/**
* Returns path of logs database
* @param context - current context
* @return returns database path as string
*/
public static String LogsDatabasePath(Context context)
{
String result = null;
try
{
String dbDirectory = DatabaseDirectoryPath(context);
if(dbDirectory != null && dbDirectory != "")
{
result = dbDirectory + "/logs.db";
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "LogsDatabasePath(Context)");
}
return result;
}
/**
* Returns path of database
* @param context - current context
* @return returns database path as string
*/
public static String ResultsDatabasePath(Context context)
{
String result = null;
try
{
String dbDirectory = DatabaseDirectoryPath(context);
if(dbDirectory != null && dbDirectory != "")
{
result = dbDirectory + "/results.db";
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "ResultsDatabasePath(Context)");
}
return result;
}
/**
* Checks if file exits at path
*
* @param atPath - filename that should be checked
* @return returns true if successfully
*/
public static Boolean FileExists(String atPath)
{
if(atPath != null && atPath != "")
{
File file = new File(atPath);
return file.exists();
}
else
{
return false;
}
}
/**
* Deletes file at path
*
* @param atPath - filename that should be deleted
* @return returns true if successfully
*/
public static Boolean DeleteFile(String atPath)
{
Boolean result = false;
try
{
if(atPath != null && atPath != "")
{
File file = new File(atPath);
if(file.exists())
{
file.delete();
}
}
return !FileExists(atPath);
}
catch(Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "DeleteFile(String)");
}
return result;
}
/**
* Writes content to the file
*
* @param filename - filename of storage
* @param context - current context
* @return returns byte array
*/
public static Boolean WriteToStorage(String filename, byte[] data, Context context)
{
Boolean result = false;
try
{
String storageDirectory = StorageDirectoryPath(context);
if(storageDirectory != null && storageDirectory != "")
{
String filePath = storageDirectory + "/" + filename;
if(filePath != null && filePath != "")
{
if(FileExists(filePath))
{
DeleteFile(filePath);
}
FileOutputStream out = new FileOutputStream(filePath);
out.write(data);
out.close();
result = true;
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "WriteToStorage(String, byte[], Context)");
}
return result;
}
/**
* Writes content to the file
*
* @param filename - filename of encrypted file storage
* @param context - current context
* @return returns byte array
*/
public static Boolean WriteToEncryptedStorage(String filename, byte[] data, Context context)
{
Boolean result = false;
try
{
String storageDirectory = EncryptedStorageDirectoryPath(context);
if(storageDirectory != null && storageDirectory != "")
{
String filePath = storageDirectory + "/" + filename;
if(filePath != null && filePath != "")
{
if(FileExists(filePath))
{
DeleteFile(filePath);
}
FileOutputStream out = new FileOutputStream(filePath);
out.write(data);
out.close();
result = true;
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "WriteToEncryptedStorage(String, byte[], Context)");
}
return result;
}
/**
* Reads content of file as byte array
*
* @param filename - filename of storage file
* @param context - current context
* @return returns byte array
*/
public static byte[] ReadFromStorage(String filename, Context context)
{
byte[] result = null;
try
{
String storageDirectory = StorageDirectoryPath(context);
if(storageDirectory != null && storageDirectory != "")
{
String filePath = storageDirectory + "/" + filename;
File file = new File(filePath);
if(file.exists() && file.canRead())
{
result = new byte[(int) file.length()];
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
DataInputStream dis = new DataInputStream(bis);
dis.readFully(result);
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "ReadFromStorage(String, Context)");
}
return result;
}
/**
* Reads content of encrypted file as byte array
*
* @param filename - filename of encrypted file
* @param context - current context
* @return returns byte array
*/
public static byte[] ReadFromEncryptedStorage(String filename, Context context)
{
byte[] result = null;
try
{
String storageDirectory = EncryptedStorageDirectoryPath(context);
if(storageDirectory != null && storageDirectory != "")
{
String filePath = storageDirectory + "/" + filename;
File file = new File(filePath);
if(file.exists() && file.canRead())
{
result = new byte[(int) file.length()];
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
DataInputStream dis = new DataInputStream(bis);
dis.readFully(result);
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "ReadFromEncryptedStorage(String, Context)");
}
return result;
}
/**
* Returns file path from storage
* @param filename - filename in storage
* @param context - current context
* @return retunrs path as string
*/
public static String GetPathForStorageFile(String filename, Context context)
{
String result = null;
try
{
if(filename != null)
{
String storageDirectory = StorageDirectoryPath(context);
if(storageDirectory != null && storageDirectory != "")
{
result = storageDirectory + "/" + filename;
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "GetPathForStorageFile(String, Context)");
}
return result;
}
/**
* Returns path for encrypted file
*
* @param filename - filename in the encrypted storage
* @param context - current context
* @return returns path as string
*/
public static String GetPathForStorageEncryptedFile(String filename, Context context)
{
String result = null;
try
{
if(filename != null)
{
String storageDirectory = EncryptedStorageDirectoryPath(context);
if(storageDirectory != null && storageDirectory != "")
{
result = storageDirectory + "/" + filename;
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "GetPathForStorageEncryptedFile(String, Context)");
}
return result;
}
/**
* Returns all files from encrypted storage
*
* @param context - current context
* @return returns list of files
*/
public static List<File> GetEncryptedFiles(Context context)
{
List<File> result = null;
try
{
String path = EncryptedStorageDirectoryPath(context);
result = Files.walk(Paths.get(path))
.filter(Files::isRegularFile)
.map(Path::toFile)
.collect(Collectors.toList());
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "GetEncryptedFiles(String, Context)");
}
return result;
}
/**
* Returns all oegd files from storage
*
* @param context - current context
* @return returns list of files
*/
public static List<File> GetOEGDFiles(Context context)
{
List<File> result = null;
try
{
String path = StorageDirectoryPath(context);
List<File> files = Files.walk(Paths.get(path))
.filter(Files::isRegularFile)
.map(Path::toFile)
.collect(Collectors.toList());
if(files != null && files.size() > 0)
{
result = new ArrayList<>();
for(int i = 0; i < files.size(); i++)
{
File f = files.get(i);
if(f.getName().toLowerCase().contains(".oegd"))
{
result.add(f);
}
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "GetOEGDFiles(String, Context)");
}
return result;
}
/**
* Returns device info object
*
* @param settings
* @return
*/
public static Device GetDeviceInfo(de.labor_stein.befund.Core.Models.Settings settings)
{
Device result = new Device();
if(Build.MANUFACTURER != null && Build.MODEL != null)
{
char firstChar = Build.MANUFACTURER.charAt(0);
result.udid = settings.udid;
result.name = Character.toUpperCase(firstChar) + Build.MANUFACTURER.substring(1) + " (" + Build.MODEL + ")";
result.manufacturer = Character.toUpperCase(firstChar) + Build.MANUFACTURER.substring(1);
result.model = Build.MODEL;
result.os = Build.VERSION.RELEASE;
}
return result;
}
/**
* Returns storage info object
* @param context - current context
* @return returns storage info
*/
public static StorageInfo GetStorageInfo(Context context)
{
StorageInfo result = null;
String application_directory = ApplicationDirectoryPath(context);
if(application_directory != null && application_directory != "")
{
File directory = new File(application_directory);
if(directory.exists())
{
result = new StorageInfo();
result.total = (double)directory.getTotalSpace() / 1000000000;
result.free = (double)directory.getFreeSpace() / 1000000000;
result.used = (result.total - result.free);
}
}
return result;
}
/**
* Returns file creation date
* @param atPath - path of file
* @return returns path as string
*/
public static Date GetFileCreationDate(String atPath)
{
if(atPath != null && atPath != "")
{
File file = new File(atPath);
if(file.exists())
{
return new Date(file.lastModified());
}
else
{
return null;
}
}
else
{
return null;
}
}
/**
* Returns internal storage
* @param context - current context
* @return returns storage path as string
*/
private static String GetInternalStorage(Context context)
{
String result = null;
File[] fileDirs = context.getExternalFilesDirs(null);
if (fileDirs != null && fileDirs.length > 0)
{
for (File file : fileDirs)
{
if(file != null && Environment.isExternalStorageEmulated(file))
{
result = file.getAbsolutePath();
break;
}
}
}
return result;
}
/**
* Deletes all files from device
*
* @return returns true if successfully
*/
public static boolean DeleteAllFiles(Context context)
{
boolean result = false;
try
{
List<File> files = GetEncryptedFiles(context);
/** delete results **/
if(files != null && files.size() > 0)
{
for(int i = 0; i < files.size(); i++)
{
File f = files.get(i);
DeleteFile(f.getPath());
}
}
/** Delete oegd´s **/
List<File> oegds = GetOEGDFiles(context);
if(oegds != null && oegds.size() > 0)
{
for(int i = 0; i < oegds.size(); i++)
{
File f = files.get(i);
DeleteFile(f.getPath());
}
}
/** Delete logs database **/
DeleteFile(LogsDatabasePath(context));
/** Delete results database **/
DeleteFile(ResultsDatabasePath(context));
/** Delete settubgs **/
DeleteFile(SettingsPath(context));
/** check if successfully deleted **/
result = !FileExists(SettingsPath(context));
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.System", "DeleteAllFiles");
}
return result;
}
public static byte[] ReadFromAssets(String filename, Context context)
{
byte[] result = null;
try
{
AssetManager am = context.getAssets();
if(am != null)
{
InputStream is = am.open(filename);
if(is != null)
{
int length = is.available();
byte[] buffer = new byte[length];
is.read(buffer);
result = buffer;
is.close();
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getLocalizedMessage(), "de.labor_stein.befund.Core.System", "ReadFromAssets(String, Context)");
}
return result;
}
}

View File

@ -0,0 +1,457 @@
//
// EditOEGDActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 02.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.gson.Gson;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.UUID;
import de.labor_stein.befund.Core.Helpers.DateHelper;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.OEGD;
import de.labor_stein.befund.Core.Models.OEGDFile;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Base64;
import de.labor_stein.befund.Core.System;
public class EditOEGDActivity extends AppCompatActivity
{
/** EditOEGDActivityContext **/
private Context MainContext;
/** Layouts **/
private CoordinatorLayout ActivityRootLayout;
/** Controls **/
private TextView lblEditOEGD;
private TextView EditOEGDActivitylblButtonBack;
private EditText EditOEGDActivity_txtTitle;
private EditText EditOEGDActivity_txtFirstname;
private EditText EditOEGDActivity_txtLastname;
private EditText EditOEGDActivity_txtAdditionLastname;
private EditText EditOEGDActivity_txtPrefix;
private Spinner EditOEGDActivity_txtGenders;
private EditText EditOEGDActivity_txtBirthday;
private DatePickerDialog BirthdayPicker;
private EditText EditOEGDActivity_txtStreet;
private EditText EditOEGDActivity_txtZIP;
private EditText EditOEGDActivity_txtCity;
private EditText EditOEGDActivity_txtTelefon;
private Button EditOEGDActivity_btnSave;
private TextView EditOEGDActivity_Status;
/** Buttons **/
private FloatingActionButton OEGDButtonBack;
/** List items **/
private String[] Genders = { Lang.Get("LBL_GENDER"), Lang.Get("LBL_GENDER_M"), Lang.Get("LBL_GENDER_W"), Lang.Get("LBL_GENDER_D"), Lang.Get("LBL_GENDER_X") };
/** Current OEGDFile for editing **/
private OEGDFile CurrentOEGD = null;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_oegd);
try
{
Bundle parameters = getIntent().getExtras();
if(parameters != null)
{
String file = parameters.getString("file");
if(file != null)
{
byte[] encrypted_content = System.ReadFromStorage(file, this);
if(encrypted_content != null)
{
String json = AES.Decrypt(new String(encrypted_content, StandardCharsets.UTF_8), AES.GetKey(Session.DevicePassword));
if(json != null)
{
CurrentOEGD = new OEGDFile();
CurrentOEGD.filename = file;
CurrentOEGD.OEGD = new Gson().fromJson(json, OEGD.class);
}
}
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getMessage(), "EditOEGDActivity", "onCreate");
}
this.Initialize();
}
/**
* Initializes eIDActivity
*/
private void Initialize()
{
MainContext = this;
Log.Initialize(this);
this.InitializeLayouts();
this.InitializeLabels();
this.InitializeButtons();
this.InitializeControls();
this.InitializeLanguages();
}
/**
* Initializes Languages
*/
private void InitializeLanguages()
{
lblEditOEGD.setText(Lang.Get("LBL_EDIT_OEGD"));
EditOEGDActivitylblButtonBack.setText(Lang.Get("BTN_BACK"));
EditOEGDActivity_txtTitle.setHint(Lang.Get("LBL_TITLE"));
EditOEGDActivity_txtFirstname.setHint(Lang.Get("LBL_FIRSTNAME"));
EditOEGDActivity_txtLastname.setHint(Lang.Get("LBL_LASTNAME"));
EditOEGDActivity_txtAdditionLastname.setHint(Lang.Get("LBL_ADDITION_NAME"));
EditOEGDActivity_txtPrefix.setHint(Lang.Get("LBL_NAME_PREFIX"));
EditOEGDActivity_txtBirthday.setHint(Lang.Get("LBL_BIRTHDAY"));
EditOEGDActivity_txtStreet.setHint(Lang.Get("LBL_STREET"));
EditOEGDActivity_txtZIP.setHint(Lang.Get("LBL_ZIP"));
EditOEGDActivity_txtCity.setHint(Lang.Get("LBL_CITY"));
EditOEGDActivity_txtTelefon.setHint(Lang.Get("LBL_TELEFON"));
EditOEGDActivity_btnSave.setText(Lang.Get("BTN_SAVE"));
}
/**
* Initializes controls
*/
private void InitializeControls()
{
EditOEGDActivity_btnSave = findViewById(R.id.EditOEGDActivity_btnSave);
if(this.CurrentOEGD != null && this.CurrentOEGD.OEGD != null)
{
EditOEGDActivity_btnSave.setOnClickListener(v -> { this.EditOEGDActivity_btnSave_Click(); });
}
EditOEGDActivity_txtTitle = findViewById(R.id.EditOEGDActivity_txtTitle);
EditOEGDActivity_txtFirstname = findViewById(R.id.EditOEGDActivity_txtFirstname);
EditOEGDActivity_txtLastname = findViewById(R.id.EditOEGDActivity_txtLastname);
EditOEGDActivity_txtAdditionLastname = findViewById(R.id.EditOEGDActivity_txtAdditionLastname);
EditOEGDActivity_txtPrefix = findViewById(R.id.EditOEGDActivity_txtPrefix);
EditOEGDActivity_txtGenders = findViewById(R.id.EditOEGDActivity_txtGenders);
EditOEGDActivity_txtBirthday = findViewById(R.id.EditOEGDActivity_txtBirthday);
EditOEGDActivity_txtStreet = findViewById(R.id.EditOEGDActivity_txtStreet);
EditOEGDActivity_txtZIP = findViewById(R.id.EditOEGDActivity_txtZIP);
EditOEGDActivity_txtCity = findViewById(R.id.EditOEGDActivity_txtCity);
EditOEGDActivity_txtTelefon = findViewById(R.id.EditOEGDActivity_txtTelefon);
EditOEGDActivity_Status = findViewById(R.id.EditOEGDActivity_Status);
ArrayAdapter aa = new ArrayAdapter(this, android.R.layout.simple_spinner_item, this.Genders);
aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
EditOEGDActivity_txtGenders.setAdapter(aa);
/** DatePicker **/
BirthdayPicker = new DatePickerDialog(this, R.style.MySpinnerDatePickerStyle);
BirthdayPicker.getDatePicker().setMaxDate(new Date().getTime());
BirthdayPicker.setOnDateSetListener(new DatePickerDialog.OnDateSetListener()
{
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth)
{
Date selectedDate = DateHelper.getDateFromDatePicket(BirthdayPicker.getDatePicker());
if(selectedDate != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
EditOEGDActivity_txtBirthday.setText(dateFormat.format(selectedDate));
}
}
});
/** Disable directly key insert in the birthday field(it should be set by DatePicker for well formed value) **/
EditOEGDActivity_txtBirthday.setOnKeyListener((View v, int keyCode, KeyEvent event) -> { return true; });
/** Show/Hide DatePicker **/
EditOEGDActivity_txtBirthday.setOnFocusChangeListener((View v, boolean hasFocus) -> { if(hasFocus) { BirthdayPicker.show(); } });
EditOEGDActivity_txtBirthday.setOnTouchListener((View v, MotionEvent event) -> { BirthdayPicker.show(); return true; });
/** Set the values to the fields **/
if(this.CurrentOEGD != null && this.CurrentOEGD.OEGD != null)
{
if(this.CurrentOEGD.OEGD.title != null && !this.CurrentOEGD.OEGD.title.isEmpty())
{
EditOEGDActivity_txtTitle.setText(this.CurrentOEGD.OEGD.title);
}
EditOEGDActivity_txtFirstname.setText(this.CurrentOEGD.OEGD.first_name);
EditOEGDActivity_txtLastname.setText(this.CurrentOEGD.OEGD.last_name);
if(this.CurrentOEGD.OEGD.name_addition != null && !this.CurrentOEGD.OEGD.name_addition.isEmpty())
{
EditOEGDActivity_txtAdditionLastname.setText(this.CurrentOEGD.OEGD.name_addition);
}
if(this.CurrentOEGD.OEGD.prefix != null && !this.CurrentOEGD.OEGD.prefix.isEmpty())
{
EditOEGDActivity_txtPrefix.setText(this.CurrentOEGD.OEGD.prefix);
}
if(this.CurrentOEGD.OEGD.gender.toLowerCase().equals("m"))
{
EditOEGDActivity_txtGenders.setSelection(1);
}
else if(this.CurrentOEGD.OEGD.gender.toLowerCase().equals("w"))
{
EditOEGDActivity_txtGenders.setSelection(2);
}
else if(this.CurrentOEGD.OEGD.gender.toLowerCase().equals("d"))
{
EditOEGDActivity_txtGenders.setSelection(3);
}
else if(this.CurrentOEGD.OEGD.gender.toLowerCase().equals("x"))
{
EditOEGDActivity_txtGenders.setSelection(4);
}
if(this.CurrentOEGD.OEGD.birthdate != null && !this.CurrentOEGD.OEGD.birthdate.isEmpty())
{
Date birthday = this.CurrentOEGD.OEGD.GetBirthday();
if(birthday != null)
{
int year = DateHelper.GetFullYearFromDate(birthday);
int month = DateHelper.GetFullMonthFromDate(birthday);
int day = DateHelper.GetFullDayFromDate(birthday);
BirthdayPicker.updateDate(year, month - 1, day);
EditOEGDActivity_txtBirthday.setText(this.CurrentOEGD.OEGD.GetFormatedBirthday());
}
}
EditOEGDActivity_txtStreet.setText(this.CurrentOEGD.OEGD.address.street_number);
EditOEGDActivity_txtCity.setText(this.CurrentOEGD.OEGD.address.city);
EditOEGDActivity_txtZIP.setText(this.CurrentOEGD.OEGD.address.zip_code);
if(this.CurrentOEGD.OEGD.phone != null && !this.CurrentOEGD.OEGD.phone.isEmpty())
{
EditOEGDActivity_txtTelefon.setText(this.CurrentOEGD.OEGD.phone);
}
}
}
/**
* Initialize Layouts
*/
private void InitializeLayouts()
{
ActivityRootLayout = (CoordinatorLayout)findViewById(R.id.EditOEGDActivityRootLayout);
}
/**
* Initializes Labels
*/
private void InitializeLabels()
{
lblEditOEGD = ActivityRootLayout.findViewById(R.id.lblEditOEGD);
EditOEGDActivitylblButtonBack = ActivityRootLayout.findViewById(R.id.EditOEGDActivitylblButtonBack);
}
/**
* Initializes Buttons
*/
private void InitializeButtons()
{
OEGDButtonBack = ActivityRootLayout.findViewById(R.id.OEGDButtonBack);
OEGDButtonBack.setOnClickListener(v ->{ OEGDButtonBack_Click(); });
}
/**
* Go Back to OEGDActivity
*/
private void OEGDButtonBack_Click()
{
Intent intent = new Intent(this, OEGDActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.side_in_left, R.anim.side_out_right);
}
/**
* Save current OEGD
*/
private void EditOEGDActivity_btnSave_Click()
{
try
{
EditOEGDActivity_Status.setText("");
if(EditOEGDActivity_txtFirstname.getText() == null || EditOEGDActivity_txtFirstname.getText().toString().isEmpty())
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_FIRSTNAME"));
}
else if(EditOEGDActivity_txtLastname.getText() == null || EditOEGDActivity_txtLastname.getText().toString().isEmpty())
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_LASTNAME"));
}
else if(EditOEGDActivity_txtBirthday.getText() == null || EditOEGDActivity_txtBirthday.getText().toString().isEmpty())
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_BIRTHDAY"));
}
else if(EditOEGDActivity_txtGenders.getSelectedItemPosition() <= 0)
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_GENDER"));
}
else if(EditOEGDActivity_txtStreet.getText() == null || EditOEGDActivity_txtStreet.getText().toString().isEmpty())
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_STREET"));
}
else if(EditOEGDActivity_txtZIP.getText() == null || EditOEGDActivity_txtZIP.getText().toString().isEmpty())
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_ZIP"));
}
else if(EditOEGDActivity_txtCity.getText() == null || EditOEGDActivity_txtCity.getText().toString().isEmpty())
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_CITY"));
}
else
{
OEGD oegd = new OEGD();
oegd.first_name = EditOEGDActivity_txtFirstname.getText().toString();
oegd.last_name = EditOEGDActivity_txtLastname.getText().toString();
Date selectedDate = DateHelper.getDateFromDatePicket(BirthdayPicker.getDatePicker());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
oegd.birthdate = dateFormat.format(selectedDate);
int genderIndex = (int)EditOEGDActivity_txtGenders.getSelectedItemId();
String gender_full_name = Genders[genderIndex];
if(gender_full_name.equals(Lang.Get("LBL_GENDER_M")))
{
oegd.gender = "M";
}
else if(gender_full_name.equals(Lang.Get("LBL_GENDER_W")))
{
oegd.gender = "W";
}
else if(gender_full_name.equals(Lang.Get("LBL_GENDER_D")))
{
oegd.gender = "D";
}
else
{
oegd.gender = "X";
}
if(EditOEGDActivity_txtTitle.getText() != null && !EditOEGDActivity_txtTitle.getText().toString().isEmpty())
{
oegd.title = EditOEGDActivity_txtTitle.getText().toString();
}
if(EditOEGDActivity_txtAdditionLastname.getText() != null && !EditOEGDActivity_txtAdditionLastname.getText().toString().isEmpty())
{
oegd.name_addition = EditOEGDActivity_txtAdditionLastname.getText().toString();
}
if(EditOEGDActivity_txtPrefix.getText() != null && !EditOEGDActivity_txtPrefix.getText().toString().isEmpty())
{
oegd.prefix = EditOEGDActivity_txtPrefix.getText().toString();
}
oegd.address = OEGD.Address.createInstance();
oegd.address.zip_code = EditOEGDActivity_txtZIP.getText().toString();
oegd.address.city = EditOEGDActivity_txtCity.getText().toString();
oegd.address.street_number = EditOEGDActivity_txtStreet.getText().toString();
oegd.address.country_code = "D";
oegd.cwa_consent_flag = true;
if(EditOEGDActivity_txtTelefon.getText() != null && !EditOEGDActivity_txtTelefon.getText().toString().isEmpty())
{
oegd.phone = EditOEGDActivity_txtTelefon.getText().toString();
}
String json = new Gson().toJson(oegd);
if(json != null)
{
String encrypted_content = AES.Encrypt(json, AES.GetKey(Session.DevicePassword));
if(encrypted_content != null)
{
if(System.WriteToStorage(this.CurrentOEGD.filename, encrypted_content.getBytes(StandardCharsets.UTF_8), this))
{
GoToOEGDActivity();
}
else
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_COULD_NOT_SAVE_OEGD"));
}
}
else
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_COULD_NOT_SAVE_OEGD"));
}
}
else
{
EditOEGDActivity_Status.setText(Lang.Get("ERROR_COULD_NOT_SAVE_OEGD"));
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "EditOEGDActivity", "EditOEGDActivity_btnCreate_Click");
}
}
/**
* Goes back to OEGDActivity
*/
private void GoToOEGDActivity()
{
Intent OEGDActivity = new Intent(this, OEGDActivity.class);
startActivity(OEGDActivity);
overridePendingTransition(R.anim.side_in_left, R.anim.side_out_right);
}
}

View File

@ -0,0 +1,173 @@
package de.labor_stein.befund;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import de.labor_stein.befund.Core.Https.Request;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Settings;
import de.labor_stein.befund.Core.System;
public class FAQActivity extends AppCompatActivity
{
/** SupportActivityContext **/
private Context MainContext;
/** Layouts **/
private CoordinatorLayout ActivityRootLayout;
/** Controls **/
private TextView lblFAQActivity;
private TextView lblFAQActivityButtonBack;
/** Buttons **/
private FloatingActionButton FAQButtonBack;
/** WebView **/
private WebView FAQ_web;
/** Settings **/
private de.labor_stein.befund.Core.Models.Settings Settings;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_faq);
this.Initialize();
}
@Override
protected void onResume()
{
super.onResume();
this.InitializeLanguages();
}
/**
* Initialize LaborActivity
*/
private void Initialize()
{
MainContext = this;
Log.Initialize(this);
this.InitializeControls();
this.InitializeLanguages();
}
/**
* Initializes Languages
*/
private void InitializeLanguages()
{
lblFAQActivity.setText(Lang.Get("LBL_FAQ"));
lblFAQActivityButtonBack.setText(Lang.Get("BTN_BACK"));
}
/**
* Initializes Controls
*/
private void InitializeControls()
{
this.Settings = de.labor_stein.befund.Core.Models.Settings.load(this);
ActivityRootLayout = (CoordinatorLayout)findViewById(R.id.FAQActivityRootLayout);
lblFAQActivity = ActivityRootLayout.findViewById(R.id.lblFAQActivity);
lblFAQActivityButtonBack = ActivityRootLayout.findViewById(R.id.lblFAQButtonBack);
FAQButtonBack = ActivityRootLayout.findViewById(R.id.FAQButtonBack);
FAQ_web = ActivityRootLayout.findViewById(R.id.FAQ_web);
FAQButtonBack.setOnClickListener(v ->{ FAQButtonBack_Click(); });
this.LoadFAQ();
}
/**
* Load FAQ
*/
private void LoadFAQ()
{
try
{
/** Run request on sub thread **/
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
Request.GetResponseAsync(Settings.GetFAQURL(),
"GET",
(content) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
FAQ_web.loadUrl(Settings.GetFAQURL());
}
});
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
// byte[] local_faq_data = System.ReadFromAssets("faq.html", MainContext);
//
// if(local_faq_data != null && local_faq_data.length > 0)
// {
// FAQ_web.loadData(new String(local_faq_data), "text/html", "utf-8");
// }
byte[] local_data = System.ReadFromAssets("no_connection.html", MainContext);
if(local_data != null && local_data.length > 0)
{
String html = new String(local_data);
html = html.replace("[NO_CONNECTION]", Lang.Get("ERROR_FAQ_NEEDS_CONNECTION"));
FAQ_web.loadData(html, "text/html", "utf-8");
}
}
});
});
}
});
thread.start();
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "FAQActivity", "LoadFAQ");
}
}
/**
* Go Back to MainActivity
*/
private void FAQButtonBack_Click()
{
this.finish();
// Intent intent = new Intent(this, MainActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Bundle parameters = new Bundle();
// parameters.putBoolean("SplashScreenLoaded", true);
// intent.putExtras(parameters);
// startActivity(intent);
// overridePendingTransition(R.anim.side_in_left, R.anim.side_out_right);
}
}

View File

@ -0,0 +1,491 @@
//
// LaborActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 04.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.Manifest;
import android.os.Build;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.journeyapps.barcodescanner.ScanContract;
import com.journeyapps.barcodescanner.ScanOptions;
import java.util.List;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Labor;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Models.Settings;
public class LaborActivity extends AppCompatActivity
{
/** MainActivityContext **/
private Context MainContext;
private AppCompatActivity CurrentActivity;
/** ViewPager **/
private ViewPager Pager;
private PagerAdapter Adapter;
/** Settings **/
private de.labor_stein.befund.Core.Models.Settings Settings;
/** PERMISSION FLAGS **/
private static int CAMERA_PERMISSION = 1000;
private static int POST_NOTIFICATIONS_PERMISSION = 1000;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_labor);
CurrentActivity = this;
this.Initialize();
}
/**
* Initialize LaborActivity
*/
private void Initialize()
{
this.Settings = de.labor_stein.befund.Core.Models.Settings.load(this);
Lang.SetLanguage(this.Settings.lang);
Pager = (ViewPager) findViewById(R.id.LaborPager);
Adapter = new LaborPagerAdapter(getSupportFragmentManager(), Labor.Labors(), this);
Pager.setAdapter(Adapter);
TextView lblSelectLabor = findViewById(R.id.lblSelectLabor);
lblSelectLabor.setText(Lang.Get("LBL_SELECT_LABOR"));
this.RequestAuthorizations();
//this.RequestPushNotification();
}
/**
* Check necessary permission if already granted
*/
private void RequestAuthorizations()
{
int result = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA))
{
if (result != PackageManager.PERMISSION_GRANTED)
{
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setCancelable(true);
alertBuilder.setTitle(Lang.Get("MSG_CAMERA_PERMISSION_TITLE"));
alertBuilder.setMessage(Lang.Get("MSG_CAMERA_PERMISSION_MSG"));
alertBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
ActivityCompat.requestPermissions(CurrentActivity, new String[] { Manifest.permission.CAMERA }, CAMERA_PERMISSION);
}
});
AlertDialog alert = alertBuilder.create();
alert.show();
}
else
{
Session.CameraGranted = true;
}
}
else
{
if (result != PackageManager.PERMISSION_GRANTED)
{
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setCancelable(true);
alertBuilder.setTitle(Lang.Get("MSG_CAMERA_PERMISSION_TITLE"));
alertBuilder.setMessage(Lang.Get("MSG_CAMERA_PERMISSION_MSG"));
alertBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
ActivityCompat.requestPermissions(CurrentActivity, new String[] { Manifest.permission.CAMERA }, CAMERA_PERMISSION);
}
});
AlertDialog alert = alertBuilder.create();
alert.show();
}
else
{
Session.CameraGranted = true;
}
}
}
private void RequestPushNotification() {
if (Build.VERSION.SDK_INT >= 33) {
int result = ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS);
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.POST_NOTIFICATIONS)) {
if (result != PackageManager.PERMISSION_GRANTED) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setCancelable(true);
alertBuilder.setTitle(Lang.Get("MSG_POST_NOTIFICATION_PERMISSION_TITLE"));
alertBuilder.setMessage(Lang.Get("MSG_POST_NOTIFICATION_MSG"));
alertBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityCompat.requestPermissions(CurrentActivity, new String[]{Manifest.permission.POST_NOTIFICATIONS}, POST_NOTIFICATIONS_PERMISSION);
}
});
AlertDialog alert = alertBuilder.create();
alert.show();
} else {
Session.NotificationGranted = true;
}
} else {
if (result != PackageManager.PERMISSION_GRANTED) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setCancelable(true);
alertBuilder.setTitle(Lang.Get("MSG_POST_NOTIFICATIONS_PERMISSION_TITLE"));
alertBuilder.setMessage(Lang.Get("MSG_POST_NOTIFICATIONS_PERMISSION_MSG"));
alertBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ActivityCompat.requestPermissions(CurrentActivity, new String[]{Manifest.permission.POST_NOTIFICATIONS}, POST_NOTIFICATIONS_PERMISSION);
}
});
AlertDialog alert = alertBuilder.create();
alert.show();
} else {
Session.CameraGranted = true;
}
}
}
}
/**
* Saves selected labor
*
* @param labor
*/
public void SelectLabor(Labor labor)
{
try
{
if(this.Settings == null)
{
this.Settings = new Settings();
this.Settings.lang = Lang.GetSystemLang();
}
this.Settings.labor = labor;
this.Settings.save(this);
this.GoToSplashScreen();
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "LaborActivity", "SelectLabor(Labor)");
}
}
/** Launches camera to get qr code **/
private final ActivityResultLauncher<ScanOptions> barcodeLauncher = registerForActivityResult(new ScanContract(),
result ->
{
try
{
if(result.getContents() != null)
{
String url = result.getContents().toString();
if(url != null && !url.isEmpty())
{
int indexOfId = url.lastIndexOf("id=");
if(indexOfId > 0)
{
String id = url.substring(indexOfId).replace("id=", "");
if(id != null && !id.isEmpty())
{
Labor labor = Labor.GetLaborByName(id);
if(labor != null)
{
this.SelectLabor(labor);
}
else
{
Toast.makeText(this, Lang.Get("ERROR_COULD_NOT_READ_QRCODE"), Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(this, Lang.Get("ERROR_COULD_NOT_READ_QRCODE"), Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(this, Lang.Get("ERROR_COULD_NOT_READ_QRCODE"), Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(this, Lang.Get("ERROR_COULD_NOT_READ_QRCODE"), Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(this, Lang.Get("ERROR_COULD_NOT_READ_QRCODE"), Toast.LENGTH_SHORT).show();
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "LaborActivity", "SelectLaborOverQRCode(Labor)");
}
});
/**
* Selects labor over QR-Code
*/
public void SelectLaborOverQRCode()
{
try
{
ScanOptions options = new ScanOptions();
options.setDesiredBarcodeFormats(ScanOptions.QR_CODE);
options.setBeepEnabled(false);
options.setBarcodeImageEnabled(true);
options.setOrientationLocked(true);
barcodeLauncher.launch(options);
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "LaborActivity", "SelectLaborOverQRCode(Labor)");
}
}
/**
* Goes to splash activity
*/
private void GoToSplashScreen()
{
Intent splashActivity = new Intent(this, SplashActivity.class);
splashActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(splashActivity);
overridePendingTransition(R.anim.side_in_right, R.anim.side_out_left);
finish();
}
@Override
public void onBackPressed()
{
if (Pager.getCurrentItem() == 0)
{
super.onBackPressed();
}
else
{
Pager.setCurrentItem(Pager.getCurrentItem() - 1);
}
}
/** Gots asked permission results **/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
{
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
/** got status of camera permission **/
if (requestCode == CAMERA_PERMISSION)
{
if (grantResults != null && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
{
Session.CameraGranted = true;
}
}
}
/** LaborCard Fragment **/
public static class LaborFragment extends Fragment
{
/** LaborActivity Context **/
private LaborActivity LaborActivity;
/** Labor object **/
private Labor Labor;
/** Constructor for labor fragment **/
public LaborFragment(Labor labor, LaborActivity laborActivity)
{
this.Labor = labor;
this.LaborActivity = laborActivity;
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_labor, container, false);
ImageView logo = view.findViewById(R.id.fragment_labor_icon);
logo.setImageResource(this.Labor.logo);
TextView name = view.findViewById(R.id.fragment_labor_name);
name.setText(this.Labor.name);
TextView street = view.findViewById(R.id.fragment_labor_street);
if(this.Labor.street != null && !this.Labor.street.isEmpty())
{
street.setText(this.Labor.street);
}
TextView city = view.findViewById(R.id.fragment_labor_city);
if(this.Labor.city != null && !this.Labor.city.isEmpty() && this.Labor.zip != null && !this.Labor.zip.isEmpty())
{
city.setText(this.Labor.zip + " " + this.Labor.city);
}
TextView tel = view.findViewById(R.id.fragment_labor_tel);
if(this.Labor.tel != null && !this.Labor.tel.isEmpty())
{
tel.setText(this.Labor.tel);
}
TextView web = view.findViewById(R.id.fragment_labor_web);
if(this.Labor.web != null && !this.Labor.web.isEmpty())
{
web.setText(this.Labor.web);
}
Button btnSelect = view.findViewById(R.id.fragment_labor_btnSelect);
btnSelect.setText(Lang.Get("BTN_SELECT"));
btnSelect.setOnClickListener(v -> { this.LaborActivity.SelectLabor(this.Labor); });
return view;
}
/** Creates a new instance of fragment **/
public static LaborFragment newInstance(Labor labor, LaborActivity laborActivity)
{
return new LaborFragment(labor, laborActivity);
}
}
/** Fragment to select a labor over qrcode **/
public static class LaborQRCodeSelectFragment extends Fragment
{
/** LaborActivity Context **/
private LaborActivity LaborActivity;
/** Constructor for labor fragment **/
public LaborQRCodeSelectFragment(LaborActivity laborActivity)
{
this.LaborActivity = laborActivity;
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_labor_qrcode_select, container, false);
ImageView buttonQRCodeScan = view.findViewById(R.id.fragment_labor_btn_qr_code);
TextView lblScanQrCode = view.findViewById(R.id.fragment_labor_lbl_scan_qr_code);
lblScanQrCode.setText(Lang.Get("LBL_SCAN_QR_CODE"));
TextView lblSelectManuel = view.findViewById(R.id.fragment_labor_lbl_select_manuel);
lblSelectManuel.setText(Lang.Get("LBL_SELECT_LABOR_MANUEL"));
buttonQRCodeScan.setOnClickListener(v -> { this.LaborActivity.SelectLaborOverQRCode(); } );
return view;
}
/** Creates a new instance of fragment **/
public static LaborQRCodeSelectFragment newInstance(LaborActivity laborActivity)
{
return new LaborQRCodeSelectFragment(laborActivity);
}
}
/** LaborSwitcher Adapter **/
private class LaborPagerAdapter extends FragmentPagerAdapter
{
/** List of labors**/
private List<Labor> Labors = null;
/** LaborActivity Context **/
private LaborActivity LaborActivity;
public LaborPagerAdapter(FragmentManager fragmentManager, List<Labor> labors, LaborActivity laborActivity)
{
super(fragmentManager);
this.Labors = labors;
this.LaborActivity = laborActivity;
}
@Override
public int getCount()
{
return 1;
}
@Override
public Fragment getItem(int position)
{
if(position == 0)
{
return LaborQRCodeSelectFragment.newInstance(this.LaborActivity);
}
else
{
return LaborFragment.newInstance(this.Labors.get(position - 1), this.LaborActivity);
}
}
}
}

View File

@ -0,0 +1,996 @@
//
// LoginActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 05.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputType;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.biometric.BiometricPrompt;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.Executor;
import de.labor_stein.befund.Core.Https.Request;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Database.Results;
import de.labor_stein.befund.Core.Models.Request.ChangeVerificatorHash;
import de.labor_stein.befund.Core.Models.Request.EncryptedRequest;
import de.labor_stein.befund.Core.Models.Request.GetPIN;
import de.labor_stein.befund.Core.Models.Response.PIN;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Curve25519;
import de.labor_stein.befund.Core.Security.SHA512;
import de.labor_stein.befund.Core.System;
public class LoginActivity extends AppCompatActivity
{
/** LoginActivityContext **/
private Context MainContext;
/** Layouts **/
private ConstraintLayout LoginActivityRootLayout;
/** Controls **/
private ImageView loginLaborLogo;
private EditText loginPasswordView_txtPassword;
private ImageView loginPasswordView_txtPasswordViewer;
private Button loginPasswordView_btnLogin;
private Button loginPasswordView_btnPasswordReset;
private Button loginPasswordView_btnSupport;
private TextView loginPasswordStatus;
private TextView LoginActivity_PrivacyPolicy;
/** BEGIN POPUPS **/
/** BEGIN Popup PrivacyPolicy **/
private PopupWindow PopupPrivacyPolicy;
private TextView PopupPrivacyPolicy_lblHeader;
private Button PopupPrivacyPolicy_btnAcceptPrivacyPolicy;
private WebView PopupPrivacyPolicy_web;
/** END Popup PrivacyPolicy **/
/** BEGIN PopupPasswordReset **/
private PopupWindow PopupPasswordReset;
private View PopupPasswordReset_Overlay;
private LinearLayout PopupPasswordReset_Popup;
private EditText PopupPasswordReset_txtPIN;
private EditText PopupPasswordReset_txtNewPassword;
private ImageView PopupPasswordReset_txtNewPasswordViewer;
private EditText PopupPasswordReset_txtPasswordConfirm;
private ImageView PopupPasswordReset_txtPasswordConfirmViewer;
private EditText PopupPasswordReset_txtNewPIN;
private TextView PopupPasswordReset_Status;
private ProgressBar PopupPasswordReset_Loading;
private Button PopupPasswordReset_BtnChange;
private Button PopupPasswordReset_BtnRequestPIN;
private Button PopupPasswordReset_BtnCancel;
/** END PopupPasswordReset **/
/** END POPUPS **/
/** Settings **/
private de.labor_stein.befund.Core.Models.Settings Settings;
/** Database Contexts **/
private de.labor_stein.befund.Core.Database.Results dbResults;
private de.labor_stein.befund.Core.Database.Logs dbLogs;
private boolean IsPasswordChanging = false;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
this.Initialize();
}
@Override
protected void onResume()
{
super.onResume();
this.InitializeLanguages();
}
/**
* Initialize LoginActivity Activity
*/
private void Initialize()
{
MainContext = this;
this.IsPasswordChanging = false;
this.dbResults = new de.labor_stein.befund.Core.Database.Results(this);
this.dbLogs = new de.labor_stein.befund.Core.Database.Logs(this);
Log.Initialize(this);
this.Settings = de.labor_stein.befund.Core.Models.Settings.load(this);
Log.Initialize(this);
this.InitializeControls();
this.InitializePopups();
this.InitializeLanguages();
}
private void InitializePopups()
{
this.InitializePopupPasswordReset();
}
/**
* Initializes Languages
*/
private void InitializeLanguages()
{
Lang.SetLanguage(this.Settings.lang);
PopupPasswordReset_txtPIN.setHint(Lang.Get("LBL_PIN"));
PopupPasswordReset_txtNewPassword.setHint(Lang.Get("LBL_NEW_PASSWORD"));
PopupPasswordReset_txtPasswordConfirm.setHint(Lang.Get("LBL_NEW_PASSWORD_CONFIRM"));
PopupPasswordReset_txtNewPIN.setHint(Lang.Get("LBL_NEW_PIN"));
PopupPasswordReset_BtnChange.setText(Lang.Get("BTN_CHANGE"));
PopupPasswordReset_BtnRequestPIN.setText(Lang.Get("BTN_PIN_REQUEST"));
PopupPasswordReset_BtnCancel.setText(Lang.Get("BTN_CANCEL"));
loginPasswordView_txtPassword.setHint(Lang.Get("LBL_PASSWORD"));
loginPasswordView_btnPasswordReset.setText(Lang.Get("BTN_FORGOT"));
loginPasswordView_btnSupport.setText(Lang.Get("BTN_SUPPORT"));
loginPasswordView_btnLogin.setText(Lang.Get("BTN_LOGIN"));
LoginActivity_PrivacyPolicy.setText(Lang.Get("BTN_PRIVACY_POLICY"));
}
/**
* INitializes Controls
*/
private void InitializeControls()
{
LoginActivityRootLayout = findViewById(R.id.LoginActivityRootLayout);
loginPasswordView_txtPassword = findViewById(R.id.loginPasswordView_txtPassword);
loginPasswordView_txtPasswordViewer = findViewById(R.id.loginPasswordView_txtPasswordViewer);
loginPasswordView_btnPasswordReset = findViewById(R.id.loginPasswordView_btnPasswordReset);
loginPasswordView_btnSupport = findViewById(R.id.loginPasswordView_btnSupport);
loginPasswordView_btnLogin = findViewById(R.id.loginPasswordView_btnLogin);
loginPasswordStatus = findViewById(R.id.loginPasswordStatus);
loginLaborLogo = findViewById(R.id.loginLaborLogo);
loginLaborLogo.setVisibility(View.VISIBLE);
loginLaborLogo.setImageResource(Settings.labor.logo);
loginPasswordView_btnLogin.setOnClickListener(v -> { this.loginPasswordView_btnLogin_Click(); });
loginPasswordView_txtPassword.setOnKeyListener(new View.OnKeyListener()
{
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if(keyCode == KeyEvent.KEYCODE_ENTER)
{
loginPasswordView_btnLogin_Click();
}
return false;
}
});
loginPasswordView_btnSupport.setOnClickListener(v -> { this.GoToSupportActivity(); });
/** Password Viewers **/
loginPasswordView_txtPasswordViewer.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
if (event.getAction() == android.view.MotionEvent.ACTION_DOWN)
{
loginPasswordView_txtPasswordViewer.setAlpha(1.0f);
loginPasswordView_txtPassword.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
loginPasswordView_txtPassword.setSelection(loginPasswordView_txtPassword.getText().length());
}
else if (event.getAction() == android.view.MotionEvent.ACTION_UP)
{
loginPasswordView_txtPasswordViewer.setAlpha(0.5f);
loginPasswordView_txtPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
loginPasswordView_txtPassword.setSelection(loginPasswordView_txtPassword.getText().length());
}
return true;
}
});
LoginActivity_PrivacyPolicy = LoginActivityRootLayout.findViewById(R.id.LoginActivity_PrivacyPolicy);
LoginActivity_PrivacyPolicy.setVisibility(View.INVISIBLE);
// LoginActivity_PrivacyPolicy.setOnClickListener(new View.OnClickListener()
// {
// @Override
// public void onClick(View v) {
// ShowPrivacyPolicy();
// }
// });
}
/** Shows privacy policy popup**/
private void ShowPrivacyPolicy()
{
this.InitializePrivacyPolicyPopup();
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setText(Lang.Get("BTN_CLOSE"));
this.LoadPrivacyPolicy();
}
/**
* Initializes PrivacyPolicy Popup
*/
private void InitializePrivacyPolicyPopup()
{
Lang.SetLanguage(Lang.GetSystemLang());
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View PopupPrivacyPolicyView = inflater.inflate(R.layout.popup_privacy_policy, null);
PopupPrivacyPolicy_lblHeader = PopupPrivacyPolicyView.findViewById(R.id.PopupPrivacyPolicy_lblHeader);
PopupPrivacyPolicy_btnAcceptPrivacyPolicy = PopupPrivacyPolicyView.findViewById(R.id.PopupPrivacyPolicy_btnAccept);
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setEnabled(false);
PopupPrivacyPolicy_lblHeader.setText(Lang.Get("LBL_PRIVACY_POLICY"));
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setText(Lang.Get("BTN_ACCEPT_PRIVACY_POLICY"));
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setOnClickListener((v) ->
{
PopupPrivacyPolicy.dismiss();
});
/** Create popup window context **/
PopupPrivacyPolicy = new PopupWindow(
PopupPrivacyPolicyView,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
true
);
PopupPrivacyPolicy_web = PopupPrivacyPolicyView.findViewById(R.id.PopupPrivacyPolicy_web);
this.LoginActivityRootLayout.post(new Runnable()
{
public void run()
{
LoadPrivacyPolicy();
PopupPrivacyPolicy.showAtLocation(LoginActivityRootLayout, Gravity.CENTER,0,0);
}
});
}
/**
* Load PrivacyPolicy
*/
private void LoadPrivacyPolicy()
{
try
{
/** Run request on sub thread **/
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
Request.GetResponseAsync(Settings.GetPrivacyPolicyURL(),
"GET",
(content) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PopupPrivacyPolicy_web.loadUrl(Settings.GetPrivacyPolicyURL());
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setEnabled(true);
}
});
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setEnabled(true);
byte[] local_privacy_policy_data = System.ReadFromAssets("no_connection.html", MainContext);
if(local_privacy_policy_data != null && local_privacy_policy_data.length > 0)
{
String html = new String(local_privacy_policy_data);
html = html.replace("[NO_CONNECTION]", Lang.Get("ERROR_PRIVACY_POLICY_NEEDS_CONNECTION"));
PopupPrivacyPolicy_web.loadData(html, "text/html", "utf-8");
}
}
});
});
}
});
thread.start();
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "LoginActivity", "LoadPrivacyPolicy");
}
}
/**
* Initializes PopupPasswordReset Popup
*/
private void InitializePopupPasswordReset()
{
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
PopupPasswordReset_Overlay = inflater.inflate(R.layout.popup_password_reset, null);
PopupPasswordReset_Popup = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_Popup);
PopupPasswordReset_txtPIN = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_txtPIN);
PopupPasswordReset_txtNewPassword = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_txtNewPassword);
PopupPasswordReset_txtNewPasswordViewer = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_txtNewPasswordViewer);
PopupPasswordReset_txtPasswordConfirm = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_txtPasswordConfirm);
PopupPasswordReset_txtPasswordConfirmViewer = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_txtPasswordConfirmViewer);
PopupPasswordReset_txtNewPIN = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_txtNewPIN);
PopupPasswordReset_BtnChange = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_BtnChange);
PopupPasswordReset_BtnRequestPIN = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_BtnRequestPIN);
PopupPasswordReset_BtnCancel = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_BtnCancel);
PopupPasswordReset_Status = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_Status);
PopupPasswordReset_Loading = PopupPasswordReset_Overlay.findViewById(R.id.PopupPasswordReset_Loading);
PopupPasswordReset_Loading.setVisibility(View.INVISIBLE);
PopupPasswordReset_BtnChange.setOnClickListener(v -> { this.ChangePassword(); });
PopupPasswordReset_BtnRequestPIN.setOnClickListener(v -> { this.RequestPIN(); });
loginPasswordView_btnPasswordReset.setOnClickListener(v -> { this.PopupPasswordReset_Show(); });
PopupPasswordReset_BtnCancel.setOnClickListener(v -> { this.PopupPasswordReset_Hide(); });
PopupPasswordReset_txtNewPassword.setOnFocusChangeListener((View v, boolean hasFocus) -> { if(hasFocus) { PopupPasswordReset_HideLoading(Lang.Get("ERROR_ENTER_STRONG_PASSWORD")); } });
PopupPasswordReset_txtPIN.setOnFocusChangeListener((View v, boolean hasFocus) -> { if(hasFocus) { PopupPasswordReset_HideLoading(Lang.Get("ERROR_PIN_LENGTH")); } });
PopupPasswordReset_txtNewPIN.setOnFocusChangeListener((View v, boolean hasFocus) -> { if(hasFocus) { PopupPasswordReset_HideLoading(Lang.Get("ERROR_PIN_LENGTH")); } });
/** Create popup window context **/
PopupPasswordReset = new PopupWindow(
PopupPasswordReset_Overlay,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
true
);
/** Password Viewers **/
PopupPasswordReset_txtNewPasswordViewer.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
if (event.getAction() == android.view.MotionEvent.ACTION_DOWN)
{
PopupPasswordReset_txtNewPasswordViewer.setAlpha(1.0f);
PopupPasswordReset_txtNewPassword.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
PopupPasswordReset_txtNewPassword.setSelection(PopupPasswordReset_txtNewPassword.getText().length());
}
else if (event.getAction() == android.view.MotionEvent.ACTION_UP)
{
PopupPasswordReset_txtNewPasswordViewer.setAlpha(0.5f);
PopupPasswordReset_txtNewPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
PopupPasswordReset_txtNewPassword.setSelection(PopupPasswordReset_txtNewPassword.getText().length());
}
return true;
}
});
PopupPasswordReset_txtPasswordConfirmViewer.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
if (event.getAction() == android.view.MotionEvent.ACTION_DOWN)
{
PopupPasswordReset_txtPasswordConfirmViewer.setAlpha(1.0f);
PopupPasswordReset_txtPasswordConfirm.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
PopupPasswordReset_txtPasswordConfirm.setSelection(PopupPasswordReset_txtPasswordConfirm.getText().length());
}
else if (event.getAction() == android.view.MotionEvent.ACTION_UP)
{
PopupPasswordReset_txtPasswordConfirmViewer.setAlpha(0.5f);
PopupPasswordReset_txtPasswordConfirm.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
PopupPasswordReset_txtPasswordConfirm.setSelection(PopupPasswordReset_txtPasswordConfirm.getText().length());
}
return true;
}
});
}
/**
* Show PopupPasswordReset
*/
private void PopupPasswordReset_Show()
{
PopupPasswordReset_txtPIN.setText("");
PopupPasswordReset_txtNewPassword.setText("");
PopupPasswordReset_txtPasswordConfirm.setText("");
PopupPasswordReset_txtNewPIN.setText("");
PopupPasswordReset_Status.setText("");
PopupPasswordReset_Loading.setVisibility(View.INVISIBLE);
PopupPasswordReset_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_in));
PopupPasswordReset_Popup.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_in));
if(!PopupPasswordReset.isShowing())
{
PopupPasswordReset.showAtLocation(LoginActivityRootLayout, Gravity.CENTER,0,0);
}
if(!BiometricAuthenticationSupported())
{
PopupPasswordReset_BtnRequestPIN.setVisibility(View.INVISIBLE);
}
}
/**
* Hide PopupPasswordReset
*/
private void PopupPasswordReset_Hide()
{
PopupPasswordReset_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_out));
PopupPasswordReset_Popup.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_out));
if(PopupPasswordReset.isShowing())
{
Animation anim = AnimationUtils.loadAnimation(this, R.anim.popup_out);
anim.setAnimationListener(new Animation.AnimationListener()
{
@Override
public void onAnimationStart(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation)
{
PopupPasswordReset.dismiss();
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
anim.setFillAfter(true);
PopupPasswordReset_Popup.startAnimation(anim);
}
}
/** BEGIN FUNCTIONS **/
/** Hide PopupPasswordReset Loading with optional status message **/
private void PopupPasswordReset_HideLoading(String message)
{
PopupPasswordReset_Loading.setVisibility(View.INVISIBLE);
if(message != null && !message.isEmpty())
{
PopupPasswordReset_Status.setText(message);
}
}
/**
* Changes password with pin
* */
private void ChangePassword()
{
try
{
PopupPasswordReset_Status.setText("");
if(!this.IsPasswordChanging)
{
this.IsPasswordChanging = true;
PopupPasswordReset_Loading.setVisibility(View.VISIBLE);
if(PopupPasswordReset_txtPIN.getText() == null || PopupPasswordReset_txtPIN.getText().toString().isEmpty())
{
this.IsPasswordChanging = false;
PopupPasswordReset_HideLoading(Lang.Get("ERROR_ENTER_YOUR_PIN"));
}
else if(PopupPasswordReset_txtPIN.getText().toString().length() != 5)
{
this.IsPasswordChanging = false;
PopupPasswordReset_HideLoading(Lang.Get("ERROR_PIN_LENGTH"));
}
else
{
String pin = PopupPasswordReset_txtPIN.getText().toString();
String old_password = AES.Decrypt(this.Settings.password_hash, AES.GetKey(this.Settings.password_reset_hash + pin));
if(old_password != null)
{
String password_policy = "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!+@$%^&<>*~:`-]).{8,}$";
if(!PopupPasswordReset_txtNewPassword.getText().toString().matches(password_policy))
{
this.IsPasswordChanging = false;
PopupPasswordReset_HideLoading(Lang.Get("ERROR_ENTER_STRONG_PASSWORD"));
}
else if(!PopupPasswordReset_txtNewPassword.getText().toString().equals(PopupPasswordReset_txtPasswordConfirm.getText().toString()))
{
this.IsPasswordChanging = false;
PopupPasswordReset_HideLoading(Lang.Get("ERROR_CONFIRM_PASSWORD"));
}
else if(PopupPasswordReset_txtNewPIN.getText() == null || PopupPasswordReset_txtNewPIN.getText().toString().isEmpty())
{
this.IsPasswordChanging = false;
PopupPasswordReset_HideLoading(Lang.Get("ERROR_ENTER_NEW_PIN"));
}
else if(PopupPasswordReset_txtNewPIN.getText().toString().length() != 5)
{
this.IsPasswordChanging = false;
PopupPasswordReset_HideLoading(Lang.Get("ERROR_PIN_LENGTH"));
}
else
{
String new_password = PopupPasswordReset_txtNewPassword.getText().toString();
String decrypted_private_key = AES.Decrypt(Settings.hashed_private_key, AES.GetKey(old_password));
Curve25519.KeyPair requestKeyPair = Curve25519.GenerateKeyPair();
byte[] key = AES.GetKey(new_password);
ChangeVerificatorHash changeVerificatorHash = new ChangeVerificatorHash();
changeVerificatorHash.old_verificator_hash = Settings.verificator_hash;
changeVerificatorHash.new_verificator_hash = SHA512.HMAC(SHA512.VerificatorHashingValue, key);
changeVerificatorHash.udid = Settings.udid;
changeVerificatorHash.pin = PopupPasswordReset_txtNewPIN.getText().toString();
PopupPasswordReset_Status.setText("");
/** Run request on sub thread **/
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
/** Update verificator_hash & pin on the server **/
Request.KeyExchangeAsync(Settings.labor.host,
requestKeyPair,
(publicKey) ->
{
byte[] sharedKey = requestKeyPair.GetSharedKey(publicKey.key);
EncryptedRequest request = new EncryptedRequest("ChangeVerificatorHash", changeVerificatorHash, sharedKey);
Request.EncryptedRequestAsync(Settings.labor.host,
"results",
"update_verificator_hash",
request,
publicKey,
requestKeyPair,
(encryptedResponse) ->
{
encryptedResponse.Decrypt(sharedKey);
if(encryptedResponse.descriptor.toLowerCase().equals("success"))
{
try
{
List<Results> results = dbResults.GetResults();
/** decrypt & encrypt old results by new password **/
if(results != null && results.size() > 0)
{
for(int i = 0; i < results.size(); i++)
{
Results res = results.get(i);
String file = System.GetPathForStorageEncryptedFile(res.pgs, MainContext);
if(file != null && System.FileExists(file))
{
byte[] encrypted_content = System.ReadFromEncryptedStorage(res.pgs, MainContext);
if(encrypted_content != null && encrypted_content.length > 0)
{
String decrypted_content = AES.Decrypt(new String(encrypted_content), AES.GetKey(old_password));
if(decrypted_content != null)
{
String local_encrypted = AES.Encrypt(decrypted_content, AES.GetKey(new_password));
if(local_encrypted != null)
{
System.WriteToEncryptedStorage(res.pgs, local_encrypted.getBytes(StandardCharsets.UTF_8), MainContext);
}
}
}
}
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getMessage(), "LoginActivity", "Thread change encryption");
}
/** Run on main Thread **/
runOnUiThread(new Runnable()
{
@Override
public void run()
{
/** update settings **/
byte[] key = AES.GetKey(new_password);
Settings.password_reset_hash = UUID.randomUUID().toString();
byte[] passwordHashKey = AES.GetKey(Settings.password_reset_hash + changeVerificatorHash.pin);
Settings.password_hash = AES.Encrypt(new_password, passwordHashKey);
Settings.verificator_hash = SHA512.HMAC(SHA512.VerificatorHashingValue, key);
Settings.hashed_private_key = AES.Encrypt(decrypted_private_key, key);
Settings.save(MainContext);
Session.DevicePassword = new_password;
PopupPasswordReset_Hide();
String msg = Lang.Get("MSG_PASSWORD_HAS_BEEN_CHANGED");
ShowAlert(msg);
}
});
}
else
{
/** Run on main Thread **/
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PopupPasswordReset_HideLoading(Lang.Get("ERROR_COULD_NOT_CHANGE_PASSWORD"));
Log.Error("Could not update verificator_hash & pin on the server", "LoginActivity", "RequestPINFromServer");
}
});
}
IsPasswordChanging = false;
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
IsPasswordChanging = false;
PopupPasswordReset_HideLoading(error);
Log.Critical(error, "LoginActivity", "ChangePassword");
}
});
});
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
IsPasswordChanging = false;
PopupPasswordReset_HideLoading(error);
Log.Critical(error, "LoginActivity", "ChangePassword");
}
});
});
}
});
thread.start();
}
}
else
{
PopupPasswordReset_HideLoading(Lang.Get("ERROR_INVALID_PASSWORD_RESET_PIN"));
IsPasswordChanging = false;
}
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "LoginActivity", "ChangePassword");
IsPasswordChanging = false;
}
}
/**
* Checks if biometrical authentication is available
*
* @return returns true if available
*/
public boolean BiometricAuthenticationSupported()
{
boolean result = false;
try
{
androidx.biometric.BiometricManager biometricManager = androidx.biometric.BiometricManager.from(this);
switch(biometricManager.canAuthenticate())
{
case androidx.biometric.BiometricManager.BIOMETRIC_SUCCESS:
result = true;
break;
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "LoginActivity", "BiometricAuthenticationSupported");
}
return result;
}
/**
* Request PIN from the server
*
* User has to authentificate by biometric
*/
private void RequestPIN()
{
try
{
PopupPasswordReset_Status.setText("");
Executor executor = ContextCompat.getMainExecutor(this);
BiometricPrompt biometricPrompt = new BiometricPrompt(LoginActivity.this, executor, new BiometricPrompt.AuthenticationCallback()
{
@Override
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString)
{
super.onAuthenticationError(errorCode, errString);
PopupPasswordReset_HideLoading("" + errString);
}
@Override
public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result)
{
super.onAuthenticationSucceeded(result);
RequestPINFromServer();
}
@Override
public void onAuthenticationFailed()
{
super.onAuthenticationFailed();
PopupPasswordReset_HideLoading(Lang.Get("ERROR_BIOMETRICAL_AUTHENTIFICATION_COULD_NOT_ACTIVATED"));
}
});
BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder()
.setTitle(Lang.Get("LBL_BIOMETRICAL_AUTHENTIFICATION"))
.setNegativeButtonText(Lang.Get("BTN_CANCEL"))
.build();
biometricPrompt.authenticate(promptInfo);
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "MainActivity", "RequestPIN");
}
}
/**
* Send server request for PIN
*/
private void RequestPINFromServer()
{
try
{
PopupPasswordReset_Loading.setVisibility(View.VISIBLE);
Curve25519.KeyPair requestKeyPair = Curve25519.GenerateKeyPair();
/** Run request on sub thread **/
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
Request.KeyExchangeAsync(Settings.labor.host,
requestKeyPair,
(publicKey) ->
{
GetPIN getPIN = new GetPIN();
getPIN.udid = Settings.udid;
getPIN.verificator_hash = Settings.verificator_hash;
byte[] sharedKey = requestKeyPair.GetSharedKey(publicKey.key);
EncryptedRequest request = new EncryptedRequest("PIN", getPIN, sharedKey);
Request.EncryptedRequestAsync(Settings.labor.host,
"results",
"pin",
request,
publicKey,
requestKeyPair,
(encryptedResponse) ->
{
Object response = encryptedResponse.Decrypt(sharedKey);
/** Run on main Thread **/
runOnUiThread(new Runnable()
{
@Override
public void run()
{
if(response != null)
{
try
{
PIN pin = (PIN)response;
if(pin != null && pin.code != null && !pin.code.isEmpty())
{
PopupPasswordReset_HideLoading("");
PopupPasswordReset_txtPIN.setText(pin.code);
}
else
{
PopupPasswordReset_HideLoading(Lang.Get("ERROR_COULD_NOT_GET_PIN"));
Log.Error("Could not get pin from the server", "LoginActivity", "RequestPINFromServer");
}
}
catch (Exception ex)
{
PopupPasswordReset_HideLoading(Lang.Get("ERROR_COULD_NOT_GET_PIN"));
Log.Error(ex.getMessage(), "LoginActivity", "RequestPINFromServer");
}
}
else
{
PopupPasswordReset_HideLoading(Lang.Get("ERROR_COULD_NOT_GET_PIN"));
Log.Error("Could not get pin from the server", "LoginActivity", "RequestPINFromServer");
}
}
});
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PopupPasswordReset_HideLoading(error);
Log.Critical(error, "LoginActivity", "RequestPINFromServer");
}
});
});
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PopupPasswordReset_HideLoading(error);
Log.Critical(error, "LoginActivity", "RequestPINFromServer");
}
});
});
}
});
thread.start();
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "LoginActivity", "RequestPINFromServer");
}
}
/**
* Do user login
*/
private void loginPasswordView_btnLogin_Click()
{
try
{
loginPasswordStatus.setText("");
if(loginPasswordView_txtPassword.getText() == null || loginPasswordView_txtPassword.getText().toString().isEmpty())
{
loginPasswordStatus.setText(Lang.Get("ERROR_INVALID_PASSWORD"));
}
else
{
String password = loginPasswordView_txtPassword.getText().toString();
String tmp_encrypt_key = AES.Decrypt(Settings.hashed_private_key, AES.GetKey(password));
if(tmp_encrypt_key == null)
{
loginPasswordStatus.setText(Lang.Get("ERROR_INVALID_PASSWORD"));
}
else
{
Session.DevicePassword = password;
this.GoToMainActivity();
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "LoginActivity", "loginPasswordView_btnLogin_Click");
}
}
/**
* Go Back to MainActivity
*/
private void GoToMainActivity()
{
Intent intent = new Intent(this, MainActivity.class );
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Bundle parameters = new Bundle();
parameters.putBoolean("SplashScreenLoaded", true);
intent.putExtras(parameters);
startActivity(intent);
overridePendingTransition(R.anim.side_in_left, R.anim.side_out_right);
}
/**
* Goes to SupportActivity
*/
private void GoToSupportActivity()
{
Intent supportActivity = new Intent(this, SupportActivity.class);
startActivity(supportActivity);
overridePendingTransition(R.anim.side_in_right, R.anim.side_out_left);
}
/**
* Shows message as alert dialog with ok button
* @param msg - message that should be showed in alert dialog
*/
private void ShowAlert(String msg)
{
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
dlgAlert.setMessage(msg);
dlgAlert.setPositiveButton("OK", null);
dlgAlert.setCancelable(true);
dlgAlert.create().show();
}
/** END FUNCTIONS **/
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,354 @@
//
// NewOEGDActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 02.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.gson.Gson;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
import de.labor_stein.befund.Core.Helpers.DateHelper;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.OEGD;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.System;
public class NewOEGDActivity extends AppCompatActivity
{
/** NewOEGDActivityContext **/
private Context MainContext;
/** Layouts **/
private CoordinatorLayout ActivityRootLayout;
/** Controls **/
private TextView lblNewOEGD;
private TextView NewOEGDActivitylblButtonBack;
private EditText NewOEGDActivity_txtTitle;
private EditText NewOEGDActivity_txtFirstname;
private EditText NewOEGDActivity_txtLastname;
private EditText NewOEGDActivity_txtAdditionLastname;
private EditText NewOEGDActivity_txtPrefix;
private Spinner NewOEGDActivity_txtGenders;
private EditText NewOEGDActivity_txtBirthday;
private DatePickerDialog BirthdayPicker;
private EditText NewOEGDActivity_txtStreet;
private EditText NewOEGDActivity_txtZIP;
private EditText NewOEGDActivity_txtCity;
private EditText NewOEGDActivity_txtTelefon;
private Button NewOEGDActivity_btnCreate;
private TextView NewOEGDActivity_Status;
/** Buttons **/
private FloatingActionButton OEGDButtonBack;
/** List items **/
private String[] Genders = { Lang.Get("LBL_GENDER"), Lang.Get("LBL_GENDER_M"), Lang.Get("LBL_GENDER_W"), Lang.Get("LBL_GENDER_D"), Lang.Get("LBL_GENDER_X") };
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_oegd);
this.Initialize();
}
/**
* Initializes eIDActivity
*/
private void Initialize()
{
MainContext = this;
Log.Initialize(this);
this.InitializeLayouts();
this.InitializeLabels();
this.InitializeButtons();
this.InitializeControls();
this.InitializeLanguages();
}
/**
* Initializes Languages
*/
private void InitializeLanguages()
{
lblNewOEGD.setText(Lang.Get("LBL_NEW_OEGD"));
NewOEGDActivitylblButtonBack.setText(Lang.Get("BTN_BACK"));
NewOEGDActivity_txtTitle.setHint(Lang.Get("LBL_TITLE"));
NewOEGDActivity_txtFirstname.setHint(Lang.Get("LBL_FIRSTNAME"));
NewOEGDActivity_txtLastname.setHint(Lang.Get("LBL_LASTNAME"));
NewOEGDActivity_txtAdditionLastname.setHint(Lang.Get("LBL_ADDITION_NAME"));
NewOEGDActivity_txtPrefix.setHint(Lang.Get("LBL_NAME_PREFIX"));
NewOEGDActivity_txtBirthday.setHint(Lang.Get("LBL_BIRTHDAY"));
NewOEGDActivity_txtStreet.setHint(Lang.Get("LBL_STREET"));
NewOEGDActivity_txtZIP.setHint(Lang.Get("LBL_ZIP"));
NewOEGDActivity_txtCity.setHint(Lang.Get("LBL_CITY"));
NewOEGDActivity_txtTelefon.setHint(Lang.Get("LBL_TELEFON"));
NewOEGDActivity_btnCreate.setText(Lang.Get("BTN_CREATE"));
}
/**
* Initializes controls
*/
private void InitializeControls()
{
NewOEGDActivity_btnCreate = findViewById(R.id.NewOEGDActivity_btnCreate);
NewOEGDActivity_txtTitle = findViewById(R.id.NewOEGDActivity_txtTitle);
NewOEGDActivity_txtFirstname = findViewById(R.id.NewOEGDActivity_txtFirstname);
NewOEGDActivity_txtLastname = findViewById(R.id.NewOEGDActivity_txtLastname);
NewOEGDActivity_txtAdditionLastname = findViewById(R.id.NewOEGDActivity_txtAdditionLastname);
NewOEGDActivity_txtPrefix = findViewById(R.id.NewOEGDActivity_txtPrefix);
NewOEGDActivity_txtGenders = findViewById(R.id.NewOEGDActivity_txtGenders);
NewOEGDActivity_txtBirthday = findViewById(R.id.NewOEGDActivity_txtBirthday);
NewOEGDActivity_txtStreet = findViewById(R.id.NewOEGDActivity_txtStreet);
NewOEGDActivity_txtZIP = findViewById(R.id.NewOEGDActivity_txtZIP);
NewOEGDActivity_txtCity = findViewById(R.id.NewOEGDActivity_txtCity);
NewOEGDActivity_txtTelefon = findViewById(R.id.NewOEGDActivity_txtTelefon);
NewOEGDActivity_Status = findViewById(R.id.NewOEGDActivity_Status);
ArrayAdapter aa = new ArrayAdapter(this, android.R.layout.simple_spinner_item, this.Genders);
aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
NewOEGDActivity_txtGenders.setAdapter(aa);
/** DatePicker **/
BirthdayPicker = new DatePickerDialog(this, R.style.MySpinnerDatePickerStyle);
BirthdayPicker.getDatePicker().setMaxDate(new Date().getTime());
BirthdayPicker.setOnDateSetListener(new DatePickerDialog.OnDateSetListener()
{
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth)
{
Date selectedDate = DateHelper.getDateFromDatePicket(BirthdayPicker.getDatePicker());
if(selectedDate != null)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
NewOEGDActivity_txtBirthday.setText(dateFormat.format(selectedDate));
}
}
});
/** Disable directly key insert in the birthday field(it should be set by DatePicker for well formed value) **/
NewOEGDActivity_txtBirthday.setOnKeyListener((View v, int keyCode, KeyEvent event) -> { return true; });
/** Show/Hide DatePicker **/
NewOEGDActivity_txtBirthday.setOnFocusChangeListener((View v, boolean hasFocus) -> { if(hasFocus) { BirthdayPicker.show(); } });
NewOEGDActivity_txtBirthday.setOnTouchListener((View v, MotionEvent event) -> { BirthdayPicker.show(); return true; });
NewOEGDActivity_btnCreate.setOnClickListener(v -> { this.NewOEGDActivity_btnCreate_Click(); });
//NewOEGDActivity_btnAcceptCWAPolicy.setOnClickListener((v) -> { PopupCWAPolicy.showAtLocation(ActivityRootLayout, Gravity.CENTER,0,0);});
}
/**
* Initialize Layouts
*/
private void InitializeLayouts()
{
ActivityRootLayout = (CoordinatorLayout)findViewById(R.id.NewOEGDActivityRootLayout);
}
/**
* Initializes Labels
*/
private void InitializeLabels()
{
lblNewOEGD = ActivityRootLayout.findViewById(R.id.lblNewOEGD);
NewOEGDActivitylblButtonBack = ActivityRootLayout.findViewById(R.id.NewOEGDActivitylblButtonBack);
}
/**
* Initializes Buttons
*/
private void InitializeButtons()
{
OEGDButtonBack = ActivityRootLayout.findViewById(R.id.OEGDButtonBack);
OEGDButtonBack.setOnClickListener(v ->{ OEGDButtonBack_Click(); });
}
/**
* Go Back to OEGDActivity
*/
private void OEGDButtonBack_Click()
{
Intent intent = new Intent(this, OEGDActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.side_in_left, R.anim.side_out_right);
}
/**
* Creates a new OEGD
*/
private void NewOEGDActivity_btnCreate_Click()
{
try
{
NewOEGDActivity_Status.setText("");
if(NewOEGDActivity_txtFirstname.getText() == null || NewOEGDActivity_txtFirstname.getText().toString().isEmpty())
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_FIRSTNAME"));
}
else if(NewOEGDActivity_txtLastname.getText() == null || NewOEGDActivity_txtLastname.getText().toString().isEmpty())
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_LASTNAME"));
}
else if(NewOEGDActivity_txtBirthday.getText() == null || NewOEGDActivity_txtBirthday.getText().toString().isEmpty())
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_BIRTHDAY"));
}
else if(NewOEGDActivity_txtGenders.getSelectedItemPosition() <= 0)
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_GENDER"));
}
else if(NewOEGDActivity_txtStreet.getText() == null || NewOEGDActivity_txtStreet.getText().toString().isEmpty())
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_STREET"));
}
else if(NewOEGDActivity_txtZIP.getText() == null || NewOEGDActivity_txtZIP.getText().toString().isEmpty())
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_ZIP"));
}
else if(NewOEGDActivity_txtCity.getText() == null || NewOEGDActivity_txtCity.getText().toString().isEmpty())
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_ENTER_CITY"));
}
else
{
OEGD oegd = new OEGD();
oegd.first_name = NewOEGDActivity_txtFirstname.getText().toString();
oegd.last_name = NewOEGDActivity_txtLastname.getText().toString();
Date selectedDate = DateHelper.getDateFromDatePicket(BirthdayPicker.getDatePicker());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
oegd.birthdate = dateFormat.format(selectedDate);
int genderIndex = (int)NewOEGDActivity_txtGenders.getSelectedItemId();
String gender_full_name = Genders[genderIndex];
if(gender_full_name.equals(Lang.Get("LBL_GENDER_M")))
{
oegd.gender = "M";
}
else if(gender_full_name.equals(Lang.Get("LBL_GENDER_W")))
{
oegd.gender = "W";
}
else if(gender_full_name.equals(Lang.Get("LBL_GENDER_D")))
{
oegd.gender = "D";
}
else
{
oegd.gender = "X";
}
if(NewOEGDActivity_txtTitle.getText() != null && !NewOEGDActivity_txtTitle.getText().toString().isEmpty())
{
oegd.title = NewOEGDActivity_txtTitle.getText().toString();
}
if(NewOEGDActivity_txtAdditionLastname.getText() != null && !NewOEGDActivity_txtAdditionLastname.getText().toString().isEmpty())
{
oegd.name_addition = NewOEGDActivity_txtAdditionLastname.getText().toString();
}
if(NewOEGDActivity_txtPrefix.getText() != null && !NewOEGDActivity_txtPrefix.getText().toString().isEmpty())
{
oegd.prefix = NewOEGDActivity_txtPrefix.getText().toString();
}
oegd.address = OEGD.Address.createInstance();
oegd.address.zip_code = NewOEGDActivity_txtZIP.getText().toString();
oegd.address.city = NewOEGDActivity_txtCity.getText().toString();
oegd.address.street_number = NewOEGDActivity_txtStreet.getText().toString();
oegd.address.country_code = "D";
if(NewOEGDActivity_txtTelefon.getText() != null && !NewOEGDActivity_txtTelefon.getText().toString().isEmpty())
{
oegd.phone = NewOEGDActivity_txtTelefon.getText().toString();
}
String json = new Gson().toJson(oegd);
if(json != null)
{
String encrypted_content = AES.Encrypt(json, AES.GetKey(Session.DevicePassword));
if(encrypted_content != null)
{
SimpleDateFormat dF = new SimpleDateFormat("yyyyMMdd_HH_mm_ss");
String filename = dF.format(new Date()) + "_" + UUID.randomUUID().toString().replace("-", "") + ".oegd";
if(System.WriteToStorage(filename, encrypted_content.getBytes(StandardCharsets.UTF_8), this))
{
GoToOEGDActivity();
}
else
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_COULD_NOT_SAVE_OEGD"));
}
}
else
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_COULD_NOT_SAVE_OEGD"));
}
}
else
{
NewOEGDActivity_Status.setText(Lang.Get("ERROR_COULD_NOT_SAVE_OEGD"));
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "NewOEGDActivity", "NewOEGDActivity_btnCreate_Click");
}
}
/**
* Goes back to OEGDActivity
*/
private void GoToOEGDActivity()
{
Intent OEGDActivity = new Intent(this, OEGDActivity.class);
startActivity(OEGDActivity);
overridePendingTransition(R.anim.side_in_left, R.anim.side_out_right);
}
}

View File

@ -0,0 +1,717 @@
//
// OEGDActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 02.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.gson.Gson;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import de.labor_stein.befund.Core.Helpers.ImageHelper;
import de.labor_stein.befund.Core.Https.Request;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Database.Status;
import de.labor_stein.befund.Core.Models.Labor;
import de.labor_stein.befund.Core.Models.OEGD;
import de.labor_stein.befund.Core.Models.OEGDFile;
import de.labor_stein.befund.Core.Models.Request.EncryptedRequest;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.System;
public class OEGDActivity extends AppCompatActivity
{
/** OEGDActivityContext **/
private Context MainContext;
/** Layouts **/
private CoordinatorLayout ActivityRootLayout;
/** Controls **/
private TextView lblOEGD;
private TextView lblOEGDButtonButtonBack;
private TextView lblNoOEGD;
private ProgressBar OEGDMainLoading;
/** Buttons **/
private FloatingActionButton OEGDButtonBack;
private Button bottomOEGDButtonMenuOpener;
/** BEGIN POPUPS **/
/** BEGIN OptionsPopup **/
private PopupWindow OEGDOptionsOptions;
private View OEGDOptionsOptions_Overlay;
private LinearLayout OEGDOptionsOptions_Popup;
private Button OEGDOptionsOptions_BtnAdd;
private LinearLayout OEGDOptionsEditView;
private Button OEGDOptionsOptions_BtnEdit;
private LinearLayout OEGDOptionsDeleteView;
private Button OEGDOptionsOptions_BtnDelete;
private Button OEGDOptionsOptions_BtnCancel;
/** END OptionsPopup **/
/** BEGIN ConfirmDeletePopup **/
private PopupWindow ConfirmDeletePopup;
private View ConfirmDeletePopup_Overlay;
private LinearLayout ConfirmDeletePopup_Popup;
private TextView PopupConfirmDelete_text;
private Button ConfirmDeletePopup_BtnYES;
private Button ConfirmDeletePopup_BtnNO;
/** END ConfirmDeletePopup **/
/** END POPUPS **/
/** OEGDs **/
private List<OEGDFile> OEGDFiles;
private OEGDFile CurrentOEGDFile = null;
/** ViewPager **/
private ViewPager Pager;
private PagerAdapter Adapter;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_oegd);
this.Initialize();
}
/**
* Initializes OEGDActivity
*/
private void Initialize()
{
MainContext = this;
Log.Initialize(this);
this.InitializeLayouts();
this.InitializeLabels();
this.InitializeButtons();
this.InitializeOptionsPopup();
this.InitializeConfirmDeletePopup();
this.InitializePager();
this.InitializeLanguages();
this.loadOEGDs();
}
/**
* Initialize Layouts
*/
private void InitializeLayouts()
{
ActivityRootLayout = (CoordinatorLayout)findViewById(R.id.OEGDActivityRootLayout);
}
/**
* Initializes Labels
*/
private void InitializeLabels()
{
lblOEGD = ActivityRootLayout.findViewById(R.id.lblOEGD);
lblOEGDButtonButtonBack = ActivityRootLayout.findViewById(R.id.lblOEGDButtonButtonBack);
lblNoOEGD = ActivityRootLayout.findViewById(R.id.lblNoOEGD);
OEGDMainLoading = ActivityRootLayout.findViewById(R.id.OEGDMainLoading);
OEGDMainLoading.setVisibility(View.GONE);
}
/**
* Initializes Buttons
*/
private void InitializeButtons()
{
OEGDButtonBack = ActivityRootLayout.findViewById(R.id.OEGDButtonBack);
OEGDButtonBack.setOnClickListener(v ->{ OEGDButtonBack_Click(); });
bottomOEGDButtonMenuOpener = ActivityRootLayout.findViewById(R.id.bottomOEGDButtonMenuOpener);
bottomOEGDButtonMenuOpener.setOnClickListener(v -> { this.OEGDOptionsOptions_Show(); });
}
/**
* Initializes ConfirmDelete Popup
*/
private void InitializeConfirmDeletePopup()
{
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
ConfirmDeletePopup_Overlay = inflater.inflate(R.layout.popup_confirm_delete, null);
ConfirmDeletePopup_Popup = ConfirmDeletePopup_Overlay.findViewById(R.id.PopupConfirm_Popup);
PopupConfirmDelete_text = ConfirmDeletePopup_Overlay.findViewById(R.id.PopupConfirmDelete_text);
ConfirmDeletePopup_BtnYES = ConfirmDeletePopup_Overlay.findViewById(R.id.PopupPasswordConfirm_BtnYES);
ConfirmDeletePopup_BtnYES.setOnClickListener(v -> { this.ConfirmDeletePopup_BtnYES_Click(); });
ConfirmDeletePopup_BtnNO = ConfirmDeletePopup_Overlay.findViewById(R.id.PopupConfirmDelete_BtnNO);
ConfirmDeletePopup_BtnNO.setOnClickListener(v -> { this.OConfirmDeletePopup_Hide(); });
/** Create popup window context **/
ConfirmDeletePopup = new PopupWindow(
ConfirmDeletePopup_Overlay,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
true
);
}
/**
* Initializes Options Popup
*/
private void InitializeOptionsPopup()
{
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
OEGDOptionsOptions_Overlay = inflater.inflate(R.layout.popup_oegd_options, null);
OEGDOptionsOptions_Popup = OEGDOptionsOptions_Overlay.findViewById(R.id.OEGDOptions_Popup);
OEGDOptionsOptions_BtnAdd = OEGDOptionsOptions_Overlay.findViewById(R.id.OEGDOptions_BtnAdd);
OEGDOptionsOptions_BtnAdd.setOnClickListener(v -> { this.OEGDOptionsOptions_BtnAdd_Click(); });
OEGDOptionsEditView = OEGDOptionsOptions_Overlay.findViewById(R.id.OEGDOptionsEditView);
OEGDOptionsOptions_BtnEdit = OEGDOptionsOptions_Overlay.findViewById(R.id.OEGDOptions_BtnEdit);
OEGDOptionsOptions_BtnEdit.setOnClickListener(v -> { this.OEGDOptionsOptions_BtnEdit_Click(); });
OEGDOptionsDeleteView = OEGDOptionsOptions_Overlay.findViewById(R.id.OEGDOptionsDeleteView);
OEGDOptionsOptions_BtnDelete = OEGDOptionsOptions_Overlay.findViewById(R.id.OEGDOptions_BtnDelete);
OEGDOptionsOptions_BtnDelete.setOnClickListener(v -> { this.OEGDOptionsOptions_BtnDelete_Click(); });
OEGDOptionsOptions_BtnCancel = OEGDOptionsOptions_Overlay.findViewById(R.id.OEGDOptions_BtnCancel);
OEGDOptionsOptions_BtnCancel.setOnClickListener(v -> { this.OEGDOptionsOptions_BtnCancel_Click(); });
/** Create popup window context **/
OEGDOptionsOptions = new PopupWindow(
OEGDOptionsOptions_Overlay,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
true
);
}
/**
* Initializes OEGD Pager
*/
private void InitializePager()
{
Pager = (ViewPager) findViewById(R.id.OEGDPager);
Adapter = new OEGDActivity.OEGDPagerAdapter(getSupportFragmentManager(), this.OEGDFiles, this);
Pager.setAdapter(Adapter);
Pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener()
{
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels)
{
CurrentOEGDFile = null;
OEGDOptionsEditView.setVisibility(View.GONE);
OEGDOptionsDeleteView.setVisibility(View.GONE);
if(OEGDFiles != null && OEGDFiles.size() > 0 && position >= 0 && position < OEGDFiles.size())
{
OEGDOptionsEditView.setVisibility(View.VISIBLE);
OEGDOptionsDeleteView.setVisibility(View.VISIBLE);
CurrentOEGDFile = OEGDFiles.get(position);
}
}
@Override
public void onPageSelected(int position) {}
@Override
public void onPageScrollStateChanged(int state) {}
});
}
/**
* Initializes Languages
*/
private void InitializeLanguages()
{
lblOEGD.setText(Lang.Get("LBL_OEGD"));
lblNoOEGD.setText(Lang.Get("LBL_NO_OEGD"));
lblOEGDButtonButtonBack.setText(Lang.Get("BTN_BACK"));
OEGDOptionsOptions_BtnAdd.setText(Lang.Get("BTN_ADD"));
OEGDOptionsOptions_BtnEdit.setText(Lang.Get("BTN_EDIT"));
OEGDOptionsOptions_BtnDelete.setText(Lang.Get("BTN_DELETE"));
OEGDOptionsOptions_BtnCancel.setText(Lang.Get("BTN_CANCEL"));
ConfirmDeletePopup_BtnYES.setText(Lang.Get("BTN_YES"));
ConfirmDeletePopup_BtnNO.setText(Lang.Get("BTN_NO"));
}
/** BEGIN EVENTS **/
/**
* Show ConfirmDeletePopup
*/
private void ConfirmDeletePopup_Show()
{
if(CurrentOEGDFile != null)
{
String text = Lang.Get("MSG_SURE_WANT_DELETE").replace("[ITEM]", (CurrentOEGDFile.OEGD.first_name + " " + CurrentOEGDFile.OEGD.last_name));
PopupConfirmDelete_text.setText(text);
ConfirmDeletePopup_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_in));
ConfirmDeletePopup_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_in));
if(!ConfirmDeletePopup.isShowing())
{
ConfirmDeletePopup.showAtLocation(ActivityRootLayout, Gravity.CENTER,0,0);
}
}
}
/**
* Delete confirmed item
*/
private void ConfirmDeletePopup_BtnYES_Click()
{
try
{
if(CurrentOEGDFile != null)
{
String file = System.GetPathForStorageFile(CurrentOEGDFile.filename, MainContext);
if(file != null)
{
System.DeleteFile(file);
}
this.OConfirmDeletePopup_Hide();
//this.loadOEGDs();
finish();
overridePendingTransition(0, 0);
startActivity(getIntent());
overridePendingTransition(0, 0);
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "OEGDActivity", "ConfirmDeletePopup_BtnYES_Click");
}
}
/**
* Hide ConfirmDeletePopup
*/
private void OConfirmDeletePopup_Hide()
{
ConfirmDeletePopup_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_out));
ConfirmDeletePopup_Popup.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_out));
if(ConfirmDeletePopup.isShowing())
{
Animation anim = AnimationUtils.loadAnimation(this, R.anim.popup_out);
anim.setAnimationListener(new Animation.AnimationListener()
{
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation)
{
ConfirmDeletePopup.dismiss();
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
anim.setFillAfter(true);
ConfirmDeletePopup_Popup.startAnimation(anim);
}
}
/**
* Show OEGDOptionsOptions
*/
private void OEGDOptionsOptions_Show()
{
OEGDOptionsOptions_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_in));
OEGDOptionsOptions_Popup.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_in));
if(!OEGDOptionsOptions.isShowing())
{
OEGDOptionsOptions.showAtLocation(ActivityRootLayout, Gravity.CENTER,0,0);
}
}
/**
* Hide OEGDOptionsOptions
*/
private void OEGDOptionsOptions_Hide()
{
OEGDOptionsOptions_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_out));
OEGDOptionsOptions_Popup.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_out));
if(OEGDOptionsOptions.isShowing())
{
Animation anim = AnimationUtils.loadAnimation(this, R.anim.popup_out);
anim.setAnimationListener(new Animation.AnimationListener()
{
@Override
public void onAnimationStart(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation)
{
OEGDOptionsOptions.dismiss();
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
anim.setFillAfter(true);
OEGDOptionsOptions_Popup.startAnimation(anim);
}
}
/**
* Go Back to MainActivity
*/
private void OEGDButtonBack_Click()
{
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Bundle parameters = new Bundle();
parameters.putBoolean("SplashScreenLoaded", true);
intent.putExtras(parameters);
startActivity(intent);
overridePendingTransition(R.anim.side_in_left, R.anim.side_out_right);
}
/**
* On OptionsPopup Add Button clicked
*/
private void OEGDOptionsOptions_BtnAdd_Click()
{
this.OEGDOptionsOptions_Hide();
this.NewOEGDActivity();
}
/**
* Goes to NewOEGDActivity
*/
private void NewOEGDActivity()
{
Intent newOEGDActivity = new Intent(this, NewOEGDActivity.class);
startActivity(newOEGDActivity);
overridePendingTransition(R.anim.side_in_right, R.anim.side_out_left);
}
/**
* On OptionsPopup Edit Button clicked
*/
private void OEGDOptionsOptions_BtnEdit_Click()
{
this.OEGDOptionsOptions_Hide();
if(CurrentOEGDFile != null)
{
this.GoToEditOEGDActivity(CurrentOEGDFile);
}
}
/**
* GoTo EditOEGDActivity
*
* @param oegdFile - oegd file that should be edited
*/
private void GoToEditOEGDActivity(OEGDFile oegdFile)
{
try
{
Intent editOEGDActivity = new Intent(this, EditOEGDActivity.class);
Bundle parameters = new Bundle();
parameters.putString("file", oegdFile.filename);
editOEGDActivity.putExtras(parameters);
startActivity(editOEGDActivity);
overridePendingTransition(R.anim.side_in_right, R.anim.side_out_left);
}
catch (Exception ex)
{
Log.Critical(ex.getMessage(), "MainActivity", "GoToEditOEGDActivity");
}
}
/**
* On OptionsPopup Delete Button clicked
*/
private void OEGDOptionsOptions_BtnDelete_Click()
{
this.OEGDOptionsOptions_Hide();
this.ConfirmDeletePopup_Show();
}
/**
* On OptionsPopup Cancel Button clicked
*/
private void OEGDOptionsOptions_BtnCancel_Click()
{
this.OEGDOptionsOptions_Hide();
}
/** END EVENTS **/
/** BEGIN FUNCTIONS **/
private void loadOEGDs()
{
this.OEGDFiles = null;
OEGDMainLoading.setVisibility(View.VISIBLE);
try
{
/** Run request on sub thread **/
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
List<File> oegdFiles = System.GetOEGDFiles(MainContext);
if(oegdFiles != null && oegdFiles.size() > 0)
{
OEGDFiles = new ArrayList<>();
for(int i = 0; i < oegdFiles.size(); i++)
{
try
{
File f = oegdFiles.get(i);
byte[] encrypted_content = System.ReadFromStorage(f.getName(), MainContext);
if(encrypted_content != null)
{
String json = AES.Decrypt(new String(encrypted_content, StandardCharsets.UTF_8), AES.GetKey(Session.DevicePassword));
if(json != null)
{
OEGD obj = (OEGD)new Gson().fromJson(json, OEGD.class);
if(obj != null)
{
OEGDFile oegdFile = new OEGDFile();
oegdFile.OEGD = obj;
oegdFile.filename = f.getName();
OEGDFiles.add(oegdFile);
}
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "eIDActivity", "loadOEGDs");
}
}
}
UpdateOEGDCodes();
}
});
thread.start();
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "eIDActivity", "loadOEGDs");
}
}
/**
* Updates OEGD QR-Codes on main thread
*/
private void UpdateOEGDCodes()
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
OEGDMainLoading.setVisibility(View.GONE);
OEGDOptionsEditView.setVisibility(View.GONE);
OEGDOptionsDeleteView.setVisibility(View.GONE);
if(OEGDFiles != null && OEGDFiles.size() > 0)
{
OEGDOptionsEditView.setVisibility(View.VISIBLE);
OEGDOptionsDeleteView.setVisibility(View.VISIBLE);
Pager.setVisibility(View.VISIBLE);
lblNoOEGD.setVisibility(View.GONE);
bottomOEGDButtonMenuOpener.clearAnimation();
}
else
{
Pager.setVisibility(View.GONE);
lblNoOEGD.setVisibility(View.VISIBLE);
Animation animation = new AlphaAnimation(1, 0);
animation.setDuration(200);
animation.setInterpolator(new LinearInterpolator());
animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.REVERSE);
bottomOEGDButtonMenuOpener.startAnimation(animation);
}
((OEGDActivity.OEGDPagerAdapter)Adapter).updateDataset(OEGDFiles);
}
});
}
/** END FUNCTIONS **/
/** OEGDSwitcher Adapter **/
private class OEGDPagerAdapter extends FragmentStatePagerAdapter
{
/** List of OEGDFiles **/
private List<OEGDFile> OEGDFiles = null;
/** OEGDActivity Context **/
private OEGDActivity OEGDActivity;
public OEGDPagerAdapter(FragmentManager fragmentManager, List<OEGDFile> oegdFiles, OEGDActivity oegdActivity)
{
super(fragmentManager);
this.OEGDFiles = oegdFiles;
this.OEGDActivity = oegdActivity;
if(this.OEGDFiles == null)
{
this.OEGDFiles = new ArrayList<>();
}
}
/**
* Updates dataset
*/
public void updateDataset(List<OEGDFile> oegdFiles)
{
this.OEGDFiles = oegdFiles;
if(this.OEGDFiles == null)
{
this.OEGDFiles = new ArrayList<>();
}
this.notifyDataSetChanged();
}
@Override
public int getCount()
{
return this.OEGDFiles.size();
}
@Override
public Fragment getItem(int position)
{
return de.labor_stein.befund.OEGDActivity.OEGDFragment.newInstance(this.OEGDFiles.get(position), this.OEGDActivity);
}
}
/** OEGDCard Fragment **/
public static class OEGDFragment extends Fragment
{
/** OEGDActivity Context **/
private OEGDActivity OEGDActivity;
/** OEGDFile object **/
private OEGDFile OEGDFile;
/** Constructor for OEGDFragment **/
public OEGDFragment(OEGDFile oegdFile, OEGDActivity oegdActivity)
{
this.OEGDFile = oegdFile;
this.OEGDActivity = oegdActivity;
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_oegd_code, container, false);
ImageView qrCode = view.findViewById(R.id.fragment_oegd_qr_code);
TextView name = view.findViewById(R.id.fragment_oegd_name);
name.setText(this.OEGDFile.OEGD.first_name + " " + this.OEGDFile.OEGD.last_name);
try
{
String json = new Gson().toJson(this.OEGDFile.OEGD);
if(json != null && !json.isEmpty())
{
Bitmap qrCodeImage = ImageHelper.QRCode(json, 350, 350);
if(qrCodeImage != null)
{
qrCode.setVisibility(View.VISIBLE);
qrCode.setImageBitmap(qrCodeImage);
}
else
{
qrCode.setVisibility(View.INVISIBLE);
}
}
else
{
qrCode.setVisibility(View.INVISIBLE);
}
}
catch (Exception ex)
{
qrCode.setVisibility(View.INVISIBLE);
Log.Error(ex.getMessage(), "OEGDActivity.OEGDFragment", "onCreateView");
}
return view;
}
/** Creates a new instance of fragment **/
public static de.labor_stein.befund.OEGDActivity.OEGDFragment newInstance(OEGDFile oegdFile, OEGDActivity oegdActivity)
{
return new OEGDActivity.OEGDFragment(oegdFile, oegdActivity);
}
}
}

View File

@ -0,0 +1,428 @@
//
// PDFViewerActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 02.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;
import android.print.PageRange;
import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter;
import android.print.PrintDocumentInfo;
import android.print.PrintJob;
import android.print.PrintManager;
import android.print.pdf.PrintedPdfDocument;
import android.text.InputType;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.github.barteksc.pdfviewer.PDFView;
import com.github.barteksc.pdfviewer.listener.OnErrorListener;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import de.labor_stein.befund.Core.Helpers.DateHelper;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Security.Base64;
import de.labor_stein.befund.Core.System;
public class PDFViewerActivity extends AppCompatActivity
{
/** PDFViewerActivityContext **/
private Context MainContext;
/** Layouts **/
private CoordinatorLayout ActivityRootLayout;
private FrameLayout PDFViewerLayout;
/** Controls **/
private TextView lblMyResult;
private TextView lblPDFViewerButtonBack;
/** Buttons **/
private FloatingActionButton PDFViewerButtonBack;
private Button bottomPDFViewerMenuOpener;
/** PDFViewer **/
private PDFView PDFViewer;
public static byte[] PDFCurrentContent;
/** BEGIN POPUPS **/
/** BEGIN OptionsPopup **/
private PopupWindow PDFViewerOptions;
private View PPDFViewerOptions_Overlay;
private LinearLayout PDFViewerOptions_Popup;
private Button PDFViewerOptions_BtnPrint;
private Button PDFViewerOptions_BtnShare;
private Button PDFViewerOptions_BtnCancel;
private final int SAVE_DOCUMENT_REQUEST_CODE = 0x445;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pdf_viewer);
this.Initialize();
}
/**
* Initialize PDFViewer Activity
*/
private void Initialize()
{
MainContext = this;
Log.Initialize(this);
this.InitializeLayouts();
this.InitializeLabels();
this.InitializeButtons();
this.InitializePDFViewer();
this.InitializePopups();
this.InitializeLanguages();
}
/**
* Initialize Layouts
*/
private void InitializeLayouts()
{
ActivityRootLayout = (CoordinatorLayout)findViewById(R.id.PDFActivityRootLayout);
PDFViewerLayout = ActivityRootLayout.findViewById(R.id.PDFViewerLayout);
}
/**
* Initializes Labels
*/
private void InitializeLabels()
{
lblMyResult = ActivityRootLayout.findViewById(R.id.lblMyResult);
lblPDFViewerButtonBack = ActivityRootLayout.findViewById(R.id.lblPDFViewerButtonBack);
}
/**
* Initializes Buttons
*/
private void InitializeButtons()
{
PDFViewerButtonBack = ActivityRootLayout.findViewById(R.id.PDFViewerButtonBack);
PDFViewerButtonBack.setOnClickListener(v ->{ PDFViewerButtonBack_Click(); });
bottomPDFViewerMenuOpener = ActivityRootLayout.findViewById(R.id.bottomPDFViewerMenuOpener);
bottomPDFViewerMenuOpener.setOnClickListener(v -> { PDFViewerOptions_Show(); });
}
/**
* Initializes PDFViewer
*/
private void InitializePDFViewer()
{
PDFViewer = ActivityRootLayout.findViewById(R.id.PDFViewer);
if(PDFCurrentContent != null && PDFCurrentContent.length > 0)
{
PDFViewer.fromBytes(PDFCurrentContent)
.defaultPage(0)
.load();
}
}
/**
* Initializes Languages
*/
private void InitializeLanguages()
{
lblMyResult.setText(Lang.Get("BTN_MY_RESULT"));
lblPDFViewerButtonBack.setText(Lang.Get("BTN_BACK"));
PDFViewerOptions_BtnPrint.setText(Lang.Get("BTN_PRINT"));
PDFViewerOptions_BtnShare.setText(Lang.Get("BTN_FILE_SHARE"));
PDFViewerOptions_BtnCancel.setText(Lang.Get("BTN_CANCEL"));
}
/**
* Initializes Popups
*/
private void InitializePopups()
{
this.InitializeOptionsPopup();
}
/**
* Initializes Options Popup
*/
private void InitializeOptionsPopup()
{
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
PPDFViewerOptions_Overlay = inflater.inflate(R.layout.popup_pdf_viewer_options, null);
PDFViewerOptions_Popup = PPDFViewerOptions_Overlay.findViewById(R.id.PDFViewerOptions_Popup);
PDFViewerOptions_BtnPrint = PPDFViewerOptions_Overlay.findViewById(R.id.PDFViewerOptions_BtnPrint);
PDFViewerOptions_BtnPrint.setOnClickListener(v -> { this.PDFViewerOptions_BtnPrint_Click(); });
PDFViewerOptions_BtnShare = PPDFViewerOptions_Overlay.findViewById(R.id.PDFViewerOptions_BtnShare);
PDFViewerOptions_BtnShare.setOnClickListener(v -> { this.PDFViewerOptions_BtnShare_Click(); });
PDFViewerOptions_BtnCancel = PPDFViewerOptions_Overlay.findViewById(R.id.PDFViewerOptions_BtnCancel);
PDFViewerOptions_BtnCancel.setOnClickListener(v -> { this.PDFViewerOptions_BtnCancel_Click(); });
/** Create popup window context **/
PDFViewerOptions = new PopupWindow(
PPDFViewerOptions_Overlay,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
true
);
}
/** BEGIN EVENTS **/
/**
* Show PDFViewerOptions
*/
private void PDFViewerOptions_Show()
{
PPDFViewerOptions_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_in));
PDFViewerOptions_Popup.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_in));
if(!PDFViewerOptions.isShowing())
{
PDFViewerOptions.showAtLocation(ActivityRootLayout, Gravity.CENTER,0,0);
}
}
/**
* Hide PDFViewerOptions
*/
private void PDFViewerOptions_Hide()
{
PPDFViewerOptions_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_out));
PDFViewerOptions_Popup.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_out));
if(PDFViewerOptions.isShowing())
{
Animation anim = AnimationUtils.loadAnimation(this, R.anim.popup_out);
anim.setAnimationListener(new Animation.AnimationListener()
{
@Override
public void onAnimationStart(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation)
{
PDFViewerOptions.dismiss();
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
anim.setFillAfter(true);
PDFViewerOptions_Popup.startAnimation(anim);
}
}
/**
* Go Back to MainActivity
*/
private void PDFViewerButtonBack_Click()
{
PDFCurrentContent = null;
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Bundle parameters = new Bundle();
parameters.putBoolean("SplashScreenLoaded", true);
intent.putExtras(parameters);
startActivity(intent);
overridePendingTransition(R.anim.side_in_left, R.anim.side_out_right);
}
/** On OptionsPopup Print Button clicked **/
private void PDFViewerOptions_BtnPrint_Click()
{
try
{
PrintManager printManager = (PrintManager)getSystemService(Context.PRINT_SERVICE);
PrintAttributes.Builder builder = new PrintAttributes.Builder();
builder.setMediaSize(PrintAttributes.MediaSize.NA_LETTER);
PrintAttributes attributes = new PrintAttributes.Builder()
.setMediaSize(PrintAttributes.MediaSize.ISO_A4)
.setResolution(new PrintAttributes.Resolution("id", Context.PRINT_SERVICE, 200, 200))
.setColorMode(PrintAttributes.COLOR_MODE_COLOR)
.setMinMargins(PrintAttributes.Margins.NO_MARGINS)
.build();
printManager.print("Befunddruck", new PdfDocumentAdapter(this, PDFCurrentContent), attributes);
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "PDFViewerActivity", "PDFViewerOptions_BtnPrint_Click");
}
}
/** On OptionsPopup Share Button clicked **/
private void PDFViewerOptions_BtnShare_Click()
{
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_CREATE_DOCUMENT);
sendIntent.addCategory(Intent.CATEGORY_OPENABLE);
sendIntent.setType("application/pdf");
sendIntent.putExtra(Intent.EXTRA_TITLE, "Befund.pdf");
Intent shareIntent = Intent.createChooser(sendIntent, null);
startActivityForResult(shareIntent, SAVE_DOCUMENT_REQUEST_CODE);
}
/**
* On OptionsPopup Cancel Button clicked
*/
private void PDFViewerOptions_BtnCancel_Click()
{
this.PDFViewerOptions_Hide();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SAVE_DOCUMENT_REQUEST_CODE && resultCode == RESULT_OK)
{
Uri uri = data.getData();
try
{
OutputStream output = getContentResolver().openOutputStream(uri);
output.write(PDFCurrentContent);
output.flush();
output.close();
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "PDFViewerActivity", "onActivityResult(Share file)");
}
}
}
/** END EVENTS **/
/**
* PDFDocumentAdapter
*/
public class PdfDocumentAdapter extends PrintDocumentAdapter
{
Context Context = null;
byte[] Content = null;
public PdfDocumentAdapter(Context context, byte[] content)
{
this.Context = context;
this.Content = content;
}
@Override
public void onLayout(PrintAttributes printAttributes, PrintAttributes printAttributes1, CancellationSignal cancellationSignal, LayoutResultCallback layoutResultCallback, Bundle bundle)
{
if (cancellationSignal.isCanceled())
{
layoutResultCallback.onLayoutCancelled();
}
else
{
PrintDocumentInfo.Builder builder = new PrintDocumentInfo.Builder("Befund.pdf");
builder.setContentType(PrintDocumentInfo.CONTENT_TYPE_DOCUMENT).setPageCount(PrintDocumentInfo.PAGE_COUNT_UNKNOWN).build();
layoutResultCallback.onLayoutFinished(builder.build(), !printAttributes1.equals(printAttributes));
}
}
@Override
public void onWrite(PageRange[] pageRanges, ParcelFileDescriptor parcelFileDescriptor, CancellationSignal cancellationSignal, WriteResultCallback writeResultCallback)
{
OutputStream out = null;
InputStream in = null;
try
{
in = new ByteArrayInputStream(this.Content);
out = new FileOutputStream(parcelFileDescriptor.getFileDescriptor());
byte[] buf = new byte[16384];
int size;
while ((size = in.read(buf)) >= 0 && !cancellationSignal.isCanceled())
{
out.write(buf, 0, size);
}
if (cancellationSignal.isCanceled())
{
writeResultCallback.onWriteCancelled();
}
else
{
writeResultCallback.onWriteFinished(new PageRange[] { PageRange.ALL_PAGES });
}
}
catch (Exception e)
{
writeResultCallback.onWriteFailed(e.getMessage());
}
finally
{
try
{
in.close();
out.close();
}
catch (IOException ex)
{
Log.Error(ex.getMessage(), "PDFViewerActivity.PdfDocumentAdapter", "onWrite");
}
}
}
}
}

View File

@ -0,0 +1,542 @@
//
// PasswordActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 11.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputType;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import de.labor_stein.befund.Core.Https.Request;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Database.Results;
import de.labor_stein.befund.Core.Models.Request.ChangeVerificatorHash;
import de.labor_stein.befund.Core.Models.Request.EncryptedRequest;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Curve25519;
import de.labor_stein.befund.Core.Security.SHA512;
import de.labor_stein.befund.Core.System;
public class PasswordActivity extends AppCompatActivity
{
/** PasswordActivityContext **/
private Context MainContext;
/** Layouts **/
private CoordinatorLayout PasswordActivityRootLayout;
/** Buttons **/
private FloatingActionButton PasswordActivityButtonBack;
private Button PasswordActivity_BtnChange;
/** Controls **/
private TextView lblPasswordChange;
private TextView lblPasswordActivityButtonBack;
private EditText PasswordActivity_txtCurrentPassword;
private ImageView PasswordActivity_txtCurrentPasswordViewer;
private EditText PasswordActivity_txtNewPassword;
private ImageView PasswordActivity_txtNewPasswordViewer;
private EditText PasswordActivity_txtPasswordConfirm;
private ImageView PasswordActivity_txtPasswordConfirmViewer;
private EditText PasswordActivity_txtNewPIN;
private TextView PasswordActivity_Status;
private ProgressBar PasswordActivity_Loading;
/** Settings **/
private de.labor_stein.befund.Core.Models.Settings Settings;
/** Database Contexts **/
private de.labor_stein.befund.Core.Database.Results dbResults;
private de.labor_stein.befund.Core.Database.Logs dbLogs;
private boolean IsSaving = false;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.password_activity);
this.Initialize();
}
@Override
protected void onResume()
{
super.onResume();
this.InitializeLanguages();
}
/**
* Initialize PasswordActivityContext
*/
private void Initialize()
{
MainContext = this;
this.IsSaving = false;
this.dbResults = new de.labor_stein.befund.Core.Database.Results(this);
this.dbLogs = new de.labor_stein.befund.Core.Database.Logs(this);
Log.Initialize(this);
this.Settings = de.labor_stein.befund.Core.Models.Settings.load(this);
this.InitializeLayouts();
this.InitializeLabels();
this.InitializeButtons();
this.InitializeLanguages();
//PasswordActivity_HideLoading(Lang.Get("ERROR_ENTER_YOUR_CURRENT_PASSWORD"));
}
/**
* Initialize Layouts
*/
private void InitializeLayouts()
{
PasswordActivityRootLayout = (CoordinatorLayout)findViewById(R.id.PasswordActivityRootLayout);
}
/**
* Initializes Labels
*/
private void InitializeLabels()
{
lblPasswordChange = PasswordActivityRootLayout.findViewById(R.id.lblPasswordChange);
lblPasswordActivityButtonBack = PasswordActivityRootLayout.findViewById(R.id.lblPasswordActivityButtonBack);
PasswordActivity_txtCurrentPassword = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_txtCurrentPassword);
PasswordActivity_txtCurrentPasswordViewer = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_txtCurrentPasswordViewer);
PasswordActivity_txtNewPassword = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_txtNewPassword);
PasswordActivity_txtNewPIN = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_txtNewPIN);
PasswordActivity_txtNewPasswordViewer = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_txtNewPasswordViewer);
PasswordActivity_txtPasswordConfirm = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_txtPasswordConfirm);
PasswordActivity_txtPasswordConfirmViewer = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_txtPasswordConfirmViewer);
PasswordActivity_Status = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_Status);
PasswordActivity_Loading = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_Loading);
PasswordActivity_Loading.setVisibility(View.INVISIBLE);
PasswordActivity_txtCurrentPassword.setOnFocusChangeListener((View v, boolean hasFocus) ->
{
if(hasFocus)
{ PasswordActivity_HideLoading(Lang.Get("ERROR_ENTER_YOUR_CURRENT_PASSWORD")); }
else
{ PasswordActivity_Status.setText(""); }
});
PasswordActivity_txtNewPassword.setOnFocusChangeListener((View v, boolean hasFocus) ->
{
if(hasFocus)
{ PasswordActivity_HideLoading(Lang.Get("ERROR_ENTER_STRONG_PASSWORD")); }
else
{ PasswordActivity_Status.setText(""); }
});
PasswordActivity_txtPasswordConfirm.setOnFocusChangeListener((View v, boolean hasFocus) ->
{
if(hasFocus)
{ PasswordActivity_HideLoading(Lang.Get("ERROR_ENTER_STRONG_PASSWORD")); }
else
{ PasswordActivity_Status.setText(""); }
});
PasswordActivity_txtNewPIN.setOnFocusChangeListener((View v, boolean hasFocus) ->
{
if(hasFocus)
{ PasswordActivity_HideLoading(Lang.Get("ERROR_PIN_LENGTH")); }
else
{ PasswordActivity_Status.setText(""); }
});
/** Password Viewers **/
PasswordActivity_txtCurrentPasswordViewer.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
if (event.getAction() == android.view.MotionEvent.ACTION_DOWN)
{
PasswordActivity_txtCurrentPasswordViewer.setAlpha(1.0f);
PasswordActivity_txtCurrentPassword.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
PasswordActivity_txtCurrentPassword.setSelection(PasswordActivity_txtCurrentPassword.getText().length());
}
else if (event.getAction() == android.view.MotionEvent.ACTION_UP)
{
PasswordActivity_txtCurrentPasswordViewer.setAlpha(0.5f);
PasswordActivity_txtCurrentPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
PasswordActivity_txtCurrentPassword.setSelection(PasswordActivity_txtCurrentPassword.getText().length());
}
return true;
}
});
PasswordActivity_txtNewPasswordViewer.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
if (event.getAction() == android.view.MotionEvent.ACTION_DOWN)
{
PasswordActivity_txtNewPasswordViewer.setAlpha(1.0f);
PasswordActivity_txtNewPassword.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
PasswordActivity_txtNewPassword.setSelection(PasswordActivity_txtNewPassword.getText().length());
}
else if (event.getAction() == android.view.MotionEvent.ACTION_UP)
{
PasswordActivity_txtNewPasswordViewer.setAlpha(0.5f);
PasswordActivity_txtNewPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
PasswordActivity_txtNewPassword.setSelection(PasswordActivity_txtNewPassword.getText().length());
}
return true;
}
});
PasswordActivity_txtPasswordConfirmViewer.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
if (event.getAction() == android.view.MotionEvent.ACTION_DOWN)
{
PasswordActivity_txtPasswordConfirmViewer.setAlpha(1.0f);
PasswordActivity_txtPasswordConfirm.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
PasswordActivity_txtPasswordConfirm.setSelection(PasswordActivity_txtPasswordConfirm.getText().length());
}
else if (event.getAction() == android.view.MotionEvent.ACTION_UP)
{
PasswordActivity_txtPasswordConfirmViewer.setAlpha(0.5f);
PasswordActivity_txtPasswordConfirm.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
PasswordActivity_txtPasswordConfirm.setSelection(PasswordActivity_txtPasswordConfirm.getText().length());
}
return true;
}
});
PasswordActivity_txtPasswordConfirm.setOnKeyListener(new View.OnKeyListener()
{
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if(keyCode == KeyEvent.KEYCODE_ENTER)
{
PasswordActivity_BtnChange_Click();
}
return false;
}
});
}
/**
* Initializes Languages
*/
private void InitializeLanguages()
{
lblPasswordChange.setText(Lang.Get("LBL_PASSWORD_CHANGE"));
PasswordActivity_txtCurrentPassword.setHint(Lang.Get("LBL_CURRENT_PASSWORD"));
PasswordActivity_txtNewPassword.setHint(Lang.Get("LBL_NEW_PASSWORD"));
PasswordActivity_txtPasswordConfirm.setHint(Lang.Get("LBL_PASSWORD_CONFIRM"));
PasswordActivity_txtNewPIN.setHint(Lang.Get("LBL_NEW_PIN"));
PasswordActivity_BtnChange.setText(Lang.Get("BTN_CHANGE"));
lblPasswordActivityButtonBack.setText(Lang.Get("BTN_BACK"));
}
/**
* Initializes Buttons
*/
private void InitializeButtons()
{
PasswordActivityButtonBack = PasswordActivityRootLayout.findViewById(R.id.PasswordActivityButtonBack);
PasswordActivityButtonBack.setOnClickListener(v ->{ PasswordActivityButtonBack_Click(); });
PasswordActivity_BtnChange = PasswordActivityRootLayout.findViewById(R.id.PasswordActivity_BtnChange);
PasswordActivity_BtnChange.setOnClickListener(v -> { this.PasswordActivity_BtnChange_Click(); });
}
/**
* Go Back to MainActivity
*/
private void PasswordActivityButtonBack_Click()
{
this.finish();
}
/**
* Change password
*/
private void PasswordActivity_BtnChange_Click()
{
try
{
PasswordActivity_Status.setText("");
if(!this.IsSaving)
{
this.IsSaving = true;
PasswordActivity_Loading.setVisibility(View.VISIBLE);
if(PasswordActivity_txtCurrentPassword.getText() == null || PasswordActivity_txtCurrentPassword.getText().toString().isEmpty())
{
PasswordActivity_HideLoading(Lang.Get("ERROR_ENTER_YOUR_CURRENT_PASSWORD"));
this.IsSaving = false;
}
else
{
String old_password = PasswordActivity_txtCurrentPassword.getText().toString();
String tmp_encrypt_key = AES.Decrypt(Settings.hashed_private_key, AES.GetKey(old_password));
if(tmp_encrypt_key != null)
{
String password_policy = "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!+@$%^&<>*~:`-]).{8,}$";
if(!PasswordActivity_txtNewPassword.getText().toString().matches(password_policy))
{
this.IsSaving = false;
PasswordActivity_HideLoading(Lang.Get("ERROR_ENTER_STRONG_PASSWORD"));
}
else if(!PasswordActivity_txtNewPassword.getText().toString().equals(PasswordActivity_txtPasswordConfirm.getText().toString()))
{
this.IsSaving = false;
PasswordActivity_HideLoading(Lang.Get("ERROR_CONFIRM_PASSWORD"));
}
else if(PasswordActivity_txtNewPIN.getText() == null || PasswordActivity_txtNewPIN.getText().toString().isEmpty())
{
this.IsSaving = false;
PasswordActivity_HideLoading(Lang.Get("ERROR_ENTER_NEW_PIN"));
}
else if(PasswordActivity_txtNewPIN.getText().toString().length() != 5)
{
this.IsSaving = false;
PasswordActivity_HideLoading(Lang.Get("ERROR_PIN_LENGTH"));
}
else
{
String new_password = PasswordActivity_txtNewPassword.getText().toString();
String decrypted_private_key = AES.Decrypt(Settings.hashed_private_key, AES.GetKey(old_password));
Curve25519.KeyPair requestKeyPair = Curve25519.GenerateKeyPair();
byte[] key = AES.GetKey(new_password);
ChangeVerificatorHash changeVerificatorHash = new ChangeVerificatorHash();
changeVerificatorHash.old_verificator_hash = Settings.verificator_hash;
changeVerificatorHash.new_verificator_hash = SHA512.HMAC(SHA512.VerificatorHashingValue, key);
changeVerificatorHash.udid = Settings.udid;
changeVerificatorHash.pin = PasswordActivity_txtNewPIN.getText().toString();
PasswordActivity_Status.setText("");
/** Run request on sub thread **/
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
/** Update verificator_hash & pin on the server **/
Request.KeyExchangeAsync(Settings.labor.host,
requestKeyPair,
(publicKey) ->
{
byte[] sharedKey = requestKeyPair.GetSharedKey(publicKey.key);
EncryptedRequest request = new EncryptedRequest("ChangeVerificatorHash", changeVerificatorHash, sharedKey);
Request.EncryptedRequestAsync(Settings.labor.host,
"results",
"update_verificator_hash",
request,
publicKey,
requestKeyPair,
(encryptedResponse) ->
{
encryptedResponse.Decrypt(sharedKey);
/** change encryption to existing files if password has been successfully updated on the server **/
if(encryptedResponse.descriptor.toLowerCase().equals("success"))
{
try
{
List<Results> results = dbResults.GetResults();
/** decrypt & encrypt old results by new password **/
if(results != null && results.size() > 0)
{
for(int i = 0; i < results.size(); i++)
{
Results res = results.get(i);
String file = System.GetPathForStorageEncryptedFile(res.pgs, MainContext);
if(file != null && System.FileExists(file))
{
byte[] encrypted_content = System.ReadFromEncryptedStorage(res.pgs, MainContext);
if(encrypted_content != null && encrypted_content.length > 0)
{
String decrypted_content = AES.Decrypt(new String(encrypted_content), AES.GetKey(old_password));
if(decrypted_content != null)
{
String local_encrypted = AES.Encrypt(decrypted_content, AES.GetKey(new_password));
if(local_encrypted != null)
{
System.WriteToEncryptedStorage(res.pgs, local_encrypted.getBytes(StandardCharsets.UTF_8), MainContext);
}
}
}
}
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getMessage(), "PasswordActivity", "Thread change encryption");
}
/** Run on main Thread **/
runOnUiThread(new Runnable()
{
@Override
public void run()
{
/** update settings **/
byte[] key = AES.GetKey(new_password);
Settings.password_reset_hash = UUID.randomUUID().toString();
byte[] passwordHashKey = AES.GetKey(Settings.password_reset_hash + changeVerificatorHash.pin);
Settings.password_hash = AES.Encrypt(new_password, passwordHashKey);
Settings.verificator_hash = SHA512.HMAC(SHA512.VerificatorHashingValue, key);
Settings.hashed_private_key = AES.Encrypt(decrypted_private_key, key);
Settings.save(MainContext);
Session.DevicePassword = new_password;
String msg = Lang.Get("MSG_PASSWORD_HAS_BEEN_CHANGED");
PasswordActivity_HideLoading(msg);
PasswordActivity_txtCurrentPassword.setText("");
PasswordActivity_txtNewPassword.setText("");
PasswordActivity_txtPasswordConfirm.setText("");
PasswordActivity_txtNewPIN.setText("");
HideKeyboard(PasswordActivity_txtPasswordConfirm);
}
});
}
else
{
/** Run on main Thread **/
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PasswordActivity_HideLoading(Lang.Get("ERROR_COULD_NOT_CHANGE_PASSWORD"));
Log.Error("Could not update verificator_hash & pin on the server", "LoginActivity", "RequestPINFromServer");
}
});
}
IsSaving = false;
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
IsSaving = false;
PasswordActivity_HideLoading(error);
Log.Critical(error, "PasswordActivity", "PasswordActivity_BtnChange_Click");
}
});
});
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
IsSaving = false;
PasswordActivity_HideLoading(error);
Log.Critical(error, "PasswordActivity", "PasswordActivity_BtnChange_Click");
}
});
});
}
});
thread.start();
}
}
else
{
this.IsSaving = false;
PasswordActivity_HideLoading(Lang.Get("ERROR_YOUR_CURRENT_PASSWORD_IS_INVALID"));
}
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "PasswordActivity", "PasswordActivity_BtnChange_Click");
this.IsSaving = false;
}
}
/** Hide PasswordActivity Loading with optional status message **/
private void PasswordActivity_HideLoading(String message)
{
PasswordActivity_Loading.setVisibility(View.INVISIBLE);
if(message != null && !message.isEmpty())
{
PasswordActivity_Status.setText(message);
}
}
/** Hide Keyboard **/
public void HideKeyboard(View view)
{
InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(this.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}

View File

@ -0,0 +1,71 @@
//
// PushNotificationService.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 29.04.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund.Services;
import android.app.NotificationManager;
import android.content.Context;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import java.util.Map;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Settings;
import de.labor_stein.befund.MainActivity;
public class PushNotificationService extends FirebaseMessagingService
{
private static MainActivity _MainActivity = null;
private static Settings _Settings = null;
/**
* Sets the context of mainActivity to the PushNotificationService
*
* @param mainActivity
*/
public static void SetMainActivity(MainActivity mainActivity, Settings settings)
{
_MainActivity = mainActivity;
_Settings = settings;
}
/**
* Resets budge number of notification
*/
public static void ClearNotificationBadge(Context context)
{
try
{
NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
{
if (notificationManager != null)
{
notificationManager.cancelAll();
}
}
}
catch (Exception ex)
{
Log.Critical(ex.getMessage(), "Services.PushNotificationService", "PushNotificationService");
}
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage)
{
super.onMessageReceived(remoteMessage);
if(_MainActivity != null)
{
_MainActivity.LoadResults(false);
}
}
}

View File

@ -0,0 +1,326 @@
//
// SettingsActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 08.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Switch;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.List;
import de.labor_stein.befund.Core.Https.Request;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Database.Status;
import de.labor_stein.befund.Core.Models.Labor;
import de.labor_stein.befund.Core.Models.Request.EncryptedRequest;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Security.Curve25519;
public class SettingsActivity extends AppCompatActivity
{
/** SettingsActivityContext **/
private Context MainContext;
/** Layouts **/
private CoordinatorLayout ActivityRootLayout;
/** Controls **/
private TextView lblSettings;
private TextView lblSettingsButtonButtonBack;
private TextView SettingsActivity_lblYourLabor;
/** Labor Controls **/
private ImageView SettingsActivity_LaborLogo;
private TextView SettingsActivity_LaborName;
private TextView SettingsActivity_LaborStreet;
private TextView SettingsActivity_LaborCity;
private TextView SettingsActivity_LaborTel;
private TextView SettingsActivity_LaborWeb;
private TextView SettingsActivity_LaborStatus;
private TextView SettingsActivity_lblLanguages;
private TextView SettingsActivity_swDE;
private ImageView SettingsActivity_btnDE;
private TextView SettingsActivity_swEN;
private ImageView SettingsActivity_btnEN;
private ProgressBar SettingsActivity_Loading;
/** Settings **/
private de.labor_stein.befund.Core.Models.Settings Settings;
/** Buttons **/
private FloatingActionButton SettingsButtonBack;
/** Connection state **/
private boolean HostConnected = false;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
this.Initialize();
}
@Override
protected void onResume()
{
super.onResume();
this.InitializeLanguages();
}
/**
* Initialize SettingsActivity
*/
private void Initialize()
{
MainContext = this;
/** First has to be loaded settings to use system properties **/
this.Settings = de.labor_stein.befund.Core.Models.Settings.load(this);
this.InitializeLayouts();
this.InitializeLabels();
this.InitializeButtons();
this.InitializeLabor();
this.InitializeLanguages();
}
/**
* Initializes Languages
*/
private void InitializeLanguages()
{
Lang.SetLanguage(this.Settings.lang);
lblSettings.setText(Lang.Get("LBL_SETTINGS"));
lblSettingsButtonButtonBack.setText(Lang.Get("BTN_BACK"));
SettingsActivity_lblYourLabor.setText(Lang.Get("LBL_YOUR_LABOR"));
SettingsActivity_lblLanguages.setText(Lang.Get("LBL_LANGUAGE"));
if(Session.Maintenance)
{
SettingsActivity_LaborStatus.setText(Lang.Get("LBL_MAINTENANCE"));
}
else if(HostConnected)
{
SettingsActivity_LaborStatus.setText(Lang.Get("LBL_CONNECTED"));
}
else
{
SettingsActivity_LaborStatus.setText(Lang.Get("LBL_DISCONNECTED"));
}
}
/**
* Initialize Layouts
*/
private void InitializeLayouts()
{
ActivityRootLayout = (CoordinatorLayout)findViewById(R.id.SettingsActivityRootLayout);
SettingsActivity_Loading = ActivityRootLayout.findViewById(R.id.SettingsActivity_Loading);
SettingsActivity_LaborStatus = ActivityRootLayout.findViewById(R.id.SettingsActivity_LaborStatus);
SettingsActivity_Loading.setVisibility(View.GONE);
}
/**
* Initialize Labels
*/
private void InitializeLabels()
{
lblSettings = ActivityRootLayout.findViewById(R.id.lblSettings);
lblSettingsButtonButtonBack = ActivityRootLayout.findViewById(R.id.lblSettingsButtonButtonBack);
SettingsActivity_lblYourLabor = ActivityRootLayout.findViewById(R.id.SettingsActivity_lblYourLabor);
SettingsActivity_lblLanguages = ActivityRootLayout.findViewById(R.id.SettingsActivity_lblLanguages);
}
/**
* Initializes Buttons
*/
private void InitializeButtons()
{
SettingsButtonBack = ActivityRootLayout.findViewById(R.id.SettingsButtonBack);
SettingsButtonBack.setOnClickListener(v ->{ SettingsButtonBack_Click(); });
SettingsActivity_swDE = ActivityRootLayout.findViewById(R.id.SettingsActivity_swDE);
SettingsActivity_swEN = ActivityRootLayout.findViewById(R.id.SettingsActivity_swEN);
SettingsActivity_btnDE = ActivityRootLayout.findViewById(R.id.SettingsActivity_btnDE);
SettingsActivity_btnEN = ActivityRootLayout.findViewById(R.id.SettingsActivity_btnEN);
if(this.Settings.lang == Lang.Languages.EN)
{
SettingsActivity_swDE.setVisibility(View.GONE);
SettingsActivity_swEN.setVisibility(View.VISIBLE);
}
else
{
SettingsActivity_swDE.setVisibility(View.VISIBLE);
SettingsActivity_swEN.setVisibility(View.GONE);
}
SettingsActivity_btnEN.setOnClickListener(v ->
{
SettingsActivity_swDE.setVisibility(View.GONE);
SettingsActivity_swEN.setVisibility(View.VISIBLE);
this.ChangeLanguage(Lang.Languages.EN);
});
SettingsActivity_btnDE.setOnClickListener(v ->
{
SettingsActivity_swDE.setVisibility(View.VISIBLE);
SettingsActivity_swEN.setVisibility(View.GONE);
this.ChangeLanguage(Lang.Languages.DE);
});
}
/**
* Initializes Labor info
*/
private void InitializeLabor()
{
if(this.Settings.labor != null)
{
SettingsActivity_LaborLogo = ActivityRootLayout.findViewById(R.id.SettingsActivity_LaborLogo);
SettingsActivity_LaborLogo.setImageResource(this.Settings.labor.logo);
if(this.Settings.labor.name != null && !this.Settings.labor.name.isEmpty())
{
SettingsActivity_LaborName = ActivityRootLayout.findViewById(R.id.SettingsActivity_LaborName);
SettingsActivity_LaborName.setText(this.Settings.labor.name);
}
if(this.Settings.labor.street != null && !this.Settings.labor.street.isEmpty())
{
SettingsActivity_LaborStreet = ActivityRootLayout.findViewById(R.id.SettingsActivity_LaborStreet);
SettingsActivity_LaborStreet.setText(this.Settings.labor.street);
}
if(this.Settings.labor.city != null && !this.Settings.labor.city.isEmpty())
{
SettingsActivity_LaborCity = ActivityRootLayout.findViewById(R.id.SettingsActivity_LaborCity);
SettingsActivity_LaborCity.setText(this.Settings.labor.city);
}
if(this.Settings.labor.tel != null && !this.Settings.labor.tel.isEmpty())
{
SettingsActivity_LaborTel = ActivityRootLayout.findViewById(R.id.SettingsActivity_LaborTel);
SettingsActivity_LaborTel.setText(this.Settings.labor.tel);
}
if(this.Settings.labor.web != null && !this.Settings.labor.web.isEmpty())
{
SettingsActivity_LaborWeb = ActivityRootLayout.findViewById(R.id.SettingsActivity_LaborWeb);
SettingsActivity_LaborWeb.setText(this.Settings.labor.web);
}
SettingsActivity_swDE = ActivityRootLayout.findViewById(R.id.SettingsActivity_swDE);
SettingsActivity_swEN = ActivityRootLayout.findViewById(R.id.SettingsActivity_swEN);
if(!Session.Maintenance)
{
this.CheckLaborHost();
}
}
}
/**
* Change language
*/
private void ChangeLanguage(Lang.Languages lang)
{
Settings.lang = lang;
Settings.save(MainContext);
InitializeLanguages();
}
/**
* Check connection to the selected labor host
*/
private void CheckLaborHost()
{
try
{
HostConnected = false;
Curve25519.KeyPair requestKeyPair = Curve25519.GenerateKeyPair();
SettingsActivity_Loading.setVisibility(View.VISIBLE);
/** Run request on sub thread **/
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
Request.KeyExchangeAsync(Settings.labor.host,
requestKeyPair,
(publicKey) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
HostConnected = true;
SettingsActivity_Loading.setVisibility(View.GONE);
SettingsActivity_LaborStatus.setText(Lang.Get("LBL_CONNECTED"));
SettingsActivity_LaborStatus.setBackgroundColor(getColor(R.color.color_connected));
}
});
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
SettingsActivity_LaborStatus.setText(Lang.Get("LBL_DISCONNECTED"));
SettingsActivity_LaborStatus.setBackgroundColor(getColor(R.color.color_disconnected));
SettingsActivity_Loading.setVisibility(View.GONE);
Log.Critical(error, "SettingsActivity", "CheckLaborHost");
}
});
});
}
});
thread.start();
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "SettingsActivity", "CheckLaborHost");
}
}
/** BEGIN EVENTS **/
/**
* Go Back to MainActivity
*/
private void SettingsButtonBack_Click()
{
setResult(RESULT_OK);
this.finish();
}
/** END EVENTS **/
}

View File

@ -0,0 +1,199 @@
//
// SplashActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 04.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.content.Context;
import android.content.Intent;
import android.graphics.Point;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.constraintlayout.widget.ConstraintLayout;
import java.util.Timer;
import java.util.TimerTask;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Labor;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Models.Settings;
import de.labor_stein.befund.databinding.ActivityMainBinding;
public class SplashActivity extends AppCompatActivity
{
/** SplashActivityContext **/
private Context MainContext;
private ConstraintLayout ActivityRootLayout;
/** Limbach Logo **/
private ImageView LimbachLogo;
/** Labor Logo **/
private ImageView LaborLogo;
private static final int LogoWidth = 400;
private static final int LogoHeight = 120;
/** Settings **/
private de.labor_stein.befund.Core.Models.Settings Settings;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.Initialize();
}
/**
* Initialize SplashScreen
*/
private void Initialize()
{
MainContext = this;
this.Settings = de.labor_stein.befund.Core.Models.Settings.load(this);
if(this.Settings == null || this.Settings.labor == null)
{
Labor labor = GetLaborByStartParameter(getIntent());
if(labor != null)
{
if(this.Settings == null)
{
this.Settings = new Settings();
this.Settings.lang = Lang.GetSystemLang();
}
this.Settings.labor = labor;
this.Settings.save(this);
}
}
ActivityRootLayout = findViewById(R.id.SplashActivityRootLayout);
LimbachLogo = ActivityRootLayout.findViewById(R.id.logoLimbach);
LaborLogo = ActivityRootLayout.findViewById(R.id.logoLabor);
this.Animate();
}
/**
* Animates Logos on Splash Screen
*/
private void Animate()
{
try
{
if(this.Settings != null && this.Settings.labor != null)
{
Display display = getWindowManager().getDefaultDisplay();
Point displaySize = new Point();
display.getSize(displaySize);
int width = displaySize.x;
LimbachLogo.animate().translationX(width).setStartDelay(1000).setDuration(500).start();
LaborLogo.setX(-width);
LaborLogo.setVisibility(View.VISIBLE);
LaborLogo.setImageResource(this.Settings.labor.logo);
LaborLogo.animate().translationX(0).setStartDelay(1000).setDuration(500).start();
}
final Handler handler = new Handler();
handler.postDelayed(new Runnable()
{
@Override
public void run()
{
GoToMainActivity();
}
}, 2000);
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "SplashActivity", "Animate");
}
}
/**
* Returns labor by start parameter (data protocol S. Manifest: exp: befund://labor?id=LABOR_MOENCHENGLADBACH)
*
* @param intent - intent that gor query parameter
* @return Returns labor object by Intent incoming query
*/
public static Labor GetLaborByStartParameter(Intent intent)
{
Labor result = null;
try
{
if(intent != null)
{
Uri query = intent.getData();
if(query != null)
{
String id = query.getQueryParameter("id");
if(id != null && !id.isEmpty())
{
result = de.labor_stein.befund.Core.Models.Labor.GetLaborByName(id);
}
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "Core.Models.Session", "GetLabirByStartParameter(Ident)");
}
return result;
}
/**
* Goes ether to main activity or to labor activity to select labor
*/
private void GoToMainActivity()
{
if(this.Settings != null && this.Settings.labor != null)
{
Intent mainActivity = new Intent(this, MainActivity.class);
mainActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP);
Bundle parameters = new Bundle();
parameters.putBoolean("SplashScreenLoaded", true);
mainActivity.putExtras(parameters);
startActivity(mainActivity);
overridePendingTransition(R.anim.side_in_right, R.anim.side_out_left);
finish();
}
else
{
Intent laborActivity = new Intent(this, LaborActivity.class);
laborActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(laborActivity);
overridePendingTransition(R.anim.side_in_right, R.anim.side_out_left);
finish();
}
}
}

View File

@ -0,0 +1,830 @@
//
// PasswordActivity.java
// Befund
//
// Created by Irakli Abetschkhrischwili on 11.07.22.
// Copyright © 2022 MVZ Dr. Stein und Kollegen. All rights reserved.
package de.labor_stein.befund;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputType;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.Timer;
import java.util.TimerTask;
import de.labor_stein.befund.Core.Https.Request;
import de.labor_stein.befund.Core.Lang.Lang;
import de.labor_stein.befund.Core.Log;
import de.labor_stein.befund.Core.Models.Request.EncryptedRequest;
import de.labor_stein.befund.Core.Models.Request.Support;
import de.labor_stein.befund.Core.Models.Session;
import de.labor_stein.befund.Core.Models.Settings;
import de.labor_stein.befund.Core.Security.AES;
import de.labor_stein.befund.Core.Security.Curve25519;
import de.labor_stein.befund.Core.System;
public class SupportActivity extends AppCompatActivity
{
/** SupportActivityContext **/
private Context MainContext;
/** Layouts **/
private CoordinatorLayout SupportActivityRootLayout;
/** Buttons **/
private FloatingActionButton SupportActivityButtonBack;
private Button SupportActivity_BtnSend;
/** Controls **/
private TextView lblSupportActivity;
private TextView lblSupportActivityButtonBack;
private EditText SupportActivity_txtEmail;
private Spinner SupportActivity_Topics;
private EditText SupportActivity_txtTEXT;
private Button SupportActivity_btnSend;
private Button SupportActivity_btnHideKeyboard;
private TextView SupportActivity_PrivacyPolicy;
private TextView SupportActivity_Status;
private ProgressBar SupportActivity_Loading;
private TextView SupportActivity_lblYourLabor;
private boolean IsRunning = false;
/** List items **/
private String[] Topics = null;
/** BEGIN POPUPS **/
/** BEGIN PasswordConfirm **/
private PopupWindow PopupPasswordConfirm;
private View PopupPasswordConfirm_Overlay;
private LinearLayout PopupPasswordConfirm_Popup;
private LinearLayout PopupPasswordConfirmContent;
private EditText PopupPasswordConfirm_txtPassword;
private ImageView PopupPasswordConfirm_txtPasswordViewer;
private ProgressBar PopupPasswordConfirm_Loading;
private TextView PopupPasswordConfirm_Status;
private Button PopupPasswordConfirm_btnCancel;
private Button PopupPasswordConfirm_btnOk;
/** END PasswordConfirm **/
/** Settings **/
private de.labor_stein.befund.Core.Models.Settings Settings;
/** Labor Controls **/
private ImageView SupportActivity_LaborLogo;
private TextView SupportActivity_LaborName;
private TextView SupportActivity_LaborStreet;
private TextView SupportActivity_LaborCity;
private TextView SupportActivity_LaborTel;
private TextView SupportActivity_LaborWeb;
/** BEGIN Popup PrivacyPolicy **/
private PopupWindow PopupPrivacyPolicy;
private TextView PopupPrivacyPolicy_lblHeader;
private Button PopupPrivacyPolicy_btnAcceptPrivacyPolicy;
private WebView PopupPrivacyPolicy_web;
/** END Popup PrivacyPolicy **/
private ImageView btnSupportActivityImpressumCollapse;
private LinearLayout btnSupportActivityImpressum;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_support);
this.Initialize();
}
@Override
protected void onResume()
{
super.onResume();
this.InitializeLanguages();
}
/**
* Initialize SupportActivityContext
*/
private void Initialize()
{
MainContext = this;
this.Settings = de.labor_stein.befund.Core.Models.Settings.load(this);
this.InitializeControls();
this.InitializeLayouts();
this.InitializeLabels();
this.InitializeButtons();
this.InitializeLabor();
this.InitializePopup();
this.InitializeLanguages();
}
/**
* Initializes Languages
*/
private void InitializeLanguages()
{
lblSupportActivity.setText(Lang.Get("LBL_SUPPORT"));
lblSupportActivityButtonBack.setText(Lang.Get("BTN_BACK"));
SupportActivity_txtEmail.setHint(Lang.Get("LBL_EMAIL"));
SupportActivity_btnSend.setText(Lang.Get("BTN_SEND"));
SupportActivity_txtTEXT.setHint(Lang.Get("LBL_TEXT"));
SupportActivity_btnHideKeyboard.setText(Lang.Get("BTN_HIDE_KEYBOARD"));
PopupPasswordConfirm_btnCancel.setText(Lang.Get("BTN_CANCEL"));
PopupPasswordConfirm_btnOk.setText(Lang.Get("BTN_OK"));
PopupPasswordConfirm_txtPassword.setHint(Lang.Get("LBL_PASSWORD"));
SupportActivity_lblYourLabor.setText(Lang.Get("LBL_YOUR_LABOR"));
SupportActivity_PrivacyPolicy.setText(Lang.Get("BTN_PRIVACY_POLICY"));
}
/**
* Initializes Popup
*/
private void InitializePopup()
{
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
PopupPasswordConfirm_Overlay = inflater.inflate(R.layout.popup_confirm_password, null);
PopupPasswordConfirm_Popup = PopupPasswordConfirm_Overlay.findViewById(R.id.PopupPasswordConfirm_Popup);
PopupPasswordConfirmContent = PopupPasswordConfirm_Overlay.findViewById(R.id.PopupPasswordConfirmContent);
PopupPasswordConfirm_btnCancel = PopupPasswordConfirm_Overlay.findViewById(R.id.PopupPasswordConfirm_BtnCancel);
PopupPasswordConfirm_btnCancel.setOnClickListener(v -> { this.PopupPasswordConfirm_btnCancel_Click(); });
PopupPasswordConfirm_btnOk = PopupPasswordConfirm_Overlay.findViewById(R.id.PopupPasswordConfirm_BtnEncrypt);
PopupPasswordConfirm_btnOk.setOnClickListener(v -> { this.PopupPasswordConfirm_btnOk_Click(); });
PopupPasswordConfirm_Loading = PopupPasswordConfirm_Overlay.findViewById(R.id.PopupPasswordConfirm_Loading);
PopupPasswordConfirm_Status = PopupPasswordConfirm_Overlay.findViewById(R.id.PopupPasswordConfirm_Status);
PopupPasswordConfirm_txtPassword = PopupPasswordConfirm_Overlay.findViewById(R.id.PopupPasswordConfirm_txtPassword);
PopupPasswordConfirm_txtPasswordViewer = PopupPasswordConfirm_Overlay.findViewById(R.id.PopupPasswordConfirm_txtPasswordViewer);
PopupPasswordConfirm_txtPasswordViewer.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
if (event.getAction() == android.view.MotionEvent.ACTION_DOWN)
{
PopupPasswordConfirm_txtPasswordViewer.setAlpha(1.0f);
PopupPasswordConfirm_txtPassword.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
PopupPasswordConfirm_txtPassword.setSelection(PopupPasswordConfirm_txtPassword.getText().length());
}
else if (event.getAction() == android.view.MotionEvent.ACTION_UP)
{
PopupPasswordConfirm_txtPasswordViewer.setAlpha(0.5f);
PopupPasswordConfirm_txtPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
PopupPasswordConfirm_txtPassword.setSelection(PopupPasswordConfirm_txtPassword.getText().length());
}
return true;
}
});
PopupPasswordConfirm_txtPassword.setOnKeyListener(new View.OnKeyListener()
{
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if(keyCode == KeyEvent.KEYCODE_ENTER)
{
PopupPasswordConfirm_btnOk_Click();
}
return false;
}
});
PopupPasswordConfirm_Loading.setVisibility(View.GONE);
PopupPasswordConfirm_Status.setText("");
/** Create popup window context **/
PopupPasswordConfirm = new PopupWindow(
PopupPasswordConfirm_Overlay,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
true
);
}
private void InitializeControls()
{
if(Session.IsLoggedIn())
{
this.Topics = new String[] {
Lang.Get("LBL_SUPPORT_TOPIC_INFO"),
Lang.Get("LBL_SUPPORT_TOPIC_TROUBLE"),
Lang.Get("LBL_SUPPORT_TOPIC_ACCOUNT_DELETE")
};
}
else
{
this.Topics = new String[] {
Lang.Get("LBL_SUPPORT_TOPIC_INFO"),
Lang.Get("LBL_SUPPORT_TOPIC_TROUBLE")
};
}
}
/**
* Initializes Labor info
*/
private void InitializeLabor()
{
if(this.Settings.labor != null)
{
SupportActivity_LaborLogo = SupportActivityRootLayout.findViewById(R.id.SupportActivity_LaborLogo);
SupportActivity_LaborLogo.setImageResource(this.Settings.labor.logo);
if(this.Settings.labor.name != null && !this.Settings.labor.name.isEmpty())
{
SupportActivity_LaborName = SupportActivityRootLayout.findViewById(R.id.SupportActivity_LaborName);
SupportActivity_LaborName.setText(this.Settings.labor.name);
}
if(this.Settings.labor.street != null && !this.Settings.labor.street.isEmpty())
{
SupportActivity_LaborStreet = SupportActivityRootLayout.findViewById(R.id.SupportActivity_LaborStreet);
SupportActivity_LaborStreet.setText(this.Settings.labor.street);
}
if(this.Settings.labor.city != null && !this.Settings.labor.city.isEmpty())
{
SupportActivity_LaborCity = SupportActivityRootLayout.findViewById(R.id.SupportActivity_LaborCity);
SupportActivity_LaborCity.setText(this.Settings.labor.city);
}
if(this.Settings.labor.tel != null && !this.Settings.labor.tel.isEmpty())
{
SupportActivity_LaborTel = SupportActivityRootLayout.findViewById(R.id.SupportActivity_LaborTel);
SupportActivity_LaborTel.setText(this.Settings.labor.tel);
}
if(this.Settings.labor.web != null && !this.Settings.labor.web.isEmpty())
{
SupportActivity_LaborWeb = SupportActivityRootLayout.findViewById(R.id.SupportActivity_LaborWeb);
SupportActivity_LaborWeb.setText(this.Settings.labor.web);
}
btnSupportActivityImpressumCollapse = SupportActivityRootLayout.findViewById(R.id.btnSupportActivityImpressumCollapse);
btnSupportActivityImpressum = SupportActivityRootLayout.findViewById(R.id.btnSupportActivityImpressum);
btnSupportActivityImpressumCollapse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(btnSupportActivityImpressum.getVisibility() == View.VISIBLE)
{
btnSupportActivityImpressumCollapse.setImageResource(R.drawable.ic_arrow_drop_down_circle);
btnSupportActivityImpressum.setVisibility(View.GONE);
}
else
{
btnSupportActivityImpressumCollapse.setImageResource(R.drawable.ic_arrow_drop_up_circle);
btnSupportActivityImpressum.setVisibility(View.VISIBLE);
}
}
});
}
}
/**
* Initialize Layouts
*/
private void InitializeLayouts()
{
SupportActivityRootLayout = (CoordinatorLayout)findViewById(R.id.SupportActivityRootLayout);
}
/**
* Initializes Labels
*/
private void InitializeLabels()
{
lblSupportActivity = SupportActivityRootLayout.findViewById(R.id.lblSupportActivity);
lblSupportActivityButtonBack = SupportActivityRootLayout.findViewById(R.id.lblSupportActivityButtonBack);
SupportActivity_txtEmail = SupportActivityRootLayout.findViewById(R.id.SupportActivity_txtEmail);
SupportActivity_lblYourLabor = SupportActivityRootLayout.findViewById(R.id.SupportActivity_lblYourLabor);
SupportActivity_txtTEXT = SupportActivityRootLayout.findViewById(R.id.AupportActivity_txtTEXT);
SupportActivity_Status = SupportActivityRootLayout.findViewById(R.id.SupportActivity_Status);
SupportActivity_Loading = SupportActivityRootLayout.findViewById(R.id.SupportActivity_Loading);
SupportActivity_Loading.setVisibility(View.INVISIBLE);
/** Run RequestPGS on ENTER KEY (SampleID) **/
SupportActivity_txtTEXT.setOnFocusChangeListener(new View.OnFocusChangeListener()
{
@Override
public void onFocusChange(View v, boolean hasFocus)
{
if(hasFocus)
{
SupportActivity_btnHideKeyboard.setVisibility(View.VISIBLE);
}
}
});
SupportActivity_txtTEXT.setOnClickListener(v -> { SupportActivity_btnHideKeyboard.setVisibility(View.VISIBLE); });
SupportActivity_txtTEXT.setOnKeyListener(new View.OnKeyListener()
{
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
SupportActivity_btnHideKeyboard.setVisibility(View.VISIBLE);
return false;
}
});
SupportActivity_Topics = SupportActivityRootLayout.findViewById(R.id.AupportActivity_Topics);
ArrayAdapter aa = new ArrayAdapter(this, android.R.layout.simple_spinner_item, this.Topics);
aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
SupportActivity_Topics.setAdapter(aa);
SupportActivity_txtEmail.setVisibility(View.VISIBLE);
SupportActivity_Topics.setVisibility(View.VISIBLE);
SupportActivity_txtTEXT.setVisibility(View.VISIBLE);
}
/**
* Initializes Buttons
*/
private void InitializeButtons()
{
SupportActivityButtonBack = SupportActivityRootLayout.findViewById(R.id.SupportActivityButtonBack);
SupportActivityButtonBack.setOnClickListener(v ->{ this.ActivityButtonBack_Click(); });
//SupportActivityButtonBack.setOnClickListener((v) -> { PopupCWAPolicy.dismiss(); });
SupportActivity_btnSend = SupportActivityRootLayout.findViewById(R.id.AupportActivity_btnSend);
SupportActivity_btnHideKeyboard = SupportActivityRootLayout.findViewById(R.id.SupportActivity_btnHideKeyboard);
SupportActivity_btnHideKeyboard.setOnClickListener(v -> { this.HideKeyboard(SupportActivity_txtTEXT); });
SupportActivity_btnHideKeyboard.setVisibility(View.GONE);
SupportActivity_btnSend.setVisibility(View.VISIBLE);
SupportActivity_btnSend.setOnClickListener(v -> { this.SupportActivity_btnSend_Click(); });
SupportActivity_PrivacyPolicy = SupportActivityRootLayout.findViewById(R.id.SupportActivity_PrivacyPolicy);
SupportActivity_PrivacyPolicy.setVisibility(View.INVISIBLE);
//SupportActivity_PrivacyPolicy.setOnClickListener(new View.OnClickListener()
//{
// @Override
// public void onClick(View v) {
// ShowPrivacyPolicy();
// }
//});
}
/** Shows privacy policy popup**/
private void ShowPrivacyPolicy()
{
this.InitializePrivacyPolicyPopup();
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setText(Lang.Get("BTN_CLOSE"));
this.LoadPrivacyPolicy();
}
/**
* Initializes PrivacyPolicy Popup
*/
private void InitializePrivacyPolicyPopup()
{
Lang.SetLanguage(Lang.GetSystemLang());
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View PopupPrivacyPolicyView = inflater.inflate(R.layout.popup_privacy_policy, null);
PopupPrivacyPolicy_lblHeader = PopupPrivacyPolicyView.findViewById(R.id.PopupPrivacyPolicy_lblHeader);
PopupPrivacyPolicy_btnAcceptPrivacyPolicy = PopupPrivacyPolicyView.findViewById(R.id.PopupPrivacyPolicy_btnAccept);
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setEnabled(false);
PopupPrivacyPolicy_lblHeader.setText(Lang.Get("LBL_PRIVACY_POLICY"));
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setText(Lang.Get("BTN_ACCEPT_PRIVACY_POLICY"));
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setOnClickListener((v) ->
{
PopupPrivacyPolicy.dismiss();
});
/** Create popup window context **/
PopupPrivacyPolicy = new PopupWindow(
PopupPrivacyPolicyView,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
true
);
PopupPrivacyPolicy_web = PopupPrivacyPolicyView.findViewById(R.id.PopupPrivacyPolicy_web);
this.SupportActivityRootLayout.post(new Runnable()
{
public void run()
{
LoadPrivacyPolicy();
PopupPrivacyPolicy.showAtLocation(SupportActivityRootLayout, Gravity.CENTER,0,0);
}
});
}
/**
* Load PrivacyPolicy
*/
private void LoadPrivacyPolicy()
{
try
{
/** Run request on sub thread **/
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
Request.GetResponseAsync(Settings.GetPrivacyPolicyURL(),
"GET",
(content) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PopupPrivacyPolicy_web.loadUrl(Settings.GetPrivacyPolicyURL());
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setEnabled(true);
}
});
},
(error) ->
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PopupPrivacyPolicy_btnAcceptPrivacyPolicy.setEnabled(true);
byte[] local_privacy_policy_data = System.ReadFromAssets("no_connection.html", MainContext);
if(local_privacy_policy_data != null && local_privacy_policy_data.length > 0)
{
String html = new String(local_privacy_policy_data);
html = html.replace("[NO_CONNECTION]", Lang.Get("ERROR_PRIVACY_POLICY_NEEDS_CONNECTION"));
PopupPrivacyPolicy_web.loadData(html, "text/html", "utf-8");
}
}
});
});
}
});
thread.start();
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "SupportActivity", "LoadPrivacyPolicy");
}
}
/** Hide Keyboard **/
public void HideKeyboard(View view)
{
InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(this.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
SupportActivity_btnHideKeyboard.setVisibility(View.GONE);
}
private void ActivityButtonBack_Click()
{
this.finish();
}
/**
* Go Back to MainActivity
*/
private void PasswordActivityButtonBack_Click()
{
Intent intent = new Intent(this, MainActivity.class );
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Bundle parameters = new Bundle();
parameters.putBoolean("SplashScreenLoaded", true);
intent.putExtras(parameters);
startActivity(intent);
overridePendingTransition(R.anim.side_in_left, R.anim.side_out_right);
}
/**
* Send support to server
*/
private void SupportActivity_btnSend_Click()
{
try
{
SupportActivity_Status.setText("");
SupportActivity_Loading.setVisibility(View.GONE);
if(SupportActivity_txtEmail.getText() == null || SupportActivity_txtEmail.getText().toString().isEmpty())
{
this.SupportActivity_HideLoading(Lang.Get("ERROR_ENTER_EMAIL"));
}
else if(SupportActivity_Topics.getSelectedItemPosition() < 0)
{
this.SupportActivity_HideLoading(Lang.Get("ERROR_ENTER_TOPIC"));
}
else if(SupportActivity_txtTEXT.getText() == null || SupportActivity_txtTEXT.getText().toString().isEmpty())
{
this.SupportActivity_HideLoading(Lang.Get("ERROR_ENTER_TEXT"));
}
else
{
String email = SupportActivity_txtEmail.getText().toString();
int topicIndex = (int)SupportActivity_Topics.getSelectedItemId();
String topic = Topics[topicIndex];
String text = SupportActivity_txtTEXT.getText().toString();
if(topic == Lang.Get("LBL_SUPPORT_TOPIC_ACCOUNT_DELETE"))
{
PopupPasswordConfirm_Show();
}
else
{
this.SendAsync(email, topic, text, false);
}
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "SupportActivity", "AupportActivity_btnSend_Click");
}
}
/**
* Send request async
*/
private void SendAsync(String email, String topic, String text, boolean delete_device)
{
try
{
if(!IsRunning)
{
IsRunning = true;
Curve25519.KeyPair requestKeyPair = Curve25519.GenerateKeyPair();
Support support = new Support();
support.email = email;
support.topic = topic;
support.text = text;
support.udid = Session.Device.udid;
support.verificator_hash = this.Settings.verificator_hash;
support.delete_device = delete_device;
SupportActivity_Loading.setVisibility(View.VISIBLE);
/** Run request on sub thread **/
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
/** Update verificator_hash & pin on the server **/
Request.KeyExchangeAsync(Settings.labor.host,
requestKeyPair,
(publicKey) ->
{
byte[] sharedKey = requestKeyPair.GetSharedKey(publicKey.key);
EncryptedRequest request = new EncryptedRequest("Support", support, sharedKey);
Request.EncryptedRequestAsync(Settings.labor.host,
"results",
"support",
request,
publicKey,
requestKeyPair,
(encryptedResponse) ->
{
IsRunning = false;
encryptedResponse.Decrypt(sharedKey);
/** Run on main Thread **/
runOnUiThread(new Runnable()
{
@Override
public void run()
{
if(encryptedResponse.descriptor.toLowerCase().equals("success"))
{
if(delete_device)
{
if(System.DeleteAllFiles(MainContext) && Settings.delete(MainContext))
{
SupportActivity_HideLoading(Lang.Get("MSG_ACCOUNT_SUCCESSFULLY_DELETED"));
new Timer().schedule(new TimerTask()
{
@Override
public void run()
{
GoToLaborActivity();
}
}, 1000);
}
else
{
SupportActivity_HideLoading(Lang.Get("ERROR_ACCOUNT_COULD_NOT_DELETED"));
}
}
else
{
SupportActivity_HideLoading(Lang.Get("MSG_SUPPORT_SUCCESSFULLY_SENT"));
}
}
else
{
SupportActivity_HideLoading(Lang.Get("ERROR_SUPPORT_COULD_NOT_SENT"));
}
SupportActivity_txtEmail.setText("");
SupportActivity_txtTEXT.setText("");
}
});
},
(error) ->
{
IsRunning = false;
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PopupPasswordConfirm_Status.setText("");
PopupPasswordConfirm_Loading.setVisibility(View.GONE);
SupportActivity_HideLoading(error);
Log.Critical(error, "SupportActivity", "SendAsync");
}
});
});
},
(error) ->
{
IsRunning = false;
runOnUiThread(new Runnable()
{
@Override
public void run()
{
PopupPasswordConfirm_Status.setText("");
PopupPasswordConfirm_Loading.setVisibility(View.GONE);
SupportActivity_HideLoading(error);
Log.Critical(error, "SupportActivity", "SendAsync");
}
});
});
}
});
thread.start();
}
}
catch (Exception ex)
{
Log.Error(ex.getMessage(), "SupportActivity", "SendAsync");
}
}
/** Hide SupportActivity Loading with optional status message **/
private void SupportActivity_HideLoading(String message)
{
SupportActivity_Loading.setVisibility(View.INVISIBLE);
if(message != null && !message.isEmpty())
{
SupportActivity_Status.setText(message);
}
}
/**
* Confirm password
*/
private void PopupPasswordConfirm_btnOk_Click()
{
PopupPasswordConfirm_Status.setText("");
if(PopupPasswordConfirm_txtPassword.getText() == null || PopupPasswordConfirm_txtPassword.getText().toString().isEmpty())
{
PopupPasswordConfirm_Status.setText(Lang.Get("ERROR_ENTER_PASSWORD"));
}
else
{
String tmp_decrypted = AES.Decrypt(this.Settings.hashed_private_key, AES.GetKey(PopupPasswordConfirm_txtPassword.getText().toString()));
if(tmp_decrypted == null)
{
PopupPasswordConfirm_Status.setText(Lang.Get("ERROR_INVALID_PASSWORD"));
}
else
{
String email = SupportActivity_txtEmail.getText().toString();
int topicIndex = (int)SupportActivity_Topics.getSelectedItemId();
String topic = Topics[topicIndex];
String text = SupportActivity_txtTEXT.getText().toString();
this.SendAsync(email, topic, text, true);
PopupPasswordConfirm_Hide();
}
}
}
/**
* Hides Password confirm popup on cancel button
*/
private void PopupPasswordConfirm_btnCancel_Click()
{
this.PopupPasswordConfirm_Hide();
}
/**
* Show Password Confirm Popup
*/
private void PopupPasswordConfirm_Show()
{
PopupPasswordConfirm_txtPassword.setText("");
PopupPasswordConfirm_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_in));
PopupPasswordConfirm_Popup.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_in));
if(!PopupPasswordConfirm.isShowing())
{
PopupPasswordConfirm.showAtLocation(SupportActivityRootLayout, Gravity.CENTER,0,0);
}
}
/**
* Hides Password confirm popup
*/
private void PopupPasswordConfirm_Hide()
{
PopupPasswordConfirm_Overlay.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_overlay_out));
PopupPasswordConfirm_Popup.setAnimation(AnimationUtils.loadAnimation(this, R.anim.popup_out));
if(PopupPasswordConfirm.isShowing())
{
Animation anim = AnimationUtils.loadAnimation(this, R.anim.popup_out);
anim.setAnimationListener(new Animation.AnimationListener()
{
@Override
public void onAnimationStart(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation)
{
PopupPasswordConfirm.dismiss();
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
anim.setFillAfter(true);
PopupPasswordConfirm_Popup.startAnimation(anim);
}
}
/**
* Goes to Labor activity
*/
private void GoToLaborActivity()
{
Intent laborActivity = new Intent(this, LaborActivity.class);
laborActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(laborActivity);
overridePendingTransition(R.anim.side_in_right, R.anim.side_out_left);
finish();
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0%p"
android:toXDelta="100%p"
android:duration="600"
android:fillAfter="true">
</translate>
</set>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:fromXScale="0.1"
android:toXScale="1"
android:fromYScale="0.1"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:duration="200"/>
</set>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:fromXScale="1"
android:toXScale="0"
android:fromYScale="1"
android:toYScale="0"
android:pivotX="50%"
android:pivotY="50%"
android:duration="200"/>
</set>

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