Compare commits

...

106 Commits

Author SHA1 Message Date
Andrea Busi ff2f6e1e5a release: Increase version for release 2021-02-25 19:47:20 +01:00
Andrea Busi c10000df53 fix: Retry server registration if fails
Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/30
2021-02-24 21:05:50 +01:00
Andrea Busi 6e6f1bed17 feat: Use native ads in seismics section
Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/22
2021-02-21 20:56:12 +01:00
Andrea Busi c77a31e322 refactor: Remove no longer used EQNAdsUtility class 2021-02-21 20:56:12 +01:00
Andrea Busi 47db205135 refactor: Use adaptive banners in maps
Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/22
2021-02-21 20:56:05 +01:00
Andrea Busi 5ab30c139f refactor: Rename ReteSismicaAnnotation in EQNMapAnnotationSeismicNetwork 2021-02-21 20:56:05 +01:00
Andrea Busi 852e950428 refactor: Rename PastquakesAnnotation in EQNMapAnnotationPastquakes 2021-02-21 20:56:05 +01:00
Andrea Busi e882a83694 refactor: Rewrite seismic map in Swift and rename its annotation model 2021-02-21 20:56:05 +01:00
Andrea Busi 0d26e641d7 refactor: Improve NSNotification definition to be Swift friendly 2021-02-21 20:56:05 +01:00
Andrea Busi 4c6a07c9d0 refactor: Use adaptive banners in main controllers
Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/22
2021-02-21 20:55:51 +01:00
Andrea Busi fe38921f23 fix: Use test ads during debug 2021-02-21 20:54:12 +01:00
Andrea Busi 118991feea dependency: Add missing SKAdNetworkItems in info.plist for GoogleMobileAds 2021-02-21 20:52:07 +01:00
Andrea Busi a87750f380 dependency: Add -ObjC flag to let GoogleMobileAds works 2021-02-21 20:52:07 +01:00
Andrea Busi cb8ee2cb67 dependency: Update Pods 2021-02-21 20:52:07 +01:00
Andrea Busi 787cd8b4e7 refactor: Rename some constants 2021-02-21 20:51:28 +01:00
Andrea Busi 64ec53e6f8 refactor: Remove unused method to validate app receipt 2021-02-21 20:50:55 +01:00
Andrea Busi 2df5342da2 chore: Remove old xcuserdata from versioning 2020-12-18 22:00:26 +01:00
Andrea Busi d8fdba5e4f release: Increase version for release 2020-12-08 16:20:10 +01:00
Andrea Busi a05e186275 refactor: Rewrite EQNReteSmartphone model in Swift and use proper types for properties 2020-12-08 16:20:10 +01:00
Andrea Busi 7730da5faa dependency: Update Pods 2020-12-07 09:57:27 +01:00
Andrea Busi 9844dc9ac2 fix: Add missing return 2020-12-07 09:57:27 +01:00
Andrea Busi a9f16bca4a refactor: Reorganise code related to background monitoring
- Move to Models folder
- Improve code and nullability notation
- Rename class with typo in name
2020-12-07 09:46:43 +01:00
Andrea Busi 5612768d7f refactor: Remove useless imports 2020-12-07 09:46:43 +01:00
Andrea Busi ad1487afdf feat: Add server request to register in-app purchase
Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/29
2020-12-07 09:46:24 +01:00
Andrea Busi f707186dea refactor: Show restored product in alert 2020-12-02 21:16:10 +01:00
Andrea Busi 24f63c7d4b feat: Add message if no subscriptions are available to restore 2020-12-02 21:16:10 +01:00
Andrea Busi 9678040d51 refactor: Improve log in in-app purchase manager 2020-12-02 21:16:10 +01:00
Andrea Busi 27dc1d8ff5 release: Increase version for release 2020-11-21 15:50:37 +01:00
Andrea Busi 4a0fe9ed09 refactor: Remove unused constants 2020-11-21 15:50:37 +01:00
Andrea Busi b382b70aa9 refactor: Reorganize some code 2020-11-21 15:50:37 +01:00
Andrea Busi 024a7c6333 feat: Add button to open subscriptions page from simulator result 2020-11-21 15:50:37 +01:00
Andrea Busi c9b4ef1aa5 feat: Add protocol to create controllers from storyboard 2020-11-21 15:50:37 +01:00
Andrea Busi f30ab9e009 refactor: Remove unused strings 2020-11-21 15:50:37 +01:00
Andrea Busi e15b7bcca2 feat: Add simulator function 2020-11-15 15:44:34 +01:00
Andrea Busi 90426c21f1 fix: Solve an issue with home layout 2020-11-15 15:44:15 +01:00
Andrea Busi 2ab07b7010 feat: Add methods to check enabled subscriptions 2020-11-15 15:44:15 +01:00
Andrea Busi be8fd7f4b5 refactor: Rewrite enum to be more Obj-C 2020-11-15 15:44:15 +01:00
Andrea Busi 4bf972747f dependency: Update Pods 2020-11-15 15:44:15 +01:00
Andrea Busi 96567c19f5 refactor: Remove unused GoogleMaps and GooglePlaces dependencies 2020-11-15 15:44:15 +01:00
Andrea Busi 82d5bd6b0d refactor: Remove some unused strings and remove extra escaping 2020-11-15 15:44:15 +01:00
Andrea Busi 889dd5e179 refactor: Improve code style 2020-11-14 17:46:39 +01:00
Andrea Busi bd8aba6992 refactor: Improve imports 2020-11-14 17:46:39 +01:00
Andrea Busi 017af0ed8e refactor: Add folder for "segnalazioni" controller 2020-11-14 15:08:23 +01:00
Andrea Busi 4f4d8dac52 fix: Add missing translation 2020-10-26 06:46:56 +01:00
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
Andrea Busi 67546801ac release: Increase version for release 2020-10-13 08:08:48 +02:00
Andrea Busi 6135e2d38c refactor: Rename some constants 2020-10-13 08:08:48 +02:00
Andrea Busi e46fa0417d refactor: Update notification sound and remove not yet used setting parameter 2020-10-13 08:08:48 +02:00
Andrea Busi dc6bb13960 refactor: Load notification icons from current bundle, instead of download every time from the server 2020-10-13 08:08:48 +02:00
Andrea Busi 6aecff1415 fix: Play notification sound also with app in foreground 2020-10-12 21:10:07 +02:00
Andrea Busi 6fcf58608f refactor: Remove notification logic related to tsunami 2020-10-12 21:10:07 +02:00
Andrea Busi 65ed82445b fix: Solve issue that cause 30 seconds delay to display push notifications
Also apply some refactor to improve code style
2020-10-12 21:10:07 +02:00
Andrea Busi ab727b119b fix: Disable zoom in map 2020-10-12 21:10:07 +02:00
Andrea Busi 1bd833093b refactor: Hide "Simulator" button in home 2020-10-12 21:10:07 +02:00
Andrea Busi 904d4c5de8 refactor: Change text when seismic table is empty 2020-10-12 21:10:07 +02:00
Andrea Busi 720d0fcd2a fix: Disable selection for "location data" cell 2020-10-11 16:28:13 +02:00
Andrea Busi 8f50ed0a25 fix: Use M0_0 endpoint to retrieve data if show near earthquake is enabled 2020-10-11 16:28:13 +02:00
Andrea Busi 4f3bd9aa95 refactor: Align seismic cards style to new app layout 2020-10-08 22:18:51 +02:00
Andrea Busi cb30995a07 feat: Add location data card in Allerte section 2020-10-08 22:18:51 +02:00
Andrea Busi faeb9c0788 dependency: Add Solar library 2020-10-08 22:18:51 +02:00
Andrea Busi d286909a8d refactor: Move method to get string from coordinate in EQNUtility class 2020-10-08 22:18:51 +02:00
Andrea Busi 499d689943 refactor: Minor layout fixes 2020-10-08 21:36:28 +02:00
Andrea Busi 89e7989abc feat: Add shadow and rounded corner to cards 2020-10-08 21:36:28 +02:00
Andrea Busi bf4a5e7728 feat: Add test push alert feature 2020-10-08 21:36:28 +02:00
Andrea Busi e1bd26db48 refactor: Use proper method to store/load also dictionary 2020-10-08 21:36:28 +02:00
Andrea Busi 509b75e7b5 refactor: Use a shared method to handle push notification 2020-10-08 21:36:28 +02:00
Andrea Busi 5e16909f12 refactor: Remove old strings for storyboard 2020-10-08 21:36:28 +02:00
Andrea Busi 53817ac52a refactor: Remove unused images 2020-10-08 21:36:28 +02:00
Andrea Busi 54c6297637 refactor: Use new method to get formatted time difference 2020-10-08 21:36:28 +02:00
Andrea Busi 0374a0a1bd refactor: Improve notification management 2020-10-08 21:36:28 +02:00
Andrea Busi cf7ae31eb1 refactor: Better model PastquakesAnnotation 2020-10-08 21:36:28 +02:00
Andrea Busi 92e75913ab refactor: Recreate layout for "Allerte" section 2020-10-08 21:36:28 +02:00
Andrea Busi 061c321c2b refactor: Rename ReteSmartphone controller to AllerteViewController 2020-10-08 21:36:28 +02:00
Andrea Busi d50104a2f9 refactor: Improve layout in tab Segnalazioni 2020-10-08 21:36:28 +02:00
Andrea Busi 81d554cc78 refactor: Remove grafico utenti call and model
Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/26
2020-10-08 21:36:28 +02:00
Andrea Busi bda81d01ba refactor: Handle refresh for common notifications in base controller 2020-10-08 21:36:28 +02:00
Andrea Busi 708e6dd92f feat: Add cache mechanism for seismic data
- download data only after 2 minutes after the previous download
- download data when app returns from the background
- user can force data download

Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/18
2020-10-08 21:36:28 +02:00
Andrea Busi 74d7c71ed4 refactor: Improve code and use new utility method 2020-10-08 21:36:28 +02:00
Andrea Busi 27503c1643 refactor: Add new method to store/retrieve an array from NSUserDefault
This method uses only supported API, in order to solve deprecated warnings. Also, remove useless method
2020-10-08 21:36:28 +02:00
Andrea Busi 95935dd377 refactor: Remove commented code 2020-10-08 21:36:28 +02:00
Andrea Busi b357039901 refactor: Remove unused constants 2020-10-08 21:36:28 +02:00
Andrea Busi df8c154848 refactor: Remove AppTransportSecurity exception, only HTTPS are made from the app 2020-10-08 21:36:27 +02:00
Andrea Busi 882e0ba4b6 refactor: Remove not yet used strings 2020-10-08 21:36:27 +02:00
Andrea Busi 88572c2829 refactor: Use HTTPS endpoint to download notification icons 2020-10-08 21:36:27 +02:00
Andrea Busi bad1ce5879 refactor: Convert from Macro to static constants and use HTTPS as default protocol
Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/17
2020-10-08 21:36:27 +02:00
Andrea Busi ce387912f8 feat: Add method to get formatted time difference 2020-10-08 21:36:27 +02:00
Andrea Busi 8f711b988a release: Increase version for release 2020-10-08 14:22:26 +02:00
Andrea Busi e202ba8452 fix: Solve wrong url for settings upload 2020-10-08 14:21:49 +02:00
Andrea Busi eb8d8be800 fix: Make provider label fit required space 2020-10-08 14:01:52 +02:00
Andrea Busi a1b7a5ee70 fix: Seismic filter now use case-insensitive check for networks 2020-10-08 14:01:36 +02:00
Andrea Busi 7a117097e3 fix: Add missing translations 2020-10-08 14:01:24 +02:00
Andrea Busi 8070262a44 fix: Use proper time zone when parse web service date 2020-10-08 14:00:53 +02:00
Andrea Busi f768b15916 release: Increase version for release 2020-10-03 12:10:24 +02:00
Andrea Busi a07480f90a fix: Handle seismic date as nullable parameter to avoid crashes 2020-10-03 12:09:47 +02:00
Andrea Busi 4e5e93e3f1 refactor: Rename method to convert server string into date 2020-10-03 12:09:31 +02:00
Andrea Busi 68c9eb9bbc feat: Show alert when weather data are not available 2020-10-03 12:09:06 +02:00
Andrea Busi ba2fbfaa60 feat: Handle weather code as nullable parameter 2020-10-03 12:01:17 +02:00
Andrea Busi e194731bc8 refactor: Rename NSDictionary extension and improve code 2020-10-03 11:58:15 +02:00
271 changed files with 6244 additions and 6244 deletions
+97
View File
@@ -1,5 +1,102 @@
# Changelog
## Versione 3.3
### Build (52)
- Aggiunta gestione in caso di fallita registrazione iniziale al server
### Build (51)
- Utilizzati adaptive e native banner
- Aggiornate dipendenze
- Rimosso codice non utilizzato
## Versione 3.2.1
### Build (50)
- Aggiunta chiamata per registrazione acquisto
- Rivisto modell EQNReteSmartphone
### Build (49)
- Aggiunta indicazione prodotto ripristinato
- Aggiunto messaggio se nessun prodotto da ripristinare
## Versione 3.2.0
### Build (48)
- Rimosse stringhe non utilizzate
- Aggiunto bottone per aprire pagina abbonamenti
### Build (47)
- Corretto problema layout in home
- Aggiunta funzione simulatore
- Rimosse stringhe non utilizzate e aggiornate traduzioni mancanti
## 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)
- Corrette stringhe in tab Sismi
- Disabilitato zoom mappa in Allerte
- Nascosto bottone per "Simulatore"
- Corretto problema ritardo visualizzazione notifiche push
- Suono notifiche riprodotto anche con app in foreground
- Icone in notifiche caricate da locale e non scaricate dal server
- Aggiornato suono notifica
### Build (43)
- Corretto scaricamento dati sismi per gestione "qualsiasi terremoto se < 50 km"
- Corretta selezione cella "dati posizione"
### Build (42)
- Corretto filtro rete GEONET
- Completata funzione "Test allerta"
- Aggiunta card "dati posizione"
### Build (40)
- Completato flusso e alert per invio messaggio
- Correzioni layout
### Build (39)
- Ombra e angoli arrotondati in card
- Funzione test allerte (WIP)
### Build (38)
- Aggiornate icone stelle
- Aggiunto messaggio localizzazione
- Rimosso bottone invio messaggio
### Build (37)
- Correzioni varie layout
- Corretto flusso invio commento
### Build (36)
- Migrate chiamate ad HTTPS
- Rimossa eccezione AppTransportSecurity per chiamate non sicure
- Aggiunto meccanismo cache per sismi
- Rivisto layout tab Segnalazioni (WIP)
- Rivisto layout tab Allerte (WIP)
## Versione 2.3.2
### Build (41)
- Corretto caricamento parametri settings
- Corretto filtro per rete Geonet
- Fix minori
## Versione 2.3.1
### Build (35)
- Aggiunto controllo su data in schede sismi per evitare crash
- Aggiunta gestione dati meteo non disponibili
## Versione 2.3
### Build (34)
@@ -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 "EQNMapAnnotationPastquakes.h"
#import "EQNMapAnnotationSeismicNetwork.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"]) {
EQNMapAnnotationPastquakes *annotation = [[EQNMapAnnotationPastquakes alloc] initWithTitle:content.body
location:coordinate.coordinate
intensita:[userInfo[@"intensity"] intValue]];
[self.mapView addAnnotation:annotation];
} else if ([userInfo[@"type"] isEqualToString:@"manual"]){
EQNMapAnnotationSeismicNetwork *annotation = [[EQNMapAnnotationSeismicNetwork 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
if ([annotation isKindOfClass:[PastquakesAnnotation class]]) {
PastquakesAnnotation *anLocation = (PastquakesAnnotation *)annotation;
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:IDENTIFIER_ANNOTATION_PASTQUAKES];
if (annotationView == nil)
annotationView = anLocation.annotationView;
else
annotationView.annotation = anLocation;
return annotationView;
}
else if ([annotation isKindOfClass:[ReteSismicaAnnotation class]]) {
ReteSismicaAnnotation *anLocation = (ReteSismicaAnnotation *)annotation;
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:IDENTIFIER_ANNOTATION_RETESMARTPHONE];
if (annotationView == nil)
annotationView = anLocation.annotationView;
else
annotationView.annotation = anLocation;
return annotationView;
}
// 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:[EQNMapAnnotationPastquakes class]]) {
EQNMapAnnotationPastquakes *anLocation = (EQNMapAnnotationPastquakes *)annotation;
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:EQNMapAnnotationPastquakesIdentifier];
if (annotationView == nil) {
annotationView = anLocation.annotationView;
} else {
annotationView.annotation = anLocation;
}
return annotationView;
} else if ([annotation isKindOfClass:[EQNMapAnnotationSeismicNetwork class]]) {
EQNMapAnnotationSeismicNetwork *anLocation = (EQNMapAnnotationSeismicNetwork *)annotation;
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:EQNMapAnnotationSeismicNetworkIdentifier];
if (annotationView == nil) {
annotationView = anLocation.annotationView;
} else {
annotationView.annotation = anLocation;
}
return annotationView;
}
return nil;
}
@end
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Some files were not shown because too many files have changed in this diff Show More