Skip to content

Commit

Permalink
Revert "refactor(Mute::Notification): Remove notification for mute"
Browse files Browse the repository at this point in the history
This reverts commit 96e080a.
  • Loading branch information
Belphemur committed Sep 4, 2021
1 parent 8b1981d commit 1951d29
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public MicrophoneMuteToggler(AudioSwitcher switcher, NotificationManager.Notific
return null;
}

_notificationManager.NotifyMuteChanged(result.Name, result.NewMuteState);
return result.NewMuteState;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@ public interface INotification : IEnumImpl<NotificationTypeEnum>
/// <param name="profile"></param>
/// <param name="processId"></param>
void NotifyProfileChanged(Profile.Profile profile, uint? processId);

/// <summary>
/// Notify about the mute state having changed
/// </summary>
void NotifyMuteChanged(string microphoneName, bool newMuteState);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
_bannerManager.ShowNotification(bannerData);
}

public void NotifyMuteChanged(string microphoneName, bool newMuteState)
{
var title = newMuteState ? string.Format(SettingsStrings.notification_microphone_muted, microphoneName) : string.Format(SettingsStrings.notification_microphone_unmuted, microphoneName);

var icon = newMuteState ? Resources.microphone_muted : Resources.microphone_unmuted;

var bannerData = new BannerData
{
Priority = 2,
Image = icon,
Title = title

};
_bannerManager.ShowNotification(bannerData);
}

public void NotifyDefaultChanged(MMDevice audioDevice)
{
var icon = AudioDeviceIconExtractor.ExtractIconFromAudioDevice(audioDevice, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,9 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
//Ignored
}
}

public void NotifyMuteChanged(string microphoneName, bool newMuteState)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@ public bool IsAvailable()
public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
{
}

public void NotifyMuteChanged(string microphoneName, bool newMuteState)
{

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
}
}

public void NotifyMuteChanged(string microphoneName, bool newMuteState)
{
}

private Stream GetStreamCopy()
{
lock (this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,11 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
var text = string.Join("\n", profile.Devices.Select(wrapper => wrapper.DeviceInfo.NameClean));
Configuration.Icon.ShowBalloonTip(1000, title, text, ToolTipIcon.Info);
}

public void NotifyMuteChanged(string microphoneName, bool newMuteState)
{
var title = newMuteState ? string.Format(SettingsStrings.notification_microphone_muted, microphoneName) : string.Format(SettingsStrings.notification_microphone_unmuted, microphoneName);
Configuration.Icon.ShowBalloonTip(1000, title, microphoneName, ToolTipIcon.Info);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ public void NotifyProfileChanged(Profile.Profile profile, uint? processId)
_notification.NotifyProfileChanged(profile, processId);
}

public void NotifyMuteChanged(string microphoneName, bool newMuteState)
{
_notification.NotifyMuteChanged(microphoneName, newMuteState);
}

~NotificationManager()
{
_model.DefaultDeviceChanged -= ModelOnDefaultDeviceChanged;
Expand Down
12 changes: 1 addition & 11 deletions SoundSwitch/Properties/Resources.Designer.cs

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

9 changes: 3 additions & 6 deletions SoundSwitch/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="SoundSwitch16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow-switch-16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down Expand Up @@ -202,7 +202,4 @@
<data name="profile-menu-delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\user-times-solid.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="muted_microphone_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\muted_microphone_32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

0 comments on commit 1951d29

Please sign in to comment.