Compare commits

...

9 Commits

Author SHA1 Message Date
Andrea Busi 122cf497b3 release: Increase version for release 2020-10-16 18:28:51 +02:00
Andrea Busi 361b51a5a2 fix: Use proper value when creating url for test alert 2020-10-16 18:28:51 +02:00
Andrea Busi bbfd28c5d2 dependency: Update Pods 2020-10-15 11:51:46 +02:00
Andrea Busi e399c53de1 feat: Add countdown inside notification content
Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/28
2020-10-15 11:47:54 +02:00
Andrea Busi d8c0d48ad2 refactor: Improve notification content layout and cleanup code 2020-10-15 08:40:03 +02:00
Andrea Busi a474d5782f refactor: Improve style and comments for EQNUtility class 2020-10-15 08:40:03 +02:00
Andrea Busi c538ca7dcb refactor: Move ads utility in a dedicated class 2020-10-15 08:40:03 +02:00
Andrea Busi b11af3d138 fix: Explicit import StoreKit 2020-10-15 08:40:02 +02:00
Andrea Busi 8e1b1bd5a7 refactor: Remove not yet used sounds 2020-10-13 11:23:38 +02:00
24 changed files with 375 additions and 270 deletions
+9
View File
@@ -1,5 +1,14 @@
# Changelog
## Versione 3.1.0
### Build (46)
- Corretto invio parametri per test allerta
### Build (45)
- Rimossi suoni non utilizzati
- Rivista content extension notifica
## Versione 3.0
### Build (44)
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="M4Y-Lb-cyx">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="M4Y-Lb-cyx">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -15,68 +13,61 @@
<objects>
<viewController id="M4Y-Lb-cyx" userLabel="Notification View Controller" customClass="NotificationViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" simulatedAppContext="notificationCenter" id="S3S-Oj-5AN">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="330"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pCT-Wh-lut">
<rect key="frame" x="30" y="28" width="274" height="33"/>
<constraints>
<constraint firstAttribute="height" constant="33" id="3nL-zP-Xy4"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<nil key="textColor"/>
<rect key="frame" x="8" y="216" width="304" height="20.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f3d-th-bgU">
<rect key="frame" x="16" y="69" width="288" height="47"/>
<constraints>
<constraint firstAttribute="height" constant="47" id="ret-xK-EBP"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bT3-3m-qLh">
<rect key="frame" x="16" y="124" width="288" height="29"/>
<constraints>
<constraint firstAttribute="height" constant="29" id="Uqp-c7-9jk"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bT3-3m-qLh">
<rect key="frame" x="8" y="285" width="304" height="29"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
<color key="textColor" red="0.91764705879999997" green="0.46274509800000002" blue="0.0078431372550000003" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="4ID-Zb-OQF">
<rect key="frame" x="0.0" y="161" width="320" height="259"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="200"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="259" id="WpP-bs-nlm"/>
<constraint firstAttribute="height" constant="200" id="Pgl-8e-ePq"/>
</constraints>
<connections>
<outlet property="delegate" destination="M4Y-Lb-cyx" id="Cs2-OY-eT2"/>
</connections>
</mapView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f3d-th-bgU">
<rect key="frame" x="8" y="244.5" width="304" height="20.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="4ID-Zb-OQF" firstAttribute="leading" secondItem="2BE-c3-nQJ" secondAttribute="leading" id="6ml-zm-WGB"/>
<constraint firstItem="f3d-th-bgU" firstAttribute="top" secondItem="pCT-Wh-lut" secondAttribute="bottom" constant="8" id="7wZ-2G-DRJ"/>
<constraint firstItem="f3d-th-bgU" firstAttribute="leading" secondItem="2BE-c3-nQJ" secondAttribute="leading" constant="16" id="B18-89-k0p"/>
<constraint firstItem="2BE-c3-nQJ" firstAttribute="trailing" secondItem="f3d-th-bgU" secondAttribute="trailing" constant="16" id="JZ8-8S-jXR"/>
<constraint firstItem="2BE-c3-nQJ" firstAttribute="trailing" secondItem="pCT-Wh-lut" secondAttribute="trailing" constant="16" id="P48-jk-9M7"/>
<constraint firstItem="4ID-Zb-OQF" firstAttribute="top" secondItem="bT3-3m-qLh" secondAttribute="bottom" constant="8" id="beN-rS-bGS"/>
<constraint firstItem="bT3-3m-qLh" firstAttribute="leading" secondItem="2BE-c3-nQJ" secondAttribute="leading" constant="16" id="cYK-5u-EMT"/>
<constraint firstItem="4ID-Zb-OQF" firstAttribute="bottom" secondItem="2BE-c3-nQJ" secondAttribute="bottom" constant="-60" id="gfC-gJ-8KE"/>
<constraint firstItem="bT3-3m-qLh" firstAttribute="top" secondItem="f3d-th-bgU" secondAttribute="bottom" constant="8" id="ixD-Y8-JnR"/>
<constraint firstItem="4ID-Zb-OQF" firstAttribute="trailing" secondItem="2BE-c3-nQJ" secondAttribute="trailing" id="n4A-8c-Bbr"/>
<constraint firstItem="2BE-c3-nQJ" firstAttribute="trailing" secondItem="bT3-3m-qLh" secondAttribute="trailing" constant="16" id="sak-kv-U04"/>
<constraint firstItem="pCT-Wh-lut" firstAttribute="leading" secondItem="2BE-c3-nQJ" secondAttribute="leading" constant="30" id="tuy-Pe-AhL"/>
<constraint firstItem="pCT-Wh-lut" firstAttribute="top" secondItem="2BE-c3-nQJ" secondAttribute="top" constant="8" id="xC7-C5-Yju"/>
</constraints>
<viewLayoutGuide key="safeArea" id="2BE-c3-nQJ"/>
<constraints>
<constraint firstItem="pCT-Wh-lut" firstAttribute="leading" secondItem="2BE-c3-nQJ" secondAttribute="leading" constant="8" id="3cg-0U-ASJ"/>
<constraint firstItem="f3d-th-bgU" firstAttribute="leading" secondItem="pCT-Wh-lut" secondAttribute="leading" id="7qA-vV-ocI"/>
<constraint firstItem="2BE-c3-nQJ" firstAttribute="trailing" secondItem="pCT-Wh-lut" secondAttribute="trailing" constant="8" id="CAC-UM-SaJ"/>
<constraint firstItem="f3d-th-bgU" firstAttribute="trailing" secondItem="pCT-Wh-lut" secondAttribute="trailing" id="Dd7-BF-iOG"/>
<constraint firstItem="f3d-th-bgU" firstAttribute="top" secondItem="pCT-Wh-lut" secondAttribute="bottom" constant="8" id="FJ8-nn-ydU"/>
<constraint firstItem="2BE-c3-nQJ" firstAttribute="bottom" secondItem="bT3-3m-qLh" secondAttribute="bottom" constant="16" id="I71-6U-jK3"/>
<constraint firstItem="pCT-Wh-lut" firstAttribute="top" secondItem="4ID-Zb-OQF" secondAttribute="bottom" constant="16" id="It9-RA-906"/>
<constraint firstItem="bT3-3m-qLh" firstAttribute="trailing" secondItem="f3d-th-bgU" secondAttribute="trailing" id="KXf-x4-iZs"/>
<constraint firstItem="bT3-3m-qLh" firstAttribute="leading" secondItem="f3d-th-bgU" secondAttribute="leading" id="QlJ-Vh-oi4"/>
<constraint firstItem="bT3-3m-qLh" firstAttribute="top" secondItem="f3d-th-bgU" secondAttribute="bottom" constant="20" id="UUO-2F-eE7"/>
<constraint firstItem="4ID-Zb-OQF" firstAttribute="trailing" secondItem="2BE-c3-nQJ" secondAttribute="trailing" id="buf-BU-I5b"/>
<constraint firstItem="4ID-Zb-OQF" firstAttribute="leading" secondItem="2BE-c3-nQJ" secondAttribute="leading" id="e8D-ji-t64"/>
<constraint firstItem="4ID-Zb-OQF" firstAttribute="top" secondItem="2BE-c3-nQJ" secondAttribute="top" id="hL6-gc-S6i"/>
</constraints>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="480"/>
<size key="freeformSize" width="320" height="330"/>
<connections>
<outlet property="descrizione" destination="f3d-th-bgU" id="3PP-J5-iAi"/>
<outlet property="mappa" destination="4ID-Zb-OQF" id="d2K-qy-Q7P"/>
<outlet property="onda" destination="bT3-3m-qLh" id="xoD-qM-UAF"/>
<outlet property="titolo" destination="pCT-Wh-lut" id="C0V-PC-Sai"/>
<outlet property="descriptionLabel" destination="f3d-th-bgU" id="Aym-KJ-DqY"/>
<outlet property="mapView" destination="4ID-Zb-OQF" id="x8o-nT-bL4"/>
<outlet property="titleLabel" destination="pCT-Wh-lut" id="uIg-dn-Wms"/>
<outlet property="waveLabel" destination="bT3-3m-qLh" id="AkJ-nd-d2R"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vXp-U4-Rya" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -2,17 +2,12 @@
// NotificationViewController.h
// EQNNotificationContent
//
// Created by Luca Beretta on 03/01/2019.
// Copyright © 2019 Luca Beretta. All rights reserved.
// Refactored by Andrea Busi on 14/10/2020.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface NotificationViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *titolo;
@property (weak, nonatomic) IBOutlet UILabel *descrizione;
@property (weak, nonatomic) IBOutlet UILabel *onda;
@property (weak, nonatomic) IBOutlet MKMapView *mappa;
@end
@@ -2,82 +2,164 @@
// NotificationViewController.m
// EQNNotificationContent
//
// Created by Luca Beretta on 03/01/2019.
// Copyright © 2019 Luca Beretta. All rights reserved.
// Refactored by Andrea Busi on 14/10/2020.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
#import "NotificationViewController.h"
#import <UserNotifications/UserNotifications.h>
#import <UserNotificationsUI/UserNotificationsUI.h>
#import <MapKit/MapKit.h>
#import "PastquakesAnnotation.h"
#import "ReteSismicaAnnotation.h"
#import "EQNUtility.h"
@import UserNotifications;
@import UserNotificationsUI;
@import MapKit;
@interface NotificationViewController () <UNNotificationContentExtension, MKMapViewDelegate>
@property (nonatomic, strong) NSDictionary *info;
@property (nonatomic, strong) NSURLSession *session;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *descriptionLabel;
@property (weak, nonatomic) IBOutlet UILabel *waveLabel;
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
/// This will be calculated as seismic date + warning time
@property (strong, nonatomic) NSDate *userSeismicTimestamp;
@property (strong, nonatomic) NSTimer *countdownTimer;
@end
@implementation NotificationViewController
- (void)viewDidLoad {
- (void)setMapView:(MKMapView *)mapView
{
_mapView = mapView;
_mapView.scrollEnabled = NO;
_mapView.zoomEnabled = NO;
}
#pragma mark - View Lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any required interface initialization here.
}
-(void)didReceiveNotification:(UNNotification *)notification {
- (void)didReceiveNotification:(UNNotification *)notification
{
UNNotificationContent *content = notification.request.content;
NSDictionary *userInfo = content.userInfo;
self.titolo.text = notification.request.content.title;
self.descrizione.text = notification.request.content.body;
NSDictionary *dict = notification.request.content.userInfo;
CLLocation *coordinate = [[CLLocation alloc] initWithLatitude:[dict[@"latitude"] doubleValue] longitude:[dict[@"longitude"] doubleValue]];
// set title and description
self.titleLabel.text = content.title;
self.descriptionLabel.text = content.body;
// add annotation onthe map
CLLocation *coordinate = [[CLLocation alloc] initWithLatitude:[userInfo[@"latitude"] doubleValue]
longitude:[userInfo[@"longitude"] doubleValue]];
MKCoordinateSpan span = MKCoordinateSpanMake(10.5, 10.5);
MKCoordinateRegion region = MKCoordinateRegionMake(coordinate.coordinate, span);
self.mappa.delegate = self;
[self.mappa setCenterCoordinate:coordinate.coordinate animated:NO];
[self.mappa setRegion:region animated:YES];
self.mappa.scrollEnabled = NO;
[self.mapView setCenterCoordinate:coordinate.coordinate animated:NO];
[self.mapView setRegion:region animated:YES];
if ([dict[@"type"] isEqualToString:@"eqn"]) {
PastquakesAnnotation *annotation = [[PastquakesAnnotation alloc] initWithTitle:notification.request.content.body location:coordinate.coordinate intensita:[dict[@"intensity"] intValue]];
[self.mappa addAnnotation:annotation];
}
else if ([dict[@"type"] isEqualToString:@"manual"]){
ReteSismicaAnnotation *annotation = [[ReteSismicaAnnotation alloc] initWithTitle:notification.request.content.body location:coordinate.coordinate magnitudo:[dict[@"magnitudo"] intValue]];
[self.mappa addAnnotation:annotation];
if ([userInfo[@"type"] isEqualToString:@"eqn"]) {
PastquakesAnnotation *annotation = [[PastquakesAnnotation alloc] initWithTitle:content.body
location:coordinate.coordinate
intensita:[userInfo[@"intensity"] intValue]];
[self.mapView addAnnotation:annotation];
} else if ([userInfo[@"type"] isEqualToString:@"manual"]){
ReteSismicaAnnotation *annotation = [[ReteSismicaAnnotation alloc] initWithTitle:content.body
location:coordinate.coordinate
magnitudo:[userInfo[@"magnitudo"] intValue]];
[self.mapView addAnnotation:annotation];
}
self.onda.text = [NSString stringWithFormat:@"%@ %@ %@", NSLocalizedString(@"Onda sismica in", @""), dict[@"wave_speed"], NSLocalizedString(@"secondi", @"")];
self.userSeismicTimestamp = [self calculateUserSeismicTimestampWithInfo:userInfo];
if (self.userSeismicTimestamp) {
// start the countdown
self.countdownTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(countdownFired:)
userInfo:nil
repeats:YES];
[self.countdownTimer fire];
}
}
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{
#pragma mark - Private
- (nullable NSDate *)calculateUserSeismicTimestampWithInfo:(NSDictionary *)info
{
// dobbiamo calcolare l'ora in cui il sisma arriverà nella posizione dell'utente
// per fare questo, il calcolo sarà:
// timestamp sisma + warning time
// ultima posizione nota dell'utente
CLLocationManager *manager = [[CLLocationManager alloc] init];
CLLocation *lastUserLocation = manager.location;
if (!lastUserLocation) {
return nil;
}
// posizione sisma
double latitude = [info[@"latitude"] doubleValue];
double longitude = [info[@"longitude"] doubleValue];
CLLocation *location = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
// distanza tra sisma e utente (in km)
CLLocationDistance distance = [lastUserLocation distanceFromLocation:location];
double userDistance = distance/1000;
// calcoliamo warning_time
double waveSpeed = [info[@"wave_speed"] doubleValue];
double warningTime = round(userDistance/waveSpeed - 5);
// aggiungiamo il warning time al timestamp del sisma
NSDate *seismicDate = [EQNUtility getDateFromString:info[@"datetime"]];
NSDate *userSeismicDate = [seismicDate dateByAddingTimeInterval:warningTime];
return userSeismicDate;
}
- (void)countdownFired:(id)sender
{
NSDate *now = [NSDate date];
NSTimeInterval difference = MAX([self.userSeismicTimestamp timeIntervalSinceDate:now], 0);
self.waveLabel.text = [NSString stringWithFormat:@"%@ %.0f %@", NSLocalizedString(@"alert_wave", @""), difference, NSLocalizedString(@"alert_seconds", @"")];
if (difference <= 0) {
// stop the countdown
[self.countdownTimer invalidate];
self.countdownTimer = nil;
}
}
#pragma mark - MKMapViewDelegate
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[PastquakesAnnotation class]]) {
PastquakesAnnotation *anLocation = (PastquakesAnnotation *)annotation;
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:IDENTIFIER_ANNOTATION_PASTQUAKES];
if (annotationView == nil)
if (annotationView == nil) {
annotationView = anLocation.annotationView;
else
} else {
annotationView.annotation = anLocation;
}
return annotationView;
}
else if ([annotation isKindOfClass:[ReteSismicaAnnotation class]]) {
} else if ([annotation isKindOfClass:[ReteSismicaAnnotation class]]) {
ReteSismicaAnnotation *anLocation = (ReteSismicaAnnotation *)annotation;
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:IDENTIFIER_ANNOTATION_RETESMARTPHONE];
if (annotationView == nil)
if (annotationView == nil) {
annotationView = anLocation.annotationView;
else
} else {
annotationView.annotation = anLocation;
}
return annotationView;
}
return nil;
return nil;
}
@end
@@ -20,12 +20,6 @@
8C465D9D21F7BBE700F04673 /* PastquakesAnnotation.h in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C602248218EDBE200C799C2 /* PastquakesAnnotation.h */; };
8C465D9E21F7BD8700F04673 /* PastquakesAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C602249218EDBE200C799C2 /* PastquakesAnnotation.m */; };
8C465D9F21F7BE0600F04673 /* Assets.xcassets in Sources */ = {isa = PBXBuildFile; fileRef = 8CBD3DD12149B9AD0070C963 /* Assets.xcassets */; };
8C483CA521FBC06D00259FD2 /* alerta_japanese.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 8C483CA421FBC06D00259FD2 /* alerta_japanese.m4r */; };
8C483CA621FBC06D00259FD2 /* alerta_japanese.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 8C483CA421FBC06D00259FD2 /* alerta_japanese.m4r */; };
8C483CA721FBC06D00259FD2 /* alerta_japanese.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 8C483CA421FBC06D00259FD2 /* alerta_japanese.m4r */; };
8C483CA921FBC1E900259FD2 /* alerta_mexico.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 8C483CA821FBC1E800259FD2 /* alerta_mexico.m4r */; };
8C483CAA21FBC1E900259FD2 /* alerta_mexico.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 8C483CA821FBC1E800259FD2 /* alerta_mexico.m4r */; };
8C483CAB21FBC1E900259FD2 /* alerta_mexico.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 8C483CA821FBC1E800259FD2 /* alerta_mexico.m4r */; };
8C483CAE21FDA53B00259FD2 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C483CAD21FDA53B00259FD2 /* StoreKit.framework */; };
8C483CB821FDACD300259FD2 /* IAPHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C483CB721FDACD300259FD2 /* IAPHelper.swift */; };
8C483CBC21FDACE500259FD2 /* VersioneProProducts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C483CBB21FDACE500259FD2 /* VersioneProProducts.swift */; };
@@ -82,6 +76,10 @@
DC03BEAB250BC0A60084769B /* EQNRoundedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC03BEAA250BC0A60084769B /* EQNRoundedButton.swift */; };
DC08803F24F5A89000186D97 /* SettingEnableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC08803E24F5A89000186D97 /* SettingEnableTableViewCell.swift */; };
DC08804124F5B41400186D97 /* SettingSliderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC08804024F5B41400186D97 /* SettingSliderTableViewCell.swift */; };
DC0AE1A325381D4100111307 /* EQNAdsUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = DC0AE1A225381D4100111307 /* EQNAdsUtility.m */; };
DC0AE1B52538202300111307 /* EQNUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CF05B56218C93BA0055012B /* EQNUtility.m */; };
DC0AE1B92538204100111307 /* EQNSegnalazione.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C593E89217BA2470008B260 /* EQNSegnalazione.m */; };
DC0AE1BA2538204100111307 /* EQNPastquakes.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CF4F4DA216D44930057110B /* EQNPastquakes.m */; };
DC0E551324F8063300D54270 /* SettingSegmentedTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC0E551224F8063300D54270 /* SettingSegmentedTableViewCell.swift */; };
DC105641251E7ECE002579BB /* UIFont+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC105640251E7ECE002579BB /* UIFont+Extensions.swift */; };
DC27EB2F24F6EBE000ACBFE0 /* SettingsSeismicNetworksViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC27EB2E24F6EBE000ACBFE0 /* SettingsSeismicNetworksViewController.swift */; };
@@ -291,8 +289,6 @@
8C2B25122193927E00E0E25E /* ReteSismiDettagliMappa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReteSismiDettagliMappa.h; sourceTree = "<group>"; };
8C2B25132193927E00E0E25E /* ReteSismiDettagliMappa.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReteSismiDettagliMappa.m; sourceTree = "<group>"; };
8C465D9721F6539700F04673 /* Earthquake Network.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Earthquake Network.xcodeproj"; sourceTree = "<group>"; };
8C483CA421FBC06D00259FD2 /* alerta_japanese.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = alerta_japanese.m4r; sourceTree = "<group>"; };
8C483CA821FBC1E800259FD2 /* alerta_mexico.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = alerta_mexico.m4r; sourceTree = "<group>"; };
8C483CAD21FDA53B00259FD2 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
8C483CB021FDA8C700259FD2 /* Earthquake Network-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Earthquake Network-Bridging-Header.h"; sourceTree = "<group>"; };
8C483CB521FDACD100259FD2 /* EQNNotificationService-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "EQNNotificationService-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -388,6 +384,8 @@
DC03BEAA250BC0A60084769B /* EQNRoundedButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNRoundedButton.swift; sourceTree = "<group>"; };
DC08803E24F5A89000186D97 /* SettingEnableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingEnableTableViewCell.swift; sourceTree = "<group>"; };
DC08804024F5B41400186D97 /* SettingSliderTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingSliderTableViewCell.swift; sourceTree = "<group>"; };
DC0AE1A125381D4100111307 /* EQNAdsUtility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQNAdsUtility.h; sourceTree = "<group>"; };
DC0AE1A225381D4100111307 /* EQNAdsUtility.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNAdsUtility.m; sourceTree = "<group>"; };
DC0E551224F8063300D54270 /* SettingSegmentedTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingSegmentedTableViewCell.swift; sourceTree = "<group>"; };
DC105640251E7ECE002579BB /* UIFont+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+Extensions.swift"; sourceTree = "<group>"; };
DC27EB2E24F6EBE000ACBFE0 /* SettingsSeismicNetworksViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSeismicNetworksViewController.swift; sourceTree = "<group>"; };
@@ -930,8 +928,6 @@
isa = PBXGroup;
children = (
DC958D662535788E00D73D4A /* alert_sound.wav */,
8C483CA421FBC06D00259FD2 /* alerta_japanese.m4r */,
8C483CA821FBC1E800259FD2 /* alerta_mexico.m4r */,
);
path = Sound;
sourceTree = "<group>";
@@ -1012,6 +1008,8 @@
DC4B67602517833F00634277 /* EQNSeismic.swift */,
8CAFD7C321825E4A00F8BD29 /* EQNSisma.h */,
8CAFD7C421825E4A00F8BD29 /* EQNSisma.m */,
DC0AE1A125381D4100111307 /* EQNAdsUtility.h */,
DC0AE1A225381D4100111307 /* EQNAdsUtility.m */,
8CF05B55218C93BA0055012B /* EQNUtility.h */,
8CF05B56218C93BA0055012B /* EQNUtility.m */,
DCF0188E252F09C500C783F0 /* EQNUtility+Extensions.swift */,
@@ -1264,7 +1262,6 @@
DC958D412535742D00D73D4A /* star6f_red2.png in Resources */,
DC958D032535742D00D73D4A /* star4_yellow2.png in Resources */,
DC958D0C2535742D00D73D4A /* star3_yellow2.png in Resources */,
8C483CA621FBC06D00259FD2 /* alerta_japanese.m4r in Resources */,
DC958D172535742D00D73D4A /* triangle2_purple2.png in Resources */,
DC958D142535742D00D73D4A /* star4r_purple2.png in Resources */,
DC958D342535742D00D73D4A /* triangle2_red2.png in Resources */,
@@ -1302,7 +1299,6 @@
DC958D2D2535742D00D73D4A /* dyamond_round_red2.png in Resources */,
DC958D3F2535742D00D73D4A /* star3_white2.png in Resources */,
DC958CE72535742D00D73D4A /* esa_green2.png in Resources */,
8C483CAA21FBC1E900259FD2 /* alerta_mexico.m4r in Resources */,
DC958D122535742D00D73D4A /* triround_inner_red2.png in Resources */,
DC958CEF2535742D00D73D4A /* penta_green2.png in Resources */,
DC958D3E2535742D00D73D4A /* star6_green2.png in Resources */,
@@ -1361,9 +1357,7 @@
buildActionMask = 2147483647;
files = (
8C4DD4F9228237E000AE77ED /* InfoPlist.strings in Resources */,
8C483CA921FBC1E900259FD2 /* alerta_mexico.m4r in Resources */,
8CBD3DD52149B9AD0070C963 /* LaunchScreen.storyboard in Resources */,
8C483CA521FBC06D00259FD2 /* alerta_japanese.m4r in Resources */,
8C10B0B92281FE7F00125C9F /* Localizable.strings in Resources */,
8C6CBAE521597E79005C426A /* GoogleService-Info.plist in Resources */,
DC958D672535788E00D73D4A /* alert_sound.wav in Resources */,
@@ -1380,8 +1374,6 @@
files = (
8CF12CDC21DE49B600613AC5 /* MainInterface.storyboard in Resources */,
8C10B0BB2281FE7F00125C9F /* Localizable.strings in Resources */,
8C483CA721FBC06D00259FD2 /* alerta_japanese.m4r in Resources */,
8C483CAB21FBC1E900259FD2 /* alerta_mexico.m4r in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1555,6 +1547,7 @@
8C4E34422152B5E8008B0D2A /* EQNRilevamento.m in Sources */,
8C7A3B66225A5EA40045B266 /* NSDictionary+EQNExtensions.m in Sources */,
8CF66053214C12DC009F4314 /* EQNMath.m in Sources */,
DC0AE1A325381D4100111307 /* EQNAdsUtility.m in Sources */,
DCF4A54524F8DB8300B17326 /* SettingDateTableViewCell.swift in Sources */,
DC7EEE4A252A11C9004B4A2A /* AlertsSmartphoneNetworkTableViewCell.swift in Sources */,
DC7EEE4F252A1634004B4A2A /* AlertsPriorityServiceTableViewCell.swift in Sources */,
@@ -1585,6 +1578,9 @@
files = (
8C7CD64821F7D0F800835812 /* ReteSismicaAnnotation.m in Sources */,
8C465D9F21F7BE0600F04673 /* Assets.xcassets in Sources */,
DC0AE1B92538204100111307 /* EQNSegnalazione.m in Sources */,
DC0AE1B52538202300111307 /* EQNUtility.m in Sources */,
DC0AE1BA2538204100111307 /* EQNPastquakes.m in Sources */,
8C465D9E21F7BD8700F04673 /* PastquakesAnnotation.m in Sources */,
8CF12CD921DE49B600613AC5 /* NotificationViewController.m in Sources */,
);
@@ -1664,12 +1660,12 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 44;
CURRENT_PROJECT_VERSION = 46;
DEVELOPMENT_TEAM = WJA4MR4CPC;
INFOPLIST_FILE = EQNNotificationService/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.0;
MARKETING_VERSION = 3.1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake.EQNNotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Earthquake Network Extensions - Development";
@@ -1686,12 +1682,12 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 44;
CURRENT_PROJECT_VERSION = 46;
DEVELOPMENT_TEAM = WJA4MR4CPC;
INFOPLIST_FILE = EQNNotificationService/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.0;
MARKETING_VERSION = 3.1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake.EQNNotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Earthquake Network Extensions - Development";
@@ -1824,14 +1820,14 @@
CODE_SIGN_ENTITLEMENTS = "Earthquake Network/Earthquake Network.entitlements";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 44;
CURRENT_PROJECT_VERSION = 46;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = WJA4MR4CPC;
GCC_PREFIX_HEADER = "Earthquake Network/Earthquake Network-Prefix.pch";
INFOPLIST_FILE = "Earthquake Network/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.0;
MARKETING_VERSION = 3.1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
@@ -1852,13 +1848,13 @@
CODE_SIGN_ENTITLEMENTS = "Earthquake Network/Earthquake Network.entitlements";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 44;
CURRENT_PROJECT_VERSION = 46;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = WJA4MR4CPC;
GCC_PREFIX_HEADER = "Earthquake Network/Earthquake Network-Prefix.pch";
INFOPLIST_FILE = "Earthquake Network/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.0;
MARKETING_VERSION = 3.1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
@@ -1874,12 +1870,12 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 44;
CURRENT_PROJECT_VERSION = 46;
DEVELOPMENT_TEAM = WJA4MR4CPC;
INFOPLIST_FILE = EQNNotificationContent/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.0;
MARKETING_VERSION = 3.1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake.EQNNotificationContent;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Earthquake Network Extensions - Development";
@@ -1896,12 +1892,12 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 44;
CURRENT_PROJECT_VERSION = 46;
DEVELOPMENT_TEAM = WJA4MR4CPC;
INFOPLIST_FILE = EQNNotificationContent/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.0;
MARKETING_VERSION = 3.1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake.EQNNotificationContent;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Earthquake Network Extensions - Development";
@@ -8,6 +8,7 @@
import UIKit
import SafariServices
import StoreKit
class PurchaseProVersionViewController: UIViewController {
@@ -8,6 +8,7 @@
import UIKit
import SafariServices
import StoreKit
class SubscriptionDetailViewController: UIViewController {
@@ -7,6 +7,7 @@
//
import UIKit
import StoreKit
class SubscriptionProductTableViewCell: EQNInsetTableViewCell {
@@ -7,6 +7,7 @@
//
import UIKit
import StoreKit
class SubscriptionsActiveTableViewCell: EQNInsetTableViewCell {
@@ -7,6 +7,7 @@
//
import UIKit
import StoreKit
class SubscriptionsViewController: UITableViewController {
@@ -8,9 +8,10 @@
#import "ReteSismiDettagliMappa.h"
#import "SismaAnnotation.h"
#import "EQNAdsUtility.h"
@interface ReteSismiDettagliMappa ()
@property(nonatomic, strong) GADBannerView *bannerView;
@property (nonatomic, strong) GADBannerView *bannerView;
@end
@implementation ReteSismiDettagliMappa
@@ -33,7 +34,7 @@
- (void)setupUI
{
self.mapView.delegate = self;
self.bannerView = [EQNUtility ottieniBannerWithController:self position:YES];
self.bannerView = [EQNAdsUtility ottieniBannerWithController:self position:YES];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"]
style:UIBarButtonItemStyleDone
@@ -0,0 +1,24 @@
//
// EQNAdsUtility.h
// Earthquake Network
//
// Created by Busi Andrea on 15/10/2020.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
#import <Foundation/Foundation.h>
@import GoogleMobileAds;
NS_ASSUME_NONNULL_BEGIN
@interface EQNAdsUtility : NSObject
/// Creates Ad-sense banner to show on a given controller
/// This method returns nil if the user has a Pro version, no banner has to be shown
/// @param controller Controller
/// @param isButton Is button
+ (nullable GADBannerView *)ottieniBannerWithController:(UIViewController *)controller position:(BOOL)isButton;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,45 @@
//
// EQNAdsUtility.m
// Earthquake Network
//
// Created by Busi Andrea on 15/10/2020.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
#import "EQNAdsUtility.h"
@implementation EQNAdsUtility
#pragma mark - Public
+ (GADBannerView *)ottieniBannerWithController:(UIViewController *)controller position:(BOOL)isButton
{
if ([EQNPurchaseUtility isProVersionEnabled]) {
return nil;
}
GADBannerView *bannerView = [[GADBannerView alloc]
initWithAdSize:kGADAdSizeBanner];
bannerView.adUnitID = EQN_ADMOB_ANNUNCIO_IDA;
bannerView.rootViewController = controller;
bannerView.backgroundColor = [UIColor whiteColor];
[bannerView loadRequest:[GADRequest request]];
[self addBanner:bannerView toController:controller isTopAnchored:isButton];
return bannerView;
}
#pragma mark - Private
+ (void)addBanner:(UIView *)bannerView toController:(UIViewController *)controller isTopAnchored:(BOOL)isButton
{
bannerView.translatesAutoresizingMaskIntoConstraints = NO;
[controller.view addSubview:bannerView];
[[bannerView.centerXAnchor constraintEqualToAnchor:controller.view.centerXAnchor] setActive:YES];
NSLayoutAnchor *parentAnchor = isButton ? controller.view.safeAreaLayoutGuide.bottomAnchor : controller.view.safeAreaLayoutGuide.topAnchor;
NSLayoutAnchor *bannerAnchor = isButton ? bannerView.bottomAnchor : bannerView.topAnchor;
[[bannerAnchor constraintEqualToAnchor:parentAnchor] setActive:YES];
}
@end
+11 -10
View File
@@ -7,9 +7,8 @@
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "Costanti.h"
@import GoogleMobileAds;
@class EQNGenericValue;
@@ -28,16 +27,18 @@ NS_ASSUME_NONNULL_BEGIN
/// @param timeDifference Time differnce
+ (NSString *)formattedStringForTimeDifference:(NSInteger)timeDifference;
+(NSArray *)applicaFiltroWithTime:(EQNFiltriMappa )filtro withList:(NSArray *)list;
+(NSString *)clearStringMessaggi:(NSString *)messaggio;
+(NSInteger )getDifferenceMinute:(NSDate *)date;
/// Apply a map filter to a given set of annotations
/// @param filtro Filter to apply
/// @param list Annotations
+ (NSArray *)applicaFiltroWithTime:(EQNFiltriMappa)filtro withList:(NSArray *)list;
/// Clear a given string from unwanted characters
/// @param messaggio Cleaned string
+ (NSString *)clearStringMessaggi:(NSString *)messaggio;
/// Creates Ad-sense banner to show on a given controller
/// This method returns nil if the user has a Pro version, no banner has to be shown
/// @param controller Controller
/// @param isButton Is button
+ (nullable GADBannerView *)ottieniBannerWithController:(UIViewController *)controller position:(BOOL)isButton;
/// Calculate time difference (in minutes) between the given date and the current timestamp
/// @param date Difference (in minutes)
+ (NSInteger)getDifferenceMinute:(NSDate *)date;
/// Store an array of custom objects to NSUserDefaults
/// @param array Array to store
+34 -75
View File
@@ -48,8 +48,37 @@
return [NSString stringWithFormat:format, (long)finalValue];
}
+(NSDate *)impostaFiltroWithTime:(EQNFiltriMappa )filtro{
+ (NSArray *)applicaFiltroWithTime:(EQNFiltriMappa )filtro withList:(NSArray *)list
{
NSDate *date = [self impostaFiltroWithTime:filtro];
NSMutableArray *temp = [NSMutableArray array];
for (id object in list) {
if ([object isKindOfClass:[EQNPastquakes class]]) {
EQNPastquakes *anPasq = (EQNPastquakes *)object;
if ([anPasq.date compare:date] == NSOrderedDescending) {
[temp addObject:anPasq];
NSLog(@"\n\naggiunto %@ filtro %@", anPasq.date, date);
} else {
NSLog(@"\n\nNon aggiunto %@ filtro %@", anPasq.date, date);
}
} else if ([object isKindOfClass:[EQNSegnalazione class]]){
EQNSegnalazione *anSegn = (EQNSegnalazione *)object;
if ([anSegn.date compare:date] == NSOrderedDescending) {
[temp addObject:anSegn];
NSLog(@"\n\naggiunto %@ filtro %@", anSegn.date, date);
} else {
NSLog(@"\n\nNon aggiunto %@ filtro %@", anSegn.date, date);
}
}
}
NSLog(@"filtrati %lu tutti %lu", (unsigned long)temp.count, (unsigned long)list.count);
return temp;
}
+ (NSDate *)impostaFiltroWithTime:(EQNFiltriMappa)filtro
{
unsigned unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute;
NSDate *now = [NSDate date];
@@ -85,49 +114,10 @@
}
return [gregorian dateFromComponents:comps];
}
+(NSArray *)applicaFiltroWithTime:(EQNFiltriMappa )filtro withList:(NSArray *)list {
NSDate *date = [self impostaFiltroWithTime:filtro];
NSMutableArray *temp = [NSMutableArray array];
for (id object in list) {
if ([object isKindOfClass:[EQNPastquakes class]]) {
EQNPastquakes *anPasq = (EQNPastquakes *)object;
if ([anPasq.date compare:date] == NSOrderedDescending) {
[temp addObject:anPasq];
NSLog(@"\n\naggiunto %@ filtro %@", anPasq.date, date);
}
else{
NSLog(@"\n\nNon aggiunto %@ filtro %@", anPasq.date, date);
}
} else if ([object isKindOfClass:[EQNSegnalazione class]]){
EQNSegnalazione *anSegn = (EQNSegnalazione *)object;
if ([anSegn.date compare:date] == NSOrderedDescending) {
[temp addObject:anSegn];
NSLog(@"\n\naggiunto %@ filtro %@", anSegn.date, date);
}
else{
NSLog(@"\n\nNon aggiunto %@ filtro %@", anSegn.date, date);
}
}
}
NSLog(@"filtrati %lu tutti %lu", (unsigned long)temp.count, (unsigned long)list.count);
return temp;
}
+(NSString *)clearStringMessaggi:(NSString *)messaggio{
+ (NSString *)clearStringMessaggi:(NSString *)messaggio
{
NSString *clearString = [messaggio stringByReplacingOccurrencesOfString:@" " withString:@""];
clearString = [clearString stringByReplacingOccurrencesOfString:@"[" withString:@""];
clearString = [clearString stringByReplacingOccurrencesOfString:@"]" withString:@""];
@@ -136,13 +126,11 @@
clearString = [clearString stringByReplacingOccurrencesOfString:@">" withString:@""];
clearString = [clearString stringByReplacingOccurrencesOfString:@"/" withString:@""];
clearString = [clearString stringByReplacingOccurrencesOfString:@"span" withString:@""];
return clearString;
}
+(NSInteger )getDifferenceMinute:(NSDate *)date{
+ (NSInteger)getDifferenceMinute:(NSDate *)date
{
NSDate *now = [NSDate date];
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSDateComponents *components = [calendar components:NSCalendarUnitMinute
@@ -151,35 +139,6 @@
options:0];
return components.minute;
}
+ (GADBannerView *)ottieniBannerWithController:(UIViewController *)controller position:(BOOL)isButton
{
if ([EQNPurchaseUtility isProVersionEnabled]) {
return nil;
}
GADBannerView *bannerView = [[GADBannerView alloc]
initWithAdSize:kGADAdSizeBanner];
bannerView.adUnitID = EQN_ADMOB_ANNUNCIO_IDA;
bannerView.rootViewController = controller;
bannerView.backgroundColor = [UIColor whiteColor];
[bannerView loadRequest:[GADRequest request]];
[self addBanner:bannerView toController:controller isTopAnchored:isButton];
return bannerView;
}
+ (void)addBanner:(UIView *)bannerView toController:(UIViewController *)controller isTopAnchored:(BOOL)isButton
{
bannerView.translatesAutoresizingMaskIntoConstraints = NO;
[controller.view addSubview:bannerView];
[[bannerView.centerXAnchor constraintEqualToAnchor:controller.view.centerXAnchor] setActive:YES];
NSLayoutAnchor *parentAnchor = isButton ? controller.view.safeAreaLayoutGuide.bottomAnchor : controller.view.safeAreaLayoutGuide.topAnchor;
NSLayoutAnchor *bannerAnchor = isButton ? bannerView.bottomAnchor : bannerView.topAnchor;
[[bannerAnchor constraintEqualToAnchor:parentAnchor] setActive:YES];
}
#pragma mark - Store/load data
@@ -8,11 +8,12 @@
#import "PastquakesDettagliMappa.h"
#import "PastquakesAnnotation.h"
#import "EQNAdsUtility.h"
@interface PastquakesDettagliMappa () <MKMapViewDelegate>
@property (nonatomic, strong) NSMutableArray *annotationArray;
@property(nonatomic, strong) GADBannerView *bannerView;
@property (nonatomic, strong) GADBannerView *bannerView;
@end
@@ -39,7 +40,7 @@
[self.buttonAzione addTarget:self action:@selector(visualizzaPikerFiltro:) forControlEvents:UIControlEventTouchDown];
[self applicaFiltroWithTime:@(2)];
self.bannerView = [EQNUtility ottieniBannerWithController:self position:NO];
self.bannerView = [EQNAdsUtility ottieniBannerWithController:self position:NO];
}
- (void)creaMarcherWithSegnalazione:(id)segnalazione
@@ -8,10 +8,12 @@
#import "SegnalazioniUtenteDettagliMappa.h"
#import "ReteSismicaAnnotation.h"
#import "EQNAdsUtility.h"
@interface SegnalazioniUtenteDettagliMappa ()
@property (nonatomic, strong) NSMutableArray *annotationArray;
@property(nonatomic, strong) GADBannerView *bannerView;
@property (nonatomic, strong) GADBannerView *bannerView;
@end
@@ -44,7 +46,7 @@
[self.buttonAzione addTarget:self action:@selector(visualizzaPikerFiltro:) forControlEvents:UIControlEventTouchDown];
[self applicaFiltroWithTime:@(0)];
self.bannerView = [EQNUtility ottieniBannerWithController:self position:NO];
self.bannerView = [EQNAdsUtility ottieniBannerWithController:self position:NO];
}
@@ -320,9 +320,6 @@
/* No comment provided by engineer. */
"OK" = "OK";
/* No comment provided by engineer. */
"Onda sismica in" = "Seismic wave in";
/* No comment provided by engineer. */
"oppure" = "otherwise";
@@ -405,9 +402,6 @@
/* No comment provided by engineer. */
"Se vuoi filtrare la lista dei sismi, seleziona la nazione in cui vivi" = "If you want to filter the list of earthquakes, select the country where you live";
/* No comment provided by engineer. */
"secondi" = "seconds";
/* No comment provided by engineer. */
"Segnalazione " = "Report ";
@@ -673,6 +667,10 @@
"permission_location_no" = "You have chosen to prevent the app from reading the location of the device. You will NOT receive real-time notifications and alerts";
"permission_location_no_background" = "You have chosen to prevent the app from reading the location of your device when the app is in the background. Notifications and real time alerts may NOT be received";
// Notifica
"alert_wave" = "Seismic wave in";
"alert_seconds" = "seconds";
// Varie
"minutes_one" = "%lu minute ago";
"minutes_other" = "%lu minutes ago";
@@ -315,9 +315,6 @@
/* No comment provided by engineer. */
"OK" = "OK";
/* No comment provided by engineer. */
"Onda sismica in" = "Onda sísmica en";
/* No comment provided by engineer. */
"oppure" = "de otra manera";
@@ -400,9 +397,6 @@
/* No comment provided by engineer. */
"Se vuoi filtrare la lista dei sismi, seleziona la nazione in cui vivi" = "Si desea filtrar la lista de sismos, selecciona el país donde vive.";
/* No comment provided by engineer. */
"secondi" = "segundos";
/* No comment provided by engineer. */
"Segnalazione " = "Informe ";
@@ -669,6 +663,10 @@
"permission_location_no" = "Ha elegido evitar que la aplicación lea la ubicación de tu dispositivo. NO recibirá notificaciones y alertas en tiempo real";
"permission_location_no_background" = "Ha elegido evitar que la aplicación lea la ubicación de tu dispositivo cuando la aplicación está en segundo plano. Por lo tanto, NO se garantiza la recepción de notificaciones y alertas en tiempo real";
// Notifica
"alert_wave" = "Onda sísmica en";
"alert_seconds" = "segundos";
// Varie
"minutes_one" = "%lu minuto";
"minutes_other" = "%lu minutos";
@@ -313,9 +313,6 @@
/* No comment provided by engineer. */
"OK" = "OK";
/* No comment provided by engineer. */
"Onda sismica in" = "Onda sismica in";
/* No comment provided by engineer. */
"oppure" = "oppure";
@@ -398,9 +395,6 @@
/* No comment provided by engineer. */
"Se vuoi filtrare la lista dei sismi, seleziona la nazione in cui vivi" = "Se vuoi filtrare la lista dei sismi, seleziona la nazione in cui vivi";
/* No comment provided by engineer. */
"secondi" = "secondi";
/* No comment provided by engineer. */
"Segnalazione " = "Segnalazione ";
@@ -661,6 +655,10 @@
"permission_location_no" = "Hai scelto di impedire alla app di leggere la posizione del tuo dispositivo. NON riceverai notifiche ed allerte in tempo reale.";
"permission_location_no_background" = "Hai scelto di impedire alla app di leggere la posizione del tuo dispositivo quando la app è in background. NON è quindi garantita la ricezione di notifiche ed allerte in tempo reale.";
// Notifica
"alert_wave" = "Onda sismica in";
"alert_seconds" = "secondi";
// Varie
"minutes_one" = "%lu minuto fa";
"minutes_other" = "%lu minuti fa";
@@ -253,7 +253,7 @@
+ (NSURL *)urlAlertPushTest
{
EQNGenericValue *radius = [EQNData magitudoForteFor:[EQNNotificheReteSismiche sharedInstance].energiaTerremotiForti];
EQNGenericValue *radius = [EQNData raggioSismaFor:[EQNAllertaSismica sharedInstance].raggioSismiLievi];
CLLocationCoordinate2D lastPosition = [EQNUser defaultUser].lastPosition.coordinate;
NSString *stringUrl = [NSString stringWithFormat:@"%@?u_id=%@&radius=%@&lat=%f&lon=%f", EQNServerUrlTestAlarm, [EQNUser defaultUser].user_ID, radius.value, lastPosition.latitude, lastPosition.longitude ];
return [NSURL URLWithString:stringUrl];
+35 -35
View File
@@ -1,26 +1,26 @@
PODS:
- DZNEmptyDataSet (1.8.1)
- Firebase/Core (6.33.0):
- Firebase/Core (6.34.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 6.8.3)
- Firebase/CoreOnly (6.33.0):
- FirebaseCore (= 6.10.3)
- Firebase/Crashlytics (6.33.0):
- FirebaseAnalytics (= 6.9.0)
- Firebase/CoreOnly (6.34.0):
- FirebaseCore (= 6.10.4)
- Firebase/Crashlytics (6.34.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 4.6.1)
- Firebase/Messaging (6.33.0):
- FirebaseCrashlytics (~> 4.6.2)
- Firebase/Messaging (6.34.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 4.7.0)
- FirebaseAnalytics (6.8.3):
- FirebaseMessaging (~> 4.7.1)
- FirebaseAnalytics (6.9.0):
- FirebaseCore (~> 6.10)
- FirebaseInstallations (~> 1.6)
- GoogleAppMeasurement (= 6.8.3)
- FirebaseInstallations (~> 1.7)
- GoogleAppMeasurement (= 6.9.0)
- GoogleUtilities/AppDelegateSwizzler (~> 6.7)
- GoogleUtilities/MethodSwizzler (~> 6.7)
- GoogleUtilities/Network (~> 6.7)
- "GoogleUtilities/NSData+zlib (~> 6.7)"
- nanopb (~> 1.30906.0)
- FirebaseCore (6.10.3):
- FirebaseCore (6.10.4):
- FirebaseCoreDiagnostics (~> 1.6)
- GoogleUtilities/Environment (~> 6.7)
- GoogleUtilities/Logger (~> 6.7)
@@ -29,7 +29,7 @@ PODS:
- GoogleUtilities/Environment (~> 6.7)
- GoogleUtilities/Logger (~> 6.7)
- nanopb (~> 1.30906.0)
- FirebaseCrashlytics (4.6.1):
- FirebaseCrashlytics (4.6.2):
- FirebaseCore (~> 6.10)
- FirebaseInstallations (~> 1.6)
- GoogleDataTransport (~> 7.2)
@@ -40,12 +40,12 @@ PODS:
- GoogleUtilities/Environment (~> 6.7)
- GoogleUtilities/UserDefaults (~> 6.7)
- PromisesObjC (~> 1.2)
- FirebaseInstanceID (4.7.0):
- FirebaseInstanceID (4.8.0):
- FirebaseCore (~> 6.10)
- FirebaseInstallations (~> 1.6)
- GoogleUtilities/Environment (~> 6.7)
- GoogleUtilities/UserDefaults (~> 6.7)
- FirebaseMessaging (4.7.0):
- FirebaseMessaging (4.7.1):
- FirebaseCore (~> 6.10)
- FirebaseInstanceID (~> 4.7)
- GoogleUtilities/AppDelegateSwizzler (~> 6.7)
@@ -56,21 +56,21 @@ PODS:
- Google-Mobile-Ads-SDK (7.66.0):
- GoogleAppMeasurement (~> 6.0)
- GoogleUserMessagingPlatform (~> 1.1)
- GoogleAppMeasurement (6.8.3):
- GoogleAppMeasurement (6.9.0):
- GoogleUtilities/AppDelegateSwizzler (~> 6.7)
- GoogleUtilities/MethodSwizzler (~> 6.7)
- GoogleUtilities/Network (~> 6.7)
- "GoogleUtilities/NSData+zlib (~> 6.7)"
- nanopb (~> 1.30906.0)
- GoogleDataTransport (7.4.0):
- GoogleDataTransport (7.5.1):
- nanopb (~> 1.30906.0)
- GoogleMaps (3.10.0):
- GoogleMaps/Maps (= 3.10.0)
- GoogleMaps/Base (3.10.0)
- GoogleMaps/Maps (3.10.0):
- GoogleMaps (4.0.0):
- GoogleMaps/Maps (= 4.0.0)
- GoogleMaps/Base (4.0.0)
- GoogleMaps/Maps (4.0.0):
- GoogleMaps/Base
- GooglePlaces (3.10.0):
- GoogleMaps/Base (= 3.10.0)
- GooglePlaces (4.0.0):
- GoogleMaps/Base (= 4.0.0)
- GoogleUserMessagingPlatform (1.2.0)
- GoogleUtilities/AppDelegateSwizzler (6.7.2):
- GoogleUtilities/Environment
@@ -96,7 +96,7 @@ PODS:
- nanopb/encode (= 1.30906.0)
- nanopb/decode (1.30906.0)
- nanopb/encode (1.30906.0)
- PromisesObjC (1.2.10)
- PromisesObjC (1.2.11)
- Protobuf (3.13.0)
- Solar (2.1.0)
@@ -135,23 +135,23 @@ SPEC REPOS:
SPEC CHECKSUMS:
DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7
Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5
FirebaseAnalytics: 5dd088bd2e67bb9d13dbf792d1164ceaf3052193
FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd
Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999
FirebaseAnalytics: 3bb096873ee0d7fa4b6c70f5e9166b6da413cc7f
FirebaseCore: d3a978a3cfa3240bf7e4ba7d137fdf5b22b628ec
FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1
FirebaseCrashlytics: 5777d3462fb8c3ab9e80a2473bd7d667a2e8411c
FirebaseCrashlytics: 1a747c9cc084a24dc6d9511c991db1cd078154eb
FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2
FirebaseInstanceID: ac5a82fcd21f804dbfc8f318eff9e1d7a9916e49
FirebaseMessaging: fc1f98b4592f8f2ea538169b1c317c6e76f81300
FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1
FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a
Google-Mobile-Ads-SDK: 7d7074359c040f5add4e0963bf860e14690060d0
GoogleAppMeasurement: 966e88df9d19c15715137bb2ddaf52373f111436
GoogleDataTransport: b7f406340a291370045a270c599e53c6fa6ec20f
GoogleMaps: 8c080862ff2748ece9929471b30feb56a6c5079d
GooglePlaces: 9a6f5f3a0c88da2aa1bf7426a65d3e004f5e69a1
GoogleAppMeasurement: a6a3a066369828db64eda428cb2856dc1cdc7c4e
GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833
GoogleMaps: b7f7fc569a9b354a3af0d9729dbec40957b7d41e
GooglePlaces: ca8d4aba09ba79e0a829cf1dca03a41de6a09016
GoogleUserMessagingPlatform: c85530d930ba509583aa5a6d50a10aca22cf8502
GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3
nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc
PromisesObjC: b14b1c6b68e306650688599de8a45e49fae81151
PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f
Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748
Solar: 2dc6e7cc39186cb0c8228fa08df76fb50c7d8f24