diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml new file mode 100644 index 0000000..d8a0ed1 --- /dev/null +++ b/.idea/libraries/Dart_Packages.xml @@ -0,0 +1,832 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml new file mode 100644 index 0000000..4c421aa --- /dev/null +++ b/.idea/libraries/Flutter_Plugins.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/android/app/build.gradle b/app/android/app/build.gradle index 14745d7..5c0a675 100644 --- a/app/android/app/build.gradle +++ b/app/android/app/build.gradle @@ -2,6 +2,7 @@ plugins { id "com.android.application" id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" + id "com.google.gms.google-services" } def localProperties = new Properties() @@ -51,11 +52,30 @@ android { versionName flutterVersionName } + signingConfigs { + if (System.getenv("APKSIGN_KEYSTORE") != null) { + release { + storeFile file(System.getenv("APKSIGN_KEYSTORE")) + storePassword System.getenv("APKSIGN_KEYSTORE_PASS") + keyAlias System.getenv("APKSIGN_KEY_ALIAS") + keyPassword System.getenv("APKSIGN_KEY_PASS") + } + } else { + release { + keyAlias 'cloud-gallery' + keyPassword 'canopas@cloud-gallery' + storeFile file('dev.jks') + storePassword 'canopas@cloud-gallery' + } + } + } + buildTypes { + debug { + signingConfig signingConfigs.release + } release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig signingConfigs.release } } } @@ -64,4 +84,4 @@ flutter { source '../..' } -dependencies {} +dependencies {} \ No newline at end of file diff --git a/app/android/app/google-services.json b/app/android/app/google-services.json new file mode 100644 index 0000000..6b6f018 --- /dev/null +++ b/app/android/app/google-services.json @@ -0,0 +1,54 @@ +{ + "project_info": { + "project_number": "64221198282", + "project_id": "cloud-gallery-auth", + "storage_bucket": "cloud-gallery-auth.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:64221198282:android:64782148b88407396e8133", + "android_client_info": { + "package_name": "com.canopas.cloud_gallery" + } + }, + "oauth_client": [ + { + "client_id": "64221198282-3eg7r09fsl1u3s9tge7ud1206q18pkf7.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.canopas.cloud_gallery", + "certificate_hash": "38887addbb77aaeba38c77a211469aafe02b2b41" + } + }, + { + "client_id": "64221198282-3pk3g95eutmuj2u4h45ptorsbb64g3og.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyABDkRcwTA2gwgjBtx5GGNLgAsCHKY7Rpc" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "64221198282-3pk3g95eutmuj2u4h45ptorsbb64g3og.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "64221198282-h8h8gjo3991iijeg2agdkmfh6tr014nq.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "com.canopas.cloudGallery" + } + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/android/app/local.properties b/app/android/app/local.properties new file mode 100644 index 0000000..654aec0 --- /dev/null +++ b/app/android/app/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Wed Jan 17 14:17:41 IST 2024 +sdk.dir=/Users/pratikcanopas/Library/Android/sdk diff --git a/app/android/build.gradle b/app/android/build.gradle index e83fb5d..b0d5826 100644 --- a/app/android/build.gradle +++ b/app/android/build.gradle @@ -7,6 +7,7 @@ buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.google.gms:google-services:4.4.0" } } diff --git a/app/ios/Podfile.lock b/app/ios/Podfile.lock index ba916c3..a9a28a7 100644 --- a/app/ios/Podfile.lock +++ b/app/ios/Podfile.lock @@ -5,6 +5,17 @@ PODS: - AppAuth/Core (1.6.2) - AppAuth/ExternalUserAgent (1.6.2): - AppAuth/Core + - Firebase/CoreOnly (10.18.0): + - FirebaseCore (= 10.18.0) + - firebase_core (2.24.2): + - Firebase/CoreOnly (= 10.18.0) + - Flutter + - FirebaseCore (10.18.0): + - FirebaseCoreInternal (~> 10.0) + - GoogleUtilities/Environment (~> 7.12) + - GoogleUtilities/Logger (~> 7.12) + - FirebaseCoreInternal (10.19.0): + - "GoogleUtilities/NSData+zlib (~> 7.8)" - Flutter (1.0.0) - google_sign_in_ios (0.0.1): - Flutter @@ -14,42 +25,55 @@ PODS: - AppAuth (~> 1.5) - GTMAppAuth (< 3.0, >= 1.3) - GTMSessionFetcher/Core (< 4.0, >= 1.1) + - GoogleUtilities/Environment (7.12.0): + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.12.0): + - GoogleUtilities/Environment + - "GoogleUtilities/NSData+zlib (7.12.0)" - GTMAppAuth (2.0.0): - AppAuth/Core (~> 1.6) - GTMSessionFetcher/Core (< 4.0, >= 1.5) - GTMSessionFetcher/Core (3.2.0) - - shared_preferences_foundation (0.0.1): - - Flutter - - FlutterMacOS + - PromisesObjC (2.3.1) DEPENDENCIES: + - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - Flutter (from `Flutter`) - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) - - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) SPEC REPOS: trunk: - AppAuth + - Firebase + - FirebaseCore + - FirebaseCoreInternal - GoogleSignIn + - GoogleUtilities - GTMAppAuth - GTMSessionFetcher + - PromisesObjC EXTERNAL SOURCES: + firebase_core: + :path: ".symlinks/plugins/firebase_core/ios" Flutter: :path: Flutter google_sign_in_ios: :path: ".symlinks/plugins/google_sign_in_ios/darwin" - shared_preferences_foundation: - :path: ".symlinks/plugins/shared_preferences_foundation/darwin" SPEC CHECKSUMS: AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570 + Firebase: 414ad272f8d02dfbf12662a9d43f4bba9bec2a06 + firebase_core: 0af4a2b24f62071f9bf283691c0ee41556dcb3f5 + FirebaseCore: 2322423314d92f946219c8791674d2f3345b598f + FirebaseCoreInternal: b444828ea7cfd594fca83046b95db98a2be4f290 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 google_sign_in_ios: 1bfaf6607b44cd1b24c4d4bc39719870440f9ce1 GoogleSignIn: b232380cf495a429b8095d3178a8d5855b42e842 + GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae GTMSessionFetcher: 41b9ef0b4c08a6db4b7eb51a21ae5183ec99a2c8 - shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 + PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4 PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189 diff --git a/app/ios/Runner.xcodeproj/project.pbxproj b/app/ios/Runner.xcodeproj/project.pbxproj index 14ab8ba..d23556a 100644 --- a/app/ios/Runner.xcodeproj/project.pbxproj +++ b/app/ios/Runner.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + ADB0F54A909CECF6AE7126A9 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DCBF06C22B4C2B81ABC49EC /* GoogleService-Info.plist */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -45,6 +46,7 @@ 0B0DC1FB5EAC2980BA93FC3A /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 1DCBF06C22B4C2B81ABC49EC /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; @@ -129,6 +131,7 @@ 331C8082294A63A400263BE5 /* RunnerTests */, 1812CDCCD7D8EE1D81BEB3EF /* Pods */, E90E204BBB1CD9A3DD7B3F25 /* Frameworks */, + 1DCBF06C22B4C2B81ABC49EC /* GoogleService-Info.plist */, ); sourceTree = ""; }; @@ -265,6 +268,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ADB0F54A909CECF6AE7126A9 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/app/ios/Runner/GoogleService-Info.plist b/app/ios/Runner/GoogleService-Info.plist new file mode 100644 index 0000000..caae6a0 --- /dev/null +++ b/app/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 64221198282-h8h8gjo3991iijeg2agdkmfh6tr014nq.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.64221198282-h8h8gjo3991iijeg2agdkmfh6tr014nq + API_KEY + AIzaSyDOoeWHX2RlxHcQ_QUHvR-tZJk_RsFluwY + GCM_SENDER_ID + 64221198282 + PLIST_VERSION + 1 + BUNDLE_ID + com.canopas.cloudGallery + PROJECT_ID + cloud-gallery-auth + STORAGE_BUCKET + cloud-gallery-auth.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:64221198282:ios:fcb315ff1f4bb4a66e8133 + + \ No newline at end of file diff --git a/app/ios/Runner/Info.plist b/app/ios/Runner/Info.plist index 65b37b6..cee9707 100644 --- a/app/ios/Runner/Info.plist +++ b/app/ios/Runner/Info.plist @@ -12,6 +12,19 @@ $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 + GIDClientID + 64221198282-h8h8gjo3991iijeg2agdkmfh6tr014nq.apps.googleusercontent.com + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLSchemes + + com.googleusercontent.apps.64221198282-h8h8gjo3991iijeg2agdkmfh6tr014nq + + + CFBundleName cloud_gallery CFBundlePackageType diff --git a/app/ios/firebase_app_id_file.json b/app/ios/firebase_app_id_file.json new file mode 100644 index 0000000..cf0114a --- /dev/null +++ b/app/ios/firebase_app_id_file.json @@ -0,0 +1,7 @@ +{ + "file_generated_by": "FlutterFire CLI", + "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", + "GOOGLE_APP_ID": "1:64221198282:ios:fcb315ff1f4bb4a66e8133", + "FIREBASE_PROJECT_ID": "cloud-gallery-auth", + "GCM_SENDER_ID": "64221198282" +} \ No newline at end of file diff --git a/app/lib/firebase_options.dart b/app/lib/firebase_options.dart new file mode 100644 index 0000000..e12dc21 --- /dev/null +++ b/app/lib/firebase_options.dart @@ -0,0 +1,70 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for web - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyABDkRcwTA2gwgjBtx5GGNLgAsCHKY7Rpc', + appId: '1:64221198282:android:64782148b88407396e8133', + messagingSenderId: '64221198282', + projectId: 'cloud-gallery-auth', + storageBucket: 'cloud-gallery-auth.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyDOoeWHX2RlxHcQ_QUHvR-tZJk_RsFluwY', + appId: '1:64221198282:ios:fcb315ff1f4bb4a66e8133', + messagingSenderId: '64221198282', + projectId: 'cloud-gallery-auth', + storageBucket: 'cloud-gallery-auth.appspot.com', + androidClientId: '64221198282-3eg7r09fsl1u3s9tge7ud1206q18pkf7.apps.googleusercontent.com', + iosClientId: '64221198282-h8h8gjo3991iijeg2agdkmfh6tr014nq.apps.googleusercontent.com', + iosBundleId: 'com.canopas.cloudGallery', + ); +} diff --git a/app/lib/main.dart b/app/lib/main.dart index ebc08bf..6581d8a 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -1,8 +1,19 @@ +import 'package:cloud_gallery/firebase_options.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'ui/app.dart'; -void main() { - runApp(const CloudGalleryApp()); +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + + final container = ProviderContainer(); + runApp(UncontrolledProviderScope( + container: container, child: const CloudGalleryApp())); } class CloudGalleryApp extends StatefulWidget { @@ -18,4 +29,3 @@ class _CloudGalleryAppState extends State { return const App(); } } - diff --git a/app/lib/ui/flow/main/main_screen.dart b/app/lib/ui/flow/main/main_screen.dart index de5e872..16305e4 100644 --- a/app/lib/ui/flow/main/main_screen.dart +++ b/app/lib/ui/flow/main/main_screen.dart @@ -11,8 +11,9 @@ class _MainScreenState extends State { @override Widget build(BuildContext context) { return const Scaffold( - body: Center( - child: Text("Home Screen"), - )); + body: Center( + child: Text('Home Screen'), + ), + ); } } diff --git a/app/lib/ui/flow/settings /settings_screen.dart b/app/lib/ui/flow/settings /settings_screen.dart deleted file mode 100644 index b611ddb..0000000 --- a/app/lib/ui/flow/settings /settings_screen.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:flutter/material.dart'; - -class SettingsScreen extends StatefulWidget { - const SettingsScreen({super.key}); - - @override - State createState() => _SettingsScreenState(); -} - -class _SettingsScreenState extends State { - @override - Widget build(BuildContext context) { - return const Scaffold( - body: Center( - child: Text("Settings Screen"), - ), - ); - } -} diff --git a/app/lib/ui/navigation/app_router.dart b/app/lib/ui/navigation/app_router.dart index 77be5c0..2821b13 100644 --- a/app/lib/ui/navigation/app_router.dart +++ b/app/lib/ui/navigation/app_router.dart @@ -1,5 +1,4 @@ import 'package:cloud_gallery/ui/flow/main/main_screen.dart'; -import 'package:cloud_gallery/ui/flow/settings%20/settings_screen.dart'; import 'package:go_router/go_router.dart'; import 'app_route.dart'; @@ -9,21 +8,11 @@ class AppRouter { builder: (context) => const HomeScreen(), ); - static AppRoute get settings => AppRoute( - AppRoutePath.settings, - builder: (context) => const SettingsScreen(), - ); - static final routes = [ home.goRoute, - GoRoute( - path: AppRoutePath.settings, - builder: (context, state) => state.widget(context), - ), ]; } class AppRoutePath { static const home = '/'; - static const settings = '/settings'; } diff --git a/app/macos/Flutter/GeneratedPluginRegistrant.swift b/app/macos/Flutter/GeneratedPluginRegistrant.swift index 82f2a45..8fd83c1 100644 --- a/app/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/app/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,8 +5,10 @@ import FlutterMacOS import Foundation +import firebase_core import google_sign_in_ios func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) } diff --git a/app/pubspec.lock b/app/pubspec.lock index 8b6bddf..1910b49 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -240,6 +240,14 @@ packages: relative: true source: path version: "0.0.1" + extension_google_sign_in_as_googleapis_auth: + dependency: transitive + description: + name: extension_google_sign_in_as_googleapis_auth + sha256: bcf4f8dedcc1e66ce5fe98fbd98cc86ed25ad7fce0511e8d6cdc46ccbf421e8e + url: "https://pub.dev" + source: hosted + version: "2.0.12" fake_async: dependency: transitive description: @@ -256,6 +264,30 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.0" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + sha256: "96607c0e829a581c2a483c658f04e8b159964c3bae2730f73297070bc85d40bb" + url: "https://pub.dev" + source: hosted + version: "2.24.2" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 + url: "https://pub.dev" + source: hosted + version: "5.0.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: d585bdf3c656c3f7821ba1bd44da5f13365d22fcecaf5eb75c4295246aaa83c0 + url: "https://pub.dev" + source: hosted + version: "2.10.0" fixnum: dependency: transitive description: @@ -301,7 +333,7 @@ packages: source: sdk version: "0.0.0" freezed: - dependency: "direct dev" + dependency: "direct main" description: name: freezed sha256: "6c5031daae12c7072b3a87eff98983076434b4889ef2a44384d0cae3f82372ba" @@ -309,7 +341,7 @@ packages: source: hosted version: "2.4.6" freezed_annotation: - dependency: transitive + dependency: "direct main" description: name: freezed_annotation sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d @@ -396,6 +428,14 @@ packages: url: "https://pub.dev" source: hosted version: "12.0.0" + googleapis_auth: + dependency: transitive + description: + name: googleapis_auth + sha256: "127b1bbd32170ab8312f503bd57f1d654d8e4039ddfbc63c027d3f7ade0eff74" + url: "https://pub.dev" + source: hosted + version: "1.3.1" graphs: dependency: transitive description: @@ -416,10 +456,10 @@ packages: dependency: transitive description: name: http - sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139 + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "0.13.6" http_multi_server: dependency: transitive description: @@ -456,10 +496,10 @@ packages: dependency: transitive description: name: js - sha256: "4186c61b32f99e60f011f7160e32c89a758ae9b1d0c6d28e2c02ef0382300e2b" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.6.7" json_annotation: dependency: transitive description: diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 10bfea1..547a6b1 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -32,6 +32,13 @@ dependencies: # navigation go_router: ^13.0.1 + # core + firebase_core: ^2.24.2 + + # code generation + freezed: ^2.4.6 + freezed_annotation: ^2.4.1 + dev_dependencies: flutter_test: @@ -43,7 +50,8 @@ dev_dependencies: # code generation build_runner: ^2.3.3 - freezed: ^2.4.6 + + flutter: diff --git a/app/windows/flutter/generated_plugin_registrant.cc b/app/windows/flutter/generated_plugin_registrant.cc index 8b6d468..1a82e7d 100644 --- a/app/windows/flutter/generated_plugin_registrant.cc +++ b/app/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + FirebaseCorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); } diff --git a/app/windows/flutter/generated_plugins.cmake b/app/windows/flutter/generated_plugins.cmake index b93c4c3..fa8a39b 100644 --- a/app/windows/flutter/generated_plugins.cmake +++ b/app/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + firebase_core ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/build_watch b/build_watch new file mode 100755 index 0000000..cf7c5a9 --- /dev/null +++ b/build_watch @@ -0,0 +1,23 @@ +#!/bin/bash + +# Function to terminate all background processes on exit +function cleanup { + pkill -P $$ +} +trap cleanup EXIT + +# Function to keep running a command until it succeeds +function keep_running { + while true; do + dart run build_runner watch --delete-conflicting-outputs; + echo "Command failed with no zero exit code. Respawning.." + sleep 1 + done +} + +# Navigate to each project directory and run the watcher in the background +(cd app && keep_running) & +(cd data && keep_running) & + +# Wait for all background processes to finish +wait diff --git a/data/.flutter-plugins-dependencies b/data/.flutter-plugins-dependencies index ece4333..432e794 100644 --- a/data/.flutter-plugins-dependencies +++ b/data/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_sign_in_ios","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"google_sign_in_android","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_android-6.1.21/","native_build":true,"dependencies":[]}],"macos":[{"name":"google_sign_in_ios","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"google_sign_in_web","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_web-0.12.3+2/","dependencies":[]}]},"dependencyGraph":[{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]}],"date_created":"2024-01-16 16:13:35.297035","version":"3.16.5"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_sign_in_ios","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"google_sign_in_android","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_android-6.1.21/","native_build":true,"dependencies":[]}],"macos":[{"name":"google_sign_in_ios","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"google_sign_in_web","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_web-0.12.3+2/","dependencies":[]}]},"dependencyGraph":[{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]}],"date_created":"2024-01-17 19:19:20.833539","version":"3.16.7"} \ No newline at end of file diff --git a/data/lib/services/auth_service.dart b/data/lib/services/auth_service.dart new file mode 100644 index 0000000..6753c34 --- /dev/null +++ b/data/lib/services/auth_service.dart @@ -0,0 +1,42 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:google_sign_in/google_sign_in.dart'; +import 'package:googleapis/drive/v3.dart' as drive; + +final googleSignInProvider = Provider( + (ref) => GoogleSignIn( + scopes: [ + drive.DriveApi.driveScope, + ], + ), +); + +final authServiceProvider = Provider( + (ref) => AuthService(ref.read(googleSignInProvider)), +); + +class AuthService { + final GoogleSignIn _googleSignIn; + + const AuthService( + this._googleSignIn, + ); + + Future signInWithGoogle() async { + try { + final googleSignInAccount = await _googleSignIn.signIn(); + if (googleSignInAccount != null) { + await googleSignInAccount.authentication; + } + } catch (_) { + rethrow; + } + } + + Future signOutWithGoogle() async { + try { + await _googleSignIn.signOut(); + } catch (_) { + rethrow; + } + } +} diff --git a/data/lib/services/google_drive_service.dart b/data/lib/services/google_drive_service.dart new file mode 100644 index 0000000..8e26ae9 --- /dev/null +++ b/data/lib/services/google_drive_service.dart @@ -0,0 +1,25 @@ +import 'package:extension_google_sign_in_as_googleapis_auth/extension_google_sign_in_as_googleapis_auth.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:google_sign_in/google_sign_in.dart'; +import 'package:googleapis/drive/v3.dart' as drive; +import 'auth_service.dart'; + +final googleDriveServiceProvider = Provider( + (ref) => GoogleDriveService(ref.read(googleSignInProvider)), +); + +class GoogleDriveService { + final GoogleSignIn _googleSignIn; + + const GoogleDriveService(this._googleSignIn); + + Future getDriveFiles() async { + if (_googleSignIn.currentUser != null) { + final client = await _googleSignIn.authenticatedClient(); + final driveApi = drive.DriveApi(client!); + await driveApi.files.list(); + + ///TODO: Convert File to custom object + } + } +} diff --git a/data/pubspec.yaml b/data/pubspec.yaml index bc02f81..da6ae01 100644 --- a/data/pubspec.yaml +++ b/data/pubspec.yaml @@ -12,7 +12,17 @@ dependencies: # services googleapis: ^12.0.0 + + # authentication google_sign_in: ^6.2.1 + extension_google_sign_in_as_googleapis_auth: ^2.0.12 + + # state management + flutter_riverpod: ^2.4.9 + + # ode generation + freezed: ^2.4.6 + freezed_annotation: ^2.4.1 dev_dependencies: flutter_test: @@ -24,7 +34,7 @@ dev_dependencies: # code generation build_runner: ^2.3.3 - freezed: ^2.4.6 + flutter: