fixing refactored store context

This commit is contained in:
Roland Osborne 2023-02-16 10:04:05 -08:00
parent 95627c14e3
commit d2e7955012
8 changed files with 12 additions and 11 deletions

View File

@ -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;

View File

@ -103,7 +103,7 @@ export const styles = StyleSheet.create({
marginTop: 16,
},
logintext: {
color: 'yellow',
color: Colors.primary,
},
nologintext: {
color: Colors.disabled,

View File

@ -138,7 +138,7 @@ export const styles = StyleSheet.create({
marginBottom: 16,
},
logintext: {
color: 'yellow',
color: Colors.primary,
},
nologintext: {
color: Colors.disabled,

View File

@ -103,7 +103,7 @@ export const styles = StyleSheet.create({
marginTop: 16,
},
createtext: {
color: 'yellow',
color: Colors.primary,
},
nocreatetext: {
color: Colors.disabled,

View File

@ -103,7 +103,7 @@ export const styles = StyleSheet.create({
marginTop: 16,
},
logintext: {
color: 'yellow',
color: Colors.primary,
},
nologintext: {
color: Colors.disabled,

View File

@ -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 });

View File

@ -58,6 +58,7 @@ export function useChannelContext() {
};
const sync = async () => {
if (access.current && !syncing.current && setRevision.current !== curRevision.current) {
syncing.current = true;
try {

View File

@ -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]);