| 
						
						
						
					 | 
				
				 | 
				
					@ -1,11 +1,25 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					<template> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  <QuickNav selected="Contacts"></QuickNav> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					  <section id="Content" class="p-6 pb-24 max-w-3xl mx-auto"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <!-- Back --> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <div class="text-lg text-center font-light relative px-7"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      <h1 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        class="text-lg text-center px-2 py-1 absolute -left-2 -top-1" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        @click="$router.back()" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      > | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        <fa icon="chevron-left" class="fa-fw"></fa> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      </h1> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    </div> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <!-- Heading --> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <h1 id="ViewHeading" class="text-4xl text-center font-light pt-4 mb-8"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      Contact Import | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    </h1> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <span> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      Note that you will have to make them visible one-by-one in the list of | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      Contacts. | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    </span> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    <div v-if="sameCount > 0"> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      {{ sameCount }} contact{{ sameCount == 1 ? "" : "s" }} are the same as | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      existing contacts. | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -56,7 +70,7 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      <fa icon="spinner" v-if="importing" class="animate-spin" /> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      <button | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        v-else | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        class="text-sm bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-1.5 rounded-l-md" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        class="bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-sm text-white mt-2 px-2 py-1.5 rounded" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        @click="importContacts" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      > | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Import Selected Contacts | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -146,13 +160,14 @@ export default class ContactImportView extends Vue { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      updatedCount = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    for (let i = 0; i < this.contactsImporting.length; i++) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      if (this.contactsSelected[i]) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const contact = R.clone(this.contactsImporting[i]); // cloning to avoid the problem with a Proxy object | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const contact = this.contactsImporting[i]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        const existingContact = this.contactsExisting[contact.did]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (existingContact) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          await db.contacts.update(contact.did, contact); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          updatedCount++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          await db.contacts.add(contact); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          // without explicit clone on the Proxy, we get: DataCloneError: Failed to execute 'add' on 'IDBObjectStore': #<Object> could not be cloned. | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          await db.contacts.add(R.clone(contact)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					          importedCount++; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |