Skip to content

Version Updated #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ android/app/agconnect-services.json
android/app/mykeystore.jks
ios/Podfile.lock
ios/Pods
package-lock.json
10 changes: 10 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -214,13 +216,21 @@ function App(): JSX.Element {
<GDPR />
</CustomSection>

<CustomSection title="Re Init SDK">
<ReInitSDK />
</CustomSection>

<CustomSection title="Message Center">
<MessageCenter />
</CustomSection>

<CustomSection title="Content Optimizer">
<ContentOptimizer />
</CustomSection>

<CustomSection title="Block In App">
<BlockInApps />
</CustomSection>
</View>
</ScrollView>
</SafeAreaView>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
Expand Down
38 changes: 38 additions & 0 deletions src/insider/BlockInApps.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<View>
<View style={styles.row}>
<CustomButton text="Disable In-App Messages" onPress={disableInAppMessages} />
<CustomButton text="Enable In-App Messages" onPress={enableInAppMessages} />
</View>
</View>
);
}

export default BlockInApps;
4 changes: 2 additions & 2 deletions src/insider/PageVisit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function PageVisitMethods(): JSX.Element {
<CustomButton
text="Product Page"
onPress={() => {
triggerPage("visitListingPage");
triggerPage("visitProductDetailPage");
}}
/>
</View>
Expand All @@ -76,7 +76,7 @@ function PageVisitMethods(): JSX.Element {
<CustomButton
text="Category Page"
onPress={() => {
triggerPage("visitProductDetailPage");
triggerPage("visitListingPage");
}}
/>
</View>
Expand Down
3 changes: 2 additions & 1 deletion src/insider/Product.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 _.
Expand Down
25 changes: 25 additions & 0 deletions src/insider/ReInitSDK.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<View>
<CustomButton text="Re Init SDK" onPress={reInitSDK}/>
</View>
);
}

export default ReInitSDK;
8 changes: 7 additions & 1 deletion src/insider/UserAttribute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
};
Expand Down
14 changes: 11 additions & 3 deletions src/insider/UserIdentifier.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import { View } from "react-native";

import CustomButton from "../components/CustomButton";
Expand All @@ -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 (
<View>
<CustomButton text="Login" onPress={login} />
Expand All @@ -36,6 +39,11 @@ const UserIdentifiers = () => {
buttonStyle={{ backgroundColor: "#E57F74" }}
onPress={logout}
/>
<CustomButton
text="Sign Up"
buttonStyle={{ backgroundColor: "#007BFF" }}
onPress={signUp}
/>
</View>
);
};
Expand Down