Skip to content

Commit

Permalink
Auto increase bundle version, handling url scheme, image generation
Browse files Browse the repository at this point in the history
  • Loading branch information
relikd committed Feb 14, 2019
1 parent abf6312 commit 7e68c17
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 101 deletions.
88 changes: 43 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,72 @@

![screenshot](doc/screenshot.png)

For nearly a decade I've been using the then free version of [RSS Menu](https://itunes.apple.com/us/app/rss-menu/id423069534). However, with the release of macOS Mojave, 32bit applications are no longer supported. Furthermore, the currently available version in the Mac App Store was last updated in 2014 (as of writing).
For nearly a decade I've been using the then free version of [RSS Menu](https://itunes.apple.com/us/app/rss-menu/id423069534).
However, with the release of macOS Mojave, 32bit applications are no longer supported.
Furthermore, the currently available version in the Mac App Store was last updated in 2014 (as of writing).

*baRSS* was build from scratch with a minimal footprint in mind. It will be available on the AppStore eventually. If you want a feature to be added, drop me an email or create an issue. Look at the other issues, in case somebody else already filed one similar. If you like this project and want to say thank you drop me a line (or other stuff like money). Regardless, I'll continue development as long as I'm using it on my own. Admittedly, I've invested way too much time in this project already (1400h+) …
*baRSS* was build from scratch with a minimal footprint in mind. It will be available on the AppStore eventually.
If you want a feature to be added, drop me an email or create an issue.
Look at the other issues, in case somebody else already filed one similar.
If you like this project and want to say thank you drop me a line (or other stuff like money).
Regardless, I'll continue development as long as I'm using it on my own.
Admittedly, I've invested way too much time in this project already (1400h+) …


Why is this project not written in Swift?
-----------------------------------------
### Why is this project not written in Swift?

Actually, I started this project with Swift. Even without adding much functionality, the app was exceeding the 10 Mb file size. Compared to the nearly finished Alpha version with 500 Kb written in Objective-C. The reason for that, Swift frameworks are always packed into the final application. I decided that this level of encapsulation is a waste of space for such a small application.
Actually, I started this project with Swift. Even without adding much functionality, the app was exceeding the 10 Mb file size.
Compared to the nearly finished Alpha version with 500 Kb written in Objective-C.
The reason for that, Swift frameworks are always packed into the final application.
I decided that this level of encapsulation is a waste of space for such a small application.


3rd Party Libraries
-------------------
### 3rd Party Libraries

This project uses a modified version of Brent Simmons [RSXML](https://github.com/brentsimmons/RSXML) for feed parsing. RSXML is licensed under a MIT license (same as this project).
This project uses a modified version of Brent Simmons [RSXML](https://github.com/brentsimmons/RSXML) for feed parsing.
RSXML is licensed under a MIT license (same as this project).


Current project state
---------------------

All basic functionality is there. What's missing?

- Authenticated feeds
- Online sync with other services
- Text / UI localisation
- App icon & UI icons

All in all, the software is in a usable state. The remaining features will be added in the coming weeks.


Hidden options
--------------

1) When holding down the option key, the menu will show an item to open only a few unread items at a time. This number can be changed with the following Terminal command (default: 10):
1) When holding down the option key, the menu will show an item to open only a few unread items at a time.
This number can be changed with the following Terminal command (default: 10):

```defaults write de.relikd.baRSS openFewLinksLimit -int 10```

defaults write de.relikd.baRSS openFewLinksLimit -int 10
2) In preferences you can choose to show 'Short article names'. This will limit the number of displayed characters to 60 (default).
With this Terminal command you can customize this number:

2) In preferences you can choose to show 'Short article names'. This will limit the number of displayed characters to 60 (default). With this Terminal command you can customize this number:
```defaults write de.relikd.baRSS shortArticleNamesLimit -int 50```

3) If you hold down the option key and click on an article item, you can mark a single item (un-)read.

defaults write de.relikd.baRSS shortArticleNamesLimit -int 50


ToDo
----

- [ ] Edit feed
- [ ] Show statistics
- [x] How often gets the feed updated (min, max, avg)
- [ ] Automatically choose best interval?
- [x] Show time of next update
- [ ] Missing
- [ ] App Icon & UI icons (a shout out to all designers out there!)
- [ ] Text / UI localization
- [ ] Feeds with authentication
- [ ] Sandbox (does work, except for:)
- [ ] Default RSS application checkbox (disable or other workaround)


- [ ] Other
- [ ] App Icon
- [ ] Translate text to different languages
- [x] Download with ephemeral url session?
- [ ] Add Sandboxing
- [ ] Disable Startup checkbox (or other workaround)


- [ ] Additional features
- [ ] Sync with online services!
- [ ] Nice to have (... on increased demand)
- [ ] Automatically choose best update interval (e.g., avg)
- [ ] Sync with online services
- [ ] Notification Center
- [ ] Sleep timer. (e.g., disable updates during working hours)
- [ ] Pure image feed? (show images directly in menu)
- [ ] Distraction Mode
- [ ] Distract less: Sleep timer. (e.g., disable updates during working hours)
- [ ] Distract more: Automatically open feed items
- [ ] Add support for media types
- [ ] music / video? (open media player)
- [ ] Pure image feed? (show images directly in menu)
- [ ] Per feed / group settings
- [ ] select launch application (e.g., for podcasts)
- [ ] exclude unread count from menu bar (e.g., unimportant feeds)
- [ ] ~~Infinite storage. (load more button)~~
- [ ] Automatically open feed items?
- [ ] Per feed launch application (e.g., for podcasts)
- [ ] Per group setting to exclude unread count from menu bar

31 changes: 26 additions & 5 deletions baRSS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
54A07A7E220E04CF00082C51 /* NSFetchRequest+Ext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSFetchRequest+Ext.m"; sourceTree = "<group>"; };
54A07A80220E723D00082C51 /* MapUnreadTotal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MapUnreadTotal.h; sourceTree = "<group>"; };
54A07A81220E723D00082C51 /* MapUnreadTotal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MapUnreadTotal.m; sourceTree = "<group>"; };
54ACC27C21061B3B0020715F /* baRSS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = baRSS.app; sourceTree = BUILT_PRODUCTS_DIR; };
54ACC27C21061B3B0020715F /* baRSS Beta.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "baRSS Beta.app"; sourceTree = BUILT_PRODUCTS_DIR; };
54ACC28321061B3B0020715F /* DBv1.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = DBv1.xcdatamodel; sourceTree = "<group>"; };
54ACC28521061B3C0020715F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
54ACC28A21061B3C0020715F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -261,7 +261,7 @@
54ACC27D21061B3B0020715F /* Products */ = {
isa = PBXGroup;
children = (
54ACC27C21061B3B0020715F /* baRSS.app */,
54ACC27C21061B3B0020715F /* baRSS Beta.app */,
54CC042C2162532800A48795 /* baRSS-Helper.app */,
);
name = Products;
Expand Down Expand Up @@ -322,14 +322,15 @@
544DCCBB212A2B4D002DBC46 /* Embed Frameworks */,
544DCCBC212A2B5A002DBC46 /* CopyFiles */,
54CC043D2162565F00A48795 /* CopyFiles */,
543964EE2215C27B0016AAA3 /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = baRSS;
productName = baRRS;
productReference = 54ACC27C21061B3B0020715F /* baRSS.app */;
productReference = 54ACC27C21061B3B0020715F /* baRSS Beta.app */;
productType = "com.apple.product-type.application";
};
54CC042B2162532800A48795 /* baRSS-Helper */ = {
Expand Down Expand Up @@ -421,6 +422,26 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
543964EE2215C27B0016AAA3 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# https://crunchybagel.com/auto-incrementing-build-numbers-in-xcode/\nbuildNumber=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"${PROJECT_DIR}/${INFOPLIST_FILE}\")\nbuildNumber=$(($buildNumber + 1))\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"${PROJECT_DIR}/${INFOPLIST_FILE}\"\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
54ACC27821061B3B0020715F /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -617,7 +638,7 @@
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
PRODUCT_BUNDLE_IDENTIFIER = de.relikd.baRSS.beta;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_NAME = "$(TARGET_NAME) Beta";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
Expand Down Expand Up @@ -666,7 +687,7 @@
"$(FRAMEWORK_SEARCH_PATHS)",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
PRODUCT_BUNDLE_IDENTIFIER = de.relikd.baRSS.beta;
PRODUCT_BUNDLE_IDENTIFIER = de.relikd.baRSS;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
};
Expand Down
13 changes: 8 additions & 5 deletions baRSS/AppHook.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,18 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification {

- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
NSString *url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
if ([url hasPrefix:@"feed:"]) {
// TODO: handle other app schemes like configuration export / import
url = [url substringFromIndex:5];
if ([url hasPrefix:@"//"])
url = [url substringFromIndex:2];
NSString *scheme = [[[NSURL URLWithString:url] scheme] lowercaseString];
url = [url substringFromIndex:scheme.length + 1]; // + ':'
if (url.length >= 2 && [[url substringToIndex:2] isEqualToString:@"//"]) {
url = [url substringFromIndex:2];
}
if ([scheme isEqualToString:@"feed"]) {
[FeedDownload autoDownloadAndParseURL:url successBlock:^{
[self reopenPreferencesIfOpen];
}];
}
// TODO: handle other app schemes like configuration export / import
// NSURLComponents *comp = [NSURLComponents componentsWithString:url];
}


Expand Down
3 changes: 2 additions & 1 deletion baRSS/Core Data/Feed+Ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
@class RSParsedFeed;

@interface Feed (Ext)
@property (nonnull, readonly) NSImage* iconImage16;

// Generator methods / Feed update
+ (instancetype)newFeedAndMetaInContext:(NSManagedObjectContext*)context;
+ (instancetype)appendToRootWithDefaultIntervalInContext:(NSManagedObjectContext*)moc;
Expand All @@ -35,6 +37,5 @@
// Article properties
- (NSArray<FeedArticle*>*)sortedArticles;
// Icon
- (NSImage*)iconImage16;
- (BOOL)setIconImage:(NSImage*)img;
@end
35 changes: 11 additions & 24 deletions baRSS/Core Data/Feed+Ext.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ - (NSMenuItem*)newMenuItem {
item.title = self.group.nameOrError;
item.toolTip = self.subtitle;
item.enabled = (self.articles.count > 0);
item.image = [self iconImage16];
item.image = self.iconImage16;
item.representedObject = self.indexPath;
item.target = [self class];
item.action = @selector(didClickOnMenuItem:);
Expand Down Expand Up @@ -200,30 +200,17 @@ - (FeedArticle*)findArticleWithLink:(NSString*)url {
/**
@return Return @c 16x16px image. Either from core data storage or generated default RSS icon.
*/
- (NSImage*)iconImage16 {
NSData *imgData = self.icon.icon;
if (imgData)
{
NSImage *img = [[NSImage alloc] initWithData:imgData];
[img setSize:NSMakeSize(16, 16)];
return img;
}
else if (self.articles.count == 0)
{
static NSImage *warningIcon;
if (!warningIcon) {
warningIcon = [NSImage imageNamed:NSImageNameCaution];
[warningIcon setSize:NSMakeSize(16, 16)];
}
return warningIcon;
}
else
{
static NSImage *defaultRSSIcon; // TODO: setup imageNamed: for default rss icon
if (!defaultRSSIcon)
defaultRSSIcon = [RSSIcon iconWithSize:16];
return defaultRSSIcon;
- (nonnull NSImage*)iconImage16 {
NSImage *img = nil;
if (self.articles.count == 0) {
img = [NSImage imageNamed:NSImageNameCaution];
} else if (self.icon.icon) {
img = [[NSImage alloc] initWithData:self.icon.icon];
} else {
return [RSSIcon iconWithSize:16]; // TODO: setup imageNamed: for default rss icon?
}
[img setSize:NSMakeSize(16, 16)];
return img;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion baRSS/Core Data/FeedGroup+Ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ typedef NS_ENUM(int16_t, FeedGroupType) {
/// Overwrites @c type attribute with enum. Use one of: @c GROUP, @c FEED, @c SEPARATOR.
@property (nonatomic) FeedGroupType type;
@property (nonnull, readonly) NSString *nameOrError;
@property (nonnull, readonly) NSImage* groupIconImage16;
@property (nonnull, readonly) NSImage* iconImage16;

+ (instancetype)newGroup:(FeedGroupType)type inContext:(NSManagedObjectContext*)context;
- (void)setParent:(FeedGroup *)parent andSortIndex:(int32_t)sortIndex;
- (void)setNameIfChanged:(NSString*)name;
- (NSImage*)groupIconImage16;
- (NSMenuItem*)newMenuItem;
// Handle children and parents
- (NSString*)indexPathString;
Expand Down
44 changes: 28 additions & 16 deletions baRSS/Core Data/FeedGroup+Ext.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,33 @@

@implementation FeedGroup (Ext)

#pragma mark - Properties

/// @return Returns "(error)" if @c self.name is @c nil.
- (nonnull NSString*)nameOrError {
return (self.name ? self.name : NSLocalizedString(@"(error)", nil));
}

/// @return Return @c 16x16px NSImageNameFolder image.
- (nonnull NSImage*)groupIconImage16 {
NSImage *groupIcon = [NSImage imageNamed:NSImageNameFolder];
groupIcon.size = NSMakeSize(16, 16);
return groupIcon;
}

/**
@return Return @c 16x16px image.
Either feed icon ( @c type @c == @c FEED ) or @c NSImageNameFolder ( @c type @c == @c GROUP ).
*/
- (nonnull NSImage*)iconImage16 {
if (self.type == FEED)
return self.feed.iconImage16;
return self.groupIconImage16;
}


#pragma mark - Generator

/// Create new instance and set @c Feed and @c FeedMeta if group type is @c FEED
+ (instancetype)newGroup:(FeedGroupType)type inContext:(NSManagedObjectContext*)moc {
FeedGroup *fg = [[FeedGroup alloc] initWithEntity: FeedGroup.entity insertIntoManagedObjectContext:moc];
Expand All @@ -49,27 +76,12 @@ - (void)setNameIfChanged:(NSString*)name {
self.name = name;
}

/// @return Return static @c 16x16px NSImageNameFolder image.
- (NSImage*)groupIconImage16 {
static NSImage *groupIcon;
if (!groupIcon) {
groupIcon = [NSImage imageNamed:NSImageNameFolder];
groupIcon.size = NSMakeSize(16, 16);
}
return groupIcon;
}

/// @return Returns "(error)" if @c self.name is @c nil.
- (nonnull NSString*)nameOrError {
return (self.name ? self.name : NSLocalizedString(@"(error)", nil));
}

/// @return Fully initialized @c NSMenuItem with @c title and @c image.
- (NSMenuItem*)newMenuItem {
NSMenuItem *item = [NSMenuItem new];
item.title = self.nameOrError;
item.enabled = (self.children.count > 0);
item.image = [self groupIconImage16];
item.image = self.groupIconImage16;
item.representedObject = self.objectID;
return item;
}
Expand Down
6 changes: 3 additions & 3 deletions baRSS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9</string>
<string>0.9.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<string>1032</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand All @@ -43,7 +43,7 @@
<true/>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 relikd. Public Domain.</string>
<string>Copyright © 2019 relikd. Public Domain.</string>
<key>NSPrincipalClass</key>
<string>AppHook</string>
</dict>
Expand Down
Loading

0 comments on commit 7e68c17

Please sign in to comment.