Miyayu

feat: enable displayValue

Enables the use of "displayValue" included in MLKit.
style: comment space
@@ -278,7 +278,7 @@ class MobileScanner(private val activity: Activity, private val textureRegistry: @@ -278,7 +278,7 @@ class MobileScanner(private val activity: Activity, private val textureRegistry:
278 "calendarEvent" to calendarEvent?.data, "contactInfo" to contactInfo?.data, 278 "calendarEvent" to calendarEvent?.data, "contactInfo" to contactInfo?.data,
279 "driverLicense" to driverLicense?.data, "email" to email?.data, 279 "driverLicense" to driverLicense?.data, "email" to email?.data,
280 "geoPoint" to geoPoint?.data, "phone" to phone?.data, "sms" to sms?.data, 280 "geoPoint" to geoPoint?.data, "phone" to phone?.data, "sms" to sms?.data,
281 - "url" to url?.data, "wifi" to wifi?.data) 281 + "url" to url?.data, "wifi" to wifi?.data, "displayValue" to displayValue)
282 282
283 private val Point.data: Map<String, Double> 283 private val Point.data: Map<String, Double>
284 get() = mapOf("x" to x.toDouble(), "y" to y.toDouble()) 284 get() = mapOf("x" to x.toDouble(), "y" to y.toDouble())
@@ -70,7 +70,7 @@ extension UIDeviceOrientation { @@ -70,7 +70,7 @@ extension UIDeviceOrientation {
70 extension Barcode { 70 extension Barcode {
71 var data: [String: Any?] { 71 var data: [String: Any?] {
72 let corners = cornerPoints?.map({$0.cgPointValue.data}) 72 let corners = cornerPoints?.map({$0.cgPointValue.data})
73 - return ["corners": corners, "format": format.rawValue, "rawBytes": rawData, "rawValue": rawValue, "type": valueType.rawValue, "calendarEvent": calendarEvent?.data, "contactInfo": contactInfo?.data, "driverLicense": driverLicense?.data, "email": email?.data, "geoPoint": geoPoint?.data, "phone": phone?.data, "sms": sms?.data, "url": url?.data, "wifi": wifi?.data] 73 + return ["corners": corners, "format": format.rawValue, "rawBytes": rawData, "rawValue": rawValue, "type": valueType.rawValue, "calendarEvent": calendarEvent?.data, "contactInfo": contactInfo?.data, "driverLicense": driverLicense?.data, "email": email?.data, "geoPoint": geoPoint?.data, "phone": phone?.data, "sms": sms?.data, "url": url?.data, "wifi": wifi?.data, "displayValue": displayValue]
74 } 74 }
75 } 75 }
76 76
@@ -27,6 +27,15 @@ class Barcode { @@ -27,6 +27,15 @@ class Barcode {
27 /// Returns null if the raw value can not be determined. 27 /// Returns null if the raw value can not be determined.
28 final String? rawValue; 28 final String? rawValue;
29 29
  30 + /// Returns barcode value in a user-friendly format.
  31 + ///
  32 + /// This method may omit some of the information encoded in the barcode. For example, if [rawValue] returns 'MEBKM:TITLE:Google;URL://www.google.com;;', the display value might be '//www.google.com'.
  33 + ///
  34 + /// This value may be multiline, for example, when line breaks are encoded into the original TEXT barcode value. May include the supplement value.
  35 + ///
  36 + /// Returns null if nothing found.
  37 + final String? displayValue;
  38 +
30 /// Returns format type of the barcode value. 39 /// Returns format type of the barcode value.
31 /// 40 ///
32 /// For example, TYPE_TEXT, TYPE_PRODUCT, TYPE_URL, etc. 41 /// For example, TYPE_TEXT, TYPE_PRODUCT, TYPE_URL, etc.
@@ -77,6 +86,7 @@ class Barcode { @@ -77,6 +86,7 @@ class Barcode {
77 this.sms, 86 this.sms,
78 this.url, 87 this.url,
79 this.wifi, 88 this.wifi,
  89 + this.displayValue,
80 required this.rawValue, 90 required this.rawValue,
81 }); 91 });
82 92
@@ -86,6 +96,7 @@ class Barcode { @@ -86,6 +96,7 @@ class Barcode {
86 format = toFormat(data['format'] as int), 96 format = toFormat(data['format'] as int),
87 rawBytes = data['rawBytes'] as Uint8List?, 97 rawBytes = data['rawBytes'] as Uint8List?,
88 rawValue = data['rawValue'] as String?, 98 rawValue = data['rawValue'] as String?,
  99 + displayValue = data['displayValue'] as String?,
89 type = BarcodeType.values[data['type'] as int], 100 type = BarcodeType.values[data['type'] as int],
90 calendarEvent = toCalendarEvent(data['calendarEvent'] as Map?), 101 calendarEvent = toCalendarEvent(data['calendarEvent'] as Map?),
91 contactInfo = toContactInfo(data['contactInfo'] as Map?), 102 contactInfo = toContactInfo(data['contactInfo'] as Map?),