Skip to content

Commit bad7d26

Browse files
Merge branch 'main' into feature/ISS-183379-update-hybrid-docs-samples
2 parents 5150523 + dac152c commit bad7d26

File tree

3 files changed

+60
-33
lines changed

3 files changed

+60
-33
lines changed

custom-implementation/src/main.tsx

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import './main.css'
22
import '@devrev/marketing-shared-components/dist/cjs/index.css'
33

4-
import ReactDOM from 'react-dom'
5-
4+
import ReactDOM from 'react-dom/client'
65
import React from 'react'
76

87
import Header from './components/header'
@@ -15,13 +14,12 @@ import { getPageData } from './modules/sanity/utils'
1514

1615
const FERN_CONTENT_WRAPPER_ID = 'fern-header-content-wrapper'
1716
const DEVREV_CONTENT_WRAPPER_ID = 'devrev-header-content-wrapper'
18-
1917
const FERN_HEADER_CONTAINER_ID = 'fern-header'
2018

2119
const render = async () => {
22-
/*
23-
* This is a where we try to make async data call.
24-
*/
20+
if (typeof window === 'undefined') {
21+
return
22+
}
2523

2624
const data = await getPageData()
2725

@@ -30,20 +28,22 @@ const render = async () => {
3028

3129
const theme = document.getElementsByTagName('html')[0].getAttribute('class')
3230

33-
if (!document.getElementById('sidenav-header-wrapper')) {
31+
if (!document.getElementById('sidenav-header-wrapper') && sidenav) {
3432
const sidenavHeaderWrapper = document.createElement('div')
3533
sidenavHeaderWrapper.setAttribute('id', 'sidenav-header-wrapper')
3634
sidenav.appendChild(sidenavHeaderWrapper)
3735

3836
const search = document.createElement('div')
3937
search.setAttribute('id', 'search-component')
4038
sidenavHeaderWrapper.appendChild(search)
41-
ReactDOM.render(React.createElement(Search), search)
39+
const searchRoot = ReactDOM.createRoot(search)
40+
searchRoot.render(React.createElement(Search))
4241

4342
const wrapper = document.createElement('div')
4443
wrapper.setAttribute('id', 'theme-switch')
4544
sidenavHeaderWrapper.appendChild(wrapper)
46-
ReactDOM.render(React.createElement(ThemeSwitch), wrapper)
45+
const themeRoot = ReactDOM.createRoot(wrapper)
46+
themeRoot.render(React.createElement(ThemeSwitch))
4747

4848
sidenav.replaceWith(sidenavHeaderWrapper)
4949
}
@@ -83,29 +83,33 @@ const render = async () => {
8383
document.body.appendChild(fernHeaderContainer)
8484
}
8585

86-
ReactDOM.render(
86+
// Updated to createRoot - callback handling changed
87+
const headerRoot = ReactDOM.createRoot(devrevContentWrapper)
88+
headerRoot.render(
8789
React.createElement(Header, {
8890
...data.header,
8991
version: theme == 'dark' ? 'light' : 'dark',
90-
}),
91-
devrevContentWrapper,
92-
() => {
93-
// Once the header component is loaded, make it visible
94-
const header = document.getElementById(FERN_HEADER_CONTAINER_ID)
95-
if (header) header.style.display = 'block'
96-
}
92+
})
9793
)
94+
95+
// Make header visible immediately
96+
setTimeout(() => {
97+
const header = document.getElementById(FERN_HEADER_CONTAINER_ID)
98+
if (header) header.style.display = 'block'
99+
}, 0)
98100
}
99101

100-
ReactDOM.render(
101-
React.createElement(Footer, { ...data.footer }),
102-
document.getElementById('fern-footer'),
103-
() => {
104-
// Once the footer component is loaded, make it visible
102+
const footerElement = document.getElementById('fern-footer')
103+
if (footerElement) {
104+
const footerRoot = ReactDOM.createRoot(footerElement)
105+
footerRoot.render(React.createElement(Footer, { ...data.footer }))
106+
107+
// Make footer visible immediately
108+
setTimeout(() => {
105109
const footer = document.getElementById('fern-footer')
106110
if (footer) footer.style.display = 'block'
107-
},
108-
)
111+
}, 0)
112+
}
109113

110114
// Add Plug component directly to body
111115
if (!document.getElementById('plug-platform')) {
@@ -145,8 +149,20 @@ const render = async () => {
145149
}
146150

147151
let observations = 0
148-
document.addEventListener('DOMContentLoaded', async () => {
149-
await render()
152+
153+
if (document.readyState === 'loading') {
154+
document.addEventListener('DOMContentLoaded', async () => {
155+
await render()
156+
setupMutationObserver()
157+
})
158+
} else {
159+
// DOM is already ready, run immediately
160+
render().then(() => {
161+
setupMutationObserver()
162+
})
163+
}
164+
165+
function setupMutationObserver() {
150166
new MutationObserver(async (e, o) => {
151167
await render()
152168
for (const item of e) {
@@ -164,4 +180,4 @@ document.addEventListener('DOMContentLoaded', async () => {
164180
}
165181
}
166182
}).observe(document.body, { childList: true, subtree: true })
167-
})
183+
}

fern/docs/pages/sdks/mobile/android/quickstart.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ To integrate the latest version of our SDK into your app, follow these steps:
4545
</Tab>
4646
</Tabs>
4747

48+
### Proguard rules
49+
50+
If you are using Proguard in your project, add the following lines to your configuration:
51+
```bash
52+
-keep class ai.devrev.** { *; }
53+
-keep class com.userexperior.* { *; }
54+
```
55+
4856
## Set up the DevRev SDK
4957

5058
1. Open the DevRev web app at [https://app.devrev.ai](https://app.devrev.ai) and go to the **Settings** page.
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Troubleshooting
22

3-
- **Issue**: Encountering problems with DevRev SDK integration.
4-
**Solution**: Verify the correct SDK dependency setup in the project. Ensure `mavenCentral` is accessible from the IDE.
3+
- **Issue**: Can't import the SDK into my app.
4+
**Solution**: Double-check the setup process and ensure that `mavenCentral()` is present in the project level repositories block.
55

6-
- **Issue**: The `showSupport()` function or XML button is unresponsive.
7-
**Solution**: Confirm that user identification is performed before using the `showSupport()` function or XML button.
6+
- **Issue**: How does the DevRev SDK handle errors?
7+
**Solution**: The DevRev SDK reports all errors using Android's logging utility. Look for error messages in Android Studio's Logcat after applying `DEVREV SDK` filter.
88

9-
- **Issue**: Incorrect operation due to `App ID` and `secret` misconfiguration.
10-
**Solution**: Double-check that both `App ID` and `secret` values are accurately configured in your application.
9+
- **Issue**: Support chat doesn't show.
10+
**Solution**: Ensure you have correctly called one of the identification methods: `DevRev.identifyUnverifiedUser(...)`, `DevRev.identifyVerifiedUser(...)`, or `DevRev.identifyAnonymousUser(...)`.
11+
12+
- **Issue**: Not receiving push notifications.
13+
**Solution**: Ensure that your app is configured to receive push notifications and that your device is registered with the DevRev SDK.

0 commit comments

Comments
 (0)