-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixes incorrectly mapping from granted permissions to record typ…
…es (#153) * fix: fixes incorrect mapping between permission names to records * style: reformatted file and remove unused import * fix: fixes granted permissions loop order and adds a permission class * chore: remove obsolete custom exception * chore: update example --------- Authored-by: Ugur Akin <[email protected]>
- Loading branch information
Showing
4 changed files
with
42 additions
and
17 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
23 changes: 23 additions & 0 deletions
23
android/src/main/java/dev/matinzd/healthconnect/permissions/ReactPermission.kt
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,23 @@ | ||
package dev.matinzd.healthconnect.permissions | ||
|
||
import com.facebook.react.bridge.ReadableMap | ||
import com.facebook.react.bridge.WritableNativeMap | ||
|
||
data class ReactPermission(val accessType: AccessType, val recordType: String) { | ||
fun toReadableMap(): ReadableMap { | ||
val map = WritableNativeMap() | ||
map.putString(ACCESS_TYPE, accessType.reactName) | ||
map.putString(RECORD_TYPE, recordType) | ||
return map | ||
} | ||
|
||
companion object { | ||
private const val ACCESS_TYPE = "accessType" | ||
private const val RECORD_TYPE = "recordType" | ||
} | ||
} | ||
|
||
enum class AccessType(val reactName: String) { | ||
READ("read"), | ||
WRITE("write") | ||
} |
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