Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes for moveAssetsDatabase #96

Merged
merged 1 commit into from
May 13, 2024
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 android/src/main/java/com/op/sqlite/OPSQLiteModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
val assetsManager = context.assets

try {
// Open the input stream for the asset file
val inputStream: InputStream = assetsManager.open("$path/$filename")

// Create the output file in the documents directory
val databasesFolder =
context.getDatabasePath("defaultDatabase")
.absolutePath
Expand All @@ -79,6 +76,8 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB
}
}

val inputStream: InputStream = assetsManager.open("$path/$filename")

// Open the output stream for the output file
val outputStream: OutputStream = FileOutputStream(outputFile)

Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,11 @@ export const open = (options: {
};
};

export const moveAssetsDatabase = (args: {
export const moveAssetsDatabase = async (args: {
filename: string;
path?: string;
overwrite?: boolean;
}): boolean => {
}): Promise<boolean> => {
return NativeModules.OPSQLite.moveAssetsDatabase(args);
};

Expand Down
Loading