added copy individual photos from Friends
This commit is contained in:
parent
f8f5d506e0
commit
f18d52411c
13 changed files with 195 additions and 103 deletions
|
@ -25,6 +25,8 @@
|
||||||
CD63EE7E191065C300153F49 /* OARequestParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = CD63EE5E191065C300153F49 /* OARequestParameter.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
CD63EE7E191065C300153F49 /* OARequestParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = CD63EE5E191065C300153F49 /* OARequestParameter.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||||
CD63EE80191065C300153F49 /* OAServiceTicket.m in Sources */ = {isa = PBXBuildFile; fileRef = CD63EE62191065C300153F49 /* OAServiceTicket.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
CD63EE80191065C300153F49 /* OAServiceTicket.m in Sources */ = {isa = PBXBuildFile; fileRef = CD63EE62191065C300153F49 /* OAServiceTicket.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||||
CD63EE82191065C300153F49 /* OAToken.m in Sources */ = {isa = PBXBuildFile; fileRef = CD63EE67191065C300153F49 /* OAToken.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
CD63EE82191065C300153F49 /* OAToken.m in Sources */ = {isa = PBXBuildFile; fileRef = CD63EE67191065C300153F49 /* OAToken.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||||
|
CDBE75A519196F50004710F2 /* Timeline.m in Sources */ = {isa = PBXBuildFile; fileRef = CDBE75A419196F50004710F2 /* Timeline.m */; };
|
||||||
|
CDBE75A81919706D004710F2 /* PhotoFriendUploader.m in Sources */ = {isa = PBXBuildFile; fileRef = CDBE75A71919706D004710F2 /* PhotoFriendUploader.m */; };
|
||||||
CDD9E4F818A144E4006EEC0D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4F718A144E4006EEC0D /* Foundation.framework */; };
|
CDD9E4F818A144E4006EEC0D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4F718A144E4006EEC0D /* Foundation.framework */; };
|
||||||
CDD9E4FA18A144E4006EEC0D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4F918A144E4006EEC0D /* CoreGraphics.framework */; };
|
CDD9E4FA18A144E4006EEC0D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4F918A144E4006EEC0D /* CoreGraphics.framework */; };
|
||||||
CDD9E4FC18A144E4006EEC0D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4FB18A144E4006EEC0D /* UIKit.framework */; };
|
CDD9E4FC18A144E4006EEC0D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDD9E4FB18A144E4006EEC0D /* UIKit.framework */; };
|
||||||
|
@ -41,7 +43,6 @@
|
||||||
CDD9E52318A144E4006EEC0D /* TroveboxTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E52218A144E4006EEC0D /* TroveboxTests.m */; };
|
CDD9E52318A144E4006EEC0D /* TroveboxTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E52218A144E4006EEC0D /* TroveboxTests.m */; };
|
||||||
CDD9E56018A1467F006EEC0D /* Synced+Methods.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55418A1467F006EEC0D /* Synced+Methods.m */; };
|
CDD9E56018A1467F006EEC0D /* Synced+Methods.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55418A1467F006EEC0D /* Synced+Methods.m */; };
|
||||||
CDD9E56118A1467F006EEC0D /* Timeline+Methods.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55618A1467F006EEC0D /* Timeline+Methods.m */; };
|
CDD9E56118A1467F006EEC0D /* Timeline+Methods.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55618A1467F006EEC0D /* Timeline+Methods.m */; };
|
||||||
CDD9E56218A1467F006EEC0D /* Timeline.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55818A1467F006EEC0D /* Timeline.m */; };
|
|
||||||
CDD9E56318A1467F006EEC0D /* Photo.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55918A1467F006EEC0D /* Photo.xcdatamodel */; };
|
CDD9E56318A1467F006EEC0D /* Photo.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55918A1467F006EEC0D /* Photo.xcdatamodel */; };
|
||||||
CDD9E56418A1467F006EEC0D /* Photo.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55B18A1467F006EEC0D /* Photo.m */; };
|
CDD9E56418A1467F006EEC0D /* Photo.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55B18A1467F006EEC0D /* Photo.m */; };
|
||||||
CDD9E56518A1467F006EEC0D /* Synced.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55D18A1467F006EEC0D /* Synced.m */; };
|
CDD9E56518A1467F006EEC0D /* Synced.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD9E55D18A1467F006EEC0D /* Synced.m */; };
|
||||||
|
@ -207,6 +208,10 @@
|
||||||
CD63EE66191065C300153F49 /* OAToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OAToken.h; sourceTree = "<group>"; };
|
CD63EE66191065C300153F49 /* OAToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OAToken.h; sourceTree = "<group>"; };
|
||||||
CD63EE67191065C300153F49 /* OAToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OAToken.m; sourceTree = "<group>"; };
|
CD63EE67191065C300153F49 /* OAToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OAToken.m; sourceTree = "<group>"; };
|
||||||
CD63EE6A191065C300153F49 /* OAuthConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OAuthConsumer.h; sourceTree = "<group>"; };
|
CD63EE6A191065C300153F49 /* OAuthConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OAuthConsumer.h; sourceTree = "<group>"; };
|
||||||
|
CDBE75A319196F50004710F2 /* Timeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timeline.h; sourceTree = "<group>"; };
|
||||||
|
CDBE75A419196F50004710F2 /* Timeline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Timeline.m; sourceTree = "<group>"; };
|
||||||
|
CDBE75A61919706D004710F2 /* PhotoFriendUploader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoFriendUploader.h; sourceTree = "<group>"; };
|
||||||
|
CDBE75A71919706D004710F2 /* PhotoFriendUploader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoFriendUploader.m; sourceTree = "<group>"; };
|
||||||
CDD9E4F418A144E4006EEC0D /* Trovebox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Trovebox.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
CDD9E4F418A144E4006EEC0D /* Trovebox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Trovebox.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
CDD9E4F718A144E4006EEC0D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
CDD9E4F718A144E4006EEC0D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||||
CDD9E4F918A144E4006EEC0D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
CDD9E4F918A144E4006EEC0D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||||
|
@ -228,8 +233,6 @@
|
||||||
CDD9E55418A1467F006EEC0D /* Synced+Methods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Synced+Methods.m"; sourceTree = "<group>"; };
|
CDD9E55418A1467F006EEC0D /* Synced+Methods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Synced+Methods.m"; sourceTree = "<group>"; };
|
||||||
CDD9E55518A1467F006EEC0D /* Timeline+Methods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Timeline+Methods.h"; sourceTree = "<group>"; };
|
CDD9E55518A1467F006EEC0D /* Timeline+Methods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Timeline+Methods.h"; sourceTree = "<group>"; };
|
||||||
CDD9E55618A1467F006EEC0D /* Timeline+Methods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Timeline+Methods.m"; sourceTree = "<group>"; };
|
CDD9E55618A1467F006EEC0D /* Timeline+Methods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Timeline+Methods.m"; sourceTree = "<group>"; };
|
||||||
CDD9E55718A1467F006EEC0D /* Timeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timeline.h; sourceTree = "<group>"; };
|
|
||||||
CDD9E55818A1467F006EEC0D /* Timeline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Timeline.m; sourceTree = "<group>"; };
|
|
||||||
CDD9E55918A1467F006EEC0D /* Photo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Photo.xcdatamodel; sourceTree = "<group>"; };
|
CDD9E55918A1467F006EEC0D /* Photo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Photo.xcdatamodel; sourceTree = "<group>"; };
|
||||||
CDD9E55A18A1467F006EEC0D /* Photo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Photo.h; sourceTree = "<group>"; };
|
CDD9E55A18A1467F006EEC0D /* Photo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Photo.h; sourceTree = "<group>"; };
|
||||||
CDD9E55B18A1467F006EEC0D /* Photo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Photo.m; sourceTree = "<group>"; };
|
CDD9E55B18A1467F006EEC0D /* Photo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Photo.m; sourceTree = "<group>"; };
|
||||||
|
@ -651,9 +654,9 @@
|
||||||
CDD9E55418A1467F006EEC0D /* Synced+Methods.m */,
|
CDD9E55418A1467F006EEC0D /* Synced+Methods.m */,
|
||||||
CDD9E55518A1467F006EEC0D /* Timeline+Methods.h */,
|
CDD9E55518A1467F006EEC0D /* Timeline+Methods.h */,
|
||||||
CDD9E55618A1467F006EEC0D /* Timeline+Methods.m */,
|
CDD9E55618A1467F006EEC0D /* Timeline+Methods.m */,
|
||||||
CDD9E55718A1467F006EEC0D /* Timeline.h */,
|
|
||||||
CDD9E55818A1467F006EEC0D /* Timeline.m */,
|
|
||||||
CDD9E55918A1467F006EEC0D /* Photo.xcdatamodel */,
|
CDD9E55918A1467F006EEC0D /* Photo.xcdatamodel */,
|
||||||
|
CDBE75A319196F50004710F2 /* Timeline.h */,
|
||||||
|
CDBE75A419196F50004710F2 /* Timeline.m */,
|
||||||
CDD9E55A18A1467F006EEC0D /* Photo.h */,
|
CDD9E55A18A1467F006EEC0D /* Photo.h */,
|
||||||
CDD9E55B18A1467F006EEC0D /* Photo.m */,
|
CDD9E55B18A1467F006EEC0D /* Photo.m */,
|
||||||
CDD9E55C18A1467F006EEC0D /* Synced.h */,
|
CDD9E55C18A1467F006EEC0D /* Synced.h */,
|
||||||
|
@ -906,6 +909,8 @@
|
||||||
CD3DA77C19143FE200C4B5C9 /* FriendDetailsViewController.m */,
|
CD3DA77C19143FE200C4B5C9 /* FriendDetailsViewController.m */,
|
||||||
CD3DA77E19143FE200C4B5C9 /* FriendDetailsViewControlleriPad.xib */,
|
CD3DA77E19143FE200C4B5C9 /* FriendDetailsViewControlleriPad.xib */,
|
||||||
CD3DA77F19143FE200C4B5C9 /* FriendDetailsViewController.xib */,
|
CD3DA77F19143FE200C4B5C9 /* FriendDetailsViewController.xib */,
|
||||||
|
CDBE75A61919706D004710F2 /* PhotoFriendUploader.h */,
|
||||||
|
CDBE75A71919706D004710F2 /* PhotoFriendUploader.m */,
|
||||||
);
|
);
|
||||||
name = Friends;
|
name = Friends;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1077,7 +1082,6 @@
|
||||||
CDD9E65918A147A7006EEC0D /* CoreDataTableViewController.m in Sources */,
|
CDD9E65918A147A7006EEC0D /* CoreDataTableViewController.m in Sources */,
|
||||||
CDD9E62A18A1478F006EEC0D /* WebService.m in Sources */,
|
CDD9E62A18A1478F006EEC0D /* WebService.m in Sources */,
|
||||||
CDD9E60218A14754006EEC0D /* MWCaptionView.m in Sources */,
|
CDD9E60218A14754006EEC0D /* MWCaptionView.m in Sources */,
|
||||||
CDD9E56218A1467F006EEC0D /* Timeline.m in Sources */,
|
|
||||||
CDD9E59A18A146CC006EEC0D /* MenuTableViewSectionCell.m in Sources */,
|
CDD9E59A18A146CC006EEC0D /* MenuTableViewSectionCell.m in Sources */,
|
||||||
CDD9E57E18A1469E006EEC0D /* LoginConnectViewController.m in Sources */,
|
CDD9E57E18A1469E006EEC0D /* LoginConnectViewController.m in Sources */,
|
||||||
CD63EE7A191065C300153F49 /* OAMutableURLRequest.m in Sources */,
|
CD63EE7A191065C300153F49 /* OAMutableURLRequest.m in Sources */,
|
||||||
|
@ -1129,6 +1133,7 @@
|
||||||
CDD9E65B18A147A7006EEC0D /* Constants.m in Sources */,
|
CDD9E65B18A147A7006EEC0D /* Constants.m in Sources */,
|
||||||
CDD9E5D218A1472A006EEC0D /* JobUploaderController.m in Sources */,
|
CDD9E5D218A1472A006EEC0D /* JobUploaderController.m in Sources */,
|
||||||
CDD9E65E18A147A7006EEC0D /* NSDictionarySerializer.m in Sources */,
|
CDD9E65E18A147A7006EEC0D /* NSDictionarySerializer.m in Sources */,
|
||||||
|
CDBE75A81919706D004710F2 /* PhotoFriendUploader.m in Sources */,
|
||||||
CDD9E5BE18A14707006EEC0D /* OpenPhotoIASKAppSettingsViewController.m in Sources */,
|
CDD9E5BE18A14707006EEC0D /* OpenPhotoIASKAppSettingsViewController.m in Sources */,
|
||||||
CDD9E5B218A146EB006EEC0D /* UploadCell.m in Sources */,
|
CDD9E5B218A146EB006EEC0D /* UploadCell.m in Sources */,
|
||||||
CDD9E60918A14754006EEC0D /* TMPhotoQuiltViewCell.m in Sources */,
|
CDD9E60918A14754006EEC0D /* TMPhotoQuiltViewCell.m in Sources */,
|
||||||
|
@ -1158,6 +1163,7 @@
|
||||||
CDD9E56418A1467F006EEC0D /* Photo.m in Sources */,
|
CDD9E56418A1467F006EEC0D /* Photo.m in Sources */,
|
||||||
CDD9E61018A14769006EEC0D /* AlbumViewController.m in Sources */,
|
CDD9E61018A14769006EEC0D /* AlbumViewController.m in Sources */,
|
||||||
CDD9E5E418A1473B006EEC0D /* ELCAssetCell.m in Sources */,
|
CDD9E5E418A1473B006EEC0D /* ELCAssetCell.m in Sources */,
|
||||||
|
CDBE75A519196F50004710F2 /* Timeline.m in Sources */,
|
||||||
CDD9E50618A144E4006EEC0D /* main.m in Sources */,
|
CDD9E50618A144E4006EEC0D /* main.m in Sources */,
|
||||||
CD63EE6D191065C300153F49 /* NSMutableURLRequest+Parameters.m in Sources */,
|
CD63EE6D191065C300153F49 /* NSMutableURLRequest+Parameters.m in Sources */,
|
||||||
CDD9E56118A1467F006EEC0D /* Timeline+Methods.m in Sources */,
|
CDD9E56118A1467F006EEC0D /* Timeline+Methods.m in Sources */,
|
||||||
|
|
|
@ -199,8 +199,13 @@
|
||||||
// set the upload photo object in the cell for restart or cancel
|
// set the upload photo object in the cell for restart or cancel
|
||||||
uploadCell.originalObject = photo;
|
uploadCell.originalObject = photo;
|
||||||
|
|
||||||
// set thumb
|
if ([photo.copyFromFriend boolValue]){
|
||||||
uploadCell.thumb.image = [UIImage imageWithData:photo.photoDataThumb];
|
// show default thumb
|
||||||
|
uploadCell.thumb.image = [UIImage imageNamed:@"Icon.png"];
|
||||||
|
}else{
|
||||||
|
// set thumb
|
||||||
|
uploadCell.thumb.image = [UIImage imageWithData:photo.photoDataThumb];
|
||||||
|
}
|
||||||
[uploadCell.thumb.superview.layer setCornerRadius:3.0f];
|
[uploadCell.thumb.superview.layer setCornerRadius:3.0f];
|
||||||
[uploadCell.thumb.superview.layer setShadowColor:[UIColor blackColor].CGColor];
|
[uploadCell.thumb.superview.layer setShadowColor:[UIColor blackColor].CGColor];
|
||||||
[uploadCell.thumb.superview.layer setShadowOpacity:0.25];
|
[uploadCell.thumb.superview.layer setShadowOpacity:0.25];
|
||||||
|
@ -212,18 +217,32 @@
|
||||||
uploadCell.progressBar.hidden=YES;
|
uploadCell.progressBar.hidden=YES;
|
||||||
|
|
||||||
if ( [photo.status isEqualToString:kUploadStatusTypeCreated]){
|
if ( [photo.status isEqualToString:kUploadStatusTypeCreated]){
|
||||||
uploadCell.status.text=NSLocalizedString(@"Waiting ...",@"Status upload - waiting");
|
if ([photo.copyFromFriend boolValue]){
|
||||||
|
uploadCell.status.text=NSLocalizedString(@"Waiting to copy",@"Waiting to copy");
|
||||||
|
}else{
|
||||||
|
uploadCell.status.text=NSLocalizedString(@"Waiting ...",@"Status upload - waiting");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[uploadCell.imageStatus setImage:[UIImage imageNamed:@"home-waiting.png"]];
|
[uploadCell.imageStatus setImage:[UIImage imageNamed:@"home-waiting.png"]];
|
||||||
uploadCell.imageStatus.hidden=NO;
|
uploadCell.imageStatus.hidden=NO;
|
||||||
uploadCell.status.textColor=UIColorFromRGB(0x3B2414);
|
uploadCell.status.textColor=UIColorFromRGB(0x3B2414);
|
||||||
}else if ( [photo.status isEqualToString:kUploadStatusTypeUploading]){
|
}else if ( [photo.status isEqualToString:kUploadStatusTypeUploading]){
|
||||||
uploadCell.status.text=@"";
|
if ([photo.copyFromFriend boolValue]){
|
||||||
uploadCell.status.textColor=UIColorFromRGB(0x3B2414);
|
uploadCell.status.text=@"Copying ...";
|
||||||
uploadCell.progressBar.hidden=NO;
|
}else{
|
||||||
|
uploadCell.status.text=@"";
|
||||||
|
[uploadCell.progressBar setProgress:[photo.photoUploadProgress floatValue]];
|
||||||
|
uploadCell.progressBar.hidden=NO;
|
||||||
|
}
|
||||||
|
|
||||||
[uploadCell.progressBar setProgress:[photo.photoUploadProgress floatValue]];
|
uploadCell.status.textColor=UIColorFromRGB(0x3B2414);
|
||||||
}else if ( [photo.status isEqualToString:kUploadStatusTypeUploadFinished]){
|
}else if ( [photo.status isEqualToString:kUploadStatusTypeUploadFinished]){
|
||||||
uploadCell.status.text=NSLocalizedString(@"Upload finished!",@"Status upload - Upload finished!");
|
if ([photo.copyFromFriend boolValue]){
|
||||||
|
uploadCell.status.text=NSLocalizedString(@"Copy finished!",@"Status copy - copy finished!");
|
||||||
|
}else{
|
||||||
|
uploadCell.status.text=NSLocalizedString(@"Upload finished!",@"Status upload - Upload finished!");
|
||||||
|
}
|
||||||
uploadCell.status.textColor=UIColorFromRGB(0x3B2414);
|
uploadCell.status.textColor=UIColorFromRGB(0x3B2414);
|
||||||
[uploadCell.imageStatus setImage:[UIImage imageNamed:@"home-finished.png"]];
|
[uploadCell.imageStatus setImage:[UIImage imageNamed:@"home-finished.png"]];
|
||||||
uploadCell.imageStatus.hidden=NO;
|
uploadCell.imageStatus.hidden=NO;
|
||||||
|
@ -251,7 +270,11 @@
|
||||||
// delete this object after 2 seconds
|
// delete this object after 2 seconds
|
||||||
[self performSelector:@selector(deleteTimeline:) withObject:photo afterDelay:2.0];
|
[self performSelector:@selector(deleteTimeline:) withObject:photo afterDelay:2.0];
|
||||||
}else if ( [photo.status isEqualToString:kUploadStatusTypeFailed]){
|
}else if ( [photo.status isEqualToString:kUploadStatusTypeFailed]){
|
||||||
uploadCell.status.text=NSLocalizedString(@"Retry uploading",@"Status upload - Retry uploading!");
|
if ([photo.copyFromFriend boolValue]){
|
||||||
|
uploadCell.status.text=NSLocalizedString(@"Retry copying",@"Status upload - Retry copying!");
|
||||||
|
}else{
|
||||||
|
uploadCell.status.text=NSLocalizedString(@"Retry uploading",@"Status upload - Retry uploading!");
|
||||||
|
}
|
||||||
uploadCell.status.textColor=UIColorFromRGB(0x3B2414);
|
uploadCell.status.textColor=UIColorFromRGB(0x3B2414);
|
||||||
}else if ( [photo.status isEqualToString:kUploadStatusTypeDuplicated]){
|
}else if ( [photo.status isEqualToString:kUploadStatusTypeDuplicated]){
|
||||||
uploadCell.status.text=NSLocalizedString(@"Already in your account",@"Status upload - Already in your account");
|
uploadCell.status.text=NSLocalizedString(@"Already in your account",@"Status upload - Already in your account");
|
||||||
|
@ -425,7 +448,7 @@
|
||||||
self.mwphoto.permission = photo.permission;
|
self.mwphoto.permission = photo.permission;
|
||||||
|
|
||||||
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
|
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
|
||||||
|
|
||||||
// check if user is type GROUP
|
// check if user is type GROUP
|
||||||
// if yes, he should not have access to actions
|
// if yes, he should not have access to actions
|
||||||
NSString *type = [[NSUserDefaults standardUserDefaults] objectForKey:kTroveboxTypeUser];
|
NSString *type = [[NSUserDefaults standardUserDefaults] objectForKey:kTroveboxTypeUser];
|
||||||
|
@ -434,7 +457,7 @@
|
||||||
}else{
|
}else{
|
||||||
browser.displayActionButton = YES;
|
browser.displayActionButton = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:browser];
|
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:browser];
|
||||||
|
|
||||||
// Present
|
// Present
|
||||||
|
|
|
@ -176,14 +176,14 @@
|
||||||
#endif
|
#endif
|
||||||
NSURL *url = [[result valueForProperty:ALAssetPropertyURLs] valueForKey:[[[result valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]];
|
NSURL *url = [[result valueForProperty:ALAssetPropertyURLs] valueForKey:[[[result valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]];
|
||||||
[uploader loadDataAndSaveEntityUploadDate:[NSDate date]
|
[uploader loadDataAndSaveEntityUploadDate:[NSDate date]
|
||||||
shareFacebook:[NSNumber numberWithBool:NO]
|
shareFacebook:[NSNumber numberWithBool:NO]
|
||||||
shareTwitter:[NSNumber numberWithBool:NO]
|
shareTwitter:[NSNumber numberWithBool:NO]
|
||||||
permission:[NSNumber numberWithBool:NO]
|
permission:[NSNumber numberWithBool:NO]
|
||||||
tags:@""
|
tags:@""
|
||||||
albums:@""
|
albums:@""
|
||||||
title:@""
|
title:@""
|
||||||
url:url
|
url:url
|
||||||
groupUrl:nil];
|
groupUrl:nil];
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// stop the enumeration
|
// stop the enumeration
|
||||||
|
@ -253,17 +253,27 @@
|
||||||
// prepare the data to upload
|
// prepare the data to upload
|
||||||
NSString *filename = photo.fileName;
|
NSString *filename = photo.fileName;
|
||||||
|
|
||||||
// set size
|
if (![photo.copyFromFriend boolValue]){
|
||||||
delegate.totalSize = [NSNumber numberWithInteger:data.length];
|
// on upload, not copying
|
||||||
|
// set size
|
||||||
|
delegate.totalSize = [NSNumber numberWithInteger:data.length];
|
||||||
|
}
|
||||||
// create the service, check photo exists and send the request
|
// create the service, check photo exists and send the request
|
||||||
WebService *service = [[WebService alloc] init];
|
WebService *service = [[WebService alloc] init];
|
||||||
|
|
||||||
// before check if the photo already exist
|
// before check if the photo already exist
|
||||||
if ([service isPhotoAlreadyOnServer:[SHA1 sha1File:data]]){
|
if (![photo.copyFromFriend boolValue] &&[service isPhotoAlreadyOnServer:[SHA1 sha1File:data]]){
|
||||||
@throw [NSException exceptionWithName:@"Failed to upload" reason:@"409" userInfo: nil];
|
@throw [NSException exceptionWithName:@"Failed to upload" reason:@"409" userInfo: nil];
|
||||||
}else{
|
}else{
|
||||||
NSDictionary *response = [service uploadPicture:data metadata:dictionary fileName:filename delegate:delegate];
|
NSDictionary *response;
|
||||||
|
|
||||||
|
if ([photo.copyFromFriend boolValue]){
|
||||||
|
// copy
|
||||||
|
response= [service copyPictureWithUrl:photo.photoUrl];
|
||||||
|
}else{
|
||||||
|
response= [service uploadPicture:data metadata:dictionary fileName:filename delegate:delegate];
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEVELOPMENT_ENABLED
|
#ifdef DEVELOPMENT_ENABLED
|
||||||
NSLog(@"Photo uploaded correctly");
|
NSLog(@"Photo uploaded correctly");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#import "MWPhoto.h"
|
#import "MWPhoto.h"
|
||||||
#import "MWPhotoProtocol.h"
|
#import "MWPhotoProtocol.h"
|
||||||
#import "MWCaptionView.h"
|
#import "MWCaptionView.h"
|
||||||
|
#import "PhotoFriendUploader.h"
|
||||||
|
|
||||||
// Debug Logging
|
// Debug Logging
|
||||||
#if 0 // Set to 1 to enable debug logging
|
#if 0 // Set to 1 to enable debug logging
|
||||||
|
|
|
@ -1242,51 +1242,20 @@
|
||||||
#ifdef DEVELOPMENT_ENABLED
|
#ifdef DEVELOPMENT_ENABLED
|
||||||
NSLog(@"Download image");
|
NSLog(@"Download image");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Only react when image has loaded
|
|
||||||
id <MWPhoto> photo = [self photoAtIndex:_currentPageIndex];
|
id <MWPhoto> photo = [self photoAtIndex:_currentPageIndex];
|
||||||
|
|
||||||
// get factory for Service
|
PhotoFriendUploader *upload = [[PhotoFriendUploader alloc]init];
|
||||||
TroveboxServerAPI *service = [[TroveboxServerAPI alloc] init];
|
[upload loadDataAndSaveEntityUrl:photo.url];
|
||||||
|
|
||||||
// progress
|
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Copying"
|
||||||
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
message:@""
|
||||||
|
|
||||||
[service inappropriatePhoto:photo.identification success:^(id response) {
|
|
||||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
||||||
// get default answer
|
|
||||||
TroveboxAnswerAPI *api = [[TroveboxAnswerAPI alloc] initWithAnswer:response];
|
|
||||||
#ifdef DEVELOPMENT_ENABLED
|
|
||||||
NSLog(@"Answer %@",api);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Message received"
|
|
||||||
message:@"Thanks for reporting this photo."
|
|
||||||
delegate:nil
|
delegate:nil
|
||||||
cancelButtonTitle:@"OK"
|
cancelButtonTitle:@"OK"
|
||||||
otherButtonTitles:nil];
|
otherButtonTitles:nil];
|
||||||
[message show];
|
[message show];
|
||||||
|
|
||||||
} failure:^(NSError *error) {
|
|
||||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
||||||
#ifdef DEVELOPMENT_ENABLED
|
|
||||||
NSLog(@"Error %@", error.description);
|
|
||||||
#endif
|
|
||||||
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Error"
|
|
||||||
message:@"Error to send your request. Try again later, please."
|
|
||||||
delegate:nil
|
|
||||||
cancelButtonTitle:@"OK"
|
|
||||||
otherButtonTitles:nil];
|
|
||||||
[message show];
|
|
||||||
}];
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Actions
|
#pragma mark - Actions
|
||||||
|
|
||||||
- (void)actionButtonPressed:(id)sender {
|
- (void)actionButtonPressed:(id)sender {
|
||||||
|
|
|
@ -61,4 +61,7 @@
|
||||||
// in the server
|
// in the server
|
||||||
- (NSString *)identification;
|
- (NSString *)identification;
|
||||||
|
|
||||||
|
// photo url to upload to server in the case of friends
|
||||||
|
- (NSString *)url;
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="2061" systemVersion="12D78" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
|
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="5064" systemVersion="13C1021" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
|
||||||
<entity name="Photo" representedClassName="Photo" syncable="YES">
|
<entity name="Photo" representedClassName="Photo" syncable="YES">
|
||||||
<attribute name="date" optional="YES" attributeType="Date" syncable="YES"/>
|
<attribute name="date" optional="YES" attributeType="Date" syncable="YES"/>
|
||||||
<attribute name="height" optional="YES" attributeType="Float" defaultValueString="0" syncable="YES"/>
|
<attribute name="height" optional="YES" attributeType="Float" defaultValueString="0" syncable="YES"/>
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="Timeline" representedClassName="Timeline" syncable="YES">
|
<entity name="Timeline" representedClassName="Timeline" syncable="YES">
|
||||||
<attribute name="albums" optional="YES" attributeType="String" syncable="YES"/>
|
<attribute name="albums" optional="YES" attributeType="String" syncable="YES"/>
|
||||||
|
<attribute name="copyFromFriend" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
|
||||||
<attribute name="date" optional="YES" attributeType="Date" syncable="YES"/>
|
<attribute name="date" optional="YES" attributeType="Date" syncable="YES"/>
|
||||||
<attribute name="dateUploaded" optional="YES" attributeType="Date" syncable="YES"/>
|
<attribute name="dateUploaded" optional="YES" attributeType="Date" syncable="YES"/>
|
||||||
<attribute name="facebook" optional="YES" attributeType="Boolean" syncable="YES"/>
|
<attribute name="facebook" optional="YES" attributeType="Boolean" syncable="YES"/>
|
||||||
|
@ -47,6 +48,6 @@
|
||||||
<elements>
|
<elements>
|
||||||
<element name="Photo" positionX="160" positionY="192" width="128" height="195"/>
|
<element name="Photo" positionX="160" positionY="192" width="128" height="195"/>
|
||||||
<element name="Synced" positionX="160" positionY="192" width="128" height="105"/>
|
<element name="Synced" positionX="160" positionY="192" width="128" height="105"/>
|
||||||
<element name="Timeline" positionX="160" positionY="192" width="128" height="405"/>
|
<element name="Timeline" positionX="160" positionY="192" width="128" height="420"/>
|
||||||
</elements>
|
</elements>
|
||||||
</model>
|
</model>
|
16
Trovebox/PhotoFriendUploader.h
Normal file
16
Trovebox/PhotoFriendUploader.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// PhotoFriendUploader.h
|
||||||
|
// Trovebox
|
||||||
|
//
|
||||||
|
// Created by Patrick Santana on 06/05/14.
|
||||||
|
// Copyright (c) 2014 Trovebox. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface PhotoFriendUploader : NSObject
|
||||||
|
|
||||||
|
|
||||||
|
- (void) loadDataAndSaveEntityUrl:(NSString *) url;
|
||||||
|
|
||||||
|
@end
|
43
Trovebox/PhotoFriendUploader.m
Normal file
43
Trovebox/PhotoFriendUploader.m
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
//
|
||||||
|
// PhotoFriendUploader.m
|
||||||
|
// Trovebox
|
||||||
|
//
|
||||||
|
// Created by Patrick Santana on 06/05/14.
|
||||||
|
// Copyright (c) 2014 Trovebox. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "PhotoFriendUploader.h"
|
||||||
|
|
||||||
|
@implementation PhotoFriendUploader
|
||||||
|
|
||||||
|
|
||||||
|
- (void) loadDataAndSaveEntityUrl:(NSString *) url
|
||||||
|
{
|
||||||
|
//in the main queue, generate TimelinePhotos
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
@autoreleasepool{
|
||||||
|
|
||||||
|
// data to be saved in the database
|
||||||
|
Timeline *uploadInfo = [NSEntityDescription insertNewObjectForEntityForName:@"Timeline"
|
||||||
|
inManagedObjectContext:[SharedAppDelegate managedObjectContext]];
|
||||||
|
|
||||||
|
// details form this upload
|
||||||
|
uploadInfo.date = [NSDate date];
|
||||||
|
uploadInfo.dateUploaded = [NSDate date];
|
||||||
|
uploadInfo.facebook = [NSNumber numberWithBool:NO];
|
||||||
|
uploadInfo.twitter = [NSNumber numberWithBool:NO];
|
||||||
|
uploadInfo.permission = [NSNumber numberWithBool:NO];
|
||||||
|
uploadInfo.title = @"";
|
||||||
|
uploadInfo.tags=@"";
|
||||||
|
uploadInfo.albums=@"";
|
||||||
|
uploadInfo.status=kUploadStatusTypeCreated;
|
||||||
|
uploadInfo.userUrl = [SharedAppDelegate userHost];
|
||||||
|
uploadInfo.photoToUpload = [NSNumber numberWithBool:YES];
|
||||||
|
uploadInfo.photoUrl = url;
|
||||||
|
uploadInfo.copyFromFriend = [NSNumber numberWithBool:YES];
|
||||||
|
uploadInfo.photoDataTempUrl=@"";
|
||||||
|
uploadInfo.fileName=@"";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@end
|
|
@ -2,20 +2,8 @@
|
||||||
// Timeline.h
|
// Timeline.h
|
||||||
// Trovebox
|
// Trovebox
|
||||||
//
|
//
|
||||||
// Created by Patrick Santana on 17/04/13.
|
// Created by Patrick Santana on 06/05/14.
|
||||||
// Copyright 2013 Trovebox
|
// Copyright (c) 2014 Trovebox. All rights reserved.
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
@ -24,6 +12,7 @@
|
||||||
|
|
||||||
@interface Timeline : NSManagedObject
|
@interface Timeline : NSManagedObject
|
||||||
|
|
||||||
|
@property (nonatomic, retain) NSString * albums;
|
||||||
@property (nonatomic, retain) NSDate * date;
|
@property (nonatomic, retain) NSDate * date;
|
||||||
@property (nonatomic, retain) NSDate * dateUploaded;
|
@property (nonatomic, retain) NSDate * dateUploaded;
|
||||||
@property (nonatomic, retain) NSNumber * facebook;
|
@property (nonatomic, retain) NSNumber * facebook;
|
||||||
|
@ -47,6 +36,6 @@
|
||||||
@property (nonatomic, retain) NSString * title;
|
@property (nonatomic, retain) NSString * title;
|
||||||
@property (nonatomic, retain) NSNumber * twitter;
|
@property (nonatomic, retain) NSNumber * twitter;
|
||||||
@property (nonatomic, retain) NSString * userUrl;
|
@property (nonatomic, retain) NSString * userUrl;
|
||||||
@property (nonatomic, retain) NSString * albums;
|
@property (nonatomic, retain) NSNumber * copyFromFriend;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -2,20 +2,8 @@
|
||||||
// Timeline.m
|
// Timeline.m
|
||||||
// Trovebox
|
// Trovebox
|
||||||
//
|
//
|
||||||
// Created by Patrick Santana on 17/04/13.
|
// Created by Patrick Santana on 06/05/14.
|
||||||
// Copyright 2013 Trovebox
|
// Copyright (c) 2014 Trovebox. All rights reserved.
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "Timeline.h"
|
#import "Timeline.h"
|
||||||
|
@ -23,6 +11,7 @@
|
||||||
|
|
||||||
@implementation Timeline
|
@implementation Timeline
|
||||||
|
|
||||||
|
@dynamic albums;
|
||||||
@dynamic date;
|
@dynamic date;
|
||||||
@dynamic dateUploaded;
|
@dynamic dateUploaded;
|
||||||
@dynamic facebook;
|
@dynamic facebook;
|
||||||
|
@ -46,6 +35,6 @@
|
||||||
@dynamic title;
|
@dynamic title;
|
||||||
@dynamic twitter;
|
@dynamic twitter;
|
||||||
@dynamic userUrl;
|
@dynamic userUrl;
|
||||||
@dynamic albums;
|
@dynamic copyFromFriend;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -33,10 +33,10 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initForServer:(NSString *) server
|
- (id)initForServer:(NSString *) server
|
||||||
oAuthKey:(NSString *) oAuthKey
|
oAuthKey:(NSString *) oAuthKey
|
||||||
oAuthSecret:(NSString *) oAuthSecret
|
oAuthSecret:(NSString *) oAuthSecret
|
||||||
consumerKey:(NSString *) consumerKey
|
consumerKey:(NSString *) consumerKey
|
||||||
consumerSecret:(NSString *) consumerSecret;
|
consumerSecret:(NSString *) consumerSecret;
|
||||||
|
|
||||||
- (NSArray *) fetchNewestPhotosMaxResult:(int) maxResult;
|
- (NSArray *) fetchNewestPhotosMaxResult:(int) maxResult;
|
||||||
|
@ -85,4 +85,5 @@
|
||||||
- (NSArray *) loadGallery:(int) pageSize onPage:(int) page forSite:(NSString*) site;
|
- (NSArray *) loadGallery:(int) pageSize onPage:(int) page forSite:(NSString*) site;
|
||||||
- (NSArray *) loadGallery:(int) pageSize onPage:(int) page album:(Album*) album forSite:(NSString*) site;
|
- (NSArray *) loadGallery:(int) pageSize onPage:(int) page album:(Album*) album forSite:(NSString*) site;
|
||||||
- (NSArray *) loadAlbums:(int) pageSize onPage:(int) page version:(NSString *) serverVersion forSite:(NSString*) site;
|
- (NSArray *) loadAlbums:(int) pageSize onPage:(int) page version:(NSString *) serverVersion forSite:(NSString*) site;
|
||||||
|
- (NSDictionary *) copyPictureWithUrl:(NSString*) photoUrl;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -172,6 +172,47 @@
|
||||||
[asiRequest setTimeOutSeconds:240];
|
[asiRequest setTimeOutSeconds:240];
|
||||||
[asiRequest startSynchronous];
|
[asiRequest startSynchronous];
|
||||||
|
|
||||||
|
return [self parseResponseAsNSDictionary:asiRequest];
|
||||||
|
};
|
||||||
|
|
||||||
|
- (NSDictionary *) copyPictureWithUrl:(NSString*) photoUrl
|
||||||
|
{
|
||||||
|
[self validateCredentials];
|
||||||
|
|
||||||
|
NSMutableString *urlString = [NSMutableString stringWithFormat: @"%@/v1/photo/upload.json", self.server];
|
||||||
|
NSURL *url = [NSURL URLWithString:urlString];
|
||||||
|
|
||||||
|
OAMutableURLRequest *oaUrlRequest = [self getUrlRequest:url];
|
||||||
|
[oaUrlRequest setHTTPMethod:@"POST"];
|
||||||
|
|
||||||
|
// set the parameter to copy
|
||||||
|
NSArray *params = [NSArray arrayWithObjects:[[OARequestParameter alloc] initWithName:@"photo"
|
||||||
|
value:photoUrl], nil];
|
||||||
|
[oaUrlRequest setParameters:params];
|
||||||
|
|
||||||
|
// prepare the request. This will be used to get the Authorization header and add in the multipart component
|
||||||
|
[oaUrlRequest prepare];
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Using ASIHTTPRequest for Multipart. The authentication come from the OAMutableURLRequest
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
ASIFormDataRequest *asiRequest = [ASIFormDataRequest requestWithURL:url];
|
||||||
|
asiRequest.userAgentString=@"Trovebox iOS";
|
||||||
|
|
||||||
|
|
||||||
|
// set the authorization header to be used in the OAuth
|
||||||
|
NSDictionary *dictionary = [oaUrlRequest allHTTPHeaderFields];
|
||||||
|
[asiRequest addRequestHeader:@"Authorization" value:[dictionary objectForKey:@"Authorization"]];
|
||||||
|
|
||||||
|
// set the parameter already added in the signature
|
||||||
|
[asiRequest addPostValue:photoUrl forKey:@"photo"];
|
||||||
|
|
||||||
|
// timeout 4 minutes. TODO. Needs improvements.
|
||||||
|
[asiRequest setTimeOutSeconds:240];
|
||||||
|
[asiRequest startSynchronous];
|
||||||
|
|
||||||
return [self parseResponseAsNSDictionary:asiRequest];
|
return [self parseResponseAsNSDictionary:asiRequest];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue