Skip to content

Commit

Permalink
Merge pull request #1840 from nextcloud/migrate-spm-packages
Browse files Browse the repository at this point in the history
Migrate more packages from CocoaPods to SPM
  • Loading branch information
Ivansss authored Oct 17, 2024
2 parents 287bba5 + 3d529c4 commit 914799e
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 29 deletions.
100 changes: 100 additions & 0 deletions NextcloudTalk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@
1FBC3BE92B61BD09003909E0 /* TestBaseRealm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FBC3BE82B61BD09003909E0 /* TestBaseRealm.swift */; };
1FC18FC02CB7EA300058F621 /* AVRoutePickerViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FC18FBF2CB7EA300058F621 /* AVRoutePickerViewExtension.swift */; };
1FC18FC22CB7EA5C0058F621 /* RPSystemBroadcastPickerViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FC18FC12CB7EA5C0058F621 /* RPSystemBroadcastPickerViewExtension.swift */; };
1FC4B3222CC0538B00D28138 /* JDStatusBarNotification in Frameworks */ = {isa = PBXBuildFile; productRef = 1FC4B3212CC0538B00D28138 /* JDStatusBarNotification */; };
1FC4B3252CC054BC00D28138 /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = 1FC4B3242CC054BC00D28138 /* UICKeyChainStore */; };
1FC4B3272CC0562600D28138 /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = 1FC4B3262CC0562600D28138 /* UICKeyChainStore */; };
1FC4B3292CC0562E00D28138 /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = 1FC4B3282CC0562E00D28138 /* UICKeyChainStore */; };
1FC4B32B2CC0564100D28138 /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = 1FC4B32A2CC0564100D28138 /* UICKeyChainStore */; };
1FC4B3312CC057B700D28138 /* MBProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = 1FC4B3302CC057B700D28138 /* MBProgressHUD */; };
1FC4B3332CC057DD00D28138 /* MBProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = 1FC4B3322CC057DD00D28138 /* MBProgressHUD */; };
1FC4B3362CC0586A00D28138 /* libPhoneNumber in Frameworks */ = {isa = PBXBuildFile; productRef = 1FC4B3352CC0586A00D28138 /* libPhoneNumber */; };
1FC940B92A5F21FC00FFFADE /* SwiftMarkdownObjCBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0A1D432A5F1FA800A25433 /* SwiftMarkdownObjCBridge.swift */; };
1FC940BA2A5F21FD00FFFADE /* SwiftMarkdownObjCBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0A1D432A5F1FA800A25433 /* SwiftMarkdownObjCBridge.swift */; };
1FCE3D532C9B5918009C68A9 /* SwiftyGif in Frameworks */ = {isa = PBXBuildFile; productRef = 1FCE3D522C9B5918009C68A9 /* SwiftyGif */; };
Expand Down Expand Up @@ -1239,6 +1247,7 @@
1F759C322B63CBA5000534AB /* Realm in Frameworks */,
1F77A6002AB9A50D007B6037 /* NextcloudKit in Frameworks */,
1F77A60C2AB9A5BE007B6037 /* CDMarkdownKit in Frameworks */,
1FC4B32B2CC0564100D28138 /* UICKeyChainStore in Frameworks */,
1FF2FD5D2AB99CCB000C9905 /* ReplayKit.framework in Frameworks */,
1F77A5EF2AB9A41E007B6037 /* SDWebImage in Frameworks */,
1FF1361A2BFBC841006A6101 /* SwiftyAttributes in Frameworks */,
Expand All @@ -1259,15 +1268,19 @@
1F45A1212A01D8BA005FE87D /* SDWebImageSVGKitPlugin in Frameworks */,
1F628CBA2842BAAF0083A425 /* QRCodeReader in Frameworks */,
1FAB2E7D2AC99326001214EB /* TOCropViewController in Frameworks */,
1FC4B3252CC054BC00D28138 /* UICKeyChainStore in Frameworks */,
2C90E5CF1EDF23A00093D85A /* WebKit.framework in Frameworks */,
2C90E5691EDDE13A0093D85A /* UIKit.framework in Frameworks */,
80CDF8C42A8E098900CB57AE /* SwiftUIIntrospect in Frameworks */,
2C90E5671EDDE1340093D85A /* CoreGraphics.framework in Frameworks */,
1F45A1162A01D6EC005FE87D /* SDWebImage in Frameworks */,
1FC4B3362CC0586A00D28138 /* libPhoneNumber in Frameworks */,
2C90E5641EDDE0FB0093D85A /* Foundation.framework in Frameworks */,
1F468E7628DCC6C60099597B /* Dynamic in Frameworks */,
1F759C2C2B63CB93000534AB /* Realm in Frameworks */,
1FAB2E882ACD44D0001214EB /* WebRTC in Frameworks */,
1FC4B3332CC057DD00D28138 /* MBProgressHUD in Frameworks */,
1FC4B3222CC0538B00D28138 /* JDStatusBarNotification in Frameworks */,
1F0ECBF52A68274400921E90 /* CDMarkdownKit in Frameworks */,
1F66B72F29FABD01003FB168 /* SwiftyAttributes in Frameworks */,
1F7AE07829142CA1009F72AD /* NextcloudKit in Frameworks */,
Expand All @@ -1284,6 +1297,8 @@
1F0ECBF92A68277C00921E90 /* CDMarkdownKit in Frameworks */,
8789AE73BFCAA413B43319C0 /* libPods-ShareExtension.a in Frameworks */,
1F759C302B63CBA0000534AB /* Realm in Frameworks */,
1FC4B3292CC0562E00D28138 /* UICKeyChainStore in Frameworks */,
1FC4B3312CC057B700D28138 /* MBProgressHUD in Frameworks */,
1F45A11A2A01D70E005FE87D /* SDWebImage in Frameworks */,
1F8848122A75B68D00063860 /* IntentsUI.framework in Frameworks */,
1F35F8FD2AEEDCCB00044BDA /* AudioToolbox.framework in Frameworks */,
Expand All @@ -1299,6 +1314,7 @@
1F759C2E2B63CB9A000534AB /* Realm in Frameworks */,
1F45A1232A01D8F1005FE87D /* SDWebImageSVGKitPlugin in Frameworks */,
1F0ECBF72A68277000921E90 /* CDMarkdownKit in Frameworks */,
1FC4B3272CC0562600D28138 /* UICKeyChainStore in Frameworks */,
1F7AE07A29142E62009F72AD /* NextcloudKit in Frameworks */,
1F7AE07D29158878009F72AD /* IntentsUI.framework in Frameworks */,
1FF1361C2BFBC86A006A6101 /* SwiftyAttributes in Frameworks */,
Expand Down Expand Up @@ -2233,6 +2249,7 @@
1F77A60B2AB9A5BE007B6037 /* CDMarkdownKit */,
1F759C312B63CBA5000534AB /* Realm */,
1FF136192BFBC841006A6101 /* SwiftyAttributes */,
1FC4B32A2CC0564100D28138 /* UICKeyChainStore */,
);
productName = BroadcastUploadExtension;
productReference = 1FF2FD5B2AB99CCB000C9905 /* BroadcastUploadExtension.appex */;
Expand Down Expand Up @@ -2274,6 +2291,10 @@
80CDF8C32A8E098900CB57AE /* SwiftUIIntrospect */,
1F759C2B2B63CB93000534AB /* Realm */,
1FCE3D522C9B5918009C68A9 /* SwiftyGif */,
1FC4B3212CC0538B00D28138 /* JDStatusBarNotification */,
1FC4B3242CC054BC00D28138 /* UICKeyChainStore */,
1FC4B3322CC057DD00D28138 /* MBProgressHUD */,
1FC4B3352CC0586A00D28138 /* libPhoneNumber */,
);
productName = NextcloudTalk;
productReference = 2C05747D1EDD9E8E00D9E7F2 /* NextcloudTalk.app */;
Expand Down Expand Up @@ -2301,6 +2322,8 @@
1FAB2E7E2AC99367001214EB /* TOCropViewController */,
1F35F8F42AEEDA9800044BDA /* SwiftyAttributes */,
1F759C2F2B63CBA0000534AB /* Realm */,
1FC4B3282CC0562E00D28138 /* UICKeyChainStore */,
1FC4B3302CC057B700D28138 /* MBProgressHUD */,
);
productName = ShareExtension;
productReference = 2C62AFA324C08845007E460A /* ShareExtension.appex */;
Expand All @@ -2327,6 +2350,7 @@
1F0ECBF62A68277000921E90 /* CDMarkdownKit */,
1F759C2D2B63CB9A000534AB /* Realm */,
1FF1361B2BFBC86A006A6101 /* SwiftyAttributes */,
1FC4B3262CC0562600D28138 /* UICKeyChainStore */,
);
productName = NotificationServiceExtension;
productReference = 2CC0014F24A1F0E900A20167 /* NotificationServiceExtension.appex */;
Expand Down Expand Up @@ -2432,6 +2456,10 @@
80CDF8C22A8E098900CB57AE /* XCRemoteSwiftPackageReference "swiftui-introspect" */,
1F759C2A2B63CB93000534AB /* XCRemoteSwiftPackageReference "realm-swift-binary" */,
1FCE3D512C9B5918009C68A9 /* XCRemoteSwiftPackageReference "SwiftyGif" */,
1FC4B3202CC0538B00D28138 /* XCRemoteSwiftPackageReference "JDStatusBarNotification" */,
1FC4B3232CC054BC00D28138 /* XCRemoteSwiftPackageReference "UICKeyChainStore" */,
1FC4B32F2CC057B700D28138 /* XCRemoteSwiftPackageReference "MBProgressHUD" */,
1FC4B3342CC0586A00D28138 /* XCRemoteSwiftPackageReference "libPhoneNumber-iOS" */,
);
productRefGroup = 2C05747E1EDD9E8E00D9E7F2 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -4290,6 +4318,38 @@
revision = 5f15c82f4b02072c1595980580eade9325e1819f;
};
};
1FC4B3202CC0538B00D28138 /* XCRemoteSwiftPackageReference "JDStatusBarNotification" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/calimarkus/JDStatusBarNotification.git";
requirement = {
kind = exactVersion;
version = 2.0.9;
};
};
1FC4B3232CC054BC00D28138 /* XCRemoteSwiftPackageReference "UICKeyChainStore" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/kishikawakatsumi/UICKeyChainStore";
requirement = {
kind = exactVersion;
version = 2.2.1;
};
};
1FC4B32F2CC057B700D28138 /* XCRemoteSwiftPackageReference "MBProgressHUD" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/matej/MBProgressHUD";
requirement = {
kind = exactVersion;
version = 1.2.0;
};
};
1FC4B3342CC0586A00D28138 /* XCRemoteSwiftPackageReference "libPhoneNumber-iOS" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/iziz/libPhoneNumber-iOS";
requirement = {
kind = exactVersion;
version = 1.2.0;
};
};
1FCE3D512C9B5918009C68A9 /* XCRemoteSwiftPackageReference "SwiftyGif" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/alexiscreuzot/SwiftyGif";
Expand Down Expand Up @@ -4507,6 +4567,46 @@
package = 1FAB2E862ACD44CF001214EB /* XCRemoteSwiftPackageReference "talk-clients-webrtc" */;
productName = WebRTC;
};
1FC4B3212CC0538B00D28138 /* JDStatusBarNotification */ = {
isa = XCSwiftPackageProductDependency;
package = 1FC4B3202CC0538B00D28138 /* XCRemoteSwiftPackageReference "JDStatusBarNotification" */;
productName = JDStatusBarNotification;
};
1FC4B3242CC054BC00D28138 /* UICKeyChainStore */ = {
isa = XCSwiftPackageProductDependency;
package = 1FC4B3232CC054BC00D28138 /* XCRemoteSwiftPackageReference "UICKeyChainStore" */;
productName = UICKeyChainStore;
};
1FC4B3262CC0562600D28138 /* UICKeyChainStore */ = {
isa = XCSwiftPackageProductDependency;
package = 1FC4B3232CC054BC00D28138 /* XCRemoteSwiftPackageReference "UICKeyChainStore" */;
productName = UICKeyChainStore;
};
1FC4B3282CC0562E00D28138 /* UICKeyChainStore */ = {
isa = XCSwiftPackageProductDependency;
package = 1FC4B3232CC054BC00D28138 /* XCRemoteSwiftPackageReference "UICKeyChainStore" */;
productName = UICKeyChainStore;
};
1FC4B32A2CC0564100D28138 /* UICKeyChainStore */ = {
isa = XCSwiftPackageProductDependency;
package = 1FC4B3232CC054BC00D28138 /* XCRemoteSwiftPackageReference "UICKeyChainStore" */;
productName = UICKeyChainStore;
};
1FC4B3302CC057B700D28138 /* MBProgressHUD */ = {
isa = XCSwiftPackageProductDependency;
package = 1FC4B32F2CC057B700D28138 /* XCRemoteSwiftPackageReference "MBProgressHUD" */;
productName = MBProgressHUD;
};
1FC4B3322CC057DD00D28138 /* MBProgressHUD */ = {
isa = XCSwiftPackageProductDependency;
package = 1FC4B32F2CC057B700D28138 /* XCRemoteSwiftPackageReference "MBProgressHUD" */;
productName = MBProgressHUD;
};
1FC4B3352CC0586A00D28138 /* libPhoneNumber */ = {
isa = XCSwiftPackageProductDependency;
package = 1FC4B3342CC0586A00D28138 /* XCRemoteSwiftPackageReference "libPhoneNumber-iOS" */;
productName = libPhoneNumber;
};
1FCE3D522C9B5918009C68A9 /* SwiftyGif */ = {
isa = XCSwiftPackageProductDependency;
package = 1FCE3D512C9B5918009C68A9 /* XCRemoteSwiftPackageReference "SwiftyGif" */;
Expand Down
2 changes: 2 additions & 0 deletions NextcloudTalk/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#import "NextcloudTalk-Swift.h"

@import UICKeyChainStore;

@interface AppDelegate ()

@property (nonatomic, strong) NSTimer *keepAliveTimer;
Expand Down
3 changes: 2 additions & 1 deletion NextcloudTalk/NCKeyChainController.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
*/

#import <Foundation/Foundation.h>
#import "UICKeyChainStore.h"

NS_ASSUME_NONNULL_BEGIN

@class UICKeyChainStore;

extern NSString * const kNCNormalPushTokenKey;
extern NSString * const kNCPushKitTokenKey;

Expand Down
3 changes: 2 additions & 1 deletion NextcloudTalk/NCKeyChainController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
#import <CommonCrypto/CommonDigest.h>

#import "NCAppBranding.h"

#import "NextcloudTalk-Swift.h"

@import UICKeyChainStore;

@implementation NCKeyChainController

NSString * const kNCTokenKey = @"ncToken";
Expand Down
1 change: 0 additions & 1 deletion NextcloudTalk/NextcloudTalk-Bridging-Header-Extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#import "ShareConfirmationCollectionViewCell.h"
#import "ShareItem.h"
#import "ShareItemController.h"
#import "MBProgressHUD.h"

#import "NCUserDefaults.h"
#import "NCIntentController.h"
Expand Down
4 changes: 0 additions & 4 deletions NextcloudTalk/NextcloudTalk-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
#import "ContactsTableViewCell.h"
#import "DetailedOptionsSelectorTableViewController.h"
#import "HeaderWithButton.h"
#import "NBPhoneNumber.h"
#import "NBPhoneNumberDefines.h"
#import "NBPhoneNumberUtil.h"
#import "NCAPIController.h"
#import "NCAppBranding.h"
#import "NCConnectionController.h"
Expand Down Expand Up @@ -75,7 +72,6 @@
#import "AutoCompletionTableViewCell.h"
#import "NCKeyChainController.h"
#import "NCIntentController.h"
#import "MBProgressHUD.h"
#import "CCCertificate.h"

#import "ScreenCapturer.h"
Expand Down
16 changes: 8 additions & 8 deletions NextcloudTalk/SettingsTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SafariServices
import SwiftUI
import ReplayKit
import SDWebImage
import libPhoneNumber

enum SettingsSection: Int {
case kSettingsSectionUser = 0
Expand Down Expand Up @@ -56,7 +57,6 @@ class SettingsTableViewController: UITableViewController, UITextFieldDelegate, U
var typingIndicatorSwitch = UISwitch()
var contactSyncSwitch = UISwitch()
var setPhoneAction: UIAlertAction?
var phoneUtil = NBPhoneNumberUtil()
var includeInRecentsSwitch = UISwitch()

var totalImageCacheSize = 0
Expand Down Expand Up @@ -349,12 +349,12 @@ class SettingsTableViewController: UITableViewController, UITextFieldDelegate, U

setPhoneNumberDialog.addTextField { [self] textField in
let location = NSLocale.current.regionCode
let countryCode = phoneUtil.getCountryCode(forRegion: location)
let countryCode = NBPhoneNumberUtil.sharedInstance().getCountryCode(forRegion: location)
if let countryCode = countryCode {
textField.text = "+\(countryCode)"
}
if let exampleNumber = try? phoneUtil.getExampleNumber(location) {
textField.placeholder = try? phoneUtil.format(exampleNumber, numberFormat: NBEPhoneNumberFormat.INTERNATIONAL)
if let exampleNumber = try? NBPhoneNumberUtil.sharedInstance().getExampleNumber(location) {
textField.placeholder = try? NBPhoneNumberUtil.sharedInstance().format(exampleNumber, numberFormat: NBEPhoneNumberFormat.INTERNATIONAL)
}
textField.keyboardType = .phonePad
textField.delegate = self
Expand Down Expand Up @@ -389,8 +389,8 @@ class SettingsTableViewController: UITableViewController, UITextFieldDelegate, U
func presentPhoneNumberErrorDialog(phoneNumber: String) {
let alertTitle = NSLocalizedString("Could not set phone number", comment: "")
var alertMessage = NSLocalizedString("An error occurred while setting phone number", comment: "")
let failedPhoneNumber = try? phoneUtil.parse(phoneNumber, defaultRegion: nil)
if let formattedPhoneNumber = try? phoneUtil.format(failedPhoneNumber, numberFormat: NBEPhoneNumberFormat.INTERNATIONAL) {
let failedPhoneNumber = try? NBPhoneNumberUtil.sharedInstance().parse(phoneNumber, defaultRegion: nil)
if let formattedPhoneNumber = try? NBPhoneNumberUtil.sharedInstance().format(failedPhoneNumber, numberFormat: NBEPhoneNumberFormat.INTERNATIONAL) {
alertMessage = NSLocalizedString("An error occurred while setting \(formattedPhoneNumber) as phone number", comment: "")
}

Expand All @@ -415,8 +415,8 @@ class SettingsTableViewController: UITableViewController, UITextFieldDelegate, U
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if textField.tag == kPhoneTextFieldTag {
let inputPhoneNumber = (textField.text as NSString?)?.replacingCharacters(in: range, with: string)
let phoneNumber = try? phoneUtil.parse(inputPhoneNumber, defaultRegion: nil)
setPhoneAction?.isEnabled = phoneUtil.isValidNumber(phoneNumber)
let phoneNumber = try? NBPhoneNumberUtil.sharedInstance().parse(inputPhoneNumber, defaultRegion: nil)
setPhoneAction?.isEnabled = NBPhoneNumberUtil.sharedInstance().isValidNumber(phoneNumber)
}
return true
}
Expand Down
7 changes: 4 additions & 3 deletions NextcloudTalk/UserProfileTableViewController+Actions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//

import Foundation
import libPhoneNumber

extension UserProfileTableViewController {

Expand Down Expand Up @@ -58,16 +59,16 @@ extension UserProfileTableViewController {
let hasPhone = !account.phone.isEmpty
setPhoneNumberDialog.addTextField { [self] textField in
let regionCode = NSLocale.current.regionCode
let countryCode = phoneUtil.getCountryCode(forRegion: regionCode)
let countryCode = NBPhoneNumberUtil.sharedInstance().getCountryCode(forRegion: regionCode)
if let countryCode = countryCode {
textField.text = "+\(countryCode)"
}
if hasPhone {
textField.text = self.account.phone
}
let exampleNumber = try? self.phoneUtil.getExampleNumber(regionCode ?? "")
let exampleNumber = try? NBPhoneNumberUtil.sharedInstance().getExampleNumber(regionCode ?? "")
if let exampleNumber = exampleNumber {
textField.placeholder = try? self.phoneUtil.format(exampleNumber, numberFormat: NBEPhoneNumberFormat.INTERNATIONAL)
textField.placeholder = try? NBPhoneNumberUtil.sharedInstance().format(exampleNumber, numberFormat: NBEPhoneNumberFormat.INTERNATIONAL)
textField.keyboardType = .phonePad
textField.delegate = self
textField.tag = self.kPhoneTextFieldTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//

import Foundation
import libPhoneNumber

extension UserProfileTableViewController: UINavigationControllerDelegate, UITextFieldDelegate, UIGestureRecognizerDelegate, UIImagePickerControllerDelegate, AvatarEditViewDelegate {

Expand Down Expand Up @@ -113,8 +114,8 @@ extension UserProfileTableViewController: UINavigationControllerDelegate, UIText
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if textField.tag == kPhoneTextFieldTag {
let inputPhoneNumber = (textField.text as NSString?)?.replacingCharacters(in: range, with: string)
let phoneNumber = try? phoneUtil.parse(inputPhoneNumber, defaultRegion: nil)
setPhoneAction.isEnabled = phoneUtil.isValidNumber(phoneNumber) && account.phone != inputPhoneNumber
let phoneNumber = try? NBPhoneNumberUtil.sharedInstance().parse(inputPhoneNumber, defaultRegion: nil)
setPhoneAction.isEnabled = NBPhoneNumberUtil.sharedInstance().isValidNumber(phoneNumber) && account.phone != inputPhoneNumber
}
return true
}
Expand Down
Loading

0 comments on commit 914799e

Please sign in to comment.