Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 70

AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
04/14/15 12:52 AM (9 years ago)

local json override possible?

I'm using one of the email plugins and I set the pre-fill values in the control panel. I would like to provide a screen in the app that allows the user to create their preferred local overrides for the subject, cc and bcc (and maybe body text). Can anyone suggest a way or point to an example please?
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
04/14/15 01:43 AM (9 years ago)
You need to create a new plugin. You should start with the email plugin you already have, then go to buzztouch.com and create a new plugin there. By default, it will be empty, so you need to copy the source code and the resource files (XML files on Android) into it, then upload it to the (self hosted) server. Once there, use the Admin privilege and refresh the plugins, refresh it twice in a row. That guarantees that the new plugin will be entered properly into the server database. Now you should have a new plugin on the server, which does exactly the same as the original email plugin you wanted to alter. Create a new screen with the new plugin, connect it to a menu in the app, then you can download the app. The purpose of downloading is only to get the source code into the existing app, so do not import it all into the existing app, only the code and xml files for the new plugin. >local json override possible? Yes, the best place to override is parseScreenData. Once there, you can start changing the source code to your liking. Since you want the user to create input data and then use it freely in the app, you should start accepting the bitter truth that your plugin now needs to save the data, show it, allow editing, then save again, and of course, use it in appropriate places in the app. The best way is to use a local database, but unless you are already a programmer, that may be out or your reach. You can, however, always use BT_strings class with setPref and getPref functions to store and retrieve the data. As a side note, Buzztouch is phenomenal when you need to publish existing content as an app. For many developers here, that may be more than enough. For several years, that was more than more than enough for end users too. Now the wonder of "having an app for that" is gone, apps must be unique in every way, otherwise, competitors will eat you alive in the stores. Enter the notion of database within the app, as a tool to create tension and retention amongst the users. If you succeed in making them enter their own data into your app, you can almost guarantee that they will be back, and your chances of making money with the app rise exponentially. Which is why from now on all of my apps will try to capture user data in a database, one or more of them. Let the app be about them and their data, and you, as an app developer, will win.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
04/14/15 07:31 AM (9 years ago)
Dusko, thanks for your very comprehensive answer. I'm looking at an ios solution at the moment but I understand the scope of what you are suggesting. I had the thought that some kind of form with fields that held the json values used for the email plugin. I envisioned the form contents being loaded after the config.txt json had been loaded, to over-ride the existing json. Sounds simpleish, but I am not sure if it is feasible. Alan
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
04/15/15 09:41 PM (9 years ago)
As Dusko said, setPref and getPref with NSUSERDEFAULTS is your friend for your situation. Let us know how you get along. -- Niraj
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.