Skip to content

Commit 36f45be

Browse files
Merge pull request #1199 from ChatSecure/remove-server-list
Remove outdated server list for new signups
2 parents 1faaed2 + 28d24ab commit 36f45be

File tree

7 files changed

+66
-100
lines changed

7 files changed

+66
-100
lines changed

ChatSecureCore/Classes/View Controllers/Login View Controllers/OTRBaseLoginViewController.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,10 @@ - (void) updateUsernameRow {
189189
if (!usernameRow) {
190190
return;
191191
}
192-
XLFormRowDescriptor *serverRow = [self.form formRowWithTag:kOTRXLFormXMPPServerTag];
192+
XLFormRowDescriptor *serverRow = [self.form formRowWithTag:kOTRXLFormXMPPServerDomainTag];
193193
NSString *domain = nil;
194194
if (serverRow) {
195-
OTRXMPPServerInfo *serverInfo = serverRow.value;
196-
domain = serverInfo.domain;
195+
domain = serverRow.value;
197196
usernameRow.value = domain;
198197
} else {
199198
usernameRow.value = self.account.username;
@@ -238,7 +237,7 @@ - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexP
238237
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue
239238
{
240239
[super formRowDescriptorValueHasChanged:formRow oldValue:oldValue newValue:newValue];
241-
if (formRow.tag == kOTRXLFormXMPPServerTag) {
240+
if (formRow.tag == kOTRXLFormXMPPServerDomainTag) {
242241
[self updateUsernameRow];
243242
}
244243
}

ChatSecureCore/Classes/View Controllers/Login View Controllers/OTRXLFormCreator.m

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
NSString *const kOTRXLFormHostnameTextFieldTag = @"kOTRXLFormHostnameTextFieldTag";
2828
NSString *const kOTRXLFormPortTextFieldTag = @"kOTRXLFormPortTextFieldTag";
2929
NSString *const kOTRXLFormResourceTextFieldTag = @"kOTRXLFormResourceTextFieldTag";
30-
NSString *const kOTRXLFormXMPPServerTag = @"kOTRXLFormXMPPServerTag";
30+
NSString *const kOTRXLFormXMPPServerDomainTag = @"kOTRXLFormXMPPServerDomainTag";
3131

3232
NSString *const kOTRXLFormShowAdvancedTag = @"kOTRXLFormShowAdvancedTag";
3333

@@ -124,7 +124,7 @@ + (XLFormDescriptor *)formForAccountType:(OTRAccountType)accountType createAccou
124124
}
125125

126126
serverSection.footerTitle = Server_String_Hint();
127-
[serverSection addFormRow:[self serverRowDescriptorWithValue:nil]];
127+
[serverSection addFormRow:[self serverRowDescriptor]];
128128

129129
XLFormSectionDescriptor *torSection = [XLFormSectionDescriptor formSectionWithTitle:@"Tor"];
130130
torSection.footerTitle = TOR_WARNING_MESSAGE_STRING();
@@ -285,16 +285,13 @@ + (XLFormRowDescriptor *)resourceRowDescriptorWithValue:(NSString *)value
285285
return resourceRowDescriptor;
286286
}
287287

288-
+ (XLFormRowDescriptor *)serverRowDescriptorWithValue:(OTRXMPPServerInfo *)value
288+
+ (XLFormRowDescriptor *)serverRowDescriptor
289289
{
290-
XLFormRowDescriptor *xmppServerDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kOTRXLFormXMPPServerTag rowType:kOTRFormRowDescriptorTypeXMPPServer];
291-
if (!value) {
292-
value = [[OTRXMPPServerInfo defaultServerList] firstObject];
293-
}
294-
xmppServerDescriptor.value = value;
295-
xmppServerDescriptor.action.viewControllerClass = [OTRXMPPServerListViewController class];
290+
XLFormRowDescriptor *serverRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kOTRXLFormXMPPServerDomainTag rowType:XLFormRowDescriptorTypeURL title:CUSTOM_STRING()];
291+
serverRowDescriptor.required = YES;
292+
[serverRowDescriptor.cellConfigAtConfigure setObject:@"example.com" forKey:@"textField.placeholder"];
296293

297-
return xmppServerDescriptor;
294+
return serverRowDescriptor;
298295
}
299296

300297

ChatSecureCore/Classes/View Controllers/Login View Controllers/OTRXMPPCreateAccountHandler.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ @implementation OTRXMPPCreateAccountHandler
2626
- (OTRXMPPAccount *)moveValues:(XLFormDescriptor *)form intoAccount:(OTRXMPPAccount *)account
2727
{
2828
account = (OTRXMPPAccount *)[super moveValues:form intoAccount:account];
29-
OTRXMPPServerInfo *serverInfo = [[form formRowWithTag:kOTRXLFormXMPPServerTag] value];
29+
NSString *serverDomain = [[form formRowWithTag:kOTRXLFormXMPPServerDomainTag] value];
3030

3131
NSString *username = nil;
3232
if ([account.username containsString:@"@"]) {
@@ -35,11 +35,9 @@ - (OTRXMPPAccount *)moveValues:(XLFormDescriptor *)form intoAccount:(OTRXMPPAcco
3535
} else {
3636
username = account.username;
3737
}
38-
39-
NSString *domain = serverInfo.domain;
40-
38+
4139
//Create valid 'username' which is a bare jid ([email protected])
42-
XMPPJID *jid = [XMPPJID jidWithUser:username domain:domain resource:nil];
40+
XMPPJID *jid = [XMPPJID jidWithUser:username domain:serverDomain resource:nil];
4341

4442
if (jid) {
4543
account.username = [jid bare];

ChatSecureCore/Classes/View Controllers/Login View Controllers/OTRXMPPLoginHandler.m

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,9 @@ - (OTRXMPPAccount *)moveValues:(XLFormDescriptor *)form intoAccount:(OTRXMPPAcco
125125
NSString *resource = [[form formRowWithTag:kOTRXLFormResourceTextFieldTag] value];
126126

127127
if (![hostname length]) {
128-
XLFormRowDescriptor *serverRow = [form formRowWithTag:kOTRXLFormXMPPServerTag];
128+
XLFormRowDescriptor *serverRow = [form formRowWithTag:kOTRXLFormXMPPServerDomainTag];
129129
if (serverRow) {
130-
OTRXMPPServerInfo *serverInfo = serverRow.value;
131-
hostname = serverInfo.domain;
130+
hostname = serverRow.value;
132131
}
133132
}
134133
account.domain = hostname;
@@ -161,18 +160,6 @@ - (OTRXMPPAccount *)moveValues:(XLFormDescriptor *)form intoAccount:(OTRXMPPAcco
161160
account.resource = jid.resource;
162161
account.displayName = nickname;
163162

164-
// Use server's .onion if possible, else use FQDN
165-
if (account.accountType == OTRAccountTypeXMPPTor) {
166-
OTRXMPPServerInfo *serverInfo = [[form formRowWithTag:kOTRXLFormXMPPServerTag] value];
167-
OTRXMPPTorAccount *torAccount = (OTRXMPPTorAccount*)account;
168-
torAccount.onion = serverInfo.onion;
169-
if (torAccount.onion.length) {
170-
torAccount.domain = torAccount.onion;
171-
} else if (serverInfo.server.length) {
172-
torAccount.domain = serverInfo.server;
173-
}
174-
}
175-
176163
// Start generating our OTR key here so it's ready when we need it
177164

178165
[OTRProtocolManager.encryptionManager.otrKit generatePrivateKeyForAccountName:account.username protocol:kOTRProtocolTypeXMPP completion:^(OTRFingerprint *fingerprint, NSError *error) {

ChatSecureCore/Public/OTRXLFormCreator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern NSString *const kOTRXLFormLoginAutomaticallySwitchTag;
2020
extern NSString *const kOTRXLFormHostnameTextFieldTag;
2121
extern NSString *const kOTRXLFormPortTextFieldTag;
2222
extern NSString *const kOTRXLFormResourceTextFieldTag;
23-
extern NSString *const kOTRXLFormXMPPServerTag;
23+
extern NSString *const kOTRXLFormXMPPServerDomainTag;
2424
extern NSString *const kOTRXLFormUseTorTag;
2525
extern NSString *const kOTRXLFormAutomaticURLFetchTag;
2626

0 commit comments

Comments
 (0)