Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7dee433

Browse files
authored
Merge pull request #674 from 64characters/copy-settings
Allow the user to copy the app settings into the clipboard as text
2 parents d13b7d1 + b089085 commit 7dee433

75 files changed

Lines changed: 1156 additions & 599 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Changelog
22

33
## 1.6
4-
- macOS Big Sur
5-
- Apple silicon
6-
- Minimum deployment target 10.13
4+
- macOS Big Sur.
5+
- Apple silicon.
6+
- Minimum deployment target 10.13.
77
- Fixed an issue where matching contact for an incoming call could not
88
be found when the incoming phone number was exactly the same length
99
as the significant phone number setting and the contact's phone
1010
number was longer than that.
11+
- Remove user notification when incoming call is answered or declined.
12+
- Allow the app settings to be copied to clipboard as text.

Telephone.xcodeproj/project.pbxproj

Lines changed: 46 additions & 16 deletions
Large diffs are not rendered by default.

Telephone/AKSIPAccount.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
@import UseCases;
2323

2424
#import "AKSIPAccountDelegate.h"
25-
#import "AKSIPAccountKeys.h"
2625

2726
@class AKSIPURIParser, PJSUACallInfo;
2827

@@ -127,7 +126,8 @@ extern const NSInteger kAKSIPAccountRegistrationExpireTimeNotSpecified;
127126

128127
@property(nonatomic) NSThread *thread;
129128

130-
// Mandatory keys: kUUID, kFullName, kRealm, kUsername, kDomain.
129+
// Mandatory keys: AKSIPAccountKeys.uuid, AKSIPAccountKeys.fullName, AKSIPAccountKeys.realm, AKSIPAccountKeys.username,
130+
// AKSIPAccountKeys.domain.
131131
- (instancetype)initWithDictionary:(NSDictionary *)dict parser:(AKSIPURIParser *)parser NS_DESIGNATED_INITIALIZER;
132132
- (instancetype)init NS_UNAVAILABLE;
133133

Telephone/AKSIPAccount.m

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -225,49 +225,54 @@ - (BOOL)hasUnansweredIncomingCalls {
225225
}
226226

227227
- (instancetype)initWithDictionary:(NSDictionary *)dict parser:(AKSIPURIParser *)parser {
228-
NSParameterAssert([dict[kUUID] length] > 0);
229-
NSParameterAssert(dict[kFullName]);
230-
NSParameterAssert(dict[kRealm]);
231-
NSParameterAssert(dict[kUsername]);
232-
NSParameterAssert(dict[kDomain]);
228+
NSParameterAssert([dict[AKSIPAccountKeys.uuid] length] > 0);
229+
NSParameterAssert(dict[AKSIPAccountKeys.fullName]);
230+
NSParameterAssert(dict[AKSIPAccountKeys.realm]);
231+
NSParameterAssert(dict[AKSIPAccountKeys.username]);
232+
NSParameterAssert(dict[AKSIPAccountKeys.domain]);
233233

234234
self = [super init];
235235
if (self == nil) {
236236
return nil;
237237
}
238238

239239
SIPAddress *address = nil;
240-
if ([dict[kSIPAddress] length] > 0) {
241-
address = [[SIPAddress alloc] initWithString:dict[kSIPAddress]];
240+
if ([dict[AKSIPAccountKeys.sipAddress] length] > 0) {
241+
address = [[SIPAddress alloc] initWithString:dict[AKSIPAccountKeys.sipAddress]];
242242
} else {
243-
address = [[SIPAddress alloc] initWithUser:dict[kUsername] host:dict[kDomain]];
243+
address = [[SIPAddress alloc] initWithUser:dict[AKSIPAccountKeys.username] host:dict[AKSIPAccountKeys.domain]];
244244
}
245245

246-
_uuid = [dict[kUUID] copy];
247-
if ([dict[kTransport] isEqualToString:kTransportTCP]) {
246+
_uuid = [dict[AKSIPAccountKeys.uuid] copy];
247+
if ([dict[AKSIPAccountKeys.transport] isEqualToString:AKSIPAccountKeys.transportTCP]) {
248248
_transport = TransportTCP;
249-
} else if ([dict[kTransport] isEqualToString:kTransportTLS]) {
249+
} else if ([dict[AKSIPAccountKeys.transport] isEqualToString:AKSIPAccountKeys.transportTLS]) {
250250
_transport = TransportTLS;
251251
} else {
252252
_transport = TransportUDP;
253253
}
254-
_uri = [[URI alloc] initWithUser:address.user host:address.host displayName:dict[kFullName] transport:_transport];
254+
_uri = [[URI alloc] initWithUser:address.user
255+
host:address.host
256+
displayName:dict[AKSIPAccountKeys.fullName]
257+
transport:_transport];
255258

256-
_fullName = [dict[kFullName] copy];
259+
_fullName = [dict[AKSIPAccountKeys.fullName] copy];
257260
_SIPAddress = address.stringValue;
258-
_registrar = [[ServiceAddress alloc] initWithString:([dict[kRegistrar] length] > 0 ? dict[kRegistrar] : dict[kDomain])];
259-
_realm = [dict[kRealm] copy];
260-
_username = [dict[kUsername] copy];
261-
_domain = [dict[kDomain] copy];
262-
if ([dict[kUseProxy] boolValue]) {
263-
_proxyHost = [dict[kProxyHost] copy];
264-
self.proxyPort = [dict[kProxyPort] integerValue];
261+
_registrar = [[ServiceAddress alloc] initWithString:([dict[AKSIPAccountKeys.registrar] length] > 0 ?
262+
dict[AKSIPAccountKeys.registrar] :
263+
dict[AKSIPAccountKeys.domain])];
264+
_realm = [dict[AKSIPAccountKeys.realm] copy];
265+
_username = [dict[AKSIPAccountKeys.username] copy];
266+
_domain = [dict[AKSIPAccountKeys.domain] copy];
267+
if ([dict[AKSIPAccountKeys.useProxy] boolValue]) {
268+
_proxyHost = [dict[AKSIPAccountKeys.proxyHost] copy];
269+
self.proxyPort = [dict[AKSIPAccountKeys.proxyPort] integerValue];
265270
}
266-
self.reregistrationTime = [dict[kReregistrationTime] integerValue];
267-
_usesIPv6 = [dict[kIPVersion] isEqualToString:kIPVersion6];
268-
_updatesContactHeader = [dict[kUpdateContactHeader] boolValue];
269-
_updatesViaHeader = [dict[kUpdateViaHeader] boolValue];
270-
_updatesSDP = [dict[kUpdateSDP] boolValue];
271+
self.reregistrationTime = [dict[AKSIPAccountKeys.reregistrationTime] integerValue];
272+
_usesIPv6 = [dict[AKSIPAccountKeys.ipVersion] isEqualToString:AKSIPAccountKeys.ipVersion6];
273+
_updatesContactHeader = [dict[AKSIPAccountKeys.updateContactHeader] boolValue];
274+
_updatesViaHeader = [dict[AKSIPAccountKeys.updateViaHeader] boolValue];
275+
_updatesSDP = [dict[AKSIPAccountKeys.updateSDP] boolValue];
271276

272277
_identifier = kAKSIPUserAgentInvalidIdentifier;
273278

Telephone/AKSIPAccountKeys.h

Lines changed: 0 additions & 43 deletions
This file was deleted.

Telephone/AKSIPAccountKeys.m

Lines changed: 0 additions & 43 deletions
This file was deleted.

Telephone/AKSIPAccountKeys.swift

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// AKSIPAccountKeys.swift
3+
// Telephone
4+
//
5+
// Copyright © 2008-2016 Alexey Kuznetsov
6+
// Copyright © 2016-2021 64 Characters
7+
//
8+
// Telephone is free software: you can redistribute it and/or modify
9+
// it under the terms of the GNU General Public License as published by
10+
// the Free Software Foundation, either version 3 of the License, or
11+
// (at your option) any later version.
12+
//
13+
// Telephone is distributed in the hope that it will be useful,
14+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
// GNU General Public License for more details.
17+
//
18+
19+
import Foundation
20+
21+
@objcMembers
22+
class AKSIPAccountKeys: NSObject {
23+
static let uuid = "UUID"
24+
static let desc = "Description"
25+
static let fullName = "FullName"
26+
static let sipAddress = "SIPAddress"
27+
static let registrar = "Registrar"
28+
static let domain = "Domain"
29+
static let realm = "Realm"
30+
static let username = "Username"
31+
static let reregistrationTime = "ReregistrationTime"
32+
static let useProxy = "UseProxy"
33+
static let proxyHost = "ProxyHost"
34+
static let proxyPort = "ProxyPort"
35+
static let transport = "Transport"
36+
static let transportUDP = "UDP"
37+
static let transportTCP = "TCP"
38+
static let transportTLS = "TLS"
39+
static let ipVersion = "IPVersion"
40+
static let ipVersion4 = "4"
41+
static let ipVersion6 = "6"
42+
static let updateContactHeader = "UpdateContactHeader"
43+
static let updateViaHeader = "UpdateViaHeader"
44+
static let updateSDP = "UpdateSDP"
45+
static let useIPv6Only = "UseIPv6Only"
46+
}

Telephone/AccountController.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ - (void)makeCallToURI:(AKSIPURI *)destinationURI
266266
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
267267
AKTelephoneNumberFormatter *telephoneNumberFormatter = [[AKTelephoneNumberFormatter alloc] init];
268268
[telephoneNumberFormatter setSplitsLastFourDigits:
269-
[defaults boolForKey:kTelephoneNumberFormatterSplitsLastFourDigits]];
269+
[defaults boolForKey:UserDefaultsKeys.telephoneNumberFormatterSplitsLastFourDigits]];
270270

271271
NSString *enteredCallDestinationString = [[destinationURI user] copy];
272272

@@ -307,7 +307,7 @@ - (void)makeCallToURI:(AKSIPURI *)destinationURI
307307
[aCallController setTitle:[destinationURI SIPAddress]];
308308

309309
} else if (![enteredCallDestinationString ak_hasLetters]) {
310-
if ([enteredCallDestinationString ak_isTelephoneNumber] && [defaults boolForKey:kFormatTelephoneNumbers]) {
310+
if ([enteredCallDestinationString ak_isTelephoneNumber] && [defaults boolForKey:UserDefaultsKeys.formatTelephoneNumbers]) {
311311
[aCallController setTitle:[telephoneNumberFormatter stringForObjectValue:enteredCallDestinationString]];
312312
} else {
313313
[aCallController setTitle:enteredCallDestinationString];
@@ -325,7 +325,7 @@ - (void)makeCallToURI:(AKSIPURI *)destinationURI
325325
[aCallController setDisplayedName:[destinationURI SIPAddress]];
326326

327327
} else if ([enteredCallDestinationString ak_isTelephoneNumber] &&
328-
[defaults boolForKey:kFormatTelephoneNumbers]) {
328+
[defaults boolForKey:UserDefaultsKeys.formatTelephoneNumbers]) {
329329

330330
[aCallController setDisplayedName:
331331
[telephoneNumberFormatter stringForObjectValue:enteredCallDestinationString]];
@@ -606,7 +606,7 @@ - (void)SIPAccount:(AKSIPAccount *)account didReceiveCall:(AKSIPCall *)aCall {
606606

607607
return;
608608

609-
} else if (![[NSUserDefaults standardUserDefaults] boolForKey:kCallWaiting]) {
609+
} else if (![[NSUserDefaults standardUserDefaults] boolForKey:UserDefaultsKeys.callWaiting]) {
610610
// Reply with 486 Busy Here if needed.
611611
for (CallController *callController in [self callControllers]) {
612612
if ([callController isCallActive]) {
@@ -628,9 +628,9 @@ - (void)SIPAccount:(AKSIPAccount *)account didReceiveCall:(AKSIPCall *)aCall {
628628

629629
AKSIPURIFormatter *SIPURIFormatter = [[AKSIPURIFormatter alloc] init];
630630
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
631-
[SIPURIFormatter setFormatsTelephoneNumbers:[defaults boolForKey:kFormatTelephoneNumbers]];
631+
[SIPURIFormatter setFormatsTelephoneNumbers:[defaults boolForKey:UserDefaultsKeys.formatTelephoneNumbers]];
632632
[SIPURIFormatter setTelephoneNumberFormatterSplitsLastFourDigits:
633-
[defaults boolForKey:kTelephoneNumberFormatterSplitsLastFourDigits]];
633+
[defaults boolForKey:UserDefaultsKeys.telephoneNumberFormatterSplitsLastFourDigits]];
634634

635635
// These variables will be changed during the Address Book search if the record is found.
636636
NSString *finalDisplayedName = [SIPURIFormatter stringForObjectValue:[aCall remoteURI]];
@@ -703,7 +703,7 @@ - (void)SIPAccount:(AKSIPAccount *)account didReceiveCall:(AKSIPCall *)aCall {
703703
}
704704
}
705705

706-
NSUInteger significantPhoneNumberLength = [defaults integerForKey:kSignificantPhoneNumberLength];
706+
NSUInteger significantPhoneNumberLength = [defaults integerForKey:UserDefaultsKeys.significantPhoneNumberLength];
707707

708708
// Get the significant phone suffix if the phone number length is greater
709709
// than we defined.
@@ -808,12 +808,12 @@ - (void)SIPAccount:(AKSIPAccount *)account didReceiveCall:(AKSIPCall *)aCall {
808808
NSString *callSource;
809809
AKTelephoneNumberFormatter *telephoneNumberFormatter = [[AKTelephoneNumberFormatter alloc] init];
810810
[telephoneNumberFormatter setSplitsLastFourDigits:
811-
[defaults boolForKey:kTelephoneNumberFormatterSplitsLastFourDigits]];
811+
[defaults boolForKey:UserDefaultsKeys.telephoneNumberFormatterSplitsLastFourDigits]];
812812
if ([[aCallController phoneLabelFromAddressBook] length] > 0) {
813813
callSource = [aCallController phoneLabelFromAddressBook];
814814
} else if ([[[aCall remoteURI] user] length] > 0) {
815815
if ([[[aCall remoteURI] user] ak_isTelephoneNumber]) {
816-
if ([defaults boolForKey:kFormatTelephoneNumbers]) {
816+
if ([defaults boolForKey:UserDefaultsKeys.formatTelephoneNumbers]) {
817817
callSource = [telephoneNumberFormatter stringForObjectValue:[[aCall remoteURI] user]];
818818
} else {
819819
callSource = [[aCall remoteURI] user];

0 commit comments

Comments
 (0)