Page MenuHomePhabricator

D6773.id23305.diff
No OneTemporary

D6773.id23305.diff

diff --git a/native/android/app/src/cpp/PlatformSpecificTools.cpp b/native/android/app/src/cpp/PlatformSpecificTools.cpp
--- a/native/android/app/src/cpp/PlatformSpecificTools.cpp
+++ b/native/android/app/src/cpp/PlatformSpecificTools.cpp
@@ -24,6 +24,13 @@
}
return result;
}
+
+ static std::string getNotificationsCryptoAccountPath() {
+ static const auto cls = javaClassStatic();
+ static auto method =
+ cls->getStaticMethod<JString()>("getNotificationsCryptoAccountPath");
+ return method(cls)->toStdString();
+ }
};
namespace comm {
@@ -40,4 +47,12 @@
return std::string{"android"};
}
+std::string PlatformSpecificTools::getNotificationsCryptoAccountPath() {
+ std::string path;
+ NativeAndroidAccessProvider::runTask([&path]() {
+ path = PlatformSpecificToolsJavaClass::getNotificationsCryptoAccountPath();
+ });
+ return path;
+}
+
} // namespace comm
diff --git a/native/cpp/CommonCpp/Tools/PlatformSpecificTools.h b/native/cpp/CommonCpp/Tools/PlatformSpecificTools.h
--- a/native/cpp/CommonCpp/Tools/PlatformSpecificTools.h
+++ b/native/cpp/CommonCpp/Tools/PlatformSpecificTools.h
@@ -8,6 +8,7 @@
public:
static void generateSecureRandomBytes(crypto::OlmBuffer &buffer, size_t size);
static std::string getDeviceOS();
+ static std::string getNotificationsCryptoAccountPath();
};
} // namespace comm
diff --git a/native/ios/Comm/PlatformSpecificTools.mm b/native/ios/Comm/PlatformSpecificTools.mm
--- a/native/ios/Comm/PlatformSpecificTools.mm
+++ b/native/ios/Comm/PlatformSpecificTools.mm
@@ -23,4 +23,18 @@
return std::string{"ios"};
}
+std::string PlatformSpecificTools::getNotificationsCryptoAccountPath() {
+ NSURL *groupUrl = [NSFileManager.defaultManager
+ containerURLForSecurityApplicationGroupIdentifier:@"group.app.comm"];
+ if (groupUrl == nil) {
+ throw std::runtime_error(
+ "Failed to resolve notifications crypto account path - could not find "
+ "groupUrl");
+ }
+ return std::string(
+ [[groupUrl
+ URLByAppendingPathComponent:@"comm_notifications_crypto_account"]
+ .path UTF8String]);
+}
+
}; // namespace comm

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 2:57 AM (19 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595198
Default Alt Text
D6773.id23305.diff (2 KB)

Event Timeline