Parse

@Mgoldberg62401, In your initial question, you mention that you want one user to send a voice msg to another user. You must have the destination user Object ID for this to work. How you are going to do this part, is really up to you. It depends of how you are building/architect your app and how you find people or friend.

Basically, if you know the ObjectId of the user to send the voice msg, you attach this object ID as a parameter of your voiceMsg object. Then your user, knows its own user Object id, therefore the query is not a problem

Doing a query is quite straightforward with the object ID. If you link your audio file with your voiceMsg object, you will have the file URL in the result of your query. After that, its just a question of doing a network.download.

At this point, I have gave you lot of hint to investigate and direction to try. I am sorry,  but I do not have time to write some code example for doing this as you must understand I have also work to do :slight_smile: But I am sure that you should be able to find your way.

Hope this help

Nick

@nmichaud 

Thanks again! I fully understand the steps now! 

LAST QUESTION I SWEAR! :slight_smile:

​How would you go about saving a user’s object ID when searching for the ** person?**

Basically, there will be a search bar that the user can search for users by username.  I am using the parse findUserByUsername and already figured out a way to actually capture the object ID.  However, where can I save the object ID?  I can’t have a globals file in my app and save every single user Object Id that someone searches for!

How can I save the Object ID for later use when they want to send the audio file?

Thanks and I swear this is the last question. lol

-Max

@Mgoldberg62401, I do not understand the problem you are describing. From my point of view, doing a query on the database should always be mandatory as you have a search on the real data everytime. You should only store what is important for your user. Again I do not know what is your app and how it should work, but I guess that if someone is searching for a specific individual, then you should only store the new friend. And then again, maybe like Facebook, you want to ensure that the user on the other end accept to receive audio files…

Now to store your list of friend, there is many ways of doing that. You can either build your own lib or use code that is available on the Corona site.

Hi @Mgoldberg62401,

I’m afraid this topic is moving away from being plugin related and more about application semantics. Any further questions in regards to how to make “systems” should be started in a new thread. Many thanks!

Cheers.

Below I have my code that handles searching for a user in parse.  

The “if” statement runs fine when the text field’s text matches a registered user.  However, when the text field’s text doesn’t match a registered user, the “else if” statement should run.  However, it doesn’t.

My question is:  ​How can I get the else if statement to run when the text field text doesn’t match a registered user?

I am guessing there is some kind of debugging method to set as the conditional statement, for example: elseif (value.results == nil) or something along those lines that can detect when no users are returned/found.  Thanks!

[lua]–search bar function to find user

   local function onSearchUser( ok, res, info )

        if (ok == true) then

           

           for key, value in ipairs( res.results ) do

           if (value.username == searchInput.text) then

                – user found!

print(“USER FOUND!”)

print( "Push notification target is: "…searchInput.text  )

gamesettings.pushNotificationTarget = “”…searchInput.text

loadsave.saveTable(gamesettings, “settings.json”)

elseif (value.username ~= searchInput.text) then

native.showAlert( “No User Found”, searchInput.text…" does not exist!",  { “” }  )

end

      end

   end

end

  

  

  parse.macro.findUserByUsername( ‘’…searchInput.text)

  :response(onSearchUser)[/lua]

@develephant @nmichaud

Hi @Mgoldberg62401 you should really start a new thread as @develephant ask. This is not the  right thread to ask questions related to an app your building and LUA related question.

We are in a busy schedule with our app, therefore I will not be able to help you as quickly as before.

Just want to say thank you @develephant for the great plugin.

Your plugin will acelerate our development.

I hope I can contribute with the community in the future.

Hi Julio,

You are very welcome, and thank you for taking the time to let me know.

Happy New Year.

Here’s a surprise - Parse is closing down its hosted service in 12 months time!

http://blog.parse.com/announcements/moving-on/

They are providing the server software as open source and a migration tool to move your Parse database to MongoDB.

Updated Release 0.2.7

 

This version adds support for the Parse-Server standalone open source framework.

 

Added cloudAddress to Config module

Added generateInstallationId to Tools module

 

Updated docs to clarify Parse-Server module support

 

Enjoy.

Thank you @develephant. That was quick!

I having a issue with Parse regarding user passwords. I can’t find anything on restrictions or requirements, but noticed that in the curl examples you can’t have = or @ in them http://curl.haxx.se/docs/manpage.html#–data-urlencode

I was wondering if the plugin itself had any such restrictions? If I create a user with the password: ================================================== I get an Invalid Login Parameters error when I try to login.

Hi @tap32

A couple questions.

Have you tested a password that is 32 chars or less?

Are you using the Corona Parse plugin?

Cheers 

Hi @develephant, thanks for getting back. Am using your plugin “com.develephant” publisherId. 

I’ve not played around with the password length. As I couldn’t see any mention of enforced restrictions, and as there were no errors at account creation, my suspicions were immediately that there was a character or two at fault.

I’m using the app as part of a study (which I hope to have finished before Parse shutsdown. The participants get no choice in the password, but the app generates one for them and stores it locally as we don’t need them to reuse the accounts. 

I use the following code to generate the password. I use an array rather than a random in just to make filtering characters easier.

[lua]

local chars={[[]],[[!]],[[#]],[[$]],[[%]],[[&]],[[(]],[[)]],[[*]],[[+]],[[-]],[[.]],[[0]],[[1]],[[2]],[[3]],[[4]],[[5]],[[6]],[[7]],[[8]],[[9]],[[:]],[[;]],[[<]],[[>]],[[?]],[[A]],[[B]],[[C]],[[D]],[[E]],[[F]],[[G]],[[H]],[[I]],[[J]],[[K]],[[L]],[[M]],[[N]],[[O]],[[P]],[[Q]],[[R]],[[S]],[[T]],[[U]],[[V]],[[W]],[[X]],[[Y]],[[Z]],[[[]],[[^]],[[_]],[[`]],[[a]],[[b]],[[c]],[[d]],[[e]],[[f]],[[g]],[[h]],[[i]],[[j]],[[k]],[[l]],[[m]],[[n]],[[o]],[[p]],[[q]],[[r]],[[s]],[[t]],[[u]],[[v]],[[w]],[[x]],[[y]],[[z]],[[{]],[[|]],[[}]]}

function generatePassword()

  math.randomseed(os.time()+system.getTimer())

  local password={}

  for i=1, 50 do 

    password[i]=chars[math.random(#chars)]

  end

  return table.concat(password,"")

end

[/lua]

You’ll notice I’ve not removed the = and @ symbols from the options. I’d noticed that generally some accounts work and some don’t. All have the same password recipe. Account creation always went fine, but when they opened the app after it had been closed and it attempts to login there were issues. The account with issues seemed to have = in their passwords, and generating a password just of = caused the same issue. 

Hi,

I would recommend “parse.tools.generateInstallationId( input_seed )” to gain access to a Parse compatible ID.

http://parse.develephant.com/Tools/#generateinstallationid

Here is the full method, if you want to use it elsewhere:

[lua]

function tools.generateInstallationId( input )

  assert(input, “An input string is a required parameter.”)

  local crypto = require( “crypto” )

  local hash = crypto.digest( crypto.md5, input )

  local function h( s, e )

    return string.sub(hash, s, e)

  end

  local id = h(1,8)…’-’…h(9,12)…’-’…h(13,16)…’-’…h(17,20)…’-’…h(21,nil)

  return id

end

[/lua]

Hope that helps.

Cheers.

Fantastic, will try that instead

Hi. Great plugin! I’m currently building an app around it, however I have a question.

Is it possible to utilize Parse key filters other than WHERE and the macros? Specifically I would like to get objects using the “containedIn” query (as in get all objects whose objectId is contained within the passed table).  I could make a Cloud function to do that but is there an out-of-the-box way?

Hi,

The “where” entry should have probably been called “query” but…

To answer your question, yes you can add any of the query operators in the “where” entry. The “hard” part is converting your query properly from Parse-land.

Example:

:where( { score = { ["$gt"] = 200 } } )

If you need more help let me know.

Cheers.

You also might look at:

http://parse.develephant.com/CH3_Usage/

Cheers.