claimDailyReward function

Future claimDailyReward(
  1. int uid, {
  2. bool chinese = false,
  3. dynamic lang = 'en-us',
})

Implementation

Future claimDailyReward(int uid, {bool chinese = false, lang = 'en-us'}) async {
  var info = await getDailyRewardInfo(chinese: chinese);

  if (info.signedIn) return;

  const params = {};

  if (chinese) {
    params['game_uid'] = uid;
    params['region'] = recognizeServer(uid);
  }

  params['lang'] = lang;
  await fetchDailyEndpoint('sign',
      chinese: chinese, kwargs: {'method': 'POST', 'params': params});
  var rewards = await getMonthlyReward(chinese: chinese, lang: lang);

  return rewards[info.claimedReward];
}