Switch onboarding seed step and display name step
This commit is contained in:
parent
99e217e323
commit
d6e499bd9a
|
@ -64,6 +64,8 @@ final class AccountDetailsViewController : OnboardingBaseViewController {
|
|||
}
|
||||
OWSProfileManager.shared().updateLocalProfileName(normalizedUserName, avatarImage: nil, success: { }, failure: { }) // Try to save the user name but ignore the result
|
||||
}
|
||||
onboardingController.pushKeyPairViewController(from: self)
|
||||
TSAccountManager.sharedInstance().didRegister()
|
||||
UserDefaults.standard.set(true, forKey: "didUpdateForMainnet")
|
||||
onboardingController.verificationDidComplete(fromView: self)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,12 +225,10 @@ final class SeedViewController : OnboardingBaseViewController {
|
|||
let hexEncodedPublicKey = keyPair.hexEncodedPublicKey
|
||||
let accountManager = TSAccountManager.sharedInstance()
|
||||
accountManager.phoneNumberAwaitingVerification = hexEncodedPublicKey
|
||||
accountManager.didRegister()
|
||||
switch mode {
|
||||
case .register: Analytics.shared.track("Seed Created")
|
||||
case .restore: Analytics.shared.track("Seed Restored")
|
||||
}
|
||||
onboardingController.verificationDidComplete(fromView: self)
|
||||
UserDefaults.standard.set(true, forKey: "didUpdateForMainnet")
|
||||
onboardingController.pushAccountDetailsViewController(from: self)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class OnboardingController: NSObject {
|
|||
// MARK: - Transitions
|
||||
|
||||
public func onboardingSplashDidComplete(viewController: UIViewController) {
|
||||
pushAccountDetailsViewController(from: viewController)
|
||||
pushSeedViewController(from: viewController)
|
||||
}
|
||||
|
||||
public func onboardingPermissionsWasSkipped(viewController: UIViewController) {
|
||||
|
@ -106,7 +106,7 @@ public class OnboardingController: NSObject {
|
|||
|
||||
Logger.info("")
|
||||
|
||||
pushAccountDetailsViewController(from: viewController)
|
||||
pushSeedViewController(from: viewController)
|
||||
}
|
||||
|
||||
public func onboardingPermissionsDidComplete(viewController: UIViewController) {
|
||||
|
@ -114,20 +114,20 @@ public class OnboardingController: NSObject {
|
|||
|
||||
Logger.info("")
|
||||
|
||||
pushAccountDetailsViewController(from: viewController)
|
||||
}
|
||||
|
||||
private func pushAccountDetailsViewController(from viewController: UIViewController) {
|
||||
AssertIsOnMainThread()
|
||||
let accountDetailsVC = AccountDetailsViewController(onboardingController: self)
|
||||
viewController.navigationController?.pushViewController(accountDetailsVC, animated: true)
|
||||
pushSeedViewController(from: viewController)
|
||||
}
|
||||
|
||||
func pushKeyPairViewController(from viewController: UIViewController) {
|
||||
public func pushSeedViewController(from viewController: UIViewController) {
|
||||
AssertIsOnMainThread()
|
||||
let seedVC = SeedViewController(onboardingController: self)
|
||||
viewController.navigationController?.pushViewController(seedVC, animated: true)
|
||||
}
|
||||
|
||||
public func pushAccountDetailsViewController(from viewController: UIViewController) {
|
||||
AssertIsOnMainThread()
|
||||
let accountDetailsVC = AccountDetailsViewController(onboardingController: self)
|
||||
viewController.navigationController?.pushViewController(accountDetailsVC, animated: true)
|
||||
}
|
||||
|
||||
public func onboardingRegistrationSucceeded(viewController: UIViewController) {
|
||||
AssertIsOnMainThread()
|
||||
|
|
|
@ -8,7 +8,7 @@ extension String {
|
|||
}
|
||||
|
||||
private class RNG {
|
||||
private let int32Max: Int = Int(Int32.max) // 2147483647
|
||||
private let int32Max = Int(Int32.max) // 2147483647
|
||||
|
||||
private var seed: Int
|
||||
private var initial: Int
|
||||
|
|
|
@ -11,7 +11,11 @@ public final class LokiGroupChatAPI : NSObject {
|
|||
private static let maxRetryCount: UInt = 4
|
||||
|
||||
// MARK: Public Chat
|
||||
#if DEBUG
|
||||
@objc public static let publicChatServer = "https://chat-dev.lokinet.org"
|
||||
#else
|
||||
@objc public static let publicChatServer = "https://chat.lokinet.org"
|
||||
#endif
|
||||
@objc public static let publicChatMessageType = "network.loki.messenger.publicChat"
|
||||
@objc public static let publicChatServerID: UInt64 = 1
|
||||
|
||||
|
|
|
@ -414,9 +414,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return;
|
||||
}
|
||||
|
||||
// Loki: Handle any friend request accepts if we need to
|
||||
// TODO: We'll need to fix this up if we ever start using Sync messages
|
||||
[self handleFriendRequestAcceptIfNeededWithEnvelope:envelope transaction:transaction];
|
||||
// Loki: Handle friend request acceptance if needed
|
||||
// TODO: We'll need to fix this up if we ever start using sync messages
|
||||
[self handleFriendRequestAcceptanceIfNeededWithEnvelope:envelope transaction:transaction];
|
||||
|
||||
if (envelope.content != nil) {
|
||||
NSError *error;
|
||||
|
@ -1488,9 +1488,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return nil;
|
||||
}
|
||||
|
||||
// Loki
|
||||
// If we received a message from a contact in the last 2 minues that was not p2p, then we need to ping them.
|
||||
// We assume this occurred because they don't have our p2p details.
|
||||
// Loki: If we received a message from a contact in the last 2 minutes that wasn't P2P, then we need to ping them.
|
||||
// We assume this occurred because they don't have our P2P details.
|
||||
if (!envelope.isPtpMessage && envelope.source != nil) {
|
||||
uint64_t timestamp = envelope.timestamp;
|
||||
uint64_t now = NSDate.ows_millisecondTimeStamp;
|
||||
|
@ -1519,12 +1518,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
}
|
||||
|
||||
// The difference between this function and `handleFriendRequestAcceptIfNeededWithEnvelope:` is that this will setup the incoming message for display to the user
|
||||
// While `handleFriendRequestAcceptIfNeededWithEnvelope:` handles friend request accepting logic and doesn't need a message
|
||||
- (void)handleFriendRequestMessageIfNeededWithEnvelope:(SSKProtoEnvelope *)envelope message:(TSIncomingMessage *)message thread:(TSThread *)thread transaction:(YapDatabaseReadWriteTransaction *)transaction {
|
||||
// Check if it's a friend request message and make sure it's not a group message
|
||||
if (envelope.isGroupChatMessage || envelope.type != SSKProtoEnvelopeTypeFriendRequest) return;
|
||||
|
||||
if (thread.hasCurrentUserSentFriendRequest) {
|
||||
// This can happen if Alice sent Bob a friend request, Bob declined, but then Bob changed his
|
||||
// mind and sent a friend request to Alice. In this case we want Alice to auto-accept the request
|
||||
|
@ -1555,18 +1550,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
}
|
||||
|
||||
- (void)handleFriendRequestAcceptIfNeededWithEnvelope:(SSKProtoEnvelope *)envelope transaction:(YapDatabaseReadWriteTransaction *)transaction {
|
||||
// If we get any other envelope type then we can assume that we had to use signal cipher decryption
|
||||
// and that means we must have a session with the other person.
|
||||
// We also need to ensure that we're contacting the person directly and not through a public chat
|
||||
- (void)handleFriendRequestAcceptanceIfNeededWithEnvelope:(SSKProtoEnvelope *)envelope transaction:(YapDatabaseReadWriteTransaction *)transaction {
|
||||
// If we get an envelope that isn't a friend request, then we can infer that we had to use
|
||||
// Signal cipher decryption and thus that we have a session with the other person.
|
||||
if (envelope.isGroupChatMessage || envelope.type == SSKProtoEnvelopeTypeFriendRequest) return;
|
||||
|
||||
// If we're already friends then there's no point in continuing
|
||||
// TODO: We'll need to fix this up if we ever start using Sync messages
|
||||
// Currently it'll use `envelope.source` but with sync messages we need to use the message sender id
|
||||
// TODO: We'll need to fix this up if we ever start using sync messages
|
||||
// Currently it'll use `envelope.source` but with sync messages we need to use the message sender ID
|
||||
TSContactThread *thread = [TSContactThread getOrCreateThreadWithContactId:envelope.source transaction:transaction];
|
||||
if (thread.isContactFriend) return;
|
||||
|
||||
// Become happy friends and go on great adventures
|
||||
[thread saveFriendRequestStatus:LKThreadFriendRequestStatusFriends withTransaction:transaction];
|
||||
TSOutgoingMessage *existingFriendRequestMessage = (TSOutgoingMessage *)[thread.lastInteraction as:TSOutgoingMessage.class];
|
||||
|
|
Loading…
Reference in New Issue