Giter Club home page Giter Club logo

fixmystreet-mobile's Introduction

FixMyStreet Mobile App

This is the FixMyStreet mobile app for reporting problems to an instance of the FixMyStreet platform - https://github.com/mysociety/fixmystreet.

You must have your FixMyStreet webserver up and running first: the mobile app ultimately sends reports via that. It is not a standalone service. For more information on FixMyStreet, see http://fixmystreet.org

It's still in development at the moment and only a small amount of time has been spent on making it re-brandable/re-usable so if you want to create your own version on top of it you may be in for a bumpy ride.

The FixMyStreet mobile app uses PhoneGap and has versions for Android and iOS.

Running

To get it up and running you will need to create www/js/config.js based on the www/js/config.js-example file. This has configuration for which FMS instance to use etc.

You should also create a config.xml file based on config.xml-example. The only change you should need to make is to add the hostname of your FMS installation in an <access origin=""/> tag.

You'll also need package.json and package-lock.json which can be similarly created from the -example files.

Setup

This project uses Apache Cordova to produce Android and iOS apps. There is some mildly complicated configuration and setup required to be able to develop with it. The following all assumes you're working on a Mac.

  1. Make sure you have the latest versions of XCode, JDK 1.8, the Android SDK, node and npm installed. It's a very good idea to have installed the Intel HAXM versions of the Android emulator because they're about 100 times faster to run. You need to download it from the Android SDK Manager (run android on the command line) and then actually run the .dmg that this creates in your sdk folder. (Alternatively brew cask install intel-haxm if you use Homebrew Cask.)

  2. Install the cordova CLI with npm: npm install -g cordova Note that this is not the same as the phonegap CLI and the two should not be mixed up. The latter gives you access to Adobe's proprietary phonegap build service, which we don't use!

  3. Install the latest android api and build tools packages within the Android SDK Manager (run android on the command line to launch it)

  4. Checkout the project

  5. cd into the project directory and run cordova prepare to load up the cordova platforms and plugins we use.

  6. Create a new 'Android Virtual Device' for emulating a real device by running android avd and using one of the 'Device Definitions' on the second tab as a template. It doesn't matter which one, but set the CPU type to 'Atom (x86)' otherwise it will be very very slow. Enable 'Use Host GPU', if available, to massively speed up the UI. Ticking 'Hardware keyboard present' will allow you to use your keyboard instead of hunting-and-pecking the on-screen keyboard.

  7. Copy www/js/config.js-example to www/js/config.js and edit if needed

  8. To run the project on one of the platforms, use: cordova emulate ios or cordova emulate android

Basic structure

  • www - JS, HTML, CSS and image files
  • templates - templates with strings to be translated
  • locale - gettext translation files
  • bin - helper scripts for translation

www Stucture

  • css - css files
  • js - project javascript files
  • js/views - backbone view files
  • js/models - backgone model files
  • jslib - third party javascript libraries and files
  • templates - underscore templates for the pages
  • cobrands - template overrides and stylesheets for your own cobrand

Cobranding

If you want to change the appearance of the app (e.g. to change the colour scheme, or provide your own FAQ/help text), you can use your own templates and stylesheets to achieve this.

Rather than editing the existing templates in www/templates/en, you should override the default template by placing your own version in www/cobrands/<cobrand name>/templates/en and set the CONFIG.COBRAND value appropriately in www/js/config.js.

For example to change the intro text that's shown when you first launch the app, set CONFIG.COBRAND to mycobrand and then copy www/templates/en/initial_help.html to www/cobrands/mycobrand/templates/en/initial_help.html and edit it with your new text.

To change the colour theme or other styles used in the app, create www/cobrands/mycobrand/css/style.css and add your own CSS rules. If CONFIG.COBRAND is set to mycobrand then this new CSS file will be included in the page HTML automatically.

Translation

We use gettext for translation with a series of templated files that use the Template Toolkit Perl module. The scripts are based on those used for the FixMyStreet website. In the templates directory are a set of page templates marked up for translation. These are parsed by the scripts and a set of strings to be translated are extracted. These strings are then used to generate a a set of .po files for each language under locales, which in turn generate a set of translated template files for use in the app. For more details see the translating file.

The app only supports one language at a time at the moment.

Tips and Tricks

  • Make sure you read the documentation for Cordova from http://cordova.apache.org/ not the Phonegap site - the two vary in infuriating and subtle ways and much of the stackoverflow-esque info on the web is confused about which one it's for. Particularly in the options for things in config.xml which is where all the magic happens.
  • You can use ios-sim to launch the iOS emulator directly with something like: ios-sim launch platforms/ios/build/emulator/FixMyStreet.app --devicetypeid "com.apple.CoreSimulator.SimDeviceType.iPhone-6, 8.0" after you've built the project via a previous emulator run or a direct build via cordova build ios. This allows you to specify a different device than the default one. To see the available options for --devicetypeid run ios-sim showdevicetypes.
  • You can open the iOS project in XCode if you prefer to run it that way, the project file is in platforms/ios
  • To check the console log output when emulating iOS, run: tail -f console.log Cordova by default writes it out to that file in your project root
  • To check the console log output when emulating Android, cd to platforms/android/cordova and run ./log. I found that I needed to be in the directory for it to actually print anything, YMMV.
  • Leave the emulators running once they start, it's much quicker!

Upgrading

Cordova now includes version numbers for the platforms and plugins in config.xml so it's possible to use the command line tools to update everything.

  1. Update the CLI: npm update cordova
  2. Update each platform: cordova platform update ios --save, cordova platform update android --save
  3. Update each plugin. Unfortunately, it doesn't seem possible to upgrade all of the plugins in one go, so you'll have to type out cordova plugin update cordova-plugin-name --save for every single one. You can get a list that's easy to edit into a script from cordova plugin list.
  4. Refer to the upgrade guides: https://cordova.apache.org/docs/en/latest/guide/platforms/android/upgrade.html and https://cordova.apache.org/docs/en/latest/guide/platforms/ios/upgrade.html for anything you need to change between versions. The plugins helpfully print notices for some things that have changed when you install them.
  5. Test the changes

Releasing

Android

To release the app on Android, you need to do the following:

  1. Change your config.js to include production settings
  2. Bump the version code in config.xml, both the main one and the android specific one
  3. Clone the mySociety keys repository
  4. Build a release version of the app: cordova build android --release -- --keystore="/path/to/keys_repo/android/android_keystore" --alias=<fixmystreet|cuidomiciudad|etc>

iOS

App Store

To release the app in the iTunes App Store you need to do the following:

  1. Change your config.js to include production settings
  2. Bump the version code in config.xml, both the main one and the android specific one
  3. Run the emulator to make sure you've built the latest version of the app: cordova emulate ios
  4. Open the app in XCode (the xcodeproj project file you need is in platforms/ios)
  5. Select Product > Archive from the XCode menu
  6. In the "navigator" window that pops up, select the latest build and then hit "Validate" in the top right. It'll ask to access your keychain, so you'll need to make sure you've installed the latest certificates there already.
  7. Once the validation has finished, hit "Submit" and pick the certificate again to actually send it to Apple.
  8. Now you need to log into iTunes Connect and add a new version of the app for this build, then submit it for review.

Ad-Hoc Distribution

iOS allows you to distribute builds of your app directly to selected testers, either by sending them the .ipa file for installation via iTunes or via a specially-crafted web page they visit from their device. More info.

  1. Gather the device UDIDs from testers and add them to the 'devices' section of the developer center.
  2. You'll probably have to re-download the provisioning profile for the app into Xcode so subsequent builds include the new device UDIDs.
  3. Open the .xcodeproj file in Xcode and run Product > Archive
  4. Select the archive in the Organizer window that subsequently pops up, then click Export and select Save for Ad Hoc Deployment.
  5. Follow the wizard, selecting Export one app for all compatible devices, and Include manifest for over-the-air installation.
  6. The wizard will ask you to provide values for the App URL, and a couple of image URLs. Put dummy values in if you don't know the final URLs for the .ipa and images yet, you can edit the output manifest file later.
  7. Copy the resulting .ipa and manifest to your webserver. Make sure they're served over HTTPS or iOS will refuse to install the app.
  8. Users can install the app on their devices by going to a URL of the form itms-services://?action=download-manifest&url=[MANIFEST URL HERE]

fixmystreet-mobile's People

Contributors

davea avatar dracos avatar jedidiah avatar joesiltberg avatar jonkri avatar mhl avatar struan avatar tursics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fixmystreet-mobile's Issues

'Remind me later' bookmark function for FMS mobile

Once the new version of FMS mobile is launched, I would like to be able to bookmark a page. When I load this page on my phone, it notes where I am and stores it for later. Then at some point when it thinks I am sitting down (mid evening?), it drops me a mail with a link to a page where I can fill in all the rest of the details in my report, and send it off. Basically, a quick button for reminding me to report problems later.

Fix radar screen

Upon app loading it briefly shows the radar screen, but it only occupies about the top left 2/3 of the screen.

Improve the FixMyStreet Mobile Game

The game that we built at the Christmas hack day isn't really finished. ( URL http://fmsgame.mysociety.org ). In particular:

  • It needs to only return older/old problems; it is currently returning the newest around a location - need API for looking up reports, even if it's an API of RSS feeds.
  • All the text needs improving, and perhaps the URL.
  • We should have users chase down problems that have been marked fixed by councils, to check if they are marking things as fixed that are not actually fixed.

iPhone app: allow photos to be added retrospectively

Comment from user:
"You have to take the photo as you're actually
completing the info about the problem - often I've taken a pic, then stopped
further along the path/road when it's safe to do so and used the fix my
street app and it doesn't seem to let me upload retrospectively if you see
what I mean."

Black text on buttons at top sometimes goes white

I can't reproduce this reliably, but a few times I've managed to get into a condition where one of the buttons at the top has white text, or text that flickers between black and white as I drag the map. See attached screenshot ('Drafts' button).
photo

Many map tiles are not loading

Android Jellybean - many map tiles are not loading even on a good wifi connection. No obvious pattern as to why some are loading and some aren't.

Fix proportions of placeholder photo

On the 'add a photo' page the placeholder photo image is stretched on my phone (just a bit) so the camera lens isn't circular. Please change it so it is fixed proportions.

No email confirmation when using Android App

Make the android (and probably iPhone) app handle the entire process of reporting an issue without having to wait for an email and then follow a link to the website.

(this probably requires having some kind of login - for the android app accepting a Google login would probably do, since almost anyone using an android phone will have a Google account).

Create way to allow app store approval testing without creating fake reports

May just be as simple as asking app store reported not to confirm reports however that means they cannot test login.

Another option is a list of service types in general.yml that are marked as hidden by send_reports as the service type for the iPhone app is not used elsewhere. This can then be removed from the list when the app has been confirmed.
This would not solve the problem for submitting updates though.

Change success page text

Currently says "Your report has been created"

Change to:

"Thanks. Your report will be sent to the authorities immediately."

And centre the text 'view it on the site'

Fix strange login error message

I've just successfully logged into the app, half way through the problem reporting process. Despite hving succeeded in logging in, the words referred to an error (which has now vanished). THen it says 'cofirmation email sent', which is wrong given that I'm logged in.

Change drafts menu when there are no drafts

Change 'my reports' text in the header to say 'Incomplete reports'
Change 'draft reports' in the body to say 'If you start compiling a report, but don't finish and send it, it'll appear in this menu so you can finish it later'.

User suggestion: batch reporting

Feedback via email:
I think a batch reporting mode is really needed or an easy way to create a list of locations that could then be uploaded directly to the site and gone through rather than always being done from the phone itself.

Improve the mobile apps

Features that could/should be implemented include offline reporting (working when not online/storing reports for submission/review), a shinier UI, a map showing other people's problems, the ability to leave updates on problems, and integration with user accounts. Also perhaps the ability to choose photos that have already been taken.

As a first step, the apps should be updated to match the new mobile design, though offline reporting/user account remembering are certainly things to be considered.

Cancelling shouldn't save a draft

Starting a report and then clicking 'cancel' doesn't feel like it should save a draft. Perhaps 'are you should you want to cancel this report?', or explicitly calling that button 'save a draft'.

Fix ambiguous email/password error

Upon setting a password and confirming my name/phone number, it briefly shows a loading spinner, then returns the error 'there was a problem with your email/password'. It doesn't tell me what, though, so I am stuck.

Additional strange behaviour. I was just on this error screen, let my phone lock itself. Upon unlock it shows 'confirmation email sent', which is a surprise.

Crosshairs vanishes

Upon leaving app or letting the phone lock.Not sure exactly what is going on before this happens, sorry

Refinements to Android app

Suggestions via Twitter:

" I'd [..] like to see 'problems reported nearby' and 'my reports' as well as the ability to choose between saving a draft and actually finishing a report all together in the android app as well as on the browser interface."

Android app: handle GPS better

  1. Don't register a GPS handler on startup, only when you're about to use it
  2. Once the GPS handler has got a fix, save it into session data with system time - then onResume, check whether there's already a recent fix

Android mobile app - GPS control

Very irritating having to wait for GPS to lock on after taking photo of fault.

I suggest either enable GPS when app is opened, or when selecting photo taking. This would allow the GPS location to be associated with the photo (although in error by the distance of the user from the fault) , and so allow the user to move away whilst completing the further details of the report. This would be a very useful safety and convenience issue as often faults have to photographed from the middle of a road or other poor location.

Set up templates to use translation

See zurich mobile app for details on this.

  • Mark up templates with translation code
  • add translation management scripts
  • add code to allow translation/template set to be selected

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.