From ed64ba07799fd33a76e302bbfc6f3a9e6ab23114 Mon Sep 17 00:00:00 2001 From: Pranshul Date: Sun, 31 Aug 2025 18:53:55 +0530 Subject: [PATCH] updated v2.6.1 --- .../weather_master_app/LocationHelper.kt | 82 +++++++++++------- lib/controllers/home_f.dart | 2 +- lib/models/insights_gen.dart | 10 ++- lib/screens/about_page.dart | 4 +- lib/screens/home.dart | 2 +- lib/widget_background.dart | 3 +- lib/widgets/current_conditions_card.dart | 36 ++------ lib/widgets/daily_card.dart | 2 +- lib/widgets/hourly_card.dart | 2 +- lib/widgets/pollen_card.dart | 2 +- lib/widgets/rain_block.dart | 2 +- lib/widgets/top_summary_block.dart | 2 +- pubspec.yaml | 2 +- .../.gradle/8.9/fileHashes/fileHashes.bin | Bin 28497 -> 28497 bytes .../.gradle/8.9/fileHashes/fileHashes.lock | Bin 17 -> 17 bytes .../8.9/fileHashes/resourceHashesCache.bin | Bin 22475 -> 22509 bytes .../cxx/create_cxx_tasks_38_timing.txt | 24 +++++ 17 files changed, 103 insertions(+), 72 deletions(-) diff --git a/android/app/src/main/kotlin/com/pranshulgg/weather_master_app/LocationHelper.kt b/android/app/src/main/kotlin/com/pranshulgg/weather_master_app/LocationHelper.kt index 41f09ac50..5de1b6e21 100644 --- a/android/app/src/main/kotlin/com/pranshulgg/weather_master_app/LocationHelper.kt +++ b/android/app/src/main/kotlin/com/pranshulgg/weather_master_app/LocationHelper.kt @@ -10,24 +10,26 @@ import android.location.LocationManager import android.os.Bundle import android.os.Handler import android.os.Looper +import android.util.Log import androidx.core.app.ActivityCompat class LocationHelper(private val activity: Activity) { private val locationManager = activity.getSystemService(Context.LOCATION_SERVICE) as LocationManager - // Talks to GPS & network private var pendingCallback: LocationResult? = null private val handler = Handler(Looper.getMainLooper()) + private var listener: LocationListener? = null companion object { private const val LOCATION_REQUEST_CODE = 999 - private const val TIMEOUT_MS = 10_000L // Max wait 10 seconds + private const val TIMEOUT_MS = 60_000L // 60 seconds for slower fixes } - // Public method to get location fun getCurrentPosition(callback: LocationResult) { + pendingCallback = callback + // Step 0: Permission check if (ActivityCompat.checkSelfPermission( activity, @@ -38,25 +40,45 @@ class LocationHelper(private val activity: Activity) { Manifest.permission.ACCESS_COARSE_LOCATION ) != PackageManager.PERMISSION_GRANTED ) { + // Request permission if missing + ActivityCompat.requestPermissions( + activity, + arrayOf( + Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.ACCESS_COARSE_LOCATION + ), + LOCATION_REQUEST_CODE + ) return } - // Step 1: Try last known location first (fastest route) + // Step 1: Try last known location first val lastLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER) ?: locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER) + ?: locationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER) if (lastLocation != null) { callback.onSuccess(lastLocation.latitude, lastLocation.longitude) return } - // Step 2: Set up listener for updates - pendingCallback = callback - val listener = object : LocationListener { + // Step 2: Check available providers + val providers = mutableListOf() + if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) providers.add(LocationManager.GPS_PROVIDER) + if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) providers.add(LocationManager.NETWORK_PROVIDER) + if (locationManager.isProviderEnabled(LocationManager.PASSIVE_PROVIDER)) providers.add(LocationManager.PASSIVE_PROVIDER) + + if (providers.isEmpty()) { + callback.onFailure("No location provider enabled") + return + } + + // Step 3: Set up listener + listener = object : LocationListener { override fun onLocationChanged(location: Location) { - // Pass it on + Log.d("LocationHelper", "Location received: ${location.latitude}, ${location.longitude}") pendingCallback?.onSuccess(location.latitude, location.longitude) - removeUpdates(this) + removeUpdates() } override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) {} @@ -64,33 +86,32 @@ class LocationHelper(private val activity: Activity) { override fun onProviderDisabled(provider: String) {} } - // Ask GPS and Network (network usually faster indoors) - if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { - locationManager.requestLocationUpdates( - LocationManager.GPS_PROVIDER, - 0L, - 0f, - listener - ) - } - if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { - locationManager.requestLocationUpdates( - LocationManager.NETWORK_PROVIDER, - 0L, - 0f, - listener - ) + // Request updates from all available providers + providers.forEach { provider -> + try { + locationManager.requestLocationUpdates( + provider, + 1000L, // 1-second interval + 0f, + listener!! + ) + } catch (e: SecurityException) { + Log.e("LocationHelper", "Permission issue: $e") + } catch (e: Exception) { + Log.e("LocationHelper", "Failed to request updates for $provider: $e") + } } - // Step 3: Timeout in case nothing arrives + // Step 4: Timeout handler handler.postDelayed({ pendingCallback?.onFailure("Location timeout") - removeUpdates(listener) + removeUpdates() }, TIMEOUT_MS) } - private fun removeUpdates(listener: LocationListener) { - locationManager.removeUpdates(listener) + private fun removeUpdates() { + listener?.let { locationManager.removeUpdates(it) } + listener = null pendingCallback = null } @@ -99,12 +120,9 @@ class LocationHelper(private val activity: Activity) { if (requestCode == LOCATION_REQUEST_CODE) { val callback = pendingCallback pendingCallback = null - if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - // User said yes → fetch location callback?.let { getCurrentPosition(it) } } else { - // User said no → sad face callback?.onFailure("Location permission denied") } } diff --git a/lib/controllers/home_f.dart b/lib/controllers/home_f.dart index 77feaf738..c37b4c1cf 100644 --- a/lib/controllers/home_f.dart +++ b/lib/controllers/home_f.dart @@ -63,7 +63,7 @@ String getDayLabel(DateTime date, int index, utcOffsetSeconds) { } } -final String currentVersion = 'v2.6.0'; +final String currentVersion = 'v2.6.1'; final String githubRepo = 'PranshulGG/WeatherMaster'; bool isChecking = false; diff --git a/lib/models/insights_gen.dart b/lib/models/insights_gen.dart index 952be4cf5..1f56b97f5 100644 --- a/lib/models/insights_gen.dart +++ b/lib/models/insights_gen.dart @@ -419,10 +419,18 @@ class _ShowInsightsState extends State { Widget build(BuildContext context) { return Container( padding: const EdgeInsets.all(12), - margin: const EdgeInsets.fromLTRB(12, 0, 12, 0), + margin: const EdgeInsets.fromLTRB(13, 0, 13, 0), decoration: BoxDecoration( color: Color(widget.selectedContainerBgIndex), borderRadius: BorderRadius.circular(20), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.15), + spreadRadius: 1, + blurRadius: 1, + offset: Offset(0, 1), + ), + ], ), constraints: BoxConstraints(minHeight: 65), child: IntrinsicHeight( diff --git a/lib/screens/about_page.dart b/lib/screens/about_page.dart index d14482a77..a76572baf 100644 --- a/lib/screens/about_page.dart +++ b/lib/screens/about_page.dart @@ -108,7 +108,7 @@ class AboutPage extends StatelessWidget { showLicensePage( context: context, applicationName: 'WeatherMaster', - applicationVersion: 'v2.6.0 (F)', + applicationVersion: 'v2.6.1 (F)', applicationIcon: Container( clipBehavior: Clip.hardEdge, margin: EdgeInsets.only(bottom: 16, top: 16), @@ -353,7 +353,7 @@ class CheckUpdateButton extends StatefulWidget { } class _CheckUpdateButtonState extends State { - final String currentVersion = 'v2.6.0'; + final String currentVersion = 'v2.6.1'; final String githubRepo = 'PranshulGG/WeatherMaster'; bool isChecking = false; diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 94032dea4..1237b0777 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -1458,7 +1458,7 @@ class _WeatherHomeState extends State { currentLastUpdated: formattedTime, ), WeatherFrogIconWidget(iconUrl: _iconUrlFroggy), - const SizedBox(height: 12), + const SizedBox(height: 13.8), SizedBox( width: isFoldableLayout(context) ? 500 : null, height: null, diff --git a/lib/widget_background.dart b/lib/widget_background.dart index 5fcfb18dc..ade39d987 100644 --- a/lib/widget_background.dart +++ b/lib/widget_background.dart @@ -285,7 +285,8 @@ Future updateHomeWidget(weather, {bool updatedFromHome = false}) async { await HomeWidget.updateWidget( name: 'WeatherWidgetCastProvider', iOSName: null); await HomeWidget.updateWidget(name: 'PillWidgetProvider', iOSName: null); - await HomeWidget.updateWidget(name: 'GlanceWidgetProvider', iOSName: null); + await HomeWidget.updateWidget( + name: 'clockDateWidgetProvider', iOSName: null); await HomeWidget.updateWidget( name: 'DateCurrentWidgetProvider', iOSName: null); diff --git a/lib/widgets/current_conditions_card.dart b/lib/widgets/current_conditions_card.dart index 3864d437a..0c250acc6 100644 --- a/lib/widgets/current_conditions_card.dart +++ b/lib/widgets/current_conditions_card.dart @@ -73,13 +73,11 @@ class ConditionsWidgets extends StatefulWidget { class _ConditionsWidgetsState extends State { List itemOrder = []; - final String orderPrefsKey = 'tile_order'; - bool _initialized = false; + final String orderPrefsKey = 'tile_order_new'; @override void initState() { super.initState(); _loadTileOrder(); - _initializePreferences(); } Future _loadTileOrder() async { @@ -97,28 +95,6 @@ class _ConditionsWidgetsState extends State { } } - Future _initializePreferences() async { - if (_initialized) return; - _initialized = true; - - final prefs = await SharedPreferences.getInstance(); - List? savedList = prefs.getStringList(orderPrefsKey); - - if (savedList != null) { - List intList = savedList.map(int.parse).toList(); - List zeroToSeven = List.generate(8, (i) => i); - - if (intList.toSet().containsAll(zeroToSeven) && - intList.every((e) => e >= 0 && e <= 7)) { - await prefs.remove(orderPrefsKey); - } - } - - List newList = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; - await prefs.setStringList(orderPrefsKey, newList); - print('New list saved'); - } - @override Widget build(BuildContext context) { final tempUnit = context.watch().tempUnit; @@ -756,7 +732,7 @@ class _ConditionsWidgetsState extends State { backgroundColor: Color(widget.selectedContainerBgIndex)), headerWidgetConditions( - headerText: "direction".tr(), + headerText: "wind".tr(), headerIcon: Symbols.explore, ), Align( @@ -1297,7 +1273,11 @@ class _ConditionsWidgetsState extends State { ), ), onTap: () { - widget.isFromHome ? openContainer() : null; + if (widget.isFromHome) { + if (moonriseFormat != "N/A" && moonsetFormat != "N/A") { + openContainer(); + } + } }, ); }, @@ -1386,7 +1366,7 @@ class _ConditionsWidgetsState extends State { // 123216 return Container( - margin: EdgeInsets.fromLTRB(12, 0, 12, 0), + margin: EdgeInsets.fromLTRB(13, 0, 13, 0), child: Column( children: [ Container( diff --git a/lib/widgets/daily_card.dart b/lib/widgets/daily_card.dart index 471cc6c7b..f9dffa0d1 100644 --- a/lib/widgets/daily_card.dart +++ b/lib/widgets/daily_card.dart @@ -77,7 +77,7 @@ class DailyCard extends StatelessWidget { top: 15, bottom: 0, ), - margin: EdgeInsets.fromLTRB(12, 0, 12, 0), + margin: EdgeInsets.fromLTRB(13, 0, 13, 0), child: Column( children: [ Row(crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/lib/widgets/hourly_card.dart b/lib/widgets/hourly_card.dart index 6557cf3d7..abe1161ac 100644 --- a/lib/widgets/hourly_card.dart +++ b/lib/widgets/hourly_card.dart @@ -65,7 +65,7 @@ class HourlyCard extends StatelessWidget { ], ), padding: EdgeInsets.only(top: 15, bottom: 0), - margin: EdgeInsets.fromLTRB(12, 0, 12, 0), + margin: EdgeInsets.fromLTRB(13, 0, 13, 0), child: Column( children: [ Row(crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/lib/widgets/pollen_card.dart b/lib/widgets/pollen_card.dart index 1d8ee55c5..6c7784495 100644 --- a/lib/widgets/pollen_card.dart +++ b/lib/widgets/pollen_card.dart @@ -99,7 +99,7 @@ class PollenCard extends StatelessWidget { ], ), padding: EdgeInsets.only(top: 15, bottom: 15), - margin: EdgeInsets.fromLTRB(12, 0, 12, 0), + margin: EdgeInsets.fromLTRB(13, 0, 13, 0), child: Column( children: [ Row(crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/lib/widgets/rain_block.dart b/lib/widgets/rain_block.dart index 1abd50000..3b8d0a812 100644 --- a/lib/widgets/rain_block.dart +++ b/lib/widgets/rain_block.dart @@ -177,7 +177,7 @@ class RainBlock extends StatelessWidget { final precipitationUnit = unitSettings.precipitationUnit; return Container( - margin: const EdgeInsets.only(bottom: 0, left: 12, right: 12, top: 0), + margin: const EdgeInsets.only(bottom: 0, left: 13, right: 13, top: 0), padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Color(selectedContainerBgIndex), diff --git a/lib/widgets/top_summary_block.dart b/lib/widgets/top_summary_block.dart index 25f73eaa4..bb5d84a6a 100644 --- a/lib/widgets/top_summary_block.dart +++ b/lib/widgets/top_summary_block.dart @@ -568,7 +568,7 @@ class _SummaryCardState extends State { ], ), padding: EdgeInsets.only(top: 15, bottom: 10), - margin: EdgeInsets.fromLTRB(12, 0, 12, 0), + margin: EdgeInsets.fromLTRB(13, 0, 13, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/pubspec.yaml b/pubspec.yaml index 3a3b52300..ae53718e8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 2.6.0+21 +version: 2.6.1+22 environment: sdk: ">=3.0.6 <4.0.0" diff --git a/settings_tiles_custom/example/android/.gradle/8.9/fileHashes/fileHashes.bin b/settings_tiles_custom/example/android/.gradle/8.9/fileHashes/fileHashes.bin index 6b10206147abc9eee20813d0a66dbc34be42625b..7d6bd2e831902419b6772b937bf1f007908976b7 100644 GIT binary patch delta 1929 zcmYk6eN2^A0LJfi_liNZ*kuA2fl$$y3UmG8+;nBlH6}rb1|%O|5fK4hf0UK8hHW|K z8nLHuvtqWD8%o9aqq)|oHP#wqjImiINof_IdD& z5+mr(<6vcEL>?6Wm9O;2!z}ci?`J;eWA3FozmJ7-t2u=oZXiK`@QY1)MdF zO2Ifj6j=LZNNkJ6a1knfz9)ag2hF4;zAQ8s}3AiAL!GI01MGP;;(*ieMvEjVHg)4$2L=~HG z@H(~?l-q$omH)S6Iy&8r25RQSYO)JLC$ILaZV50+9kU2hmSk^hmnK>j7a22w83|P zk#4(Ac0l$e*2PtFVk^aS5+PQ;x>S54@hyJljaaRA<#lGaA7smCY&j=AU!zO!`4k^fVECRW(q@qg@WJ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--git a/settings_tiles_custom/example/android/.gradle/8.9/fileHashes/fileHashes.lock b/settings_tiles_custom/example/android/.gradle/8.9/fileHashes/fileHashes.lock index 9c8331fc1bb8d4f73ced78ef71d737544be7e599..4eab8902b5e6a6a5fd6547da48fc0bdf9278d787 100644 GIT binary patch literal 17 VcmZRMz56`-dT#I<1~70h0{}iL1&{y$ literal 17 VcmZRMz56`-dT#I<1~72j4*))J1=s)p diff --git a/settings_tiles_custom/example/android/.gradle/8.9/fileHashes/resourceHashesCache.bin b/settings_tiles_custom/example/android/.gradle/8.9/fileHashes/resourceHashesCache.bin index 5124ba7f5364f4a193836bdd0c8153a3c7e55726..be2d7cc9d7402a20f021c6d33a9f134140088a15 100644 GIT binary patch delta 56 zcmX@Tp7HH^#tkMCjAfHeB_;@TzY@JU^GSv?0~my#-n>_$nu}3!qv8+ojRrq>HamKB K@lTHTQ33#IXcXfB delta 35 rcmaF6p7Hd0#tkMCjHQ!JB_?dXD^bkF$hlGRhxkSV0p87y9$owZ{Gklq diff --git a/settings_tiles_custom/example/build/app/intermediates/cxx/create_cxx_tasks_38_timing.txt b/settings_tiles_custom/example/build/app/intermediates/cxx/create_cxx_tasks_38_timing.txt index f5bd5db84..4113b8caf 100644 --- a/settings_tiles_custom/example/build/app/intermediates/cxx/create_cxx_tasks_38_timing.txt +++ b/settings_tiles_custom/example/build/app/intermediates/cxx/create_cxx_tasks_38_timing.txt @@ -622,3 +622,27 @@ create_cxx_tasks [gap of 32ms] create_cxx_tasks completed in 251ms +# C/C++ build system timings +create_cxx_tasks + create-initial-cxx-model + create-module-model 121ms + [gap of 15ms] + create-variant-model 28ms + create-ARMEABI_V7A-model 85ms + create-ARM64_V8A-model 11ms + create-X86-model 11ms + create-X86_64-model 11ms + create-module-model 16ms + create-ARMEABI_V7A-model 17ms + create-ARM64_V8A-model 17ms + create-X86-model 19ms + create-X86_64-model 17ms + create-module-model 24ms + create-ARMEABI_V7A-model 14ms + create-ARM64_V8A-model 18ms + create-X86-model 23ms + create-X86_64-model 11ms + create-initial-cxx-model completed in 490ms + [gap of 49ms] +create_cxx_tasks completed in 560ms +