Skip to content

Commit

Permalink
Upgraded React-Native to 0.73.4 & dependencies in the Android.
Browse files Browse the repository at this point in the history
  • Loading branch information
SanthoshKumarSrikanthaMurali committed Mar 9, 2024
1 parent 50f0650 commit d35f8d0
Show file tree
Hide file tree
Showing 6 changed files with 3,645 additions and 3,390 deletions.
100 changes: 50 additions & 50 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
def packageJsonFile = file('../package.json')
def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text)
def packageVersion = '"' + packageJson.version + '"'
def packageJsonFile = file('../package.json')
def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text)
def packageVersion = '"' + packageJson.version + '"'


buildscript {
if (project == rootProject) {
repositories {
google()
mavenCentral()
}
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 21
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.1.8937393"
kotlinVersion = "1.8.0"
}
if (project == rootProject) {
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
}
}

apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
// Compatibility for AGP v. <4.2/Gradle 8
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
if (agpVersion >= 7) {
namespace 'com.intercom.reactnative'
}
namespace 'com.intercom.reactnative'
compileSdk rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

compileSdkVersion safeExtGet('IntercomReactNative_compileSdkVersion', 34)
defaultConfig {
minSdkVersion safeExtGet('IntercomReactNative_minSdkVersion', 21)
targetSdkVersion safeExtGet('IntercomReactNative_targetSdkVersion', 34)
versionCode 1
versionName "1.0"
buildConfigField 'String', 'INTERCOM_VERSION_NAME', packageVersion
}
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
buildConfigField 'String', 'INTERCOM_VERSION_NAME', packageVersion
}

buildTypes {
release {
minifyEnabled false
}
}
lintOptions {
disable 'GradleCompatible'
}

if (agpVersion < 8) {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
}
}
lintOptions {
disable 'GradleCompatible'
}
}

repositories {
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
google()
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
google()
}

dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.google.firebase:firebase-messaging:${safeExtGet('firebaseMessagingVersion', '20.2.+')}"
implementation 'io.intercom.android:intercom-sdk:15.6.4'
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.google.firebase:firebase-messaging:${safeExtGet('firebaseMessagingVersion', '20.2.+')}"
implementation 'io.intercom.android:intercom-sdk:15.7.0'
}
42 changes: 23 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,25 @@
"access": "public"
},
"devDependencies": {
"@expo/config-plugins": "^7.8.4",
"@react-native-community/eslint-config": "^2.0.0",
"@types/jest": "^26.0.0",
"@types/mocha": "^8.2.2",
"@types/react": "^16.9.19",
"@types/react-native": "0.62.13",
"@wdio/mocha-framework": "^7.7.2",
"eslint": "^7.2.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^3.1.3",
"jest": "^26.0.1",
"pod-install": "^0.1.0",
"prettier": "^2.0.5",
"react": "18.1.0",
"react-native": "0.70.4",
"react-native-builder-bob": "^0.18.0",
"typescript": "^4.1.3",
"webdriverio": "^7.7.2"
"@expo/config-plugins": "7.8.4",
"@react-native-community/eslint-config": "3.2.0",
"@types/jest": "29.5.12",
"@types/mocha": "10.0.6",
"@types/react": "18.2.6",
"@react-native/typescript-config": "0.73.1",
"@wdio/mocha-framework": "8.33.1",
"@wdio/globals": "8.33.1",
"eslint": "8.19.0",
"eslint-config-prettier": "8.10.0",
"eslint-plugin-prettier": "5.1.3",
"jest": "29.6.3",
"pod-install": "0.2.0",
"prettier": "3.0.0",
"react": "18.2.0",
"react-native": "0.73.4",
"react-native-builder-bob": "0.23.2",
"typescript": "5.0.4",
"webdriverio": "8.33.0"
},
"peerDependencies": {
"react": "*",
Expand Down Expand Up @@ -135,6 +136,9 @@
]
},
"resolutions": {
"@types/react": "^17.0.38"
"@types/react": "18.2.6"
},
"engines": {
"node": ">=18"
}
}
2 changes: 1 addition & 1 deletion src/expo-plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
ConfigPlugin,
type ConfigPlugin,
createRunOncePlugin,
withAppDelegate,
AndroidConfig,
Expand Down
24 changes: 12 additions & 12 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
NativeModules,
NativeEventEmitter,
Platform,
EmitterSubscription,
type EmitterSubscription,
} from 'react-native';

const { IntercomModule, IntercomEventEmitter } = NativeModules;
Expand All @@ -28,13 +28,13 @@ type LogLevelType = keyof typeof LogLevel;

export const IntercomEvents = {
IntercomUnreadCountDidChange:
IntercomEventEmitter.UNREAD_COUNT_CHANGE_NOTIFICATION,
IntercomEventEmitter.UNREAD_COUNT_CHANGE_NOTIFICATION,
IntercomWindowDidHide: IntercomEventEmitter.WINDOW_DID_HIDE_NOTIFICATION,
IntercomWindowDidShow: IntercomEventEmitter.WINDOW_DID_SHOW_NOTIFICATION,
IntercomHelpCenterWindowDidShow:
IntercomEventEmitter.WINDOW_DID_SHOW_NOTIFICATION,
IntercomEventEmitter.WINDOW_DID_SHOW_NOTIFICATION,
IntercomHelpCenterWindowDidHide:
IntercomEventEmitter.WINDOW_DID_HIDE_NOTIFICATION,
IntercomEventEmitter.WINDOW_DID_HIDE_NOTIFICATION,
};

type EventType =
Expand Down Expand Up @@ -200,7 +200,7 @@ export type IntercomType = {
* @return {Promise<HelpCenterCollectionContent>} A {@link HelpCenterCollectionContent} object.
*/
fetchHelpCenterCollection: (
id: string
id: string,
) => Promise<HelpCenterCollectionContent>;

/**
Expand All @@ -211,7 +211,7 @@ export type IntercomType = {
* @return {Promise<HelpCenterArticleSearchResult>} An array of {@link HelpCenterArticleSearchResult} objects.
*/
searchHelpCenter: (
term: string
term: string,
) => Promise<Array<HelpCenterArticleSearchResult>>;

/**
Expand Down Expand Up @@ -283,7 +283,7 @@ export type IntercomType = {
*/
addEventListener: (
event: EventType,
callback: (response: { count?: number; visible: boolean }) => void
callback: (response: { count?: number; visible: boolean }) => void,
) => EmitterSubscription;
};

Expand Down Expand Up @@ -332,15 +332,15 @@ const Intercom: IntercomType = {

addEventListener: (event, callback) => {
event === IntercomEvents.IntercomUnreadCountDidChange &&
Platform.OS === 'android' &&
IntercomEventEmitter.startEventListener();
Platform.OS === 'android' &&
IntercomEventEmitter.startEventListener();
const eventEmitter = new NativeEventEmitter(IntercomEventEmitter);
const listener = eventEmitter.addListener(event, callback);
const originalRemove = listener.remove;
listener.remove = () => {
event === IntercomEvents.IntercomUnreadCountDidChange &&
Platform.OS === 'android' &&
IntercomEventEmitter.removeEventListener();
Platform.OS === 'android' &&
IntercomEventEmitter.removeEventListener();
originalRemove();
};
return listener;
Expand Down Expand Up @@ -389,7 +389,7 @@ export type IntercomContentType = {
carouselWithCarouselId: (carouselId: string) => Carousel;
surveyWithSurveyId: (surveyId: string) => Survey;
helpCenterCollectionsWithIds: (
collectionIds: string[]
collectionIds: string[],
) => HelpCenterCollections;
conversationWithConversationId: (conversationId: string) => Conversation;
};
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"paths": {
"@intercom/intercom-react-native": ["./src/index"],
},
"types": ["node", "mocha", "webdriverio/async", "@wdio/mocha-framework"],
"types": ["node", "mocha", "@wdio/globals/types", "@wdio/mocha-framework"],
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"esModuleInterop": true,
"importsNotUsedAsValues": "error",
"verbatimModuleSyntax": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["esnext"],
Expand Down
Loading

0 comments on commit d35f8d0

Please sign in to comment.