Add macOS support (#23)
* Add macOS support * Update README * Update to v0.2.0 * Document breaking changes * Delete widget tests
This commit is contained in:
@@ -46,8 +46,8 @@ class DevicePreview extends StatelessWidget {
|
||||
final status = Text(
|
||||
device.byPlatform(
|
||||
onAny: (d) => d.status.name,
|
||||
onIOS: (d) =>
|
||||
context.select<AppService, bool>((v) => v.isIOSBrowser)
|
||||
onDarwin: (d) =>
|
||||
context.select<AppService, bool>((v) => v.isDarwinBrowser)
|
||||
? "Peer found | ${d.status.name}"
|
||||
: "Pending invitation | ${d.status.name}",
|
||||
) ??
|
||||
|
||||
@@ -53,10 +53,10 @@ class InfoPanel extends StatelessWidget {
|
||||
label: 'Communication channel state',
|
||||
value: service.communicationChannelState.previewName,
|
||||
),
|
||||
if (Platform.isIOS)
|
||||
if (Platform.isIOS || Platform.isMacOS)
|
||||
_InfoChip(
|
||||
label: 'Role',
|
||||
value: service.isIOSBrowser
|
||||
value: service.isDarwinBrowser
|
||||
? 'You are going to find your friend'
|
||||
: 'You are waiting for another user to connect',
|
||||
),
|
||||
@@ -94,7 +94,8 @@ class AdditionalInfoPanel extends StatelessWidget {
|
||||
label: 'Model',
|
||||
value: service.platformModel,
|
||||
),
|
||||
if (service.currentDeviceInfo != null && Platform.isIOS)
|
||||
if (service.currentDeviceInfo != null &&
|
||||
(Platform.isIOS || Platform.isMacOS))
|
||||
_InfoChip(
|
||||
label: 'Device P2P ID',
|
||||
value: service.currentDeviceInfo!.id,
|
||||
|
||||
@@ -19,7 +19,7 @@ class _IdleViewState extends State<IdleView> {
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
context.read<AppService>().getSavedIOSDeviceName().then((value) {
|
||||
context.read<AppService>().getSavedDarwinDeviceName().then((value) {
|
||||
controller.text = value;
|
||||
controller.selection = TextSelection.collapsed(offset: value.length);
|
||||
setState(() {
|
||||
@@ -56,7 +56,7 @@ class _IdleViewState extends State<IdleView> {
|
||||
return Center(
|
||||
child: Column(
|
||||
children: [
|
||||
if (Platform.isIOS)
|
||||
if (Platform.isIOS || Platform.isMacOS)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10.0),
|
||||
child: TextFormField(
|
||||
|
||||
@@ -19,7 +19,7 @@ class ReadyView extends StatelessWidget {
|
||||
title: 'Start discover peers',
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (Platform.isIOS)
|
||||
if (Platform.isIOS || Platform.isMacOS)
|
||||
ActionButton(
|
||||
onTap: () {
|
||||
context.read<AppService>().updateState(AppState.selectClientType);
|
||||
|
||||
@@ -34,8 +34,8 @@ class _PeersBody extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Selector<AppService, bool>(
|
||||
selector: (context, service) => service.isIOSBrowser,
|
||||
builder: (context, isIOSBrowser, _) {
|
||||
selector: (context, service) => service.isDarwinBrowser,
|
||||
builder: (context, isDarwinBrowser, _) {
|
||||
return Selector<AppService, List<NearbyDevice>?>(
|
||||
selector: (context, service) => service.peers,
|
||||
builder: (context, peers, _) {
|
||||
@@ -55,7 +55,7 @@ class _PeersBody extends StatelessWidget {
|
||||
],
|
||||
)
|
||||
: Text(
|
||||
Platform.isAndroid || isIOSBrowser
|
||||
Platform.isAndroid || isDarwinBrowser
|
||||
? 'No one here ('
|
||||
: "Wait until someone invites you!",
|
||||
textAlign: TextAlign.center,
|
||||
|
||||
Reference in New Issue
Block a user