Compare commits
12 Commits
master
...
martin/ini
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2ac245cfb | ||
|
|
66a60da3b5 | ||
|
|
826cd98d8e | ||
|
|
c119db518a | ||
|
|
833658f242 | ||
|
|
4bee1edc3f | ||
|
|
ec1d830224 | ||
|
|
9e30e12883 | ||
|
|
01c0b2a062 | ||
|
|
1c272e4ac0 | ||
|
|
717a0b03f3 | ||
|
|
f29cbb9704 |
26
Makefile
Normal file
26
Makefile
Normal file
@ -0,0 +1,26 @@
|
||||
update_metadata: MetaDataPlistCreator/createPlistFromHeader
|
||||
@echo "creating plist file..."
|
||||
mv libPhoneNumber/NBGeneratedPhoneNumberMetaData.h MetaDataPlistCreator
|
||||
(cd MetaDataPlistCreator && createPlistFromHeader)
|
||||
mv MetaDataPlistCreator/phoneNumberMap.plist libPhoneNumber
|
||||
rm MetaDataPlistCreator/NBGeneratedPhoneNumberMetaData.h
|
||||
|
||||
MetaDataPlistCreator/createPlistFromHeader: libPhoneNumber/NBGeneratedPhoneNumberMetaData.h
|
||||
@echo "creating binary..."
|
||||
cp libPhoneNumber/NBGeneratedPhoneNumberMetaData.h MetaDataPlistCreator
|
||||
xcodebuild -target MetaDataPlistCreator
|
||||
mv build/Release/createPlistFromHeader MetaDataPlistCreator
|
||||
|
||||
libPhoneNumber/NBGeneratedPhoneNumberMetaData.h:
|
||||
@echo "creating temporary header file..."
|
||||
cd libPhoneNumberTests && ./metadataGenerator
|
||||
cd libPhoneNumber && ./GeneratePhoneNumberHeader.sh
|
||||
|
||||
clean:
|
||||
@echo "deleting all temporary files..."
|
||||
rm -f libPhoneNumber/NBGeneratedPhoneNumberMetaData.h
|
||||
rm -f libPhoneNumber/phoneNumberMap.plist
|
||||
rm -f MetaDataPlistCreator/NBGeneratedPhoneNumberMetaData.h
|
||||
rm -f MetaDataPlistCreator/phoneNumberMap.plist
|
||||
rm -f MetaDataPlistCreator/createPlistFromHeader
|
||||
rm -rf build
|
||||
20
MetaDataPlistCreator/MetaDataPlistCreator.h
Normal file
20
MetaDataPlistCreator/MetaDataPlistCreator.h
Normal file
@ -0,0 +1,20 @@
|
||||
//
|
||||
// MetaDataPlistCreator.h
|
||||
// MetaDataPlistCreator
|
||||
//
|
||||
// Created by Martin Böttcher on 09.02.22.
|
||||
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MetaDataPlistCreator_h
|
||||
#define MetaDataPlistCreator_h
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
@interface MetaDataPlistCreator : NSObject
|
||||
|
||||
+ (BOOL) createPlistFile:(NSString*) path;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* MetaDataPlistCreator_h */
|
||||
122
MetaDataPlistCreator/MetaDataPlistCreator.m
Normal file
122
MetaDataPlistCreator/MetaDataPlistCreator.m
Normal file
@ -0,0 +1,122 @@
|
||||
//
|
||||
// MetaDataPlistCreator.m
|
||||
// MetaDataPlistCreator
|
||||
//
|
||||
// Created by Martin Böttcher on 09.02.22.
|
||||
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MetaDataPlistCreator.h"
|
||||
#import "NBGeneratedPhoneNumberMetaData.h"
|
||||
|
||||
@implementation MetaDataPlistCreator: NSObject
|
||||
|
||||
+ (BOOL) createPlistFile:(NSString*) path {
|
||||
NSDictionary *result = [MetaDataPlistCreator jsonObjectFromZippedDataWithBytes:kPhoneNumberMetaData
|
||||
compressedLength:kPhoneNumberMetaDataCompressedLength
|
||||
expandedLength:kPhoneNumberMetaDataExpandedLength];
|
||||
|
||||
// The jsonMap is large and held in memory.
|
||||
// It's contents are deeply nested and very repetitive.
|
||||
// We can greatly reduce the memory used by jsonMap
|
||||
// by traversing its contents and de-duplicating repeated values.
|
||||
result = [MetaDataPlistCreator deduplicateJsonMap:result];
|
||||
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:result requiringSecureCoding:NO error:NULL];
|
||||
return data != nil && [data writeToFile:path atomically:YES];
|
||||
}
|
||||
|
||||
+ (NSDictionary<NSObject *, NSObject *> *)deduplicateJsonMap:(NSDictionary<NSObject *, NSObject *> *)inputMap {
|
||||
NSMutableSet<NSObject *> *valueSet = [NSMutableSet new];
|
||||
NSObject *result = [self deduplicateJsonValue:inputMap valueSet:valueSet];
|
||||
return (NSDictionary<NSObject *, NSObject *> *) result;
|
||||
}
|
||||
|
||||
+ (NSObject *)deduplicateJsonValue:(NSObject *)jsonValue valueSet:(NSMutableSet<NSObject *> *)valueSet {
|
||||
|
||||
NSObject *_Nullable existingValue = [valueSet member:jsonValue];
|
||||
if (existingValue != nil) {
|
||||
assert([existingValue isKindOfClass:jsonValue.class]);
|
||||
return existingValue;
|
||||
} else {
|
||||
[valueSet addObject:jsonValue];
|
||||
}
|
||||
|
||||
if ([jsonValue isKindOfClass:NSArray.class]) {
|
||||
return [self deduplicateJsonArray:(NSArray<NSObject *> *) jsonValue
|
||||
valueSet:valueSet];
|
||||
} else if ([jsonValue isKindOfClass:NSDictionary.class]) {
|
||||
return [self deduplicateJsonDictionary:(NSDictionary<NSObject *, NSObject *> *) jsonValue
|
||||
valueSet:valueSet];
|
||||
} else if ([jsonValue isKindOfClass:NSString.class] ||
|
||||
[jsonValue isKindOfClass:NSNumber.class] ||
|
||||
[jsonValue isKindOfClass:NSData.class] ||
|
||||
[jsonValue isKindOfClass:NSNull.class]) {
|
||||
return jsonValue;
|
||||
} else {
|
||||
NSLog(@"Unexpected value: %@, %@", jsonValue.class, jsonValue);
|
||||
return jsonValue;
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSArray<NSObject *> *)deduplicateJsonArray:(NSArray<NSObject *> *)jsonArray
|
||||
valueSet:(NSMutableSet<NSObject *> *)valueSet {
|
||||
NSMutableArray<NSObject *> *result = [NSMutableArray new];
|
||||
for (NSObject *jsonValue in jsonArray) {
|
||||
[result addObject:[self deduplicateJsonValue:jsonValue valueSet:valueSet]];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (NSDictionary<NSObject *, NSObject *> *)deduplicateJsonDictionary:(NSDictionary<NSObject *, NSObject *> *)jsonDictionary
|
||||
valueSet:(NSMutableSet<NSObject *> *)valueSet {
|
||||
NSMutableDictionary<NSObject *, NSObject *> *result = [NSMutableDictionary new];
|
||||
[jsonDictionary enumerateKeysAndObjectsUsingBlock:^(NSObject * _Nonnull jsonKey,
|
||||
NSObject * _Nonnull jsonValue,
|
||||
BOOL * _Nonnull stop) {
|
||||
result[(id<NSCopying>) jsonKey] = [self deduplicateJsonValue:jsonValue valueSet:valueSet];
|
||||
}];
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand gzipped data into a JSON object.
|
||||
|
||||
* @param bytes Array<Bytef> of zipped data.
|
||||
* @param compressedLength Length of the compressed bytes.
|
||||
* @param expandedLength Length of the expanded bytes.
|
||||
* @return JSON dictionary.
|
||||
*/
|
||||
+ (NSDictionary *)jsonObjectFromZippedDataWithBytes:(z_const Bytef [])bytes
|
||||
compressedLength:(NSUInteger)compressedLength
|
||||
expandedLength:(NSUInteger)expandedLength {
|
||||
// Data is a gzipped JSON file that is embedded in the binary.
|
||||
// See GeneratePhoneNumberHeader.sh and PhoneNumberMetaData.h for details.
|
||||
NSMutableData* gunzippedData = [NSMutableData dataWithLength:expandedLength];
|
||||
|
||||
z_stream zStream;
|
||||
memset(&zStream, 0, sizeof(zStream));
|
||||
__attribute((unused)) int err = inflateInit2(&zStream, 16);
|
||||
NSAssert(err == Z_OK, @"Unable to init stream. err = %d", err);
|
||||
|
||||
zStream.next_in = bytes;
|
||||
zStream.avail_in = (uint)compressedLength;
|
||||
zStream.next_out = (Bytef *)gunzippedData.bytes;
|
||||
zStream.avail_out = (uint)gunzippedData.length;
|
||||
|
||||
err = inflate(&zStream, Z_FINISH);
|
||||
NSAssert(err == Z_STREAM_END, @"Unable to inflate compressed data. err = %d", err);
|
||||
|
||||
err = inflateEnd(&zStream);
|
||||
NSAssert(err == Z_OK, @"Unable to inflate compressed data. err = %d", err);
|
||||
|
||||
NSError *error = nil;
|
||||
NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:gunzippedData
|
||||
options:0
|
||||
error:&error];
|
||||
NSAssert(error == nil, @"Unable to convert JSON - %@", error);
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@end
|
||||
14
MetaDataPlistCreator/main.m
Normal file
14
MetaDataPlistCreator/main.m
Normal file
@ -0,0 +1,14 @@
|
||||
//
|
||||
// main.m
|
||||
// MetaDataPlistCreator
|
||||
//
|
||||
// Created by Martin Böttcher on 09.02.22.
|
||||
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MetaDataPlistCreator.h"
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
return [MetaDataPlistCreator createPlistFile:@"phoneNumberMap.plist"] ? 0 : 1;
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "libPhoneNumber-iOS"
|
||||
s.version = "0.9.15"
|
||||
s.version = "0.9.16"
|
||||
s.summary = "iOS library for parsing, formatting, storing and validating international phone numbers from libphonenumber library."
|
||||
s.description = <<-DESC
|
||||
libPhoneNumber for iOS
|
||||
@ -11,12 +11,13 @@ DESC
|
||||
s.authors = { "iziz" => "zen.isis@gmail.com", "hyukhur" => "hyukhur@gmail.com" }
|
||||
s.source = { :git => "https://github.com/iziz/libPhoneNumber-iOS.git", :tag => s.version.to_s }
|
||||
s.libraries = 'z'
|
||||
s.dependency 'CocoaLumberjack'
|
||||
s.ios.framework = 'CoreTelephony'
|
||||
s.ios.deployment_target = "6.0"
|
||||
s.ios.deployment_target = "11.0"
|
||||
s.osx.deployment_target = "10.9"
|
||||
s.watchos.deployment_target = "2.0"
|
||||
s.tvos.deployment_target = "9.0"
|
||||
s.requires_arc = true
|
||||
s.private_header_files = 'libPhoneNumber/NBGeneratedPhoneNumberMetaData.h'
|
||||
s.source_files = 'libPhoneNumber/NBPhoneNumberDefines.{h,m}', 'libPhoneNumber/NBPhoneNumber.{h,m}', 'libPhoneNumber/NBNumberFormat.{h,m}', 'libPhoneNumber/NBPhoneNumberDesc.{h,m}', 'libPhoneNumber/NBPhoneMetaData.{h,m}', 'libPhoneNumber/NBPhoneNumberUtil.{h,m}', 'libPhoneNumber/NBMetadataHelper.{h,m}', 'libPhoneNumber/NBAsYouTypeFormatter.{h,m}', 'libPhoneNumber/NSArray+NBAdditions.{h,m}', 'libPhoneNumber/NBGeneratedPhoneNumberMetaData.h', 'libPhoneNumber/Internal/NBRegExMatcher.{h,m}', 'libPhoneNumber/Internal/NBRegularExpressionCache.{h,m}'
|
||||
s.resources = 'libPhoneNumber/phoneNumberMap.plist'
|
||||
s.source_files = 'libPhoneNumber/NBPhoneNumberDefines.{h,m}', 'libPhoneNumber/NBPhoneNumber.{h,m}', 'libPhoneNumber/NBNumberFormat.{h,m}', 'libPhoneNumber/NBPhoneNumberDesc.{h,m}', 'libPhoneNumber/NBPhoneMetaData.{h,m}', 'libPhoneNumber/NBPhoneNumberUtil.{h,m}', 'libPhoneNumber/NBMetadataHelper.{h,m}', 'libPhoneNumber/NBAsYouTypeFormatter.{h,m}', 'libPhoneNumber/NSArray+NBAdditions.{h,m}', 'libPhoneNumber/Internal/NBRegExMatcher.{h,m}', 'libPhoneNumber/Internal/NBRegularExpressionCache.{h,m}'
|
||||
end
|
||||
|
||||
@ -43,6 +43,8 @@
|
||||
14B7A2B41DE9BF160051AED7 /* NBPhoneNumberDefines.m in Sources */ = {isa = PBXBuildFile; fileRef = A81D6A281BECC43A00F68F34 /* NBPhoneNumberDefines.m */; };
|
||||
14B7A2B51DE9BF160051AED7 /* NBPhoneNumberUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = FD8B84321934C35F00C350EB /* NBPhoneNumberUtil.m */; };
|
||||
14B7A2B61DE9BF160051AED7 /* NBAsYouTypeFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = FD8B84271934C35F00C350EB /* NBAsYouTypeFormatter.m */; };
|
||||
14E06D5127B3DAFA007754F4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 14E06D5027B3DAFA007754F4 /* main.m */; };
|
||||
14E06D5727B3DDF0007754F4 /* MetaDataPlistCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 14E06D5627B3DDF0007754F4 /* MetaDataPlistCreator.m */; };
|
||||
1F31D52E1DDD46B100257818 /* libPhoneNumberwatchOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F31D52C1DDD46B100257818 /* libPhoneNumberwatchOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
1F31D5321DDD46B900257818 /* NBMetadataHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = FD12C2681A87401B00B53856 /* NBMetadataHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
1F31D5331DDD46BD00257818 /* NBMetadataHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = FD12C2691A87401B00B53856 /* NBMetadataHelper.m */; };
|
||||
@ -131,10 +133,6 @@
|
||||
8B1FEF9D1EB7BF6C00FBDE87 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD6AE8FA1BEE72B600263DE1 /* ViewController.swift */; };
|
||||
8B1FEF9E1EB7BF7000FBDE87 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FD6AE8FC1BEE72B600263DE1 /* Main.storyboard */; };
|
||||
8B1FEF9F1EB7BF7200FBDE87 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FD6AE9011BEE72B600263DE1 /* LaunchScreen.storyboard */; };
|
||||
8B1FEFA01EB7BFC500FBDE87 /* NBGeneratedPhoneNumberMetaData.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BB73AA71E7C9C6700B0691B /* NBGeneratedPhoneNumberMetaData.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
8B1FEFA11EB7BFC500FBDE87 /* NBGeneratedPhoneNumberMetaData.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BB73AA71E7C9C6700B0691B /* NBGeneratedPhoneNumberMetaData.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
8B1FEFA21EB7BFC600FBDE87 /* NBGeneratedPhoneNumberMetaData.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BB73AA71E7C9C6700B0691B /* NBGeneratedPhoneNumberMetaData.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
8B1FEFA31EB7BFC600FBDE87 /* NBGeneratedPhoneNumberMetaData.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BB73AA71E7C9C6700B0691B /* NBGeneratedPhoneNumberMetaData.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
A025047D214C61FD00AFC260 /* NBPhoneNumberUtil+ShortNumberTestHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5833091FD1FC9500F26ED4 /* NBPhoneNumberUtil+ShortNumberTestHelper.h */; };
|
||||
A025047E214C61FD00AFC260 /* NBPhoneNumberUtil+ShortNumberTestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F58330A1FD1FC9500F26ED4 /* NBPhoneNumberUtil+ShortNumberTestHelper.m */; };
|
||||
A81D6A2B1BECC44600F68F34 /* NBPhoneNumberDefines.m in Sources */ = {isa = PBXBuildFile; fileRef = A81D6A281BECC43A00F68F34 /* NBPhoneNumberDefines.m */; };
|
||||
@ -150,6 +148,18 @@
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
14E06D4C27B3DAFA007754F4 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0F2870911FCF7936006230BF /* NBPhoneNumberUtil+ShortNumber.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NBPhoneNumberUtil+ShortNumber.h"; sourceTree = "<group>"; };
|
||||
0F2870921FCF7936006230BF /* NBPhoneNumberUtil+ShortNumber.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NBPhoneNumberUtil+ShortNumber.m"; sourceTree = "<group>"; };
|
||||
@ -166,6 +176,10 @@
|
||||
1485C5251E06F4890092F541 /* NBPhoneNumberUtilTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NBPhoneNumberUtilTest.m; path = libPhoneNumberTests/NBPhoneNumberUtilTest.m; sourceTree = SOURCE_ROOT; };
|
||||
1485C52B1E06F4930092F541 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = libPhoneNumberTests/Info.plist; sourceTree = SOURCE_ROOT; };
|
||||
14B7A2931DE9B65D0051AED7 /* libPhoneNumberiOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = libPhoneNumberiOSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
14E06D4E27B3DAFA007754F4 /* createPlistFromHeader */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = createPlistFromHeader; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
14E06D5027B3DAFA007754F4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
14E06D5527B3DDDB007754F4 /* MetaDataPlistCreator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MetaDataPlistCreator.h; sourceTree = "<group>"; };
|
||||
14E06D5627B3DDF0007754F4 /* MetaDataPlistCreator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MetaDataPlistCreator.m; sourceTree = "<group>"; };
|
||||
187A618A1A25DF04000D8BB6 /* PhoneNumberMetaData.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = PhoneNumberMetaData.json; path = libPhoneNumberTests/generatedJSON/PhoneNumberMetaData.json; sourceTree = SOURCE_ROOT; };
|
||||
187A618B1A25DF04000D8BB6 /* PhoneNumberMetaDataForTesting.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = PhoneNumberMetaDataForTesting.json; path = libPhoneNumberTests/generatedJSON/PhoneNumberMetaDataForTesting.json; sourceTree = SOURCE_ROOT; };
|
||||
1F31D52A1DDD46B100257818 /* libPhoneNumberwatchOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = libPhoneNumberwatchOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@ -229,6 +243,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
14E06D4B27B3DAFA007754F4 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1F31D5261DDD46B100257818 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -348,6 +369,17 @@
|
||||
name = libPhoneNumber.samples;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
14E06D4F27B3DAFA007754F4 /* MetaDataPlistCreator */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8BB73AA71E7C9C6700B0691B /* NBGeneratedPhoneNumberMetaData.h */,
|
||||
14E06D5027B3DAFA007754F4 /* main.m */,
|
||||
14E06D5527B3DDDB007754F4 /* MetaDataPlistCreator.h */,
|
||||
14E06D5627B3DDF0007754F4 /* MetaDataPlistCreator.m */,
|
||||
);
|
||||
path = MetaDataPlistCreator;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1F31D52B1DDD46B100257818 /* watchOS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -415,6 +447,7 @@
|
||||
14B7A2941DE9B65D0051AED7 /* libPhoneNumber.tests */,
|
||||
14C114F11DE9A9070029FE1C /* libPhoneNumber.samples */,
|
||||
4D43EF831740825100C24FF3 /* libPhoneNumber-iOS.podspec */,
|
||||
14E06D4F27B3DAFA007754F4 /* MetaDataPlistCreator */,
|
||||
FD7A061F167715A0004BBEB6 /* Frameworks */,
|
||||
FD7A061D167715A0004BBEB6 /* Products */,
|
||||
);
|
||||
@ -429,6 +462,7 @@
|
||||
14B7A2931DE9B65D0051AED7 /* libPhoneNumberiOSTests.xctest */,
|
||||
7C72507C1E0EBE7D00F916ED /* libPhoneNumbermacOS.framework */,
|
||||
8B1FEF731EB7BE7C00FBDE87 /* SwiftDemo.app */,
|
||||
14E06D4E27B3DAFA007754F4 /* createPlistFromHeader */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@ -474,7 +508,6 @@
|
||||
children = (
|
||||
FD12C2681A87401B00B53856 /* NBMetadataHelper.h */,
|
||||
FD12C2691A87401B00B53856 /* NBMetadataHelper.m */,
|
||||
8BB73AA71E7C9C6700B0691B /* NBGeneratedPhoneNumberMetaData.h */,
|
||||
FD379E291A8AE5150015C184 /* NBPhoneNumberMetadata.plist */,
|
||||
);
|
||||
name = Metadata;
|
||||
@ -487,7 +520,6 @@
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8B1FEFA11EB7BFC500FBDE87 /* NBGeneratedPhoneNumberMetaData.h in Headers */,
|
||||
1F31D5461DDD478300257818 /* NBPhoneMetaData.h in Headers */,
|
||||
1F31D5401DDD477300257818 /* NBPhoneNumber.h in Headers */,
|
||||
1F31D5421DDD477800257818 /* NBNumberFormat.h in Headers */,
|
||||
@ -507,7 +539,6 @@
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8B1FEFA21EB7BFC600FBDE87 /* NBGeneratedPhoneNumberMetaData.h in Headers */,
|
||||
1F31D5511DDD47BA00257818 /* libPhoneNumbertvOS.h in Headers */,
|
||||
1F31D5551DDD47EB00257818 /* NBMetadataHelper.h in Headers */,
|
||||
1F31D5621DDD482C00257818 /* NBPhoneMetaData.h in Headers */,
|
||||
@ -527,7 +558,6 @@
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8B1FEFA01EB7BFC500FBDE87 /* NBGeneratedPhoneNumberMetaData.h in Headers */,
|
||||
A025047D214C61FD00AFC260 /* NBPhoneNumberUtil+ShortNumberTestHelper.h in Headers */,
|
||||
0F2870981FCF8F13006230BF /* NBRegExMatcher.h in Headers */,
|
||||
34ACBBB61B7124AB0064B3BD /* NBPhoneNumberDefines.h in Headers */,
|
||||
@ -549,7 +579,6 @@
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8B1FEFA31EB7BFC600FBDE87 /* NBGeneratedPhoneNumberMetaData.h in Headers */,
|
||||
7C7250801E0EBE7D00F916ED /* libPhoneNumbermacOS.h in Headers */,
|
||||
7C72508E1E0EC05900F916ED /* NBMetadataHelper.h in Headers */,
|
||||
7C7250941E0EC06900F916ED /* NBPhoneMetaData.h in Headers */,
|
||||
@ -585,6 +614,23 @@
|
||||
productReference = 14B7A2931DE9B65D0051AED7 /* libPhoneNumberiOSTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
14E06D4D27B3DAFA007754F4 /* MetaDataPlistCreator */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 14E06D5427B3DAFA007754F4 /* Build configuration list for PBXNativeTarget "MetaDataPlistCreator" */;
|
||||
buildPhases = (
|
||||
14E06D4A27B3DAFA007754F4 /* Sources */,
|
||||
14E06D4B27B3DAFA007754F4 /* Frameworks */,
|
||||
14E06D4C27B3DAFA007754F4 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = MetaDataPlistCreator;
|
||||
productName = MetaDataPlistCreator;
|
||||
productReference = 14E06D4E27B3DAFA007754F4 /* createPlistFromHeader */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
1F31D5291DDD46B100257818 /* libPhoneNumberwatchOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1F31D5311DDD46B100257818 /* Build configuration list for PBXNativeTarget "libPhoneNumberwatchOS" */;
|
||||
@ -690,6 +736,10 @@
|
||||
CreatedOnToolsVersion = 8.1;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
14E06D4D27B3DAFA007754F4 = {
|
||||
CreatedOnToolsVersion = 13.2.1;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
1F31D5291DDD46B100257818 = {
|
||||
CreatedOnToolsVersion = 8.1;
|
||||
ProvisioningStyle = Automatic;
|
||||
@ -716,6 +766,7 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
Base,
|
||||
);
|
||||
mainGroup = FD7A0611167715A0004BBEB6;
|
||||
@ -729,6 +780,7 @@
|
||||
7C72507B1E0EBE7D00F916ED /* libPhoneNumbermacOS */,
|
||||
14B7A2921DE9B65D0051AED7 /* libPhoneNumberiOSTests */,
|
||||
8B1FEF721EB7BE7C00FBDE87 /* SwiftDemo */,
|
||||
14E06D4D27B3DAFA007754F4 /* MetaDataPlistCreator */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@ -805,6 +857,15 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
14E06D4A27B3DAFA007754F4 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
14E06D5727B3DDF0007754F4 /* MetaDataPlistCreator.m in Sources */,
|
||||
14E06D5127B3DAFA007754F4 /* main.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1F31D5251DDD46B100257818 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -982,6 +1043,75 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
14E06D5227B3DAFA007754F4 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALLOW_TARGET_PLATFORM_SPECIALIZATION = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_OPTIMIZATION_PROFILE_FILE = "";
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_KEY_WKRunsIndependentlyOfCompanionApp = YES;
|
||||
INSTALL_PATH = .;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
PRODUCT_NAME = createPlistFromHeader;
|
||||
SDKROOT = macosx;
|
||||
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";
|
||||
TARGETED_DEVICE_FAMILY = "";
|
||||
VALID_ARCHS = "arm64 x86_64";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
14E06D5327B3DAFA007754F4 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALLOW_TARGET_PLATFORM_SPECIALIZATION = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_OPTIMIZATION_PROFILE_FILE = "";
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
INFOPLIST_KEY_WKRunsIndependentlyOfCompanionApp = YES;
|
||||
INSTALL_PATH = .;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_NAME = createPlistFromHeader;
|
||||
SDKROOT = macosx;
|
||||
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";
|
||||
TARGETED_DEVICE_FAMILY = "";
|
||||
VALID_ARCHS = "arm64 x86_64";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1F31D52F1DDD46B100257818 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@ -1480,6 +1610,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
14E06D5427B3DAFA007754F4 /* Build configuration list for PBXNativeTarget "MetaDataPlistCreator" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
14E06D5227B3DAFA007754F4 /* Debug */,
|
||||
14E06D5327B3DAFA007754F4 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1F31D5311DDD46B100257818 /* Build configuration list for PBXNativeTarget "libPhoneNumberwatchOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1320"
|
||||
version = "2.0">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "14E06D4D27B3DAFA007754F4"
|
||||
BuildableName = "MetaDataPlistCreator"
|
||||
BlueprintName = "MetaDataPlistCreator"
|
||||
ReferencedContainer = "container:libPhoneNumber.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = ""
|
||||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||
disableMainThreadChecker = "YES"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "YES"
|
||||
debugDocumentVersioning = "NO"
|
||||
debugXPCServices = "NO"
|
||||
debugServiceExtension = "internal"
|
||||
enableGPUFrameCaptureMode = "3"
|
||||
enableGPUValidationMode = "1"
|
||||
allowLocationSimulation = "NO"
|
||||
viewDebuggingEnabled = "No"
|
||||
queueDebuggingEnabled = "No"
|
||||
GPUProfilerEnabled = "No">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "14E06D4D27B3DAFA007754F4"
|
||||
BuildableName = "MetaDataPlistCreator"
|
||||
BlueprintName = "MetaDataPlistCreator"
|
||||
ReferencedContainer = "container:libPhoneNumber.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "14E06D4D27B3DAFA007754F4"
|
||||
BuildableName = "MetaDataPlistCreator"
|
||||
BlueprintName = "MetaDataPlistCreator"
|
||||
ReferencedContainer = "container:libPhoneNumber.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
File diff suppressed because it is too large
Load Diff
@ -7,9 +7,15 @@
|
||||
//
|
||||
|
||||
#import "NBMetadataHelper.h"
|
||||
#import "NBGeneratedPhoneNumberMetaData.h"
|
||||
#import "NBPhoneMetaData.h"
|
||||
|
||||
#import <CocoaLumberjack/CocoaLumberjack.h>
|
||||
#ifdef DEBUG
|
||||
static const NSUInteger ddLogLevel = DDLogLevelAll;
|
||||
#else
|
||||
static const NSUInteger ddLogLevel = DDLogLevelInfo;
|
||||
#endif
|
||||
|
||||
@interface NBMetadataHelper ()
|
||||
|
||||
// Cached metadata
|
||||
@ -55,15 +61,22 @@ static NSString *StringByTrimming(NSString *aString) {
|
||||
Ref. site (countrycode.org)
|
||||
*/
|
||||
+ (NSDictionary *)phoneNumberDataMap {
|
||||
static NSDictionary *phoneNumberDataDictionary;
|
||||
static NSDictionary *result;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
phoneNumberDataDictionary =
|
||||
[self jsonObjectFromZippedDataWithBytes:kPhoneNumberMetaData
|
||||
compressedLength:kPhoneNumberMetaDataCompressedLength
|
||||
expandedLength:kPhoneNumberMetaDataExpandedLength];
|
||||
@autoreleasepool {
|
||||
NSString *path = [[NSBundle bundleForClass:NBMetadataHelper.class] pathForResource:@"phoneNumberMap" ofType:@"plist"];
|
||||
NSData *fileContent = [NSData dataWithContentsOfFile:path];
|
||||
if (fileContent != nil) {
|
||||
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:fileContent];
|
||||
unarchiver.requiresSecureCoding = YES;
|
||||
NSSet *allowedClasses = [NSSet setWithArray:@[NSArray.class, NSDictionary.class, NSNull.class, NSString.class, NSNumber.class]];
|
||||
result = (NSDictionary *)[unarchiver decodeObjectOfClasses:allowedClasses forKey:NSKeyedArchiveRootObjectKey];
|
||||
}
|
||||
NSAssert(result != nil, @"phoneNumberMap.plist missing or corrupt");
|
||||
}
|
||||
});
|
||||
return phoneNumberDataDictionary;
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)CCode2CNMap {
|
||||
@ -223,45 +236,4 @@ static NSString *StringByTrimming(NSString *aString) {
|
||||
|
||||
#endif // SHORT_NUMBER_SUPPORT
|
||||
|
||||
|
||||
/**
|
||||
* Expand gzipped data into a JSON object.
|
||||
|
||||
* @param bytes Array<Bytef> of zipped data.
|
||||
* @param compressedLength Length of the compressed bytes.
|
||||
* @param expandedLength Length of the expanded bytes.
|
||||
* @return JSON dictionary.
|
||||
*/
|
||||
+ (NSDictionary *)jsonObjectFromZippedDataWithBytes:(z_const Bytef [])bytes
|
||||
compressedLength:(NSUInteger)compressedLength
|
||||
expandedLength:(NSUInteger)expandedLength {
|
||||
// Data is a gzipped JSON file that is embedded in the binary.
|
||||
// See GeneratePhoneNumberHeader.sh and PhoneNumberMetaData.h for details.
|
||||
NSMutableData* gunzippedData = [NSMutableData dataWithLength:expandedLength];
|
||||
|
||||
z_stream zStream;
|
||||
memset(&zStream, 0, sizeof(zStream));
|
||||
__attribute((unused)) int err = inflateInit2(&zStream, 16);
|
||||
NSAssert(err == Z_OK, @"Unable to init stream. err = %d", err);
|
||||
|
||||
zStream.next_in = bytes;
|
||||
zStream.avail_in = (uint)compressedLength;
|
||||
zStream.next_out = (Bytef *)gunzippedData.bytes;
|
||||
zStream.avail_out = (uint)gunzippedData.length;
|
||||
|
||||
err = inflate(&zStream, Z_FINISH);
|
||||
NSAssert(err == Z_STREAM_END, @"Unable to inflate compressed data. err = %d", err);
|
||||
|
||||
err = inflateEnd(&zStream);
|
||||
NSAssert(err == Z_OK, @"Unable to inflate compressed data. err = %d", err);
|
||||
|
||||
NSError *error = nil;
|
||||
NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:gunzippedData
|
||||
options:0
|
||||
error:&error];
|
||||
NSAssert(error == nil, @"Unable to convert JSON - %@", error);
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
BIN
libPhoneNumber/phoneNumberMap.plist
Normal file
BIN
libPhoneNumber/phoneNumberMap.plist
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -60,7 +60,7 @@ func loadJS(from url: URL, to context: JSContext) {
|
||||
let context = JSContext()!
|
||||
context.exceptionHandler = { _, exception in
|
||||
fputs("Javascript exception thrown: \(exception!)\n", __stderrp)
|
||||
// exit(1)
|
||||
exit(1)
|
||||
}
|
||||
|
||||
// Load required dependencies.
|
||||
@ -68,25 +68,11 @@ let googleClosure = URL(
|
||||
string: "http://cdn.rawgit.com/google/closure-library/master/closure/goog/base.js")!
|
||||
loadJS(from: googleClosure, to: context)
|
||||
|
||||
let jQuery = URL(string: "http://code.jquery.com/jquery-1.8.3.min.js")!
|
||||
loadJS(from: jQuery, to: context)
|
||||
|
||||
// Evaluate requires.
|
||||
let requires = """
|
||||
goog.require('goog.proto2.Message');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.json');
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.proto2.ObjectSerializer');
|
||||
goog.require('goog.string.StringBuffer');
|
||||
goog.require('i18n.phonenumbers.metadata');
|
||||
"""
|
||||
context.evaluateScript(requires)
|
||||
|
||||
// Load metadata file from GitHub.
|
||||
let phoneMetadata = URL(string: "https://raw.githubusercontent.com/googlei18n/libphonenumber/master/javascript/i18n/phonenumbers/metadata.js")!
|
||||
let phoneMetadataForTesting = URL(string: "https://raw.githubusercontent.com/googlei18n/libphonenumber/master/javascript/i18n/phonenumbers/metadatafortesting.js")!
|
||||
let shortNumberMetadata = URL(string: "https://raw.githubusercontent.com/googlei18n/libphonenumber/master/javascript/i18n/phonenumbers/shortnumbermetadata.js")!
|
||||
let ref = "master"
|
||||
let phoneMetadata = URL(string: "https://raw.githubusercontent.com/google/libphonenumber/\(ref)/javascript/i18n/phonenumbers/metadata.js")!
|
||||
let phoneMetadataForTesting = URL(string: "https://raw.githubusercontent.com/google/libphonenumber/\(ref)/javascript/i18n/phonenumbers/metadatafortesting.js")!
|
||||
let shortNumberMetadata = URL(string: "https://raw.githubusercontent.com/google/libphonenumber/\(ref)/javascript/i18n/phonenumbers/shortnumbermetadata.js")!
|
||||
|
||||
let currentDir = FileManager.default.currentDirectoryPath
|
||||
let baseURL = URL(fileURLWithPath: currentDir).appendingPathComponent("generatedJSON")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user