File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77use OCA \Libresign \AppInfo \Application as AppInfoApplication ;
88use OCP \App \IAppManager ;
99use OCP \IConfig ;
10- use OCP \IL10N ;
1110use OCP \IUserManager ;
1211use OCP \Migration \IOutput ;
1312use OCP \Migration \IRepairStep ;
@@ -29,7 +28,7 @@ public function getName(): string {
2928 public function run (IOutput $ output ): void {
3029
3130 $ currentVersion = $ currentVersion = $ this ->appManager ->getAppVersion (AppInfoApplication::APP_ID );
32- $ lastNotifiedVersion = $ this ->config ->getAppValue (AppInfoApplication::APP_ID , 'last_notified_version ' , '' );
31+ $ lastNotifiedVersion = $ this ->config ->getAppValue (AppInfoApplication::APP_ID , 'last_notified_version ' , '' );
3332
3433 if ($ currentVersion === $ lastNotifiedVersion ) {
3534 return ;
@@ -44,7 +43,8 @@ public function run(IOutput $output): void {
4443 ->setDateTime (new \DateTime ())
4544 ->setObject ('upgrade ' , '1 ' )
4645 ->setSubject ('libresign_upgrade ' , [
47- 'message ' => 'LibreSign has been updated to version ' . $ currentVersion . '! Consider supporting the project: https://libresign.coop '
46+ 'version ' => $ currentVersion ,
47+ 'message ' => 'If LibreSign is useful to you or your organization, please consider supporting our cooperative by clicking the Donate button below. ' ,
4848 ]);
4949 $ this ->notificationManager ->notify ($ notification );
5050 }
Original file line number Diff line number Diff line change @@ -229,12 +229,20 @@ private function parseUpgrade(
229229 ): INotification {
230230
231231 $ parameters = $ notification ->getSubjectParameters ();
232+ $ version = $ parameters ['version ' ] ?? '' ;
232233 $ notification ->setIcon ($ this ->url ->getAbsoluteURL ($ this ->url ->imagePath (Application::APP_ID , 'app-dark.svg ' )));
233- $ subject = $ l ->t ('LibreSign has been updated! ' );
234+ $ subject = $ l ->t ('LibreSign has been updated to version %s! ' , [ $ version ] );
234235 $ message = $ parameters ['message ' ] ?? '' ;
235236 $ notification ->setParsedSubject ($ subject )
236237 ->setParsedMessage ($ message );
237238
239+ $ donateAction = $ notification ->createAction ()
240+ ->setParsedLabel ($ l ->t ('Donate ' ))
241+ ->setPrimary (true )
242+ ->setLink ('https://libresign.coop ' , \OCP \Notification \IAction::TYPE_WEB );
243+
244+ $ notification ->addParsedAction ($ donateAction );
245+
238246 $ dismissAction = $ notification ->createAction ()
239247 ->setParsedLabel ($ l ->t ('Dismiss notification ' ))
240248 ->setPrimary (false )
@@ -250,7 +258,8 @@ private function parseUpgrade(
250258 ],
251259 ),
252260 IAction::TYPE_DELETE
253- );
261+ );
262+
254263 $ notification ->addParsedAction ($ dismissAction );
255264
256265 return $ notification ;
You can’t perform that action at this time.
0 commit comments