-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dennis Oberhoff
authored and
Dennis Oberhoff
committed
Dec 3, 2016
1 parent
6ada612
commit fcd2c5e
Showing
129 changed files
with
10,164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,4 @@ fastlane/screenshots | |
# https://github.com/johnno1962/injectionforxcode | ||
|
||
iOSInjectionProject/ | ||
.DS_Store |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
MusaicFM.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Artwork.h | ||
// MusaicFM | ||
// | ||
// Created by Dennis Oberhoff on 13/11/2016. | ||
// Copyright © 2016 Dennis Oberhoff. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface Artwork : NSObject <NSCoding> | ||
|
||
@property (nonatomic, readwrite, strong)NSString * album; | ||
@property (nonatomic, readwrite, strong) NSString *artist; | ||
@property (nonatomic, readwrite, strong) NSURL *artworkUrl; | ||
@property (nonatomic, readwrite, strong) NSURL *url; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// Artwork.m | ||
// MusaicFM | ||
// | ||
// Created by Dennis Oberhoff on 13/11/2016. | ||
// Copyright © 2016 Dennis Oberhoff. All rights reserved. | ||
// | ||
|
||
#import "Artwork.h" | ||
|
||
@implementation Artwork | ||
|
||
- (instancetype)initWithCoder:(NSCoder *)decoder { | ||
self = [super init]; | ||
if (self) { | ||
self.url = [decoder decodeObjectForKey:@"url"]; | ||
self.artworkUrl = [decoder decodeObjectForKey:@"artworkUrl"]; | ||
self.album = [decoder decodeObjectForKey:@"name"]; | ||
self.artist = [decoder decodeObjectForKey:@"artist"]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)encodeWithCoder:(NSCoder *)encoder { | ||
[encoder encodeObject:self.url forKey:@"url"]; | ||
[encoder encodeObject:self.artworkUrl forKey:@"artworkUrl"]; | ||
[encoder encodeObject:self.album forKey:@"album"]; | ||
[encoder encodeObject:self.artist forKey:@"artist"]; | ||
} | ||
|
||
- (BOOL)isEqual:(id)object { | ||
if (![object isKindOfClass:[self class]]) { | ||
return NO; | ||
} | ||
Artwork *compare = object; | ||
return [compare.artworkUrl isEqual:self.artworkUrl]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Constants.h | ||
// MusaicFM | ||
// | ||
// Created by Dennis Oberhoff on 20/11/2016. | ||
// Copyright © 2016 Dennis Oberhoff. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
extern NSString *const spotifyClientId; | ||
extern NSString *const spotifySecretId; | ||
extern NSString *const spotifyRedirectUrl; | ||
extern NSString *const lastFmId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Constants.m | ||
// MusaicFM | ||
// | ||
// Created by Dennis Oberhoff on 20/11/2016. | ||
// Copyright © 2016 Dennis Oberhoff. All rights reserved. | ||
// | ||
|
||
#import "Constants.h" | ||
|
||
NSString *const spotifyClientId = @"465423dcfdca4d8f8213181e9e5e3fa4"; | ||
NSString *const spotifySecretId = @"8330d56673864353ac187b5b29532f06"; | ||
NSString *const spotifyRedirectUrl = @"musaicfm://spotify"; | ||
NSString *const lastFmId = @"b61d847786cc5f854207a51afd77b01f"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Factory.h | ||
// MusaicFM | ||
// | ||
// Created by Dennis Oberhoff on 03/12/2016. | ||
// Copyright © 2016 Dennis Oberhoff. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface Factory : NSObject | ||
|
||
+ (NSURLRequest *)lastFmRequest:(NSArray *)queryItems; | ||
|
||
+ (NSURLComponents *)spotifyAlbums; | ||
+ (NSURLComponents *)spotifyNewReleases; | ||
+ (NSURLComponents *)spotifyToken; | ||
+ (NSURLComponents *)spotifyAuthentification; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// | ||
// Factory.m | ||
// MusaicFM | ||
// | ||
// Created by Dennis Oberhoff on 03/12/2016. | ||
// Copyright © 2016 Dennis Oberhoff. All rights reserved. | ||
// | ||
|
||
#import "Factory.h" | ||
#import "Constants.h" | ||
|
||
@implementation Factory | ||
|
||
|
||
+ (NSURLRequest *)lastFmRequest:(NSArray *)queryItems { | ||
NSMutableArray *items = queryItems ? queryItems.mutableCopy : [NSMutableArray new]; | ||
|
||
[items addObjectsFromArray:@[[NSURLQueryItem queryItemWithName:@"api_key" value:lastFmId], | ||
[NSURLQueryItem queryItemWithName:@"format" value:@"json"]]]; | ||
|
||
NSURLComponents *components = [NSURLComponents new]; | ||
components.scheme = @"https"; | ||
components.host = @"ws.audioscrobbler.com"; | ||
components.path = @"/2.0/"; | ||
components.queryItems = items.copy; | ||
return [NSURLRequest requestWithURL:components.URL]; | ||
} | ||
|
||
+ (NSURLComponents *)spotifyAlbums { | ||
NSURLComponents *components = [NSURLComponents new]; | ||
components.scheme = @"https"; | ||
components.host = @"api.spotify.com"; | ||
components.path = @"/v1/me/albums"; | ||
return components; | ||
} | ||
|
||
|
||
+ (NSURLComponents *)spotifyNewReleases { | ||
NSURLComponents *components = [NSURLComponents new]; | ||
components.scheme = @"https"; | ||
components.host = @"api.spotify.com"; | ||
components.path = @"/v1/browse/new-releases"; | ||
return components; | ||
} | ||
|
||
|
||
+ (NSURLComponents *)spotifyToken { | ||
NSURLComponents *components = [NSURLComponents new]; | ||
components.scheme = @"https"; | ||
components.host = @"accounts.spotify.com"; | ||
components.path = @"/api/token"; | ||
return components; | ||
} | ||
|
||
+ (NSURLComponents *)spotifyAuthentification { | ||
NSURLComponents *components = [NSURLComponents new]; | ||
components.scheme = @"https"; | ||
components.host = @"accounts.spotify.com"; | ||
components.path = @"/authorize/"; | ||
components.queryItems = @[[NSURLQueryItem queryItemWithName:@"client_id" value:spotifyClientId], | ||
[NSURLQueryItem queryItemWithName:@"response_type" value:@"code"], | ||
[NSURLQueryItem queryItemWithName:@"scope" value:@"user-library-read"], | ||
[NSURLQueryItem queryItemWithName:@"show_dialog" value:@"true"], | ||
[NSURLQueryItem queryItemWithName:@"redirect_uri" value:spotifyRedirectUrl]]; | ||
|
||
return components; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright © 2016 Dennis Oberhoff. All rights reserved.</string> | ||
<key>NSPrincipalClass</key> | ||
<string>MusaicFMView</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// Manager.h | ||
// MusaicFM | ||
// | ||
// Created by Dennis Oberhoff on 13/11/2016. | ||
// Copyright © 2016 Dennis Oberhoff. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "Preferences.h" | ||
|
||
typedef NS_ENUM (NSUInteger, Weekly) { | ||
WeeklyAll = 0, | ||
Weekly7Days = 1, | ||
Weekly1Month = 2, | ||
Weekly3Month = 3, | ||
Weekly6Month = 4, | ||
Weekly12Month = 5, | ||
}; | ||
|
||
@interface Manager : NSObject | ||
|
||
@property (nonatomic, readwrite, strong)Preferences * preferences; | ||
|
||
|
||
- (void)performSpotifyUserAlbums:(void (^)(NSArray *items)) completion andFailure:(void (^)(NSError *error))failure; | ||
- (void)performSpotifyReleases:(void (^)(NSArray *items)) completion andFailure:(void (^)(NSError *error))failure; | ||
- (void)performSpotifyToken:(NSString *)code completionHandler:(dispatch_block_t)completion andFailure:(void (^)(NSError *error))failure; | ||
|
||
- (void)performLastfmTag:(void (^)(NSArray *items)) completion andFailure:(void (^)(NSError *error))failure; | ||
- (void)performLastfmWeekly:(void (^)(NSArray *items)) completion andFailure:(void (^)(NSError *error))failure; | ||
|
||
@end |
Oops, something went wrong.