Skip to content

Commit

Permalink
chore(android): remove some dead analytics code (#14022)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga authored Jun 15, 2024
1 parent dc180b9 commit 6926f0d
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ public String getIcon()
return "appicon.png";
}

public boolean isAnalyticsEnabled()
{
return true;
}

public String getGUID()
{
return "edf09efc-69ef-46fd-9777-35d6aaa2d7b5";
Expand Down
39 changes: 0 additions & 39 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -1541,9 +1541,6 @@ AndroidBuilder.prototype.run = async function run(logger, config, cli, finished)
// Notify plugins that we're about to begin.
await new Promise(resolve => cli.emit('build.pre.construct', this, resolve));

// Post build analytics.
await this.doAnalytics();

// Initialize build system. Checks if we need to do a clean or incremental build.
await this.initialize();
await this.loginfo();
Expand Down Expand Up @@ -1602,35 +1599,6 @@ AndroidBuilder.prototype.run = async function run(logger, config, cli, finished)
}
};

AndroidBuilder.prototype.doAnalytics = async function doAnalytics() {
const cli = this.cli;
let eventName = 'android.' + cli.argv.target;

if (cli.argv.target === 'dist-playstore') {
eventName = 'android.distribute.playstore';
} else if (this.allowDebugging && this.debugPort) {
eventName += '.debug';
} else if (this.allowProfiling && this.profilerPort) {
eventName += '.profile';
} else {
eventName += '.run';
}

cli.addAnalyticsEvent(eventName, {
name: cli.tiapp.name,
publisher: cli.tiapp.publisher,
url: cli.tiapp.url,
image: cli.tiapp.icon,
appid: cli.tiapp.id,
description: cli.tiapp.description,
type: cli.argv.type,
guid: cli.tiapp.guid,
version: cli.tiapp.version,
copyright: cli.tiapp.copyright,
date: (new Date()).toDateString()
});
};

AndroidBuilder.prototype.initialize = async function initialize() {
const argv = this.cli.argv;

Expand Down Expand Up @@ -1865,12 +1833,6 @@ AndroidBuilder.prototype.checkIfShouldForceRebuild = function checkIfShouldForce
return true;
}

if (!this.tiapp.analytics !== !manifest.analytics) {
this.logger.info(__('Forcing rebuild: tiapp.xml analytics flag changed since last build'));
this.logger.info(' ' + __('Was: %s', !!manifest.analytics));
this.logger.info(' ' + __('Now: %s', !!this.tiapp.analytics));
return true;
}
if (this.tiapp.publisher !== manifest.publisher) {
this.logger.info(__('Forcing rebuild: tiapp.xml publisher changed since last build'));
this.logger.info(' ' + __('Was: %s', manifest.publisher));
Expand Down Expand Up @@ -3822,7 +3784,6 @@ AndroidBuilder.prototype.writeBuildManifest = async function writeBuildManifest(
outputDir: this.cli.argv['output-dir'],
name: this.tiapp.name,
id: this.tiapp.id,
analytics: this.tiapp.analytics,
publisher: this.tiapp.publisher,
url: this.tiapp.url,
version: this.tiapp.version,
Expand Down
4 changes: 0 additions & 4 deletions android/templates/build/AppInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ public String getIcon() {
return "<%- tiapp.icon %>";
}

public boolean isAnalyticsEnabled() {
return <%- !!tiapp.analytics %>;
}

public String getGUID() {
return "<%- tiapp.guid %>";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public interface ITiAppInfo {
String getCopyright();
String getDescription();
String getIcon();
boolean isAnalyticsEnabled();
String getGUID();
boolean isFullscreen();
String getDeployType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public abstract class TiApplication extends Application implements KrollApplicat
protected ITiAppInfo appInfo;
protected TiStylesheet stylesheet;
protected HashMap<String, WeakReference<KrollModule>> modules;
protected String[] filteredAnalyticsEvents;

public static AtomicBoolean isActivityTransition = new AtomicBoolean(false);
protected static ArrayList<ActivityTransitionListener> activityTransitionListeners = new ArrayList<>();
Expand Down Expand Up @@ -738,11 +737,6 @@ public KrollProxy unregisterProxy(String proxyId)
return proxy;
}

public boolean isAnalyticsEnabled()
{
return false;
}

/**
* Determines if Titanium's JavaScript runtime should run on the main UI thread or not
* based on the "tiapp.xml" property "run-on-main-thread".
Expand All @@ -755,26 +749,6 @@ public boolean runOnMainThread()
return true;
}

public void setFilterAnalyticsEvents(String[] events)
{
filteredAnalyticsEvents = events;
}

public boolean isAnalyticsFiltered(String eventName)
{
if (filteredAnalyticsEvents == null) {
return false;
}

for (int i = 0; i < filteredAnalyticsEvents.length; ++i) {
String currentName = filteredAnalyticsEvents[i];
if (eventName.equals(currentName)) {
return true;
}
}
return false;
}

@Override
public String getDeployType()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import android.app.Application;
import android.os.Bundle;

import com.appcelerator.aps.APSAnalytics;

import org.appcelerator.kroll.KrollModule;

public class TiApplicationLifecycle implements Application.ActivityLifecycleCallbacks
Expand Down Expand Up @@ -50,11 +48,6 @@ public void onActivityStarted(Activity activity)
}
appModule.fireEvent(TiC.EVENT_RESUMED, null);
}

// Post analytics for this event, if enabled.
if (this.tiApp.isAnalyticsEnabled()) {
APSAnalytics.getInstance().sendAppForegroundEvent();
}
}

// Increment number of "started" activities. These are activities that are currently in the foreground.
Expand All @@ -76,11 +69,6 @@ public void onActivityStopped(Activity activity)
appModule.fireEvent(TiC.EVENT_PAUSE, null);
appModule.fireEvent(TiC.EVENT_PAUSED, null);
}

// Post analytics for this event, if enabled.
if (this.tiApp.isAnalyticsEnabled()) {
APSAnalytics.getInstance().sendAppBackgroundEvent();
}
}

// Decrement count of started/visible activities.
Expand Down

0 comments on commit 6926f0d

Please sign in to comment.