commit fa18f7643e6b910e695fabbb596780097a724c33
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Jan 3 16:02:46 2023 +0100

    Unlock downloaded objects on download if we have everything in the app unlocked!

diff --git a/src/main/java/org/distorted/objects/RubikObjectList.java b/src/main/java/org/distorted/objects/RubikObjectList.java
index 7f5b17fc..9f319e30 100644
--- a/src/main/java/org/distorted/objects/RubikObjectList.java
+++ b/src/main/java/org/distorted/objects/RubikObjectList.java
@@ -22,6 +22,7 @@ import org.distorted.objectlib.main.ObjectSignatures;
 import org.distorted.objectlib.main.ObjectType;
 
 import static org.distorted.main.RubikActivity.SHOW_IAP_DEBUG;
+import static org.distorted.main.RubikActivity.USE_IAP;
 import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
 import static org.distorted.objectlib.main.ObjectType.NUM_OBJECTS;
 import static org.distorted.main.RubikActivity.SHOW_DOWNLOADED_DEBUG;
@@ -74,6 +75,15 @@ public class RubikObjectList
     createBuiltinObjects();
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private static boolean allObjectsUnlocked()
+    {
+    return mBoughtObjects!=null       &&
+           mBoughtObjects.length()>0  &&
+           mBoughtObjects.charAt(0)=='*';
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   private void createBuiltinObjects()
@@ -117,6 +127,12 @@ public class RubikObjectList
     mObjects.add(obj);
     mNumObjects++;
 
+    if( USE_IAP && !obj.isFree() && allObjectsUnlocked() )
+      {
+      if( SHOW_IAP_DEBUG ) android.util.Log.e("D", "everything unlocked, so setting downloaded object free: "+obj.getUpperName() );
+      obj.markFree();
+      }
+
     if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "creating downloaded object "+obj.getUpperName() );
 
     if( obj.hasExtras() )
@@ -257,13 +273,6 @@ public class RubikObjectList
       }
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public static boolean allAlreadyBought()
-    {
-    return mBoughtObjects.equals("*");
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public static boolean thereAreLockedObjects()
@@ -358,7 +367,7 @@ public class RubikObjectList
       editor.putString("rol_downloaded", "" );
       }
 
-    if( RubikActivity.USE_IAP )
+    if( USE_IAP )
       {
       editor.putString("rol_bought", mBoughtObjects);
 
@@ -436,7 +445,7 @@ public class RubikObjectList
     mObject = getOrdinal(objName);
     if( mObject<0 || mObject>=mNumObjects ) mObject = DEF_OBJECT;
 
-    if( RubikActivity.USE_IAP && justStarted ) restoreFreedObjects(preferences);
+    if( USE_IAP && justStarted ) restoreFreedObjects(preferences);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
