From 3f9c210e5ca1ab83b3dcb79dee809550eaec2210 Mon Sep 17 00:00:00 2001 From: Yogesh Singh Date: Mon, 30 Oct 2023 18:18:59 +0530 Subject: [PATCH 1/6] updated yml --- .github/workflows/build.yml | 21 ++++++++++++++++--- .github/workflows/ktlint.yml | 36 +++++++++++++++++++++++++++++++++ .github/workflows/swiftlint.yml | 28 +++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ktlint.yml create mode 100644 .github/workflows/swiftlint.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cf259090..5799fbe26 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,23 +27,38 @@ on: - "**.txt" jobs: - build_appbundle: + check_build: if: github.event.pull_request.draft == false runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-java@v3 with: distribution: zulu java-version: 12.x - - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: channel: stable cache: true + - name: Get Flutter dependencies in Core SDK + run: flutter pub get + working-directory: packages/hmssdk_flutter + - name: Dart Format + run: dart format . + - name: Dart Fix + run: dart fix --apply + - name: Flutter Analyze in HMSSDK + uses: zgosalvez/github-actions-analyze-dart@v2 + with: + working-directory: packages/hmssdk_flutter + - name: Commit and Push changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: 🤖 Automated Format and Fix + commit_user_name: 🤖 100ms Flutter Bot - name: Build Android App Bundle env: FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} diff --git a/.github/workflows/ktlint.yml b/.github/workflows/ktlint.yml new file mode 100644 index 000000000..6fffd0d9f --- /dev/null +++ b/.github/workflows/ktlint.yml @@ -0,0 +1,36 @@ +name: KtLint + +on: + # trunk-ignore(yamllint/empty-values) + workflow_dispatch: + pull_request: + paths: + - "**/*.kt" + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: read-all + +jobs: + SwiftLint: + runs-on: ubuntu-latest + + permissions: + checks: write + + steps: + - name: Install ktlint + run: | + curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.44.0/ktlint && chmod a+x ktlint && sudo mv ktlint /usr/local/bin/ + + - name: Run ktlint + run: | + ktlint --reporter=checkstyle,output=build/ktlint-report.xml + continue-on-error: true + + - uses: yutailang0119/action-ktlint@v3 + with: + report-path: build/*.xml + continue-on-error: false diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml new file mode 100644 index 000000000..23835c0fa --- /dev/null +++ b/.github/workflows/swiftlint.yml @@ -0,0 +1,28 @@ +name: SwiftLint + +on: + # trunk-ignore(yamllint/empty-values) + workflow_dispatch: + pull_request: + paths: + - "**/*.swift" + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: read-all + +jobs: + SwiftLint: + runs-on: ubuntu-latest + + permissions: + checks: write + + steps: + - uses: actions/checkout@v4 + - name: GitHub Action for SwiftLint + uses: norio-nomura/action-swiftlint@3.2.1 + env: + DIFF_BASE: ${{ github.base_ref }} From 95407b602509b17873e8e8e1f9d9677187049f4d Mon Sep 17 00:00:00 2001 From: ygit Date: Mon, 30 Oct 2023 12:52:27 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=A4=96=20Automated=20Format=20and=20F?= =?UTF-8?q?ix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hms_room_kit/lib/src/hmssdk_interactor.dart | 2 +- .../lib/src/meeting/meeting_store.dart | 14 +++++--------- .../bottom_sheets/participants_bottom_sheet.dart | 2 +- .../participants_view_all_bottom_sheet.dart | 2 +- sample apps/hms-callkit-app/lib/home_page.dart | 16 +++++++--------- .../mobx/lib/setup/hms_sdk_interactor.dart | 2 +- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/packages/hms_room_kit/lib/src/hmssdk_interactor.dart b/packages/hms_room_kit/lib/src/hmssdk_interactor.dart index 558007313..ed488778c 100644 --- a/packages/hms_room_kit/lib/src/hmssdk_interactor.dart +++ b/packages/hms_room_kit/lib/src/hmssdk_interactor.dart @@ -164,7 +164,7 @@ class HMSSDKInteractor { Future getPeer({required String peerId}) async { List? peers = await hmsSDK.getPeers(); - return peers?.firstWhere((element) => element.peerId == peerId); + return peers.firstWhere((element) => element.peerId == peerId); } void changeTrackState(HMSTrack forRemoteTrack, bool mute, diff --git a/packages/hms_room_kit/lib/src/meeting/meeting_store.dart b/packages/hms_room_kit/lib/src/meeting/meeting_store.dart index 151fc3255..ef55d7714 100644 --- a/packages/hms_room_kit/lib/src/meeting/meeting_store.dart +++ b/packages/hms_room_kit/lib/src/meeting/meeting_store.dart @@ -710,7 +710,7 @@ class MeetingStore extends ChangeNotifier peerListIterators.clear(); List? offStageRoles = HMSRoomLayout.roleLayoutData?.screens ?.conferencing?.defaultConf?.elements?.onStageExp?.offStageRoles; - offStageRoles?.forEach((role) async { + offStageRoles.forEach((role) async { var peerListIterator = await _hmsSDKInteractor.getPeerListIterator( peerListIteratorOptions: PeerListIteratorOptions(limit: 10, byRoleName: role)); @@ -845,10 +845,8 @@ class MeetingStore extends ChangeNotifier void setParticipantsList(List roles) { String? onStageRoles = HMSRoomLayout.roleLayoutData?.screens?.conferencing ?.defaultConf?.elements?.onStageExp?.onStageRole; - if (onStageRoles != null) { - participantsInMeetingMap[onStageRoles] = []; - } - roles + participantsInMeetingMap[onStageRoles] = []; + roles .where((role) => role.publishSettings?.allowed.isNotEmpty ?? false) .forEach((element) { participantsInMeetingMap[element.name] = []; @@ -870,11 +868,9 @@ class MeetingStore extends ChangeNotifier void getSpotlightPeer() async { String? metadata = await _hmsSessionStore?.getSessionMetadataForKey(key: "spotlight"); - if (metadata != null) { - setPeerToSpotlight(metadata); - spotlightMetadata = metadata; + setPeerToSpotlight(metadata); + spotlightMetadata = metadata; } - } @override void onRoomUpdate({required HMSRoom room, required HMSRoomUpdate update}) { diff --git a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart index 858278a11..902515cb1 100644 --- a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart +++ b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart @@ -114,7 +114,7 @@ class _ParticipantsBottomSheetState extends State { if (isOnStageRole) { if (peer.metadata != null) { String? peerMetadata = peer.metadata; - if (peerMetadata?.contains("prevRole") ?? false) { + if (peerMetadata.contains("prevRole") ?? false) { String? previousRole = jsonDecode(peer.metadata!)["prevRole"]; if (previousRole != null) { diff --git a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart index 2a0ecb79e..967213563 100644 --- a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart +++ b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart @@ -107,7 +107,7 @@ class _ParticipantsViewAllBottomSheetState if (isOnStageRole) { if (peer.metadata != null) { String? peerMetadata = peer.metadata; - if (peerMetadata?.contains("prevRole") ?? false) { + if (peerMetadata.contains("prevRole") ?? false) { String? previousRole = jsonDecode(peer.metadata!)["prevRole"]; if (previousRole != null) { diff --git a/sample apps/hms-callkit-app/lib/home_page.dart b/sample apps/hms-callkit-app/lib/home_page.dart index 78d833f2c..e859a552f 100644 --- a/sample apps/hms-callkit-app/lib/home_page.dart +++ b/sample apps/hms-callkit-app/lib/home_page.dart @@ -304,15 +304,13 @@ class _HomePageState extends State { tokenEndpoint: "Enter your token endpoint here", userId: "Enter the user Id here"); //Checking whether authentication token is null or not - if (authToken != null) { - call( - receiverFCMToken: fcmTokenController.text, - authToken: authToken); - NavigationService.instance.pushNamedIfNotCurrent( - AppRoute.previewPage, - args: authToken); - } - }, + call( + receiverFCMToken: fcmTokenController.text, + authToken: authToken); + NavigationService.instance.pushNamedIfNotCurrent( + AppRoute.previewPage, + args: authToken); + }, child: const Padding( padding: EdgeInsets.all(12.0), child: Row( diff --git a/sample apps/mobx/lib/setup/hms_sdk_interactor.dart b/sample apps/mobx/lib/setup/hms_sdk_interactor.dart index 4c4273495..0ec0b1e31 100644 --- a/sample apps/mobx/lib/setup/hms_sdk_interactor.dart +++ b/sample apps/mobx/lib/setup/hms_sdk_interactor.dart @@ -124,7 +124,7 @@ class HMSSDKInteractor { Future getPeer({required String peerId}) async { List? peers = await hmsSDK.getPeers(); - return peers?.firstWhere((element) => element.peerId == peerId); + return peers.firstWhere((element) => element.peerId == peerId); } void changeTrackState(HMSTrack forRemoteTrack, bool mute, From 89eaee0c9de4c7d409bfba5025520f5b8bea7e18 Mon Sep 17 00:00:00 2001 From: Yogesh Singh Date: Tue, 31 Oct 2023 13:34:34 +0530 Subject: [PATCH 3/6] =?UTF-8?q?Revert=20"=F0=9F=A4=96=20Automated=20Format?= =?UTF-8?q?=20and=20Fix"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 95407b602509b17873e8e8e1f9d9677187049f4d. --- .../hms_room_kit/lib/src/hmssdk_interactor.dart | 2 +- .../lib/src/meeting/meeting_store.dart | 14 +++++++++----- .../bottom_sheets/participants_bottom_sheet.dart | 2 +- .../participants_view_all_bottom_sheet.dart | 2 +- sample apps/hms-callkit-app/lib/home_page.dart | 16 +++++++++------- .../mobx/lib/setup/hms_sdk_interactor.dart | 2 +- 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/packages/hms_room_kit/lib/src/hmssdk_interactor.dart b/packages/hms_room_kit/lib/src/hmssdk_interactor.dart index ed488778c..558007313 100644 --- a/packages/hms_room_kit/lib/src/hmssdk_interactor.dart +++ b/packages/hms_room_kit/lib/src/hmssdk_interactor.dart @@ -164,7 +164,7 @@ class HMSSDKInteractor { Future getPeer({required String peerId}) async { List? peers = await hmsSDK.getPeers(); - return peers.firstWhere((element) => element.peerId == peerId); + return peers?.firstWhere((element) => element.peerId == peerId); } void changeTrackState(HMSTrack forRemoteTrack, bool mute, diff --git a/packages/hms_room_kit/lib/src/meeting/meeting_store.dart b/packages/hms_room_kit/lib/src/meeting/meeting_store.dart index ef55d7714..151fc3255 100644 --- a/packages/hms_room_kit/lib/src/meeting/meeting_store.dart +++ b/packages/hms_room_kit/lib/src/meeting/meeting_store.dart @@ -710,7 +710,7 @@ class MeetingStore extends ChangeNotifier peerListIterators.clear(); List? offStageRoles = HMSRoomLayout.roleLayoutData?.screens ?.conferencing?.defaultConf?.elements?.onStageExp?.offStageRoles; - offStageRoles.forEach((role) async { + offStageRoles?.forEach((role) async { var peerListIterator = await _hmsSDKInteractor.getPeerListIterator( peerListIteratorOptions: PeerListIteratorOptions(limit: 10, byRoleName: role)); @@ -845,8 +845,10 @@ class MeetingStore extends ChangeNotifier void setParticipantsList(List roles) { String? onStageRoles = HMSRoomLayout.roleLayoutData?.screens?.conferencing ?.defaultConf?.elements?.onStageExp?.onStageRole; - participantsInMeetingMap[onStageRoles] = []; - roles + if (onStageRoles != null) { + participantsInMeetingMap[onStageRoles] = []; + } + roles .where((role) => role.publishSettings?.allowed.isNotEmpty ?? false) .forEach((element) { participantsInMeetingMap[element.name] = []; @@ -868,9 +870,11 @@ class MeetingStore extends ChangeNotifier void getSpotlightPeer() async { String? metadata = await _hmsSessionStore?.getSessionMetadataForKey(key: "spotlight"); - setPeerToSpotlight(metadata); - spotlightMetadata = metadata; + if (metadata != null) { + setPeerToSpotlight(metadata); + spotlightMetadata = metadata; } + } @override void onRoomUpdate({required HMSRoom room, required HMSRoomUpdate update}) { diff --git a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart index 902515cb1..858278a11 100644 --- a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart +++ b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart @@ -114,7 +114,7 @@ class _ParticipantsBottomSheetState extends State { if (isOnStageRole) { if (peer.metadata != null) { String? peerMetadata = peer.metadata; - if (peerMetadata.contains("prevRole") ?? false) { + if (peerMetadata?.contains("prevRole") ?? false) { String? previousRole = jsonDecode(peer.metadata!)["prevRole"]; if (previousRole != null) { diff --git a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart index 967213563..2a0ecb79e 100644 --- a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart +++ b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart @@ -107,7 +107,7 @@ class _ParticipantsViewAllBottomSheetState if (isOnStageRole) { if (peer.metadata != null) { String? peerMetadata = peer.metadata; - if (peerMetadata.contains("prevRole") ?? false) { + if (peerMetadata?.contains("prevRole") ?? false) { String? previousRole = jsonDecode(peer.metadata!)["prevRole"]; if (previousRole != null) { diff --git a/sample apps/hms-callkit-app/lib/home_page.dart b/sample apps/hms-callkit-app/lib/home_page.dart index e859a552f..78d833f2c 100644 --- a/sample apps/hms-callkit-app/lib/home_page.dart +++ b/sample apps/hms-callkit-app/lib/home_page.dart @@ -304,13 +304,15 @@ class _HomePageState extends State { tokenEndpoint: "Enter your token endpoint here", userId: "Enter the user Id here"); //Checking whether authentication token is null or not - call( - receiverFCMToken: fcmTokenController.text, - authToken: authToken); - NavigationService.instance.pushNamedIfNotCurrent( - AppRoute.previewPage, - args: authToken); - }, + if (authToken != null) { + call( + receiverFCMToken: fcmTokenController.text, + authToken: authToken); + NavigationService.instance.pushNamedIfNotCurrent( + AppRoute.previewPage, + args: authToken); + } + }, child: const Padding( padding: EdgeInsets.all(12.0), child: Row( diff --git a/sample apps/mobx/lib/setup/hms_sdk_interactor.dart b/sample apps/mobx/lib/setup/hms_sdk_interactor.dart index 0ec0b1e31..4c4273495 100644 --- a/sample apps/mobx/lib/setup/hms_sdk_interactor.dart +++ b/sample apps/mobx/lib/setup/hms_sdk_interactor.dart @@ -124,7 +124,7 @@ class HMSSDKInteractor { Future getPeer({required String peerId}) async { List? peers = await hmsSDK.getPeers(); - return peers.firstWhere((element) => element.peerId == peerId); + return peers?.firstWhere((element) => element.peerId == peerId); } void changeTrackState(HMSTrack forRemoteTrack, bool mute, From f0ad84f5178a9663c19dfb4e9d5c72108cf3d10f Mon Sep 17 00:00:00 2001 From: Yogesh Singh Date: Tue, 31 Oct 2023 13:41:31 +0530 Subject: [PATCH 4/6] updated yml --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5799fbe26..d7d33ee9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,11 +49,15 @@ jobs: - name: Dart Format run: dart format . - name: Dart Fix - run: dart fix --apply + run: cd packages/hmssdk_flutter; dart fix --apply - name: Flutter Analyze in HMSSDK - uses: zgosalvez/github-actions-analyze-dart@v2 + uses: invertase/github-action-dart-analyzer@v1 with: working-directory: packages/hmssdk_flutter + - name: Flutter Analyze in Room Kit + uses: invertase/github-action-dart-analyzer@v1 + with: + working-directory: packages/hms_room_kit - name: Commit and Push changes uses: stefanzweifel/git-auto-commit-action@v5 with: From e1f744cc8f9fbe73aeb775153197626a4b9039f6 Mon Sep 17 00:00:00 2001 From: Yogesh Singh Date: Tue, 31 Oct 2023 13:52:25 +0530 Subject: [PATCH 5/6] added paths --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7d33ee9f..1d1128384 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,8 @@ on: branches: - main - develop + paths: + - "**/*.dart" paths-ignore: - "**.md" - doc/** From b8181ad20f7445e2608fa329528453e06119ad86 Mon Sep 17 00:00:00 2001 From: Yogesh Singh Date: Tue, 31 Oct 2023 14:06:19 +0530 Subject: [PATCH 6/6] updated yml --- .github/workflows/ktlint.yml | 3 +-- .github/workflows/swiftlint.yml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ktlint.yml b/.github/workflows/ktlint.yml index 6fffd0d9f..a1eeec5e2 100644 --- a/.github/workflows/ktlint.yml +++ b/.github/workflows/ktlint.yml @@ -1,7 +1,6 @@ name: KtLint on: - # trunk-ignore(yamllint/empty-values) workflow_dispatch: pull_request: paths: @@ -14,7 +13,7 @@ concurrency: permissions: read-all jobs: - SwiftLint: + KtLint: runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml index 23835c0fa..b88c58a40 100644 --- a/.github/workflows/swiftlint.yml +++ b/.github/workflows/swiftlint.yml @@ -1,7 +1,6 @@ name: SwiftLint on: - # trunk-ignore(yamllint/empty-values) workflow_dispatch: pull_request: paths: