feat: Improve UI in notification content

Resolves: https://github.com/futurainnovation/eqn.ios/issues/4
This commit is contained in:
Andrea Busi
2025-07-18 17:02:52 +02:00
parent 276fa2032a
commit f23c19bce7
4 changed files with 47 additions and 16 deletions
@@ -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<MKAnnotation>)annotation