├── .gitignore ├── README.md ├── ReadingList.png ├── ReadingList.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── Ryder.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── ReadingList.xcscheme │ └── xcschememanagement.plist └── ReadingList ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj └── MainMenu.xib ├── Info.plist ├── ReadingList.h └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | *~.nib 3 | *.swp 4 | .DS_Store 5 | *.mode1 6 | *.mode1v3 7 | *.mode2v3 8 | *.perspective 9 | *.perspectivev3 10 | *.pbxuser 11 | xcuserdata 12 | *.xccheckout 13 | *.xcuserstate 14 | lto-llvm.o* 15 | *.xcscmblueprint 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ReadingList 3 | =========== 4 | 5 | This little Mac app uses private API to display Safari’s Reading List. It has a few features: 6 | 7 | - sort and filter by title, date, domain and preview text 8 | - multiple selection 9 | - add new items by dragging & dropping URLs into the main window 10 | - open selected items in the default browser by pressing return (hold option to open in background) 11 | - remove selected items by pressing delete 12 | 13 | Make sure you quit the app (instead of killing the process from Xcode) to ensure changes are flushed. 14 | 15 | ![ReadingList in action](ReadingList.png) 16 | 17 | Disclaimer 18 | ---------- 19 | I built this on macOS 10.12.3 (16D32). Future or past versions will probably break it. Do not use this code in a shipping product. Do not link against private frameworks. Do not ingest. For entertainment purposes only. 20 | 21 | Credits and Shouts Out 22 | ---------------------- 23 | h/t Jonathan Wight ([@schwa](https://twitter.com/schwa)) for [prompting me](https://twitter.com/rydermackay/status/845406758214516737 24 | ) to waste an evening on this :P 25 | -------------------------------------------------------------------------------- /ReadingList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rydermackay/ReadingList/4d30a22d1bb96ed36b9d8e6a674f83b03ca23cf2/ReadingList.png -------------------------------------------------------------------------------- /ReadingList.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0D3E26CF1E85A96700AC91B3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D3E26CE1E85A96700AC91B3 /* AppDelegate.m */; }; 11 | 0D3E26D21E85A96700AC91B3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D3E26D11E85A96700AC91B3 /* main.m */; }; 12 | 0D3E26D41E85A96700AC91B3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0D3E26D31E85A96700AC91B3 /* Assets.xcassets */; }; 13 | 0D3E26D71E85A96700AC91B3 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0D3E26D51E85A96700AC91B3 /* MainMenu.xib */; }; 14 | 0D6458512091401900320522 /* Safari.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D6458502091401900320522 /* Safari.framework */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 0D3E26CA1E85A96700AC91B3 /* ReadingList.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReadingList.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 0D3E26CD1E85A96700AC91B3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 20 | 0D3E26CE1E85A96700AC91B3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 21 | 0D3E26D11E85A96700AC91B3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 22 | 0D3E26D31E85A96700AC91B3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 0D3E26D61E85A96700AC91B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 24 | 0D3E26D81E85A96700AC91B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | 0D3E26E11E85E01F00AC91B3 /* ReadingList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReadingList.h; sourceTree = ""; }; 26 | 0D6458502091401900320522 /* Safari.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Safari.framework; path = /System/Library/PrivateFrameworks/Safari.framework; sourceTree = ""; }; 27 | 0D9A01041E8603370074A735 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | 0D3E26C71E85A96700AC91B3 /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 2147483647; 34 | files = ( 35 | 0D6458512091401900320522 /* Safari.framework in Frameworks */, 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 0D3E26C11E85A96700AC91B3 = { 43 | isa = PBXGroup; 44 | children = ( 45 | 0D9A01041E8603370074A735 /* README.md */, 46 | 0D3E26CC1E85A96700AC91B3 /* ReadingList */, 47 | 0D3E26CB1E85A96700AC91B3 /* Products */, 48 | 0D3E26DE1E85A99200AC91B3 /* Frameworks */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | 0D3E26CB1E85A96700AC91B3 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 0D3E26CA1E85A96700AC91B3 /* ReadingList.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | 0D3E26CC1E85A96700AC91B3 /* ReadingList */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 0D3E26E11E85E01F00AC91B3 /* ReadingList.h */, 64 | 0D3E26CD1E85A96700AC91B3 /* AppDelegate.h */, 65 | 0D3E26CE1E85A96700AC91B3 /* AppDelegate.m */, 66 | 0D3E26D31E85A96700AC91B3 /* Assets.xcassets */, 67 | 0D3E26D51E85A96700AC91B3 /* MainMenu.xib */, 68 | 0D3E26D81E85A96700AC91B3 /* Info.plist */, 69 | 0D3E26D01E85A96700AC91B3 /* Supporting Files */, 70 | ); 71 | path = ReadingList; 72 | sourceTree = ""; 73 | }; 74 | 0D3E26D01E85A96700AC91B3 /* Supporting Files */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 0D3E26D11E85A96700AC91B3 /* main.m */, 78 | ); 79 | name = "Supporting Files"; 80 | sourceTree = ""; 81 | }; 82 | 0D3E26DE1E85A99200AC91B3 /* Frameworks */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 0D6458502091401900320522 /* Safari.framework */, 86 | ); 87 | name = Frameworks; 88 | sourceTree = ""; 89 | }; 90 | /* End PBXGroup section */ 91 | 92 | /* Begin PBXNativeTarget section */ 93 | 0D3E26C91E85A96700AC91B3 /* ReadingList */ = { 94 | isa = PBXNativeTarget; 95 | buildConfigurationList = 0D3E26DB1E85A96700AC91B3 /* Build configuration list for PBXNativeTarget "ReadingList" */; 96 | buildPhases = ( 97 | 0D3E26C61E85A96700AC91B3 /* Sources */, 98 | 0D3E26C71E85A96700AC91B3 /* Frameworks */, 99 | 0D3E26C81E85A96700AC91B3 /* Resources */, 100 | ); 101 | buildRules = ( 102 | ); 103 | dependencies = ( 104 | ); 105 | name = ReadingList; 106 | productName = ReadingList; 107 | productReference = 0D3E26CA1E85A96700AC91B3 /* ReadingList.app */; 108 | productType = "com.apple.product-type.application"; 109 | }; 110 | /* End PBXNativeTarget section */ 111 | 112 | /* Begin PBXProject section */ 113 | 0D3E26C21E85A96700AC91B3 /* Project object */ = { 114 | isa = PBXProject; 115 | attributes = { 116 | LastUpgradeCheck = 0940; 117 | ORGANIZATIONNAME = "Ryder Mackay"; 118 | TargetAttributes = { 119 | 0D3E26C91E85A96700AC91B3 = { 120 | CreatedOnToolsVersion = 8.2.1; 121 | DevelopmentTeam = J67PW9QQ97; 122 | ProvisioningStyle = Automatic; 123 | }; 124 | }; 125 | }; 126 | buildConfigurationList = 0D3E26C51E85A96700AC91B3 /* Build configuration list for PBXProject "ReadingList" */; 127 | compatibilityVersion = "Xcode 3.2"; 128 | developmentRegion = English; 129 | hasScannedForEncodings = 0; 130 | knownRegions = ( 131 | en, 132 | Base, 133 | ); 134 | mainGroup = 0D3E26C11E85A96700AC91B3; 135 | productRefGroup = 0D3E26CB1E85A96700AC91B3 /* Products */; 136 | projectDirPath = ""; 137 | projectRoot = ""; 138 | targets = ( 139 | 0D3E26C91E85A96700AC91B3 /* ReadingList */, 140 | ); 141 | }; 142 | /* End PBXProject section */ 143 | 144 | /* Begin PBXResourcesBuildPhase section */ 145 | 0D3E26C81E85A96700AC91B3 /* Resources */ = { 146 | isa = PBXResourcesBuildPhase; 147 | buildActionMask = 2147483647; 148 | files = ( 149 | 0D3E26D41E85A96700AC91B3 /* Assets.xcassets in Resources */, 150 | 0D3E26D71E85A96700AC91B3 /* MainMenu.xib in Resources */, 151 | ); 152 | runOnlyForDeploymentPostprocessing = 0; 153 | }; 154 | /* End PBXResourcesBuildPhase section */ 155 | 156 | /* Begin PBXSourcesBuildPhase section */ 157 | 0D3E26C61E85A96700AC91B3 /* Sources */ = { 158 | isa = PBXSourcesBuildPhase; 159 | buildActionMask = 2147483647; 160 | files = ( 161 | 0D3E26D21E85A96700AC91B3 /* main.m in Sources */, 162 | 0D3E26CF1E85A96700AC91B3 /* AppDelegate.m in Sources */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXSourcesBuildPhase section */ 167 | 168 | /* Begin PBXVariantGroup section */ 169 | 0D3E26D51E85A96700AC91B3 /* MainMenu.xib */ = { 170 | isa = PBXVariantGroup; 171 | children = ( 172 | 0D3E26D61E85A96700AC91B3 /* Base */, 173 | ); 174 | name = MainMenu.xib; 175 | sourceTree = ""; 176 | }; 177 | /* End PBXVariantGroup section */ 178 | 179 | /* Begin XCBuildConfiguration section */ 180 | 0D3E26D91E85A96700AC91B3 /* Debug */ = { 181 | isa = XCBuildConfiguration; 182 | buildSettings = { 183 | ALWAYS_SEARCH_USER_PATHS = NO; 184 | CLANG_ANALYZER_NONNULL = YES; 185 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 186 | CLANG_CXX_LIBRARY = "libc++"; 187 | CLANG_ENABLE_MODULES = YES; 188 | CLANG_ENABLE_OBJC_ARC = YES; 189 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 190 | CLANG_WARN_BOOL_CONVERSION = YES; 191 | CLANG_WARN_COMMA = YES; 192 | CLANG_WARN_CONSTANT_CONVERSION = YES; 193 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 194 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 195 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 196 | CLANG_WARN_EMPTY_BODY = YES; 197 | CLANG_WARN_ENUM_CONVERSION = YES; 198 | CLANG_WARN_INFINITE_RECURSION = YES; 199 | CLANG_WARN_INT_CONVERSION = YES; 200 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 201 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 202 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 203 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 204 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 205 | CLANG_WARN_STRICT_PROTOTYPES = YES; 206 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 207 | CLANG_WARN_UNREACHABLE_CODE = YES; 208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 209 | CODE_SIGN_IDENTITY = "-"; 210 | COPY_PHASE_STRIP = NO; 211 | DEBUG_INFORMATION_FORMAT = dwarf; 212 | ENABLE_STRICT_OBJC_MSGSEND = YES; 213 | ENABLE_TESTABILITY = YES; 214 | GCC_C_LANGUAGE_STANDARD = gnu99; 215 | GCC_DYNAMIC_NO_PIC = NO; 216 | GCC_NO_COMMON_BLOCKS = YES; 217 | GCC_OPTIMIZATION_LEVEL = 0; 218 | GCC_PREPROCESSOR_DEFINITIONS = ( 219 | "DEBUG=1", 220 | "$(inherited)", 221 | ); 222 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 223 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 224 | GCC_WARN_UNDECLARED_SELECTOR = YES; 225 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 226 | GCC_WARN_UNUSED_FUNCTION = YES; 227 | GCC_WARN_UNUSED_VARIABLE = YES; 228 | MACOSX_DEPLOYMENT_TARGET = 10.12; 229 | MTL_ENABLE_DEBUG_INFO = YES; 230 | ONLY_ACTIVE_ARCH = YES; 231 | SDKROOT = macosx; 232 | }; 233 | name = Debug; 234 | }; 235 | 0D3E26DA1E85A96700AC91B3 /* Release */ = { 236 | isa = XCBuildConfiguration; 237 | buildSettings = { 238 | ALWAYS_SEARCH_USER_PATHS = NO; 239 | CLANG_ANALYZER_NONNULL = YES; 240 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 241 | CLANG_CXX_LIBRARY = "libc++"; 242 | CLANG_ENABLE_MODULES = YES; 243 | CLANG_ENABLE_OBJC_ARC = YES; 244 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 245 | CLANG_WARN_BOOL_CONVERSION = YES; 246 | CLANG_WARN_COMMA = YES; 247 | CLANG_WARN_CONSTANT_CONVERSION = YES; 248 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INFINITE_RECURSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 260 | CLANG_WARN_STRICT_PROTOTYPES = YES; 261 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 262 | CLANG_WARN_UNREACHABLE_CODE = YES; 263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 264 | CODE_SIGN_IDENTITY = "-"; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu99; 270 | GCC_NO_COMMON_BLOCKS = YES; 271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 273 | GCC_WARN_UNDECLARED_SELECTOR = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 275 | GCC_WARN_UNUSED_FUNCTION = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | MACOSX_DEPLOYMENT_TARGET = 10.12; 278 | MTL_ENABLE_DEBUG_INFO = NO; 279 | SDKROOT = macosx; 280 | }; 281 | name = Release; 282 | }; 283 | 0D3E26DC1E85A96700AC91B3 /* Debug */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 287 | COMBINE_HIDPI_IMAGES = YES; 288 | DEVELOPMENT_TEAM = J67PW9QQ97; 289 | INFOPLIST_FILE = ReadingList/Info.plist; 290 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 291 | LIBRARY_SEARCH_PATHS = ( 292 | "$(inherited)", 293 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/Safari.framework/Versions/A", 294 | ); 295 | PRODUCT_BUNDLE_IDENTIFIER = com.rydermackay.ReadingList; 296 | PRODUCT_NAME = "$(TARGET_NAME)"; 297 | SYSTEM_FRAMEWORK_SEARCH_PATHS = "$(inherited) $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks"; 298 | }; 299 | name = Debug; 300 | }; 301 | 0D3E26DD1E85A96700AC91B3 /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 305 | COMBINE_HIDPI_IMAGES = YES; 306 | DEVELOPMENT_TEAM = J67PW9QQ97; 307 | INFOPLIST_FILE = ReadingList/Info.plist; 308 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 309 | LIBRARY_SEARCH_PATHS = ( 310 | "$(inherited)", 311 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/Safari.framework/Versions/A", 312 | ); 313 | PRODUCT_BUNDLE_IDENTIFIER = com.rydermackay.ReadingList; 314 | PRODUCT_NAME = "$(TARGET_NAME)"; 315 | SYSTEM_FRAMEWORK_SEARCH_PATHS = "$(inherited) $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks"; 316 | }; 317 | name = Release; 318 | }; 319 | /* End XCBuildConfiguration section */ 320 | 321 | /* Begin XCConfigurationList section */ 322 | 0D3E26C51E85A96700AC91B3 /* Build configuration list for PBXProject "ReadingList" */ = { 323 | isa = XCConfigurationList; 324 | buildConfigurations = ( 325 | 0D3E26D91E85A96700AC91B3 /* Debug */, 326 | 0D3E26DA1E85A96700AC91B3 /* Release */, 327 | ); 328 | defaultConfigurationIsVisible = 0; 329 | defaultConfigurationName = Release; 330 | }; 331 | 0D3E26DB1E85A96700AC91B3 /* Build configuration list for PBXNativeTarget "ReadingList" */ = { 332 | isa = XCConfigurationList; 333 | buildConfigurations = ( 334 | 0D3E26DC1E85A96700AC91B3 /* Debug */, 335 | 0D3E26DD1E85A96700AC91B3 /* Release */, 336 | ); 337 | defaultConfigurationIsVisible = 0; 338 | defaultConfigurationName = Release; 339 | }; 340 | /* End XCConfigurationList section */ 341 | }; 342 | rootObject = 0D3E26C21E85A96700AC91B3 /* Project object */; 343 | } 344 | -------------------------------------------------------------------------------- /ReadingList.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ReadingList.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ReadingList.xcodeproj/xcuserdata/Ryder.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 23 | 24 | 25 | 26 | 27 | 29 | 35 | 36 | 44 | 45 | 46 | 47 | 48 | 50 | 56 | 57 | 65 | 66 | 67 | 68 | 69 | 71 | 77 | 78 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ReadingList.xcodeproj/xcuserdata/Ryder.xcuserdatad/xcschemes/ReadingList.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ReadingList.xcodeproj/xcuserdata/Ryder.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ReadingList.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 0D3E26C91E85A96700AC91B3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ReadingList/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ReadingList 4 | // 5 | // Created by Ryder Mackay on 2017-03-24. 6 | // Copyright © 2017 Ryder Mackay. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSResponder 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ReadingList/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ReadingList 4 | // 5 | // Created by Ryder Mackay on 2017-03-24. 6 | // Copyright © 2017 Ryder Mackay. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ReadingList.h" 11 | #import 12 | 13 | @interface SwizzleLamb : NSObject 14 | + (BOOL)canPerformUserInitiatedBookmarkOperations; 15 | @end 16 | 17 | @implementation SwizzleLamb 18 | + (BOOL)canPerformUserInitiatedBookmarkOperations { return NO; } 19 | @end 20 | 21 | @interface AppDelegate () 22 | @property (nonatomic) id readingListController; 23 | @property (nonatomic) IBOutlet NSArrayController *arrayController; 24 | @property (nonatomic) IBOutlet NSWindow *window; 25 | @property (nonatomic) IBOutlet NSTableView *tableView; 26 | @end 27 | 28 | @implementation AppDelegate 29 | 30 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 31 | // if we don't disable undo support, we'll have to somehow make -frontmostUndoController return non-nil to get deletion to work 32 | Method m1 = class_getClassMethod(NSClassFromString(@"BookmarksUndoController"), @selector(canPerformUserInitiatedBookmarkOperations)); 33 | Method m2 = class_getClassMethod([SwizzleLamb class], @selector(canPerformUserInitiatedBookmarkOperations)); 34 | method_exchangeImplementations(m1, m2); 35 | 36 | self.window.titleVisibility = NSWindowTitleHidden; 37 | 38 | // -allItems is initially nil, so command line apps will have to block until the change notification 39 | self.readingListController = [NSClassFromString(@"ReadingListController") sharedController]; 40 | 41 | // no apparent way to observe changes so we'll use the underlying store notifications directly 42 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readingListDataStoreItemsDidChange:) name:@"ReadingListDataStoreItemsDidChange" object:nil]; 43 | 44 | [self.tableView registerForDraggedTypes:@[(__bridge NSString *)kUTTypeURL]]; 45 | } 46 | 47 | - (void)applicationWillTerminate:(NSNotification *)aNotification { 48 | [self.readingListController savePendingChangesBeforeTermination]; 49 | } 50 | 51 | - (void)readingListDataStoreItemsDidChange:(NSNotification *)note { 52 | self.arrayController.content = [self.readingListController.allItems mutableCopy]; // bindings lol 53 | } 54 | 55 | - (void)printReadingList { 56 | id controller = self.readingListController; 57 | NSLog(@"%lu items", (unsigned long)controller.itemCount); 58 | for (id item in controller.allItems) { 59 | NSLog(@"%@: %@", (item.siteName ?: item.domainString), item.title); 60 | NSLog(@"Added %@", item.dateAdded); 61 | NSLog(@"%@", item.previewText); 62 | } 63 | } 64 | 65 | - (IBAction)search:(NSSearchField *)sender { 66 | NSString *searchTerm = sender.stringValue; 67 | if (searchTerm.length > 0) { 68 | NSPredicate *title = [NSPredicate predicateWithFormat:@"title contains[cd] %@", searchTerm]; 69 | NSPredicate *domain = [NSPredicate predicateWithFormat:@"domainString contains[cd] %@", searchTerm]; 70 | NSPredicate *preview = [NSPredicate predicateWithFormat:@"previewText contains[cd] %@", searchTerm]; 71 | self.arrayController.filterPredicate = [NSCompoundPredicate orPredicateWithSubpredicates:@[title, domain, preview]]; 72 | } else { 73 | self.arrayController.filterPredicate = nil; 74 | } 75 | } 76 | 77 | - (IBAction)delete:(id)sender { 78 | NSUInteger count = self.arrayController.selectedObjects.count; 79 | if (count > 1) { 80 | NSAlert *alert = [[NSAlert alloc] init]; 81 | alert.messageText = [NSString stringWithFormat:@"Are you sure you want to delete %lu items?", count]; 82 | alert.informativeText = @"This operation cannot be undone. Don’t blame me if you lose something important."; 83 | [alert addButtonWithTitle:[NSString stringWithFormat:@"Delete %lu Items", count]]; 84 | [alert addButtonWithTitle:@"Cancel"]; 85 | alert.buttons[0].keyEquivalent = @"\r"; 86 | alert.buttons[1].keyEquivalent = @"\e"; 87 | [alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) { 88 | if (returnCode == NSAlertFirstButtonReturn) { 89 | [self reallyDelete]; 90 | } 91 | }]; 92 | } else { 93 | [self reallyDelete]; 94 | } 95 | } 96 | 97 | - (void)reallyDelete { 98 | for (id item in self.arrayController.selectedObjects) { 99 | [self.readingListController removeItem:item]; 100 | } 101 | [self.arrayController removeObjects:self.arrayController.selectedObjects]; 102 | } 103 | 104 | - (IBAction)open:(id)sender { 105 | [self openSelectedURLsInBackground:NO]; 106 | } 107 | 108 | - (IBAction)openInBackground:(id)sender { 109 | [self openSelectedURLsInBackground:YES]; 110 | } 111 | 112 | - (void)openSelectedURLsInBackground:(BOOL)inBackground { 113 | NSMutableArray *urls = [NSMutableArray array]; 114 | for (id item in self.arrayController.selectedObjects) { 115 | NSURL *url = [NSURL URLWithString:item.urlString]; 116 | if (url) { 117 | [urls addObject:url]; 118 | [self.readingListController markItem:item asUnread:NO]; // safari doesn't show this change until relaunch 119 | } 120 | } 121 | NSWorkspaceLaunchOptions options = NSWorkspaceLaunchDefault; 122 | if (inBackground) { 123 | options |= NSWorkspaceLaunchWithoutActivation; 124 | } 125 | 126 | [[NSWorkspace sharedWorkspace] openURLs:urls withAppBundleIdentifier:nil options:options additionalEventParamDescriptor:nil launchIdentifiers:nil]; 127 | } 128 | 129 | #pragma mark - Dragging destination support 130 | 131 | - (NSDragOperation)tableView:(NSTableView *)tableView validateDrop:(id)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)dropOperation { 132 | 133 | if (![[info draggingPasteboard] canReadObjectForClasses:@[[NSURL class]] options:nil]) { 134 | return NSDragOperationNone; 135 | } 136 | 137 | if (!([self validURLsForDropInfo:info].count > 0)) { 138 | return NSDragOperationNone; 139 | } 140 | 141 | [tableView setDropRow:-1 dropOperation:NSTableViewDropOn]; 142 | 143 | return NSDragOperationCopy; 144 | } 145 | 146 | - (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation { 147 | 148 | NSArray *validURLs = [self validURLsForDropInfo:info]; 149 | for (NSURL *url in validURLs) { 150 | [self.readingListController addItemWithTitle:nil url:url addUserInteraction:0 allowUndo:NO]; 151 | } 152 | 153 | return validURLs.count > 0; 154 | } 155 | 156 | - (NSArray *)validURLsForDropInfo:(id )info { 157 | NSMutableArray *validURLs = [NSMutableArray array]; 158 | for (NSURL *url in [[info draggingPasteboard] readObjectsForClasses:@[[NSURL class]] options:nil]) { 159 | if ([url isKindOfClass:[NSURL class]]) { 160 | if ([url.scheme.lowercaseString isEqual:@"http"] || [url.scheme.lowercaseString isEqualToString:@"https"]) { 161 | [validURLs addObject:url]; 162 | } 163 | } 164 | } 165 | return [validURLs copy]; 166 | } 167 | 168 | @end 169 | -------------------------------------------------------------------------------- /ReadingList/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /ReadingList/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | DQ 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | DQ 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | CA 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | -------------------------------------------------------------------------------- /ReadingList/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2017 Ryder Mackay. All rights reserved. 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /ReadingList/ReadingList.h: -------------------------------------------------------------------------------- 1 | // 2 | // ReadingList.h 3 | // ReadingList 4 | // 5 | // Created by Ryder Mackay on 2017-03-24. 6 | // Copyright © 2017 Ryder Mackay. All rights reserved. 7 | // 8 | 9 | @import Foundation; 10 | 11 | // Hopper is awesome 12 | 13 | @protocol ReadingListItem 14 | 15 | - (NSString *)title; 16 | - (NSString *)urlString; 17 | - (NSString *)previewText; 18 | - (NSString *)domainString; 19 | - (NSString *)siteName; 20 | - (NSString *)localTitle; 21 | - (NSString *)localPreviewText; 22 | - (NSDate *)dateAdded; 23 | - (NSDate *)dateLastViewed; 24 | - (NSDate *)dateLastFetched; 25 | - (NSImage *)icon; 26 | 27 | @end 28 | 29 | 30 | 31 | @protocol ReadingListController 32 | 33 | + (instancetype)sharedController; 34 | 35 | - (NSInteger)itemCount; 36 | - (NSArray *)allItems; 37 | 38 | - (void)addItemWithTitle:(NSString *)title url:(NSURL *)url addUserInteraction:(NSInteger)userInteraction allowUndo:(BOOL)allowUndo; 39 | - (void)markItem:(id )item asUnread:(BOOL)isUnread; 40 | - (void)removeItem:(id )item; 41 | 42 | - (void)pruneWebArchives; 43 | - (void)clearAllItems; 44 | - (void)savePendingChangesBeforeTermination; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /ReadingList/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ReadingList 4 | // 5 | // Created by Ryder Mackay on 2017-03-24. 6 | // Copyright © 2017 Ryder Mackay. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | --------------------------------------------------------------------------------