Browse Source

Projucer: Ensure that "Module Added" analytics events are only sent once and not sent when creating a new project

tags/2021-05-28
ed 7 years ago
parent
commit
b999047748
4 changed files with 18 additions and 22 deletions
  1. +3
    -11
      extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h
  2. +13
    -9
      extras/Projucer/Source/Project/jucer_Module.cpp
  3. +1
    -1
      extras/Projucer/Source/Project/jucer_Module.h
  4. +1
    -1
      extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h

+ 3
- 11
extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h View File

@@ -408,7 +408,7 @@ private:
for (auto missingModule : missingDependencies)
{
if (auto* info = list.getModuleWithID (missingModule))
modules.addModule (info->moduleFolder, copyLocally, useGlobalPath);
modules.addModule (info->moduleFolder, copyLocally, useGlobalPath, false);
else
missing.add (missingModule);
}
@@ -543,7 +543,8 @@ public:
for (int i = 0; i < modules.size(); ++i)
project.getModules().addModule (modules.getReference(i).moduleFolder,
project.getModules().areMostModulesCopiedLocally(),
project.getModules().areMostModulesUsingGlobalPath());
project.getModules().areMostModulesUsingGlobalPath(),
true);
}
void addSubItems() override
@@ -586,7 +587,6 @@ public:
void handlePopupMenuResult (int resultCode) override
{
auto& modules = project.getModules();
auto numModulesBefore = modules.getNumModules();
if (resultCode == 1001)
{
@@ -601,14 +601,6 @@ public:
else if (resultCode < 400)
modules.addModuleInteractive (getAvailableModulesInExporterPaths() [resultCode - 300]);
}
if (modules.getNumModules() == numModulesBefore + 1)
{
StringPairArray data;
data.set ("label", modules.getModuleID (modules.getNumModules() - 1));
Analytics::getInstance()->logEvent ("Module Added", data, ProjucerAnalyticsEvent::projectEvent);
}
}
StringArray getAvailableModulesInGlobalJucePath()


+ 13
- 9
extras/Projucer/Source/Project/jucer_Module.cpp View File

@@ -775,7 +775,7 @@ Value EnabledModuleList::shouldCopyModuleFilesLocally (const String& moduleID) c
.getPropertyAsValue (Ids::useLocalCopy, getUndoManager());
}
void EnabledModuleList::addModule (const File& moduleFolder, bool copyLocally, bool useGlobalPath)
void EnabledModuleList::addModule (const File& moduleFolder, bool copyLocally, bool useGlobalPath, bool sendAnalyticsEvent)
{
ModuleDescription info (moduleFolder);
@@ -801,10 +801,13 @@ void EnabledModuleList::addModule (const File& moduleFolder, bool copyLocally, b
for (Project::ExporterIterator exporter (project); exporter.next();)
exporter->getPathForModuleValue (moduleID) = path.toUnixStyle();
StringPairArray data;
data.set ("label", moduleID);
if (sendAnalyticsEvent)
{
StringPairArray data;
data.set ("label", moduleID);
Analytics::getInstance()->logEvent ("Module Added", data, ProjucerAnalyticsEvent::projectEvent);
Analytics::getInstance()->logEvent ("Module Added", data, ProjucerAnalyticsEvent::projectEvent);
}
}
}
}
@@ -961,20 +964,20 @@ void EnabledModuleList::addModuleInteractive (const String& moduleID)
list.scanGlobalJuceModulePath();
if (auto* info = list.getModuleWithID (moduleID))
{
addModule (info->moduleFolder, areMostModulesCopiedLocally(), areMostModulesUsingGlobalPath());
addModule (info->moduleFolder, areMostModulesCopiedLocally(), areMostModulesUsingGlobalPath(), true);
return;
}
list.scanGlobalUserModulePath();
if (auto* info = list.getModuleWithID (moduleID))
{
addModule (info->moduleFolder, areMostModulesCopiedLocally(), areMostModulesUsingGlobalPath());
addModule (info->moduleFolder, areMostModulesCopiedLocally(), areMostModulesUsingGlobalPath(), true);
return;
}
list.scanProjectExporterModulePaths (project);
if (auto* info = list.getModuleWithID (moduleID))
addModule (info->moduleFolder, areMostModulesCopiedLocally(), false);
addModule (info->moduleFolder, areMostModulesCopiedLocally(), false, true);
else
addModuleFromUserSelectedFile();
}
@@ -997,8 +1000,9 @@ void EnabledModuleList::addModuleOfferingToCopy (const File& f, bool isFromUserS
return;
}
addModule (m.moduleFolder, areMostModulesCopiedLocally(), isFromUserSpecifiedFolder ? false
: areMostModulesUsingGlobalPath());
addModule (m.moduleFolder, areMostModulesCopiedLocally(),
isFromUserSpecifiedFolder ? false : areMostModulesUsingGlobalPath(),
true);
}
bool isJUCEFolder (const File& f)


+ 1
- 1
extras/Projucer/Source/Project/jucer_Module.h View File

@@ -155,7 +155,7 @@ public:
ModuleDescription getModuleInfo (const String& moduleID);
File getModuleFolder (const String& moduleID);
void addModule (const File& moduleManifestFile, bool copyLocally, bool useGlobalPath);
void addModule (const File& moduleManifestFile, bool copyLocally, bool useGlobalPath, bool sendAnalyticsEvent);
void addModuleInteractive (const String& moduleID);
void addModuleFromUserSelectedFile();
void addModuleOfferingToCopy (const File&, bool isFromUserSpecifiedFolder);


+ 1
- 1
extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h View File

@@ -187,7 +187,7 @@ struct NewProjectWizard
for (int i = 0; i < mods.size(); ++i)
if (const ModuleDescription* info = list.getModuleWithID (mods[i]))
project.getModules().addModule (info->moduleFolder, false, useGlobalPath);
project.getModules().addModule (info->moduleFolder, false, useGlobalPath, false);
}
void addExporters (Project& project, WizardComp& wizardComp)


Loading…
Cancel
Save