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

flutter and android version upgraded #215

Open
wants to merge 1 commit into
base: master
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
6 changes: 2 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28
compileSdkVersion 33
ndkVersion "21.4.7075529"

lintOptions {
Expand All @@ -36,7 +36,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.cloudwebrtc.flutterwebrtcdemo"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -52,8 +52,6 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
android:value="2" />
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
Expand Down
6 changes: 4 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
buildscript {
ext.kotlin_version = '1.9.10'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

Expand All @@ -24,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
9 changes: 5 additions & 4 deletions lib/src/call_sample/call_sample.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'dart:core';

import 'package:flutter/material.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';

import '../widgets/screen_select_dialog.dart';
import 'signaling.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';

class CallSample extends StatefulWidget {
static String tag = 'call_sample';
Expand Down Expand Up @@ -103,7 +105,6 @@ class _CallSampleState extends State<CallSample> {
});

break;
case CallState.CallStateRinging:
}
};

Expand Down Expand Up @@ -354,7 +355,7 @@ class _CallSampleState extends State<CallSample> {
: ListView.builder(
shrinkWrap: true,
padding: const EdgeInsets.all(0.0),
itemCount: (_peers != null ? _peers.length : 0),
itemCount: _peers.length,
itemBuilder: (context, i) {
return _buildRow(context, _peers[i]);
}),
Expand Down
13 changes: 8 additions & 5 deletions lib/src/call_sample/data_channel_sample.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:flutter/material.dart';
import 'dart:core';
import 'dart:async';
import 'dart:core';
import 'dart:typed_data';
import 'signaling.dart';

import 'package:flutter/material.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';

import 'signaling.dart';

class DataChannelSample extends StatefulWidget {
static String tag = 'call_sample';
final String host;
Expand Down Expand Up @@ -249,10 +251,11 @@ class _DataChannelSampleState extends State<DataChannelSample> {
: ListView.builder(
shrinkWrap: true,
padding: const EdgeInsets.all(0.0),
itemCount: (_peers != null ? _peers.length : 0),
itemCount: _peers.length,
itemBuilder: (context, i) {
return _buildRow(context, _peers[i]);
}),
},
),
);
}
}
2 changes: 1 addition & 1 deletion lib/src/call_sample/random_string.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int randomBetween(int from, int to) {
/// Generates a random string of [length] with characters
/// between ascii [from] to [to].
/// Defaults to characters of ascii '!' to '~'.
String randomString(int length, {int from: ASCII_START, int to: ASCII_END}) {
String randomString(int length, {int from = ASCII_START, int to = ASCII_END}) {
return String.fromCharCodes(
List.generate(length, (index) => randomBetween(from, to)));
}
Expand Down
45 changes: 21 additions & 24 deletions lib/src/call_sample/signaling.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import 'dart:convert';
import 'dart:async';
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';

import '../utils/screen_select_dialog.dart';
import 'random_string.dart';

import '../utils/device_info.dart'
if (dart.library.js) '../utils/device_info_web.dart';
import '../utils/screen_select_dialog.dart';
import '../utils/turn.dart' if (dart.library.js) '../utils/turn_web.dart';
import '../utils/websocket.dart'
if (dart.library.js) '../utils/websocket_web.dart';
import '../utils/turn.dart' if (dart.library.js) '../utils/turn_web.dart';
import 'random_string.dart';

enum SignalingState {
ConnectionOpen,
Expand Down Expand Up @@ -459,25 +459,22 @@ class Signaling {
*/
}
pc.onIceCandidate = (candidate) async {
if (candidate == null) {
print('onIceCandidate: complete!');
return;
}
// This delay is needed to allow enough time to try an ICE candidate
// before skipping to the next one. 1 second is just an heuristic value
// and should be thoroughly tested in your own environment.
await Future.delayed(
const Duration(seconds: 1),
() => _send('candidate', {
'to': peerId,
'from': _selfId,
'candidate': {
'sdpMLineIndex': candidate.sdpMLineIndex,
'sdpMid': candidate.sdpMid,
'candidate': candidate.candidate,
},
'session_id': sessionId,
}));
const Duration(seconds: 1),
() => _send(
'candidate',
{
'to': peerId,
'from': _selfId,
'candidate': {
'sdpMLineIndex': candidate.sdpMLineIndex,
'sdpMid': candidate.sdpMid,
'candidate': candidate.candidate,
},
'session_id': sessionId,
},
),
);
};

pc.onIceConnectionState = (state) {};
Expand Down Expand Up @@ -507,7 +504,7 @@ class Signaling {
}

Future<void> _createDataChannel(Session session,
{label: 'fileTransfer'}) async {
{label = 'fileTransfer'}) async {
RTCDataChannelInit dataChannelDict = RTCDataChannelInit()
..maxRetransmits = 30;
RTCDataChannel channel =
Expand Down
6 changes: 6 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import FlutterMacOS
import Foundation

import flutter_webrtc
import path_provider_foundation
import shared_preferences_foundation

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
}
Loading