diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..cc9f0b8
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+iTunesSearch
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..d821048
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/iTunesSearch.iml b/.idea/iTunesSearch.iml
new file mode 100644
index 0000000..cb345e8
--- /dev/null
+++ b/.idea/iTunesSearch.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..8662aa9
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..c14551d
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml
new file mode 100644
index 0000000..922003b
--- /dev/null
+++ b/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..d071f0c
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,236 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1426267314379
+
+ 1426267314379
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/xcode.xml b/.idea/xcode.xml
new file mode 100644
index 0000000..b6aaa74
--- /dev/null
+++ b/.idea/xcode.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/fr.lproj/Localizable.strings b/fr.lproj/Localizable.strings
new file mode 100644
index 0000000..7d4180b
--- /dev/null
+++ b/fr.lproj/Localizable.strings
@@ -0,0 +1,14 @@
+/*
+ Localizable.strings
+ iTunesSearch
+
+ Created by William Hong Jun Cho on 3/12/15.
+ Copyright (c) 2015 joaquim. All rights reserved.
+*/
+"all" = "Tous";
+"movie" = "Film";
+"feature-movie" = "Film";
+"ebook" = "EBook";
+"song" = "Musique";
+"podcast" = "Podcast";
+"search" = "Recherche";
\ No newline at end of file
diff --git a/iTunesSearch.xcodeproj/project.pbxproj b/iTunesSearch.xcodeproj/project.pbxproj
old mode 100644
new mode 100755
index 79e06d7..005b13f
--- a/iTunesSearch.xcodeproj/project.pbxproj
+++ b/iTunesSearch.xcodeproj/project.pbxproj
@@ -7,13 +7,23 @@
objects = {
/* Begin PBXBuildFile section */
+ 8F6595B71AB48F87000C445C /* MainTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F6595B61AB48F87000C445C /* MainTableViewController.m */; };
+ 8F6595B91AB48FB7000C445C /* MainTableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8F6595B81AB48FB7000C445C /* MainTableView.xib */; };
+ 8F802E6C1AB1F8D800936645 /* Midia.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F802E6B1AB1F8D800936645 /* Midia.m */; };
+ 8F802E6F1AB1F99700936645 /* EBook.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F802E6E1AB1F99700936645 /* EBook.m */; };
+ 8F802E721AB1FA8400936645 /* Musica.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F802E711AB1FA8400936645 /* Musica.m */; };
+ 8F802E751AB22C9600936645 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8F802E771AB22C9600936645 /* Localizable.strings */; };
+ 8F802E7E1AB22DEF00936645 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8F802E801AB22DEF00936645 /* Localizable.strings */; };
+ 8F802E811AB22DF600936645 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8F802E831AB22DF600936645 /* Localizable.strings */; };
+ 8FC0F54E1AAF82F30087D8E5 /* SearchData.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FC0F54D1AAF82F30087D8E5 /* SearchData.m */; };
+ 8FD534F21AD97E2700274712 /* MidiaDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FD534F11AD97E2700274712 /* MidiaDetailViewController.m */; };
+ 8FD534F41AD9800500274712 /* MidiaDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8FD534F31AD9800500274712 /* MidiaDetailViewController.xib */; };
+ 8FE624401AB351FA0037CEFD /* Podcast.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FE6243F1AB351FA0037CEFD /* Podcast.m */; };
92C21CB61AAE757A0052ABE6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CB51AAE757A0052ABE6 /* main.m */; };
92C21CB91AAE757A0052ABE6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 92C21CB81AAE757A0052ABE6 /* AppDelegate.m */; };
- 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 */; };
@@ -30,20 +40,36 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ 8F6595B51AB48F87000C445C /* MainTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainTableViewController.h; sourceTree = ""; };
+ 8F6595B61AB48F87000C445C /* MainTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainTableViewController.m; sourceTree = ""; };
+ 8F6595B81AB48FB7000C445C /* MainTableView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainTableView.xib; sourceTree = ""; };
+ 8F802E6A1AB1F8D800936645 /* Midia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Midia.h; sourceTree = ""; };
+ 8F802E6B1AB1F8D800936645 /* Midia.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Midia.m; sourceTree = ""; };
+ 8F802E6D1AB1F99700936645 /* EBook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EBook.h; sourceTree = ""; };
+ 8F802E6E1AB1F99700936645 /* EBook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EBook.m; sourceTree = ""; };
+ 8F802E701AB1FA8400936645 /* Musica.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Musica.h; sourceTree = ""; };
+ 8F802E711AB1FA8400936645 /* Musica.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Musica.m; sourceTree = ""; };
+ 8F802E761AB22C9600936645 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; };
+ 8F802E7F1AB22DEF00936645 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; };
+ 8F802E821AB22DF600936645 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = ""; };
+ 8FC0F54C1AAF82F30087D8E5 /* SearchData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchData.h; sourceTree = ""; };
+ 8FC0F54D1AAF82F30087D8E5 /* SearchData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchData.m; sourceTree = ""; };
+ 8FD534F01AD97E2700274712 /* MidiaDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MidiaDetailViewController.h; sourceTree = ""; };
+ 8FD534F11AD97E2700274712 /* MidiaDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MidiaDetailViewController.m; sourceTree = ""; };
+ 8FD534F31AD9800500274712 /* MidiaDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MidiaDetailViewController.xib; sourceTree = ""; };
+ 8FE6243E1AB351FA0037CEFD /* Podcast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Podcast.h; sourceTree = ""; };
+ 8FE6243F1AB351FA0037CEFD /* Podcast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Podcast.m; sourceTree = ""; };
92C21CB01AAE757A0052ABE6 /* iTunesSearch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iTunesSearch.app; sourceTree = BUILT_PRODUCTS_DIR; };
92C21CB41AAE757A0052ABE6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
92C21CB51AAE757A0052ABE6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
92C21CB71AAE757A0052ABE6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
92C21CB81AAE757A0052ABE6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
- 92C21CBA1AAE757A0052ABE6 /* TableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; };
- 92C21CBB1AAE757A0052ABE6 /* TableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = ""; };
92C21CC01AAE757A0052ABE6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
92C21CC91AAE757A0052ABE6 /* iTunesSearchTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iTunesSearchTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
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 = ""; };
@@ -72,6 +98,9 @@
92C21CA71AAE757A0052ABE6 = {
isa = PBXGroup;
children = (
+ 8F802E771AB22C9600936645 /* Localizable.strings */,
+ 8F802E831AB22DF600936645 /* Localizable.strings */,
+ 8F802E801AB22DEF00936645 /* Localizable.strings */,
92C21CB21AAE757A0052ABE6 /* iTunesSearch */,
92C21CCC1AAE757A0052ABE6 /* iTunesSearchTests */,
92C21CB11AAE757A0052ABE6 /* Products */,
@@ -94,13 +123,16 @@
92C21CE91AAE859A0052ABE6 /* Entidades */,
92C21CB71AAE757A0052ABE6 /* AppDelegate.h */,
92C21CB81AAE757A0052ABE6 /* AppDelegate.m */,
- 92C21CBA1AAE757A0052ABE6 /* TableViewController.h */,
- 92C21CBB1AAE757A0052ABE6 /* TableViewController.m */,
- 92C21CDC1AAE75DC0052ABE6 /* TableView.xib */,
92C21CD91AAE75B30052ABE6 /* iTunesManager.h */,
92C21CDA1AAE75B30052ABE6 /* iTunesManager.m */,
92C21CC01AAE757A0052ABE6 /* Images.xcassets */,
92C21CB31AAE757A0052ABE6 /* Supporting Files */,
+ 8F6595B51AB48F87000C445C /* MainTableViewController.h */,
+ 8F6595B61AB48F87000C445C /* MainTableViewController.m */,
+ 8F6595B81AB48FB7000C445C /* MainTableView.xib */,
+ 8FD534F01AD97E2700274712 /* MidiaDetailViewController.h */,
+ 8FD534F11AD97E2700274712 /* MidiaDetailViewController.m */,
+ 8FD534F31AD9800500274712 /* MidiaDetailViewController.xib */,
);
path = iTunesSearch;
sourceTree = "";
@@ -146,6 +178,16 @@
children = (
92C21CE61AAE858E0052ABE6 /* Filme.h */,
92C21CE71AAE858E0052ABE6 /* Filme.m */,
+ 8FC0F54C1AAF82F30087D8E5 /* SearchData.h */,
+ 8FC0F54D1AAF82F30087D8E5 /* SearchData.m */,
+ 8F802E6A1AB1F8D800936645 /* Midia.h */,
+ 8F802E6B1AB1F8D800936645 /* Midia.m */,
+ 8F802E6D1AB1F99700936645 /* EBook.h */,
+ 8F802E6E1AB1F99700936645 /* EBook.m */,
+ 8F802E701AB1FA8400936645 /* Musica.h */,
+ 8F802E711AB1FA8400936645 /* Musica.m */,
+ 8FE6243E1AB351FA0037CEFD /* Podcast.h */,
+ 8FE6243F1AB351FA0037CEFD /* Podcast.m */,
);
name = Entidades;
sourceTree = "";
@@ -213,6 +255,8 @@
knownRegions = (
en,
Base,
+ fr,
+ pt,
);
mainGroup = 92C21CA71AAE757A0052ABE6;
productRefGroup = 92C21CB11AAE757A0052ABE6 /* Products */;
@@ -230,9 +274,13 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 8FD534F41AD9800500274712 /* MidiaDetailViewController.xib in Resources */,
+ 8F802E751AB22C9600936645 /* Localizable.strings in Resources */,
+ 8F6595B91AB48FB7000C445C /* MainTableView.xib in Resources */,
+ 8F802E811AB22DF600936645 /* Localizable.strings in Resources */,
+ 8F802E7E1AB22DEF00936645 /* Localizable.strings in Resources */,
92C21CC11AAE757A0052ABE6 /* Images.xcassets in Resources */,
92C21CE21AAE76930052ABE6 /* TableViewCell.xib in Resources */,
- 92C21CDD1AAE75DC0052ABE6 /* TableView.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -250,12 +298,18 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 92C21CBC1AAE757A0052ABE6 /* TableViewController.m in Sources */,
92C21CDB1AAE75B30052ABE6 /* iTunesManager.m in Sources */,
+ 8F802E721AB1FA8400936645 /* Musica.m in Sources */,
92C21CB91AAE757A0052ABE6 /* AppDelegate.m in Sources */,
+ 8F802E6C1AB1F8D800936645 /* Midia.m in Sources */,
+ 8F802E6F1AB1F99700936645 /* EBook.m in Sources */,
+ 8FE624401AB351FA0037CEFD /* Podcast.m in Sources */,
92C21CE81AAE858E0052ABE6 /* Filme.m in Sources */,
+ 8F6595B71AB48F87000C445C /* MainTableViewController.m in Sources */,
+ 8FD534F21AD97E2700274712 /* MidiaDetailViewController.m in Sources */,
92C21CE11AAE76930052ABE6 /* TableViewCell.m in Sources */,
92C21CB61AAE757A0052ABE6 /* main.m in Sources */,
+ 8FC0F54E1AAF82F30087D8E5 /* SearchData.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -277,6 +331,35 @@
};
/* End PBXTargetDependency section */
+/* Begin PBXVariantGroup section */
+ 8F802E771AB22C9600936645 /* Localizable.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 8F802E761AB22C9600936645 /* en */,
+ );
+ name = Localizable.strings;
+ path = iTunesSearch;
+ sourceTree = "";
+ };
+ 8F802E801AB22DEF00936645 /* Localizable.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 8F802E7F1AB22DEF00936645 /* fr */,
+ );
+ name = Localizable.strings;
+ sourceTree = "";
+ };
+ 8F802E831AB22DF600936645 /* Localizable.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 8F802E821AB22DF600936645 /* pt */,
+ );
+ name = Localizable.strings;
+ path = iTunesSearch;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
/* Begin XCBuildConfiguration section */
92C21CD11AAE757A0052ABE6 /* Debug */ = {
isa = XCBuildConfiguration;
diff --git a/iTunesSearch.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iTunesSearch.xcodeproj/project.xcworkspace/contents.xcworkspacedata
old mode 100644
new mode 100755
diff --git a/iTunesSearch/AppDelegate.m b/iTunesSearch/AppDelegate.m
index d513fd8..67d0315 100644
--- a/iTunesSearch/AppDelegate.m
+++ b/iTunesSearch/AppDelegate.m
@@ -9,7 +9,7 @@
#import "AppDelegate.h"
#warning Classe importada para uso no metodo de inicilizacao da App
-#import "TableViewController.h"
+#import "MainTableViewController.h"
@interface AppDelegate ()
@@ -27,9 +27,20 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
#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];
+ /*/
+ //Iniciando com SearchView
+ UINavigationController *nav = [[UINavigationController alloc]init];
+ MainTableViewController *vc = [[MainTableViewController alloc] init];
+ [nav pushViewController:vc animated:YES];
+ [self.window setRootViewController:nav];
+ //*/
+
[self.window makeKeyAndVisible];
+
return YES;
}
diff --git a/iTunesSearch/EBook.h b/iTunesSearch/EBook.h
new file mode 100644
index 0000000..cb804c9
--- /dev/null
+++ b/iTunesSearch/EBook.h
@@ -0,0 +1,16 @@
+//
+// EBook.h
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/12/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import
+#import "Midia.h"
+
+@interface EBook : Midia
+
+@property (nonatomic, strong) NSString *autor;
+
+@end
diff --git a/iTunesSearch/EBook.m b/iTunesSearch/EBook.m
new file mode 100644
index 0000000..5224c76
--- /dev/null
+++ b/iTunesSearch/EBook.m
@@ -0,0 +1,13 @@
+//
+// EBook.m
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/12/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import "EBook.h"
+
+@implementation EBook
+
+@end
diff --git a/iTunesSearch/Entidades/Filme.h b/iTunesSearch/Entidades/Filme.h
index eb126dc..f609f23 100644
--- a/iTunesSearch/Entidades/Filme.h
+++ b/iTunesSearch/Entidades/Filme.h
@@ -7,14 +7,11 @@
//
#import
+#import "Midia.h"
-@interface Filme : NSObject
+@interface Filme : Midia
+
+@property (nonatomic, strong) NSString *duration;
-@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) NSString *pais;
@end
diff --git a/iTunesSearch/MainTableView.xib b/iTunesSearch/MainTableView.xib
new file mode 100644
index 0000000..9a3dc32
--- /dev/null
+++ b/iTunesSearch/MainTableView.xib
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/iTunesSearch/MainTableViewController.h b/iTunesSearch/MainTableViewController.h
new file mode 100644
index 0000000..3154fec
--- /dev/null
+++ b/iTunesSearch/MainTableViewController.h
@@ -0,0 +1,20 @@
+//
+// MainTableViewController.h
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/14/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import
+
+@interface MainTableViewController : UIViewController
+
+@property (weak, nonatomic) IBOutlet UITextField *txtSearch;
+@property (weak, nonatomic) IBOutlet UIButton *btnSearch;
+- (IBAction)onBtnSearch:(id)sender;
+@property (weak, nonatomic) IBOutlet UISegmentedControl *scControl;
+@property (weak, nonatomic) IBOutlet UITableView *tableView;
+
+
+@end
diff --git a/iTunesSearch/MainTableViewController.m b/iTunesSearch/MainTableViewController.m
new file mode 100644
index 0000000..6844dc3
--- /dev/null
+++ b/iTunesSearch/MainTableViewController.m
@@ -0,0 +1,133 @@
+//
+// MainTableViewController.m
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/14/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import "MainTableViewController.h"
+#import "SearchData.h"
+#import "iTunesManager.h"
+#import "TableViewCell.h"
+#import "MidiaDetailViewController.h"
+
+
+@interface MainTableViewController ()
+
+@end
+
+@implementation MainTableViewController {
+ iTunesManager *itunes;
+ SearchData *midiaData;
+ NSArray *currentMidiaList;
+ NSUserDefaults *uData;
+}
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ itunes = [iTunesManager sharedInstance];
+ uData = [NSUserDefaults standardUserDefaults];
+
+
+ UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil];
+ [_tableView registerNib:nib forCellReuseIdentifier:@"celulaPadrao"];
+
+ [_btnSearch setTitle:NSLocalizedString(@"search", nil) forState:UIControlStateNormal];
+ [_txtSearch setDelegate:self];
+ [_tableView setDelegate:self];
+
+ [_scControl removeAllSegments];
+ [_scControl addTarget:self action:@selector(onSCValueChanged:) forControlEvents:UIControlEventValueChanged];
+
+
+ NSString *lastSearch = [uData stringForKey:@"lastSearch"];
+ if(lastSearch && lastSearch.length > 0) {
+ [_txtSearch setText:lastSearch];
+ [self searchFor:lastSearch];
+ }
+}
+
+-(void)searchFor:(NSString *)value {
+ midiaData = [itunes buscarMidias:value];
+
+ [_scControl removeAllSegments];
+ for (int i = 0; i < midiaData.midiaTypes.count; i++) {
+ [_scControl insertSegmentWithTitle:NSLocalizedString(midiaData.midiaTypes[i], nil) atIndex:i animated:YES];
+ }
+ [_scControl setSelectedSegmentIndex:0];
+ [self onSCValueChanged:_scControl];
+
+ [uData setValue:value forKey:@"lastSearch"];
+}
+
+#pragma mark - UITableViewDataSource
+-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ return 1;
+}
+
+-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
+ return NSLocalizedString(midiaData.midiaTypes[section], nil);
+}
+
+-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return currentMidiaList.count;
+}
+
+-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ return 75;
+}
+
+-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ TableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:@"celulaPadrao"];
+
+ Midia *midia = currentMidiaList[indexPath.row];
+
+ [cell.name setText:midia.trackName];
+ [cell.kind setText:NSLocalizedString(midia.kind, nil)];
+ [cell.genero setText:midia.primaryGenreName];
+
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:midia.artworkUrl]];
+ if(data) {
+ UIImage *img = [UIImage imageWithData:data];
+ if(img) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [cell.imgPreview setImage:img];
+ });
+ }
+ }
+ });
+
+ return cell;
+}
+
+-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ MidiaDetailViewController *vc = [[MidiaDetailViewController alloc] init];
+ [vc setMidia:currentMidiaList[indexPath.row]];
+ [self.navigationController pushViewController:vc animated:YES];
+}
+
+#pragma mark - UI events
+-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
+ NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[0-9a-zA-Z]" options:NSRegularExpressionCaseInsensitive error:nil];
+ NSUInteger matches = [regex numberOfMatchesInString:string options:0 range:NSMakeRange(0, string.length)];
+ return (matches > 0);
+}
+
+- (IBAction)onBtnSearch:(id)sender {
+ NSString *value = _txtSearch.text;
+ if(value && value.length > 0) {
+ [self searchFor:value];
+ }
+}
+
+-(void)onSCValueChanged:(UISegmentedControl *)segment {
+ currentMidiaList = [midiaData getArrayByKind:midiaData.midiaTypes[_scControl.selectedSegmentIndex]];
+ [_tableView reloadData];
+}
+
+
+
+@end
diff --git a/iTunesSearch/Midia.h b/iTunesSearch/Midia.h
new file mode 100644
index 0000000..a876a0f
--- /dev/null
+++ b/iTunesSearch/Midia.h
@@ -0,0 +1,24 @@
+//
+// Midia.h
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/12/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import
+
+@interface Midia : NSObject
+
+@property (nonatomic, strong) NSString *kind;
+@property (nonatomic, strong) NSString *trackId;
+@property (nonatomic, strong) NSString *trackName;
+@property (nonatomic, strong) NSString *trackPrice;
+@property (nonatomic, strong) NSString *artistName;
+@property (nonatomic, strong) NSString *primaryGenreName;
+@property (nonatomic, strong) NSString *country;
+@property (nonatomic, strong) NSString *currency;
+@property (nonatomic, strong) NSString *artworkUrl;
+
+
+@end
diff --git a/iTunesSearch/Midia.m b/iTunesSearch/Midia.m
new file mode 100644
index 0000000..968bc4a
--- /dev/null
+++ b/iTunesSearch/Midia.m
@@ -0,0 +1,13 @@
+//
+// Midia.m
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/12/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import "Midia.h"
+
+@implementation Midia
+
+@end
diff --git a/iTunesSearch/MidiaDetailViewController.h b/iTunesSearch/MidiaDetailViewController.h
new file mode 100644
index 0000000..420caea
--- /dev/null
+++ b/iTunesSearch/MidiaDetailViewController.h
@@ -0,0 +1,20 @@
+//
+// MidiaDetailViewController.h
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 4/11/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import
+#import "Midia.h"
+
+@interface MidiaDetailViewController : UIViewController
+
+@property (weak, nonatomic) IBOutlet UILabel *textTitle;
+@property (weak, nonatomic) IBOutlet UITextView *textWall;
+@property (weak, nonatomic) IBOutlet UIImageView *imgPreview;
+
+-(void)setMidia:(Midia *)m;
+
+@end
diff --git a/iTunesSearch/MidiaDetailViewController.m b/iTunesSearch/MidiaDetailViewController.m
new file mode 100644
index 0000000..545ddff
--- /dev/null
+++ b/iTunesSearch/MidiaDetailViewController.m
@@ -0,0 +1,47 @@
+//
+// MidiaDetailViewController.m
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 4/11/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import "MidiaDetailViewController.h"
+#import "Midia.h"
+
+@implementation MidiaDetailViewController {
+ Midia *midia;
+}
+
+-(void)viewDidLoad {
+ [super viewDidLoad];
+
+}
+
+-(void)viewWillAppear:(BOOL)animated {
+ [super viewWillAppear:animated];
+
+ self.textTitle.text = NSLocalizedString(midia.trackName, nil);
+ self.textWall.text = [NSString stringWithFormat:@"%@\n%@\n%@ %@",
+ midia.primaryGenreName,
+ midia.artistName,
+ midia.currency, midia.trackPrice];
+
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:midia.artworkUrl]];
+ if(data) {
+ UIImage *img = [UIImage imageWithData:data];
+ if(img) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self.imgPreview setImage:img];
+ });
+ }
+ }
+ });
+}
+
+-(void) setMidia:(Midia *)m {
+ midia = m;
+}
+
+@end
diff --git a/iTunesSearch/MidiaDetailViewController.xib b/iTunesSearch/MidiaDetailViewController.xib
new file mode 100644
index 0000000..15f188e
--- /dev/null
+++ b/iTunesSearch/MidiaDetailViewController.xib
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/iTunesSearch/Musica.h b/iTunesSearch/Musica.h
new file mode 100644
index 0000000..8280958
--- /dev/null
+++ b/iTunesSearch/Musica.h
@@ -0,0 +1,17 @@
+//
+// Musica.h
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/12/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import
+#import "Midia.h"
+
+@interface Musica : Midia
+
+@property (nonatomic,strong) NSString *artista;
+
+
+@end
diff --git a/iTunesSearch/Musica.m b/iTunesSearch/Musica.m
new file mode 100644
index 0000000..114c490
--- /dev/null
+++ b/iTunesSearch/Musica.m
@@ -0,0 +1,13 @@
+//
+// Musica.m
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/12/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..69149aa
--- /dev/null
+++ b/iTunesSearch/Podcast.h
@@ -0,0 +1,16 @@
+//
+// Podcast.h
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/13/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import
+#import "Midia.h"
+
+@interface Podcast : Midia
+
+
+
+@end
diff --git a/iTunesSearch/Podcast.m b/iTunesSearch/Podcast.m
new file mode 100644
index 0000000..74593c8
--- /dev/null
+++ b/iTunesSearch/Podcast.m
@@ -0,0 +1,13 @@
+//
+// Podcast.m
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/13/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import "Podcast.h"
+
+@implementation Podcast
+
+@end
diff --git a/iTunesSearch/SearchData.h b/iTunesSearch/SearchData.h
new file mode 100644
index 0000000..0c9efb6
--- /dev/null
+++ b/iTunesSearch/SearchData.h
@@ -0,0 +1,25 @@
+//
+// SearchData.h
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/10/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import
+#import "Midia.h"
+#import "Filme.h"
+#import "EBook.h"
+#import "Musica.h"
+#import "Podcast.h"
+
+@interface SearchData : NSObject
+
+-(id)initWithResults:(NSArray *)results;
+-(void)addData:(Midia *)midia;
+-(NSArray *)getArrayByKind:(NSString *)kind;
+
+@property (nonatomic, strong) NSMutableDictionary *data;
+@property (nonatomic, strong) NSMutableArray *midiaTypes;
+
+@end
diff --git a/iTunesSearch/SearchData.m b/iTunesSearch/SearchData.m
new file mode 100644
index 0000000..6b3c3ac
--- /dev/null
+++ b/iTunesSearch/SearchData.m
@@ -0,0 +1,91 @@
+//
+// SearchData.m
+// iTunesSearch
+//
+// Created by William Hong Jun Cho on 3/10/15.
+// Copyright (c) 2015 joaquim. All rights reserved.
+//
+
+#import "SearchData.h"
+
+@implementation SearchData {
+}
+
+@synthesize data, midiaTypes;
+
+-(id)init {
+ self = [super init];
+ if(self) {
+ midiaTypes = [[NSMutableArray alloc]init];
+ data = [[NSMutableDictionary alloc] init];
+ }
+ return self;
+}
+
+-(id)initWithResults:(NSArray *)results {
+ self = [super init];
+ if(self) {
+ midiaTypes = [[NSMutableArray alloc]init];
+ data = [[NSMutableDictionary alloc] init];
+
+ for (NSDictionary *item in results) {
+ NSString *itemKind = [item objectForKey:@"kind"];
+
+ Midia *midia = nil;
+
+ //todo add regex
+ if([itemKind isEqualToString:@"feature-movie"]) {
+ Filme *filme = [[Filme alloc] init];
+ [filme setDuration:[item objectForKey:@"trackTimeMillis"]];
+ midia = filme;
+ } else if([itemKind isEqualToString:@"song"]) {
+ Musica *musica = [[Musica alloc] init];
+
+ midia = musica;
+ } else if([itemKind isEqualToString:@"podcast"]) {
+ Podcast *podcast = [[Podcast alloc] init];
+
+ midia = podcast;
+ } else if([itemKind isEqualToString:@"ebook"]) {
+ EBook *ebook = [[EBook alloc]init];
+
+ midia = ebook;
+ }
+
+ if(midia) {
+ NSString *kind = [item objectForKey:@"kind"];
+
+ [midia setKind :[item objectForKey:@"kind"]];
+ [midia setTrackName :[item objectForKey:@"trackName"]];
+ [midia setTrackId :[item objectForKey:@"trackId"]];
+ [midia setTrackPrice :[item objectForKey:@"trackPrice"]];
+ [midia setArtistName :[item objectForKey:@"artistName"]];
+ [midia setPrimaryGenreName:[item objectForKey:@"primaryGenreName"]];
+ [midia setCountry :[item objectForKey:@"country"]];
+ [midia setCurrency :[item objectForKey:@"currency"]];
+ [midia setArtworkUrl :[item objectForKey:@"artworkUrl100"]];
+
+ if(![midiaTypes containsObject:kind])
+ [midiaTypes addObject:kind];
+
+ NSMutableArray *array = [data objectForKey:kind];
+ if(!array) {
+ array = [[NSMutableArray alloc] init];
+ [data setObject:array forKey:kind];
+ }
+ [array addObject:midia];
+ }
+ }
+ }
+ return self;
+}
+
+-(void)addData:(Midia *)midia {
+
+}
+
+-(NSArray *)getArrayByKind:(NSString *)kind {
+ return [data objectForKey:kind];
+}
+
+@end
diff --git a/iTunesSearch/TableView.xib b/iTunesSearch/TableView.xib
deleted file mode 100644
index 55f128c..0000000
--- a/iTunesSearch/TableView.xib
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/iTunesSearch/TableViewCell.h b/iTunesSearch/TableViewCell.h
index b630349..eb98c5a 100644
--- a/iTunesSearch/TableViewCell.h
+++ b/iTunesSearch/TableViewCell.h
@@ -10,8 +10,11 @@
@interface TableViewCell : UITableViewCell
-@property (weak, nonatomic) IBOutlet UILabel *nome;
-@property (weak, nonatomic) IBOutlet UILabel *tipo;
+@property (weak, nonatomic) IBOutlet UIImageView *imgPreview;
+
+@property (weak, nonatomic) IBOutlet UILabel *name;
+@property (weak, nonatomic) IBOutlet UILabel *kind;
+@property (weak, nonatomic) IBOutlet UILabel *genero;
@end
diff --git a/iTunesSearch/TableViewCell.xib b/iTunesSearch/TableViewCell.xib
index bf8bd3f..f15908e 100644
--- a/iTunesSearch/TableViewCell.xib
+++ b/iTunesSearch/TableViewCell.xib
@@ -1,7 +1,7 @@
-
+
-
+
@@ -15,30 +15,58 @@
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
diff --git a/iTunesSearch/TableViewController.h b/iTunesSearch/TableViewController.h
deleted file mode 100644
index 0cbb5c4..0000000
--- a/iTunesSearch/TableViewController.h
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// ViewController.h
-// iTunesSearch
-//
-// Created by joaquim on 09/03/15.
-// Copyright (c) 2015 joaquim. All rights reserved.
-//
-
-#import
-
-@interface TableViewController : UIViewController
-
-
-@property (strong, nonatomic) IBOutlet UITableView *tableview;
-
-@end
-
diff --git a/iTunesSearch/TableViewController.m b/iTunesSearch/TableViewController.m
deleted file mode 100644
index f689980..0000000
--- a/iTunesSearch/TableViewController.m
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// ViewController.m
-// iTunesSearch
-//
-// Created by joaquim on 09/03/15.
-// Copyright (c) 2015 joaquim. All rights reserved.
-//
-
-#import "TableViewController.h"
-#import "TableViewCell.h"
-#import "iTunesManager.h"
-#import "Entidades/Filme.h"
-
-@interface TableViewController () {
- NSArray *midias;
-}
-
-@end
-
-@implementation TableViewController
-
-
-
-- (void)viewDidLoad {
- [super viewDidLoad];
-
- 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)];
-}
-
-- (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
-}
-
-
-#pragma mark - Metodos do UITableViewDataSource
--(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return 1;
-}
-
--(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return [midias count];
-}
-
--(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- TableViewCell *celula = [self.tableview dequeueReusableCellWithIdentifier:@"celulaPadrao"];
-
- Filme *filme = [midias objectAtIndex:indexPath.row];
-
- [celula.nome setText:filme.nome];
- [celula.tipo setText:@"Filme"];
-
- return celula;
-}
-
--(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 70;
-}
-
-
-@end
diff --git a/iTunesSearch/en.lproj/Localizable.strings b/iTunesSearch/en.lproj/Localizable.strings
new file mode 100644
index 0000000..55b4b5d
--- /dev/null
+++ b/iTunesSearch/en.lproj/Localizable.strings
@@ -0,0 +1,14 @@
+/*
+ Localizable.strings
+ iTunesSearch
+
+ Created by William Hong Jun Cho on 3/12/15.
+ Copyright (c) 2015 joaquim. All rights reserved.
+*/
+"all" = "All";
+"movie" = "Movie";
+"feature-movie" = "Movie";
+"ebook" = "EBook";
+"song" = "Music";
+"podcast" = "Podcast";
+"search" = "Search";
\ No newline at end of file
diff --git a/iTunesSearch/iTunesManager.h b/iTunesSearch/iTunesManager.h
index c0e366b..9839754 100644
--- a/iTunesSearch/iTunesManager.h
+++ b/iTunesSearch/iTunesManager.h
@@ -7,6 +7,7 @@
//
#import
+#import "SearchData.h"
@interface iTunesManager : NSObject
@@ -16,6 +17,6 @@
*/
+ (iTunesManager*)sharedInstance;
-- (NSArray *)buscarMidias:(NSString *)termo;
+- (SearchData *)buscarMidias:(NSString *)termo;
@end
diff --git a/iTunesSearch/iTunesManager.m b/iTunesSearch/iTunesManager.m
index e2babda..c3e64a7 100644
--- a/iTunesSearch/iTunesManager.m
+++ b/iTunesSearch/iTunesManager.m
@@ -7,7 +7,6 @@
//
#import "iTunesManager.h"
-#import "Entidades/Filme.h"
@implementation iTunesManager
@@ -29,12 +28,11 @@ + (id)sharedInstance
}
-- (NSArray *)buscarMidias:(NSString *)termo {
- if (!termo) {
+- (SearchData *)buscarMidias:(NSString *)termo {
+ if (!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=%@&", termo];
NSData *jsonData = [NSData dataWithContentsOfURL: [NSURL URLWithString:url]];
NSError *error;
@@ -45,22 +43,7 @@ - (NSArray *)buscarMidias:(NSString *)termo {
NSLog(@"Não foi possível fazer a busca. ERRO: %@", error);
return nil;
}
-
- NSArray *resultados = [resultado objectForKey:@"results"];
- 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];
- }
-
- return filmes;
+ return [[SearchData alloc] initWithResults:[resultado objectForKey:@"results"]];
}
diff --git a/iTunesSearch/pt.lproj/Localizable.strings b/iTunesSearch/pt.lproj/Localizable.strings
new file mode 100644
index 0000000..0ccffbb
--- /dev/null
+++ b/iTunesSearch/pt.lproj/Localizable.strings
@@ -0,0 +1,14 @@
+/*
+ Localizable.strings
+ iTunesSearch
+
+ Created by William Hong Jun Cho on 3/12/15.
+ Copyright (c) 2015 joaquim. All rights reserved.
+*/
+"all" = "Todos";
+"movie" = "Filme";
+"feature-movie" = "Filme";
+"ebook" = "EBook";
+"song" = "Música";
+"podcast" = "Podcast";
+"search" = "Buscar";
\ No newline at end of file