diff --git a/.gitignore b/.gitignore index 9f3aabbe8a..935f2ca462 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ *.la *.a +# Pod macOS +src/ui/osx/Pods/ + tmp/* build/* src/lib/osx/build @@ -70,8 +73,6 @@ coverage third_party/TFDatePicker/TFDatePicker/build/ -xcshareddata - *.obj *.tlog *.exe diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 02c9e55618..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,12 +0,0 @@ -[submodule "third_party/Sparkle"] - path = third_party/Sparkle - url = https://github.com/sparkle-project/Sparkle.git - ignore = dirty -[submodule "third_party/MASShortcut"] - path = third_party/MASShortcut - url = https://github.com/shpakovski/MASShortcut.git - ignore = dirty -[submodule "third_party/bugsnag-cocoa"] - path = third_party/bugsnag-cocoa - url = https://github.com/bugsnag/bugsnag-cocoa - ignore = dirty diff --git a/Makefile b/Makefile index e0dace5b9c..1c8deb4fe9 100644 --- a/Makefile +++ b/Makefile @@ -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 \ @@ -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) @@ -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 @@ -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 diff --git a/README.md b/README.md index 9072592f8d..f67eead4e6 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Toggl built and signed apps for all platforms ## Linux
-Tarball    |    Flathub    |    Snap Store +Tarball    |    Flathub    |    Snap Store (still in alpha phase)

Only 64bit is supported @@ -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 diff --git a/src/analytics.cc b/src/analytics.cc index 38dd82604d..4212fc4b1c 100644 --- a/src/analytics.cc +++ b/src/analytics.cc @@ -23,15 +23,15 @@ 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; @@ -39,8 +39,8 @@ void Analytics::TrackChannel(const std::string client_id, 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; @@ -48,7 +48,7 @@ void Analytics::TrackOs(const std::string client_id, 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); @@ -56,21 +56,21 @@ void Analytics::TrackOSDetails(const std::string client_id) { 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(); @@ -78,11 +78,11 @@ void Analytics::TrackSize(const std::string client_id, 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() @@ -94,8 +94,8 @@ 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; @@ -103,7 +103,7 @@ void Analytics::TrackIdleDetectionClick(const std::string client_id, 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-"; @@ -258,7 +258,7 @@ 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 @@ -266,7 +266,7 @@ void GoogleAnalyticsSettingsEvent::setActionBool(std::string type, bool 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/" @@ -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 diff --git a/src/analytics.h b/src/analytics.h index 6995a3535e..0430873d49 100644 --- a/src/analytics.h +++ b/src/analytics.h @@ -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) @@ -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) @@ -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); }; diff --git a/src/autotracker.cc b/src/autotracker.cc index b0e84df074..de9b1d0498 100644 --- a/src/autotracker.cc +++ b/src/autotracker.cc @@ -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; @@ -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(); diff --git a/src/autotracker.h b/src/autotracker.h index 16ab885dbd..58157a6120 100644 --- a/src/autotracker.h +++ b/src/autotracker.h @@ -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); diff --git a/src/base_model.cc b/src/base_model.cc index 6d7cdad333..ae61387a37 100644 --- a/src/base_model.cc +++ b/src/base_model.cc @@ -56,7 +56,7 @@ void BaseModel::ClearValidationError() { SetValidationError(noError); } -void BaseModel::SetValidationError(const std::string value) { +void BaseModel::SetValidationError(const std::string &value) { if (validation_error_ != value) { validation_error_ = value; SetDirty(); @@ -77,7 +77,7 @@ void BaseModel::SetUpdatedAt(const Poco::Int64 value) { } } -void BaseModel::SetGUID(const std::string value) { +void BaseModel::SetGUID(const std::string &value) { if (guid_ != value) { guid_ = value; SetDirty(); @@ -105,11 +105,11 @@ void BaseModel::SetID(const Poco::UInt64 value) { } } -void BaseModel::SetUpdatedAtString(const std::string value) { +void BaseModel::SetUpdatedAtString(const std::string &value) { SetUpdatedAt(Formatter::Parse8601(value)); } -error BaseModel::LoadFromDataString(const std::string data_string) { +error BaseModel::LoadFromDataString(const std::string &data_string) { Json::Value root; Json::Reader reader; if (!reader.parse(data_string, root)) { @@ -153,7 +153,7 @@ error BaseModel::ApplyBatchUpdateResult( return LoadFromDataString(update->Body); } -bool BaseModel::userCannotAccessWorkspace(const toggl::error err) const { +bool BaseModel::userCannotAccessWorkspace(const error &err) const { return (std::string::npos != std::string(err).find( kCannotAccessWorkspaceError)); } diff --git a/src/base_model.h b/src/base_model.h index 3fe61de343..e7fa43d4c9 100644 --- a/src/base_model.h +++ b/src/base_model.h @@ -63,7 +63,7 @@ class TOGGL_INTERNAL_EXPORT BaseModel { const std::string &GUID() const { return guid_; } - void SetGUID(const std::string value); + void SetGUID(const std::string &value); const Poco::UInt64 &UID() const { return uid_; @@ -99,7 +99,7 @@ class TOGGL_INTERNAL_EXPORT BaseModel { void SetUpdatedAt(const Poco::Int64 value); std::string UpdatedAtString() const; - void SetUpdatedAtString(const std::string value); + void SetUpdatedAtString(const std::string &value); // When a model is deleted // on server, it will be removed from local @@ -122,7 +122,7 @@ class TOGGL_INTERNAL_EXPORT BaseModel { void EnsureGUID(); void ClearValidationError(); - void SetValidationError(const std::string value); + void SetValidationError(const std::string &value); const std::string &ValidationError() const { return validation_error_; } @@ -136,17 +136,17 @@ class TOGGL_INTERNAL_EXPORT BaseModel { return 0; } - virtual bool DuplicateResource(const toggl::error) const { + virtual bool DuplicateResource(const toggl::error &err) const { return false; } - virtual bool ResourceCannotBeCreated(const toggl::error) const { + virtual bool ResourceCannotBeCreated(const toggl::error &err) const { return false; } - virtual bool ResolveError(const toggl::error) { + virtual bool ResolveError(const toggl::error &err) { return false; } - error LoadFromDataString(const std::string); + error LoadFromDataString(const std::string &); void Delete(); @@ -158,7 +158,7 @@ class TOGGL_INTERNAL_EXPORT BaseModel { protected: Poco::Logger &logger() const; - bool userCannotAccessWorkspace(const toggl::error err) const; + bool userCannotAccessWorkspace(const toggl::error &err) const; private: std::string batchUpdateRelativeURL() const; diff --git a/src/batch_update_result.cc b/src/batch_update_result.cc index 2c8ea2f2d8..b465a1e129 100644 --- a/src/batch_update_result.cc +++ b/src/batch_update_result.cc @@ -86,7 +86,7 @@ void BatchUpdateResult::ProcessResponseArray( } error BatchUpdateResult::ParseResponseArray( - const std::string response_body, + const std::string &response_body, std::vector *responses) { poco_check_ptr(responses); diff --git a/src/batch_update_result.h b/src/batch_update_result.h index 9730aebb9b..5a3d598695 100644 --- a/src/batch_update_result.h +++ b/src/batch_update_result.h @@ -37,7 +37,7 @@ class TOGGL_INTERNAL_EXPORT BatchUpdateResult { void LoadFromJSON(Json::Value value); static error ParseResponseArray( - const std::string response_body, + const std::string &response_body, std::vector *responses); static void ProcessResponseArray( std::vector * const results, diff --git a/src/client.cc b/src/client.cc index d4deebe1e3..a7aeb57fe7 100644 --- a/src/client.cc +++ b/src/client.cc @@ -31,7 +31,7 @@ std::string Client::String() const { return ss.str(); } -void Client::SetName(const std::string value) { +void Client::SetName(const std::string &value) { if (name_ != value) { name_ = value; SetDirty(); @@ -63,7 +63,7 @@ Json::Value Client::SaveToJSON() const { return n; } -bool Client::ResolveError(const toggl::error err) { +bool Client::ResolveError(const toggl::error &err) { if (nameHasAlreadyBeenTaken(err)) { SetName(Name() + " 1"); return true; @@ -76,12 +76,12 @@ bool Client::ResolveError(const toggl::error err) { return false; } -bool Client::nameHasAlreadyBeenTaken(const error err) { +bool Client::nameHasAlreadyBeenTaken(const error &err) { return (std::string::npos != std::string(err).find( "Name has already been taken")); } -bool Client::ResourceCannotBeCreated(const toggl::error err) const { +bool Client::ResourceCannotBeCreated(const toggl::error &err) const { return (std::string::npos != std::string(err).find( "cannot add or edit clients in workspace")); } diff --git a/src/client.h b/src/client.h index 0245215b5d..932252b36d 100644 --- a/src/client.h +++ b/src/client.h @@ -30,7 +30,7 @@ class TOGGL_INTERNAL_EXPORT Client : public BaseModel { const std::string &Name() const { return name_; } - void SetName(const std::string value); + void SetName(const std::string &value); // Override BaseModel std::string String() const; @@ -38,14 +38,14 @@ class TOGGL_INTERNAL_EXPORT Client : public BaseModel { std::string ModelURL() const; void LoadFromJSON(Json::Value value); Json::Value SaveToJSON() const; - bool ResolveError(const toggl::error); - bool ResourceCannotBeCreated(const toggl::error) const; + bool ResolveError(const toggl::error &err); + bool ResourceCannotBeCreated(const toggl::error &err) const; private: Poco::UInt64 wid_; std::string name_; - static bool nameHasAlreadyBeenTaken(const error err); + static bool nameHasAlreadyBeenTaken(const error &err); }; } // namespace toggl diff --git a/src/context.cc b/src/context.cc index c46d39979a..86042ba26b 100644 --- a/src/context.cc +++ b/src/context.cc @@ -62,7 +62,7 @@ namespace toggl { std::string Context::log_path_ = ""; -Context::Context(const std::string app_name, const std::string app_version) +Context::Context(const std::string &app_name, const std::string &app_version) : db_(nullptr) , user_(nullptr) , timeline_uploader_(nullptr) @@ -193,7 +193,7 @@ void Context::stopActivities() { logger().debug(exc.displayText()); } catch(const std::exception& ex) { logger().debug(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { logger().debug(ex); } @@ -301,7 +301,7 @@ error Context::StartEvents() { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; @@ -339,7 +339,7 @@ error Context::save(const bool push_changes) { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -422,7 +422,7 @@ std::string UIElements::String() const { } void UIElements::ApplyChanges( - const std::string editor_guid, + const std::string &editor_guid, const std::vector &changes) { time_entry_editor_guid = editor_guid; @@ -961,7 +961,7 @@ bool Context::isPostponed( return true; } -error Context::displayError(const error err) { +error Context::displayError(const error &err) { if ((err.find(kUnauthorizedError) != std::string::npos)) { if (user_) { setUser(nullptr); @@ -1075,7 +1075,7 @@ void Context::onProjectAutocompletes(Poco::Util::TimerTask&) { // NOLINT UI()->DisplayProjectAutocomplete(&project_autocompletes); } -void Context::setOnline(const std::string reason) { +void Context::setOnline(const std::string &reason) { std::stringstream ss; ss << "setOnline, reason:" << reason; logger().debug(ss.str()); @@ -1107,7 +1107,7 @@ void Context::onSwitchWebSocketOff(Poco::Util::TimerTask&) { // NOLINT ws_client_.Shutdown(); } -error Context::LoadUpdateFromJSONString(const std::string json) { +error Context::LoadUpdateFromJSONString(const std::string &json) { std::stringstream ss; ss << "LoadUpdateFromJSONString json=" << json; logger().debug(ss.str()); @@ -1475,7 +1475,7 @@ error Context::downloadUpdate() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -1604,7 +1604,7 @@ void Context::onTimelineUpdateServerSettings(Poco::Util::TimerTask&) { // NOLIN } } -error Context::SendFeedback(Feedback fb) { +error Context::SendFeedback(const Feedback &fb) { if (!user_) { logger().warning("Cannot send feedback, user logged out"); return noError; @@ -1711,8 +1711,8 @@ void Context::onSendFeedback(Poco::Util::TimerTask&) { // NOLINT } error Context::SetSettingsRemindTimes( - const std::string remind_starts, - const std::string remind_ends) { + const std::string &remind_starts, + const std::string &remind_ends) { return applySettingsSaveResultToUI( db()->SetSettingsRemindTimes(remind_starts, remind_ends)); } @@ -1746,7 +1746,7 @@ error Context::SetSettingsUseIdleDetection(const bool use_idle_detection) { db()->SetSettingsUseIdleDetection(use_idle_detection)); } -error Context::applySettingsSaveResultToUI(const error err) { +error Context::applySettingsSaveResultToUI(const error &err) { if (err != noError) { return displayError(err); } @@ -1828,7 +1828,7 @@ error Context::SetSettingsManualMode(const bool manual_mode) { } error Context::SetSettingsReminderMinutes(const Poco::UInt64 reminder_minutes) { - const error err = applySettingsSaveResultToUI( + const error &err = applySettingsSaveResultToUI( db()->SetSettingsReminderMinutes(reminder_minutes)); if (err == noError) { resetLastTrackingReminderTime(); @@ -1909,17 +1909,6 @@ void Context::SetMiniTimerW(const int64_t y) { displayError(db()->SetMiniTimerW(y)); } -void Context::SetCompactMode( - const bool value) { - displayError(db()->SetCompactMode(value)); -} - -bool Context::GetCompactMode() { - bool value(false); - displayError(db()->GetCompactMode(&value)); - return value; -} - void Context::SetMiniTimerVisible( const bool value) { displayError(db()->SetMiniTimerVisible(value)); @@ -1987,7 +1976,7 @@ int64_t Context::GetWindowEditSizeWidth() { } void Context::SetKeyStart( - const std::string value) { + const std::string &value) { displayError(db()->SetKeyStart(value)); } @@ -1998,7 +1987,7 @@ std::string Context::GetKeyStart() { } void Context::SetKeyShow( - const std::string value) { + const std::string &value) { displayError(db()->SetKeyShow(value)); } @@ -2009,7 +1998,7 @@ std::string Context::GetKeyShow() { } void Context::SetKeyModifierShow( - const std::string value) { + const std::string &value) { displayError(db()->SetKeyModifierShow(value)); } @@ -2020,7 +2009,7 @@ std::string Context::GetKeyModifierShow() { } void Context::SetKeyModifierStart( - const std::string value) { + const std::string &value) { displayError(db()->SetKeyModifierStart(value)); } @@ -2032,7 +2021,7 @@ std::string Context::GetKeyModifierStart() { error Context::SetProxySettings( const bool use_proxy, - const Proxy proxy) { + const Proxy &proxy) { bool was_using_proxy(false); Proxy previous_proxy_settings; @@ -2073,7 +2062,7 @@ void Context::OpenSettings() { } error Context::SetDBPath( - const std::string path) { + const std::string &path) { try { std::stringstream ss; ss << "SetDBPath " << path; @@ -2090,13 +2079,13 @@ error Context::SetDBPath( return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; } -void Context::SetEnvironment(const std::string value) { +void Context::SetEnvironment(const std::string &value) { if (!("production" == value || "development" == value || "test" == value)) { @@ -2117,16 +2106,16 @@ Database *Context::db() const { return db_; } -error Context::GoogleLogin(const std::string access_token) { +error Context::GoogleLogin(const std::string &access_token) { return Login(access_token, "google_access_token"); } -error Context::AsyncGoogleLogin(const std::string access_token) { +error Context::AsyncGoogleLogin(const std::string &access_token) { return AsyncLogin(access_token, "google_access_token"); } -error Context::attemptOfflineLogin(const std::string email, - const std::string password) { +error Context::attemptOfflineLogin(const std::string &email, + const std::string &password) { if (email.empty()) { return error("cannot login offline without an e-mail"); } @@ -2179,8 +2168,8 @@ error Context::attemptOfflineLogin(const std::string email, return save(false); } -error Context::AsyncLogin(const std::string email, - const std::string password) { +error Context::AsyncLogin(const std::string &email, + const std::string &password) { std::thread backgroundThread([&](std::string email, std::string password) { return this->Login(email, password); }, email, password); @@ -2189,8 +2178,8 @@ error Context::AsyncLogin(const std::string email, } error Context::Login( - const std::string email, - const std::string password) { + const std::string &email, + const std::string &password) { try { TogglClient client(UI()); std::string json(""); @@ -2243,13 +2232,13 @@ error Context::Login( return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } } -error Context::AsyncSignup(const std::string email, - const std::string password, +error Context::AsyncSignup(const std::string &email, + const std::string &password, const uint64_t country_id) { std::thread backgroundThread([&](std::string email, std::string password, uint64_t country_id) { return this->Signup(email, password, country_id); @@ -2259,8 +2248,8 @@ error Context::AsyncSignup(const std::string email, } error Context::Signup( - const std::string email, - const std::string password, + const std::string &email, + const std::string &password, const uint64_t country_id) { TogglClient client(UI()); @@ -2274,7 +2263,7 @@ error Context::Signup( } error Context::GoogleSignup( - const std::string access_token, + const std::string &access_token, const uint64_t country_id) { TogglClient client(UI()); @@ -2286,8 +2275,7 @@ error Context::GoogleSignup( return Login(access_token, "google_access_token"); } -error Context::AsyncGoogleSignup( - const std::string access_token, +error Context::AsyncGoogleSignup(const std::string &access_token, const uint64_t country_id) { std::thread backgroundThread([&](std::string access_token, uint64_t country_id) { return this->GoogleSignup(access_token, country_id); @@ -2384,7 +2372,7 @@ void Context::setUser(User *value, const bool logged_in) { } error Context::SetLoggedInUserFromJSON( - const std::string json) { + const std::string &json) { if (json.empty()) { return displayError("empty JSON"); @@ -2468,7 +2456,7 @@ error Context::Logout() { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; @@ -2502,18 +2490,18 @@ error Context::ClearCache() { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } } TimeEntry *Context::Start( - const std::string description, - const std::string duration, + const std::string &description, + const std::string &duration, const Poco::UInt64 task_id, const Poco::UInt64 project_id, - const std::string project_guid, - const std::string tags, + const std::string &project_guid, + const std::string &tags, const bool prevent_on_app) { // Do not even allow to add new time entries, @@ -2587,9 +2575,9 @@ TimeEntry *Context::Start( } void Context::OpenTimeEntryEditor( - const std::string GUID, + const std::string &GUID, const bool edit_running_entry, - const std::string focused_field_name) { + const std::string &focused_field_name) { if (!edit_running_entry && GUID.empty()) { logger().error("Cannot edit time entry without a GUID"); return; @@ -2705,7 +2693,7 @@ TimeEntry *Context::ContinueLatest(const bool prevent_on_app) { } TimeEntry *Context::Continue( - const std::string GUID) { + const std::string &GUID) { // Do not even allow to continue entries, // else they will linger around in the app @@ -2758,7 +2746,7 @@ TimeEntry *Context::Continue( return result; } -error Context::DeleteTimeEntryByGUID(const std::string GUID) { +error Context::DeleteTimeEntryByGUID(const std::string &GUID) { // Do not even allow to delete time entries, // else they will linger around in the app // and the user can continue using the unsupported app. @@ -2806,8 +2794,8 @@ error Context::DeleteTimeEntryByGUID(const std::string GUID) { } error Context::SetTimeEntryDuration( - const std::string GUID, - const std::string duration) { + const std::string &GUID, + const std::string &duration) { if (GUID.empty()) { return displayError(std::string(__FUNCTION__) + ": Missing GUID"); } @@ -2838,10 +2826,10 @@ error Context::SetTimeEntryDuration( } error Context::SetTimeEntryProject( - const std::string GUID, + const std::string &GUID, const Poco::UInt64 task_id, const Poco::UInt64 project_id, - const std::string project_guid) { + const std::string &project_guid) { try { if (GUID.empty()) { return displayError(std::string(__FUNCTION__) + ": Missing GUID"); @@ -2898,14 +2886,14 @@ error Context::SetTimeEntryProject( return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return displayError(save(true)); } error Context::SetTimeEntryDate( - const std::string GUID, + const std::string &GUID, const Poco::Int64 unix_timestamp) { if (GUID.empty()) { @@ -2965,8 +2953,8 @@ error Context::SetTimeEntryDate( error Context::SetTimeEntryStart( - const std::string GUID, - const std::string value) { + const std::string &GUID, + const std::string &value) { if (GUID.empty()) { return displayError(std::string(__FUNCTION__) + ": Missing GUID"); } @@ -3024,8 +3012,8 @@ error Context::SetTimeEntryStart( } error Context::SetTimeEntryStop( - const std::string GUID, - const std::string value) { + const std::string &GUID, + const std::string &value) { if (GUID.empty()) { return displayError(std::string(__FUNCTION__) + ": Missing GUID"); } @@ -3087,8 +3075,8 @@ error Context::SetTimeEntryStop( } error Context::SetTimeEntryTags( - const std::string GUID, - const std::string value) { + const std::string &GUID, + const std::string &value) { if (GUID.empty()) { return displayError(std::string(__FUNCTION__) + ": Missing GUID"); } @@ -3124,7 +3112,7 @@ error Context::SetTimeEntryTags( } error Context::SetTimeEntryBillable( - const std::string GUID, + const std::string &GUID, const bool value) { if (GUID.empty()) { return displayError(std::string(__FUNCTION__) + ": Missing GUID"); @@ -3161,8 +3149,8 @@ error Context::SetTimeEntryBillable( } error Context::SetTimeEntryDescription( - const std::string GUID, - const std::string value) { + const std::string &GUID, + const std::string &value) { if (GUID.empty()) { return displayError(std::string(__FUNCTION__) + ": Missing GUID"); } @@ -3236,7 +3224,7 @@ error Context::Stop(const bool prevent_on_app) { } error Context::DiscardTimeAt( - const std::string guid, + const std::string &guid, const Poco::Int64 at, const bool split_into_new_entry) { @@ -3286,7 +3274,7 @@ error Context::DiscardTimeAt( } TimeEntry *Context::DiscardTimeAndContinue( - const std::string guid, + const std::string &guid, const Poco::Int64 at) { // Reset reminder count when doing idle actions @@ -3354,13 +3342,13 @@ error Context::ToggleTimelineRecording(const bool record_timeline) { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; } -error Context::SetUpdateChannel(const std::string channel) { +error Context::SetUpdateChannel(const std::string &channel) { error err = db()->SaveUpdateChannel(channel); if (err != noError) { return displayError(err); @@ -3370,7 +3358,7 @@ error Context::SetUpdateChannel(const std::string channel) { } void Context::SearchHelpArticles( - const std::string keywords) { + const std::string &keywords) { UI()->DisplayHelpArticles(help_database_.GetArticles(keywords)); } @@ -3425,7 +3413,7 @@ error Context::SetDefaultProject( return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } } @@ -3453,7 +3441,7 @@ error Context::DefaultProjectName(std::string *name) { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; @@ -3475,7 +3463,7 @@ error Context::DefaultPID(Poco::UInt64 *result) { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; @@ -3497,14 +3485,14 @@ error Context::DefaultTID(Poco::UInt64 *result) { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; } error Context::AddAutotrackerRule( - const std::string term, + const std::string &term, const Poco::UInt64 pid, const Poco::UInt64 tid, Poco::Int64 *rule_id) { @@ -3607,10 +3595,10 @@ error Context::DeleteAutotrackerRule( Project *Context::CreateProject( const Poco::UInt64 workspace_id, const Poco::UInt64 client_id, - const std::string client_guid, - const std::string project_name, + const std::string &client_guid, + const std::string &project_name, const bool is_private, - const std::string project_color) { + const std::string &project_color) { if (!workspace_id) { displayError(kPleaseSelectAWorkspace); @@ -3703,8 +3691,8 @@ Project *Context::CreateProject( error Context::AddObmAction( const Poco::UInt64 experiment_id, - const std::string key, - const std::string value) { + const std::string &key, + const std::string &value) { // Check input if (!experiment_id) { return error("missing experiment_id"); @@ -3744,7 +3732,7 @@ error Context::AddObmAction( Client *Context::CreateClient( const Poco::UInt64 workspace_id, - const std::string client_name) { + const std::string &client_name) { if (!workspace_id) { displayError(kPleaseSelectAWorkspace); @@ -3916,7 +3904,7 @@ error Context::offerBetaChannel(bool *did_offer) { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; @@ -3963,7 +3951,7 @@ error Context::runObmExperiments() { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; @@ -4021,7 +4009,7 @@ void Context::onWake(Poco::Util::TimerTask&) { // NOLINT catch (const std::exception& ex) { logger().error(ex.what()); } - catch (const std::string& ex) { + catch (const std::string & ex) { logger().error(ex); } } @@ -4231,7 +4219,7 @@ void Context::displayPomodoroBreak() { UI()->DisplayPomodoroBreak(settings_.pomodoro_break_minutes); } -error Context::StartAutotrackerEvent(const TimelineEvent event) { +error Context::StartAutotrackerEvent(const TimelineEvent &event) { Poco::Mutex::ScopedLock lock(user_m_); if (!user_) { return noError; @@ -4303,7 +4291,7 @@ error Context::CreateCompressedTimelineBatchForUpload(TimelineBatch *batch) { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; @@ -4327,7 +4315,7 @@ error Context::StartTimelineEvent(TimelineEvent *event) { return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } return noError; @@ -4348,7 +4336,7 @@ error Context::MarkTimelineBatchAsUploaded( return displayError(exc.displayText()); } catch(const std::exception& ex) { return displayError(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return displayError(ex); } } @@ -4581,14 +4569,14 @@ void Context::onLoadMore(Poco::Util::TimerTask&) { catch (const std::exception& ex) { logger().warning(ex.what()); } - catch (const std::string& ex) { + catch (const std::string & ex) { logger().warning(ex); } } -void Context::SetLogPath(const std::string path) { +void Context::SetLogPath(const std::string &path) { Poco::AutoPtr simpleFileChannel( new Poco::SimpleFileChannel); simpleFileChannel->setProperty( @@ -4688,7 +4676,7 @@ error Context::pullAllUserData( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -4822,15 +4810,15 @@ error Context::pushChanges( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; } error Context::pushClients( - std::vector clients, - std::string api_token, + const std::vector &clients, + const std::string &api_token, TogglClient toggl_client) { std::string client_json(""); error err = noError; @@ -4872,10 +4860,9 @@ error Context::pushClients( return err; } -error Context::pushProjects( - std::vector projects, - std::vector clients, - std::string api_token, +error Context::pushProjects(const std::vector &projects, + const std::vector &clients, + const std::string &api_token, TogglClient toggl_client) { error err = noError; std::string project_json(""); @@ -4929,9 +4916,8 @@ error Context::pushProjects( return err; } -error Context::updateEntryProjects( - std::vector projects, - std::vector time_entries) { +error Context::updateEntryProjects(const std::vector &projects, + const std::vector &time_entries) { for (std::vector::const_iterator it = time_entries.begin(); it != time_entries.end(); it++) { @@ -4952,9 +4938,9 @@ error Context::updateEntryProjects( } error Context::pushEntries( - std::map, - std::vector time_entries, - std::string api_token, + const std::map&, + const std::vector &time_entries, + const std::string &api_token, TogglClient toggl_client) { std::string entry_json(""); @@ -5097,7 +5083,7 @@ error Context::pullObmExperiments() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } } @@ -5166,7 +5152,7 @@ error Context::pushObmAction() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -5174,8 +5160,8 @@ error Context::pushObmAction() { error Context::me( TogglClient *toggl_client, - const std::string email, - const std::string password, + const std::string &email, + const std::string &password, std::string *user_data_json, const Poco::Int64 since) { @@ -5215,7 +5201,7 @@ error Context::me( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -5292,7 +5278,7 @@ error Context::pullWorkspaces(TogglClient* toggl_client) { catch (const std::exception& ex) { return ex.what(); } - catch (const std::string& ex) { + catch (const std::string & ex) { return ex; } return noError; @@ -5373,7 +5359,7 @@ error Context::pullWorkspacePreferences( catch (const std::exception& ex) { return ex.what(); } - catch (const std::string& ex) { + catch (const std::string & ex) { return ex; } return noError; @@ -5434,7 +5420,7 @@ error Context::pullUserPreferences( catch (const std::exception& ex) { return ex.what(); } - catch (const std::string& ex) { + catch (const std::string & ex) { return ex; } return noError; @@ -5442,7 +5428,7 @@ error Context::pullUserPreferences( error Context::signupGoogle( TogglClient *toggl_client, - const std::string access_token, + const std::string &access_token, std::string *user_data_json, const uint64_t country_id) { try { @@ -5492,8 +5478,8 @@ error Context::signupGoogle( error Context::signup( TogglClient *toggl_client, - const std::string email, - const std::string password, + const std::string &email, + const std::string &password, std::string *user_data_json, const uint64_t country_id) { @@ -5539,7 +5525,7 @@ error Context::signup( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -5572,7 +5558,7 @@ error Context::ToSAccept() { } catch(const std::exception& ex) { displayError(kCannotConnectError); return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { displayError(kCannotConnectError); return ex; } @@ -5626,7 +5612,7 @@ error Context::PullCountries() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -5634,7 +5620,7 @@ error Context::PullCountries() { template void Context::collectPushableModels( - const std::vector list, + const std::vector &list, std::vector *result, std::map *models) const { diff --git a/src/context.h b/src/context.h index a011ee2236..d19cfdb514 100644 --- a/src/context.h +++ b/src/context.h @@ -71,7 +71,7 @@ class TOGGL_INTERNAL_EXPORT UIElements { std::string String() const; void ApplyChanges( - const std::string editor_guid, + const std::string &editor_guid, const std::vector &changes); bool first_load; @@ -96,8 +96,8 @@ class TOGGL_INTERNAL_EXPORT UIElements { class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { public: Context( - const std::string app_name, - const std::string app_version); + const std::string &app_name, + const std::string &app_version); virtual ~Context(); GUI *UI() { @@ -113,23 +113,23 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { void FullSync(); void Sync(); void TimelineUpdateServerSettings(); - error SendFeedback(Feedback); + error SendFeedback(const Feedback &); // Load model update from JSON string (from WebSocket) - error LoadUpdateFromJSONString(const std::string json); + error LoadUpdateFromJSONString(const std::string &json); - void SetWebSocketClientURL(const std::string value); + void SetWebSocketClientURL(const std::string &value); - error SetDBPath(const std::string path); + error SetDBPath(const std::string &path); - void SetUpdatePath(const std::string path) { + void SetUpdatePath(const std::string &path) { update_path_ = path; } const std::string &UpdatePath() { return update_path_; } - void SetEnvironment(const std::string environment); + void SetEnvironment(const std::string &environment); std::string Environment() const { return environment_; } @@ -176,8 +176,8 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { error SetSettingsAutodetectProxy(const bool autodetect_proxy); error SetSettingsRemindTimes( - const std::string remind_starts, - const std::string remind_ends); + const std::string &remind_starts, + const std::string &remind_ends); error SetSettingsRemindDays( const bool remind_mon, @@ -188,11 +188,6 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { const bool remind_sat, const bool remind_sun); - void SetCompactMode( - const bool); - - bool GetCompactMode(); - void SetMiniTimerVisible( const bool); @@ -224,30 +219,29 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { int64_t GetWindowEditSizeWidth(); void SetKeyStart( - const std::string value); + const std::string &value); std::string GetKeyStart(); void SetKeyShow( - const std::string value); + const std::string &value); std::string GetKeyShow(); void SetKeyModifierShow( - const std::string value); + const std::string &value); std::string GetKeyModifierShow(); void SetKeyModifierStart( - const std::string value); + const std::string &value); std::string GetKeyModifierStart(); error ProxySettings(bool *use_proxy, Proxy *proxy); - error SetProxySettings( - const bool use_proxy, - const Proxy proxy); + error SetProxySettings(const bool use_proxy, + const Proxy &proxy); error LoadWindowSettings( int64_t *window_x, @@ -276,108 +270,108 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { void SetMiniTimerW( const int64_t w); - error AsyncLogin(const std::string email, - const std::string password); + error AsyncLogin(const std::string &email, + const std::string &password); error Login( - const std::string email, - const std::string password); + const std::string &email, + const std::string &password); error AsyncSignup( - const std::string email, - const std::string password, + const std::string &email, + const std::string &password, const uint64_t country_id); error Signup( - const std::string email, - const std::string password, + const std::string &email, + const std::string &password, const uint64_t country_id); error GoogleSignup( - const std::string access_token, + const std::string &access_token, const uint64_t country_id); error AsyncGoogleSignup( - const std::string access_token, + const std::string &access_token, const uint64_t country_id); - error GoogleLogin(const std::string access_token); - error AsyncGoogleLogin(const std::string access_token); + error GoogleLogin(const std::string &access_token); + error AsyncGoogleLogin(const std::string &access_token); error Logout(); - error SetLoggedInUserFromJSON(const std::string json); + error SetLoggedInUserFromJSON(const std::string &json); error ClearCache(); TimeEntry *Start( - const std::string description, - const std::string duration, + const std::string &description, + const std::string &duration, const Poco::UInt64 task_id, const Poco::UInt64 project_id, - const std::string project_guid, - const std::string tags, + const std::string &project_guid, + const std::string &tags, const bool prevent_on_app); TimeEntry *ContinueLatest(const bool prevent_on_app); TimeEntry *Continue( - const std::string GUID); + const std::string &GUID); void OpenTimeEntryList(); void OpenSettings(); void OpenTimeEntryEditor( - const std::string GUID, + const std::string &GUID, const bool edit_running_entry = false, - const std::string focused_field_name = ""); + const std::string &focused_field_name = ""); error SetTimeEntryDuration( - const std::string GUID, - const std::string duration); + const std::string &GUID, + const std::string &duration); - error DeleteTimeEntryByGUID(const std::string GUID); + error DeleteTimeEntryByGUID(const std::string &GUID); error SetTimeEntryProject( - const std::string GUID, + const std::string &GUID, const Poco::UInt64 task_id, const Poco::UInt64 project_id, - const std::string project_guid); + const std::string &project_guid); error SetTimeEntryDate( - const std::string GUID, + const std::string &GUID, const Poco::Int64 unix_timestamp); error SetTimeEntryStart( - const std::string GUID, - const std::string value); + const std::string &GUID, + const std::string &value); error SetTimeEntryStop( - const std::string GUID, - const std::string value); + const std::string &GUID, + const std::string &value); error SetTimeEntryTags( - const std::string GUID, - const std::string value); + const std::string &GUID, + const std::string &value); error SetTimeEntryBillable( - const std::string GUID, + const std::string &GUID, const bool value); error SetTimeEntryDescription( - const std::string GUID, - const std::string value); + const std::string &GUID, + const std::string &value); error Stop(const bool prevent_on_app); error DiscardTimeAt( - const std::string GUID, + const std::string &GUID, const Poco::Int64 at, const bool split_into_new_entry); TimeEntry *DiscardTimeAndContinue( - const std::string GUID, + const std::string &GUID, const Poco::Int64 at); TimeEntry *RunningTimeEntry(); @@ -397,10 +391,10 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { error DefaultTID(Poco::UInt64 *result); void SearchHelpArticles( - const std::string keywords); + const std::string &keywords); error SetUpdateChannel( - const std::string channel); + const std::string &channel); error UpdateChannel( std::string *update_channel); @@ -408,19 +402,19 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { Project *CreateProject( const Poco::UInt64 workspace_id, const Poco::UInt64 client_id, - const std::string client_guid, - const std::string project_name, + const std::string &client_guid, + const std::string &project_name, const bool is_private, - const std::string project_color); + const std::string &project_color); Client *CreateClient( const Poco::UInt64 workspace_id, - const std::string client_name); + const std::string &client_name); error AddObmAction( const Poco::UInt64 experiment_id, - const std::string key, - const std::string value); + const std::string &key, + const std::string &value); void SetSleep(); @@ -445,14 +439,14 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { void LoadMore(); - static void SetLogPath(const std::string path); + static void SetLogPath(const std::string &path); void SetQuit() { quit_ = true; } error AddAutotrackerRule( - const std::string term, + const std::string &term, const Poco::UInt64 pid, const Poco::UInt64 tid, Poco::Int64 *rule_id); @@ -465,7 +459,7 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { std::string UserEmail(); // Timeline datasource - error StartAutotrackerEvent(const TimelineEvent event); + error StartAutotrackerEvent(const TimelineEvent &event); error CreateCompressedTimelineBatchForUpload(TimelineBatch *batch); error StartTimelineEvent(TimelineEvent *event); error MarkTimelineBatchAsUploaded( @@ -544,7 +538,7 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { void displayTimeEntryEditor(const bool open, TimeEntry *te, - const std::string focused_field_name); + const std::string &focused_field_name); void displayReminder(); void resetLastTrackingReminderTime(); @@ -554,11 +548,11 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { void updateUI(const UIElements &elements); - error displayError(const error err); + error displayError(const error &err); void scheduleSync(); - void setOnline(const std::string reason); + void setOnline(const std::string &reason); int nextSyncIntervalSeconds() const; @@ -569,8 +563,8 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { Poco::Timestamp postpone( const Poco::Timestamp::TimeDiff throttleMicros) const; - error attemptOfflineLogin(const std::string email, - const std::string password); + error attemptOfflineLogin(const std::string &email, + const std::string &password); error downloadUpdate(); @@ -582,7 +576,7 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { error compressTimeline(); - error applySettingsSaveResultToUI(const error err); + error applySettingsSaveResultToUI(const error &err); error pullAllUserData(TogglClient *https_client); error pullChanges(TogglClient *https_client); @@ -592,39 +586,37 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { error pushChanges( TogglClient *https_client, bool *had_something_to_push); - error pushClients( - std::vector clients, - std::string api_token, + error pushClients(const std::vector &clients, + const std::string &api_token, TogglClient toggl_client); error pushProjects( - std::vector projects, - std::vector clients, - std::string api_token, + const std::vector &projects, + const std::vector &clients, + const std::string &api_token, TogglClient toggl_client); - error pushEntries( - std::map models, - std::vector time_entries, - std::string api_token, + error pushEntries(const std::map &models, + const std::vector &time_entries, + const std::string &api_token, TogglClient toggl_client); error updateEntryProjects( - std::vector projects, - std::vector time_entries); + const std::vector &projects, + const std::vector &time_entries); static error signup( TogglClient *https_client, - const std::string email, - const std::string password, + const std::string &email, + const std::string &password, std::string *user_data_json, const uint64_t country_id); static error signupGoogle( TogglClient *toggl_client, - const std::string access_token, + const std::string &access_token, std::string *user_data_json, const uint64_t country_id); static error me(TogglClient *https_client, - const std::string email, - const std::string password, - std::string *user_data, - const Poco::Int64 since); + const std::string &email, + const std::string &password, + std::string *user_data, + const Poco::Int64 since); bool isTimeEntryLocked(TimeEntry* te); bool isTimeLockedInWorkspace(time_t t, Workspace* ws); @@ -645,7 +637,7 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource { template void collectPushableModels( - const std::vector list, + const std::vector &list, std::vector *result, std::map *models = nullptr) const; diff --git a/src/database.cc b/src/database.cc index a6d3bf0931..1c43b7f37a 100644 --- a/src/database.cc +++ b/src/database.cc @@ -42,7 +42,7 @@ using Poco::Data::Keywords::limit; using Poco::Data::Keywords::into; using Poco::Data::Keywords::now; -Database::Database(const std::string db_path) +Database::Database(const std::string &db_path) : session_(nullptr) , desktop_id_("") , analytics_client_id_("") { @@ -208,7 +208,7 @@ error Database::DeleteUser( } error Database::deleteAllFromTableByUID( - const std::string table_name, + const std::string &table_name, const Poco::UInt64 &UID) { @@ -232,14 +232,14 @@ error Database::deleteAllFromTableByUID( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("deleteAllFromTableByUID"); } error Database::deleteAllFromTableByDate( - const std::string table_name, + const std::string &table_name, const Poco::Timestamp &time) { if (table_name.empty()) { @@ -262,7 +262,7 @@ error Database::deleteAllFromTableByDate( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("deleteAllFromTableByDate"); @@ -286,7 +286,7 @@ error Database::deleteAllSyncedTimelineEventsByDate( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("deleteAllSyncedTimelineEventsByDate"); @@ -308,13 +308,13 @@ error Database::journalMode(std::string *mode) { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("journalMode"); } -error Database::setJournalMode(const std::string mode) { +error Database::setJournalMode(const std::string &mode) { if (mode.empty()) { return error("Cannot set journal mode without a mode"); } @@ -331,7 +331,7 @@ error Database::setJournalMode(const std::string mode) { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("setJournalMode"); @@ -348,7 +348,7 @@ error Database::vacuum() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("vacuum"); @@ -359,7 +359,7 @@ Poco::Logger &Database::logger() const { } error Database::DeleteFromTable( - const std::string table_name, + const std::string &table_name, const Poco::Int64 &local_id) { if (table_name.empty()) { @@ -389,13 +389,13 @@ error Database::DeleteFromTable( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("DeleteFromTable"); } -error Database::last_error(const std::string was_doing) { +error Database::last_error(const std::string &was_doing) { Poco::Mutex::ScopedLock lock(session_m_); poco_check_ptr(session_); @@ -487,7 +487,7 @@ error Database::LoadSettings(Settings *settings) { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("LoadSettings"); @@ -519,7 +519,7 @@ error Database::SaveWindowSettings( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } @@ -581,7 +581,7 @@ error Database::LoadWindowSettings( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("LoadWindowSettings"); @@ -619,21 +619,12 @@ error Database::LoadProxySettings( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("LoadProxySettings"); } -error Database::SetCompactMode( - const bool value) { - return setSettingsValue("compact_mode", value); -} - -error Database::GetCompactMode(bool *result) { - return getSettingsValue("compact_mode", result); -} - error Database::SetMiniTimerVisible( const bool value) { return setSettingsValue("mini_timer_visible", value); @@ -689,7 +680,7 @@ error Database::GetWindowEditSizeWidth(Poco::Int64 *result) { } error Database::SetKeyStart( - const std::string value) { + const std::string &value) { return setSettingsValue("key_start", value); } @@ -698,7 +689,7 @@ error Database::GetKeyStart(std::string *result) { } error Database::SetKeyShow( - const std::string value) { + const std::string &value) { return setSettingsValue("key_show", value); } @@ -707,7 +698,7 @@ error Database::GetKeyShow(std::string *result) { } error Database::SetKeyModifierShow( - const std::string value) { + const std::string &value) { return setSettingsValue("key_modifier_show", value); } @@ -716,7 +707,7 @@ error Database::GetKeyModifierShow(std::string *result) { } error Database::SetKeyModifierStart( - const std::string value) { + const std::string &value) { return setSettingsValue("key_modifier_start", value); } @@ -744,7 +735,7 @@ error Database::SetSettingsRemindTimes( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } @@ -786,7 +777,7 @@ error Database::SetSettingsRemindDays( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } @@ -866,7 +857,7 @@ error Database::SetSettingsAutodetectProxy(const bool &autodetect_proxy) { template error Database::setSettingsValue( - const std::string field_name, + const std::string &field_name, const T &value) { try { @@ -882,7 +873,7 @@ error Database::setSettingsValue( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("setSettingsValue"); @@ -890,7 +881,7 @@ error Database::setSettingsValue( template error Database::getSettingsValue( - const std::string field_name, + const std::string &field_name, T *value) { try { @@ -908,7 +899,7 @@ error Database::getSettingsValue( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("getSettingsValue"); @@ -967,13 +958,13 @@ error Database::SaveProxySettings( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("SaveProxySettings"); } -error Database::Trim(const std::string text, std::string *result) { +error Database::Trim(const std::string &text, std::string *result) { try { Poco::Mutex::ScopedLock lock(session_m_); @@ -992,7 +983,7 @@ error Database::Trim(const std::string text, std::string *result) { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("Trim"); @@ -1022,7 +1013,7 @@ error Database::ResetWindow() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("ResetWindow"); @@ -1046,7 +1037,7 @@ error Database::LoadUpdateChannel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("LoadUpdateChannel"); @@ -1102,7 +1093,7 @@ error Database::LoadUserByEmail( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return LoadUserByID(uid, model); @@ -1247,7 +1238,7 @@ error Database::LoadUserByID( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } error err = loadUsersRelatedData(user); @@ -1317,7 +1308,7 @@ error Database::loadWorkspaces( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("loadWorkspaces"); @@ -1379,7 +1370,7 @@ error Database::loadClients( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("loadClients"); @@ -1469,7 +1460,7 @@ error Database::loadProjects( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("loadProjects"); @@ -1531,7 +1522,7 @@ error Database::loadTasks( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("loadTasks"); @@ -1592,7 +1583,7 @@ error Database::loadTags( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("loadTags"); @@ -1646,7 +1637,7 @@ error Database::loadAutotrackerRules( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("loadAutotrackerRules"); @@ -1698,7 +1689,7 @@ error Database::loadObmActions( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("loadObmActions"); @@ -1751,7 +1742,7 @@ error Database::loadObmExperiments( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("loadObmExperiments"); @@ -1827,7 +1818,7 @@ error Database::loadTimelineEvents( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -1881,7 +1872,7 @@ error Database::loadTimeEntries( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -1969,7 +1960,13 @@ error Database::loadTimeEntriesFromSQLStatement( } else { model->SetValidationError(rs[19].convert()); } - model->ClearDirty(); + if (model->UIModifiedAt() > model->UpdatedAt()) { + model->SetUnsynced(); + model->SetDirty(); + } else { + model->ClearDirty(); + } + list->push_back(model); more = rs.moveNext(); } @@ -1978,7 +1975,7 @@ error Database::loadTimeEntriesFromSQLStatement( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -1987,7 +1984,7 @@ error Database::loadTimeEntriesFromSQLStatement( template error Database::saveRelatedModels( const Poco::UInt64 UID, - const std::string table_name, + const std::string &table_name, std::vector *list, std::vector *changes) { @@ -2162,7 +2159,7 @@ error Database::saveModel( logger().debug(ss.str()); if (model->ID()) { *session_ << - "insert into time_entries(id, uid, description, " + "insert or replace into time_entries(id, uid, description, " "wid, guid, pid, tid, billable, " "duronly, ui_modified_at, " "start, stop, duration, " @@ -2196,7 +2193,7 @@ error Database::saveModel( now; } else { *session_ << - "insert into time_entries(uid, description, wid, " + "insert or replace into time_entries(uid, description, wid, " "guid, pid, tid, billable, " "duronly, ui_modified_at, " "start, stop, duration, " @@ -2254,7 +2251,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -2413,7 +2410,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -2507,7 +2504,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -2603,7 +2600,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -2704,7 +2701,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -2825,7 +2822,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -3072,7 +3069,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -3155,7 +3152,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -3266,7 +3263,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -3410,7 +3407,7 @@ error Database::SaveUser( } catch(const std::exception& ex) { session_->rollback(); return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { session_->rollback(); return ex; } @@ -3656,7 +3653,7 @@ error Database::CurrentAPIToken( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("CurrentAPIToken"); @@ -3674,7 +3671,7 @@ error Database::ClearCurrentAPIToken() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("ClearCurrentAPIToken"); @@ -3710,7 +3707,7 @@ error Database::SetCurrentAPIToken( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("SetCurrentAPIToken"); @@ -3753,7 +3750,7 @@ error Database::EnsureTimelineGUIDS() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } } @@ -3812,7 +3809,7 @@ error Database::saveAnalyticsClientID() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("saveAnalyticsClientID"); @@ -3849,7 +3846,7 @@ error Database::LoadMigrations( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("LoadMigrations"); @@ -3857,7 +3854,7 @@ error Database::LoadMigrations( error Database::Migrate( const std::string &name, - const std::string sql) { + const std::string &sql) { if (name.empty()) { return error("Cannot run a migration without name"); @@ -3909,14 +3906,14 @@ error Database::Migrate( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; } error Database::execute( - const std::string sql) { + const std::string &sql) { if (sql.empty()) { @@ -3937,14 +3934,14 @@ error Database::execute( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; } error Database::String( - const std::string sql, + const std::string &sql, std::string *result) { if (sql.empty()) { @@ -3966,14 +3963,14 @@ error Database::String( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("String"); } error Database::UInt( - const std::string sql, + const std::string &sql, Poco::UInt64 *result) { if (sql.empty()) { @@ -3995,7 +3992,7 @@ error Database::UInt( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("UInt"); @@ -4016,7 +4013,7 @@ error Database::saveDesktopID() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return last_error("saveDesktopID"); @@ -4118,7 +4115,7 @@ error Database::saveModel( return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; diff --git a/src/database.h b/src/database.h index e33c88ca37..a910e5b6a2 100644 --- a/src/database.h +++ b/src/database.h @@ -44,11 +44,11 @@ class Workspace; class TOGGL_INTERNAL_EXPORT Database { public: - explicit Database(const std::string db_path); + explicit Database(const std::string &db_path); ~Database(); error DeleteFromTable( - const std::string table_name, + const std::string &table_name, const Poco::Int64 &local_id); error DeleteUser( @@ -141,12 +141,6 @@ class TOGGL_INTERNAL_EXPORT Database { error LoadMigrations( std::vector *); - error SetCompactMode( - const bool); - - error GetCompactMode( - bool *); - error SetMiniTimerVisible( const bool); @@ -180,22 +174,22 @@ class TOGGL_INTERNAL_EXPORT Database { error GetWindowEditSizeWidth(Poco::Int64 *result); error SetKeyStart( - const std::string value); + const std::string &value); error GetKeyStart(std::string *result); error SetKeyShow( - const std::string value); + const std::string &value); error GetKeyShow(std::string *result); error SetKeyModifierShow( - const std::string value); + const std::string &value); error GetKeyModifierShow(std::string *result); error SetKeyModifierStart( - const std::string value); + const std::string &value); error GetKeyModifierStart(std::string *result); @@ -214,11 +208,11 @@ class TOGGL_INTERNAL_EXPORT Database { const std::string &update_channel); error UInt( - const std::string sql, + const std::string &sql, Poco::UInt64 *result); error String( - const std::string sql, + const std::string &sql, std::string *result); error SaveUser(User *user, bool with_related_data, @@ -248,11 +242,11 @@ class TOGGL_INTERNAL_EXPORT Database { error Migrate( const std::string &name, - const std::string sql); + const std::string &sql); error EnsureTimelineGUIDS(); - error Trim(const std::string text, std::string *result); + error Trim(const std::string &text, std::string *result); error ResetWindow(); @@ -265,22 +259,22 @@ class TOGGL_INTERNAL_EXPORT Database { template error setSettingsValue( - const std::string field_name, + const std::string &field_name, const T &value); template error getSettingsValue( - const std::string field_name, + const std::string &field_name, T *value); error execute( - const std::string sql); + const std::string &sql); error last_error( - const std::string was_doing); + const std::string &was_doing); error journalMode(std::string *); - error setJournalMode(const std::string); + error setJournalMode(const std::string &); error loadUsersRelatedData(User *user); @@ -331,19 +325,19 @@ class TOGGL_INTERNAL_EXPORT Database { template error saveRelatedModels( const Poco::UInt64 UID, - const std::string table_name, + const std::string &table_name, std::vector *list, std::vector *changes); error deleteAllFromTableByDate( - const std::string table_name, + const std::string &table_name, const Poco::Timestamp &time); error deleteAllSyncedTimelineEventsByDate( const Poco::Timestamp &time); error deleteAllFromTableByUID( - const std::string table_name, + const std::string &table_name, const Poco::UInt64 &UID); error saveModel( diff --git a/src/error.cc b/src/error.cc index 86d1c3d8a0..47c4ccd99d 100644 --- a/src/error.cc +++ b/src/error.cc @@ -9,7 +9,7 @@ namespace toggl { -bool IsNetworkingError(const error err) { +bool IsNetworkingError(const error &err) { if (noError == err) { return false; } @@ -99,7 +99,7 @@ bool IsNetworkingError(const error err) { return false; } -bool IsUserError(const error err) { +bool IsUserError(const error &err) { if (noError == err) { return false; } @@ -209,7 +209,7 @@ bool IsUserError(const error err) { return false; } -std::string MakeErrorActionable(const error err) { +std::string MakeErrorActionable(const error &err) { if (noError == err) { return err; } diff --git a/src/error.h b/src/error.h index 867d248da7..0a07461138 100644 --- a/src/error.h +++ b/src/error.h @@ -9,9 +9,9 @@ namespace toggl { -bool IsNetworkingError(const error); -bool IsUserError(const error); -std::string MakeErrorActionable(const error); +bool IsNetworkingError(const error &err); +bool IsUserError(const error &err); +std::string MakeErrorActionable(const error &err); } // namespace toggl diff --git a/src/feedback.h b/src/feedback.h index b5e1589c0a..57536189ab 100644 --- a/src/feedback.h +++ b/src/feedback.h @@ -20,26 +20,26 @@ class TOGGL_INTERNAL_EXPORT Feedback { toggl::error Validate() const; - const std::string AttachmentPath() const { + const std::string &AttachmentPath() const { return attachment_path_; } - void SetAttachmentPath(const std::string value) { + void SetAttachmentPath(const std::string &value) { attachment_path_ = value; } - const std::string Details() const { + const std::string &Details() const { return details_; } - void SetDetails(const std::string value) { + void SetDetails(const std::string &value) { details_ = value; } - void SetSubject(const std::string value) { + void SetSubject(const std::string &value) { std::stringstream ss; ss << "Toggl Desktop - " << value; subject_ = ss.str(); } - const std::string Subject() const { + const std::string &Subject() const { return subject_; } diff --git a/src/formatter.cc b/src/formatter.cc index d52ab9f5d2..38caf033b4 100644 --- a/src/formatter.cc +++ b/src/formatter.cc @@ -36,7 +36,7 @@ std::string Formatter::TimeOfDayFormat = std::string(""); std::string Formatter::DurationFormat = Format::Improved; std::string Formatter::togglTimeOfDayToPocoFormat( - const std::string toggl_format) { + const std::string &toggl_format) { if ("h:mm A" == toggl_format) { return "%h:%M %A"; } @@ -104,7 +104,7 @@ std::string Formatter::FormatDateHeader(const std::time_t date) { return Poco::DateTimeFormatter::format(datetime, "%w, %e %b"); } -bool Formatter::parseTimeInputAMPM(const std::string numbers, +bool Formatter::parseTimeInputAMPM(const std::string &numbers, int *hours, int *minutes, const bool has_pm) { @@ -143,9 +143,9 @@ bool Formatter::parseTimeInputAMPM(const std::string numbers, } bool Formatter::parseTimeInputAMPM( - const std::string value, - const std::string am_symbol, - const std::string pm_symbol, + const std::string &value, + const std::string &am_symbol, + const std::string &pm_symbol, int *hours, int *minutes) { @@ -175,7 +175,7 @@ bool timeIsWithinLimits(int *hours, int *minutes) { return true; } -bool Formatter::ParseTimeInput(const std::string input, +bool Formatter::ParseTimeInput(const std::string &input, int *hours, int *minutes) { std::string value = Poco::replace(Poco::UTF8::toUpper(input), " ", ""); @@ -218,7 +218,7 @@ bool Formatter::ParseTimeInput(const std::string input, return timeIsWithinLimits(hours, minutes); } -bool Formatter::parseDurationStringHHMMSS(const std::string value, +bool Formatter::parseDurationStringHHMMSS(const std::string &value, int *parsed_seconds) { *parsed_seconds = 0; @@ -246,7 +246,7 @@ bool Formatter::parseDurationStringHHMMSS(const std::string value, return true; } -bool Formatter::parseDurationStringHHMM(const std::string value, +bool Formatter::parseDurationStringHHMM(const std::string &value, int *parsed_seconds) { *parsed_seconds = 0; @@ -270,7 +270,7 @@ bool Formatter::parseDurationStringHHMM(const std::string value, } void Formatter::take( - const std::string delimiter, + const std::string &delimiter, double *value, std::string *whatsleft) { @@ -317,7 +317,7 @@ int Formatter::parseDurationStringHoursMinutesSeconds( return Poco::Timespan(period, 0).totalSeconds(); } -bool Formatter::parseDurationStringMMSS(const std::string value, +bool Formatter::parseDurationStringMMSS(const std::string &value, int *parsed_seconds) { *parsed_seconds = 0; @@ -340,7 +340,7 @@ bool Formatter::parseDurationStringMMSS(const std::string value, return true; } -int Formatter::ParseDurationString(const std::string value) { +int Formatter::ParseDurationString(const std::string &value) { std::string input = Poco::replace(value, " ", ""); input = Poco::replace(input, ",", "."); @@ -427,7 +427,7 @@ std::string Formatter::FormatDurationForDateHeader( std::string Formatter::FormatDuration( const Poco::Int64 value, - const std::string format_name, + const std::string &format_name, const bool with_seconds) { Poco::Int64 duration = AbsDuration(value); @@ -487,7 +487,7 @@ std::string Formatter::FormatDuration( return ss.str(); } -std::time_t Formatter::Parse8601(const std::string iso_8601_formatted_date) { +std::time_t Formatter::Parse8601(const std::string &iso_8601_formatted_date) { if ("null" == iso_8601_formatted_date) { return 0; } @@ -540,7 +540,7 @@ std::string Formatter::Format8601(const Poco::Timestamp ts) { Poco::DateTimeFormat::ISO8601_FORMAT); } -std::string Formatter::EscapeJSONString(const std::string input) { +std::string Formatter::EscapeJSONString(const std::string &input) { std::ostringstream ss; for (std::string::const_iterator iter = input.begin(); iter != input.end(); diff --git a/src/formatter.h b/src/formatter.h index a82155ba76..26fe7939a0 100644 --- a/src/formatter.h +++ b/src/formatter.h @@ -51,7 +51,7 @@ class TOGGL_INTERNAL_EXPORT Formatter { static std::string FormatDuration( const Poco::Int64 value, - const std::string format_name, + const std::string &format_name, const bool with_seconds = true); static std::string FormatDurationForDateHeader( @@ -79,53 +79,53 @@ class TOGGL_INTERNAL_EXPORT Formatter { // Parse static std::time_t Parse8601( - const std::string iso_8601_formatted_date); + const std::string &iso_8601_formatted_date); static int ParseDurationString( - const std::string value); + const std::string &value); static bool ParseTimeInput( - const std::string value, + const std::string &value, int *hours, int *minutes); // Escape static std::string EscapeJSONString( - const std::string input); + const std::string &input); private: static std::string togglTimeOfDayToPocoFormat( - const std::string toggl_format); + const std::string &toggl_format); static void take( - const std::string delimiter, + const std::string &delimiter, double *value, std::string *whatsleft); static bool parseTimeInputAMPM( - const std::string numbers, + const std::string &numbers, int *hours, int *minutes, const bool has_pm); static bool parseTimeInputAMPM( - const std::string value, - const std::string am_symbol, - const std::string pm_symbol, + const std::string &value, + const std::string &am_symbol, + const std::string &pm_symbol, int *hours, int *minutes); static bool parseDurationStringHHMMSS( - const std::string value, + const std::string &value, int *parsed_seconds); static bool parseDurationStringHHMM( - const std::string value, + const std::string &value, int *parsed_seconds); static bool parseDurationStringMMSS( - const std::string value, + const std::string &value, int *parsed_seconds); static int parseDurationStringHoursMinutesSeconds( diff --git a/src/gui.cc b/src/gui.cc index 5dcf604abd..d3b8358b99 100644 --- a/src/gui.cc +++ b/src/gui.cc @@ -101,7 +101,7 @@ void GUI::DisplayCountries( } TogglCountryView *first = country_list_init(items); on_display_countries_(first); - country_item_clear(first); + country_list_clear(first); } void GUI::DisplaySyncState(const Poco::Int64 state) { @@ -138,7 +138,7 @@ void GUI::DisplayLogin(const bool open, const uint64_t user_id) { lastDisplayLoginUserID = user_id; } -error GUI::DisplayError(const error err) { +error GUI::DisplayError(const error &err) { if (noError == err) { return noError; } @@ -371,11 +371,11 @@ void GUI::DisplayTimeEntryAutocomplete( TogglAutocompleteView *first = autocomplete_list_init(items); on_display_time_entry_autocomplete_(first); - autocomplete_item_clear(first); + autocomplete_list_clear(first); } void GUI::DisplayHelpArticles( - std::vector articles) { + const std::vector &articles) { logger().debug("DisplayHelpArticles"); if (!on_display_help_articles_) { @@ -384,7 +384,7 @@ void GUI::DisplayHelpArticles( TogglHelpArticleView *first = help_article_list_init(articles); on_display_help_articles_(first); - help_article_clear(first); + help_article_list_clear(first); } void GUI::DisplayMinitimerAutocomplete( @@ -393,7 +393,7 @@ void GUI::DisplayMinitimerAutocomplete( TogglAutocompleteView *first = autocomplete_list_init(items); on_display_mini_timer_autocomplete_(first); - autocomplete_item_clear(first); + autocomplete_list_clear(first); } void GUI::DisplayProjectAutocomplete( @@ -402,11 +402,11 @@ void GUI::DisplayProjectAutocomplete( TogglAutocompleteView *first = autocomplete_list_init(items); on_display_project_autocomplete_(first); - autocomplete_item_clear(first); + autocomplete_list_clear(first); } void GUI::DisplayTimeEntryList(const bool open, - const std::vector list, + const std::vector &list, const bool show_load_more_button) { Poco::Stopwatch stopwatch; auto renderList = std::vector(); @@ -451,7 +451,7 @@ void GUI::DisplayTimeEntryList(const bool open, on_display_time_entry_list_(open, first, show_load_more_button); - time_entry_view_item_clear(first); + time_entry_view_list_clear(first); stopwatch.stop(); { @@ -462,12 +462,12 @@ void GUI::DisplayTimeEntryList(const bool open, } } -void GUI::DisplayTags(const std::vector list) { +void GUI::DisplayTags(const std::vector &list) { logger().debug("DisplayTags"); TogglGenericView *first = generic_to_view_item_list(list); on_display_tags_(first); - view_item_clear(first); + view_list_clear(first); } void GUI::DisplayAutotrackerRules( @@ -500,31 +500,30 @@ void GUI::DisplayAutotrackerRules( } delete[] title_list; - autotracker_view_item_clear(first); + autotracker_view_list_clear(first); } void GUI::DisplayClientSelect( - const std::vector list) { + const std::vector &list) { logger().debug("DisplayClientSelect"); TogglGenericView *first = generic_to_view_item_list(list); on_display_client_select_(first); - view_item_clear(first); + view_list_clear(first); } void GUI::DisplayWorkspaceSelect( - const std::vector list) { + const std::vector &list) { logger().debug("DisplayWorkspaceSelect"); TogglGenericView *first = generic_to_view_item_list(list); on_display_workspace_select_(first); - view_item_clear(first); + view_list_clear(first); } -void GUI::DisplayTimeEntryEditor( - const bool open, - const view::TimeEntry te, - const std::string focused_field_name) { +void GUI::DisplayTimeEntryEditor(const bool open, + const view::TimeEntry &te, + const std::string &focused_field_name) { logger().debug( "DisplayTimeEntryEditor focused_field_name=" + focused_field_name); @@ -535,10 +534,10 @@ void GUI::DisplayTimeEntryEditor( on_display_time_entry_editor_(open, view, field_s); free(field_s); - time_entry_view_item_clear(view); + time_entry_view_list_clear(view); } -void GUI::DisplayURL(const std::string URL) { +void GUI::DisplayURL(const std::string &URL) { logger().debug("DisplayURL " + URL); char_t *url = copy_string(URL); @@ -546,7 +545,7 @@ void GUI::DisplayURL(const std::string URL) { free(url); } -void GUI::DisplayUpdate(const std::string URL) { +void GUI::DisplayUpdate(const std::string &URL) { logger().debug("DisplayUpdate " + URL); char_t *url = copy_string(URL); @@ -555,7 +554,7 @@ void GUI::DisplayUpdate(const std::string URL) { } void GUI::DisplayUpdateDownloadState( - const std::string version, + const std::string &version, const Poco::Int64 download_state) { if (!CanDisplayUpdateDownloadState()) { @@ -575,9 +574,9 @@ void GUI::DisplayUpdateDownloadState( void GUI::DisplaySettings(const bool open, const bool record_timeline, - const Settings settings, + const Settings &settings, const bool use_proxy, - const Proxy proxy) { + const Proxy &proxy) { logger().debug("DisplaySettings"); TogglSettingsView *view = settings_view_item_init( @@ -596,7 +595,7 @@ void GUI::DisplayTimerState( TogglTimeEntryView *view = time_entry_view_item_init(te); on_display_timer_state_(view); - time_entry_view_item_clear(view); + time_entry_view_list_clear(view); logger().debug("DisplayTimerState"); } @@ -606,11 +605,11 @@ void GUI::DisplayEmptyTimerState() { logger().debug("DisplayEmptyTimerState"); } -void GUI::DisplayIdleNotification(const std::string guid, - const std::string since, - const std::string duration, +void GUI::DisplayIdleNotification(const std::string &guid, + const std::string &since, + const std::string &duration, const int64_t started, - const std::string description) { + const std::string &description) { char_t *guid_s = copy_string(guid); char_t *since_s = copy_string(since); char_t *duration_s = copy_string(duration); diff --git a/src/gui.h b/src/gui.h index fbbfe9136b..a765080acc 100644 --- a/src/gui.h +++ b/src/gui.h @@ -386,14 +386,14 @@ class TOGGL_INTERNAL_EXPORT GUI : public SyncStateMonitor { void DisplayApp(); - error DisplayError(const error); + error DisplayError(const error &err); // Overlay screen triggers error DisplayWSError(); error DisplayTosAccept(); void DisplayHelpArticles( - const std::vector articles); + const std::vector &articles); void DisplaySyncState(const Poco::Int64 state); @@ -419,7 +419,7 @@ class TOGGL_INTERNAL_EXPORT GUI : public SyncStateMonitor { void DisplayTimeEntryList( const bool open, - const std::vector list, + const std::vector &list, const bool show_load_more_button); void DisplayProjectColors(); @@ -428,13 +428,13 @@ class TOGGL_INTERNAL_EXPORT GUI : public SyncStateMonitor { std::vector *items); void DisplayWorkspaceSelect( - const std::vector list); + const std::vector &list); void DisplayClientSelect( - const std::vector list); + const std::vector &list); void DisplayTags( - const std::vector list); + const std::vector &list); void DisplayAutotrackerRules( const std::vector &autotracker_rules, @@ -442,35 +442,35 @@ class TOGGL_INTERNAL_EXPORT GUI : public SyncStateMonitor { void DisplayTimeEntryEditor( const bool open, - const view::TimeEntry te, - const std::string focused_field_name); + const view::TimeEntry &te, + const std::string &focused_field_name); - void DisplayURL(const std::string); + void DisplayURL(const std::string &); void DisplayLogin(const bool open, const uint64_t user_id); void DisplaySettings( const bool open, const bool record_timeline, - const Settings settings, + const Settings &settings, const bool use_proxy, - const Proxy proxy); + const Proxy &proxy); void DisplayTimerState( const view::TimeEntry &te); void DisplayEmptyTimerState(); - void DisplayIdleNotification(const std::string guid, - const std::string since, - const std::string duration, + void DisplayIdleNotification(const std::string &guid, + const std::string &since, + const std::string &duration, const int64_t started, - const std::string description); + const std::string &description); - void DisplayUpdate(const std::string URL); + void DisplayUpdate(const std::string &URL); void DisplayUpdateDownloadState( - const std::string version, + const std::string &version, const Poco::Int64 download_state); error VerifyCallbacks(); diff --git a/src/help_article.cc b/src/help_article.cc index b2d18e91af..644547d0df 100644 --- a/src/help_article.cc +++ b/src/help_article.cc @@ -590,7 +590,7 @@ HelpDatabase::HelpDatabase() { } std::vector HelpDatabase::GetArticles( - const std::string keywords) { + const std::string &keywords) { std::string lower = Poco::UTF8::toLower(keywords); Poco::StringTokenizer tokenizer(lower, ";, ", Poco::StringTokenizer::TOK_TRIM); diff --git a/src/help_article.h b/src/help_article.h index 054984ef22..97fc8e7701 100644 --- a/src/help_article.h +++ b/src/help_article.h @@ -14,10 +14,10 @@ namespace toggl { class TOGGL_INTERNAL_EXPORT HelpArticle { public: HelpArticle( - const std::string type, - const std::string name, - const std::string url, - const std::string search_text) + const std::string &type, + const std::string &name, + const std::string &url, + const std::string &search_text) : Type(type) , Name(name) , URL(url) @@ -46,7 +46,7 @@ class TOGGL_INTERNAL_EXPORT HelpDatabase { virtual ~HelpDatabase() {} std::vector GetArticles( - const std::string keywords); + const std::string &keywords); private: std::vector articles_; diff --git a/src/https_client.cc b/src/https_client.cc index f2efee0db3..0818ab2bed 100644 --- a/src/https_client.cc +++ b/src/https_client.cc @@ -52,7 +52,7 @@ void ServerStatus::startStatusCheck() { checker_.start(); } -void ServerStatus::stopStatusCheck(const std::string reason) { +void ServerStatus::stopStatusCheck(const std::string &reason) { if (!checker_.isRunning() || checker_.isStopped()) { return; } @@ -506,7 +506,7 @@ HTTPSResponse HTTPSClient::makeHttpRequest( } catch(const std::exception& ex) { resp.err = ex.what(); return resp; - } catch(const std::string& ex) { + } catch(const std::string & ex) { resp.err = ex; return resp; } diff --git a/src/https_client.h b/src/https_client.h index 75c500b075..5406d076b5 100644 --- a/src/https_client.h +++ b/src/https_client.h @@ -58,7 +58,7 @@ class TOGGL_INTERNAL_EXPORT ServerStatus { bool gone(); void startStatusCheck(); - void stopStatusCheck(const std::string reason); + void stopStatusCheck(const std::string &reason); bool checkingStatus(); Poco::Logger &logger() const; diff --git a/src/idle.cc b/src/idle.cc index 5011addc23..db99faad07 100644 --- a/src/idle.cc +++ b/src/idle.cc @@ -44,7 +44,7 @@ void Idle::SetIdleSeconds( logger().error(exc.displayText()); } catch(const std::exception& ex) { return logger().error(ex.what()); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return logger().error(ex); } last_idle_seconds_reading_ = idle_seconds; diff --git a/src/idle.h b/src/idle.h index 8d12ca7427..ede82bb9c5 100644 --- a/src/idle.h +++ b/src/idle.h @@ -23,7 +23,7 @@ class TOGGL_INTERNAL_EXPORT Idle { const Poco::Int64 idle_seconds, User *current_user); - void SetSettings(const Settings settings) { + void SetSettings(const Settings &settings) { settings_ = settings; } diff --git a/src/migrations.cc b/src/migrations.cc index 064407242e..96566c2a4b 100644 --- a/src/migrations.cc +++ b/src/migrations.cc @@ -1212,14 +1212,6 @@ error Migrations::migrateSettings() { return err; } - err = db_->Migrate( - "settings.compact_mode", - "ALTER TABLE settings " - "ADD COLUMN compact_mode INTEGER NOT NULL DEFAULT 0;"); - if (err != noError) { - return err; - } - err = db_->Migrate( "settings.keep_end_time_fixed", "ALTER TABLE settings " diff --git a/src/model_change.h b/src/model_change.h index 3505da3b55..55bf2114a6 100644 --- a/src/model_change.h +++ b/src/model_change.h @@ -14,10 +14,10 @@ namespace toggl { class ModelChange { public: ModelChange( - const std::string model_type, - const std::string change_type, + const std::string &model_type, + const std::string &change_type, const Poco::UInt64 model_id, - const std::string GUID) + const std::string &GUID) : model_type_(model_type) , change_type_(change_type) , model_id_(model_id) diff --git a/src/netconf.cc b/src/netconf.cc index 5408ece41d..2dbfe20bcd 100644 --- a/src/netconf.cc +++ b/src/netconf.cc @@ -27,7 +27,7 @@ namespace toggl { error Netconf::autodetectProxy( - const std::string encoded_url, + const std::string &encoded_url, std::vector *proxy_strings) { poco_assert(proxy_strings); @@ -50,7 +50,13 @@ error Netconf::autodetectProxy( std::wstring proxy_url_wide(ie_config.lpszProxy); std::string s(""); Poco::UnicodeConverter::toUTF8(proxy_url_wide, s); - proxy_strings->push_back(s); + s = Poco::replace(s, std::string("http="), std::string("http://")); + s = Poco::replace(s, std::string("https="), std::string("https://")); + std::stringstream ss(s); + std::string proxy_address; + while (std::getline(ss, proxy_address, ';')) { + proxy_strings->push_back(proxy_address); + } } #endif @@ -89,7 +95,7 @@ error Netconf::autodetectProxy( } error Netconf::ConfigureProxy( - const std::string encoded_url, + const std::string &encoded_url, Poco::Net::HTTPSClientSession *session) { Poco::Logger &logger = Poco::Logger::get("ConfigureProxy"); diff --git a/src/netconf.h b/src/netconf.h index 57a28c763e..dc480c12be 100644 --- a/src/netconf.h +++ b/src/netconf.h @@ -26,12 +26,12 @@ class TOGGL_INTERNAL_EXPORT Netconf { virtual ~Netconf() {} static error ConfigureProxy( - const std::string encoded_url, + const std::string &encoded_url, Poco::Net::HTTPSClientSession *session); private: static error autodetectProxy( - const std::string encoded_url, + const std::string &encoded_url, std::vector *proxy_strings); }; diff --git a/src/obm_action.cc b/src/obm_action.cc index f420637123..c8a24c3451 100644 --- a/src/obm_action.cc +++ b/src/obm_action.cc @@ -25,14 +25,14 @@ void ObmAction::SetExperimentID(const Poco::UInt64 value) { } } -void ObmAction::SetKey(const std::string value) { +void ObmAction::SetKey(const std::string &value) { if (key_ != value) { key_ = value; SetDirty(); } } -void ObmAction::SetValue(const std::string value) { +void ObmAction::SetValue(const std::string &value) { if (value_ != value) { value_ = value; SetDirty(); @@ -87,7 +87,7 @@ void ObmExperiment::SetIncluded(const bool value) { } } -void ObmExperiment::SetActions(const std::string value) { +void ObmExperiment::SetActions(const std::string &value) { if (actions_ != value) { actions_ = value; SetDirty(); diff --git a/src/obm_action.h b/src/obm_action.h index 063c943df2..54662ff295 100644 --- a/src/obm_action.h +++ b/src/obm_action.h @@ -24,12 +24,12 @@ class TOGGL_INTERNAL_EXPORT ObmAction : public BaseModel { const std::string &Key() const { return key_; } - void SetKey(const std::string value); + void SetKey(const std::string &value); const std::string &Value() const { return value_; } - void SetValue(const std::string value); + void SetValue(const std::string &value); const Poco::UInt64 &ExperimentID() const { return experiment_id_; @@ -72,10 +72,10 @@ class TOGGL_INTERNAL_EXPORT ObmExperiment : public BaseModel { } void SetNr(const Poco::UInt64 value); - const std::string Actions() const { + const std::string &Actions() const { return actions_; } - void SetActions(const std::string value); + void SetActions(const std::string &value); // Override BaseModel std::string String() const; diff --git a/src/platforminfo.cc b/src/platforminfo.cc index 294b93695a..deca590663 100644 --- a/src/platforminfo.cc +++ b/src/platforminfo.cc @@ -132,7 +132,7 @@ std::string getWMName() { std::string getDEName() { char *env = getenv("XDG_CURRENT_DESKTOP"); - return std::string(env); + return env ? std::string(env) : ""; } std::string getDistroName() { diff --git a/src/project.cc b/src/project.cc index 7ab43a3671..fa27a887d8 100644 --- a/src/project.cc +++ b/src/project.cc @@ -49,7 +49,7 @@ std::string Project::FullName() const { return ss.str(); } -void Project::SetClientGUID(const std::string value) { +void Project::SetClientGUID(const std::string &value) { if (client_guid_ != value) { client_guid_ = value; SetDirty(); @@ -70,7 +70,7 @@ void Project::SetPrivate(const bool value) { } } -void Project::SetName(const std::string value) { +void Project::SetName(const std::string &value) { if (name_ != value) { name_ = value; SetDirty(); @@ -84,7 +84,7 @@ void Project::SetBillable(const bool value) { } } -void Project::SetColor(const std::string value) { +void Project::SetColor(const std::string &value) { if (color_ != value) { color_ = Poco::UTF8::toLower(value); SetDirty(); @@ -99,7 +99,7 @@ std::string Project::ColorCode() const { return ColorCodes[index % ColorCodes.size()]; } -error Project::SetColorCode(const std::string color_code) { +error Project::SetColorCode(const std::string &color_code) { SetColor(color_code); return noError; } @@ -118,7 +118,7 @@ void Project::SetCID(const Poco::UInt64 value) { } } -void Project::SetClientName(const std::string value) { +void Project::SetClientName(const std::string &value) { if (client_name_ != value) { client_name_ = value; SetDirty(); @@ -161,17 +161,17 @@ Json::Value Project::SaveToJSON() const { return n; } -bool Project::DuplicateResource(const toggl::error err) const { +bool Project::DuplicateResource(const toggl::error &err) const { return (std::string::npos != std::string(err).find("Name has already been taken")); } -bool Project::ResourceCannotBeCreated(const toggl::error err) const { +bool Project::ResourceCannotBeCreated(const toggl::error &err) const { return (std::string::npos != std::string(err).find( "User cannot add or edit projects in workspace")); } -bool Project::clientIsInAnotherWorkspace(const toggl::error err) const { +bool Project::clientIsInAnotherWorkspace(const toggl::error &err) const { return (std::string::npos != std::string(err).find( "client is in another workspace") || (std::string::npos != std::string(err).find("Client with the ID") @@ -179,12 +179,12 @@ bool Project::clientIsInAnotherWorkspace(const toggl::error err) const { } bool Project::onlyAdminsCanChangeProjectVisibility( - const toggl::error err) const { + const toggl::error &err) const { return (std::string::npos != std::string(err).find( "Only admins can change project visibility")); } -bool Project::ResolveError(const toggl::error err) { +bool Project::ResolveError(const toggl::error &err) { if (userCannotAccessWorkspace(err)) { SetWID(0); return true; diff --git a/src/project.h b/src/project.h index 109f9609bd..2bacb29c70 100644 --- a/src/project.h +++ b/src/project.h @@ -40,20 +40,20 @@ class TOGGL_INTERNAL_EXPORT Project : public BaseModel { const std::string &ClientGUID() const { return client_guid_; } - void SetClientGUID(const std::string); + void SetClientGUID(const std::string &); const std::string &Name() const { return name_; } - void SetName(const std::string value); + void SetName(const std::string &value); const std::string &Color() const { return color_; } - void SetColor(const std::string value); + void SetColor(const std::string &value); std::string ColorCode() const; - error SetColorCode(const std::string color_code); + error SetColorCode(const std::string &color_code); const bool &Active() const { return active_; @@ -73,7 +73,7 @@ class TOGGL_INTERNAL_EXPORT Project : public BaseModel { const std::string &ClientName() const { return client_name_; } - void SetClientName(const std::string value); + void SetClientName(const std::string &value); std::string FullName() const; @@ -83,15 +83,15 @@ class TOGGL_INTERNAL_EXPORT Project : public BaseModel { std::string ModelURL() const; void LoadFromJSON(Json::Value value); Json::Value SaveToJSON() const; - bool DuplicateResource(const toggl::error) const; - bool ResourceCannotBeCreated(const toggl::error) const; - bool ResolveError(const toggl::error); + bool DuplicateResource(const toggl::error &err) const; + bool ResourceCannotBeCreated(const toggl::error &err) const; + bool ResolveError(const toggl::error &err); static std::vector ColorCodes; private: - bool clientIsInAnotherWorkspace(const toggl::error) const; - bool onlyAdminsCanChangeProjectVisibility(const toggl::error err) const; + bool clientIsInAnotherWorkspace(const toggl::error &err) const; + bool onlyAdminsCanChangeProjectVisibility(const toggl::error &err) const; Poco::UInt64 wid_; Poco::UInt64 cid_; diff --git a/src/proxy.h b/src/proxy.h index fd488302fa..3929185ab2 100644 --- a/src/proxy.h +++ b/src/proxy.h @@ -27,7 +27,7 @@ class TOGGL_INTERNAL_EXPORT Proxy { const std::string &Host() const { return host_; } - void SetHost(const std::string value) { + void SetHost(const std::string &value) { host_ = value; } @@ -41,14 +41,14 @@ class TOGGL_INTERNAL_EXPORT Proxy { const std::string &Username() const { return username_; } - void SetUsername(const std::string value) { + void SetUsername(const std::string &value) { username_ = value; } const std::string &Password() const { return password_; } - void SetPassword(const std::string value) { + void SetPassword(const std::string &value) { password_ = value; } diff --git a/src/related_data.cc b/src/related_data.cc index 57ed676ef4..a4fe5a465c 100644 --- a/src/related_data.cc +++ b/src/related_data.cc @@ -72,7 +72,7 @@ error RelatedData::DeleteAutotrackerRule(const Poco::Int64 local_id) { } AutotrackerRule *RelatedData::FindAutotrackerRule( - const TimelineEvent event) const { + const TimelineEvent &event) const { for (std::vector::const_iterator it = AutotrackerRules.begin(); it != AutotrackerRules.end(); it++) { @@ -85,7 +85,7 @@ AutotrackerRule *RelatedData::FindAutotrackerRule( } bool RelatedData::HasMatchingAutotrackerRule( - const std::string lowercase_term) const { + const std::string &lowercase_term) const { for (std::vector::const_iterator it = AutotrackerRules.begin(); it != AutotrackerRules.end(); it++) { diff --git a/src/related_data.h b/src/related_data.h index b63ff4d802..2337b05da2 100644 --- a/src/related_data.h +++ b/src/related_data.h @@ -85,7 +85,7 @@ class TOGGL_INTERNAL_EXPORT RelatedData { Poco::Int64 TotalDurationForDate(const TimeEntry *match) const; // avoid duplicates - bool HasMatchingAutotrackerRule(const std::string lowercase_term) const; + bool HasMatchingAutotrackerRule(const std::string &lowercase_term) const; error DeleteAutotrackerRule(const Poco::Int64 local_id); @@ -97,7 +97,7 @@ class TOGGL_INTERNAL_EXPORT RelatedData { TimeEntry * const te, view::TimeEntry *view) const; - AutotrackerRule *FindAutotrackerRule(const TimelineEvent event) const; + AutotrackerRule *FindAutotrackerRule(const TimelineEvent &event) const; Client *clientByProject(Project *p) const; diff --git a/src/tag.cc b/src/tag.cc index 820ce66305..7d3295458a 100644 --- a/src/tag.cc +++ b/src/tag.cc @@ -25,7 +25,7 @@ void Tag::SetWID(const Poco::UInt64 value) { } } -void Tag::SetName(const std::string value) { +void Tag::SetName(const std::string &value) { if (name_ != value) { name_ = value; SetDirty(); diff --git a/src/tag.h b/src/tag.h index 857fd5dd4e..683e168e8b 100644 --- a/src/tag.h +++ b/src/tag.h @@ -26,7 +26,7 @@ class TOGGL_INTERNAL_EXPORT Tag : public BaseModel { const std::string &Name() const { return name_; } - void SetName(const std::string value); + void SetName(const std::string &value); // Override BaseModel std::string String() const; diff --git a/src/task.cc b/src/task.cc index 689975ca6c..e09f165a1a 100644 --- a/src/task.cc +++ b/src/task.cc @@ -30,7 +30,7 @@ void Task::SetWID(const Poco::UInt64 value) { } } -void Task::SetName(const std::string value) { +void Task::SetName(const std::string &value) { if (name_ != value) { name_ = value; SetDirty(); diff --git a/src/task.h b/src/task.h index 3bfddb0d0e..8c70608e8a 100644 --- a/src/task.h +++ b/src/task.h @@ -25,7 +25,7 @@ class TOGGL_INTERNAL_EXPORT Task : public BaseModel { const std::string &Name() const { return name_; } - void SetName(const std::string value); + void SetName(const std::string &value); const Poco::UInt64 &WID() const { return wid_; diff --git a/src/test/test_data.cc b/src/test/test_data.cc index 0d418abb31..13f4174be1 100644 --- a/src/test/test_data.cc +++ b/src/test/test_data.cc @@ -20,7 +20,7 @@ std::string loadFromTestDataDir(const char* filename) { return loadTestDataFile(std::string(TESTDATADIR) + filename); } -std::string loadTestDataFile(const std::string filename) { +std::string loadTestDataFile(const std::string &filename) { Poco::FileStream fis(filename, std::ios::binary); std::stringstream ss; ss << fis.rdbuf(); diff --git a/src/test/toggl_api_test.cc b/src/test/toggl_api_test.cc index a00d1be619..f32e73317b 100644 --- a/src/test/toggl_api_test.cc +++ b/src/test/toggl_api_test.cc @@ -1445,16 +1445,6 @@ TEST(toggl_api, concurrency) { } } -TEST(toggl_api, toggl_set_compact_mode) { - testing::App app; - - toggl_set_compact_mode(app.ctx(), true); - ASSERT_TRUE(toggl_get_compact_mode(app.ctx())); - - toggl_set_compact_mode(app.ctx(), false); - ASSERT_FALSE(toggl_get_compact_mode(app.ctx())); -} - TEST(toggl_api, toggl_set_keep_end_times_fixed) { testing::App app; diff --git a/src/time_entry.cc b/src/time_entry.cc index b164c9c2f5..1b3d169c08 100644 --- a/src/time_entry.cc +++ b/src/time_entry.cc @@ -28,7 +28,7 @@ namespace toggl { -bool TimeEntry::ResolveError(const error err) { +bool TimeEntry::ResolveError(const error &err) { if (durationTooLarge(err) && Stop() && Start()) { Poco::Int64 seconds = (std::min)(Stop() - Start(), @@ -74,43 +74,43 @@ bool TimeEntry::ResolveError(const error err) { return false; } -bool TimeEntry::isNotFound(const error err) const { +bool TimeEntry::isNotFound(const error &err) const { return std::string::npos != std::string(err).find( "Time entry not found"); } -bool TimeEntry::isMissingCreatedWith(const error err) const { +bool TimeEntry::isMissingCreatedWith(const error &err) const { return std::string::npos != std::string(err).find( "created_with needs to be provided an a valid string"); } bool TimeEntry::userCannotAccessTheSelectedProject( - const error err) const { + const error &err) const { return (std::string::npos != std::string(err).find( "User cannot access the selected project")); } bool TimeEntry::userCannotAccessSelectedTask( - const error err) const { + const error &err) const { return (std::string::npos != std::string(err).find( "User cannot access selected task")); } -bool TimeEntry::durationTooLarge(const error err) const { +bool TimeEntry::durationTooLarge(const error &err) const { return (std::string::npos != std::string(err).find( "Max allowed duration per 1 time entry is 999 hours")); } -bool TimeEntry::startTimeWrongYear(const error err) const { +bool TimeEntry::startTimeWrongYear(const error &err) const { return (std::string::npos != std::string(err).find( "Start time year must be between 2006 and 2030")); } -bool TimeEntry::stopTimeMustBeAfterStartTime(const error err) const { +bool TimeEntry::stopTimeMustBeAfterStartTime(const error &err) const { return (std::string::npos != std::string(err).find( "Stop time must be after start time")); } -bool TimeEntry::billableIsAPremiumFeature(const error err) const { +bool TimeEntry::billableIsAPremiumFeature(const error &err) const { return (std::string::npos != std::string(err).find( "Billable is a premium feature")); } @@ -198,19 +198,19 @@ void TimeEntry::SetStop(const Poco::Int64 value) { } } -void TimeEntry::SetDescription(const std::string value) { - const std::string trimValue = trim_whitespace(value); +void TimeEntry::SetDescription(const std::string &value) { + const std::string &trimValue = trim_whitespace(value); if (description_ != trimValue) { description_ = trimValue; SetDirty(); } } -void TimeEntry::SetStopString(const std::string value) { +void TimeEntry::SetStopString(const std::string &value) { SetStop(Formatter::Parse8601(value)); } -void TimeEntry::SetCreatedWith(const std::string value) { +void TimeEntry::SetCreatedWith(const std::string &value) { if (created_with_ != value) { created_with_ = value; SetDirty(); @@ -231,7 +231,7 @@ void TimeEntry::SetWID(const Poco::UInt64 value) { } } -void TimeEntry::SetStopUserInput(const std::string value) { +void TimeEntry::SetStopUserInput(const std::string &value) { SetStopString(value); if (Stop() < Start()) { @@ -266,7 +266,7 @@ void TimeEntry::SetTID(const Poco::UInt64 value) { static const char kTagSeparator = '\t'; -void TimeEntry::SetTags(const std::string tags) { +void TimeEntry::SetTags(const std::string &tags) { if (Tags() != tags) { TagNames.clear(); if (!tags.empty()) { @@ -295,7 +295,7 @@ void TimeEntry::SetDurationInSeconds(const Poco::Int64 value) { } } -void TimeEntry::SetStartUserInput(const std::string value, +void TimeEntry::SetStartUserInput(const std::string &value, const bool keepEndTimeFixed) { Poco::Int64 start = Formatter::Parse8601(value); if (IsTracking()) { @@ -316,11 +316,11 @@ void TimeEntry::SetStartUserInput(const std::string value, } } -void TimeEntry::SetStartString(const std::string value) { +void TimeEntry::SetStartString(const std::string &value) { SetStart(Formatter::Parse8601(value)); } -void TimeEntry::SetDurationUserInput(const std::string value) { +void TimeEntry::SetDurationUserInput(const std::string &value) { int seconds = Formatter::ParseDurationString(value); if (IsTracking()) { time_t now = time(nullptr); @@ -338,7 +338,7 @@ void TimeEntry::SetDurationUserInput(const std::string value) { } } -void TimeEntry::SetProjectGUID(const std::string value) { +void TimeEntry::SetProjectGUID(const std::string &value) { if (project_guid_ != value) { project_guid_ = value; SetDirty(); diff --git a/src/time_entry.h b/src/time_entry.h index d144dd549a..3009f95977 100644 --- a/src/time_entry.h +++ b/src/time_entry.h @@ -42,7 +42,7 @@ class TOGGL_INTERNAL_EXPORT TimeEntry : public BaseModel, public TimedEvent { std::vector TagNames; const std::string Tags() const; - void SetTags(const std::string tags); + void SetTags(const std::string &tags); const std::string TagsHash() const; @@ -79,10 +79,10 @@ class TOGGL_INTERNAL_EXPORT TimeEntry : public BaseModel, public TimedEvent { const std::string &Description() const { return description_; } - void SetDescription(const std::string value); + void SetDescription(const std::string &value); std::string StartString() const; - void SetStartString(const std::string value); + void SetStartString(const std::string &value); const Poco::Int64 &Start() const { return start_; @@ -90,7 +90,7 @@ class TOGGL_INTERNAL_EXPORT TimeEntry : public BaseModel, public TimedEvent { void SetStart(const Poco::Int64 value); std::string StopString() const; - void SetStopString(const std::string value); + void SetStopString(const std::string &value); const Poco::Int64 &Stop() const { return stop_; @@ -100,7 +100,7 @@ class TOGGL_INTERNAL_EXPORT TimeEntry : public BaseModel, public TimedEvent { const std::string &CreatedWith() const { return created_with_; } - void SetCreatedWith(const std::string value); + void SetCreatedWith(const std::string &value); void DiscardAt(const Poco::Int64); @@ -109,12 +109,12 @@ class TOGGL_INTERNAL_EXPORT TimeEntry : public BaseModel, public TimedEvent { const std::string &ProjectGUID() const { return project_guid_; } - void SetProjectGUID(const std::string); + void SetProjectGUID(const std::string &); // User-triggered changes to timer: - void SetDurationUserInput(const std::string); - void SetStopUserInput(const std::string); - void SetStartUserInput(const std::string, const bool); + void SetDurationUserInput(const std::string &); + void SetStopUserInput(const std::string &); + void SetStartUserInput(const std::string &, const bool); bool IsTracking() const { return duration_in_seconds_ < 0; @@ -127,7 +127,7 @@ class TOGGL_INTERNAL_EXPORT TimeEntry : public BaseModel, public TimedEvent { std::string ModelName() const; std::string ModelURL() const; std::string String() const; - virtual bool ResolveError(const error err); + virtual bool ResolveError(const error &err); void LoadFromJSON(Json::Value value); Json::Value SaveToJSON() const; @@ -139,7 +139,7 @@ class TOGGL_INTERNAL_EXPORT TimeEntry : public BaseModel, public TimedEvent { Poco::Int64 RealDurationInSeconds() const; - bool isNotFound(const error err) const; + bool isNotFound(const error &err) const; const std::string GroupHash() const; @@ -158,19 +158,19 @@ class TOGGL_INTERNAL_EXPORT TimeEntry : public BaseModel, public TimedEvent { bool unsynced_; Poco::Int64 last_start_at_; - bool setDurationStringHHMMSS(const std::string value); - bool setDurationStringHHMM(const std::string value); - bool setDurationStringMMSS(const std::string value); + bool setDurationStringHHMMSS(const std::string &value); + bool setDurationStringHHMM(const std::string &value); + bool setDurationStringMMSS(const std::string &value); void loadTagsFromJSON(Json::Value value); - bool durationTooLarge(const error) const; - bool startTimeWrongYear(const error err) const; - bool stopTimeMustBeAfterStartTime(const error) const; - bool userCannotAccessTheSelectedProject(const error) const; - bool userCannotAccessSelectedTask(const error) const; - bool billableIsAPremiumFeature(const error) const; - bool isMissingCreatedWith(const error err) const; + bool durationTooLarge(const error &err) const; + bool startTimeWrongYear(const error &err) const; + bool stopTimeMustBeAfterStartTime(const error &err) const; + bool userCannotAccessTheSelectedProject(const error &err) const; + bool userCannotAccessSelectedTask(const error &err) const; + bool billableIsAPremiumFeature(const error &err) const; + bool isMissingCreatedWith(const error &err) const; }; } // namespace toggl diff --git a/src/timeline_event.cc b/src/timeline_event.cc index 1f28e70602..e72b69aa21 100644 --- a/src/timeline_event.cc +++ b/src/timeline_event.cc @@ -28,7 +28,7 @@ std::string TimelineEvent::ModelURL() const { return ""; } -void TimelineEvent::SetTitle(const std::string value) { +void TimelineEvent::SetTitle(const std::string &value) { if (title_ != value) { title_ = value; SetDirty(); @@ -56,7 +56,7 @@ void TimelineEvent::SetIdle(const bool value) { } } -void TimelineEvent::SetFilename(const std::string value) { +void TimelineEvent::SetFilename(const std::string &value) { if (filename_ != value) { filename_ = value; SetDirty(); diff --git a/src/timeline_event.h b/src/timeline_event.h index 170526dc65..7eda9e93a5 100644 --- a/src/timeline_event.h +++ b/src/timeline_event.h @@ -30,7 +30,7 @@ class TOGGL_INTERNAL_EXPORT TimelineEvent : public BaseModel, public TimedEvent const std::string &Title() const { return title_; } - void SetTitle(const std::string value); + void SetTitle(const std::string &value); const Poco::Int64 &Start() const { return start_time_; @@ -50,7 +50,7 @@ class TOGGL_INTERNAL_EXPORT TimelineEvent : public BaseModel, public TimedEvent const std::string &Filename() const { return filename_; } - void SetFilename(const std::string value); + void SetFilename(const std::string &value); const bool &Chunked() const { return chunked_; diff --git a/src/timeline_notifications.h b/src/timeline_notifications.h index 8787660e66..edf4901b52 100644 --- a/src/timeline_notifications.h +++ b/src/timeline_notifications.h @@ -33,21 +33,21 @@ class TOGGL_INTERNAL_EXPORT TimelineBatch { std::string &APIToken() { return api_token_; } - void SetAPIToken(const std::string value) { + void SetAPIToken(const std::string &value) { api_token_ = value; } std::vector &Events() { return events_; } - void SetEvents(const std::vector value) { + void SetEvents(const std::vector &value) { events_ = value; } std::string &DesktopID() { return desktop_id_; } - void SetDesktopID(const std::string value) { + void SetDesktopID(const std::string &value) { desktop_id_ = value; } @@ -63,7 +63,7 @@ class TOGGL_INTERNAL_EXPORT TimelineDatasource { virtual ~TimelineDatasource() {} // A autotracker event has started - virtual error StartAutotrackerEvent(const TimelineEvent event) = 0; + virtual error StartAutotrackerEvent(const TimelineEvent &event) = 0; // A timeline event is detected, window has changes // or there's an idle event. diff --git a/src/timeline_uploader.cc b/src/timeline_uploader.cc index 8052ccd5ef..497374e153 100644 --- a/src/timeline_uploader.cc +++ b/src/timeline_uploader.cc @@ -153,7 +153,7 @@ error TimelineUploader::start() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; @@ -169,7 +169,7 @@ error TimelineUploader::Shutdown() { return exc.displayText(); } catch(const std::exception& ex) { return ex.what(); - } catch(const std::string& ex) { + } catch(const std::string & ex) { return ex; } return noError; diff --git a/src/toggl_api.cc b/src/toggl_api.cc index d859bce1c9..7e98d82f04 100644 --- a/src/toggl_api.cc +++ b/src/toggl_api.cc @@ -1336,17 +1336,6 @@ bool_t testing_set_logged_in_user( return toggl::noError == ctx->SetLoggedInUserFromJSON(std::string(json)); } -void toggl_set_compact_mode( - void *context, - const bool_t value) { - app(context)->SetCompactMode(value); -} - -bool_t toggl_get_compact_mode( - void *context) { - return app(context)->GetCompactMode(); -} - void toggl_set_keep_end_time_fixed( void *context, const bool_t value) { diff --git a/src/toggl_api.h b/src/toggl_api.h index 9447ee16a9..825400e998 100644 --- a/src/toggl_api.h +++ b/src/toggl_api.h @@ -997,13 +997,6 @@ extern "C" { void *context, const char *json); - TOGGL_EXPORT void toggl_set_compact_mode( - void *context, - const bool_t value); - - TOGGL_EXPORT bool_t toggl_get_compact_mode( - void *context); - TOGGL_EXPORT void toggl_set_keep_end_time_fixed( void *context, const bool_t value); diff --git a/src/toggl_api_private.cc b/src/toggl_api_private.cc index d1a941b36c..7766430e6e 100644 --- a/src/toggl_api_private.cc +++ b/src/toggl_api_private.cc @@ -15,8 +15,7 @@ #include "Poco/Logger.h" #include "Poco/UnicodeConverter.h" -TogglAutocompleteView *autocomplete_item_init( - const toggl::view::Autocomplete item) { +TogglAutocompleteView *autocomplete_item_init(const toggl::view::Autocomplete &item) { TogglAutocompleteView *result = new TogglAutocompleteView(); result->Description = copy_string(item.Description); result->Text = copy_string(item.Text); @@ -74,19 +73,19 @@ void autocomplete_item_clear(TogglAutocompleteView *item) { free(item->WorkspaceName); item->WorkspaceName = nullptr; - if (item->Next) { - TogglAutocompleteView *next = - reinterpret_cast(item->Next); - poco_check_ptr(next); - autocomplete_item_clear(next); - item->Next = nullptr; - } - delete item; } +void autocomplete_list_clear(TogglAutocompleteView *first) { + while (first) { + TogglAutocompleteView *next = reinterpret_cast(first->Next); + autocomplete_item_clear(first); + first = next; + } +} + TogglGenericView *generic_to_view_item_list( - const std::vector list) { + const std::vector &list) { TogglGenericView *first = nullptr; for (std::vector::const_iterator it = list.begin(); @@ -100,7 +99,7 @@ TogglGenericView *generic_to_view_item_list( } TogglGenericView *generic_to_view_item( - const toggl::view::Generic c) { + const toggl::view::Generic &c) { TogglGenericView *result = new TogglGenericView(); result->ID = static_cast(c.ID); result->WID = static_cast(c.WID); @@ -111,8 +110,7 @@ TogglGenericView *generic_to_view_item( return result; } -TogglAutotrackerRuleView *autotracker_rule_to_view_item( - const toggl::view::AutotrackerRule model) { +TogglAutotrackerRuleView *autotracker_rule_to_view_item(const toggl::view::AutotrackerRule &model) { TogglAutotrackerRuleView *view = new TogglAutotrackerRuleView(); // Autotracker settings are not saved to DB, // so the ID will be 0 always. But will have local ID @@ -135,15 +133,17 @@ void autotracker_view_item_clear(TogglAutotrackerRuleView *view) { free(view->ProjectAndTaskLabel); view->ProjectAndTaskLabel = nullptr; - if (view->Next) { - TogglAutotrackerRuleView *next = - reinterpret_cast(view->Next); - autotracker_view_item_clear(next); - } - delete view; } +void autotracker_view_list_clear(TogglAutotrackerRuleView *first) { + while (first) { + TogglAutotrackerRuleView *next = reinterpret_cast(first->Next); + autotracker_view_item_clear(first); + first = next; + } +} + void view_item_clear(TogglGenericView *item) { if (!item) { return; @@ -158,15 +158,17 @@ void view_item_clear(TogglGenericView *item) { free(item->WorkspaceName); item->WorkspaceName = nullptr; - if (item->Next) { - TogglGenericView *next = - reinterpret_cast(item->Next); - view_item_clear(next); - } - delete item; } +void view_list_clear(TogglGenericView *first) { + while (first) { + TogglGenericView *next = reinterpret_cast(first->Next); + view_item_clear(first); + first = next; + } +} + void country_item_clear(TogglCountryView *item) { if (!item) { return; @@ -183,15 +185,17 @@ void country_item_clear(TogglCountryView *item) { free(item->VatRegex); item->VatRegex = nullptr; - if (item->Next) { - TogglCountryView *next = - reinterpret_cast(item->Next); - country_item_clear(next); - } - delete item; } +void country_list_clear(TogglCountryView *first) { + while (first) { + TogglCountryView *next = reinterpret_cast(first->Next); + country_item_clear(first); + first = next; + } +} + std::string to_string(const char_t *s) { if (!s) { return std::string(""); @@ -206,9 +210,9 @@ std::string to_string(const char_t *s) { #endif } -std::string trim_whitespace(const std::string str) +std::string trim_whitespace(const std::string &str) { - const std::string& whitespace = " \t"; + const std::string & whitespace = " \t"; const auto strBegin = str.find_first_not_of(whitespace); if (strBegin == std::string::npos) return ""; // no content @@ -219,7 +223,7 @@ std::string trim_whitespace(const std::string str) return str.substr(strBegin, strRange); } -const char_t *to_char_t(const std::string s) { +const char_t *to_char_t(const std::string &s) { #if defined(_WIN32) || defined(WIN32) std::wstring ws; Poco::UnicodeConverter::toUTF16(s, ws); @@ -229,7 +233,7 @@ const char_t *to_char_t(const std::string s) { #endif } -char_t *copy_string(const std::string s) { +char_t *copy_string(const std::string &s) { #if defined(_WIN32) || defined(WIN32) std::wstring ws; Poco::UnicodeConverter::toUTF16(s, ws); @@ -401,13 +405,6 @@ void time_entry_view_item_clear( item->Error = nullptr; } - if (item->Next) { - TogglTimeEntryView *next = - reinterpret_cast(item->Next); - time_entry_view_item_clear(next); - item->Next = nullptr; - } - free(item->GroupName); item->GroupName = nullptr; @@ -417,11 +414,19 @@ void time_entry_view_item_clear( delete item; } +void time_entry_view_list_clear(TogglTimeEntryView *first) { + while (first) { + TogglTimeEntryView *next = reinterpret_cast(first->Next); + time_entry_view_item_clear(first); + first = next; + } +} + TogglSettingsView *settings_view_item_init( const bool_t record_timeline, - const toggl::Settings settings, + const toggl::Settings &settings, const bool_t use_proxy, - const toggl::Proxy proxy) { + const toggl::Proxy &proxy) { TogglSettingsView *view = new TogglSettingsView(); view->RecordTimeline = record_timeline; @@ -493,8 +498,8 @@ TogglAutocompleteView *autocomplete_list_init( return first; } -TogglHelpArticleView *help_artice_init( - const toggl::HelpArticle item) { +TogglHelpArticleView *help_article_init( + const toggl::HelpArticle &item) { TogglHelpArticleView *result = new TogglHelpArticleView(); result->Category = copy_string(item.Type); result->Name = copy_string(item.Name); @@ -503,38 +508,38 @@ TogglHelpArticleView *help_artice_init( return result; } -void help_article_clear(TogglHelpArticleView *item) { - if (!item) { +void help_article_item_clear(TogglHelpArticleView *view) { + if (!view) { return; } - free(item->Category); - item->Category = nullptr; + free(view->Category); + view->Category = nullptr; - free(item->Name); - item->Name = nullptr; + free(view->Name); + view->Name = nullptr; - free(item->URL); - item->URL = nullptr; + free(view->URL); + view->URL = nullptr; - if (item->Next) { - TogglHelpArticleView *next = - reinterpret_cast(item->Next); - help_article_clear(next); - item->Next = nullptr; - } + delete view; +} - delete item; +void help_article_list_clear(TogglHelpArticleView *first) { + while (first) { + TogglHelpArticleView *next = reinterpret_cast(first->Next); + help_article_item_clear(first); + first = next; + } } -TogglHelpArticleView *help_article_list_init( - const std::vector items) { +TogglHelpArticleView *help_article_list_init(const std::vector &items) { TogglHelpArticleView *first = nullptr; for (std::vector::const_reverse_iterator it = items.rbegin(); it != items.rend(); it++) { - TogglHelpArticleView *item = help_artice_init(*it); + TogglHelpArticleView *item = help_article_init(*it); item->Next = first; first = item; } diff --git a/src/toggl_api_private.h b/src/toggl_api_private.h index e6434b836d..c1c3b2e6b6 100644 --- a/src/toggl_api_private.h +++ b/src/toggl_api_private.h @@ -30,44 +30,52 @@ class TimeEntry; } // namespace toggl TOGGL_INTERNAL_EXPORT int compare_string(const char_t *s1, const char_t *s2); -TOGGL_INTERNAL_EXPORT const char_t* to_char_t(const std::string s); -TOGGL_INTERNAL_EXPORT char_t *copy_string(const std::string s); +TOGGL_INTERNAL_EXPORT const char_t* to_char_t(const std::string &s); +TOGGL_INTERNAL_EXPORT char_t *copy_string(const std::string &s); TOGGL_INTERNAL_EXPORT std::string to_string(const char_t *s); /** Trim all leading and trailing whitespace from the string. Don't trim on middle of word. - Ex: const std::string foo = " too much space "; - const std::string text = trim(foo); + Ex: const std::string &foo = " too much space "; + const std::string &text = trim(foo); // Text = "too much space" @param str The string need to be trimmed @return The string after trimming the leading and trailing whitespace */ -std::string trim_whitespace(const std::string str); +std::string trim_whitespace(const std::string &str); TogglGenericView *generic_to_view_item( - const toggl::view::Generic c); + const toggl::view::Generic &c); TogglGenericView *generic_to_view_item_list( - const std::vector list); + const std::vector &list); TogglAutotrackerRuleView *autotracker_rule_to_view_item( - const toggl::view::AutotrackerRule model); + const toggl::view::AutotrackerRule &model); void autotracker_view_item_clear(TogglAutotrackerRuleView *view); +void autotracker_view_list_clear(TogglAutotrackerRuleView *first); + TogglAutocompleteView *autocomplete_item_init( - const toggl::view::Autocomplete item); + const toggl::view::Autocomplete &item); void view_item_clear(TogglGenericView *item); +void view_list_clear(TogglGenericView *first); + void autocomplete_item_clear(TogglAutocompleteView *item); +void autocomplete_list_clear(TogglAutocompleteView *first); + TogglCountryView *country_list_init( std::vector *items); void country_item_clear(TogglCountryView *item); +void country_list_clear(TogglCountryView *first); + TogglCountryView *country_view_item_init( const Json::Value v); @@ -76,11 +84,13 @@ TogglTimeEntryView *time_entry_view_item_init( void time_entry_view_item_clear(TogglTimeEntryView *item); +void time_entry_view_list_clear(TogglTimeEntryView *first); + TogglSettingsView *settings_view_item_init( const bool_t record_timeline, - const toggl::Settings settings, + const toggl::Settings &settings, const bool_t use_proxy, - const toggl::Proxy proxy); + const toggl::Proxy &proxy); void settings_view_item_clear(TogglSettingsView *view); @@ -88,10 +98,11 @@ TogglAutocompleteView *autocomplete_list_init( std::vector *items); TogglHelpArticleView *help_article_list_init( - const std::vector items); + const std::vector &items); + +void help_article_item_clear(TogglHelpArticleView *view); -void help_article_clear( - TogglHelpArticleView *first); +void help_article_list_clear(TogglHelpArticleView *first); Poco::Logger &logger(); diff --git a/src/ui/osx/Gemfile b/src/ui/osx/Gemfile new file mode 100644 index 0000000000..d01736f34e --- /dev/null +++ b/src/ui/osx/Gemfile @@ -0,0 +1,4 @@ +# frozen_string_literal: true +source "https://rubygems.org" + +gem 'cocoapods', '1.7.5' \ No newline at end of file diff --git a/src/ui/osx/Gemfile.lock b/src/ui/osx/Gemfile.lock new file mode 100644 index 0000000000..83ef179fca --- /dev/null +++ b/src/ui/osx/Gemfile.lock @@ -0,0 +1,76 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.1) + activesupport (4.2.11.1) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + atomos (0.1.3) + claide (1.0.3) + cocoapods (1.7.5) + activesupport (>= 4.0.2, < 5) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.7.5) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-stats (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.3.1, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.6.6) + nap (~> 1.0) + ruby-macho (~> 1.4) + xcodeproj (>= 1.10.0, < 2.0) + cocoapods-core (1.7.5) + activesupport (>= 4.0.2, < 6) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + cocoapods-deintegrate (1.0.4) + cocoapods-downloader (1.2.2) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.0) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.4.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.1.0) + colored2 (3.1.2) + concurrent-ruby (1.1.5) + escape (0.0.4) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + minitest (5.12.0) + molinillo (0.6.6) + nanaimo (0.2.6) + nap (1.1.0) + netrc (0.11.0) + ruby-macho (1.4.0) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + xcodeproj (1.12.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.2.6) + +PLATFORMS + ruby + +DEPENDENCIES + cocoapods (= 1.7.5) + +BUNDLED WITH + 2.0.1 diff --git a/src/ui/osx/Podfile b/src/ui/osx/Podfile new file mode 100644 index 0000000000..95018246db --- /dev/null +++ b/src/ui/osx/Podfile @@ -0,0 +1,16 @@ +source 'https://github.com/CocoaPods/Specs.git' + +platform :osx, '10.11' +use_frameworks! +inhibit_all_warnings! + +# TogglDesktop +target 'TogglDesktop' do + project 'TogglDesktop/TogglDesktop.xcodeproj' + + pod 'GTMAppAuth' + pod 'AppAuth' + pod 'Sparkle' + pod 'MASShortcut' + pod 'Bugsnag' +end diff --git a/src/ui/osx/Podfile.lock b/src/ui/osx/Podfile.lock new file mode 100644 index 0000000000..a589754b9f --- /dev/null +++ b/src/ui/osx/Podfile.lock @@ -0,0 +1,45 @@ +PODS: + - AppAuth (1.2.0): + - AppAuth/Core (= 1.2.0) + - AppAuth/ExternalUserAgent (= 1.2.0) + - AppAuth/Core (1.2.0) + - AppAuth/ExternalUserAgent (1.2.0) + - Bugsnag (5.22.6) + - GTMAppAuth (1.0.0): + - AppAuth/Core (~> 1.0) + - GTMSessionFetcher (~> 1.1) + - GTMSessionFetcher (1.2.2): + - GTMSessionFetcher/Full (= 1.2.2) + - GTMSessionFetcher/Core (1.2.2) + - GTMSessionFetcher/Full (1.2.2): + - GTMSessionFetcher/Core (= 1.2.2) + - MASShortcut (2.4.0) + - Sparkle (1.21.3) + +DEPENDENCIES: + - AppAuth + - Bugsnag + - GTMAppAuth + - MASShortcut + - Sparkle + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - AppAuth + - Bugsnag + - GTMAppAuth + - GTMSessionFetcher + - MASShortcut + - Sparkle + +SPEC CHECKSUMS: + AppAuth: bce82c76043657c99d91e7882e8a9e1a93650cd4 + Bugsnag: 48bf35c605e92e8f661cb751281117bb99850b34 + GTMAppAuth: 4deac854479704f348309e7b66189e604cf5e01e + GTMSessionFetcher: 61bb0f61a4cb560030f1222021178008a5727a23 + MASShortcut: d9e4909e878661cc42877cc9d6efbe638273ab57 + Sparkle: 3f75576db8b0265adef36c43249d747f22d0b708 + +PODFILE CHECKSUM: c4a62535fe79b548c6e5a798729b6a797198ed02 + +COCOAPODS: 1.7.5 diff --git a/src/ui/osx/TogglDesktop.xcworkspace/contents.xcworkspacedata b/src/ui/osx/TogglDesktop.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..2b910e6cb1 --- /dev/null +++ b/src/ui/osx/TogglDesktop.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/src/ui/osx/TogglDesktop/Feature/GoogleLogin/GoogleAuthenticationServer+Objc.swift b/src/ui/osx/TogglDesktop/Feature/GoogleLogin/GoogleAuthenticationServer+Objc.swift new file mode 100644 index 0000000000..e05626b4d0 --- /dev/null +++ b/src/ui/osx/TogglDesktop/Feature/GoogleLogin/GoogleAuthenticationServer+Objc.swift @@ -0,0 +1,18 @@ +// +// GoogleAuthenticationServer+Objc.swift +// TogglDesktop +// +// Created by Nghia Tran on 9/17/19. +// Copyright © 2019 Alari. All rights reserved. +// + +import Foundation + +@objc class GoogleAuthenticationServerHelper: NSObject { + + @objc class func authorize(_ complete: @escaping (String?, Error?) -> Void) { + GoogleAuthenticationServer.shared.authenticate { (user, error) in + complete(user?.accessToken, error) + } + } +} diff --git a/src/ui/osx/TogglDesktop/Feature/GoogleLogin/GoogleAuthenticationServer.swift b/src/ui/osx/TogglDesktop/Feature/GoogleLogin/GoogleAuthenticationServer.swift new file mode 100644 index 0000000000..9756746e26 --- /dev/null +++ b/src/ui/osx/TogglDesktop/Feature/GoogleLogin/GoogleAuthenticationServer.swift @@ -0,0 +1,138 @@ +// +// GoogleAuthenticationServer.swift +// TogglDesktop +// +// Created by Nghia Tran on 9/17/19. +// Copyright © 2019 Alari. All rights reserved. +// + +import Foundation +import AppAuth +import GTMAppAuth + +final class GoogleAuthenticationServer { + + static let shared = GoogleAuthenticationServer() + + private struct Constants { + static let Issuer = "https://accounts.google.com" + static let ClientID = "426090949585-uj7lka2mtanjgd7j9i6c4ik091rcv6n5.apps.googleusercontent.com" + static let ClientSecret = "6IHWKIfTAMF7cPJsBvoGxYui" + static let RedirectURI = "com.googleusercontent.apps.426090949585-uj7lka2mtanjgd7j9i6c4ik091rcv6n5:/oauthredirect" + static let TogglAuthorizerKey = "toggldesktop-authorization" + static let Scopes = [OIDScopeProfile, OIDScopeEmail] + } + + enum GoogleError: Error, LocalizedError { + case invalidIssuerURL + case invalidRedirectURL + case missingConfig + case missingAccessToken + case custom(Error?) + + var errorDescription: String? { + switch self { + case .invalidIssuerURL: + return "Invalid issuer URL" + case .invalidRedirectURL: + return "Invalid Redirect URL" + case .missingConfig: + return "Missing config from Google" + case .missingAccessToken: + return "Missing Access Token" + case .custom(let error): + return "\(String(describing: error))" + } + } + } + + struct GoogleUser { + let accessToken: String + } + + // MARK: Variables + + init() { + + } + + // MARK: Public + + func authenticate(_ complete: @escaping (GoogleUser?, GoogleError?) -> Void) { + discoverService {[weak self] (config, error) in + guard let strongSelf = self else { return } + + if let error = error { + complete(nil, error) + return + } + + guard let config = config else { + complete(nil, .missingConfig) + return + } + + // Authenticate with google + strongSelf.makeAuthenticationRequest(with: config, complete: complete) + } + } +} + +// MARK: Private + +extension GoogleAuthenticationServer { + + fileprivate func discoverService(_ complete: @escaping (OIDServiceConfiguration?, GoogleError?) -> Void) { + + // Double check the URL + guard let issuerURL = URL(string: Constants.Issuer) else { + complete(nil, .invalidIssuerURL) + return + } + + // Get service + OIDAuthorizationService.discoverConfiguration(forIssuer: issuerURL) { (config, error) in + if let error = error { + complete(nil, .custom(error)) + return + } + + complete(config, nil) + } + } + + fileprivate func makeAuthenticationRequest(with config: OIDServiceConfiguration, complete: @escaping (GoogleUser?, GoogleError?) -> Void) { + guard let redirectURL = URL(string: Constants.RedirectURI) else { + complete(nil, .invalidRedirectURL) + return + } + + // Request to service + let request = OIDAuthorizationRequest(configuration: config, clientId: Constants.ClientID, + clientSecret: Constants.ClientSecret, + scopes: Constants.Scopes, + redirectURL: redirectURL, + responseType: OIDResponseTypeCode, + additionalParameters: nil) + + // Wait callback URL + let appDelegate = NSApp.delegate as! AppDelegate + appDelegate.currentAuthorizationFlow = OIDAuthState.authState(byPresenting: request, callback: { (authState, error) in + if let error = error { + complete(nil, .custom(error)) + return + } + + // Process auth state + if let authState = authState { + if let token = authState.lastTokenResponse?.accessToken { + complete(GoogleUser(accessToken: token), nil) + return + } + } + + // Otherwise + complete(nil, .missingAccessToken) + }) + } +} diff --git a/src/ui/osx/TogglDesktop/Feature/TimeEntryEditor/AutoComplete/Input/TagAutoCompleteTextField.swift b/src/ui/osx/TogglDesktop/Feature/TimeEntryEditor/AutoComplete/Input/TagAutoCompleteTextField.swift index 093b9e6b6b..3c2f2c4d35 100644 --- a/src/ui/osx/TogglDesktop/Feature/TimeEntryEditor/AutoComplete/Input/TagAutoCompleteTextField.swift +++ b/src/ui/osx/TogglDesktop/Feature/TimeEntryEditor/AutoComplete/Input/TagAutoCompleteTextField.swift @@ -13,7 +13,7 @@ final class TagAutoCompleteTextField: AutoCompleteTextField, NSWindowDelegate { // Hack // Because the TagAutoCompleteTextField is inside the AutoCompleteWindow // So we have to prevent the action to closeSuggestion when the textField is resigned - private var isPressingTab = false + private var skipCloseAutocomplete = false // The design for TagTextField is different than other // The AutoCompleteWindow will contain the TextView @@ -36,7 +36,7 @@ final class TagAutoCompleteTextField: AutoCompleteTextField, NSWindowDelegate { } override func controlTextDidEndEditing(_ obj: Notification) { - if !isPressingTab { + if !skipCloseAutocomplete { super.controlTextDidEndEditing(obj) } } @@ -65,12 +65,19 @@ final class TagAutoCompleteTextField: AutoCompleteTextField, NSWindowDelegate { closeSuggestion() } + func focus() { + // If we makeFirstResponder, it will trigger the -controlTextDidEndEditing and collapse the AutoCompleteView + skipCloseAutocomplete = true + window?.makeFirstResponder(self) + skipCloseAutocomplete = false + } + override func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool { if commandSelector == #selector(NSResponder.insertTab(_:)) { - isPressingTab = true + skipCloseAutocomplete = true } let handled = super.control(control, textView: textView, doCommandBy: commandSelector) - isPressingTab = false + skipCloseAutocomplete = false return handled } } diff --git a/src/ui/osx/TogglDesktop/Feature/TimeEntryEditor/EditorViewController.swift b/src/ui/osx/TogglDesktop/Feature/TimeEntryEditor/EditorViewController.swift index dc75e72fd9..5b14a02e77 100644 --- a/src/ui/osx/TogglDesktop/Feature/TimeEntryEditor/EditorViewController.swift +++ b/src/ui/osx/TogglDesktop/Feature/TimeEntryEditor/EditorViewController.swift @@ -86,6 +86,14 @@ final class EditorViewController: NSViewController { NSAttributedString.Key.foregroundColor: NSColor.labelColor] }() fileprivate var isRegisterTimerNotification = false + private lazy var dateFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateStyle = .none + formatter.timeStyle = .medium + formatter.timeZone = TimeZone.current + formatter.locale = Locale.current + return formatter + }() // MARK: View Cyclex @@ -353,6 +361,8 @@ extension EditorViewController { durationTextField.stringValue = timeEntry.duration startAtTextField.stringValue = timeEntry.startTimeString endAtTextField.stringValue = timeEntry.endTimeString + startAtTextField.toolTip = dateFormatter.string(from: timeEntry.started) + endAtTextField.toolTip = dateFormatter.string(from: timeEntry.ended) } fileprivate func updateNextKeyViews() { @@ -526,7 +536,7 @@ extension EditorViewController: AutoCompleteTextFieldDelegate { DesktopLibraryBridge.shared().updateTimeEntry(withTags: selectedTags.toNames(), guid: timeEntry.guid) // Focus on tag textfield agains, so user can continue typying - sender.window?.makeFirstResponder(tagTextField) + tagTextField.focus() tagTextField.resetText() } } @@ -536,6 +546,12 @@ extension EditorViewController: AutoCompleteTextFieldDelegate { tagTextField.removeFromSuperview() tagAutoCompleteContainerView.addSubview(tagTextField) tagTextField.edgesToSuperView() + + // Since Tag Token appear -> There is no text field to be focus + // Focus on duration + if !tagStackView.isHidden && durationTextField.currentEditor() == nil { + view.window?.makeFirstResponder(durationTextField) + } } } diff --git a/src/ui/osx/TogglDesktop/LoginViewController.m b/src/ui/osx/TogglDesktop/LoginViewController.m index 3c0ee8f5f4..6a5c6a3a8f 100644 --- a/src/ui/osx/TogglDesktop/LoginViewController.m +++ b/src/ui/osx/TogglDesktop/LoginViewController.m @@ -5,7 +5,6 @@ // #import "LoginViewController.h" -#import "GTMOAuth2WindowController.h" #import "Utils.h" #import "NSTextField+Ext.h" #import "TogglDesktop-Swift.h" @@ -24,6 +23,14 @@ typedef NS_ENUM (NSUInteger, TabViewType) static NSString *const countryNotSelectedError = @"Please select Country before signing up"; static NSString *const tosAgreeError = @"You must agree to the terms of service and privacy policy to use Toggl"; +typedef NS_ENUM (NSUInteger, UserAction) +{ + UserActionAccountLogin, + UserActionAccountSignup, + UserActionGoogleLogin, + UserActionGoogleSignup, +}; + @interface LoginViewController () @property (weak) IBOutlet NSTabView *tabView; @property (weak) IBOutlet NSTextField *email; @@ -41,11 +48,13 @@ @interface LoginViewController () 0) - { - // Show the body of the server's authentication failure response - errorStr = [[NSString alloc] initWithData:responseData - encoding:NSUTF8StringEncoding]; - } - else - { - NSString *str = [[error userInfo] objectForKey:kGTMOAuth2ErrorMessageKey]; - if (str != nil) - { - if ([str length] > 0) - { - errorStr = str; - } - } - } - - NSLog(@"Login error: %@", errorStr); - - if ([errorStr isEqualToString:@"access_denied"]) - { - errorStr = @"Google login access was denied to app."; - } - - if ([errorStr isEqualToString:@"The operation couldn’t be completed. (com.google.GTMOAuth2 error -1000.)"]) - { - errorStr = @"Window was closed before login completed."; - } + NSLog(@"Login error: %@", errorStr); - [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError - object:errorStr]; - return; + if ([errorStr isEqualToString:@"access_denied"]) + { + errorStr = @"Google login access was denied to app."; } - // Show loader and disable text boxs - [self showLoaderView:YES]; + if ([errorStr isEqualToString:@"The operation couldn’t be completed. (com.google.GTMOAuth2 error -1000.)"]) + { + errorStr = @"Window was closed before login completed."; + } - toggl_google_login_async(ctx, [auth.accessToken UTF8String]); + [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError + object:errorStr]; } -- (BOOL)validateForm:(BOOL)signup +- (void)handleGoogleToken:(NSString *)token { - // check if email is inserted - NSString *email = [self.email stringValue]; - - if (email == nil || !email.length) + [self showLoaderView:YES]; + switch (self.userAction) { - [self.email.window makeFirstResponder:self.email]; - [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError - object:emailMissingError]; - return NO; + case UserActionGoogleSignup : + toggl_google_signup_async(ctx, [token UTF8String], self.selectedCountryID); + break; + case UserActionGoogleLogin : + toggl_google_login_async(ctx, [token UTF8String]); + break; + default : + break; } +} - // check if password is inserted - NSString *pass = [self.password stringValue]; - - if (pass == nil || !pass.length) +- (BOOL)validateFormForAction:(UserAction)action +{ + switch (action) { - [self.password.window makeFirstResponder:self.password]; - [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError - object:passwordMissingError]; - return NO; - } + case UserActionAccountLogin : + if (![self isEmalValid]) + { + return NO; + } + if (![self isPasswordValid]) + { + return NO; + } + return YES; - if (!signup) - { - return YES; - } + case UserActionAccountSignup : + if (![self isEmalValid]) + { + return NO; + } + if (![self isPasswordValid]) + { + return NO; + } + if (![self isCountryValid]) + { + return NO; + } + if (![self isTOSValid]) + { + return NO; + } + return YES; - // check if country is selected - if (self.selectedCountryID == -1 || self.countrySelect.stringValue.length == 0) - { - [self.countrySelect.window makeFirstResponder:self.countrySelect]; - [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError - object:countryNotSelectedError]; - return NO; - } + case UserActionGoogleLogin : + return YES; - // check if tos and privacy policy is checked - BOOL tosChecked = [Utils stateToBool:[self.tosCheckbox state]]; - if (!tosChecked) - { - [self.tosCheckbox.window makeFirstResponder:self.tosCheckbox]; - [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError - object:tosAgreeError]; - return NO; + case UserActionGoogleSignup : + if (![self isCountryValid]) + { + return NO; + } + if (![self isTOSValid]) + { + return NO; + } + return YES; + + default : + break; } - return YES; + return NO; } - (IBAction)clickSignupButton:(id)sender { + self.userAction = UserActionAccountSignup; + // Validate all values inserted - if (![self validateForm:YES]) + if (![self validateFormForAction:self.userAction]) { return; } @@ -416,10 +417,12 @@ - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBy return NO; } -- (IBAction)loginGoogleOnTap:(id)sender { +- (IBAction)loginGoogleOnTap:(id)sender +{ // for empty State + self.userAction = UserActionGoogleLogin; [self setUserSignUp:NO]; - [self startGoogleLogin]; + [self startGoogleAuthentication]; } - (void)setUserSignUp:(BOOL)isSignUp @@ -453,8 +456,75 @@ - (void)showLoaderView:(BOOL)show self.signUpLink.enabled = !show; } -- (void)resetLoader { +- (void)resetLoader +{ [self showLoaderView:NO]; } +- (IBAction)signupGoogleBtnOnTap:(id)sender +{ + self.userAction = UserActionGoogleSignup; + if (![self validateFormForAction:self.userAction]) + { + return; + } + + [self setUserSignUp:NO]; + [self startGoogleAuthentication]; +} + +- (BOOL)isEmalValid +{ + NSString *email = [self.email stringValue]; + + if (email == nil || !email.length) + { + [self.email.window makeFirstResponder:self.email]; + [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError + object:emailMissingError]; + return NO; + } + return YES; +} + +- (BOOL)isPasswordValid +{ + NSString *pass = [self.password stringValue]; + + if (pass == nil || !pass.length) + { + [self.password.window makeFirstResponder:self.password]; + [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError + object:passwordMissingError]; + return NO; + } + return YES; +} + +- (BOOL)isCountryValid +{ + if (self.selectedCountryID == -1 || self.countrySelect.stringValue.length == 0) + { + [self.countrySelect.window makeFirstResponder:self.countrySelect]; + [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError + object:countryNotSelectedError]; + return NO; + } + return YES; +} + +- (BOOL)isTOSValid +{ + BOOL tosChecked = [Utils stateToBool:[self.tosCheckbox state]]; + + if (!tosChecked) + { + [self.tosCheckbox.window makeFirstResponder:self.tosCheckbox]; + [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kDisplayError + object:tosAgreeError]; + return NO; + } + return YES; +} + @end diff --git a/src/ui/osx/TogglDesktop/LoginViewController.xib b/src/ui/osx/TogglDesktop/LoginViewController.xib index 5a41d6ef1b..da0d479224 100644 --- a/src/ui/osx/TogglDesktop/LoginViewController.xib +++ b/src/ui/osx/TogglDesktop/LoginViewController.xib @@ -22,6 +22,7 @@ + @@ -41,11 +42,11 @@ - + - + @@ -86,19 +87,19 @@ - + - + - + - + @@ -106,7 +107,7 @@ @@ -256,9 +257,27 @@ + + + + - + @@ -266,7 +285,7 @@ - + @@ -278,7 +297,7 @@ - + @@ -286,7 +305,7 @@ - + @@ -307,6 +326,7 @@ + @@ -314,6 +334,7 @@ + diff --git a/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/Contents.json b/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/Contents.json index eba3daa792..8f85198399 100644 --- a/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/Contents.json +++ b/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/Contents.json @@ -2,12 +2,12 @@ "images" : [ { "idiom" : "mac", - "filename" : "continue.png", + "filename" : "aqua.png", "scale" : "1x" }, { "idiom" : "mac", - "filename" : "continue@2x.png", + "filename" : "aqua@2x.png", "scale" : "2x" } ], diff --git a/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/aqua.png b/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/aqua.png new file mode 100644 index 0000000000..567860584e Binary files /dev/null and b/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/aqua.png differ diff --git a/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/aqua@2x.png b/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/aqua@2x.png new file mode 100644 index 0000000000..6537c54eef Binary files /dev/null and b/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/aqua@2x.png differ diff --git a/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/continue.png b/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/continue.png deleted file mode 100644 index a7e4d5ba5e..0000000000 Binary files a/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/continue.png and /dev/null differ diff --git a/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/continue@2x.png b/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/continue@2x.png deleted file mode 100644 index 874628daae..0000000000 Binary files a/src/ui/osx/TogglDesktop/Media.xcassets/MainApp/continue-timer-button.imageset/continue@2x.png and /dev/null differ diff --git a/src/ui/osx/TogglDesktop/Media.xcassets/icon_cancel.imageset/Contents.json b/src/ui/osx/TogglDesktop/Media.xcassets/icon_cancel.imageset/Contents.json new file mode 100644 index 0000000000..09ded3bb9e --- /dev/null +++ b/src/ui/osx/TogglDesktop/Media.xcassets/icon_cancel.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "mac", + "filename" : "icon_cancel.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "filename" : "icon_cancel@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/src/ui/osx/TogglDesktop/Media.xcassets/icon_cancel.imageset/icon_cancel.png b/src/ui/osx/TogglDesktop/Media.xcassets/icon_cancel.imageset/icon_cancel.png new file mode 100644 index 0000000000..2d226f0ffd Binary files /dev/null and b/src/ui/osx/TogglDesktop/Media.xcassets/icon_cancel.imageset/icon_cancel.png differ diff --git a/src/ui/osx/TogglDesktop/Media.xcassets/icon_cancel.imageset/icon_cancel@2x.png b/src/ui/osx/TogglDesktop/Media.xcassets/icon_cancel.imageset/icon_cancel@2x.png new file mode 100644 index 0000000000..f6983cd763 Binary files /dev/null and b/src/ui/osx/TogglDesktop/Media.xcassets/icon_cancel.imageset/icon_cancel@2x.png differ diff --git a/src/ui/osx/TogglDesktop/Other/TogglDesktop-Bridging-Header.h b/src/ui/osx/TogglDesktop/Other/TogglDesktop-Bridging-Header.h index 718a75c9a9..ef38d9dad2 100644 --- a/src/ui/osx/TogglDesktop/Other/TogglDesktop-Bridging-Header.h +++ b/src/ui/osx/TogglDesktop/Other/TogglDesktop-Bridging-Header.h @@ -14,3 +14,4 @@ #import "UndoTextField.h" #import "TimeEntryCollectionView.h" #import "ConvertHexColor.h" +#import "AppDelegate.h" diff --git a/src/ui/osx/TogglDesktop/Swift/Extensions/NSColor+VisibleColor.swift b/src/ui/osx/TogglDesktop/Swift/Extensions/NSColor+VisibleColor.swift index 1cdab9304e..b25dd47452 100644 --- a/src/ui/osx/TogglDesktop/Swift/Extensions/NSColor+VisibleColor.swift +++ b/src/ui/osx/TogglDesktop/Swift/Extensions/NSColor+VisibleColor.swift @@ -13,8 +13,6 @@ extension NSColor { @objc func visibleColor() -> NSColor { guard let window = NSApplication.shared.keyWindow else { return self } let darkMode = window.isDarkMode - let bottomThreshold: CGFloat = 75.0 / 255.0 - let topThreshold: CGFloat = 180.0 / 255.0 // Get correct RGB from current color space guard let component = getRGBComponents() else { return self } @@ -24,13 +22,25 @@ extension NSColor { // If darkmode and color is black-based // or light mode and color is white-based - if (darkMode && (red + blue + green) <= 3.0 * bottomThreshold) || - (!darkMode && (red + blue + green) >= 3.0 * topThreshold) { - + let relativeLuminance = getRelativeLuminance(red: red, green: green, blue: blue) + let contrastRatio = darkMode + ? (relativeLuminance + 0.05) + / (getRelativeLuminance(red: 30.0 / 255.0, green: 30.0 / 255.0, blue: 30.0 / 255.0) + 0.05) + : (getRelativeLuminance(red: 1.0, green: 1.0, blue: 1.0) + 0.05) + / (relativeLuminance + 0.05) + + if (contrastRatio < 1.5) { // Revert color to make it visible - let red = 1.0 - redComponent - let green = 1.0 - greenComponent - let blue = 1.0 - blueComponent + let red = 1.0 - red + let green = 1.0 - green + let blue = 1.0 - blue + return NSColor(red: red, green: green, blue: blue, alpha: 1.0) + } + else if (contrastRatio < 3.0) { + // Just make it lighter/darker + let red = addContrast(component: red, darkMode: darkMode) + let green = addContrast(component: green, darkMode: darkMode) + let blue = addContrast(component: blue, darkMode: darkMode) return NSColor(red: red, green: green, blue: blue, alpha: 1.0) } return self @@ -44,4 +54,25 @@ extension NSColor { rgbColor.getRed(&red, green: &green, blue: &blue, alpha: nil) return (red, green, blue) } + + func getRelativeLuminance(red: CGFloat, green: CGFloat, blue: CGFloat) -> CGFloat { + func getComponentLuminance(component: CGFloat) -> CGFloat { + return component <= 0.03928 + ? component / 12.92 + : pow((component + 0.055) / 1.055, 2.4) + } + let rLuminance = getComponentLuminance(component: red) + let gLuminance = getComponentLuminance(component: green) + let bLuminance = getComponentLuminance(component: blue) + return 0.2126 * rLuminance + 0.7152 * gLuminance + 0.0722 * bLuminance; + } + + func addContrast(component: CGFloat, darkMode: Bool) -> CGFloat { + if darkMode { + return min(1.0, (component + 0.12) * 1.2) + } + else { + return max(0.0, (component - 0.12) / 1.2) + } + } } diff --git a/src/ui/osx/TogglDesktop/TimerEditViewController.m b/src/ui/osx/TogglDesktop/TimerEditViewController.m index 00e4601809..f79c711bc2 100644 --- a/src/ui/osx/TogglDesktop/TimerEditViewController.m +++ b/src/ui/osx/TogglDesktop/TimerEditViewController.m @@ -22,6 +22,7 @@ #import "AutoCompleteTable.h" #import #import "Utils.h" +#import "ClickableImageView.h" typedef enum : NSUInteger { @@ -30,7 +31,7 @@ DisplayModeInput, } DisplayMode; -@interface TimerEditViewController () +@interface TimerEditViewController () @property (weak) IBOutlet NSBoxClickable *manualBox; @property (weak) IBOutlet NSBoxClickable *mainBox; @property (weak) IBOutlet NSTextFieldDuration *durationTextField; @@ -38,12 +39,13 @@ @interface TimerEditViewController () @property (weak) IBOutlet ProjectTextField *projectTextField; @property (weak) IBOutlet AutoCompleteInput *descriptionLabel; @property (weak) IBOutlet NSImageView *billableFlag; -@property (weak) IBOutlet NSImageView *tagFlag; +@property (weak) IBOutlet ClickableImageView *tagFlag; @property (weak) IBOutlet NSButton *addEntryBtn; @property (weak) IBOutlet NSView *contentContainerView; @property (weak) IBOutlet TimerContainerBox *autocompleteContainerView; @property (weak) IBOutlet DotImageView *dotImageView; @property (weak) IBOutlet NSLayoutConstraint *projectTextFieldLeading; +@property (weak) IBOutlet NSButton *cancelBtn; - (IBAction)startButtonClicked:(id)sender; - (IBAction)durationFieldChanged:(id)sender; @@ -101,10 +103,6 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil selector:@selector(stop:) name:kCommandStop object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(startNewShortcut:) - name:kCommandNewShortcut - object:nil]; self.time_entry = [[TimeEntryViewItem alloc] init]; @@ -146,6 +144,7 @@ - (void)initCommon self.autoCompleteInput.responderDelegate = self.autocompleteContainerView; self.descriptionLabel.delegate = self; + self.tagFlag.delegate = self; } - (void)viewDidAppear @@ -281,6 +280,9 @@ - (void)displayTimerState:(TimeEntryViewItem *)te { self.durationTextField.stringValue = @""; } + + // Hide + self.cancelBtn.hidden = YES; } - (void)startDisplayTimeEntryEditor:(NSNotification *)notification @@ -314,7 +316,7 @@ - (void)showDefaultTimer { [self.view.window makeFirstResponder:self.autoCompleteInput]; } - + self.cancelBtn.hidden = YES; self.time_entry = [[TimeEntryViewItem alloc] init]; } @@ -339,6 +341,10 @@ - (void)textFieldClicked:(id)sender { focusField = kFocusedFieldNameDuration; } + else if (sender == self.tagFlag) + { + focusField = kFocusedFieldNameTag; + } toggl_edit(ctx, [self.time_entry.GUID UTF8String], false, focusField); } @@ -602,6 +608,9 @@ - (IBAction)performClick:(id)sender [[self.descriptionLabel currentEditor] setSelectedRange:NSMakeRange(tRange.length, 0)]; [self.autoCompleteInput resetTable]; [self.liteAutocompleteDataSource clearFilter]; + + // Show cancel btn + self.cancelBtn.hidden = NO; } - (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector @@ -733,4 +742,20 @@ - (void)keyDown:(NSEvent *)event } } +- (void)imageViewOnClick:(id)sender +{ + [self textFieldClicked:sender]; +} + +- (IBAction)cancelBtnOnTap:(id)sender +{ + NSString *description = self.time_entry.Description; + self.time_entry = [[TimeEntryViewItem alloc] init]; + self.time_entry.Description = description; + self.tagFlag.hidden = YES; + self.billableFlag.hidden = YES; + self.cancelBtn.hidden = YES; + [self renderProjectLabelWithViewItem:nil]; +} + @end diff --git a/src/ui/osx/TogglDesktop/TimerEditViewController.xib b/src/ui/osx/TogglDesktop/TimerEditViewController.xib index e0f08751cb..5ab013f39b 100644 --- a/src/ui/osx/TogglDesktop/TimerEditViewController.xib +++ b/src/ui/osx/TogglDesktop/TimerEditViewController.xib @@ -13,6 +13,7 @@ + @@ -168,7 +169,7 @@ - + @@ -236,6 +237,20 @@ + @@ -277,6 +292,7 @@ + @@ -284,6 +300,7 @@ + @@ -307,6 +324,7 @@ + diff --git a/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/project.pbxproj b/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/project.pbxproj index bfcb0921e8..1722a58c68 100644 --- a/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/project.pbxproj +++ b/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 3CE30E022052BD8B00AF2E2A /* AutoCompleteTableContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CE30E012052BD8B00AF2E2A /* AutoCompleteTableContainer.m */; }; 3CFE547E201781A7006B673A /* libcrypto.1.1.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3CFE546D201781A5006B673A /* libcrypto.1.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3CFE547F201781A7006B673A /* libssl.1.1.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3CFE547D201781A5006B673A /* libssl.1.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 5B29B9409F01EC0E842DE86D /* Pods_TogglDesktop.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EB480B234BC7336AAC1F952E /* Pods_TogglDesktop.framework */; }; 69FC17F517E6534400B96425 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 69FC17F417E6534400B96425 /* Cocoa.framework */; }; 69FC17FF17E6534400B96425 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 69FC17FD17E6534400B96425 /* InfoPlist.strings */; }; 69FC180117E6534400B96425 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FC180017E6534400B96425 /* main.m */; }; @@ -38,8 +39,6 @@ 74033C9717EC1DE100CA53D3 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 74033C9617EC1DE100CA53D3 /* libc++.dylib */; }; 74098C331919899600CBDFB9 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 74098C321919899600CBDFB9 /* Utils.m */; }; 741104BF18C7682700BC7A49 /* NSTextFieldWithBackground.m in Sources */ = {isa = PBXBuildFile; fileRef = 741104BE18C7682700BC7A49 /* NSTextFieldWithBackground.m */; }; - 7421348F195C4F1A007EF78B /* CrashReporter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 749A3A5918D889BE000AD2DB /* CrashReporter.framework */; }; - 74213490195C50B5007EF78B /* CrashReporter.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 749A3A5918D889BE000AD2DB /* CrashReporter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 7423393C1829B99C00063FA9 /* IdleNotificationWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7423393A1829B99C00063FA9 /* IdleNotificationWindowController.m */; }; 7423393D1829B99C00063FA9 /* IdleNotificationWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7423393B1829B99C00063FA9 /* IdleNotificationWindowController.xib */; }; 7424949E17F1E3D20030121C /* UIEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = 7424949D17F1E3D20030121C /* UIEvents.m */; }; @@ -64,12 +63,6 @@ 749CB8CC18167D6E00814841 /* PreferencesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 749CB8CA18167D6E00814841 /* PreferencesWindowController.m */; }; 749CB8CD18167D6E00814841 /* PreferencesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 749CB8CB18167D6E00814841 /* PreferencesWindowController.xib */; }; 74A7346A18297DD100525BBC /* ConvertHexColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 74A7346918297DD100525BBC /* ConvertHexColor.m */; }; - 74AA9471180909F50000539F /* GTMHTTPFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 74AA9467180909F50000539F /* GTMHTTPFetcher.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 74AA9472180909F50000539F /* GTMHTTPFetchHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = 74AA9469180909F50000539F /* GTMHTTPFetchHistory.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 74AA9473180909F50000539F /* GTMOAuth2Authentication.m in Sources */ = {isa = PBXBuildFile; fileRef = 74AA946B180909F50000539F /* GTMOAuth2Authentication.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 74AA9474180909F50000539F /* GTMOAuth2SignIn.m in Sources */ = {isa = PBXBuildFile; fileRef = 74AA946D180909F50000539F /* GTMOAuth2SignIn.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 74AA9475180909F50000539F /* GTMOAuth2Window.xib in Resources */ = {isa = PBXBuildFile; fileRef = 74AA946E180909F50000539F /* GTMOAuth2Window.xib */; }; - 74AA9476180909F50000539F /* GTMOAuth2WindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 74AA9470180909F50000539F /* GTMOAuth2WindowController.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 74AA947818090A8E0000539F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 74AA947718090A8E0000539F /* Security.framework */; }; 74BA5FCF18B6E770009DAA2D /* NSHoverButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BA5FCE18B6E770009DAA2D /* NSHoverButton.m */; }; 74BAAA0B17F37B140079386F /* TimeEntryViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BAAA0A17F37B140079386F /* TimeEntryViewItem.m */; }; @@ -97,11 +90,13 @@ BA014050225710FD000E5B91 /* TagAutoCompleteTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA01404F225710FD000E5B91 /* TagAutoCompleteTextField.swift */; }; BA01405222571199000E5B91 /* TagTokenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA01405122571199000E5B91 /* TagTokenView.swift */; }; BA014054225711A3000E5B91 /* TagTokenView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BA014053225711A3000E5B91 /* TagTokenView.xib */; }; + BA01E8A1232F77B3006B93EC /* ClickableImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = BA01E8A0232F77B3006B93EC /* ClickableImageView.m */; }; BA03725521FE9FD400FC277B /* FlatButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA03725421FE9FD400FC277B /* FlatButton.swift */; }; BA03729D21FED85700FC277B /* NSView+Xib.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA03729C21FED85700FC277B /* NSView+Xib.swift */; }; BA053659225DDDBB00C26E1F /* CustomFocusRingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA053658225DDDBB00C26E1F /* CustomFocusRingButton.swift */; }; BA05367F225E238D00C26E1F /* ProjectWorksapceCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA05367E225E238D00C26E1F /* ProjectWorksapceCellView.swift */; }; BA05369F225E239600C26E1F /* ProjectWorksapceCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BA05369E225E239600C26E1F /* ProjectWorksapceCellView.xib */; }; + BA067642233A492F00485C3C /* TogglApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = BA067641233A492F00485C3C /* TogglApplication.m */; }; BA08E012222E32C90075F68E /* NSView+LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA08E011222E32C90075F68E /* NSView+LayoutConstraint.swift */; }; BA08E087222E709C0075F68E /* ProjectTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = BA08E086222E709C0075F68E /* ProjectTextField.m */; }; BA0C3A65223219470081C6DE /* AutoCompleteCellType.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA0C3A64223219470081C6DE /* AutoCompleteCellType.swift */; }; @@ -158,13 +153,13 @@ BA46E09F2226707F00C25763 /* Collection+Safe.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA46E09E2226707F00C25763 /* Collection+Safe.swift */; }; BA4AEB9C22C217A4001A898D /* ResizablePopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4AEB9B22C217A4001A898D /* ResizablePopover.swift */; }; BA50ED8522705F9E008323FA /* CalendarFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA50ED8422705F9E008323FA /* CalendarFlowLayout.swift */; }; + BA5B0E4E2330E1C6008D1DED /* GoogleAuthenticationServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5B0E4D2330E1C6008D1DED /* GoogleAuthenticationServer.swift */; }; + BA5B0E502330EA92008D1DED /* GoogleAuthenticationServer+Objc.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5B0E4F2330EA92008D1DED /* GoogleAuthenticationServer+Objc.swift */; }; BA6572A6224DFA6F00BA4C60 /* RGB.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6572A0224DFA6E00BA4C60 /* RGB.swift */; }; BA6572A7224DFA6F00BA4C60 /* HSBGen.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6572A1224DFA6E00BA4C60 /* HSBGen.swift */; }; BA6572A8224DFA6F00BA4C60 /* CurrentColorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6572A2224DFA6F00BA4C60 /* CurrentColorView.swift */; }; BA6572A9224DFA6F00BA4C60 /* ColorGraphicsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6572A3224DFA6F00BA4C60 /* ColorGraphicsView.swift */; }; BA6572AA224DFA6F00BA4C60 /* HSV.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6572A4224DFA6F00BA4C60 /* HSV.swift */; }; - BA6E873521DDC1E2005E2451 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA6E86B621DDB331005E2451 /* Sparkle.framework */; }; - BA6E873621DDC1E2005E2451 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BA6E86B621DDB331005E2451 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BA6EB8402248CBE3003BB8EF /* ProjectStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6EB83F2248CBE3003BB8EF /* ProjectStorage.swift */; }; BA6EB8942249DB33003BB8EF /* VerticallyCenteredTextFieldCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6EB8752249DB33003BB8EF /* VerticallyCenteredTextFieldCell.swift */; }; BA6F1B1A21EEE258009265E4 /* NSColor+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA6F1B1921EEE258009265E4 /* NSColor+Utils.swift */; }; @@ -185,8 +180,6 @@ BA7D335722489BD000B953A8 /* AutoCompleteViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA7D335622489BD000B953A8 /* AutoCompleteViewDataSource.swift */; }; BA7D335A22489C8000B953A8 /* ProjectDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA7D335922489C8000B953A8 /* ProjectDataSource.swift */; }; BA7D335E2248B48000B953A8 /* AutoCompleteTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA7D335D2248B48000B953A8 /* AutoCompleteTextField.swift */; }; - BA7DB6E321F9C77A0059239B /* MASShortcut.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA7DB6D221F9C7660059239B /* MASShortcut.framework */; }; - BA7DB6E421F9C77A0059239B /* MASShortcut.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BA7DB6D221F9C7660059239B /* MASShortcut.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BA80BEB2221EAE6F00BDFD35 /* Array+ByGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA80BEB1221EAE6F00BDFD35 /* Array+ByGroup.swift */; }; BA81896A23016148000710EA /* NSColor+VisibleColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA81896923016148000710EA /* NSColor+VisibleColor.swift */; }; BA84363B22533A6600EF5830 /* DesktopLibraryBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = BA84363A22533A6600EF5830 /* DesktopLibraryBridge.m */; }; @@ -232,8 +225,6 @@ BAD2342621D612DF0039C742 /* libPocoUtil.60.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = BAD2341D21D612DF0039C742 /* libPocoUtil.60.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; BAD2342721D612DF0039C742 /* libPocoFoundation.60.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = BAD2341E21D612DF0039C742 /* libPocoFoundation.60.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; BAD307D3229C1BD000C727DB /* KeyboardDatePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAD307D2229C1BD000C727DB /* KeyboardDatePicker.swift */; }; - BAD858C7228EAE6500226C71 /* Bugsnag.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAD858A3228EAE0E00226C71 /* Bugsnag.framework */; }; - BAD858C8228EAE6500226C71 /* Bugsnag.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BAD858A3228EAE0E00226C71 /* Bugsnag.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BAD858CC228EAE7C00226C71 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = BAD858CB228EAE7C00226C71 /* libz.tbd */; }; BAE007DE21FAF00D00404379 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BAE007DD21FAF00D00404379 /* Media.xcassets */; }; BAE49CAE222FC1C900773814 /* TimerContainerBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE49CAD222FC1C900773814 /* TimerContainerBox.swift */; }; @@ -266,230 +257,6 @@ remoteGlobalIDString = C55DA59B17F06A3B00B42178; remoteInfo = TogglDesktopLibrary; }; - 745126C619A28AA600390F47 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 058812B91040582D009128FB; - remoteInfo = "CrashReporter-iOS"; - }; - 749A3A5618D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 05E731F30EFA1AAB005EDFB7; - remoteInfo = "CrashReporter-MacOSX-Static"; - }; - 749A3A5818D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8DC2EF5B0486A6940098B216; - remoteInfo = "CrashReporter-MacOSX"; - }; - 749A3A5C18D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 05CD31520EE936A9000FDE88; - remoteInfo = "CrashReporter-iOS-Device"; - }; - 749A3A5E18D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 05CD31630EE93905000FDE88; - remoteInfo = "CrashReporter-iOS-Simulator"; - }; - 749A3A6018D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 05E731E30EFA1A3E005EDFB7; - remoteInfo = plcrashutil; - }; - 749A3A6218D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 05CD32690EE93DC3000FDE88; - remoteInfo = "Tests-MacOSX"; - }; - 749A3A6418D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 05CD32A90EE94062000FDE88; - remoteInfo = "Tests-iOS-Simulator"; - }; - 749A3A6618D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 05CD33240EE94439000FDE88; - remoteInfo = "Tests-iOS-Device"; - }; - 749A3A6818D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 05F40CE70EF7AB80008050CF; - remoteInfo = DemoCrash; - }; - 749A3A6A18D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 052A45CF136353FB00987004; - remoteInfo = "DemoCrash-iOS-Device"; - }; - 749A3A6C18D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 052A464F136355FD00987004; - remoteInfo = "DemoCrash-iOS-Simulator"; - }; - 749A3A6E18D889BE000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 050DE24D0F61B80B00152ED3; - remoteInfo = "Fuzz Testing"; - }; - 749A3A7218D89F23000AD2DB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 8DC2EF4F0486A6940098B216; - remoteInfo = "CrashReporter-MacOSX"; - }; - BA6E86B521DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8DC2EF5B0486A6940098B216; - remoteInfo = Sparkle; - }; - BA6E86B721DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 61B5F90209C4CEE200B25A18; - remoteInfo = "Sparkle Test App"; - }; - BA6E86B921DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 612279D90DB5470200AB99EA; - remoteInfo = "Sparkle Unit Tests"; - }; - BA6E86BB21DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 5D06E8D00FD68C7C005AE3F6; - remoteInfo = BinaryDelta; - }; - BA6E86BD21DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 55C14BB7136EEF1500649790; - remoteInfo = Autoupdate; - }; - BA6E86BF21DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 726B2B5D1C645FC900388755; - remoteInfo = "UI Tests"; - }; - BA6E86C121DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 722954B41D04ADAF00ECF9CA; - remoteInfo = fileop; - }; - BA6E86C321DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 5AE13FB31E0D9E07000D2C2C; - remoteInfo = generate_appcast; - }; - BA6E86C521DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 5AB8F19F214DA72000A1187F; - remoteInfo = generate_keys; - }; - BA6E86C721DDB331005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 5A5ADED7214EDE4900DF0099; - remoteInfo = sign_update; - }; - BA6E873721DDC1E2005E2451 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 8DC2EF4F0486A6940098B216; - remoteInfo = Sparkle; - }; - BA7DB6D121F9C7660059239B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA7DB6BB21F9C7660059239B /* MASShortcut.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0D827CD31990D4420010B8EF; - remoteInfo = MASShortcut; - }; - BA7DB6D321F9C7660059239B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA7DB6BB21F9C7660059239B /* MASShortcut.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0D827D8319910AFF0010B8EF; - remoteInfo = MASShortcutTests; - }; - BA7DB6D521F9C7660059239B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA7DB6BB21F9C7660059239B /* MASShortcut.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0D827D371990D5E70010B8EF; - remoteInfo = Demo; - }; - BA7DB6E521F9C77A0059239B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BA7DB6BB21F9C7660059239B /* MASShortcut.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 0D827CD21990D4420010B8EF; - remoteInfo = MASShortcut; - }; - BAD858A2228EAE0E00226C71 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BAD8589D228EAE0E00226C71 /* Bugsnag.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8A2C8FA11C6BC1F700846019; - remoteInfo = Bugsnag; - }; - BAD858A4228EAE0E00226C71 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BAD8589D228EAE0E00226C71 /* Bugsnag.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8A2C8FAB1C6BC1F700846019; - remoteInfo = Tests; - }; - BAD858C9228EAE6500226C71 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BAD8589D228EAE0E00226C71 /* Bugsnag.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 8A2C8FA01C6BC1F700846019; - remoteInfo = Bugsnag; - }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -501,20 +268,16 @@ files = ( 3CFE547E201781A7006B673A /* libcrypto.1.1.dylib in CopyFiles */, BAD2342121D612DF0039C742 /* libPocoNet.60.dylib in CopyFiles */, - BA7DB6E421F9C77A0059239B /* MASShortcut.framework in CopyFiles */, BAD2342521D612DF0039C742 /* libPocoJSON.60.dylib in CopyFiles */, BAD2342321D612DF0039C742 /* libPocoData.60.dylib in CopyFiles */, BAD2342721D612DF0039C742 /* libPocoFoundation.60.dylib in CopyFiles */, 3CFE547F201781A7006B673A /* libssl.1.1.dylib in CopyFiles */, - BAD858C8228EAE6500226C71 /* Bugsnag.framework in CopyFiles */, 74456B9E1A774CB0002A6338 /* TogglDesktopLibrary.dylib in CopyFiles */, BAD2341F21D612DF0039C742 /* libPocoDataSQLite.60.dylib in CopyFiles */, BAD2342621D612DF0039C742 /* libPocoUtil.60.dylib in CopyFiles */, BAD2342021D612DF0039C742 /* libPocoNetSSL.60.dylib in CopyFiles */, BAD2342221D612DF0039C742 /* libPocoCrypto.60.dylib in CopyFiles */, BAD2342421D612DF0039C742 /* libPocoXML.60.dylib in CopyFiles */, - 74213490195C50B5007EF78B /* CrashReporter.framework in CopyFiles */, - BA6E873621DDC1E2005E2451 /* Sparkle.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -542,6 +305,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 3A54C9591227E723FEC0DB85 /* Pods-TogglDesktop.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TogglDesktop.debug.xcconfig"; path = "Target Support Files/Pods-TogglDesktop/Pods-TogglDesktop.debug.xcconfig"; sourceTree = ""; }; 3C0158EF1C7B414E00FE63AA /* LoadMoreCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadMoreCell.xib; sourceTree = ""; }; 3C07B758193C88AE00ED6E6F /* NSCustomTimerComboBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSCustomTimerComboBox.h; sourceTree = ""; }; 3C07B759193C88AE00ED6E6F /* NSCustomTimerComboBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCustomTimerComboBox.m; sourceTree = ""; }; @@ -631,7 +395,6 @@ 748B3A3219222DB100F31468 /* DisplayCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayCommand.h; sourceTree = ""; }; 748B3A3319222DB100F31468 /* DisplayCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DisplayCommand.m; sourceTree = ""; }; 7498D2471888B226001390B9 /* TimeEntryCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TimeEntryCell.xib; sourceTree = ""; }; - 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CrashReporter.xcodeproj; path = ../../../../third_party/plcrashreporter/CrashReporter.xcodeproj; sourceTree = ""; }; 749BD0BB1833E28400980494 /* NSBoxClickable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSBoxClickable.h; sourceTree = ""; }; 749BD0BC1833E28400980494 /* NSBoxClickable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSBoxClickable.m; sourceTree = ""; }; 749CB8C918167D6E00814841 /* PreferencesWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesWindowController.h; sourceTree = SOURCE_ROOT; }; @@ -639,17 +402,6 @@ 749CB8CB18167D6E00814841 /* PreferencesWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesWindowController.xib; sourceTree = SOURCE_ROOT; }; 74A7346818297DD100525BBC /* ConvertHexColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConvertHexColor.h; sourceTree = ""; }; 74A7346918297DD100525BBC /* ConvertHexColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConvertHexColor.m; sourceTree = ""; }; - 74AA9466180909F50000539F /* GTMHTTPFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMHTTPFetcher.h; path = "../../../../third_party/gtm-oauth2-read-only/HTTPFetcher/GTMHTTPFetcher.h"; sourceTree = ""; }; - 74AA9467180909F50000539F /* GTMHTTPFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMHTTPFetcher.m; path = "../../../../third_party/gtm-oauth2-read-only/HTTPFetcher/GTMHTTPFetcher.m"; sourceTree = ""; }; - 74AA9468180909F50000539F /* GTMHTTPFetchHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMHTTPFetchHistory.h; path = "../../../../third_party/gtm-oauth2-read-only/HTTPFetcher/GTMHTTPFetchHistory.h"; sourceTree = ""; }; - 74AA9469180909F50000539F /* GTMHTTPFetchHistory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMHTTPFetchHistory.m; path = "../../../../third_party/gtm-oauth2-read-only/HTTPFetcher/GTMHTTPFetchHistory.m"; sourceTree = ""; }; - 74AA946A180909F50000539F /* GTMOAuth2Authentication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMOAuth2Authentication.h; path = "../../../../third_party/gtm-oauth2-read-only/Source/GTMOAuth2Authentication.h"; sourceTree = ""; }; - 74AA946B180909F50000539F /* GTMOAuth2Authentication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMOAuth2Authentication.m; path = "../../../../third_party/gtm-oauth2-read-only/Source/GTMOAuth2Authentication.m"; sourceTree = ""; }; - 74AA946C180909F50000539F /* GTMOAuth2SignIn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMOAuth2SignIn.h; path = "../../../../third_party/gtm-oauth2-read-only/Source/GTMOAuth2SignIn.h"; sourceTree = ""; }; - 74AA946D180909F50000539F /* GTMOAuth2SignIn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMOAuth2SignIn.m; path = "../../../../third_party/gtm-oauth2-read-only/Source/GTMOAuth2SignIn.m"; sourceTree = ""; }; - 74AA946E180909F50000539F /* GTMOAuth2Window.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = GTMOAuth2Window.xib; path = "../../../../third_party/gtm-oauth2-read-only/Source/Mac/GTMOAuth2Window.xib"; sourceTree = ""; }; - 74AA946F180909F50000539F /* GTMOAuth2WindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GTMOAuth2WindowController.h; path = "../../../../third_party/gtm-oauth2-read-only/Source/Mac/GTMOAuth2WindowController.h"; sourceTree = ""; }; - 74AA9470180909F50000539F /* GTMOAuth2WindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GTMOAuth2WindowController.m; path = "../../../../third_party/gtm-oauth2-read-only/Source/Mac/GTMOAuth2WindowController.m"; sourceTree = ""; }; 74AA947718090A8E0000539F /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 74B680A8180759C300B697AA /* TogglDesktopLibrary.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TogglDesktopLibrary.xcodeproj; path = ../../../lib/osx/TogglDesktopLibrary.xcodeproj; sourceTree = ""; }; 74BA5FCD18B6E770009DAA2D /* NSHoverButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSHoverButton.h; sourceTree = ""; }; @@ -681,6 +433,7 @@ 95C0707618CDB67300A34D0D /* NSCustomComboBoxCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCustomComboBoxCell.m; sourceTree = ""; }; 95C0707818CDB91500A34D0D /* NSCustomComboBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSCustomComboBox.h; sourceTree = ""; }; 95C0707918CDB91500A34D0D /* NSCustomComboBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCustomComboBox.m; sourceTree = ""; }; + B671ACF75B3267B013176BD7 /* Pods-TogglDesktop.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TogglDesktop.release.xcconfig"; path = "Target Support Files/Pods-TogglDesktop/Pods-TogglDesktop.release.xcconfig"; sourceTree = ""; }; BA013FF4225705B6000E5B91 /* HoverTableCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HoverTableCellView.swift; sourceTree = ""; }; BA01404522570805000E5B91 /* TagCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagCellView.swift; sourceTree = ""; }; BA0140472257080F000E5B91 /* TagCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TagCellView.xib; sourceTree = ""; }; @@ -690,11 +443,15 @@ BA01404F225710FD000E5B91 /* TagAutoCompleteTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagAutoCompleteTextField.swift; sourceTree = ""; }; BA01405122571199000E5B91 /* TagTokenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagTokenView.swift; sourceTree = ""; }; BA014053225711A3000E5B91 /* TagTokenView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TagTokenView.xib; sourceTree = ""; }; + BA01E89F232F77B3006B93EC /* ClickableImageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ClickableImageView.h; sourceTree = ""; }; + BA01E8A0232F77B3006B93EC /* ClickableImageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ClickableImageView.m; sourceTree = ""; }; BA03725421FE9FD400FC277B /* FlatButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlatButton.swift; sourceTree = ""; }; BA03729C21FED85700FC277B /* NSView+Xib.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSView+Xib.swift"; sourceTree = ""; }; BA053658225DDDBB00C26E1F /* CustomFocusRingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomFocusRingButton.swift; sourceTree = ""; }; BA05367E225E238D00C26E1F /* ProjectWorksapceCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectWorksapceCellView.swift; sourceTree = ""; }; BA05369E225E239600C26E1F /* ProjectWorksapceCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProjectWorksapceCellView.xib; sourceTree = ""; }; + BA067640233A492F00485C3C /* TogglApplication.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TogglApplication.h; sourceTree = ""; }; + BA067641233A492F00485C3C /* TogglApplication.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TogglApplication.m; sourceTree = ""; }; BA08E011222E32C90075F68E /* NSView+LayoutConstraint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSView+LayoutConstraint.swift"; sourceTree = ""; }; BA08E085222E709C0075F68E /* ProjectTextField.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProjectTextField.h; sourceTree = ""; }; BA08E086222E709C0075F68E /* ProjectTextField.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProjectTextField.m; sourceTree = ""; }; @@ -748,12 +505,13 @@ BA46E09E2226707F00C25763 /* Collection+Safe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Collection+Safe.swift"; sourceTree = ""; }; BA4AEB9B22C217A4001A898D /* ResizablePopover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResizablePopover.swift; sourceTree = ""; }; BA50ED8422705F9E008323FA /* CalendarFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarFlowLayout.swift; sourceTree = ""; }; + BA5B0E4D2330E1C6008D1DED /* GoogleAuthenticationServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoogleAuthenticationServer.swift; sourceTree = ""; }; + BA5B0E4F2330EA92008D1DED /* GoogleAuthenticationServer+Objc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GoogleAuthenticationServer+Objc.swift"; sourceTree = ""; }; BA6572A0224DFA6E00BA4C60 /* RGB.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RGB.swift; sourceTree = ""; }; BA6572A1224DFA6E00BA4C60 /* HSBGen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HSBGen.swift; sourceTree = ""; }; BA6572A2224DFA6F00BA4C60 /* CurrentColorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrentColorView.swift; sourceTree = ""; }; BA6572A3224DFA6F00BA4C60 /* ColorGraphicsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorGraphicsView.swift; sourceTree = ""; }; BA6572A4224DFA6F00BA4C60 /* HSV.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HSV.swift; sourceTree = ""; }; - BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sparkle.xcodeproj; path = ../../../../third_party/Sparkle/Sparkle.xcodeproj; sourceTree = ""; }; BA6EB83F2248CBE3003BB8EF /* ProjectStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectStorage.swift; sourceTree = ""; }; BA6EB8752249DB33003BB8EF /* VerticallyCenteredTextFieldCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VerticallyCenteredTextFieldCell.swift; sourceTree = ""; }; BA6F1B1921EEE258009265E4 /* NSColor+Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSColor+Utils.swift"; sourceTree = ""; }; @@ -776,7 +534,6 @@ BA7D335622489BD000B953A8 /* AutoCompleteViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCompleteViewDataSource.swift; sourceTree = ""; }; BA7D335922489C8000B953A8 /* ProjectDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectDataSource.swift; sourceTree = ""; }; BA7D335D2248B48000B953A8 /* AutoCompleteTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCompleteTextField.swift; sourceTree = ""; }; - BA7DB6BB21F9C7660059239B /* MASShortcut.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MASShortcut.xcodeproj; path = ../../../../third_party/MASShortcut/MASShortcut.xcodeproj; sourceTree = ""; }; BA80BEB1221EAE6F00BDFD35 /* Array+ByGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+ByGroup.swift"; sourceTree = ""; }; BA81896923016148000710EA /* NSColor+VisibleColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSColor+VisibleColor.swift"; sourceTree = ""; }; BA84363922533A6600EF5830 /* DesktopLibraryBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DesktopLibraryBridge.h; sourceTree = ""; }; @@ -798,6 +555,7 @@ BAA11AC22251F4D6007F31D2 /* WorkspaceAutoCompleteTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkspaceAutoCompleteTextField.swift; sourceTree = ""; }; BAA11AC42251F502007F31D2 /* WorkspaceDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkspaceDataSource.swift; sourceTree = ""; }; BAA260D0222D1DC70094F4E4 /* NSView+Shadow+Border.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSView+Shadow+Border.swift"; sourceTree = ""; }; + BAAC931A22EEF92100E2EE1C /* TogglDesktop.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = TogglDesktop.entitlements; path = TogglDesktop/TogglDesktop.entitlements; sourceTree = ""; }; BAAF567D2223CAC5003D0D73 /* NSButton+TextColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSButton+TextColor.swift"; sourceTree = ""; }; BAAF569D2223D4C7003D0D73 /* DotImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DotImageView.swift; sourceTree = ""; }; BAAF569F2223DF9A003D0D73 /* VertificalTimeEntryFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VertificalTimeEntryFlowLayout.swift; sourceTree = ""; }; @@ -823,7 +581,6 @@ BAD2341D21D612DF0039C742 /* libPocoUtil.60.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libPocoUtil.60.dylib; path = ../../../../third_party/poco/lib/Darwin/x86_64/libPocoUtil.60.dylib; sourceTree = ""; }; BAD2341E21D612DF0039C742 /* libPocoFoundation.60.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libPocoFoundation.60.dylib; path = ../../../../third_party/poco/lib/Darwin/x86_64/libPocoFoundation.60.dylib; sourceTree = ""; }; BAD307D2229C1BD000C727DB /* KeyboardDatePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardDatePicker.swift; sourceTree = ""; }; - BAD8589D228EAE0E00226C71 /* Bugsnag.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Bugsnag.xcodeproj; path = "../../../../third_party/bugsnag-cocoa/OSX/Bugsnag.xcodeproj"; sourceTree = ""; }; BAD858C5228EAE3000226C71 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; BAD858CB228EAE7C00226C71 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; BAE007DD21FAF00D00404379 /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Media.xcassets; sourceTree = ""; }; @@ -848,6 +605,7 @@ C5DA1FC117F1B38B001C4565 /* LoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginViewController.h; sourceTree = SOURCE_ROOT; }; C5DA1FC217F1B38B001C4565 /* LoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewController.m; sourceTree = SOURCE_ROOT; }; C5DA1FC317F1B38B001C4565 /* LoginViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoginViewController.xib; sourceTree = SOURCE_ROOT; }; + EB480B234BC7336AAC1F952E /* Pods_TogglDesktop.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TogglDesktop.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -861,19 +619,26 @@ 743D942618279290000E6F70 /* IOKit.framework in Frameworks */, 74AA947818090A8E0000539F /* Security.framework in Frameworks */, 74E3CDD917FC369700C3ADD3 /* ExceptionHandling.framework in Frameworks */, - 7421348F195C4F1A007EF78B /* CrashReporter.framework in Frameworks */, 74E3CDD717FBAE0800C3ADD3 /* SystemConfiguration.framework in Frameworks */, - BA6E873521DDC1E2005E2451 /* Sparkle.framework in Frameworks */, - BA7DB6E321F9C77A0059239B /* MASShortcut.framework in Frameworks */, - BAD858C7228EAE6500226C71 /* Bugsnag.framework in Frameworks */, 74033C9717EC1DE100CA53D3 /* libc++.dylib in Frameworks */, 69FC17F517E6534400B96425 /* Cocoa.framework in Frameworks */, + 5B29B9409F01EC0E842DE86D /* Pods_TogglDesktop.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3A742A9261BE0A8B078F1749 /* Pods */ = { + isa = PBXGroup; + children = ( + 3A54C9591227E723FEC0DB85 /* Pods-TogglDesktop.debug.xcconfig */, + B671ACF75B3267B013176BD7 /* Pods-TogglDesktop.release.xcconfig */, + ); + name = Pods; + path = ../Pods; + sourceTree = ""; + }; 3C6B246F203E01B70063FC08 /* AutoComplete */ = { isa = PBXGroup; children = ( @@ -897,6 +662,7 @@ 69FC17E817E6534400B96425 = { isa = PBXGroup; children = ( + BAAC931A22EEF92100E2EE1C /* TogglDesktop.entitlements */, BAE007DD21FAF00D00404379 /* Media.xcassets */, BAD2341921D612DE0039C742 /* libPocoCrypto.60.dylib */, BAD2341A21D612DE0039C742 /* libPocoData.60.dylib */, @@ -911,12 +677,7 @@ 3CFE546D201781A5006B673A /* libcrypto.1.1.dylib */, 3CFE547D201781A5006B673A /* libssl.1.1.dylib */, 742134C3195C63AE007EF78B /* poco */, - BAD8589D228EAE0E00226C71 /* Bugsnag.xcodeproj */, - 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */, 74B680A8180759C300B697AA /* TogglDesktopLibrary.xcodeproj */, - BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */, - BA7DB6BB21F9C7660059239B /* MASShortcut.xcodeproj */, - 74E1682E180F269F0026261C /* gtm */, 74E857AA194F8807007A88B9 /* ssl */, BA712EAF21BF904E00A2D8DD /* Feature */, BA1B7FA122E5D52F001333D9 /* Swift */, @@ -925,6 +686,7 @@ 69FC17F317E6534400B96425 /* Frameworks */, 69FC17F217E6534400B96425 /* Products */, 3C1E013E19D2DAE300DBF9A5 /* dsa_pub.pem */, + 3A742A9261BE0A8B078F1749 /* Pods */, ); sourceTree = ""; }; @@ -953,6 +715,7 @@ 69FC17F417E6534400B96425 /* Cocoa.framework */, 69FC181217E6534500B96425 /* SenTestingKit.framework */, 69FC17F617E6534400B96425 /* Other Frameworks */, + EB480B234BC7336AAC1F952E /* Pods_TogglDesktop.framework */, ); name = Frameworks; sourceTree = ""; @@ -1082,6 +845,10 @@ BA08E086222E709C0075F68E /* ProjectTextField.m */, 745126B419A28AA500390F47 /* Reachability.h */, 745126B519A28AA600390F47 /* Reachability.m */, + BA01E89F232F77B3006B93EC /* ClickableImageView.h */, + BA01E8A0232F77B3006B93EC /* ClickableImageView.m */, + BA067640233A492F00485C3C /* TogglApplication.h */, + BA067641233A492F00485C3C /* TogglApplication.m */, ); name = ui; path = test2; @@ -1115,44 +882,6 @@ name = Products; sourceTree = ""; }; - 749A3A4418D889BD000AD2DB /* Products */ = { - isa = PBXGroup; - children = ( - 749A3A5718D889BE000AD2DB /* libCrashReporter-MacOSX-Static.a */, - 749A3A5918D889BE000AD2DB /* CrashReporter.framework */, - 745126C719A28AA600390F47 /* CrashReporter.framework */, - 749A3A5D18D889BE000AD2DB /* libCrashReporter-iphoneos.a */, - 749A3A5F18D889BE000AD2DB /* libCrashReporter-iphonesimulator.a */, - 749A3A6118D889BE000AD2DB /* plcrashutil */, - 749A3A6318D889BE000AD2DB /* Tests-MacOSX.xctest */, - 749A3A6518D889BE000AD2DB /* Tests-iOS-Simulator.xctest */, - 749A3A6718D889BE000AD2DB /* Tests-iOS-Device.xctest */, - 749A3A6918D889BE000AD2DB /* DemoCrash.app */, - 749A3A6B18D889BE000AD2DB /* DemoCrash-iOS-Device.app */, - 749A3A6D18D889BE000AD2DB /* DemoCrash-iOS-Simulator.app */, - 749A3A6F18D889BE000AD2DB /* Fuzz Testing */, - ); - name = Products; - sourceTree = ""; - }; - 74E1682E180F269F0026261C /* gtm */ = { - isa = PBXGroup; - children = ( - 74AA9466180909F50000539F /* GTMHTTPFetcher.h */, - 74AA9467180909F50000539F /* GTMHTTPFetcher.m */, - 74AA9468180909F50000539F /* GTMHTTPFetchHistory.h */, - 74AA9469180909F50000539F /* GTMHTTPFetchHistory.m */, - 74AA946A180909F50000539F /* GTMOAuth2Authentication.h */, - 74AA946B180909F50000539F /* GTMOAuth2Authentication.m */, - 74AA946C180909F50000539F /* GTMOAuth2SignIn.h */, - 74AA946D180909F50000539F /* GTMOAuth2SignIn.m */, - 74AA946E180909F50000539F /* GTMOAuth2Window.xib */, - 74AA946F180909F50000539F /* GTMOAuth2WindowController.h */, - 74AA9470180909F50000539F /* GTMOAuth2WindowController.m */, - ); - name = gtm; - sourceTree = ""; - }; 74E857AA194F8807007A88B9 /* ssl */ = { isa = PBXGroup; children = ( @@ -1356,6 +1085,15 @@ path = Cells; sourceTree = ""; }; + BA5B0E2E2330E1A8008D1DED /* GoogleLogin */ = { + isa = PBXGroup; + children = ( + BA5B0E4D2330E1C6008D1DED /* GoogleAuthenticationServer.swift */, + BA5B0E4F2330EA92008D1DED /* GoogleAuthenticationServer+Objc.swift */, + ); + path = GoogleLogin; + sourceTree = ""; + }; BA657280224DFA4F00BA4C60 /* ColorWheel */ = { isa = PBXGroup; children = ( @@ -1368,23 +1106,6 @@ path = ColorWheel; sourceTree = ""; }; - BA6E86A621DDB331005E2451 /* Products */ = { - isa = PBXGroup; - children = ( - BA6E86B621DDB331005E2451 /* Sparkle.framework */, - BA6E86B821DDB331005E2451 /* Sparkle Test App.app */, - BA6E86BA21DDB331005E2451 /* Sparkle Unit Tests.xctest */, - BA6E86BC21DDB331005E2451 /* BinaryDelta */, - BA6E86BE21DDB331005E2451 /* Autoupdate.app */, - BA6E86C021DDB331005E2451 /* UI Tests.xctest */, - BA6E86C221DDB331005E2451 /* fileop */, - BA6E86C421DDB331005E2451 /* generate_appcast */, - BA6E86C621DDB331005E2451 /* generate_keys */, - BA6E86C821DDB331005E2451 /* sign_update */, - ); - name = Products; - sourceTree = ""; - }; BA6EB8202248CBD3003BB8EF /* Storage */ = { isa = PBXGroup; children = ( @@ -1400,6 +1121,7 @@ BA712EAF21BF904E00A2D8DD /* Feature */ = { isa = PBXGroup; children = ( + BA5B0E2E2330E1A8008D1DED /* GoogleLogin */, BA13D1E42269B4F600EB3833 /* Calendar */, BA657280224DFA4F00BA4C60 /* ColorWheel */, BA34F0DB22439BF300C27A15 /* TimeEntryEditor */, @@ -1464,16 +1186,6 @@ path = Input; sourceTree = ""; }; - BA7DB6BC21F9C7660059239B /* Products */ = { - isa = PBXGroup; - children = ( - BA7DB6D221F9C7660059239B /* MASShortcut.framework */, - BA7DB6D421F9C7660059239B /* MASShortcutTests.xctest */, - BA7DB6D621F9C7660059239B /* Demo.app */, - ); - name = Products; - sourceTree = ""; - }; BA8B4C522251FA6900592BC7 /* Workspace */ = { isa = PBXGroup; children = ( @@ -1516,15 +1228,6 @@ path = TimeEntryEmptyView; sourceTree = ""; }; - BAD8589E228EAE0E00226C71 /* Products */ = { - isa = PBXGroup; - children = ( - BAD858A3228EAE0E00226C71 /* Bugsnag.framework */, - BAD858A5228EAE0E00226C71 /* Tests.xctest */, - ); - name = Products; - sourceTree = ""; - }; BAF50DF521A2A16D0090BA95 /* IconFactory */ = { isa = PBXGroup; children = ( @@ -1583,6 +1286,7 @@ isa = PBXNativeTarget; buildConfigurationList = 69FC182217E6534500B96425 /* Build configuration list for PBXNativeTarget "TogglDesktop" */; buildPhases = ( + 1276406FB7B983D0C81B35AE /* [CP] Check Pods Manifest.lock */, 69FC17ED17E6534400B96425 /* Sources */, 69FC17EE17E6534400B96425 /* Frameworks */, 69FC17EF17E6534400B96425 /* Resources */, @@ -1591,15 +1295,13 @@ BA3BF8502315455B00721020 /* Copy Files for Library in Debug mode */, 7407F1F41AA80466000380C4 /* Run Script (Fix dynamic library paths in Frameworks) */, BA6406F121C8FC690074BC96 /* Run Formatter */, + CE4DD35122BF90B10398A0A6 /* [CP] Embed Pods Frameworks */, + B984F0D8FC24E4374FFADFBB /* Upload Bugsnag dSYM */, ); buildRules = ( ); dependencies = ( 74456B9C1A77486B002A6338 /* PBXTargetDependency */, - 749A3A7318D89F23000AD2DB /* PBXTargetDependency */, - BA6E873821DDC1E2005E2451 /* PBXTargetDependency */, - BA7DB6E621F9C77A0059239B /* PBXTargetDependency */, - BAD858CA228EAE6500226C71 /* PBXTargetDependency */, ); name = TogglDesktop; productName = test2; @@ -1619,6 +1321,11 @@ DevelopmentTeam = B227VTMZ94; LastSwiftMigration = 1020; ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.HardenedRuntime = { + enabled = 1; + }; + }; }; }; }; @@ -1636,22 +1343,6 @@ productRefGroup = 69FC17F217E6534400B96425 /* Products */; projectDirPath = ""; projectReferences = ( - { - ProductGroup = BAD8589E228EAE0E00226C71 /* Products */; - ProjectRef = BAD8589D228EAE0E00226C71 /* Bugsnag.xcodeproj */; - }, - { - ProductGroup = 749A3A4418D889BD000AD2DB /* Products */; - ProjectRef = 749A3A4318D889BD000AD2DB /* CrashReporter.xcodeproj */; - }, - { - ProductGroup = BA7DB6BC21F9C7660059239B /* Products */; - ProjectRef = BA7DB6BB21F9C7660059239B /* MASShortcut.xcodeproj */; - }, - { - ProductGroup = BA6E86A621DDB331005E2451 /* Products */; - ProjectRef = BA6E86A521DDB331005E2451 /* Sparkle.xcodeproj */; - }, { ProductGroup = 74456B871A774858002A6338 /* Products */; ProjectRef = 74B680A8180759C300B697AA /* TogglDesktopLibrary.xcodeproj */; @@ -1674,202 +1365,6 @@ remoteRef = 74456B991A774858002A6338 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 745126C719A28AA600390F47 /* CrashReporter.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CrashReporter.framework; - remoteRef = 745126C619A28AA600390F47 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A5718D889BE000AD2DB /* libCrashReporter-MacOSX-Static.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libCrashReporter-MacOSX-Static.a"; - remoteRef = 749A3A5618D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A5918D889BE000AD2DB /* CrashReporter.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CrashReporter.framework; - remoteRef = 749A3A5818D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A5D18D889BE000AD2DB /* libCrashReporter-iphoneos.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libCrashReporter-iphoneos.a"; - remoteRef = 749A3A5C18D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A5F18D889BE000AD2DB /* libCrashReporter-iphonesimulator.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libCrashReporter-iphonesimulator.a"; - remoteRef = 749A3A5E18D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A6118D889BE000AD2DB /* plcrashutil */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.executable"; - path = plcrashutil; - remoteRef = 749A3A6018D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A6318D889BE000AD2DB /* Tests-MacOSX.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "Tests-MacOSX.xctest"; - remoteRef = 749A3A6218D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A6518D889BE000AD2DB /* Tests-iOS-Simulator.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "Tests-iOS-Simulator.xctest"; - remoteRef = 749A3A6418D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A6718D889BE000AD2DB /* Tests-iOS-Device.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "Tests-iOS-Device.xctest"; - remoteRef = 749A3A6618D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A6918D889BE000AD2DB /* DemoCrash.app */ = { - isa = PBXReferenceProxy; - fileType = wrapper.application; - path = DemoCrash.app; - remoteRef = 749A3A6818D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A6B18D889BE000AD2DB /* DemoCrash-iOS-Device.app */ = { - isa = PBXReferenceProxy; - fileType = wrapper.application; - path = "DemoCrash-iOS-Device.app"; - remoteRef = 749A3A6A18D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A6D18D889BE000AD2DB /* DemoCrash-iOS-Simulator.app */ = { - isa = PBXReferenceProxy; - fileType = wrapper.application; - path = "DemoCrash-iOS-Simulator.app"; - remoteRef = 749A3A6C18D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 749A3A6F18D889BE000AD2DB /* Fuzz Testing */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.executable"; - path = "Fuzz Testing"; - remoteRef = 749A3A6E18D889BE000AD2DB /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86B621DDB331005E2451 /* Sparkle.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = Sparkle.framework; - remoteRef = BA6E86B521DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86B821DDB331005E2451 /* Sparkle Test App.app */ = { - isa = PBXReferenceProxy; - fileType = wrapper.application; - path = "Sparkle Test App.app"; - remoteRef = BA6E86B721DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86BA21DDB331005E2451 /* Sparkle Unit Tests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "Sparkle Unit Tests.xctest"; - remoteRef = BA6E86B921DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86BC21DDB331005E2451 /* BinaryDelta */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.executable"; - path = BinaryDelta; - remoteRef = BA6E86BB21DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86BE21DDB331005E2451 /* Autoupdate.app */ = { - isa = PBXReferenceProxy; - fileType = wrapper.application; - path = Autoupdate.app; - remoteRef = BA6E86BD21DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86C021DDB331005E2451 /* UI Tests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "UI Tests.xctest"; - remoteRef = BA6E86BF21DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86C221DDB331005E2451 /* fileop */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.executable"; - path = fileop; - remoteRef = BA6E86C121DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86C421DDB331005E2451 /* generate_appcast */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.executable"; - path = generate_appcast; - remoteRef = BA6E86C321DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86C621DDB331005E2451 /* generate_keys */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.executable"; - path = generate_keys; - remoteRef = BA6E86C521DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA6E86C821DDB331005E2451 /* sign_update */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.executable"; - path = sign_update; - remoteRef = BA6E86C721DDB331005E2451 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA7DB6D221F9C7660059239B /* MASShortcut.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = MASShortcut.framework; - remoteRef = BA7DB6D121F9C7660059239B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA7DB6D421F9C7660059239B /* MASShortcutTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = MASShortcutTests.xctest; - remoteRef = BA7DB6D321F9C7660059239B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BA7DB6D621F9C7660059239B /* Demo.app */ = { - isa = PBXReferenceProxy; - fileType = wrapper.application; - path = Demo.app; - remoteRef = BA7DB6D521F9C7660059239B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BAD858A3228EAE0E00226C71 /* Bugsnag.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = Bugsnag.framework; - remoteRef = BAD858A2228EAE0E00226C71 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - BAD858A5228EAE0E00226C71 /* Tests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = Tests.xctest; - remoteRef = BAD858A4228EAE0E00226C71 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -1920,7 +1415,6 @@ 3C0158F01C7B414E00FE63AA /* LoadMoreCell.xib in Resources */, BA13D21B2269E0B500EB3833 /* CalendarViewController.xib in Resources */, 74D1D27417EB72D900E709B0 /* TimerEditViewController.xib in Resources */, - 74AA9475180909F50000539F /* GTMOAuth2Window.xib in Resources */, 3C1E013F19D2DAE300DBF9A5 /* dsa_pub.pem in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1928,6 +1422,28 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 1276406FB7B983D0C81B35AE /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-TogglDesktop-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 7407F1F41AA80466000380C4 /* Run Script (Fix dynamic library paths in Frameworks) */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1956,6 +1472,25 @@ shellPath = /usr/bin/ruby; shellScript = "if ENV[\"DEBUG_INFORMATION_FORMAT\"] != \"dwarf-with-dsym\"\nexit\nend\n\nfork do\nProcess.setsid\nSTDIN.reopen(\"/dev/null\")\nSTDOUT.reopen(\"/dev/null\", \"a\")\nSTDERR.reopen(\"/dev/null\", \"a\")\n\nrequire 'shellwords'\n\nDir[\"#{ENV[\"DWARF_DSYM_FOLDER_PATH\"]}/#{ENV[\"DWARF_DSYM_FILE_NAME\"]}/Contents/Resources/DWARF/*\"].each do |dsym|\nsystem(\"curl -F dsym=@#{Shellwords.escape(dsym)} -F projectRoot=#{Shellwords.escape(ENV[\"PROJECT_DIR\"])} https://upload.bugsnag.com/\")\nend\nend"; }; + B984F0D8FC24E4374FFADFBB /* Upload Bugsnag dSYM */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Upload Bugsnag dSYM"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = "/usr/bin/env ruby"; + shellScript = "# Bugsnag key\napi_key = \"aa13053a88d5133b688db0f25ec103b7\"\n\nfork do\n Process.setsid\n STDIN.reopen(\"/dev/null\")\n STDOUT.reopen(\"/dev/null\", \"a\")\n STDERR.reopen(\"/dev/null\", \"a\")\n\n require 'shellwords'\n\n Dir[\"#{ENV[\"DWARF_DSYM_FOLDER_PATH\"]}/*/Contents/Resources/DWARF/*\"].each do |dsym|\n curl_command = \"curl -F dsym=@#{Shellwords.escape(dsym)} -F projectRoot=#{Shellwords.escape(ENV[\"PROJECT_DIR\"])} \"\n curl_command += \"-F apiKey=#{Shellwords.escape(api_key)} \" if api_key\n curl_command += \"https://upload.bugsnag.com/\"\n system(curl_command)\n end\nend\n"; + showEnvVarsInLog = 0; + }; BA6406F121C8FC690074BC96 /* Run Formatter */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1974,6 +1509,36 @@ shellPath = /bin/sh; shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nset -e\n\nif ! which uncrustify > /dev/null; then\n echo \"warning: Uncrustify is not installed.\"\nelse\n cd $SRCROOT/../../../../\n make fmt\nfi\n"; }; + CE4DD35122BF90B10398A0A6 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-TogglDesktop/Pods-TogglDesktop-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/AppAuth/AppAuth.framework", + "${BUILT_PRODUCTS_DIR}/Bugsnag/Bugsnag.framework", + "${BUILT_PRODUCTS_DIR}/GTMAppAuth/GTMAppAuth.framework", + "${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework", + "${BUILT_PRODUCTS_DIR}/MASShortcut/MASShortcut.framework", + "${PODS_ROOT}/Sparkle/Sparkle.framework", + "${PODS_ROOT}/Sparkle/Sparkle.framework.dSYM", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppAuth.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Bugsnag.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMAppAuth.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MASShortcut.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sparkle.framework", + "${DWARF_DSYM_FOLDER_PATH}/Sparkle.framework.dSYM", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-TogglDesktop/Pods-TogglDesktop-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -1987,7 +1552,9 @@ 3CC450E91A31ED540012440B /* NSTextFieldDuration.m in Sources */, 7424949E17F1E3D20030121C /* UIEvents.m in Sources */, BA13D2152269C01500EB3833 /* Date+Utils.swift in Sources */, + BA5B0E502330EA92008D1DED /* GoogleAuthenticationServer+Objc.swift in Sources */, BAAF56A02223DF9A003D0D73 /* VertificalTimeEntryFlowLayout.swift in Sources */, + BA01E8A1232F77B3006B93EC /* ClickableImageView.m in Sources */, C5CB7F0417F43EE100A2AEB1 /* TimeEntryCell.m in Sources */, C5DA1FBF17F1B08A001C4565 /* MainWindowController.m in Sources */, BAE6379A22B225C70024DD08 /* AddTagButton.swift in Sources */, @@ -2002,7 +1569,6 @@ BA13D2172269DE3400EB3833 /* NoVibrantPopoverView.swift in Sources */, 3C6B2488203E01D90063FC08 /* AutoCompleteTable.m in Sources */, BA412C1D224E0D61003CA17A /* ClientDataSource.swift in Sources */, - 74AA9472180909F50000539F /* GTMHTTPFetchHistory.m in Sources */, BA6EB8402248CBE3003BB8EF /* ProjectStorage.swift in Sources */, BAAF567E2223CAC5003D0D73 /* NSButton+TextColor.swift in Sources */, BA6EB8942249DB33003BB8EF /* VerticallyCenteredTextFieldCell.swift in Sources */, @@ -2056,7 +1622,6 @@ BA6F1B1A21EEE258009265E4 /* NSColor+Utils.swift in Sources */, BA4059B7221D46F4002969B8 /* TimeEntryCollectionView.m in Sources */, BA4059AF221D215A002969B8 /* TimeHeaderView.swift in Sources */, - 74AA9476180909F50000539F /* GTMOAuth2WindowController.m in Sources */, BA89CB392265EA4400D21584 /* String+Search.swift in Sources */, BA9C2E08224C854C002AD2A1 /* ProjectColor.swift in Sources */, BA01404622570805000E5B91 /* TagCellView.swift in Sources */, @@ -2073,7 +1638,6 @@ BA7D334F224897FC00B953A8 /* ProjectHeaderCellView.swift in Sources */, BAE49CAE222FC1C900773814 /* TimerContainerBox.swift in Sources */, BA13D20A2269BA6500EB3833 /* CalendarDataSource.swift in Sources */, - 74AA9474180909F50000539F /* GTMOAuth2SignIn.m in Sources */, BA053659225DDDBB00C26E1F /* CustomFocusRingButton.swift in Sources */, BA7D335E2248B48000B953A8 /* AutoCompleteTextField.swift in Sources */, BA763B7B2268601700DC245A /* PopoverRootView.swift in Sources */, @@ -2094,7 +1658,6 @@ 3C3AF64E20ACC6280088A3A6 /* CountryViewItem.m in Sources */, BA13D2062269B7C400EB3833 /* CalendarViewController.swift in Sources */, BAF6319C21E6F868002DD6AB /* NotificationCenter+MainThread.swift in Sources */, - 74AA9471180909F50000539F /* GTMHTTPFetcher.m in Sources */, BAFBFCC821CD1D3C004B443F /* SystemService.m in Sources */, BAF50DF821A2A18D0090BA95 /* AppIconFactory.m in Sources */, 74A7346A18297DD100525BBC /* ConvertHexColor.m in Sources */, @@ -2109,6 +1672,7 @@ 3C2F239D21A7B43400CBE6BC /* UnsupportedNotice.m in Sources */, 741104BF18C7682700BC7A49 /* NSTextFieldWithBackground.m in Sources */, BA80BEB2221EAE6F00BDFD35 /* Array+ByGroup.swift in Sources */, + BA067642233A492F00485C3C /* TogglApplication.m in Sources */, 74F8FBA318313FA6000F09EE /* NSTextFieldClickable.m in Sources */, BA35B22122E6E9E200FA560E /* Key.swift in Sources */, BA7B4BCB21C0EF8800B75B14 /* NSAlert+Utils.m in Sources */, @@ -2120,11 +1684,11 @@ BA014050225710FD000E5B91 /* TagAutoCompleteTextField.swift in Sources */, BAE8E845224CA9AC006D534E /* ProjectAutoCompleteTextField.swift in Sources */, BA6572A7224DFA6F00BA4C60 /* HSBGen.swift in Sources */, + BA5B0E4E2330E1C6008D1DED /* GoogleAuthenticationServer.swift in Sources */, BA8B4C752251FAD500592BC7 /* WorkspaceCellView.swift in Sources */, BA2E3F2C22375E640035D034 /* NSView+Appearance.swift in Sources */, 743D782A182791FA00978BCC /* idler.c in Sources */, BA9C2DF8224C7E44002AD2A1 /* ProjectCreationView.swift in Sources */, - 74AA9473180909F50000539F /* GTMOAuth2Authentication.m in Sources */, BA412BFC224E0CBE003CA17A /* ClientStorage.swift in Sources */, BA7B4C7C21C293E700B75B14 /* String+Optional.swift in Sources */, BA6572A8224DFA6F00BA4C60 /* CurrentColorView.swift in Sources */, @@ -2149,26 +1713,6 @@ name = TogglDesktopLibrary; targetProxy = 74456B9B1A77486B002A6338 /* PBXContainerItemProxy */; }; - 749A3A7318D89F23000AD2DB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "CrashReporter-MacOSX"; - targetProxy = 749A3A7218D89F23000AD2DB /* PBXContainerItemProxy */; - }; - BA6E873821DDC1E2005E2451 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Sparkle; - targetProxy = BA6E873721DDC1E2005E2451 /* PBXContainerItemProxy */; - }; - BA7DB6E621F9C77A0059239B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = MASShortcut; - targetProxy = BA7DB6E521F9C77A0059239B /* PBXContainerItemProxy */; - }; - BAD858CA228EAE6500226C71 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Bugsnag; - targetProxy = BAD858C9228EAE6500226C71 /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -2305,15 +1849,18 @@ }; 69FC182317E6534500B96425 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 3A54C9591227E723FEC0DB85 /* Pods-TogglDesktop.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LIBRARY = "compiler-default"; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = TogglDesktop/TogglDesktop.entitlements; CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = B227VTMZ94; + ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)", @@ -2359,16 +1906,19 @@ }; 69FC182417E6534500B96425 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B671ACF75B3267B013176BD7 /* Pods-TogglDesktop.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LIBRARY = "compiler-default"; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = TogglDesktop/TogglDesktop.entitlements; CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEVELOPMENT_TEAM = B227VTMZ94; + ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)", diff --git a/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/xcshareddata/xcschemes/TogglDesktop-Production.xcscheme b/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/xcshareddata/xcschemes/TogglDesktop-Production.xcscheme new file mode 100644 index 0000000000..a2befd7a09 --- /dev/null +++ b/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/xcshareddata/xcschemes/TogglDesktop-Production.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/xcshareddata/xcschemes/TogglDesktop.xcscheme b/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/xcshareddata/xcschemes/TogglDesktop.xcscheme new file mode 100644 index 0000000000..3ada2a258a --- /dev/null +++ b/src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj/xcshareddata/xcschemes/TogglDesktop.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ui/osx/TogglDesktop/TogglDesktop/TogglDesktop.entitlements b/src/ui/osx/TogglDesktop/TogglDesktop/TogglDesktop.entitlements new file mode 100644 index 0000000000..8cc185af8d --- /dev/null +++ b/src/ui/osx/TogglDesktop/TogglDesktop/TogglDesktop.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.cs.disable-library-validation + + + diff --git a/src/ui/osx/TogglDesktop/UIEvents.h b/src/ui/osx/TogglDesktop/UIEvents.h index ac8da72c4b..6d28a322ca 100644 --- a/src/ui/osx/TogglDesktop/UIEvents.h +++ b/src/ui/osx/TogglDesktop/UIEvents.h @@ -10,7 +10,6 @@ // Commands, backend <- UI extern NSString *const kCommandNew; -extern NSString *const kCommandNewShortcut; extern NSString *const kCommandStop; extern NSString *const kCommandContinue; diff --git a/src/ui/osx/TogglDesktop/UIEvents.m b/src/ui/osx/TogglDesktop/UIEvents.m index 956f659f94..664dda279a 100644 --- a/src/ui/osx/TogglDesktop/UIEvents.m +++ b/src/ui/osx/TogglDesktop/UIEvents.m @@ -9,7 +9,6 @@ #import "UIEvents.h" NSString *const kCommandNew = @"New"; -NSString *const kCommandNewShortcut = @"NewShortcut"; NSString *const kCommandStop = @"Stop"; NSString *const kCommandContinue = @"Continue"; diff --git a/src/ui/osx/TogglDesktop/test2/AppDelegate.h b/src/ui/osx/TogglDesktop/test2/AppDelegate.h index 5caea3f8fd..824b0b40c1 100644 --- a/src/ui/osx/TogglDesktop/test2/AppDelegate.h +++ b/src/ui/osx/TogglDesktop/test2/AppDelegate.h @@ -11,7 +11,10 @@ @class AutocompleteItem; @class Reachability; +@protocol OIDExternalUserAgentSession; + @interface AppDelegate : NSObject +@property (strong, nonatomic) id currentAuthorizationFlow; @property (strong, nonatomic) NSStatusItem *statusItem; @property (strong, nonatomic) Reachability *reach; - (IBAction)onPreferencesMenuItem:(id)sender; @@ -28,4 +31,5 @@ - (IBAction)onHideMenuItem:(id)sender; - (IBAction)onSendFeedbackMainMenuItem:(id)sender; - (IBAction)onConsoleMenuItem:(id)sender; +- (NSString *)currentChannel; @end diff --git a/src/ui/osx/TogglDesktop/test2/AppDelegate.m b/src/ui/osx/TogglDesktop/test2/AppDelegate.m index dda6b40846..c2190d379f 100644 --- a/src/ui/osx/TogglDesktop/test2/AppDelegate.m +++ b/src/ui/osx/TogglDesktop/test2/AppDelegate.m @@ -13,7 +13,6 @@ #import "AutotrackerRuleItem.h" #import #import "ConsoleViewController.h" -#import "CrashReporter.h" #import "DisplayCommand.h" #import "FeedbackWindowController.h" #import "IdleEvent.h" @@ -36,6 +35,7 @@ #import "AppIconFactory.h" #import #import "Reachability.h" +#import @interface AppDelegate () @property (nonatomic, strong) MainWindowController *mainWindowController; @@ -130,21 +130,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification self.mainWindowController = [[MainWindowController alloc] initWithWindowNibName:@"MainWindowController"]; [self.mainWindowController.window setReleasedWhenClosed:NO]; - PLCrashReporter *crashReporter = [self configuredCrashReporter]; - - // Check if we previously crashed - if ([crashReporter hasPendingCrashReport]) - { - [self handleCrashReport]; - } - - // Enable the Crash Reporter - NSError *error; - if (![crashReporter enableCrashReporterAndReturnError:&error]) - { - NSLog(@"Warning: Could not enable crash reporter: %@", error); - } - if (self.forceCrash) { abort(); @@ -315,6 +300,9 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification } [self hideConsoleMenuIfNeed]; + + // Setup Google Service Callback + [self registerGoogleEventHandler]; } - (void)systemWillPowerOff:(NSNotification *)aNotification @@ -907,6 +895,21 @@ - (void)indicateStoppedTimer [self.runningTimeEntryMenuItem setTitle:@"Timer is not tracking"]; } +- (NSMenu *)applicationDockMenu:(NSApplication *)sender { + NSMenu *menu = [[NSMenu alloc] init]; + + [menu addItemWithTitle:@"Start New" + action:@selector(onNewMenuItem:) + keyEquivalent:@"n"].tag = kMenuItemTagNew; + [menu addItemWithTitle:@"Continue Latest" + action:@selector(onContinueMenuItem:) + keyEquivalent:@"o"].tag = kMenuItemTagContinue; + [menu addItemWithTitle:@"Stop Timer" + action:@selector(onStopMenuItem:) + keyEquivalent:@"s"].tag = kMenuItemTagStop; + return menu; +} + - (void)createStatusItem { NSAssert([NSThread isMainThread], @"Rendering stuff should happen on main thread"); @@ -995,7 +998,7 @@ - (IBAction)onConsoleMenuItem:(id)sender - (void)onNewMenuItem:(id)sender { - [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kCommandNewShortcut + [[NSNotificationCenter defaultCenter] postNotificationOnMainThread:kCommandNew object:[[TimeEntryViewItem alloc] init]]; } @@ -1432,77 +1435,6 @@ - (void)displayIdleNotification:(IdleEvent *)idleEvent [self.idleNotificationWindowController displayIdleEvent:idleEvent]; } -- (PLCrashReporter *)configuredCrashReporter -{ - PLCrashReporterConfig *config = [[PLCrashReporterConfig alloc] - initWithSignalHandlerType:PLCrashReporterSignalHandlerTypeBSD - symbolicationStrategy:PLCrashReporterSymbolicationStrategyAll]; - - return [[PLCrashReporter alloc] initWithConfiguration:config]; -} - -- (void)handleCrashReport -{ - PLCrashReporter *crashReporter = [self configuredCrashReporter]; - - NSError *error; - NSData *crashData = [crashReporter loadPendingCrashReportDataAndReturnError:&error]; - - if (crashData == nil) - { - NSLog(@"Could not load crash report: %@", error); - [crashReporter purgePendingCrashReport]; - return; - } - - PLCrashReport *report = [[PLCrashReport alloc] initWithData:crashData - error:&error]; - if (report == nil) - { - NSLog(@"Could not parse crash report"); - [crashReporter purgePendingCrashReport]; - return; - } - - NSString *summary = [NSString stringWithFormat:@"Crashed with signal %@ (code %@)", - report.signalInfo.name, - report.signalInfo.code]; - - NSString *humanReadable = [PLCrashReportTextFormatter stringValueForCrashReport:report - withTextFormat:PLCrashReportTextFormatiOS]; - NSLog(@"Crashed on %@", report.systemInfo.timestamp); - NSLog(@"Report: %@", humanReadable); - - NSException *exception; - if (report.hasExceptionInfo) - { - exception = [NSException - exceptionWithName:report.exceptionInfo.exceptionName - reason:report.exceptionInfo.exceptionReason - userInfo:nil]; - } - else - { - exception = [NSException - exceptionWithName:summary - reason:humanReadable - userInfo:nil]; - } - char *str = toggl_get_update_channel(ctx); - NSString *channel = [NSString stringWithUTF8String:str]; - free(str); - - [Bugsnag notify:exception - block:^(BugsnagCrashReport *report) { - NSDictionary *data = @{ - @"channel": channel - }; - [report addMetadata:data toTabWithName:@"metadata"]; - }]; - - [crashReporter purgePendingCrashReport]; -} - - (void)reachabilityChanged:(NSNotification *)notice { NetworkStatus remoteHostStatus = [self.reach currentReachabilityStatus]; @@ -1824,4 +1756,34 @@ - (void)hideConsoleMenuIfNeed #endif } +#pragma mark - Google Authentication + +- (void)registerGoogleEventHandler +{ + NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; + + [appleEventManager setEventHandler:self + andSelector:@selector(handleGetURLEvent:withReplyEvent:) + forEventClass:kInternetEventClass + andEventID:kAEGetURL]; +} + +- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event + withReplyEvent:(NSAppleEventDescriptor *)replyEvent +{ + NSString *URLString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; + NSURL *URL = [NSURL URLWithString:URLString]; + + [_currentAuthorizationFlow resumeExternalUserAgentFlowWithURL:URL]; +} + +- (NSString *)currentChannel +{ + char *str = toggl_get_update_channel(ctx); + NSString *channel = [NSString stringWithUTF8String:str]; + + free(str); + return channel; +} + @end diff --git a/src/ui/osx/TogglDesktop/test2/ClickableImageView.h b/src/ui/osx/TogglDesktop/test2/ClickableImageView.h new file mode 100644 index 0000000000..4413a553c2 --- /dev/null +++ b/src/ui/osx/TogglDesktop/test2/ClickableImageView.h @@ -0,0 +1,25 @@ +// +// ClickableImageView.h +// TogglDesktop +// +// Created by Nghia Tran on 9/16/19. +// Copyright © 2019 Alari. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol ClickableImageViewDelegate + +- (void)imageViewOnClick:(id)sender; + +@end + +@interface ClickableImageView : NSImageView + +@property (weak, nonatomic) id delegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ui/osx/TogglDesktop/test2/ClickableImageView.m b/src/ui/osx/TogglDesktop/test2/ClickableImageView.m new file mode 100644 index 0000000000..b7f3ea5638 --- /dev/null +++ b/src/ui/osx/TogglDesktop/test2/ClickableImageView.m @@ -0,0 +1,18 @@ +// +// ClickableImageView.m +// TogglDesktop +// +// Created by Nghia Tran on 9/16/19. +// Copyright © 2019 Alari. All rights reserved. +// + +#import "ClickableImageView.h" + +@implementation ClickableImageView + +- (void)mouseDown:(NSEvent *)theEvent +{ + [self.delegate imageViewOnClick:self]; +} + +@end diff --git a/src/ui/osx/TogglDesktop/test2/ProjectTextField.m b/src/ui/osx/TogglDesktop/test2/ProjectTextField.m index 138fa32caa..8b8910d496 100644 --- a/src/ui/osx/TogglDesktop/test2/ProjectTextField.m +++ b/src/ui/osx/TogglDesktop/test2/ProjectTextField.m @@ -31,6 +31,11 @@ - (void)awakeFromNib self.renderClient = YES; } +- (void)mouseDown:(NSEvent *)theEvent +{ + [self sendAction:@selector(textFieldClicked:) to:[self delegate]]; +} + - (void)setAttributedStringValue:(NSAttributedString *)attributedStringValue { [super setAttributedStringValue:attributedStringValue]; @@ -127,6 +132,7 @@ - (NSColor *)clientTextColor - (void)setTextColor:(NSColor *)textColor { NSColor *visibleColor = [textColor visibleColor]; + [super setTextColor:visibleColor]; } diff --git a/src/ui/osx/TogglDesktop/test2/TimeEntryCell.m b/src/ui/osx/TogglDesktop/test2/TimeEntryCell.m index 8918b2f644..6d45dd9009 100644 --- a/src/ui/osx/TogglDesktop/test2/TimeEntryCell.m +++ b/src/ui/osx/TogglDesktop/test2/TimeEntryCell.m @@ -75,7 +75,7 @@ - (void)awakeFromNib { // We don't need to remove TrackingArea and create with new size after cell's size change bounds.size.width = NSScreen.mainScreen.frame.size.width; NSTrackingArea *tracking = [[NSTrackingArea alloc]initWithRect:bounds - options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow) + options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways) owner:self userInfo:nil]; [self.view addTrackingArea:tracking]; diff --git a/src/ui/osx/TogglDesktop/test2/TimeEntryCell.xib b/src/ui/osx/TogglDesktop/test2/TimeEntryCell.xib index 944c965ebd..d49ded0daa 100644 --- a/src/ui/osx/TogglDesktop/test2/TimeEntryCell.xib +++ b/src/ui/osx/TogglDesktop/test2/TimeEntryCell.xib @@ -1,8 +1,8 @@ - + - + @@ -62,7 +62,7 @@ - + @@ -157,12 +157,12 @@