mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
fixing refactored store context
This commit is contained in:
parent
95627c14e3
commit
d2e7955012
@ -567,7 +567,7 @@
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
@ -639,7 +639,7 @@
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
|
@ -103,7 +103,7 @@ export const styles = StyleSheet.create({
|
||||
marginTop: 16,
|
||||
},
|
||||
logintext: {
|
||||
color: 'yellow',
|
||||
color: Colors.primary,
|
||||
},
|
||||
nologintext: {
|
||||
color: Colors.disabled,
|
||||
|
@ -138,7 +138,7 @@ export const styles = StyleSheet.create({
|
||||
marginBottom: 16,
|
||||
},
|
||||
logintext: {
|
||||
color: 'yellow',
|
||||
color: Colors.primary,
|
||||
},
|
||||
nologintext: {
|
||||
color: Colors.disabled,
|
||||
|
@ -103,7 +103,7 @@ export const styles = StyleSheet.create({
|
||||
marginTop: 16,
|
||||
},
|
||||
createtext: {
|
||||
color: 'yellow',
|
||||
color: Colors.primary,
|
||||
},
|
||||
nocreatetext: {
|
||||
color: Colors.disabled,
|
||||
|
@ -103,7 +103,7 @@ export const styles = StyleSheet.create({
|
||||
marginTop: 16,
|
||||
},
|
||||
logintext: {
|
||||
color: 'yellow',
|
||||
color: Colors.primary,
|
||||
},
|
||||
nologintext: {
|
||||
color: Colors.disabled,
|
||||
|
@ -186,7 +186,7 @@ export function useCardContext() {
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
entry.offsync = true;
|
||||
await store.action.setCardItemOffsync(guid, card.id);
|
||||
await store.actions.setCardItemOffsync(guid, card.id);
|
||||
}
|
||||
}
|
||||
cards.current.set(card.id, { ...entry });
|
||||
|
@ -58,6 +58,7 @@ export function useChannelContext() {
|
||||
};
|
||||
|
||||
const sync = async () => {
|
||||
|
||||
if (access.current && !syncing.current && setRevision.current !== curRevision.current) {
|
||||
syncing.current = true;
|
||||
try {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useEffect, useState, useRef, useContext } from 'react';
|
||||
import SQLite from "react-native-sqlite-storage";
|
||||
|
||||
const DATABAG_DB = 'db_v090.db';
|
||||
const DATABAG_DB = 'db_v_101.db';
|
||||
|
||||
export function useStoreContext() {
|
||||
const [state, setState] = useState({});
|
||||
@ -168,8 +168,8 @@ export function useStoreContext() {
|
||||
await db.current.executeSql("INSERT OR REPLACE INTO app (key, value) values (?, ?);", [dataId, encodeObject(revision)]);
|
||||
},
|
||||
setChannelItem: async (guid, channel) => {
|
||||
const { id, revision, data } = channel;
|
||||
await db.current.executeSql(`INSERT OR REPLACE INTO channel_${guid} (channel_id, revision, detail_revision, topic_revision, detail, summary, unsealed_detail, unsealed_summary) values (?, ?, ?, ?, ?, ?, null, null);`, [id, revision, detailRevision, topicRevision, encodeObject(channelDetail), encodeObject(channelSummary)]);
|
||||
const { id, revision, detailRevision, topicRevision, detail, summary } = channel;
|
||||
await db.current.executeSql(`INSERT OR REPLACE INTO channel_${guid} (channel_id, revision, detail_revision, topic_revision, detail, summary, unsealed_detail, unsealed_summary) values (?, ?, ?, ?, ?, ?, null, null);`, [id, revision, detailRevision, topicRevision, encodeObject(detail), encodeObject(summary)]);
|
||||
},
|
||||
clearChannelItem: async (guid, channelId) => {
|
||||
await db.current.executeSql(`DELETE FROM channel_${guid} WHERE channel_id=?`, [channelId]);
|
||||
@ -264,7 +264,7 @@ export function useStoreContext() {
|
||||
|
||||
setCardChannelItem: async (guid, cardId, channel) => {
|
||||
const { channelId, revision, detailRevision, topicRevision, detail, summary } = channel;
|
||||
await db.current.executeSql(`INSERT OR REPLACE INTO card_channel_${guid} (card_id, channel_id, revision, detail_revision, topic_revision, detail, summary, unsealed_detail, unsealed_summary) values (?, ?, ?, ?, ?, ?, ?, null, null);`, [cardId, channelId, revision, detailRevision, topicRevision, encodeObject(channelDetail), encodeObject(channelSummary)]);
|
||||
await db.current.executeSql(`INSERT OR REPLACE INTO card_channel_${guid} (card_id, channel_id, revision, detail_revision, topic_revision, detail, summary, unsealed_detail, unsealed_summary) values (?, ?, ?, ?, ?, ?, ?, null, null);`, [cardId, channelId, revision, detailRevision, topicRevision, encodeObject(detail), encodeObject(summary)]);
|
||||
},
|
||||
clearCardChannelItem: async (guid, cardId, channelId) => {
|
||||
await db.current.executeSql(`DELETE FROM card_channel_${guid} WHERE card_id=? and channel_id=?`, [cardId, channelId]);
|
||||
|
Loading…
Reference in New Issue
Block a user