diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift
index 2fef299..b87f4ef 100644
--- a/ios/Runner/AppDelegate.swift
+++ b/ios/Runner/AppDelegate.swift
@@ -18,17 +18,18 @@ import Flutter
case "init":
if let authToken: String = call.arguments as? String {
peerManager.initializeToken(authToken: authToken)
- print("Initialized")
}
+ result(0)
+ return
case "join":
if let conversationId: String = call.arguments as? String {
peerManager.join(conversationId: conversationId)
- print("Join executed")
}
+ result(0)
return
case "exit":
peerManager.exit()
- print("Exit executed")
+ result(0)
return
case "get":
if let activeConversation = peerManager.get() {
@@ -36,7 +37,6 @@ import Flutter
} else {
result("")
}
- print("get executed")
return
default:
result(FlutterMethodNotImplemented)
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 91f8ae4..5d05155 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -32,6 +32,11 @@
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
+ NSAppTransportSecurity
+
+ NSAllowsArbitraryLoads
+
+
UISupportedInterfaceOrientations~ipad
UIInterfaceOrientationPortrait
@@ -41,7 +46,7 @@
UIViewControllerBasedStatusBarAppearance
- NSMicrophoneUsageDescription
- $(PRODUCT_NAME) Microphone Usage!
+ NSMicrophoneUsageDescription
+ $(PRODUCT_NAME) Microphone Usage!
diff --git a/ios/Runner/PeerManager.swift b/ios/Runner/PeerManager.swift
index 14cbb41..e0d65e6 100644
--- a/ios/Runner/PeerManager.swift
+++ b/ios/Runner/PeerManager.swift
@@ -13,7 +13,7 @@ class PeerManager: NSObject {
// WebRTC initialization
var connectionFactory: RTCPeerConnectionFactory?
var signalingApiProvider: SignalingApiProvider?
- var eventSource: EventSource = EventSource(url: "http://localhost/signal/subscribe")
+ var eventSource: EventSource?
// List of users
var peerList: [String: PeerConnectionWrapper] = [:]
@@ -26,9 +26,10 @@ class PeerManager: NSObject {
self.connectionFactory = RTCPeerConnectionFactory()
}
- // MUST CALL THIS BEFORE SIGNSLLING WORKS
+ // MUST CALL THIS BEFORE SIGNALLING WORKS
public func initializeToken(authToken: String) {
self.signalingApiProvider = SignalingApiProvider(authToken: authToken)
+ self.eventSource = EventSource(url: "http://localhost/signal/subscribe?token=\(authToken)")
}
public func join(conversationId: String) {
@@ -75,7 +76,7 @@ class PeerManager: NSObject {
private extension PeerManager {
func initialiseEventSource() {
- eventSource.addEventListener("offer") { (id, event, data) in
+ eventSource?.addEventListener("offer") { (id, event, data) in
guard let id = id, let data = data else {
// Incorrect packet type error
@@ -102,7 +103,7 @@ private extension PeerManager {
}
}
- eventSource.addEventListener("answer") { (id, event, data) in
+ eventSource?.addEventListener("answer") { (id, event, data) in
guard let id = id, let data = data else {
// Incorrect packet type error
@@ -117,7 +118,7 @@ private extension PeerManager {
}
}
- eventSource.addEventListener("ice-candidate") { (id, event, data) in
+ eventSource?.addEventListener("ice-candidate") { (id, event, data) in
guard let id = id, let data = data else {
// Incorrect packet type error
diff --git a/lib/src/resources/conversation_api_provider.dart b/lib/src/resources/conversation_api_provider.dart
index c9c9eb0..1d95a48 100644
--- a/lib/src/resources/conversation_api_provider.dart
+++ b/lib/src/resources/conversation_api_provider.dart
@@ -35,7 +35,6 @@ class ConversationApiProvider {
Future> fetchConversations() async {
final jwt = await loginManager.getToken();
- print("jwt: ${jwt}");
try {
final responseBody =
await this.cache.fetch("$baseUrlCore/user/conversation", headers: {
diff --git a/lib/src/services/conversation_manager.dart b/lib/src/services/conversation_manager.dart
index 426d443..4a042e2 100644
--- a/lib/src/services/conversation_manager.dart
+++ b/lib/src/services/conversation_manager.dart
@@ -14,10 +14,10 @@ class ConversationManager {
print(e);
}
}
- print("init");
}
Future join(String conversationId) async {
+ print("JOIN called");
try {
await channel.invokeMethod('join', conversationId);
} on PlatformException catch (e) {
diff --git a/lib/src/ui/home/widgets/conversation_item.dart b/lib/src/ui/home/widgets/conversation_item.dart
index ccea311..12f28aa 100644
--- a/lib/src/ui/home/widgets/conversation_item.dart
+++ b/lib/src/ui/home/widgets/conversation_item.dart
@@ -41,6 +41,7 @@ class _ConversationItemState extends State {
@override
Widget build(BuildContext context) {
+ print("BUILDING");
return ListTile(
isThreeLine: true,
onTap: () async {
diff --git a/lib/src/ui/login/widgets/login_page.dart b/lib/src/ui/login/widgets/login_page.dart
index c486097..486742b 100644
--- a/lib/src/ui/login/widgets/login_page.dart
+++ b/lib/src/ui/login/widgets/login_page.dart
@@ -55,10 +55,12 @@ class _LoginPageState extends State {
TextButton(
text: "Continue",
onClickCallback: () async {
- print(controller.text);
final authToken =
await widget.loginManager.loginTest(controller.text);
- ConversationManager.init(authToken);
+
+ // Waiting for initialization
+ await ConversationManager.init(authToken);
+
Navigator.pushNamed(context, 'welcome/otp');
}),
]));