-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(example): add features and buttons implementation (#1280)
Jira ID: RL-224
- Loading branch information
1 parent
f4d097a
commit bb42692
Showing
10 changed files
with
351 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React, { useState } from 'react'; | ||
import { ActivityIndicator } from 'react-native'; | ||
import Instabug from 'instabug-reactnative'; | ||
import { ListTile } from '../components/ListTile'; | ||
import { Screen } from '../components/Screen'; | ||
import { showNotification } from '../utils/showNotification'; | ||
|
||
export const LegacyModeScreen: React.FC = () => { | ||
const [loading, setLoading] = useState(false); | ||
|
||
const addMultipleInstabugLogs = async (numberOfLogs: number) => { | ||
setLoading(true); | ||
try { | ||
for (let i = 0; i < numberOfLogs; i++) { | ||
Instabug.logDebug(`log ${i}`); | ||
} | ||
showNotification('Success', 'Succeeded'); | ||
} catch (error) { | ||
showNotification('Error', 'Failed'); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
const addMultipleUserEvents = async (numberOfLogs: number) => { | ||
setLoading(true); | ||
try { | ||
for (let i = 0; i < numberOfLogs; i++) { | ||
Instabug.logUserEvent(`test user event ${i}`); | ||
} | ||
showNotification('Success', 'Succeeded'); | ||
} catch (error) { | ||
showNotification('Error', 'Failed'); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
const addMultipleTags = async (numberOfLogs: number) => { | ||
setLoading(true); | ||
try { | ||
for (let i = 0; i < numberOfLogs; i++) { | ||
Instabug.appendTags([`test tag ${i}`]); | ||
} | ||
showNotification('Success', 'Succeeded'); | ||
} catch (error) { | ||
showNotification('Error', 'Failed'); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
const addMultipleUserAttributes = async (numberOfLogs: number) => { | ||
setLoading(true); | ||
try { | ||
for (let i = 0; i < numberOfLogs; i++) { | ||
Instabug.setUserAttribute(`user${i}`, `user${i} value`); | ||
} | ||
showNotification('Success', 'Succeeded'); | ||
} catch (error) { | ||
showNotification('Error', 'Failed'); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<Screen> | ||
{loading && <ActivityIndicator size="large" color="#0000ff" />} | ||
|
||
<ListTile | ||
title="Attach 10 InstabugLogs at a time" | ||
onPress={() => addMultipleInstabugLogs(10)} | ||
/> | ||
<ListTile title="Attach 10 events at a time" onPress={() => addMultipleUserEvents(10)} /> | ||
<ListTile title="Attach 10 tags at a time" onPress={() => addMultipleTags(10)} /> | ||
<ListTile | ||
title="Attach 10 user attributes at a time" | ||
onPress={() => addMultipleUserAttributes(10)} | ||
/> | ||
</Screen> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.