MyBB Community Forums

Full Version: GoMobile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hi Scoutie,

Love the mod. I'm making some changes to it at the moment - mainly adding in iOS integration.

I have this working now so if a user on an iOS device (iPod, iPhone or iPad) visited the forum, they have the option of installing the forum as a webapp - this places the icon on the iPhone homescreen and runs in full screen mode like any other App.
Works kind of cool - if you're interested in seeing it let me know. Happy to share the code.

Anyway, during my changes I noticed that you include the add attachment box in the post and edit pages. Can I ask why that is there? On a mobile I dont think you can add attachments can you?I may be worng so I don't want to remove that bit if there is reason for it being there!

Many thanks

Here are some screenshots of the iOS integration

User visits the forum on an iOS device. A balloon appears askign if they want to install on the homescreen
[Image: 1.jpg]

They click add to homscreen and are asked what they want to call the app
[Image: 2.jpg]

The icon is then placed on their home screen
[Image: 3.jpg]

A splashscreen is defined so when they click on the app, an image is shown while the site is loading
[Image: 4.jpg]

Once the site is loaded you can see it is in full screen mode, notice no safari bars at the top or the bottom, just acts as a native app
[Image: 5.jpg]

User control panel in the webapp
[Image: 6.jpg]

Is work in progress but so far so good
(2012-02-25, 03:44 AM)Scoutie44 Wrote: [ -> ]I'm slightly confused (also not an avid Facebook user). From what I understand, you're trying to display your forums on Facebook in an iframe?

Once again the answer is yes. Not the Full version, I need only the Gomobile version to be shown on FB. See one previous page for the extended answer.

Is it possible to accomplish this?...Ty


@cjeb456, looking good!
Goes well, no errors now.
A question for the author. Use the web version, plugin: Hide until thanks (3.1.2). How can I add option Tank for mobile version? Thank you and you did a good job
BUMP

Hopefully I'll be passing on the reigns for GoMobile development, but I'd just like to open up dialogue on a change I just made (that had been sitting on my hard drive for a couple months o.o).

I've managed to get around forum-specific themes, by altering the $current_page variable used in global.php (and then resetting it after the theme is switched). I scanned through global.php, and the only place it was used was for forum-specific themes, so it shouldn't affect anything else within global.php. Now, it may cause issues if plugins try to hook into global_start after MyBBGM since the $current_page variable gets upset. This is easily avoided by getting the script name directly, so it's hard to say if any plugins call upon $current_page directly or not.

Anyways, the change is available on GitHub and you can test it out on MyBBGM.com's "Information" forum, if you'd like.

https://github.com/Scoutie44/MyBB-GoMobile
Unfortunetely there seen to be quite some plugins relying on such variable so probably this is not the best way to handle it. You could "unset" the pid, tid, and fid inputs to make the code fail into your favor, then restore the default variables.

Example:
$plugins->add_hook('global_start', 'gomobile_modifyinputs', 999);
function gomobile_modifyinputs()
{
	global $mybb, $current_page;

	if(in_array($current_page, array(
		"showthread.php", 
		"forumdisplay.php",
		"newthread.php",
		"newreply.php",
		"ratethread.php",
		"editpost.php",
		"polls.php",
		"sendthread.php",
		"printthread.php",
		"moderation.php"
	)) && (int)$mybb->user['style'] == (int)$mybb->settings['gomobile_theme_id'])
	{
		$mybb->input['gm_pid'] = $mybb->input['pid'];
		$mybb->input['gm_tid'] = $mybb->input['tid'];
		$mybb->input['gm_fid'] = $mybb->input['fid'];

		$mybb->input['pid'] = $mybb->input['tid'] = $mybb->input['fid'] = false;

		global $plugins;

		$plugins->add_hook('global_end', 'gomobile_restoreinputs', -999);
	}
}

function gomobile_restoreinputs()
{
	global $mybb;

	$mybb->input['pid'] = $mybb->input['gm_pid'];
	$mybb->input['tid'] = $mybb->input['gm_tid'];
	$mybb->input['fid'] = $mybb->input['gm_fid'];
}

(Ugly, right?)

This, of course, if you don't want complains of plugins malfunctioning because of this. You can also hope for developers to update their plugins to work with your fix Toungue
In terms of keeping variables intact, that's even worse.

Hook priority is a good idea, though.
(2012-12-08, 06:59 PM)frostschutz Wrote: [ -> ]In terms of keeping variables intact, that's even worse.

What about modifying the cache then? Since the forum theme id is read from the cache then it could be better to force the mobile theme id from there.

$plugins->add_hook('global_start', 'gomobile_modifyinputs', -999);
function gomobile_modifyinputs()
{
	global $mybb, $current_page;

	$gmstyle = (int)$mybb->settings['gomobile_theme_id'];
	if(in_array($current_page, array(
		"showthread.php", 
		"forumdisplay.php",
		"newthread.php",
		"newreply.php",
		"ratethread.php",
		"editpost.php",
		"polls.php",
		"sendthread.php",
		"printthread.php",
		"moderation.php"
	)) && (int)$mybb->user['style'] == $gmstyle)
	{
		foreach($mybb->cache->cache['forums'] as $key => &$forum)
		{
			if($forum['style'])
			{
				$forum['style'] = $gmstyle;
			}
		}
	}
}

Downside is that it will now save queries (as my last suggestion or author's implementation do).
(2012-12-08, 06:59 PM)frostschutz Wrote: [ -> ]In terms of keeping variables intact, that's even worse.

Hook priority is a good idea, though.

That's what I was thinking, that if users encounter issues it can be adjusted.

(2012-12-08, 07:23 PM)Omar G. Wrote: [ -> ]What about modifying the cache then? Since the forum theme id is read from the cache then it could be better to force the mobile theme id from there.

I think at the end of the day, there's no great way to do this. As I say, plugin authors utilizing $current_page, specifically in the global_start hook (since it gets reset in global_end), will only need to alter a single line of their plugin for compatibility purposes. Or as mentioned, webmasters can play with the hook priorities to see if that helps.
The issue is outdated plugins that work fine until administrators do install or update GoMobile. This may cause people from stopping using this plugin regardless of it being your (this plugin) fault or not.
I wouldn't mind waiting to see what plugins conflicts will arise from this. I guess since many people don't utilize forum-specific themes anyways, the code probably doesn't need to be there by default.

Do you happen to know of any plugins off hand that utilize $current_page? I wouldn't mid analyzing their usage.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15