//
// 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
Add a code snippet to your website: www.paste.org