Revision 59aee296
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/main/RubikPreRender.java | ||
---|---|---|
380 | 380 |
private void requestReview() |
381 | 381 |
{ |
382 | 382 |
final RubikScores scores = RubikScores.getInstance(); |
383 |
int numRuns = scores.getNumRuns(); |
|
384 |
int numPlay = scores.getNumPlays(); |
|
385 |
int numReview = scores.getNumReviews(); |
|
383 |
int numWins = scores.incrementNumWins(); |
|
386 | 384 |
|
387 |
if( numRuns>=2 && numPlay>=5 ) scores.incrementNumReviews(); |
|
388 |
|
|
389 |
if( numReview==0 ) |
|
385 |
if( numWins==8 || numWins==35 || numWins==100 || numWins==200) |
|
390 | 386 |
{ |
391 | 387 |
final long timeBegin = System.currentTimeMillis(); |
392 | 388 |
final RubikActivity act = (RubikActivity)mView.getContext(); |
... | ... | |
409 | 405 |
@Override |
410 | 406 |
public void onFailure(Exception e) |
411 | 407 |
{ |
412 |
analyticsReport(act,"Review Flow Failed", name, timeBegin);
|
|
408 |
analyticsReport(act,"Failed", name, timeBegin); |
|
413 | 409 |
} |
414 | 410 |
}); |
415 | 411 |
|
... | ... | |
418 | 414 |
@Override |
419 | 415 |
public void onComplete(@NonNull Task<Void> task) |
420 | 416 |
{ |
421 |
analyticsReport(act,"Review Flow Complete", name, timeBegin);
|
|
417 |
analyticsReport(act,"Complete", name, timeBegin); |
|
422 | 418 |
} |
423 | 419 |
}); |
424 | 420 |
} |
425 | 421 |
else |
426 | 422 |
{ |
427 | 423 |
String name = scores.getName(); |
428 |
analyticsReport(act,"Request Review Flow not successful", name, timeBegin);
|
|
424 |
analyticsReport(act,"Not Successful", name, timeBegin);
|
|
429 | 425 |
} |
430 | 426 |
} |
431 | 427 |
}); |
src/main/java/org/distorted/scores/RubikScores.java | ||
---|---|---|
49 | 49 |
private boolean mNameIsVerified; |
50 | 50 |
private int mNumRuns; |
51 | 51 |
private int mNumPlays; |
52 |
private int mNumReviews;
|
|
52 |
private int mNumWins;
|
|
53 | 53 |
private int mDeviceID; |
54 | 54 |
|
55 | 55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
72 | 72 |
|
73 | 73 |
mNameIsVerified = false; |
74 | 74 |
|
75 |
mNumPlays = -1;
|
|
76 |
mNumRuns = -1;
|
|
77 |
mDeviceID = -1;
|
|
78 |
mNumReviews = 0;
|
|
75 |
mNumPlays= -1; |
|
76 |
mNumRuns = -1; |
|
77 |
mDeviceID= -1; |
|
78 |
mNumWins = 0;
|
|
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
243 | 243 |
return mNumRuns; |
244 | 244 |
} |
245 | 245 |
|
246 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
247 |
|
|
248 |
public int getNumReviews() |
|
249 |
{ |
|
250 |
return mNumReviews; |
|
251 |
} |
|
252 |
|
|
253 | 246 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
254 | 247 |
|
255 | 248 |
public String getName() |
... | ... | |
280 | 273 |
|
281 | 274 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
282 | 275 |
|
283 |
public void incrementNumReviews()
|
|
276 |
public int incrementNumWins()
|
|
284 | 277 |
{ |
285 |
mNumReviews++; |
|
278 |
mNumWins++; |
|
279 |
return mNumWins; |
|
286 | 280 |
} |
287 | 281 |
|
288 | 282 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
388 | 382 |
editor.putString("scores_name" , mName ); |
389 | 383 |
editor.putBoolean("scores_isVerified", mNameIsVerified); |
390 | 384 |
editor.putInt("scores_numPlays", mNumPlays); |
391 |
editor.putInt("scores_numRuns" , mNumRuns); |
|
385 |
editor.putInt("scores_numRuns" , mNumRuns );
|
|
392 | 386 |
editor.putInt("scores_deviceid", mDeviceID); |
393 |
editor.putInt("scores_review" , mNumReviews);
|
|
387 |
editor.putInt("scores_review" , mNumWins );
|
|
394 | 388 |
} |
395 | 389 |
|
396 | 390 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
461 | 455 |
mNumPlays = preferences.getInt("scores_numPlays", 0); |
462 | 456 |
mNumRuns = preferences.getInt("scores_numRuns" , 0); |
463 | 457 |
mDeviceID = preferences.getInt("scores_deviceid",-1); |
464 |
mNumReviews = preferences.getInt("scores_review" ,-3);
|
|
458 |
mNumWins = preferences.getInt("scores_review" , 0);
|
|
465 | 459 |
|
466 | 460 |
if( mDeviceID==-1 ) mDeviceID = privateGetDeviceID(); |
467 | 461 |
|
Also available in: Unified diff
Change the way we request for reviews.