//
//  AssetsHelper.m
//  RNRainbowRn
//
//  Created by Doha Tubaileh on 8/6/19.
//  Copyright © 2019 Facebook. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "AssetsHelper.h"

@implementation AssetsHelper

- (instancetype)init
{
  self = [super init];
  if (self) {
  }
  return self;
}

+ (NSDictionary*)getJson:(NSString *)assetsFileName {
  NSString *path = [[NSBundle mainBundle] pathForResource:assetsFileName ofType:@"json"];
  NSData *data = [NSData dataWithContentsOfFile:path];
  NSDictionary *json;
  if(data != nil) {
    json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
    if(json == nil) {
      NSLog(@"[AssetsHelper] an error occurs creating json obj");
    }
  }
  else {
    NSLog(@"[AssetsHelper] an error occurs while  reading json file");
  }
  return json;
}

@end
