-
Notifications
You must be signed in to change notification settings - Fork 40
[MOB-12260] create-embedded-tab-in-example-app #741
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
lposen
wants to merge
6
commits into
loren/embedded/master
Choose a base branch
from
loren/embedded/MOB-12260-create-embedded-tab-in-example-app
base: loren/embedded/master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1ac7370
docs: add Embedded component to example app
lposen f81b52d
Merge branch 'jwt/MOB-12298-new-improve-logger' into loren/embedded/M…
lposen f456e20
feat: add Embedded tab to Main component in example app
lposen 28173ed
Merge branch 'loren/embedded/master' into loren/embedded/MOB-12260-cr…
lposen 0be3376
Merge branch 'loren/embedded/master' into loren/embedded/MOB-12260-cr…
lposen 25ec86d
feat: add chat icon to route configuration in App.constants.ts
lposen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,16 +1,59 @@ | ||
| /* eslint-disable react-native/split-platform-components */ | ||
| import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
| import { useEffect } from 'react'; | ||
| import { PermissionsAndroid, Platform } from 'react-native'; | ||
|
|
||
| import { Route } from '../../constants/routes'; | ||
| import { useIterableApp } from '../../hooks/useIterableApp'; | ||
| import type { RootStackParamList } from '../../types'; | ||
| import { Login } from '../Login'; | ||
| import { Main } from './Main'; | ||
| import type { RootStackParamList } from '../../types'; | ||
|
|
||
| const Stack = createNativeStackNavigator<RootStackParamList>(); | ||
|
|
||
| const requestNotificationPermission = async () => { | ||
| if (Platform.OS === 'android') { | ||
| const apiLevel = Platform.Version; // Get the Android API level | ||
|
|
||
| if (apiLevel >= 33) { | ||
| // Check if Android 13 or higher | ||
| try { | ||
| const granted = await PermissionsAndroid.request( | ||
| PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS, | ||
| { | ||
| title: 'Notification Permission', | ||
| message: | ||
| 'This app needs access to your notifications for push, in-app messages, embedded messages and more.', | ||
| buttonNeutral: 'Ask Me Later', | ||
| buttonNegative: 'Cancel', | ||
| buttonPositive: 'OK', | ||
| } | ||
| ); | ||
| if (granted === PermissionsAndroid.RESULTS.GRANTED) { | ||
| console.log('Notification permission granted'); | ||
| } else { | ||
| console.log('Notification permission denied'); | ||
| } | ||
| } catch (err) { | ||
| console.warn(err); | ||
| } | ||
| } else { | ||
| // For Android versions below 13, notification permission is generally not required | ||
| // or is automatically granted upon app installation. | ||
| console.log( | ||
| 'Notification permission not required for this Android version.' | ||
| ); | ||
| } | ||
| } | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }; | ||
|
|
||
| export const App = () => { | ||
| const { isLoggedIn } = useIterableApp(); | ||
|
|
||
| useEffect(() => { | ||
| requestNotificationPermission(); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <Stack.Navigator> | ||
| {isLoggedIn ? ( | ||
|
|
||
This file contains hidden or 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 hidden or 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,21 @@ | ||
| import { StyleSheet } from 'react-native'; | ||
| import { button, buttonText, container, hr } from '../../constants'; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| button, | ||
| buttonText, | ||
| container: { ...container, paddingHorizontal: 0 }, | ||
| embeddedSection: { | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| gap: 16, | ||
| paddingHorizontal: 16, | ||
| }, | ||
| hr, | ||
| text: { textAlign: 'center' }, | ||
| utilitySection: { | ||
| paddingHorizontal: 16, | ||
| }, | ||
| }); | ||
|
|
||
| export default styles; |
This file contains hidden or 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,13 @@ | ||
| import { Text, View } from 'react-native'; | ||
|
|
||
| import styles from './Embedded.styles'; | ||
|
|
||
| export const Embedded = () => { | ||
| return ( | ||
| <View style={styles.container}> | ||
| <Text style={styles.text}>EMBEDDED</Text> | ||
| </View> | ||
| ); | ||
| }; | ||
|
|
||
| export default Embedded; |
This file contains hidden or 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 @@ | ||
| export * from './Embedded'; |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| export * from './colors'; | ||
| export * from './containers'; | ||
| export * from './formElements'; | ||
| export * from './miscElements'; | ||
| export * from './shadows'; | ||
| export * from './typography'; |
This file contains hidden or 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,9 @@ | ||
| import { type ViewStyle } from 'react-native'; | ||
| import { colors } from './colors'; | ||
|
|
||
| export const hr: ViewStyle = { | ||
| backgroundColor: colors.borderPrimary, | ||
| height: 1, | ||
| marginVertical: 20, | ||
| marginHorizontal: 0, | ||
| }; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.