diff --git a/.gitignore b/.gitignore index 439a9f6..c899185 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ android/app/agconnect-services.json android/app/mykeystore.jks ios/Podfile.lock ios/Pods +package-lock.json diff --git a/App.tsx b/App.tsx index 375f570..3cf572d 100644 --- a/App.tsx +++ b/App.tsx @@ -42,6 +42,8 @@ import PageVisit from "./src/insider/PageVisit"; import GDPR from "./src/insider/GDPR"; import MessageCenter from "./src/insider/MessageCenter"; import ContentOptimizer from "./src/insider/ContentOptimizer"; +import ReInitSDK from "./src/insider/ReInitSDK"; +import BlockInApps from "./src/insider/BlockInApps"; import RNInsider from "react-native-insider"; import InsiderCallbackType from "react-native-insider/src/InsiderCallbackType"; @@ -214,6 +216,10 @@ function App(): JSX.Element { + + + + @@ -221,6 +227,10 @@ function App(): JSX.Element { + + + + diff --git a/package.json b/package.json index 155c326..68ca8b0 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "react": "18.2.0", "react-native": "0.74.5", "react-native-dropdown-picker": "^5.4.4", - "react-native-insider": "6.5.0-nh", + "react-native-insider": "^6.7.0", "react-native-svg-transformer": "^1.5.0" }, "devDependencies": { @@ -24,13 +24,13 @@ "@react-native/babel-preset": "0.74.87", "@react-native/eslint-config": "0.74.87", "@react-native/metro-config": "0.74.87", - "metro-react-native-babel-preset": "^0.77.0", "@react-native/typescript-config": "0.74.87", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "eslint": "^8.19.0", "jest": "^29.6.3", + "metro-react-native-babel-preset": "^0.77.0", "prettier": "2.8.8", "react-test-renderer": "18.2.0", "typescript": "5.0.4" diff --git a/src/insider/BlockInApps.tsx b/src/insider/BlockInApps.tsx new file mode 100644 index 0000000..a093c60 --- /dev/null +++ b/src/insider/BlockInApps.tsx @@ -0,0 +1,38 @@ +import React from "react"; +import { View, StyleSheet } from "react-native"; + +import CustomButton from "../components/CustomButton"; +import RNInsider from "react-native-insider"; + +function BlockInApps(): JSX.Element { + const styles = StyleSheet.create({ + row: { + width: "100%", + flexDirection: "row", + flex: 1, + alignItems: "center", + justifyContent: "center", + }, + }); + + const disableInAppMessages = () => { + RNInsider.disableInAppMessages(); + console.log("[INSIDER][disableInAppMessages]: Method is triggered."); + }; + + const enableInAppMessages = () => { + RNInsider.enableInAppMessages(); + console.log("[INSIDER][enableInAppMessages]: Method is triggered."); + }; + + return ( + + + + + + + ); +} + +export default BlockInApps; diff --git a/src/insider/PageVisit.tsx b/src/insider/PageVisit.tsx index 9942d6c..bd49711 100644 --- a/src/insider/PageVisit.tsx +++ b/src/insider/PageVisit.tsx @@ -62,7 +62,7 @@ function PageVisitMethods(): JSX.Element { { - triggerPage("visitListingPage"); + triggerPage("visitProductDetailPage"); }} /> @@ -76,7 +76,7 @@ function PageVisitMethods(): JSX.Element { { - triggerPage("visitProductDetailPage"); + triggerPage("visitListingPage"); }} /> diff --git a/src/insider/Product.tsx b/src/insider/Product.tsx index a2eda69..53d803a 100644 --- a/src/insider/Product.tsx +++ b/src/insider/Product.tsx @@ -28,7 +28,8 @@ function Product(): JSX.Element { .setSalePrice(10.5) .setShippingCost(10.5) .setQuantity(10) - .setStock(10); + .setStock(10) + .setGroupCode("12345"); // Setting custom attributes. // MARK: Your attribute key should be all lowercased and should not include any special or non Latin characters or any space, otherwise this attribute will be ignored. You can use underscore _. diff --git a/src/insider/ReInitSDK.tsx b/src/insider/ReInitSDK.tsx new file mode 100644 index 0000000..3a78744 --- /dev/null +++ b/src/insider/ReInitSDK.tsx @@ -0,0 +1,25 @@ +import React from "react"; +import { View, StyleSheet } from "react-native"; +import CustomButton from "../components/CustomButton"; +import RNInsider from "react-native-insider"; + +function ReInitSDK(): JSX.Element { + const reInitSDK = () => { + console.log("[INSIDER][reInitSDK]: Button Pressed"); + + try { + RNInsider.reinitWithPartnerName("test_partner"); + console.log("[INSIDER][reInitSDK]: Reinitialized with test_partner"); + } catch (error) { + console.error("[INSIDER][reInitSDK]: Error reinitializing SDK", error); + } + }; + + return ( + + + + ); +} + +export default ReInitSDK; diff --git a/src/insider/UserAttribute.tsx b/src/insider/UserAttribute.tsx index 88f8989..3953c61 100644 --- a/src/insider/UserAttribute.tsx +++ b/src/insider/UserAttribute.tsx @@ -26,7 +26,13 @@ const UserAttributes = () => { .setFacebookID("Facebook-ID") .setTwitterID("Twittter-ID") .setLanguage("TR") - .setLocale("tr_TR"); + .setLocale("tr_TR") + .setCustomAttributeWithString("string_parameter", "Insider Example") + .setCustomAttributeWithInt("int_parameter", 10) + .setCustomAttributeWithDouble("double_parameter", 10.5) + .setCustomAttributeWithBoolean("bool_parameter", true) + .setCustomAttributeWithDate("date_parameter", new Date()) + .setCustomAttributeWithArray("array_parameter", ["value1", "value2", "value3"]); console.log("[INSIDER][getCurrentUser]: Method is triggered."); }; diff --git a/src/insider/UserIdentifier.tsx b/src/insider/UserIdentifier.tsx index c9ae50a..457f7cc 100644 --- a/src/insider/UserIdentifier.tsx +++ b/src/insider/UserIdentifier.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React from "react"; import { View } from "react-native"; import CustomButton from "../components/CustomButton"; @@ -22,12 +22,15 @@ const UserIdentifiers = () => { const logout = () => { let currentUser = RNInsider.getCurrentUser(); - currentUser.logout(); - console.log("[INSIDER][logout]: Method is triggered."); }; + const signUp = () => { + RNInsider.signUpConfirmation(); + console.log("[INSIDER][signUpConfirmation]: Method is triggered."); + }; + return ( @@ -36,6 +39,11 @@ const UserIdentifiers = () => { buttonStyle={{ backgroundColor: "#E57F74" }} onPress={logout} /> + ); };