Skip to content

Commit

Permalink
Merge branch 'development' into 'fix-lint-errors'
Browse files Browse the repository at this point in the history
  • Loading branch information
udenr committed Apr 8, 2024
2 parents 53bad09 + 524a072 commit fbbf9ae
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 37 deletions.
30 changes: 26 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
# Changelog

<a name="v1.3.1"></a>
## [Pain Diary (Privacy Friendly) v1.3.1](https://github.com/SecUSo/privacy-friendly-pain-diary/releases/tag/v1.3.1) - 12 Mar 2024

## What's Changed
* Add ci workflow by [@udenr](https://github.com/udenr) in https://github.com/SecUSo/privacy-friendly-pain-diary/pull/34
* Fix unit tests by [@udenr](https://github.com/udenr) in https://github.com/SecUSo/privacy-friendly-pain-diary/pull/35
* Update backup api to v1.2.0 by [@udenr](https://github.com/udenr) in https://github.com/SecUSo/privacy-friendly-pain-diary/pull/36
* documentation: Added info re: Privacy Friendly Backup by [@jahway603](https://github.com/jahway603) in https://github.com/SecUSo/privacy-friendly-pain-diary/pull/30
* Update to version 1.3.1 by [@udenr](https://github.com/udenr) in https://github.com/SecUSo/privacy-friendly-pain-diary/pull/37
* Updates Copyright by [@coderPaddyS](https://github.com/coderPaddyS) in https://github.com/SecUSo/privacy-friendly-pain-diary/pull/39
* Update backup api to v1.3.0 by [@coderPaddyS](https://github.com/coderPaddyS)

## New Contributors
* [@jahway603](https://github.com/jahway603) made their first contribution in https://github.com/SecUSo/privacy-friendly-pain-diary/pull/30
* [@coderPaddyS](https://github.com/coderPaddyS) made their first contribution in https://github.com/SecUSo/privacy-friendly-pain-diary/pull/39

**Full Changelog**: https://github.com/SecUSo/privacy-friendly-pain-diary/compare/v1.3.0...v1.3.1

[Changes][v1.3.1]


<a name="v1.3.0"></a>
## [Pain Diary (Privacy Friendly) v1.3.0 (v1.3.0)](https://github.com/SecUSo/privacy-friendly-pain-diary/releases/tag/v1.3.0) - 03 Aug 2022
## [Pain Diary (Privacy Friendly) v1.3.0](https://github.com/SecUSo/privacy-friendly-pain-diary/releases/tag/v1.3.0) - 03 Aug 2022

## What's Changed
* Update backup api to latest version to support the Backup App from F-Droid by [@udenr](https://github.com/udenr)
Expand All @@ -12,7 +33,7 @@


<a name="v1.2"></a>
## [Pain Diary (Privacy Friendly) v1.2 (v1.2)](https://github.com/SecUSo/privacy-friendly-pain-diary/releases/tag/v1.2) - 22 Jul 2022
## [Pain Diary (Privacy Friendly) v1.2](https://github.com/SecUSo/privacy-friendly-pain-diary/releases/tag/v1.2) - 22 Jul 2022

## What's Changed
* Update README.md by [@Poussinou](https://github.com/Poussinou) in https://github.com/SecUSo/privacy-friendly-pain-diary/pull/10
Expand All @@ -32,7 +53,7 @@


<a name="v1.0"></a>
## [Privacy Friendly Pain Diary v1.0 (v1.0)](https://github.com/SecUSo/privacy-friendly-pain-diary/releases/tag/v1.0) - 29 Mar 2018
## [Privacy Friendly Pain Diary v1.0](https://github.com/SecUSo/privacy-friendly-pain-diary/releases/tag/v1.0) - 29 Mar 2018

Privacy Friendly Pain Diary can help you track and "share" your pain. It allows you to make daily diary
entries recording your condition and the intensity, location, nature and time of the pain you feel, as
Expand All @@ -48,8 +69,9 @@ https://secuso.org/pfa.
[Changes][v1.0]


[v1.3.1]: https://github.com/SecUSo/privacy-friendly-pain-diary/compare/v1.3.0...v1.3.1
[v1.3.0]: https://github.com/SecUSo/privacy-friendly-pain-diary/compare/v1.2...v1.3.0
[v1.2]: https://github.com/SecUSo/privacy-friendly-pain-diary/compare/v1.0...v1.2
[v1.0]: https://github.com/SecUSo/privacy-friendly-pain-diary/tree/v1.0

<!-- Generated by https://github.com/rhysd/changelog-from-release -->
<!-- Generated by https://github.com/rhysd/changelog-from-release v3.7.2 -->
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ GNU General Public License for more details.<br/>
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.<br/>

The icons used in the navigation drawer are licensed under the [CC BY 2.5](http://creativecommons.org/licenses/by/2.5/). In addition to them the app uses icons from [Google Design Material Icons](https://design.google.com/icons/index.html) licensed under Apache License Version 2.0. All other images (the logo of Privacy Friendly Apps, the SECUSO logo and the app logo) copyright [Karlsruhe Institute of Technology](https://kit.edu) (2016-2022).
The icons used in the navigation drawer are licensed under the [CC BY 2.5](http://creativecommons.org/licenses/by/2.5/). In addition to them the app uses icons from [Google Design Material Icons](https://design.google.com/icons/index.html) licensed under Apache License Version 2.0. All other images (the logo of Privacy Friendly Apps, the SECUSO logo and the app logo) copyright [SECUSO](www.secuso.org) (2016-2024).

## Contributors

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />

<supports-screens
android:anyDensity="true"
Expand Down Expand Up @@ -137,4 +138,4 @@
</provider>

</application>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ License, or (at your option) any later version.
import android.widget.DatePicker;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
Expand Down Expand Up @@ -74,7 +75,7 @@ public class ExportPDFActivity extends AppCompatActivity {
private TextInputLayout startDateWrapper;
private TextInputLayout endDateWrapper;

private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.US);
private final SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.US);
private Date startDate;
private Date endDate;

Expand Down Expand Up @@ -134,7 +135,7 @@ public void onClick(View view) {
case R.id.btn_export:
LiveData<File> fileLive = exportAsPDF();
final ExportPDFActivity activity = this;
fileLive.observe(this, new Observer<File>() {
fileLive.observe(this, new Observer<>() {
@Override
public void onChanged(File file) {
if (file != null) {
Expand Down Expand Up @@ -196,7 +197,7 @@ public void onDateSet(DatePicker datePicker, int year, int month, int day) {
}

private LiveData<File> exportAsPDF() {
final MutableLiveData<File>[] file = new MutableLiveData[]{new MutableLiveData<>()};
final MutableLiveData<File> file = new MutableLiveData<>();
if (startDate == null) {
startDateWrapper.setError(getString(R.string.start_date_error));
} else if (endDate == null) {
Expand All @@ -206,25 +207,22 @@ private LiveData<File> exportAsPDF() {
diaryEntriesLive.observe(this, diaryEntryInterfaces -> {
long userID = new PrefManager(this).getUserID();
if (userID == AbstractPersistentObject.INVALID_OBJECT_ID) {
file[0].setValue(exportAsPDF(new PdfCreator(this, startDate, endDate, diaryEntryInterfaces, new User()).createPdfDocument()));
file.setValue(exportAsPDF(new PdfCreator(this, startDate, endDate, diaryEntryInterfaces, new User()).createPdfDocument()));
} else {
LiveData<UserInterface> userLive = database.getUserByID(userID);
userLive.observe(this, userInterface -> {
file[0].setValue(exportAsPDF(new PdfCreator(this, startDate, endDate, diaryEntryInterfaces, userInterface).createPdfDocument()));
file.setValue(exportAsPDF(new PdfCreator(this, startDate, endDate, diaryEntryInterfaces, userInterface).createPdfDocument()));
});
}
});
}
return file[0];
return file;
}

private File exportAsPDF(PdfDocument doc) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(ExportPDFActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(ExportPDFActivity.this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE);
return null;
}
}
Expand All @@ -237,7 +235,7 @@ private File exportAsPDF(PdfDocument doc) {
}
}

SimpleDateFormat s = new SimpleDateFormat("ddMMyyyy");
SimpleDateFormat s = new SimpleDateFormat("ddMMyyyy", Locale.getDefault());
String filename = s.format(startDate) + "-" + s.format(endDate);
File file = new File(directory, filename + ".pdf");
if (file.exists()) {
Expand Down Expand Up @@ -277,17 +275,15 @@ public void onChanged(File file) {
}

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, getString(R.string.permission_write_granted), Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, getString(R.string.permission_write_denied), Toast.LENGTH_LONG).show();
}
return;
if (requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, getString(R.string.permission_write_granted), Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, getString(R.string.permission_write_denied), Toast.LENGTH_LONG).show();
}
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ abstract class PainDiaryDatabase : RoomDatabase() {
.build()
}

private val roomCallback: Callback = object : Callback() {
override fun onCreate(db: SupportSQLiteDatabase) {
super.onCreate(db)
}
}
private val roomCallback: Callback = object: Callback() {}

// object : Callback() {
// override fun onCreate(db: SupportSQLiteDatabase) {
// super.onCreate(db)
// }
// }


val MIGRATION_1_2 = object : Migration(1, 2) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<string name="about_author">Autoren: </string>
<string name="about_author_contributors">und Mitwirkende.</string>
<string name="about_affiliation">In Zusammenarbeit mit</string>
<string name="privacy_friendly">Diese App gehört zur Gruppe der Privacy Friendly Apps entwickelt von der Technischen Universität Darmstadt. Quelltext lizenziert unter GPLv3. Bilder copyright TU Darmstadt und Google Inc.</string>
<string name="privacy_friendly">Diese App gehört zur Gruppe der Privacy Friendly Apps entwickelt vom Karlsruher Institut für Technologie. Quelltext lizenziert unter GPLv3. Bilder copyright KIT und Google Inc.</string>
<string name="more_info">Weitere Infos unter:</string>

<!-- ### SETTINGS ### -->
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<string name="about_author">Autores: </string>
<string name="about_author_contributors">y contribuidores.</string>
<string name="about_affiliation">En afiliación con</string>
<string name="privacy_friendly">Esta aplicación pertenece al grupo de Aplicaciones que respetan la privacidad desarrolladas por Technische Universität Darmstadt. Código fuente bajo licencia GPLv3. Derechos de autor de las imágenes TU Darmstadt y Google Inc.</string>
<string name="privacy_friendly">Esta aplicación pertenece al grupo de Aplicaciones que respetan la privacidad desarrolladas por Karlsruhe Institute of Technology. Código fuente bajo licencia GPLv3. Derechos de autor de las imágenes KIT y Google Inc.</string>
<string name="more_info">Se puede encontrar más información en:</string>

<!-- ### SETTINGS ### -->
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<string name="about_author_names" translatable="false">Karola Marky, Susanne Felsen, Rybien Sinjari</string>
<string name="about_author_contributors">and contributors.</string>
<string name="about_affiliation">In affiliation with</string>
<string name="privacy_friendly">This application belongs to the group of Privacy Friendly Apps developed by Technische Universität Darmstadt. Sourcecode licensed under GPLv3. Images copyright TU Darmstadt and Google Inc.</string>
<string name="privacy_friendly">This application belongs to the group of Privacy Friendly Apps developed by Karlsruhe Institute of Technology. Sourcecode licensed under GPLv3. Images copyright KIT and Google Inc.</string>
<string name="more_info">More information can be found on:</string>
<string name="github" translatable="false"><a href="https://github.com/SecUSo/privacy-friendly-pain-diary">Github-Repo</a></string>
<string name="url" translatable="false"><a href="https://www.secuso.org/pfa">SECUSO-Website</a></string>
Expand Down

0 comments on commit fbbf9ae

Please sign in to comment.