|
1 | 1 | import { useState, useEffect } from 'react' |
2 | 2 | import { Platform } from 'react-native'; |
3 | 3 | import { db } from "../db/dbConnection"; |
4 | | -import { ANDROID_CONNECTION_STRING, CONNECTION_STRING, API_TOKEN } from "@env"; |
| 4 | +import { ANDROID_MANAGED_DATABASE_ID, MANAGED_DATABASE_ID, API_TOKEN } from "@env"; |
5 | 5 | import { getDylibPath } from "@op-engineering/op-sqlite"; |
6 | 6 | import { randomUUID } from 'expo-crypto'; |
7 | 7 | import { useSyncContext } from '../components/SyncContext'; |
@@ -72,11 +72,11 @@ const useCategories = () => { |
72 | 72 | await db.execute('INSERT OR IGNORE INTO tags (uuid, name) VALUES (?, ?)', ['work', 'Work']) |
73 | 73 | await db.execute('INSERT OR IGNORE INTO tags (uuid, name) VALUES (?, ?)', ['personal', 'Personal']) |
74 | 74 |
|
75 | | - if ((ANDROID_CONNECTION_STRING || CONNECTION_STRING) && API_TOKEN) { |
76 | | - await db.execute(`SELECT cloudsync_network_init('${Platform.OS == 'android' && ANDROID_CONNECTION_STRING ? ANDROID_CONNECTION_STRING : CONNECTION_STRING}');`); |
| 75 | + if ((ANDROID_MANAGED_DATABASE_ID || MANAGED_DATABASE_ID) && API_TOKEN) { |
| 76 | + await db.execute(`SELECT cloudsync_network_init('${Platform.OS == 'android' && ANDROID_MANAGED_DATABASE_ID ? ANDROID_MANAGED_DATABASE_ID : MANAGED_DATABASE_ID}');`); |
77 | 77 | await db.execute(`SELECT cloudsync_network_set_token('${API_TOKEN}');`) |
78 | 78 | } else { |
79 | | - throw new Error('No valid CONNECTION_STRING or API_TOKEN provided, cloudsync_network_init will not be called'); |
| 79 | + throw new Error('No valid MANAGED_DATABASE_ID or API_TOKEN provided, cloudsync_network_init will not be called'); |
80 | 80 | } |
81 | 81 |
|
82 | 82 | db.execute('SELECT cloudsync_network_sync(100, 10);') |
|
0 commit comments