Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Grechuhin <i.grechuhin@gmail.com>2017-09-29 12:47:42 +0300
committerSergey Yershov <syershov@maps.me>2017-09-29 13:17:44 +0300
commit8168ea1e604d9a75b314a8b739cf5a774a261a6e (patch)
tree6631043fc83c5f38f22daf5c57dff24651c9efda /platform
parentcccd8608896f1c95758aaae3f33badaca5772ae1 (diff)
[secure-storage] [ios] Added secure storage implementation.
Diffstat (limited to 'platform')
-rw-r--r--platform/secure_storage_ios.mm19
1 files changed, 15 insertions, 4 deletions
diff --git a/platform/secure_storage_ios.mm b/platform/secure_storage_ios.mm
index e738590b14..9d8293bb87 100644
--- a/platform/secure_storage_ios.mm
+++ b/platform/secure_storage_ios.mm
@@ -1,20 +1,31 @@
#include "platform/secure_storage.hpp"
+#import <Foundation/Foundation.h>
+
namespace platform
{
+
+NSString * StorageKey(std::string const & key)
+{
+ return [NSString stringWithFormat:@"Maps.me::PlatrormKey::%@", @(key.c_str())];
+}
+
void SecureStorage::Save(std::string const & key, std::string const & value)
{
- // TODO: implement @igrechuhin
+ [NSUserDefaults.standardUserDefaults setObject:@(value.c_str()) forKey:StorageKey(key)];
}
bool SecureStorage::Load(std::string const & key, std::string & value)
{
- // TODO: implement @igrechuhin
- return false;
+ NSString * val = [NSUserDefaults.standardUserDefaults objectForKey:StorageKey(key)];
+ if (!val)
+ return false;
+ value = val.UTF8String;
+ return true;
}
void SecureStorage::Remove(std::string const & key)
{
- // TODO: implement @igrechuhin
+ [NSUserDefaults.standardUserDefaults removeObjectForKey:StorageKey(key)];
}
} // namespace platform