Android/iOS demos (PR #2056)

Merge from google/mobile-demos
This commit is contained in:
Andrew n marshall
2018-09-19 12:58:28 -07:00
committed by GitHub
51 changed files with 2192 additions and 0 deletions

27
demos/mobile/android/.gitignore vendored Normal file
View File

@@ -0,0 +1,27 @@
/build
/captures
/app/src/main/assets/blockly/msg
.settings
.project
# Local Settings
local.properties
# Project files
*.komodoproject
.gradle
*.iml
.idea
# Build files
*.pyc
*.apk
*.ap_
*.class
*.dex
# OSX Files
.DS_Store
# Windows Files
Thumb.db

View File

@@ -0,0 +1,45 @@
# Blockly in an Android WebView
This code demonstrates how to get Blockly running in an Android app by
embedding it in a WebView.
### BlocklyWebViewFragment
Most of the work is done within the fragment class `BlocklyWebViewFragment`.
This fragment instantiates the WebView, loads the HTML
(`assets/blockly/webview.html`), and provides a few helper methods.
### Copying web assets with gradle
This android project copies the necessary files from the main Blockly
repository (i.e., parent directory). In `app/build.gradle`, note the
`copyBlocklyWebFiles` task and `preBuild.dependsOn copyBlocklyWebFiles` line.
In your own project, these files can be placed directly in the `assets/blockly`
directory without the copy step. However, if you do use the copy step, make
sure you adapt the copy paths appropriately. Additionally, you may want to
update your `.gitignore` or similar file.
### Loading Block Definitions and Generator functions
The `webview.html` loads the block definitions and generator functions directly
into the page, without support or coordination with the Android classes. This
assumes the app will always utilize the same blocks. This does not mean all
blocks are visible to the user all the time; that is controlled by the toolbox
and workspace files. This should accommodate almost all applications.
This does mean loading your own block definitions and generators will involve
editing the HTML, adding you own `<script>` tag, and possibly removing
the `blocks_compressed.js` if you do not use any standard blocks.
### Connecting a Developer Console
While the console output of the WebView will be visible in the Android log
(i.e., `logcat`), some times a more intrusive approach is required to isolate
a problem. For instructions on connecting the WebView to Chrome's Developer
Tools, see this article:
https://developers.google.com/web/tools/chrome-devtools/remote-debugging/
The WebView must be visible in the connect device or emulator before the
WebView will included in the list of available pages to connect to.

7
demos/mobile/android/app/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
/build
# Files copied during build:
src/main/assets/blockly/blockly_compressed.js
src/main/assets/blockly/blocks_compressed.js
src/main/assets/blockly/media
src/main/assets/blockly/webview.html

View File

@@ -0,0 +1,50 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId 'com.google.blockly.android.webview.demo'
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
task copyBlocklyHtmlFile(type: Copy) {
from('../../html') {
include 'index.html'
}
into project(':app').file('./src/main/assets/blockly')
rename('index.html', 'webview.html')
}
task copyBlocklyMoreFiles(type: Copy) {
from('../../../..') {
include 'blockly_compressed.js', 'blocks_compressed.js', 'msg/js/**', 'media/**'
exclude 'media/test_*'
}
into project(':app').file('./src/main/assets/blockly')
}
project.afterEvaluate {
preBuild.dependsOn(copyBlocklyHtmlFile, copyBlocklyMoreFiles)
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,26 @@
package com.example.blocklywebview;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.blocklywebview", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.blocklywebview">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.google.blockly.android.webview.demo.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,333 @@
var BLOCKLY_TOOLBOX_XML = BLOCKLY_TOOLBOX_XML || Object.create(null);
/* BEGINNING BLOCKLY_TOOLBOX_XML ASSIGNMENT. DO NOT EDIT. USE BLOCKLY DEVTOOLS. */
BLOCKLY_TOOLBOX_XML['standard'] =
// From XML string/file, replace ^\s?(\s*)?(<.*>)$ with \+$1'$2'
// Tweak first and last line.
'<xml>'
+ '<category name="Logic" colour="%{BKY_LOGIC_HUE}">'
+ '<block type="controls_if"></block>'
+ '<block type="logic_compare"></block>'
+ '<block type="logic_operation"></block>'
+ '<block type="logic_negate"></block>'
+ '<block type="logic_boolean"></block>'
+ '<block type="logic_null" disabled="true"></block>'
+ '<block type="logic_ternary"></block>'
+ '</category>'
+ '<category name="Loops" colour="%{BKY_LOOPS_HUE}">'
+ '<block type="controls_repeat_ext">'
+ '<value name="TIMES">'
+ '<shadow type="math_number">'
+ '<field name="NUM">10</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="controls_repeat" disabled="true"></block>'
+ '<block type="controls_whileUntil"></block>'
+ '<block type="controls_for">'
+ '<value name="FROM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="TO">'
+ '<shadow type="math_number">'
+ '<field name="NUM">10</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="BY">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="controls_forEach"></block>'
+ '<block type="controls_flow_statements"></block>'
+ '</category>'
+ '<category name="Math" colour="%{BKY_MATH_HUE}">'
+ '<block type="math_number" gap="32">'
+ '<field name="NUM">123</field>'
+ '</block>'
+ '<block type="math_arithmetic">'
+ '<value name="A">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="B">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_single">'
+ '<value name="NUM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">9</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_trig">'
+ '<value name="NUM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">45</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_constant"></block>'
+ '<block type="math_number_property">'
+ '<value name="NUMBER_TO_CHECK">'
+ '<shadow type="math_number">'
+ '<field name="NUM">0</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_round">'
+ '<value name="NUM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">3.1</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_on_list"></block>'
+ '<block type="math_modulo">'
+ '<value name="DIVIDEND">'
+ '<shadow type="math_number">'
+ '<field name="NUM">64</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="DIVISOR">'
+ '<shadow type="math_number">'
+ '<field name="NUM">10</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_constrain">'
+ '<value name="VALUE">'
+ '<shadow type="math_number">'
+ '<field name="NUM">50</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="LOW">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="HIGH">'
+ '<shadow type="math_number">'
+ '<field name="NUM">100</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_random_int">'
+ '<value name="FROM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="TO">'
+ '<shadow type="math_number">'
+ '<field name="NUM">100</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_random_float"></block>'
+ '</category>'
+ '<category name="Text" colour="%{BKY_TEXTS_HUE}">'
+ '<block type="text"></block>'
+ '<block type="text_join"></block>'
+ '<block type="text_append">'
+ '<value name="TEXT">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_length">'
+ '<value name="VALUE">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_isEmpty">'
+ '<value name="VALUE">'
+ '<shadow type="text">'
+ '<field name="TEXT"></field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_indexOf">'
+ '<value name="VALUE">'
+ '<block type="variables_get">'
+ '<field name="VAR">text</field>'
+ '</block>'
+ '</value>'
+ '<value name="FIND">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_charAt">'
+ '<value name="VALUE">'
+ '<block type="variables_get">'
+ '<field name="VAR">text</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="text_getSubstring">'
+ '<value name="STRING">'
+ '<block type="variables_get">'
+ '<field name="VAR">text</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="text_changeCase">'
+ '<value name="TEXT">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_trim">'
+ '<value name="TEXT">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_count">'
+ '<value name="SUB">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '<value name="TEXT">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_replace">'
+ '<value name="FROM">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '<value name="TO">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '<value name="TEXT">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_reverse">'
+ '<value name="TEXT">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '</block>'
+ '<label text="Input/Output:" web-class="ioLabel"></label>'
+ '<block type="text_print">'
+ '<value name="TEXT">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_prompt_ext">'
+ '<value name="TEXT">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '</category>'
+ '<category name="Lists" colour="%{BKY_LISTS_HUE}">'
+ '<block type="lists_create_with">'
+ '<mutation items="0"></mutation>'
+ '</block>'
+ '<block type="lists_create_with"></block>'
+ '<block type="lists_repeat">'
+ '<value name="NUM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">5</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="lists_length"></block>'
+ '<block type="lists_isEmpty"></block>'
+ '<block type="lists_indexOf">'
+ '<value name="VALUE">'
+ '<block type="variables_get">'
+ '<field name="VAR">list</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="lists_getIndex">'
+ '<value name="VALUE">'
+ '<block type="variables_get">'
+ '<field name="VAR">list</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="lists_setIndex">'
+ '<value name="LIST">'
+ '<block type="variables_get">'
+ '<field name="VAR">list</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="lists_getSublist">'
+ '<value name="LIST">'
+ '<block type="variables_get">'
+ '<field name="VAR">list</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="lists_split">'
+ '<value name="DELIM">'
+ '<shadow type="text">'
+ '<field name="TEXT">,</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="lists_sort"></block>'
+ '<block type="lists_reverse"></block>'
+ '</category>'
+ '<category name="Colour" colour="%{BKY_COLOUR_HUE}">'
+ '<block type="colour_picker"></block>'
+ '<block type="colour_random"></block>'
+ '<block type="colour_rgb">'
+ '<value name="RED">'
+ '<shadow type="math_number">'
+ '<field name="NUM">100</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="GREEN">'
+ '<shadow type="math_number">'
+ '<field name="NUM">50</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="BLUE">'
+ '<shadow type="math_number">'
+ '<field name="NUM">0</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="colour_blend">'
+ '<value name="COLOUR1">'
+ '<shadow type="colour_picker">'
+ '<field name="COLOUR">#ff0000</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="COLOUR2">'
+ '<shadow type="colour_picker">'
+ '<field name="COLOUR">#3333ff</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="RATIO">'
+ '<shadow type="math_number">'
+ '<field name="NUM">0.5</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '</category>'
+ '<sep></sep>'
+ '<category name="Variables" colour="%{BKY_VARIABLES_HUE}" custom="VARIABLE"></category>'
+ '<category name="Functions" colour="%{BKY_PROCEDURES_HUE}" custom="PROCEDURE"></category>'
+ '</xml>';
/* END BLOCKLY_TOOLBOX_XML ASSIGNMENT. DO NOT EDIT. */

View File

@@ -0,0 +1,37 @@
package com.google.blockly.android.webview;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
/**
* This fragments contains and manages the web view that hosts Blockly.
*/
public class BlocklyWebViewFragment extends Fragment {
protected @Nullable WebView mWebView = null;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
mWebView = new WebView(inflater.getContext());
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("file:///android_asset/blockly/webview.html");
return mWebView;
}
// TODO: Method to invoke code generation
// TODO: Method to load workspace from string (or InputStream?)
// TODO: Method to serialize workspace to string (or OutputStream?)
// TODO: Clear / reset workspace
// TODO: Load toolbox
// TODO: Listener for event JSON
// TODO: Method to evaluate JavaScript string in the WebView
}

View File

@@ -0,0 +1,18 @@
package com.google.blockly.android.webview.demo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.example.blocklywebview.R;
/**
* The primary activity of the demo application. The activity embeds the
* {@link com.google.blockly.android.webview.BlocklyWebViewFragment}.
*/
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

View File

@@ -0,0 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeColor="#00000000"
android:strokeWidth="1">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0"/>
<item
android:color="#00000000"
android:offset="1.0"/>
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeColor="#00000000"
android:strokeWidth="1"/>
</vector>

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.google.blockly.android.webview.demo.MainActivity">
<fragment
android:id="@+id/blockly_webview"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:name="com.google.blockly.android.webview.BlocklyWebViewFragment"
/>
</android.support.constraint.ConstraintLayout>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">Blockly WebView</string>
</resources>

View File

@@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@@ -0,0 +1,17 @@
package com.example.blocklywebview;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@@ -0,0 +1,27 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@@ -0,0 +1,13 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Tue Jul 24 10:14:53 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

172
demos/mobile/android/gradlew vendored Executable file
View File

@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
demos/mobile/android/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1 @@
include ':app'

View File

@@ -0,0 +1,29 @@
<!DOCTYPE html>
<!-- HTML file to host Blockly in a mobile WebView. -->
<html>
<head>
<style type="text/css">
html, body, #blocklyDiv {
border: 0;
height: 100%;
margin: 0;
padding: 0;
width: 100%;
}
</style>
<script src="blockly_compressed.js"></script>
<script src="blocks_compressed.js"></script>
<!-- TODO: Select msg file based on locale. -->
<script src="msg/js/en.js"></script>
<script src="toolbox_standard.js"></script>
</head>
<body>
<div id="blocklyDiv"></div>
<script type="text/javascript">
var workspacePlayground = Blockly.inject('blocklyDiv', {
media: 'media/',
toolbox: BLOCKLY_TOOLBOX_XML['standard']
});
</script>
</body>
</html>

29
demos/mobile/ios/.gitignore vendored Normal file
View File

@@ -0,0 +1,29 @@
# Files copied by cp_resources.sh
/Resources/Non-Localized/Blockly/blockly_compressed.js
/Resources/Non-Localized/Blockly/blocks_compressed.js
/Resources/Non-Localized/Blockly/media
/Resources/Non-Localized/Blockly/msg
/Resources/Non-Localized/Blockly/webview.html
# Xcode.gitignore
## User settings
xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

View File

@@ -0,0 +1,390 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
AB036C55211B89D600CCC9D8 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB036C54211B89D600CCC9D8 /* WebKit.framework */; };
AB980111211A37B50025AFF2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB980110211A37B50025AFF2 /* AppDelegate.swift */; };
AB980113211A37B50025AFF2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB980112211A37B50025AFF2 /* ViewController.swift */; };
AB980116211A37B50025AFF2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB980114211A37B50025AFF2 /* Main.storyboard */; };
AB980118211A37B70025AFF2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AB980117211A37B70025AFF2 /* Assets.xcassets */; };
AB98011B211A37B70025AFF2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB980119211A37B70025AFF2 /* LaunchScreen.storyboard */; };
ABA1B7FC212214E7000D3CC5 /* Blockly in Resources */ = {isa = PBXBuildFile; fileRef = ABA1B7FB212214E7000D3CC5 /* Blockly */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
AB036C54211B89D600CCC9D8 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
AB98010D211A37B50025AFF2 /* Blockly WebView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Blockly WebView.app"; sourceTree = BUILT_PRODUCTS_DIR; };
AB980110211A37B50025AFF2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
AB980112211A37B50025AFF2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
AB980115211A37B50025AFF2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
AB980117211A37B70025AFF2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
AB98011A211A37B70025AFF2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
AB98011C211A37B70025AFF2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
ABA1B7FB212214E7000D3CC5 /* Blockly */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Blockly; path = "Resources/Non-Localized/Blockly"; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
AB98010A211A37B50025AFF2 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AB036C55211B89D600CCC9D8 /* WebKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
AB036C53211B89D500CCC9D8 /* Frameworks */ = {
isa = PBXGroup;
children = (
AB036C54211B89D600CCC9D8 /* WebKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
AB980104211A37B50025AFF2 = {
isa = PBXGroup;
children = (
AB98010F211A37B50025AFF2 /* Blockly WebView */,
AB98010E211A37B50025AFF2 /* Products */,
AB036C53211B89D500CCC9D8 /* Frameworks */,
);
sourceTree = "<group>";
};
AB98010E211A37B50025AFF2 /* Products */ = {
isa = PBXGroup;
children = (
AB98010D211A37B50025AFF2 /* Blockly WebView.app */,
);
name = Products;
sourceTree = "<group>";
};
AB98010F211A37B50025AFF2 /* Blockly WebView */ = {
isa = PBXGroup;
children = (
ABA1B7F9212214B9000D3CC5 /* Resources */,
AB980110211A37B50025AFF2 /* AppDelegate.swift */,
AB980112211A37B50025AFF2 /* ViewController.swift */,
AB980114211A37B50025AFF2 /* Main.storyboard */,
AB980117211A37B70025AFF2 /* Assets.xcassets */,
AB980119211A37B70025AFF2 /* LaunchScreen.storyboard */,
AB98011C211A37B70025AFF2 /* Info.plist */,
);
path = "Blockly WebView";
sourceTree = "<group>";
};
ABA1B7F9212214B9000D3CC5 /* Resources */ = {
isa = PBXGroup;
children = (
ABA1B7FA212214C6000D3CC5 /* Non-Localized */,
);
path = Resources;
sourceTree = "<group>";
};
ABA1B7FA212214C6000D3CC5 /* Non-Localized */ = {
isa = PBXGroup;
children = (
ABA1B7FB212214E7000D3CC5 /* Blockly */,
);
path = "Non-Localized";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
AB98010C211A37B50025AFF2 /* Blockly WebView */ = {
isa = PBXNativeTarget;
buildConfigurationList = AB98011F211A37B70025AFF2 /* Build configuration list for PBXNativeTarget "Blockly WebView" */;
buildPhases = (
AB980109211A37B50025AFF2 /* Sources */,
AB98010A211A37B50025AFF2 /* Frameworks */,
ABEDABD1212372E700A66667 /* ShellScript */,
AB98010B211A37B50025AFF2 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Blockly WebView";
productName = "Blockly WebView";
productReference = AB98010D211A37B50025AFF2 /* Blockly WebView.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
AB980105211A37B50025AFF2 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0940;
LastUpgradeCheck = 0940;
ORGANIZATIONNAME = Google;
TargetAttributes = {
AB98010C211A37B50025AFF2 = {
CreatedOnToolsVersion = 9.4.1;
};
};
};
buildConfigurationList = AB980108211A37B50025AFF2 /* Build configuration list for PBXProject "Blockly WebView" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = AB980104211A37B50025AFF2;
productRefGroup = AB98010E211A37B50025AFF2 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
AB98010C211A37B50025AFF2 /* Blockly WebView */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
AB98010B211A37B50025AFF2 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AB98011B211A37B70025AFF2 /* LaunchScreen.storyboard in Resources */,
AB980118211A37B70025AFF2 /* Assets.xcassets in Resources */,
AB980116211A37B50025AFF2 /* Main.storyboard in Resources */,
ABA1B7FC212214E7000D3CC5 /* Blockly in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
ABEDABD1212372E700A66667 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = ./cp_resources.sh;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
AB980109211A37B50025AFF2 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AB980113211A37B50025AFF2 /* ViewController.swift in Sources */,
AB980111211A37B50025AFF2 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
AB980114211A37B50025AFF2 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
AB980115211A37B50025AFF2 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
AB980119211A37B70025AFF2 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
AB98011A211A37B70025AFF2 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
AB98011D211A37B70025AFF2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
AB98011E211A37B70025AFF2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
AB980120211A37B70025AFF2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 3KZF7Q7Q49;
INFOPLIST_FILE = "Blockly WebView/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.google.kidscoding.Blockly-WebView";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
AB980121211A37B70025AFF2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 3KZF7Q7Q49;
INFOPLIST_FILE = "Blockly WebView/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.google.kidscoding.Blockly-WebView";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
AB980108211A37B50025AFF2 /* Build configuration list for PBXProject "Blockly WebView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AB98011D211A37B70025AFF2 /* Debug */,
AB98011E211A37B70025AFF2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
AB98011F211A37B70025AFF2 /* Build configuration list for PBXNativeTarget "Blockly WebView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AB980120211A37B70025AFF2 /* Debug */,
AB980121211A37B70025AFF2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = AB980105211A37B50025AFF2 /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Blockly WebView.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Blockly WebView.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,46 @@
//
// AppDelegate.swift
// Blockly WebView
//
// Created by Andrew Marshall on 8/7/18.
// Copyright © 2018 Google. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

View File

@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Blockly_WebView" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<wkWebView multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HmE-ZW-QKv">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<wkWebViewConfiguration key="configuration" allowsAirPlayForMediaPlayback="NO">
<dataDetectorTypes key="dataDetectorTypes"/>
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<connections>
<outlet property="webView" destination="HmE-ZW-QKv" id="OGc-PV-TAB"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-10" y="51"/>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,38 @@
//
// ViewController.swift
// Blockly WebView
//
// Created by Andrew Marshall on 8/7/18.
// Copyright © 2018 Google. All rights reserved.
//
import UIKit
import WebKit
class ViewController: UIViewController {
/// The name used to reference this iOS object when executing callbacks from the JS code.
/// If this value is changed, it should also be changed in the `CODE_GENERATOR_BRIDGE_JS` file.
fileprivate static let HOST_HTML = "Blockly/webview.html"
@IBOutlet weak var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
loadWebView()
}
func loadWebView() {
if let htmlUrl = Bundle.main.url(forResource: "webview", withExtension: "html", subdirectory: "Blockly") {
webView.load(URLRequest.init(url: htmlUrl))
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

View File

@@ -0,0 +1,333 @@
var BLOCKLY_TOOLBOX_XML = BLOCKLY_TOOLBOX_XML || Object.create(null);
/* BEGINNING BLOCKLY_TOOLBOX_XML ASSIGNMENT. DO NOT EDIT. USE BLOCKLY DEVTOOLS. */
BLOCKLY_TOOLBOX_XML['standard'] =
// From XML string/file, replace ^\s?(\s*)?(<.*>)$ with \+$1'$2'
// Tweak first and last line.
'<xml>'
+ '<category name="Logic" colour="%{BKY_LOGIC_HUE}">'
+ '<block type="controls_if"></block>'
+ '<block type="logic_compare"></block>'
+ '<block type="logic_operation"></block>'
+ '<block type="logic_negate"></block>'
+ '<block type="logic_boolean"></block>'
+ '<block type="logic_null" disabled="true"></block>'
+ '<block type="logic_ternary"></block>'
+ '</category>'
+ '<category name="Loops" colour="%{BKY_LOOPS_HUE}">'
+ '<block type="controls_repeat_ext">'
+ '<value name="TIMES">'
+ '<shadow type="math_number">'
+ '<field name="NUM">10</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="controls_repeat" disabled="true"></block>'
+ '<block type="controls_whileUntil"></block>'
+ '<block type="controls_for">'
+ '<value name="FROM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="TO">'
+ '<shadow type="math_number">'
+ '<field name="NUM">10</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="BY">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="controls_forEach"></block>'
+ '<block type="controls_flow_statements"></block>'
+ '</category>'
+ '<category name="Math" colour="%{BKY_MATH_HUE}">'
+ '<block type="math_number" gap="32">'
+ '<field name="NUM">123</field>'
+ '</block>'
+ '<block type="math_arithmetic">'
+ '<value name="A">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="B">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_single">'
+ '<value name="NUM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">9</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_trig">'
+ '<value name="NUM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">45</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_constant"></block>'
+ '<block type="math_number_property">'
+ '<value name="NUMBER_TO_CHECK">'
+ '<shadow type="math_number">'
+ '<field name="NUM">0</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_round">'
+ '<value name="NUM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">3.1</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_on_list"></block>'
+ '<block type="math_modulo">'
+ '<value name="DIVIDEND">'
+ '<shadow type="math_number">'
+ '<field name="NUM">64</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="DIVISOR">'
+ '<shadow type="math_number">'
+ '<field name="NUM">10</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_constrain">'
+ '<value name="VALUE">'
+ '<shadow type="math_number">'
+ '<field name="NUM">50</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="LOW">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="HIGH">'
+ '<shadow type="math_number">'
+ '<field name="NUM">100</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_random_int">'
+ '<value name="FROM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">1</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="TO">'
+ '<shadow type="math_number">'
+ '<field name="NUM">100</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="math_random_float"></block>'
+ '</category>'
+ '<category name="Text" colour="%{BKY_TEXTS_HUE}">'
+ '<block type="text"></block>'
+ '<block type="text_join"></block>'
+ '<block type="text_append">'
+ '<value name="TEXT">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_length">'
+ '<value name="VALUE">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_isEmpty">'
+ '<value name="VALUE">'
+ '<shadow type="text">'
+ '<field name="TEXT"></field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_indexOf">'
+ '<value name="VALUE">'
+ '<block type="variables_get">'
+ '<field name="VAR">text</field>'
+ '</block>'
+ '</value>'
+ '<value name="FIND">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_charAt">'
+ '<value name="VALUE">'
+ '<block type="variables_get">'
+ '<field name="VAR">text</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="text_getSubstring">'
+ '<value name="STRING">'
+ '<block type="variables_get">'
+ '<field name="VAR">text</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="text_changeCase">'
+ '<value name="TEXT">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_trim">'
+ '<value name="TEXT">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_count">'
+ '<value name="SUB">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '<value name="TEXT">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_replace">'
+ '<value name="FROM">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '<value name="TO">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '<value name="TEXT">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_reverse">'
+ '<value name="TEXT">'
+ '<shadow type="text"></shadow>'
+ '</value>'
+ '</block>'
+ '<label text="Input/Output:" web-class="ioLabel"></label>'
+ '<block type="text_print">'
+ '<value name="TEXT">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="text_prompt_ext">'
+ '<value name="TEXT">'
+ '<shadow type="text">'
+ '<field name="TEXT">abc</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '</category>'
+ '<category name="Lists" colour="%{BKY_LISTS_HUE}">'
+ '<block type="lists_create_with">'
+ '<mutation items="0"></mutation>'
+ '</block>'
+ '<block type="lists_create_with"></block>'
+ '<block type="lists_repeat">'
+ '<value name="NUM">'
+ '<shadow type="math_number">'
+ '<field name="NUM">5</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="lists_length"></block>'
+ '<block type="lists_isEmpty"></block>'
+ '<block type="lists_indexOf">'
+ '<value name="VALUE">'
+ '<block type="variables_get">'
+ '<field name="VAR">list</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="lists_getIndex">'
+ '<value name="VALUE">'
+ '<block type="variables_get">'
+ '<field name="VAR">list</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="lists_setIndex">'
+ '<value name="LIST">'
+ '<block type="variables_get">'
+ '<field name="VAR">list</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="lists_getSublist">'
+ '<value name="LIST">'
+ '<block type="variables_get">'
+ '<field name="VAR">list</field>'
+ '</block>'
+ '</value>'
+ '</block>'
+ '<block type="lists_split">'
+ '<value name="DELIM">'
+ '<shadow type="text">'
+ '<field name="TEXT">,</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="lists_sort"></block>'
+ '<block type="lists_reverse"></block>'
+ '</category>'
+ '<category name="Colour" colour="%{BKY_COLOUR_HUE}">'
+ '<block type="colour_picker"></block>'
+ '<block type="colour_random"></block>'
+ '<block type="colour_rgb">'
+ '<value name="RED">'
+ '<shadow type="math_number">'
+ '<field name="NUM">100</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="GREEN">'
+ '<shadow type="math_number">'
+ '<field name="NUM">50</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="BLUE">'
+ '<shadow type="math_number">'
+ '<field name="NUM">0</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '<block type="colour_blend">'
+ '<value name="COLOUR1">'
+ '<shadow type="colour_picker">'
+ '<field name="COLOUR">#ff0000</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="COLOUR2">'
+ '<shadow type="colour_picker">'
+ '<field name="COLOUR">#3333ff</field>'
+ '</shadow>'
+ '</value>'
+ '<value name="RATIO">'
+ '<shadow type="math_number">'
+ '<field name="NUM">0.5</field>'
+ '</shadow>'
+ '</value>'
+ '</block>'
+ '</category>'
+ '<sep></sep>'
+ '<category name="Variables" colour="%{BKY_VARIABLES_HUE}" custom="VARIABLE"></category>'
+ '<category name="Functions" colour="%{BKY_PROCEDURES_HUE}" custom="PROCEDURE"></category>'
+ '</xml>';
/* END BLOCKLY_TOOLBOX_XML ASSIGNMENT. DO NOT EDIT. */

View File

@@ -0,0 +1,20 @@
#!/bin/bash
set -eux
BLOCKLY_ROOT=../../..
IOS_RESOURCES=Resources/Non-Localized/Blockly
MORE_FILES_TO_COPY=(
"blockly_compressed.js"
"blocks_compressed.js"
"media"
"msg/js"
)
mkdir -p $IOS_RESOURCES/media
mkdir -p $IOS_RESOURCES/msg/js
rsync -rp ../html/index.html $IOS_RESOURCES/webview.html
for i in "${MORE_FILES_TO_COPY[@]}"; do # The quotes are necessary here
TARGET_DIR=$(dirname $IOS_RESOURCES/$i)
rsync -rp $BLOCKLY_ROOT/$i $TARGET_DIR
done