1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Started fixing ReactNative app

This commit is contained in:
Laurent Cozic 2017-07-05 21:34:25 +01:00
parent 9d630ab0ca
commit f0a8cbe95d
50 changed files with 12 additions and 153 deletions

View File

@ -1,138 +0,0 @@
require('source-map-support').install();
require('babel-plugin-transform-runtime');
import { OneDriveApi } from 'lib/onedrive-api.js';
const fs = require('fs-extra');
const path = require('path');
import { FileApiDriverOneDrive } from 'lib/file-api-driver-onedrive.js';
import { FileApi } from 'lib/file-api.js';
function configContent() {
const configFilePath = path.dirname(__dirname) + '/config.json';
return fs.readFile(configFilePath, 'utf8').then((content) => {
return JSON.parse(content);
});
}
async function main() {
let config = await configContent();
const fetch = require('node-fetch');
let options = {
headers: { 'Authorization': 'bearer ' + config.oneDriveToken },
};
// let api = new OneDriveApi('a');
// api.setToken(config.oneDriveToken);
// let r = await api.execText('GET', '/drive/root:/joplin/aaaaaaaaaaaaaaaaa.txt:/content');
// console.info(r);
//console.info(options);
// let response = await fetch('https://graph.microsoft.com/v1.0/drive/root:/joplin/aaaaaaaaaaaaaaaaa.txt:/content', options);
// console.info(response.ok);
// console.info(response.status);
// console.info(response.statusText);
// console.info(response.headers.get('Location'));
// let responseText = await response.text();
// console.info(responseText);
let driver = new FileApiDriverOneDrive('e09fc0de-c958-424f-83a2-e56a721d331b', 'JA3cwsqSGHFtjMwd5XoF5L5');
driver.api().setToken(config.oneDriveToken);
//config.oneDriveToken);
let api = new FileApi('/joplin', driver);
let appDir = await driver.api().execJson('GET', '/drive/special/approot');
console.info(appDir);
// /drive/special/approot
// await api.delete('eraseme.txt');
// let result = await api.list();
// console.info(result);
//await api.put('aaaaaaaaaaaaaaaaa.txt', 'AAAAAAAAAAAA MOD');
//onsole.info(content);
// let content = await api.get('aaaaaaaaaaaaaaaaa.txt');
// console.info(content);
// let r = await api.setTimestamp('aaaaaaaaaaaaaaaaa.txt', 1498061000000);
// console.info(r);
// console.info('==============');
// let stat = await api.stat('aaaaaaaaaaaaaaaaa.txt');
// console.info(stat);
// console.info(content);
// // const fetch = require('node-fetch');
// let content = await api.get('aaaaaaaaaaaaaaaaa.txt');
// console.info('CONTENT', content);
// var token = '';
// var client = MicrosoftGraph.Client.init({
// authProvider: (done) => {
// done(null, config.oneDriveToken);
// }
// });
// LIST ITEMS
//client.api('/drive/items/9ADA0EADFA073D0A%21109/children').get((err, res) => {
//client.api('/drive/items/9ADA0EADFA073D0A%21109/children').get((err, res) => {
//client.api('/drive/root:/joplin:/children').get((err, res) => {
// client.api('/drive/root:/.:/children').get((err, res) => {
// console.log(err, res);
// });
// SET ITEM CONTENT
// client.api('/drive/items/9ADA0EADFA073D0A%21109:/test.txt:/content').put('testing', (err, res) => {
// console.log(err, res);
// });
// SET ITEM CONTENT
// client.api('/drive/items/9ADA0EADFA073D0A%21109:/test2.txt:/content').put('testing deux', (err, res) => {
// console.log(err, res);
// });
// DELETE ITEM
// client.api('/drive/items/9ADA0EADFA073D0A%21111').delete((err, res) => {
// console.log(err, res);
// });
// GET ITEM METADATA
// client.api('/drive/items/9ADA0EADFA073D0A%21110?select=name,lastModifiedDateTime').get((err, res) => {
// console.log(err, res);
// });
}
main().catch((error) => {
console.error(error);
});

View File

@ -3,7 +3,7 @@ CLIENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
mkdir -p "$CLIENT_DIR/build"
rm -f "$CLIENT_DIR/app/lib"
ln -s "$CLIENT_DIR/../lib" "$CLIENT_DIR/app"
ln -s "$CLIENT_DIR/../ReactNativeClient/lib" "$CLIENT_DIR/app"
cp "$CLIENT_DIR/package.json" "$CLIENT_DIR/build"
# Always keep this as the last line so that the exit

View File

@ -1,3 +1,3 @@
import { main } from 'app/main.js';
import { main } from './main.js';
main();

View File

@ -1 +0,0 @@
../lib

View File

@ -1,5 +1,3 @@
require('babel-plugin-transform-runtime');
import { BaseItem } from 'lib/models/base-item.js';
import { Folder } from 'lib/models/folder.js';
import { Note } from 'lib/models/note.js';

View File

@ -8,7 +8,7 @@
import { AppRegistry } from 'react-native';
import { Log } from 'lib/log.js'
import { Root } from 'app/root.js';
import { Root } from './root.js';
function main() {
AppRegistry.registerComponent('AwesomeProject', () => Root);

View File

@ -11,18 +11,18 @@ import { Note } from 'lib/models/note.js'
import { Folder } from 'lib/models/folder.js'
import { BaseModel } from 'lib/base-model.js'
import { Database } from 'lib/database.js'
import { ItemList } from 'app/components/item-list.js'
import { NotesScreen } from 'app/components/screens/notes.js'
import { NoteScreen } from 'app/components/screens/note.js'
import { FolderScreen } from 'app/components/screens/folder.js'
import { FoldersScreen } from 'app/components/screens/folders.js'
import { LoginScreen } from 'app/components/screens/login.js'
import { LoadingScreen } from 'app/components/screens/loading.js'
import { ItemList } from 'lib/components/item-list.js'
import { NotesScreen } from 'lib/components/screens/notes.js'
import { NoteScreen } from 'lib/components/screens/note.js'
import { FolderScreen } from 'lib/components/screens/folder.js'
import { FoldersScreen } from 'lib/components/screens/folders.js'
import { LoginScreen } from 'lib/components/screens/login.js'
import { LoadingScreen } from 'lib/components/screens/loading.js'
import { Setting } from 'lib/models/setting.js'
import { Synchronizer } from 'lib/synchronizer.js'
import { MenuContext } from 'react-native-popup-menu';
import { SideMenu } from 'app/components/side-menu.js';
import { SideMenuContent } from 'app/components/side-menu-content.js';
import { SideMenu } from 'lib/components/side-menu.js';
import { SideMenuContent } from 'lib/components/side-menu-content.js';
//import { NoteFolderService } from 'lib/services/note-folder-service.js';
import { DatabaseDriverReactNative } from 'lib/database-driver-react-native';