Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3547942
D4472.id14704.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4472.id14704.diff
View Options
diff --git a/native/ios/Comm/TemporaryMessageStorage/TemporaryMessageStorage.mm b/native/ios/Comm/TemporaryMessageStorage/TemporaryMessageStorage.mm
--- a/native/ios/Comm/TemporaryMessageStorage/TemporaryMessageStorage.mm
+++ b/native/ios/Comm/TemporaryMessageStorage/TemporaryMessageStorage.mm
@@ -4,6 +4,12 @@
#import "NonBlockingLock.h"
#import <string>
+@interface TemporaryMessageStorage ()
+- (NSString *)_createNewStorage;
+- (NSString *)_getLockName:(NSString *)fileName;
+- (NSString *)_getPath:(NSString *)fileName;
+@end
+
@implementation TemporaryMessageStorage
- (instancetype)init {
@@ -40,4 +46,30 @@
return self;
}
+- (NSString *)_createNewStorage {
+ int64_t timestamp = (int64_t)[NSDate date].timeIntervalSince1970;
+ NSString *newStorageName = [NSString stringWithFormat:@"msg_%lld", timestamp];
+ NSString *newStoragePath =
+ [self.directoryURL URLByAppendingPathComponent:newStorageName].path;
+ const char *newStoragePathCstr =
+ [newStoragePath cStringUsingEncoding:NSUTF8StringEncoding];
+ FILE *newStorage = fopen(newStoragePathCstr, "a");
+ if (!newStorage) {
+ return nil;
+ }
+ fclose(newStorage);
+ return newStorageName;
+}
+
+- (NSString *)_getLockName:(NSString *)fileName {
+ return [NSString stringWithFormat:@"group.app.comm/%@", fileName];
+}
+
+- (NSString *)_getPath:(NSString *)fileName {
+ if (!fileName) {
+ return nil;
+ }
+ return [self.directoryURL URLByAppendingPathComponent:fileName].path;
+}
+
@end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 3:48 PM (2 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2716061
Default Alt Text
D4472.id14704.diff (1 KB)
Attached To
Mode
D4472: Extend TemporaryMessageStore interface with private auxiliary methods to manipulate paths
Attached
Detach File
Event Timeline
Log In to Comment