From 10bf13f56b175727d86d98a52a79a13cdad31183 Mon Sep 17 00:00:00 2001 From: Lecat Baptiste <60200125+BaptisteLecat@users.noreply.github.com> Date: Mon, 18 Dec 2023 20:17:53 +0100 Subject: [PATCH 1/7] Implement all firebase monitoring suite --- lib/main.dart | 12 ++++++++++ macos/Flutter/GeneratedPluginRegistrant.swift | 2 ++ pubspec.lock | 24 +++++++++++++++++++ pubspec.yaml | 1 + 4 files changed, 39 insertions(+) diff --git a/lib/main.dart b/lib/main.dart index c164be0..893de9f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:firebase_core/firebase_core.dart'; +import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -8,6 +9,7 @@ import 'package:weatherjourney/firebase_options.dart'; import 'package:weatherjourney/src/app.dart'; import 'package:weatherjourney/src/features/authentication/application/services/apple_sign_in_available_service.dart'; import 'package:weatherjourney/src/localization/string_hardcoded.dart'; +import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:timezone/data/latest.dart' as tz; Future main() async { @@ -15,6 +17,7 @@ Future main() async { await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); + FirebaseAnalytics analytics = FirebaseAnalytics.instance; tz.initializeTimeZones(); // turn off the # in the URLs on the web usePathUrlStrategy(); @@ -27,6 +30,15 @@ Future main() async { container.read(appleSignInAvailableServiceProvider); //container.read(authRepositoryProvider).signOut(); + FlutterError.onError = (errorDetails) { + FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails); + }; + // Pass all uncaught asynchronous errors that aren't handled by the Flutter framework to Crashlytics + PlatformDispatcher.instance.onError = (error, stack) { + FirebaseCrashlytics.instance.recordError(error, stack, fatal: true); + return true; + }; + runApp( UncontrolledProviderScope(container: container, child: const MyApp()), ); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 390589f..df5c1cf 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,6 +6,7 @@ import FlutterMacOS import Foundation import cloud_firestore +import firebase_analytics import firebase_auth import firebase_core import firebase_crashlytics @@ -16,6 +17,7 @@ import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) + FLTFirebaseAnalyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAnalyticsPlugin")) FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseCrashlyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCrashlyticsPlugin")) diff --git a/pubspec.lock b/pubspec.lock index f2e8b9a..311a18d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -265,6 +265,30 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.4" + firebase_analytics: + dependency: "direct main" + description: + name: firebase_analytics + sha256: "5e92d510eacd66c354718fd9cc8f66ffdfa025640b645c4742297fb973770508" + url: "https://pub.dev" + source: hosted + version: "10.7.4" + firebase_analytics_platform_interface: + dependency: transitive + description: + name: firebase_analytics_platform_interface + sha256: "72977325a72af5ebb8e53b5c5533cb2e33eec481cd46210cfe5427f5efba55d8" + url: "https://pub.dev" + source: hosted + version: "3.8.4" + firebase_analytics_web: + dependency: transitive + description: + name: firebase_analytics_web + sha256: "8b9710be7e292e2a5ad34fff449d4b668c5808fb339649e69181727a4534f579" + url: "https://pub.dev" + source: hosted + version: "0.5.5+11" firebase_auth: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index bd6b2c1..dabf595 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: geolocator: ^10.1.0 pretty_dio_logger: ^1.3.1 shimmer: ^3.0.0 + firebase_analytics: ^10.7.4 dev_dependencies: flutter_test: From 1696f322f2deb6d9a9bec241b9a56fec161761fa Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 18 Dec 2023 19:21:14 +0000 Subject: [PATCH 2/7] (MINOR) Bump version From 86a0fdce3fe2cf4eca561ad5d9f54058c29ad262 Mon Sep 17 00:00:00 2001 From: Lecat Baptiste <60200125+BaptisteLecat@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:10:59 +0100 Subject: [PATCH 3/7] Update beta_workflow.yml --- .github/workflows/beta_workflow.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/beta_workflow.yml b/.github/workflows/beta_workflow.yml index 0c82b58..85084a5 100644 --- a/.github/workflows/beta_workflow.yml +++ b/.github/workflows/beta_workflow.yml @@ -43,6 +43,13 @@ jobs: git checkout -b release/${{ steps.semver.outputs.version }} develop git push origin release/${{ steps.semver.outputs.version }} + - name: create a tag for the new version + run: | + git config --local user.email "ci-executor@github.com" + git config --local user.name "GitHub Action" + git tag -a ${{ steps.semver.outputs.version }} -m "Release ${{ steps.semver.outputs.version }}" + git push origin ${{ steps.semver.outputs.version }} + build-and-deploy-android: needs: create-release-branch environment: beta From 05649ef94c83f06d11cf1e5bb8319f29d56fa818 Mon Sep 17 00:00:00 2001 From: Lecat Baptiste <60200125+BaptisteLecat@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:11:24 +0100 Subject: [PATCH 4/7] Update beta_workflow.yml --- .github/workflows/beta_workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/beta_workflow.yml b/.github/workflows/beta_workflow.yml index 85084a5..1604cdf 100644 --- a/.github/workflows/beta_workflow.yml +++ b/.github/workflows/beta_workflow.yml @@ -111,7 +111,7 @@ jobs: echo ${{ secrets.PLAYSTORE_SERVICE_ACCOUNT_BASE_64 }} | base64 --decode > android/playstore-service-account.json shell: bash - - name: Deploy iOS Beta to TestFlight via Fastlane + - name: Deploy Android Beta to PlayStore via Fastlane uses: maierj/fastlane-action@v1.4.0 with: lane: beta From d196dca04f74f1b26fbcdcd0158c209cf1505524 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 19 Dec 2023 10:16:11 +0000 Subject: [PATCH 5/7] (MINOR) Bump version From 604f1ebf8334d9bb3c679a49f4e4093f7acb7fe2 Mon Sep 17 00:00:00 2001 From: Lecat Baptiste <60200125+BaptisteLecat@users.noreply.github.com> Date: Thu, 4 Apr 2024 22:55:33 +0200 Subject: [PATCH 6/7] Fix image expiration error --- ios/Podfile.lock | 55 +++++++++++++++++++ .../presentation/widget/location_card.dart | 19 +++++-- .../presentation/widget/weather_widget.dart | 44 +++++++++++++++ pubspec.lock | 50 +++++++++++------ 4 files changed, 147 insertions(+), 21 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 3a2a01d..3a03bd6 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -645,9 +645,14 @@ PODS: - firebase_core - Flutter - nanopb (< 2.30910.0, >= 2.30908.0) + - Firebase/Analytics (10.18.0): + - Firebase/Core - Firebase/Auth (10.18.0): - Firebase/CoreOnly - FirebaseAuth (~> 10.18.0) + - Firebase/Core (10.18.0): + - Firebase/CoreOnly + - FirebaseAnalytics (~> 10.18.0) - Firebase/CoreOnly (10.18.0): - FirebaseCore (= 10.18.0) - Firebase/Crashlytics (10.18.0): @@ -659,6 +664,10 @@ PODS: - Firebase/Performance (10.18.0): - Firebase/CoreOnly - FirebasePerformance (~> 10.18.0) + - firebase_analytics (10.7.4): + - Firebase/Analytics (= 10.18.0) + - firebase_core + - Flutter - firebase_auth (4.15.2): - Firebase/Auth (= 10.18.0) - firebase_core @@ -676,6 +685,24 @@ PODS: - Flutter - FirebaseABTesting (10.19.0): - FirebaseCore (~> 10.0) + - FirebaseAnalytics (10.18.0): + - FirebaseAnalytics/AdIdSupport (= 10.18.0) + - FirebaseCore (~> 10.0) + - FirebaseInstallations (~> 10.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseAnalytics/AdIdSupport (10.18.0): + - FirebaseCore (~> 10.0) + - FirebaseInstallations (~> 10.0) + - GoogleAppMeasurement (= 10.18.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) - FirebaseAppCheckInterop (10.19.0) - FirebaseAuth (10.18.0): - FirebaseAppCheckInterop (~> 10.17) @@ -756,6 +783,26 @@ PODS: - google_sign_in_ios (0.0.1): - Flutter - GoogleSignIn (~> 6.2) + - GoogleAppMeasurement (10.18.0): + - GoogleAppMeasurement/AdIdSupport (= 10.18.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (10.18.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 10.18.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (10.18.0): + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleDataTransport (9.3.0): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) @@ -872,6 +919,7 @@ PODS: DEPENDENCIES: - cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) + - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`) @@ -891,6 +939,7 @@ SPEC REPOS: - BoringSSL-GRPC - Firebase - FirebaseABTesting + - FirebaseAnalytics - FirebaseAppCheckInterop - FirebaseAuth - FirebaseCore @@ -904,6 +953,7 @@ SPEC REPOS: - FirebaseRemoteConfig - FirebaseSessions - FirebaseSharedSwift + - GoogleAppMeasurement - GoogleDataTransport - GoogleSignIn - GoogleUtilities @@ -920,6 +970,8 @@ SPEC REPOS: EXTERNAL SOURCES: cloud_firestore: :path: ".symlinks/plugins/cloud_firestore/ios" + firebase_analytics: + :path: ".symlinks/plugins/firebase_analytics/ios" firebase_auth: :path: ".symlinks/plugins/firebase_auth/ios" firebase_core: @@ -949,11 +1001,13 @@ SPEC CHECKSUMS: BoringSSL-GRPC: 3175b25143e648463a56daeaaa499c6cb86dad33 cloud_firestore: d2707a9ead952efd2a89e82347e46dc4b9c32e8d Firebase: 414ad272f8d02dfbf12662a9d43f4bba9bec2a06 + firebase_analytics: 88c111412070acc2b05c1734151f58824f3db657 firebase_auth: 0099901926d85bda1688f6e451755b413c16154d firebase_core: 0af4a2b24f62071f9bf283691c0ee41556dcb3f5 firebase_crashlytics: 55714f63ae0973c54b3a721c451ae5f815086c1f firebase_performance: 2183122a3c7a650c80d8c164e9e28f13c4c62fc7 FirebaseABTesting: bfa3b384b68cee10a89183649c64cd7998a37a12 + FirebaseAnalytics: 4d310b35c48eaa4a058ddc04bdca6bdb5dc0fe80 FirebaseAppCheckInterop: 37884781f3e16a1ba47e7ec80a1e805f987788e3 FirebaseAuth: 12314b438fa76048540c8fb86d6cfc9e08595176 FirebaseCore: 2322423314d92f946219c8791674d2f3345b598f @@ -970,6 +1024,7 @@ SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 google_sign_in_ios: 1256ff9d941db546373826966720b0c24804bcdd + GoogleAppMeasurement: 70ce9aa438cff1cfb31ea3e660bcc67734cb716e GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe GoogleSignIn: 5651ce3a61e56ca864160e79b484cd9ed3f49b7a GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 diff --git a/lib/src/features/locations/presentation/widget/location_card.dart b/lib/src/features/locations/presentation/widget/location_card.dart index c3826a3..e06fb69 100644 --- a/lib/src/features/locations/presentation/widget/location_card.dart +++ b/lib/src/features/locations/presentation/widget/location_card.dart @@ -152,15 +152,26 @@ class LocationCard extends ConsumerWidget { lastGeneration .generatedImage!.uri, fit: BoxFit.fitWidth, + errorBuilder: (context, error, + stackTrace) => + Container( + decoration: BoxDecoration( + color: Theme.of(context) + .primaryColor, + borderRadius: + BorderRadius.circular( + 12), + ), + ), loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) { - return (loadingProgress == null) - ? child - : const ShimmerItemWidget(); - }), + return (loadingProgress == null) + ? child + : const ShimmerItemWidget(); + }), ), ), ], diff --git a/lib/src/features/weather/presentation/widget/weather_widget.dart b/lib/src/features/weather/presentation/widget/weather_widget.dart index 94d2173..50be2a1 100644 --- a/lib/src/features/weather/presentation/widget/weather_widget.dart +++ b/lib/src/features/weather/presentation/widget/weather_widget.dart @@ -73,6 +73,50 @@ class WeatherWidget extends ConsumerWidget { children: [ Image.network( generation.generatedImage!.uri, + errorBuilder: (context, error, stackTrace) => + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 24, vertical: 12), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Error loading image try to regenerate it "), + const SizedBox(height: 20), + GestureDetector( + onTap: () { + ref + .read(locationControllerProvider + .notifier) + .generate( + locationId: location.id!, + weather: + weatherForLocation.value!, + ); + }, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 24, vertical: 12), + decoration: BoxDecoration( + color: Theme.of(context) + .primaryColor, + borderRadius: + BorderRadius.circular(10), + ), + child: const Center( + child: Text( + 'Regenerate', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + )), + ) + ], + ), + ), fit: BoxFit.fill, ), Padding( diff --git a/pubspec.lock b/pubspec.lock index 311a18d..91819e0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -656,6 +656,30 @@ packages: url: "https://pub.dev" source: hosted version: "6.7.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: e45c31f458d01fd9ef4a214feb2e153b72d5b1907435f4332b1637a2f348c021 + url: "https://pub.dev" + source: hosted + version: "9.0.18" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "54808cfcfa87dbc0d74c61ac063d624adf1bd5c0407301f32b06c783c60dc4ca" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "7e71be3c161472f6c9158ac8875dd8de575060d60b5d159ebca3600ea32c9116" + url: "https://pub.dev" + source: hosted + version: "1.0.6" lints: dependency: transitive description: @@ -676,26 +700,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" mime: dependency: transitive description: @@ -724,10 +748,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_parsing: dependency: transitive description: @@ -1277,14 +1301,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.2" - web: - dependency: transitive - description: - name: web - sha256: "14f1f70c51119012600c5f1f60ca68efda5a9b6077748163c6af2893ec5df8fc" - url: "https://pub.dev" - source: hosted - version: "0.2.1-beta" web_socket_channel: dependency: transitive description: @@ -1334,5 +1350,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0-157.0.dev <4.0.0" + dart: ">=3.2.0-0 <4.0.0" flutter: ">=3.10.0" From 532f14f0841875653373ccbd0f83d211b314596f Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 4 Apr 2024 21:18:28 +0000 Subject: [PATCH 7/7] (MINOR) Bump version