Skip to content

Commit b4ef34d

Browse files
committed
First commit (v.1.0.2)
1 parent 1c6377c commit b4ef34d

File tree

343 files changed

+29559
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

343 files changed

+29559
-0
lines changed

BonDia.xcodeproj/project.pbxproj

+653
Large diffs are not rendered by default.

BonDia.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BonDia.xcworkspace/contents.xcworkspacedata

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BonDia/AboutUsViewController.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// AboutUsViewController.h
3+
// BonDia
4+
//
5+
// Created by Marc Gomez <[email protected]> on 2/9/14.
6+
// Copyright (c) 2014 www.marcgomez.work. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface AboutUsViewController : UIViewController {
12+
IBOutlet UIButton *mail_bt;
13+
IBOutlet UIButton *twitter_bt;
14+
IBOutlet UIButton *web_bt;
15+
IBOutlet UILabel *label_by;
16+
}
17+
18+
- (IBAction)goMail:(id)sender;
19+
20+
- (IBAction)goTwitter:(id)sender;
21+
22+
- (IBAction)goWeb:(id)sender;
23+
24+
- (IBAction)cancel:(id)sender;
25+
26+
@end

BonDia/AboutUsViewController.m

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//
2+
// AboutUsViewController.m
3+
// BonDia
4+
//
5+
// Created by Marc Gomez <[email protected]> on 2/9/14.
6+
// Copyright (c) 2014 www.marcgomez.work. All rights reserved.
7+
//
8+
9+
#import "AboutUsViewController.h"
10+
#import <Google/Analytics.h>
11+
12+
@implementation AboutUsViewController
13+
14+
- (void)viewDidLoad {
15+
[super viewDidLoad];
16+
17+
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
18+
[tracker set:kGAIScreenName value:@"About Us"];
19+
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];
20+
21+
[[[self navigationController] navigationBar] setBarStyle:UIBarStyleBlackTranslucent];
22+
[self setTitle:@"Autor"];
23+
}
24+
25+
#pragma mark - IBAction
26+
27+
- (IBAction)goMail:(id)sender {
28+
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mailto:[email protected]"]]) {
29+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:[email protected]"]];
30+
} else {
31+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.marcgomez.work"]];
32+
}
33+
}
34+
35+
- (IBAction)goTwitter:(id)sender {
36+
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString: @"twitter://user?id=258800672"]]) {
37+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"twitter://user?id=258800672"]];
38+
} else {
39+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://twitter.com/MarcGoVi"]];
40+
}
41+
}
42+
43+
44+
- (IBAction)goWeb:(id)sender {
45+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.marcgomez.work"]];
46+
}
47+
48+
- (IBAction)cancel:(id)sender {
49+
[self dismissViewControllerAnimated:TRUE completion:nil];
50+
}
51+
52+
#pragma mark - Memory management
53+
54+
- (void)didReceiveMemoryWarning {
55+
[super didReceiveMemoryWarning];
56+
}
57+
58+
@end

BonDia/AppDelegate.h

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// AppDelegate.h
3+
// BonDia
4+
//
5+
// Created by Marc Gomez <[email protected]> on 2/2/14.
6+
// Copyright (c) 2014 www.marcgomez.work. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface AppDelegate : UIResponder <UIApplicationDelegate>
12+
13+
@property (nonatomic, strong) UIWindow *window;
14+
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
15+
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
16+
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
17+
18+
/**
19+
* Save all the data when we close the app.
20+
*/
21+
- (void)saveContext;
22+
23+
/**
24+
* Returns the URL to the application's Documents directory.
25+
*/
26+
- (NSURL *)applicationDocumentsDirectory;
27+
28+
@end

BonDia/AppDelegate.m

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
//
2+
// AppDelegate.m
3+
// BonDia
4+
//
5+
// Created by Marc Gomez <[email protected]> on 2/2/14.
6+
// Copyright (c) 2014 www.marcgomez.work. All rights reserved.
7+
//
8+
9+
#import "AppDelegate.h"
10+
#import <Google/Analytics.h>
11+
#import <unistd.h>
12+
#import "iRate.h"
13+
#import "Article.h"
14+
#import "DetailArticleViewController.h"
15+
16+
@implementation AppDelegate
17+
18+
@synthesize managedObjectContext, managedObjectModel, persistentStoreCoordinator, window;
19+
20+
+ (void)initialize{
21+
//configure iRate
22+
[iRate sharedInstance].daysUntilPrompt = 5;
23+
[iRate sharedInstance].usesUntilPrompt = 15;
24+
[iRate sharedInstance].useAllAvailableLanguages = NO;
25+
}
26+
27+
#pragma mark - UIApplicationDelegate Methods
28+
29+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
30+
[[UIApplication sharedApplication] setStatusBarHidden:NO];
31+
32+
// Configure tracker from GoogleService-Info.plist.
33+
NSError *configureError;
34+
[[GGLContext sharedInstance] configureWithError:&configureError];
35+
NSAssert(!configureError, @"Error configuring Google services: %@", configureError);
36+
// Optional: configure GAI options.
37+
GAI *gai = [GAI sharedInstance];
38+
gai.trackUncaughtExceptions = YES; // report uncaught exceptions
39+
//gai.logger.logLevel = kGAILogLevelVerbose; // remove before app release
40+
41+
return YES;
42+
}
43+
44+
- (void)applicationWillResignActive:(UIApplication *)application {
45+
// 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.
46+
// 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.
47+
}
48+
49+
- (void)applicationDidEnterBackground:(UIApplication *)application {
50+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
51+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
52+
}
53+
54+
- (void)applicationWillEnterForeground:(UIApplication *)application {
55+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
56+
}
57+
58+
- (void)applicationDidBecomeActive:(UIApplication *)application {
59+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
60+
}
61+
62+
- (void)applicationWillTerminate:(UIApplication *)application {
63+
// Saves changes in the application's managed object context before the application terminates.
64+
[self saveContext];
65+
}
66+
67+
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
68+
if ([url isFileURL]) {
69+
// We've been given a file, not a network URL. For our purposes, that means it's an
70+
// Airdrop receipt. We'll extract the original URL from the file and continue
71+
// as if we'd been passed it normally.
72+
NSData *fileData = [NSData dataWithContentsOfURL:url];
73+
[[NSFileManager defaultManager] removeItemAtPath:[url path] error:nil];
74+
NSDictionary* dict = [NSDictionary dictionaryWithObject:fileData forKey:@"fileDataNotification"];
75+
[[NSNotificationCenter defaultCenter] postNotificationName:@"airDropDetailArticleNotification" object:nil userInfo:dict];
76+
return YES;
77+
}
78+
return NO;
79+
}
80+
81+
#pragma mark - Core Data stack
82+
83+
- (void)saveContext {
84+
NSError *error = nil;
85+
if (managedObjectContext != nil) {
86+
if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
87+
NSLog(@"AppDelegate - Impossible save changes. Details: %@, %@", error, [error userInfo]);
88+
abort();
89+
}
90+
}
91+
}
92+
93+
// Returns the managed object context for the application.
94+
// If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
95+
- (NSManagedObjectContext *)managedObjectContext {
96+
if (managedObjectContext != nil) {
97+
return managedObjectContext;
98+
}
99+
100+
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
101+
if (coordinator != nil) {
102+
managedObjectContext = [[NSManagedObjectContext alloc] init];
103+
[managedObjectContext setPersistentStoreCoordinator: coordinator];
104+
}
105+
return managedObjectContext;
106+
}
107+
108+
// Returns the managed object model for the application.
109+
// If the model doesn't already exist, it is created from the application's model.
110+
- (NSManagedObjectModel *)managedObjectModel {
111+
if (managedObjectModel != nil) {
112+
return managedObjectModel;
113+
}
114+
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"BonDia" withExtension:@"momd"];
115+
managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
116+
return managedObjectModel;
117+
}
118+
119+
// Returns the persistent store coordinator for the application.
120+
// If the coordinator doesn't already exist, it is created and the application's store added to it.
121+
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
122+
if (persistentStoreCoordinator != nil) {
123+
return persistentStoreCoordinator;
124+
}
125+
126+
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"BonDia.sqlite"];
127+
128+
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
129+
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
130+
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
131+
132+
NSError *error = nil;
133+
persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
134+
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error]) {
135+
NSLog(@"AppDelegate - Impossible addind persistent store coordinator. Details: %@, %@", error, [error userInfo]);
136+
abort();
137+
}
138+
139+
return persistentStoreCoordinator;
140+
}
141+
142+
#pragma mark - Application's Documents directory
143+
144+
- (NSURL *)applicationDocumentsDirectory {
145+
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
146+
}
147+
148+
@end

BonDia/Article.h

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// Article.h
3+
// BonDia
4+
//
5+
// Created by Marc Gomez <[email protected]> on 2/10/14.
6+
// Copyright (c) 2014 www.marcgomez.work. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import <CoreData/CoreData.h>
11+
12+
@interface Article : NSManagedObject
13+
14+
@property (nonatomic) int32_t idArticle;
15+
@property (nonatomic, retain) NSString * title;
16+
@property (nonatomic, retain) NSString * dateString;
17+
@property (nonatomic) double dateTimestamp;
18+
@property (nonatomic, retain) NSString * author;
19+
@property (nonatomic, retain) NSString * section;
20+
@property (nonatomic) int32_t sectionInt;
21+
@property (nonatomic, retain) NSString * body;
22+
@property (nonatomic, retain) NSData * image;
23+
@property (nonatomic, retain) NSData * image2;
24+
@property (nonatomic, retain) NSString * urlImage;
25+
@property (nonatomic, retain) NSString * urlImage2;
26+
@property (nonatomic, retain) NSString * urlArticle;
27+
@property (nonatomic) BOOL loadingImage;
28+
29+
- (void)setDataFromDictionary:(NSDictionary *)dict;
30+
31+
- (NSString *)parseImageURL:(NSString *)imageURL;
32+
33+
- (void)setDataFromAirDrop:(NSDictionary *)dict;
34+
35+
@end

0 commit comments

Comments
 (0)