Skip to content

Commit

Permalink
Merge branch 'release/1.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackjacx committed May 9, 2023
2 parents 98b7b9a + 832a1a9 commit dc51a17
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 43 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* Implement DisplayState - [@Blackjacx](https://github.com/Blackjacx).
* Inject config directly in ViewController - [@Blackjacx](https://github.com/Blackjacx).

## [1.9.0] - 2023-05-09Z
* [#49](https://github.com/Blackjacx/Columbus/pull/49): Add fallback for CTCarrier deprecation - [@mic-ioki](https://github.com/mic-ioki).
* Use default country for the initial country code - [@Blackjacx](https://github.com/Blackjacx).
* Update Copyright - [@Blackjacx](https://github.com/Blackjacx).

## [1.8.0] - 2023-05-02Z
* Remove auto assign to project workflow - [@Blackjacx](https://github.com/Blackjacx).
* Make CoreTelephony Approach Debuggable - [@Blackjacx](https://github.com/Blackjacx).
Expand Down
2 changes: 1 addition & 1 deletion Columbus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Columbus'
s.version = '1.8.1'
s.version = '1.9.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A country picker for iOS, tvOS and watchOS.'
s.description = <<-DESC
Expand Down
16 changes: 8 additions & 8 deletions Columbus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,11 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 36;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 35;
DYLIB_CURRENT_VERSION = 36;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand Down Expand Up @@ -725,10 +725,10 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 36;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 35;
DYLIB_CURRENT_VERSION = 36;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand Down Expand Up @@ -906,11 +906,11 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 36;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 35;
DYLIB_CURRENT_VERSION = 36;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand Down Expand Up @@ -949,10 +949,10 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 36;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 35;
DYLIB_CURRENT_VERSION = 36;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand Down
7 changes: 4 additions & 3 deletions Example/Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus_iOS_Example
//
// Created by Stefan Herold on 23.06.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand All @@ -20,14 +20,15 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
window = UIWindow(frame: UIScreen.main.bounds)

let config = CountryPickerConfig()
var countryPicker = CountryPickerViewController(config: config, initialCountryCode: "DE") { (country) in
let defaultCountryCode = CountryPickerViewController.defaultCountry().isoCountryCode
var countryPicker = CountryPickerViewController(config: config, initialCountryCode: defaultCountryCode) { (country) in
print("Programmatic: \(country)")
}

#if os(iOS)
let storyboard = UIStoryboard(name: "CountryPickerStoryboard", bundle: nil)
countryPicker = storyboard.instantiateViewController(identifier: "picker") { (coder) -> CountryPickerViewController? in
CountryPickerViewController(coder: coder, config: config, initialCountryCode: "DE") { (country) in
CountryPickerViewController(coder: coder, config: config, initialCountryCode: defaultCountryCode) { (country) in
print("Storyboard: \(country)")
}
}
Expand Down
2 changes: 1 addition & 1 deletion Example/Source/UIColor+SemanticColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus-iOS
//
// Created by Stefan Herold on 31.01.20.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.759.0)
aws-sdk-core (3.171.0)
aws-partitions (1.761.0)
aws-sdk-core (3.172.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.64.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.121.0)
aws-sdk-s3 (1.122.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/ColumbusMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 22.06.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import Foundation
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/Configurable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 21.06.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/Country.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 21.06.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/CountryCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 21.06.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/CountryList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 22.06.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 05.02.21.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand Down
26 changes: 17 additions & 9 deletions Source/Classes/CountryPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 22.06.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand Down Expand Up @@ -266,15 +266,23 @@ public final class CountryPickerViewController: UIViewController {
// Core Telephony Approach

#if os(iOS) && !targetEnvironment(simulator)
guard let cellularProviders = CTTelephonyNetworkInfo().serviceSubscriberCellularProviders else {
return defaultCountry
}
let carriers = cellularProviders.map(\.value)

guard let firstIsoCountryCode = carriers.compactMap(\.isoCountryCode).first?.uppercased() else {
return defaultCountry

// CTCarrier is deprecated from 16.4 and Locale region is used as fallback.
// see: https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-16_4-release-notes#Deprecations

var deviceIsoCountryCode: String?
if #available(iOS 16.4, *) {
deviceIsoCountryCode = Locale.current.language.region?.identifier
} else {
guard let cellularProviders = CTTelephonyNetworkInfo().serviceSubscriberCellularProviders else {
return defaultCountry
}
let carriers = cellularProviders.map(\.value)
deviceIsoCountryCode = carriers.compactMap(\.isoCountryCode).first?.uppercased()
}
guard let country = (countries.first { $0.isoCountryCode.compare(firstIsoCountryCode, options: .caseInsensitive) == .orderedSame }) else {

guard let deviceIsoCountryCode,
let country = (countries.first { $0.isoCountryCode.compare(deviceIsoCountryCode, options: .caseInsensitive) == .orderedSame }) else {
return defaultCountry
}
return country
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/CountryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 21.06.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/EmptyDecodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 20.02.21.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import Foundation
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/UIView+Subviews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 13.08.19.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import UIKit
Expand Down
2 changes: 1 addition & 1 deletion Source/Columbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 21.12.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

#import <UIKit/UIKit.h>
Expand Down
4 changes: 2 additions & 2 deletions Source/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.8.1</string>
<string>1.9.0</string>
<key>CFBundleVersion</key>
<string>35</string>
<string>36</string>
</dict>
</plist>
6 changes: 3 additions & 3 deletions Source/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.8.1</string>
<string>1.9.0</string>
<key>CFBundleVersion</key>
<string>35</string>
<string>36</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2022 Stefan Herold. All rights reserved.</string>
<string>Copyright © 2023 Stefan Herold. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion Tests/ColumbusTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Columbus
//
// Created by Stefan Herold on 24.12.18.
// Copyright © 2022 Stefan Herold. All rights reserved.
// Copyright © 2023 Stefan Herold. All rights reserved.
//

import XCTest
Expand Down
4 changes: 2 additions & 2 deletions Tests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.8.1</string>
<string>1.9.0</string>
<key>CFBundleVersion</key>
<string>35</string>
<string>36</string>
</dict>
</plist>

0 comments on commit dc51a17

Please sign in to comment.