Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Memify.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
92B9EBAB1971AC680037E036 /* FormViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 92B9EBA91971AC680037E036 /* FormViewController.xib */; };
92B9EBB01971B81F0037E036 /* DropAnimationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 92B9EBAF1971B81F0037E036 /* DropAnimationController.m */; };
92BD4D19197F3F3F0047010E /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92BD4D18197F3F3F0047010E /* Social.framework */; };
92BD4D1C198010200047010E /* Card.m in Sources */ = {isa = PBXBuildFile; fileRef = 92BD4D1B198010200047010E /* Card.m */; };
92BD4D29198011FD0047010E /* ImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 92BD4D28198011FD0047010E /* ImageView.m */; };
92BD4D2F198012F50047010E /* CardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 92BD4D2E198012F50047010E /* CardView.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -96,6 +99,12 @@
92B9EBAE1971B81F0037E036 /* DropAnimationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DropAnimationController.h; sourceTree = "<group>"; };
92B9EBAF1971B81F0037E036 /* DropAnimationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DropAnimationController.m; sourceTree = "<group>"; };
92BD4D18197F3F3F0047010E /* Social.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; };
92BD4D1A198010200047010E /* Card.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Card.h; sourceTree = "<group>"; };
92BD4D1B198010200047010E /* Card.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Card.m; sourceTree = "<group>"; };
92BD4D27198011FD0047010E /* ImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageView.h; sourceTree = "<group>"; };
92BD4D28198011FD0047010E /* ImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageView.m; sourceTree = "<group>"; };
92BD4D2D198012F50047010E /* CardView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CardView.h; sourceTree = "<group>"; };
92BD4D2E198012F50047010E /* CardView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CardView.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -191,6 +200,8 @@
92B9EBA91971AC680037E036 /* FormViewController.xib */,
927A4E3C1966603E00444506 /* LoginViewController.xib */,
927A4E371966600500444506 /* HomeViewController.xib */,
92BD4D1F1980116A0047010E /* Card Views */,
92BD4D1D198010290047010E /* Card Models */,
92B9EBB21971C0AE0037E036 /* Delegates */,
92B9EBB11971C08F0037E036 /* Animation Controllers */,
927A4E1819665F8100444506 /* Images.xcassets */,
Expand Down Expand Up @@ -248,6 +259,26 @@
name = Delegates;
sourceTree = "<group>";
};
92BD4D1D198010290047010E /* Card Models */ = {
isa = PBXGroup;
children = (
92BD4D1B198010200047010E /* Card.m */,
92BD4D1A198010200047010E /* Card.h */,
);
name = "Card Models";
sourceTree = "<group>";
};
92BD4D1F1980116A0047010E /* Card Views */ = {
isa = PBXGroup;
children = (
92BD4D27198011FD0047010E /* ImageView.h */,
92BD4D28198011FD0047010E /* ImageView.m */,
92BD4D2D198012F50047010E /* CardView.h */,
92BD4D2E198012F50047010E /* CardView.m */,
);
name = "Card Views";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -388,6 +419,9 @@
927A4E1319665F8100444506 /* main.m in Sources */,
927A4E1719665F8100444506 /* RSAppDelegate.m in Sources */,
92B9EBAA1971AC680037E036 /* FormViewController.m in Sources */,
92BD4D1C198010200047010E /* Card.m in Sources */,
92BD4D2F198012F50047010E /* CardView.m in Sources */,
92BD4D29198011FD0047010E /* ImageView.m in Sources */,
927A4E381966600500444506 /* HomeViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
18 changes: 18 additions & 0 deletions Memify/Card.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Card.h
// Memify
//
// Created by Ryan Sickles on 7/23/14.
// Copyright (c) 2014 sickles.ryan. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Card : NSObject

@property (nonatomic, strong) UIImage *image;
@property (nonatomic, strong) UIImage *senderProPic;
@property (nonatomic, copy) NSString *senderName;

- (instancetype)initWithName:(NSString *)senderName image:(UIImage *)image image:(UIImage *)senderProPic;
@end
25 changes: 25 additions & 0 deletions Memify/Card.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Card.m
// Memify
//
// Created by Ryan Sickles on 7/23/14.
// Copyright (c) 2014 sickles.ryan. All rights reserved.
//

#import "Card.h"

@implementation Card

#pragma mark - Object Lifecycle

- (instancetype)initWithName:(NSString *)senderName image:(UIImage *)image image:(UIImage *)senderProPic{
self = [super init];
if (self) {
_senderName = senderName;
_image = image;
_senderProPic = senderProPic;
}
return self;
}

@end
18 changes: 18 additions & 0 deletions Memify/CardView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// CardView.h
// Memify
//
// Created by Ryan Sickles on 7/23/14.
// Copyright (c) 2014 sickles.ryan. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <MDCSwipeToChoose/MDCSwipeToChoose.h>

@class Card;

@interface CardView : MDCSwipeToChooseView

@property (nonatomic, strong, readonly) Card *card;
- (instancetype)initWithFrame:(CGRect)frame card:(Card *)card options:(MDCSwipeToChooseViewOptions *)options;
@end
114 changes: 114 additions & 0 deletions Memify/CardView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
//
// CardView.m
// Memify
//
// Created by Ryan Sickles on 7/23/14.
// Copyright (c) 2014 sickles.ryan. All rights reserved.
//

#import "CardView.h"
#import "ImageView.h"
#import "Card.h"

static const CGFloat ChoosePersonViewImageLabelWidth = 42.f;
@interface CardView ()
@property (nonatomic, strong) UIView *informationView;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) ImageView *cameraImageLabelView;
@property (nonatomic, strong) ImageView *interestsImageLabelView;
@property (nonatomic, strong) ImageView *friendsImageLabelView;
@end

@implementation CardView


- (instancetype)initWithFrame:(CGRect)frame card:(Card *)card options:(MDCSwipeToChooseViewOptions *)options
{
self = [super initWithFrame:frame];
if (self) {
_card = card;
self.imageView.image = _card.image;
NSLog(@"THIS IS THE CARD IMAGE %@",_card);
self.autoresizingMask = UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleBottomMargin;
self.imageView.autoresizingMask = self.autoresizingMask;

[self constructInformationView];
}
return self;
}

#pragma mark - Internal Methods

- (void)constructInformationView {
CGFloat bottomHeight = 60.f;
CGRect bottomFrame = CGRectMake(0,
CGRectGetHeight(self.bounds) - bottomHeight,
CGRectGetWidth(self.bounds),
bottomHeight);
_informationView = [[UIView alloc] initWithFrame:bottomFrame];
_informationView.backgroundColor = [UIColor whiteColor];
_informationView.clipsToBounds = YES;
_informationView.autoresizingMask = UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleTopMargin;
[self addSubview:_informationView];

[self constructNameLabel];
[self constructCameraImageLabelView];
[self constructInterestsImageLabelView];
[self constructFriendsImageLabelView];
}

- (void)constructNameLabel {
CGFloat leftPadding = 12.f;
CGFloat topPadding = 17.f;
CGRect frame = CGRectMake(leftPadding,
topPadding,
floorf(CGRectGetWidth(_informationView.frame)/2),
CGRectGetHeight(_informationView.frame) - topPadding);
_nameLabel = [[UILabel alloc] initWithFrame:frame];
_nameLabel.text = [NSString stringWithFormat:@"%@",@"Sender Name"];
[_informationView addSubview:_nameLabel];
}


- (void)constructCameraImageLabelView {
CGFloat rightPadding = 10.f;
UIImage *image = [UIImage imageNamed:@"camera"];
_cameraImageLabelView = [self buildImageLabelViewLeftOf:CGRectGetWidth(_informationView.bounds) - rightPadding
image:image
text:@"asdf"];
[_informationView addSubview:_cameraImageLabelView];
}

- (void)constructInterestsImageLabelView {
UIImage *image = [UIImage imageNamed:@"book"];
_interestsImageLabelView = [self buildImageLabelViewLeftOf:CGRectGetMinX(_cameraImageLabelView.frame)
image:image
text:@"asdf"];
[_informationView addSubview:_interestsImageLabelView];
}

- (void)constructFriendsImageLabelView {
UIImage *image = [UIImage imageNamed:@"group"];
_friendsImageLabelView = [self buildImageLabelViewLeftOf:CGRectGetMinX(_interestsImageLabelView.frame)
image:image
text:@"asdf"];
[_informationView addSubview:_friendsImageLabelView];
}

- (ImageView *)buildImageLabelViewLeftOf:(CGFloat)x image:(UIImage *)image text:(NSString *)text {
CGRect frame = CGRectMake(x - ChoosePersonViewImageLabelWidth,
0,
ChoosePersonViewImageLabelWidth,
CGRectGetHeight(_informationView.bounds));
ImageView *view = [[ImageView alloc] initWithFrame:frame
image:image
text:text];
view.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
return view;
}


@end
3 changes: 2 additions & 1 deletion Memify/FormViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
@property (strong,nonatomic) NSString *userId;
@property (strong,nonatomic) NSString *media_reference;
@property (strong,nonatomic) NSString *source_type;
@property (strong, nonatomic) IBOutlet NSString *message_text;
@property (strong, nonatomic) NSString *message_text;
@property (strong, nonatomic) NSDictionary *userData;
@end
26 changes: 19 additions & 7 deletions Memify/FormViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- (void)viewDidLoad
{
[super viewDidLoad];
self.message_text = @"Nothing was entered";
self.source_type = @"Internet";
[self.taskBar addTarget:self action:@selector(taskBarAction:) forControlEvents:UIControlEventValueChanged];
FBRequest *request = [FBRequest requestForMe];
// Send request to Facebook
Expand Down Expand Up @@ -273,13 +275,13 @@ -(void)saveImageSelectedtoUser:(UIImage*)image friends:(NSMutableArray *)friends
//Picture is sent so remove all recipients!
PFObject *card = [PFObject objectWithClassName:@"Cards"];
[card setObject:self.media_reference forKey:@"media_reference"];
NSLog(@"he");
[card setObject:mediaType forKey:@"media_type"];
NSLog(@"hi");
[card setObject:self.source_type forKey:@"source_type"];
NSLog(@"ha");
[card setObject:self.message_text forKey:@"message"];
//[card setObject:self.active_state forKey:@"active_state"]; add to homeview based on swipe
////[card setObject:self.flipped forKey:@"flipped"]; add to homeview based on swipe
//[card setObject:[[PFUser currentUser] username] forKey:@"senderName"];

NSLog(@"hiii");
[card saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if(error){
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please Try Sending Picture Again" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
Expand All @@ -288,9 +290,19 @@ -(void)saveImageSelectedtoUser:(UIImage*)image friends:(NSMutableArray *)friends
}
else{
self.memeImage = nil;
//save to parse is successful!
//go to back to homepage

//save Card to parse is successful now add cards to recipients
PFObject *junctionTable = [PFObject objectWithClassName:@"Junction"];
FBRequest *request = [FBRequest requestForMe];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
self.userData = (NSDictionary *)result;
for (int arrayIndex=0; arrayIndex<[self.friendsList count]; arrayIndex++) {
[junctionTable setObject:self.userData[@"id"] forKey:@"SenderId"];
[junctionTable setObject:[self.friendsList objectAtIndex:arrayIndex ] forKey:@"RecipientId"];
[junctionTable setObject:card.objectId forKey:@"CardId"];
[junctionTable saveEventually];
}

}];
}
}];
}
Expand Down
11 changes: 8 additions & 3 deletions Memify/HomeViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
#import "FormViewController.h"
#import "DropAnimationController.h"
#import <Parse/Parse.h>
#import "CardView.h"
@class LoginViewController;

@interface HomeViewController : UIViewController <NSURLConnectionDelegate,UIViewControllerTransitioningDelegate>
@interface HomeViewController : UIViewController <NSURLConnectionDelegate,UIViewControllerTransitioningDelegate,MDCSwipeToChooseDelegate>
{
NSMutableData *_imageData;
LoginViewController *login;
Expand All @@ -24,8 +25,12 @@
@property CGFloat boundsy;
@property (nonatomic,strong) UIColor *mainColor;
@property (nonatomic,strong) NSString *boldFontName;
@property (strong, nonatomic) IBOutlet UIImageView *cardImage;
@property (strong, nonatomic) PFObject *firstImage;
@property (strong,nonatomic) NSString *userId;
@property NSInteger *active_state;
@property (strong,nonatomic) NSNumber *active_state;
@property (strong,nonatomic) NSNumber *flipped;
//card properties
@property (nonatomic, strong) Card *currentCard;
@property (nonatomic, strong) CardView *frontCardView;
@property (nonatomic, strong) CardView *backCardView;
@end
Loading