From 9d64b76af60a8c0e50ca20d5b2aa7069c2b11ef2 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Tue, 30 Apr 2019 09:34:14 +1000 Subject: [PATCH] Clean & fix bad merge --- .../ViewControllers/ProfileViewController.m | 2 +- .../OnboardingPublicKeyViewController.swift | 19 ++++++--------- .../translations/en.lproj/Localizable.strings | 1 + SignalMessaging/Views/OWSFlatButton.swift | 5 ++++ SignalMessaging/profiles/OWSProfileManager.m | 8 +++---- SignalServiceKit/protobuf/SignalService.proto | 24 +++++++++---------- SignalServiceKit/src/Contacts/PhoneNumber.m | 4 +--- 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Signal/src/ViewControllers/ProfileViewController.m b/Signal/src/ViewControllers/ProfileViewController.m index d16e05c14..b8dd26d5a 100644 --- a/Signal/src/ViewControllers/ProfileViewController.m +++ b/Signal/src/ViewControllers/ProfileViewController.m @@ -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]; diff --git a/Signal/src/ViewControllers/Registration/OnboardingPublicKeyViewController.swift b/Signal/src/ViewControllers/Registration/OnboardingPublicKeyViewController.swift index 70819b72d..73a80f3df 100644 --- a/Signal/src/ViewControllers/Registration/OnboardingPublicKeyViewController.swift +++ b/Signal/src/ViewControllers/Registration/OnboardingPublicKeyViewController.swift @@ -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() } - } } diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index a7049eeb7..8933f0be5 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -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"; diff --git a/SignalMessaging/Views/OWSFlatButton.swift b/SignalMessaging/Views/OWSFlatButton.swift index 5e4358f46..c11a3aa91 100644 --- a/SignalMessaging/Views/OWSFlatButton.swift +++ b/SignalMessaging/Views/OWSFlatButton.swift @@ -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 ) { diff --git a/SignalMessaging/profiles/OWSProfileManager.m b/SignalMessaging/profiles/OWSProfileManager.m index 564485d8b..3a7561be6 100644 --- a/SignalMessaging/profiles/OWSProfileManager.m +++ b/SignalMessaging/profiles/OWSProfileManager.m @@ -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 diff --git a/SignalServiceKit/protobuf/SignalService.proto b/SignalServiceKit/protobuf/SignalService.proto index 5dffbd283..4f7ee3fa4 100644 --- a/SignalServiceKit/protobuf/SignalService.proto +++ b/SignalServiceKit/protobuf/SignalService.proto @@ -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 diff --git a/SignalServiceKit/src/Contacts/PhoneNumber.m b/SignalServiceKit/src/Contacts/PhoneNumber.m index 40bac6222..8c5567a84 100644 --- a/SignalServiceKit/src/Contacts/PhoneNumber.m +++ b/SignalServiceKit/src/Contacts/PhoneNumber.m @@ -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);