Skip to content

Commit

Permalink
merged from master
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaroti9 committed Jun 2, 2024
2 parents 9ea99d5 + 74dd095 commit 4637de0
Show file tree
Hide file tree
Showing 17 changed files with 486 additions and 163 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode 35
versionName "2.3.8"
versionCode 37
versionName "2.3.10"
}

buildTypes {
Expand Down
Binary file removed assets/backdrops/overcast3.jpg
Binary file not shown.
Binary file removed assets/backdrops/thunderstorm3.jpg
Binary file not shown.
Binary file added assets/backdrops/thunderstorm4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions lib/decoders/decode_OM.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ class OMCurrent {
final int feels_like;
final int uv;
final double precip;

final int wind;
final int wind_dir;

final Color backcolor;
final Color primary;
Expand Down Expand Up @@ -146,6 +148,7 @@ class OMCurrent {
required this.highlight,
required this.backup_backcolor,
required this.backup_primary,
required this.wind_dir,
});

static OMCurrent fromJson(item, settings, sunstatus, timenow) {
Expand Down Expand Up @@ -197,6 +200,7 @@ class OMCurrent {
humidity: item["current"]["relative_humidity_2m"],
temp: unit_coversion(
item["current"]["temperature_2m"], settings["Temperature"]).round(),
wind_dir: item["current"]["wind_direction_10m"],
);
}
}
Expand All @@ -212,7 +216,10 @@ class OMDay {

final int precip_prob;
final double total_precip;

final int windspeed;
final int wind_dir;

final double mm_precip;
final int uv;

Expand All @@ -229,6 +236,7 @@ class OMDay {
required this.hourly_for_precip,
required this.mm_precip,
required this.uv,
required this.wind_dir,
});

static OMDay build(item, settings, index, sunstatus) {
Expand All @@ -245,6 +253,7 @@ class OMDay {
mm_precip: item["daily"]["precipitation_sum"][index],
hourly_for_precip: buildHours(index, false, item, settings, sunstatus),
hourly: buildHours(index, true, item, settings, sunstatus),
wind_dir: item["daily"]["wind_direction_10m_dominant"][index] ?? 0,
);
}

Expand Down Expand Up @@ -275,7 +284,6 @@ class OMHour {
final String text;
final double precip;
final double wind;
final int wind_dir;

const OMHour({
required this.temp,
Expand All @@ -284,7 +292,6 @@ class OMHour {
required this.text,
required this.precip,
required this.wind,
required this.wind_dir,
});

static OMHour fromJson(item, index, settings, sunstatus) => OMHour(
Expand All @@ -296,6 +303,5 @@ class OMHour {
time: settings["Time mode"] == '12 hour'? oMamPmTime(item["hourly"]["time"][index]) : oM24hour(item["hourly"]["time"][index]),
precip: unit_coversion(item["hourly"]["precipitation"][index], settings["Precipitation"]),
wind: unit_coversion(item["hourly"]["wind_speed_10m"][index], settings["Wind"]),
wind_dir: item["hourly"]["wind_direction_10m"][index],
);
}
17 changes: 17 additions & 0 deletions lib/decoders/decode_wapi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ import 'extra_info.dart';

bool RandomSwitch = false;

int wapiGetWindDir(var data) {
int total = 0;
for (var i = 0; i < data.length; i++) {
int x = data[i]["wind_degree"];
total += x;
}
return (total / data.length).round();
}

String amPmTime(String time) {
List<String> splited = time.split(" ");
List<String> num = splited[0].split(":");
Expand Down Expand Up @@ -203,7 +212,9 @@ class WapiCurrent {
final int feels_like;
final int uv;
final double precip;

final int wind;
final int wind_dir;

final Color backcolor;
final Color primary;
Expand Down Expand Up @@ -232,6 +243,7 @@ class WapiCurrent {
required this.backup_primary,
required this.backup_backcolor,
required this.colorpop,
required this.wind_dir,
});

static WapiCurrent fromJson(item, settings) {
Expand Down Expand Up @@ -284,6 +296,7 @@ class WapiCurrent {
settings["Precipitation"]).toStringAsFixed(1)),
wind: unit_coversion(item["current"]["wind_kph"], settings["Wind"])
.round(),
wind_dir: item["current"]["wind_degree"]
);
}
}
Expand All @@ -302,6 +315,8 @@ class WapiDay {
final int uv;
final mm_precip;

final int wind_dir;

const WapiDay({
required this.text,
required this.icon,
Expand All @@ -315,6 +330,7 @@ class WapiDay {
required this.windspeed,
required this.hourly_for_precip,
required this.mm_precip,
required this.wind_dir,
});

static WapiDay fromJson(item, index, settings, timenow) => WapiDay(
Expand All @@ -336,6 +352,7 @@ class WapiDay {
precip_prob: item["day"]["daily_chance_of_rain"],
windspeed: unit_coversion(item["day"]["maxwind_kph"], settings["Wind"]).round(),
uv: item["day"]["uv"].round(),
wind_dir: wapiGetWindDir(item["hour"])
);

static List<WapiHour> buildWapiHour(data, settings, int index, int timenow, bool get_rid_first) {
Expand Down
16 changes: 13 additions & 3 deletions lib/decoders/extra_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class WeatherData {
final sunstatus;
final radar;

final fetch_datetime;

WeatherData({
required this.place,
required this.settings,
Expand All @@ -69,6 +71,7 @@ class WeatherData {
required this.radar,
required this.days,
required this.current,
required this.fetch_datetime,
});

static Future<WeatherData> getFullData(settings, placeName, real_loc, latlong, provider) async {
Expand All @@ -89,6 +92,9 @@ class WeatherData {

var file = await cacheManager2.getSingleFile(url.toString(), key: "$real_loc, weatherapi.com")
.timeout(const Duration(seconds: 6));

DateTime fetch_datetime = await file.lastModified();

var response = await file.readAsString();

var wapi_body = jsonDecode(response);
Expand Down Expand Up @@ -120,15 +126,17 @@ class WeatherData {
sunstatus: sunstatus,
aqi: WapiAqi.fromJson(wapi_body),
radar: await RainviewerRadar.getData(),

fetch_datetime: fetch_datetime,
);
}
else {
final oMParams = {
"latitude": lat.toString(),
"longitude": lng.toString(),
"current": ["temperature_2m", "relative_humidity_2m", "apparent_temperature", "weather_code", "wind_speed_10m"],
"hourly": ["temperature_2m", "precipitation", "weather_code", "wind_speed_10m", "wind_direction_10m"],
"daily": ["weather_code", "temperature_2m_max", "temperature_2m_min", "uv_index_max", "precipitation_sum", "precipitation_probability_max", "wind_speed_10m_max"],
"current": ["temperature_2m", "relative_humidity_2m", "apparent_temperature", "weather_code", "wind_speed_10m", 'wind_direction_10m'],
"hourly": ["temperature_2m", "precipitation", "weather_code", "wind_speed_10m"],
"daily": ["weather_code", "temperature_2m_max", "temperature_2m_min", "uv_index_max", "precipitation_sum", "precipitation_probability_max", "wind_speed_10m_max", "wind_direction_10m_dominant"],
"timezone": "auto",
"forecast_days": "14"
};
Expand Down Expand Up @@ -159,6 +167,8 @@ class WeatherData {
settings: settings,
provider: "open-meteo",
real_loc: real_loc,

fetch_datetime: fetch_datetime,
);
}
}
Expand Down
11 changes: 6 additions & 5 deletions lib/donation_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class _InfoPageState extends State<InfoPage> {
Widget build(BuildContext context) {

List<Color> colors = getColors(primary, back, settings, 0);
Color link = colors[1];

return Scaffold(
backgroundColor: colors[0],
Expand Down Expand Up @@ -345,7 +346,7 @@ class _InfoPageState extends State<InfoPage> {
'https://github.com/bmaroti9/Overmorrow');
},
child: comfortatext('source code', 20, settings,
color: Colors.orange)),
color: link)),
),
)
],
Expand Down Expand Up @@ -376,20 +377,20 @@ class _InfoPageState extends State<InfoPage> {
'https://open-meteo.com');
},
child: comfortatext('open-meteo.com', 20, settings,
color: Colors.orange)),
color: link)),
TextButton(
onPressed: () async {
await _launchUrl(
'https://www.rainviewer.com/api.html');
},
child: comfortatext('www.rainviewer.com', 20, settings,
color: Colors.orange)),
color: link)),
TextButton(
onPressed: () async {
await _launchUrl('https://www.weatherapi.com/');
},
child: comfortatext('www.weatherapi.com', 20, settings,
color: Colors.orange))
color: link))
]),
),
),
Expand Down Expand Up @@ -431,7 +432,7 @@ class _InfoPageState extends State<InfoPage> {
translation(
imageText[index], settings["Language"]),
20, settings,
color: Colors.orange),
color: link),
),
),
);
Expand Down
Loading

0 comments on commit 4637de0

Please sign in to comment.