feat(ios): migrate to Swift Package Manager and upgrade linphone-sdk
This commit is contained in:
parent
a02b76c360
commit
d421c46a71
18 changed files with 184 additions and 129 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:liblinphone_flutter/liblinphone_flutter.dart';
|
||||
|
||||
void main() {
|
||||
|
|
@ -16,7 +15,6 @@ class MyApp extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
String _platformVersion = 'Unknown';
|
||||
final _liblinphoneFlutterPlugin = LiblinphoneFlutter();
|
||||
|
||||
@override
|
||||
|
|
@ -25,21 +23,10 @@ class _MyAppState extends State<MyApp> {
|
|||
initPlatformState();
|
||||
}
|
||||
|
||||
// Platform messages are asynchronous, so we initialize in an async method.
|
||||
Future<void> initPlatformState() async {
|
||||
String platformVersion;
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
// We also handle the message potentially returning null.
|
||||
platformVersion = 'stub';
|
||||
|
||||
// If the widget was removed from the tree while the asynchronous platform
|
||||
// message was in flight, we want to discard the reply rather than calling
|
||||
// setState to update our non-existent appearance.
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() {
|
||||
_platformVersion = platformVersion;
|
||||
});
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -47,7 +34,28 @@ class _MyAppState extends State<MyApp> {
|
|||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('Plugin example app')),
|
||||
body: Center(child: Text('Running on: $_platformVersion\n')),
|
||||
body: Column(
|
||||
children: [
|
||||
StreamBuilder(
|
||||
stream: _liblinphoneFlutterPlugin.registrationEvents,
|
||||
builder: (context, snapshot) {
|
||||
return ListTile(
|
||||
leading: snapshot.hasData
|
||||
? const Icon(Icons.check)
|
||||
: (snapshot.hasError
|
||||
? const Icon(Icons.error)
|
||||
: const CircularProgressIndicator()),
|
||||
title: Text(
|
||||
snapshot.hasData
|
||||
? "${snapshot.data}"
|
||||
: (snapshot.hasError ? "${snapshot.error}" : "Loading"),
|
||||
),
|
||||
subtitle: const Text("Registration events"),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue