Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16352] LiveView: App events are not cleared on reload

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.0, Release 3.2.1
Fix Version/sn/a
ComponentsLiveView
Labelsliveview, supportTeam
ReporterFokke Zandbergen
AssigneeUnknown
Created2014-01-27T07:30:33.000+0000
Updated2018-02-28T20:03:29.000+0000

Description

When a change triggers LiveView to reload the app, app events like Ti.App.resumed or Ti.Gesture.orientationchange are not cleaned up and fire for once each time the app has been reloaded.

To reproduce

Run the following app with LiveView enabled and follow the steps on the screen:
var run = Ti.App.Properties.getInt('run', 0);
run++;
Ti.App.Properties.setInt('run', run);

function logEvent(e) {
	console.log(e.type + ' #' + run);
}

Ti.App.addEventListener('resumed', logEvent);
Ti.Gesture.addEventListener('orientationchange', logEvent);

var win = Ti.UI.createWindow({  
    backgroundColor:'#fff'
});

win.add(Ti.UI.createLabel({
	text: '1. Change something to trigger LiveView to restart the app.\n'
		+ '2. Move app to background and then resume.\n'
		+ '3. Change orientation.\n'
		+ '4. Check logs.\n'
		+ '5. Confirm that you see each event triggered twice.'
}));

win.open();

Comments

  1. Ritu Agrawal 2014-01-28

    I tried the test case with LiveView enabled but for some reason I am not seeing any orientationchange or resumed event. It is a little strange as I see the same behavior with or without LiveView. I will try on another device tomorrow.
  2. Fokke Zandbergen 2014-01-28

    Well, that would be very strange indeed. I did the test on iOSSimulator, using the menu options to rotate and shake the device.
  3. Ritu Agrawal 2014-01-31

    Moving this ticket to engineering as I can reproduce this issue with Appcelerator Studio 3.2.0 and LiveView.
  4. Fokke Zandbergen 2014-01-31

    I think it's even wider then App events, it's any non-UI event listeners, also on custom modules. So it might even mean these modules are never cleared as well?
  5. Fokke Zandbergen 2014-02-04

    Why backlog? IMHO this stops LiveView from being usable in any serious app using non-ui event listeners.
  6. Tanel Kollamaa 2015-10-12

    I'm having the same issue with Ti.App.fireEvent/addEventListener events and also with the facebook module's login/logout events.
  7. Ivo Toby 2015-11-10

    I was hoping for a temporary workaround by detecting a reload from liveView but so far no succes. This issue makes liveView pretty useless
  8. Fokke Zandbergen 2015-11-10

    The issue is complex because apart from core-APIs firing global events, there could also be modules. The workaround is: * Use the close event on Windows * You can check if LiveView is active with if (localeStrings) ..
  9. Mark Henderson 2018-02-20

    This seriously affects the ability to use LiveView on Android. Since the app is re-loaded effectively, can't all App.addEventListener and App.fireEvent's be reset?

JSON Source