Skip to content

Commit 57396d2

Browse files
committed
add initialstate provider
Signed-off-by: Simon L <szaimen@e.mail.de>
1 parent 03256ad commit 57396d2

3 files changed

Lines changed: 46 additions & 4 deletions

File tree

lib/Listener/BeforeTemplateRenderedListener.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030
use OCA\FirstRunWizard\Notification\AppHint;
3131
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
3232
use OCP\BackgroundJob\IJobList;
33+
use OCP\Defaults;
3334
use OCP\EventDispatcher\Event;
3435
use OCP\EventDispatcher\IEventListener;
3536
use OCP\IConfig;
37+
use OCP\AppFramework\Services\IInitialState;
3638
use OCP\IUser;
3739
use OCP\IUserSession;
3840
use OCP\Util;
@@ -55,16 +57,26 @@ class BeforeTemplateRenderedListener implements IEventListener {
5557
*/
5658
private $jobList;
5759

60+
/** @var IInitialState */
61+
protected $initialState;
62+
63+
/** @var Defaults */
64+
protected $theming;
65+
5866
public function __construct(
5967
IConfig $config,
6068
IUserSession $userSession,
6169
IJobList $jobList,
62-
AppHint $appHint
70+
AppHint $appHint,
71+
IInitialState $initialState,
72+
Defaults $theming,
6373
) {
6474
$this->userSession = $userSession;
6575
$this->config = $config;
6676
$this->appHint = $appHint;
6777
$this->jobList = $jobList;
78+
$this->initialState = $initialState;
79+
$this->theming = $theming;
6880
}
6981

7082
public function handle(Event $event): void {
@@ -88,5 +100,20 @@ public function handle(Event $event): void {
88100
}
89101

90102
Util::addScript(Application::APP_ID, 'about');
103+
104+
$this->initialState->provideInitialState(
105+
'desktop',
106+
$this->config->getSystemValue('customclient_desktop', $this->theming->getSyncClientUrl())
107+
);
108+
109+
$this->initialState->provideInitialState(
110+
'android',
111+
$this->config->getSystemValue('customclient_android', $this->theming->getAndroidClientUrl())
112+
);
113+
114+
$this->initialState->provideInitialState(
115+
'ios',
116+
$this->config->getSystemValue('customclient_ios', $this->theming->getiOSClientUrl())
117+
);
91118
}
92119
}

src/components/AppStoreBadge.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,21 @@
3232

3333
<script>
3434
import { imagePath } from '@nextcloud/router'
35+
import { loadState } from '@nextcloud/initial-state'
36+
37+
const android = loadState('firstrunwizard', 'android')
38+
const ios = loadState('firstrunwizard', 'ios')
3539
3640
export default {
3741
name: 'AppStoreBadge',
3842
43+
data() {
44+
return {
45+
android,
46+
ios,
47+
}
48+
},
49+
3950
props: {
4051
type: {
4152
type: String,
@@ -60,9 +71,9 @@ export default {
6071
6172
href() {
6273
if (this.type === 'ios') {
63-
return 'https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8'
74+
return this.ios
6475
} else if (this.type === 'android') {
65-
return 'https://play.google.com/store/apps/details?id=com.nextcloud.client'
76+
return this.android
6677
}
6778
return undefined
6879
},

src/components/Page2.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<div class="page__content">
3434
<AppStoreBadge type="android" />
3535
<AppStoreBadge type="ios" />
36-
<Card href="https://nextcloud.com/install/#install-clients"
36+
<Card :href="desktop"
3737
:title="t('firstrunwizard', 'Desktop app ↗')"
3838
:subtitle="t('firstrunwizard', 'Download For Windows, Mac OS and Linux.')" />
3939
<Card :href="syncClientsUrl"
@@ -58,6 +58,9 @@ import AppStoreBadge from './AppStoreBadge.vue'
5858
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
5959
import { NcButton } from '@nextcloud/vue'
6060
import { generateUrl } from '@nextcloud/router'
61+
import { loadState } from '@nextcloud/initial-state'
62+
63+
const desktop = loadState('firstrunwizard', 'desktop')
6164
6265
export default {
6366
name: 'Page2',
@@ -73,6 +76,7 @@ export default {
7376
return {
7477
subtitleText: t('firstrunwizard', 'Sync your files across your devices with the desktop and mobile apps, and connect your calendar and contacts.'),
7578
syncClientsUrl: generateUrl('settings/user/sync-clients'),
79+
desktop,
7680
}
7781
},
7882

0 commit comments

Comments
 (0)