UserEntity.user.dart 7.91 KB
// GENERATED CODE - DO NOT MODIFY BY HAND

// **************************************************************************
// UserGenerator
// **************************************************************************

import 'package:rxdart/rxdart.dart';
import 'package:gmalpha_flutter/commonModel/app_module.dart';

class UserEntityImpl {
  factory UserEntityImpl() => _sharedInstance();

  static UserEntityImpl _instance;

  UserEntityImpl._() {}

  static UserEntityImpl _sharedInstance() {
    if (_instance == null) {
      _instance = UserEntityImpl._();
    }
    return _instance;
  }

  String _userId;
  Observable<bool> saveuserId(String userId) {
    return Observable.fromFuture(mmKvUtil.saveStringKv("user_uid", userId))
        .map((value) {
      if (value) {
        this._userId = userId;
      }
      return value;
    });
  }

  Observable<String> getuserId() {
    if (_userId != null) {
      return Observable.fromFuture(Future.value(_userId));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("user_uid"));
  }

  String _nickName;
  Observable<bool> savenickName(String nickName) {
    return Observable.fromFuture(mmKvUtil.saveStringKv("username", nickName))
        .map((value) {
      if (value) {
        this._nickName = nickName;
      }
      return value;
    });
  }

  Observable<String> getnickName() {
    if (_nickName != null) {
      return Observable.fromFuture(Future.value(_nickName));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("username"));
  }

  String _profilePic;
  Observable<bool> saveprofilePic(String profilePic) {
    return Observable.fromFuture(mmKvUtil.saveStringKv("potrait", profilePic))
        .map((value) {
      if (value) {
        this._profilePic = profilePic;
      }
      return value;
    });
  }

  Observable<String> getprofilePic() {
    if (_profilePic != null) {
      return Observable.fromFuture(Future.value(_profilePic));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("potrait"));
  }

  bool _hasAnswered;
  Observable<bool> savehasAnswered(bool hasAnswered) {
    return Observable.fromFuture(
            mmKvUtil.saveBoolKv("personal_qa", hasAnswered))
        .map((value) {
      if (value) {
        this._hasAnswered = hasAnswered;
      }
      return value;
    });
  }

  Observable<bool> gethasAnswered() {
    if (_hasAnswered != null) {
      return Observable.fromFuture(Future.value(_hasAnswered));
    }
    return Observable.fromFuture(mmKvUtil.getBoolKv("personal_qa"));
  }

  bool _hasScanFace;
  Observable<bool> savehasScanFace(bool hasScanFace) {
    return Observable.fromFuture(
            mmKvUtil.saveBoolKv("has_scan_face", hasScanFace))
        .map((value) {
      if (value) {
        this._hasScanFace = hasScanFace;
      }
      return value;
    });
  }

  Observable<bool> gethasScanFace() {
    if (_hasScanFace != null) {
      return Observable.fromFuture(Future.value(_hasScanFace));
    }
    return Observable.fromFuture(mmKvUtil.getBoolKv("has_scan_face"));
  }

  String _gender;
  Observable<bool> savegender(String gender) {
    return Observable.fromFuture(mmKvUtil.saveStringKv("gender", gender))
        .map((value) {
      if (value) {
        this._gender = gender;
      }
      return value;
    });
  }

  Observable<String> getgender() {
    if (_gender != null) {
      return Observable.fromFuture(Future.value(_gender));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("gender"));
  }

  String _cityId;
  Observable<bool> savecityId(String cityId) {
    return Observable.fromFuture(
            mmKvUtil.saveStringKv("current_city_id", cityId))
        .map((value) {
      if (value) {
        this._cityId = cityId;
      }
      return value;
    });
  }

  Observable<String> getcityId() {
    if (_cityId != null) {
      return Observable.fromFuture(Future.value(_cityId));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("current_city_id"));
  }

  int _birth;
  Observable<bool> savebirth(int birth) {
    return Observable.fromFuture(mmKvUtil.saveIntKv("birthday", birth))
        .map((value) {
      if (value) {
        this._birth = birth;
      }
      return value;
    });
  }

  Observable<int> getbirth() {
    if (_birth != null) {
      return Observable.fromFuture(Future.value(_birth));
    }
    return Observable.fromFuture(mmKvUtil.getIntKv("birthday"));
  }

  String _countryId;
  Observable<bool> savecountryId(String countryId) {
    return Observable.fromFuture(mmKvUtil.saveStringKv("country_id", countryId))
        .map((value) {
      if (value) {
        this._countryId = countryId;
      }
      return value;
    });
  }

  Observable<String> getcountryId() {
    if (_countryId != null) {
      return Observable.fromFuture(Future.value(_countryId));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("country_id"));
  }

  bool _detailSetted;
  Observable<bool> savedetailSetted(bool detailSetted) {
    return Observable.fromFuture(
            mmKvUtil.saveBoolKv("detail_setted", detailSetted))
        .map((value) {
      if (value) {
        this._detailSetted = detailSetted;
      }
      return value;
    });
  }

  Observable<bool> getdetailSetted() {
    if (_detailSetted != null) {
      return Observable.fromFuture(Future.value(_detailSetted));
    }
    return Observable.fromFuture(mmKvUtil.getBoolKv("detail_setted"));
  }

  String _questionUrl;
  Observable<bool> savequestionUrl(String questionUrl) {
    return Observable.fromFuture(
            mmKvUtil.saveStringKv("question_url", questionUrl))
        .map((value) {
      if (value) {
        this._questionUrl = questionUrl;
      }
      return value;
    });
  }

  Observable<String> getquestionUrl() {
    if (_questionUrl != null) {
      return Observable.fromFuture(Future.value(_questionUrl));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("question_url"));
  }

  bool _isBind;
  Observable<bool> saveisBind(bool isBind) {
    return Observable.fromFuture(
            mmKvUtil.saveBoolKv("user_bind_mobile", isBind))
        .map((value) {
      if (value) {
        this._isBind = isBind;
      }
      return value;
    });
  }

  Observable<bool> getisBind() {
    if (_isBind != null) {
      return Observable.fromFuture(Future.value(_isBind));
    }
    return Observable.fromFuture(mmKvUtil.getBoolKv("user_bind_mobile"));
  }

  String _countryInfoName;
  Observable<bool> savecountryInfoName(String countryInfoName) {
    return Observable.fromFuture(
            mmKvUtil.saveStringKv("country_name", countryInfoName))
        .map((value) {
      if (value) {
        this._countryInfoName = countryInfoName;
      }
      return value;
    });
  }

  Observable<String> getcountryInfoName() {
    if (_countryInfoName != null) {
      return Observable.fromFuture(Future.value(_countryInfoName));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("country_name"));
  }

  String _countryInfoId;
  Observable<bool> savecountryInfoId(String countryInfoId) {
    return Observable.fromFuture(
            mmKvUtil.saveStringKv("country_id", countryInfoId))
        .map((value) {
      if (value) {
        this._countryInfoId = countryInfoId;
      }
      return value;
    });
  }

  Observable<String> getcountryInfoId() {
    if (_countryInfoId != null) {
      return Observable.fromFuture(Future.value(_countryInfoId));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("country_id"));
  }

  String _countryInfoLanguage;
  Observable<bool> savecountryInfoLanguage(String countryInfoLanguage) {
    return Observable.fromFuture(
            mmKvUtil.saveStringKv("country_language", countryInfoLanguage))
        .map((value) {
      if (value) {
        this._countryInfoLanguage = countryInfoLanguage;
      }
      return value;
    });
  }

  Observable<String> getcountryInfoLanguage() {
    if (_countryInfoLanguage != null) {
      return Observable.fromFuture(Future.value(_countryInfoLanguage));
    }
    return Observable.fromFuture(mmKvUtil.getStringKv("country_language"));
  }
}