@ -42,17 +42,17 @@ 
			
		
	
		
			
				
					    >  
			
		
	
		
			
				
					      If  no  download  happened  yet ,  click  again  here  to  download  now .  
			
		
	
		
			
				
					    < / a >  
			
		
	
		
			
				
					    < div  class = "mt-4"  v-if ="showPlatform Instructions" >  
			
		
	
		
			
				
					    < div  class = "mt-4"  v-if ="platformCapabilities.needsFileHandling Instructions" >  
			
		
	
		
			
				
					      < p >  
			
		
	
		
			
				
					        After  the  download ,  you  can  save  the  file  in  your  preferred  storage  
			
		
	
		
			
				
					        location .  
			
		
	
		
			
				
					      < / p >  
			
		
	
		
			
				
					      < ul >  
			
		
	
		
			
				
					        < li  v-if ="platformService.isCapacitor() &&  isIOS" class="list-disc list-outside ml-4" >  
			
		
	
		
			
				
					        < li  v-if ="platformCapabilities. isIOS" class="list-disc list-outside ml-4" >  
			
		
	
		
			
				
					          On  iOS :  Choose  "More..."  and  select  a  place  in  iCloud ,  or  go  "Back"  
			
		
	
		
			
				
					          and  save  to  another  location .  
			
		
	
		
			
				
					        < / li >  
			
		
	
		
			
				
					        < li  v-if ="platformService.isCapacitor() && ! isIOS" class="list-disc list-outside ml-4" >  
			
		
	
		
			
				
					        < li  v-if ="platformCapabilities.isMobile && !platformCapabilities. isIOS" class="list-disc list-outside ml-4" >  
			
		
	
		
			
				
					          On  Android :  Choose  "Open"  and  then  share  
			
		
	
		
			
				
					          < font -awesome  icon = "share-nodes"  class = "fa-fw"  / >  
			
		
	
		
			
				
					          to  your  prefered  place .  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -68,7 +68,7 @@ import { NotificationIface } from "../constants/app"; 
			
		
	
		
			
				
					import  {  db  }  from  "../db/index" ;  
			
		
	
		
			
				
					import  {  logger  }  from  "../utils/logger" ;  
			
		
	
		
			
				
					import  {  PlatformServiceFactory  }  from  "../services/PlatformServiceFactory" ;  
			
		
	
		
			
				
					import  {  PlatformService  }  from  "../services/PlatformService" ;  
			
		
	
		
			
				
					import  {  PlatformService ,  PlatformCapabilities }  from  "../services/PlatformService" ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					/ * *  
			
		
	
		
			
				
					 *  @ vue - component  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -103,17 +103,10 @@ export default class DataExportSection extends Vue { 
			
		
	
		
			
				
					  private  platformService :  PlatformService  =  PlatformServiceFactory . getInstance ( ) ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  / * *  
			
		
	
		
			
				
					   *  Whethe rthe  current  platform  is  iOS   
			
		
	
		
			
				
					   *  Platform  capabilities  fo rthe  current  platform  
			
		
	
		
			
				
					   * /  
			
		
	
		
			
				
					  private  get  isIOS ( ) :  boolean  {  
			
		
	
		
			
				
					    return  /iPad|iPhone|iPod/ . test ( navigator . userAgent ) ;  
			
		
	
		
			
				
					  }  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  / * *  
			
		
	
		
			
				
					   *  Whether  to  show  platform - specific  instructions  
			
		
	
		
			
				
					   * /  
			
		
	
		
			
				
					  private  get  showPlatformInstructions ( ) :  boolean  {  
			
		
	
		
			
				
					    return  this . platformService . isCapacitor ( ) ;  
			
		
	
		
			
				
					  private  get  platformCapabilities ( ) :  PlatformCapabilities  {  
			
		
	
		
			
				
					    return  this . platformService . getCapabilities ( ) ;  
			
		
	
		
			
				
					  }  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  / * *  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -121,7 +114,7 @@ export default class DataExportSection extends Vue { 
			
		
	
		
			
				
					   *  Revokes  object  URL  when  component  is  unmounted  ( web  platform  only )  
			
		
	
		
			
				
					   * /  
			
		
	
		
			
				
					  beforeUnmount ( )  {  
			
		
	
		
			
				
					    if  ( this . downloadUrl  &&  this . platformService . isWeb ( )  )  {  
			
		
	
		
			
				
					    if  ( this . downloadUrl  &&  this . platformCapabilities . hasFileDownload  )  {  
			
		
	
		
			
				
					      URL . revokeObjectURL ( this . downloadUrl ) ;  
			
		
	
		
			
				
					    }  
			
		
	
		
			
				
					  }  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -139,7 +132,7 @@ export default class DataExportSection extends Vue { 
			
		
	
		
			
				
					      const  blob  =  await  db . export ( {  prettyJson :  true  } ) ;  
			
		
	
		
			
				
					      const  fileName  =  ` ${ db . name } -backup.json ` ;  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					      if  ( this . platformService . isWeb ( )  )  {  
			
		
	
		
			
				
					      if  ( this . platformCapabilities . hasFileDownload  )  {  
			
		
	
		
			
				
					        / /   W e b   p l a t f o r m :   U s e   d o w n l o a d   l i n k  
			
		
	
		
			
				
					        this . downloadUrl  =  URL . createObjectURL ( blob ) ;  
			
		
	
		
			
				
					        const  downloadAnchor  =  this . $refs . downloadLink  as  HTMLAnchorElement ;  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -147,13 +140,10 @@ export default class DataExportSection extends Vue { 
			
		
	
		
			
				
					        downloadAnchor . download  =  fileName ;  
			
		
	
		
			
				
					        downloadAnchor . click ( ) ;  
			
		
	
		
			
				
					        setTimeout ( ( )  =>  URL . revokeObjectURL ( this . downloadUrl ) ,  1000 ) ;  
			
		
	
		
			
				
					      }  else  if  ( this . platformService . isCapacitor ( )  )  {  
			
		
	
		
			
				
					        / /   C a p a c i t o r   p l a t f o r m :   W r i t e   t o   a p p   d i r e c t o r y  
			
		
	
		
			
				
					      }  else  if  ( this . platformCapabilities . hasFileSystem  )  {  
			
		
	
		
			
				
					        / /   N a t i v e   p l a t f o r m :   W r i t e   t o   a p p   d i r e c t o r y  
			
		
	
		
			
				
					        const  content  =  await  blob . text ( ) ;  
			
		
	
		
			
				
					        await  this . platformService . writeFile ( fileName ,  content ) ;  
			
		
	
		
			
				
					      }  else  {  
			
		
	
		
			
				
					        / /   O t h e r   p l a t f o r m s :   U s e   p l a t f o r m   s e r v i c e  
			
		
	
		
			
				
					        await  this . platformService . writeFile ( fileName ,  await  blob . text ( ) ) ;  
			
		
	
		
			
				
					      }  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					      this . $notify (  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -161,7 +151,7 @@ export default class DataExportSection extends Vue { 
			
		
	
		
			
				
					          group :  "alert" ,  
			
		
	
		
			
				
					          type :  "success" ,  
			
		
	
		
			
				
					          title :  "Export Successful" ,  
			
		
	
		
			
				
					          text :  this . platformService . isWeb ( )   
			
		
	
		
			
				
					          text :  this . platformCapabilities . hasFileDownload   
			
		
	
		
			
				
					            ?  "See your downloads directory for the backup. It is in the Dexie format."  
			
		
	
		
			
				
					            :  "The backup has been saved to your device." ,  
			
		
	
		
			
				
					        } ,  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -187,7 +177,7 @@ export default class DataExportSection extends Vue { 
			
		
	
		
			
				
					   * /  
			
		
	
		
			
				
					  public  computedStartDownloadLinkClassNames ( )  {  
			
		
	
		
			
				
					    return  {  
			
		
	
		
			
				
					      hidden :  this . downloadUrl  &&  this . platformService . isWeb ( )  ,  
			
		
	
		
			
				
					      hidden :  this . downloadUrl  &&  this . platformCapabilities . hasFileDownload  ,  
			
		
	
		
			
				
					    } ;  
			
		
	
		
			
				
					  }  
			
		
	
		
			
				
					
 
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -197,7 +187,7 @@ export default class DataExportSection extends Vue { 
			
		
	
		
			
				
					   * /  
			
		
	
		
			
				
					  public  computedDownloadLinkClassNames ( )  {  
			
		
	
		
			
				
					    return  {  
			
		
	
		
			
				
					      hidden :  ! this . downloadUrl  ||  ! this . platformService . isWeb ( )  ,  
			
		
	
		
			
				
					      hidden :  ! this . downloadUrl  ||  ! this . platformCapabilities . hasFileDownload  ,  
			
		
	
		
			
				
					    } ;  
			
		
	
		
			
				
					  }  
			
		
	
		
			
				
					}