Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Apr 4, 2020
0 parents commit 5d4ecb0
Show file tree
Hide file tree
Showing 378 changed files with 13,943 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.DS_Store
tmp
bin
build

*/*/modules
*/*/modules*
.apt_generated
build.properties
.svn
*.pyc
*~.nib/
*.pbxuser
*.perspective
*.perspectivev3
xcuserdata
*.xcuserstate
*.xcuserdata*

.idea/
libs/

android/clean
android/ant_clean
android/.classpath
android/.settings
android/dist/
android/launch-*
android/example/
nbproject
/metadata.json
/ios/metadata.json
/ios/Carthage

android/java-sources.txt
android/build.properties
android/.project
android/platform/README.md
/ios/dist
/android/.gradle
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: place your license here and we'll include it in the module distribution
107 changes: 107 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Appcelerator Titanium Mobile Module Project

This is a skeleton Titanium Mobile Mobile module project.

## Module Naming

Choose a unique module id for your module. This ID usually follows a namespace
convention using DNS notation. For example, com.appcelerator.module.test. This
ID can only be used once by all public modules in Titanium.

## Getting Started

1. Edit the `manifest` with the appropriate details about your module.
2. Edit the `LICENSE` to add your license details.
3. Place any assets (such as PNG files) that are required anywhere in the module folder.
4. Edit the `timodule.xml` and configure desired settings.
5. Code and build.

## Documentation
-----------------------------

You should provide at least minimal documentation for your module in `documentation` folder using the Markdown syntax.

For more information on the Markdown syntax, refer to this documentation at:

<http://daringfireball.net/projects/markdown/>

## Example

The `example` directory contains a skeleton application test harness that can be
used for testing and providing an example of usage to the users of your module.

## Building

Simply run `appc run -p [ios|android] --build-only` which will compile and package your module.

## Linting

You can use `clang` to lint your code. A default Axway linting style is included inside the module main folder.
Run `clang-format -style=file -i SRC_FILE` in the module root to lint the `SRC_FILE`. You can also patterns,
like `clang-format -style=file -i Classes/*`

## Install

To use your module locally inside an app you can copy the zip file into the app root folder and compile your app.
The file will automatically be extracted and copied into the correct `modules/` folder.

If you want to use your module globally in all your apps you have to do the following:

### macOS

Copy the distribution zip file into the `~/Library/Application Support/Titanium` folder

### Linux

Copy the distribution zip file into the `~/.titanium` folder

### Windows
Copy the distribution zip file into the `C:\ProgramData\Titanium` folder

## Project Usage

Register your module with your application by editing `tiapp.xml` and adding your module.
Example:

<modules>
<module version="1.0.0">ti.stripe</module>
</modules>

When you run your project, the compiler will combine your module along with its dependencies
and assets into the application.

## Example Usage

To use your module in code, you will need to require it.

### ES6+ (recommended)

```js
import MyModule from 'ti.stripe';
MyModule.foo();
```

### ES5

```js
var MyModule = require('ti.stripe');
MyModule.foo();
```

## Testing

To test your module with the example, use:

```js
appc run -p [ios|android]
```

This will execute the app.js in the example/ folder as a Titanium application.

## Distribution

You have a variety of choises for distributing your module
- [Gitt.io](http://gitt.io/)
- [Axway Marketplace](https://marketplace.axway.com/home)

Code strong!
26 changes: 26 additions & 0 deletions android/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
Language: Java
AccessModifierOffset: -4
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
# class, constructor, method should be next line
BreakBeforeBraces: Linux
# Keep '=' at end of line when wrapping, but move things like '&&', '||' to beginning of newline
BreakBeforeBinaryOperators: NonAssignment
# FIXME: break for brace after synchronized block, anonymous class declarations
BreakAfterJavaFieldAnnotations: true
ColumnLimit: 120
IndentCaseLabels: true
IndentWidth: 4
MaxEmptyLinesToKeep: 1
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
TabWidth: 4
UseTab: ForContinuationAndIndentation
SpaceAfterCStyleCast: true
# Spaces inside {} for array literals, i.e. "new Object[] { args }"
Cpp11BracedListStyle: false
ReflowComments: false
8 changes: 8 additions & 0 deletions android/Resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Files in this folder are copied directory into the compiled product directory
when the Android app is compiled:

<project-dir>/build/android/bin/assets/Resources/

Files in this directory are copied directly on top of whatever files are already
in the build directory, so please be careful that your files don't clobber
essential project files or files from other modules.
56 changes: 56 additions & 0 deletions android/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<project name="titanium-stripe" default="dist">
<description>
Ant build script for Titanium Android module titanium-stripe
</description>

<property name="ti.module.root" location="${basedir}"/>
<property file="build.properties" />

<!-- Make sure 'architectures' is in manifest file -->
<property file="${ti.module.root}/manifest" prefix="manifest"/>
<fail message="Missing required manifest key 'architectures'.">
<condition>
<not>
<isset property="manifest.architectures"/>
</not>
</condition>
</fail>

<fail message="Manifest key 'architectures' has no value.">
<condition>
<not>
<length string="${manifest.architectures}" trim="true" when="greater" length="0"/>
</not>
</condition>
</fail>

<!-- Copy documentation subdirectories -->
<mkdir dir="${basedir}/documentation"/>
<copy todir="${basedir}/documentation">
<fileset dir="${basedir}/../documentation"/>
</copy>

<!-- Copy example subdirectories -->
<mkdir dir="${basedir}/example"/>
<copy todir="${basedir}/example">
<fileset dir="${basedir}/../example"/>
</copy>

<!-- Copy assets subdirectories -->
<mkdir dir="${basedir}/assets"/>
<copy todir="${basedir}/assets">
<fileset dir="${basedir}/../assets"/>
</copy>

<!-- Copy license -->
<copy todir="${basedir}" file="${basedir}/../LICENSE"/>

<target name="cleancopy" description="Delete old copies">
<delete dir="${basedir}/documentation"/>
<delete dir="${basedir}/example"/>
<delete dir="${basedir}/assets"/>
<delete file="${basedir}/LICENSE"/>
</target>

<import file="${titanium.platform}/../module/android/build.xml"/>
</project>
2 changes: 2 additions & 0 deletions android/lib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
You can place any .jar dependencies in this directory and they will be included
when your module is being compiled.
18 changes: 18 additions & 0 deletions android/manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 1.0.0
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86
description: titanium-stripe
author: Your Name
license: Specify your license
copyright: Copyright (c) 2020 by Your Company

# these should not be edited
name: titanium-stripe
moduleid: ti.stripe
guid: 8a8da6b4-4dab-4c18-9439-de2e14457a1c
platform: android
minsdk: 8.3.2
104 changes: 104 additions & 0 deletions android/src/ti/stripe/ExampleProxy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
* This file was auto-generated by the Titanium Module SDK helper for Android
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2017 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
*/
package ti.stripe;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.titanium.TiC;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.kroll.common.TiConfig;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.proxy.TiViewProxy;
import org.appcelerator.titanium.view.TiCompositeLayout;
import org.appcelerator.titanium.view.TiCompositeLayout.LayoutArrangement;
import org.appcelerator.titanium.view.TiUIView;

import android.app.Activity;


// This proxy can be created by calling TitaniumStripe.createExample({message: "hello world"})
@Kroll.proxy(creatableInModule=TitaniumStripeModule.class)
public class ExampleProxy extends TiViewProxy
{
// Standard Debugging variables
private static final String LCAT = "ExampleProxy";
private static final boolean DBG = TiConfig.LOGD;

private class ExampleView extends TiUIView
{
public ExampleView(TiViewProxy proxy) {
super(proxy);
LayoutArrangement arrangement = LayoutArrangement.DEFAULT;

if (proxy.hasProperty(TiC.PROPERTY_LAYOUT)) {
String layoutProperty = TiConvert.toString(proxy.getProperty(TiC.PROPERTY_LAYOUT));
if (layoutProperty.equals(TiC.LAYOUT_HORIZONTAL)) {
arrangement = LayoutArrangement.HORIZONTAL;
} else if (layoutProperty.equals(TiC.LAYOUT_VERTICAL)) {
arrangement = LayoutArrangement.VERTICAL;
}
}
setNativeView(new TiCompositeLayout(proxy.getActivity(), arrangement));
}

@Override
public void processProperties(KrollDict d)
{
super.processProperties(d);
}
}


// Constructor
public ExampleProxy()
{
super();
}

@Override
public TiUIView createView(Activity activity)
{
TiUIView view = new ExampleView(this);
view.getLayoutParams().autoFillsHeight = true;
view.getLayoutParams().autoFillsWidth = true;
return view;
}

// Handle creation options
@Override
public void handleCreationDict(KrollDict options)
{
super.handleCreationDict(options);

if (options.containsKey("message")) {
Log.d(LCAT, "example created with message: " + options.get("message"));
}
}

// Methods
@Kroll.method
public void printMessage(String message)
{
Log.d(LCAT, "printing message: " + message);
}


@Kroll.getProperty @Kroll.method
public String getMessage()
{
return "Hello World from my module";
}

@Kroll.setProperty @Kroll.method
public void setMessage(String message)
{
Log.d(LCAT, "Tried setting module message to: " + message);
}
}
Loading

0 comments on commit 5d4ecb0

Please sign in to comment.