Skip to content

Commit

Permalink
feat: create helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kometenstaub committed Mar 10, 2022
1 parent 9954e04 commit cc9ba1f
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/diff_utils.ts
@@ -1,10 +1,26 @@
import type { Plugin, App} from 'obsidian';
import type OpenSyncHistoryPlugin from './main'
import type { Plugin, App, TFile } from 'obsidian';
import type OpenSyncHistoryPlugin from './main';
import type { gHResult, item, syncInstance } from './interfaces';

export default class DiffUtils {
instance: syncInstance;

constructor(private plugin: OpenSyncHistoryPlugin, private app: App) {
this.plugin = plugin;
this.app = app
this.app = app;
this.instance = this.app.internalPlugins.plugins.sync.instance;
}

async getVersions(
file: TFile,
uid: number | null = null
): Promise<gHResult> {
return await this.instance.getHistory(file.path, uid);
}

async getContent(uid: number) {
const content = await this.instance.getContentForVersion(uid);
const textDecoder = new TextDecoder('utf-8');
const text = textDecoder.decode(new Uint8Array(content));
}
}

0 comments on commit cc9ba1f

Please sign in to comment.