Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
yield call(newTextile, REPO_PATH, LOG_LEVELS)
yield put(TextileNodeActions.createNodeSuccess())
yield put(TextileNodeActions.startingNode())
yield call(start)
const sessions: ReadonlyArray = yield call(cafeSessions)
if (sessions.length < 1) {
const cafeOverride: string = Config.RN_TEXTILE_CAFE_OVERRIDE
if (cafeOverride) {
yield call(registerOverrideCafe, cafeOverride)
} else {
yield call(discoverAndRegisterCafes)
}
}
const threadsResult: ReadonlyArray = yield call(threads)
const cameraRollThreadName = 'Camera Roll'
const cameraRollThreadKey = Config.RN_TEXTILE_CAMERA_ROLL_THREAD_KEY
const cameraRollThread = threadsResult.find((thread) => thread.key === cameraRollThreadKey)
if (!cameraRollThread) {
yield call(addThread, cameraRollThreadKey, cameraRollThreadName, false)
}
yield put(TextileNodeActions.startNodeSuccess())
} catch (error) {
try {
if (error.message === MIGRATION_NEEDED_ERROR) {
// instruct the node to export data to files
yield call(migrateRepo, REPO_PATH)
// store the fact there is a pending migration in the preferences redux persisted state
yield put(MigrationActions.migrationNeeded())
yield call(announcePeer)
// call the create/start sequence again
yield call(createAndStartNode, dispatch)
} else if (error.message === INIT_NEEDED_ERROR) {
thread => thread.key === Config.RN_TEXTILE_CAMERA_ROLL_THREAD_KEY
)
thread => thread.key === Config.RN_TEXTILE_CAMERA_ROLL_THREAD_KEY
)
export function* refreshThreads(
action: ActionType
) {
try {
const threadsResult: IThreadList = yield call(Textile.threads.list)
for (const thread of threadsResult.items) {
/**
* Filters to only threads we want to work with
*/
const useIt =
thread.key.indexOf('textile_photos-shared') === 0 ||
thread.key === Config.RN_TEXTILE_CAMERA_ROLL_THREAD_KEY
if (useIt) {
const valid = thread.headBlocks.length > 0
const withValid = { ...thread, valid }
yield put(GroupsActions.insertThread(withValid))
yield put(GroupsActions.refreshThreadRequest(thread.id))
}
}
} catch (error) {
yield put(
TextileEventsActions.newErrorMessage('refreshThreads', error.message)
)
yield put(GroupsActions.refreshThreadsError(error))
}
}
.filter((thread) => {
return thread.key !== Config.RN_TEXTILE_CAMERA_ROLL_THREAD_KEY &&
BLACKLIST.indexOf(thread.name) < 0
})