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

Commit ac7353f

Browse files
committed
Make methods returning only noError return nothing (lib)
1 parent 8939ccd commit ac7353f

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

src/context.cc

+14-18
Original file line numberDiff line numberDiff line change
@@ -2746,14 +2746,14 @@ error Context::Login(
27462746
}
27472747
}
27482748

2749-
error Context::AsyncSignup(const std::string &email,
2749+
void Context::AsyncSignup(const std::string &email,
27502750
const std::string &password,
27512751
const uint64_t country_id) {
27522752
std::thread backgroundThread([&](std::string email, std::string password, uint64_t country_id) {
27532753
return this->Signup(email, password, country_id);
27542754
}, email, password, country_id);
27552755
backgroundThread.detach();
2756-
return noError;
2756+
return;
27572757
}
27582758

27592759
error Context::Signup(
@@ -2782,13 +2782,13 @@ error Context::GoogleSignup(
27822782
return Login(access_token, kGoogleAccessToken, true);
27832783
}
27842784

2785-
error Context::AsyncGoogleSignup(const std::string &access_token,
2785+
void Context::AsyncGoogleSignup(const std::string &access_token,
27862786
const uint64_t country_id) {
27872787
std::thread backgroundThread([&](std::string access_token, uint64_t country_id) {
27882788
return this->GoogleSignup(access_token, country_id);
27892789
}, access_token, country_id);
27902790
backgroundThread.detach();
2791-
return noError;
2791+
return;
27922792
}
27932793

27942794
error Context::AppleSignup(
@@ -2803,15 +2803,15 @@ error Context::AppleSignup(
28032803
return Login(access_token, kAppleAccessToken, true);
28042804
}
28052805

2806-
error Context::AsyncAppleSignup(
2806+
void Context::AsyncAppleSignup(
28072807
const std::string &access_token,
28082808
const uint64_t country_id,
28092809
const std::string &full_name) {
28102810
std::thread backgroundThread([&](std::string access_token, uint64_t country_id, std::string full_name) {
28112811
return this->AppleSignup(access_token, country_id, full_name);
28122812
}, access_token, country_id, full_name);
28132813
backgroundThread.detach();
2814-
return noError;
2814+
return;
28152815
}
28162816

28172817
void Context::setUser(User *value, const bool logged_in) {
@@ -5751,12 +5751,8 @@ error Context::pushChanges(
57515751
}
57525752

57535753
// Update project id on time entries if needed
5754-
err = updateEntryProjects(
5755-
projects,
5756-
time_entries);
5757-
if (err != noError) {
5758-
return err;
5759-
}
5754+
updateEntryProjects(projects, time_entries);
5755+
57605756
project_stopwatch.stop();
57615757
ss << " | " << projects.size() << " projects in "
57625758
<< project_stopwatch.elapsed() / 1000 << " ms";
@@ -5897,7 +5893,7 @@ error Context::pushProjects(
58975893
return err;
58985894
}
58995895

5900-
error Context::updateProjectClients(const std::vector<Client *> &clients,
5896+
void Context::updateProjectClients(const std::vector<Client *> &clients,
59015897
const std::vector<Project *> &projects) {
59025898
for (auto it = projects.cbegin(); it != projects.cend(); ++it) {
59035899
if (!(*it)->CID() && !(*it)->ClientGUID().empty()) {
@@ -5911,10 +5907,10 @@ error Context::updateProjectClients(const std::vector<Client *> &clients,
59115907
}
59125908
}
59135909

5914-
return noError;
5910+
return;
59155911
}
59165912

5917-
error Context::updateEntryProjects(const std::vector<Project *> &projects,
5913+
void Context::updateEntryProjects(const std::vector<Project *> &projects,
59185914
const std::vector<TimeEntry *> &time_entries) {
59195915
for (std::vector<TimeEntry *>::const_iterator it =
59205916
time_entries.begin();
@@ -5932,7 +5928,7 @@ error Context::updateEntryProjects(const std::vector<Project *> &projects,
59325928
}
59335929
}
59345930

5935-
return noError;
5931+
return;
59365932
}
59375933

59385934
error Context::pushEntries(
@@ -6776,10 +6772,10 @@ error Context::ToSAccept() {
67766772
return noError;
67776773
}
67786774

6779-
error Context::ToggleEntriesGroup(std::string name) {
6775+
void Context::ToggleEntriesGroup(std::string name) {
67806776
entry_groups[name] = !entry_groups[name];
67816777
OpenTimeEntryList();
6782-
return noError;
6778+
return;
67836779
}
67846780

67856781
error Context::AsyncPullCountries() {

src/context.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource {
304304
const std::string &password,
305305
const bool isSignup = false);
306306

307-
error AsyncSignup(
307+
void AsyncSignup(
308308
const std::string &email,
309309
const std::string &password,
310310
const uint64_t country_id);
@@ -318,7 +318,7 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource {
318318
const std::string &access_token,
319319
const uint64_t country_id);
320320

321-
error AsyncGoogleSignup(
321+
void AsyncGoogleSignup(
322322
const std::string &access_token,
323323
const uint64_t country_id);
324324

@@ -327,7 +327,7 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource {
327327
const uint64_t country_id,
328328
const std::string &full_name);
329329

330-
error AsyncAppleSignup(
330+
void AsyncAppleSignup(
331331
const std::string &access_token,
332332
const uint64_t country_id,
333333
const std::string &full_name);
@@ -561,7 +561,7 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource {
561561
const int64_t promotion_type,
562562
const int64_t promotion_response);
563563

564-
error ToggleEntriesGroup(
564+
void ToggleEntriesGroup(
565565
std::string name);
566566

567567
error AsyncPullCountries();
@@ -729,10 +729,10 @@ class TOGGL_INTERNAL_EXPORT Context : public TimelineDatasource {
729729
const std::map<std::string, BaseModel *> &models,
730730
const std::vector<TimeEntry *> &time_entries,
731731
const std::string &api_token);
732-
error updateProjectClients(
732+
void updateProjectClients(
733733
const std::vector<Client *> &clients,
734734
const std::vector<Project *> &projects);
735-
error updateEntryProjects(
735+
void updateEntryProjects(
736736
const std::vector<Project *> &projects,
737737
const std::vector<TimeEntry *> &time_entries);
738738
error signup(

src/toggl_api.cc

+13-5
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,11 @@ bool_t toggl_signup_async(
464464
const char_t *email,
465465
const char_t *password,
466466
const uint64_t country_id) {
467-
return toggl::noError == app(context)->AsyncSignup(to_string(email),
468-
to_string(password), country_id);
467+
468+
app(context)->AsyncSignup(to_string(email),
469+
to_string(password),
470+
country_id);
471+
return true;
469472
}
470473

471474
bool_t toggl_google_signup(
@@ -480,8 +483,10 @@ bool_t toggl_google_signup_async(
480483
void *context,
481484
const char_t *access_token,
482485
const uint64_t country_id) {
483-
return toggl::noError == app(context)->AsyncGoogleSignup(to_string(access_token),
484-
country_id);
486+
487+
app(context)->AsyncGoogleSignup(to_string(access_token),
488+
country_id);
489+
return true;
485490
}
486491

487492
bool_t toggl_apple_signup(
@@ -505,7 +510,10 @@ bool_t toggl_apple_signup_async(
505510
if (full_name) {
506511
name = to_string(full_name);
507512
}
508-
return toggl::noError == app(context)->AsyncAppleSignup(to_string(access_token), country_id, name);
513+
app(context)->AsyncAppleSignup(to_string(access_token),
514+
country_id,
515+
name);
516+
return true;
509517
}
510518

511519
bool_t toggl_google_login(

0 commit comments

Comments
 (0)