mirror of
https://github.com/scratchfoundation/scratchjr.git
synced 2024-11-28 18:15:37 -05:00
Address comments
This commit is contained in:
parent
2c4520e9e1
commit
c8f655447a
9 changed files with 24 additions and 25 deletions
|
@ -617,14 +617,14 @@ public class JavaScriptDirectInterface {
|
|||
|
||||
// Analytics
|
||||
@JavascriptInterface
|
||||
public void analyticsEvent(String category, String action, String label, long value) {
|
||||
public void analyticsEvent(String category, String action, String label) {
|
||||
_activity.logAnalyticsEvent(category, action, label);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void setAnalyticsUser(String place) {
|
||||
public void setAnalyticsPlacePref(String place) {
|
||||
if (place != null) {
|
||||
_activity.setAnalyticsUser(place);
|
||||
_activity.setAnalyticsPlacePref(place);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -494,7 +494,7 @@ public class ScratchJrActivity
|
|||
* Record the preferred place for the user: home, school, other, noanswer
|
||||
* @param place
|
||||
*/
|
||||
public void setAnalyticsUser(String place) {
|
||||
public void setAnalyticsPlacePref(String place) {
|
||||
_FirebaseAnalytics.setUserProperty("place_preference", place);
|
||||
}
|
||||
|
||||
|
|
|
@ -126,8 +126,8 @@
|
|||
:(int)shareType
|
||||
:(NSString *)b64data;
|
||||
- (NSString *) deviceName;
|
||||
- (NSString *) analyticsEvent:(NSString *)category :(NSString *)action :(NSString *)label :(NSNumber*)value;
|
||||
- (void) setAnalyticsUser:(NSString *)place;
|
||||
- (NSString *) analyticsEvent:(NSString *)category :(NSString *)action :(NSString *)label;
|
||||
- (void) setAnalyticsPlacePref:(NSString *)place;
|
||||
@end
|
||||
|
||||
@interface ViewController : UIViewController <JSExports,UIWebViewDelegate,MFMailComposeViewControllerDelegate>
|
||||
|
|
|
@ -315,7 +315,7 @@ JSContext *js;
|
|||
return [ScratchJr hideSplash:body];
|
||||
}
|
||||
|
||||
-(NSString*) analyticsEvent:(NSString*) category :(NSString*) action :(NSString*) label :(NSNumber*) value {
|
||||
-(NSString*) analyticsEvent:(NSString*) category :(NSString*) action :(NSString*) label {
|
||||
[FIRAnalytics logEventWithName:kFIREventViewItem
|
||||
parameters:@{
|
||||
kFIRParameterItemID:action,
|
||||
|
@ -325,7 +325,7 @@ JSContext *js;
|
|||
return @"1";
|
||||
}
|
||||
|
||||
-(void) setAnalyticsUser:(NSString*)place {
|
||||
-(void) setAnalyticsPlacePref:(NSString*)place {
|
||||
[FIRAnalytics setUserPropertyString:place forName:@"place_preference"];
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ let info = null;
|
|||
let okclicky = null;
|
||||
let infoBoxOpen = false;
|
||||
|
||||
const EMAILSHARE = 0;
|
||||
const AIRDROPSHARE = 1;
|
||||
|
||||
export default class UI {
|
||||
static get infoBoxOpen () {
|
||||
return infoBoxOpen;
|
||||
|
@ -134,7 +137,7 @@ export default class UI {
|
|||
shareEmail.id = 'infoboxShareButtonEmail';
|
||||
shareEmail.textContent = Localization.localize('SHARING_BY_EMAIL');
|
||||
shareEmail.ontouchstart = function (e) {
|
||||
UI.infoDoShare(e, nameField, shareLoadingGif, 0);
|
||||
UI.infoDoShare(e, nameField, shareLoadingGif, EMAILSHARE);
|
||||
};
|
||||
|
||||
if (isAndroid) {
|
||||
|
@ -149,7 +152,7 @@ export default class UI {
|
|||
shareAirdrop.textContent = Localization.localize('SHARING_BY_AIRDROP');
|
||||
shareAirdrop.style.float = 'right';
|
||||
shareAirdrop.ontouchstart = function (e) {
|
||||
UI.infoDoShare(e, nameField, shareLoadingGif, 1);
|
||||
UI.infoDoShare(e, nameField, shareLoadingGif, AIRDROPSHARE);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -254,7 +257,7 @@ export default class UI {
|
|||
|
||||
setTimeout(saveAndShare, 500); // 500ms delay to wait for loading GIF to show and keyboard to hide
|
||||
|
||||
iOS.analyticsEvent('editor', 'share_button', (shareType == 0) ? 'email' : 'airdrop');
|
||||
iOS.analyticsEvent('editor', 'share_button', (shareType == EMAILSHARE) ? 'email' : 'airdrop');
|
||||
|
||||
function saveAndShare () {
|
||||
// Save the project's new name
|
||||
|
|
|
@ -94,7 +94,7 @@ function indexLoadStart (afterUsage) {
|
|||
gn('usageOther').className = 'usageOther hide';
|
||||
gn('usageNoanswer').className = 'usageNoanswer hide';
|
||||
}
|
||||
iOS.setAnalyticsUser(AppUsage.currentUsage);
|
||||
iOS.setAnalyticsPlacePref(AppUsage.currentUsage);
|
||||
}
|
||||
gn('gettings').className = 'gettings show';
|
||||
gn('startcode').className = 'startcode show';
|
||||
|
|
|
@ -351,15 +351,12 @@ export default class iOS {
|
|||
fcn(tabletInterface.deviceName());
|
||||
}
|
||||
|
||||
static analyticsEvent (category, action, label, value) {
|
||||
if (!value) {
|
||||
value = 1;
|
||||
}
|
||||
tabletInterface.analyticsEvent(category, action, label, value);
|
||||
static analyticsEvent (category, action, label) {
|
||||
tabletInterface.analyticsEvent(category, action, label);
|
||||
}
|
||||
|
||||
static setAnalyticsUser (preferredPlace) {
|
||||
tabletInterface.setAnalyticsUser(preferredPlace);
|
||||
static setAnalyticsPlacePref (preferredPlace) {
|
||||
tabletInterface.setAnalyticsPlacePref(preferredPlace);
|
||||
}
|
||||
|
||||
// Web Wiew delegate call backs
|
||||
|
|
|
@ -163,6 +163,9 @@ export default class Paint {
|
|||
static open (bkg, md5, sname, cname, cscale, sw, sh) {
|
||||
let action = '';
|
||||
let label = '';
|
||||
// Analytics:
|
||||
// md3: name of the asset, an md5 hash for user generated, filename for library items
|
||||
// sname: is not set for a new character (ignored for backgrounds)
|
||||
if (bkg) {
|
||||
action = 'edit_background';
|
||||
label = (md5 in MediaLib.keys) ? md5 : 'user_background';
|
||||
|
|
|
@ -31,11 +31,7 @@ export default class AppUsage {
|
|||
* @param {string} kind answer from user to the usage survey (home, school, other, noanswer)
|
||||
*/
|
||||
static setUsage (kind) {
|
||||
if (kind === '') {
|
||||
Cookie.set('usage', 'noanswer');
|
||||
} else {
|
||||
Cookie.set('usage', kind);
|
||||
}
|
||||
currentUsage = (kind === '') ? 'noanswer' : kind;
|
||||
Cookie.set('usage', currentUsage);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue