Revision a4259b7f
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/main/RubikPreRender.java | ||
---|---|---|
369 | 369 |
int numPlay = scores.getNumPlays(); |
370 | 370 |
int numReview = scores.getNumReviews(); |
371 | 371 |
|
372 |
if( numRuns>=2 && numPlay>6 && numReview<1 ) |
|
372 |
if( numRuns>=2 && numPlay>=5 ) scores.incrementNumReviews(); |
|
373 |
|
|
374 |
if( numReview==0 ) |
|
373 | 375 |
{ |
376 |
final long timeBegin = System.currentTimeMillis(); |
|
374 | 377 |
final RubikActivity act = (RubikActivity)mView.getContext(); |
375 | 378 |
final ReviewManager manager = ReviewManagerFactory.create(act); |
376 | 379 |
Task<ReviewInfo> request = manager.requestReviewFlow(); |
... | ... | |
383 | 386 |
if (task.isSuccessful()) |
384 | 387 |
{ |
385 | 388 |
final String name = scores.getName(); |
386 |
scores.incrementNumReviews(); |
|
387 | 389 |
ReviewInfo reviewInfo = task.getResult(); |
388 | 390 |
Task<Void> flow = manager.launchReviewFlow(act, reviewInfo); |
389 | 391 |
|
... | ... | |
392 | 394 |
@Override |
393 | 395 |
public void onFailure(Exception e) |
394 | 396 |
{ |
395 |
analyticsReport(act,"Review Flow Failed", name); |
|
397 |
analyticsReport(act,"Review Flow Failed", name, timeBegin);
|
|
396 | 398 |
} |
397 | 399 |
}); |
398 | 400 |
|
... | ... | |
401 | 403 |
@Override |
402 | 404 |
public void onComplete(@NonNull Task<Void> task) |
403 | 405 |
{ |
404 |
analyticsReport(act,"Review Flow Complete", name); |
|
406 |
analyticsReport(act,"Review Flow Complete", name, timeBegin);
|
|
405 | 407 |
} |
406 | 408 |
}); |
407 | 409 |
} |
408 | 410 |
else |
409 | 411 |
{ |
410 | 412 |
String name = scores.getName(); |
411 |
analyticsReport(act,"Request review flow not successful", name); |
|
413 |
analyticsReport(act,"Request review flow not successful", name, timeBegin);
|
|
412 | 414 |
} |
413 | 415 |
} |
414 | 416 |
}); |
... | ... | |
417 | 419 |
|
418 | 420 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
419 | 421 |
|
420 |
private void analyticsReport(RubikActivity act, String message, String name) |
|
422 |
private void analyticsReport(RubikActivity act, String message, String name, long timeBegin)
|
|
421 | 423 |
{ |
424 |
long elapsed = System.currentTimeMillis() - timeBegin; |
|
425 |
|
|
422 | 426 |
if( BuildConfig.DEBUG ) |
423 | 427 |
{ |
424 | 428 |
android.util.Log.d("pre", message); |
425 | 429 |
android.util.Log.d("pre", name); |
430 |
android.util.Log.d("pre", "startTime: "+timeBegin+" elapsed: "+elapsed); |
|
426 | 431 |
} |
427 | 432 |
else |
428 | 433 |
{ |
... | ... | |
433 | 438 |
Bundle bundle = new Bundle(); |
434 | 439 |
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, message); |
435 | 440 |
bundle.putString(FirebaseAnalytics.Param.CHARACTER, name); |
441 |
bundle.putString(FirebaseAnalytics.Param.START_DATE, "startTime: "+timeBegin+" elapsed: "+elapsed); |
|
436 | 442 |
analytics.logEvent(FirebaseAnalytics.Event.CAMPAIGN_DETAILS, bundle); |
437 | 443 |
} |
438 | 444 |
} |
Also available in: Unified diff
adjust requesting for review a bit more - now it will happen after a user has launched the app twice and played 7 times.