Skip to content

Commit

Permalink
add initialstate provider
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed Nov 15, 2023
1 parent 03256ad commit c3d9dac
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 24 additions & 1 deletion lib/Controller/WizardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use OCA\FirstRunWizard\AppInfo\Application;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\AppFramework\Http\JSONResponse;
use OCP\Defaults;
use OCP\IConfig;
Expand All @@ -47,20 +48,24 @@ class WizardController extends Controller {
/** @var array|false|string[] */
protected $slides = [];

/** @var IInitialState */
protected $initialState;

/**
* @param string $appName
* @param IRequest $request
* @param IConfig $config
* @param string $userId
* @param Defaults $theming
*/
public function __construct($appName, IRequest $request, IConfig $config, $userId, Defaults $theming, IGroupManager $groupManager) {
public function __construct($appName, IRequest $request, IConfig $config, $userId, Defaults $theming, IGroupManager $groupManager, IInitialState $initialState) {
parent::__construct($appName, $request);

$this->config = $config;
$this->userId = $userId;
$this->theming = $theming;
$this->groupManager = $groupManager;
$this->initialState = $initialState;

$this->slides = explode(',', $this->config->getAppValue(Application::APP_ID, 'slides', 'video,values,apps,clients,final'));
}
Expand All @@ -81,6 +86,24 @@ public function disable() {
public function show() {
$appStore = $this->config->getSystemValue('appstoreenabled', true);

$this->initialState->provideInitialState(
'firstrunwizard',
'desktop',
$this->config->getSystemValue('customclient_desktop', $this->theming->getSyncClientUrl())
);

$this->initialState->provideInitialState(
'firstrunwizard',
'android',
$this->config->getSystemValue('customclient_android', $this->theming->getSyncClientUrl())
);

$this->initialState->provideInitialState(
'firstrunwizard',
'ios',
$this->config->getSystemValue('customclient_ios', $this->theming->getSyncClientUrl())
);

$data = [
'desktop' => $this->config->getSystemValue('customclient_desktop', $this->theming->getSyncClientUrl()),
'android' => $this->config->getSystemValue('customclient_android', $this->theming->getAndroidClientUrl()),
Expand Down
2 changes: 2 additions & 0 deletions src/components/Page2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ import AppStoreBadge from './AppStoreBadge.vue'
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
import { NcButton } from '@nextcloud/vue'
import { generateUrl } from '@nextcloud/router'
import { loadState } from '@nextcloud/initial-state'
const val = loadState('myapp', 'user_preference')

Check failure on line 62 in src/components/Page2.vue

View workflow job for this annotation

GitHub Actions / eslint

'val' is assigned a value but never used

export default {
name: 'Page2',
Expand Down

0 comments on commit c3d9dac

Please sign in to comment.