import { Injectable } from 'angular-ts-decorators' ; import autobind from 'autobind-decorator' ; import { AppHelperService } from '../../../../app/shared/app-helper/app-helper.service' ; import { ApiService } from '../../../../shared/api/api.interface' ; import { Bookmark } from '../../../../shared/bookmark/bookmark.interface' ; import { ExceptionHandler } from '../../../../shared/errors/errors.interface' ; import { LogService } from '../../../../shared/log/log.service' ; import { StoreService } from '../../../../shared/store/store.service' ; import { Sync } from '../../../../shared/sync/sync.interface' ; import { SyncService } from '../../../../shared/sync/sync.service' ; import { UtilityService } from '../../../../shared/utility/utility.service' ; import { WorkingService } from '../../../../shared/working/working.service' ; import { AndroidPlatformService } from '../../../android-shared/android-platform/android-platform.service' ; @ autobind @ Injectable ( 'AppHelperService' ) export class AndroidAppHelperService extends AppHelperService { $interval : ng . IIntervalService ; platformSvc : AndroidPlatformService ; static $inject = [ '$exceptionHandler' , '$interval' , '$location' , '$q' , '$timeout' , 'ApiService' , 'LogService' , 'PlatformService' , 'StoreService' , 'SyncService' , 'UtilityService' , 'WorkingService' ] ; constructor ( $exceptionHandler , $interval , $location , $q , $timeout , ApiSvc , LogSvc , PlatformSvc , StoreSvc , SyncSvc , UtilitySvc , WorkingSvc ) { super ( $exceptionHandler , $location , $q , $timeout , ApiSvc , LogSvc , PlatformSvc , StoreSvc , SyncSvc , UtilitySvc , WorkingSvc ) ; this . $exceptionHandler = $exceptionHandler ; this . $interval = $interval ; } confirmBeforeSyncing ( ) { return false ; } copyTextToClipboard ( text ) { return this . $q < void > ( ( resolve , reject ) => { window . cordova . plugins . clipboard . copy ( text , resolve , reject ) ; } ) . then ( ( ) => { } ) ; } exitApp ( ) { window . cordova . plugins . exit ( ) ; } getCurrentSync ( ) { return this . $q . resolve ( this . syncSvc . getCurrentSync ( ) ) ; } getHelpPages ( ) { const pages = [ this . platformSvc . getI18nString ( this . Strings . View . Help . Welcome ) , this . platformSvc . getI18nString ( this . Strings . View . Help . FirstSync ) , this . platformSvc . getI18nString ( this . Strings . View . Help . ExistingId ) , this . platformSvc . getI18nString ( this . Strings . View . Help . Searching ) , this . platformSvc . getI18nString ( this . Strings . View . Help . AddingBookmarks ) , this . platformSvc . getI18nString ( this . Strings . View . Help . BackingUp ) , this . platformSvc . getI18nString ( this . Strings . View . Help . FurtherSupport ) ] ; return pages ; } getNextScheduledSyncUpdateCheck ( ) { return this . $q . resolve ( new Date ( '' ) ) ; } getSyncQueueLength ( ) { return this . $q . resolve ( this . syncSvc . getSyncQueueLength ( ) ) ; } openUrl ( event ? , url ? ) { this . utilitySvc . stopEventPropagation ( event ) ; if ( url ) { this . platformSvc . openUrl ( url ) ; } else if ( event ?. currentTarget ) { this . platformSvc . openUrl ( ( event . currentTarget as HTMLLinkElement ) . href ) ; } else { this . logSvc . logWarning ( 'Couldn’t open url' ) ; } } removePermissions ( ) { return this . $q . resolve ( ) ; } requestPermissions ( ) { return this . $q . resolve ( true ) ; } shareBookmark ( bookmark ) { const options = { url : bookmark . url } ; const onError = ( err ) => { this . $exceptionHandler ( err ) ; } ; window . plugins . socialsharing . shareWithOptions ( options , null , onError ) ; } }