mirror of
https://github.com/nextcloud/ocsms.git
synced 2026-08-11 16:32:55 +00:00
Add ConfigMapper, similar to chat app. Also implement setCountry call, need to use and handle it on the interface now
This commit is contained in:
+24
-17
@@ -20,6 +20,8 @@ use \OCA\OcSms\Controller\SmsController;
|
||||
use \OCA\OcSms\Db\Sms;
|
||||
use \OCA\OcSms\Db\SmsMapper;
|
||||
|
||||
use \OCA\OcSms\Db\ConfigMapper;
|
||||
|
||||
use \OCA\OcSms\Lib\PhoneNumberFormatter;
|
||||
|
||||
class OcSmsApp extends App {
|
||||
@@ -27,9 +29,6 @@ class OcSmsApp extends App {
|
||||
/**
|
||||
* @var array used to cache the parsed contacts for every request
|
||||
*/
|
||||
/*
|
||||
caching dosn´t work because on every call all will be reinstantiated
|
||||
*/
|
||||
private static $contacts;
|
||||
private static $contactPhotos;
|
||||
|
||||
@@ -44,23 +43,17 @@ class OcSmsApp extends App {
|
||||
$this->c = $container;
|
||||
$app = $this;
|
||||
|
||||
/**
|
||||
* Controllers
|
||||
*/
|
||||
|
||||
$container->registerService('SmsController', function($c) use($app) {
|
||||
return new SmsController(
|
||||
$c->query('AppName'),
|
||||
$c->query('Request'),
|
||||
$c->query('UserId'),
|
||||
$c->query('SmsMapper'),
|
||||
$app
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Database Layer
|
||||
*/
|
||||
$container->registerService('ConfigMapper', function ($c) use ($app) {
|
||||
return new ConfigMapper(
|
||||
$c->query('ServerContainer')->getDb(),
|
||||
$app->getUserId(),
|
||||
$c->query('ServerContainer')->getCrypto()
|
||||
);
|
||||
});
|
||||
|
||||
$container->registerService('Sms', function($c) {
|
||||
return new Sms($c->query('ServerContainer')->getDb());
|
||||
});
|
||||
@@ -76,6 +69,20 @@ class OcSmsApp extends App {
|
||||
return \OCP\User::getUser();
|
||||
});
|
||||
|
||||
/**
|
||||
* Controllers
|
||||
*/
|
||||
$container->registerService('SmsController', function($c) use($app) {
|
||||
return new SmsController(
|
||||
$c->query('AppName'),
|
||||
$c->query('Request'),
|
||||
$c->query('UserId'),
|
||||
$c->query('SmsMapper'),
|
||||
$c->query('ConfigMapper'),
|
||||
$app
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Managers
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user