Skip to content
This repository was archived by the owner on Aug 12, 2022. It is now read-only.

Commit 72c8112

Browse files
authored
Merge pull request #324 from LLK/release/2020-09-14
[MASTER] Release/2020 09 14
2 parents 4817760 + 7f9ddab commit 72c8112

Some content is hidden

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

71 files changed

+11437
-1001
lines changed

.github/CONTRIBUTING.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## Contributing
2+
The development of ScratchJr is an ongoing process, and we love to have people in the ScratchJr and open source communities help us along the way.
3+
4+
### Ways to Help
5+
6+
* **Documenting bugs**
7+
* If you've identified a bug in ScratchJr you should first check to see if it's been filed as an issue, if not you can file one. Make sure you follow the issue template.
8+
* It's important that we can consistently reproduce issues. When writing an issue, be sure to follow our [reproduction step guidelines](https://github.com/LLK/scratch-gui/wiki/Writing-good-repro-steps). The example is based on Scratch, but the same principles apply to ScratchJr.
9+
* Some issues are marked "Needs Repro". Adding a comment with good reproduction steps to those issues is a great way to help.
10+
11+
* **Fixing bugs**
12+
* You can request to fix a bug in a comment on the issue if you at mention the repo coordinator, who for this repo is @chrisgarrity.
13+
* If the issue is marked "Help Wanted" you can go ahead and start working on it!
14+
* **We will only accept Pull Requests for bugs that have an issue filed that has a priority label**
15+
* If you're interested in fixing a bug with no issue, file the issue first and wait for it to have a priority added to it.
16+
17+
* We are not looking for Pull Requests ("PR") for every issue and may deny a PR if it doesn't fit our criteria.
18+
* We are far more likely to accept a PR if it is for an issue marked with Help Wanted.
19+
* We will not accept PRs for issues marked with "Needs Discussion" or "Needs Design."
20+
21+
### Learning Git and Github
22+
23+
If you want to work on fixing issues, you should be familiar with Git and Github.
24+
25+
* [Learn Git branching](https://learngitbranching.js.org/) includes an introduction to basic git commands and useful branching features.
26+
* Here's a general introduction to [contributing to an open source project](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github).
27+
28+
**Important:** we follow the [Github Flow process](https://guides.github.com/introduction/flow/) as our development process.
29+
30+
### How to Fix Bugs
31+
1. Identify which Github issue you are working on. Leave a comment on the issue to let us (and other contributors) know you're working on it.
32+
2. Make sure you have a fork of this repo (see [Github's forking a repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) for details)
33+
3. Switch to the `develop` branch, and pull down the latest changes from upstream
34+
4. Run the code, and reproduce the problem
35+
5. Create your branch from the `develop` branch
36+
6. Make code changes to fix the problem
37+
7. Run `npm test` to make sure that your changes pass our tests
38+
8. Commit your changes
39+
9. Push your branch to your fork
40+
10. Create your pull request
41+
1. Make sure to follow the template in the PR description
42+
1. Remember to check the “[Allow edits from maintainers](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)” box
43+
44+
When submitting pull requests keep in mind:
45+
* please be patient -- it can take a while to find time to review them
46+
* try to change the least amount of code necessary to fix the bug
47+
* the code can't be radically changed without significant coordination with the Scratch Team, so these types of changes should be avoided
48+
* if you find yourself changing a substantial amount of code or considering radical changes, please ask for clarification -- we may have envisioned a different approach, or underestimated the amount of effort
49+
50+
### Suggestions
51+
![Block sketch](https://user-images.githubusercontent.com/3431616/77192550-1dcebe00-6ab3-11ea-9606-8ecd8500c958.png)
52+
53+
Please note: **_we are unlikely to accept PRs with new features that haven't been thought through and discussed as a group_**.
54+
55+
Why? Because we have a strong belief in the value of keeping things simple for new users. It's been said that the Scratch Team spends about one hour of design discussion for every pixel in Scratch or ScratchJr. To learn more about our design philosophy, see [the Scratch Developers page](https://scratch.mit.edu/developers), or [this paper](https://ase.tufts.edu/DevTech/publications/scratchjr_idc_2013.pdf).
56+
57+
### Other resources
58+
Beyond this repo, there are also some other resources that you might want to take a look at:
59+
* [Community Guidelines](https://github.com/LLK/scratch-www/wiki/Community-Guidelines) (we find it important to maintain a constructive and welcoming community for ScratchJr, just like on Scratch)
60+
* [Open Source forum](https://scratch.mit.edu/discuss/49/) on Scratch

.github/ISSUE_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### Expected Behavior
2+
3+
_Please describe what should happen_
4+
5+
### Actual Behavior
6+
7+
_Describe what actually happens, screenshots are helpful._
8+
9+
### Steps to Reproduce
10+
11+
_Explain what someone needs to do in order to see what's described in *Actual behavior* above_
12+
13+
### Device and Operating System
14+
15+
_e.g. iPad mini, iOS 10.3 or Samsung Galaxy Tab S6, Android 10_

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### Resolves
2+
3+
_What Github issue does this resolve (please include link)? Please make sure that the PR title reflects what the PR will do, not what is changing.
4+
Please do not submit PRs that are not associated with a Github issue, or that only partially implement an issue._
5+
6+
- Resolves #
7+
8+
### Proposed Changes
9+
10+
_Describe what this Pull Request does_
11+
12+
### Reason for Changes
13+
14+
_Explain why these changes should be made_
15+
16+
### Test Coverage
17+
18+
_Please show how you have added tests to cover your changes, or provide the testing steps to verify the change. Screenshots that show the change are also helpful._

CONTRIBUTING.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

android/ScratchJr/.idea/codeStyles/Project.xml

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/ScratchJr/.idea/misc.xml

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/ScratchJr/app/src/main/java/org/scratchjr/android/JavaScriptDirectInterface.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,4 +629,24 @@ public void setAnalyticsPlacePref(String place) {
629629
_activity.setAnalyticsPlacePref(place);
630630
}
631631
}
632+
633+
/**
634+
* Record a user property
635+
* @param prefObjStr single key-value JSON string, like "{\"school\": \"Central High\"}"
636+
*/
637+
@JavascriptInterface
638+
public void setAnalyticsPref(String prefObjStr) {
639+
if (prefObjStr != null) {
640+
try {
641+
JSONObject jsonObject = new JSONObject(prefObjStr);
642+
JSONArray jsonArray = jsonObject.names();
643+
String key = jsonArray.getString(0);
644+
String value = jsonObject.getString(key);
645+
_activity.setAnalyticsPref(key, value);
646+
} catch (JSONException e) {
647+
Log.e(LOG_TAG, "JSON error: " + e.getMessage(), e);
648+
return;
649+
}
650+
}
651+
}
632652
}

android/ScratchJr/app/src/main/java/org/scratchjr/android/ScratchJrActivity.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ private void receiveProject(Uri projectUri) {
337337
}
338338
// We send the project Base64-encoded to JavaScript where it's processed and unpacked
339339
String base64Project = Base64.encodeToString(projectData.toByteArray(), Base64.DEFAULT);
340-
runJavaScript("iOS.loadProjectFromSjr('" + base64Project + "');");
340+
runJavaScript("OS.loadProjectFromSjr('" + base64Project + "');");
341341
}
342342

343343
public RelativeLayout getContainer() {
@@ -507,10 +507,9 @@ public void run() {
507507
*/
508508
public void logAnalyticsEvent(String category, String action, String label) {
509509
Bundle params = new Bundle();
510-
params.putString(FirebaseAnalytics.Param.ITEM_ID, action);
511510
params.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, category);
512511
params.putString(FirebaseAnalytics.Param.ITEM_NAME, label);
513-
_FirebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, params);
512+
_FirebaseAnalytics.logEvent(action, params);
514513
}
515514

516515
/**
@@ -521,6 +520,15 @@ public void setAnalyticsPlacePref(String place) {
521520
_FirebaseAnalytics.setUserProperty("place_preference", place);
522521
}
523522

523+
/**
524+
* Record a user property
525+
* @param key like "school"
526+
* @param value like "Central High"
527+
*/
528+
public void setAnalyticsPref(String key, String value) {
529+
_FirebaseAnalytics.setUserProperty(key, value);
530+
}
531+
524532
public void translateAndScaleRectToContainerCoords(RectF rect, float devicePixelRatio) {
525533
float wx = _webView.getX();
526534
float wy = _webView.getY();
18.6 KB
Loading
8.1 KB
Loading

0 commit comments

Comments
 (0)