Skip to content

Commit 26263d7

Browse files
committed
added chatAI feature for android
1 parent 160e3c5 commit 26263d7

File tree

14 files changed

+1416
-1021
lines changed

14 files changed

+1416
-1021
lines changed

apps/box/.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"runtime": "automatic"
1313
}
1414
],
15+
"@babel/plugin-transform-class-static-block",
1516
"react-native-reanimated/plugin",
1617
["@babel/plugin-proposal-export-namespace-from"]
1718
]

apps/box/android/app/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ android {
8282
applicationId "land.fx.blox"
8383
minSdkVersion rootProject.ext.minSdkVersion
8484
targetSdkVersion rootProject.ext.targetSdkVersion
85-
versionCode 231
86-
versionName "1.6.31"
85+
versionCode 232
86+
versionName "1.6.32"
8787
// buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
8888

8989
testBuildType System.getProperty('testBuildType', 'debug')
@@ -127,7 +127,11 @@ android {
127127
}
128128
}
129129
}
130-
130+
sourceSets {
131+
main {
132+
jniLibs.srcDirs = ['src/main/jniLibs']
133+
}
134+
}
131135
}
132136

133137
dependencies {
3.63 MB
Binary file not shown.
3.63 MB
Binary file not shown.

apps/box/android/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ buildscript {
1414
repositories {
1515
google()
1616
mavenCentral()
17+
maven { url 'https://jitpack.io' }
1718
}
1819
dependencies {
1920
classpath("com.android.tools.build:gradle")
@@ -31,7 +32,7 @@ allprojects {
3132
repositories {
3233
google()
3334
mavenCentral()
34-
maven { url 'https://www.jitpack.io' }
35+
maven { url 'https://jitpack.io' }
3536
}
3637
}
3738
// @generated begin detox-import - expo prebuild (DO NOT MODIFY) sync-1c7ed0e9d1c19e4a2b5b79bb7ec877ac879fce8d
Lines changed: 39 additions & 0 deletions
Loading

apps/box/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "box",
3-
"version": "1.6.30",
3+
"version": "1.6.32",
44
"private": true,
55
"dependencies": {
66
"@functionland/fula-sec": "*",
@@ -79,7 +79,9 @@
7979
"ethers": "*",
8080
"whatwg-fetch": "*",
8181
"react-native-permissions": "*",
82-
"base-64": "*"
82+
"base-64": "*",
83+
"react-native-syntax-highlighter": "*",
84+
"react-syntax-highlighter": "*"
8385
},
8486
"devDependencies": {
8587
"@types/react-native-background-timer": "^2.0.2"

apps/box/src/components/GlobalBottomSheet.tsx

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import {
1010
} from '@functionland/component-library';
1111
import { SCREEN_WIDTH, SCREEN_HEIGHT } from '../constants/layout';
1212
import { DynamicIcon } from '../components';
13-
import { useMainTabsNavigation } from '../hooks';
13+
import { useMainTabsNavigation, useRootNavigation } from '../hooks';
1414
import { Routes } from '../navigation/navigationConfig';
1515
import { usePluginsStore } from '../stores/usePluginsStore'; // Import the plugins store
16+
import { SvgUri } from 'react-native-svg';
1617

1718
type Plugin = {
1819
name: string;
1920
'icon-path': string;
21+
'icon-file'?: string;
2022
};
2123

2224
type GlobalBottomSheetProps = {
@@ -28,6 +30,7 @@ export const GlobalBottomSheet = React.forwardRef<
2830
GlobalBottomSheetProps
2931
>((_, ref) => {
3032
const navigation = useMainTabsNavigation();
33+
const navigationRoot = useRootNavigation();
3134
const theme = useFxTheme();
3235
const itemWidth = (SCREEN_WIDTH - APP_HORIZONTAL_PADDING * 2) / 4;
3336
const [plugins, setPlugins] = useState<Plugin[]>([]);
@@ -52,31 +55,43 @@ export const GlobalBottomSheet = React.forwardRef<
5255
<FxBottomSheetModal ref={ref}>
5356
<FxBox height={SCREEN_HEIGHT * 0.75}>
5457
<FxText variant="bodyMediumRegular">Plugins</FxText>
55-
<FxBox paddingVertical="20">
56-
{plugins.map((plugin) => (
57-
<FxPressableOpacity
58-
key={plugin.name}
59-
width={itemWidth}
60-
alignItems="center"
61-
marginVertical="4"
62-
paddingVertical="4"
63-
onPress={() => {
64-
_.closeBottomSheet();
65-
navigation.navigate(Routes.PluginTab, { name: plugin.name });
66-
}}
67-
>
58+
<FxBox paddingVertical="20" flexDirection="row" flexWrap="wrap">
59+
{plugins.map((plugin) => (
60+
<FxPressableOpacity
61+
key={plugin.name}
62+
width={itemWidth}
63+
alignItems="center"
64+
marginVertical="4"
65+
paddingVertical="4"
66+
onPress={() => {
67+
_.closeBottomSheet();
68+
navigation.navigate(Routes.PluginTab, { name: plugin.name });
69+
}}
70+
>
71+
{plugin['icon-path'] ? (
6872
<DynamicIcon
6973
iconPath={plugin['icon-path']}
7074
fill={theme.colors.primary}
7175
/>
72-
<FxText marginTop="4">{plugin.name}</FxText>
73-
{activePlugins.includes(plugin.name) && (
74-
<FxText variant="bodyXSLight" color="greenBase" marginTop="0">
75-
Installed
76-
</FxText>
77-
)}
78-
</FxPressableOpacity>
79-
))}
76+
) : plugin['icon-file'] ? (
77+
<SvgUri
78+
uri={plugin['icon-file']}
79+
width={itemWidth}
80+
height={24}
81+
fill={theme.colors.primary}
82+
style={{ alignSelf: 'center', padding: 0, margin: 0 }}
83+
/>
84+
) : null}
85+
86+
<FxText marginTop="4">{plugin.name}</FxText>
87+
88+
{activePlugins.includes(plugin.name) && (
89+
<FxText variant="bodyXSLight" color="greenBase" marginTop="0">
90+
Installed
91+
</FxText>
92+
)}
93+
</FxPressableOpacity>
94+
))}
8095
</FxBox>
8196
</FxBox>
8297
</FxBottomSheetModal>

apps/box/src/navigation/MainTabs.navigator.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import { BloxScreen } from '../screens/Blox/Blox.screen';
1010
import { PluginScreen } from '../screens/Plugin.screen';
1111
import { DevicesScreen } from '../screens/Devices.screen';
1212
import { UsersScreen } from '../screens/Users/Users.screen';
13+
import ChatAIScreen from '../screens/ChatAI.screen';
1314
import {
1415
BloxIcon,
1516
UserIcon,
1617
// HubIcon,
1718
DevicesIcon,
1819
SettingsIcon,
1920
} from '../components';
21+
import { SvgUri } from 'react-native-svg';
2022
import {
2123
Routes,
2224
MainTabsParamList,
@@ -71,11 +73,11 @@ export const MainTabsNavigator = () => {
7173
const [scanning, setScanning] = useState(false);
7274

7375
const openGlobalBottomSheet = () => {
74-
globalBottomSheetRef.current.present();
76+
globalBottomSheetRef.current?.present();
7577
};
7678

7779
const closeGlobalBottomSheet = () => {
78-
globalBottomSheetRef.current.close();
80+
globalBottomSheetRef.current?.close();
7981
};
8082

8183
const isValidIp = (ip: string): boolean => {
@@ -239,6 +241,22 @@ export const MainTabsNavigator = () => {
239241
},
240242
})}
241243
/>
244+
<MainTabs.Screen
245+
name={Routes.ChatAITab}
246+
component={ChatAIScreen}
247+
options={{
248+
tabBarIcon: ({ color }) => (
249+
<SvgUri
250+
uri="https://raw.githubusercontent.com/functionland/fx-components/main/apps/box/assets/icons/chatai-icon.svg"
251+
width={24}
252+
height={24}
253+
fill={color}
254+
style={{ alignSelf: 'center', padding: 0, margin: 0 }}
255+
/>
256+
),
257+
tabBarLabel: 'ChatAI',
258+
}}
259+
/>
242260
<MainTabs.Screen
243261
name={Routes.DevicesTab}
244262
component={DevicesScreen}

apps/box/src/navigation/navigationConfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export enum Routes {
1111
MainTabs = 'MainTabs',
1212
Hub = 'Hub',
1313
Plugin = 'Plugin',
14+
ChatAI = 'ChatAI',
1415

1516
// Initial Setup
1617
Welcome = 'Welcome',
@@ -30,6 +31,7 @@ export enum Routes {
3031
PluginTab = 'PluginTab',
3132
DevicesTab = 'DevicesTab',
3233
SettingsTab = 'SettingsTab',
34+
ChatAITab = 'ChatAITab',
3335

3436
// Settings Stack
3537
Settings = 'Settings',
@@ -61,6 +63,7 @@ export type RootStackParamList = {
6163
[Routes.MainTabs]: NavigatorScreenParams<MainTabsParamList>;
6264
[Routes.Hub]: undefined;
6365
[Routes.Plugin]: undefined;
66+
[Routes.ChatAI]: undefined;
6467
};
6568

6669
export type MainTabsParamList = {
@@ -71,6 +74,7 @@ export type MainTabsParamList = {
7174
[Routes.DevicesTab]: undefined;
7275
[Routes.SettingsTab]: NavigatorScreenParams<SettingsStackParamList>;
7376
[Routes.InitialSetup]: undefined;
77+
[Routes.ChatAITab]: undefined;
7478
};
7579

7680
export type SettingsStackParamList = {

0 commit comments

Comments
 (0)