react-native-flyy 1.4.23 → 1.4.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/android/.project +2 -2
  2. package/android/.settings/org.eclipse.buildship.core.prefs +4 -1
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/com/reactnativeflyy/FlyyModule.kt +72 -73
  5. package/android/src/main/java/com/reactnativeflyy/FlyyRouteActivity.java +4 -0
  6. package/ios/Montserrat-Bold.ttf +0 -0
  7. package/ios/ReactNativeFlyy.m +220 -117
  8. package/lib/commonjs/assets/images/check.png +0 -0
  9. package/lib/commonjs/assets/images/medal.png +0 -0
  10. package/lib/commonjs/assets/images/radio.png +0 -0
  11. package/lib/commonjs/assets/images/reward_flyy.png +0 -0
  12. package/lib/commonjs/assets/images/xmark.png +0 -0
  13. package/lib/commonjs/flyy_checkin_view.js +382 -0
  14. package/lib/commonjs/flyy_checkin_view.js.map +1 -0
  15. package/lib/commonjs/index.js +248 -3
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/module/assets/images/check.png +0 -0
  18. package/lib/module/assets/images/medal.png +0 -0
  19. package/lib/module/assets/images/radio.png +0 -0
  20. package/lib/module/assets/images/reward_flyy.png +0 -0
  21. package/lib/module/assets/images/xmark.png +0 -0
  22. package/lib/module/flyy_checkin_view.js +365 -0
  23. package/lib/module/flyy_checkin_view.js.map +1 -0
  24. package/lib/module/index.js +233 -3
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/typescript/flyy_checkin_view.d.ts +19 -0
  27. package/lib/typescript/index.d.ts +22 -0
  28. package/package.json +4 -1
  29. package/react-native-flyy.podspec +1 -1
  30. package/src/assets/images/check.png +0 -0
  31. package/src/assets/images/medal.png +0 -0
  32. package/src/assets/images/radio.png +0 -0
  33. package/src/assets/images/reward_flyy.png +0 -0
  34. package/src/assets/images/xmark.png +0 -0
  35. package/src/flyy_checkin_view.tsx +214 -0
  36. package/src/index.tsx +219 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","Image","NativeModules","Text","TouchableOpacity","View","Flyy","FlyyWidget","widgetStyle","rewardsButtonIcon","require","offersButtonIcon","walletButtonIcon","rewardButtonTitle","offerButtonTitle","walletButtonTitle","buttonTitleFontFamily","buttonBorderWidth","buttonTitleTextSize","iconCornerRadius","buttonCornerRadius","buttonTitleTextColor","buttonBorderColor","containerBackgroundColor","buttonIconBackgroundColor","buttonBackgroundColor","buttonStyle","backgroundColor","height","flex","elevation","borderRadius","borderColor","borderWidth","width","flexDirection","justifyContent","alignItems","openOffersScreen","openRewardsScreen","openWalletScreen","FlyyCardView","cardStyle","buttonTitle","buttonIcon","alignSelf","flexShrink","color","fontSize","fontFamily","textAlign","paddingLeft","paddingRight"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,KADF,EAEEC,aAFF,EAGEC,IAHF,EAIEC,gBAJF,EAKEC,IALF,QAMO,cANP;AAYA,MAAM;AAAEC,EAAAA;AAAF,IAAWJ,aAAjB;AAEA,eAAeI,IAAf;AACA,OAAO,MAAMC,UAAU,GAAG,CAAC;AACzBC,EAAAA,WAAW,GAAG;AACZC,IAAAA,iBAAiB,EAAEC,OAAO,CAAC,kCAAD,CADd;AAEZC,IAAAA,gBAAgB,EAAED,OAAO,CAAC,kCAAD,CAFb;AAGZE,IAAAA,gBAAgB,EAAEF,OAAO,CAAC,kCAAD,CAHb;AAIZG,IAAAA,iBAAiB,EAAE,SAJP;AAKZC,IAAAA,gBAAgB,EAAE,QALN;AAMZC,IAAAA,iBAAiB,EAAE,QANP;AAOZC,IAAAA,qBAAqB,EAAE,iBAPX;AAQZC,IAAAA,iBAAiB,EAAE,GARP;AASZC,IAAAA,mBAAmB,EAAE,IATT;AAUZC,IAAAA,gBAAgB,EAAE,IAVN;AAWZC,IAAAA,kBAAkB,EAAE,IAXR;AAYZC,IAAAA,oBAAoB,EAAE,OAZV;AAaZC,IAAAA,iBAA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Modules,\n Text,\n TouchableOpacity,\n View,\n} from 'react-native';\n\ntype FlyyType = {\n multiply(a: number, b: number): Promise<number>;\n};\n\nconst { Flyy } = NativeModules;\n\nexport default Flyy as FlyyType;\nexport const FlyyWidget = ({\n widgetStyle = {\n rewardsButtonIcon: require('./assets/images/rewardwidget.png'),\n offersButtonIcon: require('./assets/images/offerswidget.png'),\n walletButtonIcon: require('./assets/images/walletwidget.png'),\n rewardButtonTitle: 'Rewards',\n offerButtonTitle: 'Offers',\n walletButtonTitle: 'Wallet',\n buttonTitleFontFamily: 'Montserrat-Bold',\n buttonBorderWidth: 0.5,\n buttonTitleTextSize: 16.0,\n iconCornerRadius: 30.0,\n buttonCornerRadius: 15.0,\n buttonTitleTextColor: 'black',\n buttonBorderColor: 'white',\n containerBackgroundColor: '#ebedeb',\n buttonIconBackgroundColor: '#654EA3',\n buttonBackgroundColor: 'white',\n },\n}) => {\n const buttonStyle = {\n backgroundColor: widgetStyle.buttonBackgroundColor ?? 'white',\n height: 110,\n flex: 1,\n elevation: 1,\n borderRadius: widgetStyle.buttonCornerRadius ?? 15.0,\n borderColor: widgetStyle.buttonBorderColor ?? 'white',\n borderWidth: widgetStyle.buttonBorderWidth ?? 0.5,\n };\n return (\n <View\n style={{\n backgroundColor: widgetStyle.containerBackgroundColor ?? '#ebedeb',\n height: 160,\n width: '100%',\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <View style={{ width: 20 }} />\n <TouchableOpacity\n onPress={() => {\n Flyy.openOffersScreen();\n }}\n style={buttonStyle}\n >\n <FlyyCardView\n cardStyle={widgetStyle}\n buttonTitle={widgetStyle.offerButtonTitle ?? 'Offers'}\n buttonIcon={\n widgetStyle.offersButtonIcon ??\n require('./assets/images/offerswidget.png')\n }\n />\n </TouchableOpacity>\n <View style={{ width: 15 }} />\n <TouchableOpacity\n onPress={() => {\n Flyy.openRewardsScreen();\n }}\n style={buttonStyle}\n >\n <FlyyCardView\n cardStyle={widgetStyle}\n buttonTitle={widgetStyle.rewardButtonTitle ?? 'Rewards'}\n buttonIcon={\n widgetStyle.rewardsButtonIcon ??\n require('./assets/images/rewardwidget.png')\n }\n />\n </TouchableOpacity>\n <View style={{ width: 15 }} />\n <TouchableOpacity\n onPress={() => {\n Flyy.openWalletScreen();\n }}\n style={buttonStyle}\n >\n <FlyyCardView\n cardStyle={widgetStyle}\n buttonTitle={widgetStyle.walletButtonTitle ?? 'Wallet'}\n buttonIcon={\n widgetStyle.walletButtonIcon ??\n require('./assets/images/walletwidget.png')\n }\n />\n </TouchableOpacity>\n <View style={{ width: 20 }} />\n </View>\n );\n};\n\n// @ts-ignore\nconst FlyyCardView = ({ cardStyle, buttonTitle, buttonIcon }) => {\n return (\n <View>\n <View style={{ height: 10 }} />\n <View\n style={{\n backgroundColor: cardStyle.buttonIconBackgroundColor ?? '#654EA3',\n height: 50,\n width: 50,\n borderRadius: cardStyle.iconCornerRadius ?? 30.0,\n alignSelf: 'center',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Image source={buttonIcon} style={{ height: 28, width: 28 }} />\n </View>\n <View style={{ height: 10 }} />\n <Text\n style={{\n alignSelf: 'center',\n flexShrink: 1,\n color: cardStyle.buttonTitleTextColor ?? 'black',\n fontSize:\n cardStyle.buttonTitleTextSize != null\n ? cardStyle.buttonTitleTextSize < 30\n ? cardStyle.buttonTitleTextSize\n : 30\n : 16,\n fontFamily: cardStyle.buttonTitleFontFamily ?? 'Montserrat-Bold',\n textAlign: 'center',\n paddingLeft: 5,\n paddingRight: 5,\n }}\n numberOfLines={1}\n >\n {buttonTitle}\n </Text>\n <View style={{ height: 10 }} />\n </View>\n );\n};\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["React","useEffect","useState","Image","NativeModules","Text","TouchableOpacity","View","Dimensions","Linking","Draggable","FlyyCheckinComponent","AsyncStorage","Flyy","FlyyCheckinView","props","checkInBtnTextColor","checkInTitleColor","checkInDescriptionColor","checkInDaysColor","checkInEarnColor","fontFamily","windowHeight","get","height","windowWidth","width","FlyyFloatingWidget","backgroundColor","buttonHeight","buttonWidth","buttonCornerRadius","buttonIcon","require","onPress","x","y","minX","minY","maxX","maxY","show","stick","startDate","endDate","showWidget","setShowWidget","userData","setUserData","iconUrl","setIconUrl","setBackgroundColor","buttonSize","setButtonSize","buttonXPosition","setButtonXPosition","buttonYPosition","setButtonYPosition","deeplink","setDeeplink","flyyConfigDate","oldState","currentState","data","fetchData","sdkInfo","getUserData","appData","getAppData","resp","fetch","headers","json","widgetConfig","info","floating_widget_configuration","icon_url","uri","color","size","parseInt","position","currentDate","Date","getDate","getItem","date","diffTime","Math","abs","diffDays","ceil","getAppOccurence","occurrenceCount","show_to_user","num_times","setItem","JSON","stringify","getTime","getDate2","num_days","supported","canOpenURL","openURL","borderRadius","justifyContent","alignItems","console","log","left","bottom","tintColor","FlyyWidget","widgetStyle","rewardsButtonIcon","offersButtonIcon","walletButtonIcon","rewardButtonTitle","offerButtonTitle","walletButtonTitle","buttonTitleFontFamily","buttonBorderWidth","buttonTitleTextSize","iconCornerRadius","buttonTitleTextColor","buttonBorderColor","containerBackgroundColor","buttonIconBackgroundColor","buttonBackgroundColor","buttonStyle","flex","elevation","borderColor","borderWidth","flexDirection","openOffersScreen","openRewardsScreen","openWalletScreen","FlyyCardView","cardStyle","buttonTitle","alignSelf","flexShrink","fontSize","textAlign","paddingLeft","paddingRight"],"mappings":"AAAA;AACA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SACEC,KADF,EAEEC,aAFF,EAGEC,IAHF,EAIEC,gBAJF,EAKEC,IALF,EAMEC,UANF,EAQEC,OARF,QASO,cATP;AAUA,OAAOC,SAAP,MAAsB,wBAAtB;AACA,OAAOC,oBAAP,MAAiC,qBAAjC;AACA,OAAOC,YAAP,MAAyB,2CAAzB;AAOA,MAAM;AAAEC,EAAAA;AAAF,IAAWT,aAAjB;AAEA,eAAeS,IAAf,C,CAEA;;AACA,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AAS,CAACjB,mBAAV,GAAgC,EAAhC,GACEiB,SAAS,CAACjB,mBADZ,GAEE,EAHN,GAII,EATD;AAULtG,MAAAA,UAAU,4BAAEuH,SAAS,CAACnB,qBAAZ,2EAAqC,iBAV1C;AAWLwB,MAAAA,SAAS,EAAE,QAXN;AAYLC,MAAAA,WAAW,EAAE,CAZR;AAaLC,MAAAA,YAAY,EAAE;AAbT,KADT;AAgBE,IAAA,aAAa,EAAE;AAhBjB,KAkBGN,WAlBH,CAhBF,eAoCE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAE;AAAErH,MAAAA,MAAM,EAAE;AAAV;AAAb,IApCF,CADF;AAwCD,CAzCD","sourcesContent":["// @ts-nocheck\nimport React, { useEffect, useState } from 'react';\nimport {\n Image,\n NativeModules,\n Text,\n TouchableOpacity,\n View,\n Dimensions,\n AppState,\n Linking\n} from 'react-native';\nimport Draggable from 'react-native-draggable';\nimport FlyyCheckinComponent from './flyy_checkin_view';\nimport AsyncStorage from '@react-native-async-storage/async-storage';\n\ntype FlyyType = {\n getUserId(arg0: (data: any) => void): unknown;\n multiply(a: number, b: number): Promise<number>;\n};\n\nconst { Flyy } = NativeModules;\n\nexport default Flyy as FlyyType;\n\n// ****** Flyy CheckinView Widget ******\nexport const FlyyCheckinView = (props: any) => {\n return (<FlyyCheckinComponent style={{\n checkInBtnTextColor: props.checkInBtnTextColor,\n checkInTitleColor: props.checkInTitleColor,\n checkInDescriptionColor: props.checkInDescriptionColor,\n checkInDaysColor: props.checkInDaysColor,\n checkInEarnColor: props.checkInEarnColor,\n fontFamily: props.fontFamily\n }} />)\n}\nconst windowHeight = Dimensions.get('window').height;\nconst windowWidth = Dimensions.get('window').width;\n\n// ****** Flyy Floating Widget ******\nexport const FlyyFloatingWidget = ({\n props = {\n backgroundColor: \"#654EA3\",\n buttonHeight: 55,\n buttonWidth: 55,\n buttonCornerRadius: 40,\n buttonIcon: require('./assets/images/rewardwidget.png'),\n onPress: () => { },\n x: windowWidth - 75,\n y: windowHeight - 100,\n minX: 5,\n minY: 5,\n maxX: windowWidth - 5,\n maxY: windowHeight - 5,\n show: true,\n stick: false,\n startDate: 0,\n endDate: 0\n } }) => {\n\n const [showWidget,setShowWidget] = useState(false);\n const [userData,setUserData] = useState({});\n const [iconUrl,setIconUrl] = useState(require('./assets/images/rewardwidget.png'));\n const [backgroundColor,setBackgroundColor] = useState(\"#654EA3\");\n const [buttonSize,setButtonSize] = useState(55); \n const [buttonXPosition,setButtonXPosition] = useState(windowWidth - 75);\n const [buttonYPosition,setButtonYPosition] = useState(windowHeight - 100);\n const [deeplink,setDeeplink] = useState(null);\n const flyyConfigDate = \"flyy_config_date\";\n var oldState = null;\n var currentState = null;\n var data = null;\n\n useEffect(()=>{\n fetchData();\n },[]);\n\n const fetchData = async() => {\n const sdkInfo = await Flyy.getUserData();\n const appData = await Flyy.getAppData();\n const resp = await fetch(`https://${sdkInfo[\"environment\"] == 0 ? \"ghc-stage\" : \"ghc\"}.theflyy.com/api/v8/flyy_app_info`, {\n headers: {\n \"X-Key\": sdkInfo[\"partner_id\"],\n \"Content-Type\": \"application/json\",\n \"X-App-Data\": appData\n }\n });\n data = await resp.json();\n const widgetConfig = data.info.floating_widget_configuration;\n\n if (widgetConfig.icon_url != null && widgetConfig.icon_url != '') {\n setIconUrl({ uri: widgetConfig.icon_url })\n } else {\n setIconUrl(props.buttonIcon)\n }\n\n if (widgetConfig.color != null && widgetConfig.color != '') {\n setBackgroundColor(widgetConfig.color)\n } else {\n setBackgroundColor(props.backgroundColor)\n }\n\n if (widgetConfig.size != null && widgetConfig.color != 0) {\n setButtonSize(parseInt(data.info.floating_widget_configuration.size))\n } else {\n setButtonSize(props.buttonHeight)\n }\n\n //FloatingButton Position \n if (widgetConfig.position == \"bottom_left\") {\n setButtonXPosition(10)\n } else if (widgetConfig.position == \"bottom_right\") {\n setButtonXPosition(windowWidth - 75)\n } else if (widgetConfig.position == \"upper_left\") {\n setButtonXPosition(10)\n setButtonYPosition(10)\n } else if (widgetConfig.position == \"upper_right\") {\n setButtonXPosition(windowWidth - 75)\n setButtonYPosition(10)\n }\n\n //Set DeepLink \n if (widgetConfig.deeplink != null && widgetConfig.deeplink != \"\") {\n setDeeplink(widgetConfig.deeplink)\n }\n //Set Visibility of FloatingButton\n var currentDate = new Date();\n const getDate = await AsyncStorage.getItem(flyyConfigDate);\n var date = new Date(parseInt(getDate));\n const diffTime = Math.abs(getDate - currentDate);\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1; \n if(diffDays != 0){\n var data = await Flyy.getAppOccurence(1);\n }\n const occurrenceCount = await Flyy.getAppOccurence(0);\n if (widgetConfig.show_to_user && occurrenceCount <= widgetConfig.num_times) {\n // var numberOfDaysToAdd = widgetConfig.num_days+1;\n // var result = currentDate.setDate(currentDate.getDate() + numberOfDaysToAdd);\n if(getDate === null){\n await AsyncStorage.setItem(\n flyyConfigDate,\n JSON.stringify(currentDate.getTime())\n );\n }\n const getDate2 = await AsyncStorage.getItem(flyyConfigDate);\n var date = new Date(parseInt(getDate2));\n const diffTime = Math.abs(getDate2 - currentDate);\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;\n //Show widget on same day\n if(diffDays === 0){\n setShowWidget(true)\n }else{\n //reset occurrence on next day\n await Flyy.getAppOccurence(1);\n if(diffDays >= widgetConfig.num_days+1){\n await AsyncStorage.setItem(\n flyyConfigDate,\n JSON.stringify(currentDate.getTime())\n );\n setShowWidget(true)\n }\n }\n }else{\n const getDate2 = await AsyncStorage.getItem(flyyConfigDate);\n var date = new Date(parseInt(getDate2));\n const diffTime = Math.abs(getDate2 - currentDate);\n const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); \n if(diffDays != 1){\n var data = await Flyy.getAppOccurence(1);\n }\n }\n }\n\n // if(props.show){\n // if(props.startDate != null && props.startDate != 0){\n // var now = new Date().getTime();\n // if(now >= props.startDate && now <= props.endDate){\n // props.show = true\n // }else{\n // props.show = false\n // }\n // }\n // }\n\n // AppState.addEventListener('change', state =>{\n // console.log('AppState updated to', AppState.currentState) \n // oldState = currentState;\n // currentState = state;\n // if(oldState == null){\n // console.log('App is newly start :::') \n // }})\n\n return (\n // @ts-ignore\n props.show && showWidget? <Draggable x={buttonXPosition}\n y={buttonYPosition}\n minX={props.minX ?? 5}\n minY={props.minY ?? 5}\n maxX={props.maxX ?? windowWidth - 5}\n maxY={props.maxY ?? windowHeight - 5}\n renderSize={56}\n // shouldReverse = {true}\n onDragRelease={props.stick ? () => {\n\n } : null} isCircle>\n <TouchableOpacity\n onPress={deeplink != null ? async()=>{\n const supported = await Linking.canOpenURL(deeplink);\n await Linking.openURL(deeplink);\n }:props.onPress}\n style={{\n height: buttonSize,\n width: buttonSize,\n backgroundColor: backgroundColor,\n borderRadius: buttonSize/2,\n justifyContent: 'center',\n alignItems: 'center',\n }}>\n <Image source={iconUrl} style={{ height: buttonSize*55/100, width: buttonSize*55/100 }} />\n <TouchableOpacity \n onPress={()=>{ \n props.show = false;\n setShowWidget(false);\n console.log(\"SHOW PROPS :::\");\n console.log(props.show);\n }}\n style = {{height: 20, width: 20, backgroundColor: \"transparent\",position:'absolute',left:buttonSize-11, bottom: buttonSize*72/100}}>\n <Image source={require('./assets/images/xmark.png')} style={{ height: 18, width: 18, tintColor: \"black\"}} />\n </TouchableOpacity>\n </TouchableOpacity>\n </Draggable> : <View/> \n );\n}\n\nexport const FlyyWidget = ({\n widgetStyle = {\n rewardsButtonIcon: require('./assets/images/rewardwidget.png'),\n offersButtonIcon: require('./assets/images/offerswidget.png'),\n walletButtonIcon: require('./assets/images/walletwidget.png'),\n rewardButtonTitle: 'Rewards',\n offerButtonTitle: 'Offers',\n walletButtonTitle: 'Wallet',\n buttonTitleFontFamily: 'Montserrat-Bold',\n buttonBorderWidth: 0.5,\n buttonTitleTextSize: 16.0,\n iconCornerRadius: 30.0,\n buttonCornerRadius: 15.0,\n buttonTitleTextColor: 'black',\n buttonBorderColor: 'white',\n containerBackgroundColor: '#ebedeb',\n buttonIconBackgroundColor: '#654EA3',\n buttonBackgroundColor: 'white',\n },\n}) => {\n const buttonStyle = {\n backgroundColor: widgetStyle.buttonBackgroundColor ?? 'white',\n height: 110,\n flex: 1,\n elevation: 1,\n borderRadius: widgetStyle.buttonCornerRadius ?? 15.0,\n borderColor: widgetStyle.buttonBorderColor ?? 'white',\n borderWidth: widgetStyle.buttonBorderWidth ?? 0.5,\n };\n return (\n <View\n style={{\n backgroundColor: widgetStyle.containerBackgroundColor ?? '#ebedeb',\n height: 160,\n width: '100%',\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <View style={{ width: 20 }} />\n <TouchableOpacity\n onPress={() => {\n Flyy.openOffersScreen();\n }}\n style={buttonStyle}\n >\n <FlyyCardView\n cardStyle={widgetStyle}\n buttonTitle={widgetStyle.offerButtonTitle ?? 'Offers'}\n buttonIcon={\n widgetStyle.offersButtonIcon ??\n require('./assets/images/offerswidget.png')\n }\n />\n </TouchableOpacity>\n <View style={{ width: 15 }} />\n <TouchableOpacity\n onPress={() => {\n Flyy.openRewardsScreen();\n }}\n style={buttonStyle}\n >\n <FlyyCardView\n cardStyle={widgetStyle}\n buttonTitle={widgetStyle.rewardButtonTitle ?? 'Rewards'}\n buttonIcon={\n widgetStyle.rewardsButtonIcon ??\n require('./assets/images/rewardwidget.png')\n }\n />\n </TouchableOpacity>\n <View style={{ width: 15 }} />\n <TouchableOpacity\n onPress={() => {\n Flyy.openWalletScreen();\n }}\n style={buttonStyle}\n >\n <FlyyCardView\n cardStyle={widgetStyle}\n buttonTitle={widgetStyle.walletButtonTitle ?? 'Wallet'}\n buttonIcon={\n widgetStyle.walletButtonIcon ??\n require('./assets/images/walletwidget.png')\n }\n />\n </TouchableOpacity>\n <View style={{ width: 20 }} />\n </View>\n );\n};\n\n// @ts-ignore\nconst FlyyCardView = ({ cardStyle, buttonTitle, buttonIcon }) => {\n return (\n <View>\n <View style={{ height: 10 }} />\n <View\n style={{\n backgroundColor: cardStyle.buttonIconBackgroundColor ?? '#654EA3',\n height: 50,\n width: 50,\n borderRadius: cardStyle.iconCornerRadius ?? 30.0,\n alignSelf: 'center',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Image source={buttonIcon} style={{ height: 28, width: 28 }} />\n </View>\n <View style={{ height: 10 }} />\n <Text\n style={{\n alignSelf: 'center',\n flexShrink: 1,\n color: cardStyle.buttonTitleTextColor ?? 'black',\n fontSize:\n cardStyle.buttonTitleTextSize != null\n ? cardStyle.buttonTitleTextSize < 30\n ? cardStyle.buttonTitleTextSize\n : 30\n : 16,\n fontFamily: cardStyle.buttonTitleFontFamily ?? 'Montserrat-Bold',\n textAlign: 'center',\n paddingLeft: 5,\n paddingRight: 5,\n }}\n numberOfLines={1}\n >\n {buttonTitle}\n </Text>\n <View style={{ height: 10 }} />\n </View>\n );\n};\n"]}
@@ -0,0 +1,19 @@
1
+ import { Component } from "react";
2
+ declare class FlyyCheckinComponent extends Component {
3
+ state: {
4
+ mileStoneData: never[];
5
+ checkinOffer: never[];
6
+ listItems: never[];
7
+ persons: number[];
8
+ partnerId: string;
9
+ userId: string;
10
+ appData: string;
11
+ environment: number;
12
+ };
13
+ componentDidMount(): Promise<void>;
14
+ fetchData(): Promise<void>;
15
+ checkInApi(): Promise<void>;
16
+ notifyMessage(msg: string): void;
17
+ render(): JSX.Element;
18
+ }
19
+ export default FlyyCheckinComponent;
@@ -1,9 +1,31 @@
1
1
  /// <reference types="react" />
2
2
  declare type FlyyType = {
3
+ getUserId(arg0: (data: any) => void): unknown;
3
4
  multiply(a: number, b: number): Promise<number>;
4
5
  };
5
6
  declare const _default: FlyyType;
6
7
  export default _default;
8
+ export declare const FlyyCheckinView: (props: any) => JSX.Element;
9
+ export declare const FlyyFloatingWidget: ({ props }: {
10
+ props?: {
11
+ backgroundColor: string;
12
+ buttonHeight: number;
13
+ buttonWidth: number;
14
+ buttonCornerRadius: number;
15
+ buttonIcon: any;
16
+ onPress: () => void;
17
+ x: number;
18
+ y: number;
19
+ minX: number;
20
+ minY: number;
21
+ maxX: number;
22
+ maxY: number;
23
+ show: boolean;
24
+ stick: boolean;
25
+ startDate: number;
26
+ endDate: number;
27
+ } | undefined;
28
+ }) => JSX.Element;
7
29
  export declare const FlyyWidget: ({ widgetStyle, }: {
8
30
  widgetStyle?: {
9
31
  rewardsButtonIcon: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-flyy",
3
- "version": "1.4.23",
3
+ "version": "1.4.25",
4
4
  "description": "React Native wrapper around our Android and iOS mobile SDKs",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -161,6 +161,7 @@
161
161
  "react-dev-utils": "10.1.0"
162
162
  },
163
163
  "dependencies": {
164
+ "@react-native-async-storage/async-storage": "^1.17.11",
164
165
  "@react-native-firebase/app": "^12.7.0",
165
166
  "abab": "^2.0.5",
166
167
  "abort-controller": "^3.0.0",
@@ -754,6 +755,8 @@
754
755
  "rc": "^1.2.8",
755
756
  "react-devtools-core": "^4.10.1",
756
757
  "react-is": "^16.13.1",
758
+ "react-native-draggable": "github:ashish1066/react-native-draggable",
759
+ "react-native-simple-toast": "^1.1.4",
757
760
  "react-refresh": "^0.4.3",
758
761
  "read-pkg": "^3.0.0",
759
762
  "read-pkg-up": "^7.0.1",
@@ -18,5 +18,5 @@ Pod::Spec.new do |s|
18
18
 
19
19
 
20
20
  s.dependency "React-Core"
21
- s.dependency "FlyyFramework", "1.3.41"
21
+ s.dependency "FlyyFramework", "1.3.63"
22
22
  end
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,214 @@
1
+ // @ts-nocheck
2
+ import React, { Component } from "react";
3
+ import { View, Text, TouchableOpacity,StyleSheet,Image, VirtualizedList, Platform, ToastAndroid, Alert, Linking } from "react-native";
4
+ import Flyy from 'react-native-flyy';
5
+ import Toast from 'react-native-simple-toast';
6
+
7
+ class FlyyCheckinComponent extends Component {
8
+
9
+ state = {
10
+ mileStoneData: [],
11
+ checkinOffer: [],
12
+ listItems: [],
13
+ persons: [1,2,3,4,5],
14
+ partnerId: "",
15
+ userId: "",
16
+ appData: "",
17
+ environment: 0
18
+ };
19
+
20
+ async componentDidMount(){
21
+ try {
22
+ const data = await Flyy.getUserData();
23
+ const appData = await Flyy.getAppData();
24
+ this.setState({
25
+ partnerId : data["partner_id"],
26
+ userId : data["user_id"],
27
+ environment : data["environment"],
28
+ appData: appData
29
+ })
30
+ } catch (e) {
31
+ console.error(e);
32
+ }
33
+
34
+ await this.fetchData();
35
+ }
36
+
37
+
38
+ async fetchData(){
39
+ this.setState({ listItems : []})
40
+ const resp = await fetch(`https://${this.state.environment == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/v7/flyy_app_info`, {
41
+ headers: {
42
+ "X-Key": this.state.partnerId,
43
+ "Content-Type": "application/json",
44
+ "X-App-Data": this.state.appData
45
+ }
46
+ });
47
+ const data = await resp.json();
48
+ for (var key in data.info.offers) {
49
+ if (data.info.offers[key].offer_type_code === "checkin") {
50
+ this.setState({ checkinOffer : data.info.offers[key] })
51
+ this.setState({ mileStoneData : data.info.offers[key].milestones })
52
+ break;
53
+ }
54
+ }
55
+ var tempData = [];
56
+ var isRewardDay = false;
57
+ var isCheckedIn = false;
58
+ for (let i = 0; i < this.state.checkinOffer.total_streak; i++) {
59
+ for (let j = 0; j < this.state.mileStoneData.length; j++) {
60
+ if (i + 1 === parseInt(this.state.mileStoneData[j].value)) {
61
+ isRewardDay = true;
62
+ }
63
+ }
64
+ if (i+1 <= this.state.checkinOffer.streak) {
65
+ isCheckedIn = true;
66
+ }
67
+ tempData.push({ "isRewardDay": isRewardDay, "isCheckedIn": isCheckedIn })
68
+ isRewardDay = false;
69
+ isCheckedIn = false;
70
+ }
71
+ this.setState({ listItems : tempData })
72
+ }
73
+
74
+
75
+ async checkInApi() {
76
+ var url = `https://${this.state.environment == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/v1/checkin?offer_id=` + this.state.checkinOffer.id.toString();
77
+ const resp = await fetch(url, {
78
+ headers: {
79
+ "X-Key": this.state.partnerId,
80
+ "Content-Type": "application/json",
81
+ "X-App-Data": this.state.appData
82
+ }
83
+ });
84
+ const data = await resp.json();
85
+ if (data.success) {
86
+ this.fetchData()
87
+ } else {
88
+ this.notifyMessage(data.message)
89
+ }
90
+ }
91
+
92
+ notifyMessage(msg:string) {
93
+ if (Platform.OS === 'android') {
94
+ ToastAndroid.show(msg, ToastAndroid.SHORT)
95
+ } else {
96
+ Toast.showWithGravity(msg, Toast.SHORT, Toast.BOTTOM);
97
+ }
98
+ }
99
+
100
+ render() {
101
+ const Divider = ({color = "black",index}:{color:any,index:any}) => {
102
+ return (
103
+ <View style={{ flexDirection: 'row'}}>
104
+ {React.Children.toArray(
105
+ this.state.persons.map(() => {
106
+ return (
107
+ <View style={{ flexDirection: 'row' }}>
108
+ <View style={{ height: 1, width: 2, backgroundColor: color, borderRadius: 2 }} />
109
+ <View style={{ width: 1, backgroundColor: "white", borderRadius: 2 }} />
110
+ </View>
111
+ );
112
+ })
113
+ )}
114
+ </View>
115
+ )
116
+ }
117
+ const getItemCount = () => this.state.listItems.length;
118
+ const getItem = (data:any, index:any) => ({
119
+ id: Math.random().toString(12).substring(0),
120
+ isRewardDay: data[index].isRewardDay,
121
+ isCheckedIn: data[index].isCheckedIn,
122
+ index: index
123
+ });
124
+ const Item = ({ title, index }: {title:any,index:any}) => {
125
+ const day = index + 1;
126
+ return (
127
+ <View style = {{justifyContent: "center",alignItems:'center',alignContent:'center'}}>
128
+ <View style = {{flexDirection : 'row',height: 35,justifyContent:'center',alignItems:'center'}}>
129
+ {title.isCheckedIn? <View style={{ height: 1, width: 15, alignSelf: "center" , backgroundColor: index == 0 ? "white" : "black"}} />:<Divider color={index == 0 ? "white" : "black"} index={index}/>}
130
+ {title.isRewardDay ?
131
+ title.isCheckedIn ? <Image source={require('./assets/images/reward_flyy.png')} style={{ height: 20, width: 15 }} /> : <Image source={{ uri: this.state.checkinOffer["currency_icon_url"] }} style={{ height: 20, width: 20 }} />
132
+ : title.isCheckedIn ?
133
+ <View style = {{height:17,width:17,backgroundColor:"black",borderRadius:15,justifyContent:'center',alignItems:'center'}}><Text style={{color:"white",fontSize:10}}>✓</Text></View>
134
+ : <Image source={require('./assets/images/radio.png')} style={{ height: 20, width: 20 }} />}
135
+ {index != this.state.listItems.length-1 ? this.state.listItems[index+1].isCheckedIn ? <View style={{ height: 1, width: 15, alignSelf: "center" , backgroundColor: index == this.state.listItems.length-1 ? "white" : "black"}} />:<Divider color={index == this.state.listItems.length - 1 ? "white" : "black"} index={index}/>: <View style = {{width:15}}/>}
136
+ </View>
137
+ <Text style = {{textAlign: 'center',color: title.isRewardDay ? this.props.style?.checkInEarnColor ?? "black" : this.props.style?.checkInDaysColor ?? "black"}}>{title.isRewardDay ?
138
+ title.isCheckedIn ? "Won" : "Earn"
139
+ : title.isCheckedIn ? "Day "+day : "Day "+day}</Text>
140
+ </View>
141
+ )
142
+ }
143
+ return (
144
+ <TouchableOpacity style={styles.main} onPress = {()=>{
145
+ Flyy.openFlyyCheckinPage();
146
+ }}>
147
+ <View style={{ height: 10 }} />
148
+ <Text style={{ fontSize: 20, color: this.props.style?.checkInTitleColor ?? "black", fontFamily: this.props.style?.fontFamily ?? "Montserrat-Regular" }}>
149
+ {this.state.checkinOffer["offer_type_title"] ?? "N/A"}
150
+ </Text>
151
+ <View style={{ height: 10 }} />
152
+ <View style = {{flexDirection: 'row',width:250,justifyContent: 'center'}}>
153
+ <Text numberOfLines={1} style={{ fontSize: 18, color: this.props.style?.checkInDescriptionColor ?? "grey", fontFamily: this.props.style?.fontFamily ?? "Montserrat-Regular",textAlign: "center"}}>
154
+ {this.state.checkinOffer["description"] != null ? this.state.checkinOffer["description"].replace(/(<([^>]+)>)/ig, '') : "N/A"}
155
+ </Text>
156
+ </View>
157
+ <View style={{ height: 10 }} />
158
+ <View style={styles.listContainer}>
159
+ <View>
160
+ <VirtualizedList
161
+ data={this.state.listItems}
162
+ style = {{alignSelf: "center"}}
163
+ initialNumToRender={4}
164
+ horizontal={true}
165
+ renderItem={({ item, index }) => <Item title={item} index={index} />}
166
+ getItemCount={getItemCount}
167
+ getItem={getItem}
168
+ />
169
+ </View>
170
+ </View>
171
+ <View style={{ height: 10 }} />
172
+ <TouchableOpacity
173
+ style={styles.button}
174
+ onPress={async () => {
175
+ const eventId = this.state.checkinOffer["event_id"];
176
+ const url = this.state.checkinOffer["deeplink"];
177
+ if(eventId != null){
178
+ if (url != "") {
179
+ const supported = await Linking.canOpenURL(url);
180
+ if (supported) {
181
+ await Linking.openURL(url);
182
+ }
183
+ }
184
+ }else{
185
+ this.checkInApi();
186
+ }
187
+ }}>
188
+ <Text style={{
189
+ fontSize: 20,
190
+ color: this.props.style?.checkInBtnTextColor ?? "white",
191
+ paddingLeft: 10,
192
+ paddingRight: 10,
193
+ fontFamily: "Montserrat-Regular"
194
+ }}>{this.state.checkinOffer["checked_in"] ? "Checked In" : this.state.checkinOffer["button_text"] != "" ? this.state.checkinOffer["button_text"] : "Check In"}</Text>
195
+ </TouchableOpacity>
196
+ </TouchableOpacity>
197
+ );
198
+ }
199
+ }
200
+
201
+ const styles = StyleSheet.create({
202
+ main: {
203
+ backgroundColor: "white",
204
+ elevation: 5,
205
+ height: 210,
206
+ width: "90%",
207
+ alignItems: "center",
208
+ borderRadius: 10
209
+ },
210
+ listContainer: { height: 60,flexDirection: "row",justifyContent: "center",width:"100%",alignItems:'center',alignContent:'center',backgroundColor: "white"},
211
+ button: { backgroundColor: "#f57242", height: 35, borderRadius: 5, justifyContent: "center" },
212
+ });
213
+
214
+ export default FlyyCheckinComponent;
package/src/index.tsx CHANGED
@@ -1,19 +1,237 @@
1
- import React from 'react';
1
+ // @ts-nocheck
2
+ import React, { useEffect, useState } from 'react';
2
3
  import {
3
4
  Image,
4
5
  NativeModules,
5
6
  Text,
6
7
  TouchableOpacity,
7
8
  View,
9
+ Dimensions,
10
+ AppState,
11
+ Linking
8
12
  } from 'react-native';
13
+ import Draggable from 'react-native-draggable';
14
+ import FlyyCheckinComponent from './flyy_checkin_view';
15
+ import AsyncStorage from '@react-native-async-storage/async-storage';
9
16
 
10
17
  type FlyyType = {
18
+ getUserId(arg0: (data: any) => void): unknown;
11
19
  multiply(a: number, b: number): Promise<number>;
12
20
  };
13
21
 
14
22
  const { Flyy } = NativeModules;
15
23
 
16
24
  export default Flyy as FlyyType;
25
+
26
+ // ****** Flyy CheckinView Widget ******
27
+ export const FlyyCheckinView = (props: any) => {
28
+ return (<FlyyCheckinComponent style={{
29
+ checkInBtnTextColor: props.checkInBtnTextColor,
30
+ checkInTitleColor: props.checkInTitleColor,
31
+ checkInDescriptionColor: props.checkInDescriptionColor,
32
+ checkInDaysColor: props.checkInDaysColor,
33
+ checkInEarnColor: props.checkInEarnColor,
34
+ fontFamily: props.fontFamily
35
+ }} />)
36
+ }
37
+ const windowHeight = Dimensions.get('window').height;
38
+ const windowWidth = Dimensions.get('window').width;
39
+
40
+ // ****** Flyy Floating Widget ******
41
+ export const FlyyFloatingWidget = ({
42
+ props = {
43
+ backgroundColor: "#654EA3",
44
+ buttonHeight: 55,
45
+ buttonWidth: 55,
46
+ buttonCornerRadius: 40,
47
+ buttonIcon: require('./assets/images/rewardwidget.png'),
48
+ onPress: () => { },
49
+ x: windowWidth - 75,
50
+ y: windowHeight - 100,
51
+ minX: 5,
52
+ minY: 5,
53
+ maxX: windowWidth - 5,
54
+ maxY: windowHeight - 5,
55
+ show: true,
56
+ stick: false,
57
+ startDate: 0,
58
+ endDate: 0
59
+ } }) => {
60
+
61
+ const [showWidget,setShowWidget] = useState(false);
62
+ const [userData,setUserData] = useState({});
63
+ const [iconUrl,setIconUrl] = useState(require('./assets/images/rewardwidget.png'));
64
+ const [backgroundColor,setBackgroundColor] = useState("#654EA3");
65
+ const [buttonSize,setButtonSize] = useState(55);
66
+ const [buttonXPosition,setButtonXPosition] = useState(windowWidth - 75);
67
+ const [buttonYPosition,setButtonYPosition] = useState(windowHeight - 100);
68
+ const [deeplink,setDeeplink] = useState(null);
69
+ const flyyConfigDate = "flyy_config_date";
70
+ var oldState = null;
71
+ var currentState = null;
72
+ var data = null;
73
+
74
+ useEffect(()=>{
75
+ fetchData();
76
+ },[]);
77
+
78
+ const fetchData = async() => {
79
+ const sdkInfo = await Flyy.getUserData();
80
+ const appData = await Flyy.getAppData();
81
+ const resp = await fetch(`https://${sdkInfo["environment"] == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/v8/flyy_app_info`, {
82
+ headers: {
83
+ "X-Key": sdkInfo["partner_id"],
84
+ "Content-Type": "application/json",
85
+ "X-App-Data": appData
86
+ }
87
+ });
88
+ data = await resp.json();
89
+ const widgetConfig = data.info.floating_widget_configuration;
90
+
91
+ if (widgetConfig.icon_url != null && widgetConfig.icon_url != '') {
92
+ setIconUrl({ uri: widgetConfig.icon_url })
93
+ } else {
94
+ setIconUrl(props.buttonIcon)
95
+ }
96
+
97
+ if (widgetConfig.color != null && widgetConfig.color != '') {
98
+ setBackgroundColor(widgetConfig.color)
99
+ } else {
100
+ setBackgroundColor(props.backgroundColor)
101
+ }
102
+
103
+ if (widgetConfig.size != null && widgetConfig.color != 0) {
104
+ setButtonSize(parseInt(data.info.floating_widget_configuration.size))
105
+ } else {
106
+ setButtonSize(props.buttonHeight)
107
+ }
108
+
109
+ //FloatingButton Position
110
+ if (widgetConfig.position == "bottom_left") {
111
+ setButtonXPosition(10)
112
+ } else if (widgetConfig.position == "bottom_right") {
113
+ setButtonXPosition(windowWidth - 75)
114
+ } else if (widgetConfig.position == "upper_left") {
115
+ setButtonXPosition(10)
116
+ setButtonYPosition(10)
117
+ } else if (widgetConfig.position == "upper_right") {
118
+ setButtonXPosition(windowWidth - 75)
119
+ setButtonYPosition(10)
120
+ }
121
+
122
+ //Set DeepLink
123
+ if (widgetConfig.deeplink != null && widgetConfig.deeplink != "") {
124
+ setDeeplink(widgetConfig.deeplink)
125
+ }
126
+ //Set Visibility of FloatingButton
127
+ var currentDate = new Date();
128
+ const getDate = await AsyncStorage.getItem(flyyConfigDate);
129
+ var date = new Date(parseInt(getDate));
130
+ const diffTime = Math.abs(getDate - currentDate);
131
+ const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
132
+ if(diffDays != 0){
133
+ var data = await Flyy.getAppOccurence(1);
134
+ }
135
+ const occurrenceCount = await Flyy.getAppOccurence(0);
136
+ if (widgetConfig.show_to_user && occurrenceCount <= widgetConfig.num_times) {
137
+ // var numberOfDaysToAdd = widgetConfig.num_days+1;
138
+ // var result = currentDate.setDate(currentDate.getDate() + numberOfDaysToAdd);
139
+ if(getDate === null){
140
+ await AsyncStorage.setItem(
141
+ flyyConfigDate,
142
+ JSON.stringify(currentDate.getTime())
143
+ );
144
+ }
145
+ const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
146
+ var date = new Date(parseInt(getDate2));
147
+ const diffTime = Math.abs(getDate2 - currentDate);
148
+ const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
149
+ //Show widget on same day
150
+ if(diffDays === 0){
151
+ setShowWidget(true)
152
+ }else{
153
+ //reset occurrence on next day
154
+ await Flyy.getAppOccurence(1);
155
+ if(diffDays >= widgetConfig.num_days+1){
156
+ await AsyncStorage.setItem(
157
+ flyyConfigDate,
158
+ JSON.stringify(currentDate.getTime())
159
+ );
160
+ setShowWidget(true)
161
+ }
162
+ }
163
+ }else{
164
+ const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
165
+ var date = new Date(parseInt(getDate2));
166
+ const diffTime = Math.abs(getDate2 - currentDate);
167
+ const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
168
+ if(diffDays != 1){
169
+ var data = await Flyy.getAppOccurence(1);
170
+ }
171
+ }
172
+ }
173
+
174
+ // if(props.show){
175
+ // if(props.startDate != null && props.startDate != 0){
176
+ // var now = new Date().getTime();
177
+ // if(now >= props.startDate && now <= props.endDate){
178
+ // props.show = true
179
+ // }else{
180
+ // props.show = false
181
+ // }
182
+ // }
183
+ // }
184
+
185
+ // AppState.addEventListener('change', state =>{
186
+ // console.log('AppState updated to', AppState.currentState)
187
+ // oldState = currentState;
188
+ // currentState = state;
189
+ // if(oldState == null){
190
+ // console.log('App is newly start :::')
191
+ // }})
192
+
193
+ return (
194
+ // @ts-ignore
195
+ props.show && showWidget? <Draggable x={buttonXPosition}
196
+ y={buttonYPosition}
197
+ minX={props.minX ?? 5}
198
+ minY={props.minY ?? 5}
199
+ maxX={props.maxX ?? windowWidth - 5}
200
+ maxY={props.maxY ?? windowHeight - 5}
201
+ renderSize={56}
202
+ // shouldReverse = {true}
203
+ onDragRelease={props.stick ? () => {
204
+
205
+ } : null} isCircle>
206
+ <TouchableOpacity
207
+ onPress={deeplink != null ? async()=>{
208
+ const supported = await Linking.canOpenURL(deeplink);
209
+ await Linking.openURL(deeplink);
210
+ }:props.onPress}
211
+ style={{
212
+ height: buttonSize,
213
+ width: buttonSize,
214
+ backgroundColor: backgroundColor,
215
+ borderRadius: buttonSize/2,
216
+ justifyContent: 'center',
217
+ alignItems: 'center',
218
+ }}>
219
+ <Image source={iconUrl} style={{ height: buttonSize*55/100, width: buttonSize*55/100 }} />
220
+ <TouchableOpacity
221
+ onPress={()=>{
222
+ props.show = false;
223
+ setShowWidget(false);
224
+ console.log("SHOW PROPS :::");
225
+ console.log(props.show);
226
+ }}
227
+ style = {{height: 20, width: 20, backgroundColor: "transparent",position:'absolute',left:buttonSize-11, bottom: buttonSize*72/100}}>
228
+ <Image source={require('./assets/images/xmark.png')} style={{ height: 18, width: 18, tintColor: "black"}} />
229
+ </TouchableOpacity>
230
+ </TouchableOpacity>
231
+ </Draggable> : <View/>
232
+ );
233
+ }
234
+
17
235
  export const FlyyWidget = ({
18
236
  widgetStyle = {
19
237
  rewardsButtonIcon: require('./assets/images/rewardwidget.png'),