Mobile share_target: move to /launch

This commit is contained in:
Enrico Ros
2023-10-15 23:53:00 -07:00
parent 9a851e342f
commit 85562b5888
4 changed files with 17 additions and 14 deletions
+14 -7
View File
@@ -11,9 +11,7 @@ import { AppLayout } from '~/common/layout/AppLayout';
import { asValidURL } from '~/common/util/urlUtils';
function LogoProgress(props: {
showProgress: boolean
}) {
function LogoProgress(props: { showProgress: boolean }) {
return <Box sx={{
width: 64,
height: 64,
@@ -30,7 +28,16 @@ function LogoProgress(props: {
}
function AppShare() {
/**
* This page will be invoked on mobile when sharing Text/URLs/Files from other APPs
* See the /public/manifest.json for how this is configured. Parameters:
* - text: the text to share
* - url: the URL to share
* - if the URL is a valid URL, it will be downloaded and the content will be shared
* - if the URL is not a valid URL, it will be shared as text
* - title: the title of the shared content
*/
function AppShareTarget() {
// state
const [errorMessage, setErrorMessage] = React.useState<string | null>(null);
const [intentText, setIntentText] = React.useState<string | null>(null);
@@ -140,12 +147,12 @@ function AppShare() {
/**
* This page will be invoked on mobile when sharing Text/URLs/Files from other APPs
* Example URL: https://get.big-agi.com/share?title=This+Title&text=https%3A%2F%2Fexample.com%2Fapp%2Fpath
* Example URL: https://get.big-agi.com/launch?title=This+Title&text=https%3A%2F%2Fexample.com%2Fapp%2Fpath
*/
export default function SharePage() {
export default function LaunchPage() {
return (
<AppLayout>
<AppShare />
<AppShareTarget />
</AppLayout>
);
}
+1 -1
View File
@@ -25,7 +25,7 @@
}
],
"share_target": {
"action": "/share",
"action": "/launch",
"method": "GET",
"enctype": "application/x-www-form-urlencoded",
"params": {
@@ -188,7 +188,7 @@ export function Composer(props: {
}, shallow);
const { chatLLMId, chatLLM } = useChatLLM();
// Effect: load initial text if queued up (e.g. by /share)
// Effect: load initial text if queued up (e.g. by /launch)
React.useEffect(() => {
if (startupText) {
setStartupText(null);
+1 -5
View File
@@ -12,7 +12,7 @@ import { setLayoutMenuAnchor } from './store-applayout';
// routes for the quick switcher menu item
type ContainedAppType = 'chat' | /*'data' |*/ 'news' /*| 'share'*/;
type ContainedAppType = 'chat' | /*'data' |*/ 'news';
const AppItems: ContainedAppType[] = ['chat', 'news'];
@@ -25,10 +25,6 @@ const AppRouteMap: { [key in ContainedAppType]: { name: string, route: string }
// name: 'Data',
// route: '/data',
// },
// 'share': {
// name: 'Share',
// route: '/share',
// },
'news': {
name: 'News',
route: '/news',