Skip to content

Commit

Permalink
https://github.com/AndreiMisiukevich/OpenTok-Xamarin.Forms/issues/34
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiMisiukevich committed Aug 31, 2020
1 parent 5b32987 commit cc5992f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public sealed class PlatformOpenTokService : BaseOpenTokService
private readonly Collection<SubscriberKit> _subscribers = new Collection<SubscriberKit>();

private PlatformOpenTokService()
{
{
_subscriberStreamIds.CollectionChanged += OnSubscriberStreamIdsCollectionChanged;
PropertyChanged += OnPropertyChanged;
StreamIdCollection = new ReadOnlyObservableCollection<string>(_subscriberStreamIds);
Subscribers = new ReadOnlyCollection<SubscriberKit>(_subscribers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public sealed class PlatformOpenTokService : BaseOpenTokService
private readonly Collection<OTSubscriber> _subscribers = new Collection<OTSubscriber>();

private PlatformOpenTokService()
{
{
_subscriberStreamIds.CollectionChanged += OnSubscriberStreamIdsCollectionChanged;
PropertyChanged += OnPropertyChanged;
StreamIdCollection = new ReadOnlyObservableCollection<string>(_subscriberStreamIds);
Subscribers = new ReadOnlyCollection<OTSubscriber>(_subscribers);
Expand Down
10 changes: 8 additions & 2 deletions Lib/Xamarin.Forms.OpenTok/Service/BaseOpenTokService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using System.Collections.Specialized;

namespace Xamarin.Forms.OpenTok.Service
{
Expand All @@ -12,12 +13,14 @@ public abstract class BaseOpenTokService : IOpenTokService
{
public event PropertyChangedEventHandler PropertyChanged;

public abstract ReadOnlyObservableCollection<string> StreamIdCollection { get; }

public event Action<string> Error;

public event Action<string> MessageReceived;

public event NotifyCollectionChangedEventHandler StreamIdCollectionChanged;

public abstract ReadOnlyObservableCollection<string> StreamIdCollection { get; }

private readonly object _propertiesLocker = new object();

private readonly Dictionary<string, object> _properties = new Dictionary<string, object>();
Expand Down Expand Up @@ -91,6 +94,9 @@ public bool IsPublishingStarted
protected void RaiseMessageReceived(string message)
=> MessageReceived?.Invoke(message);

protected void OnSubscriberStreamIdsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
=> StreamIdCollectionChanged(sender, e);

private T GetValue<T>(T defaultValue, [CallerMemberName] string name = null)
{
lock (_propertiesLocker)
Expand Down
7 changes: 5 additions & 2 deletions Lib/Xamarin.Forms.OpenTok/Service/IOpenTokService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Collections.Specialized;

namespace Xamarin.Forms.OpenTok.Service
{
public interface IOpenTokService : INotifyPropertyChanged
{
ReadOnlyObservableCollection<string> StreamIdCollection { get; }

event Action<string> Error;

event Action<string> MessageReceived;

event NotifyCollectionChangedEventHandler StreamIdCollectionChanged;

ReadOnlyObservableCollection<string> StreamIdCollection { get; }

bool IsVideoPublishingEnabled { get; set; }

bool IsAudioPublishingEnabled { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion OpenTok.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Xamarin.Forms.OpenTok</id>
<version>1.2.5</version>
<version>1.2.6</version>
<title>Xamarin.Forms.OpenTok</title>
<authors>Andrei Misiukevich</authors>
<owners>Andrei Misiukevich</owners>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cc5992f

Please sign in to comment.