From fed66e8bc8349512fe44d15ca028246c73281a7b Mon Sep 17 00:00:00 2001 From: neminsheth Date: Fri, 12 Jul 2024 15:11:12 +0530 Subject: [PATCH 1/5] Add Firebase configuration and setup Android/iOS platforms --- .metadata | 25 +- android/app/google-services.json | 82 +++++ .../example/get_flutter_fire/MainActivity.kt | 5 + firebase.json | 1 + ios/Podfile | 44 +++ ios/Podfile.lock | 346 ++++++++++++++++++ ios/Runner/GoogleService-Info.plist | 34 ++ macos/Podfile | 43 +++ macos/Runner/GoogleService-Info.plist | 34 ++ pubspec.lock | 88 ++--- 10 files changed, 653 insertions(+), 49 deletions(-) create mode 100644 android/app/google-services.json create mode 100644 android/app/src/main/kotlin/com/example/get_flutter_fire/MainActivity.kt create mode 100644 firebase.json create mode 100644 ios/Podfile create mode 100644 ios/Podfile.lock create mode 100644 ios/Runner/GoogleService-Info.plist create mode 100644 macos/Podfile create mode 100644 macos/Runner/GoogleService-Info.plist diff --git a/.metadata b/.metadata index 784ce129..6eb54a17 100644 --- a/.metadata +++ b/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3" + revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49" channel: "stable" project_type: app @@ -13,11 +13,26 @@ project_type: app migration: platforms: - platform: root - create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 - base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + - platform: android + create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + - platform: ios + create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + - platform: linux + create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + - platform: macos + create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 - platform: web - create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 - base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + - platform: windows + create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 + base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 # User provided section diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 00000000..41ea6bf4 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,82 @@ +{ + "project_info": { + "project_number": "56053565487", + "project_id": "sharekhan-nemin", + "storage_bucket": "sharekhan-nemin.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:56053565487:android:f0e57a6359c84f97cb5eda", + "android_client_info": { + "package_name": "nemin.sharekhan" + } + }, + "oauth_client": [ + { + "client_id": "56053565487-rbb4oliis6kl4angm8pbu9dusnr5g4op.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyA42S1sFkyQAj1yZ1F4gUmE_pxec3h3YBw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "56053565487-rbb4oliis6kl4angm8pbu9dusnr5g4op.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "56053565487-4hpe201r97dakjqqo6b0g3ltrabpfrmo.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "com.example.getFlutterFire" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:56053565487:android:a10bbf5abca35d98cb5eda", + "android_client_info": { + "package_name": "sharekhan.nemin" + } + }, + "oauth_client": [ + { + "client_id": "56053565487-rbb4oliis6kl4angm8pbu9dusnr5g4op.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyA42S1sFkyQAj1yZ1F4gUmE_pxec3h3YBw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "56053565487-rbb4oliis6kl4angm8pbu9dusnr5g4op.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "56053565487-4hpe201r97dakjqqo6b0g3ltrabpfrmo.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "com.example.getFlutterFire" + } + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/example/get_flutter_fire/MainActivity.kt b/android/app/src/main/kotlin/com/example/get_flutter_fire/MainActivity.kt new file mode 100644 index 00000000..018e286b --- /dev/null +++ b/android/app/src/main/kotlin/com/example/get_flutter_fire/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.get_flutter_fire + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/firebase.json b/firebase.json new file mode 100644 index 00000000..6643fe7b --- /dev/null +++ b/firebase.json @@ -0,0 +1 @@ +{"flutter":{"platforms":{"dart":{"lib/firebase_options.dart":{"projectId":"sharekhan-nemin","configurations":{"android":"1:56053565487:android:f0e57a6359c84f97cb5eda","ios":"1:56053565487:ios:3515d315addadb07cb5eda","macos":"1:56053565487:ios:3515d315addadb07cb5eda","web":"1:56053565487:web:bdde9b35d35b497ccb5eda","windows":"1:56053565487:web:5c35ec65002974a6cb5eda"}}},"ios":{"default":{"projectId":"sharekhan-nemin","appId":"1:56053565487:ios:3515d315addadb07cb5eda","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"android":{"default":{"projectId":"sharekhan-nemin","appId":"1:56053565487:android:f0e57a6359c84f97cb5eda","fileOutput":"android/app/google-services.json"}},"macos":{"default":{"projectId":"sharekhan-nemin","appId":"1:56053565487:ios:3515d315addadb07cb5eda","uploadDebugSymbols":false,"fileOutput":"macos/Runner/GoogleService-Info.plist"}}}}} \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 00000000..d97f17e2 --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '12.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 00000000..6afd14af --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,346 @@ +PODS: + - AppAuth (1.7.5): + - AppAuth/Core (= 1.7.5) + - AppAuth/ExternalUserAgent (= 1.7.5) + - AppAuth/Core (1.7.5) + - AppAuth/ExternalUserAgent (1.7.5): + - AppAuth/Core + - desktop_webview_auth (0.0.1): + - Flutter + - DKImagePickerController/Core (4.3.9): + - DKImagePickerController/ImageDataManager + - DKImagePickerController/Resource + - DKImagePickerController/ImageDataManager (4.3.9) + - DKImagePickerController/PhotoGallery (4.3.9): + - DKImagePickerController/Core + - DKPhotoGallery + - DKImagePickerController/Resource (4.3.9) + - DKPhotoGallery (0.0.19): + - DKPhotoGallery/Core (= 0.0.19) + - DKPhotoGallery/Model (= 0.0.19) + - DKPhotoGallery/Preview (= 0.0.19) + - DKPhotoGallery/Resource (= 0.0.19) + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Core (0.0.19): + - DKPhotoGallery/Model + - DKPhotoGallery/Preview + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Model (0.0.19): + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Preview (0.0.19): + - DKPhotoGallery/Model + - DKPhotoGallery/Resource + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Resource (0.0.19): + - SDWebImage + - SwiftyGif + - file_picker (0.0.1): + - DKImagePickerController/PhotoGallery + - Flutter + - Firebase/Analytics (10.25.0): + - Firebase/Core + - Firebase/Auth (10.25.0): + - Firebase/CoreOnly + - FirebaseAuth (~> 10.25.0) + - Firebase/Core (10.25.0): + - Firebase/CoreOnly + - FirebaseAnalytics (~> 10.25.0) + - Firebase/CoreOnly (10.25.0): + - FirebaseCore (= 10.25.0) + - Firebase/DynamicLinks (10.25.0): + - Firebase/CoreOnly + - FirebaseDynamicLinks (~> 10.25.0) + - Firebase/RemoteConfig (10.25.0): + - Firebase/CoreOnly + - FirebaseRemoteConfig (~> 10.25.0) + - Firebase/Storage (10.25.0): + - Firebase/CoreOnly + - FirebaseStorage (~> 10.25.0) + - firebase_analytics (10.10.7): + - Firebase/Analytics (= 10.25.0) + - firebase_core + - Flutter + - firebase_auth (4.20.0): + - Firebase/Auth (= 10.25.0) + - firebase_core + - Flutter + - firebase_core (2.32.0): + - Firebase/CoreOnly (= 10.25.0) + - Flutter + - firebase_dynamic_links (5.5.7): + - Firebase/DynamicLinks (= 10.25.0) + - firebase_core + - Flutter + - firebase_remote_config (4.4.7): + - Firebase/RemoteConfig (= 10.25.0) + - firebase_core + - Flutter + - firebase_storage (11.7.7): + - Firebase/Storage (= 10.25.0) + - firebase_core + - Flutter + - FirebaseABTesting (10.29.0): + - FirebaseCore (~> 10.0) + - FirebaseAnalytics (10.25.0): + - FirebaseAnalytics/AdIdSupport (= 10.25.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.30911.0, >= 2.30908.0) + - FirebaseAnalytics/AdIdSupport (10.25.0): + - FirebaseCore (~> 10.0) + - FirebaseInstallations (~> 10.0) + - GoogleAppMeasurement (= 10.25.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30911.0, >= 2.30908.0) + - FirebaseAppCheckInterop (10.29.0) + - FirebaseAuth (10.25.0): + - FirebaseAppCheckInterop (~> 10.17) + - FirebaseCore (~> 10.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.8) + - GoogleUtilities/Environment (~> 7.8) + - GTMSessionFetcher/Core (< 4.0, >= 2.1) + - RecaptchaInterop (~> 100.0) + - FirebaseAuthInterop (10.29.0) + - FirebaseCore (10.25.0): + - FirebaseCoreInternal (~> 10.0) + - GoogleUtilities/Environment (~> 7.12) + - GoogleUtilities/Logger (~> 7.12) + - FirebaseCoreExtension (10.29.0): + - FirebaseCore (~> 10.0) + - FirebaseCoreInternal (10.29.0): + - "GoogleUtilities/NSData+zlib (~> 7.8)" + - FirebaseDynamicLinks (10.25.0): + - FirebaseCore (~> 10.0) + - FirebaseInstallations (10.29.0): + - FirebaseCore (~> 10.0) + - GoogleUtilities/Environment (~> 7.8) + - GoogleUtilities/UserDefaults (~> 7.8) + - PromisesObjC (~> 2.1) + - FirebaseRemoteConfig (10.25.0): + - FirebaseABTesting (~> 10.0) + - FirebaseCore (~> 10.0) + - FirebaseInstallations (~> 10.0) + - FirebaseRemoteConfigInterop (~> 10.23) + - FirebaseSharedSwift (~> 10.0) + - GoogleUtilities/Environment (~> 7.8) + - "GoogleUtilities/NSData+zlib (~> 7.8)" + - FirebaseRemoteConfigInterop (10.29.0) + - FirebaseSharedSwift (10.29.0) + - FirebaseStorage (10.25.0): + - FirebaseAppCheckInterop (~> 10.0) + - FirebaseAuthInterop (~> 10.25) + - FirebaseCore (~> 10.0) + - FirebaseCoreExtension (~> 10.0) + - GoogleUtilities/Environment (~> 7.12) + - GTMSessionFetcher/Core (< 4.0, >= 2.1) + - Flutter (1.0.0) + - google_sign_in_ios (0.0.1): + - AppAuth (>= 1.7.4) + - Flutter + - FlutterMacOS + - GoogleSignIn (~> 7.1) + - GTMSessionFetcher (>= 3.4.0) + - GoogleAppMeasurement (10.25.0): + - GoogleAppMeasurement/AdIdSupport (= 10.25.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30911.0, >= 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (10.25.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 10.25.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30911.0, >= 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (10.25.0): + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30911.0, >= 2.30908.0) + - GoogleSignIn (7.1.0): + - AppAuth (< 2.0, >= 1.7.3) + - GTMAppAuth (< 5.0, >= 4.1.1) + - GTMSessionFetcher/Core (~> 3.3) + - GoogleUtilities/AppDelegateSwizzler (7.13.3): + - GoogleUtilities/Environment + - GoogleUtilities/Logger + - GoogleUtilities/Network + - GoogleUtilities/Privacy + - GoogleUtilities/Environment (7.13.3): + - GoogleUtilities/Privacy + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.13.3): + - GoogleUtilities/Environment + - GoogleUtilities/Privacy + - GoogleUtilities/MethodSwizzler (7.13.3): + - GoogleUtilities/Logger + - GoogleUtilities/Privacy + - GoogleUtilities/Network (7.13.3): + - GoogleUtilities/Logger + - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Privacy + - GoogleUtilities/Reachability + - "GoogleUtilities/NSData+zlib (7.13.3)": + - GoogleUtilities/Privacy + - GoogleUtilities/Privacy (7.13.3) + - GoogleUtilities/Reachability (7.13.3): + - GoogleUtilities/Logger + - GoogleUtilities/Privacy + - GoogleUtilities/UserDefaults (7.13.3): + - GoogleUtilities/Logger + - GoogleUtilities/Privacy + - GTMAppAuth (4.1.1): + - AppAuth/Core (~> 1.7) + - GTMSessionFetcher/Core (< 4.0, >= 3.3) + - GTMSessionFetcher (3.5.0): + - GTMSessionFetcher/Full (= 3.5.0) + - GTMSessionFetcher/Core (3.5.0) + - GTMSessionFetcher/Full (3.5.0): + - GTMSessionFetcher/Core + - image_picker_ios (0.0.1): + - Flutter + - nanopb (2.30910.0): + - nanopb/decode (= 2.30910.0) + - nanopb/encode (= 2.30910.0) + - nanopb/decode (2.30910.0) + - nanopb/encode (2.30910.0) + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - PromisesObjC (2.4.0) + - RecaptchaInterop (100.0.0) + - SDWebImage (5.19.4): + - SDWebImage/Core (= 5.19.4) + - SDWebImage/Core (5.19.4) + - SwiftyGif (5.4.5) + +DEPENDENCIES: + - desktop_webview_auth (from `.symlinks/plugins/desktop_webview_auth/ios`) + - file_picker (from `.symlinks/plugins/file_picker/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_dynamic_links (from `.symlinks/plugins/firebase_dynamic_links/ios`) + - firebase_remote_config (from `.symlinks/plugins/firebase_remote_config/ios`) + - firebase_storage (from `.symlinks/plugins/firebase_storage/ios`) + - Flutter (from `Flutter`) + - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) + - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + +SPEC REPOS: + trunk: + - AppAuth + - DKImagePickerController + - DKPhotoGallery + - Firebase + - FirebaseABTesting + - FirebaseAnalytics + - FirebaseAppCheckInterop + - FirebaseAuth + - FirebaseAuthInterop + - FirebaseCore + - FirebaseCoreExtension + - FirebaseCoreInternal + - FirebaseDynamicLinks + - FirebaseInstallations + - FirebaseRemoteConfig + - FirebaseRemoteConfigInterop + - FirebaseSharedSwift + - FirebaseStorage + - GoogleAppMeasurement + - GoogleSignIn + - GoogleUtilities + - GTMAppAuth + - GTMSessionFetcher + - nanopb + - PromisesObjC + - RecaptchaInterop + - SDWebImage + - SwiftyGif + +EXTERNAL SOURCES: + desktop_webview_auth: + :path: ".symlinks/plugins/desktop_webview_auth/ios" + file_picker: + :path: ".symlinks/plugins/file_picker/ios" + firebase_analytics: + :path: ".symlinks/plugins/firebase_analytics/ios" + firebase_auth: + :path: ".symlinks/plugins/firebase_auth/ios" + firebase_core: + :path: ".symlinks/plugins/firebase_core/ios" + firebase_dynamic_links: + :path: ".symlinks/plugins/firebase_dynamic_links/ios" + firebase_remote_config: + :path: ".symlinks/plugins/firebase_remote_config/ios" + firebase_storage: + :path: ".symlinks/plugins/firebase_storage/ios" + Flutter: + :path: Flutter + google_sign_in_ios: + :path: ".symlinks/plugins/google_sign_in_ios/darwin" + image_picker_ios: + :path: ".symlinks/plugins/image_picker_ios/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" + +SPEC CHECKSUMS: + AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa + desktop_webview_auth: d645139460ef203d50bd0cdb33356785dd939cce + DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c + DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 + file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655 + Firebase: 0312a2352584f782ea56f66d91606891d4607f06 + firebase_analytics: cc06e24d6a2343c44f845b3112143db72d10ef78 + firebase_auth: 5719ddc9f654b813405899480e84971bd8e61235 + firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197 + firebase_dynamic_links: 525e9c1b702d2ed2d9b0dbd342eee1e15a75e62d + firebase_remote_config: 7b05c80210ab558c80f7a756681022b4ee98eea0 + firebase_storage: 5c0f552d6b27d621429d7fd16ebab4be94a3c954 + FirebaseABTesting: d87f56707159bae64e269757a6e963d490f2eebe + FirebaseAnalytics: ec00fe8b93b41dc6fe4a28784b8e51da0647a248 + FirebaseAppCheckInterop: 6a1757cfd4067d8e00fccd14fcc1b8fd78cfac07 + FirebaseAuth: c0f93dcc570c9da2bffb576969d793e95c344fbb + FirebaseAuthInterop: 17db81e9b198afb0f95ce48c133825727eed55d3 + FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483 + FirebaseCoreExtension: 705ca5b14bf71d2564a0ddc677df1fc86ffa600f + FirebaseCoreInternal: df84dd300b561c27d5571684f389bf60b0a5c934 + FirebaseDynamicLinks: 12c9f5b643943e0565ed28080373f89cbcb914a3 + FirebaseInstallations: 913cf60d0400ebd5d6b63a28b290372ab44590dd + FirebaseRemoteConfig: 9f3935cefecd85d5b312192117f444957de24a75 + FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d + FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e + FirebaseStorage: 44f4e25073f6fa0d4d8c09f5bec299ee9e4eb985 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38 + GoogleAppMeasurement: 9abf64b682732fed36da827aa2a68f0221fd2356 + GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db + GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 + GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de + GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 + image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 + nanopb: 438bc412db1928dac798aa6fd75726007be04262 + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 + RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21 + SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d + SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 + +PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 + +COCOAPODS: 1.14.2 diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist new file mode 100644 index 00000000..78e3a245 --- /dev/null +++ b/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 56053565487-4hpe201r97dakjqqo6b0g3ltrabpfrmo.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.56053565487-4hpe201r97dakjqqo6b0g3ltrabpfrmo + API_KEY + AIzaSyD12e9qHOj8ulb6cxP0DIWHW2tIeYzgKtc + GCM_SENDER_ID + 56053565487 + PLIST_VERSION + 1 + BUNDLE_ID + com.example.getFlutterFire + PROJECT_ID + sharekhan-nemin + STORAGE_BUCKET + sharekhan-nemin.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:56053565487:ios:3515d315addadb07cb5eda + + \ No newline at end of file diff --git a/macos/Podfile b/macos/Podfile new file mode 100644 index 00000000..c795730d --- /dev/null +++ b/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/macos/Runner/GoogleService-Info.plist b/macos/Runner/GoogleService-Info.plist new file mode 100644 index 00000000..78e3a245 --- /dev/null +++ b/macos/Runner/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 56053565487-4hpe201r97dakjqqo6b0g3ltrabpfrmo.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.56053565487-4hpe201r97dakjqqo6b0g3ltrabpfrmo + API_KEY + AIzaSyD12e9qHOj8ulb6cxP0DIWHW2tIeYzgKtc + GCM_SENDER_ID + 56053565487 + PLIST_VERSION + 1 + BUNDLE_ID + com.example.getFlutterFire + PROJECT_ID + sharekhan-nemin + STORAGE_BUCKET + sharekhan-nemin.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:56053565487:ios:3515d315addadb07cb5eda + + \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 877fc75e..d0fdd9cb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -117,10 +117,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: "29c90806ac5f5fb896547720b73b17ee9aed9bba540dc5d91fe29f8c5745b10a" + sha256: "824f5b9f389bfc4dddac3dea76cd70c51092d9dff0b2ece7ef4f53db8547d258" url: "https://pub.dev" source: hosted - version: "8.0.3" + version: "8.0.6" file_selector_linux: dependency: transitive description: @@ -181,26 +181,26 @@ packages: dependency: "direct main" description: name: firebase_auth - sha256: f0a75f61992d036e4c46ad0e9febd364d98aa2c092690a5475cb1421a8243cfe + sha256: cfc2d970829202eca09e2896f0a5aa7c87302817ecc0bdfa954f026046bf10ba url: "https://pub.dev" source: hosted - version: "4.19.5" + version: "4.20.0" firebase_auth_platform_interface: dependency: transitive description: name: firebase_auth_platform_interface - sha256: feb77258404309ffc7761c78e1c0ad2ed5e4fdc378e035619e2cc13be4397b62 + sha256: a0270e1db3b2098a14cb2a2342b3cd2e7e458e0c391b1f64f6f78b14296ec093 url: "https://pub.dev" source: hosted - version: "7.2.6" + version: "7.3.0" firebase_auth_web: dependency: transitive description: name: firebase_auth_web - sha256: "6d527f357da2bf93a67a42b423aa92943104a0c290d1d72ad9a42c779d501cd2" + sha256: "64e067e763c6378b7e774e872f0f59f6812885e43020e25cde08f42e9459837b" url: "https://pub.dev" source: hosted - version: "5.11.5" + version: "5.12.0" firebase_core: dependency: "direct main" description: @@ -213,34 +213,34 @@ packages: dependency: transitive description: name: firebase_core_platform_interface - sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 + sha256: "1003a5a03a61fc9a22ef49f37cbcb9e46c86313a7b2e7029b9390cf8c6fc32cb" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.1.0" firebase_core_web: dependency: transitive description: name: firebase_core_web - sha256: "43d9e951ac52b87ae9cc38ecdcca1e8fa7b52a1dd26a96085ba41ce5108db8e9" + sha256: "23509cb3cddfb3c910c143279ac3f07f06d3120f7d835e4a5d4b42558e978712" url: "https://pub.dev" source: hosted - version: "2.17.0" + version: "2.17.3" firebase_dynamic_links: dependency: transitive description: name: firebase_dynamic_links - sha256: f704859abc17d99e74b47eaf47455b45a88ab7e2973f03e6130ff666b45fe11f + sha256: "47b8c8a8546d8a7f9000edb90848549f20b137d814ee7e0407b3d43b8445e282" url: "https://pub.dev" source: hosted - version: "5.5.5" + version: "5.5.7" firebase_dynamic_links_platform_interface: dependency: transitive description: name: firebase_dynamic_links_platform_interface - sha256: f86992605b50e2f0ce6c24993430affc98021da8d8a74d5596b7a2c84196c110 + sha256: "72e7810635f908ce060c5803c7acb29116c5b6befc73e90446c52722bc9506a2" url: "https://pub.dev" source: hosted - version: "0.2.6+33" + version: "0.2.6+35" firebase_remote_config: dependency: "direct main" description: @@ -269,26 +269,26 @@ packages: dependency: "direct main" description: name: firebase_storage - sha256: da76ca9c11d795c4bae1bd13b31d54bb9eb9ccbee7eb5f6b86b8294370e9d488 + sha256: "2ae478ceec9f458c1bcbf0ee3e0100e4e909708979e83f16d5d9fba35a5b42c1" url: "https://pub.dev" source: hosted - version: "11.7.5" + version: "11.7.7" firebase_storage_platform_interface: dependency: transitive description: name: firebase_storage_platform_interface - sha256: be17bfa9110a6429b40dd3760c755034079fd734aa1dd2476d5638ab780cc508 + sha256: "4e18662e6a66e2e0e181c06f94707de06d5097d70cfe2b5141bf64660c5b5da9" url: "https://pub.dev" source: hosted - version: "5.1.20" + version: "5.1.22" firebase_storage_web: dependency: transitive description: name: firebase_storage_web - sha256: "5219c20c0768a8e2ffedf0a116b7bc80ab32fcc6e2cbd50cbde14f8c4575c3f4" + sha256: "3a44aacd38a372efb159f6fe36bb4a7d79823949383816457fd43d3d47602a53" url: "https://pub.dev" source: hosted - version: "3.9.5" + version: "3.9.7" firebase_ui_auth: dependency: "direct main" description: @@ -351,10 +351,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f" + sha256: c6b0b4c05c458e1c01ad9bcc14041dd7b1f6783d487be4386f793f47a8a4d03e url: "https://pub.dev" source: hosted - version: "2.0.19" + version: "2.0.20" flutter_svg: dependency: transitive description: @@ -417,10 +417,10 @@ packages: dependency: transitive description: name: google_sign_in_android - sha256: "7647893c65e6720973f0e579051c8f84b877b486614d9f70a404259c41a4632e" + sha256: d30fb34b659679ea74397e9748b4ab5d720720d57dcc79538f1b3c4a68654cb3 url: "https://pub.dev" source: hosted - version: "6.1.23" + version: "6.1.27" google_sign_in_ios: dependency: transitive description: @@ -441,10 +441,10 @@ packages: dependency: transitive description: name: google_sign_in_web - sha256: fc0f14ed45ea616a6cfb4d1c7534c2221b7092cc4f29a709f0c3053cc3e821bd + sha256: d606264c7a1a526a3aa79d938b85a601d8589731a478bd4a3dcbdeb14a572228 url: "https://pub.dev" source: hosted - version: "0.12.4" + version: "0.12.4+1" http: dependency: transitive description: @@ -465,18 +465,18 @@ packages: dependency: "direct main" description: name: image_picker - sha256: "33974eca2e87e8b4e3727f1b94fa3abcb25afe80b6bc2c4d449a0e150aedf720" + sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: "79455f6cff4cbef583b2b524bbf0d4ec424e5959f4d464e36ef5323715b98370" + sha256: ff39a10ab4f48f4ac70776d0494a97bf073cd2570892cd46bc8a5cac162c25db url: "https://pub.dev" source: hosted - version: "0.8.12" + version: "0.8.12+4" image_picker_for_web: dependency: transitive description: @@ -489,10 +489,10 @@ packages: dependency: transitive description: name: image_picker_ios - sha256: cb0db0ec0d3e2cd49674f2e6053be25ccdb959832607c1cbd215dd6cf10fb0dd + sha256: "6703696ad49f5c3c8356d576d7ace84d1faf459afb07accbb0fae780753ff447" url: "https://pub.dev" source: hosted - version: "0.8.11" + version: "0.8.12" image_picker_linux: dependency: transitive description: @@ -625,10 +625,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d + sha256: "30c5aa827a6ae95ce2853cdc5fe3971daaac00f6f081c419c013f7f57bff2f5e" url: "https://pub.dev" source: hosted - version: "2.2.4" + version: "2.2.7" path_provider_foundation: dependency: transitive description: @@ -657,10 +657,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.0" petitparser: dependency: transitive description: @@ -673,10 +673,10 @@ packages: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: @@ -798,10 +798,10 @@ packages: dependency: transitive description: name: win32 - sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" + sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4 url: "https://pub.dev" source: hosted - version: "5.5.0" + version: "5.5.1" xdg_directories: dependency: transitive description: @@ -819,5 +819,5 @@ packages: source: hosted version: "6.5.0" sdks: - dart: ">=3.3.4 <4.0.0" - flutter: ">=3.19.2" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" From c11c7942b2b5d736e96067db3c571dc789de75d5 Mon Sep 17 00:00:00 2001 From: neminsheth Date: Fri, 12 Jul 2024 20:40:42 +0530 Subject: [PATCH 2/5] Working: TODO: Ensure Reset Password has Email verification --- .../modules/profile/views/profile_view.dart | 192 +++++++++++------- 1 file changed, 116 insertions(+), 76 deletions(-) diff --git a/lib/app/modules/profile/views/profile_view.dart b/lib/app/modules/profile/views/profile_view.dart index c26d11c1..e5be965f 100644 --- a/lib/app/modules/profile/views/profile_view.dart +++ b/lib/app/modules/profile/views/profile_view.dart @@ -1,5 +1,6 @@ // ignore_for_file: inference_failure_on_function_invocation +import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_ui_auth/firebase_ui_auth.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -17,11 +18,11 @@ class ProfileView extends GetView { Color get placeholderColor => Colors.grey; Widget _imageFrameBuilder( - BuildContext context, - Widget? child, - int? frame, - bool? _, - ) { + BuildContext context, + Widget? child, + int? frame, + bool? _, + ) { if (frame == null) { return Container(color: placeholderColor); } @@ -31,84 +32,96 @@ class ProfileView extends GetView { @override Widget build(BuildContext context) { - return Obx(() => profileScreen()); + return Obx(() => profileScreen(context)); } - Widget profileScreen() { + Widget profileScreen(BuildContext context) { return AuthService.to.isLoggedInValue ? ProfileScreen( - // We are using the Flutter Fire Profile Screen now but will change in subsequent steps. - // The issues are highlighted in comments here + // We are using the Flutter Fire Profile Screen now but will change in subsequent steps. + // The issues are highlighted in comments here - // appBar: AppBar( - // title: const Text('User Profile'), - // ), - avatar: SizedBox( - //null will give the profile image component but it does not refresh the pic when changed - height: size, + // appBar: AppBar( + // title: const Text('User Profile'), + // ), + avatar: SizedBox( + //null will give the profile image component but it does not refresh the pic when changed + height: size, + width: size, + child: ClipPath( + clipper: ShapeBorderClipper(shape: shape), + clipBehavior: Clip.hardEdge, + child: controller.photoURL != null + ? Image.network( + controller.photoURL!, + width: size, + height: size, + cacheWidth: size.toInt(), + cacheHeight: size.toInt(), + fit: BoxFit.contain, + frameBuilder: _imageFrameBuilder, + ) + : Center( + child: Image.asset( + 'assets/images/dash.png', width: size, - child: ClipPath( - clipper: ShapeBorderClipper(shape: shape), - clipBehavior: Clip.hardEdge, - child: controller.photoURL != null - ? Image.network( - controller.photoURL!, - width: size, - height: size, - cacheWidth: size.toInt(), - cacheHeight: size.toInt(), - fit: BoxFit.contain, - frameBuilder: _imageFrameBuilder, - ) - : Center( - child: Image.asset( - 'assets/images/dash.png', - width: size, - fit: BoxFit.contain, - ), - ), - ), + fit: BoxFit.contain, ), - // showDeleteConfirmationDialog: true, //this does not work properly. Possibly a bug in FlutterFire - actions: [ - SignedOutAction((context) { - Get.back(); - controller.logout(); - Get.rootDelegate.toNamed(Screen.PROFILE.route); - // Navigator.of(context).pop(); - }), - AccountDeletedAction((context, user) { - //If we don't include this the button is still shown but no action gets done. Ideally the button should also not be shown. Its a bug in FlutterFire - Get.defaultDialog( - //this is only called after the delete is done and not useful for confirmation of the delete action - title: 'Deleted Account of ${user.displayName}', - barrierDismissible: true, - navigatorKey: Get.nestedKey(Screen.HOME.route), - ); - }) - ], - children: [ - //This is to show that we can add custom content here - const Divider(), - controller.currentUser?.email != null - ? TextButton.icon( - onPressed: callChangePwdDialog, - label: const Text('Change Password'), - icon: const Icon(Icons.password_rounded), - ) - : const SizedBox.shrink(), - ImagePickerButton(callback: (String? path) async { - if (path != null) { - //Upload to Store - String? dest = await controller.uploadFile(path); - //attach it to User imageUrl - if (dest != null) { - await controller.updatePhotoURL(dest); - } - } - }) - ], - ) + ), + ), + ), + // showDeleteConfirmationDialog: true, //this does not work properly. Possibly a bug in FlutterFire + actions: [ + SignedOutAction((context) { + Get.back(); + controller.logout(); + Get.rootDelegate.toNamed(Screen.PROFILE.route); + // Navigator.of(context).pop(); + }), + AccountDeletedAction((context, user) { + //If we don't include this the button is still shown but no action gets done. Ideally the button should also not be shown. Its a bug in FlutterFire + Get.defaultDialog( + //this is only called after the delete is done and not useful for confirmation of the delete action + title: 'Deleted Account of ${user.displayName}', + barrierDismissible: true, + navigatorKey: Get.nestedKey(Screen.HOME.route), + ); + }) + ], + children: [ + //This is to show that we can add custom content here + const Divider(), + controller.currentUser?.email != null + ? TextButton.icon( + onPressed: callChangePwdDialog, + label: const Text('Change Password'), + icon: const Icon(Icons.password_rounded), + ) + : const SizedBox.shrink(), + TextButton.icon( + onPressed: () => _resetPasswordEmailVerification(context), + label: const Text('Reset Password'), + icon: const Icon(Icons.email_rounded), + ), + ImagePickerButton(callback: (String? path) async { + if (path != null) { + //Upload to Store + String? dest = await controller.uploadFile(path); + //attach it to User imageUrl + if (dest != null) { + await controller.updatePhotoURL(dest); + } + else { + Get.snackbar( + 'Error', + 'Failed to pick image.', + snackPosition: SnackPosition.BOTTOM, + ); + } + } + }) + ], + ) : const Scaffold(); } @@ -121,4 +134,31 @@ class ProfileView extends GetView { textCancel: "Cancel", onConfirm: dlg.onSubmit); } + + Future _resetPasswordEmailVerification(BuildContext context) async { + final email = controller.currentUser?.email; + if (email != null) { + try { + await FirebaseAuth.instance.sendPasswordResetEmail(email: email); + controller.logout(); + Get.snackbar( + 'Success', + 'Password reset email sent. Please check your inbox.', + snackPosition: SnackPosition.BOTTOM, + ); + } catch (e) { + Get.snackbar( + 'Error', + 'Failed to send password reset email: $e', + snackPosition: SnackPosition.BOTTOM, + ); + } + } else { + Get.snackbar( + 'Error', + 'No email associated with this account.', + snackPosition: SnackPosition.BOTTOM, + ); + } + } } From 7f2c1667b5269469f69a30c10d2da6e9348511ee Mon Sep 17 00:00:00 2001 From: neminsheth Date: Fri, 12 Jul 2024 22:51:13 +0530 Subject: [PATCH 3/5] Working: TODO: Ensure Reset Password has Email verification --- .../modules/profile/views/profile_view.dart | 74 ++++++++++--------- lib/app/widgets/image_picker_button.dart | 35 +++++---- 2 files changed, 61 insertions(+), 48 deletions(-) diff --git a/lib/app/modules/profile/views/profile_view.dart b/lib/app/modules/profile/views/profile_view.dart index e5be965f..327a6193 100644 --- a/lib/app/modules/profile/views/profile_view.dart +++ b/lib/app/modules/profile/views/profile_view.dart @@ -92,48 +92,54 @@ class ProfileView extends GetView { //This is to show that we can add custom content here const Divider(), controller.currentUser?.email != null - ? TextButton.icon( - onPressed: callChangePwdDialog, - label: const Text('Change Password'), - icon: const Icon(Icons.password_rounded), - ) - : const SizedBox.shrink(), - TextButton.icon( + // ? TextButton.icon( + // onPressed: callChangePwdDialog, + // label: const Text('Change Password'), + // icon: const Icon(Icons.password_rounded), + // ) + // : const SizedBox.shrink(), + ? TextButton.icon( onPressed: () => _resetPasswordEmailVerification(context), label: const Text('Reset Password'), icon: const Icon(Icons.email_rounded), - ), - ImagePickerButton(callback: (String? path) async { - if (path != null) { - //Upload to Store - String? dest = await controller.uploadFile(path); - //attach it to User imageUrl - if (dest != null) { - await controller.updatePhotoURL(dest); - } - else { - Get.snackbar( - 'Error', - 'Failed to pick image.', - snackPosition: SnackPosition.BOTTOM, - ); - } - } - }) + ) + : const SizedBox.shrink(), + // ImagePickerButton( + // callback: (String? path) async { + // if (path != null) { + // String? dest = await controller.uploadFile(path); + // if (dest != null) { + // await controller.updatePhotoURL(dest); + // } else { + // Get.snackbar( + // 'Error', + // 'Failed to upload image.', + // snackPosition: SnackPosition.BOTTOM, + // ); + // } + // } else { + // Get.snackbar( + // 'Error', + // 'Failed to pick image.', + // snackPosition: SnackPosition.BOTTOM, + // ); + // } + // }, + // ), ], ) : const Scaffold(); } - void callChangePwdDialog() { - var dlg = ChangePasswordDialog(controller.currentUser!); - Get.defaultDialog( - title: "Change Password", - content: dlg, - textConfirm: "Submit", - textCancel: "Cancel", - onConfirm: dlg.onSubmit); - } + // void callChangePwdDialog() { + // var dlg = ChangePasswordDialog(controller.currentUser!); + // Get.defaultDialog( + // title: "Change Password", + // content: dlg, + // textConfirm: "Submit", + // textCancel: "Cancel", + // onConfirm: dlg.onSubmit); + // } Future _resetPasswordEmailVerification(BuildContext context) async { final email = controller.currentUser?.email; diff --git a/lib/app/widgets/image_picker_button.dart b/lib/app/widgets/image_picker_button.dart index d6e87ff4..9082249e 100644 --- a/lib/app/widgets/image_picker_button.dart +++ b/lib/app/widgets/image_picker_button.dart @@ -24,14 +24,14 @@ enum ImageSources implements ActionEnum { case ImageSources.file: return await getFile(); default: + return null; } - return null; } @override - final IconData? icon; + final IconData icon; @override - final String? label; + final String label; static Future getImage(ImageSource imageSource) async { final pickedFile = await ImagePicker().pickImage(source: imageSource); @@ -53,7 +53,6 @@ enum ImageSources implements ActionEnum { GetStorage().write(fileName, fileBytes); return fileName; - //result.files.single.path;//is causing issues for Web, see https://github.com/miguelpruivo/flutter_file_picker/wiki/FAQ } else { Get.snackbar('Error', 'Image Not Selected'); return null; @@ -64,28 +63,36 @@ enum ImageSources implements ActionEnum { class ImagePickerButton extends MenuSheetButton { final ValueSetter? callback; - const ImagePickerButton( - {super.key, - super.icon = const Icon(Icons.image), - super.label = 'Pick an Image', - this.callback}); + const ImagePickerButton({ + super.key, + super.icon = const Icon(Icons.image), + super.label = 'Pick an Image', + this.callback, + }); @override Iterable get values => ImageSources.values; @override void callbackFunc(act) { - if (callback != null) callback!(act); + if (callback != null && act != null) { + callback!(act); + } } @override Widget build(BuildContext context) { return !(GetPlatform.isAndroid || GetPlatform.isIOS) ? TextButton.icon( - onPressed: () async => callbackFunc(await ImageSources.getFile()), - icon: icon, - label: const Text('Pick an Image'), - ) + onPressed: () async { + var result = await ImageSources.getFile(); + if (result != null) { + callbackFunc(result); + } + }, + icon: icon, + label: const Text('Pick an Image'), + ) : builder(context); } } From 038adb5b345087423022a0e358fab8b9dd24010f Mon Sep 17 00:00:00 2001 From: neminsheth Date: Sun, 14 Jul 2024 01:02:39 +0530 Subject: [PATCH 4/5] Fix null check error in ImagePickerButton and improve null handling in ProfileView and ProfileController --- .../modules/profile/views/profile_view.dart | 48 ++++------------- lib/app/widgets/image_picker_button.dart | 54 ++++++++++++------- 2 files changed, 45 insertions(+), 57 deletions(-) diff --git a/lib/app/modules/profile/views/profile_view.dart b/lib/app/modules/profile/views/profile_view.dart index 327a6193..764954b8 100644 --- a/lib/app/modules/profile/views/profile_view.dart +++ b/lib/app/modules/profile/views/profile_view.dart @@ -92,54 +92,28 @@ class ProfileView extends GetView { //This is to show that we can add custom content here const Divider(), controller.currentUser?.email != null - // ? TextButton.icon( - // onPressed: callChangePwdDialog, - // label: const Text('Change Password'), - // icon: const Icon(Icons.password_rounded), - // ) - // : const SizedBox.shrink(), ? TextButton.icon( onPressed: () => _resetPasswordEmailVerification(context), label: const Text('Reset Password'), icon: const Icon(Icons.email_rounded), ) : const SizedBox.shrink(), - // ImagePickerButton( - // callback: (String? path) async { - // if (path != null) { - // String? dest = await controller.uploadFile(path); - // if (dest != null) { - // await controller.updatePhotoURL(dest); - // } else { - // Get.snackbar( - // 'Error', - // 'Failed to upload image.', - // snackPosition: SnackPosition.BOTTOM, - // ); - // } - // } else { - // Get.snackbar( - // 'Error', - // 'Failed to pick image.', - // snackPosition: SnackPosition.BOTTOM, - // ); - // } - // }, - // ), + ImagePickerButton(callback: (String? path) async { + if (path != null) { + //Upload to Store + String? dest = await controller.uploadFile(path); + //attach it to User imageUrl + if (dest != null) { + await controller.updatePhotoURL(dest); + } + } + }) ], ) : const Scaffold(); } - // void callChangePwdDialog() { - // var dlg = ChangePasswordDialog(controller.currentUser!); - // Get.defaultDialog( - // title: "Change Password", - // content: dlg, - // textConfirm: "Submit", - // textCancel: "Cancel", - // onConfirm: dlg.onSubmit); - // } + Future _resetPasswordEmailVerification(BuildContext context) async { final email = controller.currentUser?.email; diff --git a/lib/app/widgets/image_picker_button.dart b/lib/app/widgets/image_picker_button.dart index 9082249e..dbd504ef 100644 --- a/lib/app/widgets/image_picker_button.dart +++ b/lib/app/widgets/image_picker_button.dart @@ -24,14 +24,14 @@ enum ImageSources implements ActionEnum { case ImageSources.file: return await getFile(); default: - return null; } + return null; } @override - final IconData icon; + final IconData? icon; @override - final String label; + final String? label; static Future getImage(ImageSource imageSource) async { final pickedFile = await ImagePicker().pickImage(source: imageSource); @@ -44,14 +44,37 @@ enum ImageSources implements ActionEnum { } static Future getFile() async { - FilePickerResult? result = await FilePicker.platform - .pickFiles(type: FileType.image, allowMultiple: false); + if (GetPlatform.isWeb) { + // Web-specific file picking logic + return await getWebFile(); + } else { + FilePickerResult? result = await FilePicker.platform.pickFiles( + type: FileType.image, + allowMultiple: false, + ); + + if (result != null && result.files.isNotEmpty) { + final fileBytes = result.files.first.bytes; + final fileName = result.files.first.name; + GetStorage().write(fileName, fileBytes); + return fileName; + } else { + Get.snackbar('Error', 'Image Not Selected'); + return null; + } + } + } + + static Future getWebFile() async { + FilePickerResult? result = await FilePicker.platform.pickFiles( + type: FileType.image, + allowMultiple: false, + ); if (result != null && result.files.isNotEmpty) { final fileBytes = result.files.first.bytes; final fileName = result.files.first.name; GetStorage().write(fileName, fileBytes); - return fileName; } else { Get.snackbar('Error', 'Image Not Selected'); @@ -75,24 +98,15 @@ class ImagePickerButton extends MenuSheetButton { @override void callbackFunc(act) { - if (callback != null && act != null) { - callback!(act); - } + if (callback != null) callback!(act); } @override Widget build(BuildContext context) { - return !(GetPlatform.isAndroid || GetPlatform.isIOS) - ? TextButton.icon( - onPressed: () async { - var result = await ImageSources.getFile(); - if (result != null) { - callbackFunc(result); - } - }, + return TextButton.icon( + onPressed: () async => callbackFunc(await ImageSources.getFile()), icon: icon, label: const Text('Pick an Image'), - ) - : builder(context); + ); } -} +} \ No newline at end of file From 134d8a4d0a8a54c3d857c833c20dc769e913123f Mon Sep 17 00:00:00 2001 From: neminsheth <102215781+neminsheth@users.noreply.github.com> Date: Fri, 19 Jul 2024 18:16:55 +0530 Subject: [PATCH 5/5] Removed firebase.json I had already added firebase.json to .gitignore, but I'm not sure how it got committed. Have removed it now. --- firebase.json | 1 - 1 file changed, 1 deletion(-) delete mode 100644 firebase.json diff --git a/firebase.json b/firebase.json deleted file mode 100644 index 6643fe7b..00000000 --- a/firebase.json +++ /dev/null @@ -1 +0,0 @@ -{"flutter":{"platforms":{"dart":{"lib/firebase_options.dart":{"projectId":"sharekhan-nemin","configurations":{"android":"1:56053565487:android:f0e57a6359c84f97cb5eda","ios":"1:56053565487:ios:3515d315addadb07cb5eda","macos":"1:56053565487:ios:3515d315addadb07cb5eda","web":"1:56053565487:web:bdde9b35d35b497ccb5eda","windows":"1:56053565487:web:5c35ec65002974a6cb5eda"}}},"ios":{"default":{"projectId":"sharekhan-nemin","appId":"1:56053565487:ios:3515d315addadb07cb5eda","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"android":{"default":{"projectId":"sharekhan-nemin","appId":"1:56053565487:android:f0e57a6359c84f97cb5eda","fileOutput":"android/app/google-services.json"}},"macos":{"default":{"projectId":"sharekhan-nemin","appId":"1:56053565487:ios:3515d315addadb07cb5eda","uploadDebugSymbols":false,"fileOutput":"macos/Runner/GoogleService-Info.plist"}}}}} \ No newline at end of file