File tree Expand file tree Collapse file tree 7 files changed +18
-23
lines changed
provider/AppBridgeProvider Expand file tree Collapse file tree 7 files changed +18
-23
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ const Home = () => {
4646 onClick = { ( ) => {
4747 send ( { type : AppBridgeMessageType . OPEN_GALLERY , payload : "" } ) ;
4848
49- send ( { type : AppBridgeMessageType . RECEIVE_SCAN_RESULT , payload : scanData } ) ;
49+ send ( { type : AppBridgeMessageType . RECEIVE_SCAN_RESULT , payload : { result : "" } } ) ;
5050 } }
5151 />
5252 < IconButton
@@ -55,7 +55,7 @@ const Home = () => {
5555 onClick = { ( ) => {
5656 send ( { type : AppBridgeMessageType . OPEN_CAMERA , payload : "" } ) ;
5757
58- send ( { type : AppBridgeMessageType . RECEIVE_SCAN_RESULT , payload : scanData } ) ;
58+ send ( { type : AppBridgeMessageType . RECEIVE_SCAN_RESULT , payload : { result : "" } } ) ;
5959 } }
6060 />
6161 </ div >
Original file line number Diff line number Diff line change @@ -17,10 +17,7 @@ const ReceiptEdit = () => {
1717
1818 const { setOcrText } = useCreateReviewStore ( ) ;
1919
20- const [ formData , setFormData ] = useState < { [ key : string ] : string } [ ] > ( [
21- { test : "abc" } ,
22- { test2 : "aadsasf" } ,
23- ] ) ;
20+ const [ formData , setFormData ] = useState < { key : string ; value : string } [ ] > ( [ ] ) ;
2421 const [ focusState , setFocusState ] = useState < { [ key : string ] : boolean } > ( { } ) ;
2522
2623 useEffect ( ( ) => {
Original file line number Diff line number Diff line change @@ -50,9 +50,9 @@ export interface CopyMessage {
5050
5151export interface ReceiveScanResultMessage {
5252 type : AppBridgeMessageType . RECEIVE_SCAN_RESULT ;
53- // payload: Array<{ [key: string]: string }>;
54- // eslint-disable-next-line @typescript-eslint/no-explicit-any
55- payload : any ;
53+ payload : {
54+ result : string ;
55+ } ;
5656}
5757
5858export interface ReceiveGeneratedReviewMessage {
Original file line number Diff line number Diff line change @@ -41,8 +41,7 @@ export function AppBridgeProvider({ children }: AppBridgeProviderProps) {
4141 useEffect ( ( ) => {
4242 if ( typeof window !== "undefined" ) {
4343 window . response = {
44- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45- receiveScanResult : ( jsonData : any ) => {
44+ receiveScanResult : ( jsonData : string ) => {
4645 try {
4746 // alert("Scan Result: " + jsonData);
4847 setScanData ( JSON . parse ( jsonData ) ) ;
Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ const iosHandlers = {
1313 } ) => window . webkit ?. messageHandlers . createReview . postMessage ( message . payload ) ,
1414 [ AppBridgeMessageType . COPY ] : ( message : { payload : { review : string } } ) =>
1515 window . webkit ?. messageHandlers . copy . postMessage ( message . payload ) ,
16- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17- [ AppBridgeMessageType . RECEIVE_SCAN_RESULT ] : ( message : { payload : { result : any } } ) =>
16+ [ AppBridgeMessageType . RECEIVE_SCAN_RESULT ] : ( message : { payload : { result : string } } ) =>
1817 window . response ?. receiveScanResult ( message . payload . result ) ,
1918 [ AppBridgeMessageType . RECEIVE_GENERATED_REVIEW ] : ( message : { payload : { result : string } } ) =>
2019 window . response ?. receiveGeneratedReview ( message . payload . result ) ,
Original file line number Diff line number Diff line change 11import { create } from "zustand" ;
22
33interface ScanDataStoreProps {
4- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5- scanData : any ;
6- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7- setScanData : ( scanData : any [ ] ) => void ;
4+ scanData : ScanResultPayload ;
5+ setScanData : ( scanData : ScanResultPayload ) => void ;
86 resetScanData : ( ) => void ;
97}
108
119export const useScanDataStore = create < ScanDataStoreProps > ( ( set ) => ( {
12- scanData : [ ] ,
13- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14- setScanData : ( scanData : any [ ] ) => set ( { scanData } ) ,
15- resetScanData : ( ) => set ( { scanData : [ ] } ) ,
10+ scanData : { parsed : [ ] } ,
11+ setScanData : ( scanData : ScanResultPayload ) => set ( { scanData } ) ,
12+ resetScanData : ( ) => set ( { scanData : { parsed : [ ] } } ) ,
1613} ) ) ;
Original file line number Diff line number Diff line change @@ -19,10 +19,13 @@ declare global {
1919 interface CopyMessagePayload {
2020 review : string ;
2121 }
22+
23+ interface ScanResultPayload {
24+ parsed : Array < { key : string ; value : string } > ;
25+ }
2226 interface Window {
2327 response ?: {
24- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25- receiveScanResult : ( jsonData : any ) => void ;
28+ receiveScanResult : ( jsonData : string ) => void ;
2629 receiveGeneratedReview : ( jsonData : string ) => void ;
2730 } ;
2831 webkit ?: {
You can’t perform that action at this time.
0 commit comments