Code Monkey home page Code Monkey logo

ibm / bluepic Goto Github PK

View Code? Open in Web Editor NEW
325.0 34.0 72.0 120.37 MB

WARNING: This repository is no longer maintained :warning: This repository will not be updated. The repository will be kept available in read-only mode.

Home Page: https://developer.ibm.com/code/patterns

License: Apache License 2.0

Swift 78.71% Objective-C 1.25% Ruby 0.06% Shell 8.34% HTML 3.46% JavaScript 5.56% CSS 2.24% Dockerfile 0.37%
bluemix-service kitura swift ibm-cloud patterns ibmcode

bluepic's Issues

Bug found and fixed in BSMSecurity's AuthorizationRequestManager.swift

Fixed bug in their code line 326 in the AuthorizationRequestManager.swift... It was:

guard let unWrappedObj = obj else {
return nil
}

When it was like this it was causing a "ambiguous use of subscript" error

I changed this code to:

guard let unWrappedObj = obj as? [String] else {
return nil
}

It was trying to treat an anyobject as an array, which you can't. So I casted it as an optional array of strings. Fixed the issue

Build search view controller on iOS app.

As a user of the iOS app, I should be able to select or enter a text tag to look up images. Images that Watson has tagged with the chosen text tags should then be returned.

Implement OpenWhisk integration [on the server side] for Weather APIs.

  • The inputs are: 1) the geolocation (latitude and longitude values) where the picture was taken, 2) the units of measure to use (imperial vs. metric), 3) the language locale (e.g. en-US), and 4) the record ID for the corresponding image record in the Cloudant database.
  • The output from the Weather API integration is the current weather condition for the given geolocation. Specifically, the "temp" and "sky_cover" (current condition) values from the output should be stored in the corresponding Cloudant JSON image record. Each JSON image record has a location JSON object, which contains a temperature field and a weather field.

Leverage MCA server SDK to secure backend endpoints.

Secure only the following endpoints using the new MCA SDK for the server:

  • get("/users/:userId")
  • get("/users")
  • post("/users/:userId/images/:fileName/:caption/:width/:height/:latitude/:longitude/:location")
  • post("/users")

Please note that securing the /users/:userId/images/:fileName/:caption/:width/:height/:latitude/:longitude/:location POST endpoint implies that:

  • The userId (Facebook ID) is retrieved from the MCA server SDK.
  • Simple logic should then be implemented to validate that the userId request parameter in the URL matches the Facebook ID retrieved through the MCA SDK on the server. If they don't match, then we throw an error (user is not authorized). For the other endpoints listed above, we don't need to perform this validation.

Implement OpenWhisk integration to invoke REST endpoint on Kitura to kick off Push notification.

  • Once the AlchemyVIsion API and Weather API OpenWhisk interactions have completed, a push notification should be generated to let the user know that the system has saved metatada for the picture he/she uploaded.
  • An POST endpoint (/push/images/:imageId) is already defined on the Kitura-based server that should be invoked by the OpenWhisk sequence (as the last step) to send the push notification to the iOS client. The Kitura-based server will then use the Push SDK (Swift 3) to send out the push notification. The last item/value in this endpoint should be the imageId of JSON image document stored in Cloudant.

Rename all instances of KituraBluePic to BluePic inside iOS project/folder.

See following list of files/folders:
drwxr-xr-x 19 olivieri staff 646 Apr 15 11:45 KituraBluePic
drwxr-xr-x 5 olivieri staff 170 Apr 15 11:45 KituraBluePic.xcodeproj
drwxr-xr-x 3 olivieri staff 102 Apr 15 11:45 KituraBluePic.xcworkspace
drwxr-xr-x 4 olivieri staff 136 Apr 15 11:45 KituraBluePicTests
drwxr-xr-x 4 olivieri staff 136 Apr 15 11:45 KituraBluePicUITests

Once files/folders renamed, update .gitignore accordingly.

Implement OpenWhisk integration [on the server side] for Alchemy Vision APIs.

  • The inputs are: 1) image/picture (NSData) and 2) the image record ID for the corresponding record in the Cloudant database.
  • The AlchemyVision API is then used to process the image to perform object and scene recognition.
  • The output from the AlchemyVision is a list that contains one or more classifications along with the confidence level (e.g. "dog", 99%). This output should be stored in the corresponding image JSON document in Cloudant under the tags field.
  • There's a new method in the RouteUtils.swift file (invokeOpenWhisk()) that will server as the starting point for kicking off the OpenWhisk sequence.

Error when running on physical phone.

Even after upgrading to the latest iOS version, it still complains on one line in the AuthorizationRequestionManager.swift saying “Ambiguous use of subscript".

We may have to reach out to Matt/Anton on this one.

Implement "build" bash script for OS X App.

We need to implement a shell script for OS X that installs any system dependencies needed for running the BluePic sever using homebrew. This script should also start the BluePic server (more details to come). It is assumed that homebrew has already been installed by the user. It is also assumed that the Swift binaries were installed by the user.

Command for installing depedencies:
brew install http-parser curl

Command for building the project:
make clean
make

Command for starting the server:
/.build/debug/Server

Let's put this script at the root level of the repo.

Reinstate approach for checking in Pods (like we did in MIL/BluePic) into the repo.

To improve the developer experience, let's reinstate the approach we used for MIL/BluePic:

  • Check in the Pods directory into source control. In other words, as part of setting up the Xcode project, you run the "pod install" command on your system, and then you push to Git everything. Developers that pull the Xcode project from Git can compile the project right away, without having to install any pods.

The current approach puts the responsibility on the developer to install the Pods themselves.

Benefits with this approach (see this URL: https://guides.cocoapods.org/using/using-cocoapods.html):

image

Create an Xcode workspace that contains both projects, iOS and Kitura-based server.

There should be at least two schemes:

  • One for building the iOS project.
  • One for building the Kitura-based project.

The schemes/targets should be set up accordingly to ensure the right projects are built.

Let's try to have the workspace file at the root folder of the repo (as a peer to the BluePic-iOS and BluePic-Server folders).

Clarification: Schemes cannot be bound to a specific toolchain. Instead, the developer will have to manually switch the toolchain depending on the project they want to work on (iOS vs. Server).

Restructure this repo.

Restructure repo as follows:

  1. Rename these folders:
  • KituraBluePic-iOS -> BluePic-iOS
  • KituraBluePic-server -> BluePic-server
  1. As peer to the BluePic-iOS and BluePic-server folders, create a new folder:
  • BluePic-OpenWhisk

3) Delete current .gitmodules file. (let's keep this file for now)

Details:

  • BluePic-iOS will contain the iOS app source code. For the development of this component, we will use the Swift 2.2 toolchain.
  • BluePic-server will contain the Kitura-based server component. This folder should contain a valid SPM Swift package. For the development of this component, we will use the Swift 3 development toolchain.
  • BluePic-OpenWhisk - This folder contains any Swift code for the implementation of OpenWhisk actions/sequenences. Note that this is not a SPM Swift package or an Xcode project.

Migrate iOS project from MIL/BluePic into this repo.

This view/page does not exist in the MIL/BluePic version. This page was added to the Kitura-BluePic version. Though this page made sense for that effort, for this new embodiment of BluePic, we don't have a use case for it.

Create initial Bluemix app with necessary services.

App has been created and can be accessed here: https://console.ng.bluemix.net/?direct=classic/#/resources/orgGuid=0cdab6d0-7ec0-470c-a97f-0e26f6228cbf&spaceGuid=4c549a92-b20e-419b-b5b1-fb58daf4af2c&appGuid=75eef52c-2ed1-4518-9587-ce55cc66479d&detailType=overview&paneId=2

App has the following services: Cloudant, Object Storage, Mobile Client Access, and Push.

App route: http://IBM-BluePic.mybluemix.net
App GUID: 75eef52c-2ed1-4518-9587-ce55cc66479d

This app uses Node.js as the server for now. We won't be adding any logic to this Node.js instance (we just needed a web server to create a CF app). We will be yanking out this Node.js server and replacing it with a Kitura-based server.

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.