Compare commits
153 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 562d3662da | |||
| c97656a5d0 | |||
| 1b5f7918ce | |||
| 49e575e462 | |||
| ddc5cea6bd | |||
| 52ecbeb7d7 | |||
| d021267fcd | |||
| 6cb3e218c4 | |||
| 7b3aa69732 | |||
| 9f2c84d673 | |||
| 0ba9bfda35 | |||
| dcbfc23070 | |||
| 42d01a9abe | |||
| 67e30728f0 | |||
| 75a186f37c | |||
| 74c539c1de | |||
| 7a9626e860 | |||
| 63d4dc289e | |||
| 742770826e | |||
| 9887622c75 | |||
| c159f7b654 | |||
| a5b1d6ab98 | |||
| 0761586405 | |||
| 10e8c2a1e6 | |||
| eaaa2fe9e6 | |||
| d3e678ef27 | |||
| ce344ba55b | |||
| 11fa2d784f | |||
| 8c179f3ccb | |||
| 4bd99cc3e6 | |||
| adca61deaf | |||
| 18683636b2 | |||
| fac9d1d58a | |||
| 17d3e4da98 | |||
| c0cb48078d | |||
| 8c0326cebb | |||
| f3c444c025 | |||
| 1f4ae087d1 | |||
| 1aa4382529 | |||
| 3827ac802c | |||
| 93232a5a26 | |||
| b9e823ff8f | |||
| 6c47546d8e | |||
| 1ebbe18252 | |||
| 32e75598cd | |||
| efff4078ab | |||
| c4122bcf1a | |||
| 0138b6c40d | |||
| 81b1a80622 | |||
| bfe63b9577 | |||
| 42489f019d | |||
| 9a967c58eb | |||
| d0afd9bd8a | |||
| 3fd1567ccf | |||
| 7d14124bde | |||
| 84bef6b9c1 | |||
| 976317437e | |||
| f529528145 | |||
| cb9b235b30 | |||
| 0c183df154 | |||
| 7dff72bd0f | |||
| 0011124c76 | |||
| e08ba7e27c | |||
| ae6de92387 | |||
| 0bec9f2848 | |||
| cc8116c10b | |||
| 7d18b4bd59 | |||
| 46be7f77e5 | |||
| 8db8e05f4d | |||
| 40a1662797 | |||
| 60e54ae92a | |||
| 8f0d07b299 | |||
| 13fea74597 | |||
| 2014c0509b | |||
| 3cfe7a5a79 | |||
| e0399f7075 | |||
| b49f2d5427 | |||
| 19717b6bef | |||
| 81c00ef2da | |||
| 54456f9629 | |||
| da2bab9db5 | |||
| 37e92222d5 | |||
| e2cda6afb1 | |||
| bb52a69ff7 | |||
| ce33ef40d6 | |||
| e27651e9dd | |||
| cd01a5390d | |||
| 1597613f72 | |||
| ec78f31ce5 | |||
| e8833dd11b | |||
| 07a9fa630c | |||
| 96623d73a0 | |||
| 58ba5f48c5 | |||
| 51a34e4463 | |||
| c3b1c53622 | |||
| 5f1ed57f42 | |||
| c77845abf5 | |||
| cb128311c7 | |||
| 7b3a8780f6 | |||
| a7a05cc5fa | |||
| 80af757d4d | |||
| d243402082 | |||
| 297df3da1a | |||
| a0a77f6311 | |||
| db66908534 | |||
| b7f57c4748 | |||
| 88ce02dfda | |||
| 1239f83cd6 | |||
| dc28ac3271 | |||
| f39b9303b5 | |||
| 95f42dd15f | |||
| 8fe0c8ec36 | |||
| 079a4f4907 | |||
| df9f81bc01 | |||
| 21896b82ac | |||
| cdfed475a9 | |||
| 87d3b988ff | |||
| d48f208e14 | |||
| c66e95b83e | |||
| ee58f8026a | |||
| 267f0c84fb | |||
| 203d225955 | |||
| 6d6c7577da | |||
| 8cbb78e276 | |||
| d682d780e0 | |||
| d32c546571 | |||
| f5caf4bc50 | |||
| 09a2fb28f7 | |||
| 0cb372aa26 | |||
| b25bb0d1d2 | |||
| 7abb1788b6 | |||
| 2a16dbefb8 | |||
| 7e4d30bbe9 | |||
| eae02b9153 | |||
| 273901dc44 | |||
| 1b3ee62d8b | |||
| 8c330dd825 | |||
| cde3e690be | |||
| 46698f1ed2 | |||
| 93644569fd | |||
| 8127747534 | |||
| 306fdd8938 | |||
| 75b29b5fde | |||
| f70370b797 | |||
| 0acb84af33 | |||
| 86394e4408 | |||
| 6f5dff6925 | |||
| dce4c0a981 | |||
| 0ba536d7a3 | |||
| 8a7326dcac | |||
| e40e99a968 | |||
| 0d70ba6351 | |||
| 33f8f709f8 |
@@ -0,0 +1,4 @@
|
|||||||
|
*.sh text eol=lf
|
||||||
|
|
||||||
|
# Files with CRLF line endings
|
||||||
|
gradlew.bat text eol=crlf
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# IntelliJ
|
# IntelliJ
|
||||||
.idea/
|
.idea/
|
||||||
out/
|
out/
|
||||||
moasdawiki-app.iml
|
*.iml
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
.gradle/
|
.gradle/
|
||||||
@@ -10,3 +10,6 @@ release/
|
|||||||
|
|
||||||
# Git
|
# Git
|
||||||
local.properties
|
local.properties
|
||||||
|
|
||||||
|
# Project
|
||||||
|
TODO.md
|
||||||
|
|||||||
@@ -1,5 +1,177 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 3.9.3.0 (versionCode 46, 2025-01-05)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.9.3
|
||||||
|
- Upgrade to Gradle 8.12
|
||||||
|
- Upgrade library dependencies
|
||||||
|
- Update copyright year
|
||||||
|
|
||||||
|
## 3.9.1.1 (versionCode 45, 2024-11-02)
|
||||||
|
|
||||||
|
- Update App sync description
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 3.9.1.0 (versionCode 44, 2024-10-04)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.9.1
|
||||||
|
- Upgrade to Gradle 8.10.2
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 3.7.1.1 (versionCode 43, 2024-05-10)
|
||||||
|
|
||||||
|
- Upgrade to Gradle 8.7
|
||||||
|
|
||||||
|
## 3.7.1.0 (versionCode 42, 2024-01-01)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.7.1
|
||||||
|
- Upgrade to Gradle 8.5
|
||||||
|
- Update copyright year
|
||||||
|
|
||||||
|
## 3.6.3.2 (versionCode 41, 2023-12-12)
|
||||||
|
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 3.6.3.1 (versionCode 40, 2023-11-15)
|
||||||
|
|
||||||
|
- Fix Gradle build issue in fdroid build
|
||||||
|
|
||||||
|
## 3.6.3.0 (versionCode 39, 2023-11-11)
|
||||||
|
|
||||||
|
- Limit calendar import to 100 events as Android has a global limit of 500 events
|
||||||
|
- Retry failed server sync requests
|
||||||
|
- Update to moasdawiki-server 3.6.3
|
||||||
|
- Upgrade library dependencies
|
||||||
|
- Upgrade to Android API 34 (Android 14)
|
||||||
|
|
||||||
|
## 3.6.2.1 (versionCode 38, 2023-08-07)
|
||||||
|
|
||||||
|
- Fix Gradle build issue
|
||||||
|
|
||||||
|
## 3.6.2.0 (versionCode 37, 2023-08-05)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.6.2
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 3.6.1.0 (versionCode 36, 2023-04-29)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.6.1
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 3.6.0.0 (versionCode 35, 2023-01-01)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.6.0
|
||||||
|
- Upgrade library dependencies
|
||||||
|
- Update copyright year
|
||||||
|
|
||||||
|
## 3.5.1.0 (versionCode 34, 2022-11-12)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.5.1
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 3.5.0.1 (versionCode 33, 2022-10-15)
|
||||||
|
|
||||||
|
- Add app icon to fastlane folder
|
||||||
|
|
||||||
|
## 3.5.0.0 (versionCode 32, 2022-10-08)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.5.0
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 3.4.5.0 (versionCode 31, 2022-09-05)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.4.5
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 3.4.4.0 (versionCode 30, 2022-04-14)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 3.4.4
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 3.2.1.0 (versionCode 29, 2021-12-29)
|
||||||
|
|
||||||
|
- Update Gradle version in moasdawiki-server and in app to fix build issue
|
||||||
|
- Update to moasdawiki-server 3.2.1
|
||||||
|
|
||||||
|
## 3.1.0.0 (versionCode 28, 2021-12-25)
|
||||||
|
|
||||||
|
- Small layout optimizations
|
||||||
|
- Update to moasdawiki-server 3.1.0
|
||||||
|
- Support for Android 12
|
||||||
|
- Upgrade library dependencies
|
||||||
|
- Update copyright year
|
||||||
|
|
||||||
|
## 2.6.1.0 (versionCode 27, 2021-06-09)
|
||||||
|
|
||||||
|
- Remove double back key press to close the app
|
||||||
|
- Update to moasdawiki-server 2.6.1
|
||||||
|
- Upgrade library dependencies
|
||||||
|
|
||||||
|
## 2.6.0.0 (versionCode 26, 2021-05-13)
|
||||||
|
|
||||||
|
- Make GPL-3.0-only licensing more clear
|
||||||
|
- Update to moasdawiki-server 2.6.0
|
||||||
|
|
||||||
|
## 2.5.2.1 (versionCode 25, 2021-05-08)
|
||||||
|
|
||||||
|
- Update documentation
|
||||||
|
- Update library dependencies
|
||||||
|
|
||||||
|
## 2.5.2.0 (versionCode 24, 2021-02-28)
|
||||||
|
|
||||||
|
- Find also words that start with the search string
|
||||||
|
- Update to moasdawiki-server 2.5.2
|
||||||
|
|
||||||
|
## 2.5.1.0 (versionCode 23, 2021-01-31)
|
||||||
|
|
||||||
|
- Enhance search index to full words
|
||||||
|
- Introduce search ignore list
|
||||||
|
- Add support for SVG images
|
||||||
|
- Update to moasdawiki-server 2.5.1
|
||||||
|
|
||||||
|
## 2.4.4.0 (versionCode 22, 2021-01-23)
|
||||||
|
|
||||||
|
- Speed up search
|
||||||
|
- Update to moasdawiki-server 2.4.4
|
||||||
|
|
||||||
|
## 2.4.3.0 (versionCode 21, 2021-01-04)
|
||||||
|
|
||||||
|
- Update descriptions for F-Droid
|
||||||
|
- Update copyright year
|
||||||
|
- Bugfix: Disable wiki editor handler
|
||||||
|
- Update to moasdawiki-server 2.4.3
|
||||||
|
|
||||||
|
## 2.4.2.0 (versionCode 20, 2020-12-28)
|
||||||
|
|
||||||
|
- Update to moasdawiki-server 2.4.2
|
||||||
|
- Upgrade library dependencies
|
||||||
|
- Refactoring: Replace deprecated AsyncTask
|
||||||
|
|
||||||
|
## 2.3.3.0 (versionCode 19, 2020-10-11)
|
||||||
|
|
||||||
|
- Bugfix: Show start page on app startup
|
||||||
|
- Bugfix: For searches only use the search index cache
|
||||||
|
- Update to moasdawiki-server 2.3.3
|
||||||
|
|
||||||
|
## 2.3.1.0 (versionCode 18, 2020-09-13)
|
||||||
|
|
||||||
|
- Speed up full text search by a search index
|
||||||
|
- Bugfix: Don't go back to start page after App restore
|
||||||
|
- Update to moasdawiki-server 2.3.1
|
||||||
|
|
||||||
|
## 2.2.1.1 (versionCode 17, 2020-09-08)
|
||||||
|
|
||||||
|
- Add German fastlane metadata for F-Droid repository
|
||||||
|
- Update library dependencies
|
||||||
|
|
||||||
|
## 2.2.1.0 (versionCode 16, 2020-03-15)
|
||||||
|
|
||||||
|
- Add fastlane metadata for F-Droid repository
|
||||||
|
|
||||||
|
## 2.2.0.0 (versionCode 15, 2020-02-08)
|
||||||
|
|
||||||
|
- Speed up full text search by searching only in the page titles in the first step
|
||||||
|
|
||||||
## 2.1.0.0 (versionCode 14, 2020-01-11)
|
## 2.1.0.0 (versionCode 14, 2020-01-11)
|
||||||
|
|
||||||
- Renewed the user interface
|
- Renewed the user interface
|
||||||
|
|||||||
@@ -619,56 +619,3 @@ Program, unless a warranty or assumption of liability accompanies a
|
|||||||
copy of the Program in return for a fee.
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
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.
|
|
||||||
|
|
||||||
MoasdaWiki Server
|
|
||||||
Copyright (C) 2008 - 2020 Herbert Reiter
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
MoasdaWiki Server Copyright (C) 2008 - 2020 Herbert Reiter
|
|
||||||
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
|
|
||||||
<http://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
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
|
|||||||
@@ -2,32 +2,47 @@
|
|||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
MoasdaWiki App is an extension of the MoasdaWiki Server to have a copy of
|
MoasdaWiki App is a privacy-friendly frontend for the MoasdaWiki Server
|
||||||
your Wiki content on your mobile device.
|
knowledge management tool. It mirrors the Wiki content on your mobile device.
|
||||||
|
|
||||||
To download the app see https://moasdawiki.net/.
|
For MoasdaWiki documentation see https://moasdawiki.net/.
|
||||||
|
|
||||||
|
## Download
|
||||||
|
|
||||||
|
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
|
||||||
|
alt="Get it on F-Droid"
|
||||||
|
height="80">](https://f-droid.org/packages/net.moasdawiki.app)
|
||||||
|
or [Google Play](https://play.google.com/store/apps/details?id=net.moasdawiki.app)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Synchronizes the data from a MoasdaWiki Server instance.
|
- Synchronizes the content from your MoasdaWiki Server instance.
|
||||||
- Data privacy: No cloud connection established, directly connects to the server inside your private network.
|
- Fast full text search.
|
||||||
- Powerful full text search, supports regular expressions.
|
- Calendar integration: Shows birthdays and events in the mobile calendar.
|
||||||
- Content cannot be modified within the app as it is no fun to type Wiki syntax on the mobile device,
|
- Data privacy by design: Directly connects to your server instance in your
|
||||||
changes have to be done via the MoasdaWiki Server.
|
private network. No trackers, never establishes a cloud connection.
|
||||||
- Calendar integration, shows birthdays and events in the mobile calendar (German version only).
|
- Wiki content cannot be modified within the app as it is no fun to type Wiki
|
||||||
|
syntax on a mobile device, changes have to be done via the MoasdaWiki Server.
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/1.png" width="250" height="500" />
|
||||||
|
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/2.png" width="250" height="500" />
|
||||||
|
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/4.png" width="250" height="500" />
|
||||||
|
|
||||||
## Synchronize content with a MoasdaWiki Server
|
## Synchronize content with a MoasdaWiki Server
|
||||||
|
|
||||||
1. Ensure to have a MoasdaWiki Server instance running on a computer in your LAN.
|
1. Download MoasdaWiki Server from https://gitlab.com/moasdawiki/moasdawiki-server.
|
||||||
1. Install and open the MoasdaWiki App.
|
2. Set up a MoasdaWiki Server instance in your LAN.
|
||||||
1. You can see a hint that the App has to be configured first. Press on that hint.
|
3. Enable LAN access to the server: Edit the repository file `config.txt` and change the setting `authentication.onlylocalhost = false`. Restart the server afterwards.
|
||||||
1. Press on "Host name" and enter the host name of the server instance, e.g. `192.168.1.101`. Press OK.
|
4. Install the MoasdaWiki App.
|
||||||
1. In the status section below you should see "Needs authorization at server". Otherwise check host name and port again.
|
5. In the app you can see a hint that it has to be configured first. Press on that hint.
|
||||||
1. On server side open the Wiki page in a browser, click on "Help" and "Synchronization".
|
6. Press on "Host name" and enter the host name or IP address of the server instance, e.g. `192.168.1.101`. Press OK.
|
||||||
1. You can see a list of devices and synchronization sessions. Check the device name and click on "Grant".
|
7. In the status section below you should see "Needs authorization at server". Otherwise check host name and port again.
|
||||||
1. Back in the app press the back button (←) on the upper left corner to get back to the main dialog.
|
8. On server side open the Wiki page in a browser, click on "Help" and "Synchronization".
|
||||||
Now you can see a hint that the app has to be synchronized. Press on that hint.
|
9. You can see a list of devices and synchronization sessions. Check the device name and click on "Grant".
|
||||||
1. Now you should have all the server content also in the app and you can see the "Home" wiki page.
|
10. Back in the app press the back button (←) on the upper left corner to get back to the main dialog. Now you can see a hint that the app has to be synchronized. Press on that hint.
|
||||||
|
11. Now you should have all the server content also in the app and you can see the "Home-App" wiki page.
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
@@ -35,6 +50,7 @@ If you have questions or any problems you can contact me via [support@moasdawiki
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MoasdaWiki server is licensed under the GPL 3 license - see the LICENSE file for details.
|
MoasdaWiki server is licensed under GPL-3.0-only – see the
|
||||||
|
[LICENSE](LICENSE) file for details.
|
||||||
|
|
||||||
Copyright (C) Herbert Reiter
|
Copyright (C) Herbert Reiter
|
||||||
|
|||||||
@@ -1,133 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
|
||||||
<component name="FacetManager">
|
|
||||||
<facet type="android-gradle" name="Android-Gradle">
|
|
||||||
<configuration>
|
|
||||||
<option name="GRADLE_PROJECT_PATH" value=":app" />
|
|
||||||
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.5.3" />
|
|
||||||
<option name="LAST_KNOWN_AGP_VERSION" value="3.5.3" />
|
|
||||||
</configuration>
|
|
||||||
</facet>
|
|
||||||
<facet type="android" name="Android">
|
|
||||||
<configuration>
|
|
||||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
|
||||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
|
||||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
|
||||||
<afterSyncTasks>
|
|
||||||
<task>generateDebugSources</task>
|
|
||||||
</afterSyncTasks>
|
|
||||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
|
||||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
|
||||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
|
||||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
|
|
||||||
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
|
|
||||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
|
||||||
</configuration>
|
|
||||||
</facet>
|
|
||||||
</component>
|
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
|
||||||
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/classes" />
|
|
||||||
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/classes" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugUnitTest/out" isTestSource="true" generated="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="jdk" jdkName="Android API 29 Platform (2)" jdkType="Android SDK" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: org.testng:testng:6.14.3@jar" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: com.beust:jcommander:1.72@jar" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: org.apache-extras.beanshell:bsh:2.0b6@jar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: org.jetbrains:annotations:18.0.0@jar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.1.0@jar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.1.0@jar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.1.0@jar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.1.0@jar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.preference:preference:1.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-resources:1.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.recyclerview:recyclerview:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.activity:activity:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.core:core:1.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.1.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.savedstate:savedstate:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.documentfile:documentfile:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: androidx.print:print:1.0.0@aar" level="project" />
|
|
||||||
<orderEntry type="module" module-name="moasdawiki-app" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
@@ -1,33 +1,38 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29 // 29 = Android 10
|
namespace "net.moasdawiki.app"
|
||||||
|
compileSdk 34 // 34 = Android 14
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "net.moasdawiki.app"
|
applicationId "net.moasdawiki.app"
|
||||||
minSdkVersion 26 // 26 = Oreo 8.0
|
minSdk 28 // 28 = Android 9
|
||||||
targetSdkVersion 29 // should be same as compileSdkVersion
|
targetSdk 34 // should be same as compileSdk
|
||||||
versionCode 14
|
versionCode 46
|
||||||
versionName "2.1.0.0"
|
versionName "3.9.3.0"
|
||||||
archivesBaseName = "moasdawiki-" + versionName + "-" + versionCode
|
|
||||||
}
|
|
||||||
sourceSets {
|
|
||||||
main{
|
|
||||||
java {
|
|
||||||
exclude "net/moasdawiki/plugin/sync/SynchronizationPlugin*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
targetCompatibility = 1.8
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig true
|
||||||
|
}
|
||||||
|
lintOptions {
|
||||||
|
// Workaround for NullPointerException in :app:lintVitalAnalyzeRelease in fdroid build
|
||||||
|
checkReleaseBuilds false
|
||||||
|
}
|
||||||
|
base {
|
||||||
|
archivesName = "moasdawiki-" + defaultConfig.versionName + "-" + defaultConfig.versionCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'net.moasdawiki:moasdawiki-server:2.1.0'
|
api 'net.moasdawiki:moasdawiki-server:3.9.3'
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
api ('androidx.appcompat:appcompat:1.6.1') {
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
exclude group: 'org.jetbrains', module: 'annotations'
|
||||||
implementation 'androidx.preference:preference:1.1.0'
|
}
|
||||||
compileOnly 'org.jetbrains:annotations:18.0.0'
|
api ('androidx.preference:preference:1.2.1') {
|
||||||
testImplementation 'org.testng:testng:6.14.3'
|
exclude group: 'org.jetbrains', module: 'annotations'
|
||||||
|
}
|
||||||
|
compileOnly 'org.jetbrains:annotations:26.0.1'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
package="net.moasdawiki.app">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
|
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
|
||||||
@@ -16,11 +15,13 @@
|
|||||||
android:name=".WikiEngineApplication"
|
android:name=".WikiEngineApplication"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
android:allowBackup="false">
|
android:allowBackup="false"
|
||||||
|
android:fullBackupContent="false"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
@@ -44,7 +45,8 @@
|
|||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="net.moasdawiki.app.CalendarAccountAuthenticatorService"
|
android:name="net.moasdawiki.app.CalendarAccountAuthenticatorService"
|
||||||
tools:ignore="ExportedService">
|
tools:ignore="ExportedService"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.accounts.AccountAuthenticator"/>
|
<action android:name="android.accounts.AccountAuthenticator"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
@@ -30,6 +29,7 @@ public class AndroidSettings extends Settings {
|
|||||||
super(logger, repositoryService, configFileName);
|
super(logger, repositoryService, configFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return BuildConfig.VERSION_NAME;
|
return BuildConfig.VERSION_NAME;
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
@@ -43,16 +42,16 @@ import androidx.preference.PreferenceManager;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.moasdawiki.plugin.Plugin;
|
import net.moasdawiki.service.transform.TerminTransformer;
|
||||||
import net.moasdawiki.plugin.PluginService;
|
|
||||||
import net.moasdawiki.plugin.TerminPlugin;
|
|
||||||
import net.moasdawiki.util.PathUtils;
|
import net.moasdawiki.util.PathUtils;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
@@ -74,8 +73,21 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
private static final Uri EVENT_URI = CalendarContract.Events. CONTENT_URI;
|
private static final Uri EVENT_URI = CalendarContract.Events. CONTENT_URI;
|
||||||
private static final Uri REMINDER_URI = CalendarContract.Reminders.CONTENT_URI;
|
private static final Uri REMINDER_URI = CalendarContract.Reminders.CONTENT_URI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alert event 4h before it starts, i.e. at 8pm in the evening before the event day.
|
||||||
|
*/
|
||||||
private static final int REMINDER_BEFORE_EVENT_MINUTES = 4 * 60;
|
private static final int REMINDER_BEFORE_EVENT_MINUTES = 4 * 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import maximum 100 events. If there are more events found, take the 100 upcoming events
|
||||||
|
* sorted by date.
|
||||||
|
*
|
||||||
|
* Android has a global event limitation of 500 events. If more than 500 events are created,
|
||||||
|
* Android throws errors with message "Maximum limit of concurrent alarms 500 reached" and
|
||||||
|
* ignores some events.
|
||||||
|
*/
|
||||||
|
private static final int MAX_EVENT_COUNT = 100;
|
||||||
|
|
||||||
private final ContentResolver contentResolver;
|
private final ContentResolver contentResolver;
|
||||||
|
|
||||||
@SuppressWarnings("SameParameterValue")
|
@SuppressWarnings("SameParameterValue")
|
||||||
@@ -87,13 +99,19 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
|
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
|
||||||
Log.d(TAG, "Begin of onPerformSync()");
|
Log.d(TAG, "Begin of onPerformSync()");
|
||||||
List<TerminPlugin.Event> events = getWikiEvents();
|
// collect and filter events
|
||||||
|
List<TerminTransformer.Event> rawEvents = getWikiEvents();
|
||||||
|
fillEmptyDateFields(rawEvents);
|
||||||
|
List<TerminTransformer.Event> events = filterEvents(rawEvents);
|
||||||
|
|
||||||
|
// update Android calendar
|
||||||
String calendarId = createCalendar();
|
String calendarId = createCalendar();
|
||||||
if (calendarId != null) {
|
if (calendarId != null) {
|
||||||
deleteAllEvents(calendarId);
|
deleteAllEvents(calendarId);
|
||||||
addEvents(calendarId, events);
|
addEvents(calendarId, events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// inform user about completed update
|
||||||
Handler handler = new Handler(Looper.getMainLooper());
|
Handler handler = new Handler(Looper.getMainLooper());
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
Toast toast = Toast.makeText(getContext(), R.string.calendar_sync_finished, Toast.LENGTH_SHORT);
|
Toast toast = Toast.makeText(getContext(), R.string.calendar_sync_finished, Toast.LENGTH_SHORT);
|
||||||
@@ -106,25 +124,78 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
* Imports all events on Wiki pages to the Android calendar.
|
* Imports all events on Wiki pages to the Android calendar.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
private List<TerminPlugin.Event> getWikiEvents() {
|
private List<TerminTransformer.Event> getWikiEvents() {
|
||||||
Log.d(TAG, "Reading Wiki events");
|
Log.d(TAG, "Reading Wiki events");
|
||||||
WikiEngineApplication app = (WikiEngineApplication) getContext();
|
WikiEngineApplication app = (WikiEngineApplication) getContext();
|
||||||
PluginService pluginService = app.getServiceLocator().getPluginService();
|
TerminTransformer terminTransformer = app.getTerminTransformer();
|
||||||
TerminPlugin terminPlugin = null;
|
if (terminTransformer == null) {
|
||||||
for (Plugin plugin : pluginService.getPlugins()) {
|
Log.e(TAG, "TerminTransformer not initialized yet, cannot retrieve event list");
|
||||||
if (plugin instanceof TerminPlugin) {
|
|
||||||
terminPlugin = (TerminPlugin) plugin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (terminPlugin == null) {
|
|
||||||
Log.e(TAG, "TerminPlugin not found, cannot retrieve event list");
|
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<TerminPlugin.Event> events = terminPlugin.getEvents();
|
List<TerminTransformer.Event> events = terminTransformer.getEvents();
|
||||||
Log.d(TAG, "Wiki events found: " + events.size());
|
Log.d(TAG, "Wiki events found: " + events.size());
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fills empty day, month, and year fields in all events.
|
||||||
|
*/
|
||||||
|
private void fillEmptyDateFields(@NotNull List<TerminTransformer.Event> events) {
|
||||||
|
TimeZone utc = TimeZone.getTimeZone("UTC");
|
||||||
|
Calendar calendar = Calendar.getInstance(utc);
|
||||||
|
for (TerminTransformer.Event event : events) {
|
||||||
|
if (event.dateFields.day == null) {
|
||||||
|
event.dateFields.day = 1;
|
||||||
|
}
|
||||||
|
if (event.dateFields.month == null) {
|
||||||
|
event.dateFields.month = 1;
|
||||||
|
}
|
||||||
|
if (event.dateFields.year == null) {
|
||||||
|
event.dateFields.year = calendar.get(Calendar.YEAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reduces the number of events if more than MAX_EVENT_COUNT, only keep events in the near future.
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private List<TerminTransformer.Event> filterEvents(@NotNull List<TerminTransformer.Event> rawEvents) {
|
||||||
|
if (rawEvents.size() <= MAX_EVENT_COUNT) {
|
||||||
|
return rawEvents;
|
||||||
|
}
|
||||||
|
|
||||||
|
// sort by month and day;
|
||||||
|
// ignore year because events repeat every year
|
||||||
|
List<TerminTransformer.Event> sortedEvents = new ArrayList<>(rawEvents);
|
||||||
|
sortedEvents.sort(Comparator.comparingInt((TerminTransformer.Event event) -> event.dateFields.month).thenComparingInt(event -> event.dateFields.day));
|
||||||
|
|
||||||
|
// keep next MAX_EVENT_COUNT events from today onwards
|
||||||
|
List<TerminTransformer.Event> result = new ArrayList<>(MAX_EVENT_COUNT);
|
||||||
|
// find first event in future
|
||||||
|
TimeZone utc = TimeZone.getTimeZone("UTC");
|
||||||
|
Calendar calendar = Calendar.getInstance(utc);
|
||||||
|
int index = 0;
|
||||||
|
while (index < sortedEvents.size() - 1
|
||||||
|
&& (sortedEvents.get(index).dateFields.month < calendar.get(Calendar.MONTH) + 1
|
||||||
|
|| sortedEvents.get(index).dateFields.month == calendar.get(Calendar.MONTH) + 1
|
||||||
|
&& sortedEvents.get(index).dateFields.day < calendar.get(Calendar.DAY_OF_MONTH))) {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
// copy events until end of year
|
||||||
|
while (result.size() < MAX_EVENT_COUNT && index < sortedEvents.size() - 1) {
|
||||||
|
result.add(sortedEvents.get(index));
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
// copy events in new year
|
||||||
|
index = 0;
|
||||||
|
while (result.size() < MAX_EVENT_COUNT && index < sortedEvents.size() - 1) {
|
||||||
|
result.add(sortedEvents.get(index));
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private Uri buildUri(@NotNull Uri uri) {
|
private Uri buildUri(@NotNull Uri uri) {
|
||||||
return uri.buildUpon()
|
return uri.buildUpon()
|
||||||
@@ -164,7 +235,6 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
cv.put(CalendarContract.Calendars.NAME, CALENDAR_NAME);
|
cv.put(CalendarContract.Calendars.NAME, CALENDAR_NAME);
|
||||||
String displayName = getContext().getString(R.string.calendar_display_name);
|
String displayName = getContext().getString(R.string.calendar_display_name);
|
||||||
cv.put(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME, displayName);
|
cv.put(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME, displayName);
|
||||||
//cv.put(CalendarContract.Calendars.CALENDAR_COLOR, 0xEA8561);
|
|
||||||
cv.put(CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL, CalendarContract.Calendars.CAL_ACCESS_READ);
|
cv.put(CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL, CalendarContract.Calendars.CAL_ACCESS_READ);
|
||||||
cv.put(CalendarContract.Calendars.OWNER_ACCOUNT, ACCOUNT_NAME);
|
cv.put(CalendarContract.Calendars.OWNER_ACCOUNT, ACCOUNT_NAME);
|
||||||
cv.put(CalendarContract.Calendars.VISIBLE, 1);
|
cv.put(CalendarContract.Calendars.VISIBLE, 1);
|
||||||
@@ -200,17 +270,17 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds all events from the event list. The first occurrence is in the current year, the events
|
* Adds up to 100 events from the event list.
|
||||||
* are repeated every year.
|
* The first occurrence is in the current year, the events are repeated every year.
|
||||||
*/
|
*/
|
||||||
private void addEvents(@NotNull String calendarId, @NotNull List<TerminPlugin.Event> events) {
|
private void addEvents(@NotNull String calendarId, @NotNull List<TerminTransformer.Event> events) {
|
||||||
Log.d(TAG, "Create calendar events");
|
Log.d(TAG, "Create calendar events");
|
||||||
for (TerminPlugin.Event event : events) {
|
for (TerminTransformer.Event event : events) {
|
||||||
String title = event.description;
|
String title = event.description;
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
title = PathUtils.extractWebName(event.pagePath);
|
title = PathUtils.extractWebName(event.pagePath);
|
||||||
}
|
}
|
||||||
String description = getContext().getString(R.string.calendar_date) + ": " + TerminPlugin.formatGermanDate(event.dateFields);
|
String description = getContext().getString(R.string.calendar_date) + ": " + TerminTransformer.formatGermanDate(event.dateFields);
|
||||||
String eventId = addEvent(calendarId, event.dateFields.day, event.dateFields.month, event.dateFields.year, title, description);
|
String eventId = addEvent(calendarId, event.dateFields.day, event.dateFields.month, event.dateFields.year, title, description);
|
||||||
if (eventId != null) {
|
if (eventId != null) {
|
||||||
addReminder(eventId);
|
addReminder(eventId);
|
||||||
@@ -223,7 +293,7 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
* Adds a single event to the calendar.
|
* Adds a single event to the calendar.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
private String addEvent(@NotNull String calendarId, @Nullable Integer day, @Nullable Integer month, @Nullable Integer year, @NotNull String title, @NotNull String description) {
|
private String addEvent(@NotNull String calendarId, int day, int month, int year, @NotNull String title, @NotNull String description) {
|
||||||
Log.d(TAG, "Create calendar event: day=" + day + ", month=" + month + ", year=" + year
|
Log.d(TAG, "Create calendar event: day=" + day + ", month=" + month + ", year=" + year
|
||||||
+ ", title=" + title + ", description=" + description);
|
+ ", title=" + title + ", description=" + description);
|
||||||
ContentValues cv = new ContentValues();
|
ContentValues cv = new ContentValues();
|
||||||
@@ -233,18 +303,8 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
|
|
||||||
TimeZone utc = TimeZone.getTimeZone("UTC");
|
TimeZone utc = TimeZone.getTimeZone("UTC");
|
||||||
Calendar beginTime = Calendar.getInstance(utc);
|
Calendar beginTime = Calendar.getInstance(utc);
|
||||||
if (day == null) {
|
|
||||||
day = 1;
|
|
||||||
}
|
|
||||||
if (month == null) {
|
|
||||||
month = 1;
|
|
||||||
}
|
|
||||||
if (year == null) {
|
|
||||||
year = beginTime.get(Calendar.YEAR);
|
|
||||||
}
|
|
||||||
beginTime.clear();
|
beginTime.clear();
|
||||||
beginTime.set(year, month - 1, day);
|
beginTime.set(year, month - 1, day);
|
||||||
|
|
||||||
cv.put(CalendarContract.Events.DTSTART, beginTime.getTimeInMillis());
|
cv.put(CalendarContract.Events.DTSTART, beginTime.getTimeInMillis());
|
||||||
cv.put(CalendarContract.Events.DURATION, "PT1D");
|
cv.put(CalendarContract.Events.DURATION, "PT1D");
|
||||||
cv.put(CalendarContract.Events.ALL_DAY, 1);
|
cv.put(CalendarContract.Events.ALL_DAY, 1);
|
||||||
@@ -294,8 +354,7 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.WRITE_CALENDAR)) {
|
if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.WRITE_CALENDAR)) {
|
||||||
Log.d(TAG, "User has permanently denied permission WRITE_CALENDAR, informing him");
|
Log.d(TAG, "User has permanently denied permission WRITE_CALENDAR, informing him");
|
||||||
String hint = context.getString(R.string.calendar_permission_request, "WRITE_CALENDAR");
|
String hint = context.getString(R.string.calendar_permission_request, "WRITE_CALENDAR");
|
||||||
Toast toast = Toast.makeText(context, hint, Toast.LENGTH_SHORT);
|
activity.runOnUiThread(() -> Toast.makeText(context, hint, Toast.LENGTH_SHORT).show());
|
||||||
toast.show();
|
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Ask for permission WRITE_CALENDAR");
|
Log.d(TAG, "Ask for permission WRITE_CALENDAR");
|
||||||
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.WRITE_CALENDAR}, 0);
|
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.WRITE_CALENDAR}, 0);
|
||||||
@@ -305,8 +364,7 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.READ_CALENDAR)) {
|
if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.READ_CALENDAR)) {
|
||||||
Log.d(TAG, "User has permanently denied permission READ_CALENDAR, informing him");
|
Log.d(TAG, "User has permanently denied permission READ_CALENDAR, informing him");
|
||||||
String hint = context.getString(R.string.calendar_permission_request, "READ_CALENDAR");
|
String hint = context.getString(R.string.calendar_permission_request, "READ_CALENDAR");
|
||||||
Toast toast = Toast.makeText(context, hint, Toast.LENGTH_SHORT);
|
activity.runOnUiThread(() -> Toast.makeText(context, hint, Toast.LENGTH_SHORT).show());
|
||||||
toast.show();
|
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Ask for permission READ_CALENDAR");
|
Log.d(TAG, "Ask for permission READ_CALENDAR");
|
||||||
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.READ_CALENDAR}, 0);
|
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.READ_CALENDAR}, 0);
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
|
|||||||
@@ -1,27 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enthält zentrale Konstanten.
|
* Defines constants and settings.
|
||||||
*
|
|
||||||
* @author Herbert Reiter
|
|
||||||
*/
|
*/
|
||||||
public abstract class Constants {
|
public abstract class Constants {
|
||||||
public static final String PREFERENCES_SYNC_SERVER_HOST = "sync_server_host";
|
public static final String PREFERENCES_SYNC_SERVER_HOST = "sync_server_host";
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
@@ -25,7 +24,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@@ -47,17 +45,17 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.view.menu.MenuBuilder;
|
import androidx.appcompat.view.menu.MenuBuilder;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import net.moasdawiki.base.ServiceException;
|
import net.moasdawiki.base.ServiceException;
|
||||||
import net.moasdawiki.base.Settings;
|
import net.moasdawiki.base.Settings;
|
||||||
import net.moasdawiki.plugin.Plugin;
|
import net.moasdawiki.http.ContentType;
|
||||||
import net.moasdawiki.plugin.PluginService;
|
import net.moasdawiki.http.HttpRequest;
|
||||||
import net.moasdawiki.server.HttpRequest;
|
import net.moasdawiki.server.RequestDispatcher;
|
||||||
import net.moasdawiki.server.HttpResponse;
|
import net.moasdawiki.service.HttpResponse;
|
||||||
import net.moasdawiki.service.render.HtmlService;
|
|
||||||
import net.moasdawiki.service.repository.RepositoryService;
|
import net.moasdawiki.service.repository.RepositoryService;
|
||||||
import net.moasdawiki.util.EscapeUtils;
|
import net.moasdawiki.util.EscapeUtils;
|
||||||
|
|
||||||
@@ -67,48 +65,44 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steuert das Verhalten des Hauptfensters inkl. eingebettetem Browser.
|
* Displays the main window with the embedded wiki browser.
|
||||||
*
|
|
||||||
* @author Herbert Reiter
|
|
||||||
*/
|
*/
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static final String TAG = "MainActivity";
|
private static final String TAG = "MainActivity";
|
||||||
private static final String SERVER_BASE_URL = "http://localhost:1/";
|
private static final String SERVER_BASE_URL = "http://localhost:1/";
|
||||||
|
|
||||||
private Settings settings;
|
|
||||||
private RepositoryService repositoryService;
|
private RepositoryService repositoryService;
|
||||||
private PluginService pluginService;
|
private Settings settings;
|
||||||
private HtmlService htmlService;
|
|
||||||
private SynchronizeWikiClient synchronizeWikiClient;
|
private SynchronizeWikiClient synchronizeWikiClient;
|
||||||
|
private RequestDispatcher requestDispatcher;
|
||||||
|
|
||||||
private WebView webview;
|
private WebView webview;
|
||||||
|
|
||||||
private long backButtonPressedTimestamp;
|
private ExecutorService synchronizationExecutorService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.main_layout);
|
setContentView(R.layout.main_layout);
|
||||||
|
|
||||||
// AndroidMainService holen
|
|
||||||
WikiEngineApplication app = (WikiEngineApplication) getApplication();
|
WikiEngineApplication app = (WikiEngineApplication) getApplication();
|
||||||
settings = app.getServiceLocator().getSettings();
|
repositoryService = app.getRepositoryService();
|
||||||
repositoryService = app.getServiceLocator().getRepositoryService();
|
settings = app.getSettings();
|
||||||
pluginService = app.getServiceLocator().getPluginService();
|
|
||||||
htmlService = app.getServiceLocator().getHtmlService();
|
|
||||||
synchronizeWikiClient = app.getSynchronizeWikiClient();
|
synchronizeWikiClient = app.getSynchronizeWikiClient();
|
||||||
|
requestDispatcher = app.getRequestDispatcher();
|
||||||
|
synchronizationExecutorService = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
// eingebetteten Browser konfigurieren
|
|
||||||
initWebView();
|
initWebView();
|
||||||
|
|
||||||
EditText searchInput = findViewById(R.id.search_input);
|
EditText searchInput = findViewById(R.id.search_input);
|
||||||
@@ -125,31 +119,29 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Konfiguriert den eingebetteten Browser.
|
* Configure the embedded web browser.
|
||||||
*/
|
*/
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
private void initWebView() {
|
private void initWebView() {
|
||||||
// Cookies deaktivieren
|
|
||||||
CookieManager cookieManager = CookieManager.getInstance();
|
CookieManager cookieManager = CookieManager.getInstance();
|
||||||
cookieManager.setAcceptCookie(false);
|
cookieManager.setAcceptCookie(false);
|
||||||
|
|
||||||
// localhost-URLs in WebView anzeigen
|
|
||||||
webview = findViewById(R.id.web_browser);
|
webview = findViewById(R.id.web_browser);
|
||||||
webview.setWebChromeClient(new WebChromeClient());
|
webview.setWebChromeClient(new WebChromeClient());
|
||||||
webview.setWebViewClient(new WebViewClient() {
|
webview.setWebViewClient(new WebViewClient() {
|
||||||
/**
|
/**
|
||||||
* Steuert, welche Links im eingebetteten Browser und welche im externen Browser
|
* Dispatch URLs the user clicks on.
|
||||||
* geöffnet werden sollen.
|
* External URLs will be shown in an external browser.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(@NotNull WebView view, @NotNull WebResourceRequest webResourceRequest) {
|
public boolean shouldOverrideUrlLoading(@NotNull WebView view, @NotNull WebResourceRequest webResourceRequest) {
|
||||||
Uri uri = webResourceRequest.getUrl();
|
Uri uri = webResourceRequest.getUrl();
|
||||||
String host = uri.getHost();
|
String host = uri.getHost();
|
||||||
if ("localhost".equals(host)) {
|
if ("localhost".equals(host)) {
|
||||||
// lokale URL im eingebetteten Browser öffnen
|
// wiki URL, show in embedded browser
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// externe Links im normalen Browser öffnen
|
// external URL, show in external browser
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
@@ -157,57 +149,47 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emuliert den Wikiserver und zu vermeiden, dass ein TCP-Port geöffnet werden muss.
|
* Resolve internal URLs without running a real HTTP server,
|
||||||
|
* so we don't have to open a port.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public WebResourceResponse shouldInterceptRequest (@NotNull WebView view, @NotNull WebResourceRequest request) {
|
public WebResourceResponse shouldInterceptRequest (@NotNull WebView view, @NotNull WebResourceRequest request) {
|
||||||
try {
|
try {
|
||||||
// URL-Pfad ermitteln
|
// determine URL path
|
||||||
Uri uri = request.getUrl();
|
Uri uri = request.getUrl();
|
||||||
String encodedUrl = uri.toString();
|
String encodedUrl = uri.toString();
|
||||||
|
//noinspection CharsetObjectCanBeUsed
|
||||||
String url = URLDecoder.decode(encodedUrl, "UTF-8");
|
String url = URLDecoder.decode(encodedUrl, "UTF-8");
|
||||||
if (!url.startsWith(SERVER_BASE_URL)) {
|
if (!url.startsWith(SERVER_BASE_URL)) {
|
||||||
return null; // Daten per HTTP laden
|
return null;
|
||||||
}
|
}
|
||||||
String urlPath = url.substring(SERVER_BASE_URL.length() - 1); // ersten "/" behalten
|
String urlPath = url.substring(SERVER_BASE_URL.length() - 1); // extract URL path
|
||||||
int hashPos = urlPath.indexOf('#');
|
int hashPos = urlPath.indexOf('#');
|
||||||
if (hashPos >= 0) {
|
if (hashPos >= 0) {
|
||||||
// cut off anchor beginning with '#'
|
// cut off anchor beginning with '#'
|
||||||
urlPath = urlPath.substring(0, hashPos);
|
urlPath = urlPath.substring(0, hashPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// per URL-Mapping das zuständige Plugin aufrufen
|
// dispatch URL path
|
||||||
HttpResponse response;
|
HttpRequest httpRequest = new HttpRequest(Collections.emptyMap(),
|
||||||
Plugin plugin = pluginService.getPluginByUrl(urlPath);
|
"GET", urlPath, urlPath, convertParameters(uri), new byte[0]);
|
||||||
if (plugin != null) {
|
HttpResponse response = requestDispatcher.handleRequest(httpRequest);
|
||||||
HttpRequest httpRequest = new HttpRequest();
|
|
||||||
httpRequest.clientIP = InetAddress.getLocalHost();
|
|
||||||
httpRequest.httpHeader = Collections.emptyMap();
|
|
||||||
httpRequest.method = "GET";
|
|
||||||
httpRequest.url = urlPath;
|
|
||||||
httpRequest.urlPath = urlPath;
|
|
||||||
httpRequest.urlParameters = convertParameters(uri);
|
|
||||||
httpRequest.httpBody = new byte[0];
|
|
||||||
|
|
||||||
response = plugin.handleRequest(httpRequest);
|
// send wiki content to browser
|
||||||
if (response == null) {
|
String mimeType;
|
||||||
response = htmlService.generateErrorPage(404, "wiki.plugin.handleRequest.notsupported", plugin.getClass().getName());
|
if (response.getContentType() != null) {
|
||||||
}
|
mimeType = response.getContentType().getMediaType();
|
||||||
} else {
|
} else {
|
||||||
// unbekannte URL
|
mimeType = ContentType.BINARY.getMediaType();
|
||||||
response = htmlService.generateErrorPage(404, "wiki.server.url.unmapped", urlPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Antwortdaten einspeisen
|
|
||||||
InputStream responseData = new ByteArrayInputStream(response.getContent());
|
InputStream responseData = new ByteArrayInputStream(response.getContent());
|
||||||
return new WebResourceResponse(response.getContentType(),
|
return new WebResourceResponse(mimeType, "UTF-8", responseData);
|
||||||
"UTF-8", responseData);
|
} catch (Exception e) {
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null; // Daten per HTTP laden
|
return null; // load HTTP data
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -217,7 +199,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// weitere Einstellungen
|
|
||||||
WebSettings webSettings = webview.getSettings();
|
WebSettings webSettings = webview.getSettings();
|
||||||
webSettings.setAllowFileAccess(false);
|
webSettings.setAllowFileAccess(false);
|
||||||
webSettings.setJavaScriptEnabled(true);
|
webSettings.setJavaScriptEnabled(true);
|
||||||
@@ -233,6 +214,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
@@ -255,30 +237,29 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
// automatically handle clicks on the Home/Up button, so long
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.action_synchronize:
|
if (itemId == R.id.action_synchronize) {
|
||||||
synchronizeServer();
|
synchronizeWithServer();
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_startpage:
|
} else if (itemId == R.id.action_startpage) {
|
||||||
loadUrl(SERVER_BASE_URL);
|
loadUrl(SERVER_BASE_URL);
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_settings:
|
} else if (itemId == R.id.action_settings) {
|
||||||
showSettingsDialog();
|
showSettingsDialog();
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_help:
|
} else if (itemId == R.id.action_help) {
|
||||||
String pagePathHelp = getWikiserverHelpUrl();
|
String pagePathHelp = getWikiserverHelpUrl();
|
||||||
loadUrl(pagePathHelp);
|
loadUrl(pagePathHelp);
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_about:
|
} else if (itemId == R.id.action_about) {
|
||||||
showAboutDialog();
|
showAboutDialog();
|
||||||
return true;
|
return true;
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, @NotNull String[] permissions, @NotNull int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
Log.d(TAG, "Permission granted by user: requestCode=" + requestCode
|
Log.d(TAG, "Permission granted by user: requestCode=" + requestCode
|
||||||
+ ", permissions=" + Arrays.toString(permissions) + ", grantResults=" + Arrays.toString(grantResults));
|
+ ", permissions=" + Arrays.toString(permissions) + ", grantResults=" + Arrays.toString(grantResults));
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
@@ -286,23 +267,14 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
// webview.canGoBack() liefert immer false
|
// webview.canGoBack() always returns false
|
||||||
WebBackForwardList backForwardList = webview.copyBackForwardList();
|
WebBackForwardList backForwardList = webview.copyBackForwardList();
|
||||||
Log.d(TAG, "Back button pressed, backForwardList index == " + backForwardList.getCurrentIndex());
|
Log.d(TAG, "Back button pressed, backForwardList index == " + backForwardList.getCurrentIndex());
|
||||||
if (backForwardList.getCurrentIndex() > 0) {
|
if (backForwardList.getCurrentIndex() > 0) {
|
||||||
webview.goBack();
|
webview.goBack();
|
||||||
} else {
|
} else {
|
||||||
long currentTimeMillis = System.currentTimeMillis();
|
// Close app
|
||||||
if (backButtonPressedTimestamp + 5000 < currentTimeMillis) {
|
finish();
|
||||||
// First click on back button or previous click was more than 5 seconds ago
|
|
||||||
Log.d(TAG, "Back button 1x, show close hint");
|
|
||||||
showToast(getString(R.string.action_back_close_hint));
|
|
||||||
backButtonPressedTimestamp = currentTimeMillis;
|
|
||||||
} else {
|
|
||||||
// Second click on back button within 5 seconds -> close app
|
|
||||||
Log.d(TAG, "Back button 2x, closing app");
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +283,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onSynchronizeHintClicked(@SuppressWarnings("unused") View view) {
|
public void onSynchronizeHintClicked(@SuppressWarnings("unused") View view) {
|
||||||
synchronizeServer();
|
synchronizeWithServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSearch(@SuppressWarnings("unused") View view) {
|
public void onSearch(@SuppressWarnings("unused") View view) {
|
||||||
@@ -334,8 +306,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
String url = getWikiserverSearchUrl(query);
|
String url = getWikiserverSearchUrl(query);
|
||||||
loadUrl(url);
|
loadUrl(url);
|
||||||
|
|
||||||
// Der Wartedialog wird nach dem Anzeigen der Suchergebnisse durch Aufruf von
|
// The wait dialog is closed by closeProgressDialog() after the search result is shown
|
||||||
// closeProgressDialog() geschlossen.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSettingsDialog() {
|
private void showSettingsDialog() {
|
||||||
@@ -344,7 +315,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showAboutDialog() {
|
private void showAboutDialog() {
|
||||||
// Versionsnummer einsetzen
|
// insert version number
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams")
|
||||||
View dialogView = getLayoutInflater().inflate(R.layout.about_layout, null);
|
View dialogView = getLayoutInflater().inflate(R.layout.about_layout, null);
|
||||||
TextView versionText = dialogView.findViewById(R.id.label_version);
|
TextView versionText = dialogView.findViewById(R.id.label_version);
|
||||||
@@ -353,7 +324,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
TextView copyrightText = dialogView.findViewById(R.id.label_copyright);
|
TextView copyrightText = dialogView.findViewById(R.id.label_copyright);
|
||||||
copyrightText.setText(getString(R.string.about_copyright, year));
|
copyrightText.setText(getString(R.string.about_copyright, year));
|
||||||
|
|
||||||
// Dialog anzeigen
|
// show dialog
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setView(dialogView);
|
builder.setView(dialogView);
|
||||||
builder.setTitle(R.string.app_name);
|
builder.setTitle(R.string.app_name);
|
||||||
@@ -363,13 +334,57 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void synchronizeServer() {
|
/**
|
||||||
SyncNowTask syncNowTask = new SyncNowTask();
|
* Called if user presses the synchronization button.
|
||||||
syncNowTask.execute();
|
*/
|
||||||
|
private void synchronizeWithServer() {
|
||||||
|
synchronizationExecutorService.submit(this::runSynchronizationWithServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Öffnet die angegebene URL im eingebetteten Browser.
|
* Run synchronization of wiki content with wiki server.
|
||||||
|
* This method is run in an asynchronous background thread.
|
||||||
|
*/
|
||||||
|
private void runSynchronizationWithServer() {
|
||||||
|
SynchronizeWikiClient.SyncResult syncResult;
|
||||||
|
try {
|
||||||
|
syncResult = synchronizeWikiClient.synchronizeRepository(this::syncProgress);
|
||||||
|
} catch (ServiceException e) {
|
||||||
|
Log.e(TAG, "Error synchronizing repository with server", e);
|
||||||
|
runOnUiThread(() -> showToast(getString(R.string.synchronize_failed)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!syncResult.isSessionValid()) {
|
||||||
|
runOnUiThread(() -> showToast(getString(R.string.synchronize_session_not_valid)));
|
||||||
|
}
|
||||||
|
else if (!syncResult.isSessionAuthorized()) {
|
||||||
|
runOnUiThread(() -> showToast(getString(R.string.synchronize_session_not_authorized)));
|
||||||
|
}
|
||||||
|
else if (syncResult.isSyncFailed()) {
|
||||||
|
runOnUiThread(() -> showToast(getString(R.string.synchronize_failed)));
|
||||||
|
}
|
||||||
|
else if (syncResult.getFileCount() > 0) {
|
||||||
|
runOnUiThread(() -> showToast(getString(R.string.synchronize_successful, syncResult.getFileCount())));
|
||||||
|
|
||||||
|
WikiEngineApplication app = (WikiEngineApplication) getApplication();
|
||||||
|
app.resetServices();
|
||||||
|
|
||||||
|
CalendarSyncAdapter.requestCalendarSync(this);
|
||||||
|
} else {
|
||||||
|
runOnUiThread(() -> showToast(getString(R.string.synchronize_not_necessary)));
|
||||||
|
}
|
||||||
|
|
||||||
|
runOnUiThread(this::hideProgressBar);
|
||||||
|
runOnUiThread(this::updateLayoutVisibility);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncProgress(int progress, int max) {
|
||||||
|
runOnUiThread(() -> showProgressBar(progress, max));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a URL in the embedded browser.
|
||||||
*/
|
*/
|
||||||
private void loadUrl(@NotNull String url) {
|
private void loadUrl(@NotNull String url) {
|
||||||
Log.d(TAG, "Open URL " + url);
|
Log.d(TAG, "Open URL " + url);
|
||||||
@@ -413,11 +428,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
boolean webViewVisible = !hostUnconfiguredHintVisible && !repositoryEmptyHintVisible;
|
boolean webViewVisible = !hostUnconfiguredHintVisible && !repositoryEmptyHintVisible;
|
||||||
if (webViewVisible) {
|
if (webViewVisible) {
|
||||||
searchArea.setVisibility(View.VISIBLE);
|
searchArea.setVisibility(View.VISIBLE);
|
||||||
boolean previousVisible = (webView.getVisibility() == View.INVISIBLE);
|
boolean previousVisible = (webView.getVisibility() == View.VISIBLE);
|
||||||
webView.setVisibility(View.VISIBLE);
|
webView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
// if WebView is shown the first time, go to start page
|
// if WebView is shown the first time, go to start page
|
||||||
if (!previousVisible) {
|
if (!previousVisible || webView.getUrl() == null) {
|
||||||
loadUrl(SERVER_BASE_URL);
|
loadUrl(SERVER_BASE_URL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -450,61 +465,4 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
Toast toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
|
Toast toast = Toast.makeText(this, message, Toast.LENGTH_SHORT);
|
||||||
toast.show();
|
toast.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Synchronisiert mit dem Wikiserver in einem separaten Thread.
|
|
||||||
*/
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
|
||||||
@SuppressWarnings("NonStaticInnerClassInSecureContext")
|
|
||||||
private class SyncNowTask extends AsyncTask<Void, ProgressData, Integer> implements SynchronizeWikiClient.ProgressFeedback {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
protected Integer doInBackground(Void... params) {
|
|
||||||
try {
|
|
||||||
return synchronizeWikiClient.synchronizeRepository(this);
|
|
||||||
} catch (ServiceException e) {
|
|
||||||
Log.e(TAG, "Error synchronizing repository", e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void progress(int step, int total) {
|
|
||||||
ProgressData progressData = new ProgressData();
|
|
||||||
progressData.step = step;
|
|
||||||
progressData.total = total;
|
|
||||||
publishProgress(progressData);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onProgressUpdate(ProgressData... progressData) {
|
|
||||||
showProgressBar(progressData[0].step, progressData[0].total);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(@Nullable Integer filesCount) {
|
|
||||||
CalendarSyncAdapter.requestCalendarSync(MainActivity.this);
|
|
||||||
|
|
||||||
if (filesCount == null) {
|
|
||||||
showToast(getString(R.string.settings_synchronize_failed));
|
|
||||||
} else if (filesCount > 0) {
|
|
||||||
showToast(getString(R.string.settings_synchronize_successful, filesCount));
|
|
||||||
|
|
||||||
// Reset internal file caches
|
|
||||||
WikiEngineApplication app = (WikiEngineApplication) getApplication();
|
|
||||||
app.resetServices();
|
|
||||||
} else {
|
|
||||||
showToast(getString(R.string.settings_synchronize_not_necessary));
|
|
||||||
}
|
|
||||||
|
|
||||||
hideProgressBar();
|
|
||||||
updateLayoutVisibility();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class ProgressData {
|
|
||||||
public int step;
|
|
||||||
public int total;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
|
|||||||
@@ -1,26 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
@@ -35,11 +32,11 @@ import androidx.preference.PreferenceFragmentCompat;
|
|||||||
import net.moasdawiki.base.Settings;
|
import net.moasdawiki.base.Settings;
|
||||||
import net.moasdawiki.service.repository.RepositoryService;
|
import net.moasdawiki.service.repository.RepositoryService;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
public class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
@@ -47,15 +44,17 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
private SynchronizeWikiClient synchronizeWikiClient;
|
private SynchronizeWikiClient synchronizeWikiClient;
|
||||||
private RepositoryService repositoryService;
|
private RepositoryService repositoryService;
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
|
private ExecutorService synchronizationExecutorService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
//noinspection ConstantConditions
|
//noinspection DataFlowIssue
|
||||||
WikiEngineApplication app = (WikiEngineApplication) getContext().getApplicationContext();
|
WikiEngineApplication app = (WikiEngineApplication) getContext().getApplicationContext();
|
||||||
synchronizeWikiClient = app.getSynchronizeWikiClient();
|
synchronizeWikiClient = app.getSynchronizeWikiClient();
|
||||||
repositoryService = app.getServiceLocator().getRepositoryService();
|
repositoryService = app.getRepositoryService();
|
||||||
settings = app.getServiceLocator().getSettings();
|
settings = app.getSettings();
|
||||||
|
synchronizationExecutorService = Executors.newSingleThreadExecutor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -167,37 +166,30 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called if the user changes the connection settings to give fast feedback.
|
||||||
|
*/
|
||||||
private void checkServerConnection() {
|
private void checkServerConnection() {
|
||||||
new ConnectServerTask().execute();
|
synchronizationExecutorService.submit(this::runCheckServerConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the connection to the Wiki server.
|
* Run server connection check.
|
||||||
|
* This method is run in an asynchronous background thread.
|
||||||
*/
|
*/
|
||||||
@SuppressLint("StaticFieldLeak")
|
private void runCheckServerConnection() {
|
||||||
@SuppressWarnings("NonStaticInnerClassInSecureContext")
|
SharedPreferences preferences = getPreferenceManager().getSharedPreferences();
|
||||||
private class ConnectServerTask extends AsyncTask<Void, Void, Boolean> {
|
String host = preferences.getString(Constants.PREFERENCES_SYNC_SERVER_HOST, null);
|
||||||
@Override
|
if (host == null) {
|
||||||
@NotNull
|
Log.d(TAG, "Cancel ConnectServerTask because server host is not configured");
|
||||||
protected Boolean doInBackground(Void... params) {
|
return;
|
||||||
SharedPreferences preferences = getPreferenceManager().getSharedPreferences();
|
|
||||||
String host = preferences.getString(Constants.PREFERENCES_SYNC_SERVER_HOST, null);
|
|
||||||
if (host == null) {
|
|
||||||
Log.d(TAG, "Cancel ConnectServerTask because server host is not configured");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect with server
|
|
||||||
return synchronizeWikiClient.createAndCheckSession();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
SynchronizeWikiClient.SessionStatus sessionStatus = synchronizeWikiClient.createAndCheckSession();
|
||||||
protected void onPostExecute(@NotNull Boolean success) {
|
updateStatusText();
|
||||||
updateStatusText();
|
|
||||||
|
|
||||||
if (!success) {
|
if (!sessionStatus.isValid()) {
|
||||||
showToast(getString(R.string.settings_search_failed));
|
showToast(getString(R.string.settings_search_failed));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
@@ -29,20 +28,9 @@ import androidx.preference.PreferenceManager;
|
|||||||
import net.moasdawiki.base.Logger;
|
import net.moasdawiki.base.Logger;
|
||||||
import net.moasdawiki.base.ServiceException;
|
import net.moasdawiki.base.ServiceException;
|
||||||
import net.moasdawiki.base.Settings;
|
import net.moasdawiki.base.Settings;
|
||||||
import net.moasdawiki.plugin.ServiceLocator;
|
|
||||||
import net.moasdawiki.plugin.sync.AbstractSyncXml;
|
|
||||||
import net.moasdawiki.plugin.sync.CheckSessionResponseXml;
|
|
||||||
import net.moasdawiki.plugin.sync.CheckSessionXml;
|
|
||||||
import net.moasdawiki.plugin.sync.CreateSessionResponseXml;
|
|
||||||
import net.moasdawiki.plugin.sync.CreateSessionXml;
|
|
||||||
import net.moasdawiki.plugin.sync.ErrorResponseXml;
|
|
||||||
import net.moasdawiki.plugin.sync.ListModifiedFilesResponseXml;
|
|
||||||
import net.moasdawiki.plugin.sync.ListModifiedFilesXml;
|
|
||||||
import net.moasdawiki.plugin.sync.ReadFileResponseXml;
|
|
||||||
import net.moasdawiki.plugin.sync.ReadFileXml;
|
|
||||||
import net.moasdawiki.plugin.sync.SingleFileXml;
|
|
||||||
import net.moasdawiki.service.repository.AnyFile;
|
import net.moasdawiki.service.repository.AnyFile;
|
||||||
import net.moasdawiki.service.repository.RepositoryService;
|
import net.moasdawiki.service.repository.RepositoryService;
|
||||||
|
import net.moasdawiki.service.sync.*;
|
||||||
import net.moasdawiki.util.DateUtils;
|
import net.moasdawiki.util.DateUtils;
|
||||||
import net.moasdawiki.util.xml.XmlGenerator;
|
import net.moasdawiki.util.xml.XmlGenerator;
|
||||||
import net.moasdawiki.util.xml.XmlParser;
|
import net.moasdawiki.util.xml.XmlParser;
|
||||||
@@ -51,6 +39,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
@@ -59,16 +48,14 @@ import java.net.InetAddress;
|
|||||||
import java.net.NetworkInterface;
|
import java.net.NetworkInterface;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sucht einen Wikiserver in Netzwerk und synchronisiert alle Wikidateien
|
* Connects to the configured MoasdaWiki server and downloads the wiki files.
|
||||||
* im eigenen Repository..
|
|
||||||
*
|
|
||||||
* @author Herbert Reiter
|
|
||||||
*/
|
*/
|
||||||
public class SynchronizeWikiClient {
|
public class SynchronizeWikiClient {
|
||||||
|
|
||||||
@@ -76,6 +63,10 @@ public class SynchronizeWikiClient {
|
|||||||
|
|
||||||
private static final String PROTOCOL_VERSION = "2.0";
|
private static final String PROTOCOL_VERSION = "2.0";
|
||||||
|
|
||||||
|
private static final int CONNECTION_CONNECT_TIMEOUT = 2_000; // 2 seconds
|
||||||
|
private static final int CONNECTION_READ_TIMEOUT = 120_000; // 2 minutes
|
||||||
|
private static final int CONNECTION_RETRIES = 3;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -85,23 +76,25 @@ public class SynchronizeWikiClient {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final RepositoryService repositoryService;
|
private final RepositoryService repositoryService;
|
||||||
@NotNull
|
@NotNull
|
||||||
private final SecureRandom random = new SecureRandom();
|
private final SecureRandom random;
|
||||||
|
|
||||||
public SynchronizeWikiClient(@NotNull Context mContext, @NotNull ServiceLocator serviceLocator) {
|
public SynchronizeWikiClient(@NotNull Context mContext, @NotNull Logger logger, @NotNull Settings settings,
|
||||||
|
@NotNull RepositoryService repositoryService) {
|
||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
this.logger = serviceLocator.getLogger();
|
this.logger = logger;
|
||||||
this.settings = serviceLocator.getSettings();
|
this.settings = settings;
|
||||||
this.repositoryService = serviceLocator.getRepositoryService();
|
this.repositoryService = repositoryService;
|
||||||
|
this.random = new SecureRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verbindet sich mit dem Wikiserver. Ist bereits eine Serversession vorhanden, wird diese
|
* Connects with the MoasdaWiki server.
|
||||||
* weiter verwendet.
|
* If there is already a valid server session, it is reused.
|
||||||
*/
|
*/
|
||||||
public boolean createAndCheckSession() {
|
public SessionStatus createAndCheckSession() {
|
||||||
String serverHostPort = getServerHostPort();
|
String serverHostPort = getServerHostPort();
|
||||||
if (serverHostPort == null) {
|
if (serverHostPort == null) {
|
||||||
return false;
|
return new SessionStatus(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(mContext);
|
PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||||
@@ -109,37 +102,39 @@ public class SynchronizeWikiClient {
|
|||||||
String serverSessionId = preferences.getString(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID, null);
|
String serverSessionId = preferences.getString(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID, null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Wenn noch keine Session vorhanden ist, eine erzeugen
|
// If there is no session yet, create a new session
|
||||||
boolean createSessionCalled = false;
|
boolean createSessionCalled = false;
|
||||||
if (serverSessionId == null) {
|
if (serverSessionId == null) {
|
||||||
createSessionCalled = true;
|
createSessionCalled = true;
|
||||||
createSession(serverHostPort);
|
createSession(serverHostPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ist Session freigeschaltet zur Synchronisierung?
|
// Check existing session if it's still valid
|
||||||
boolean[] checkResult = checkSession(serverHostPort);
|
SessionStatus sessionStatus = checkSession(serverHostPort);
|
||||||
if (checkResult[0]) {
|
if (sessionStatus.isValid()) {
|
||||||
return true;
|
return sessionStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Session ist ungültig --> neue Session holen
|
// If session ist invalid, create new session
|
||||||
if (createSessionCalled) {
|
if (createSessionCalled) {
|
||||||
// createSession nicht erneut aufrufen
|
// don't call createSession() twice
|
||||||
return false;
|
return new SessionStatus(false, false);
|
||||||
}
|
}
|
||||||
createSession(serverHostPort);
|
createSession(serverHostPort);
|
||||||
|
|
||||||
// Session erneut prüfen
|
// Check session again
|
||||||
boolean[] checkResult2 = checkSession(serverHostPort);
|
return checkSession(serverHostPort);
|
||||||
return checkResult2[0];
|
|
||||||
}
|
}
|
||||||
catch (ServiceException e) {
|
catch (ServiceException e) {
|
||||||
return false;
|
return new SessionStatus(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connects with the MoasdaWiki server and creates a new session.
|
||||||
|
*/
|
||||||
private void createSession(@NotNull String serverHostPort) throws ServiceException {
|
private void createSession(@NotNull String serverHostPort) throws ServiceException {
|
||||||
// Anfrage schicken
|
// send request
|
||||||
CreateSessionXml createSessionXml = new CreateSessionXml();
|
CreateSessionXml createSessionXml = new CreateSessionXml();
|
||||||
createSessionXml.version = PROTOCOL_VERSION;
|
createSessionXml.version = PROTOCOL_VERSION;
|
||||||
createSessionXml.clientSessionId = generateSessionId();
|
createSessionXml.clientSessionId = generateSessionId();
|
||||||
@@ -153,11 +148,11 @@ public class SynchronizeWikiClient {
|
|||||||
String requestXml = generateXml(createSessionXml);
|
String requestXml = generateXml(createSessionXml);
|
||||||
String responseXml = sendXmlRequest(serverHostPort, "/sync/create-session", requestXml);
|
String responseXml = sendXmlRequest(serverHostPort, "/sync/create-session", requestXml);
|
||||||
|
|
||||||
// Antwort auswerten
|
// parse response
|
||||||
CreateSessionResponseXml response = parseXml(responseXml, CreateSessionResponseXml.class);
|
CreateSessionResponseXml response = parseXml(responseXml, CreateSessionResponseXml.class);
|
||||||
Log.d(TAG, "Current sync session ID '" + response.serverSessionId + "'");
|
Log.d(TAG, "Current sync session ID '" + response.serverSessionId + "'");
|
||||||
|
|
||||||
// Session prüfen
|
// check for session id
|
||||||
if (response.serverSessionId == null) {
|
if (response.serverSessionId == null) {
|
||||||
throw new ServiceException("Didn't get a server session ID");
|
throw new ServiceException("Didn't get a server session ID");
|
||||||
}
|
}
|
||||||
@@ -169,30 +164,34 @@ public class SynchronizeWikiClient {
|
|||||||
editor.putString(Constants.PREFERENCES_SYNC_SERVER_HOST_DISPLAYNAME, response.serverHost);
|
editor.putString(Constants.PREFERENCES_SYNC_SERVER_HOST_DISPLAYNAME, response.serverHost);
|
||||||
editor.putString(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID, response.serverSessionId);
|
editor.putString(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID, response.serverSessionId);
|
||||||
editor.putString(Constants.PREFERENCES_SYNC_CLIENT_SESSION_ID, createSessionXml.clientSessionId);
|
editor.putString(Constants.PREFERENCES_SYNC_CLIENT_SESSION_ID, createSessionXml.clientSessionId);
|
||||||
// Synchronisierungszeiten können nicht mehr genutzt werden
|
// reset sync data
|
||||||
editor.remove(Constants.PREFERENCES_SYNC_SERVER_TIME);
|
editor.remove(Constants.PREFERENCES_SYNC_SERVER_TIME);
|
||||||
editor.remove(Constants.PREFERENCES_SYNC_SERVER_SESSION_AUTHORIZED);
|
editor.remove(Constants.PREFERENCES_SYNC_SERVER_SESSION_AUTHORIZED);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
private String generateSessionId() {
|
private String generateSessionId() {
|
||||||
return new BigInteger(130, random).toString(32);
|
return new BigInteger(130, random).toString(32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if our MoasdaWiki server session is valid and authorized.
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
private boolean[] checkSession(@NotNull String serverHostPort) throws ServiceException {
|
private SessionStatus checkSession(@NotNull String serverHostPort) throws ServiceException {
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||||
String serverSessionId = preferences.getString(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID, null);
|
String serverSessionId = preferences.getString(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID, null);
|
||||||
String clientSessionId = preferences.getString(Constants.PREFERENCES_SYNC_CLIENT_SESSION_ID, null);
|
String clientSessionId = preferences.getString(Constants.PREFERENCES_SYNC_CLIENT_SESSION_ID, null);
|
||||||
|
|
||||||
// Anfrage schicken
|
// Send request
|
||||||
CheckSessionXml checkSessionXml = new CheckSessionXml();
|
CheckSessionXml checkSessionXml = new CheckSessionXml();
|
||||||
checkSessionXml.version = PROTOCOL_VERSION;
|
checkSessionXml.version = PROTOCOL_VERSION;
|
||||||
checkSessionXml.serverSessionId = serverSessionId;
|
checkSessionXml.serverSessionId = serverSessionId;
|
||||||
String requestXml = generateXml(checkSessionXml);
|
String requestXml = generateXml(checkSessionXml);
|
||||||
String responseXml = sendXmlRequest(serverHostPort, "/sync/check-session", requestXml);
|
String responseXml = sendXmlRequest(serverHostPort, "/sync/check-session", requestXml);
|
||||||
|
|
||||||
// Antwort auswerten
|
// Parse response
|
||||||
CheckSessionResponseXml response = parseXml(responseXml, CheckSessionResponseXml.class);
|
CheckSessionResponseXml response = parseXml(responseXml, CheckSessionResponseXml.class);
|
||||||
if (response.valid == null || !response.valid) {
|
if (response.valid == null || !response.valid) {
|
||||||
Log.d(TAG, "Sync server session ID '" + serverSessionId + "' is not valid any more");
|
Log.d(TAG, "Sync server session ID '" + serverSessionId + "' is not valid any more");
|
||||||
@@ -200,7 +199,7 @@ public class SynchronizeWikiClient {
|
|||||||
editor.remove(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID);
|
editor.remove(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID);
|
||||||
editor.remove(Constants.PREFERENCES_SYNC_CLIENT_SESSION_ID);
|
editor.remove(Constants.PREFERENCES_SYNC_CLIENT_SESSION_ID);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
return new boolean[]{ false, false };
|
return new SessionStatus(false, false);
|
||||||
}
|
}
|
||||||
if (clientSessionId != null && !clientSessionId.equals(response.clientSessionId)) {
|
if (clientSessionId != null && !clientSessionId.equals(response.clientSessionId)) {
|
||||||
Log.d(TAG, "Sync server authentication failed, client session ID does not match");
|
Log.d(TAG, "Sync server authentication failed, client session ID does not match");
|
||||||
@@ -208,37 +207,70 @@ public class SynchronizeWikiClient {
|
|||||||
editor.remove(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID);
|
editor.remove(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID);
|
||||||
editor.remove(Constants.PREFERENCES_SYNC_CLIENT_SESSION_ID);
|
editor.remove(Constants.PREFERENCES_SYNC_CLIENT_SESSION_ID);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
return new boolean[]{ false, false };
|
return new SessionStatus(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
boolean authorized = response.authorized != null && response.authorized;
|
boolean authorized = response.authorized != null && response.authorized;
|
||||||
editor.putBoolean(Constants.PREFERENCES_SYNC_SERVER_SESSION_AUTHORIZED, authorized);
|
editor.putBoolean(Constants.PREFERENCES_SYNC_SERVER_SESSION_AUTHORIZED, authorized);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
return new boolean[]{ true, authorized };
|
return new SessionStatus(true, authorized);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronisiert alle Repository-Dateien mit dem Wikiserver. Vorher wird geprüft, ob
|
* Contains the session status.
|
||||||
* die Server-Session noch gültig ist und wir mit demselben Server verbunden sind.
|
|
||||||
*
|
|
||||||
* @return Anzahl der synchronisierten Dateien.
|
|
||||||
*/
|
*/
|
||||||
public int synchronizeRepository(ProgressFeedback feedback) throws ServiceException {
|
public static class SessionStatus {
|
||||||
boolean sessionValid = createAndCheckSession();
|
/**
|
||||||
if (!sessionValid) {
|
* Is the MoasdaWiki server session valid?
|
||||||
throw new ServiceException("No valid server session found");
|
*/
|
||||||
|
private final boolean valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the session authorized at server side?
|
||||||
|
*/
|
||||||
|
private final boolean authorized;
|
||||||
|
|
||||||
|
public SessionStatus(boolean valid, boolean authorized) {
|
||||||
|
this.valid = valid;
|
||||||
|
this.authorized = authorized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAuthorized() {
|
||||||
|
return authorized;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads the wiki files from the MoasdaWiki server.
|
||||||
|
* Checks if the session is still valid.
|
||||||
|
*/
|
||||||
|
public SyncResult synchronizeRepository(ProgressFeedback feedback) throws ServiceException {
|
||||||
String serverHostPort = getServerHostPort();
|
String serverHostPort = getServerHostPort();
|
||||||
if (serverHostPort == null) {
|
if (serverHostPort == null) {
|
||||||
throw new ServiceException("No wiki server configured");
|
Log.w(TAG, "No server host name configured");
|
||||||
|
return new SyncResult(false, false, true, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SessionStatus sessionStatus = createAndCheckSession();
|
||||||
|
if (!sessionStatus.isValid()) {
|
||||||
|
Log.w(TAG, "No valid server session");
|
||||||
|
return new SyncResult(false, false, true, 0);
|
||||||
|
}
|
||||||
|
if (!sessionStatus.isAuthorized()) {
|
||||||
|
Log.w(TAG, "Server session not authorized");
|
||||||
|
return new SyncResult(true, false, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||||
String serverSessionId = preferences.getString(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID, null);
|
String serverSessionId = preferences.getString(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID, null);
|
||||||
if (serverSessionId == null) {
|
if (serverSessionId == null) {
|
||||||
throw new ServiceException("Not server session ID found");
|
Log.w(TAG, "No server session available");
|
||||||
|
return new SyncResult(false, false, true, 0);
|
||||||
}
|
}
|
||||||
long lastSyncServerTimeMs = preferences.getLong(Constants.PREFERENCES_SYNC_SERVER_TIME, 0);
|
long lastSyncServerTimeMs = preferences.getLong(Constants.PREFERENCES_SYNC_SERVER_TIME, 0);
|
||||||
Date lastSyncServerTime = null;
|
Date lastSyncServerTime = null;
|
||||||
@@ -260,10 +292,10 @@ public class SynchronizeWikiClient {
|
|||||||
Log.d(TAG, "Downloading " + fileCount + " files from server");
|
Log.d(TAG, "Downloading " + fileCount + " files from server");
|
||||||
if (fileCount == 0) {
|
if (fileCount == 0) {
|
||||||
// no files to download, cancel process
|
// no files to download, cancel process
|
||||||
return 0;
|
return new SyncResult(true, true, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < fileCount && !feedback.isCancelled(); i++) {
|
for (int i = 0; i < fileCount; i++) {
|
||||||
feedback.progress(i, fileCount);
|
feedback.progress(i, fileCount);
|
||||||
SingleFileXml serverFile = response.fileList.get(i);
|
SingleFileXml serverFile = response.fileList.get(i);
|
||||||
try {
|
try {
|
||||||
@@ -279,17 +311,45 @@ public class SynchronizeWikiClient {
|
|||||||
app.resetServices();
|
app.resetServices();
|
||||||
|
|
||||||
// Update last sync time
|
// Update last sync time
|
||||||
if (!feedback.isCancelled()) {
|
Date currentServerDate = DateUtils.parseUtcDate(response.currentServerTime);
|
||||||
Date currentServerDate = DateUtils.parseUtcDate(response.currentServerTime);
|
if (currentServerDate != null) {
|
||||||
if (currentServerDate != null) {
|
long newLastSyncServerTimeMs = currentServerDate.getTime();
|
||||||
long newLastSyncServerTimeMs = currentServerDate.getTime();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
editor.putLong(Constants.PREFERENCES_SYNC_SERVER_TIME, newLastSyncServerTimeMs);
|
||||||
editor.putLong(Constants.PREFERENCES_SYNC_SERVER_TIME, newLastSyncServerTimeMs);
|
editor.apply();
|
||||||
editor.apply();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileCount;
|
return new SyncResult(true, true, false, fileCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SyncResult {
|
||||||
|
private final boolean sessionValid;
|
||||||
|
private final boolean sessionAuthorized;
|
||||||
|
private final boolean syncFailed;
|
||||||
|
private final int fileCount;
|
||||||
|
|
||||||
|
public SyncResult(boolean sessionValid, boolean sessionAuthorized, boolean syncFailed, int fileCount) {
|
||||||
|
this.sessionValid = sessionValid;
|
||||||
|
this.sessionAuthorized = sessionAuthorized;
|
||||||
|
this.syncFailed = syncFailed;
|
||||||
|
this.fileCount = fileCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSessionValid() {
|
||||||
|
return sessionValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSessionAuthorized() {
|
||||||
|
return sessionAuthorized;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSyncFailed() {
|
||||||
|
return syncFailed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFileCount() {
|
||||||
|
return fileCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadFileFromServer(@NotNull String serverHostPort, @NotNull String serverSessionId, @NotNull String filePath) throws ServiceException {
|
private void downloadFileFromServer(@NotNull String serverHostPort, @NotNull String serverSessionId, @NotNull String filePath) throws ServiceException {
|
||||||
@@ -387,11 +447,7 @@ public class SynchronizeWikiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schickt einen XML-Request und liest die XML-Antwort ein.
|
* Sends an XML request and reads the XML response.
|
||||||
*
|
|
||||||
* @param urlPath HTTP-URL, nicht null
|
|
||||||
* @param requestXml XML-Anfrage, nicht null.
|
|
||||||
* @return XML-Antwort, nicht null.
|
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
private String sendXmlRequest(@NotNull String serverHostPort, @NotNull String urlPath, @NotNull String requestXml) throws ServiceException {
|
private String sendXmlRequest(@NotNull String serverHostPort, @NotNull String urlPath, @NotNull String requestXml) throws ServiceException {
|
||||||
@@ -400,33 +456,11 @@ public class SynchronizeWikiClient {
|
|||||||
Log.d(TAG, "Request to " + url + ": " + truncateLogText(requestXml, 200));
|
Log.d(TAG, "Request to " + url + ": " + truncateLogText(requestXml, 200));
|
||||||
byte[] requestBytes = requestXml.getBytes(StandardCharsets.UTF_8);
|
byte[] requestBytes = requestXml.getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
URI uri = new URI(url);
|
byte[] responseBytes = sendBinaryRequestWithRetries(new URI(url).toURL(), requestBytes);
|
||||||
HttpURLConnection conn = (HttpURLConnection) uri.toURL().openConnection();
|
|
||||||
conn.setRequestMethod("POST");
|
|
||||||
conn.setRequestProperty("Content-Type", "text/xml");
|
|
||||||
conn.setRequestProperty("Content-Length", Integer.toString(requestBytes.length));
|
|
||||||
conn.setUseCaches(false);
|
|
||||||
conn.setDoOutput(true);
|
|
||||||
conn.setDoInput(true);
|
|
||||||
conn.setConnectTimeout(1000); // 1 Sekunde
|
|
||||||
conn.setReadTimeout(10000); // 10 Sekunden
|
|
||||||
conn.connect();
|
|
||||||
|
|
||||||
OutputStream out = conn.getOutputStream();
|
//noinspection CharsetObjectCanBeUsed
|
||||||
out.write(requestBytes);
|
String responseXml = new String(responseBytes, "UTF-8");
|
||||||
out.flush();
|
Log.d(TAG, "Response: " + truncateLogText(responseXml, 100));
|
||||||
|
|
||||||
InputStream in = conn.getInputStream();
|
|
||||||
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(in.available());
|
|
||||||
int bytesRead;
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
while ((bytesRead = in.read(buffer)) != -1) {
|
|
||||||
byteStream.write(buffer, 0, bytesRead);
|
|
||||||
}
|
|
||||||
byte[] responseBytes = byteStream.toByteArray();
|
|
||||||
|
|
||||||
String responseXml = new String(responseBytes, StandardCharsets.UTF_8);
|
|
||||||
Log.d(TAG, "Response: " + truncateLogText(responseXml, 400));
|
|
||||||
return responseXml;
|
return responseXml;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Error sending XML request", e);
|
Log.e(TAG, "Error sending XML request", e);
|
||||||
@@ -434,6 +468,44 @@ public class SynchronizeWikiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private byte[] sendBinaryRequestWithRetries(@NotNull URL url, byte[] requestBytes) throws ServiceException {
|
||||||
|
for (int i = 1; i <= CONNECTION_RETRIES; i++) {
|
||||||
|
try {
|
||||||
|
return sendBinaryRequest(url, requestBytes);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Log.d(TAG, "Error sending request to MoasdaWiki server in attempt " + i + " of " + CONNECTION_RETRIES, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new ServiceException("Error sending request to MoasdaWiki server for " + CONNECTION_RETRIES + " times, failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] sendBinaryRequest(@NotNull URL url, byte[] requestBytes) throws IOException {
|
||||||
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
conn.setRequestMethod("POST");
|
||||||
|
conn.setRequestProperty("Content-Type", "text/xml");
|
||||||
|
conn.setRequestProperty("Content-Length", Integer.toString(requestBytes.length));
|
||||||
|
conn.setUseCaches(false);
|
||||||
|
conn.setDoOutput(true);
|
||||||
|
conn.setDoInput(true);
|
||||||
|
conn.setConnectTimeout(CONNECTION_CONNECT_TIMEOUT);
|
||||||
|
conn.setReadTimeout(CONNECTION_READ_TIMEOUT);
|
||||||
|
conn.connect();
|
||||||
|
|
||||||
|
OutputStream out = conn.getOutputStream();
|
||||||
|
out.write(requestBytes);
|
||||||
|
out.flush();
|
||||||
|
|
||||||
|
InputStream in = conn.getInputStream();
|
||||||
|
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(in.available());
|
||||||
|
int bytesRead;
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
while ((bytesRead = in.read(buffer)) != -1) {
|
||||||
|
byteStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
return byteStream.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
private String truncateLogText(String logText, int maxLength) {
|
private String truncateLogText(String logText, int maxLength) {
|
||||||
if (logText.length() <= maxLength) {
|
if (logText.length() <= maxLength) {
|
||||||
return logText;
|
return logText;
|
||||||
@@ -446,7 +518,7 @@ public class SynchronizeWikiClient {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
private String generateXml(@NotNull AbstractSyncXml xmlBean) throws ServiceException {
|
private String generateXml(@NotNull AbstractSyncXml xmlBean) throws ServiceException {
|
||||||
XmlGenerator xmlGenerator = new XmlGenerator(logger);
|
XmlGenerator xmlGenerator = new XmlGenerator();
|
||||||
return xmlGenerator.generate(xmlBean);
|
return xmlGenerator.generate(xmlBean);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +531,7 @@ public class SynchronizeWikiClient {
|
|||||||
XmlParser xmlParser = new XmlParser(logger);
|
XmlParser xmlParser = new XmlParser(logger);
|
||||||
return xmlParser.parse(xml, xmlBeanType);
|
return xmlParser.parse(xml, xmlBeanType);
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.write("Failed to parse XML for class " + xmlBeanType.getSimpleName() + ", try class ErrorResponseXml", e);
|
Log.d(TAG, "Failed to parse XML for class " + xmlBeanType.getSimpleName() + ", try class ErrorResponseXml", e);
|
||||||
// Versuche eine Fehlerantwort zu parsen
|
// Versuche eine Fehlerantwort zu parsen
|
||||||
XmlParser xmlParser = new XmlParser(logger);
|
XmlParser xmlParser = new XmlParser(logger);
|
||||||
ErrorResponseXml errorResponseXml = xmlParser.parse(xml, ErrorResponseXml.class);
|
ErrorResponseXml errorResponseXml = xmlParser.parse(xml, ErrorResponseXml.class);
|
||||||
@@ -471,9 +543,8 @@ public class SynchronizeWikiClient {
|
|||||||
* Interface, um den Fortschritt während der Synchronisierung mit dem Server
|
* Interface, um den Fortschritt während der Synchronisierung mit dem Server
|
||||||
* zurückzuübermitteln.
|
* zurückzuübermitteln.
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface ProgressFeedback {
|
public interface ProgressFeedback {
|
||||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
|
||||||
boolean isCancelled();
|
|
||||||
void progress(int step, int total);
|
void progress(int step, int total);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* MoasdaWiki App
|
* MoasdaWiki App
|
||||||
* Copyright (C) 2008 - 2020 Herbert Reiter (herbert@moasdawiki.net)
|
* Copyright (C) 2008 - 2025 Herbert Reiter (herbert@moasdawiki.net)
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* it under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License version 3 as published
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation (GPL-3.0-only).
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, but
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moasdawiki.app;
|
package net.moasdawiki.app;
|
||||||
@@ -23,58 +22,93 @@ import android.app.Application;
|
|||||||
import net.moasdawiki.base.Logger;
|
import net.moasdawiki.base.Logger;
|
||||||
import net.moasdawiki.base.Messages;
|
import net.moasdawiki.base.Messages;
|
||||||
import net.moasdawiki.base.Settings;
|
import net.moasdawiki.base.Settings;
|
||||||
import net.moasdawiki.plugin.PluginService;
|
import net.moasdawiki.server.RequestDispatcher;
|
||||||
import net.moasdawiki.plugin.ServiceLocator;
|
import net.moasdawiki.service.handler.FileDownloadHandler;
|
||||||
|
import net.moasdawiki.service.handler.SearchHandler;
|
||||||
|
import net.moasdawiki.service.handler.ViewPageHandler;
|
||||||
import net.moasdawiki.service.render.HtmlService;
|
import net.moasdawiki.service.render.HtmlService;
|
||||||
import net.moasdawiki.service.repository.FilesystemRepositoryService;
|
|
||||||
import net.moasdawiki.service.repository.RepositoryService;
|
import net.moasdawiki.service.repository.RepositoryService;
|
||||||
|
import net.moasdawiki.service.search.SearchIgnoreList;
|
||||||
|
import net.moasdawiki.service.search.SearchIndex;
|
||||||
import net.moasdawiki.service.search.SearchService;
|
import net.moasdawiki.service.search.SearchService;
|
||||||
|
import net.moasdawiki.service.transform.IncludePageTransformer;
|
||||||
|
import net.moasdawiki.service.transform.KontaktseiteTransformer;
|
||||||
|
import net.moasdawiki.service.transform.TerminTransformer;
|
||||||
|
import net.moasdawiki.service.transform.TransformWikiPage;
|
||||||
|
import net.moasdawiki.service.transform.TransformerService;
|
||||||
|
import net.moasdawiki.service.transform.WikiTagsTransformer;
|
||||||
import net.moasdawiki.service.wiki.WikiService;
|
import net.moasdawiki.service.wiki.WikiService;
|
||||||
import net.moasdawiki.service.wiki.WikiServiceImpl;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verwaltet den Lebenszyklus der Wiki Engine. Muss außerhalb der Activities erfolgen, weil diese
|
* Main control of the wiki App.
|
||||||
* z.B. beim Drehen des Bildschirm neu erzeugt werden.
|
|
||||||
*
|
*
|
||||||
* @author Herbert Reiter
|
* Must be run globally for the App, i.e. outside of an activity.
|
||||||
*/
|
*/
|
||||||
public class WikiEngineApplication extends Application {
|
public class WikiEngineApplication extends Application {
|
||||||
|
private static final String REPOSITORY_ROOT_PATH_DEFAULT = "repository";
|
||||||
|
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
private ServiceLocator serviceLocator;
|
private RepositoryService repositoryService;
|
||||||
|
private Settings settings;
|
||||||
|
private Messages messages;
|
||||||
|
private WikiService wikiService;
|
||||||
|
private SearchService searchService;
|
||||||
private SynchronizeWikiClient synchronizeWikiClient;
|
private SynchronizeWikiClient synchronizeWikiClient;
|
||||||
|
private TerminTransformer terminTransformer;
|
||||||
|
private RequestDispatcher requestDispatcher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
logger = new Logger();
|
logger = new Logger(System.out);
|
||||||
logger.write("MoasdaWiki app starting");
|
logger.write("MoasdaWiki App starting");
|
||||||
|
|
||||||
File internalStorageRepositoryRoot = new File(getFilesDir(), "repository");
|
File internalStorageRepositoryRoot = new File(getFilesDir(), REPOSITORY_ROOT_PATH_DEFAULT);
|
||||||
RepositoryService repositoryService = new FilesystemRepositoryService(logger, internalStorageRepositoryRoot);
|
|
||||||
repositoryService.init();
|
|
||||||
WikiService wikiService = new WikiServiceImpl(logger, repositoryService);
|
|
||||||
SearchService searchService = new SearchService(logger, wikiService);
|
|
||||||
Settings settings = new AndroidSettings(logger, repositoryService, AndroidSettings.getConfigFileApp());
|
|
||||||
Messages messages = new Messages(logger, settings, repositoryService);
|
|
||||||
PluginService pluginService = new PluginService(logger, settings);
|
|
||||||
HtmlService htmlService = new HtmlService(logger, settings, messages, wikiService, pluginService);
|
|
||||||
serviceLocator = new ServiceLocator(logger, settings, messages, repositoryService, wikiService, htmlService, searchService, pluginService);
|
|
||||||
|
|
||||||
pluginService.loadPlugins(serviceLocator);
|
// basic services
|
||||||
|
repositoryService = new RepositoryService(logger, internalStorageRepositoryRoot, null, false);
|
||||||
|
settings = new AndroidSettings(logger, repositoryService, Settings.getConfigFileApp());
|
||||||
|
messages = new Messages(logger, settings, repositoryService);
|
||||||
|
wikiService = new WikiService(logger, repositoryService, false);
|
||||||
|
SearchIgnoreList searchIgnoreList = new SearchIgnoreList(logger, repositoryService);
|
||||||
|
SearchIndex searchIndex = new SearchIndex(logger, repositoryService, wikiService, searchIgnoreList, true);
|
||||||
|
searchService = new SearchService(logger, wikiService, searchIgnoreList, searchIndex, false);
|
||||||
|
|
||||||
synchronizeWikiClient = new SynchronizeWikiClient(this, serviceLocator);
|
// App: use SynchronizeWikiClient instead of SynchronizationService
|
||||||
|
synchronizeWikiClient = new SynchronizeWikiClient(this, logger, settings, repositoryService);
|
||||||
|
|
||||||
|
// transformers
|
||||||
|
// do not run the SynchronizationPageTransformer
|
||||||
|
IncludePageTransformer includePageTransformer = new IncludePageTransformer(logger, wikiService);
|
||||||
|
KontaktseiteTransformer kontaktseiteTransformer = new KontaktseiteTransformer();
|
||||||
|
terminTransformer = new TerminTransformer(logger, messages, repositoryService, wikiService, false);
|
||||||
|
WikiTagsTransformer wikiTagsTransformer = new WikiTagsTransformer(logger, settings, messages, wikiService);
|
||||||
|
// list of transformers, the order matters
|
||||||
|
TransformWikiPage[] transformers = {includePageTransformer, kontaktseiteTransformer, terminTransformer, wikiTagsTransformer};
|
||||||
|
TransformerService transformerService = new TransformerService(transformers);
|
||||||
|
|
||||||
|
// more services
|
||||||
|
HtmlService htmlService = new HtmlService(logger, settings, messages, wikiService, transformerService);
|
||||||
|
|
||||||
|
// HTTP handlers
|
||||||
|
// do not run the EditorHandler
|
||||||
|
ViewPageHandler viewPageHandler = new ViewPageHandler(logger, settings, wikiService, htmlService);
|
||||||
|
SearchHandler searchHandler = new SearchHandler(logger, settings, messages, wikiService, searchService, htmlService);
|
||||||
|
FileDownloadHandler fileDownloadHandler = new FileDownloadHandler(logger, settings, repositoryService, htmlService);
|
||||||
|
requestDispatcher = new RequestDispatcher(htmlService, viewPageHandler,
|
||||||
|
searchHandler, null, fileDownloadHandler, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetServices() {
|
public void resetServices() {
|
||||||
serviceLocator.getRepositoryService().rebuildCache();
|
repositoryService.reset();
|
||||||
serviceLocator.getWikiService().reset();
|
settings.reset();
|
||||||
serviceLocator.getSettings().reset();
|
messages.reset();
|
||||||
serviceLocator.getMessages().reset();
|
wikiService.reset();
|
||||||
serviceLocator.getPluginService().loadPlugins(serviceLocator);
|
searchService.reset();
|
||||||
|
terminTransformer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -83,11 +117,23 @@ public class WikiEngineApplication extends Application {
|
|||||||
super.onTerminate();
|
super.onTerminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceLocator getServiceLocator() {
|
public RepositoryService getRepositoryService() {
|
||||||
return serviceLocator;
|
return repositoryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Settings getSettings() {
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TerminTransformer getTerminTransformer() {
|
||||||
|
return terminTransformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SynchronizeWikiClient getSynchronizeWikiClient() {
|
public SynchronizeWikiClient getSynchronizeWikiClient() {
|
||||||
return synchronizeWikiClient;
|
return synchronizeWikiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RequestDispatcher getRequestDispatcher() {
|
||||||
|
return requestDispatcher;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 503 B |
|
Before Width: | Height: | Size: 444 B |
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 334 B |
|
Before Width: | Height: | Size: 289 B |
|
Before Width: | Height: | Size: 225 B |
|
Before Width: | Height: | Size: 623 B |
|
Before Width: | Height: | Size: 543 B |
|
Before Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 918 B |
|
Before Width: | Height: | Size: 801 B |
@@ -16,13 +16,14 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="20dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_margin="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:background="@drawable/ic_info_outline_black" />
|
android:background="@drawable/ic_info_outline_black" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -50,13 +51,14 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="20dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_margin="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:background="@drawable/ic_info_outline_black" />
|
android:background="@drawable/ic_info_outline_black" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
<string name="about_version">Version %1$s</string>
|
<string name="about_version">Version %1$s</string>
|
||||||
<string name="action_help">Hilfe</string>
|
<string name="action_help">Hilfe</string>
|
||||||
<string name="action_about">Über</string>
|
<string name="action_about">Über</string>
|
||||||
<string name="action_back_close_hint">Erneut drücken um die App zu beenden.</string>
|
|
||||||
<string name="action_settings">Einstellungen</string>
|
<string name="action_settings">Einstellungen</string>
|
||||||
<string name="action_startpage">Startseite</string>
|
<string name="action_startpage">Startseite</string>
|
||||||
<string name="action_synchronize">Synchronisieren</string>
|
<string name="action_synchronize">Synchronisieren</string>
|
||||||
@@ -29,7 +28,9 @@
|
|||||||
<string name="settings_status_server_connected">Am Server angemeldet</string>
|
<string name="settings_status_server_connected">Am Server angemeldet</string>
|
||||||
<string name="settings_status_server_authorization_mission">Erfordert Berechtigung am Server</string>
|
<string name="settings_status_server_authorization_mission">Erfordert Berechtigung am Server</string>
|
||||||
<string name="settings_search_failed">Keinen Wikiserver gefunden!</string>
|
<string name="settings_search_failed">Keinen Wikiserver gefunden!</string>
|
||||||
<string name="settings_synchronize_successful">%1$d Dateien erfolgreich synchronisiert</string>
|
<string name="synchronize_successful">%1$d Dateien erfolgreich synchronisiert</string>
|
||||||
<string name="settings_synchronize_not_necessary">Dateien sind bereits aktuell</string>
|
<string name="synchronize_not_necessary">Dateien sind bereits aktuell</string>
|
||||||
<string name="settings_synchronize_failed">Synchronisierung nicht möglich, bitte überprüfen Sie die Einstellungen und den Status!</string>
|
<string name="synchronize_session_not_valid">Keine Verbindung zum MoasdaWiki-Server vorhanden! Bitte überprüfe die Einstellungen und den Status!</string>
|
||||||
|
<string name="synchronize_session_not_authorized">Fehlende Berechtigung beim MoasdaWiki-Server! Bitte schalte den Zugang für die App beim Server frei!</string>
|
||||||
|
<string name="synchronize_failed">Synchronisierung nicht möglich, bitte überprüfe die Einstellungen und den Status!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
<string name="about_homepage_url" translatable="false">https://www.moasdawiki.net/</string>
|
<string name="about_homepage_url" translatable="false">https://www.moasdawiki.net/</string>
|
||||||
<string name="about_version">Version %1$s</string>
|
<string name="about_version">Version %1$s</string>
|
||||||
<string name="action_about">About</string>
|
<string name="action_about">About</string>
|
||||||
<string name="action_back_close_hint">Press again to exit the app.</string>
|
|
||||||
<string name="action_help">Help</string>
|
<string name="action_help">Help</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="action_startpage">Start page</string>
|
<string name="action_startpage">Start page</string>
|
||||||
@@ -30,7 +29,9 @@
|
|||||||
<string name="settings_status_server_connected">Connected to server</string>
|
<string name="settings_status_server_connected">Connected to server</string>
|
||||||
<string name="settings_status_server_authorization_mission">Needs authorization at server</string>
|
<string name="settings_status_server_authorization_mission">Needs authorization at server</string>
|
||||||
<string name="settings_search_failed">No Wiki server found!</string>
|
<string name="settings_search_failed">No Wiki server found!</string>
|
||||||
<string name="settings_synchronize_successful">Successfully synchronized %1$d files</string>
|
<string name="synchronize_successful">Successfully synchronized %1$d files</string>
|
||||||
<string name="settings_synchronize_not_necessary">All files are up-to-date</string>
|
<string name="synchronize_not_necessary">All files are up-to-date</string>
|
||||||
<string name="settings_synchronize_failed">Synchronization failed, please check settings and status!</string>
|
<string name="synchronize_session_not_valid">No connection to MoasdaWiki server available! Please check settings and status!</string>
|
||||||
|
<string name="synchronize_session_not_authorized">Connection to MoasdaWiki server not authorized! Please authorize at server side first!</string>
|
||||||
|
<string name="synchronize_failed">Synchronization failed, please check settings and status!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<exclude domain="root" />
|
||||||
|
<exclude domain="file" />
|
||||||
|
<exclude domain="database" />
|
||||||
|
<exclude domain="sharedpref" />
|
||||||
|
<exclude domain="external" />
|
||||||
|
</cloud-backup>
|
||||||
|
<device-transfer>
|
||||||
|
<exclude domain="root" />
|
||||||
|
<exclude domain="file" />
|
||||||
|
<exclude domain="database" />
|
||||||
|
<exclude domain="sharedpref" />
|
||||||
|
<exclude domain="external" />
|
||||||
|
</device-transfer>
|
||||||
|
</data-extraction-rules>
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.3'
|
classpath 'com.android.tools.build:gradle:8.7.3'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
@@ -15,7 +15,7 @@ buildscript {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
- Volltextsuche beschleunigen, indem im ersten Schritt nur noch in den Seitentiteln gesucht wird.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Fastlane Metadaten für das F-Droid-Repository hinzufügen
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Deutsche Fastlane Metadaten für das F-Droid-Repository hinzufügen
|
||||||
|
- Versionen der verwendeten Bibliotheken aktualisieren
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Volltextsuche beschleunigen durch einen Suchindex
|
||||||
|
- Bugfix: Nicht zur Wiki-Startseite wechseln wenn die App wieder geöffnet wird
|
||||||
|
- Auf moasdawiki-server 2.3.1 aktualisieren
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Bugfix: Zeige Startseite beim App-Start
|
||||||
|
- Bugfix: Bei der Suche ausschließlich den Suchindex-Cache verwenden
|
||||||
|
- Auf moasdawiki-server 2.3.3 aktualisieren
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Auf moasdawiki-server 2.4.2 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
|
- Refaktorierung: Überholtes AsyncTask ersetzen
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
- Beschreibung für F-Droid aktualisieren
|
||||||
|
- Copyright-Jahr aktualisieren
|
||||||
|
- Bugfix: Wiki-Editor deaktivieren
|
||||||
|
- Auf moasdawiki-server 2.4.3 aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Suche beschleunigen
|
||||||
|
- Auf moasdawiki-server 2.4.4 aktualisieren
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
- Suchindex auf ganze Wörter erweitern
|
||||||
|
- Ignorierliste für Suchwörter einführen
|
||||||
|
- Unterstützung für SVG-Grafiken hinzufügen
|
||||||
|
- Auf moasdawiki-server 2.5.1 aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Auch Wörter, die mit dem Suchtext beginnen, finden
|
||||||
|
- Auf moasdawiki-server 2.5.2 aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Documentation aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Lizenz GPL-3.0-only klarer herausstellen
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Entferne doppeltes Drücken der Rückwärtstaste zum Schließen der App
|
||||||
|
- Auf moasdawiki-server 2.6.1 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
- Kleine Layoutverbesserungen
|
||||||
|
- Auf moasdawiki-server 3.1.0 aktualisieren
|
||||||
|
- Unterstützung für Android 12
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Gradle-Version in moasdawiki-server und in der App aktualisieren um ein Build-Problem zu beheben
|
||||||
|
- Auf moasdawiki-server 3.2.1 aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Auf moasdawiki-server 3.4.4 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Auf moasdawiki-server 3.4.5 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Auf moasdawiki-server 3.5.0 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- App-Symbol im fastlane-Ordner hinzufügen
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Auf moasdawiki-server 3.5.1 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Auf moasdawiki-server 3.6.0 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
|
- Copyright-Jahr aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Auf moasdawiki-server 3.6.1 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Auf moasdawiki-server 3.6.2 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Gradle-Problem beheben
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- Anzahl Kalendereinträge auf 100 begrenzen, weil Android ein globales Limit von 500 Events hat
|
||||||
|
- Synchronisationsverbindungen zum Server im Fehlerfall wiederholen
|
||||||
|
- Auf moasdawiki-server 3.6.3 aktualisieren
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
|
- Unterstützung von Android API 34 (Android 14)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Gradle-Problem bei fdroid beheben
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Auf moasdawiki-server 3.7.1 aktualisieren
|
||||||
|
- Gradle-Upgrade auf 8.5
|
||||||
|
- Copyright-Jahr aktualisieren
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Upgrade to Gradle 8.7
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Auf moasdawiki-server 3.9.1 aktualisieren
|
||||||
|
- Gradle-Upgrade auf 8.10.2
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Anleitung für App-Synchronisierung ergänzen
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
- Auf moasdawiki-server 3.9.3 aktualisieren
|
||||||
|
- Gradle-Upgrade auf 8.12
|
||||||
|
- Bibliotheks-Abhängigkeiten aktualisieren
|
||||||
|
- Copyright-Jahr aktualisieren
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
MoasdaWiki App ist eine datenschutzfreundliche Oberfläche der MoasdaWiki-Server-Wissensverwaltung. Sie ist eine Kopie deiner Wikiinhalte auf deinem Mobilgerät.
|
||||||
|
|
||||||
|
<b>Funktionen:</b>
|
||||||
|
|
||||||
|
- Synchronisiert die Inhalte von deiner MoasdaWiki-Server-Instanz.
|
||||||
|
- Schnelle Volltextsuche
|
||||||
|
- Kalender-Integration: Zeigt Geburtstage und Termine im Kalender des Mobilgeräts.
|
||||||
|
- Datenschutz: Verbindet sich direkt mit dem Server in deinem privaten Netzwerk. Keine Tracker. Keine Cloud-Verbindung.
|
||||||
|
|
||||||
|
<b>Synchronisieren des Inhalts mit einem MoasdaWiki-Server:</b>
|
||||||
|
|
||||||
|
1. Lade MoasdaWiki-Server von https://moasdawiki.net/ herunter.
|
||||||
|
2. Setze eine MoasdaWiki-Server-Instance in deinem LAN auf.
|
||||||
|
3. Erlaube LAN-Zugriff auf den Server: Editiere die Datei config.txt im Repository und ändere die Einstellung authentication.onlylocalhost = false. Anschließend den Server neu starten.
|
||||||
|
4. Installiere die MoasdaWiki-App.
|
||||||
|
5. In der App kannst du einen Hinweis sehen, dass sie zunächst konfiguriert werden muss. Drücke auf den Hinweis.
|
||||||
|
6. Drücke auf "Hostname" und gib den Hostnamen oder IP-Adresse der Server-Instanz ein, z.B. 192.168.1.101. Drücke OK.
|
||||||
|
7. Im Statusbereich darunter solltest du nun "Erfordert Berechtigung am Server" sehen. Andernfalls prüfe erneut Hostname und Port.
|
||||||
|
8. Öffne auf der Serverseite die Wikiseite im Browser, klicke auf "Hilfe" und "Synchronisierung".
|
||||||
|
9. Du siehst eine Liste von Geräte und Synchronisierungs-Sitzungen. Überprüfe den Gerätenamen und klicke auf "Erlauben".
|
||||||
|
10. Zurück in der App drücke den Zurück-Button in der Ecke links oben, um zum Hauptdialog zurückzukommen. Nun kannst du einen Hinweis sehen, dass die App synchronisiert werden muss. Drücke auf diesen Hinweis.
|
||||||
|
11. Nun solltest du alle Inhalte des Servers auch in der App haben und die Wikiseite "Startseite-App" sehen.
|
||||||
|
|
||||||
|
Hinweis: Der Wikiinhalt kann nicht in der App modifiziert werden, da es keinen Spaß macht Wiki-Syntax auf dem Mobilgerät zu tippen. Änderungen müssen über den MoasdaWiki-Server erfolgen.
|
||||||
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 348 KiB |
|
After Width: | Height: | Size: 508 KiB |
|
After Width: | Height: | Size: 356 KiB |
|
After Width: | Height: | Size: 406 KiB |
@@ -0,0 +1 @@
|
|||||||
|
Datenschutzfreundliche Wissensverwaltung
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Speed up full text search by searching only in the page titles in the first step
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Add fastlane metadata for F-Droid repository
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Add German fastlane metadata for F-Droid repository
|
||||||
|
- Update library dependencies
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Speed up full text search by a search index
|
||||||
|
- Bugfix: Don't go back to start page after App restore
|
||||||
|
- Update to moasdawiki-server 2.3.1
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Bugfix: Show start page on app startup
|
||||||
|
- Bugfix: For searches only use the search index cache
|
||||||
|
- Update to moasdawiki-server 2.3.3
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Update to moasdawiki-server 2.4.2
|
||||||
|
- Upgrade library dependencies
|
||||||
|
- Refactoring: Replace deprecated AsyncTask
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
- Update descriptions for F-Droid
|
||||||
|
- Update copyright year
|
||||||
|
- Bugfix: Disable wiki editor handler
|
||||||
|
- Update to moasdawiki-server 2.4.3
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Speed up search
|
||||||
|
- Update to moasdawiki-server 2.4.4
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
- Enhance search index to full words
|
||||||
|
- Introduce search ignore list
|
||||||
|
- Add support for SVG images
|
||||||
|
- Update to moasdawiki-server 2.5.1
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Find also words that start with the search string
|
||||||
|
- Update to moasdawiki-server 2.5.2
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Update documentation
|
||||||
|
- Update library dependencies
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Make GPL-3.0-only licensing more clear
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Remove double back key press to close the app
|
||||||
|
- Update to moasdawiki-server 2.6.1
|
||||||
|
- Upgrade library dependencies
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
- Small layout optimizations
|
||||||
|
- Update to moasdawiki-server 3.1.0
|
||||||
|
- Support for Android 12
|
||||||
|
- Upgrade library dependencies
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Update Gradle version in moasdawiki-server and in app to fix build issue
|
||||||
|
- Update to moasdawiki-server 3.2.1
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Update to moasdawiki-server 3.4.4
|
||||||
|
- Upgrade library dependencies
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Update to moasdawiki-server 3.4.5
|
||||||
|
- Upgrade library dependencies
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Update to moasdawiki-server 3.5.0
|
||||||
|
- Upgrade library dependencies
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Add app icon to fastlane folder
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Update to moasdawiki-server 3.5.1
|
||||||
|
- Upgrade library dependencies
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
- Update to moasdawiki-server 3.6.0
|
||||||
|
- Upgrade library dependencies
|
||||||
|
- Update copyright year
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Update to moasdawiki-server 3.6.1
|
||||||
|
- Upgrade library dependencies
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
- Update to moasdawiki-server 3.6.2
|
||||||
|
- Upgrade library dependencies
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
- Fix Gradle build issue
|
||||||