예제 #1
0
 internal static void facebookRegister(RequestItem item, Action <JObject, Exception> callback)
 {
     if (String.IsNullOrEmpty(item.getFbId()))
     {
         if (callback != null)
         {
             callback(null, new NetmeraException(NetmeraException.ErrorCode.EC_REQUIRED_FIELD, NetmeraConstants.Netmera_UserFbId + " is required"));
         }
     }
     if (String.IsNullOrEmpty(item.getNickname()))
     {
         if (callback != null)
         {
             callback(null, new NetmeraException(NetmeraException.ErrorCode.EC_REQUIRED_FIELD, NetmeraConstants.Netmera_UserNickname + " is required"));
         }
     }
     if (String.IsNullOrEmpty(item.getName()))
     {
         item.setName(String.Empty);
     }
     if (String.IsNullOrEmpty(item.getSurname()))
     {
         item.setName(String.Empty);
     }
     if (String.IsNullOrEmpty(item.getEmail()))
     {
         item.setName(String.Empty);
     }
     NetmeraHttpUtils.facebookRegisterUser(item, (json, e) =>
     {
         if (json != null)
         {
             if (json["entry"] != null && json["entry"].First != null)
             {
                 if (callback != null)
                 {
                     callback((JObject)json.First.First, e);
                 }
             }
             else if (json["error"] != null)
             {
                 String error = json["error"]["message"].ToString();
                 if (callback != null)
                 {
                     callback(null, new NetmeraException(NetmeraException.ErrorCode.EC_USER_UPDATE_ERROR, error));
                 }
             }
             else
             {
                 if (callback != null)
                 {
                     callback(null, new NetmeraException(NetmeraException.ErrorCode.EC_USER_UPDATE_ERROR, "Error occurred while registering user"));
                 }
             }
         }
         else
         {
             if (callback != null)
             {
                 callback(null, new NetmeraException(NetmeraException.ErrorCode.EC_USER_UPDATE_ERROR, "Error occurred while registering user"));
             }
         }
     });
 }