mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			20 lines
		
	
	
		
			852 B
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			20 lines
		
	
	
		
			852 B
		
	
	
	
		
			Swift
		
	
| 
								 
											3 years ago
										 
									 | 
							
								// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import Foundation
							 | 
						||
| 
								 | 
							
								import GRDB
							 | 
						||
| 
								 | 
							
								import SessionUtilitiesKit
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								public extension Identity {
							 | 
						||
| 
								 | 
							
								    /// The user actually exists very early on during the onboarding process but there are also a few cases
							 | 
						||
| 
								 | 
							
								    /// where we want to know that the user is in a valid state (ie. has completed the proper onboarding
							 | 
						||
| 
								 | 
							
								    /// process), this value indicates that state
							 | 
						||
| 
								 | 
							
								    ///
							 | 
						||
| 
								 | 
							
								    /// One case which can happen is if the app crashed during onboarding the user can be left in an invalid
							 | 
						||
| 
								 | 
							
								    /// state (ie. with no display name) - the user would be asked to enter one on a subsequent launch to
							 | 
						||
| 
								 | 
							
								    /// resolve the invalid state
							 | 
						||
| 
								 | 
							
								    static func userCompletedRequiredOnboarding(_ db: Database? = nil) -> Bool {
							 | 
						||
| 
								 | 
							
								        Identity.userExists(db) &&
							 | 
						||
| 
								 | 
							
								        !Profile.fetchOrCreateCurrentUser(db).name.isEmpty
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |