├── .gitignore ├── test └── cljs_exponent │ └── core_test.clj ├── project.clj ├── src └── cljs_exponent │ ├── reagent.cljs │ ├── util.cljs │ ├── core.cljs │ ├── contacts.cljs │ ├── asset.cljs │ ├── facebook.cljs │ ├── google.cljs │ ├── font.cljs │ ├── permissions.cljs │ ├── amplitude.cljs │ ├── image_picker.cljs │ ├── segment.cljs │ ├── constants.cljs │ ├── location.cljs │ └── components.cljc ├── CHANGELOG.md ├── notes.org ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /classes 3 | /checkouts 4 | pom.xml 5 | pom.xml.asc 6 | *.jar 7 | *.class 8 | /.lein-* 9 | /.nrepl-port 10 | .hgignore 11 | .hg/ 12 | -------------------------------------------------------------------------------- /test/cljs_exponent/core_test.clj: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.core-test 2 | (:require [clojure.test :refer :all] 3 | [cljs-exponent.core :refer :all])) 4 | 5 | (deftest a-test 6 | (testing "FIXME, I fail." 7 | (is (= 0 1)))) 8 | -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject cljs-exponent "0.2.3" 2 | :description "Expo cljs binding" 3 | :url "https://github.com/tiensonqin/cljs-exponent" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :codox {:language :clojurescript}) 7 | -------------------------------------------------------------------------------- /src/cljs_exponent/reagent.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.reagent 2 | (:require-macros [cljs-exponent.components :refer [wrap-all-reagent]]) 3 | (:require [cljs-exponent.core] 4 | [reagent.core])) 5 | 6 | (defn safe-adapt-react-class [component] 7 | (if component 8 | (reagent.core/adapt-react-class component))) 9 | 10 | (wrap-all-reagent) 11 | -------------------------------------------------------------------------------- /src/cljs_exponent/util.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.util 2 | "Helpful utility functions that don't fit anywhere else." 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (def Util (aget exponent "Util")) 6 | 7 | (defn get-current-locale-async 8 | "Returns the current device locale as a string." 9 | [] 10 | (.call (aget Util "getCurrentLocaleAsync") 11 | Util)) 12 | -------------------------------------------------------------------------------- /src/cljs_exponent/core.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.core) 2 | 3 | (def react-native 4 | (when (exists? js/require) 5 | (js/require "react-native"))) 6 | 7 | (def react 8 | (when (exists? js/require) 9 | (js/require "react"))) 10 | 11 | (def exponent 12 | (when (exists? js/require) 13 | (js/require "expo"))) 14 | 15 | (def expo exponent) 16 | 17 | (when react-native 18 | (set! js/window.React react)) 19 | -------------------------------------------------------------------------------- /src/cljs_exponent/contacts.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.contacts 2 | "Provides access to the phone's system contacts." 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (def Contacts (aget exponent "Contacts")) 6 | 7 | (defn get-contacts-async 8 | "Get a list of all entries in the system contacts. This returns the name and optionally phone number and email of each contact. 9 | 10 | Arguments: 11 | fields (array) -- An array describing fields to retrieve per contact. Each element bust be one of Exponent.Contacts.PHONE_NUMBER or Exponent.Contacts.EMAIL. 12 | Returns: 13 | An array of objects of the form { id, name, phoneNumber, email } with phoneNumber and email only present if they were requested through the fields parameter." 14 | [fields] 15 | (.call (aget Contacts "getContactsAsync") 16 | Contacts (clj->js fields))) 17 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). 3 | 4 | ## [Unreleased] 5 | ### Changed 6 | - Add a new arity to `make-widget-async` to provide a different widget shape. 7 | 8 | ## [0.1.1] - 2016-11-09 9 | ### Changed 10 | - Documentation on how to make the widgets. 11 | 12 | ### Removed 13 | - `make-widget-sync` - we're all async, all the time. 14 | 15 | ### Fixed 16 | - Fixed widget maker to keep working when daylight savings switches over. 17 | 18 | ## 0.1.0 - 2016-11-09 19 | ### Added 20 | - Files from the new template. 21 | - Widget maker public API - `make-widget-sync`. 22 | 23 | [Unreleased]: https://github.com/your-name/exponent/compare/0.1.1...HEAD 24 | [0.1.1]: https://github.com/your-name/exponent/compare/0.1.0...0.1.1 25 | -------------------------------------------------------------------------------- /notes.org: -------------------------------------------------------------------------------- 1 | * exponent 2 | ** Auto-generated vs manually 3 | manually better docs 4 | auto generated better to maintain 5 | *** Api 6 | **** DONE Amplitude 7 | CLOSED: [2016-11-10 Thu 14:36] 8 | **** DONE Asset 9 | CLOSED: [2016-11-10 Thu 14:36] 10 | **** DONE Constants 11 | CLOSED: [2016-11-10 Thu 14:59] 12 | **** DONE Contacts 13 | CLOSED: [2016-11-10 Thu 15:15] 14 | **** DONE Facebook 15 | CLOSED: [2016-11-10 Thu 15:15] 16 | **** DONE Font 17 | CLOSED: [2016-11-10 Thu 15:15] 18 | **** DONE Google 19 | CLOSED: [2016-11-10 Thu 15:15] 20 | **** DONE ImagePicker 21 | CLOSED: [2016-11-10 Thu 15:22] 22 | **** DONE Location 23 | CLOSED: [2016-11-10 Thu 15:25] 24 | **** DONE Permissions 25 | CLOSED: [2016-11-10 Thu 15:29] 26 | **** DONE Segment 27 | CLOSED: [2016-11-10 Thu 15:36] 28 | **** Util 29 | ** Components 30 | Should support both Om next and Reagent, maybe later rum 31 | *** AppLoading 32 | *** BarCodeScanner 33 | *** BlurView 34 | *** GLView 35 | *** LinearGradient 36 | *** MapView 37 | *** Svg 38 | *** Video 39 | 40 | ** Release version rules 41 | sdk_version + date 42 | For example, 11.20160102 43 | 44 | ** Modules 45 | exponent.API 46 | exponent.om 47 | exponent.reagent 48 | -------------------------------------------------------------------------------- /src/cljs_exponent/asset.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.asset 2 | (:require [cljs-exponent.core :refer [expo]])) 3 | 4 | (defn from-module 5 | "Returns the Exponent.Asset instance representing an asset given its module." 6 | [module] 7 | (let [Asset (aget expo "Asset")] 8 | (.call (aget Asset "fromModule") 9 | module))) 10 | 11 | (defn- cache-images 12 | [images] 13 | (for [image images] 14 | (when image 15 | (let [Asset (aget expo "Asset")] 16 | (.call (aget Asset "loadAsync") Asset image))))) 17 | 18 | (defn- cache-fonts 19 | [fonts] 20 | (for [font fonts] 21 | (when font 22 | (let [Font (aget expo "Font")] 23 | (.call (aget Font "loadAsync") Font font))))) 24 | 25 | (defn- cast-as-array 26 | [coll] 27 | (if (or (array? coll) 28 | (not (reduceable? coll))) 29 | coll 30 | (into-array coll))) 31 | 32 | (defn all 33 | [coll] 34 | (.call (aget js/Promise "all") js/Promise (cast-as-array coll))) 35 | 36 | (defn cache-assets 37 | [images fonts cb] 38 | (-> 39 | (all 40 | (concat 41 | (if (seq images) 42 | (cache-images (clj->js images))) 43 | (if (seq fonts) 44 | (cache-fonts (clj->js fonts))))) 45 | (.then (fn [resp] 46 | (if cb (cb)))) 47 | (.catch (fn [err] 48 | (println "Loading assets failed: " (aget err "message")))))) 49 | -------------------------------------------------------------------------------- /src/cljs_exponent/facebook.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.facebook 2 | "Provides Facebook integration for Exponent apps. Exponent exposes a minimal native API since you can access Facebook's Graph API directly through HTTP (using fetch, for example)." 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (def Facebook (aget exponent "Facebook")) 6 | 7 | (defn login-with-read-permissions-async 8 | "Prompts the user to log into Facebook and grants your app permission 9 | to access their Facebook data. 10 | 11 | param string appId 12 | Your Facebook application ID. Facebook's developer documentation describes how to get one. 13 | 14 | param object options 15 | A map of options: 16 | 17 | permissions (array) -- An array specifying the permissions to ask for from Facebook for this login. The permissions are strings as specified in the Facebook API documentation. The default permissions are ['public_profile', 'email', 'user_friends']. 18 | returns 19 | If the user or Facebook cancelled the login, returns { type: 'cancel' }. 20 | Otherwise, returns { type: 'success', token, expires }. token is a string giving the access token to use with Facebook HTTP API requests. expires is the time at which this token will expire, as seconds since epoch. You can save the access token using, say, AsyncStorage, and use it till the expiration time." 21 | [app-id options] 22 | (.call (aget Facebook "logInWithReadPermissionsAsync") 23 | Facebook app-id (clj->js options))) 24 | -------------------------------------------------------------------------------- /src/cljs_exponent/google.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.google 2 | "Provides Google integration for Exponent apps. Exponent exposes a minimal native API since you can access Google's REST APIs directly through HTTP " 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (def Google (aget exponent "Google")) 6 | 7 | (defn login-async 8 | "Prompts the user to log into Google and grants your app permission to access some of their Google data, as specified by the scopes. 9 | 10 | param object options 11 | A map of options: 12 | 13 | behavior (string) -- The type of behavior to use for login, either web or system. Native (system) can only be used inside of a standalone app when built using the steps described below. Default is web inside of Exponent app, and system in standalone. 14 | scopes (array) -- An array specifying the scopes to ask for from Google for this login (more information here). Default scopes are ['profile', 'email']. 15 | webClientId (string) -- The client id registered with Google for the app, used with the web behavior. 16 | iosClientId (string) -- The client id registered with Google for the, used with the native behavior inside of a standalone app. 17 | returns: 18 | If the user or Google cancelled the login, returns { type: 'cancel' }. 19 | 20 | Otherwise, returns { type: 'success', accessToken, idToken, serverAuthCode, user: {...profileInformation} }. accessToken is a string giving the access token to use with Google HTTP API requests." 21 | [options] 22 | (.call (aget Google "logInAsync") 23 | Google 24 | (clj->js options))) 25 | -------------------------------------------------------------------------------- /src/cljs_exponent/font.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.font 2 | "Allows loading fonts from the web and using them in React Native components." 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (def Font (aget exponent "Font")) 6 | 7 | (defn load-async 8 | ([name url] 9 | "Load a font from the web and associate it with the given name. 10 | 11 | Arguments: 12 | name (string) -- A name by which to identify this font. You can make up any name you want; you just have to specify the same name in Exponent.Font.style() to use this font. 13 | 14 | Returns: 15 | Doesn't return anything and simply awaits till the font is available to use." 16 | (.call (aget Font "loadAsync") 17 | Font name url)) 18 | ([fonts-map] 19 | "Convenience form of Exponent.Font.loadAsync() that loads multiple fonts at once. 20 | 21 | Arguments: 22 | map (object) -- A map of names to urls as in Exponent.Font.loadAsync(). 23 | Returns: 24 | Doesn't return anything and simply awaits till all fonts are available to use." 25 | (.call (aget Font "loadAsync") 26 | Font (clj->js fonts-map)))) 27 | 28 | (defn style 29 | "Return style properties to use with a Text or other React Native component. It is safe to call this function before calling Exponent.Font.loadAsync(); it will still return the correct style properties. This way you can use this function with StyleSheet.create(). 30 | 31 | Arguments: 32 | name (string) -- The name for this font specified in Exponent.Font.loadAsync(). 33 | Returns: 34 | An object with style attributes to use in a Text or similar component." 35 | [name] 36 | (.call (aget Font "style") 37 | Font name)) 38 | -------------------------------------------------------------------------------- /src/cljs_exponent/permissions.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.permissions 2 | "When it comes to adding functionality that can access potentially sensitive information on a user's device, such as their location, or possibly send them possibly unwanted push notifications, you will need to ask the user for their permission first. Unless you've already asked their permission, then no need. And so we have the Permissions module." 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (def Permissions (aget exponent "Permissions")) 6 | 7 | (defn get-async 8 | "Determines whether your app has already been granted access to the provided permission type. 9 | 10 | Arguments 11 | type (string) -- The name of the permission. 12 | 13 | Returns 14 | Returns a Promise that is resolved with the information about the permission, including status, expiration and scope (if it applies to the permission type)." 15 | [type] 16 | (.call (aget Permissions "getAsync") 17 | Permissions type)) 18 | 19 | (defn ask-async 20 | "Prompt the user for a permission. If they have already granted access, response will be success. 21 | 22 | Arguments 23 | type (string) -- The name of the permission. 24 | 25 | Returns 26 | Returns a Promise that is resolved with the information about the permission, including status, expiration and scope (if it applies to the permission type)." 27 | [type] 28 | (.call (aget Permissions "askAsync") 29 | Permissions type)) 30 | 31 | (def ^{:doc "The permission type for push notifications. 32 | Note: On iOS, this does not disambiguate undetermined from denied and so will only ever return granted or undetermined. This is due to the way the underlying native API is implemented."} 33 | remote-notifications (aget Permissions "REMOTE_NOTIFICATIONS")) 34 | 35 | (def ^{:doc "The permission type for location access."} 36 | location (aget Permissions "LOCATION")) 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cljs-exponent 2 | 3 | [Expo](https://expo.io/) and React Native' clojurescript binding. 4 | 5 | [documentation](https://tiensonqin.github.io/cljs-exponent) 6 | 7 | [![Clojars Project](https://img.shields.io/clojars/v/cljs-exponent.svg)](https://clojars.org/cljs-exponent) 8 | 9 | ## Usage examples 10 | 11 | ### Api 12 | 13 | ``` clojure 14 | (require '[cljs-exponent.contacts :as contacts]) 15 | 16 | (contacts/get-contacts-async [(aget contacts/Contacts "PHONE_NUMBER") 17 | (aget contacts/Contacts "EMAIL")]) 18 | ``` 19 | 20 | ### Components and APIs 21 | Supports both [Om](https://github.com/omcljs/om), [Reagent](https://github.com/reagent-project/reagent) and [Rum](https://github.com/tonsky/rum). 22 | 23 | #### Om or Rum 24 | 25 | ``` clojure 26 | (require '[cljs-exponent.components :as rn]) 27 | 28 | (rn/text "hi") 29 | 30 | (.alert rn/alert "This is an alert!") 31 | 32 | (rn/linear-gradient 33 | {:colors ["#4c669f" "#3b5998" "#192f6a"] 34 | :style {:padding 15 35 | :alignItems "center" 36 | :borderRadius 5}} 37 | (text {:style {:backgroundColor "transparent" 38 | :fontSize 15 39 | :color "#fff"}} 40 | "Sign in with Facebook")) 41 | ``` 42 | 43 | #### Reagent 44 | 45 | ``` clojure 46 | (require '[cljs-exponent.reagent :as rn]) 47 | 48 | [rn/text "hi"] 49 | 50 | (.alert rn/alert "This is an alert!") 51 | 52 | [rn/linear-gradient 53 | {:colors ["#4c669f" "#3b5998" "#192f6a"] 54 | :style {:padding 15 55 | :align-items "center" 56 | :border-radius 5}} 57 | [text {:style {:background-color "transparent" 58 | :font-size 15 59 | :color "#fff"}} 60 | "Sign in with Facebook"]] 61 | ``` 62 | 63 | ## License 64 | 65 | Copyright © 2016 Tienson Qin 66 | 67 | Distributed under the Eclipse Public License either version 1.0 or (at 68 | your option) any later version. 69 | -------------------------------------------------------------------------------- /src/cljs_exponent/amplitude.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.amplitude 2 | "Provides access to https://amplitude.com/ mobile analytics. Wraps Amplitude's iOS and Android SDKs." 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (defonce Amplitude (aget exponent "Amplitude")) 6 | 7 | (defn initialize 8 | "Initializes Amplitude with your Amplitude API key. Find your API key using these instructions." 9 | [api-key] 10 | (.call (aget Amplitude "initialize") 11 | Amplitude api-key)) 12 | 13 | (defn set-user-id 14 | "Assign a user ID to the current user. If you don't have a system for user IDs you don't need to call this. See https://amplitude.zendesk.com/hc/en-us/articles/206404628-Step-2-Assign-User-IDs-and-Identify-your-Users." 15 | [user-id] 16 | (.call (aget Amplitude "setUserId") 17 | Amplitude api-key)) 18 | 19 | (defn set-user-properties 20 | "Set properties for the current user. See https://amplitude.zendesk.com/hc/en-us/articles/207108327-Step-4-Set-User-Properties-and-Event-Properties." 21 | [user-properties] 22 | (.call (aget Amplitude "setUserProperties") 23 | Amplitude (clj->js user-properties))) 24 | 25 | (defn clear-user-properties 26 | "Clear properties set by Exponent.Amplitude.setUserProperties()." 27 | [] 28 | (.call (aget Amplitude "clearUserProperties") 29 | Amplitude)) 30 | 31 | (defn log-event 32 | "Log an event to Amplitude. https://amplitude.zendesk.com/hc/en-us/articles/206404698-Step-3-Track-Events-and-Understand-the-Actions-Users-Take has information about what kind of events to track." 33 | [event-name] 34 | (.call (aget Amplitude "logEvent") 35 | Amplitude event-name)) 36 | 37 | (defn log-event-with-properties 38 | "Log an event to Amplitude with custom properties. https://amplitude.zendesk.com/hc/en-us/articles/206404698-Step-3-Track-Events-and-Understand-the-Actions-Users-Take has information about what kind of events to track." 39 | [event-name properties] 40 | (.call (aget Amplitude "logEventWithProperties") 41 | Amplitude event-name (clj->js properties))) 42 | 43 | (defn set-group 44 | "Add the current user to a group. See https://github.com/amplitude/Amplitude-iOS#setting-groups and https://github.com/amplitude/Amplitude-Android#setting-groups." 45 | [group-type group-names] 46 | (.call (aget Amplitude "setGroup") 47 | Amplitude group-type group-names)) 48 | -------------------------------------------------------------------------------- /src/cljs_exponent/image_picker.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.image-picker 2 | "Provides access to the system's UI for selecting images from the phone's photo library or taking a photo with the camera." 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (def ImagePicker (aget exponent "ImagePicker")) 6 | 7 | (defn launch-image-library-async 8 | "Display the system UI for choosing an image from the phone's photo library. 9 | 10 | Arguments 11 | options (object) -- 12 | A map of options: 13 | 14 | allowsEditing (boolean) -- Whether to show a UI to edit the image after it is picked. On Android the user can crop and rotate the image and on iOS simply crop it. Defaults to false. 15 | aspect (array) -- An array with two entries [x, y] specifying the aspect ratio to maintain if the user is allowed to edit the image (by passing allowsEditing: true). This is only applicable on Android, since on iOS the crop rectangle is always a square. 16 | Returns 17 | If the user cancelled the image picking, returns { cancelled: true }. 18 | Otherwise, returns { cancelled: false, uri, width, height } where uri is a URI to the local image file (useable in a react-native Image tag) and width, height specify the dimensions of the image." 19 | [options] 20 | (.call (aget ImagePicker "launchImageLibraryAsync") 21 | ImagePicker (clj->js options))) 22 | 23 | (defn launch-camera-async 24 | "Display the system UI for taking a photo with the camera. 25 | 26 | Arguments 27 | options (object) -- 28 | A map of options: 29 | 30 | allowsEditing (boolean) -- Whether to show a UI to edit the image after it is picked. On Android the user can crop and rotate the image and on iOS simply crop it. Defaults to false. 31 | aspect (array) -- An array with two entries [x, y] specifying the aspect ratio to maintain if the user is allowed to edit the image (by passing allowsEditing: true). This is only applicable on Android, since on iOS the crop rectangle is always a square. 32 | Returns 33 | If the user cancelled taking a photo, returns { cancelled: true }. 34 | Otherwise, returns { cancelled: false, uri, width, height } where uri is a URI to the local image file (useable in a React Native Image tag) and width, height specify the dimensions of the image." 35 | [options] 36 | (.call (aget ImagePicker "launchCameraAsync") 37 | ImagePicker (clj->js options))) 38 | -------------------------------------------------------------------------------- /src/cljs_exponent/segment.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.segment 2 | "Provides access to https://segment.com/ mobile analytics. Wraps Segment's iOS and Android sources. 3 | 4 | Note: Session tracking may not work correctly when running Experiences in the main Exponent app. It will work correctly if you create a standalone app." 5 | (:require [cljs-exponent.core :refer [exponent]])) 6 | 7 | (def Segment (aget exponent "Segment")) 8 | 9 | (defn initialize-ios 10 | "Segment requires separate write keys for iOS and Android. Call this with the write key for your iOS source in Segment. 11 | 12 | Arguments 13 | writeKey (string) -- Write key for iOS source." 14 | [write-key] 15 | (.call (aget Segment "initializeIOS") 16 | Segment write-key)) 17 | 18 | (defn initialize-android 19 | "Segment requires separate write keys for iOS and Android. Call this with the write key for your Android source in Segment. 20 | 21 | Arguments: 22 | writeKey (string) -- Write key for Android source." 23 | [write-key] 24 | (.call (aget Segment "initializeAndroid") 25 | Segment write-key)) 26 | 27 | (defn identify 28 | "Associates the current user with a user ID. Call this after calling Exponent.Segment.initializeIOS() and Exponent.Segment.initializeAndroid() but before other segment calls. See https://segment.com/docs/spec/identify/." 29 | [user-id] 30 | (.call (aget Segment "identify") 31 | Segment user-id)) 32 | 33 | (defn identify-with-traits 34 | "Associates the current user with a user ID and some metadata. Call this after calling Exponent.Segment.initializeIOS() and Exponent.Segment.initializeAndroid() but before other segment calls. See https://segment.com/docs/spec/identify/. 35 | 36 | Arguments 37 | writeKey (string) -- User ID for the current user. 38 | 39 | :param object traits 40 | A map of custom properties." 41 | [user-id traits] 42 | (.call (aget Segment "identifyWithTraits") 43 | Segment user-id (clj->js traits))) 44 | 45 | (defn track 46 | "Log an event to Segment. See https://segment.com/docs/spec/track/. 47 | 48 | Arguments 49 | event (string) -- The event name." 50 | [event] 51 | (.call (aget Segment "track") 52 | Segment event)) 53 | 54 | (defn trackWithProperties 55 | "Log an event to Segment with custom properties. See https://segment.com/docs/spec/track/. 56 | 57 | Arguments 58 | event (string) -- The event name. 59 | properties (object) -- A map of custom properties." 60 | [event properties] 61 | (.call (aget Segment "trackWithProperties") 62 | Segment event (clj->js properties))) 63 | 64 | (defn flush 65 | "Manually flush the event queue. You shouldn't need to call this in most cases." 66 | [] 67 | (.call (aget Segment "flush") 68 | Segment)) 69 | -------------------------------------------------------------------------------- /src/cljs_exponent/constants.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.constants 2 | "System information that remains constant throughout the lifetime of your app." 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (def Constants (aget exponent "Constants")) 6 | 7 | (def ^{:doc "Returns exponent, standalone, or guest. If exponent, the experience is running inside of the Exponent client. If standalone, it is a standalone app. If guest, it has been opened through a link from a standalone app."} 8 | app-ownership (aget Constants "appOwnership")) 9 | 10 | (def ^{:doc "The version string of the Exponent client currently running"} 11 | exponent-version (aget Constants "exponentVersion")) 12 | 13 | (def ^{:doc "An identifier that is unique to this particular device and installation of the Exponent client."} 14 | device-id (aget Constants "deviceId")) 15 | 16 | (def ^{:doc "A human-readable name for the device type."} 17 | device-name (aget Constants "deviceName")) 18 | 19 | (def ^{:doc "The device year class of this device."} 20 | device-year-class (aget Constants "deviceYearClass")) 21 | 22 | (def ^{:doc "true if the app is running on a device, false if running in a simulator or emulator."} 23 | is-device (aget Constants "true if the app is running on a device, false if running in a simulator or emulator.")) 24 | 25 | (def ^{:doc "Exponent.Constants.platform. 26 | ios 27 | platform 28 | The Apple internal model identifier for this device, e.g. iPhone1,1. 29 | 30 | model 31 | The human-readable model name of this device, e.g. iPhone 7 Plus. 32 | 33 | userInterfaceIdiom 34 | The user interface idiom of this device, i.e. whether the app is running on an iPhone or an iPad. Current supported values are handset and tablet. Apple TV and CarPlay will show up as unsupported."} 35 | platform (aget Constants "platform")) 36 | 37 | (def ^{:doc "true if the app is running on a device, false if running in a simulator or emulator."} 38 | session-id (aget Constants "true if the app is running on a device, false if running in a simulator or emulator.")) 39 | 40 | (def ^{:doc "The default status bar height for the device. Does not factor in changes when location tracking is in use or a phone call is active."} 41 | status-bar-height (aget Constants "statusBarHeight")) 42 | 43 | (def ^{:doc "A list of the system font names available on the current device."} 44 | system-fonts (aget Constants "systemFonts")) 45 | 46 | (def ^{:doc "The manifest object for the app, https://docs.getexponent.com/versions/v11.0.0/guides/how-exponent-works.html#exponent-manifest."} 47 | manifests (aget Constants "manifest")) 48 | 49 | (def ^{:doc "When an app is opened due to a deep link, the prefix of the URI without the deep link part. This value depends on Exponent.Constants.appOwnership: it may be different if your app is running standalone vs. in the Exponent client."} 50 | linking-uri (aget Constants "linkingUri")) 51 | -------------------------------------------------------------------------------- /src/cljs_exponent/location.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.location 2 | "This module allows reading geolocation information from the device. Your app can poll for the current location or subscribe to location update events." 3 | (:require [cljs-exponent.core :refer [exponent]])) 4 | 5 | (def Location (aget exponent "Location")) 6 | 7 | (defn get-current-position-async 8 | "Get the current position of the device. 9 | 10 | Arguments 11 | options (object) -- 12 | A map of options: 13 | 14 | enableHighAccuracy (boolean) -- Whether to enable high-accuracy mode. For low-accuracy the implementation can avoid geolocation providers that consume a significant amount of power (such as GPS). 15 | Returns 16 | Returns an object with the following fields: 17 | 18 | coords (object) -- The coordinates of the position, with the following fields: 19 | latitude (number) -- The latitude in degrees. 20 | longitude (number) -- The longitude in degrees. 21 | altitude (number) -- The altitude in meters above the WGS 84 reference ellipsoid. 22 | accuracy (number) -- The radius of uncertainty for the location, measured in meters. 23 | altitudeAccuracy (number) -- The accuracy of the altitude value, in meters (iOS only). 24 | heading (number) -- Horizontal direction of travel of this device, measured in degrees starting at due north and continuing clockwise around the compass. Thus, north is 0 degrees, east is 90 degrees, south is 180 degrees, and so on. 25 | speed (number) -- The instantaneous speed of the device in meters per second. 26 | timestamp (number) -- The time at which this position information was obtained, in milliseconds since epoch." 27 | [options] 28 | (.call (aget Location "getCurrentPositionAsync") 29 | Location (clj->js options))) 30 | 31 | (defn watchPositionAsync 32 | "Subscribe to location updates from the device. 33 | 34 | Arguments 35 | options (object) -- 36 | A map of options: 37 | 38 | enableHighAccuracy (boolean) -- Whether to enable high accuracy mode. For low accuracy the implementation can avoid geolocation providers that consume a significant amount of power (such as GPS). 39 | timeInterval (number) -- Minimum time to wait between each update in milliseconds. 40 | distanceInterval (number) -- Receive updates only when the location has changed by at least this distance in meters. 41 | callback (function) -- 42 | This function is called on each location update. It is passed exactly one parameter: an object with the following fields: 43 | 44 | coords (object) -- The coordinates of the position, with the following fields: 45 | latitude (number) -- The latitude in degrees. 46 | longitude (number) -- The longitude in degrees. 47 | altitude (number) -- The altitude in meters above the WGS 84 reference ellipsoid. 48 | accuracy (number) -- The radius of uncertainty for the location, measured in meters. 49 | altitudeAccuracy (number) -- The accuracy of the altitude value, in meters (iOS only). 50 | heading (number) -- Horizontal direction of travel of this device, measured in degrees starting at due north and continuing clockwise around the compass. Thus, north is 0 degrees, east is 90 degrees, south is 180 degrees, and so on. 51 | speed (number) -- The instantaneous speed of the device in meters per second. 52 | timestamp (number) -- The time at which this position information was obtained, in milliseconds since epoch. 53 | Returns 54 | Returns a subscription object, which has one field: 55 | 56 | remove (function) -- Call this function with no arguments to remove this subscription. The callback will no longer be called for location updates." 57 | [options callback] 58 | (.call (aget Location "watchPositionAsync") 59 | Location 60 | (clj->js options) callback)) 61 | -------------------------------------------------------------------------------- /src/cljs_exponent/components.cljc: -------------------------------------------------------------------------------- 1 | (ns cljs-exponent.components 2 | #?(:clj (:require [clojure.string :as str] 3 | [clojure.walk :as w] 4 | [clojure.set :as set])) 5 | #?(:cljs (:require-macros [cljs-exponent.components :refer [wrap-all]])) 6 | #?(:cljs (:require [clojure.string :as str] 7 | [cljs-exponent.core] 8 | [clojure.walk :as w] 9 | [clojure.set :as set]))) 10 | 11 | (def rn-apis 12 | ["AccessibilityInfo" 13 | "ActionSheetIOS" 14 | "Alert" 15 | "AlertIOS" 16 | "Animated" 17 | "AppRegistry" 18 | "AppState" 19 | "AsyncStorage" 20 | "BackAndroid" 21 | "BackHandler" 22 | "CameraRoll" 23 | "Clipboard" 24 | "Dimensions" 25 | "Easing" 26 | "Geolocation" 27 | "ImageEditor" 28 | "ImagePickerIOS" 29 | "ImageStore" 30 | "IntentAndroid" 31 | "InteractionManager" 32 | "Keyboard" 33 | "LayoutAnimation" 34 | "Linking" 35 | "NativeMethodsMixin" 36 | "NativeModules" 37 | "NetInfo" 38 | "PanResponder" 39 | "PermissionsAndroid" 40 | "PixelRatio" 41 | "Platform" 42 | "Settings" 43 | "Share" 44 | "StatusBarIOS" 45 | "StyleSheet" 46 | "Systrace" 47 | "TimePickerAndroid" 48 | "ToastAndroid" 49 | "Vibration" 50 | "VibrationIOS"]) 51 | 52 | (def rn-components 53 | ["ActivityIndicator" 54 | "Animated.Image" 55 | "Animated.Text" 56 | "Animated.View" 57 | "Animated.ScrollView" 58 | "Button" 59 | "DatePickerIOS" 60 | "DrawerLayoutAndroid" 61 | "Image" 62 | "KeyboardAvoidingView" 63 | "ListView" 64 | "FlatList" 65 | "MaskedViewIOS" 66 | "Modal" 67 | "NavigatorIOS" 68 | "Picker" 69 | "PickerIOS" 70 | "ProgressBarAndroid" 71 | "ProgressViewIOS" 72 | "RefreshControl" 73 | "ScrollView" 74 | "SectionList" 75 | "SegmentedControlIOS" 76 | "Slider" 77 | "SnapshotViewIOS" 78 | "StatusBar" 79 | "Switch" 80 | "TabBarIOS" 81 | "TabBarIOS.Item" 82 | "Text" 83 | "TextInput" 84 | "ToolbarAndroid" 85 | "TouchableHighlight" 86 | "TouchableNativeFeedback" 87 | "TouchableOpacity" 88 | "TouchableWithoutFeedback" 89 | "View" 90 | "ViewPagerAndroid" 91 | "VirtualizedList" 92 | "WebView"]) 93 | 94 | ;; TODO full expo components and api support 95 | (def ex-components 96 | ["AppLoading" 97 | "Assets" 98 | "Font" 99 | "BarCodeScanner" 100 | "BlurView" 101 | "LinearGradient" 102 | "MapView" 103 | "Svg" 104 | "Video"]) 105 | 106 | ;; copy from natal-shell 107 | (def camel-rx #"([a-z])([A-Z])") 108 | 109 | (defn to-kebab [s] 110 | (-> s 111 | (str/replace camel-rx "$1-$2") 112 | (str/replace "." "-") 113 | str/lower-case)) 114 | 115 | (defn sp [js-name] 116 | (str/split js-name #"\.")) 117 | 118 | (defn kebab-case->camel-case 119 | "Converts from kebab case to camel case, eg: on-click to onClick" 120 | [input] 121 | (let [words (str/split input #"-") 122 | capitalize (->> (rest words) 123 | (map #(apply str (str/upper-case (first %)) (rest %))))] 124 | (apply str (first words) capitalize))) 125 | 126 | (defn map-keys->camel-case 127 | "Stringifys all the keys of a cljs hashmap and converts them 128 | from kebab case to camel case. If :html-props option is specified, 129 | then rename the html properties values to their dom equivalent 130 | before conversion" 131 | [data & {:keys [html-props]}] 132 | (let [convert-to-camel (fn [[key value]] 133 | [(kebab-case->camel-case (name key)) value])] 134 | (w/postwalk (fn [x] 135 | (if (map? x) 136 | (let [new-map (if html-props 137 | (set/rename-keys x {:class :className :for :htmlFor}) 138 | x)] 139 | (into {} (map convert-to-camel new-map))) 140 | x)) 141 | data))) 142 | 143 | #?(:clj 144 | (defn wrap-rn-api [js-name] 145 | `(def ~(symbol (to-kebab js-name)) 146 | (aget cljs-exponent.core/react-native ~js-name)))) 147 | 148 | #?(:cljs 149 | (defn element [element opts & children] 150 | (if element 151 | (apply (aget cljs-exponent.core/react "createElement") element 152 | (clj->js (map-keys->camel-case opts :html-props true)) 153 | children)))) 154 | 155 | #?(:cljs 156 | (defn partial-element 157 | [& args] 158 | (-> (apply partial element args) 159 | (with-meta {:rn-element? true})))) 160 | 161 | #?(:clj 162 | (defn wrap-rn-component [js-name] 163 | (let [v (sp js-name)] 164 | (if (= 1 (count v)) 165 | `(def ~(symbol (to-kebab js-name)) 166 | (partial-element (aget cljs-exponent.core/react-native ~js-name))) 167 | `(def ~(symbol (to-kebab js-name)) 168 | (partial-element (aget cljs-exponent.core/react-native ~(first v) ~(second v)))))))) 169 | 170 | #?(:clj 171 | (defn wrap-ex-component [js-name] 172 | `(def ~(symbol (to-kebab js-name)) 173 | (partial-element (aget cljs-exponent.core/exponent ~js-name))))) 174 | 175 | #?(:clj 176 | (defn wrap-glview [] 177 | `(def ~'gl-view 178 | (partial-element (aget cljs-exponent.core/exponent "GLView"))))) 179 | 180 | #?(:clj 181 | (defn wrap-rn-reagent-component [js-name] 182 | (let [v (sp js-name)] 183 | (if (= 1 (count v)) 184 | `(def ~(symbol (to-kebab js-name)) 185 | (cljs-exponent.reagent/safe-adapt-react-class 186 | (cljs.core/aget cljs-exponent.core/react-native ~js-name))) 187 | `(def ~(symbol (to-kebab js-name)) 188 | (cljs-exponent.reagent/safe-adapt-react-class 189 | (aget cljs-exponent.core/react-native ~(first v) ~(second v)))))))) 190 | 191 | #?(:clj 192 | (defn wrap-ex-reagent-component [js-name] 193 | `(def ~(symbol (to-kebab js-name)) 194 | (cljs-exponent.reagent/safe-adapt-react-class 195 | (cljs.core/aget cljs-exponent.core/exponent ~js-name))))) 196 | 197 | #?(:clj 198 | (defn wrap-reagent-glview [] 199 | `(def ~'gl-view 200 | (cljs-exponent.reagent/safe-adapt-react-class 201 | (cljs.core/aget cljs-exponent.core/exponent "GLView"))))) 202 | 203 | #?(:clj 204 | (defmacro wrap-all [] 205 | `(do 206 | ~@(map wrap-rn-api rn-apis) 207 | ~@(map wrap-rn-component rn-components) 208 | ~@(map wrap-ex-component ex-components) 209 | ~(wrap-glview)))) 210 | 211 | #?(:clj 212 | (defmacro wrap-all-reagent [] 213 | `(do 214 | ~@(map wrap-rn-api rn-apis) 215 | ~@(map wrap-rn-reagent-component rn-components) 216 | ~@(map wrap-ex-reagent-component ex-components) 217 | ~(wrap-reagent-glview)))) 218 | 219 | #?(:cljs 220 | (wrap-all)) 221 | 222 | ;; utils 223 | #?(:cljs 224 | (defn ios? 225 | [] 226 | (= "ios" (aget platform "OS")))) 227 | 228 | #?(:cljs 229 | (defn android? 230 | [] 231 | (= "android" (aget platform "OS")))) 232 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC 2 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM 3 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 4 | 5 | 1. DEFINITIONS 6 | 7 | "Contribution" means: 8 | 9 | a) in the case of the initial Contributor, the initial code and 10 | documentation distributed under this Agreement, and 11 | 12 | b) in the case of each subsequent Contributor: 13 | 14 | i) changes to the Program, and 15 | 16 | ii) additions to the Program; 17 | 18 | where such changes and/or additions to the Program originate from and are 19 | distributed by that particular Contributor. A Contribution 'originates' from 20 | a Contributor if it was added to the Program by such Contributor itself or 21 | anyone acting on such Contributor's behalf. Contributions do not include 22 | additions to the Program which: (i) are separate modules of software 23 | distributed in conjunction with the Program under their own license 24 | agreement, and (ii) are not derivative works of the Program. 25 | 26 | "Contributor" means any person or entity that distributes the Program. 27 | 28 | "Licensed Patents" mean patent claims licensable by a Contributor which are 29 | necessarily infringed by the use or sale of its Contribution alone or when 30 | combined with the Program. 31 | 32 | "Program" means the Contributions distributed in accordance with this 33 | Agreement. 34 | 35 | "Recipient" means anyone who receives the Program under this Agreement, 36 | including all Contributors. 37 | 38 | 2. GRANT OF RIGHTS 39 | 40 | a) Subject to the terms of this Agreement, each Contributor hereby grants 41 | Recipient a non-exclusive, worldwide, royalty-free copyright license to 42 | reproduce, prepare derivative works of, publicly display, publicly perform, 43 | distribute and sublicense the Contribution of such Contributor, if any, and 44 | such derivative works, in source code and object code form. 45 | 46 | b) Subject to the terms of this Agreement, each Contributor hereby grants 47 | Recipient a non-exclusive, worldwide, royalty-free patent license under 48 | Licensed Patents to make, use, sell, offer to sell, import and otherwise 49 | transfer the Contribution of such Contributor, if any, in source code and 50 | object code form. This patent license shall apply to the combination of the 51 | Contribution and the Program if, at the time the Contribution is added by the 52 | Contributor, such addition of the Contribution causes such combination to be 53 | covered by the Licensed Patents. The patent license shall not apply to any 54 | other combinations which include the Contribution. No hardware per se is 55 | licensed hereunder. 56 | 57 | c) Recipient understands that although each Contributor grants the licenses 58 | to its Contributions set forth herein, no assurances are provided by any 59 | Contributor that the Program does not infringe the patent or other 60 | intellectual property rights of any other entity. Each Contributor disclaims 61 | any liability to Recipient for claims brought by any other entity based on 62 | infringement of intellectual property rights or otherwise. As a condition to 63 | exercising the rights and licenses granted hereunder, each Recipient hereby 64 | assumes sole responsibility to secure any other intellectual property rights 65 | needed, if any. For example, if a third party patent license is required to 66 | allow Recipient to distribute the Program, it is Recipient's responsibility 67 | to acquire that license before distributing the Program. 68 | 69 | d) Each Contributor represents that to its knowledge it has sufficient 70 | copyright rights in its Contribution, if any, to grant the copyright license 71 | set forth in this Agreement. 72 | 73 | 3. REQUIREMENTS 74 | 75 | A Contributor may choose to distribute the Program in object code form under 76 | its own license agreement, provided that: 77 | 78 | a) it complies with the terms and conditions of this Agreement; and 79 | 80 | b) its license agreement: 81 | 82 | i) effectively disclaims on behalf of all Contributors all warranties and 83 | conditions, express and implied, including warranties or conditions of title 84 | and non-infringement, and implied warranties or conditions of merchantability 85 | and fitness for a particular purpose; 86 | 87 | ii) effectively excludes on behalf of all Contributors all liability for 88 | damages, including direct, indirect, special, incidental and consequential 89 | damages, such as lost profits; 90 | 91 | iii) states that any provisions which differ from this Agreement are offered 92 | by that Contributor alone and not by any other party; and 93 | 94 | iv) states that source code for the Program is available from such 95 | Contributor, and informs licensees how to obtain it in a reasonable manner on 96 | or through a medium customarily used for software exchange. 97 | 98 | When the Program is made available in source code form: 99 | 100 | a) it must be made available under this Agreement; and 101 | 102 | b) a copy of this Agreement must be included with each copy of the Program. 103 | 104 | Contributors may not remove or alter any copyright notices contained within 105 | the Program. 106 | 107 | Each Contributor must identify itself as the originator of its Contribution, 108 | if any, in a manner that reasonably allows subsequent Recipients to identify 109 | the originator of the Contribution. 110 | 111 | 4. COMMERCIAL DISTRIBUTION 112 | 113 | Commercial distributors of software may accept certain responsibilities with 114 | respect to end users, business partners and the like. While this license is 115 | intended to facilitate the commercial use of the Program, the Contributor who 116 | includes the Program in a commercial product offering should do so in a 117 | manner which does not create potential liability for other Contributors. 118 | Therefore, if a Contributor includes the Program in a commercial product 119 | offering, such Contributor ("Commercial Contributor") hereby agrees to defend 120 | and indemnify every other Contributor ("Indemnified Contributor") against any 121 | losses, damages and costs (collectively "Losses") arising from claims, 122 | lawsuits and other legal actions brought by a third party against the 123 | Indemnified Contributor to the extent caused by the acts or omissions of such 124 | Commercial Contributor in connection with its distribution of the Program in 125 | a commercial product offering. The obligations in this section do not apply 126 | to any claims or Losses relating to any actual or alleged intellectual 127 | property infringement. In order to qualify, an Indemnified Contributor must: 128 | a) promptly notify the Commercial Contributor in writing of such claim, and 129 | b) allow the Commercial Contributor to control, and cooperate with the 130 | Commercial Contributor in, the defense and any related settlement 131 | negotiations. The Indemnified Contributor may participate in any such claim 132 | at its own expense. 133 | 134 | For example, a Contributor might include the Program in a commercial product 135 | offering, Product X. That Contributor is then a Commercial Contributor. If 136 | that Commercial Contributor then makes performance claims, or offers 137 | warranties related to Product X, those performance claims and warranties are 138 | such Commercial Contributor's responsibility alone. Under this section, the 139 | Commercial Contributor would have to defend claims against the other 140 | Contributors related to those performance claims and warranties, and if a 141 | court requires any other Contributor to pay any damages as a result, the 142 | Commercial Contributor must pay those damages. 143 | 144 | 5. NO WARRANTY 145 | 146 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON 147 | AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER 148 | EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR 149 | CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A 150 | PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the 151 | appropriateness of using and distributing the Program and assumes all risks 152 | associated with its exercise of rights under this Agreement , including but 153 | not limited to the risks and costs of program errors, compliance with 154 | applicable laws, damage to or loss of data, programs or equipment, and 155 | unavailability or interruption of operations. 156 | 157 | 6. DISCLAIMER OF LIABILITY 158 | 159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY 160 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, 161 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION 162 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 163 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 164 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE 165 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY 166 | OF SUCH DAMAGES. 167 | 168 | 7. GENERAL 169 | 170 | If any provision of this Agreement is invalid or unenforceable under 171 | applicable law, it shall not affect the validity or enforceability of the 172 | remainder of the terms of this Agreement, and without further action by the 173 | parties hereto, such provision shall be reformed to the minimum extent 174 | necessary to make such provision valid and enforceable. 175 | 176 | If Recipient institutes patent litigation against any entity (including a 177 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself 178 | (excluding combinations of the Program with other software or hardware) 179 | infringes such Recipient's patent(s), then such Recipient's rights granted 180 | under Section 2(b) shall terminate as of the date such litigation is filed. 181 | 182 | All Recipient's rights under this Agreement shall terminate if it fails to 183 | comply with any of the material terms or conditions of this Agreement and 184 | does not cure such failure in a reasonable period of time after becoming 185 | aware of such noncompliance. If all Recipient's rights under this Agreement 186 | terminate, Recipient agrees to cease use and distribution of the Program as 187 | soon as reasonably practicable. However, Recipient's obligations under this 188 | Agreement and any licenses granted by Recipient relating to the Program shall 189 | continue and survive. 190 | 191 | Everyone is permitted to copy and distribute copies of this Agreement, but in 192 | order to avoid inconsistency the Agreement is copyrighted and may only be 193 | modified in the following manner. The Agreement Steward reserves the right to 194 | publish new versions (including revisions) of this Agreement from time to 195 | time. No one other than the Agreement Steward has the right to modify this 196 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The 197 | Eclipse Foundation may assign the responsibility to serve as the Agreement 198 | Steward to a suitable separate entity. Each new version of the Agreement will 199 | be given a distinguishing version number. The Program (including 200 | Contributions) may always be distributed subject to the version of the 201 | Agreement under which it was received. In addition, after a new version of 202 | the Agreement is published, Contributor may elect to distribute the Program 203 | (including its Contributions) under the new version. Except as expressly 204 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or 205 | licenses to the intellectual property of any Contributor under this 206 | Agreement, whether expressly, by implication, estoppel or otherwise. All 207 | rights in the Program not expressly granted under this Agreement are 208 | reserved. 209 | 210 | This Agreement is governed by the laws of the State of New York and the 211 | intellectual property laws of the United States of America. No party to this 212 | Agreement will bring a legal action under this Agreement more than one year 213 | after the cause of action arose. Each party waives its rights to a jury trial 214 | in any resulting litigation. 215 | --------------------------------------------------------------------------------