diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9f540d1..536aff9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,35 +7,130 @@ on: branches: [ main ] jobs: - build: - # This job will run on ubuntu virtual machine + dart-format-and-analyze-check: + name: Dart Format Check runs-on: ubuntu-latest + steps: - # # Setup Java environment in order to build the Android app. - # - uses: actions/checkout@v1 - # - uses: actions/setup-java@v1 - # with: - # java-version: '12.x' - - # Setup the flutter environment. - - uses: subosito/flutter-action@v1 - - uses: actions/checkout@v2 - - - name: Cache Flutter dependencies - uses: actions/cache@v1 + - uses: actions/setup-java@v1 with: - path: /opt/hostedtoolcache/flutter - key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }} + java-version: '12.x' + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + - name: Install project dependencies + run: flutter pub get + - name: Dart Format Check + run: dart format lib/ test/ --set-exit-if-changed + - name: Import Sorter Check + run: dart run import_sorter:main --no-comments --exit-if-changed + - name: Dart Analyze Check + run: flutter analyze + - name: Dart Test Check + run: flutter test - # Get flutter dependencies. - - run: flutter pub get + build-for-android: + name: Build for Flutter Android + runs-on: ubuntu-latest - # Check for any formatting issues in the code. - - run: dart format --set-exit-if-changed . + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + - name: Install project dependencies + run: flutter pub get + - name: Start Android Build + working-directory: ./example + run: flutter build apk - # Statically analyze the Dart code for any errors. - - run: flutter analyze . + build-for-ios: + name: Build for Flutter iOS + runs-on: macos-latest - # Run widget tests for our flutter project. - - run: flutter test + steps: + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + - name: Install project dependencies + run: flutter pub get + - name: Build for iOS + working-directory: ./example + run: flutter build ios --release --no-codesign + + build-for-windows: + name: Build for flutter Windows + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v1 + with: + channel: 'stable' + - name: Install project dependencies + run: flutter pub get + - name: Build for windows + working-directory: ./example + run: flutter build windows --release + + build-for-macos: + name: Build for flutter macOS + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v1 + with: + channel: 'stable' + - name: Install project dependencies + run: flutter pub get + - name: Build for windows + working-directory: ./example + run: flutter build macos --release + + build-for-linux: + name: Build for Flutter Linux + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + - name: Install project dependencies + run: flutter pub get + - name: Install ninja-build libgtk-3-dev + run: sudo apt-get install -y ninja-build libgtk-3-dev + - name: Start Linux Build + working-directory: ./example + run: flutter build linux + + build-for-web: + name: Build for Flutter Web + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + - uses: actions/checkout@v2 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + - name: Install project dependencies + run: flutter pub get + - name: Start Web Build + working-directory: ./example + run: flutter build web \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 74c550d..b1d46c7 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,26 +1,37 @@ name: Publish build on: - push: - # only publish on version tags - tags: - - v* + release: + types: [published] jobs: publish: - # This job will run on ubuntu virtual machine runs-on: ubuntu-latest steps: - # Setup the flutter environment. - - uses: subosito/flutter-action@v1 - - uses: actions/checkout@v2 - - - name: Cache Flutter dependencies - uses: actions/cache@v1 + - name: Install Flutter + uses: subosito/flutter-action@v2 with: - path: /opt/hostedtoolcache/flutter - key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }} + flutter-version: '3.3.3' + - name: Install project dependencies + run: flutter pub get + - name: Dart Format Check + run: dart format lib/ test/ --set-exit-if-changed + - name: Import Sorter Check + run: dart run import_sorter:main --no-comments --exit-if-changed + - name: Dart Analyze Check + run: flutter analyze + - name: Dart Test Check + run: flutter test + - name: Check Publish Warnings + run: dart pub publish --dry-run + - name: Publish + uses: k-paxian/dart-package-publisher@v1.5.1 + with: + credentialJson: ${{ secrets.CREDENTIAL_JSON }} + flutter: true + skipTests: true + force: true - run: flutter pub get - run: flutter pub global activate dartdoc diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 59df3a8..750ac67 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -11,16 +11,16 @@ dependencies: flutter: sdk: flutter - intl: ^0.17.0 + intl: ^0.18.1 flutter_background: ^1.1.0 permission_handler: ^10.2.0 provider: ^6.0.1 logging: ^1.0.1 shared_preferences: ^2.0.7 - google_fonts: ^2.1.0 + google_fonts: ^4.0.4 eva_icons_flutter: ^3.0.0 - flutter_svg: ^1.0.0 + flutter_svg: ^2.0.5 livekit_client: path: ../ @@ -31,7 +31,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^1.0.4 + flutter_lints: ^2.0.1 # The following section is specific to Flutter. flutter: diff --git a/lib/src/core/room.dart b/lib/src/core/room.dart index 171428e..bc0914d 100644 --- a/lib/src/core/room.dart +++ b/lib/src/core/room.dart @@ -1,9 +1,8 @@ import 'dart:async'; -import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; -import 'package:livekit_client/src/hardware/hardware.dart'; -import 'package:livekit_client/src/support/app_state.dart'; + +import 'package:collection/collection.dart'; import 'package:meta/meta.dart'; import '../core/signal_client.dart'; @@ -11,6 +10,7 @@ import '../e2ee/e2ee_manager.dart'; import '../events.dart'; import '../exceptions.dart'; import '../extensions.dart'; +import '../hardware/hardware.dart'; import '../internal/events.dart'; import '../logger.dart'; import '../managers/event.dart'; @@ -20,6 +20,7 @@ import '../participant/participant.dart'; import '../participant/remote.dart'; import '../proto/livekit_models.pb.dart' as lk_models; import '../proto/livekit_rtc.pb.dart' as lk_rtc; +import '../support/app_state.dart'; import '../support/disposable.dart'; import '../support/platform.dart'; import '../track/local/audio.dart'; diff --git a/lib/src/core/transport.dart b/lib/src/core/transport.dart index cce4a6a..2b904db 100644 --- a/lib/src/core/transport.dart +++ b/lib/src/core/transport.dart @@ -1,12 +1,12 @@ import 'dart:async'; import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; -import 'package:livekit_client/src/options.dart'; import '../exceptions.dart'; import '../extensions.dart'; import '../internal/types.dart'; import '../logger.dart'; +import '../options.dart'; import '../support/disposable.dart'; import '../types/other.dart'; import '../utils.dart'; diff --git a/lib/src/e2ee/e2ee_manager.dart b/lib/src/e2ee/e2ee_manager.dart index 041fadb..2bac659 100644 --- a/lib/src/e2ee/e2ee_manager.dart +++ b/lib/src/e2ee/e2ee_manager.dart @@ -1,10 +1,11 @@ import 'package:flutter/foundation.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; -import 'package:livekit_client/src/e2ee/events.dart'; -import 'package:livekit_client/src/extensions.dart'; -import '../events.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + import '../core/room.dart'; +import '../e2ee/events.dart'; +import '../events.dart'; +import '../extensions.dart'; import '../managers/event.dart'; import 'key_provider.dart'; diff --git a/lib/src/extensions.dart b/lib/src/extensions.dart index 7307a48..68ba46b 100644 --- a/lib/src/extensions.dart +++ b/lib/src/extensions.dart @@ -1,9 +1,10 @@ import 'dart:convert'; import 'package:flutter/material.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; -import 'package:livekit_client/livekit_client.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; + +import '../livekit_client.dart'; import 'proto/livekit_models.pb.dart' as lk_models; import 'proto/livekit_rtc.pb.dart' as lk_rtc; diff --git a/lib/src/participant/local.dart b/lib/src/participant/local.dart index e92d8c3..279b9c3 100644 --- a/lib/src/participant/local.dart +++ b/lib/src/participant/local.dart @@ -1,4 +1,5 @@ import 'package:flutter/foundation.dart'; + import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; import 'package:meta/meta.dart'; diff --git a/lib/src/participant/remote.dart b/lib/src/participant/remote.dart index 107ee5a..dc31ff2 100644 --- a/lib/src/participant/remote.dart +++ b/lib/src/participant/remote.dart @@ -1,11 +1,11 @@ import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; -import 'package:livekit_client/src/internal/events.dart'; import 'package:meta/meta.dart'; import '../core/room.dart'; import '../events.dart'; import '../exceptions.dart'; import '../extensions.dart'; +import '../internal/events.dart'; import '../logger.dart'; import '../proto/livekit_models.pb.dart' as lk_models; import '../publication/remote.dart'; diff --git a/lib/src/publication/track_publication.dart b/lib/src/publication/track_publication.dart index aefec69..c3cfccd 100644 --- a/lib/src/publication/track_publication.dart +++ b/lib/src/publication/track_publication.dart @@ -1,6 +1,6 @@ -import 'package:livekit_client/livekit_client.dart'; import 'package:meta/meta.dart'; +import '../../livekit_client.dart'; import '../core/signal_client.dart'; import '../extensions.dart'; import '../internal/events.dart'; diff --git a/lib/src/support/platform.dart b/lib/src/support/platform.dart index ff680a8..47d2576 100644 --- a/lib/src/support/platform.dart +++ b/lib/src/support/platform.dart @@ -1,4 +1,5 @@ import 'dart:io'; + import 'platform/io.dart' if (dart.library.html) 'platform/web.dart'; // Returns the current platform which works for both web and devices. diff --git a/lib/src/support/platform/web.dart b/lib/src/support/platform/web.dart index 96f352b..e10affa 100644 --- a/lib/src/support/platform/web.dart +++ b/lib/src/support/platform/web.dart @@ -1,8 +1,9 @@ -import '../platform.dart'; import 'dart:js' as js; import 'package:platform_detect/platform_detect.dart'; +import '../platform.dart'; + PlatformType lkPlatformImplementation() => PlatformType.web; bool lkE2EESupportedImplementation() { diff --git a/lib/src/track/local/local.dart b/lib/src/track/local/local.dart index f2dd47a..171a4dd 100644 --- a/lib/src/track/local/local.dart +++ b/lib/src/track/local/local.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; + import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; import 'package:meta/meta.dart'; diff --git a/lib/src/track/options.dart b/lib/src/track/options.dart index 47abe8e..b60af5b 100644 --- a/lib/src/track/options.dart +++ b/lib/src/track/options.dart @@ -1,4 +1,5 @@ import 'package:flutter/foundation.dart' show kIsWeb; + import 'package:flutter_webrtc/flutter_webrtc.dart'; import '../track/local/audio.dart'; diff --git a/lib/src/track/remote/audio.dart b/lib/src/track/remote/audio.dart index b286308..2f53771 100644 --- a/lib/src/track/remote/audio.dart +++ b/lib/src/track/remote/audio.dart @@ -1,6 +1,6 @@ import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; -import 'package:livekit_client/src/internal/events.dart'; +import '../../internal/events.dart'; import '../../proto/livekit_models.pb.dart' as lk_models; import '../../types/other.dart'; import '../audio_management.dart'; diff --git a/lib/src/track/web/_audio_html.dart b/lib/src/track/web/_audio_html.dart index 021a7d1..8489259 100644 --- a/lib/src/track/web/_audio_html.dart +++ b/lib/src/track/web/_audio_html.dart @@ -1,5 +1,6 @@ import 'dart:html' as html; import 'dart:js_util' as jsutil; + import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; import 'package:js_bindings/js_bindings.dart' as js_bindings; diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 3cb643d..d5b45bc 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -1,10 +1,11 @@ import 'dart:async'; import 'dart:math' as math; +import 'package:flutter/foundation.dart'; + import 'package:collection/collection.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:device_info_plus/device_info_plus.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; import 'package:meta/meta.dart'; @@ -112,7 +113,7 @@ class Utils { case PlatformType.iOS: final info = await _deviceInfoPlugin.iosInfo; String? model = info.utsname.machine; - if (model != null && ['i386', 'x86_64', 'arm64'].contains(model)) { + if (['i386', 'x86_64', 'arm64'].contains(model)) { model = 'iOSSimulator,${model}'; } return lk_models.ClientInfo( diff --git a/lib/src/widgets/screen_select_dialog.dart b/lib/src/widgets/screen_select_dialog.dart index 2246c27..5105df6 100644 --- a/lib/src/widgets/screen_select_dialog.dart +++ b/lib/src/widgets/screen_select_dialog.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; + import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; class ThumbnailWidget extends StatefulWidget { diff --git a/lib/src/widgets/video_track_renderer.dart b/lib/src/widgets/video_track_renderer.dart index a33c6bc..838e3a6 100644 --- a/lib/src/widgets/video_track_renderer.dart +++ b/lib/src/widgets/video_track_renderer.dart @@ -1,11 +1,12 @@ import 'package:flutter/material.dart'; + import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; -import 'package:livekit_client/src/support/platform.dart'; import '../events.dart'; import '../extensions.dart'; import '../internal/events.dart'; import '../managers/event.dart'; +import '../support/platform.dart'; import '../track/local/local.dart'; import '../track/local/video.dart'; import '../track/options.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 568d343..269d577 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: sdk: flutter async: ^2.9.0 collection: ^1.16.0 - connectivity_plus: ^3.0.6 + connectivity_plus: ^4.0.0 cryptography: ^2.0.5 fixnum: ^1.0.1 meta: ^1.8.0 @@ -24,9 +24,9 @@ dependencies: uuid: ^3.0.6 synchronized: ^3.0.0+3 protobuf: ^2.1.0 - flutter_webrtc: 0.9.28 + flutter_webrtc: ^0.9.30+hotfix.1 flutter_window_close: ^0.2.2 - device_info_plus: ^8.0.0 + device_info_plus: ^9.0.0 webrtc_interface: 1.0.13 dart_webrtc: 1.0.16 js: ^0.6.4