diff --git a/Sources/EQNNotificationContent/Base.lproj/MainInterface.storyboard b/Sources/EQNNotificationContent/Base.lproj/MainInterface.storyboard index 49c09e7..109a568 100644 --- a/Sources/EQNNotificationContent/Base.lproj/MainInterface.storyboard +++ b/Sources/EQNNotificationContent/Base.lproj/MainInterface.storyboard @@ -1,9 +1,9 @@ - + - + @@ -13,22 +13,22 @@ - + - @@ -50,22 +58,25 @@ - - + + + + - + + diff --git a/Sources/EQNNotificationContent/NotificationViewController.m b/Sources/EQNNotificationContent/NotificationViewController.m index c1f3a44..d3065e5 100644 --- a/Sources/EQNNotificationContent/NotificationViewController.m +++ b/Sources/EQNNotificationContent/NotificationViewController.m @@ -19,6 +19,7 @@ @property (weak, nonatomic) IBOutlet UILabel *descriptionLabel; @property (weak, nonatomic) IBOutlet UILabel *waveLabel; @property (weak, nonatomic) IBOutlet MKMapView *mapView; +@property (weak, nonatomic) IBOutlet UIButton *tapToOpenButton; /// This will be calculated as seismic date + warning time @property (strong, nonatomic) NSDate *userSeismicTimestamp; @@ -32,6 +33,7 @@ _mapView = mapView; _mapView.scrollEnabled = NO; _mapView.zoomEnabled = NO; + _mapView.showsUserLocation = YES; } #pragma mark - View Lifecycle @@ -42,6 +44,8 @@ [self.mapView registerClass:[EQNCustomAnnotationView class] forAnnotationViewWithReuseIdentifier:EQNCustomAnnotationView.SingleLineIdentifier]; [self.mapView registerClass:[EQNCustomAnnotationView class] forAnnotationViewWithReuseIdentifier:EQNCustomAnnotationView.SmallIdentifier]; + + [self.tapToOpenButton setTitle:@"Tocca per aprire" forState:UIControlStateNormal]; } - (void)didReceiveNotification:(UNNotification *)notification @@ -56,7 +60,7 @@ // add annotation onthe map CLLocation *coordinate = [[CLLocation alloc] initWithLatitude:[userInfo[@"latitude"] doubleValue] longitude:[userInfo[@"longitude"] doubleValue]]; - MKCoordinateSpan span = MKCoordinateSpanMake(10.5, 10.5); + MKCoordinateSpan span = MKCoordinateSpanMake(6, 6); MKCoordinateRegion region = MKCoordinateRegionMake(coordinate.coordinate, span); [self.mapView setCenterCoordinate:coordinate.coordinate animated:NO]; [self.mapView setRegion:region animated:YES]; @@ -103,6 +107,13 @@ } } +#pragma mark - Actions + +- (IBAction)openAppTapped:(id)sender +{ + [self.extensionContext performNotificationDefaultAction]; +} + #pragma mark - MKMapViewDelegate - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation diff --git a/Sources/Earthquake Network.xcodeproj/project.pbxproj b/Sources/Earthquake Network.xcodeproj/project.pbxproj index a259f16..e614d94 100644 --- a/Sources/Earthquake Network.xcodeproj/project.pbxproj +++ b/Sources/Earthquake Network.xcodeproj/project.pbxproj @@ -42,6 +42,7 @@ 65583A05261B83BE00ECA9F9 /* UIKit+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65583A04261B83BE00ECA9F9 /* UIKit+Extensions.swift */; }; 6562C80725FFA6B100C85273 /* SeismicNetworkViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6562C80625FFA6B100C85273 /* SeismicNetworkViewModel.swift */; }; 6563DAA42AAF515F0072D309 /* BackgroundTaskIdentifiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6563DAA32AAF515F0072D309 /* BackgroundTaskIdentifiable.swift */; }; + 6568C2D42E2A930500402F16 /* EQNBlurredCloseButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6586971025F44C26009C0182 /* EQNBlurredCloseButton.swift */; }; 656D138F2C2225560094F597 /* SubscriptionDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656D138E2C2225560094F597 /* SubscriptionDetailsViewController.swift */; }; 656D13912C22371F0094F597 /* SubscriptionDetailsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656D13902C22371F0094F597 /* SubscriptionDetailsTableViewCell.swift */; }; 656E02162C1C4DF2008D0E92 /* EQNBaseContainerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656E02152C1C4DF2008D0E92 /* EQNBaseContainerTableViewCell.swift */; }; @@ -1716,6 +1717,7 @@ 653C67E625F3CC8400FE52AC /* EQNCustomAnnotationView.swift in Sources */, 654D18DA25F9424700BB6DB0 /* EQNUtility+Extensions.swift in Sources */, DC0AE1BA2538204100111307 /* EQNPastquakes.m in Sources */, + 6568C2D42E2A930500402F16 /* EQNBlurredCloseButton.swift in Sources */, 65D9938A29219DEC00F2B0EB /* UIKit+Extensions.swift in Sources */, 6514FF6C2D720CBE000A7BD0 /* MapPinStyle.swift in Sources */, 8CF12CD921DE49B600613AC5 /* NotificationViewController.m in Sources */, diff --git a/Sources/Earthquake Network/UI/EQNBlurredCloseButton.swift b/Sources/Earthquake Network/UI/EQNBlurredCloseButton.swift index 34cc536..867dc72 100644 --- a/Sources/Earthquake Network/UI/EQNBlurredCloseButton.swift +++ b/Sources/Earthquake Network/UI/EQNBlurredCloseButton.swift @@ -7,6 +7,7 @@ // import Foundation +import UIKit class EQNBlurredCloseButton: UIButton { @@ -18,6 +19,12 @@ class EQNBlurredCloseButton: UIButton { setupUI() } + override func awakeFromNib() { + super.awakeFromNib() + + setupUI() + } + // MARK: - Private private func setupUI() {