Skip to content
Merged
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
20 changes: 12 additions & 8 deletions .github/workflows/all_plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@

jobs:
analyze:
timeout-minutes: 45
timeout-minutes: 50
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: 'stable'
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
- uses: bluefireteam/melos-action@705015c3d2bc4ab94201ac24accb2bbe070cf533
with:
melos-version: '5.3.0'
- name: 'Run Analyze'
run: melos analyze-ci
- name: 'Validate Workspace'
if: always()
run: melos run validate:workspace

# Separated from "analyse" action as pubspec_override file is not being taken into account when running `flutter pub publish --dry-run`
# This will fail on CI until this is fixed: https://github.com/invertase/melos/issues/467
# You need to switch to Flutter 3.3.0, and run this test manually to check it works and update PR to confirm its success
pub_dry_run:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -83,9 +83,11 @@
format:
# switch back to ubuntu-latest when swiftformat is working again
runs-on: macos-latest
timeout-minutes: 20
timeout-minutes: 40
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
with:
fetch-depth: 0
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: 'stable'
Expand All @@ -107,15 +109,17 @@
run: |
clang-format --version
swiftformat --version
- name: 'Dart, Java and Objective-C '
- name: 'Dart, Java, Objective-C and Swift'
run: |
flutter pub global run flutter_plugin_tools format
flutter pub global run flutter_plugin_tools format --base-branch=origin/main
./.github/workflows/scripts/validate-formatting.sh
- name: 'Swift'
if: ${{ success() || failure() }}

# Clean generated build artificats(from format step) to prevent post run jobs from timing out
- name: Clean generated build artifacts
if: ${{ always() }}
run: |
swiftformat .
./.github/workflows/scripts/validate-formatting.sh
rm -rf build
find packages -type d -name build -prune -exec rm -rf {} +

build_examples_dart:
timeout-minutes: 30
Expand Down
3 changes: 2 additions & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
--indent 2
--maxwidth 100
--wrapparameters afterfirst
--disable sortedImports,unusedArguments,wrapMultilineStatementBraces
# Apple swift-format from flutter_plugin_tools requires `case .success(let value)` instead of `case let .success(value)`.
--disable sortedImports,unusedArguments,wrapMultilineStatementBraces,hoistPatternLet
--exclude Pods,**/MainFlutterWindow.swift,**/AppDelegate.swift,**/.symlinks/**
--swiftversion 5.7
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,41 @@

public class FlutterFirebaseFirestoreException extends Exception {
private static final String ERROR_ABORTED =
"The operation was aborted, typically due to a concurrency issue like transaction aborts, etc.";
"The operation was aborted, typically due to a concurrency issue like transaction aborts,"
+ " etc.";
private static final String ERROR_ALREADY_EXISTS =
"Some document that we attempted to create already exists.";
private static final String ERROR_CANCELLED =
"The operation was cancelled (typically by the caller).";
private static final String ERROR_DATA_LOSS = "Unrecoverable data loss or corruption.";
private static final String ERROR_DEADLINE_EXCEEDED =
"Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire.";
"Deadline expired before operation could complete. For operations that change the state of"
+ " the system, this error may be returned even if the operation has completed"
+ " successfully. For example, a successful response from a server could have been"
+ " delayed long enough for the deadline to expire.";
private static final String ERROR_FAILED_PRECONDITION =
"Operation was rejected because the system is not in a state required for the operation's execution. If performing a query, ensure it has been indexed via the Firebase console.";
"Operation was rejected because the system is not in a state required for the operation's"
+ " execution. If performing a query, ensure it has been indexed via the Firebase"
+ " console.";
private static final String ERROR_INTERNAL =
"Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken.";
"Internal errors. Means some invariants expected by underlying system has been broken. If you"
+ " see one of these errors, something is very broken.";
private static final String ERROR_INVALID_ARGUMENT =
"Client specified an invalid argument. Note that this differs from failed-precondition. invalid-argument indicates arguments that are problematic regardless of the state of the system (e.g., an invalid field name).";
"Client specified an invalid argument. Note that this differs from failed-precondition."
+ " invalid-argument indicates arguments that are problematic regardless of the state of"
+ " the system (e.g., an invalid field name).";
private static final String ERROR_NOT_FOUND = "Some requested document was not found.";
private static final String ERROR_OUT_OF_RANGE = "Operation was attempted past the valid range.";
private static final String ERROR_PERMISSION_DENIED =
"The caller does not have permission to execute the specified operation.";
private static final String ERROR_RESOURCE_EXHAUSTED =
"Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.";
"Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file"
+ " system is out of space.";
private static final String ERROR_UNAUTHENTICATED =
"The request does not have valid authentication credentials for the operation.";
private static final String ERROR_UNAVAILABLE =
"The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff.";
"The service is currently unavailable. This is a most likely a transient condition and may be"
+ " corrected by retrying with a backoff.";
private static final String ERROR_UNIMPLEMENTED =
"Operation is not implemented or not supported/enabled.";
private static final String ERROR_UNKNOWN =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ protected void writeValue(ByteArrayOutputStream stream, Object value) {
writeValue(stream, appName);
writeValue(stream, ((DocumentReference) value).getPath());
String databaseURL;
// There is no way of getting database URL from Firebase android SDK API so we cache it ourselves
// There is no way of getting database URL from Firebase android SDK API so we cache it
// ourselves
synchronized (FlutterFirebaseFirestorePlugin.firestoreInstanceCache) {
databaseURL =
FlutterFirebaseFirestorePlugin.getCachedFirebaseFirestoreInstanceForKey(firestore)
Expand Down Expand Up @@ -534,7 +535,8 @@ private Query readFirestoreQuery(ByteBuffer buffer) {
} catch (Exception exception) {
Log.e(
"FLTFirestoreMsgCodec",
"An error occurred while parsing query arguments, this is most likely an error with this SDK.",
"An error occurred while parsing query arguments, this is most likely an error with this"
+ " SDK.",
exception);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ public void namedQueryGet(
if (query == null) {
result.error(
new NullPointerException(
"Named query has not been found. Please check it has been loaded properly via loadBundle()."));
"Named query has not been found. Please check it has been loaded properly via"
+ " loadBundle()."));
return;
}

Expand Down Expand Up @@ -764,7 +765,8 @@ public void queryGet(
result.error(
new GeneratedAndroidFirebaseFirestore.FlutterError(
"invalid_query",
"An error occurred while parsing query arguments, see native logs for more information. Please report this issue.",
"An error occurred while parsing query arguments, see native logs for more"
+ " information. Please report this issue.",
null));
return;
}
Expand Down Expand Up @@ -973,7 +975,8 @@ public void querySnapshot(
result.error(
new GeneratedAndroidFirebaseFirestore.FlutterError(
"invalid_query",
"An error occurred while parsing query arguments, see native logs for more information. Please report this issue.",
"An error occurred while parsing query arguments, see native logs for more"
+ " information. Please report this issue.",
null));
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,7 @@ public interface Result<T> {
/** Failure case callback method for handling errors. */
void error(@NonNull Throwable error);
}

/** Asynchronous error handling return type for nullable API method returns. */
public interface NullableResult<T> {
/** Success case callback method for handling returns. */
Expand All @@ -2512,6 +2513,7 @@ public interface NullableResult<T> {
/** Failure case callback method for handling errors. */
void error(@NonNull Throwable error);
}

/** Asynchronous error handling return type for void API method returns. */
public interface VoidResult {
/** Success case callback method for handling returns. */
Expand All @@ -2520,6 +2522,7 @@ public interface VoidResult {
/** Failure case callback method for handling errors. */
void error(@NonNull Throwable error);
}

/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface FirebaseFirestoreHostApi {

Expand Down Expand Up @@ -2646,6 +2649,7 @@ void executePipeline(
static @NonNull MessageCodec<Object> getCodec() {
return PigeonCodec.INSTANCE;
}

/**
* Sets up an instance of `FirebaseFirestoreHostApi` to handle messages through the
* `binaryMessenger`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ public static Query parseQuery(
} catch (Exception exception) {
Log.e(
"FLTFirestoreMsgCodec",
"An error occurred while parsing query arguments, this is most likely an error with this SDK.",
"An error occurred while parsing query arguments, this is most likely an error with this"
+ " SDK.",
exception);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package io.flutter.plugins.firebase.firestore.example

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity()
class MainActivity : FlutterActivity()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UIKit
import Flutter
import UIKit

@main
@objc class AppDelegate: FlutterAppDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

import PackageDescription

let library_version = "6.4.1"
let firebase_sdk_version: Version = "12.13.0"
let libraryVersion = "6.4.1"
let firebaseSdkVersion: Version = "12.13.0"

let package = Package(
name: "cloud_firestore",
platforms: [
.iOS("15.0"),
.iOS("15.0")
],
products: [
.library(name: "cloud-firestore", targets: ["cloud_firestore"]),
.library(name: "cloud-firestore", targets: ["cloud_firestore"])
],
dependencies: [
.package(url: "https://github.com/firebase/firebase-ios-sdk", exact: firebase_sdk_version),
.package(url: "https://github.com/firebase/firebase-ios-sdk", exact: firebaseSdkVersion),
.package(name: "firebase_core", path: "../firebase_core"),
],
targets: [
Expand All @@ -30,14 +30,14 @@ let package = Package(
.product(name: "firebase-core", package: "firebase_core"),
],
resources: [
.process("Resources"),
.process("Resources")
],
cSettings: [
.headerSearchPath("include/cloud_firestore/Private"),
.headerSearchPath("include/cloud_firestore/Public"),
.define("LIBRARY_VERSION", to: "\"\(library_version)\""),
.define("LIBRARY_VERSION", to: "\"\(libraryVersion)\""),
.define("LIBRARY_NAME", to: "\"flutter-fire-fst\""),
]
),
)
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

import PackageDescription

let library_version = "6.4.1"
let firebase_sdk_version: Version = "12.13.0"
let libraryVersion = "6.4.1"
let firebaseSdkVersion: Version = "12.13.0"

let package = Package(
name: "cloud_firestore",
platforms: [
.macOS("10.15"),
.macOS("10.15")
],
products: [
.library(name: "cloud-firestore", targets: ["cloud_firestore"]),
.library(name: "cloud-firestore", targets: ["cloud_firestore"])
],
dependencies: [
.package(url: "https://github.com/firebase/firebase-ios-sdk", exact: firebase_sdk_version),
.package(url: "https://github.com/firebase/firebase-ios-sdk", exact: firebaseSdkVersion),
.package(name: "firebase_core", path: "../firebase_core"),
],
targets: [
Expand All @@ -30,14 +30,14 @@ let package = Package(
.product(name: "firebase-core", package: "firebase_core"),
],
resources: [
.process("Resources"),
.process("Resources")
],
cSettings: [
.headerSearchPath("include/cloud_firestore/Private"),
.headerSearchPath("include/cloud_firestore/Public"),
.define("LIBRARY_VERSION", to: "\"\(library_version)\""),
.define("LIBRARY_VERSION", to: "\"\(libraryVersion)\""),
.define("LIBRARY_NAME", to: "\"flutter-fire-fst\""),
]
),
)
]
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UIKit
import Flutter
import UIKit

@main
@objc class AppDelegate: FlutterAppDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import com.google.firebase.functions.HttpsCallableReference
import com.google.firebase.functions.StreamResponse
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.EventChannel.EventSink
import org.reactivestreams.Publisher
import java.net.URL
import java.util.Objects
import java.util.concurrent.TimeUnit
import org.reactivestreams.Publisher

class FirebaseFunctionsStreamHandler(private val firebaseFunctions: FirebaseFunctions) :
EventChannel.StreamHandler {
EventChannel.StreamHandler {
private var subscriber: StreamResponseSubscriber? = null

override fun onListen(arguments: Any, events: EventSink) {
Expand All @@ -36,25 +36,26 @@ class FirebaseFunctionsStreamHandler(private val firebaseFunctions: FirebaseFunc
val timeout = arguments["timeout"] as Int?
val parameters = arguments["parameters"]
val limitedUseAppCheckToken =
Objects.requireNonNull(arguments["limitedUseAppCheckToken"]) as Boolean
Objects.requireNonNull(arguments["limitedUseAppCheckToken"]) as Boolean

if (origin != null) {
val originUri = Uri.parse(origin)
firebaseFunctions.useEmulator(originUri.host!!, originUri.port)
}

val httpsCallableReference: HttpsCallableReference
val options: HttpsCallableOptions =HttpsCallableOptions.Builder()
.setLimitedUseAppCheckTokens(limitedUseAppCheckToken)
.build()
val options: HttpsCallableOptions =
HttpsCallableOptions.Builder()
.setLimitedUseAppCheckTokens(limitedUseAppCheckToken)
.build()

val publisher: Publisher<StreamResponse>
if (functionName != null) {
httpsCallableReference = firebaseFunctions.getHttpsCallable(functionName, options)
publisher = httpsCallableReference.stream(parameters)
} else if (functionUri != null) {
httpsCallableReference =
firebaseFunctions.getHttpsCallableFromUrl(URL(functionUri), options)
firebaseFunctions.getHttpsCallableFromUrl(URL(functionUri), options)
publisher = httpsCallableReference.stream()
} else {
throw IllegalArgumentException("Either functionName or functionUri must be set")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.google.firebase.platforminfo.LibraryVersionComponent
class FlutterFirebaseAppRegistrar : ComponentRegistrar {
override fun getComponents(): List<Component<*>> {
return listOf(
LibraryVersionComponent.create(BuildConfig.LIBRARY_NAME, BuildConfig.LIBRARY_VERSION)
)
LibraryVersionComponent.create(BuildConfig.LIBRARY_NAME, BuildConfig.LIBRARY_VERSION))
}
}
Loading
Loading