Skip to content

Commit

Permalink
view controller
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsmooke authored Apr 6, 2020
1 parent b2df52c commit 65c31d4
Show file tree
Hide file tree
Showing 32 changed files with 11,874 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ViewController/AddCommentViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// AddCommentViewController.h
// ArtMap
//
//

#import <UIKit/UIKit.h>
#import "Config.h"
#import "AFHTTPClient.h"
#import "AFHTTPRequestOperation.h"
#import "AFNetworking.h"

@interface AddCommentViewController : UIViewController<UITextViewDelegate>
{
UITextView *textview;
UIAlertView *errAlertView;
}

@end
154 changes: 154 additions & 0 deletions ViewController/AddCommentViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
//
// AddCommentViewController.m
// ArtMap
//
//

#import "AddCommentViewController.h"
#import "JSON.h"
#import "SVProgressHUD.h"

@interface AddCommentViewController ()

@end

@implementation AddCommentViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
// Custom initialization
}
return self;
}

- (void)viewDidLoad
{
errAlertView = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];

self.view.backgroundColor = [UIColor whiteColor];
textview = [[UITextView alloc] initWithFrame:self.view.frame];
textview.backgroundColor = [UIColor whiteColor];
textview.textColor = [UIColor blackColor];
textview.font = [UIFont fontWithName:@"Helvetica" size:16.0f];

[self.view addSubview:textview];
[textview setDelegate:self];
[textview becomeFirstResponder];

UIBarButtonItem *CancelBtn = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(emptyAction:)];
CancelBtn.tag = 100;
self.navigationItem.leftBarButtonItem = CancelBtn;

UIBarButtonItem *DoneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Comment" style:UIBarButtonItemStyleDone target:self action:@selector(action:)];
DoneBtn.tag = 200;
self.navigationItem.rightBarButtonItem = DoneBtn;


[super viewDidLoad];
// Do any additional setup after loading the view.
}



-(void) viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:YES];
}


- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {

if ([text isEqualToString:@"\n"]) {

[textView resignFirstResponder];
}

if (textView.text.length >= 160)
{
return NO;
}
return YES;
}

-(void) emptyAction:(UIBarButtonItem*)btn {

[self dismissViewControllerAnimated:YES completion:nil];
}

-(void)action:(UIBarButtonItem*)btn {

[self dismissViewControllerAnimated:YES completion:nil];
BOOL internet= [AppDelegate hasConnectivity];
BOOL internetIsConnected=1;


if (internet ==internetIsConnected) {

[SVProgressHUD showWithStatus:DefaultHudText maskType:SVProgressHUDMaskTypeGradient];

NSString *imageIdVal = [ArtMap_DELEGATE getUserDefault:ArtMap_detail];
NSString *userid = [NSString stringWithFormat:@"%@",[ArtMap_DELEGATE getUserDefault:ArtMap_UserId]];

callWebservice *add = [[callWebservice alloc] init];
add.delegate = self;




NSString * encodedText;
encodedText = [self urlEncoding:textview.text];
[add AddComments:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"{\"image_id\":\"%@\",\"user_id\":\"%@\",\"comments\":\"%@\"}",[ArtMap_DELEGATE emptystr:imageIdVal],[ArtMap_DELEGATE emptystr:userid],[ArtMap_DELEGATE emptystr:encodedText]] forKey:@"data"]];

}
else{

UIAlertView *noInternetAlert=[[UIAlertView alloc] initWithTitle:@"No Internet." message:@"Internet connection is down." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[noInternetAlert show];

}

}

- (NSString *)urlEncoding:(NSString *)valueString {

if (!valueString) {
valueString = @"";
}
NSString *encodedString = (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)valueString, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8);
return encodedString;
}





-(void) didFinishLoading:(ASIHTTPRequest*)request {

[SVProgressHUD dismiss];

// [[NSNotificationCenter defaultCenter] postNotificationName:@"addcomments" object:nil];
}
-(void) didFailWithError:(ASIHTTPRequest*)request
{
[SVProgressHUD dismiss];

UIAlertView *errorAlert=[[UIAlertView alloc] initWithTitle:@"Alert!" message:[NSString stringWithFormat:@"%@",request.error.localizedDescription] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];

[errorAlert show];


}




- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

@end
52 changes: 52 additions & 0 deletions ViewController/CameraViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// CameraViewController.h
// MapShot
//
//

#import <UIKit/UIKit.h>
#import "ToolBarViewClass.h"
#import "AppDelegate.h"
#import "UIImage+Size.h"
#import "MapPonit.h"
#import "SettingsViewController.h"
#import "PECropViewController.h"
#import "AFHTTPClient.h"
#import "MyCLController.h"
#import "SVProgressHUD.h"

@interface CameraViewController : UIViewController<UIActionSheetDelegate,UIImagePickerControllerDelegate,UITextFieldDelegate,UINavigationControllerDelegate,UITextViewDelegate,MKReverseGeocoderDelegate>
{
UIAlertView *errAlertView;
AppDelegate *deleg;
ToolBarViewClass *toolObject;
UIImage *IMG;
UIImage *resizeimg;
NSData *imagedataresize;

NSString *limitedString;
PECropViewController *cropController;

IBOutlet UIView *viewAlertRound;
IBOutlet UIView *view_alert;
IBOutlet UIImageView *alertImage;
IBOutlet UITextField *titletxt;

UIImagePickerController *picker;

MyCLController *locationController;

MKReverseGeocoder *geoCoder;
CLLocationCoordinate2D UserLocation;
NSString *currentadds;
NSString *userLatitude;
NSString *userLongitude;

AppDelegate *appDel;

}
- (void)openEditor;
-(IBAction)buttonAction:(UIButton*)sender;

-(IBAction)mapPic:(id)sender;
@end
Loading

0 comments on commit 65c31d4

Please sign in to comment.