Skip to content

Commit

Permalink
Merge pull request #189 from covid19cuba/develop
Browse files Browse the repository at this point in the history
Release v0.6.0
  • Loading branch information
leynier authored Apr 23, 2020
2 parents 4584e76 + e1fa112 commit a3c2bde
Show file tree
Hide file tree
Showing 86 changed files with 166,125 additions and 938 deletions.
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
tools:replace="android:label"
android:name="io.flutter.app.FlutterApplication"
android:label="Covid19 Cuba Data"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">

<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
Expand Down
Binary file added assets/images/marker-icon-2x-gold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/marker-icon-2x-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/marker-shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 69 additions & 7 deletions assets/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ function logx(base, x){
return Math.log10(x)/Math.log10(base);
}

var openIcon = new L.Icon({
iconUrl: 'images/marker-icon-2x-gold.png',
shadowUrl: 'images/marker-shadow.png',
iconSize: [15, 24],
iconAnchor: [7, 24],
popupAnchor: [1, -34],
shadowSize: [24, 24]
});

var closeIcon = new L.Icon({
iconUrl: 'images/marker-icon-2x-green.png',
shadowUrl: 'images/marker-shadow.png',
iconSize: [15, 24],
iconAnchor: [7, 24],
popupAnchor: [1, -34],
shadowSize: [24, 24]
});

var map_mun = L.map('map-mun', {
center: [21.5, -79.371124],
zoom: 15,
Expand All @@ -22,7 +40,15 @@ var map_mun = L.map('map-mun', {
map_mun.zoomControl.setPosition('topright');
geojsonM = null;

covidData = function (data) {
function getMarkerProfile(title, pro, mun) {
var t = '';
t += '<div class="small-pname"><span class="bd">' + title + '</span></div>';
t += '<div class="small-content"><span class="bd">' + pro + '</span> - <span>' + mun + '</span></div>';
t += '<div class="small-plink">&nbsp;</div>';
return t;
}

covidData = function (data, events) {

var factor = 100;
var muns = data.muns;
Expand Down Expand Up @@ -71,13 +97,29 @@ covidData = function (data) {
return '#D1D2D4';
}

for(var i in events){
event = events[i];
if(event['lat']===0 && event['lon']===0){
continue;
}
if(event['abierto']===false){
var marker = L.marker([event['lat'],event['lon']],{icon: closeIcon,
title: event['identificador'], riseOnHover: true}).addTo(map_mun);
}else{
var marker = L.marker([event['lat'],event['lon']],{icon: openIcon,
title: event['identificador'], riseOnHover: true}).addTo(map_mun);
}
marker.bindPopup(getMarkerProfile(event['identificador'],event['provincia'],event['municipio']));

}

map_mun.addLayer(geojsonM);
let ratio = (geojsonM.getBounds().getNorthEast().lat - geojsonM.getBounds().getSouthWest().lat) * 0.08;
map_mun.fitBounds(geojsonM.getBounds());
map_mun.setMaxBounds(geojsonM.getBounds());

//map_mun.setMaxBounds(geojsonM.getBounds().pad(ratio));
}

covidData2 = function (data) {
covidData2 = function (data, events) {

var factor = 100;
var pros = data.pros;
Expand Down Expand Up @@ -126,8 +168,9 @@ covidData2 = function (data) {
}

map_mun.addLayer(geojsonM);
let ratio = (geojsonM.getBounds().getNorthEast().lat - geojsonM.getBounds().getSouthWest().lat) * 0.05;
map_mun.fitBounds(geojsonM.getBounds());
map_mun.setMaxBounds(geojsonM.getBounds());
//map_mun.setMaxBounds(geojsonM.getBounds().pad(ratio));
}


Expand All @@ -144,7 +187,7 @@ filterByProvince = function (province_id, data) {
return ret;
}

covidData3 = function (data, province_id) {
covidData3 = function (data, province_id, events) {
var municipalitydata = JSON.parse(strGeoJson);
var factor = 100;
var muns = data.muns;
Expand Down Expand Up @@ -202,7 +245,26 @@ covidData3 = function (data, province_id) {
return '#D1D2D4';
}

for(var i in events){
event = events[i];
if(event['dpacode_provincia']===province_id){

if(event['lat']===0 && event['lon']===0){
continue;
}
if(event['abierto']===false){
var marker = L.marker([event['lat'],event['lon']],{icon: closeIcon,
title: event['identificador'], riseOnHover: true}).addTo(map_mun);
}else{
var marker = L.marker([event['lat'],event['lon']],{icon: openIcon,
title: event['identificador'], riseOnHover: true}).addTo(map_mun);
}
marker.bindPopup(getMarkerProfile(event['identificador'],event['provincia'],event['municipio']));
}
}

map_mun.addLayer(geojsonM);
let ratio = Math.abs(geojsonM.getBounds().getNorthEast().lat - geojsonM.getBounds().getSouthWest().lat) * 0.2;
map_mun.fitBounds(geojsonM.getBounds());
map_mun.setMaxBounds(geojsonM.getBounds());
//map_mun.setMaxBounds(geojsonM.getBounds().pad(ratio));
}
78,536 changes: 78,531 additions & 5 deletions assets/municipios.geojson

Large diffs are not rendered by default.

82,496 changes: 82,491 additions & 5 deletions assets/provincias.geojson

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
<false/>
<key>UIStatusBarHidden</key>
<true/>

<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
</plist>
1 change: 0 additions & 1 deletion lib/src/blocs/blocs.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export 'changelog_bloc.dart';
export 'home_bloc.dart';
export 'province_bloc.dart';
1 change: 0 additions & 1 deletion lib/src/blocs/events/events.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export 'changelog_events.dart';
export 'home_events.dart';
export 'province_events.dart';
26 changes: 0 additions & 26 deletions lib/src/blocs/events/province_events.dart

This file was deleted.

80 changes: 0 additions & 80 deletions lib/src/blocs/province_bloc.dart

This file was deleted.

34 changes: 0 additions & 34 deletions lib/src/blocs/states/province_states.dart

This file was deleted.

1 change: 0 additions & 1 deletion lib/src/blocs/states/states.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export 'changelog_states.dart';
export 'home_states.dart';
export 'province_states.dart';
9 changes: 7 additions & 2 deletions lib/src/data_providers/cuba_data_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import 'package:preferences/preferences.dart';
import 'package:covid19cuba/src/models/models.dart';
import 'package:covid19cuba/src/utils/utils.dart';

const urlCubaDataCU = 'https://cusobu.nat.cu/covid/api/v1/all.json';
const urlCubaDataCU = 'https://cusobu.nat.cu/covid/api/v1/full.json';
const urlCubaDataIO =
'https://covid19cuba.github.io/covid19cubadata.github.io/api/v1/all.json';
'https://covid19cuba.github.io/covid19cubadata.github.io/api/v1/full.json';

Future<DataModel> getCubaData() async {
var stateList = await StateModel.check();
Expand Down Expand Up @@ -62,6 +62,11 @@ Future<DataModel> getCubaDataFrom(String url) async {
var json = jsonDecode(text);
result = DataModel.fromJson(json);
PrefService.setBool(Constants.prefFirstCacheNotification, true);
PrefService.setBool(Constants.prefFirstModificationNotification, true);
PrefService.setString(
Constants.prefPesquisador,
jsonEncode(result.all.pesquisador.toJson()),
);
} catch (e) {
log(e.toString());
throw ParseException('Parse error');
Expand Down
1 change: 0 additions & 1 deletion lib/src/data_providers/data_providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ export 'cuba_data_provider.dart';
export 'info_update_provider.dart';
export 'news_provider.dart';
export 'notifications_data_provider.dart';
export 'province_data_provider.dart';
export 'state_provider.dart';
61 changes: 0 additions & 61 deletions lib/src/data_providers/province_data_provider.dart

This file was deleted.

Loading

0 comments on commit a3c2bde

Please sign in to comment.