setting text color for android dark

This commit is contained in:
balzack 2023-03-04 22:05:40 -08:00
parent c2af1b9f71
commit d12f626324
12 changed files with 81 additions and 69 deletions

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splashscreen_background"/>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources>
<color name="splashscreen_background">#8FBEA7</color>
</resources>

View File

@ -71,6 +71,7 @@ export const styles = StyleSheet.create({
flex: 1, flex: 1,
textAlign: 'center', textAlign: 'center',
padding: 8, padding: 8,
color: Colors.text,
}, },
reset: { reset: {
marginTop: 16, marginTop: 16,

View File

@ -106,6 +106,7 @@ export const styles = StyleSheet.create({
flex: 1, flex: 1,
textAlign: 'center', textAlign: 'center',
padding: 8, padding: 8,
color: Colors.text,
}, },
create: { create: {
marginTop: 16, marginTop: 16,

View File

@ -71,6 +71,7 @@ export const styles = StyleSheet.create({
flex: 1, flex: 1,
textAlign: 'center', textAlign: 'center',
padding: 8, padding: 8,
color: Colors.text,
}, },
login: { login: {
marginTop: 16, marginTop: 16,

View File

@ -71,6 +71,7 @@ export const styles = StyleSheet.create({
flex: 1, flex: 1,
textAlign: 'center', textAlign: 'center',
padding: 8, padding: 8,
color: Colors.text,
}, },
reset: { reset: {
marginTop: 16, marginTop: 16,

View File

@ -27,7 +27,7 @@ export function useAccountContext() {
syncing.current = true; syncing.current = true;
try { try {
const revision = curRevision.current; const revision = curRevision.current;
const { server, token, guid } = access.current; const { server, token, guid } = access.current || {};
const status = await getAccountStatus(server, token); const status = await getAccountStatus(server, token);
await store.actions.setAccountStatus(guid, status); await store.actions.setAccountStatus(guid, status);
await store.actions.setAccountRevision(guid, revision); await store.actions.setAccountRevision(guid, revision);
@ -51,7 +51,7 @@ export function useAccountContext() {
throw new Error('invalid account state'); throw new Error('invalid account state');
} }
access.current = session; access.current = session;
const { guid, server, token } = session; const { guid, server, token } = session || {};
const status = await store.actions.getAccountStatus(guid); const status = await store.actions.getAccountStatus(guid);
const sealKey = await store.actions.getAccountSealKey(guid); const sealKey = await store.actions.getAccountSealKey(guid);
const revision = await store.actions.getAccountRevision(guid); const revision = await store.actions.getAccountRevision(guid);
@ -68,26 +68,26 @@ export function useAccountContext() {
sync(); sync();
}, },
setNotifications: async (flag) => { setNotifications: async (flag) => {
const { server, token } = access.current; const { server, token } = access.current || {};
await setAccountNotifications(server, token, flag); await setAccountNotifications(server, token, flag);
}, },
setSearchable: async (flag) => { setSearchable: async (flag) => {
const { server, token } = access.current; const { server, token } = access.current || {};
await setAccountSearchable(server, token, flag); await setAccountSearchable(server, token, flag);
}, },
setAccountSeal: async (seal, key) => { setAccountSeal: async (seal, key) => {
const { guid, server, token } = access.current; const { guid, server, token } = access.current || {};
await setAccountSeal(server, token, seal); await setAccountSeal(server, token, seal);
await store.actions.setAccountSealKey(guid, key); await store.actions.setAccountSealKey(guid, key);
updateState({ sealKey: key }); updateState({ sealKey: key });
}, },
unlockAccountSeal: async (key) => { unlockAccountSeal: async (key) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setAccountSealKey(guid, key); await store.actions.setAccountSealKey(guid, key);
updateState({ sealKey: key }); updateState({ sealKey: key });
}, },
setLogin: async (username, password) => { setLogin: async (username, password) => {
const { server, token } = access.current; const { server, token } = access.current || {};
await setAccountLogin(server, token, username, password); await setAccountLogin(server, token, username, password);
}, },
resync: async () => { resync: async () => {

View File

@ -146,7 +146,7 @@ export function useAppContext() {
if (!access.current) { if (!access.current) {
throw new Error('invalid session state'); throw new Error('invalid session state');
} }
const { server, token } = access.current; const { server, token } = access.current || {};
await removeProfile(server, token); await removeProfile(server, token);
await clearSession(); await clearSession();
await store.actions.clearSession(); await store.actions.clearSession();

View File

@ -103,7 +103,7 @@ export function useCardContext() {
syncing.current = true; syncing.current = true;
try { try {
const { server, token, guid } = access.current; const { server, token, guid } = access.current || {};
const entry = cards.current.get(cardId); const entry = cards.current.get(cardId);
if (entry?.card?.detail.status === 'connected') { if (entry?.card?.detail.status === 'connected') {
const card = await getCard(server, token, cardId); const card = await getCard(server, token, cardId);
@ -129,7 +129,7 @@ export function useCardContext() {
if (access.current && !syncing.current && setRevision.current !== curRevision.current) { if (access.current && !syncing.current && setRevision.current !== curRevision.current) {
syncing.current = true; syncing.current = true;
try { try {
const { server, token, guid } = access.current; const { server, token, guid } = access.current || {};
const revision = curRevision.current; const revision = curRevision.current;
const delta = await getCards(server, token, setRevision.current); const delta = await getCards(server, token, setRevision.current);
for (let card of delta) { for (let card of delta) {
@ -325,36 +325,36 @@ export function useCardContext() {
sync(); sync();
}, },
addCard: async (message) => { addCard: async (message) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await addCard(server, token, message); return await addCard(server, token, message);
}, },
removeCard: async (cardId) => { removeCard: async (cardId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await removeCard(server, token, cardId); return await removeCard(server, token, cardId);
}, },
setCardConnecting: async (cardId) => { setCardConnecting: async (cardId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await setCardConnecting(server, token, cardId); return await setCardConnecting(server, token, cardId);
}, },
setCardConnected: async (cardId, cardToken, revision) => { setCardConnected: async (cardId, cardToken, revision) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await setCardConnected(server, token, cardId, cardToken, return await setCardConnected(server, token, cardId, cardToken,
revision.viewRevision, revision.articleRevision, revision.viewRevision, revision.articleRevision,
revision.channelRevision, revision.profileRevision); revision.channelRevision, revision.profileRevision);
}, },
setCardConfirmed: async (cardId) => { setCardConfirmed: async (cardId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await setCardConfirmed(server, token, cardId); return await setCardConfirmed(server, token, cardId);
}, },
getCardOpenMessage: async (cardId) => { getCardOpenMessage: async (cardId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await getCardOpenMessage(server, token, cardId); return await getCardOpenMessage(server, token, cardId);
}, },
setCardOpenMessage: async (server, message) => { setCardOpenMessage: async (server, message) => {
return await setCardOpenMessage(server, message); return await setCardOpenMessage(server, message);
}, },
getCardCloseMessage: async (cardId) => { getCardCloseMessage: async (cardId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await getCardCloseMessage(server, token, cardId); return await getCardCloseMessage(server, token, cardId);
}, },
setCardCloseMessage: async (server, message) => { setCardCloseMessage: async (server, message) => {
@ -362,7 +362,7 @@ export function useCardContext() {
}, },
getCardImageUrl: (cardId) => { getCardImageUrl: (cardId) => {
const { profileRevision } = cards.current.get(cardId)?.card || {}; const { profileRevision } = cards.current.get(cardId)?.card || {};
const { server, token } = access.current; const { server, token } = access.current || {};
return getCardImageUrl(server, token, cardId, profileRevision); return getCardImageUrl(server, token, cardId, profileRevision);
}, },
removeChannel: async (cardId, channelId) => { removeChannel: async (cardId, channelId) => {
@ -419,52 +419,52 @@ export function useCardContext() {
return await getContactChannelTopic(profile?.node, cardToken, channelId, topicId); return await getContactChannelTopic(profile?.node, cardToken, channelId, topicId);
}, },
setContactRevision: async (cardId, revision) => { setContactRevision: async (cardId, revision) => {
const { guid } = acccess.current const { guid } = acccess.current || {};
await store.actions.setCardRequestStatus(guid, { revision }); await store.actions.setCardRequestStatus(guid, { revision });
updateState({ viewRevision: revision }); updateState({ viewRevision: revision });
}, },
setChannelReadRevision: async (cardId, channelId, revision) => { setChannelReadRevision: async (cardId, channelId, revision) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelItemReadRevision(guid, cardId, channelId, revision); await store.actions.setCardChannelItemReadRevision(guid, cardId, channelId, revision);
setCardChannelField(cardId, channelId, 'readRevision', revision); setCardChannelField(cardId, channelId, 'readRevision', revision);
}, },
setChannelSyncRevision: async (cardId, channelId, revision) => { setChannelSyncRevision: async (cardId, channelId, revision) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelItemSyncRevision(guid, cardId, channelId, revision); await store.actions.setCardChannelItemSyncRevision(guid, cardId, channelId, revision);
setCardChannelField(cardId, channelId, 'syncRevision', revision); setCardChannelField(cardId, channelId, 'syncRevision', revision);
}, },
setChannelTopicMarker: async (cardId, channelId, marker) => { setChannelTopicMarker: async (cardId, channelId, marker) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelItemTopicMarker(guid, cardId, channelId, marker); await store.actions.setCardChannelItemTopicMarker(guid, cardId, channelId, marker);
setCardChannelField(cardId, channelId, 'topicMarker', marker); setCardChannelField(cardId, channelId, 'topicMarker', marker);
}, },
setChannelMarkerAndSync: async (cardId, channelId, marker, revision) => { setChannelMarkerAndSync: async (cardId, channelId, marker, revision) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelItemMarkerAndSync(guid, cardId, channelId, marker, revision); await store.actions.setCardChannelItemMarkerAndSync(guid, cardId, channelId, marker, revision);
setCardChannelField(cardId, channelId, 'topicMarker', marker, 'syncRevision', revision); setCardChannelField(cardId, channelId, 'topicMarker', marker, 'syncRevision', revision);
}, },
setCardFlag: async (cardId) => { setCardFlag: async (cardId) => {
const { guid } = acccess.current; const { guid } = acccess.current || {};
await store.actions.setCardItemBlocked(guid, cardId); await store.actions.setCardItemBlocked(guid, cardId);
setCardField(cardId, 'blocked', true); setCardField(cardId, 'blocked', true);
}, },
clearCardFlag: async (cardId) => { clearCardFlag: async (cardId) => {
const { guid } = acccess.current; const { guid } = acccess.current || {};
await store.actions.clearCardItemBlocked(guid, cardId); await store.actions.clearCardItemBlocked(guid, cardId);
setCardField(cardId, 'blocked', false); setCardField(cardId, 'blocked', false);
}, },
setChannelFlag: async (cardId, channelId) => { setChannelFlag: async (cardId, channelId) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelItemBlocked(guid, cardId, channelId); await store.actions.setCardChannelItemBlocked(guid, cardId, channelId);
setCardChannelField(cardId, channelId, 'blocked', true); setCardChannelField(cardId, channelId, 'blocked', true);
}, },
clearChannelFlag: async (cardId, channelId) => { clearChannelFlag: async (cardId, channelId) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelItemBlocked(guid, cardId, channelId); await store.actions.setCardChannelItemBlocked(guid, cardId, channelId);
setCardChannelField(cardId, channelId, 'blocked', false); setCardChannelField(cardId, channelId, 'blocked', false);
}, },
setTopicFlag: async (cardId, channelId, topicId) => { setTopicFlag: async (cardId, channelId, topicId) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelTopicBlocked(guid, cardId, channelId, topicId, true); await store.actions.setCardChannelTopicBlocked(guid, cardId, channelId, topicId, true);
}, },
clearTopicFlag: async (cardId, channelId, topicId) => { clearTopicFlag: async (cardId, channelId, topicId) => {
@ -490,33 +490,33 @@ export function useCardContext() {
return await setContactChannelNotifications(profile?.node, token, channelId, notify); return await setContactChannelNotifications(profile?.node, token, channelId, notify);
}, },
getTopicItems: async (cardId, channelId) => { getTopicItems: async (cardId, channelId) => {
const { guid } = access.current; const { guid } = access.current || {};
return await store.actions.getCardChannelTopicItems(guid, cardId, channelId); return await store.actions.getCardChannelTopicItems(guid, cardId, channelId);
}, },
setTopicItem: async (cardId, channelId, topicId, topic) => { setTopicItem: async (cardId, channelId, topicId, topic) => {
const { guid } = access.current; const { guid } = access.current || {};
return await store.actions.setCardChannelTopicItem(guid, cardId, channelId, topicId, topic); return await store.actions.setCardChannelTopicItem(guid, cardId, channelId, topicId, topic);
}, },
clearTopicItem: async (cardId, channelId, topicId) => { clearTopicItem: async (cardId, channelId, topicId) => {
const { guid } = access.current; const { guid } = access.current || {};
return await store.actions.clearCardChannelTopicItem(guid, cardId, channelId, topicId); return await store.actions.clearCardChannelTopicItem(guid, cardId, channelId, topicId);
}, },
clearTopicItems: async (cardId, channelId) => { clearTopicItems: async (cardId, channelId) => {
const { guid } = access.current; const { guid } = access.current || {};
return await store.actions.clearCardChannelTopicItems(guid, cardId, channelId); return await store.actions.clearCardChannelTopicItems(guid, cardId, channelId);
}, },
setUnsealedChannelSubject: async (cardId, channelId, revision, unsealed) => { setUnsealedChannelSubject: async (cardId, channelId, revision, unsealed) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelItemUnsealedDetail(guid, cardId, channelId, revision, unsealed); await store.actions.setCardChannelItemUnsealedDetail(guid, cardId, channelId, revision, unsealed);
setCardChannelField(cardId, channelId, 'unsealedDetail', unsealed); setCardChannelField(cardId, channelId, 'unsealedDetail', unsealed);
}, },
setUnsealedChannelSummary: async (cardId, channelId, revision, unsealed) => { setUnsealedChannelSummary: async (cardId, channelId, revision, unsealed) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelItemUnsealedSummary(guid, cardId, channelId, revision, unsealed); await store.actions.setCardChannelItemUnsealedSummary(guid, cardId, channelId, revision, unsealed);
setCardChannelField(cardId, channelId, 'unsealedSummary', unsealed); setCardChannelField(cardId, channelId, 'unsealedSummary', unsealed);
}, },
setUnsealedTopicSubject: async (cardId, channelId, topicId, revision, unsealed) => { setUnsealedTopicSubject: async (cardId, channelId, topicId, revision, unsealed) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setCardChannelTopicItemUnsealedDetail(guid, cardId, channelId, topicId, revision, unsealed); await store.actions.setCardChannelTopicItemUnsealedDetail(guid, cardId, channelId, topicId, revision, unsealed);
}, },
resync: async () => { resync: async () => {

View File

@ -142,27 +142,27 @@ export function useChannelContext() {
sync(); sync();
}, },
addChannel: async (type, subject, cards) => { addChannel: async (type, subject, cards) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await addChannel(server, token, type, subject, cards); return await addChannel(server, token, type, subject, cards);
}, },
removeChannel: async (channelId) => { removeChannel: async (channelId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await removeChannel(server, token, channelId); return await removeChannel(server, token, channelId);
}, },
setChannelSubject: async (channelId, type, subject) => { setChannelSubject: async (channelId, type, subject) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await setChannelSubject(server, token, channelId, type, subject); return await setChannelSubject(server, token, channelId, type, subject);
}, },
setChannelCard: async (channelId, cardId) => { setChannelCard: async (channelId, cardId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await setChannelCard(server, token, channelId, cardId); return await setChannelCard(server, token, channelId, cardId);
}, },
clearChannelCard: async (channelId, cardId) => { clearChannelCard: async (channelId, cardId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await clearChannelCard(server, token, channelId, cardId); return await clearChannelCard(server, token, channelId, cardId);
}, },
addTopic: async (channelId, type, message, files) => { addTopic: async (channelId, type, message, files) => {
const { server, token } = access.current; const { server, token } = access.current || {};
if (files?.length > 0) { if (files?.length > 0) {
const topicId = await addChannelTopic(server, token, channelId, null, null, null); const topicId = await addChannelTopic(server, token, channelId, null, null, null);
upload.actions.addTopic(server, token, channelId, topicId, files, async (assets) => { upload.actions.addTopic(server, token, channelId, topicId, files, async (assets) => {
@ -183,106 +183,106 @@ export function useChannelContext() {
} }
}, },
removeTopic: async (channelId, topicId) => { removeTopic: async (channelId, topicId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
await removeChannelTopic(server, token, channelId, topicId); await removeChannelTopic(server, token, channelId, topicId);
}, },
setTopicSubject: async (channelId, topicId, type, subject) => { setTopicSubject: async (channelId, topicId, type, subject) => {
const { server, token } = access.current; const { server, token } = access.current || {};
await setChannelTopicSubject(server, token, channelId, topicId, type, subject); await setChannelTopicSubject(server, token, channelId, topicId, type, subject);
}, },
getTopicAssetUrl: (channelId, topicId, assetId) => { getTopicAssetUrl: (channelId, topicId, assetId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return getChannelTopicAssetUrl(server, token, channelId, topicId, assetId); return getChannelTopicAssetUrl(server, token, channelId, topicId, assetId);
}, },
getTopics: async (channelId, revision, count, begin, end) => { getTopics: async (channelId, revision, count, begin, end) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await getChannelTopics(server, token, channelId, revision, count, begin, end); return await getChannelTopics(server, token, channelId, revision, count, begin, end);
}, },
getTopic: async (channelId, topicId) => { getTopic: async (channelId, topicId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await getChannelTopic(server, token, channelId, topicId); return await getChannelTopic(server, token, channelId, topicId);
}, },
resync: async () => { resync: async () => {
await sync(); await sync();
}, },
getNotifications: async (channelId) => { getNotifications: async (channelId) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await getChannelNotifications(server, token, channelId); return await getChannelNotifications(server, token, channelId);
}, },
setNotifications: async (channelId, notify) => { setNotifications: async (channelId, notify) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await setChannelNotifications(server, token, channelId, notify); return await setChannelNotifications(server, token, channelId, notify);
}, },
setReadRevision: async (channelId, revision) => { setReadRevision: async (channelId, revision) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelItemReadRevision(guid, channelId, revision); await store.actions.setChannelItemReadRevision(guid, channelId, revision);
setChannelField(channelId, 'readRevision', revision); setChannelField(channelId, 'readRevision', revision);
}, },
setSyncRevision: async (channelId, revision) => { setSyncRevision: async (channelId, revision) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelItemSyncRevision(guid, channelId, revision); await store.actions.setChannelItemSyncRevision(guid, channelId, revision);
setChannelField(channelId, 'syncRevision', revision); setChannelField(channelId, 'syncRevision', revision);
}, },
setTopicMarker: async (channelId, marker) => { setTopicMarker: async (channelId, marker) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelItemTopicMarker(guid, channelId, revision); await store.actions.setChannelItemTopicMarker(guid, channelId, revision);
setChannelField(channelId, 'topicMarker', marker); setChannelField(channelId, 'topicMarker', marker);
}, },
setMarkerAndSync: async (channelId, marker, revision) => { setMarkerAndSync: async (channelId, marker, revision) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelItemMarkerAndSync(guid, channelId, marker, revision); await store.actions.setChannelItemMarkerAndSync(guid, channelId, marker, revision);
setChannelField(channelId, 'topicMarker', marker, 'syncRevision', revision); setChannelField(channelId, 'topicMarker', marker, 'syncRevision', revision);
}, },
setChannelFlag: async (channelId) => { setChannelFlag: async (channelId) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelItemBlocked(guid, channelId); await store.actions.setChannelItemBlocked(guid, channelId);
setChannelField(channelId, 'blocked', true); setChannelField(channelId, 'blocked', true);
}, },
clearChannelFlag: async (channelId) => { clearChannelFlag: async (channelId) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.clearChannelItemBlocked(guid, channelId); await store.actions.clearChannelItemBlocked(guid, channelId);
setChannelField(channelId, 'blocked', false); setChannelField(channelId, 'blocked', false);
}, },
setTopicFlag: async (channelId, topicId) => { setTopicFlag: async (channelId, topicId) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelTopicBlocked(guid, channelId, topicId, 1); await store.actions.setChannelTopicBlocked(guid, channelId, topicId, 1);
}, },
clearTopicFlag: async (channelId, topicId) => { clearTopicFlag: async (channelId, topicId) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelTopicBlocked(guid, channelId, topicId, 0); await store.actions.setChannelTopicBlocked(guid, channelId, topicId, 0);
}, },
addChannelAlert: async (channelId) => { addChannelAlert: async (channelId) => {
const { server, guid } = access.current; const { server, guid } = access.current || {};
return await addFlag(server, guid, channelId); return await addFlag(server, guid, channelId);
}, },
addTopicAlert: async (channelId, topicId) => { addTopicAlert: async (channelId, topicId) => {
const { server, guid } = access.current; const { server, guid } = access.current || {};
return await addFlag(server, guid, channelId, topicId); return await addFlag(server, guid, channelId, topicId);
}, },
getTopicItems: async (channelId) => { getTopicItems: async (channelId) => {
const { guid } = access.current; const { guid } = access.current || {};
return await store.actions.getChannelTopicItems(guid, channelId); return await store.actions.getChannelTopicItems(guid, channelId);
}, },
setTopicItem: async (channelId, topic) => { setTopicItem: async (channelId, topic) => {
const { guid } = access.current; const { guid } = access.current || {};
return await store.actions.setChannelTopicItem(guid, channelId, topic); return await store.actions.setChannelTopicItem(guid, channelId, topic);
}, },
clearTopicItem: async (channelId, topicId) => { clearTopicItem: async (channelId, topicId) => {
const { guid } = access.current; const { guid } = access.current || {};
return await store.actions.clearChannelTopicItem(guid, channelId, topicId); return await store.actions.clearChannelTopicItem(guid, channelId, topicId);
}, },
setUnsealedChannelSubject: async (channelId, revision, unsealed) => { setUnsealedChannelSubject: async (channelId, revision, unsealed) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelItemUnsealedDetail(guid, channelId, revision, unsealed); await store.actions.setChannelItemUnsealedDetail(guid, channelId, revision, unsealed);
setChannelField(channelId, 'unsealedDetail', unsealed); setChannelField(channelId, 'unsealedDetail', unsealed);
}, },
setUnsealedChannelSummary: async (channelId, revision, unsealed) => { setUnsealedChannelSummary: async (channelId, revision, unsealed) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelItemUnsealedSummary(guid, channelId, revision, unsealed); await store.actions.setChannelItemUnsealedSummary(guid, channelId, revision, unsealed);
setChannelField(channelId, 'unsealedSummary', unsealed); setChannelField(channelId, 'unsealedSummary', unsealed);
}, },
setUnsealedTopicSubject: async (channelId, topicId, revision, unsealed) => { setUnsealedTopicSubject: async (channelId, topicId, revision, unsealed) => {
const { guid } = access.current; const { guid } = access.current || {};
await store.actions.setChannelTopicItemUnsealedDetail(guid, channelId, topicId, revision, unsealed); await store.actions.setChannelTopicItemUnsealedDetail(guid, channelId, topicId, revision, unsealed);
}, },
}; };

View File

@ -29,7 +29,7 @@ export function useProfileContext() {
try { try {
const revision = curRevision.current; const revision = curRevision.current;
const { server, token, guid } = access.current; const { server, token, guid } = access.current || {};
const identity = await getProfile(server, token); const identity = await getProfile(server, token);
const imageUrl = identity?.image ? getProfileImageUrl(server, token, revision) : null; const imageUrl = identity?.image ? getProfileImageUrl(server, token, revision) : null;
await store.actions.setProfile(guid, identity); await store.actions.setProfile(guid, identity);
@ -51,7 +51,7 @@ export function useProfileContext() {
const actions = { const actions = {
setSession: async (session) => { setSession: async (session) => {
const { guid, server, token } = session; const { guid, server, token } = session || {};
const identity = await store.actions.getProfile(guid); const identity = await store.actions.getProfile(guid);
const revision = await store.actions.getProfileRevision(guid); const revision = await store.actions.getProfileRevision(guid);
const imageUrl = identity?.image ? getProfileImageUrl(server, token, revision) : null; const imageUrl = identity?.image ? getProfileImageUrl(server, token, revision) : null;
@ -68,15 +68,15 @@ export function useProfileContext() {
sync(); sync();
}, },
setProfileData: async (name, location, description) => { setProfileData: async (name, location, description) => {
const { server, token } = access.current; const { server, token } = access.current || {};
await setProfileData(server, token, name, location, description); await setProfileData(server, token, name, location, description);
}, },
setProfileImage: async (image) => { setProfileImage: async (image) => {
const { server, token } = access.current; const { server, token } = access.current || {};
await setProfileImage(server, token, image); await setProfileImage(server, token, image);
}, },
getHandleStatus: async (name) => { getHandleStatus: async (name) => {
const { server, token } = access.current; const { server, token } = access.current || {};
return await getHandle(server, token, name); return await getHandle(server, token, name);
}, },
} }