From 46992aeb612982e07304cd8bf1097a245c3d568e Mon Sep 17 00:00:00 2001 From: victorhml <31203078@mackenzista.com.br> Date: Tue, 10 Mar 2015 17:29:39 -0300 Subject: [PATCH 1/4] Victor Lisboa bronze 1 e 2 --- iTunesSearch/Entidades/Filme.h | 1 + iTunesSearch/TableView.xib | 54 +++++++++++++++++++---- iTunesSearch/TableViewCell.h | 4 +- iTunesSearch/TableViewCell.xib | 70 ++++++++++++++++++++++++------ iTunesSearch/TableViewController.h | 3 ++ iTunesSearch/TableViewController.m | 56 ++++++++++++++++++++++-- iTunesSearch/iTunesManager.m | 2 + 7 files changed, 163 insertions(+), 27 deletions(-) diff --git a/iTunesSearch/Entidades/Filme.h b/iTunesSearch/Entidades/Filme.h index eb126dc..0e76198 100644 --- a/iTunesSearch/Entidades/Filme.h +++ b/iTunesSearch/Entidades/Filme.h @@ -16,5 +16,6 @@ @property (nonatomic, strong) NSString *duracao; @property (nonatomic, strong) NSString *genero; @property (nonatomic, strong) NSString *pais; +@property (nonatomic, strong) NSString *preco; @end diff --git a/iTunesSearch/TableView.xib b/iTunesSearch/TableView.xib index 55f128c..fbe7f47 100644 --- a/iTunesSearch/TableView.xib +++ b/iTunesSearch/TableView.xib @@ -1,25 +1,61 @@ - + + + - + - + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + diff --git a/iTunesSearch/TableViewCell.h b/iTunesSearch/TableViewCell.h index b630349..f0a8440 100644 --- a/iTunesSearch/TableViewCell.h +++ b/iTunesSearch/TableViewCell.h @@ -12,6 +12,8 @@ @property (weak, nonatomic) IBOutlet UILabel *nome; @property (weak, nonatomic) IBOutlet UILabel *tipo; - +@property (weak, nonatomic) IBOutlet UILabel *genero; +@property (weak, nonatomic) IBOutlet UILabel *preco; +@property (weak, nonatomic) IBOutlet UILabel *duracao; @end diff --git a/iTunesSearch/TableViewCell.xib b/iTunesSearch/TableViewCell.xib index bf8bd3f..01434a0 100644 --- a/iTunesSearch/TableViewCell.xib +++ b/iTunesSearch/TableViewCell.xib @@ -1,46 +1,88 @@ - + + - - + + - - - - - - - + + + + + + + + + + + + + + + + + + + - + diff --git a/iTunesSearch/TableViewController.h b/iTunesSearch/TableViewController.h index 0cbb5c4..20cdebe 100644 --- a/iTunesSearch/TableViewController.h +++ b/iTunesSearch/TableViewController.h @@ -11,7 +11,10 @@ @interface TableViewController : UIViewController +@property (strong, nonatomic) IBOutlet UIView *view; @property (strong, nonatomic) IBOutlet UITableView *tableview; +@property (weak, nonatomic) IBOutlet UITextField *searchBar; +- (IBAction)button:(id)sender; @end diff --git a/iTunesSearch/TableViewController.m b/iTunesSearch/TableViewController.m index f689980..638d118 100644 --- a/iTunesSearch/TableViewController.m +++ b/iTunesSearch/TableViewController.m @@ -13,6 +13,7 @@ @interface TableViewController () { NSArray *midias; +// NSString *strSearch; } @end @@ -23,7 +24,8 @@ @implementation TableViewController - (void)viewDidLoad { [super viewDidLoad]; - + _tableview.delegate = self; + _tableview.dataSource = self; UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil]; [self.tableview registerNib:nib forCellReuseIdentifier:@"celulaPadrao"]; @@ -56,13 +58,61 @@ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS [celula.nome setText:filme.nome]; [celula.tipo setText:@"Filme"]; - + [celula.genero setText:filme.genero]; + [celula.preco setText:[NSString stringWithFormat: @"Preço: US$ %@", filme.preco]]; + [celula.duracao setText:[self formatInterval:[NSString stringWithFormat: @"%@", filme.duracao]]]; return celula; } +- (NSString *) formatInterval: (NSString *) time{ + NSTimeInterval interval; + if([time doubleValue]){ + interval = [time doubleValue]; + } + else { + interval = 0.0; + } + unsigned long milliseconds = interval; + unsigned long seconds = milliseconds / 1000; + milliseconds %= 1000; + unsigned long minutes = seconds / 60; + seconds %= 60; + unsigned long hours = minutes / 60; + minutes %= 60; + + NSMutableString * result = [NSMutableString new]; + + if(hours) + [result appendFormat: @"%lu:", hours]; + + [result appendFormat: @"%lu:", minutes]; + [result appendFormat: @"%lu", seconds]; +// [result appendFormat: @"%2d",milliseconds]; + + return result; +} + -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 70; + return 100; } +//-(void)search{ +// iTunesManager *itunes =[iTunesManager sharedInstance]; +// midias = [itunes buscarMidias:strSearch]; +// [_tableview reloadData]; +//} + +//- (IBAction)button:(id)sender { +// strSearch = _searchBar.text; +// strSearch = [strSearch stringByReplacingOccurrencesOfString:@" " withString:@"+"]; +// [_searchBar resignFirstResponder]; +// [self search]; +//} + +- (IBAction)button:(id)sender { + iTunesManager *itunes =[iTunesManager sharedInstance]; + midias = [itunes buscarMidias:_searchBar.text]; + [self.tableview reloadData]; +} @end diff --git a/iTunesSearch/iTunesManager.m b/iTunesSearch/iTunesManager.m index e2babda..d9155e8 100644 --- a/iTunesSearch/iTunesManager.m +++ b/iTunesSearch/iTunesManager.m @@ -57,6 +57,8 @@ - (NSArray *)buscarMidias:(NSString *)termo { [filme setDuracao:[item objectForKey:@"trackTimeMillis"]]; [filme setGenero:[item objectForKey:@"primaryGenreName"]]; [filme setPais:[item objectForKey:@"country"]]; + [filme setPreco:[item objectForKey:@"trackPrice"]]; + [filmes addObject:filme]; } From a7214c2f9c246858833091feb79ea0eb735e1a51 Mon Sep 17 00:00:00 2001 From: victorhml <31203078@mackenzista.com.br> Date: Tue, 10 Mar 2015 17:38:16 -0300 Subject: [PATCH 2/4] bronze 1 e 2 --- iTunesSearch/TableViewController.m | 6 +++--- iTunesSearch/iTunesManager.m | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/iTunesSearch/TableViewController.m b/iTunesSearch/TableViewController.m index 638d118..ede3978 100644 --- a/iTunesSearch/TableViewController.m +++ b/iTunesSearch/TableViewController.m @@ -28,9 +28,9 @@ - (void)viewDidLoad { _tableview.dataSource = self; UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil]; [self.tableview registerNib:nib forCellReuseIdentifier:@"celulaPadrao"]; - - iTunesManager *itunes = [iTunesManager sharedInstance]; - midias = [itunes buscarMidias:@"Apple"]; +// +// iTunesManager *itunes = [iTunesManager sharedInstance]; +// midias = [itunes buscarMidias:@"Apple"]; #warning Necessario para que a table view tenha um espaco em relacao ao topo, pois caso contrario o texto ficara atras da barra superior self.tableview.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 15.f)]; diff --git a/iTunesSearch/iTunesManager.m b/iTunesSearch/iTunesManager.m index d9155e8..c852a1c 100644 --- a/iTunesSearch/iTunesManager.m +++ b/iTunesSearch/iTunesManager.m @@ -58,7 +58,6 @@ - (NSArray *)buscarMidias:(NSString *)termo { [filme setGenero:[item objectForKey:@"primaryGenreName"]]; [filme setPais:[item objectForKey:@"country"]]; [filme setPreco:[item objectForKey:@"trackPrice"]]; - [filmes addObject:filme]; } From fad97b956f3b9aa3f38c060d783740cab7d39ee0 Mon Sep 17 00:00:00 2001 From: victorhml <31203078@mackenzista.com.br> Date: Wed, 11 Mar 2015 15:21:57 -0300 Subject: [PATCH 3/4] Bronze 1 e 2 --- iTunesSearch/Entidades/Filme.h | 2 ++ iTunesSearch/TableViewController.m | 16 ---------------- iTunesSearch/iTunesManager.m | 4 ++++ 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/iTunesSearch/Entidades/Filme.h b/iTunesSearch/Entidades/Filme.h index 0e76198..f931759 100644 --- a/iTunesSearch/Entidades/Filme.h +++ b/iTunesSearch/Entidades/Filme.h @@ -17,5 +17,7 @@ @property (nonatomic, strong) NSString *genero; @property (nonatomic, strong) NSString *pais; @property (nonatomic, strong) NSString *preco; +@property (nonatomic, strong) NSString *img; + @end diff --git a/iTunesSearch/TableViewController.m b/iTunesSearch/TableViewController.m index ede3978..1e3f58b 100644 --- a/iTunesSearch/TableViewController.m +++ b/iTunesSearch/TableViewController.m @@ -28,9 +28,6 @@ - (void)viewDidLoad { _tableview.dataSource = self; UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil]; [self.tableview registerNib:nib forCellReuseIdentifier:@"celulaPadrao"]; -// -// iTunesManager *itunes = [iTunesManager sharedInstance]; -// midias = [itunes buscarMidias:@"Apple"]; #warning Necessario para que a table view tenha um espaco em relacao ao topo, pois caso contrario o texto ficara atras da barra superior self.tableview.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 15.f)]; @@ -87,7 +84,6 @@ - (NSString *) formatInterval: (NSString *) time{ [result appendFormat: @"%lu:", minutes]; [result appendFormat: @"%lu", seconds]; -// [result appendFormat: @"%2d",milliseconds]; return result; } @@ -96,18 +92,6 @@ -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPat return 100; } -//-(void)search{ -// iTunesManager *itunes =[iTunesManager sharedInstance]; -// midias = [itunes buscarMidias:strSearch]; -// [_tableview reloadData]; -//} - -//- (IBAction)button:(id)sender { -// strSearch = _searchBar.text; -// strSearch = [strSearch stringByReplacingOccurrencesOfString:@" " withString:@"+"]; -// [_searchBar resignFirstResponder]; -// [self search]; -//} - (IBAction)button:(id)sender { iTunesManager *itunes =[iTunesManager sharedInstance]; diff --git a/iTunesSearch/iTunesManager.m b/iTunesSearch/iTunesManager.m index c852a1c..11d4238 100644 --- a/iTunesSearch/iTunesManager.m +++ b/iTunesSearch/iTunesManager.m @@ -58,6 +58,10 @@ - (NSArray *)buscarMidias:(NSString *)termo { [filme setGenero:[item objectForKey:@"primaryGenreName"]]; [filme setPais:[item objectForKey:@"country"]]; [filme setPreco:[item objectForKey:@"trackPrice"]]; + [filme setImg:[item objectForKey:@"artworkUrl60"]]; + + + [filmes addObject:filme]; } From 21ba5fbe7c4d8fa2f368b005d7ad58c9ecffd3ed Mon Sep 17 00:00:00 2001 From: victorhml <31203078@mackenzista.com.br> Date: Sun, 15 Mar 2015 21:25:00 -0300 Subject: [PATCH 4/4] Bronze 1,2,3 e Prata 1,2,3 ainda falta bronze 4 --- iTunesSearch.xcodeproj/project.pbxproj | 115 +++++- iTunesSearch/AppDelegate.m | 11 +- iTunesSearch/{ => Base.lproj}/TableView.xib | 28 +- iTunesSearch/Detalhes.h | 22 ++ iTunesSearch/Detalhes.m | 102 +++++ iTunesSearch/Detalhes.xib | 360 ++++++++++++++++++ iTunesSearch/Entidades/Ebook.h | 23 ++ iTunesSearch/Entidades/Ebook.m | 13 + iTunesSearch/Entidades/Filme.h | 2 +- iTunesSearch/Entidades/Musica.h | 22 ++ iTunesSearch/Entidades/Musica.m | 13 + iTunesSearch/Entidades/Podcast.h | 21 + iTunesSearch/Entidades/Podcast.m | 13 + .../Open_Book-512.imageset/Contents.json | 21 + .../Open_Book-512.imageset/Open_Book-512.png | Bin 0 -> 25731 bytes .../film.imageset/Contents.json | 21 + .../Images.xcassets/film.imageset/film-2.png | Bin 0 -> 2089 bytes .../music.imageset/Contents.json | 21 + .../Images.xcassets/music.imageset/music.png | Bin 0 -> 24118 bytes .../podcast.imageset/Contents.json | 21 + .../podcast.imageset/podcast.png | Bin 0 -> 20215 bytes iTunesSearch/TableViewCell.h | 1 + iTunesSearch/TableViewCell.xib | 78 ++-- iTunesSearch/TableViewController.h | 4 +- iTunesSearch/TableViewController.m | 113 +++++- iTunesSearch/en.lproj/TableView.xib | 76 ++++ iTunesSearch/fr.lproj/InfoPlist.strings | 1 + iTunesSearch/fr.lproj/Localizable.strings | 2 + iTunesSearch/fr.lproj/TableView.xib | 62 +++ iTunesSearch/iTunesManager.h | 3 +- iTunesSearch/iTunesManager.m | 76 +++- iTunesSearch/pt.lproj/InfoPlist.strings | 1 + iTunesSearch/pt.lproj/Localizable.strings | 2 + iTunesSearch/pt.lproj/TableView.xib | 62 +++ iTunesSearchTests/Info.plist | 21 +- iTunesSearchTests/fr.lproj/InfoPlist.strings | 1 + iTunesSearchTests/pt.lproj/InfoPlist.strings | 1 + 37 files changed, 1229 insertions(+), 104 deletions(-) rename iTunesSearch/{ => Base.lproj}/TableView.xib (73%) create mode 100644 iTunesSearch/Detalhes.h create mode 100644 iTunesSearch/Detalhes.m create mode 100644 iTunesSearch/Detalhes.xib create mode 100644 iTunesSearch/Entidades/Ebook.h create mode 100644 iTunesSearch/Entidades/Ebook.m create mode 100644 iTunesSearch/Entidades/Musica.h create mode 100644 iTunesSearch/Entidades/Musica.m create mode 100644 iTunesSearch/Entidades/Podcast.h create mode 100644 iTunesSearch/Entidades/Podcast.m create mode 100644 iTunesSearch/Images.xcassets/Open_Book-512.imageset/Contents.json create mode 100644 iTunesSearch/Images.xcassets/Open_Book-512.imageset/Open_Book-512.png create mode 100644 iTunesSearch/Images.xcassets/film.imageset/Contents.json create mode 100644 iTunesSearch/Images.xcassets/film.imageset/film-2.png create mode 100644 iTunesSearch/Images.xcassets/music.imageset/Contents.json create mode 100644 iTunesSearch/Images.xcassets/music.imageset/music.png create mode 100644 iTunesSearch/Images.xcassets/podcast.imageset/Contents.json create mode 100644 iTunesSearch/Images.xcassets/podcast.imageset/podcast.png create mode 100644 iTunesSearch/en.lproj/TableView.xib create mode 100644 iTunesSearch/fr.lproj/InfoPlist.strings create mode 100644 iTunesSearch/fr.lproj/Localizable.strings create mode 100644 iTunesSearch/fr.lproj/TableView.xib create mode 100644 iTunesSearch/pt.lproj/InfoPlist.strings create mode 100644 iTunesSearch/pt.lproj/Localizable.strings create mode 100644 iTunesSearch/pt.lproj/TableView.xib create mode 100644 iTunesSearchTests/fr.lproj/InfoPlist.strings create mode 100644 iTunesSearchTests/pt.lproj/InfoPlist.strings diff --git a/iTunesSearch.xcodeproj/project.pbxproj b/iTunesSearch.xcodeproj/project.pbxproj index 79e06d7..104bf96 100644 --- a/iTunesSearch.xcodeproj/project.pbxproj +++ b/iTunesSearch.xcodeproj/project.pbxproj @@ -12,11 +12,22 @@ 92C21CBC1AAE757A0052ABE6 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CBB1AAE757A0052ABE6 /* TableViewController.m */; }; 92C21CC11AAE757A0052ABE6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92C21CC01AAE757A0052ABE6 /* Images.xcassets */; }; 92C21CD01AAE757A0052ABE6 /* iTunesSearchTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CCF1AAE757A0052ABE6 /* iTunesSearchTests.m */; }; - 92C21CDB1AAE75B30052ABE6 /* iTunesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CDA1AAE75B30052ABE6 /* iTunesManager.m */; }; - 92C21CDD1AAE75DC0052ABE6 /* TableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 92C21CDC1AAE75DC0052ABE6 /* TableView.xib */; }; 92C21CE11AAE76930052ABE6 /* TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CDF1AAE76930052ABE6 /* TableViewCell.m */; }; 92C21CE21AAE76930052ABE6 /* TableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 92C21CE01AAE76930052ABE6 /* TableViewCell.xib */; }; 92C21CE81AAE858E0052ABE6 /* Filme.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CE71AAE858E0052ABE6 /* Filme.m */; }; + D41463941AB368D700181638 /* TableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D41463961AB368D700181638 /* TableView.xib */; }; + D414639E1AB3696300181638 /* TableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D41463961AB368D700181638 /* TableView.xib */; }; + D41463AE1AB36A8400181638 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = D41463AD1AB36A8400181638 /* Info.plist */; }; + D41463B21AB36ADE00181638 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = D41463B41AB36ADE00181638 /* Localizable.strings */; }; + D41463B71AB36ADF00181638 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D41463B91AB36ADF00181638 /* InfoPlist.strings */; }; + D41463BF1AB377FA00181638 /* iTunesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D41463BE1AB377FA00181638 /* iTunesManager.m */; }; + D490205F1AB35EA800803E9C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D490205E1AB35EA800803E9C /* main.m */; }; + D49020641AB35F2500803E9C /* Ebook.m in Sources */ = {isa = PBXBuildFile; fileRef = D49020611AB35F2500803E9C /* Ebook.m */; }; + D49020651AB35F2500803E9C /* Musica.m in Sources */ = {isa = PBXBuildFile; fileRef = D49020631AB35F2500803E9C /* Musica.m */; }; + D49020681AB35F5900803E9C /* Podcast.m in Sources */ = {isa = PBXBuildFile; fileRef = D49020671AB35F5900803E9C /* Podcast.m */; }; + D490206C1AB35F8A00803E9C /* Detalhes.m in Sources */ = {isa = PBXBuildFile; fileRef = D490206A1AB35F8A00803E9C /* Detalhes.m */; }; + D490206D1AB35F8A00803E9C /* Detalhes.xib in Resources */ = {isa = PBXBuildFile; fileRef = D490206B1AB35F8A00803E9C /* Detalhes.xib */; }; + D49B8FDF1AB3636200A21394 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D49B8FE11AB3636200A21394 /* InfoPlist.strings */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -42,13 +53,33 @@ 92C21CCE1AAE757A0052ABE6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 92C21CCF1AAE757A0052ABE6 /* iTunesSearchTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iTunesSearchTests.m; sourceTree = ""; }; 92C21CD91AAE75B30052ABE6 /* iTunesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iTunesManager.h; sourceTree = ""; }; - 92C21CDA1AAE75B30052ABE6 /* iTunesManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iTunesManager.m; sourceTree = ""; }; - 92C21CDC1AAE75DC0052ABE6 /* TableView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableView.xib; sourceTree = ""; }; 92C21CDE1AAE76930052ABE6 /* TableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewCell.h; sourceTree = ""; }; 92C21CDF1AAE76930052ABE6 /* TableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewCell.m; sourceTree = ""; }; 92C21CE01AAE76930052ABE6 /* TableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableViewCell.xib; sourceTree = ""; }; 92C21CE61AAE858E0052ABE6 /* Filme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Filme.h; path = Entidades/Filme.h; sourceTree = ""; }; 92C21CE71AAE858E0052ABE6 /* Filme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Filme.m; path = Entidades/Filme.m; sourceTree = ""; }; + D41463951AB368D700181638 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/TableView.xib; sourceTree = ""; }; + D414639F1AB3698100181638 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/TableView.xib; sourceTree = ""; }; + D41463A01AB3698100181638 /* pt */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = pt; path = pt.lproj/TableView.xib; sourceTree = ""; }; + D41463AD1AB36A8400181638 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D41463AF1AB36AB800181638 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/TableView.xib; sourceTree = ""; }; + D41463B31AB36ADE00181638 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; + D41463B81AB36ADF00181638 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; + D41463BA1AB36AEA00181638 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = ""; }; + D41463BB1AB36AEB00181638 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; + D41463BE1AB377FA00181638 /* iTunesManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iTunesManager.m; sourceTree = ""; }; + D490205E1AB35EA800803E9C /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iTunesSearch/main.m; sourceTree = SOURCE_ROOT; }; + D49020601AB35F2500803E9C /* Ebook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ebook.h; path = Entidades/Ebook.h; sourceTree = ""; }; + D49020611AB35F2500803E9C /* Ebook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Ebook.m; path = Entidades/Ebook.m; sourceTree = ""; }; + D49020621AB35F2500803E9C /* Musica.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Musica.h; path = Entidades/Musica.h; sourceTree = ""; }; + D49020631AB35F2500803E9C /* Musica.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Musica.m; path = Entidades/Musica.m; sourceTree = ""; }; + D49020661AB35F5900803E9C /* Podcast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Podcast.h; path = Entidades/Podcast.h; sourceTree = ""; }; + D49020671AB35F5900803E9C /* Podcast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Podcast.m; path = Entidades/Podcast.m; sourceTree = ""; }; + D49020691AB35F8A00803E9C /* Detalhes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Detalhes.h; sourceTree = ""; }; + D490206A1AB35F8A00803E9C /* Detalhes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Detalhes.m; sourceTree = ""; }; + D490206B1AB35F8A00803E9C /* Detalhes.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Detalhes.xib; sourceTree = ""; }; + D49B8FE01AB3636200A21394 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; + D4E855EB1AB3639D000D86C9 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -96,9 +127,12 @@ 92C21CB81AAE757A0052ABE6 /* AppDelegate.m */, 92C21CBA1AAE757A0052ABE6 /* TableViewController.h */, 92C21CBB1AAE757A0052ABE6 /* TableViewController.m */, - 92C21CDC1AAE75DC0052ABE6 /* TableView.xib */, + D41463961AB368D700181638 /* TableView.xib */, 92C21CD91AAE75B30052ABE6 /* iTunesManager.h */, - 92C21CDA1AAE75B30052ABE6 /* iTunesManager.m */, + D41463BE1AB377FA00181638 /* iTunesManager.m */, + D49020691AB35F8A00803E9C /* Detalhes.h */, + D490206A1AB35F8A00803E9C /* Detalhes.m */, + D490206B1AB35F8A00803E9C /* Detalhes.xib */, 92C21CC01AAE757A0052ABE6 /* Images.xcassets */, 92C21CB31AAE757A0052ABE6 /* Supporting Files */, ); @@ -108,6 +142,8 @@ 92C21CB31AAE757A0052ABE6 /* Supporting Files */ = { isa = PBXGroup; children = ( + D41463B91AB36ADF00181638 /* InfoPlist.strings */, + D41463B41AB36ADE00181638 /* Localizable.strings */, 92C21CB41AAE757A0052ABE6 /* Info.plist */, 92C21CB51AAE757A0052ABE6 /* main.m */, ); @@ -117,6 +153,7 @@ 92C21CCC1AAE757A0052ABE6 /* iTunesSearchTests */ = { isa = PBXGroup; children = ( + D41463AD1AB36A8400181638 /* Info.plist */, 92C21CCF1AAE757A0052ABE6 /* iTunesSearchTests.m */, 92C21CCD1AAE757A0052ABE6 /* Supporting Files */, ); @@ -126,7 +163,9 @@ 92C21CCD1AAE757A0052ABE6 /* Supporting Files */ = { isa = PBXGroup; children = ( + D49B8FE11AB3636200A21394 /* InfoPlist.strings */, 92C21CCE1AAE757A0052ABE6 /* Info.plist */, + D490205E1AB35EA800803E9C /* main.m */, ); name = "Supporting Files"; sourceTree = ""; @@ -144,8 +183,14 @@ 92C21CE91AAE859A0052ABE6 /* Entidades */ = { isa = PBXGroup; children = ( + D49020661AB35F5900803E9C /* Podcast.h */, + D49020671AB35F5900803E9C /* Podcast.m */, 92C21CE61AAE858E0052ABE6 /* Filme.h */, 92C21CE71AAE858E0052ABE6 /* Filme.m */, + D49020601AB35F2500803E9C /* Ebook.h */, + D49020611AB35F2500803E9C /* Ebook.m */, + D49020621AB35F2500803E9C /* Musica.h */, + D49020631AB35F2500803E9C /* Musica.m */, ); name = Entidades; sourceTree = ""; @@ -213,6 +258,8 @@ knownRegions = ( en, Base, + fr, + pt, ); mainGroup = 92C21CA71AAE757A0052ABE6; productRefGroup = 92C21CB11AAE757A0052ABE6 /* Products */; @@ -230,9 +277,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + D41463B21AB36ADE00181638 /* Localizable.strings in Resources */, + D41463B71AB36ADF00181638 /* InfoPlist.strings in Resources */, 92C21CC11AAE757A0052ABE6 /* Images.xcassets in Resources */, 92C21CE21AAE76930052ABE6 /* TableViewCell.xib in Resources */, - 92C21CDD1AAE75DC0052ABE6 /* TableView.xib in Resources */, + D41463941AB368D700181638 /* TableView.xib in Resources */, + D490206D1AB35F8A00803E9C /* Detalhes.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -240,6 +290,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + D414639E1AB3696300181638 /* TableView.xib in Resources */, + D49B8FDF1AB3636200A21394 /* InfoPlist.strings in Resources */, + D41463AE1AB36A8400181638 /* Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -251,11 +304,15 @@ buildActionMask = 2147483647; files = ( 92C21CBC1AAE757A0052ABE6 /* TableViewController.m in Sources */, - 92C21CDB1AAE75B30052ABE6 /* iTunesManager.m in Sources */, + D490206C1AB35F8A00803E9C /* Detalhes.m in Sources */, 92C21CB91AAE757A0052ABE6 /* AppDelegate.m in Sources */, + D49020681AB35F5900803E9C /* Podcast.m in Sources */, 92C21CE81AAE858E0052ABE6 /* Filme.m in Sources */, 92C21CE11AAE76930052ABE6 /* TableViewCell.m in Sources */, + D49020651AB35F2500803E9C /* Musica.m in Sources */, 92C21CB61AAE757A0052ABE6 /* main.m in Sources */, + D49020641AB35F2500803E9C /* Ebook.m in Sources */, + D41463BF1AB377FA00181638 /* iTunesManager.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -263,6 +320,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + D490205F1AB35EA800803E9C /* main.m in Sources */, 92C21CD01AAE757A0052ABE6 /* iTunesSearchTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -277,6 +335,47 @@ }; /* End PBXTargetDependency section */ +/* Begin PBXVariantGroup section */ + D41463961AB368D700181638 /* TableView.xib */ = { + isa = PBXVariantGroup; + children = ( + D41463951AB368D700181638 /* en */, + D414639F1AB3698100181638 /* fr */, + D41463A01AB3698100181638 /* pt */, + D41463AF1AB36AB800181638 /* Base */, + ); + name = TableView.xib; + sourceTree = ""; + }; + D41463B41AB36ADE00181638 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + D41463B31AB36ADE00181638 /* fr */, + D41463BA1AB36AEA00181638 /* pt */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + D41463B91AB36ADF00181638 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + D41463B81AB36ADF00181638 /* fr */, + D41463BB1AB36AEB00181638 /* pt */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + D49B8FE11AB3636200A21394 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + D49B8FE01AB3636200A21394 /* fr */, + D4E855EB1AB3639D000D86C9 /* pt */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 92C21CD11AAE757A0052ABE6 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/iTunesSearch/AppDelegate.m b/iTunesSearch/AppDelegate.m index d513fd8..4957daf 100644 --- a/iTunesSearch/AppDelegate.m +++ b/iTunesSearch/AppDelegate.m @@ -22,17 +22,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( #warning Necessário para inicializar a aplicacao sem storyboard self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; -#warning Adicionado codigo para iniciar com a interface do TableView -// TableViewController *tvc = [[TableViewController alloc] initWithNibName:@"TableView" bundle:nil]; - TableViewController *tvc = [[TableViewController alloc] init]; - [self.window setRootViewController:tvc]; + TableViewController *tvc = [[TableViewController alloc]init]; + + UINavigationController *nc = [[UINavigationController alloc]initWithRootViewController:tvc]; + [[self window] setRootViewController:nc]; [self.window makeKeyAndVisible]; return YES; + } - - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. diff --git a/iTunesSearch/TableView.xib b/iTunesSearch/Base.lproj/TableView.xib similarity index 73% rename from iTunesSearch/TableView.xib rename to iTunesSearch/Base.lproj/TableView.xib index fbe7f47..bd77034 100644 --- a/iTunesSearch/TableView.xib +++ b/iTunesSearch/Base.lproj/TableView.xib @@ -7,7 +7,7 @@ - + @@ -17,7 +17,7 @@ - + @@ -25,17 +25,17 @@ - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iTunesSearch/fr.lproj/InfoPlist.strings b/iTunesSearch/fr.lproj/InfoPlist.strings new file mode 100644 index 0000000..dc62739 --- /dev/null +++ b/iTunesSearch/fr.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ \ No newline at end of file diff --git a/iTunesSearch/fr.lproj/Localizable.strings b/iTunesSearch/fr.lproj/Localizable.strings new file mode 100644 index 0000000..19b8eeb --- /dev/null +++ b/iTunesSearch/fr.lproj/Localizable.strings @@ -0,0 +1,2 @@ +/* Botão */ +"Search" = " Recherche "; diff --git a/iTunesSearch/fr.lproj/TableView.xib b/iTunesSearch/fr.lproj/TableView.xib new file mode 100644 index 0000000..ec2019c --- /dev/null +++ b/iTunesSearch/fr.lproj/TableView.xib @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iTunesSearch/iTunesManager.h b/iTunesSearch/iTunesManager.h index c0e366b..b44167e 100644 --- a/iTunesSearch/iTunesManager.h +++ b/iTunesSearch/iTunesManager.h @@ -9,7 +9,6 @@ #import @interface iTunesManager : NSObject - /** * gets singleton object. * @return singleton @@ -17,5 +16,5 @@ + (iTunesManager*)sharedInstance; - (NSArray *)buscarMidias:(NSString *)termo; - +@property NSArray* midia; @end diff --git a/iTunesSearch/iTunesManager.m b/iTunesSearch/iTunesManager.m index 11d4238..32f691b 100644 --- a/iTunesSearch/iTunesManager.m +++ b/iTunesSearch/iTunesManager.m @@ -8,6 +8,9 @@ #import "iTunesManager.h" #import "Entidades/Filme.h" +#import "Entidades/Ebook.h" +#import "Entidades/Podcast.h" +#import "Entidades/Musica.h" @implementation iTunesManager @@ -22,7 +25,7 @@ + (id)sharedInstance static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ isFirstAccess = NO; - SINGLETON = [[super allocWithZone:NULL] init]; + SINGLETON = [[super allocWithZone:NULL] init]; }); return SINGLETON; @@ -34,7 +37,7 @@ - (NSArray *)buscarMidias:(NSString *)termo { termo = @""; } - NSString *url = [NSString stringWithFormat:@"https://itunes.apple.com/search?term=%@&media=movie", termo]; + NSString *url = [NSString stringWithFormat:@"https://itunes.apple.com/search?term=%@&media=all", termo]; NSData *jsonData = [NSData dataWithContentsOfURL: [NSURL URLWithString:url]]; NSError *error; @@ -48,24 +51,63 @@ - (NSArray *)buscarMidias:(NSString *)termo { NSArray *resultados = [resultado objectForKey:@"results"]; NSMutableArray *filmes = [[NSMutableArray alloc] init]; - + NSMutableArray *ebooks = [[NSMutableArray alloc] init]; + NSMutableArray *podcasts = [[NSMutableArray alloc] init]; + NSMutableArray *musicas = [[NSMutableArray alloc] init]; + NSString *type; for (NSDictionary *item in resultados) { - Filme *filme = [[Filme alloc] init]; - [filme setNome:[item objectForKey:@"trackName"]]; - [filme setTrackId:[item objectForKey:@"trackId"]]; - [filme setArtista:[item objectForKey:@"artistName"]]; - [filme setDuracao:[item objectForKey:@"trackTimeMillis"]]; - [filme setGenero:[item objectForKey:@"primaryGenreName"]]; - [filme setPais:[item objectForKey:@"country"]]; - [filme setPreco:[item objectForKey:@"trackPrice"]]; - [filme setImg:[item objectForKey:@"artworkUrl60"]]; - + type = [item objectForKey:@"kind"]; - - [filmes addObject:filme]; + if ([type isEqualToString:@"feature-movie"]) { + Filme *filme = [[Filme alloc] init]; + [filme setNome:[item objectForKey:@"trackName"]]; + [filme setTrackId:[item objectForKey:@"trackId"]]; + [filme setArtista:[item objectForKey:@"artistName"]]; + [filme setDuracao:[item objectForKey:@"trackTimeMillis"]]; + [filme setGenero:[item objectForKey:@"primaryGenreName"]]; + [filme setPais:[item objectForKey:@"country"]]; + [filme setPreco:[item objectForKey:@"trackPrice"]]; + [filme setImgUrl:[item objectForKey:@"artworkUrl60"]]; + [filmes addObject:filme]; + } + else if ([type isEqualToString:@"ebook"]){ + Ebook *ebook = [[Ebook alloc] init]; + [ebook setNomeb:[item objectForKey:@"trackName"]]; + [ebook setTrackIdb:[item objectForKey:@"trackId"]]; + [ebook setArtistab:[item objectForKey:@"artistName"]]; + [ebook setGenerob:[item objectForKey:@"primaryGenreName"]]; + [ebook setPrecob:[item objectForKey:@"trackPrice"]]; + [ebook setImgUrlb:[item objectForKey:@"artworkUrl60"]]; + [ebook setPaisb:[item objectForKey:@"country"]]; + [ebooks addObject:ebook]; + } + else if ([type isEqualToString:@"podcast"]){ + Podcast *podcast = [[Podcast alloc] init]; + [podcast setNomep:[item objectForKey:@"trackName"]]; + [podcast setTrackIdp:[item objectForKey:@"trackId"]]; + [podcast setArtistap:[item objectForKey:@"artistName"]]; + [podcast setDuracaop:[item objectForKey:@"trackTimeMillis"]]; + [podcast setGenerop:[item objectForKey:@"primaryGenreName"]]; + [podcast setPaisp:[item objectForKey:@"country"]]; + [podcast setPrecop:[item objectForKey:@"trackPrice"]]; + [podcast setImgUrlp:[item objectForKey:@"artworkUrl60"]]; + [podcasts addObject:podcast]; + } + else if ([type isEqualToString:@"song"]){ + Musica *musica = [[Musica alloc] init]; + [musica setNomem:[item objectForKey:@"trackName"]]; + [musica setTrackIdm:[item objectForKey:@"trackId"]]; + [musica setArtistam:[item objectForKey:@"artistName"]]; + [musica setDuracaom:[item objectForKey:@"trackTimeMillis"]]; + [musica setGenerom:[item objectForKey:@"primaryGenreName"]]; + [musica setPaism:[item objectForKey:@"country"]]; + [musica setPrecom:[item objectForKey:@"trackPrice"]]; + [musica setImgUrlm:[item objectForKey:@"artworkUrl60"]]; + [musicas addObject:musica]; + } } - - return filmes; + NSArray *mid = [[NSArray alloc]initWithObjects: filmes, ebooks, podcasts, musicas, nil]; + return mid; } diff --git a/iTunesSearch/pt.lproj/InfoPlist.strings b/iTunesSearch/pt.lproj/InfoPlist.strings new file mode 100644 index 0000000..dc62739 --- /dev/null +++ b/iTunesSearch/pt.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ \ No newline at end of file diff --git a/iTunesSearch/pt.lproj/Localizable.strings b/iTunesSearch/pt.lproj/Localizable.strings new file mode 100644 index 0000000..a386870 --- /dev/null +++ b/iTunesSearch/pt.lproj/Localizable.strings @@ -0,0 +1,2 @@ +/* Botão */ +"Search" = " Buscar "; \ No newline at end of file diff --git a/iTunesSearch/pt.lproj/TableView.xib b/iTunesSearch/pt.lproj/TableView.xib new file mode 100644 index 0000000..5275b15 --- /dev/null +++ b/iTunesSearch/pt.lproj/TableView.xib @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iTunesSearchTests/Info.plist b/iTunesSearchTests/Info.plist index 0c9309b..a884b1c 100644 --- a/iTunesSearchTests/Info.plist +++ b/iTunesSearchTests/Info.plist @@ -13,12 +13,31 @@ CFBundleName $(PRODUCT_NAME) CFBundlePackageType - BNDL + APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + diff --git a/iTunesSearchTests/fr.lproj/InfoPlist.strings b/iTunesSearchTests/fr.lproj/InfoPlist.strings new file mode 100644 index 0000000..dc62739 --- /dev/null +++ b/iTunesSearchTests/fr.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ \ No newline at end of file diff --git a/iTunesSearchTests/pt.lproj/InfoPlist.strings b/iTunesSearchTests/pt.lproj/InfoPlist.strings new file mode 100644 index 0000000..dc62739 --- /dev/null +++ b/iTunesSearchTests/pt.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* No Localized Strings */ \ No newline at end of file