xref: /expo/ios/Exponent/Kernel/AppLoader/EXApiUtil.m (revision b8addc5d)
1// Copyright 2015-present 650 Industries. All rights reserved.
2
3#import "EXApiUtil.h"
4
5#import <CommonCrypto/CommonDigest.h>
6#import <React/RCTUtils.h>
7
8@import EXManifests;
9
10NS_ASSUME_NONNULL_BEGIN
11
12static NSString* kPublicKeyTag = @"exp.host.publickey";
13
14@implementation EXApiUtil
15
16+ (NSURL *)bundleUrlFromManifest:(EXManifestsManifest *)manifest
17{
18  return [[self class] encodedUrlFromString:manifest.bundleUrl];
19}
20
21+ (NSURL *)encodedUrlFromString:(NSString *)urlString
22{
23  NSURL *url = [NSURL URLWithString:urlString];
24  if (!url) {
25    url = [NSURL URLWithString:[urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]];
26  }
27  return url;
28}
29
30@end
31
32NS_ASSUME_NONNULL_END
33