Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of the "desktop-and-mobile/" sample #5

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions desktop-and-mobile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Desktop and Mobile
### This is a sample of a desktop and mobile integration of the same application.

Desktop
=======

For the Desktop version (using Electron, based in the `desktop/` folder), there is no need to build anything to see the app in action.
Here's how to do it:
* Open a command line interface in the `desktop/` folder
* Enter the command `npm install` and wait for completion
* Enter the command `npm install --only=dev` and wait for completion
* Finally, enter the command `npm start` to boot up the application (this should work on Linux, Windows and Mac OS)

-----

You will be presented with several windows, each showing some info about your system.
This is for the sample's purpose, you don't really have to pay attention to the information.
Each window is identified by its title.

-----

To understand the code, I recommend you to read the `main.js` file along with all `*.html` files, since they all interact with each other.
Just know that, except for the "Reverse thinking" window, everything starts from the `.html` files.

Mobile
======

I have only included a cordova version of the mobile counterpart, for cross-platform purposes.
In order to have a functioning version to compile and run, enter those commands in a command line interface in the `cordova/` folder:
* Enter the command `cordova prepare` and wait for completion.
* Upon completion, you can run `cordova build (android/ios)` to create an installable package of the app in the folder `platforms/(android/ios)/build/output/`.
* You can also run `cordova run (android/ios)` to run it directly on your device (if proprely connected and installed) or in a virtual machine.

-----

You will only see your device's info on the main screen of the app.
Again, this is for this sample's purposes, they don't have any importance.
Here, no "windows", just one display.

-----

To understand the code, please read the `www/js/index.js` file to see the cordova part.
You also should read the `www/nodejs-project/main.js` file to see the nodejs-mobile part.
75 changes: 75 additions & 0 deletions desktop-and-mobile/cordova/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

# Created by https://www.gitignore.io/api/node,apachecordova

### ApacheCordova ###
# Apache Cordova generated files and directories
bin/*
!/plugins
!/plugins/android.json
!/plugins/fetch.json
plugins/*
platforms/*

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env



# End of https://www.gitignore.io/api/node,apachecordova
2 changes: 2 additions & 0 deletions desktop-and-mobile/cordova/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# OS X
.DS_Store
29 changes: 29 additions & 0 deletions desktop-and-mobile/cordova/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="android" spec="^6.3.0" />
<engine name="ios" spec="^4.5.4" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="nodejs-mobile-cordova" spec="^0.1.4" />
</widget>
23 changes: 23 additions & 0 deletions desktop-and-mobile/cordova/hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Cordova Hooks

Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. See Hooks Guide for more details: http://cordova.apache.org/docs/en/edge/guide_appdev_hooks_index.md.html#Hooks%20Guide.
Loading