mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-17 21:12:16 +01:00
feat: add donate button
Signed-off-by: Samuelson Brito <samuelsonma@gmail.com>
This commit is contained in:
parent
b7cfd99350
commit
0042aa23ce
2 changed files with 18 additions and 5 deletions
|
|
@ -1,13 +1,16 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Libresign\Migration;
|
||||
|
||||
use OCA\Libresign\AppInfo\Application as AppInfoApplication;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IUserManager;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\IRepairStep;
|
||||
|
|
@ -29,7 +32,7 @@ class NotifyAdminsAfterUpgrade implements IRepairStep {
|
|||
public function run(IOutput $output): void {
|
||||
|
||||
$currentVersion = $currentVersion = $this->appManager->getAppVersion(AppInfoApplication::APP_ID);
|
||||
$lastNotifiedVersion = $this->config->getAppValue(AppInfoApplication::APP_ID, 'last_notified_version', '');
|
||||
$lastNotifiedVersion = $this->config->getAppValue(AppInfoApplication::APP_ID, 'last_notified_version', '');
|
||||
|
||||
if ($currentVersion === $lastNotifiedVersion) {
|
||||
return;
|
||||
|
|
@ -44,7 +47,8 @@ class NotifyAdminsAfterUpgrade implements IRepairStep {
|
|||
->setDateTime(new \DateTime())
|
||||
->setObject('upgrade', '1')
|
||||
->setSubject('libresign_upgrade', [
|
||||
'message' => 'LibreSign has been updated to version ' . $currentVersion . '! Consider supporting the project: https://libresign.coop'
|
||||
'version' => $currentVersion,
|
||||
'message' => 'If LibreSign is useful to you or your organization, please consider supporting our cooperative by clicking the Donate button below.',
|
||||
]);
|
||||
$this->notificationManager->notify($notification);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,12 +214,20 @@ class Notifier implements INotifier {
|
|||
): INotification {
|
||||
|
||||
$parameters = $notification->getSubjectParameters();
|
||||
$version = $parameters['version'] ?? '';
|
||||
$notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath(Application::APP_ID, 'app-dark.svg')));
|
||||
$subject = $l->t('LibreSign has been updated!');
|
||||
$subject = $l->t('LibreSign has been updated to version %s!', [$version]);
|
||||
$message = $parameters['message'] ?? '';
|
||||
$notification->setParsedSubject($subject)
|
||||
->setParsedMessage($message);
|
||||
|
||||
$donateAction = $notification->createAction()
|
||||
->setParsedLabel($l->t('Donate'))
|
||||
->setPrimary(true)
|
||||
->setLink('https://github.com/sponsors/LibreSign', \OCP\Notification\IAction::TYPE_WEB);
|
||||
|
||||
$notification->addParsedAction($donateAction);
|
||||
|
||||
$dismissAction = $notification->createAction()
|
||||
->setParsedLabel($l->t('Dismiss notification'))
|
||||
->setPrimary(false)
|
||||
|
|
@ -235,7 +243,8 @@ class Notifier implements INotifier {
|
|||
],
|
||||
),
|
||||
IAction::TYPE_DELETE
|
||||
);
|
||||
);
|
||||
|
||||
$notification->addParsedAction($dismissAction);
|
||||
|
||||
return $notification;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue