Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)

Paste

Pasted as Objective C by registered user 4eJLoBeK ( 10 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: