Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Objective C by registered user 4eJLoBeK ( 8 years ago )
//
//  FIPushMeetingView.m
//  Forinnovations
//
//  Created by Viktor Drykin on 17.10.16.
//  Copyright © 2016 NGSE. All rights reserved.
//

#import "FIAPIEngine.h"
#import "FIDBUser.h"
#import "FIPushMeetingView.h"
#import "FIDatabaseEngine.h"
#import <SDWebImage>

FIPushMeetingInfo *meetingModel;
FIDBUser *user;
@interface FIPushMeetingView ()

@end

@implementation FIPushMeetingView


- (IBAction)acceptMeetingTapped:(id)sender {
    [[FIAPIEngine sharedInstance] businessMeetingsAccept:user.runetId meetingId:[self numberValueFromString:meetingModel.meetingId] completion:^(BOOL success, id object) {
      if (success) {
          [self removeFromSuperview];
      }
    }];
}

- (IBAction)declineMeetingTapped:(id)sender {
    [[FIAPIEngine sharedInstance] businessMeetingsDecline:user.runetId meetingId:[self numberValueFromString:meetingModel.meetingId] completion:^(BOOL success, id object) {
        if (success) {
            [self removeFromSuperview];
        }
    }];
}

- (IBAction)laterTapped:(id)sender {
    [self removeFromSuperview];
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

+ (void)showPushMeetingView:(FIPushMeetingInfo *)meetingInfo {
    meetingModel = meetingInfo;
    user = [[FIDatabaseEngine sharedInstance]getLoginUser];

    NSArray *nibViews = [[NSBundle mainBundle] loadNibNamed:@"FIPushMeetingView" owner:self options:nil];
    FIPushMeetingView *meetingView = [nibViews objectAtIndex:0];
    meetingView.frame = [[UIScreen mainScreen] bounds];
    meetingView.pushTitle.text = NSLocalizedString (@"PushMeetingViewTitle", nil);
    [meetingView.personPhoto sd_setImageWithURL:[NSURL URLWithString:meetingInfo.photo] placeholderImage:nil options:SDWebImageRefreshCached];

    meetingView.personName.text = [meetingInfo getFullName];
    meetingView.meetingCoordinateInfo.text = [meetingInfo getCoordinateInfo];

    meetingView.meetingId = meetingInfo.meetingId;

    meetingView.personPhoto.layer.cornerRadius = meetingView.personPhoto.frame.size.width / 2;
    meetingView.personPhoto.clipsToBounds = YES;

    UIViewController *vc;
    UIApplication *application = [UIApplication sharedApplication];
    UIWindow *window = application.keyWindow;
    if (window.rootViewController.presentedViewController != nil) {
        vc = window.rootViewController.presentedViewController;
        while (vc.presentedViewController != nil) {
            vc = vc.presentedViewController;
        }
        if ([vc isKindOfClass:[UINavigationController class]]) {
            vc = ((UINavigationController *)vc).viewControllers.lastObject;
        }
    } else {
        vc = window.rootViewController;
    }
    [vc.view addSubview:meetingView];
}

#pragma mark - Utils

- (NSNumber *)numberValueFromString:(NSString *)stringValue {
    NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
    f.numberStyle = NSNumberFormatterDecimalStyle;
    NSNumber *numberValue = [f numberFromString:stringValue];
    return numberValue;
}

@end

 

Revise this Paste

Children: 81846 81847
Your Name: Code Language: