diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36580db4..fdffde3e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file.
+## [0.3.0 - 2023-09-28]
+
+### Added
+
+- NextcloudApp: The `ex_app.verify_version` function to simply check whether the application has been updated.
+
+### Changed
+
+- NextcloudApp: Updated `info.xml` in examples to reflect upcoming changes in the [AppStore](https://github.com/nextcloud/appstore/pull/1145)
+
## [0.2.2 - 2023-09-26]
### Added
diff --git a/docs/reference/ExApp.rst b/docs/reference/ExApp.rst
index d62e723f..f5d8d9a4 100644
--- a/docs/reference/ExApp.rst
+++ b/docs/reference/ExApp.rst
@@ -1,7 +1,7 @@
.. py:currentmodule:: nc_py_api.ex_app
-External Application
-====================
+AppAPI Application
+==================
Constants
---------
@@ -17,6 +17,8 @@ Special functions
.. autofunction:: persistent_storage
+.. autofunction:: verify_version
+
User Interface(UI)
------------------
@@ -26,7 +28,7 @@ UI methods should be accessed with the help of :class:`~nc_py_api.nextcloud.Next
# this is an example, in most cases you will get `NextcloudApp` class instance as input param.
nc = NextcloudApp()
- nc.ui.files_dropdown_menu.register(...)
+ nc.ex_app.ui.files_dropdown_menu.register(...)
.. autoclass:: nc_py_api.ex_app.ui.ui.UiApi
:members:
diff --git a/docs/reference/Nextcloud.rst b/docs/reference/Nextcloud.rst
index ea41c251..1e4478bd 100644
--- a/docs/reference/Nextcloud.rst
+++ b/docs/reference/Nextcloud.rst
@@ -3,7 +3,7 @@
Nextcloud
=========
-Two base classes for working with NextCloud. The first for working as a client, the second as an application.
+Two base classes for working with Nextcloud. The first for working as a client, the second as an application.
All required functionality is incorporated in them, they contains all other classes required to work with the Nextcloud.
diff --git a/docs/reference/index.rst b/docs/reference/index.rst
index 41de9297..24961d55 100644
--- a/docs/reference/index.rst
+++ b/docs/reference/index.rst
@@ -5,11 +5,11 @@ Reference
:maxdepth: 2
Nextcloud
+ ExApp
Apps
ActivityApp
Files/index.rst
Users/index.rst
- ExApp
Exceptions
Talk
TalkBot
diff --git a/examples/as_app/skeleton/appinfo/info.xml b/examples/as_app/skeleton/appinfo/info.xml
index 9f32b17d..b5aefbab 100644
--- a/examples/as_app/skeleton/appinfo/info.xml
+++ b/examples/as_app/skeleton/appinfo/info.xml
@@ -18,7 +18,7 @@
-
+
ghcr.io
cloud-py-api/skeleton
@@ -31,6 +31,6 @@
http
- 0
-
+ false
+
diff --git a/examples/as_app/skeleton/requirements.txt b/examples/as_app/skeleton/requirements.txt
index 0510959b..3fac8ce1 100644
--- a/examples/as_app/skeleton/requirements.txt
+++ b/examples/as_app/skeleton/requirements.txt
@@ -1 +1 @@
-nc_py_api[app]>=0.2.0
+nc_py_api[app]>=0.3.0
diff --git a/examples/as_app/talk_bot/appinfo/info.xml b/examples/as_app/talk_bot/appinfo/info.xml
index f7f6f659..12e8402d 100644
--- a/examples/as_app/talk_bot/appinfo/info.xml
+++ b/examples/as_app/talk_bot/appinfo/info.xml
@@ -18,7 +18,7 @@
-
+
ghcr.io
cloud-py-api/talk_bot
@@ -33,6 +33,6 @@
http
- 0
-
+ false
+
diff --git a/examples/as_app/talk_bot/requirements.txt b/examples/as_app/talk_bot/requirements.txt
index 0510959b..3fac8ce1 100644
--- a/examples/as_app/talk_bot/requirements.txt
+++ b/examples/as_app/talk_bot/requirements.txt
@@ -1 +1 @@
-nc_py_api[app]>=0.2.0
+nc_py_api[app]>=0.3.0
diff --git a/examples/as_app/talk_bot_ai/appinfo/info.xml b/examples/as_app/talk_bot_ai/appinfo/info.xml
index 3de45cfa..5568cbdd 100644
--- a/examples/as_app/talk_bot_ai/appinfo/info.xml
+++ b/examples/as_app/talk_bot_ai/appinfo/info.xml
@@ -18,7 +18,7 @@
-
+
ghcr.io
cloud-py-api/talk_bot_ai
@@ -33,6 +33,6 @@
http
- 0
-
+ false
+
diff --git a/examples/as_app/talk_bot_ai/requirements.txt b/examples/as_app/talk_bot_ai/requirements.txt
index d7dc06ee..3d9fc12c 100644
--- a/examples/as_app/talk_bot_ai/requirements.txt
+++ b/examples/as_app/talk_bot_ai/requirements.txt
@@ -1,4 +1,4 @@
-nc_py_api[app]>=0.2.1
+nc_py_api[app]>=0.3.0
transformers>=4.33
torch
torchvision
diff --git a/examples/as_app/talk_bot_multi/appinfo/info.xml b/examples/as_app/talk_bot_multi/appinfo/info.xml
index 5f01ad38..0ebad85f 100644
--- a/examples/as_app/talk_bot_multi/appinfo/info.xml
+++ b/examples/as_app/talk_bot_multi/appinfo/info.xml
@@ -18,7 +18,7 @@
-
+
ghcr.io
cloud-py-api/talk_bot_multi
@@ -33,6 +33,6 @@
http
- 0
-
+ false
+
diff --git a/examples/as_app/talk_bot_multi/requirements.txt b/examples/as_app/talk_bot_multi/requirements.txt
index 0510959b..3fac8ce1 100644
--- a/examples/as_app/talk_bot_multi/requirements.txt
+++ b/examples/as_app/talk_bot_multi/requirements.txt
@@ -1 +1 @@
-nc_py_api[app]>=0.2.0
+nc_py_api[app]>=0.3.0
diff --git a/examples/as_app/to_gif/appinfo/info.xml b/examples/as_app/to_gif/appinfo/info.xml
index 0b620c8b..2631c4f9 100644
--- a/examples/as_app/to_gif/appinfo/info.xml
+++ b/examples/as_app/to_gif/appinfo/info.xml
@@ -18,7 +18,7 @@
-
+
ghcr.io
cloud-py-api/to_gif
@@ -33,6 +33,6 @@
http
- 0
-
+ false
+
diff --git a/examples/as_app/to_gif/requirements.txt b/examples/as_app/to_gif/requirements.txt
index 5c0eed8e..a98523bb 100644
--- a/examples/as_app/to_gif/requirements.txt
+++ b/examples/as_app/to_gif/requirements.txt
@@ -1,4 +1,4 @@
-nc_py_api[app]>=0.2.0
+nc_py_api[app]>=0.3.0
pygifsicle
imageio
opencv-python
diff --git a/nc_py_api/_version.py b/nc_py_api/_version.py
index 40d8497e..303b1bc3 100644
--- a/nc_py_api/_version.py
+++ b/nc_py_api/_version.py
@@ -1,3 +1,3 @@
"""Version of nc_py_api."""
-__version__ = "0.2.2"
+__version__ = "0.3.0.dev0"
diff --git a/nc_py_api/ex_app/__init__.py b/nc_py_api/ex_app/__init__.py
index 82551848..cb698766 100644
--- a/nc_py_api/ex_app/__init__.py
+++ b/nc_py_api/ex_app/__init__.py
@@ -1,6 +1,6 @@
"""All possible ExApp stuff for NextcloudApp that can be used."""
from .defs import ApiScope, LogLvl
from .integration_fastapi import nc_app, set_handlers, talk_bot_app
-from .misc import persistent_storage
+from .misc import persistent_storage, verify_version
from .ui.files import UiActionFileInfo, UiFileActionHandlerInfo
from .uvicorn_fastapi import run_app
diff --git a/nc_py_api/ex_app/misc.py b/nc_py_api/ex_app/misc.py
index d06d08f4..f609ccd7 100644
--- a/nc_py_api/ex_app/misc.py
+++ b/nc_py_api/ex_app/misc.py
@@ -1,6 +1,7 @@
"""Different miscellaneous optimization/helper functions for the Nextcloud Applications."""
import os
+import typing
from sys import platform
@@ -23,3 +24,23 @@ def _get_app_cache_dir() -> str:
r = os.path.join(root_cache_path, os.environ["APP_ID"])
os.makedirs(r, exist_ok=True)
return r
+
+
+def verify_version(finalize_update: bool = True) -> typing.Optional[tuple[str, str]]:
+ """Returns tuple with an old version and new version or ``None`` if there was no update taken.
+
+ :param finalize_update: Flag indicating whether update information should be updated.
+ If ``True``, all subsequent calls to this function will return that there is no update.
+ """
+ version_file_path = os.path.join(persistent_storage(), "_version.info")
+ r = None
+ with open(version_file_path, "a+t", encoding="UTF-8") as version_file:
+ version_file.seek(0)
+ old_version = version_file.read()
+ if old_version != os.environ["APP_VERSION"]:
+ r = (old_version, os.environ["APP_VERSION"])
+ if finalize_update:
+ version_file.seek(0)
+ version_file.write(os.environ["APP_VERSION"])
+ version_file.truncate()
+ return r
diff --git a/tests/actual_tests/misc_test.py b/tests/actual_tests/misc_test.py
index b6730c19..b28966b0 100644
--- a/tests/actual_tests/misc_test.py
+++ b/tests/actual_tests/misc_test.py
@@ -3,7 +3,7 @@
import pytest
-from nc_py_api import NextcloudException
+from nc_py_api import NextcloudException, ex_app
from nc_py_api._deffered_error import DeferredError # noqa
from nc_py_api._exceptions import check_error # noqa
from nc_py_api._misc import nc_iso_time_to_datetime, require_capabilities # noqa
@@ -74,3 +74,20 @@ def test_persist_transformers_cache(nc_app):
from nc_py_api.ex_app import persist_transformers_cache # noqa
assert os.environ["TRANSFORMERS_CACHE"]
+ os.environ.pop("TRANSFORMERS_CACHE")
+
+
+def test_verify_version(nc_app):
+ version_file_path = os.path.join(ex_app.persistent_storage(), "_version.info")
+ if os.path.exists(version_file_path):
+ os.remove(version_file_path)
+ r = ex_app.verify_version(False)
+ assert not os.path.getsize(version_file_path)
+ assert isinstance(r, tuple)
+ assert r[0] == ""
+ assert r[1] == os.environ["APP_VERSION"]
+ r = ex_app.verify_version(True)
+ assert os.path.getsize(version_file_path)
+ assert r[0] == ""
+ assert r[1] == os.environ["APP_VERSION"]
+ assert ex_app.verify_version() is None