mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Refactoring
This commit is contained in:
parent
b778c66226
commit
e658555ef4
@ -698,6 +698,7 @@ ios_framework(
|
||||
":VersionInfoPlist",
|
||||
],
|
||||
minimum_os_version = "9.0",
|
||||
extension_safe = True,
|
||||
ipa_post_processor = strip_framework,
|
||||
deps = [
|
||||
"//submodules/MtProtoKit:MtProtoKit",
|
||||
@ -737,6 +738,7 @@ ios_framework(
|
||||
":VersionInfoPlist",
|
||||
],
|
||||
minimum_os_version = "9.0",
|
||||
extension_safe = True,
|
||||
ipa_post_processor = strip_framework,
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
@ -779,6 +781,7 @@ ios_framework(
|
||||
":SwiftSignalKitFramework",
|
||||
],
|
||||
minimum_os_version = "9.0",
|
||||
extension_safe = True,
|
||||
ipa_post_processor = strip_framework,
|
||||
deps = [
|
||||
"//submodules/Postbox:Postbox",
|
||||
@ -818,6 +821,7 @@ ios_framework(
|
||||
":VersionInfoPlist",
|
||||
],
|
||||
minimum_os_version = "9.0",
|
||||
extension_safe = True,
|
||||
ipa_post_processor = strip_framework,
|
||||
deps = [
|
||||
"//submodules/TelegramApi:TelegramApi",
|
||||
@ -862,6 +866,7 @@ ios_framework(
|
||||
":PostboxFramework",
|
||||
],
|
||||
minimum_os_version = "9.0",
|
||||
extension_safe = True,
|
||||
ipa_post_processor = strip_framework,
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
@ -901,6 +906,7 @@ ios_framework(
|
||||
":VersionInfoPlist",
|
||||
],
|
||||
minimum_os_version = "9.0",
|
||||
extension_safe = True,
|
||||
ipa_post_processor = strip_framework,
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
@ -987,6 +993,7 @@ ios_framework(
|
||||
":AsyncDisplayKitFramework",
|
||||
],
|
||||
minimum_os_version = "9.0",
|
||||
extension_safe = True,
|
||||
ipa_post_processor = strip_framework,
|
||||
deps = [
|
||||
"//submodules/Display:Display",
|
||||
@ -1034,6 +1041,7 @@ ios_framework(
|
||||
":DisplayFramework",
|
||||
],
|
||||
minimum_os_version = "9.0",
|
||||
extension_safe = True,
|
||||
ipa_post_processor = strip_framework,
|
||||
deps = [
|
||||
"//submodules/TelegramUI:TelegramUI",
|
||||
@ -1096,6 +1104,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"Share/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramUI:TelegramUI"
|
||||
],
|
||||
@ -1178,6 +1189,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"NotificationContent/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramUI:TelegramUI",
|
||||
":NotificationContentExtensionLink",
|
||||
@ -1269,6 +1283,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"WidgetKitWidget/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
data = [
|
||||
":WidgetAssets",
|
||||
],
|
||||
@ -1397,6 +1414,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"SiriIntents/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
data = glob([
|
||||
"SiriIntents/*.lproj/Intents.intentdefinition"
|
||||
]) + [
|
||||
@ -1496,6 +1516,9 @@ swift_library(
|
||||
srcs = glob([
|
||||
"BroadcastUpload/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramUI:TelegramUI",
|
||||
"//submodules/TelegramVoip:TelegramVoip",
|
||||
|
@ -37,7 +37,7 @@ private struct ApplicationSettings {
|
||||
private func applicationSettings(accountManager: AccountManager<TelegramAccountManagerTypes>) -> Signal<ApplicationSettings, NoError> {
|
||||
return accountManager.transaction { transaction -> ApplicationSettings in
|
||||
let loggingSettings: LoggingSettings
|
||||
if let value = transaction.getSharedData(SharedDataKeys.loggingSettings) as? LoggingSettings {
|
||||
if let value = transaction.getSharedData(SharedDataKeys.loggingSettings)?.get(LoggingSettings.self) {
|
||||
loggingSettings = value
|
||||
} else {
|
||||
loggingSettings = LoggingSettings.defaultSettings
|
||||
@ -943,7 +943,7 @@ private final class WidgetIntentHandler {
|
||||
|
||||
if let data = try? Data(contentsOf: URL(fileURLWithPath: appLockStatePath(rootPath: rootPath))), let state = try? JSONDecoder().decode(LockState.self, from: data), isAppLocked(state: state) {
|
||||
|
||||
let presentationData = WidgetPresentationData.getForExtension()
|
||||
//let presentationData = WidgetPresentationData.getForExtension()
|
||||
|
||||
let error = NSError(domain: "Locked", code: 1, userInfo: [
|
||||
NSLocalizedDescriptionKey: "Open Telegram and enter passcode to edit widget."
|
||||
|
@ -36,7 +36,7 @@ func unreadMessages(account: Account) -> Signal<[INMessage], NoError> {
|
||||
|> mapToSignal { view -> Signal<[INMessage], NoError> in
|
||||
var signals: [Signal<[INMessage], NoError>] = []
|
||||
for entry in view.0.entries {
|
||||
if case let .MessageEntry(index, _, readState, notificationSettings, _, _, _, _, _, _) = entry {
|
||||
if case let .MessageEntry(index, _, readState, isMuted, _, _, _, _, _, _) = entry {
|
||||
if index.messageIndex.id.peerId.namespace != Namespaces.Peer.CloudUser {
|
||||
continue
|
||||
}
|
||||
@ -47,12 +47,6 @@ func unreadMessages(account: Account) -> Signal<[INMessage], NoError> {
|
||||
hasUnread = readState.count != 0
|
||||
fixedCombinedReadStates = .peer([index.messageIndex.id.peerId: readState])
|
||||
}
|
||||
var isMuted = false
|
||||
if let notificationSettings = notificationSettings as? TelegramPeerNotificationSettings {
|
||||
if case let .muted(until) = notificationSettings.muteState, until >= Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) {
|
||||
isMuted = true
|
||||
}
|
||||
}
|
||||
|
||||
if !isMuted && hasUnread {
|
||||
signals.append(account.postbox.aroundMessageHistoryViewForLocation(.peer(index.messageIndex.id.peerId), anchor: .upperBound, count: 10, fixedCombinedReadStates: fixedCombinedReadStates, topTaggedMessageIdNamespaces: Set(), tagMask: nil, appendMessagesFromTheSameGroup: false, namespaces: .not(Namespaces.Message.allScheduled), orderStatistics: .combinedLocation)
|
||||
|
@ -171,7 +171,7 @@ private func getCommonTimeline(friends: [Friend]?, in context: TimelineProviderC
|
||||
var mappedMessage: WidgetDataPeer.Message?
|
||||
if let index = transaction.getTopPeerMessageIndex(peerId: peer.id) {
|
||||
if let message = transaction.getMessage(index.id) {
|
||||
mappedMessage = WidgetDataPeer.Message(accountPeerId: state.peerId, message: message)
|
||||
mappedMessage = WidgetDataPeer.Message(accountPeerId: state.peerId, message: EngineMessage(message))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,17 @@
|
||||
import Postbox
|
||||
|
||||
public final class EngineMediaResource {
|
||||
private let resource: MediaResource
|
||||
|
||||
public init(_ resource: MediaResource) {
|
||||
self.resource = resource
|
||||
}
|
||||
|
||||
public func _asResource() -> MediaResource {
|
||||
return self.resource
|
||||
}
|
||||
}
|
||||
|
||||
public enum EngineMedia {
|
||||
public typealias Id = MediaId
|
||||
|
||||
|
@ -227,7 +227,7 @@ final class WidgetDataContext {
|
||||
name = peer.debugDisplayTitle
|
||||
}
|
||||
|
||||
result.append(WidgetDataPeer(id: peerId.toInt64(), name: name, lastName: lastName, letters: [], avatarPath: nil, badge: nil, message: WidgetDataPeer.Message(accountPeerId: account.peerId, message: message)))
|
||||
result.append(WidgetDataPeer(id: peerId.toInt64(), name: name, lastName: lastName, letters: [], avatarPath: nil, badge: nil, message: WidgetDataPeer.Message(accountPeerId: account.peerId, message: EngineMessage(message))))
|
||||
}
|
||||
result.sort(by: { lhs, rhs in
|
||||
return lhs.id < rhs.id
|
||||
|
@ -13,7 +13,6 @@ swift_library(
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
||||
"//submodules/ItemListUI:ItemListUI",
|
||||
|
@ -2,7 +2,6 @@ import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import SwiftSignalKit
|
||||
import TgVoipWebrtc
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
|
||||
private final class ContextQueueImpl: NSObject, OngoingCallThreadLocalContextQueueWebrtc {
|
||||
|
@ -15,7 +15,6 @@ swift_library(
|
||||
"//submodules/GradientBackground:GradientBackground",
|
||||
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/AccountContext:AccountContext",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/WallpaperResources:WallpaperResources",
|
||||
|
@ -8,7 +8,6 @@ import TelegramCore
|
||||
import AccountContext
|
||||
import SwiftSignalKit
|
||||
import WallpaperResources
|
||||
import Postbox
|
||||
import FastBlur
|
||||
|
||||
private let motionAmount: CGFloat = 32.0
|
||||
@ -395,7 +394,7 @@ public final class WallpaperBackgroundNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
private struct PatternKey: Equatable {
|
||||
var mediaId: MediaId
|
||||
var mediaId: EngineMedia.Id
|
||||
var isLight: Bool
|
||||
}
|
||||
private static var cachedSharedPattern: (PatternKey, UIImage)?
|
||||
@ -626,19 +625,16 @@ public final class WallpaperBackgroundNode: ASDisplayNode {
|
||||
if let cachedValidPatternImage = WallpaperBackgroundNode.cachedValidPatternImage, cachedValidPatternImage.generated.wallpaper == wallpaper {
|
||||
self.validPatternImage = ValidPatternImage(wallpaper: cachedValidPatternImage.generated.wallpaper, generate: cachedValidPatternImage.generate)
|
||||
} else {
|
||||
func reference(for resource: MediaResource, media: Media, message: Message?) -> MediaResourceReference {
|
||||
if let message = message {
|
||||
return .media(media: .message(message: MessageReference(message), media: media), resource: resource)
|
||||
}
|
||||
return .wallpaper(wallpaper: .slug(file.slug), resource: resource)
|
||||
func reference(for resource: EngineMediaResource, media: EngineMedia) -> MediaResourceReference {
|
||||
return .wallpaper(wallpaper: .slug(file.slug), resource: resource._asResource())
|
||||
}
|
||||
|
||||
var convertedRepresentations: [ImageRepresentationWithReference] = []
|
||||
for representation in file.file.previewRepresentations {
|
||||
convertedRepresentations.append(ImageRepresentationWithReference(representation: representation, reference: reference(for: representation.resource, media: file.file, message: nil)))
|
||||
convertedRepresentations.append(ImageRepresentationWithReference(representation: representation, reference: reference(for: EngineMediaResource(representation.resource), media: EngineMedia(file.file))))
|
||||
}
|
||||
let dimensions = file.file.dimensions ?? PixelDimensions(width: 2000, height: 4000)
|
||||
convertedRepresentations.append(ImageRepresentationWithReference(representation: .init(dimensions: dimensions, resource: file.file.resource, progressiveSizes: [], immediateThumbnailData: nil), reference: reference(for: file.file.resource, media: file.file, message: nil)))
|
||||
convertedRepresentations.append(ImageRepresentationWithReference(representation: .init(dimensions: dimensions, resource: file.file.resource, progressiveSizes: [], immediateThumbnailData: nil), reference: reference(for: EngineMediaResource(file.file.resource), media: EngineMedia(file.file))))
|
||||
|
||||
let signal = patternWallpaperImage(account: self.context.account, accountManager: self.context.sharedContext.accountManager, representations: convertedRepresentations, mode: .screen, autoFetchFullSize: true)
|
||||
self.patternImageDisposable.set((signal
|
||||
|
@ -11,7 +11,6 @@ swift_library(
|
||||
],
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/WidgetItems:WidgetItems",
|
||||
],
|
||||
|
@ -1,11 +1,9 @@
|
||||
import Foundation
|
||||
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import WidgetItems
|
||||
|
||||
public extension WidgetDataPeer.Message {
|
||||
init(accountPeerId: PeerId, message: Message) {
|
||||
init(accountPeerId: EnginePeer.Id, message: EngineMessage) {
|
||||
var content: WidgetDataPeer.Message.Content = .text
|
||||
for media in message.media {
|
||||
switch media {
|
||||
|
@ -16,11 +16,11 @@
|
||||
|
||||
|
||||
@interface NSArray (NBAdditions)
|
||||
- (id)safeObjectAtIndex:(NSUInteger)index;
|
||||
- (id)customSafeObjectAtIndex:(NSUInteger)index;
|
||||
@end
|
||||
|
||||
@implementation NSArray (NBAdditions)
|
||||
- (id)safeObjectAtIndex:(NSUInteger)index {
|
||||
- (id)customSafeObjectAtIndex:(NSUInteger)index {
|
||||
@synchronized(self) {
|
||||
if (index >= [self count]) return nil;
|
||||
id res = [self objectAtIndex:index];
|
||||
@ -376,7 +376,7 @@
|
||||
for (unsigned int i = 0; i < possibleFormatsLength; ++i)
|
||||
{
|
||||
/** @type {i18n.phonenumbers.NumberFormat} */
|
||||
NBNumberFormat *numberFormat = [self.possibleFormats_ safeObjectAtIndex:i];
|
||||
NBNumberFormat *numberFormat = [self.possibleFormats_ customSafeObjectAtIndex:i];
|
||||
/** @type {string} */
|
||||
NSString *pattern = numberFormat.pattern;
|
||||
|
||||
@ -424,7 +424,7 @@
|
||||
for (unsigned int i = 0; i < formatListLength; ++i)
|
||||
{
|
||||
/** @type {i18n.phonenumbers.NumberFormat} */
|
||||
NBNumberFormat *format = [formatList safeObjectAtIndex:i];
|
||||
NBNumberFormat *format = [formatList customSafeObjectAtIndex:i];
|
||||
/** @type {BOOL} */
|
||||
BOOL nationalPrefixIsUsedByCountry = (self.currentMetaData_.nationalPrefix && self.currentMetaData_.nationalPrefix.length > 0);
|
||||
|
||||
@ -473,7 +473,7 @@
|
||||
for (NSUInteger i = 0; i < possibleFormatsLength; ++i)
|
||||
{
|
||||
/** @type {i18n.phonenumbers.NumberFormat} */
|
||||
NBNumberFormat *format = [self.possibleFormats_ safeObjectAtIndex:i];
|
||||
NBNumberFormat *format = [self.possibleFormats_ customSafeObjectAtIndex:i];
|
||||
|
||||
if (format.leadingDigitsPatterns.count == 0) {
|
||||
// Keep everything that isn't restricted by leading digits.
|
||||
@ -485,7 +485,7 @@
|
||||
NSInteger lastLeadingDigitsPattern = MIN(indexOfLeadingDigitsPattern, format.leadingDigitsPatterns.count - 1);
|
||||
|
||||
/** @type {string} */
|
||||
NSString *leadingDigitsPattern = [format.leadingDigitsPatterns safeObjectAtIndex:lastLeadingDigitsPattern];
|
||||
NSString *leadingDigitsPattern = [format.leadingDigitsPatterns customSafeObjectAtIndex:lastLeadingDigitsPattern];
|
||||
|
||||
if ([self.phoneUtil_ stringPositionByRegex:leadingDigits regex:leadingDigitsPattern] == 0) {
|
||||
[possibleFormats addObject:format];
|
||||
@ -554,7 +554,7 @@
|
||||
|
||||
// this match will always succeed
|
||||
/** @type {string} */
|
||||
NSString *aPhoneNumber = [m safeObjectAtIndex:0];
|
||||
NSString *aPhoneNumber = [m customSafeObjectAtIndex:0];
|
||||
// No formatting template can be created if the number of digits entered so
|
||||
// far is longer than the maximum the current formatting rule can accommodate.
|
||||
if (aPhoneNumber.length < self.nationalNumber_.length) {
|
||||
@ -1101,7 +1101,7 @@
|
||||
NSString *nationalPrefixForParsing = [NSString stringWithFormat:@"^(?:%@)", self.currentMetaData_.nationalPrefixForParsing];
|
||||
/** @type {Array.<string>} */
|
||||
NSArray *m = [self.phoneUtil_ matchedStringByRegex:nationalNumber regex:nationalPrefixForParsing];
|
||||
NSString *firstString = [m safeObjectAtIndex:0];
|
||||
NSString *firstString = [m customSafeObjectAtIndex:0];
|
||||
if (m != nil && firstString != nil && firstString.length > 0) {
|
||||
// When the national prefix is detected, we use international formatting
|
||||
// rules instead of national ones, because national formatting rules could
|
||||
@ -1135,7 +1135,7 @@
|
||||
/** @type {Array.<string>} */
|
||||
NSArray *m = [self.phoneUtil_ matchedStringByRegex:accruedInputWithoutFormatting regex:internationalPrefix];
|
||||
|
||||
NSString *firstString = [m safeObjectAtIndex:0];
|
||||
NSString *firstString = [m customSafeObjectAtIndex:0];
|
||||
|
||||
if (m != nil && firstString != nil && firstString.length > 0) {
|
||||
self.isCompleteNumber_ = YES;
|
||||
|
@ -8,11 +8,11 @@
|
||||
#import "NBPhoneMetaData.h"
|
||||
|
||||
@interface NSArray (NBAdditions)
|
||||
- (id)safeObjectAtIndex:(NSUInteger)index;
|
||||
- (id)customSafeObjectAtIndex:(NSUInteger)index;
|
||||
@end
|
||||
|
||||
@implementation NSArray (NBAdditions)
|
||||
- (id)safeObjectAtIndex:(NSUInteger)index {
|
||||
- (id)customSafeObjectAtIndex:(NSUInteger)index {
|
||||
@synchronized(self) {
|
||||
if (index >= [self count]) return nil;
|
||||
id res = [self objectAtIndex:index];
|
||||
@ -228,34 +228,34 @@ NSString *letters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
[contents appendString:@" self = [super init];\n"];
|
||||
[contents appendString:@" if (self) {\n"];
|
||||
|
||||
/* 1 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:1] name:@"self.generalDesc"]];
|
||||
/* 2 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:2] name:@"self.fixedLine"]];
|
||||
/* 3 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:3] name:@"self.mobile"]];
|
||||
/* 4 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:4] name:@"self.tollFree"]];
|
||||
/* 5 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:5] name:@"self.premiumRate"]];
|
||||
/* 6 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:6] name:@"self.sharedCost"]];
|
||||
/* 7 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:7] name:@"self.personalNumber"]];
|
||||
/* 8 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:8] name:@"self.voip"]];
|
||||
/* 1 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:1] name:@"self.generalDesc"]];
|
||||
/* 2 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:2] name:@"self.fixedLine"]];
|
||||
/* 3 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:3] name:@"self.mobile"]];
|
||||
/* 4 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:4] name:@"self.tollFree"]];
|
||||
/* 5 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:5] name:@"self.premiumRate"]];
|
||||
/* 6 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:6] name:@"self.sharedCost"]];
|
||||
/* 7 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:7] name:@"self.personalNumber"]];
|
||||
/* 8 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:8] name:@"self.voip"]];
|
||||
|
||||
/* 21 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:21] name:@"self.pager"]];
|
||||
/* 25 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:25] name:@"self.uan"]];
|
||||
/* 27 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:27] name:@"self.emergency"]];
|
||||
/* 28 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:28] name:@"self.voicemail"]];
|
||||
/* 24 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata safeObjectAtIndex:24] name:@"self.noInternationalDialling"]];
|
||||
/* 9 */ [contents appendFormat:@" self.codeID = %@;\n", STR_VAL([currentMetadata safeObjectAtIndex:9])];
|
||||
/* 10 */ [contents appendFormat:@" self.countryCode = %@;\n", NUM_VAL([currentMetadata safeObjectAtIndex:10])];
|
||||
/* 11 */ [contents appendFormat:@" self.internationalPrefix = %@;\n", STR_VAL([currentMetadata safeObjectAtIndex:11])];
|
||||
/* 17 */ [contents appendFormat:@" self.preferredInternationalPrefix = %@;\n", STR_VAL([currentMetadata safeObjectAtIndex:17])];
|
||||
/* 12 */ [contents appendFormat:@" self.nationalPrefix = %@;\n", STR_VAL([currentMetadata safeObjectAtIndex:12])];
|
||||
/* 13 */ [contents appendFormat:@" self.preferredExtnPrefix = %@;\n", STR_VAL([currentMetadata safeObjectAtIndex:13])];
|
||||
/* 15 */ [contents appendFormat:@" self.nationalPrefixForParsing = %@;\n", STR_VAL([currentMetadata safeObjectAtIndex:15])];
|
||||
/* 16 */ [contents appendFormat:@" self.nationalPrefixTransformRule = %@;\n", STR_VAL([currentMetadata safeObjectAtIndex:16])];
|
||||
/* 18 */ [contents appendFormat:@" self.sameMobileAndFixedLinePattern = %@;\n", [[currentMetadata safeObjectAtIndex:18] boolValue] ? @"YES":@"NO"];
|
||||
/* 19 */ [contents appendString:[self phoneNumberFormatArrayWithData:[currentMetadata safeObjectAtIndex:19] name:@"self.numberFormats"]]; // NBNumberFormat array
|
||||
/* 20 */ [contents appendString:[self phoneNumberFormatArrayWithData:[currentMetadata safeObjectAtIndex:20] name:@"self.intlNumberFormats"]]; // NBNumberFormat array
|
||||
/* 22 */ [contents appendFormat:@" self.mainCountryForCode = %@;\n", [[currentMetadata safeObjectAtIndex:22] boolValue] ? @"YES":@"NO"];
|
||||
/* 23 */ [contents appendFormat:@" self.leadingDigits = %@;\n", STR_VAL([currentMetadata safeObjectAtIndex:23])];
|
||||
/* 26 */ [contents appendFormat:@" self.leadingZeroPossible = %@;\n", [[currentMetadata safeObjectAtIndex:26] boolValue] ? @"YES":@"NO"];
|
||||
/* 21 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:21] name:@"self.pager"]];
|
||||
/* 25 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:25] name:@"self.uan"]];
|
||||
/* 27 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:27] name:@"self.emergency"]];
|
||||
/* 28 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:28] name:@"self.voicemail"]];
|
||||
/* 24 */ [contents appendString:[self phoneNumberDescWithData:[currentMetadata customSafeObjectAtIndex:24] name:@"self.noInternationalDialling"]];
|
||||
/* 9 */ [contents appendFormat:@" self.codeID = %@;\n", STR_VAL([currentMetadata customSafeObjectAtIndex:9])];
|
||||
/* 10 */ [contents appendFormat:@" self.countryCode = %@;\n", NUM_VAL([currentMetadata customSafeObjectAtIndex:10])];
|
||||
/* 11 */ [contents appendFormat:@" self.internationalPrefix = %@;\n", STR_VAL([currentMetadata customSafeObjectAtIndex:11])];
|
||||
/* 17 */ [contents appendFormat:@" self.preferredInternationalPrefix = %@;\n", STR_VAL([currentMetadata customSafeObjectAtIndex:17])];
|
||||
/* 12 */ [contents appendFormat:@" self.nationalPrefix = %@;\n", STR_VAL([currentMetadata customSafeObjectAtIndex:12])];
|
||||
/* 13 */ [contents appendFormat:@" self.preferredExtnPrefix = %@;\n", STR_VAL([currentMetadata customSafeObjectAtIndex:13])];
|
||||
/* 15 */ [contents appendFormat:@" self.nationalPrefixForParsing = %@;\n", STR_VAL([currentMetadata customSafeObjectAtIndex:15])];
|
||||
/* 16 */ [contents appendFormat:@" self.nationalPrefixTransformRule = %@;\n", STR_VAL([currentMetadata customSafeObjectAtIndex:16])];
|
||||
/* 18 */ [contents appendFormat:@" self.sameMobileAndFixedLinePattern = %@;\n", [[currentMetadata customSafeObjectAtIndex:18] boolValue] ? @"YES":@"NO"];
|
||||
/* 19 */ [contents appendString:[self phoneNumberFormatArrayWithData:[currentMetadata customSafeObjectAtIndex:19] name:@"self.numberFormats"]]; // NBNumberFormat array
|
||||
/* 20 */ [contents appendString:[self phoneNumberFormatArrayWithData:[currentMetadata customSafeObjectAtIndex:20] name:@"self.intlNumberFormats"]]; // NBNumberFormat array
|
||||
/* 22 */ [contents appendFormat:@" self.mainCountryForCode = %@;\n", [[currentMetadata customSafeObjectAtIndex:22] boolValue] ? @"YES":@"NO"];
|
||||
/* 23 */ [contents appendFormat:@" self.leadingDigits = %@;\n", STR_VAL([currentMetadata customSafeObjectAtIndex:23])];
|
||||
/* 26 */ [contents appendFormat:@" self.leadingZeroPossible = %@;\n", [[currentMetadata customSafeObjectAtIndex:26] boolValue] ? @"YES":@"NO"];
|
||||
|
||||
[contents appendString:@" }\n"];
|
||||
[contents appendString:@" return self;\n"];
|
||||
@ -346,7 +346,7 @@ NSString *letters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
- (NSString *)phoneNumberDescWithData:(id)value
|
||||
{
|
||||
NSString *initSentance = [NSString stringWithFormat:@"[[NBPhoneNumberDesc alloc] initWithNationalNumberPattern:%@ withPossibleNumberPattern:%@ withExample:%@]",
|
||||
STR_VAL([value safeObjectAtIndex:2]), STR_VAL([value safeObjectAtIndex:3]), STR_VAL([value safeObjectAtIndex:6])];
|
||||
STR_VAL([value customSafeObjectAtIndex:2]), STR_VAL([value customSafeObjectAtIndex:3]), STR_VAL([value customSafeObjectAtIndex:6])];
|
||||
return initSentance;
|
||||
}
|
||||
|
||||
@ -359,15 +359,15 @@ NSString *letters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
NSString *arrayName = [NSString stringWithFormat:@"%@_patternArray", cleanName];
|
||||
|
||||
if (value != nil && [value isKindOfClass:[NSArray class]]) {
|
||||
/* 1 */ NSString *pattern = [value safeObjectAtIndex:1];
|
||||
/* 2 */ NSString *format = [value safeObjectAtIndex:2];
|
||||
/* 4 */ NSString *nationalPrefixFormattingRule = [value safeObjectAtIndex:4];
|
||||
/* 6 */ BOOL nationalPrefixOptionalWhenFormatting = [[value safeObjectAtIndex:6] boolValue];
|
||||
/* 5 */ NSString *domesticCarrierCodeFormattingRule = [value safeObjectAtIndex:5];
|
||||
/* 1 */ NSString *pattern = [value customSafeObjectAtIndex:1];
|
||||
/* 2 */ NSString *format = [value customSafeObjectAtIndex:2];
|
||||
/* 4 */ NSString *nationalPrefixFormattingRule = [value customSafeObjectAtIndex:4];
|
||||
/* 6 */ BOOL nationalPrefixOptionalWhenFormatting = [[value customSafeObjectAtIndex:6] boolValue];
|
||||
/* 5 */ NSString *domesticCarrierCodeFormattingRule = [value customSafeObjectAtIndex:5];
|
||||
|
||||
[contents appendFormat:@"\n NSMutableArray *%@ = [[NSMutableArray alloc] init];\n", arrayName];
|
||||
|
||||
/* 3 */ id tmpData = [value safeObjectAtIndex:3];
|
||||
/* 3 */ id tmpData = [value customSafeObjectAtIndex:3];
|
||||
|
||||
if (tmpData != nil && [tmpData isKindOfClass:[NSArray class]]) {
|
||||
for (id numFormat in tmpData) {
|
||||
|
@ -7,11 +7,11 @@
|
||||
#import "NBPhoneNumberDesc.h"
|
||||
|
||||
@interface NSArray (NBAdditions)
|
||||
- (id)safeObjectAtIndex:(NSUInteger)index;
|
||||
- (id)customSafeObjectAtIndex:(NSUInteger)index;
|
||||
@end
|
||||
|
||||
@implementation NSArray (NBAdditions)
|
||||
- (id)safeObjectAtIndex:(NSUInteger)index {
|
||||
- (id)customSafeObjectAtIndex:(NSUInteger)index {
|
||||
@synchronized(self) {
|
||||
if (index >= [self count]) return nil;
|
||||
id res = [self objectAtIndex:index];
|
||||
@ -33,9 +33,9 @@
|
||||
NSString *exp = nil;
|
||||
|
||||
if (data != nil && [data isKindOfClass:[NSArray class]]) {
|
||||
/* 2 */ nnp = [data safeObjectAtIndex:2];
|
||||
/* 3 */ pnp = [data safeObjectAtIndex:3];
|
||||
/* 6 */ exp = [data safeObjectAtIndex:6];
|
||||
/* 2 */ nnp = [data customSafeObjectAtIndex:2];
|
||||
/* 3 */ pnp = [data customSafeObjectAtIndex:3];
|
||||
/* 6 */ exp = [data customSafeObjectAtIndex:6];
|
||||
}
|
||||
|
||||
return [self initWithNationalNumberPattern:nnp withPossibleNumberPattern:pnp withExample:exp];
|
||||
|
Loading…
x
Reference in New Issue
Block a user