Skip to content

Commit

Permalink
Set set up firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-pratik-k committed Jan 17, 2024
1 parent 7c0ce11 commit 4960508
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 11 deletions.
30 changes: 26 additions & 4 deletions .idea/libraries/Dart_Packages.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/libraries/Flutter_Plugins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/lib/services/auth_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:googleapis/drive/v3.dart' as drive;
final googleSignInProvider = Provider(
(ref) => GoogleSignIn(
scopes: [
drive.DriveApi.driveFileScope,
drive.DriveApi.driveScope,
],
),
);
Expand Down
18 changes: 12 additions & 6 deletions data/lib/services/google_drive_service.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:extension_google_sign_in_as_googleapis_auth/extension_google_sign_in_as_googleapis_auth.dart';
import 'package:flutter/foundation.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;
Expand All @@ -15,14 +14,21 @@ class GoogleDriveService {
const GoogleDriveService(this._googleSignIn);

Future<void> getDriveFiles() async {
print("Getting drive files..");
if (_googleSignIn.currentUser != null) {
print("currentUser: ${_googleSignIn.currentUser}");
final client = await _googleSignIn.authenticatedClient();
if (client == null) return;
final driveApi = drive.DriveApi(client);
final files = await driveApi.files.list();
if (kDebugMode) {
print(files);
print("client: $client");
print("client is null: ${client == null}");
final driveApi = drive.DriveApi(client!);
try {
final files = await driveApi.files.list();
print(files.toJson());
} catch (e) {
print("Error: $e");
}
} else {
print("currentUser: null");
}
}
}

0 comments on commit 4960508

Please sign in to comment.