Skip to content

Commit 73b28d0

Browse files
committed
Added the latest changes for monorepo and wrote README
1 parent 3e5f9ff commit 73b28d0

File tree

4,845 files changed

+564697
-24003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,845 files changed

+564697
-24003
lines changed

README.md

+57-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
1-
TODO Add it
1+
# Ensemble
2+
3+
Welcome to the Ensemble! This repository houses the Flutter runtime, various modules, and an example app called the Starter App that utilizes different packages. Ensemble allows you to build, publish, and iterate native and web apps seamlessly within your browser.
4+
5+
## What is Ensemble?
6+
7+
Ensemble is a revolutionary platform that enables app development through a declarative language. Rather than traditional coding, you configure your app using this language, allowing for rapid development and deployment. Key features of Ensemble include:
8+
9+
- **Native Experience:** Ensemble apps are native to each platform - iOS, Android, and web.
10+
- **Instant Updates:** App definitions are pushed to clients, enabling instant updates without waiting for app store approvals.
11+
- **Cutting-Edge Technologies:** Ensemble apps leverage the latest front-end technologies, such as Flutter for iOS and Android, and React for web, ensuring you're always at the forefront without worrying about technical debt.
12+
13+
## Modules
14+
15+
This monorepo contains the following modules:
16+
17+
- **Auth Module:** Handles authentication functionalities.
18+
- **Bracket Module:** Manages brackets for various purposes.
19+
- **Camera Module:** Provides camera-related features.
20+
- **Connect Module:** Facilitates connectivity features.
21+
- **Contacts Module:** Manages contact information.
22+
- **Deeplink Module:** Handles deep linking functionalities.
23+
- **File Manager Module:** Manages files within the app.
24+
- **Firebase Analytics Module:** Integrates Firebase analytics into Ensemble apps.
25+
26+
## Starter App
27+
28+
The Starter App, located in the `example` folder, serves as a demonstration of how to integrate and use different packages within Ensemble. It showcases the capabilities of Ensemble and how its modules can be utilized to create powerful applications.
29+
30+
## Links
31+
32+
- [Ensemble Website](https://ensembleui.com/)
33+
- [Ensemble Docs](https://docs.ensembleui.com/#/)
34+
- [Ensemble Studio](https://studio.ensembleui.com/)
35+
- [Ensemble Go (App Store)](https://testflight.apple.com/join/yFKnLQ1S)
36+
- [Ensemble Preview (Play Store)](https://play.google.com/store/apps/details?id=com.ensembleui.preview)
37+
38+
## Melos Integration
39+
40+
This monorepo is managed using [Melos](https://melos.invertase.dev/), a tool for managing Dart and Flutter monorepos. Below are some useful commands:
41+
42+
- **Initialize Melos:** `melos bootstrap` - Initializes the monorepo and installs dependencies.
43+
- **Add Dependency:** `melos add` - Add a dependency to one or more packages.
44+
- **Run Scripts:** `melos exec` - Run a script in each package.
45+
- **Publish Packages:** `melos release` - Publishes changed packages.
46+
47+
## How to Contribute
48+
49+
To contribute a new widget or enhance an existing one in Ensemble, follow these steps:
50+
51+
1. All Ensemble widgets can be found [here](https://github.com/EnsembleUI/ensemble/tree/main/lib/widget).
52+
2. Run the Kitchen Sink app locally by visiting [this link](https://studio.ensembleui.com/app/e24402cb-75e2-404c-866c-29e6c3dd7992/screens) and use the appId as described above.
53+
3. Explore how each widget works and how the YAML is mapped to the Flutter widget.
54+
4. Create your own app and screens with your widget (or enhanced widget) in the studio. Ensure it works flawlessly.
55+
5. When ready, create a pull request, and our team will review and provide feedback.
56+
57+
Thank you for contributing to Ensemble! 🚀

examples/starter/README.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ This starter project enables running and deploying Ensemble-powered Apps across
1313
- Run `flutter create --org com.ensembleui --project-name starter --platform=ios,android,web .` (note the period at the end). If you modified the appId, make sure the org and project name match the bundle ID.
1414
- Run `flutter pub upgrade`. Run this occasionally when the Ensemble framework has been updated.
1515
- Run the App with `flutter run`. If you currently have a running iOS or Android emulator, the command will prompt for a selection, otherwise the App will be opened in the web browser.
16-
- This will run the `helloApp` packaged with this repo. You can package your app locally, or hosted them on your own server or on Ensemble-hosted server.
16+
- This will run the `Ensemble Kitchen Sink` app. This app is available as a demo app in Ensemble Studio.
17+
- Optionally, you can package your app locally, or hosted them on your own server or on Ensemble-hosted server.
1718

1819
### Modules
1920
By default, Starter does not include all the modules or capabilities (e.g. camera, location). Excluding these capabilities by default reduces the App's size and not trigger any red flags during your App Store Review (e.g. camera code is present when your app doesn't use camera). Please follow the below steps carefully if your app requires these capabilities:
@@ -58,8 +59,16 @@ Ensemble Studio includes an Online Editor for making changes with type-ahead sup
5859
- Follow [iOS](https://docs.flutter.dev/deployment/ios), [Android](https://docs.flutter.dev/deployment/android), [MacOS](https://docs.flutter.dev/deployment/macos), [Windows](https://docs.flutter.dev/deployment/windows) release documentation.
5960

6061
## Misc
61-
### Run with remote definition (to be continued)
62+
### Run with remote definition
6263
To take advantage of Server-driven UI (change your UI at anytime from the server), you can host these definitions on your file server.
64+
When hosting on your server, follow the following steps.
65+
66+
- in ensemble/ensemble-config.yaml - specify `from: remote` under `definitions`
67+
- then change the `remote:` settings to match your server's configuration
68+
- make sure that your server is configured to serve files with extension `.ensemble` with `text/yaml` mime-type.
69+
- lastly if you are running `flutter run` with web configuration locally, make sure your webserver is properly configured to avoid CORS issues. See `custom_http_server.py` for an example
70+
71+
- You can also use the sample python server script to test it out locally, see `custom_http_server.py` and run it as `python3 custom_http_server.py` from command prompt.
6372

6473
### For Flutter developers
6574
Use [Android Studio](https://developer.android.com/studio) to open this project and run `main.dart`.
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import http.server
2+
from http.server import HTTPServer, SimpleHTTPRequestHandler
3+
import mimetypes
4+
5+
class CustomHTTPRequestHandler(SimpleHTTPRequestHandler):
6+
def guess_type(self, path):
7+
if path.endswith('.ensemble'):
8+
return 'text/yaml'
9+
return super().guess_type(path)
10+
11+
def end_headers(self):
12+
self.send_header('Access-Control-Allow-Origin', '*')
13+
self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
14+
self.send_header('Access-Control-Allow-Headers', 'X-Requested-With')
15+
self.send_header('Access-Control-Allow-Headers', 'Content-Type')
16+
super().end_headers()
17+
18+
if __name__ == '__main__':
19+
PORT = 8000
20+
handler = CustomHTTPRequestHandler
21+
httpd = HTTPServer(("", PORT), handler)
22+
23+
print(f"Serving at port {PORT}")
24+
httpd.serve_forever()
25+
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
1+
Import:
2+
- utils
3+
- common
4+
15
View:
6+
# Optional - style the screen
27
styles:
3-
useSafeArea: true
8+
scrollableView: true
9+
10+
# Optional - set the header for the screen
11+
header:
12+
title: Home
13+
onLoad: |
14+
saveName('John','Doe');
15+
console.log('name is ='+getName());
16+
17+
# Specify the body of the screen
418
body:
5-
# show 2 widgets vertically
619
Column:
20+
styles:
21+
padding: 24
22+
gap: 8
723
children:
8-
# widget displaying a text
924
- Text:
10-
text: Welcome
11-
12-
# reference a reusable widget defined in resources.ensemble
25+
text: Hello ${ensemble.storage.helloApp.name.first} ${ensemble.storage.helloApp.name.last}
1326
- MyCustomWidget1:
1427
inputs:
15-
name: Peter Parker
28+
inputName: ${ensemble.storage.helloApp.name}
29+
- Button:
30+
label: Call API in imported library
31+
onTap: |-
32+
callMockMethod();
33+
console.log('name is ='+getName());
34+
35+
36+
Global: |-
37+
//var myVar = myButton.label;
38+
function globalHello() {
39+
console.log('hello');
40+
}
41+
42+
API:
43+
mockAPI:
44+
url: https://dummyjson.com/users/1
45+
method: GET
46+
onResponse: |-
47+
saveName('Michael', 'Jordan');
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,50 @@
11
Widgets:
2-
# this widget can be referenced using ensemble.MyCustomWidget1
2+
# this widget can be referenced using MyCustomWidget1
33
MyCustomWidget1:
4+
Import:
5+
- apiUtils
6+
- common
47
inputs:
5-
- name
8+
- inputName
69
body:
7-
Text:
8-
text: Hello ${name} !
9-
10-
# another widget
10+
Column:
11+
children:
12+
- Text:
13+
text: ${inputName.first} ${inputName.last}
14+
- Button:
15+
label: sayHello in console
16+
onTap: |-
17+
saveName('Jane','Doe');
18+
console.log('name:'+getName());
19+
- MyCustomWidget2:
20+
inputs:
21+
customProperty: ${ensemble.storage.helloApp.name.first}
1122
MyCustomWidget2:
23+
inputs:
24+
- customProperty
1225
body:
13-
Text:
14-
text: hello world
26+
Column:
27+
children:
28+
- Text:
29+
text: ${customProperty}
30+
31+
Scripts:
32+
utils: |-
33+
var apiUtilsCount = 0;
34+
function callMockMethod() {
35+
apiUtilsCount++;
36+
console.log('apiUtilsCount='+apiUtilsCount);
37+
}
38+
common: |-
39+
function sayHello(name) {
40+
console.log('sayHello:'+name);
41+
}
42+
function saveName(first,last) {
43+
ensemble.storage.helloApp = {name: {first: first, last: last}};
44+
}
45+
function getName() {
46+
if ( ensemble.storage.helloApp != null ) {
47+
return ensemble.storage.helloApp.name;
48+
}
49+
return null;
50+
}

examples/starter/ensemble/ensemble-config.yaml

+28-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
definitions:
22
# where your page definitions are hosted ('local', 'remote' or 'ensemble')
3-
from: local
3+
from: ensemble
44

55
# for embedding definitions locally in your Flutter App
66
local:
@@ -16,31 +16,25 @@ definitions:
1616

1717
# for hosting definitions on your own server
1818
remote:
19+
# the path to your app on your remote server. For example - http://localhost:8000/
1920
path: <your_http_server_hosting_the_definitions>
2021
appId: helloApp
2122
appHome: Hello Home
23+
# path to your i18n (translation files) dir. If you are not using translations, just point to the one that comes with this repo. Example - http://localhost:8000/i18n
2224
i18nPath: <full_url_including_scheme_and_host_to_i18n_directory_on_your_server>
2325

2426
# for Ensemble-hosted definitions, simply enter your Ensemble's app key
2527
ensemble:
26-
# appId can be found on Ensemble Studio.
27-
appId: <my app id on studio.ensembleui.com>
28+
# appId can be found on Ensemble Studio. Navigate to your app, click the menu icon on top right, and copy your appId
29+
# here is the appId for Ensemble Kitchen sink. You can view this app under demo apps in studio.
30+
appId: e24402cb-75e2-404c-866c-29e6c3dd7992
2831
i18nPath: https://raw.githubusercontent.com/EnsembleUI/starter/main/ensemble/i18n
2932

30-
# for legacy Ensemble-hosted definitions, simply enter your Ensemble's app key
31-
legacy:
32-
# this is the Ensemble server URL. Do not change
33-
path: https://pz0mwfkp5m.execute-api.us-east-1.amazonaws.com/dev
34-
# appId can be found on Ensemble Studio.
35-
appId: <my app id>
36-
i18nPath: https://raw.githubusercontent.com/EnsembleUI/starter/main/ensemble/i18n
37-
enableCache: false
38-
3933
i18n:
4034
#locale string e.g. en, nl etc. If empty, user's device locale is used
41-
defaultLocale: nl
35+
defaultLocale: en
4236
#if strings in defaultLocale are not found, which locale to use instead
43-
fallbackLocale: en
37+
fallbackLocale: nl
4438
#use country code after locale code such as en_us
4539
useCountryCode: false
4640

@@ -76,10 +70,6 @@ services:
7670
redirectUri: msauth.com.ensembleui.starter://auth
7771
redirectScheme: msauth.com.ensembleui.starter
7872

79-
# Legacy Maps, replace with your own keys
80-
accounts:
81-
maps:
82-
mapbox_access_token: pk.eyJ1IjoiZW5zZW1ibGV1aSIsImEiOiJjbDVsYTNoeDQwaGQwM21udzhyemR3cDJrIn0.dnn3x8nZVj5ZFO3tn5l8Ww
8373

8474
# override any environment variables on studio.ensembleui.com here
8575
# e.g. load local assets instead of URL
@@ -90,3 +80,23 @@ environmentVariables:
9080
# This asset value is empty, meaning a reference of {env.exampleAssetVariable}pic.png
9181
# will be loaded locally from /ensemble/assets/pic.png
9282
exampleAssetVariable:
83+
84+
# uncomment the following when using firebase analytics.
85+
# For iOS - Make sure that GoogleService-Info.plist is placed under the ios/Runner folder AND has been added to the Xcode project. Just putting the file under Runner folder is NOT sufficient, it has to be added to the prject using Xcode.
86+
# For Android - Make sure that google-services.json is placed under android/app folder
87+
# For Web - make sure that the web config is present under account/firebase/web below.
88+
#analytics:
89+
# provider: firebase
90+
# enabled: true
91+
# enableConsoleLogs: true
92+
# uncomment the following when using Firebase analytics for the Web and replace the values with the values from your Firebase app.
93+
#accounts:
94+
# firebase:
95+
# web:
96+
# apiKey: "xxxxx"
97+
# authDomain: "xxxxx"
98+
# projectId: "xxxx"
99+
# storageBucket: "xxxxx"
100+
# messagingSenderId: "nnnnnn"
101+
# appId: "n:xxxxxxx"
102+
# measurementId: "G-xxxxx"

examples/starter/ios/Podfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
platform :ios, '12.0'
2+
platform :ios, '13.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@@ -32,7 +32,7 @@ target 'Runner' do
3232
use_modular_headers!
3333

3434
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35-
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.15.0'
35+
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.22.0'
3636
target 'RunnerTests' do
3737
inherit! :search_paths
3838
end

examples/starter/ios/Runner/AppDelegate.swift

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import UIKit
22
import Flutter
3-
import GoogleMaps
3+
// import GoogleMaps
4+
import flutter_local_notifications
45

56
@UIApplicationMain
67
@objc class AppDelegate: FlutterAppDelegate {
@@ -13,7 +14,14 @@ import GoogleMaps
1314
) -> Bool {
1415
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
1516
methodChannel = FlutterMethodChannel(name: AppDelegate.methodChannelName, binaryMessenger: controller.binaryMessenger)
16-
GMSServices.provideAPIKey("AIzaSyD8vwvoaEPEgYemp1EkIETetJMvyS4Ptqk")
17+
// GMSServices.provideAPIKey("AIzaSyD8vwvoaEPEgYemp1EkIETetJMvyS4Ptqk")
18+
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
19+
GeneratedPluginRegistrant.register(with: registry) }
20+
21+
if #available(iOS 10.0, *) {
22+
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
23+
}
24+
1725
GeneratedPluginRegistrant.register(with: self)
1826
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
1927
}

0 commit comments

Comments
 (0)