forked from filcuc/nimqml
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from status-im/feature/issue-2675
feat(@desktop/general): Keychain manager added
- Loading branch information
Showing
9 changed files
with
127 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
type | ||
QSettingsFormat* {.pure.} = enum | ||
NativeFormat = 0 | ||
IniFormat | ||
|
||
proc setup(self: QSettings, fileName: string, format: int) = | ||
self.vptr = dos_qsettings_create(fileName, format) | ||
|
||
proc delete*(self: QSettings) = | ||
dos_qsettings_delete(self.vptr) | ||
self.vptr.resetToNil | ||
|
||
proc newQSettings*(fileName: string, | ||
format: QSettingsFormat = QSettingsFormat.NativeFormat): QSettings = | ||
## Available values for format are: | ||
## 0 - QSettings::NativeFormat | ||
## 1 - QSettings::IniFormat | ||
## any other value will be converted to 0 (QSettings::NativeFormat) | ||
new(result, delete) | ||
result.setup(fileName, format.int) | ||
|
||
proc value*(self: QSettings, key: string, defaultValue: QVariant = newQVariant()): | ||
QVariant = | ||
newQVariant(dos_qsettings_value(self.vptr, key, defaultValue.vptr), Ownership.Take) | ||
|
||
proc setValue*(self: QSettings, key: string, value: QVariant) = | ||
dos_qsettings_set_value(self.vptr, key, value.vptr) | ||
|
||
proc remove*(self: QSettings, key: string) = | ||
dos_qsettings_remove(self.vptr, key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
proc setupDockShowAppEventObject*(self: StatusEvent, engine: QQmlApplicationEngine) = | ||
self.vptr = dos_event_create_showAppEvent(engine.vptr) | ||
|
||
proc setupDockShowAppEventObject(self: StatusEventObject, engine: QQmlApplicationEngine) = | ||
self.vptr = dos_statusevent_create_showAppEvent(engine.vptr) | ||
proc setupOSThemeEventObject*(self: StatusEvent, engine: QQmlApplicationEngine) = | ||
self.vptr = dos_event_create_osThemeEvent(engine.vptr) | ||
|
||
proc setupOSThemeEventObject(self: StatusEventObject, engine: QQmlApplicationEngine) = | ||
self.vptr = dos_statusevent_create_osThemeEvent(engine.vptr) | ||
|
||
proc delete*(self: StatusEventObject) = | ||
dos_statusevent_delete(self.vptr) | ||
proc delete*(self: StatusEvent) = | ||
dos_event_delete(self.vptr) | ||
self.vptr.resetToNil | ||
|
||
proc newStatusDockShowAppEventObject*(engine: QQmlApplicationEngine): StatusEventObject = | ||
proc newStatusDockShowAppEventObject*(engine: QQmlApplicationEngine): StatusEvent = | ||
new(result, delete) | ||
result.setupDockShowAppEventObject(engine) | ||
|
||
proc newStatusOSThemeEventObject*(engine: QQmlApplicationEngine): StatusEventObject = | ||
proc newStatusOSThemeEventObject*(engine: QQmlApplicationEngine): StatusEvent = | ||
new(result, delete) | ||
result.setupOSThemeEventObject(engine) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
proc setup(self: StatusKeychainManager, service: string, | ||
authenticationReason: string) = | ||
self.vptr = dos_keychainmanager_create(service, authenticationReason) | ||
|
||
proc delete*(self: StatusKeychainManager) = | ||
dos_keychainmanager_delete(self.vptr) | ||
self.vptr.resetToNil | ||
|
||
proc newStatusKeychainManager*(service: string, | ||
authenticationReason: string): StatusKeychainManager = | ||
new(result, delete) | ||
result.setup(service, authenticationReason) | ||
|
||
proc readDataSync*(self: StatusKeychainManager, key: string): string = | ||
return dos_keychainmanager_read_data_sync(self.vptr, key) | ||
|
||
proc readDataAsync*(self: StatusKeychainManager, key: string) = | ||
dos_keychainmanager_read_data_async(self.vptr, key) | ||
|
||
proc storeDataAsync*(self: StatusKeychainManager, key: string, data: string) = | ||
dos_keychainmanager_store_data_async(self.vptr, key, data) | ||
|
||
proc deleteDataAsync*(self: StatusKeychainManager, key: string) = | ||
dos_keychainmanager_delete_data_async(self.vptr, key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
proc setup(self: StatusOSNotificationObject) = | ||
self.vptr = dos_statusosnotification_create() | ||
proc setup(self: StatusOSNotification) = | ||
self.vptr = dos_osnotification_create() | ||
|
||
proc delete*(self: StatusOSNotificationObject) = | ||
dos_statusosnotification_delete(self.vptr) | ||
proc delete*(self: StatusOSNotification) = | ||
dos_osnotification_delete(self.vptr) | ||
self.vptr.resetToNil | ||
|
||
proc newStatusOSNotificationObject*(): StatusOSNotificationObject = | ||
proc newStatusOSNotification*(): StatusOSNotification = | ||
new(result, delete) | ||
result.setup() | ||
|
||
proc showNotification*(self: StatusOSNotificationObject, title: string, | ||
proc showNotification*(self: StatusOSNotification, title: string, | ||
message: string, identifier: string) = | ||
dos_statusosnotification_show_notification(self.vptr, title, message, identifier) | ||
dos_osnotification_show_notification(self.vptr, title, message, identifier) |