Skip to content

Commit 6b68f3b

Browse files
committed
Make federadedfilesharing button match the theming values
1 parent cb65188 commit 6b68f3b

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

apps/federatedfilesharing/settings-personal.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,28 @@
4141

4242
$cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
4343
$url = 'https://nextcloud.com/federation#' . $cloudID;
44-
$ownCloudLogoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
45-
$theme = \OC::$server->getThemingDefaults();
44+
$logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
45+
$theme = \OC::$server->query("ThemingDefaults");
46+
$color = $theme->getMailHeaderColor();
47+
$textColor = "#ffffff";
48+
if($theme instanceof \OCA\Theming\ThemingDefaults) {
49+
$logoPath = $theme->getLogo();
50+
$util = \OC::$server->query("\OCA\Theming\Util");
51+
if($util->invertTextColor($color)) {
52+
$textColor = "#000000";
53+
}
54+
}
55+
4656

4757
$tmpl = new OCP\Template('federatedfilesharing', 'settings-personal');
4858
$tmpl->assign('outgoingServer2serverShareEnabled', $federatedShareProvider->isOutgoingServer2serverShareEnabled());
4959
$tmpl->assign('message_with_URL', $l->t('Share with me through my #Nextcloud Federated Cloud ID, see %s', [$url]));
5060
$tmpl->assign('message_without_URL', $l->t('Share with me through my #Nextcloud Federated Cloud ID', [$cloudID]));
51-
$tmpl->assign('owncloud_logo_path', $ownCloudLogoPath);
61+
$tmpl->assign('logoPath', $logoPath);
5262
$tmpl->assign('reference', $url);
5363
$tmpl->assign('cloudId', $cloudID);
5464
$tmpl->assign('showShareIT', !$isIE8);
55-
$tmpl->assign('color', $theme->getMailHeaderColor());
65+
$tmpl->assign('color', $color);
66+
$tmpl->assign('textColor', $textColor);
5667

5768
return $tmpl->fetchPage();

apps/federatedfilesharing/templates/settings-personal.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ class='js-gs-share social-gnu'>
5555
<div class="hidden" id="oca-files-sharing-add-to-your-website-expanded">
5656
<p style="margin: 10px 0">
5757
<a target="_blank" rel="noreferrer" href="<?php p($_['reference']); ?>"
58-
style="padding:10px;background-color:<?php p($_['color']); ?>;color:#fff;border-radius:3px;padding-left:4px;">
59-
<img src="<?php p($_['owncloud_logo_path']); ?>"
60-
style="width:50px;position:relative;top:8px;">
58+
style="padding:10px;background-color:<?php p($_['color']); ?>;color:<?php p($_['textColor']); ?>;border-radius:3px;padding-left:4px;">
59+
<span style="background-image:url(<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['logoPath'])); ?>);width:50px;height:30px;position:relative;top:8px;background-size:contain;display:inline-block;background-repeat:no-repeat; background-position: center center;"></span>
6160
<?php p($l->t('Share with me via Nextcloud')); ?>
6261
</a>
6362
</p>
@@ -66,7 +65,7 @@ class='js-gs-share social-gnu'>
6665
<?php p($l->t('HTML Code:')); ?>
6766
<xmp><a target="_blank" rel="noreferrer" href="<?php p($_['reference']); ?>"
6867
style="padding:10px;background-color:#0082c9;color:#fff;border-radius:3px;padding-left:4px;">
69-
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['owncloud_logo_path'])); ?>"
68+
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['logoPath'])); ?>"
7069
style="width:50px;position:relative;top:8px;">
7170
<?php p($l->t('Share with me via Nextcloud')); ?>
7271

0 commit comments

Comments
 (0)