flow improvements
This commit is contained in:
+15
-5
@@ -31,7 +31,16 @@ static std::map<AccountUid, User> mUsers;
|
||||
|
||||
Result Account::init(void)
|
||||
{
|
||||
return accountInitialize(AccountServiceType_Application);
|
||||
Result res = accountInitialize(AccountServiceType_Application);
|
||||
if (R_FAILED(res)) return res;
|
||||
|
||||
AccountUid uids[8];
|
||||
s32 count = 0;
|
||||
accountListAllUsers(uids, 8, &count);
|
||||
for (s32 i = 0; i < count; i++) {
|
||||
Account::username(uids[i]); // populates mUsers as side effect
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Account::exit(void)
|
||||
@@ -55,11 +64,12 @@ static User getUser(AccountUid id)
|
||||
AccountProfileBase profilebase;
|
||||
memset(&profilebase, 0, sizeof(profilebase));
|
||||
|
||||
if (R_SUCCEEDED(accountGetProfile(&profile, id)) && R_SUCCEEDED(accountProfileGet(&profile, NULL, &profilebase))) {
|
||||
user.name = std::string(profilebase.nickname);
|
||||
if (R_SUCCEEDED(accountGetProfile(&profile, id))) {
|
||||
if (R_SUCCEEDED(accountProfileGet(&profile, NULL, &profilebase))) {
|
||||
user.name = std::string(profilebase.nickname);
|
||||
}
|
||||
accountProfileClose(&profile);
|
||||
}
|
||||
|
||||
accountProfileClose(&profile);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user