diff --git a/apps/files_sharing/js/dist/files_sharing_tab.js b/apps/files_sharing/js/dist/files_sharing_tab.js
index f52a1a7ac18bc285d706e5e0879c53273edd1eb5..747bf9d6897e28e4bb87ee961b1b5c222fa87708 100644
Binary files a/apps/files_sharing/js/dist/files_sharing_tab.js and b/apps/files_sharing/js/dist/files_sharing_tab.js differ
diff --git a/apps/files_sharing/js/dist/files_sharing_tab.js.map b/apps/files_sharing/js/dist/files_sharing_tab.js.map
index 861ada09115abedb480596a420f236cce607a655..6a1f28b98445ebff8c7695cc71b73d8062c7afb2 100644
Binary files a/apps/files_sharing/js/dist/files_sharing_tab.js.map and b/apps/files_sharing/js/dist/files_sharing_tab.js.map differ
diff --git a/apps/files_sharing/src/services/ConfigService.js b/apps/files_sharing/src/services/ConfigService.js
index 2c50ea1ecfb7ec57edb43b771be7455d1250f5c6..1fcf28109568b0a11353e1ce46fdd634d32f6dc5 100644
--- a/apps/files_sharing/src/services/ConfigService.js
+++ b/apps/files_sharing/src/services/ConfigService.js
@@ -178,7 +178,7 @@ export default class Config {
 	 * @memberof Config
 	 */
 	get isMailShareAllowed() {
-		return OC.appConfig.shareByMailEnabled !== undefined
+		return OC.getCapabilities()['files_sharing']['sharebymail'] !== undefined
 			&& OC.getCapabilities()['files_sharing']['public']['enabled'] === true
 	}
 
@@ -223,7 +223,7 @@ export default class Config {
 	 * @memberof Config
 	 */
 	get isPasswordForMailSharesRequired() {
-		return (OC.appConfig.shareByMail === undefined) ? false : OC.appConfig.shareByMail.enforcePasswordProtection === true
+		return (OC.getCapabilities()['files_sharing']['sharebymail'] === undefined) ? false : OC.getCapabilities()['files_sharing']['sharebymail']['password']['enforced']
 	}
 
 	/**
diff --git a/apps/sharebymail/appinfo/app.php b/apps/sharebymail/appinfo/app.php
deleted file mode 100644
index b57957e7daca4d0a6492ae513ff0db9c6d00b9a1..0000000000000000000000000000000000000000
--- a/apps/sharebymail/appinfo/app.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-use OCA\ShareByMail\AppInfo\Application;
-
-$app = \OC::$server->query(Application::class);
diff --git a/apps/sharebymail/composer/composer/autoload_classmap.php b/apps/sharebymail/composer/composer/autoload_classmap.php
index 0df9428d7b0ca332776a221b037477e824e9e9b8..4fa3560d87fc01bd37d0e3c4cd8d15bfdbb86121 100644
--- a/apps/sharebymail/composer/composer/autoload_classmap.php
+++ b/apps/sharebymail/composer/composer/autoload_classmap.php
@@ -9,7 +9,6 @@ return array(
     'OCA\\ShareByMail\\Activity' => $baseDir . '/../lib/Activity.php',
     'OCA\\ShareByMail\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
     'OCA\\ShareByMail\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
-    'OCA\\ShareByMail\\Settings' => $baseDir . '/../lib/Settings.php',
     'OCA\\ShareByMail\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php',
     'OCA\\ShareByMail\\Settings\\SettingsManager' => $baseDir . '/../lib/Settings/SettingsManager.php',
     'OCA\\ShareByMail\\ShareByMailProvider' => $baseDir . '/../lib/ShareByMailProvider.php',
diff --git a/apps/sharebymail/composer/composer/autoload_static.php b/apps/sharebymail/composer/composer/autoload_static.php
index 273da60be644be710dc4b51accc509d88ca19efe..22897e05f560e981aeae54b1de649ed73f1e3954 100644
--- a/apps/sharebymail/composer/composer/autoload_static.php
+++ b/apps/sharebymail/composer/composer/autoload_static.php
@@ -24,7 +24,6 @@ class ComposerStaticInitShareByMail
         'OCA\\ShareByMail\\Activity' => __DIR__ . '/..' . '/../lib/Activity.php',
         'OCA\\ShareByMail\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
         'OCA\\ShareByMail\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
-        'OCA\\ShareByMail\\Settings' => __DIR__ . '/..' . '/../lib/Settings.php',
         'OCA\\ShareByMail\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php',
         'OCA\\ShareByMail\\Settings\\SettingsManager' => __DIR__ . '/..' . '/../lib/Settings/SettingsManager.php',
         'OCA\\ShareByMail\\ShareByMailProvider' => __DIR__ . '/..' . '/../lib/ShareByMailProvider.php',
diff --git a/apps/sharebymail/lib/AppInfo/Application.php b/apps/sharebymail/lib/AppInfo/Application.php
index 7acb43cfbed2b9c346a88e47ed2681231f5b7827..572e754d934f50cce86b68afbd1d35f1a8f230f8 100644
--- a/apps/sharebymail/lib/AppInfo/Application.php
+++ b/apps/sharebymail/lib/AppInfo/Application.php
@@ -1,4 +1,6 @@
 <?php
+
+declare(strict_types=1);
 /**
  * @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
  *
@@ -27,23 +29,22 @@
 namespace OCA\ShareByMail\AppInfo;
 
 use OCA\ShareByMail\Capabilities;
-use OCA\ShareByMail\Settings;
 use OCP\AppFramework\App;
-use OCP\Util;
+use OCP\AppFramework\Bootstrap\IBootContext;
+use OCP\AppFramework\Bootstrap\IBootstrap;
+use OCP\AppFramework\Bootstrap\IRegistrationContext;
 
-class Application extends App {
-	public function __construct(array $urlParams = []) {
-		parent::__construct('sharebymail', $urlParams);
+class Application extends App implements IBootstrap {
+	public const APP_ID = 'sharebymail';
 
-		$settingsManager = \OC::$server->query(Settings\SettingsManager::class);
-		$settings = new Settings($settingsManager);
+	public function __construct() {
+		parent::__construct(self::APP_ID);
+	}
 
-		/** register capabilities */
-		$container = $this->getContainer();
-		$container->registerCapability(Capabilities::class);
+	public function register(IRegistrationContext $context): void {
+		$context->registerCapability(Capabilities::class);
+	}
 
-		/** register hooks */
-		Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareProvider');
-		Util::connectHook('\OCP\Config', 'js', $settings, 'announceShareByMailSettings');
+	public function boot(IBootContext $context): void {
 	}
 }
diff --git a/apps/sharebymail/lib/Capabilities.php b/apps/sharebymail/lib/Capabilities.php
index e703b9b1e5f691b90c528dc6f97aa8a23b2f650f..bc2d2baf81794cd90162b20f7413bd509d7876d8 100644
--- a/apps/sharebymail/lib/Capabilities.php
+++ b/apps/sharebymail/lib/Capabilities.php
@@ -1,4 +1,6 @@
 <?php
+
+declare(strict_types=1);
 /**
  * @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
  *
@@ -23,26 +25,35 @@
 
 namespace OCA\ShareByMail;
 
+use OCA\ShareByMail\Settings\SettingsManager;
 use OCP\Capabilities\ICapability;
 
 class Capabilities implements ICapability {
 
-	/**
-	 * Function an app uses to return the capabilities
-	 *
-	 * @return array Array containing the apps capabilities
-	 * @since 8.2.0
-	 */
-	public function getCapabilities() {
+	/** @var SettingsManager */
+	private $manager;
+
+	public function __construct(SettingsManager $manager) {
+		$this->manager = $manager;
+	}
+
+	public function getCapabilities(): array {
 		return [
 			'files_sharing' =>
 				[
 					'sharebymail' =>
 						[
 							'enabled' => true,
-							'upload_files_drop' => ['enabled' => true],
-							'password' => ['enabled' => true],
-							'expire_date' => ['enabled' => true]
+							'upload_files_drop' => [
+								'enabled' => true,
+							],
+							'password' => [
+								'enabled' => true,
+								'enforced' => $this->manager->enforcePasswordProtection(),
+							],
+							'expire_date' => [
+								'enabled' => true,
+							],
 						]
 				]
 		];
diff --git a/apps/sharebymail/lib/Settings.php b/apps/sharebymail/lib/Settings.php
deleted file mode 100644
index 721050c83c40f199fcafb0f64505bbb3c4e04489..0000000000000000000000000000000000000000
--- a/apps/sharebymail/lib/Settings.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OCA\ShareByMail;
-
-use OCA\ShareByMail\Settings\SettingsManager;
-
-class Settings {
-
-	/** @var SettingsManager */
-	private $settingsManager;
-
-	public function __construct(SettingsManager $settingsManager) {
-		$this->settingsManager = $settingsManager;
-	}
-
-	/**
-	 * announce that the share-by-mail share provider is enabled
-	 *
-	 * @param array $settings
-	 */
-	public function announceShareProvider(array $settings) {
-		$array = json_decode($settings['array']['oc_appconfig'], true);
-		$array['shareByMailEnabled'] = true;
-		$settings['array']['oc_appconfig'] = json_encode($array);
-	}
-
-	public function announceShareByMailSettings(array $settings) {
-		$array = json_decode($settings['array']['oc_appconfig'], true);
-		$array['shareByMail']['enforcePasswordProtection'] = $this->settingsManager->enforcePasswordProtection();
-		$settings['array']['oc_appconfig'] = json_encode($array);
-	}
-}
diff --git a/apps/sharebymail/lib/Settings/SettingsManager.php b/apps/sharebymail/lib/Settings/SettingsManager.php
index cded3e1713d71665e371a52ae610326c2608c358..00826b9b6f5babd4b94f849982f91e1c75c692dc 100644
--- a/apps/sharebymail/lib/Settings/SettingsManager.php
+++ b/apps/sharebymail/lib/Settings/SettingsManager.php
@@ -1,4 +1,6 @@
 <?php
+
+declare(strict_types=1);
 /**
  * @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
  *
@@ -43,7 +45,7 @@ class SettingsManager {
 	 *
 	 * @return bool
 	 */
-	public function sendPasswordByMail() {
+	public function sendPasswordByMail(): bool {
 		$sendPasswordByMail = $this->config->getAppValue('sharebymail', 'sendpasswordmail', $this->sendPasswordByMailDefault);
 		return $sendPasswordByMail === 'yes';
 	}
@@ -53,7 +55,7 @@ class SettingsManager {
 	 *
 	 * @return bool
 	 */
-	public function enforcePasswordProtection() {
+	public function enforcePasswordProtection(): bool {
 		$enforcePassword = $this->config->getAppValue('sharebymail', 'enforcePasswordProtection', $this->enforcePasswordProtectionDefault);
 		return $enforcePassword === 'yes';
 	}