]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add Android and iOS URLs to theming app 5782/head
authorMorris Jobke <hey@morrisjobke.de>
Wed, 19 Jul 2017 08:20:47 +0000 (10:20 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 19 Jul 2017 08:57:38 +0000 (10:57 +0200)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
apps/theming/lib/ThemingDefaults.php
apps/theming/tests/ThemingDefaultsTest.php

index 7f30a48ff8bc7230eac1a41d23c23c6d008dda58..dff24ee79601d2b11417db25857d6c90acc1c94d 100644 (file)
@@ -55,6 +55,8 @@ class ThemingDefaults extends \OC_Defaults {
        private $iTunesAppId;
        /** @var string */
        private $iOSClientUrl;
+       /** @var string */
+       private $AndroidClientUrl;
 
        /**
         * ThemingDefaults constructor.
@@ -88,6 +90,7 @@ class ThemingDefaults extends \OC_Defaults {
                $this->color = parent::getColorPrimary();
                $this->iTunesAppId = parent::getiTunesAppId();
                $this->iOSClientUrl = parent::getiOSClientUrl();
+               $this->AndroidClientUrl = parent::getAndroidClientUrl();
        }
 
        public function getName() {
@@ -200,6 +203,13 @@ class ThemingDefaults extends \OC_Defaults {
                return $this->config->getAppValue('theming', 'iOSClientUrl', $this->iOSClientUrl);
        }
 
+       /**
+        * @return string
+        */
+       public function getAndroidClientUrl() {
+               return $this->config->getAppValue('theming', 'AndroidClientUrl', $this->AndroidClientUrl);
+       }
+
 
        /**
         * @return array scss variables to overwrite
index 8646eaf865f8083b50845762c656e4df124042be..057229483e97907a191d8c21babc53f0b55004d1 100644 (file)
@@ -543,4 +543,65 @@ class ThemingDefaultsTest extends TestCase {
                ];
                $this->assertEquals($expected, $this->template->getScssVariables());
        }
+
+       public function testGetDefaultAndroidURL() {
+               $this->config
+                       ->expects($this->once())
+                       ->method('getAppValue')
+                       ->with('theming', 'AndroidClientUrl', 'https://play.google.com/store/apps/details?id=com.nextcloud.client')
+                       ->willReturn('https://play.google.com/store/apps/details?id=com.nextcloud.client');
+
+               $this->assertEquals('https://play.google.com/store/apps/details?id=com.nextcloud.client', $this->template->getAndroidClientUrl());
+       }
+
+       public function testGetCustomAndroidURL() {
+               $this->config
+                       ->expects($this->once())
+                       ->method('getAppValue')
+                       ->with('theming', 'AndroidClientUrl', 'https://play.google.com/store/apps/details?id=com.nextcloud.client')
+                       ->willReturn('https://play.google.com/store/apps/details?id=com.mycloud.client');
+
+               $this->assertEquals('https://play.google.com/store/apps/details?id=com.mycloud.client', $this->template->getAndroidClientUrl());
+       }
+
+       public function testGetDefaultiOSURL() {
+               $this->config
+                       ->expects($this->once())
+                       ->method('getAppValue')
+                       ->with('theming', 'iOSClientUrl', 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8')
+                       ->willReturn('https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8');
+
+               $this->assertEquals('https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8', $this->template->getiOSClientUrl());
+       }
+
+       public function testGetCustomiOSURL() {
+               $this->config
+                       ->expects($this->once())
+                       ->method('getAppValue')
+                       ->with('theming', 'iOSClientUrl', 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8')
+                       ->willReturn('https://itunes.apple.com/us/app/nextcloud/id1234567890?mt=8');
+
+               $this->assertEquals('https://itunes.apple.com/us/app/nextcloud/id1234567890?mt=8', $this->template->getiOSClientUrl());
+       }
+
+       public function testGetDefaultiTunesAppId() {
+               $this->config
+                       ->expects($this->once())
+                       ->method('getAppValue')
+                       ->with('theming', 'iTunesAppId', '1125420102')
+                       ->willReturn('1125420102');
+
+               $this->assertEquals('1125420102', $this->template->getiTunesAppId());
+       }
+
+       public function testGetCustomiTunesAppId() {
+               $this->config
+                       ->expects($this->once())
+                       ->method('getAppValue')
+                       ->with('theming', 'iTunesAppId', '1125420102')
+                       ->willReturn('1234567890');
+
+               $this->assertEquals('1234567890', $this->template->getiTunesAppId());
+       }
+
 }