diff --git a/appinfo/info.xml b/appinfo/info.xml index e8a128d..97caf21 100755 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -14,7 +14,7 @@ multimedia https://git.project-insanity.org/onny/nextcloud-app-radio https://git.project-insanity.org/onny/nextcloud-app-radio/issues - https://onny.project-insanity.org/files/radio-app.png + https://git.project-insanity.org/onny/nextcloud-app-radio/raw/master/screenshot.png diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php new file mode 100644 index 0000000..3fbb3a2 --- /dev/null +++ b/controller/settingscontroller.php @@ -0,0 +1,54 @@ +userId = $userId; + $this->appConfig = $appConfig; + } + + /** + * Save order for current user + * + * @NoAdminRequired + * @return array response + */ + public function getMenuState() { + $menu_state = $this->appConfig->getUserValue('menu_state', $this->userId); + $response = array( + 'status' => 'success', + 'data' => array('message' => 'User order saved successfully.'), + 'menu_state' => $menu_state + ); + return $response; + } + + /** + * Save order for current user + * + * @NoAdminRequired + * @param $menu_state string + * @return array response + */ + public function saveMenuState($menu_state) { + $this->appConfig->setUserValue('menu_state', $this->userId, $menu_state); + $response = array( + 'status' => 'success', + 'data' => array('message' => 'User order saved successfully.'), + 'menu_state' => $menu_state + ); + return $response; + } + +} diff --git a/service/configservice.php b/service/configservice.php new file mode 100644 index 0000000..e88d933 --- /dev/null +++ b/service/configservice.php @@ -0,0 +1,25 @@ +config = $config; + $this->appName = $appName; + } + + public function getUserValue($key, $userId) { + return $this->config->getUserValue($userId, $this->appName, $key); + } + + public function setUserValue($key, $userId, $value) { + $this->config->setUserValue($userId, $this->appName, $key, $value); + } + +}