[TIMOB-23572] iOS/Android: Add the ability to remove all Ti.App.Properties at once
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-07-21T17:23:28.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 6.0.0 |
| Components | Android, iOS |
| Labels | parity, properties, tiapp, userdefaults |
| Reporter | Hans Knöchel |
| Assignee | Hans Knöchel |
| Created | 2016-06-29T04:48:43.000+0000 |
| Updated | 2016-10-19T08:53:26.000+0000 |
Description
The user should be able to remove all
Ti.App.Properties at once. On iOS, the method is even (partly) exposed, yet, but not to the public interface. On Android, we need to implement that method completely.
PR: https://github.com/appcelerator/titanium_mobile/pull/8096 Demo:
// Check the initial properties (should only be the iOS ones) Ti.API.warn(Ti.App.Properties.listProperties()); // Add all possible property-types (bool, int, double, string, object & list) Ti.App.Properties.setBool("testBool", true) Ti.API.warn(Ti.App.Properties.getBool("testBool")); Ti.App.Properties.setInt("testInt", 1337) Ti.API.warn(Ti.App.Properties.getInt("testInt", 1337)); Ti.App.Properties.setDouble("testDouble", 13.37); Ti.API.warn(Ti.App.Properties.getDouble("testDouble", 13.37)); Ti.App.Properties.setString("testString", "john_doe") Ti.API.warn(Ti.App.Properties.getString("testString", "john_doe")); Ti.App.Properties.setObject("testObject", {appc: "rocks"}) Ti.API.warn(Ti.App.Properties.getObject("testObject", {appc: "rocks"})); Ti.App.Properties.setList("testList", ["appc", "rocks"]) Ti.API.warn(Ti.App.Properties.getList("testList", ["appc", "rocks"])); // Check the properties again. It should now include the keys of the custom properties Ti.API.warn(Ti.App.Properties.listProperties()); // Remove all custom properties Ti.API.warn(Ti.App.Properties.removeAllProperties()); // Check the properties a last time. The custom properties should not be included anymore Ti.API.warn(Ti.App.Properties.listProperties());[~apetkov] Please review
Verified the improvement on IOS & android. Works as expected. Closing. Environment: Appc Studio : 4.7.0.201607250649 Ti SDK : 6.0.0.v20160811221444 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.6 Appc NPM : 4.2.7 Appc CLI : 6.0.0-24 Node: 4.4.4 Nexus 5 - Android 6.0.1 Iphone simulator: Iphone 6s (9.3)