Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/(modals)/(recipes)/editRecipe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,8 @@ export default function EditRecipeScreen() {
if (!userId) {
throw new Error("User not authenticated");
}
const { UserCacheService } = await import(
"@services/offlineV2/UserCacheService"
);
const { UserCacheService } =
await import("@services/offlineV2/UserCacheService");
const recipes = await UserCacheService.getRecipes(userId, unitSystem);
const recipe = recipes.find(r => r.id === recipe_id);
if (!recipe) {
Expand Down
5 changes: 2 additions & 3 deletions app/(modals)/(recipes)/viewRecipe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ export default function ViewRecipeScreen() {

// If not found in V2 cache, check if there are legacy recipes to migrate
try {
const { LegacyMigrationService } = await import(
"@services/offlineV2/LegacyMigrationService"
);
const { LegacyMigrationService } =
await import("@services/offlineV2/LegacyMigrationService");
const legacyCount =
await LegacyMigrationService.getLegacyRecipeCount(userId);

Expand Down
4,363 changes: 1,845 additions & 2,518 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@expo/metro-runtime": "~6.1.2",
"@expo/vector-icons": "~15.0.2",
"@react-native-async-storage/async-storage": "2.2.0",
"@react-native-community/datetimepicker": "8.4.4",
"@react-native-community/datetimepicker": "8.6.0",
"@react-native-community/netinfo": "~11.4.1",
"@react-navigation/bottom-tabs": "^7.3.10",
"@react-navigation/elements": "^2.3.8",
Expand Down Expand Up @@ -84,7 +84,7 @@
"react-native-screens": "~4.16.0",
"react-native-svg": "~15.12.1",
"react-native-web": "~0.21.0",
"react-native-webview": "13.15.0",
"react-native-webview": "13.16.0",
"react-native-worklets": "0.5.1",
"uuid": "^11.1.0",
"zxcvbn": "^4.4.2"
Expand Down
10 changes: 4 additions & 6 deletions src/contexts/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,8 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({
await cacheUtils.clearUserPersistedCache(userId);

// Clear user-scoped offline data
const { UserCacheService } = await import(
"@services/offlineV2/UserCacheService"
);
const { UserCacheService } =
await import("@services/offlineV2/UserCacheService");
await UserCacheService.clearUserData(userId);

await UnifiedLogger.info("auth", "Logout completed successfully", {
Expand Down Expand Up @@ -795,9 +794,8 @@ export const AuthProvider: React.FC<AuthProviderProps> = ({
await cacheUtils.clearAllPersistedCache();

// Clear user offline data
const { UserCacheService } = await import(
"@services/offlineV2/UserCacheService"
);
const { UserCacheService } =
await import("@services/offlineV2/UserCacheService");
await UserCacheService.clearUserData();
} finally {
setIsLoading(false);
Expand Down
5 changes: 2 additions & 3 deletions src/contexts/DeveloperContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,8 @@ export const DeveloperProvider: React.FC<DeveloperProviderProps> = ({
"Starting pending operations sync"
);

const { UserCacheService } = await import(
"@services/offlineV2/UserCacheService"
);
const { UserCacheService } =
await import("@services/offlineV2/UserCacheService");

const result = await UserCacheService.syncPendingOperations();
if (result && result.success === false) {
Expand Down
5 changes: 2 additions & 3 deletions src/services/offlineV2/UserCacheService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2487,9 +2487,8 @@ export class UserCacheService {

// MIGRATION: Also check for legacy offline recipes that need preservation
try {
const { LegacyMigrationService } = await import(
"./LegacyMigrationService"
);
const { LegacyMigrationService } =
await import("./LegacyMigrationService");
const legacyCount =
await LegacyMigrationService.getLegacyRecipeCount(userId);

Expand Down
8 changes: 4 additions & 4 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ export interface ApiCallOptions {
// Brew Session API types
export type BrewSessionResponse = BrewSession;

export interface BrewSessionsListResponse
extends PaginatedResponse<BrewSession> {
export interface BrewSessionsListResponse extends PaginatedResponse<BrewSession> {
brew_sessions: BrewSession[];
}

Expand All @@ -379,8 +378,9 @@ export type UpdateBrewSessionResponse = ApiResponse<BrewSession>;

export type FermentationEntryResponse = ApiResponse<FermentationEntry>;

export interface FermentationEntriesResponse
extends ApiResponse<FermentationEntry[]> {
export interface FermentationEntriesResponse extends ApiResponse<
FermentationEntry[]
> {
data: FermentationEntry[];
}

Expand Down
5 changes: 2 additions & 3 deletions tests/services/offlineV2/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ describe("OfflineV2 Services Index", () => {
});

it("should export both services in a single import", async () => {
const { StaticDataService, UserCacheService } = await import(
"@services/offlineV2/index"
);
const { StaticDataService, UserCacheService } =
await import("@services/offlineV2/index");
expect(StaticDataService).toBeDefined();
expect(UserCacheService).toBeDefined();
expect(StaticDataService).not.toBe(UserCacheService);
Expand Down
10 changes: 4 additions & 6 deletions tests/src/hooks/offlineV2/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ describe("OfflineV2 Hooks Index", () => {
});

it("should export user data hooks", async () => {
const { useRecipes, useBrewSessions } = await import(
"@hooks/offlineV2/index"
);
const { useRecipes, useBrewSessions } =
await import("@hooks/offlineV2/index");

expect(useRecipes).toBeDefined();
expect(typeof useRecipes).toBe("function");
Expand All @@ -36,9 +35,8 @@ describe("OfflineV2 Hooks Index", () => {
});

it("should export sync management hooks", async () => {
const { useOfflineSync, useSyncStatus } = await import(
"@hooks/offlineV2/index"
);
const { useOfflineSync, useSyncStatus } =
await import("@hooks/offlineV2/index");

expect(useOfflineSync).toBeDefined();
expect(typeof useOfflineSync).toBe("function");
Expand Down