getPlaySecurityText method

Future<String> getPlaySecurityText()

Implementation

Future<String> getPlaySecurityText() async {
  SharedPreferences sharedPreferences = await DeviceStorage().getInstance();
  String sessionToken =
      sharedPreferences.getString(DeviceStorage.sessionToken) ?? "";

  String playSecurityTxt = "";
  if (sessionToken.isNotEmpty) {
    Map<String, dynamic> decodedToken = JwtDecoder.decode(sessionToken);

    if (decodedToken.containsKey('email')) {
      playSecurityTxt = decodedToken['email'];
    } else {
      playSecurityTxt = decodedToken['mobileno'];
    }
  }

  if (Platform.isIOS) {
    String? ip = await getIpAddress();
    ip = ip ?? "";
    playSecurityTxt = "$playSecurityTxt\n$ip";
  }
  return playSecurityTxt;
}