Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-08-17 04:51:11 +00:00
commit 91d94bd853
14 changed files with 139 additions and 53 deletions

View file

@ -30,8 +30,8 @@ android {
applicationId "org.comunes.fires"
minSdkVersion 16
targetSdkVersion 27
versionCode 7
versionName "1.7"
versionCode 8
versionName "1.8"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

View file

@ -16,7 +16,7 @@
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="All Against The Fire!"
android:label="@string/app_name"
android:icon="@mipmap/launch_image">
<activity
android:name=".MainActivity"
@ -31,7 +31,7 @@
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true"/>
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">¡Tod@s contra el Fuego!</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Tod@s contra o Lume!</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">All Against The Fire!</string>
</resources>

View file

@ -5,10 +5,10 @@ import 'package:fires_flutter/models/yourLocation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_fab_dialer/flutter_fab_dialer.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:redux/src/store.dart';
import 'colors.dart';
import 'firesSpinner.dart';
import 'generated/i18n.dart';
import 'genericMap.dart';
import 'globalFiresBottomStats.dart';
@ -17,7 +17,6 @@ import 'mainDrawer.dart';
import 'models/appState.dart';
import 'placesAutocompleteUtils.dart';
import 'redux/actions.dart';
import 'firesSpinner.dart';
@immutable
class _ViewModel {
@ -95,6 +94,10 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
onPressed: () {
loc.subscribed = !loc.subscribed;
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)),
subtitle: loc.currentNumFires == YourLocation.withoutStats
@ -102,12 +105,16 @@ class _ActiveFiresPageState extends State<ActiveFiresPage> {
: loc.currentNumFires == 0
? new Text(S.of(context).noFiresAround)
: loc.currentNumFires == 1
? new Text(S
.of(context)
.fireAroundThisArea(loc.distance.toString()), style: fireStatsStyle)
: new Text(S.of(context).firesAroundThisArea(
loc.currentNumFires.toString(),
loc.distance.toString()), style: fireStatsStyle),
? new Text(
S
.of(context)
.fireAroundThisArea(loc.distance.toString()),
style: fireStatsStyle)
: new Text(
S.of(context).firesAroundThisArea(
loc.currentNumFires.toString(),
loc.distance.toString()),
style: fireStatsStyle),
onLongPress: () {
showSnackMsg(S.of(context).toDeleteThisPlace);
},

View file

@ -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() {
return new Align(
alignment: const Alignment(0.0, -0.2),
@ -46,7 +62,7 @@ class _FireAlertState extends State<FireAlert> {
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<FireAlert> {
List<CustomStep> fireSteps = listWithoutNulls(<CustomStep>[
new CustomStep(
title: new Text(S.of(context).callEmergencyServicesTitle),
// subtitle:
content: new Column(children: <Widget>[
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: <Widget>[
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),

View file

@ -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,9 +73,12 @@ 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";
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 supportThisInitiative => "Support this initiative";
String get thanksForParticipating => "Thanks for participating";
@ -85,6 +89,7 @@ class S implements WidgetsLocalizations {
String get tweetAboutAFireTitle => "Tweet about";
String get typeTheNameOfAPlace => "Type the name of a place, region, etc";
String get unsubscribe => "Unsubscribe";
String get unsubscribedToFires => "Unsubscribed to fires notifications";
String get warningThisIsAVeryLargeArea => "Warning: this is a very large area";
String get youDeletedThisNotification => "You deleted this notification";
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 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";
}
@ -177,10 +183,16 @@ class es extends S {
@override
String get aYear => "un año";
@override
String get unsubscribedToFires => "Desuscrito a notificaciones de fuegos";
@override
String get itSeemsNotAtForesFire => "Parece que este fuego no es un fuego forestal.";
@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.";
@ -193,6 +205,8 @@ class es extends S {
@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.";
@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?";
@override
String get thanksForParticipating => "Gracias por Participar";
@ -229,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";
@ -261,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";

View file

@ -388,19 +388,19 @@ class _genericMapState extends State<genericMap> {
falsePosList.forEach((falsePos) {
var coords = falsePos['geo']['coordinates'];
// 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));
if (calibrate) markers.add(FireMarker(loc, FireMarkType.pixel));
});
industries.forEach((industry) {
// print(fire['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));
if (calibrate) markers.add(FireMarker(loc, FireMarkType.pixel));
});
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(
FireMarker(loc, FireMarkType.fire, () => print('marker pressed')));
markers.add(FireMarker(loc, FireMarkType.pixel));

View file

@ -84,14 +84,14 @@ class _HomePageState extends State<HomePage> {
super.initState();
_firebaseMessaging.configure(onMessage: (Map<String, dynamic> 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) {
debugPrint("onLaunch (isLoaded: ${store.state.isLoaded}): $message");
_notifForMessage(message);
_notifForMessage(message, store.state.isLoaded);
_navigateToItemDetail(message);
}, onResume: (Map<String, dynamic> message) {
debugPrint("onResume (isLoaded: ${store.state.isLoaded}): $message");
_notifForMessage(message);
_notifForMessage(message, store.state.isLoaded);
_navigateToItemDetail(message);
});
_firebaseMessaging.requestNotificationPermissions(
@ -282,7 +282,7 @@ class _HomePageState extends State<HomePage> {
// https://pub.dartlang.org/packages/firebase_messaging#-example-tab-
final FirebaseMessaging _firebaseMessaging = new FirebaseMessaging();
FireNotification _notifForMessage(Map<String, dynamic> message) {
FireNotification _notifForMessage(Map<String, dynamic> message, bool isLoaded) {
FireNotification notif;
try {
notif = new FireNotification(
@ -299,7 +299,12 @@ class _HomePageState extends State<HomePage> {
debugPrint(e.toString());
}
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;
}
}

View file

@ -192,7 +192,7 @@ class FiresApi {
"token": state.firesApiKey,
"mobileToken": mobileToken,
"sealed": sealed,
"type": type.toString()
"type": type.toString().split('.')[1]
};
final String url = '${state.firesApiUrl}mobile/falsepositive';
return await resty.post(url).json(params).go().then((response) {

View file

@ -58,6 +58,7 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
store.dispatch(new AddedYourLocationAction(action.loc));
persistYourLocations(store.state.yourLocations);
}
getFiresStatsInLocation(store, action.loc);
}
if (action is DeleteYourLocationAction) {
@ -87,13 +88,7 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
}
if (action is ShowYourLocationMapAction) {
api
.getFiresInLocation(
state: store.state,
lat: action.loc.lat,
lon: action.loc.lon,
distance: action.loc.distance)
.then((result) => store.dispatch(result));
getFiresStatsInLocation(store, action.loc);
}
if (action is ShowFireNotificationMapAction) {
@ -111,9 +106,6 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
lon: action.loc.lon,
distance: action.loc.distance)
.then((result) => store.dispatch(result)));
else {
// FIXME do something?
}
store.dispatch(new UpdatedYourLocationAction(action.loc));
persistYourLocations(store.state.yourLocations);
}
@ -150,12 +142,12 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
if (action is FetchYourLocationsAction) {
// Use the api to fetch the YourLocations
loadYourLocations().then((localLocations) {
api
.fetchYourLocations(store.state)
.then((List<YourLocation> subscribedLocations) {
// If it succeeds, dispatch a success action with the YourLocations.
// Our reducer will then update the State using these YourLocations.
// print('Subscribed to: ${subscribedLocations.length}');
api
.fetchYourLocations(store.state)
.then((List<YourLocation> subscribedLocations) {
// If it succeeds, dispatch a success action with the YourLocations.
// Our reducer will then update the State using these YourLocations.
// print('Subscribed to: ${subscribedLocations.length}');
if (subscribedLocations is List) {
// unsubscribe all locally to sync the subs state
localLocations.forEach((location) => location.subscribed = false);
@ -173,12 +165,12 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
localLocations.forEach((yl) {
api
.getFiresInLocation(
state: store.state,
lat: yl.lat,
lon: yl.lon,
distance: yl.distance)
.then((value) {
.getFiresInLocation(
state: store.state,
lat: yl.lat,
lon: yl.lon,
distance: yl.distance)
.then((value) {
yl.currentNumFires = value.numFires;
store.dispatch(new UpdateYourLocationAction(yl));
});
@ -211,18 +203,21 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
}
if (action is FetchMonitoredAreasAction) {
api.getMonitoredAreas(state: store.state).then((result) { // store.dispatch()
store.dispatch(
new FetchMonitoredAreasSucceededAction(result));
});
api.getMonitoredAreas(state: store.state).then((result) {
// store.dispatch()
store.dispatch(new FetchMonitoredAreasSucceededAction(result));
});
}
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) {
// Not necessary
// store.dispatch(new UpdatedFireNotificationAction(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);
}
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) {
api
.getFiresInLocation(

View file

@ -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",
@ -79,5 +82,8 @@
"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",
"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"
}

View file

@ -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",
@ -79,5 +82,8 @@
"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",
"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"
}