Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into fix/library-overhaul/00-fix-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrekV authored Oct 1, 2019
2 parents f9d14b0 + 9eba610 commit 6c94389
Show file tree
Hide file tree
Showing 317 changed files with 2,304 additions and 74,902 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*.la
*.a

# Pod macOS
src/ui/osx/Pods/

tmp/*
build/*
src/lib/osx/build
Expand Down Expand Up @@ -70,8 +73,6 @@ coverage

third_party/TFDatePicker/TFDatePicker/build/

xcshareddata

*.obj
*.tlog
*.exe
Expand Down
12 changes: 0 additions & 12 deletions .gitmodules

This file was deleted.

14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pocodir=third_party/poco
openssldir=third_party/openssl
jsoncppdir=third_party/jsoncpp/dist
pocoversion=$(shell cat third_party/poco/libversion)

macosdir=src/ui/osx
GTEST_ROOT=third_party/googletest-read-only

source_dirs=src/*.cc src/*.h src/test/*.cc src/test/*.h \
Expand All @@ -35,11 +35,11 @@ source_dirs=src/*.cc src/*.h src/test/*.cc src/test/*.h \

xcodebuild_command=xcodebuild \
-scheme TogglDesktop \
-project src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj \
-workspace src/ui/osx/TogglDesktop.xcworkspace \
-configuration Debug
xcodebuild_command_release=xcodebuild \
-scheme TogglDesktop \
-project src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj \
-workspace src/ui/osx/TogglDesktop.xcworkspace \
-configuration Release

ifeq ($(uname), Linux)
Expand Down Expand Up @@ -148,7 +148,7 @@ ifeq ($(uname), Linux)
app:
mkdir -p build && cd build && cmake .. && make
else
app: lib ui
app: init_cocoapod lib ui
endif

app_release: lib_release ui_release
Expand Down Expand Up @@ -182,10 +182,10 @@ clean_deps:
cd $(openssldir) && (make clean || true)
cd third_party/lua && make clean

deps: clean_deps init_submodule openssl poco lua
deps: clean_deps openssl poco lua

init_submodule:
cd $(rootdir) && git submodule update --init --recursive
init_cocoapod:
cd $(macosdir) && bundle install && bundle exec pod install && cd $(rootdir)

lua:
cd third_party/lua && make macosx && make local
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Toggl built and signed apps for all platforms
## Linux

<br>
<a href="https://toggl.github.io/toggldesktop/download/linux_tar.gz-stable//">Tarball</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href='https://flathub.org/apps/details/com.toggl.TogglDesktop'>Flathub</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href='https://snapcraft.io/toggldesktop'>Snap Store</a>
<a href="https://toggl.github.io/toggldesktop/download/linux_tar.gz-stable//">Tarball</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href='https://flathub.org/apps/details/com.toggl.TogglDesktop'>Flathub</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href='https://snapcraft.io/toggldesktop'>Snap Store</a> <i>(still in alpha phase)</i>
<br/>
<br/>
<i>Only 64bit is supported</i>
Expand Down Expand Up @@ -95,13 +95,21 @@ $ make uitest
## macOS
### Requirements
- macOS 10.14+, Xcode 10.2+ and Swift 4+
- Install Bundler
```bash
$ sudo gem install bundler
```

### Build
- Build dependencies
```bash

# Build all dependencies
$ make deps

# Prepare cocoapod
$ make init_cocoapod
```
- Open `src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj`
- Open workspace at `src/ui/osx/TogglDesktop.xcworkspace`
- Select TogglDesktop scheme and build.

## Linux
Expand Down
50 changes: 25 additions & 25 deletions src/analytics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,66 +23,66 @@
namespace toggl {


void Analytics::Track(const std::string client_id,
const std::string category,
const std::string action) {
void Analytics::Track(const std::string &client_id,
const std::string &category,
const std::string &action) {
start(new GoogleAnalyticsEvent(
client_id, category, action, "", 1));
}

void Analytics::TrackChannel(const std::string client_id,
const std::string channel) {
void Analytics::TrackChannel(const std::string &client_id,
const std::string &channel) {
std::stringstream ss;
ss << "channel-"
<< channel;

Track(client_id, "channel", ss.str());
}

void Analytics::TrackOs(const std::string client_id,
const std::string os) {
void Analytics::TrackOs(const std::string &client_id,
const std::string &os) {
std::stringstream ss;
ss << "os-"
<< os;

Track(client_id, "os", ss.str());
}

void Analytics::TrackOSDetails(const std::string client_id) {
void Analytics::TrackOSDetails(const std::string &client_id) {
std::stringstream ss;

RetrieveOsDetails(ss);

Track(client_id, "osdetails", ss.str());
}

void Analytics::TrackWindowSize(const std::string client_id,
const std::string os,
void Analytics::TrackWindowSize(const std::string &client_id,
const std::string &os,
const toggl::Rectangle rect) {
TrackSize(client_id, os, "mainsize", rect);
}

void Analytics::TrackEditSize(const std::string client_id,
const std::string os,
void Analytics::TrackEditSize(const std::string &client_id,
const std::string &os,
const toggl::Rectangle rect) {
TrackSize(client_id, os, "editsize", rect);
}

void Analytics::TrackSize(const std::string client_id,
const std::string os,
const std::string name,
void Analytics::TrackSize(const std::string &client_id,
const std::string &os,
const std::string &name,
const toggl::Rectangle rect) {
std::stringstream ss;
ss << os << "/" << name << "-" << rect.str();

Track(client_id, "stats", ss.str());
}

void Analytics::TrackSettings(const std::string client_id,
void Analytics::TrackSettings(const std::string &client_id,
const bool record_timeline,
const Settings settings,
const Settings &settings,
const bool use_proxy,
const Proxy proxy) {
const Proxy &proxy) {
Poco::LocalDateTime now;
if (now.year() != settings_sync_date.year()
|| now.month() != settings_sync_date.month()
Expand All @@ -94,16 +94,16 @@ void Analytics::TrackSettings(const std::string client_id,
}
}

void Analytics::TrackIdleDetectionClick(const std::string client_id,
const std::string button) {
void Analytics::TrackIdleDetectionClick(const std::string &client_id,
const std::string &button) {
std::stringstream ss;
ss << "reminder/"
<< button;

Track(client_id, "reminder", ss.str());
}

void Analytics::TrackAutocompleteUsage(const std::string client_id,
void Analytics::TrackAutocompleteUsage(const std::string &client_id,
const bool was_using_autocomplete) {
std::stringstream ss;
ss << "timer/autocomplete-";
Expand Down Expand Up @@ -258,15 +258,15 @@ void GoogleAnalyticsSettingsEvent::runTask() {
}
}

void GoogleAnalyticsSettingsEvent::setActionBool(std::string type, bool value) {
void GoogleAnalyticsSettingsEvent::setActionBool(const std::string &type, bool value) {
std::stringstream ss;
ss << "settings/"
<< type
<< value;
action_ = ss.str();
}

void GoogleAnalyticsSettingsEvent::setActionInt(std::string type,
void GoogleAnalyticsSettingsEvent::setActionInt(const std::string &type,
Poco::Int64 value) {
std::stringstream ss;
ss << "settings/"
Expand All @@ -275,8 +275,8 @@ void GoogleAnalyticsSettingsEvent::setActionInt(std::string type,
action_ = ss.str();
}

void GoogleAnalyticsSettingsEvent::setActionString(std::string type,
std::string value) {
void GoogleAnalyticsSettingsEvent::setActionString(const std::string &type,
const std::string &value) {
std::stringstream ss;
ss << "settings/"
<< type
Expand Down
64 changes: 32 additions & 32 deletions src/analytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,60 +23,60 @@ class Analytics : public Poco::TaskManager {
Poco::Timespan(24 * Poco::Timespan::HOURS)) {}

void Track(
const std::string client_id,
const std::string category,
const std::string action);
const std::string &client_id,
const std::string &category,
const std::string &action);

void TrackChannel(
const std::string client_id,
const std::string channel);
const std::string &client_id,
const std::string &channel);

void TrackOs(
const std::string client_id,
const std::string os);
const std::string &client_id,
const std::string &os);

void TrackOSDetails(
const std::string client_id);
const std::string &client_id);

void TrackSettings(
const std::string client_id,
const std::string &client_id,
const bool record_timeline,
const Settings settings,
const Settings &settings,
const bool use_proxy,
const Proxy proxy);
const Proxy &proxy);

void TrackIdleDetectionClick(
const std::string client_id,
const std::string button);
const std::string &client_id,
const std::string &button);

void TrackAutocompleteUsage(
const std::string client_id,
const std::string &client_id,
const bool was_using_autocomplete);

void TrackWindowSize(const std::string client_id,
const std::string os,
void TrackWindowSize(const std::string &client_id,
const std::string &os,
const toggl::Rectangle rect);

void TrackEditSize(const std::string client_id,
const std::string os,
void TrackEditSize(const std::string &client_id,
const std::string &os,
const toggl::Rectangle rect);

private:
Poco::LocalDateTime settings_sync_date;

void TrackSize(const std::string client_id,
const std::string os,
const std::string name,
void TrackSize(const std::string &client_id,
const std::string &os,
const std::string &name,
const toggl::Rectangle rect);
};

class GoogleAnalyticsEvent : public Poco::Task {
public:
GoogleAnalyticsEvent(
const std::string client_id,
const std::string category,
const std::string action,
const std::string opt_label,
const std::string &client_id,
const std::string &category,
const std::string &action,
const std::string &opt_label,
const int opt_value)
: Poco::Task("GoogleAnalyticsEvent")
, client_id_(client_id)
Expand All @@ -99,12 +99,12 @@ class GoogleAnalyticsEvent : public Poco::Task {
class GoogleAnalyticsSettingsEvent : public Poco::Task {
public:
GoogleAnalyticsSettingsEvent(
const std::string client_id,
const std::string category,
const std::string &client_id,
const std::string &category,
const bool record_timeline,
Settings settings,
const Settings &settings,
const bool uses_proxy,
Proxy proxy)
const Proxy &proxy)
: Poco::Task("GoogleAnalyticsSettingsEvent")
, client_id_(client_id)
, category_(category)
Expand All @@ -125,9 +125,9 @@ class GoogleAnalyticsSettingsEvent : public Poco::Task {

const std::string relativeURL();
void makeReq();
void setActionBool(std::string type, bool value);
void setActionInt(std::string type, Poco::Int64 value);
void setActionString(std::string type, std::string value);
void setActionBool(const std::string &type, bool value);
void setActionInt(const std::string &type, Poco::Int64 value);
void setActionString(const std::string &type, const std::string &value);
};


Expand Down
4 changes: 2 additions & 2 deletions src/autotracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace toggl {

bool AutotrackerRule::Matches(const TimelineEvent event) const {
bool AutotrackerRule::Matches(const TimelineEvent &event) const {
if (Poco::UTF8::toLower(event.Filename()).find(term_)
!= std::string::npos) {
return true;
Expand All @@ -25,7 +25,7 @@ const std::string &AutotrackerRule::Term() const {
return term_;
}

void AutotrackerRule::SetTerm(const std::string value) {
void AutotrackerRule::SetTerm(const std::string &value) {
if (term_ != value) {
term_ = value;
SetDirty();
Expand Down
4 changes: 2 additions & 2 deletions src/autotracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class TOGGL_INTERNAL_EXPORT AutotrackerRule : public BaseModel {

virtual ~AutotrackerRule() {}

bool Matches(const TimelineEvent event) const;
bool Matches(const TimelineEvent &event) const;

const std::string &Term() const;
void SetTerm(const std::string value);
void SetTerm(const std::string &value);

const Poco::UInt64 &PID() const;
void SetPID(const Poco::UInt64 value);
Expand Down
Loading

0 comments on commit 6c94389

Please sign in to comment.