Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] webmail 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 ( 7 years ago )
//
//  FIPushNotificationEngine.m
//  Forinnovations
//
//  Created by Viktor Drykin on 17.10.16.
//  Copyright © 2016 NGSE. All rights reserved.
//

#import "FIPushNotificationEngine.h"
#import "FIPushMeetingInfo.h"
#import "FIUserDefaultsHelper.h"
#import "FIRouter.h"
#import "FIPushMeetingView.h"
@implementation FIPushNotificationEngine

+ (id)sharedInstance {
    static id singleton = nil;
    static dispatch_once_t onceToken;
    dispatch_once (&onceToken, ^{
        singleton = [[self alloc] init];
    });
    return singleton;
}

- (void)handlePushNotification:(NSDictionary *)notification {
    @try {
         NSDictionary *appInfo = notification[@"aps"][@"appInfo"];
        FIPushMeetingInfo *meetingInfoModel = [[FIPushMeetingInfo alloc] init];
        meetingInfoModel.meetingId = appInfo[@"MeetingId"];
        meetingInfoModel.photo = appInfo[@"Photo"];
        meetingInfoModel.start = appInfo[@"Start"];
        NSDictionary *localeInfo = appInfo[@"LocaleInfo"];
        
        NSString *needLocale = [[FIUserDefaultsHelper sharedInstance] isCurrentLanguageEnglish]?@"en":@"ru";
        meetingInfoModel.place = localeInfo[@"place"][needLocale];
        meetingInfoModel.firstName =  localeInfo[@"firstName"][needLocale];
        meetingInfoModel.fatherName =  localeInfo[@"fatherName"][needLocale];
        meetingInfoModel.lastName =  localeInfo[@"lastName"][needLocale];
        [FIPushMeetingView showPushMeetingView:meetingInfoModel];
    } @catch (NSException *exception) {
        
    } @finally {
        
    }
 
}


@end

 

Revise this Paste

Parent: 81845
Your Name: Code Language: