Skip to content

Commit

Permalink
addressing comments (#23692)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkhan.nausharipov committed Jan 12, 2023
1 parent dc4e142 commit f33a4c2
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 234 deletions.
2 changes: 1 addition & 1 deletion learning/tour-of-beam/frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ However, after changes you may need to re-run code generation:
cd beam
./gradlew :playground:frontend:playground_components:generateCode
cd learning/tour-of-beam/frontend
flutter pub run build_runner build
flutter pub run build_runner build --delete-conflicting-outputs
```

### Run
Expand Down
27 changes: 0 additions & 27 deletions learning/tour-of-beam/frontend/lib/auth/method.dart

This file was deleted.

162 changes: 0 additions & 162 deletions learning/tour-of-beam/frontend/lib/auth/method.g.dart

This file was deleted.

11 changes: 3 additions & 8 deletions learning/tour-of-beam/frontend/lib/auth/notifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,10 @@
import 'dart:async';

import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart';
import 'package:flutter/material.dart';
import 'method.dart';

class AuthNotifier extends ChangeNotifier {
final _authProviders = UnmodifiableAuthMethodMap(
google: GoogleAuthProvider(),
github: GithubAuthProvider(),
);

AuthNotifier() {
FirebaseAuth.instance.authStateChanges().listen((user) {
notifyListeners();
Expand All @@ -40,8 +35,8 @@ class AuthNotifier extends ChangeNotifier {
return await FirebaseAuth.instance.currentUser?.getIdToken();
}

Future<void> logIn(AuthMethod authMethod) async {
await FirebaseAuth.instance.signInWithPopup(_authProviders.get(authMethod));
Future<void> logIn(AuthProvider authProvider) async {
await FirebaseAuth.instance.signInWithPopup(authProvider);
}

Future<void> logOut() async {
Expand Down
1 change: 1 addition & 0 deletions learning/tour-of-beam/frontend/lib/cache/cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:flutter/material.dart';

import '../repositories/client/client.dart';

/// A base class for caching entities from network requests.
abstract class Cache extends ChangeNotifier {
final TobClient client;

Expand Down
3 changes: 1 addition & 2 deletions learning/tour-of-beam/frontend/lib/cache/content_tree.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class ContentTreeCache extends Cache {
final _futuresBySdkId = <String, Future<ContentTreeModel>>{};

ContentTreeModel? getContentTree(String sdkId) {
final future = _futuresBySdkId[sdkId];
if (future == null) {
if (_futuresBySdkId.containsKey(sdkId)) {
unawaited(_loadContentTree(sdkId));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
*/

import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get_it/get_it.dart';
import 'package:playground_components/playground_components.dart';

import '../../assets/assets.gen.dart';
import '../../auth/method.dart';
import '../../auth/notifier.dart';
import '../../constants/sizes.dart';

Expand Down Expand Up @@ -132,7 +132,7 @@ class _BrandedLoginButtons extends StatelessWidget {
const SizedBox(height: BeamSizes.size16),
ElevatedButton.icon(
onPressed: () async {
await authNotifier.logIn(AuthMethod.google);
await authNotifier.logIn(GoogleAuthProvider());
onLoggedIn();
},
style: isLightTheme ? googleLightButtonStyle : darkButtonStyle,
Expand Down
37 changes: 8 additions & 29 deletions learning/tour-of-beam/frontend/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ packages:
name: _flutterfire_internals
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.9"
version: "1.0.12"
aligned_dialog:
dependency: transitive
description:
Expand All @@ -35,7 +35,7 @@ packages:
name: app_state
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.1"
version: "0.8.4"
archive:
dependency: transitive
description:
Expand Down Expand Up @@ -155,20 +155,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
cloud_firestore_platform_interface:
dependency: transitive
description:
name: cloud_firestore_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "5.9.0"
cloud_firestore_web:
dependency: transitive
description:
name: cloud_firestore_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
code_builder:
dependency: transitive
description:
Expand Down Expand Up @@ -254,19 +240,12 @@ packages:
source: hosted
version: "0.0.2"
enum_map:
dependency: "direct main"
dependency: transitive
description:
name: enum_map
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
enum_map_gen:
dependency: "direct dev"
description:
name: enum_map_gen
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
equatable:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -303,12 +282,12 @@ packages:
source: hosted
version: "4.1.4"
firebase_auth_platform_interface:
dependency: transitive
dependency: "direct main"
description:
name: firebase_auth_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "6.11.3"
version: "6.11.7"
firebase_auth_web:
dependency: transitive
description:
Expand All @@ -322,7 +301,7 @@ packages:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.4.1"
firebase_core_platform_interface:
dependency: transitive
description:
Expand All @@ -336,7 +315,7 @@ packages:
name: firebase_core_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.1.0"
fixnum:
dependency: transitive
description:
Expand All @@ -355,7 +334,7 @@ packages:
name: flutter_code_editor
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
version: "0.2.5"
flutter_driver:
dependency: transitive
description: flutter
Expand Down
3 changes: 1 addition & 2 deletions learning/tour-of-beam/frontend/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ dependencies:
easy_localization: ^3.0.1
easy_localization_ext: ^0.1.0
easy_localization_loader: ^1.0.0
enum_map: ^0.2.1
firebase_auth: ^4.1.1
firebase_auth_platform_interface: ^6.11.7
firebase_core: ^2.1.1
flutter: { sdk: flutter }
flutter_markdown: ^0.6.12
Expand All @@ -52,7 +52,6 @@ dependencies:

dev_dependencies:
build_runner: ^2.2.0
enum_map_gen: ^0.2.0
equatable: ^2.0.5
flutter_gen_runner: ^4.3.0
flutter_test: { sdk: flutter }
Expand Down
2 changes: 1 addition & 1 deletion learning/tour-of-beam/frontend/test/main_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
*/

void main() {
// TODO(nausharipov): add unit and integration tests
// TODO(nausharipov): add unit and integration tests: // https://github.com/apache/beam/issues/24982
}

0 comments on commit f33a4c2

Please sign in to comment.