Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25756] Android: Restart application upon locale change #9937

Merged
merged 8 commits into from Oct 15, 2018

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Mar 15, 2018

  • Restart the application upon locale change to load new language
TEST CASE
  • Project on JIRA
Ti.Locale.addEventListener('change', function (e) {
    // locale has changed, soft restart prevented
});

JIRA Ticket

@Topener
Copy link
Sponsor Contributor

Topener commented Mar 16, 2018

Yeah I agree that event makes sense! How would a user handle the restart of the app though? Or is opening/closing windows enough?

@hansemannn
Copy link
Collaborator

On iOS, we could listen to the NSCurrentLocaleDidChangeNotification notification and fire a Ti.Locale localechange event. Restarting iOS apps is not allowed by Apply though and causes app-rejections if hacked through (private) API's.

@build
Copy link
Contributor

build commented Aug 2, 2018

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

@hansemannn
Copy link
Collaborator

Is this a public method? Ti.App._restart()? The underscore looks really odd.

@garymathews
Copy link
Contributor Author

@hansemannn nope, it's intended for LiveView

@hansemannn
Copy link
Collaborator

What do you think about the following btw?

Ti.Locale.addEventListener('change', function (e) {
    // locale has changed
});

@jquick-axway
Copy link
Contributor

I like @hansemannn idea of a Ti.Locale "change" event.

And should we use this event to override the auto-restart behavior like how we did it with the "androidback" button event?

Personally, I wouldn't want the app to restart since you'll lose content and your current position within the app. Most apps, especially Windows desktop apps, will only handle the locale change the next time the app is re-launch by the end-user.

@Topener
Copy link
Sponsor Contributor

Topener commented Aug 3, 2018

I feel like you should be able to override it, so makes sense! As long as you can listen for it and still let it reboot :)

I like the event too!

@garymathews
Copy link
Contributor Author

@hansemannn Updated PR; ready for iOS parity

@build build added the docs label Aug 14, 2018
@hansemannn hansemannn modified the milestones: 7.4.0, 7.5.0 Aug 24, 2018
@lokeshchdhry
Copy link
Contributor

FR Passed.

  1. The locale change event is fired if change event listener is defined & locale is changed.
  2. If change event listener is not defined the app will soft restart to the appropriate language provided strings.xml is defined for particular language.

Studio Ver: 5.1.1.201809051655
SDK Ver: local build
OS Ver: 10.13.5
Xcode Ver: Xcode 9.4.1
Appc NPM: 4.2.13
Appc CLI: 7.0.6
Daemon Ver: 1.1.3
Ti CLI Ver: 5.1.1
Alloy Ver: 1.13.2
Node Ver: 8.9.1
NPM Ver: 5.5.1
Java Ver: 1.8.0_161
Devices: ⇨ google Nexus 5 (Android 6.0.1)
⇨ google Nexus 6P (Android 8.1.0)
Emulator: ⇨ Android 4.1.2

@lokeshchdhry
Copy link
Contributor

@garymathews , Can you please resolve the conflicts.

@lokeshchdhry lokeshchdhry merged commit b998cae into tidev:master Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants