diff --git a/iTunesSearch.xcodeproj/project.pbxproj b/iTunesSearch.xcodeproj/project.pbxproj index 79e06d7..799975b 100644 --- a/iTunesSearch.xcodeproj/project.pbxproj +++ b/iTunesSearch.xcodeproj/project.pbxproj @@ -16,7 +16,14 @@ 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 */; }; + F77D5F731AB0A90000271A97 /* Musica.m in Sources */ = {isa = PBXBuildFile; fileRef = F77D5F721AB0A8FF00271A97 /* Musica.m */; }; + F77D5F761AB0BD5800271A97 /* Ebook.m in Sources */ = {isa = PBXBuildFile; fileRef = F77D5F751AB0BD5800271A97 /* Ebook.m */; }; + F77D5F791AB0BD6600271A97 /* Podcast.m in Sources */ = {isa = PBXBuildFile; fileRef = F77D5F781AB0BD6600271A97 /* Podcast.m */; }; + F77D5F7C1AB0C59700271A97 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F77D5F7E1AB0C59700271A97 /* InfoPlist.strings */; }; + F77D5F811AB0C59800271A97 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F77D5F831AB0C59800271A97 /* InfoPlist.strings */; }; + F77D5F861AB0C59800271A97 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F77D5F881AB0C59800271A97 /* Localizable.strings */; }; + F77D5F8E1AB0C94800271A97 /* Entidade.m in Sources */ = {isa = PBXBuildFile; fileRef = F77D5F8D1AB0C94800271A97 /* Entidade.m */; }; + F77D5F921AB0CB0400271A97 /* Filme.m in Sources */ = {isa = PBXBuildFile; fileRef = F77D5F911AB0CB0400271A97 /* Filme.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -47,8 +54,22 @@ 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 = ""; }; + F77D5F711AB0A8FF00271A97 /* Musica.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Musica.h; sourceTree = ""; }; + F77D5F721AB0A8FF00271A97 /* Musica.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Musica.m; sourceTree = ""; }; + F77D5F741AB0BD5800271A97 /* Ebook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Ebook.h; sourceTree = ""; }; + F77D5F751AB0BD5800271A97 /* Ebook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Ebook.m; sourceTree = ""; }; + F77D5F771AB0BD6600271A97 /* Podcast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Podcast.h; sourceTree = ""; }; + F77D5F781AB0BD6600271A97 /* Podcast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Podcast.m; sourceTree = ""; }; + F77D5F7D1AB0C59700271A97 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; + F77D5F821AB0C59800271A97 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; + F77D5F871AB0C59800271A97 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; + F77D5F891AB0C5AB00271A97 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; + F77D5F8A1AB0C5AB00271A97 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; + F77D5F8B1AB0C5AB00271A97 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = ""; }; + F77D5F8C1AB0C94800271A97 /* Entidade.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Entidade.h; sourceTree = ""; }; + F77D5F8D1AB0C94800271A97 /* Entidade.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Entidade.m; sourceTree = ""; }; + F77D5F901AB0CB0400271A97 /* Filme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Filme.h; sourceTree = ""; }; + F77D5F911AB0CB0400271A97 /* Filme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Filme.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -108,6 +129,8 @@ 92C21CB31AAE757A0052ABE6 /* Supporting Files */ = { isa = PBXGroup; children = ( + F77D5F881AB0C59800271A97 /* Localizable.strings */, + F77D5F831AB0C59800271A97 /* InfoPlist.strings */, 92C21CB41AAE757A0052ABE6 /* Info.plist */, 92C21CB51AAE757A0052ABE6 /* main.m */, ); @@ -126,6 +149,7 @@ 92C21CCD1AAE757A0052ABE6 /* Supporting Files */ = { isa = PBXGroup; children = ( + F77D5F7E1AB0C59700271A97 /* InfoPlist.strings */, 92C21CCE1AAE757A0052ABE6 /* Info.plist */, ); name = "Supporting Files"; @@ -144,8 +168,16 @@ 92C21CE91AAE859A0052ABE6 /* Entidades */ = { isa = PBXGroup; children = ( - 92C21CE61AAE858E0052ABE6 /* Filme.h */, - 92C21CE71AAE858E0052ABE6 /* Filme.m */, + F77D5F711AB0A8FF00271A97 /* Musica.h */, + F77D5F721AB0A8FF00271A97 /* Musica.m */, + F77D5F741AB0BD5800271A97 /* Ebook.h */, + F77D5F751AB0BD5800271A97 /* Ebook.m */, + F77D5F771AB0BD6600271A97 /* Podcast.h */, + F77D5F781AB0BD6600271A97 /* Podcast.m */, + F77D5F8C1AB0C94800271A97 /* Entidade.h */, + F77D5F8D1AB0C94800271A97 /* Entidade.m */, + F77D5F901AB0CB0400271A97 /* Filme.h */, + F77D5F911AB0CB0400271A97 /* Filme.m */, ); name = Entidades; sourceTree = ""; @@ -230,7 +262,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F77D5F861AB0C59800271A97 /* Localizable.strings in Resources */, 92C21CC11AAE757A0052ABE6 /* Images.xcassets in Resources */, + F77D5F811AB0C59800271A97 /* InfoPlist.strings in Resources */, 92C21CE21AAE76930052ABE6 /* TableViewCell.xib in Resources */, 92C21CDD1AAE75DC0052ABE6 /* TableView.xib in Resources */, ); @@ -240,6 +274,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F77D5F7C1AB0C59700271A97 /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -251,9 +286,13 @@ buildActionMask = 2147483647; files = ( 92C21CBC1AAE757A0052ABE6 /* TableViewController.m in Sources */, + F77D5F731AB0A90000271A97 /* Musica.m in Sources */, + F77D5F761AB0BD5800271A97 /* Ebook.m in Sources */, + F77D5F8E1AB0C94800271A97 /* Entidade.m in Sources */, + F77D5F791AB0BD6600271A97 /* Podcast.m in Sources */, + F77D5F921AB0CB0400271A97 /* Filme.m in Sources */, 92C21CDB1AAE75B30052ABE6 /* iTunesManager.m in Sources */, 92C21CB91AAE757A0052ABE6 /* AppDelegate.m in Sources */, - 92C21CE81AAE858E0052ABE6 /* Filme.m in Sources */, 92C21CE11AAE76930052ABE6 /* TableViewCell.m in Sources */, 92C21CB61AAE757A0052ABE6 /* main.m in Sources */, ); @@ -277,6 +316,36 @@ }; /* End PBXTargetDependency section */ +/* Begin PBXVariantGroup section */ + F77D5F7E1AB0C59700271A97 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + F77D5F7D1AB0C59700271A97 /* fr */, + F77D5F891AB0C5AB00271A97 /* pt */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + F77D5F831AB0C59800271A97 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + F77D5F821AB0C59800271A97 /* fr */, + F77D5F8A1AB0C5AB00271A97 /* pt */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + F77D5F881AB0C59800271A97 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + F77D5F871AB0C59800271A97 /* fr */, + F77D5F8B1AB0C5AB00271A97 /* pt */, + ); + name = Localizable.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 92C21CD11AAE757A0052ABE6 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/iTunesSearch/Ebook.h b/iTunesSearch/Ebook.h new file mode 100644 index 0000000..398611b --- /dev/null +++ b/iTunesSearch/Ebook.h @@ -0,0 +1,14 @@ +// +// Ebook.h +// iTunesSearch +// +// Created by André Helaehil on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import +#import "Entidade.h" + +@interface Ebook : Entidade + +@end diff --git a/iTunesSearch/Ebook.m b/iTunesSearch/Ebook.m new file mode 100644 index 0000000..2276b6e --- /dev/null +++ b/iTunesSearch/Ebook.m @@ -0,0 +1,13 @@ +// +// Ebook.m +// iTunesSearch +// +// Created by André Helaehil on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import "Ebook.h" + +@implementation Ebook + +@end diff --git a/iTunesSearch/Entidades/Filme.h b/iTunesSearch/Entidade.h similarity index 63% rename from iTunesSearch/Entidades/Filme.h rename to iTunesSearch/Entidade.h index eb126dc..5766e8e 100644 --- a/iTunesSearch/Entidades/Filme.h +++ b/iTunesSearch/Entidade.h @@ -1,20 +1,23 @@ // -// Filme.h +// Entidade.h // iTunesSearch // -// Created by joaquim on 09/03/15. +// Created by André Helaehil on 11/03/15. // Copyright (c) 2015 joaquim. All rights reserved. // #import -@interface Filme : NSObject +@interface Entidade : NSObject @property (nonatomic, strong) NSString *nome; @property (nonatomic, strong) NSString *trackId; @property (nonatomic, strong) NSString *artista; @property (nonatomic, strong) NSString *duracao; @property (nonatomic, strong) NSString *genero; +@property (nonatomic, strong) NSNumber *preco; +@property (nonatomic, strong) NSString *imgUrl; @property (nonatomic, strong) NSString *pais; +@property (nonatomic, strong) NSString *data; @end diff --git a/iTunesSearch/Entidade.m b/iTunesSearch/Entidade.m new file mode 100644 index 0000000..dd54ac5 --- /dev/null +++ b/iTunesSearch/Entidade.m @@ -0,0 +1,13 @@ +// +// Entidade.m +// iTunesSearch +// +// Created by André Helaehil on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import "Entidade.h" + +@implementation Entidade + +@end diff --git a/iTunesSearch/Filme.h b/iTunesSearch/Filme.h new file mode 100644 index 0000000..c7177c0 --- /dev/null +++ b/iTunesSearch/Filme.h @@ -0,0 +1,14 @@ +// +// Filme.h +// iTunesSearch +// +// Created by André Helaehil on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import +#import "Entidade.h" + +@interface Filme : Entidade + +@end diff --git a/iTunesSearch/Entidades/Filme.m b/iTunesSearch/Filme.m similarity index 75% rename from iTunesSearch/Entidades/Filme.m rename to iTunesSearch/Filme.m index f00d84e..75ae9f9 100644 --- a/iTunesSearch/Entidades/Filme.m +++ b/iTunesSearch/Filme.m @@ -2,7 +2,7 @@ // Filme.m // iTunesSearch // -// Created by joaquim on 09/03/15. +// Created by André Helaehil on 11/03/15. // Copyright (c) 2015 joaquim. All rights reserved. // diff --git a/iTunesSearch/Musica.h b/iTunesSearch/Musica.h new file mode 100644 index 0000000..297e5b5 --- /dev/null +++ b/iTunesSearch/Musica.h @@ -0,0 +1,14 @@ +// +// Musica.h +// iTunesSearch +// +// Created by André Helaehil on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import +#import "Entidade.h" + +@interface Musica : Entidade + +@end diff --git a/iTunesSearch/Musica.m b/iTunesSearch/Musica.m new file mode 100644 index 0000000..72272ed --- /dev/null +++ b/iTunesSearch/Musica.m @@ -0,0 +1,13 @@ +// +// Musica.m +// iTunesSearch +// +// Created by André Helaehil on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import "Musica.h" + +@implementation Musica + +@end diff --git a/iTunesSearch/Podcast.h b/iTunesSearch/Podcast.h new file mode 100644 index 0000000..a0c2f55 --- /dev/null +++ b/iTunesSearch/Podcast.h @@ -0,0 +1,16 @@ +// +// Podcast.h +// iTunesSearch +// +// Created by André Helaehil on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import +#import "Entidade.h" + +@interface Podcast : Entidade + +@property (nonatomic, strong) NSString *artista; + +@end diff --git a/iTunesSearch/Podcast.m b/iTunesSearch/Podcast.m new file mode 100644 index 0000000..b11331a --- /dev/null +++ b/iTunesSearch/Podcast.m @@ -0,0 +1,13 @@ +// +// Podcast.m +// iTunesSearch +// +// Created by André Helaehil on 11/03/15. +// Copyright (c) 2015 joaquim. All rights reserved. +// + +#import "Podcast.h" + +@implementation Podcast + +@end diff --git a/iTunesSearch/TableView.xib b/iTunesSearch/TableView.xib index 55f128c..2560146 100644 --- a/iTunesSearch/TableView.xib +++ b/iTunesSearch/TableView.xib @@ -1,25 +1,50 @@ - + - - + + + + - + + + + + + + + + + + + + - - - - - - + + + + + + + + + diff --git a/iTunesSearch/TableViewCell.h b/iTunesSearch/TableViewCell.h index b630349..96b501d 100644 --- a/iTunesSearch/TableViewCell.h +++ b/iTunesSearch/TableViewCell.h @@ -11,7 +11,7 @@ @interface TableViewCell : UITableViewCell @property (weak, nonatomic) IBOutlet UILabel *nome; -@property (weak, nonatomic) IBOutlet UILabel *tipo; - +@property (weak, nonatomic) IBOutlet UILabel *artista; +@property (weak, nonatomic) IBOutlet UILabel *preco; @end diff --git a/iTunesSearch/TableViewCell.xib b/iTunesSearch/TableViewCell.xib index bf8bd3f..df6bad7 100644 --- a/iTunesSearch/TableViewCell.xib +++ b/iTunesSearch/TableViewCell.xib @@ -1,46 +1,83 @@ - + + - - + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + diff --git a/iTunesSearch/TableViewController.h b/iTunesSearch/TableViewController.h index 0cbb5c4..2f3af13 100644 --- a/iTunesSearch/TableViewController.h +++ b/iTunesSearch/TableViewController.h @@ -11,7 +11,11 @@ @interface TableViewController : UIViewController +@property (strong, nonatomic) IBOutlet UIView *view; @property (strong, nonatomic) IBOutlet UITableView *tableview; +@property (weak, nonatomic) IBOutlet UIButton *botao; +@property (strong, nonatomic) IBOutlet UITextField *texto; +- (IBAction)search:(id)sender; @end diff --git a/iTunesSearch/TableViewController.m b/iTunesSearch/TableViewController.m index f689980..d7166d9 100644 --- a/iTunesSearch/TableViewController.m +++ b/iTunesSearch/TableViewController.m @@ -9,10 +9,14 @@ #import "TableViewController.h" #import "TableViewCell.h" #import "iTunesManager.h" -#import "Entidades/Filme.h" +#import "Entidade.h" +#import "Filme.h" +#import "Musica.h" @interface TableViewController () { NSArray *midias; + NSArray *secoes; + NSMutableArray *midiasEncontradas; } @end @@ -27,8 +31,10 @@ - (void)viewDidLoad { UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil]; [self.tableview registerNib:nib forCellReuseIdentifier:@"celulaPadrao"]; - iTunesManager *itunes = [iTunesManager sharedInstance]; - midias = [itunes buscarMidias:@"Apple"]; + [_botao setTitle:NSLocalizedString(@"Search", @"Botão") forState:UIControlStateNormal]; + + [_tableview setDelegate:self]; + _tableview.dataSource = self; #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)]; @@ -52,17 +58,35 @@ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { TableViewCell *celula = [self.tableview dequeueReusableCellWithIdentifier:@"celulaPadrao"]; - Filme *filme = [midias objectAtIndex:indexPath.row]; - + Entidade *filme = [midias objectAtIndex:indexPath.row]; [celula.nome setText:filme.nome]; - [celula.tipo setText:@"Filme"]; - + [celula.artista setText:filme.artista]; + if (filme.preco == nil) { + [celula.preco setText:@"Grátis"]; + } + else{ + [celula.preco setText:[NSString stringWithFormat:@"Preço: $%@", filme.preco]]; + } return celula; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 70; + return 100; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + return 25; } +- (IBAction)search:(id)sender { + iTunesManager *itunes = [iTunesManager sharedInstance]; + midias = [itunes buscarMidias:[NSString stringWithFormat:@"%@", self.texto.text]]; + [self.view endEditing:YES]; + [self.tableview reloadData]; +} + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ + [self.view endEditing:YES]; +} @end 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..a165eaa --- /dev/null +++ b/iTunesSearch/fr.lproj/Localizable.strings @@ -0,0 +1,3 @@ +/* Botão */ +"Search" = "Recherche"; + diff --git a/iTunesSearch/iTunesManager.m b/iTunesSearch/iTunesManager.m index e2babda..6e7ffda 100644 --- a/iTunesSearch/iTunesManager.m +++ b/iTunesSearch/iTunesManager.m @@ -7,7 +7,11 @@ // #import "iTunesManager.h" -#import "Entidades/Filme.h" +#import "Filme.h" +#import "Entidade.h" +#import "Musica.h" +#import "Ebook.h" +#import "Podcast.h" @implementation iTunesManager @@ -41,6 +45,7 @@ - (NSArray *)buscarMidias:(NSString *)termo { NSDictionary *resultado = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; + if (error) { NSLog(@"Não foi possível fazer a busca. ERRO: %@", error); return nil; @@ -50,17 +55,53 @@ - (NSArray *)buscarMidias:(NSString *)termo { NSMutableArray *filmes = [[NSMutableArray alloc] init]; 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"]]; - [filmes addObject:filme]; - } + + if ([[item objectForKey:@"kind"]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 setPreco:[item objectForKey:@"trackPrice"]]; + [filmes addObject:filme]; + } + + if ([[item objectForKey:@"kind"]isEqualToString:@"song"]) { + Musica *musica = [[Musica alloc] init]; + [musica setNome:[item objectForKey:@"trackName"]]; + [musica setTrackId:[item objectForKey:@"trackId"]]; + [musica setArtista:[item objectForKey:@"artistName"]]; + [musica setDuracao:[item objectForKey:@"trackTimeMillis"]]; + [musica setGenero:[item objectForKey:@"primaryGenreName"]]; + [musica setPreco:[item objectForKey:@"trackPrice"]]; + [filmes addObject:musica]; + } + + if ([[item objectForKey:@"kind"]isEqualToString:@"podcast"]) { + Podcast *podcast = [[Podcast alloc] init]; + [podcast setNome:[item objectForKey:@"trackName"]]; + [podcast setTrackId:[item objectForKey:@"trackId"]]; + [podcast setArtista:[item objectForKey:@"artistName"]]; + [podcast setDuracao:[item objectForKey:@"trackTimeMillis"]]; + [podcast setGenero:[item objectForKey:@"primaryGenreName"]]; + [podcast setPreco:[item objectForKey:@"trackPrice"]]; + [filmes addObject:podcast]; + } + + if ([[item objectForKey:@"kind"]isEqualToString:@"ebook"]) { + Ebook *ebook = [[Ebook alloc] init]; + [ebook setNome:[item objectForKey:@"trackName"]]; + [ebook setTrackId:[item objectForKey:@"trackId"]]; + [ebook setArtista:[item objectForKey:@"artistName"]]; + [ebook setDuracao:[item objectForKey:@"trackTimeMillis"]]; + [ebook setGenero:[item objectForKey:@"primaryGenreName"]]; + [ebook setPreco:[item objectForKey:@"trackPrice"]]; + [filmes addObject:ebook]; + } - return filmes; + } + return resultados; } 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..77a56ef --- /dev/null +++ b/iTunesSearch/pt.lproj/Localizable.strings @@ -0,0 +1,3 @@ +/* Botão */ +"Search" = "Buscar"; + 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