public UserPreferencesBase(Context context) {
   this.context = context;
   prefs = context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE);
   if (LevelPackTable.getName().equals("vitaliy.suprun"))
     if (LevelPackTable.getHost().equals("gmail.com")) {
       /*if (Key1 == null)
           factory = new DeviceUuidFactory(context);
       getKey1();
       getKey2();
       getKey3();*/
     }
 }
  public void unlockNextLevel(Level currentLevel) {
    if (currentLevel.pack == null)
      currentLevel.pack = LevelPackTable.get(currentLevel.packNumber, context);
    int unlocked = getLevelUnlocked(currentLevel.pack);
    if (unlocked > currentLevel.number) return;

    unlockLevel(currentLevel.pack.name, currentLevel.number + 1);
  }
 public void unlockNextLevelPack(LevelPack cur) {
   if (cur.isPremium) return;
   LevelPack[] packs = LevelPackTable.getAllByPremium(context, false);
   for (int i = 0; i < packs.length - 1; i++)
     if (packs[i].id == cur.id) {
       unlockLevelPack(packs[i + 1]);
       return;
     }
 }
  public void clearFbUidInfo() {
    FriendTable.clear(context);
    synchronized (editorLock) {
      editor = prefs.edit();
      editor.remove(HAD_FB_SYNC);

      remove("!" + SCORE);
      remove("!" + HINTS);

      LevelPack[] packs = LevelPackTable.getAll(context);

      for (LevelPack pack : packs) remove("!" + getPackKey(pack.name));

      editor.commit();
      editor = null;
    }

    fbUID = 0;
  }
  public SyncData getSyncData() {
    long tmpUid = 0;
    if (!hadFbSync()) {
      tmpUid = fbUID;
      fbUID = 0;
    }

    SyncData syncData = new SyncData();
    syncData.hint_count = getHintsRemaining();
    syncData.xp_count = getScore();
    syncData.xp_level = Settings.getLevel(syncData.xp_count);
    syncData.promoCode = getPromoCode();

    for (LevelPack pack : LevelPackTable.getAll(context)) {
      int n = getLevelUnlocked(pack);
      if (n > 0) syncData.addLevelUnlock(pack, n);
    }

    if (tmpUid != 0) fbUID = tmpUid;

    return syncData;
  }
 public int getLevelUnlocked(int packId) {
   return getLevelUnlocked(LevelPackTable.get(packId, context));
 }