Remove deprecated App::is_mobile/is_tablet - replace with DI::mode()->isMobile()/isTablet()

This commit is contained in:
Philipp Holzer 2019-12-16 01:12:07 +01:00
parent c7230932d6
commit 26af2feee2
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
8 changed files with 10 additions and 16 deletions

View file

@ -15,6 +15,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\User; use Friendica\Model\User;
@ -136,7 +137,7 @@ function community_content(App $a, $update = 0)
} }
// check if we serve a mobile device and get the user settings accordingly // check if we serve a mobile device and get the user settings accordingly
if ($a->is_mobile) { if (DI::mode()->isMobile()) {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 20); $itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 20);
} else { } else {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network', 40); $itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network', 40);

View file

@ -228,7 +228,7 @@ function networkPager(App $a, Pager $pager, $update)
// check if we serve a mobile device and get the user settings // check if we serve a mobile device and get the user settings
// accordingly // accordingly
if ($a->is_mobile) { if (DI::mode()->isMobile()) {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network'); $itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20); $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
} else { } else {

View file

@ -66,10 +66,6 @@ class App
public $timezone; public $timezone;
public $interactive = true; public $interactive = true;
public $identities; public $identities;
/** @deprecated 2019.09 - Use App\Mode->isMobile() instead */
public $is_mobile;
/** @deprecated 2019.09 - Use App\Mode->isTable() instead */
public $is_tablet;
public $theme_info = []; public $theme_info = [];
public $category; public $category;
// Allow themes to control internal parameters // Allow themes to control internal parameters
@ -183,9 +179,6 @@ class App
$this->module = $module->getName(); $this->module = $module->getName();
$this->page = $page; $this->page = $page;
$this->is_mobile = $mode->isMobile();
$this->is_tablet = $mode->isTablet();
$this->load(); $this->load();
} }

View file

@ -571,7 +571,7 @@ class Profile
$a = \get_app(); $a = \get_app();
$o = ''; $o = '';
if (!local_user() || $a->is_mobile || $a->is_tablet) { if (!local_user() || DI::mode()->isMobile() || DI::mode()->isMobile()) {
return $o; return $o;
} }
@ -668,7 +668,7 @@ class Profile
$a = \get_app(); $a = \get_app();
$o = ''; $o = '';
if (!local_user() || $a->is_mobile || $a->is_tablet) { if (!local_user() || DI::mode()->isMobile() || DI::mode()->isMobile()) {
return $o; return $o;
} }

View file

@ -290,7 +290,7 @@ class Profile extends BaseModule
// check if we serve a mobile device and get the user settings // check if we serve a mobile device and get the user settings
// accordingly // accordingly
if ($a->is_mobile) { if (DI::mode()->isMobile()) {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 10); $itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 10);
} else { } else {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network', 20); $itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network', 20);

View file

@ -22,7 +22,7 @@ if (!isset($minimal)) {
$basepath = DI::baseUrl()->getUrlPath() ? "/" . DI::baseUrl()->getUrlPath() . "/" : "/"; $basepath = DI::baseUrl()->getUrlPath() ? "/" . DI::baseUrl()->getUrlPath() . "/" : "/";
$frio = "view/theme/frio"; $frio = "view/theme/frio";
$view_mode_class = ($a->is_mobile || $a->is_tablet) ? 'mobile-view' : 'desktop-view'; $view_mode_class = (DI::mode()->isMobile() || DI::mode()->isMobile()) ? 'mobile-view' : 'desktop-view';
$is_singleuser = Config::get('system', 'singleuser'); $is_singleuser = Config::get('system', 'singleuser');
$is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser"; $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
?> ?>

View file

@ -35,7 +35,7 @@ function frio_init(App $a)
// if the device is a mobile device set js is_mobile // if the device is a mobile device set js is_mobile
// variable so the js scripts can use this information // variable so the js scripts can use this information
if ($a->is_mobile || $a->is_tablet) { if (DI::mode()->isMobile() || DI::mode()->isMobile()) {
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<script type="text/javascript"> <script type="text/javascript">
var is_mobile = 1; var is_mobile = 1;

View file

@ -36,7 +36,7 @@ function vier_init(App $a)
$a->page['htmlhead'] .= "<link rel='stylesheet' type='text/css' href='view/theme/vier/wide.css' media='screen and (min-width: 1300px)'/>\n"; $a->page['htmlhead'] .= "<link rel='stylesheet' type='text/css' href='view/theme/vier/wide.css' media='screen and (min-width: 1300px)'/>\n";
} }
if ($a->is_mobile || $a->is_tablet) { if (DI::mode()->isMobile() || DI::mode()->isMobile()) {
$a->page['htmlhead'] .= '<meta name=viewport content="width=device-width, initial-scale=1">'."\n"; $a->page['htmlhead'] .= '<meta name=viewport content="width=device-width, initial-scale=1">'."\n";
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen"/>'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen"/>'."\n";
} }
@ -64,7 +64,7 @@ function cmtBbClose(id) {
</script> </script>
EOT; EOT;
if ($a->is_mobile || $a->is_tablet) { if (DI::mode()->isMobile() || DI::mode()->isMobile()) {
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<script> <script>
$(document).ready(function() { $(document).ready(function() {