Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
91d94bd853
14 changed files with 139 additions and 53 deletions
|
|
@ -30,8 +30,8 @@ android {
|
||||||
applicationId "org.comunes.fires"
|
applicationId "org.comunes.fires"
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 7
|
versionCode 8
|
||||||
versionName "1.7"
|
versionName "1.8"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
FlutterApplication and put your custom class here. -->
|
FlutterApplication and put your custom class here. -->
|
||||||
<application
|
<application
|
||||||
android:name="io.flutter.app.FlutterApplication"
|
android:name="io.flutter.app.FlutterApplication"
|
||||||
android:label="All Against The Fire!"
|
android:label="@string/app_name"
|
||||||
android:icon="@mipmap/launch_image">
|
android:icon="@mipmap/launch_image">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
defined in @style/LaunchTheme). -->
|
defined in @style/LaunchTheme). -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
|
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
|
||||||
android:value="true"/>
|
android:value="true" />
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
|
|
||||||
4
android/app/src/main/res/values-es/strings.xml
Normal file
4
android/app/src/main/res/values-es/strings.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">¡Tod@s contra el Fuego!</string>
|
||||||
|
</resources>
|
||||||
4
android/app/src/main/res/values-gl/strings.xml
Normal file
4
android/app/src/main/res/values-gl/strings.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Tod@s contra o Lume!</string>
|
||||||
|
</resources>
|
||||||
4
android/app/src/main/res/values/strings.xml
Normal file
4
android/app/src/main/res/values/strings.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">All Against The Fire!</string>
|
||||||
|
</resources>
|
||||||
|
|
@ -5,10 +5,10 @@ import 'package:fires_flutter/models/yourLocation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_fab_dialer/flutter_fab_dialer.dart';
|
import 'package:flutter_fab_dialer/flutter_fab_dialer.dart';
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
|
||||||
import 'package:redux/src/store.dart';
|
import 'package:redux/src/store.dart';
|
||||||
|
|
||||||
import 'colors.dart';
|
import 'colors.dart';
|
||||||
|
import 'firesSpinner.dart';
|
||||||
import 'generated/i18n.dart';
|
import 'generated/i18n.dart';
|
||||||
import 'genericMap.dart';
|
import 'genericMap.dart';
|
||||||
import 'globalFiresBottomStats.dart';
|
import 'globalFiresBottomStats.dart';
|
||||||
|
|
@ -17,7 +17,6 @@ import 'mainDrawer.dart';
|
||||||
import 'models/appState.dart';
|
import 'models/appState.dart';
|
||||||
import 'placesAutocompleteUtils.dart';
|
import 'placesAutocompleteUtils.dart';
|
||||||
import 'redux/actions.dart';
|
import 'redux/actions.dart';
|
||||||
import 'firesSpinner.dart';
|
|
||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
class _ViewModel {
|
class _ViewModel {
|
||||||
|
|
@ -95,6 +94,10 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
loc.subscribed = !loc.subscribed;
|
loc.subscribed = !loc.subscribed;
|
||||||
onToggle(loc);
|
onToggle(loc);
|
||||||
|
setState(() {});
|
||||||
|
showSnackMsg(loc.subscribed
|
||||||
|
? S.of(context).subscribedToFires
|
||||||
|
: S.of(context).unsubscribedToFires);
|
||||||
}),
|
}),
|
||||||
title: new Text(loc.description, style: new TextStyle(fontSize: 16.0)),
|
title: new Text(loc.description, style: new TextStyle(fontSize: 16.0)),
|
||||||
subtitle: loc.currentNumFires == YourLocation.withoutStats
|
subtitle: loc.currentNumFires == YourLocation.withoutStats
|
||||||
|
|
@ -102,12 +105,16 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
|
||||||
: loc.currentNumFires == 0
|
: loc.currentNumFires == 0
|
||||||
? new Text(S.of(context).noFiresAround)
|
? new Text(S.of(context).noFiresAround)
|
||||||
: loc.currentNumFires == 1
|
: loc.currentNumFires == 1
|
||||||
? new Text(S
|
? new Text(
|
||||||
.of(context)
|
S
|
||||||
.fireAroundThisArea(loc.distance.toString()), style: fireStatsStyle)
|
.of(context)
|
||||||
: new Text(S.of(context).firesAroundThisArea(
|
.fireAroundThisArea(loc.distance.toString()),
|
||||||
loc.currentNumFires.toString(),
|
style: fireStatsStyle)
|
||||||
loc.distance.toString()), style: fireStatsStyle),
|
: new Text(
|
||||||
|
S.of(context).firesAroundThisArea(
|
||||||
|
loc.currentNumFires.toString(),
|
||||||
|
loc.distance.toString()),
|
||||||
|
style: fireStatsStyle),
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
showSnackMsg(S.of(context).toDeleteThisPlace);
|
showSnackMsg(S.of(context).toDeleteThisPlace);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,22 @@ class _FireAlertState extends State<FireAlert> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() {
|
Widget buildTweetButton() {
|
||||||
return new Align(
|
return new Align(
|
||||||
alignment: const Alignment(0.0, -0.2),
|
alignment: const Alignment(0.0, -0.2),
|
||||||
|
|
@ -46,7 +62,7 @@ class _FireAlertState extends State<FireAlert> {
|
||||||
String where =
|
String where =
|
||||||
yourLocation.description.replaceAll(' ', '').split(',')[0];
|
yourLocation.description.replaceAll(' ', '').split(',')[0];
|
||||||
print(where);
|
print(where);
|
||||||
Share.share('#IF${where} FIXME');
|
Share.share(S.of(context).tweetAboutSelf(yourLocation.description, '#IF${where}'));
|
||||||
}).catchError((onError) {
|
}).catchError((onError) {
|
||||||
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||||
content: new Text(
|
content: new Text(
|
||||||
|
|
@ -65,12 +81,19 @@ class _FireAlertState extends State<FireAlert> {
|
||||||
List<CustomStep> fireSteps = listWithoutNulls(<CustomStep>[
|
List<CustomStep> fireSteps = listWithoutNulls(<CustomStep>[
|
||||||
new CustomStep(
|
new CustomStep(
|
||||||
title: new Text(S.of(context).callEmergencyServicesTitle),
|
title: new Text(S.of(context).callEmergencyServicesTitle),
|
||||||
// subtitle:
|
|
||||||
content: new Column(children: <Widget>[
|
content: new Column(children: <Widget>[
|
||||||
new Text(S.of(context).callEmergencyServicesDescription),
|
new Text(S.of(context).callEmergencyServicesDescription),
|
||||||
new SizedBox(height: 20.0),
|
new SizedBox(height: 20.0),
|
||||||
buildCallButton()
|
buildCallButton()
|
||||||
])),
|
])),
|
||||||
|
new CustomStep(
|
||||||
|
title: new Text(S.of(context).notifyNeighbours),
|
||||||
|
// state: CustomStepState.disabled,
|
||||||
|
content: new Column(children: <Widget>[
|
||||||
|
new Text(S.of(context).notifyNeighboursDescription),
|
||||||
|
new SizedBox(height: 20.0),
|
||||||
|
buildNotifyNeighboursButton()
|
||||||
|
])),
|
||||||
// TODO conditional: this only in Spain
|
// TODO conditional: this only in Spain
|
||||||
new CustomStep(
|
new CustomStep(
|
||||||
title: new Text(S.of(context).tweetAboutAFireTitle),
|
title: new Text(S.of(context).tweetAboutAFireTitle),
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ class S implements WidgetsLocalizations {
|
||||||
String get firesInYourPlaces => "Active fires in your places";
|
String get firesInYourPlaces => "Active fires in your places";
|
||||||
String get firesNearPlace => "Fires near other place";
|
String get firesNearPlace => "Fires near other place";
|
||||||
String get getAlertsOfFiresinThatArea => "Get alerts of fires in that area";
|
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 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 isYourUbicationEnabled => "I cannot get your current location. It's your ubication enabled?";
|
||||||
String get itSeemsAControlledBurning => "It's a controlled burning";
|
String get itSeemsAControlledBurning => "It's a controlled burning";
|
||||||
|
|
@ -72,9 +73,12 @@ class S implements WidgetsLocalizations {
|
||||||
String get notAWildfire => "Isn't that a forest fire?";
|
String get notAWildfire => "Isn't that a forest fire?";
|
||||||
String get notPermsUbication => "We don't have permission to get your location";
|
String get notPermsUbication => "We don't have permission to get your location";
|
||||||
String get notifyAFire => "Notify a fire";
|
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 privacyPolicy => "Privacy Policy";
|
||||||
String get shareAppBtn => "Share our app";
|
String get shareAppBtn => "Share our app";
|
||||||
String get starAppBtn => "Rate our app";
|
String get starAppBtn => "Rate our app";
|
||||||
|
String get subscribedToFires => "Subscribed to fires notifications";
|
||||||
String get 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.";
|
String get 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.";
|
||||||
String get supportThisInitiative => "Support this initiative";
|
String get supportThisInitiative => "Support this initiative";
|
||||||
String get thanksForParticipating => "Thanks for participating";
|
String get thanksForParticipating => "Thanks for participating";
|
||||||
|
|
@ -85,6 +89,7 @@ class S implements WidgetsLocalizations {
|
||||||
String get tweetAboutAFireTitle => "Tweet about";
|
String get tweetAboutAFireTitle => "Tweet about";
|
||||||
String get typeTheNameOfAPlace => "Type the name of a place, region, etc";
|
String get typeTheNameOfAPlace => "Type the name of a place, region, etc";
|
||||||
String get unsubscribe => "Unsubscribe";
|
String get unsubscribe => "Unsubscribe";
|
||||||
|
String get unsubscribedToFires => "Unsubscribed to fires notifications";
|
||||||
String get warningThisIsAVeryLargeArea => "Warning: this is a very large area";
|
String get warningThisIsAVeryLargeArea => "Warning: this is a very large area";
|
||||||
String get youDeletedThisNotification => "You deleted this notification";
|
String get youDeletedThisNotification => "You deleted this notification";
|
||||||
String get youDeletedThisPlace => "You deleted this place";
|
String get youDeletedThisPlace => "You deleted this place";
|
||||||
|
|
@ -101,6 +106,7 @@ class S implements WidgetsLocalizations {
|
||||||
String noFiresAroundThisArea(String kmAround) => "There is no fires at $kmAround км around this area";
|
String noFiresAroundThisArea(String kmAround) => "There is no fires at $kmAround км around this area";
|
||||||
String somethingAgo(String something) => "$something ago";
|
String somethingAgo(String something) => "$something ago";
|
||||||
String subscribeToValueAroundThisArea(String sliderValue) => "Subscribe to $sliderValue км around this area";
|
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";
|
String updatedLastCheck(String lastCheck) => "Updated $lastCheck";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,10 +183,16 @@ class es extends S {
|
||||||
@override
|
@override
|
||||||
String get aYear => "un año";
|
String get aYear => "un año";
|
||||||
@override
|
@override
|
||||||
|
String get unsubscribedToFires => "Desuscrito a notificaciones de fuegos";
|
||||||
|
@override
|
||||||
String get itSeemsNotAtForesFire => "Parece que este fuego no es un fuego forestal.";
|
String get itSeemsNotAtForesFire => "Parece que este fuego no es un fuego forestal.";
|
||||||
@override
|
@override
|
||||||
String get UNDO => "DESHACER";
|
String get UNDO => "DESHACER";
|
||||||
@override
|
@override
|
||||||
|
String get notifyNeighbours => "Notifica a otros usuarios/as";
|
||||||
|
@override
|
||||||
|
String get inDevelopment => "En desarrollo";
|
||||||
|
@override
|
||||||
String get tweetAboutAFireTitle => "Twittea";
|
String get tweetAboutAFireTitle => "Twittea";
|
||||||
@override
|
@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.";
|
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.";
|
||||||
|
|
@ -193,6 +205,8 @@ class es extends S {
|
||||||
@override
|
@override
|
||||||
String get NASAAck => "Reconocemos el uso de datos e imágenes de LANCE FIRMS operadas por NASA/GSFC/Earth Science Data and Information System (ESDIS) con fondos proporcionados por NASA/HQ.";
|
String get NASAAck => "Reconocemos el uso de datos e imágenes de LANCE FIRMS operadas por NASA/GSFC/Earth Science Data and Information System (ESDIS) con fondos proporcionados por NASA/HQ.";
|
||||||
@override
|
@override
|
||||||
|
String get subscribedToFires => "Suscrito a notificaciones de fuegos";
|
||||||
|
@override
|
||||||
String get isYourUbicationEnabled => "No podemos saber tu ubicación actual. ¿Están los servicios de ubicación en tu móvil activados?";
|
String get isYourUbicationEnabled => "No podemos saber tu ubicación actual. ¿Están los servicios de ubicación en tu móvil activados?";
|
||||||
@override
|
@override
|
||||||
String get thanksForParticipating => "Gracias por Participar";
|
String get thanksForParticipating => "Gracias por Participar";
|
||||||
|
|
@ -229,6 +243,8 @@ class es extends S {
|
||||||
@override
|
@override
|
||||||
String get firesInTheWorld => "Fuegos en el mundo";
|
String get firesInTheWorld => "Fuegos en el mundo";
|
||||||
@override
|
@override
|
||||||
|
String get notifyNeighboursDescription => "Alerta a otros usuarios de la zona sobre el fuego";
|
||||||
|
@override
|
||||||
String get addSomePlace => "Añade otro lugar";
|
String get addSomePlace => "Añade otro lugar";
|
||||||
@override
|
@override
|
||||||
String get confirm => "Confirmar";
|
String get confirm => "Confirmar";
|
||||||
|
|
@ -261,6 +277,8 @@ class es extends S {
|
||||||
@override
|
@override
|
||||||
String somethingAgo(String something) => "hace $something";
|
String somethingAgo(String something) => "hace $something";
|
||||||
@override
|
@override
|
||||||
|
String tweetAboutSelf(String location, String hash) => "Fuego en $location $hash";
|
||||||
|
@override
|
||||||
String subscribeToValueAroundThisArea(String sliderValue) => "Suscríbete a $sliderValue км a la redonda";
|
String subscribeToValueAroundThisArea(String sliderValue) => "Suscríbete a $sliderValue км a la redonda";
|
||||||
@override
|
@override
|
||||||
String inHours(String value) => "$value horas";
|
String inHours(String value) => "$value horas";
|
||||||
|
|
|
||||||
|
|
@ -388,19 +388,19 @@ class _genericMapState extends State<genericMap> {
|
||||||
falsePosList.forEach((falsePos) {
|
falsePosList.forEach((falsePos) {
|
||||||
var coords = falsePos['geo']['coordinates'];
|
var coords = falsePos['geo']['coordinates'];
|
||||||
// print('false pos: ${coords}');
|
// print('false pos: ${coords}');
|
||||||
var loc = LatLng(coords[1], coords[0]);
|
var loc = LatLng(double.parse(coords[1]), double.parse(coords[0]));
|
||||||
markers.add(FireMarker(loc, FireMarkType.falsePos));
|
markers.add(FireMarker(loc, FireMarkType.falsePos));
|
||||||
if (calibrate) markers.add(FireMarker(loc, FireMarkType.pixel));
|
if (calibrate) markers.add(FireMarker(loc, FireMarkType.pixel));
|
||||||
});
|
});
|
||||||
industries.forEach((industry) {
|
industries.forEach((industry) {
|
||||||
// print(fire['geo']['coordinates']);
|
// print(fire['geo']['coordinates']);
|
||||||
var coords = industry['geo']['coordinates'];
|
var coords = industry['geo']['coordinates'];
|
||||||
var loc = LatLng(coords[1], coords[0]);
|
var loc = LatLng(double.parse(coords[1]), double.parse(coords[0]));
|
||||||
markers.add(FireMarker(loc, FireMarkType.industry));
|
markers.add(FireMarker(loc, FireMarkType.industry));
|
||||||
if (calibrate) markers.add(FireMarker(loc, FireMarkType.pixel));
|
if (calibrate) markers.add(FireMarker(loc, FireMarkType.pixel));
|
||||||
});
|
});
|
||||||
fires.forEach((fire) {
|
fires.forEach((fire) {
|
||||||
var loc = new LatLng(fire['lat'], fire['lon']);
|
var loc = new LatLng(double.parse(fire['lat']), double.parse(fire['lon']));
|
||||||
markers.add(
|
markers.add(
|
||||||
FireMarker(loc, FireMarkType.fire, () => print('marker pressed')));
|
FireMarker(loc, FireMarkType.fire, () => print('marker pressed')));
|
||||||
markers.add(FireMarker(loc, FireMarkType.pixel));
|
markers.add(FireMarker(loc, FireMarkType.pixel));
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,14 @@ class _HomePageState extends State<HomePage> {
|
||||||
super.initState();
|
super.initState();
|
||||||
_firebaseMessaging.configure(onMessage: (Map<String, dynamic> message) {
|
_firebaseMessaging.configure(onMessage: (Map<String, dynamic> message) {
|
||||||
debugPrint("onMessage in fireApp (isLoaded: ${store.state.isLoaded}): $message");
|
debugPrint("onMessage in fireApp (isLoaded: ${store.state.isLoaded}): $message");
|
||||||
_showItemDialog(message, _notifForMessage(message));
|
_showItemDialog(message, _notifForMessage(message, store.state.isLoaded));
|
||||||
}, onLaunch: (Map<String, dynamic> message) {
|
}, onLaunch: (Map<String, dynamic> message) {
|
||||||
debugPrint("onLaunch (isLoaded: ${store.state.isLoaded}): $message");
|
debugPrint("onLaunch (isLoaded: ${store.state.isLoaded}): $message");
|
||||||
_notifForMessage(message);
|
_notifForMessage(message, store.state.isLoaded);
|
||||||
_navigateToItemDetail(message);
|
_navigateToItemDetail(message);
|
||||||
}, onResume: (Map<String, dynamic> message) {
|
}, onResume: (Map<String, dynamic> message) {
|
||||||
debugPrint("onResume (isLoaded: ${store.state.isLoaded}): $message");
|
debugPrint("onResume (isLoaded: ${store.state.isLoaded}): $message");
|
||||||
_notifForMessage(message);
|
_notifForMessage(message, store.state.isLoaded);
|
||||||
_navigateToItemDetail(message);
|
_navigateToItemDetail(message);
|
||||||
});
|
});
|
||||||
_firebaseMessaging.requestNotificationPermissions(
|
_firebaseMessaging.requestNotificationPermissions(
|
||||||
|
|
@ -282,7 +282,7 @@ class _HomePageState extends State<HomePage> {
|
||||||
// https://pub.dartlang.org/packages/firebase_messaging#-example-tab-
|
// https://pub.dartlang.org/packages/firebase_messaging#-example-tab-
|
||||||
final FirebaseMessaging _firebaseMessaging = new FirebaseMessaging();
|
final FirebaseMessaging _firebaseMessaging = new FirebaseMessaging();
|
||||||
|
|
||||||
FireNotification _notifForMessage(Map<String, dynamic> message) {
|
FireNotification _notifForMessage(Map<String, dynamic> message, bool isLoaded) {
|
||||||
FireNotification notif;
|
FireNotification notif;
|
||||||
try {
|
try {
|
||||||
notif = new FireNotification(
|
notif = new FireNotification(
|
||||||
|
|
@ -299,7 +299,12 @@ class _HomePageState extends State<HomePage> {
|
||||||
debugPrint(e.toString());
|
debugPrint(e.toString());
|
||||||
}
|
}
|
||||||
if (notif != null)
|
if (notif != null)
|
||||||
newNotifications.add(notif);
|
// if our store is loaded, we just dispatch the notification, if not, we wait til is loaded
|
||||||
|
if (isLoaded) {
|
||||||
|
store.dispatch(new AddFireNotificationAction(notif));
|
||||||
|
} else {
|
||||||
|
newNotifications.add(notif);
|
||||||
|
}
|
||||||
return notif;
|
return notif;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ class FiresApi {
|
||||||
"token": state.firesApiKey,
|
"token": state.firesApiKey,
|
||||||
"mobileToken": mobileToken,
|
"mobileToken": mobileToken,
|
||||||
"sealed": sealed,
|
"sealed": sealed,
|
||||||
"type": type.toString()
|
"type": type.toString().split('.')[1]
|
||||||
};
|
};
|
||||||
final String url = '${state.firesApiUrl}mobile/falsepositive';
|
final String url = '${state.firesApiUrl}mobile/falsepositive';
|
||||||
return await resty.post(url).json(params).go().then((response) {
|
return await resty.post(url).json(params).go().then((response) {
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
|
||||||
store.dispatch(new AddedYourLocationAction(action.loc));
|
store.dispatch(new AddedYourLocationAction(action.loc));
|
||||||
persistYourLocations(store.state.yourLocations);
|
persistYourLocations(store.state.yourLocations);
|
||||||
}
|
}
|
||||||
|
getFiresStatsInLocation(store, action.loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action is DeleteYourLocationAction) {
|
if (action is DeleteYourLocationAction) {
|
||||||
|
|
@ -87,13 +88,7 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action is ShowYourLocationMapAction) {
|
if (action is ShowYourLocationMapAction) {
|
||||||
api
|
getFiresStatsInLocation(store, action.loc);
|
||||||
.getFiresInLocation(
|
|
||||||
state: store.state,
|
|
||||||
lat: action.loc.lat,
|
|
||||||
lon: action.loc.lon,
|
|
||||||
distance: action.loc.distance)
|
|
||||||
.then((result) => store.dispatch(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action is ShowFireNotificationMapAction) {
|
if (action is ShowFireNotificationMapAction) {
|
||||||
|
|
@ -111,9 +106,6 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
|
||||||
lon: action.loc.lon,
|
lon: action.loc.lon,
|
||||||
distance: action.loc.distance)
|
distance: action.loc.distance)
|
||||||
.then((result) => store.dispatch(result)));
|
.then((result) => store.dispatch(result)));
|
||||||
else {
|
|
||||||
// FIXME do something?
|
|
||||||
}
|
|
||||||
store.dispatch(new UpdatedYourLocationAction(action.loc));
|
store.dispatch(new UpdatedYourLocationAction(action.loc));
|
||||||
persistYourLocations(store.state.yourLocations);
|
persistYourLocations(store.state.yourLocations);
|
||||||
}
|
}
|
||||||
|
|
@ -150,12 +142,12 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
|
||||||
if (action is FetchYourLocationsAction) {
|
if (action is FetchYourLocationsAction) {
|
||||||
// Use the api to fetch the YourLocations
|
// Use the api to fetch the YourLocations
|
||||||
loadYourLocations().then((localLocations) {
|
loadYourLocations().then((localLocations) {
|
||||||
api
|
api
|
||||||
.fetchYourLocations(store.state)
|
.fetchYourLocations(store.state)
|
||||||
.then((List<YourLocation> subscribedLocations) {
|
.then((List<YourLocation> subscribedLocations) {
|
||||||
// If it succeeds, dispatch a success action with the YourLocations.
|
// If it succeeds, dispatch a success action with the YourLocations.
|
||||||
// Our reducer will then update the State using these YourLocations.
|
// Our reducer will then update the State using these YourLocations.
|
||||||
// print('Subscribed to: ${subscribedLocations.length}');
|
// print('Subscribed to: ${subscribedLocations.length}');
|
||||||
if (subscribedLocations is List) {
|
if (subscribedLocations is List) {
|
||||||
// unsubscribe all locally to sync the subs state
|
// unsubscribe all locally to sync the subs state
|
||||||
localLocations.forEach((location) => location.subscribed = false);
|
localLocations.forEach((location) => location.subscribed = false);
|
||||||
|
|
@ -173,12 +165,12 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
|
||||||
|
|
||||||
localLocations.forEach((yl) {
|
localLocations.forEach((yl) {
|
||||||
api
|
api
|
||||||
.getFiresInLocation(
|
.getFiresInLocation(
|
||||||
state: store.state,
|
state: store.state,
|
||||||
lat: yl.lat,
|
lat: yl.lat,
|
||||||
lon: yl.lon,
|
lon: yl.lon,
|
||||||
distance: yl.distance)
|
distance: yl.distance)
|
||||||
.then((value) {
|
.then((value) {
|
||||||
yl.currentNumFires = value.numFires;
|
yl.currentNumFires = value.numFires;
|
||||||
store.dispatch(new UpdateYourLocationAction(yl));
|
store.dispatch(new UpdateYourLocationAction(yl));
|
||||||
});
|
});
|
||||||
|
|
@ -211,18 +203,21 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action is FetchMonitoredAreasAction) {
|
if (action is FetchMonitoredAreasAction) {
|
||||||
api.getMonitoredAreas(state: store.state).then((result) { // store.dispatch()
|
api.getMonitoredAreas(state: store.state).then((result) {
|
||||||
store.dispatch(
|
// store.dispatch()
|
||||||
new FetchMonitoredAreasSucceededAction(result));
|
store.dispatch(new FetchMonitoredAreasSucceededAction(result));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action is MarkFireAsFalsePositiveAction) {
|
if (action is MarkFireAsFalsePositiveAction) {
|
||||||
api.markFalsePositive(store.state, store.state.user.token, action.notif.sealed, action.type).then((result) {
|
api
|
||||||
|
.markFalsePositive(store.state, store.state.user.token,
|
||||||
|
action.notif.sealed, action.type)
|
||||||
|
.then((result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
// Not necessary
|
// Not necessary
|
||||||
// store.dispatch(new UpdatedFireNotificationAction(action.notif));
|
|
||||||
getFiresStatsInFire(store, action.notif);
|
getFiresStatsInFire(store, action.notif);
|
||||||
|
store.dispatch(new UpdatedFireNotificationAction(action.notif));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -231,6 +226,20 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
|
||||||
next(action);
|
next(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getFiresStatsInLocation(Store<AppState> store, YourLocation loc) {
|
||||||
|
api
|
||||||
|
.getFiresInLocation(
|
||||||
|
state: store.state,
|
||||||
|
lat: loc.lat,
|
||||||
|
lon: loc.lon,
|
||||||
|
distance: loc.distance)
|
||||||
|
.then((result) {
|
||||||
|
store.dispatch(result);
|
||||||
|
loc.currentNumFires = result.numFires;
|
||||||
|
store.dispatch(new UpdateYourLocationAction(loc));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void getFiresStatsInFire(Store<AppState> store, FireNotification notif) {
|
void getFiresStatsInFire(Store<AppState> store, FireNotification notif) {
|
||||||
api
|
api
|
||||||
.getFiresInLocation(
|
.getFiresInLocation(
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,11 @@
|
||||||
"errorFirePlaceDialog": "We couldn't get the location of the fire",
|
"errorFirePlaceDialog": "We couldn't get the location of the fire",
|
||||||
"callEmergencyServicesTitle": "Call 112",
|
"callEmergencyServicesTitle": "Call 112",
|
||||||
"callEmergencyServicesDescription": "You should call 112 if you have not already done so to notify the emergency services.",
|
"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",
|
"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).",
|
"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.",
|
"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",
|
"fireNotificationsTitleShort": "Notifications",
|
||||||
"fireNotificationsTitle": "Fire Notifications",
|
"fireNotificationsTitle": "Fire Notifications",
|
||||||
|
|
@ -79,5 +82,8 @@
|
||||||
"mapPrivacy": "In order to preserve the privacy of our users, the reflected data are randomly altered and are only indicative.",
|
"mapPrivacy": "In order to preserve the privacy of our users, the reflected data are randomly altered and are only indicative.",
|
||||||
"comunesSupportBtn": "Know and support our work",
|
"comunesSupportBtn": "Know and support our work",
|
||||||
"shareAppBtn": "Share our app",
|
"shareAppBtn": "Share our app",
|
||||||
"starAppBtn": "Rate our app"
|
"starAppBtn": "Rate our app",
|
||||||
|
"unsubscribedToFires": "Unsubscribed to fires notifications",
|
||||||
|
"subscribedToFires": "Subscribed to fires notifications",
|
||||||
|
"inDevelopment": "In development"
|
||||||
}
|
}
|
||||||
|
|
@ -53,8 +53,11 @@
|
||||||
"errorFirePlaceDialog": "No hemos podido obtener la ubicación del fuego",
|
"errorFirePlaceDialog": "No hemos podido obtener la ubicación del fuego",
|
||||||
"callEmergencyServicesTitle": "Llama al 112",
|
"callEmergencyServicesTitle": "Llama al 112",
|
||||||
"callEmergencyServicesDescription": "Deberías llamar al 112 si no lo has hecho ya para avisar a los servicios de emergencia.",
|
"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",
|
"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).",
|
"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.",
|
"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",
|
"fireNotificationsTitle": "Notificaciones de fuegos",
|
||||||
"fireNotificationTitle": "Notificación de fuego",
|
"fireNotificationTitle": "Notificación de fuego",
|
||||||
|
|
@ -79,5 +82,8 @@
|
||||||
"mapPrivacy": "Para preservar la privacidad de nuestros usuarios/as, los datos reflejados están aleatoriamente alterados y son solo orientativos.",
|
"mapPrivacy": "Para preservar la privacidad de nuestros usuarios/as, los datos reflejados están aleatoriamente alterados y son solo orientativos.",
|
||||||
"comunesSupportBtn": "Conoce y apoya nuestro trabajo",
|
"comunesSupportBtn": "Conoce y apoya nuestro trabajo",
|
||||||
"shareAppBtn": "Comparte nuestra app",
|
"shareAppBtn": "Comparte nuestra app",
|
||||||
"starAppBtn": "Puntúa nuestra app"
|
"starAppBtn": "Puntúa nuestra app",
|
||||||
|
"unsubscribedToFires": "Desuscrito a notificaciones de fuegos",
|
||||||
|
"subscribedToFires": "Suscrito a notificaciones de fuegos",
|
||||||
|
"inDevelopment": "En desarrollo"
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue