diff --git a/.github/workflows/push_check_analyze.yml b/.github/workflows/push_check_analyze.yml new file mode 100644 index 0000000..9a7c2cf --- /dev/null +++ b/.github/workflows/push_check_analyze.yml @@ -0,0 +1,68 @@ +name: Push Analyze Check + +on: + push: + branches: + - '**' + - '!master' + +jobs: + push_check_analyze: + + runs-on: self-hosted + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js 18 + uses: actions/setup-node@v4 + with: + node-version: '18.x' + + - name: Install Landa Messenger CLI + run: npm install @landamessenger/landa-messenger-api -g + + - uses: subosito/flutter-action@v1 + with: + channel: 'stable' + flutter-version: '3.24.3' + + - run: flutter pub get + + - run: flutter analyze + + - name: Handle job completion + if: always() + run: | + if [ "${{ job.status }}" == "failure" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🔴 Analysis Failed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/push_check_analyze.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + elif [ "${{ job.status }}" == "cancelled" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟠 Analysis Canceled" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/push_check_analyze.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + else + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟢 Analysis Passed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/push_check_analyze.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + fi + diff --git a/.github/workflows/push_check_publish_dry_run.yml b/.github/workflows/push_check_publish_dry_run.yml new file mode 100644 index 0000000..33bd614 --- /dev/null +++ b/.github/workflows/push_check_publish_dry_run.yml @@ -0,0 +1,68 @@ +name: Push Publish Dry Run Check + +on: + push: + branches: + - '**' + - '!master' + +jobs: + push_check_publish_dry_run: + + runs-on: self-hosted + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js 18 + uses: actions/setup-node@v4 + with: + node-version: '18.x' + + - name: Install Landa Messenger CLI + run: npm install @landamessenger/landa-messenger-api -g + + - uses: subosito/flutter-action@v1 + with: + channel: 'stable' + flutter-version: '3.24.3' + + - run: flutter pub get + + - run: dart pub publish --dry-run + + - name: Handle job completion + if: always() + run: | + if [ "${{ job.status }}" == "failure" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🔴 Dry Publish Failed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/push_check_publish_dry_run.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + elif [ "${{ job.status }}" == "cancelled" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟠 Dry Publish Canceled" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/push_check_publish_dry_run.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + else + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟢 Dry Publish Passed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/push_check_publish_dry_run.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + fi + diff --git a/.github/workflows/push_check_test.yml b/.github/workflows/push_check_test.yml new file mode 100644 index 0000000..f191ad7 --- /dev/null +++ b/.github/workflows/push_check_test.yml @@ -0,0 +1,74 @@ +name: Push Test Check + +on: + push: + branches: + - '**' + - '!master' + +jobs: + push_check_test: + + runs-on: self-hosted + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js 18 + uses: actions/setup-node@v4 + with: + node-version: '18.x' + + - name: Install Landa Messenger CLI + run: npm install @landamessenger/landa-messenger-api -g + + - uses: subosito/flutter-action@v1 + with: + channel: 'stable' + flutter-version: '3.24.3' + + - run: flutter pub get + + - run: flutter test --coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: coverage/lcov.info + + - name: Handle job completion + if: always() + run: | + if [ "${{ job.status }}" == "failure" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🔴 Test Failed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/push_check_test.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + elif [ "${{ job.status }}" == "cancelled" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟠 Test Canceled" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/push_check.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + else + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟢 Test Passed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/push_check.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + fi + diff --git a/.github/workflows/tag_version_and_publish.yml b/.github/workflows/tag_version_and_publish.yml new file mode 100644 index 0000000..541659f --- /dev/null +++ b/.github/workflows/tag_version_and_publish.yml @@ -0,0 +1,123 @@ +name: Tag Version and Publish on Push to Master + +on: + pull_request: + types: + - closed + branches: + - master + +jobs: + tag_version_and_publish: + if: github.event.pull_request.merged == true + + runs-on: self-hosted + + steps: + - uses: actions/checkout@v4 + + - name: Read version from pubspec.yml + id: read_version + run: | + VERSION=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2) + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Create tag + id: create_tag + run: | + # Check if the tag already exists in the remote repository + if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then + echo "Tag v${{ env.VERSION }} already exists." + else + # Create and push the new tag + git tag "v${{ env.VERSION }}" + git push origin "v${{ env.VERSION }}" + fi + + - name: Create release + if: ${{ steps.create_tag.outcome == 'success' }} + uses: softprops/action-gh-release@v2 + with: + tag_name: "v${{ env.VERSION }}" + name: "${{ github.event.pull_request.title }}" + body: "${{ github.event.pull_request.body }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Handle job completion + if: always() + run: | + if [ "${{ job.status }}" == "failure" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🔴 Creation Tag Failed" \ + --body "${{ github.repository }}: Tag v${{ env.VERSION }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/tag_version_and_publish.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + elif [ "${{ job.status }}" == "cancelled" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟠 Creation Tag Canceled" \ + --body "${{ github.repository }}: Tag v${{ env.VERSION }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/tag_version_and_publish.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + else + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟢 Creation Tag Passed" \ + --body "${{ github.repository }}: Tag v${{ env.VERSION }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/tag_version_and_publish.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + fi + + - run: flutter pub get + + - run: dart pub publish --dry-run + + - run: dart pub publish -f + + - name: Handle publish job completion + if: always() + run: | + if [ "${{ job.status }}" == "failure" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🔴 Pub Publish Failed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/tag_version_and_publish.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + elif [ "${{ job.status }}" == "cancelled" ]; then + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟠 Pub Publish Canceled" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/tag_version_and_publish.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + else + landa-messenger-api chat-send \ + --id "${{ secrets.CHAT_ID }}" \ + --api_key "${{ secrets.CHAT_KEY }}" \ + --title "🟢 Pub Publish Passed" \ + --body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \ + --url "https://github.com/landamessenger/firebase_cloud_firestore/actions/workflows/tag_version_and_publish.yml" \ + --image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \ + --background_color "#55000000" \ + --text_color "#FFFFFFFF" + fi + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 66bfa16..6ea30fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 5.4.4 + +* Bump `object` version to `1.2.6`. +* Bump `cloud_firestore` version to `5.4.4`. + ## 5.4.0 * Bump `object` version to `1.1.1`. diff --git a/analysis_options.yaml b/analysis_options.yaml index a5744c1..2966164 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,8 @@ +analyzer: + errors: + dangling_library_doc_comments: ignore include: package:flutter_lints/flutter.yaml -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +linter: + rules: + avoid_print: false \ No newline at end of file diff --git a/lib/firebase_cloud_firestore.dart b/lib/firebase_cloud_firestore.dart index 86356ef..85ed81d 100644 --- a/lib/firebase_cloud_firestore.dart +++ b/lib/firebase_cloud_firestore.dart @@ -1,4 +1,4 @@ -library firebase_cloud_firestore; +library; export 'package:cloud_firestore/cloud_firestore.dart'; export 'package:object/object.dart'; diff --git a/lib/src/fire/firestore_collection_manager.dart b/lib/src/fire/firestore_collection_manager.dart index 930067f..7dc09ac 100644 --- a/lib/src/fire/firestore_collection_manager.dart +++ b/lib/src/fire/firestore_collection_manager.dart @@ -185,9 +185,13 @@ class FirestoreCollectionManager> * Execute callbacks */ if (removed.isNotEmpty) await deletionCallback?.call(removed, page); - if (changed.isNotEmpty) + if (changed.isNotEmpty) { await callback?.call( - changed, page, collectionPages[page]?.hasMore ?? false); + changed, + page, + collectionPages[page]?.hasMore ?? false, + ); + } } Future nextCollectionPage({ diff --git a/pubspec.yaml b/pubspec.yaml index 9d2527f..cfce564 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: firebase_cloud_firestore description: "Simplify the serialization of objects for cloud_firestore in a Flutter app. It streamlines the process of converting Dart objects into formats compatible with cloud_firestore, making data storage and retrieval smoother and more efficient for developers." -version: 5.4.0 +version: 5.4.4 homepage: https://landamessenger.com repository: https://github.com/landamessenger/firebase_cloud_firestore @@ -11,12 +11,10 @@ environment: dependencies: flutter: sdk: flutter - cloud_firestore: ^5.4.0 # android ios macos web windows - object: ^1.1.1 # android ios linux macos web windows + cloud_firestore: ^5.4.4 # android ios macos web windows + object: ^1.2.6 # android ios linux macos web windows dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^4.0.0 - -flutter: