From 377143457fad54b7f4883f40867afb21012674b6 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 12 Aug 2024 20:04:02 +0530 Subject: [PATCH 1/8] apporder app to core --- lib/Service/AppsService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 4f8c88e..4ff159f 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -82,7 +82,7 @@ class AppsService { public function getAppOrder() { $order_raw = $this->config->getUserValue($this->userId, 'murena_launcher', 'order'); // If order raw empty try to get from 'apporder' app config - $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'apporder', 'order') : $order_raw; + $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'core', 'apporder') : $order_raw; // If order raw is still empty, return empty array if (!$order_raw) { return self::DEFAULT_ORDER; -- GitLab From 3d216129009cf2cd799a4302c9eb8ca52cddcac1 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 12:14:42 +0530 Subject: [PATCH 2/8] set order --- lib/Service/AppsService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 4ff159f..364745d 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -80,9 +80,9 @@ class AppsService { } public function getAppOrder() { - $order_raw = $this->config->getUserValue($this->userId, 'murena_launcher', 'order'); + $order_raw = $this->config->getUserValue($this->userId, 'core', 'apporder'); // If order raw empty try to get from 'apporder' app config - $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'core', 'apporder') : $order_raw; + //$order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'core', 'apporder') : $order_raw; // If order raw is still empty, return empty array if (!$order_raw) { return self::DEFAULT_ORDER; @@ -149,7 +149,7 @@ class AppsService { } public function updateOrder(string $order) { - $this->config->setUserValue($this->userId, $this->appName, 'order', $order); + $this->config->setUserValue($this->userId,'core', 'apporder', $order); } private function isBetaUser() { -- GitLab From 5dc1beb2da9af4421827aae3f20917e3626c5855 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 12:24:05 +0530 Subject: [PATCH 3/8] lint fiz --- lib/Service/AppsService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 364745d..e7c537d 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -82,7 +82,7 @@ class AppsService { public function getAppOrder() { $order_raw = $this->config->getUserValue($this->userId, 'core', 'apporder'); // If order raw empty try to get from 'apporder' app config - //$order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'core', 'apporder') : $order_raw; + // $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'core', 'apporder') : $order_raw; // If order raw is still empty, return empty array if (!$order_raw) { return self::DEFAULT_ORDER; @@ -149,7 +149,7 @@ class AppsService { } public function updateOrder(string $order) { - $this->config->setUserValue($this->userId,'core', 'apporder', $order); + $this->config->setUserValue($this->userId, 'core', 'apporder', $order); } private function isBetaUser() { -- GitLab From d9681f54e426812d984d668bc9431c88af4febad Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 12:35:31 +0530 Subject: [PATCH 4/8] if order is array --- lib/Service/AppsService.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index e7c537d..2e79fbc 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -124,9 +124,11 @@ class AppsService { $entriesByHref[$entry["href"]] = $entry; } // Remove photos, replace in order correctly with memories - $order = str_replace('/apps/photos/', '/apps/memories/', $order); - $order = array_unique($order); - unset($entriesByHref['/apps/photos/']); + if (is_array($order)) { + $order = str_replace('/apps/photos/', '/apps/memories/', $order); + $order = array_unique($order); + unset($entriesByHref['/apps/photos/']); + } /* Sort apps according to order Since "entriesByHref" is indexed by "href", simply reverse the order array and prepend in "entriesByHref" -- GitLab From 60ce7656140f51939b60f349b6b072e54f704e70 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 12:36:55 +0530 Subject: [PATCH 5/8] if order is array --- lib/Service/AppsService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 2e79fbc..0ca15cd 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -128,7 +128,7 @@ class AppsService { $order = str_replace('/apps/photos/', '/apps/memories/', $order); $order = array_unique($order); unset($entriesByHref['/apps/photos/']); - } + } /* Sort apps according to order Since "entriesByHref" is indexed by "href", simply reverse the order array and prepend in "entriesByHref" -- GitLab From a1d3899b90f2a11ee997763550d867754ca01da6 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 12:41:40 +0530 Subject: [PATCH 6/8] typecast to array --- lib/Service/AppsService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 0ca15cd..0e786ef 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -93,6 +93,10 @@ class AppsService { public function getAppEntries() { $entries = array_values($this->navigationManager->getAll()); $order = $this->getAppOrder(); + if ($order instanceof stdClass) { + // Typecast to array + $order = (array) $order; + } $entriesByHref = array(); if ($this->appManager->isEnabledForUser("onlyoffice")) { $office_entries = $this->getOnlyOfficeEntries(); -- GitLab From a937958f526fedf446ad186e16b3ea38b74ae9c5 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 13:16:52 +0530 Subject: [PATCH 7/8] remove changes --- lib/Service/AppsService.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 0e786ef..4ff159f 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -80,9 +80,9 @@ class AppsService { } public function getAppOrder() { - $order_raw = $this->config->getUserValue($this->userId, 'core', 'apporder'); + $order_raw = $this->config->getUserValue($this->userId, 'murena_launcher', 'order'); // If order raw empty try to get from 'apporder' app config - // $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'core', 'apporder') : $order_raw; + $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'core', 'apporder') : $order_raw; // If order raw is still empty, return empty array if (!$order_raw) { return self::DEFAULT_ORDER; @@ -93,10 +93,6 @@ class AppsService { public function getAppEntries() { $entries = array_values($this->navigationManager->getAll()); $order = $this->getAppOrder(); - if ($order instanceof stdClass) { - // Typecast to array - $order = (array) $order; - } $entriesByHref = array(); if ($this->appManager->isEnabledForUser("onlyoffice")) { $office_entries = $this->getOnlyOfficeEntries(); @@ -128,11 +124,9 @@ class AppsService { $entriesByHref[$entry["href"]] = $entry; } // Remove photos, replace in order correctly with memories - if (is_array($order)) { - $order = str_replace('/apps/photos/', '/apps/memories/', $order); - $order = array_unique($order); - unset($entriesByHref['/apps/photos/']); - } + $order = str_replace('/apps/photos/', '/apps/memories/', $order); + $order = array_unique($order); + unset($entriesByHref['/apps/photos/']); /* Sort apps according to order Since "entriesByHref" is indexed by "href", simply reverse the order array and prepend in "entriesByHref" @@ -155,7 +149,7 @@ class AppsService { } public function updateOrder(string $order) { - $this->config->setUserValue($this->userId, 'core', 'apporder', $order); + $this->config->setUserValue($this->userId, $this->appName, 'order', $order); } private function isBetaUser() { -- GitLab From 20328ee92fbcd6f08e070092b9dfafb76fcb0fee Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 19:08:40 +0530 Subject: [PATCH 8/8] change config --- lib/Service/AppsService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 4ff159f..e7c537d 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -80,9 +80,9 @@ class AppsService { } public function getAppOrder() { - $order_raw = $this->config->getUserValue($this->userId, 'murena_launcher', 'order'); + $order_raw = $this->config->getUserValue($this->userId, 'core', 'apporder'); // If order raw empty try to get from 'apporder' app config - $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'core', 'apporder') : $order_raw; + // $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'core', 'apporder') : $order_raw; // If order raw is still empty, return empty array if (!$order_raw) { return self::DEFAULT_ORDER; @@ -149,7 +149,7 @@ class AppsService { } public function updateOrder(string $order) { - $this->config->setUserValue($this->userId, $this->appName, 'order', $order); + $this->config->setUserValue($this->userId, 'core', 'apporder', $order); } private function isBetaUser() { -- GitLab