Clean & fix bad merge

This commit is contained in:
Niels Andriesse 2019-04-30 09:34:14 +10:00
parent 8d0c3b0f97
commit 9d64b76af6
7 changed files with 31 additions and 32 deletions

View file

@ -154,7 +154,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarRowTapped:)]];
avatarRow.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"avatarRow");
// Loki - Disable setting the avatar
// Loki: Disable setting the avatar
// [rows addObject:avatarRow];
UILabel *avatarLabel = [UILabel new];

View file

@ -42,8 +42,6 @@ final class OnboardingPublicKeyViewController : OnboardingBaseViewController {
let topSpacer = UIView.vStretchingSpacer()
let explanationLabel = createExplanationLabel(text: NSLocalizedString("Please save the seed below in a safe location. It can be used to restore your account if you lose access, or to migrate to a new device.", comment: ""))
explanationLabel.accessibilityIdentifier = "onboarding.publicKeyStep.explanationLabel"
let copyButton = createLinkButton(title: NSLocalizedString("Copy", comment: ""), selector: #selector(copyMnemonic))
copyButton.accessibilityIdentifier = "onboarding.publicKeyStep.copyButton"
let bottomSpacer = UIView.vStretchingSpacer()
let registerButton = createButton(title: NSLocalizedString("Register", comment: ""), selector: #selector(register))
registerButton.accessibilityIdentifier = "onboarding.publicKeyStep.registerButton"
@ -83,34 +81,31 @@ final class OnboardingPublicKeyViewController : OnboardingBaseViewController {
@objc private func copyMnemonic() {
UIPasteboard.general.string = mnemonic
copyButton.isUserInteractionEnabled = false
copyButton.setTitle(title: NSLocalizedString("Copied ✓", comment: ""), font: .ows_dynamicTypeBodyClamped, titleColor: .ows_materialBlue)
copyButton.setTitle(NSLocalizedString("Copied ✓", comment: ""))
Timer.scheduledTimer(timeInterval: 4, target: self, selector: #selector(enableCopyButton), userInfo: nil, repeats: false)
}
@objc private func enableCopyButton() {
copyButton.isUserInteractionEnabled = true
copyButton.setTitle(title: NSLocalizedString("Copy", comment: ""), font: .ows_dynamicTypeBodyClamped, titleColor: .ows_materialBlue)
copyButton.setTitle(NSLocalizedString("Copy", comment: ""))
}
@objc private func register() {
let accountManager = TSAccountManager.sharedInstance()
accountManager.phoneNumberAwaitingVerification = hexEncodedPublicKey
accountManager.didRegister()
let verificationComplete: () -> Void = { [weak self] in
let onSuccess: () -> Void = { [weak self] in
guard let strongSelf = self else { return }
strongSelf.onboardingController.verificationDidComplete(fromView: strongSelf)
}
if let userName = userName {
// Try save the profile name
OWSProfileManager.shared().updateLocalProfileName(userName, avatarImage: nil, success: verificationComplete, failure: {
// Try to save the user name
OWSProfileManager.shared().updateLocalProfileName(userName, avatarImage: nil, success: onSuccess, failure: {
Logger.warn("Failed to set user name")
verificationComplete()
onSuccess()
})
} else {
verificationComplete()
onSuccess()
}
}
}

View file

@ -2550,6 +2550,7 @@
"Enter a name to be shown to your contacts" = "Enter a name to be shown to your contacts";
"Display Name (Optional)" = "Display Name (Optional)";
"Type an optional password for added security" = "Type an optional password for added security";
"Next" = "Next";
"Password (Optional)" = "Password (Optional)";
"Please save the seed below in a safe location. It can be used to restore your account if you lose access, or to migrate to a new device." = "Please save the seed below in a safe location. It can be used to restore your account if you lose access, or to migrate to a new device.";
"Copy" = "Copy";

View file

@ -118,6 +118,11 @@ public class OWSFlatButton: UIView {
// MARK: Methods
@objc
public func setTitle(_ title: String) {
button.setTitle(title, for: .normal)
}
@objc
public func setTitle(title: String, font: UIFont,
titleColor: UIColor ) {

View file

@ -294,7 +294,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
OWSUserProfile *userProfile = self.localUserProfile;
OWSAssertDebug(userProfile);
/* LOKI - We don't support avatar uploads yet */
/* Loki: We don't support avatar uploads yet */
OWSLogVerbose(@"Updating local profile on service with no avatar.");
tryToUpdateService(nil, nil);
@ -535,10 +535,10 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
OWSAssertDebug(successBlock);
OWSAssertDebug(failureBlock);
// Since we don't need to call any servers, automatically succeed
// Loki: We don't need to make any server calls so succeed automatically
successBlock();
/* ============ Original Code ==================
/* ============ Original Code ============
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *_Nullable encryptedPaddedName = [self encryptProfileNameWithUnpaddedName:localProfileName];
@ -552,7 +552,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
failureBlock(error);
}];
});
*/
*/
}
- (void)fetchLocalUsersProfile

View file

@ -54,24 +54,24 @@ message TypingMessage {
}
message Content {
optional DataMessage dataMessage = 1;
optional SyncMessage syncMessage = 2;
optional CallMessage callMessage = 3;
optional NullMessage nullMessage = 4;
optional ReceiptMessage receiptMessage = 5;
optional TypingMessage typingMessage = 6;
optional PrekeyBundleMessage prekeyBundleMessage = 101; // Loki
optional LokiAddressMessage LokiAddressMessage = 102; // Loki
optional DataMessage dataMessage = 1;
optional SyncMessage syncMessage = 2;
optional CallMessage callMessage = 3;
optional NullMessage nullMessage = 4;
optional ReceiptMessage receiptMessage = 5;
optional TypingMessage typingMessage = 6;
optional PrekeyBundleMessage prekeyBundleMessage = 101; // Loki
optional LokiAddressMessage LokiAddressMessage = 102; // Loki
}
message PrekeyBundleMessage { // Loki
optional bytes identityKey = 1;
optional bytes identityKey = 1;
optional uint32 deviceID = 2;
optional uint32 prekeyID = 3;
optional uint32 signedKeyID = 4;
optional bytes prekey = 5;
optional bytes signedKey = 6;
optional bytes signature = 7;
optional bytes prekey = 5;
optional bytes signedKey = 6;
optional bytes signature = 7;
}
message LokiAddressMessage { // Loki

View file

@ -89,9 +89,7 @@ static NSString *const RPDefaultsKeyPhoneNumberCanonical = @"RPDefaultsKeyPhoneN
}
+ (nullable PhoneNumber *)phoneNumberFromE164:(NSString *)text {
NSString *e164 = text;
PhoneNumber *result = [[PhoneNumber alloc] initWithPhoneNumber:[NBPhoneNumber new] e164:e164];
return result;
return [[PhoneNumber alloc] initWithPhoneNumber:[NBPhoneNumber new] e164:text];
// Original code:
// ========
// OWSAssertDebug(text != nil);