feat: Update new user report data in notification extension

This commit is contained in:
Andrea Busi
2022-11-15 22:40:44 +01:00
parent e9986e0fe1
commit dfdbbd0ed4
4 changed files with 12 additions and 19 deletions
@@ -41,6 +41,7 @@
[super viewDidLoad];
[self.mapView registerClass:[EQNCustomAnnotationView class] forAnnotationViewWithReuseIdentifier:EQNCustomAnnotationView.SingleLineIdentifier];
[self.mapView registerClass:[EQNCustomAnnotationView class] forAnnotationViewWithReuseIdentifier:EQNCustomAnnotationView.SmallIdentifier];
}
- (void)didReceiveNotification:(UNNotification *)notification
@@ -67,9 +68,8 @@
[self.mapView addAnnotation:annotation];
} else if ([userInfo[@"type"] isEqualToString:@"manual"]){
EQNMapAnnotationUserReport *annotation = [[EQNMapAnnotationUserReport alloc] initWithTitle:@""
coordinate:coordinate.coordinate
magnitude:[userInfo[@"magnitudo"] intValue]];
EQNMapAnnotationUserReport *annotation = [[EQNMapAnnotationUserReport alloc] initWithMagnitude:[userInfo[@"magnitude"] intValue]
coordinate:coordinate.coordinate];
[self.mapView addAnnotation:annotation];
}
@@ -118,9 +118,9 @@
} else if ([annotation isKindOfClass:[EQNMapAnnotationUserReport class]]) {
EQNMapAnnotationUserReport *report = (EQNMapAnnotationUserReport *)annotation;
EQNCustomAnnotationView *annotationView = (EQNCustomAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:EQNCustomAnnotationView.SingleLineIdentifier];
EQNCustomAnnotationView *annotationView = (EQNCustomAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:EQNCustomAnnotationView.SmallIdentifier];
annotationView.image = report.image;
annotationView.title = report.title;
annotationView.title = report.timeDifference;
return annotationView;
}
return nil;
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

@@ -75,20 +75,9 @@ static NSString * const EQNSoundNotificationEQN = @"alert_sound.wav";
break;
}
} else if ([notificationType isEqualToString:@"manual"]) {
NSString *intensity = [userInfo objectForKey:@"magnitude"];
switch ([intensity intValue]) {
case 0:
iconName = @"star_green.png";
break;
case 1:
iconName = @"star_yellow.png";
break;
case 2:
iconName = @"star_red.png";
break;
default:
break;
}
// there are 12 levels, so a customized icon doesn't make sense
// use a generic warning icon instead
iconName = @"warning_yellow.png";
} else if ([notificationType isEqualToString:@"official"]) {
NSString *provaider = [userInfo objectForKey:@"provider"];
double intensity = [[userInfo objectForKey:@"magnitude"] doubleValue];
@@ -24,6 +24,7 @@
654D18D625F9420500BB6DB0 /* EQNMapAnnotationPastquake.swift in Sources */ = {isa = PBXBuildFile; fileRef = 654D18C825F93CD700BB6DB0 /* EQNMapAnnotationPastquake.swift */; };
654D18DA25F9424700BB6DB0 /* EQNUtility+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCF0188E252F09C500C783F0 /* EQNUtility+Extensions.swift */; };
654D18DE25F943E200BB6DB0 /* EQNMapAnnotationUserReport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653C67FB25F3D63500FE52AC /* EQNMapAnnotationUserReport.swift */; };
6552C140292678BD008E723C /* warning_yellow.png in Resources */ = {isa = PBXBuildFile; fileRef = 6552C13F292678BD008E723C /* warning_yellow.png */; };
6557CB2A2607676B00962757 /* triangle2_yellow.png in Resources */ = {isa = PBXBuildFile; fileRef = 6557CAC52607676200962757 /* triangle2_yellow.png */; };
6557CB2B2607676B00962757 /* star_purple.png in Resources */ = {isa = PBXBuildFile; fileRef = 6557CAC62607676200962757 /* star_purple.png */; };
6557CB2C2607676B00962757 /* oct_white.png in Resources */ = {isa = PBXBuildFile; fileRef = 6557CAC72607676200962757 /* oct_white.png */; };
@@ -305,6 +306,7 @@
6544416A25E9599000C41714 /* EQNDebugViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNDebugViewController.swift; sourceTree = "<group>"; };
654D18C325F93C0600BB6DB0 /* PasquakesMapViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasquakesMapViewController.swift; sourceTree = "<group>"; };
654D18C825F93CD700BB6DB0 /* EQNMapAnnotationPastquake.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNMapAnnotationPastquake.swift; sourceTree = "<group>"; };
6552C13F292678BD008E723C /* warning_yellow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = warning_yellow.png; sourceTree = "<group>"; };
6557CAC52607676200962757 /* triangle2_yellow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = triangle2_yellow.png; sourceTree = "<group>"; };
6557CAC62607676200962757 /* star_purple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = star_purple.png; sourceTree = "<group>"; };
6557CAC72607676200962757 /* oct_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = oct_white.png; sourceTree = "<group>"; };
@@ -808,6 +810,7 @@
DC30BC862534DBB30041B23B /* Icons */ = {
isa = PBXGroup;
children = (
6552C13F292678BD008E723C /* warning_yellow.png */,
6557CACE2607676300962757 /* circle_green.png */,
6557CAFF2607676700962757 /* circle_purple.png */,
6557CB1D2607676900962757 /* circle_red.png */,
@@ -1435,6 +1438,7 @@
6557CB2B2607676B00962757 /* star_purple.png in Resources */,
6557CB462607676B00962757 /* dyamond_red.png in Resources */,
6557CB682607676B00962757 /* dyamond_round_green.png in Resources */,
6552C140292678BD008E723C /* warning_yellow.png in Resources */,
6557CB7E2607676B00962757 /* star_red.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;