From 81a0d54a569c3baa15cbd9ffc4ce6b881f7cd365 Mon Sep 17 00:00:00 2001 From: "Vicente J. Ruiz Jurado" Date: Wed, 15 Aug 2018 07:03:30 +0200 Subject: [PATCH] More work with fire alerts --- lib/fireAlert.dart | 27 +++++++++++++++++++++++++-- lib/generated/i18n.dart | 12 ++++++++++++ res/values/strings_en.arb | 6 +++++- res/values/strings_es.arb | 6 +++++- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/lib/fireAlert.dart b/lib/fireAlert.dart index 80e78c7..3fd2322 100644 --- a/lib/fireAlert.dart +++ b/lib/fireAlert.dart @@ -33,6 +33,22 @@ class _FireAlertState extends State { ); } + Widget buildNotifyNeighboursButton() { + return new Align( + alignment: const Alignment(0.0, -0.2), + child: new FloatingActionButton( + heroTag: 'neighAction', + child: const Icon(CommunityMaterialIcons.bullhorn), + onPressed: () { + _scaffoldKey.currentState.showSnackBar(new SnackBar( + content: new Text(S.of(context).inDevelopment), + )); + }, + ), + ); + } + + Widget buildTweetButton() { return new Align( alignment: const Alignment(0.0, -0.2), @@ -46,7 +62,7 @@ class _FireAlertState extends State { String where = yourLocation.description.replaceAll(' ', '').split(',')[0]; print(where); - Share.share('#IF${where} FIXME'); + Share.share(S.of(context).tweetAboutSelf(yourLocation.description, '#IF${where}')); }).catchError((onError) { _scaffoldKey.currentState.showSnackBar(new SnackBar( content: new Text( @@ -65,12 +81,19 @@ class _FireAlertState extends State { List fireSteps = listWithoutNulls([ new CustomStep( title: new Text(S.of(context).callEmergencyServicesTitle), - // subtitle: content: new Column(children: [ new Text(S.of(context).callEmergencyServicesDescription), new SizedBox(height: 20.0), buildCallButton() ])), + new CustomStep( + title: new Text(S.of(context).notifyNeighbours), + // state: CustomStepState.disabled, + content: new Column(children: [ + new Text(S.of(context).notifyNeighboursDescription), + new SizedBox(height: 20.0), + buildNotifyNeighboursButton() + ])), // TODO conditional: this only in Spain new CustomStep( title: new Text(S.of(context).tweetAboutAFireTitle), diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 878899b..b43f6e0 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -59,6 +59,7 @@ class S implements WidgetsLocalizations { String get firesInYourPlaces => "Active fires in your places"; String get firesNearPlace => "Fires near other place"; String get getAlertsOfFiresinThatArea => "Get alerts of fires in that area"; + String get inDevelopment => "In development"; String get inGreenMonitoredAreas => "In green, the areas monitored by our users currently"; String get isYourUbicationEnabled => "I cannot get your current location. It's your ubication enabled?"; String get itSeemsAControlledBurning => "It's a controlled burning"; @@ -72,6 +73,8 @@ class S implements WidgetsLocalizations { String get notAWildfire => "Isn't that a forest fire?"; String get notPermsUbication => "We don't have permission to get your location"; String get notifyAFire => "Notify a fire"; + String get notifyNeighbours => "Notify other users"; + String get notifyNeighboursDescription => "Alert other users of the area about the fire"; String get privacyPolicy => "Privacy Policy"; String get shareAppBtn => "Share our app"; String get starAppBtn => "Rate our app"; @@ -103,6 +106,7 @@ class S implements WidgetsLocalizations { String noFiresAroundThisArea(String kmAround) => "There is no fires at $kmAround км around this area"; String somethingAgo(String something) => "$something ago"; String subscribeToValueAroundThisArea(String sliderValue) => "Subscribe to $sliderValue км around this area"; + String tweetAboutSelf(String location, String hash) => "Fire in $location $hash"; String updatedLastCheck(String lastCheck) => "Updated $lastCheck"; } @@ -185,6 +189,10 @@ class es extends S { @override String get UNDO => "DESHACER"; @override + String get notifyNeighbours => "Notifica a otros usuarios/as"; + @override + String get inDevelopment => "En desarrollo"; + @override String get tweetAboutAFireTitle => "Twittea"; @override String get supportPageDescription => "Puedes apoyar esta iniciativa, dando difusión, ayudándonos a desarrollar nuestro software, traduciendo esta aplicación a tu idioma, sugeriendo otras fuentes de datos públicas de fuegos para usar, etc."; @@ -235,6 +243,8 @@ class es extends S { @override String get firesInTheWorld => "Fuegos en el mundo"; @override + String get notifyNeighboursDescription => "Alerta a otros usuarios de la zona sobre el fuego"; + @override String get addSomePlace => "Añade otro lugar"; @override String get confirm => "Confirmar"; @@ -267,6 +277,8 @@ class es extends S { @override String somethingAgo(String something) => "hace $something"; @override + String tweetAboutSelf(String location, String hash) => "Fuego en $location $hash"; + @override String subscribeToValueAroundThisArea(String sliderValue) => "Suscríbete a $sliderValue км a la redonda"; @override String inHours(String value) => "$value horas"; diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 94c89eb..9e4e49f 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -53,8 +53,11 @@ "errorFirePlaceDialog": "We couldn't get the location of the fire", "callEmergencyServicesTitle": "Call 112", "callEmergencyServicesDescription": "You should call 112 if you have not already done so to notify the emergency services.", + "notifyNeighbours": "Notify other users", + "notifyNeighboursDescription": "Alert other users of the area about the fire", "tweetAboutAFireTitle": "Tweet about", "tweetAboutAFireDescription": "Additionally if you use twitter you can share additional information with the emergency services, for example, attaching photos to the tweet if you have good visibility of the fire, when you took the photos, exact location, etc. Use #hashtags type #IFMinicipalTerminal for example #IFJumilla (Forest Fire in Jumilla).", + "tweetAboutSelf": "Fire in $location $hash", "supportPageDescription": "You can support this initiative, spreading the word, helping us to develop our software, translating this app to your language, suggesting other public data sources of fires to use, etc.", "fireNotificationsTitleShort": "Notifications", "fireNotificationsTitle": "Fire Notifications", @@ -81,5 +84,6 @@ "shareAppBtn": "Share our app", "starAppBtn": "Rate our app", "unsubscribedToFires": "Unsubscribed to fires notifications", - "subscribedToFires": "Subscribed to fires notifications" + "subscribedToFires": "Subscribed to fires notifications", + "inDevelopment": "In development" } \ No newline at end of file diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 04b646e..96e0cb9 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -53,8 +53,11 @@ "errorFirePlaceDialog": "No hemos podido obtener la ubicación del fuego", "callEmergencyServicesTitle": "Llama al 112", "callEmergencyServicesDescription": "Deberías llamar al 112 si no lo has hecho ya para avisar a los servicios de emergencia.", + "notifyNeighbours": "Notifica a otros usuarios/as", + "notifyNeighboursDescription": "Alerta a otros usuarios de la zona sobre el fuego", "tweetAboutAFireTitle": "Twittea", "tweetAboutAFireDescription": "Adicionalmente si usas twitter puedes compartir información adicional con los servicios de emergencia, por ejemplo, adjuntando fotos al tweet si tienes buena visibilidad del fuego, cuando tomaste las fotos, ubicación exacta, etc. Usa #hashtags tipo #IFTerminoMunicipal por ejemplo #IFJumilla (Incendio Forestal en Jumilla).", + "tweetAboutSelf": "Fuego en $location $hash", "supportPageDescription": "Puedes apoyar esta iniciativa, dando difusión, ayudándonos a desarrollar nuestro software, traduciendo esta aplicación a tu idioma, sugeriendo otras fuentes de datos públicas de fuegos para usar, etc.", "fireNotificationsTitle": "Notificaciones de fuegos", "fireNotificationTitle": "Notificación de fuego", @@ -81,5 +84,6 @@ "shareAppBtn": "Comparte nuestra app", "starAppBtn": "Puntúa nuestra app", "unsubscribedToFires": "Desuscrito a notificaciones de fuegos", - "subscribedToFires": "Suscrito a notificaciones de fuegos" + "subscribedToFires": "Suscrito a notificaciones de fuegos", + "inDevelopment": "En desarrollo" } \ No newline at end of file