Skip to content

Commit

Permalink
Merge pull request #25950 from nextcloud/enh/product-name
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl committed Jun 16, 2021
2 parents 51add75 + d9dd31b commit 7917f4c
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 16 deletions.
3 changes: 2 additions & 1 deletion apps/files_sharing/lib/Controller/ShareController.php
Expand Up @@ -511,7 +511,8 @@ public function showShare($path = ''): TemplateResponse {
$download = new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']);
$downloadAll = new SimpleMenuAction('download', $this->l10n->t('Download all files'), 'icon-download', $shareTmpl['downloadURL'], 10, $shareTmpl['fileSize']);
$directLink = new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', $shareTmpl['previewURL']);
$externalShare = new ExternalShareMenuAction($this->l10n->t('Add to your Nextcloud'), 'icon-external', $shareTmpl['owner'], $shareTmpl['shareOwner'], $shareTmpl['filename']);
// TRANSLATORS The placeholder refers to the software product name as in 'Add to your Nextcloud'
$externalShare = new ExternalShareMenuAction($this->l10n->t('Add to your %s', [$this->defaults->getProductName()]), 'icon-external', $shareTmpl['owner'], $shareTmpl['shareOwner'], $shareTmpl['filename']);

$responseComposer = [];

Expand Down
13 changes: 12 additions & 1 deletion apps/files_sharing/tests/Controller/ShareControllerTest.php
Expand Up @@ -106,6 +106,8 @@ class ShareControllerTest extends \Test\TestCase {
private $eventDispatcher;
/** @var IL10N */
private $l10n;
/** @var Defaults|MockObject */
private $defaults;

protected function setUp(): void {
parent::setUp();
Expand All @@ -125,6 +127,7 @@ protected function setUp(): void {
$this->accountManager = $this->createMock(IAccountManager::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->l10n = $this->createMock(IL10N::class);
$this->defaults = $this->createMock(Defaults::class);

$this->shareController = new \OCA\Files_Sharing\Controller\ShareController(
$this->appName,
Expand All @@ -142,7 +145,7 @@ protected function setUp(): void {
$this->accountManager,
$this->eventDispatcher,
$this->l10n,
$this->createMock(Defaults::class)
$this->defaults
);


Expand Down Expand Up @@ -310,6 +313,10 @@ public function testShowShare() {
return vsprintf($text, $parameters);
});

$this->defaults->expects(self::any())
->method('getProductName')
->willReturn('Nextcloud');

$response = $this->shareController->showShare();
$sharedTmplParams = [
'owner' => 'ownerUID',
Expand Down Expand Up @@ -457,6 +464,10 @@ public function testShowShareWithPrivateName() {
return vsprintf($text, $parameters);
}));

$this->defaults->expects(self::any())
->method('getProductName')
->willReturn('Nextcloud');

$response = $this->shareController->showShare();
$sharedTmplParams = [
'owner' => '',
Expand Down
6 changes: 3 additions & 3 deletions apps/settings/js/vue-settings-personal-security.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-personal-security.js.map

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions apps/settings/src/components/AuthToken.vue
Expand Up @@ -91,6 +91,7 @@ import {
ActionCheckbox,
} from '@nextcloud/vue'
// When using capture groups the following parts are extracted the first is used as the version number, the second as the OS
const userAgentMap = {
ie: /(?:MSIE|Trident|Trident\/7.0; rv)[ :](\d+)/,
// Microsoft Edge User Agent from https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx
Expand All @@ -105,7 +106,7 @@ const userAgentMap = {
androidChrome: /Android.*(?:; (.*) Build\/).*Chrome\/(\d+)[0-9.]+/,
iphone: / *CPU +iPhone +OS +([0-9]+)_(?:[0-9_])+ +like +Mac +OS +X */,
ipad: /\(iPad; *CPU +OS +([0-9]+)_(?:[0-9_])+ +like +Mac +OS +X */,
iosClient: /^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)-iOS.*$/,
iosClient: /^Mozilla\/5\.0 \(iOS\) (?:ownCloud|Nextcloud)-iOS.*$/,
androidClient: /^Mozilla\/5\.0 \(Android\) ownCloud-android.*$/,
iosTalkClient: /^Mozilla\/5\.0 \(iOS\) Nextcloud-Talk.*$/,
androidTalkClient: /^Mozilla\/5\.0 \(Android\) Nextcloud-Talk.*$/,
Expand All @@ -125,10 +126,10 @@ const nameMap = {
androidChrome: t('setting', 'Google Chrome for Android'),
iphone: t('setting', 'iPhone'),
ipad: t('setting', 'iPad'),
iosClient: t('setting', 'Nextcloud iOS app'),
androidClient: t('setting', 'Nextcloud Android app'),
iosTalkClient: t('setting', 'Nextcloud Talk for iOS'),
androidTalkClient: t('setting', 'Nextcloud Talk for Android'),
iosClient: t('setting', '{productName} iOS app', { productName: window.oc_defaults.productName }),
androidClient: t('setting', '{productName} Android app', { productName: window.oc_defaults.productName }),
iosTalkClient: t('setting', '{productName} Talk for iOS', { productName: window.oc_defaults.productName }),
androidTalkClient: t('setting', '{productName} Talk for Android', { productName: window.oc_defaults.productName }),
davx5: 'DAVx5',
webPirate: 'WebPirate',
sailfishBrowser: 'SailfishBrowser',
Expand Down
7 changes: 7 additions & 0 deletions apps/theming/lib/ThemingDefaults.php
Expand Up @@ -75,6 +75,8 @@ class ThemingDefaults extends \OC_Defaults {
/** @var string */
private $entity;
/** @var string */
private $productName;
/** @var string */
private $url;
/** @var string */
private $color;
Expand Down Expand Up @@ -119,6 +121,7 @@ public function __construct(IConfig $config,
$this->name = parent::getName();
$this->title = parent::getTitle();
$this->entity = parent::getEntity();
$this->productName = parent::getName();
$this->url = parent::getBaseUrl();
$this->color = parent::getColorPrimary();
$this->iTunesAppId = parent::getiTunesAppId();
Expand All @@ -142,6 +145,10 @@ public function getEntity() {
return strip_tags($this->config->getAppValue('theming', 'name', $this->entity));
}

public function getProductName() {
return strip_tags($this->config->getAppValue('theming', 'productName', $this->productName));
}

public function getBaseUrl() {
return $this->config->getAppValue('theming', 'url', $this->url);
}
Expand Down
2 changes: 1 addition & 1 deletion core/Controller/WhatsNewController.php
Expand Up @@ -89,7 +89,7 @@ public function get():DataResponse {
$whatsNew = $this->whatsNewService->getChangesForVersion($currentVersion);
$resultData = [
'changelogURL' => $whatsNew['changelogURL'],
'product' => $this->defaults->getName(),
'product' => $this->defaults->getProductName(),
'version' => $currentVersion,
];
do {
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Setup.php
Expand Up @@ -239,7 +239,7 @@ public function getSystemInfo($allowAllDatabases = false) {
'error' => $this->l10n->t(
'Mac OS X is not supported and %s will not work properly on this platform. ' .
'Use it at your own risk! ',
[$this->defaults->getName()]
[$this->defaults->getProductName()]
),
'hint' => $this->l10n->t('For the best results, please consider using a GNU/Linux server instead.'),
];
Expand All @@ -250,7 +250,7 @@ public function getSystemInfo($allowAllDatabases = false) {
'error' => $this->l10n->t(
'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. ' .
'This will lead to problems with files over 4 GB and is highly discouraged.',
[$this->defaults->getName()]
[$this->defaults->getProductName()]
),
'hint' => $this->l10n->t('Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP.'),
];
Expand Down
1 change: 1 addition & 0 deletions lib/private/Template/JSConfigHelper.php
Expand Up @@ -293,6 +293,7 @@ public function getConfig() {
"_theme" => json_encode([
'entity' => $this->defaults->getEntity(),
'name' => $this->defaults->getName(),
'productName' => $this->defaults->getProductName(),
'title' => $this->defaults->getTitle(),
'baseUrl' => $this->defaults->getBaseUrl(),
'syncClientUrl' => $this->defaults->getSyncClientUrl(),
Expand Down
12 changes: 11 additions & 1 deletion lib/public/Defaults.php
Expand Up @@ -104,14 +104,24 @@ public function getDocBaseUrl(): string {
}

/**
* name of your ownCloud instance
* name of your Nextcloud instance (e.g. MyPrivateCloud)
* @return string
* @since 6.0.0
*/
public function getName(): string {
return $this->defaults->getName();
}

/**
* Name of the software product (defaults to Nextcloud)
*
* @return string
* @since 22.0.0
*/
public function getProductName(): string {
return $this->defaults->getProductName();
}

/**
* name of your ownCloud instance containing HTML styles
* @return string
Expand Down
2 changes: 1 addition & 1 deletion status.php
Expand Up @@ -50,7 +50,7 @@
'version' => implode('.', \OCP\Util::getVersion()),
'versionstring' => OC_Util::getVersionString(),
'edition' => '',
'productname' => $defaults->getName(),
'productname' => $defaults->getProductName(),
'extendedSupport' => \OCP\Util::hasExtendedSupport()
];
if (OC::$CLI) {
Expand Down

0 comments on commit 7917f4c

Please sign in to comment.