TodayVC.m 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // TodayVC.m
  3. // Today
  4. //
  5. // Created by Marcus Rohrmoser on 27.01.16.
  6. // Copyright (c) 2016-2016 Marcus Rohrmoser http://mro.name/me. All rights reserved.
  7. //
  8. // This program is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. #import "TodayVC.h"
  22. #import <NotificationCenter/NotificationCenter.h>
  23. @interface TodayVC() <NCWidgetProviding>
  24. @end
  25. @implementation TodayVC
  26. -(void)viewDidLoad
  27. {
  28. [super viewDidLoad];
  29. // Do any additional setup after loading the view from its nib.
  30. }
  31. -(void)didReceiveMemoryWarning
  32. {
  33. [super didReceiveMemoryWarning];
  34. // Dispose of any resources that can be recreated.
  35. }
  36. -(void)widgetPerformUpdateWithCompletionHandler:( void (^)(NCUpdateResult) )completionHandler
  37. {
  38. // Perform any setup necessary in order to update the view.
  39. // If an error is encountered, use NCUpdateResultFailed
  40. // If there's no update required, use NCUpdateResultNoData
  41. // If there's an update, use NCUpdateResultNewData
  42. completionHandler(NCUpdateResultNewData);
  43. }
  44. -(IBAction)actionNote:(id)sender
  45. {
  46. NSURL *url = [NSURL URLWithString:SELF_URL_PREFIX @"://localhost/note/add"];
  47. [self.extensionContext openURL:url completionHandler:^(BOOL success) {
  48. MRLogD (@"-", nil);
  49. }
  50. ];
  51. }
  52. @end