Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update dependencies and fix tests #131

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/scripts/functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,34 @@ export const testFunctionTimeout = functions.https.onCall((data) => {
});
});

export const foo = functions.https.onCall((data) => {
return data
});

// For e2e testing that the caller is authorized
export const testFunctionAuthorized = functions.https.onCall(async (data, context) => {
console.log("testFunctionAuthorized called", data, context.auth);
if (!context.auth) {
throw new functions.https.HttpsError(
"unauthenticated",
"testFunctionAuthorized must be called while authenticated."
);
}
try {
return 'authorized';
} catch (e) {
throw new functions.https.HttpsError("internal", (e as any).message, (e as any).details);
}
});

// For e2e testing that the caller is authorized
export const testExceptions = functions.https.onCall(async (data, context) => {
if (data == 'bad-status') {
throw new functions.https.HttpsError("invalid-argument", "", "");
}
return {};
});

// For e2e testing errors & return values.
// noinspection JSUnusedGlobalSymbols
export const testFunctionDefaultRegion = functions.https.onCall((data) => {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/install-tools.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CMD /K dart pub global activate melos 1.0.0
CMD /K dart pub global activate melos 3.1.1
melos bootstrap
2 changes: 1 addition & 1 deletion .github/workflows/scripts/install-tools.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
dart pub global activate melos 1.0.0
dart pub global activate melos 3.1.1
melos bootstrap
15 changes: 8 additions & 7 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- fixes

jobs:
analyze:
Expand All @@ -16,7 +17,7 @@ jobs:
- name: 'Install Tools'
run: ./.github/workflows/scripts/install-tools.sh
- name: 'Analyze'
uses: invertase/github-action-dart-analyzer@v1
uses: invertase/github-action-dart-analyzer@v2.0.0
with:
fatal-infos: true
fatal-warnings: true
Expand All @@ -42,10 +43,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v2
name: Install Node.js 16
- uses: actions/setup-node@v3
name: Install Node.js 18
with:
node-version: '16'
node-version: '18'
- name: 'Install Flutter'
run: ./.github/workflows/scripts/install-flutter.sh stable
- name: 'Install Tools'
Expand Down Expand Up @@ -73,10 +74,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v2
name: Install Node.js 16
- uses: actions/setup-node@v3
name: Install Node.js 18
with:
node-version: '16'
node-version: '18'
- name: 'Install Flutter'
run: .\.github\workflows\scripts\install-flutter.bat stable
- name: 'Install Tools'
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ build/
.project
.classpath
.settings
/pubspec.yaml
.last_build_id

# Docs
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ To use this plugin, add the following dependencies to your app's `pubspec.yaml`

```yaml
dependencies:
firebase_auth: ^3.1.5
firebase_auth_desktop: ^0.1.1-dev.0
firebase_core: ^1.9.0
firebase_core_desktop: ^0.1.1-dev.0
firebase_auth: ^4.6.3
firebase_auth_desktop: ^0.1.2
firebase_core: ^2.0.0
firebase_core_desktop: ^0.1.2
```

## Firebase App Initialization
Expand Down
12 changes: 6 additions & 6 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: flutterfire_dart

packages:
- packages/**
- tests/*
- tests

scripts:
lint:all:
Expand All @@ -22,18 +22,18 @@ scripts:
test:
description: Run tests in a specific package.
run: melos exec --concurrency=1 -- "flutter test --no-pub --reporter expanded"
select-package:
dir-exists:
packageFilters:
dirExists:
- 'test/'

test:e2e:
run: |
melos exec -c 1 --fail-fast -- \
"flutter drive --no-pub --target=./test_driver/driver_e2e.dart"
description: |
Run all e2e tests.
select-package:
dir-exists:
packageFilters:
dirExists:
- test_driver
scope: '*tests*'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ dependencies:
cli_util: ^0.3.5
firebase_auth_dart: ^1.0.1
firebase_core_dart: ^1.0.1
dependency_overrides:
firebase_auth_dart:
path: ../
firebase_core_dart:
path: ../../../firebase_core/firebase_core_dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# melos_managed_dependency_overrides: firebase_auth_dart,firebase_core_dart
dependency_overrides:
firebase_auth_dart:
path: ..
firebase_core_dart:
path: ../../../firebase_core/firebase_core_dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class UserProfile extends APIDelegate {
returnSecureToken: true,
deleteAttribute: [
if (photoUrl == null) 'PHOTO_URL',
if (displayName == null) 'DISPLAY_NAME'
if (displayName == null) 'DISPLAY_NAME',
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,5 +454,5 @@ Map<AuthErrorCode, String> verbose = {
AuthErrorCode.ALREADY_INITIALIZED: 'initializeAuth() has already been called with '
'different options. To avoid this error, call initializeAuth() with the '
'same options as when it was originally called, or call getAuth() to return the'
' already initialized instance.'
' already initialized instance.',
};
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ConfirmationResult {
username: userData['screenName'],
profile: {
'displayName': userData['displayName'],
'photoUrl': userData['photoUrl']
'photoUrl': userData['photoUrl'],
},
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ class FirebaseAuth {
/// Resolve this by calling [fetchSignInMethodsForEmail] and then asking
/// the user to sign in using one of the returned providers.
/// Once the user is signed in, the original credential can be linked to
/// the user with [linkWithCredential].
/// the user with [User.linkWithCredential].
/// - `invalid-credential`
/// - Thrown if the credential is malformed or has expired.
/// - `operation-not-allowed`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ class TwitterAuthProvider extends AuthProvider {

/// Sets the OAuth custom parameters to pass in a Twitter OAuth request for
/// popup and redirect sign-in operations.
// ignore: avoid_returning_this
TwitterAuthProvider setCustomParameters(
Map<dynamic, dynamic> customOAuthParameters,
) {
_parameters = customOAuthParameters;
// ignore: avoid_returning_this
return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ class UserMetadata {

/// When this account was created as dictated by the server clock.
DateTime? get creationTime =>
DateTime.fromMillisecondsSinceEpoch(_creationTimestamp);
DateTime.fromMillisecondsSinceEpoch(_creationTimestamp, isUtc: true);

/// When the user last signed in as dictated by the server clock.
///
/// This is only accurate up to a granularity of 2 minutes for consecutive
/// sign-in attempts.
DateTime? get lastSignInTime =>
DateTime.fromMillisecondsSinceEpoch(_lastSignInTime);
DateTime.fromMillisecondsSinceEpoch(_lastSignInTime, isUtc: true);

@override
String toString() {
return 'UserMetadata(creationTime: ${creationTime.toString()}, lastSignInTime: ${lastSignInTime.toString()})';
return 'UserMetadata(creationTime: $creationTime, lastSignInTime: $lastSignInTime)';
}
}
2 changes: 1 addition & 1 deletion packages/firebase_auth/firebase_auth_dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository: https://github.com/invertase/flutterfire_desktop
version: 1.0.1

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.15.0 <3.0.0'

dependencies:
firebase_core_dart: ^1.0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# melos_managed_dependency_overrides: firebase_core_dart
dependency_overrides:
firebase_core_dart:
path: ../../firebase_core/firebase_core_dart
Loading