Revision 00fcfefa
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
390 | 390 |
FirebaseAnalytics analytics = getAnalytics(); |
391 | 391 |
analytics.setUserId(scores.getName()); |
392 | 392 |
} |
393 |
|
|
394 |
// all old users upgrading from version <1.11.4, where there was no concept of 'stars', |
|
395 |
// get all the stars they have earned |
|
396 |
int numStars = scores.getNumStars(); |
|
397 |
|
|
398 |
if( numStars==0 && upgradingFromVersionWithNoStars(oldVersion) ) |
|
399 |
{ |
|
400 |
scores.correctNumStars(); |
|
401 |
} |
|
402 |
} |
|
403 |
|
|
404 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
405 |
|
|
406 |
private boolean upgradingFromVersionWithNoStars(String version) |
|
407 |
{ |
|
408 |
if( version!=null ) |
|
409 |
{ |
|
410 |
try |
|
411 |
{ |
|
412 |
int dot = version.indexOf('.',2); |
|
413 |
|
|
414 |
if( dot>2 ) |
|
415 |
{ |
|
416 |
String middle = version.substring(2,dot); |
|
417 |
int middleInt = Integer.parseInt(middle); |
|
418 |
|
|
419 |
if( middleInt<11 ) return true; |
|
420 |
if( middleInt==11 ) |
|
421 |
{ |
|
422 |
String end = version.substring(dot+1); |
|
423 |
int endInt = Integer.parseInt(end); |
|
424 |
return endInt<4; |
|
425 |
} |
|
426 |
} |
|
427 |
} |
|
428 |
catch(Exception ignored) {} |
|
429 |
} |
|
430 |
|
|
431 |
return false; |
|
393 | 432 |
} |
394 | 433 |
|
395 | 434 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
All users who are upgrading from a version <1.11.4, where there was no concept of 'stars', get all their stars.