Skip to content

Commit 24ebb05

Browse files
committed
fix for android build issue
1 parent 7c6af36 commit 24ebb05

File tree

10 files changed

+63
-21
lines changed

10 files changed

+63
-21
lines changed

example/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'dart:io';
21
import 'package:flutter/foundation.dart'
32
show debugDefaultTargetPlatformOverride;
43

@@ -11,8 +10,9 @@ import 'src/callscreen.dart';
1110
import 'src/about.dart';
1211

1312
void main() {
14-
if (WebRTC.platformIsDesktop)
13+
if (WebRTC.platformIsDesktop) {
1514
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
15+
}
1616
runApp(MyApp());
1717
}
1818

example/lib/src/callscreen.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class _MyCallScreenWidget extends State<CallScreenWidget>
159159
}
160160

161161
void _handelStreams(CallState event) async {
162-
var stream = event.stream;
162+
MediaStream stream = event.stream;
163163
if (event.originator == 'local') {
164164
if (_localRenderer != null) {
165165
_localRenderer.srcObject = stream;
@@ -238,16 +238,16 @@ class _MyCallScreenWidget extends State<CallScreenWidget>
238238
return AlertDialog(
239239
title: Text('Enter target to transfer.'),
240240
content: TextField(
241-
onChanged: (String text) {
242-
setState(() {
243-
_tansfer_target = text;
244-
});
245-
},
246-
decoration: InputDecoration(
247-
hintText: 'URI or Username',
248-
),
249-
textAlign: TextAlign.center,
241+
onChanged: (String text) {
242+
setState(() {
243+
_tansfer_target = text;
244+
});
245+
},
246+
decoration: InputDecoration(
247+
hintText: 'URI or Username',
250248
),
249+
textAlign: TextAlign.center,
250+
),
251251
actions: <Widget>[
252252
FlatButton(
253253
child: Text('Ok'),
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Theses classes simply serve to remove compile errors
3+
* when building for a flutter environment
4+
*/
5+
class Storage {
6+
Map<String, String> store = Map();
7+
8+
String operator [](String key) => store[key];
9+
operator []=(String key, String value) => store[key] = value;
10+
}
11+
12+
dynamic window;

example/lib/src/utils/key_value_store.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class KeyValueStore {
55
KeyValueStore();
66
SharedPreferences _preferences;
77

8-
init() async {
8+
void init() async {
99
_preferences = await SharedPreferences.getInstance();
1010
}
1111

example/lib/src/utils/key_value_store_web.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import 'dart:async';
22
import 'dart:convert';
3-
import 'dart:html';
3+
import 'dart_html_dummy.dart' if (dart.library.js) 'dart:html';
44

55
class KeyValueStore {
66
KeyValueStore();
77
Storage _storage;
88

9-
init() async {
10-
_storage = window.localStorage;
9+
void init() async {
10+
_storage = window.localStorage as Storage;
1111
}
1212

1313
String getString(String key) => _storage[key];

lib/src/dialog.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class Dialog {
236236
} else if (request.cseq > this._remote_seqnum) {
237237
this._remote_seqnum = request.cseq;
238238
}
239-
EventManager eventHandlers = request.server_transaction as EventManager;
239+
EventManager eventHandlers = request.server_transaction;
240240
// RFC3261 14.2 Modifying an Existing Session -UAS BEHAVIOR-.
241241
if (request.method == SipMethod.INVITE ||
242242
(request.method == SipMethod.UPDATE && request.body != null)) {

lib/src/logger.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class MyLogPrinter extends LogPrinter {
114114
for (Stackframe frame in frames.frames) {
115115
i++;
116116
var path2 = frame.sourceFile.path;
117-
if (!path2.contains(Log._localPath)) {
117+
if (!path2.contains(Log._localPath) && !path2.contains("logger.dart")) {
118118
depth = i - 1;
119119
break;
120120
}

lib/src/web_socket_dummy.dart

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Theses classes simply serve to remove compile errors
3+
* when building for a flutter environment
4+
*/
5+
6+
class WebSocket {
7+
static var OPEN;
8+
static var CONNECTING;
9+
10+
WebSocket(String url, String s);
11+
12+
get onOpen => null;
13+
14+
get onMessage => null;
15+
16+
get onClose => null;
17+
18+
get readyState => null;
19+
20+
void send(data) {}
21+
22+
void close() {}
23+
}
24+
25+
class Blob {}
26+
27+
dynamic callMethod(var a, var b, var c) {}
28+
29+
Future<dynamic> promiseToFuture(var promise) {}

lib/src/websocket_interface.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ class WebSocketInterface implements Socket {
120120
this._ws.close();
121121
}
122122
} catch (error) {
123-
logger.error('close() | error closing the WebSocket: ' + error);
123+
logger
124+
.error('close() | error closing the WebSocket: ' + error.toString());
124125
}
125126
}
126127

lib/src/websocket_web_impl.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import 'dart:html';
2-
import 'dart:js_util' as JSUtils;
1+
import 'web_socket_dummy.dart' if (dart.library.js) 'dart:html';
2+
import 'web_socket_dummy.dart' if (dart.library.js) 'dart:js_util' as JSUtils;
33
import 'logger.dart';
44

55
typedef void OnMessageCallback(dynamic msg);

0 commit comments

Comments
 (0)