fix issues in android studio, like new file to file

This commit is contained in:
Jordan
2025-03-31 06:18:05 -07:00
parent ac9df75e84
commit 2c7928daaa
3 changed files with 14 additions and 25 deletions

View File

@ -28,6 +28,7 @@ react {
// codegenDir = file("../../node_modules/@react-native/codegen")
// the sub-project for whisper-native
// whisper_android = file("$root/whisper-android/")
/* Variants */
// The list of variants to that are debuggable. For those we're going to

View File

@ -13,34 +13,18 @@ import com.whispertflite.engine.WhisperEngine;
public class NativeWhisperModule extends NativeLocalStorageSpec {
public static final String NAME = "NativeLocalStorage";
private WhisperEngineNative mNativeEngine;
public NativeLocalStorageModule(ReactApplicationContext reactContext) {
public NativeWhisperModule(ReactApplicationContext reactContext) {
super(reactContext);
mNativeEngine = new WhisperEngineNative(reactContext);
}
@Override
public String getName() {
return NAME;
}
public void loadWhisper(String path) {}
@Override
public void setItem(String value, String key) {
SharedPreferences sharedPref = getReactApplicationContext().getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(key, value);
editor.apply();
}
public void translate(String text, String language) {
@Override
public String getItem(String key) {
SharedPreferences sharedPref = getReactApplicationContext().getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
String username = sharedPref.getString(key, null);
return username;
}
@Override
public void removeItem(String key) {
SharedPreferences sharedPref = getReactApplicationContext().getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
sharedPref.edit().remove(key).apply();
}
}