-
Notifications
You must be signed in to change notification settings - Fork 0
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 #29 from plaidev/android-1
[flutter] support global event handler, and update dependencies
- Loading branch information
Showing
11 changed files
with
165 additions
and
90 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
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,26 @@ | ||
import 'package:nativebrik_bridge/embedding.dart'; | ||
|
||
EventPayloadType _parseEventPayloadType(dynamic type) { | ||
switch (type) { | ||
case "INTEGER": | ||
return EventPayloadType.integer; | ||
case "STRING": | ||
return EventPayloadType.string; | ||
case "TIMESTAMPZ": | ||
return EventPayloadType.timestamp; | ||
default: | ||
return EventPayloadType.unknown; | ||
} | ||
} | ||
|
||
Event parseEvent(dynamic arguments) { | ||
final map = arguments; | ||
final name = map["name"] as String?; | ||
final deepLink = map["deepLink"] as String?; | ||
final rawPayload = map["payload"] as List<dynamic>? ?? []; | ||
final payload = rawPayload | ||
.map((e) => EventPayload(e["name"] as String? ?? "", | ||
e["value"] as String? ?? "", _parseEventPayloadType(e["type"]))) | ||
.toList(); | ||
return Event(name, deepLink, payload); | ||
} |
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