Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3394201
D6772.id23263.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D6772.id23263.diff
View Options
diff --git a/native/android/app/src/main/java/app/comm/android/MainApplication.java b/native/android/app/src/main/java/app/comm/android/MainApplication.java
--- a/native/android/app/src/main/java/app/comm/android/MainApplication.java
+++ b/native/android/app/src/main/java/app/comm/android/MainApplication.java
@@ -34,6 +34,8 @@
System.loadLibrary("comm_jni_module");
}
+ private static Context context;
+
private final ReactNativeHost mReactNativeHost =
new ReactNativeHostWrapper(this, new ReactNativeHost(this) {
@Override
@@ -80,6 +82,7 @@
super.onCreate();
// If you opted-in for the New Architecture, we enable the TurboModule
// system
+ MainApplication.context = this.getApplicationContext();
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
Security.insertProviderAt(new org.conscrypt.OpenSSLProvider(), 1);
@@ -104,6 +107,10 @@
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
}
+ public static Context getMainApplicationContext() {
+ return MainApplication.context;
+ }
+
private void initializeDatabase() {
File sqliteFile =
this.getApplicationContext().getDatabasePath("comm.sqlite");
diff --git a/native/android/app/src/main/java/app/comm/android/fbjni/PlatformSpecificTools.java b/native/android/app/src/main/java/app/comm/android/fbjni/PlatformSpecificTools.java
--- a/native/android/app/src/main/java/app/comm/android/fbjni/PlatformSpecificTools.java
+++ b/native/android/app/src/main/java/app/comm/android/fbjni/PlatformSpecificTools.java
@@ -1,10 +1,11 @@
package app.comm.android.fbjni;
+import android.content.Context;
import android.util.Log;
+import app.comm.android.MainApplication;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
-
public class PlatformSpecificTools {
static SecureRandom secureRandom = new SecureRandom();
@@ -13,4 +14,16 @@
secureRandom.nextBytes(buffer);
return buffer;
}
+
+ public static String getNotificationsCryptoAccountPath() {
+ Context mainApplicationContext =
+ MainApplication.getMainApplicationContext();
+ if (mainApplicationContext == null) {
+ throw new RuntimeException(
+ "Failed to resolve notifications crypto account path - main application context not initialized.");
+ }
+ return mainApplicationContext
+ .getFileStreamPath("comm_notifications_crypto_account")
+ .getPath();
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 6:14 PM (19 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605771
Default Alt Text
D6772.id23263.diff (2 KB)
Attached To
Mode
D6772: Implement native method on Android to get notifications olm account storage path
Attached
Detach File
Event Timeline
Log In to Comment