Skip to content

Commit

Permalink
Added emojize parameter to translate :mushroom: into 🍄
Browse files Browse the repository at this point in the history
  • Loading branch information
vogonistic committed Mar 13, 2016
1 parent 62574ae commit 1b7204e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "App/Vendor/AHProxySettings"]
path = App/Vendor/AHProxySettings
url = https://github.com/eahrold/AHProxySettings.git
[submodule "App/Vendor/NSStringEmojize"]
path = App/Vendor/NSStringEmojize
url = https://github.com/diy/NSStringEmojize.git
21 changes: 21 additions & 0 deletions App/BitBar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
A22AF32A189F823E0011DFCD /* NSColor+Hex.m in Sources */ = {isa = PBXBuildFile; fileRef = A22AF328189F823E0011DFCD /* NSColor+Hex.m */; };
A281BDB5189066DE00C380A4 /* ExecutablePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = A281BDB4189066DE00C380A4 /* ExecutablePlugin.m */; };
A281BDB81890670800C380A4 /* HTMLPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = A281BDB71890670800C380A4 /* HTMLPlugin.m */; };
AE3C16791C93F716009AF7CA /* NSString+Emojize.m in Sources */ = {isa = PBXBuildFile; fileRef = AE7303D81C935BDE00AF5499 /* NSString+Emojize.m */; };
AE3C167A1C93F71B009AF7CA /* NSString+Emojize.m in Sources */ = {isa = PBXBuildFile; fileRef = AE7303D81C935BDE00AF5499 /* NSString+Emojize.m */; };
AE7303DB1C935BDE00AF5499 /* NSString+Emojize.m in Sources */ = {isa = PBXBuildFile; fileRef = AE7303D81C935BDE00AF5499 /* NSString+Emojize.m */; };
AE7303DD1C93721600AF5499 /* TestPlugins in Resources */ = {isa = PBXBuildFile; fileRef = AE7303DC1C93721600AF5499 /* TestPlugins */; };
AE7303E01C93848400AF5499 /* PluginManager+Test.m in Sources */ = {isa = PBXBuildFile; fileRef = AE7303DF1C93848400AF5499 /* PluginManager+Test.m */; };
AE7303E11C9386CE00AF5499 /* PluginManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 05DAE02C1833274100409786 /* PluginManager.m */; };
Expand Down Expand Up @@ -146,6 +149,9 @@
A281BDB4189066DE00C380A4 /* ExecutablePlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ExecutablePlugin.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
A281BDB61890670800C380A4 /* HTMLPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLPlugin.h; sourceTree = "<group>"; };
A281BDB71890670800C380A4 /* HTMLPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = HTMLPlugin.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
AE7303D61C935BDE00AF5499 /* emojis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = emojis.h; sourceTree = "<group>"; };
AE7303D71C935BDE00AF5499 /* NSString+Emojize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Emojize.h"; sourceTree = "<group>"; };
AE7303D81C935BDE00AF5499 /* NSString+Emojize.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Emojize.m"; sourceTree = "<group>"; };
AE7303DC1C93721600AF5499 /* TestPlugins */ = {isa = PBXFileReference; lastKnownFileType = folder; path = TestPlugins; sourceTree = "<group>"; };
AE7303DE1C93848400AF5499 /* PluginManager+Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PluginManager+Test.h"; sourceTree = "<group>"; };
AE7303DF1C93848400AF5499 /* PluginManager+Test.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PluginManager+Test.m"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -198,6 +204,7 @@
055EB10C183472C400FF83A6 /* Vendor */ = {
isa = PBXGroup;
children = (
AE7303D51C935BDE00AF5499 /* NSStringEmojize */,
F8D03BB01C3D95E600A64968 /* AHProxySettings */,
7B9A21541B9F0F10002539F7 /* DateTools */,
7B9A214F1B9F0BE6002539F7 /* STPrivilegedTask.h */,
Expand Down Expand Up @@ -310,6 +317,17 @@
path = Vendor/DateTools/DateTools;
sourceTree = SOURCE_ROOT;
};
AE7303D51C935BDE00AF5499 /* NSStringEmojize */ = {
isa = PBXGroup;
children = (
AE7303D61C935BDE00AF5499 /* emojis.h */,
AE7303D71C935BDE00AF5499 /* NSString+Emojize.h */,
AE7303D81C935BDE00AF5499 /* NSString+Emojize.m */,
);
name = NSStringEmojize;
path = Vendor/NSStringEmojize/NSStringEmojize;
sourceTree = SOURCE_ROOT;
};
F8D03BB01C3D95E600A64968 /* AHProxySettings */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -478,6 +496,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AE3C167A1C93F71B009AF7CA /* NSString+Emojize.m in Sources */,
F8D03BB71C3D95E600A64968 /* AHProxy.m in Sources */,
05DAE007183323DD00409786 /* AppDelegate.m in Sources */,
7B9A21661B9F0F10002539F7 /* DTConstants.m in Sources */,
Expand All @@ -504,6 +523,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AE3C16791C93F716009AF7CA /* NSString+Emojize.m in Sources */,
AE7303EA1C9387F300AF5499 /* NSUserDefaults+Settings.m in Sources */,
AE7303E51C93871200AF5499 /* AHProxy.m in Sources */,
AE7303E61C93871200AF5499 /* AHProxySettings.m in Sources */,
Expand Down Expand Up @@ -565,6 +585,7 @@
36DCD8CE1C76027C004DE286 /* LaunchAtLoginController.m in Sources */,
36DCD8CF1C76027C004DE286 /* AHProxySettings.m in Sources */,
36DCD8D01C76027C004DE286 /* DTTimePeriod.m in Sources */,
AE7303DB1C935BDE00AF5499 /* NSString+Emojize.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"C0AF55779579B522417152BFAB32AD2A49AFBDFE" : 0,
"F8622BA04EBD09F8BA8DC9C0C199149407552BFA" : 0,
"EFCDA5DAAD3299C621AB4AD8A1985311413BE697" : 0,
"4FA437A61B0C4384CD084682AFD40F7D2624731D" : 0,
"5A18CC4105103F3DCAAD74EC93EFD3FF8BB5508A" : 0,
"300A25E6089E8365F1B9BCC0BF644BF304850FDB" : 0
Expand All @@ -14,6 +15,7 @@
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"C0AF55779579B522417152BFAB32AD2A49AFBDFE" : "bitbar\/App\/Vendor\/AHProxySettings\/",
"F8622BA04EBD09F8BA8DC9C0C199149407552BFA" : "bitbar\/App\/Vendor\/DateTools\/",
"EFCDA5DAAD3299C621AB4AD8A1985311413BE697" : "bitbar\/App\/Vendor\/NSStringEmojize\/",
"4FA437A61B0C4384CD084682AFD40F7D2624731D" : "bitbar\/App\/Vendor\/LaunchAtLoginController\/",
"5A18CC4105103F3DCAAD74EC93EFD3FF8BB5508A" : "bitbar\/App\/Vendor\/STPrivilegedTask\/",
"300A25E6089E8365F1B9BCC0BF644BF304850FDB" : "bitbar"
Expand Down Expand Up @@ -42,6 +44,11 @@
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "C0AF55779579B522417152BFAB32AD2A49AFBDFE"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/diy\/NSStringEmojize.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "EFCDA5DAAD3299C621AB4AD8A1985311413BE697"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/MatthewYork\/DateTools.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
Expand Down
7 changes: 7 additions & 0 deletions App/BitBar/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "STPrivilegedTask.h"
#import "NSDate+DateTools.h"
#import "NSColor+Hex.h"
#import "NSString+Emojize.h"

#define DEFAULT_TIME_INTERVAL_SECONDS ((double)60.)

Expand Down Expand Up @@ -51,6 +52,9 @@ - (NSMenuItem*) buildMenuItemWithParams:(NSDictionary *)params {
}

NSString * fullTitle = params[@"title"];
if ([[params[@"emojize"] lowercaseString] isEqualToString:@"true"]) {
fullTitle = [fullTitle emojizedString];
}
if (![[params[@"trim"] lowercaseString] isEqualToString:@"false"]) {
fullTitle = [fullTitle stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceCharacterSet];
}
Expand Down Expand Up @@ -94,6 +98,9 @@ - (NSMenuItem*) buildMenuItemWithParams:(NSDictionary *)params {
- (NSAttributedString*) attributedTitleWithParams:(NSDictionary *)params {

NSString * fullTitle = params[@"title"];
if ([[params[@"emojize"] lowercaseString] isEqualToString:@"true"]) {
fullTitle = [fullTitle emojizedString];
}
if (![[params[@"trim"] lowercaseString] isEqualToString:@"false"]) {
fullTitle = [fullTitle stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceCharacterSet];
}
Expand Down
1 change: 1 addition & 0 deletions App/Vendor/NSStringEmojize
Submodule NSStringEmojize added at 00d954
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ If you want to contribute, please send us a pull request and we'll add it to our
* `alternate=true` to mark a line as an alternate to the previous one for when the Option key is pressed in the dropdown
* `templateImage=..` set an image for this item. The image data must be passed as base64 encoded string and should consist of only black and clear pixels. The alpha channel in the image can be used to adjust the opacity of black content, however. This is the recommended way to set an image for the statusbar. The imageformat can be any of the formats supported by Mac OS X
* `image=..` set an image for this item. The image data must be passed as base64 encoded string. The imageformat can be any of the formats supported by Mac OS X
* `emojize=true` will convert github style `:mushroom:` into :mushroom:

### Metadata

Expand Down

0 comments on commit 1b7204e

Please sign in to comment.