added special camera repository to start screen for android

This commit is contained in:
Joey Hess 2013-05-03 15:21:31 -04:00
parent 82b57b65cd
commit 33334bfe2e
5 changed files with 33 additions and 24 deletions

View file

@ -138,13 +138,22 @@ getFirstRepositoryR :: Handler RepHtml
getFirstRepositoryR = postFirstRepositoryR
postFirstRepositoryR :: Handler RepHtml
postFirstRepositoryR = page "Getting started" (Just Configuration) $ do
#ifdef __ANDROID__
androidspecial <- liftIO $ doesDirectoryExist "/sdcard/DCIM"
let path = "/sdcard/annex"
#else
let androidspecial = False
path <- liftIO . defaultRepositoryPath =<< lift inFirstRun
#endif
((res, form), enctype) <- lift $ runFormPost $ newRepositoryForm path
case res of
FormSuccess (RepositoryPath p) -> lift $
startFullAssistant $ T.unpack p
startFullAssistant (T.unpack p) ClientGroup
_ -> $(widgetFile "configurators/newrepository/first")
getAndroidCameraRepositoryR :: Handler ()
getAndroidCameraRepositoryR = startFullAssistant "/sdcard/DCIM" SourceGroup
{- Adding a new local repository, which may be entirely separate, or may
- be connected to the current repository. -}
getNewRepositoryR :: Handler RepHtml
@ -299,14 +308,13 @@ driveList = return []
{- Bootstraps from first run mode to a fully running assistant in a
- repository, by running the postFirstRun callback, which returns the
- url to the new webapp. -}
startFullAssistant :: FilePath -> Handler ()
startFullAssistant path = do
startFullAssistant :: FilePath -> StandardGroup -> Handler ()
startFullAssistant path group = do
webapp <- getYesod
url <- liftIO $ do
isnew <- makeRepo path False
u <- initRepo isnew True path Nothing
inDir path $
setStandardGroup u ClientGroup
inDir path $ setStandardGroup u group
addAutoStartFile path
changeWorkingDirectory path
fromJust $ postFirstRun webapp

View file

@ -21,8 +21,9 @@
/config/xmpp/needcloudrepo/#UUID NeedCloudRepoR GET
/config/addrepository AddRepositoryR GET
/config/repository/new/first FirstRepositoryR GET POST
/config/repository/new NewRepositoryR GET POST
/config/repository/new/first FirstRepositoryR GET POST
/config/repository/new/androidcamera AndroidCameraRepositoryR GET
/config/repository/switcher RepositorySwitcherR GET
/config/repository/switchto/#FilePath SwitchToRepositoryR GET
/config/repository/combine/#FilePathAndUUID CombineRepositoryR GET

View file

@ -12,22 +12,6 @@ webapp.
[[!toc ]]
## using the webapp
You can use the webapp on Android much the same as on any other
operating system, to set up the git-annex assistant.
The repository created by the webapp on your Android device is configured,
by default, as a "source" repository. This way, when you create a file on
Android (by, for example, taking a picture), it will be uploaded from your
Android device, and then its content removed from the device. This saves
storage space.
If you want to send files to your Android, and use them there, you should
edit the repository's configuration, and select "client". Bear in mind that
this will make it try to get every file placed in your repository on any
other computer, which might take up a lot of space.
## closing and reopening the webapp
The webapp does not need to be left open after you've set up your

View file

@ -23,3 +23,11 @@
jobs when low on battery or run flat out when plugged in.
* The app should be aware of network status, and avoid expensive data
transfers when not on wifi. This may need to be configurable.
* Jabber and Webdav configuration both fail with
"getProtocolByname: does not exist (no such protocol name: tcp)"
* Ssh server and Rsync.net configuration stops where ssh
should be prompting for a password in the terminal.
* Enabling debug logging in the webapp doesn't seem to work.
* S3, glacier, and local pairing are not yet enabled for Android.
* The "Files" link doesn't start a file browser. Should be possible to do
on Android via intents, I suppose?

View file

@ -3,9 +3,17 @@
Welcome to git-annex!
<p>
To get started, let's create a git-annex repository.
$if androidspecial
<p>
Files in this repository will be managed by git-annex, #
and kept in sync with your repositories on other devices.
Do you only want to share photos and videos you take?
<p>
<a .btn .btn-primary .btn-large href="@{AndroidCameraRepositoryR}">
<i .icon-camera></i> Make Camera Repository
<p>
$if androidspecial
Want to share more files? #
Files in this repository will be kept in sync with your #
repositories on other devices.
<p>
<form method="post" .form-inline enctype=#{enctype}>
^{form}