-
Notifications
You must be signed in to change notification settings - Fork 20
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 #436 from xmtp/cv/pinned-frame
Adding pinned frame metadata field
- Loading branch information
Showing
17 changed files
with
280 additions
and
32 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
22 changes: 22 additions & 0 deletions
22
android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/CreateGroupParamsWrapper.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,22 @@ | ||
package expo.modules.xmtpreactnativesdk.wrappers | ||
|
||
import com.google.gson.JsonParser | ||
|
||
class CreateGroupParamsWrapper( | ||
val groupName: String, | ||
val groupImageUrlSquare: String, | ||
val groupDescription: String, | ||
val groupPinnedFrameUrl: String, | ||
) { | ||
companion object { | ||
fun createGroupParamsFromJson(authParams: String): CreateGroupParamsWrapper { | ||
val jsonOptions = JsonParser.parseString(authParams).asJsonObject | ||
return CreateGroupParamsWrapper( | ||
if (jsonOptions.has("name")) jsonOptions.get("name").asString else "", | ||
if (jsonOptions.has("imageUrlSquare")) jsonOptions.get("imageUrlSquare").asString else "", | ||
if (jsonOptions.has("description")) jsonOptions.get("description").asString else "", | ||
if (jsonOptions.has("pinnedFrameUrl")) jsonOptions.get("pinnedFrameUrl").asString else "", | ||
) | ||
} | ||
} | ||
} |
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,25 @@ | ||
import Foundation | ||
|
||
struct CreateGroupParamsWrapper { | ||
let groupName: String | ||
let groupImageUrlSquare: String | ||
let groupDescription: String | ||
let groupPinnedFrameUrl: String | ||
|
||
static func createGroupParamsFromJson(_ authParams: String) -> CreateGroupParamsWrapper { | ||
let data = authParams.data(using: .utf8) ?? Data() | ||
let jsonOptions = (try? JSONSerialization.jsonObject(with: data, options: [])) as? [String: Any] ?? [:] | ||
|
||
let groupName = jsonOptions["name"] as? String ?? "" | ||
let groupImageUrlSquare = jsonOptions["imageUrlSquare"] as? String ?? "" | ||
let groupDescription = jsonOptions["description"] as? String ?? "" | ||
let groupPinnedFrameUrl = jsonOptions["pinnedFrameUrl"] as? String ?? "" | ||
|
||
return CreateGroupParamsWrapper( | ||
groupName: groupName, | ||
groupImageUrlSquare: groupImageUrlSquare, | ||
groupDescription: groupDescription, | ||
groupPinnedFrameUrl: groupPinnedFrameUrl | ||
) | ||
} | ||
} |
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
Oops, something went wrong.