Skip to content

Commit

Permalink
feat(sync): allow to enable/disable compression
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesjo committed Mar 6, 2022
1 parent d1c86bc commit a94499f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/app/features/config/default-global-config.const.ts
Expand Up @@ -134,7 +134,8 @@ export const DEFAULT_GLOBAL_CONFIG: GlobalConfigState = {

sync: {
isEnabled: false,
isCompressionEnabled: true,
// TODO maybe enable later if it works well
isCompressionEnabled: false,
syncProvider: null,
syncInterval: minute,

Expand Down
14 changes: 7 additions & 7 deletions src/app/features/config/form-cfgs/sync-form.const.ts
Expand Up @@ -16,6 +16,13 @@ export const SYNC_FORM: ConfigFormSection<SyncConfig> = {
label: T.F.SYNC.FORM.L_ENABLE_SYNCING,
},
},
{
key: 'isCompressionEnabled',
type: 'checkbox',
templateOptions: {
label: T.F.SYNC.FORM.L_ENABLE_COMPRESSION,
},
},
{
key: 'syncInterval',
type: 'duration',
Expand Down Expand Up @@ -77,13 +84,6 @@ export const SYNC_FORM: ConfigFormSection<SyncConfig> = {
label: T.F.SYNC.FORM.GOOGLE.L_SYNC_FILE_NAME,
},
},
{
key: 'isCompressData',
type: 'checkbox',
templateOptions: {
label: T.F.SYNC.FORM.GOOGLE.L_IS_COMPRESS_DATA,
},
},
],
},
{
Expand Down
5 changes: 2 additions & 3 deletions src/app/imex/sync/sync-provider.service.ts
Expand Up @@ -505,9 +505,8 @@ export class SyncProviderService {
}

private async _compressAppDataIfEnabled(data: AppDataComplete): Promise<string> {
// const isCompressionEnabled = (await this.syncCfg$.pipe(first()).toPromise())
// .isCompressionEnabled;
const isCompressionEnabled = true;
const isCompressionEnabled = (await this.syncCfg$.pipe(first()).toPromise())
.isCompressionEnabled;
return isCompressionEnabled
? this._compressionService.compressUTF16(JSON.stringify(data))
: JSON.stringify(data);
Expand Down
2 changes: 1 addition & 1 deletion src/app/t.const.ts
Expand Up @@ -678,7 +678,6 @@ const T = {
L_ACCESS_TOKEN: 'F.SYNC.FORM.DROPBOX.L_ACCESS_TOKEN',
},
GOOGLE: {
L_IS_COMPRESS_DATA: 'F.SYNC.FORM.GOOGLE.L_IS_COMPRESS_DATA',
L_SYNC_FILE_NAME: 'F.SYNC.FORM.GOOGLE.L_SYNC_FILE_NAME',
},
LOCAL_FILE: {
Expand All @@ -687,6 +686,7 @@ const T = {
'F.SYNC.FORM.LOCAL_FILE.L_SYNC_FILE_PATH_DESCRIPTION',
},
L_ENABLE_SYNCING: 'F.SYNC.FORM.L_ENABLE_SYNCING',
L_ENABLE_COMPRESSION: 'F.SYNC.FORM.L_ENABLE_COMPRESSION',
L_SYNC_INTERVAL: 'F.SYNC.FORM.L_SYNC_INTERVAL',
L_SYNC_PROVIDER: 'F.SYNC.FORM.L_SYNC_PROVIDER',
TITLE: 'F.SYNC.FORM.TITLE',
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json
Expand Up @@ -669,14 +669,14 @@
"L_ACCESS_TOKEN": "Access Token (generated from Auth Code)"
},
"GOOGLE": {
"L_IS_COMPRESS_DATA": "Compress data",
"L_SYNC_FILE_NAME": "Sync File Name"
},
"LOCAL_FILE": {
"L_SYNC_FILE_PATH": "Sync file path",
"L_SYNC_FILE_PATH_DESCRIPTION": "Absolute path to the file that should be used for syncing (will be created)."
},
"L_ENABLE_SYNCING": "Enable Syncing",
"L_ENABLE_COMPRESSION": "Enable Compression (faster data transfer)",
"L_SYNC_INTERVAL": "Sync Interval",
"L_SYNC_PROVIDER": "Sync Provider",
"TITLE": "Sync",
Expand Down

0 comments on commit a94499f

Please sign in to comment.