Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change icon #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Sources/AppleMail.xcodeproj/project.xcworkspace
Sources/AppleMail.xcodeproj/xcuserdata
Sources/AppleMail.xcodeproj/xcshareddata
Binary file modified Release/com.elgato.applemail.streamDeckPlugin
Binary file not shown.
19 changes: 16 additions & 3 deletions Sources/MyStreamDeckPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ @interface MyStreamDeckPlugin ()
// The Mail icon with a badge encoded in base64
@property (strong) NSString *base64MailBadgeIconString;

// The Mail icon with a long badge encoded in base64
@property (strong) NSString *base64MailLongBadgeIconString;

@end


Expand All @@ -185,13 +188,18 @@ - (void)setupIfNeeded

if(_base64MailIconString == nil)
{
_base64MailIconString = CreateBase64EncodedString(GetResourcePath(@"MailIcon.png"));
_base64MailIconString = CreateBase64EncodedString(GetResourcePath(@"mail.png"));
}

if(_base64MailBadgeIconString == nil)
{
_base64MailBadgeIconString = CreateBase64EncodedString(GetResourcePath(@"MailBadgeIcon.png"));
_base64MailBadgeIconString = CreateBase64EncodedString(GetResourcePath(@"mail_unread.png"));
}

if(self.base64MailLongBadgeIconString == nil)
{
self.base64MailLongBadgeIconString = CreateBase64EncodedString(GetResourcePath(@"mail_unread_long.png"));
}
}


Expand Down Expand Up @@ -222,7 +230,12 @@ - (void)refreshUnreadCount
// Update each known context with the new value
for(NSString *context in self.knownContexts)
{
if(numberOfUnreadEmails > 0)
if(numberOfUnreadEmails > 9)
{
[self.connectionManager setImage:self.base64MailLongBadgeIconString withContext:context withTarget:kESDSDKTarget_HardwareAndSoftware];
[self.connectionManager setTitle:[NSString stringWithFormat:@"%d", numberOfUnreadEmails] withContext:context withTarget:kESDSDKTarget_HardwareAndSoftware];
}
else if(numberOfUnreadEmails > 0)
{
[self.connectionManager setImage:self.base64MailBadgeIconString withContext:context withTarget:kESDSDKTarget_HardwareAndSoftware];
[self.connectionManager setTitle:[NSString stringWithFormat:@"%d", numberOfUnreadEmails] withContext:context withTarget:kESDSDKTarget_HardwareAndSoftware];
Expand Down
Binary file modified Sources/com.elgato.applemail.sdPlugin/AppleMail
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Sources/com.elgato.applemail.sdPlugin/mail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions Sources/com.elgato.applemail.sdPlugin/manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"Actions": [
{
"Icon": "MailIcon",
"Icon": "Mail",
"Name": "Apple Mail",
"States": [
{
"Image": "MailIcon",
"Image": "mail",
"FontSize": "18",
"FontStyle": "Bold",
"TitleAlignment": "middle",
Expand All @@ -21,7 +21,7 @@
"CodePath": "AppleMail",
"Description": "See how many unread emails you have.",
"Name": "Apple Mail",
"Icon": "MailIcon",
"Icon": "Mail",
"URL": "https://www.elgato.com/gaming/stream-deck",
"Version": "1.4.1",
"OS": [
Expand Down