Welcome, guest! Login / Register - Why register?
[email protected] webmail now available. Want one? Go here.

Paste

Pasted as Objective C by registered user 4eJLoBeK ( 5 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][email protected]"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: