Skip to content

Commit

Permalink
Merge branch 'master' into cleanup-apis
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Dec 9, 2019
2 parents 664f58f + 3d32e33 commit 0cc644e
Show file tree
Hide file tree
Showing 20 changed files with 54 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,26 +321,18 @@ private KrollDict buildReverseGeocodeResponse(JSONObject jsonResponse) throws JS

private KrollDict buildAddress(JSONObject place)
{
Log.w(
TAG,
"GeocodedAddress properties country_code, displayAddress, and zipcode are deprecated in SDK 8.0.0 and will be removed in 9.0.0");
Log.w(TAG, "Please replace usage with the respective properties: countryCode, address, and postalCode");
KrollDict address = new KrollDict();
address.put(TiC.PROPERTY_STREET1, place.optString(TiC.PROPERTY_STREET, ""));
address.put(TiC.PROPERTY_STREET, place.optString(TiC.PROPERTY_STREET, ""));
address.put(TiC.PROPERTY_CITY, place.optString(TiC.PROPERTY_CITY, ""));
address.put(TiC.PROPERTY_REGION1, ""); // AdminArea
address.put(TiC.PROPERTY_REGION2, ""); // SubAdminArea
address.put("zipcode", place.optString("zipcode", "")); // TODO: To be removed in SDK 9.0.0!
address.put(TiC.PROPERTY_REGION1, ""); // AdminArea
address.put(TiC.PROPERTY_REGION2, ""); // SubAdminArea
address.put(TiC.PROPERTY_POSTAL_CODE, place.optString("zipcode", ""));
address.put(TiC.PROPERTY_COUNTRY, place.optString(TiC.PROPERTY_COUNTRY, ""));
address.put(TiC.PROPERTY_STATE, place.optString(TiC.PROPERTY_STATE, ""));
// Replace TiC.PROPERTY_COUNTRY_CODE value with "countryCode" in SDK 9.0.0
address.put("countryCode", place.optString(TiC.PROPERTY_COUNTRY_CODE, ""));
address.put(TiC.PROPERTY_COUNTRY_CODE, place.optString(TiC.PROPERTY_COUNTRY_CODE, ""));
address.put(TiC.PROPERTY_COUNTRY_CODE, place.optString("country_code", ""));
address.put(TiC.PROPERTY_LONGITUDE, place.optDouble(TiC.PROPERTY_LONGITUDE, 0.0d));
address.put(TiC.PROPERTY_LATITUDE, place.optDouble(TiC.PROPERTY_LATITUDE, 0.0d));
address.put(TiC.PROPERTY_DISPLAY_ADDRESS, place.optString(TiC.PROPERTY_ADDRESS));
address.put(TiC.PROPERTY_ADDRESS, place.optString(TiC.PROPERTY_ADDRESS));

return address;
Expand Down
3 changes: 1 addition & 2 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -1439,9 +1439,8 @@ public class TiC

/**
* @module.api
* @deprecated Value will be changed to "countryCode" in SDK 9.0.0
*/
public static final String PROPERTY_COUNTRY_CODE = "country_code";
public static final String PROPERTY_COUNTRY_CODE = "countryCode";

/**
* @module.api
Expand Down
3 changes: 3 additions & 0 deletions apidoc/Titanium/Geolocation/Geolocation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ properties:
platforms: [iphone, ipad]
deprecated:
since: {iphone: "8.0.0", ipad: "8.0.0"}
removed: "9.0.0"

- name: country
summary: Country name.
Expand All @@ -1223,6 +1224,7 @@ properties:
platforms: [android, iphone, ipad]
deprecated:
since: {android: "8.0.0", iphone: "8.0.0", ipad: "8.0.0"}
removed: "9.0.0"

- name: longitude
summary: Longitude of the geocoded point.
Expand All @@ -1240,6 +1242,7 @@ properties:
platforms: [android]
deprecated:
since: {android: "8.0.0"}
removed: "9.0.0"

- name: address
summary: Full address.
Expand Down
6 changes: 6 additions & 0 deletions apidoc/Titanium/UI/WebView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,12 @@ events:
constants: Titanium.UI.iOS.WEBVIEW_NAVIGATIONTYPE_*
platforms: [ipad, iphone]

- name: isMainFrame
summary: Indicate if the event was generated from the main page or an iframe.
type: Boolean
platforms: [ipad, iphone]
since: "9.0.0"

- name: error
summary: Fired when the web view cannot load the content.
description: |
Expand Down
12 changes: 3 additions & 9 deletions iphone/Classes/GeolocationModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,13 @@ - (void)requestSuccess:(NSString *)locationString
BOOL success = [TiUtils boolValue:@"success" properties:event def:YES];
NSMutableDictionary *revisedEvent = [TiUtils dictionaryWithCode:success ? 0 : -1 message:success ? nil : @"error reverse geocoding"];
[revisedEvent setValuesForKeysWithDictionary:event];
// TODO: Remove the zipcode and country_code values after on SDK 9.0.0!
NSArray<NSMutableDictionary *> *places = (NSArray<NSMutableDictionary *> *)revisedEvent[@"places"];
for (NSMutableDictionary *dict in places) {
dict[@"postalCode"] = dict[@"zipcode"];
[dict removeObjectForKey:@"zipcode"];
dict[@"countryCode"] = dict[@"country_code"];
[dict removeObjectForKey:@"country_code"];
}
NSLog(@"[WARN] GeocodedAddress properties country_code and zipcode are deprecated in SDK 8.0.0 and will be removed in 9.0.0");
NSLog(@"[WARN] Please replace usage with the respective properties: countryCode and postalCode");
[callback callWithArguments:@[ revisedEvent ]];
}
}
Expand Down Expand Up @@ -317,11 +316,10 @@ - (CLLocationManager *)locationManager

locationManager.allowsBackgroundLocationUpdates = allowsBackgroundLocationUpdates;

#if IS_SDK_IOS_11
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
locationManager.showsBackgroundLocationIndicator = showBackgroundLocationIndicator;
}
#endif

locationManager.activityType = activityType;
locationManager.pausesLocationUpdatesAutomatically = pauseLocationUpdateAutomatically;

Expand Down Expand Up @@ -605,23 +603,19 @@ - (void)setHeadingFilter:(CLLocationDegrees)value

- (BOOL)showBackgroundLocationIndicator
{
#if IS_SDK_IOS_11
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
return showBackgroundLocationIndicator;
}
#endif
DebugLog(@"[ERROR] The showBackgroundLocationIndicator property is only available on iOS 11.0+. Returning \"false\" ...");
return NO;
}

- (void)setShowBackgroundLocationIndicator:(BOOL)value
{
#if IS_SDK_IOS_11
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
showBackgroundLocationIndicator = value;
return;
}
#endif
DebugLog(@"[ERROR] The showBackgroundLocationIndicator property is only available on iOS 11.0+. Ignoring call ...");
}

Expand Down
33 changes: 17 additions & 16 deletions iphone/Classes/TiAppiOSUserNotificationCenterProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,24 @@ - (void)removePendingNotifications:(id)args
}
}];
} else {
TiThreadPerformOnMainThread(^{
if (args == nil || [args count] == 0) {
[[UIApplication sharedApplication] cancelAllLocalNotifications];
return;
}
TiThreadPerformOnMainThread(
^{
if (args == nil || [args count] == 0) {
[[UIApplication sharedApplication] cancelAllLocalNotifications];
return;
}

for (UILocalNotification *scheduledNotification in UIApplication.sharedApplication.scheduledLocalNotifications) {
for (id notification in args) {
ENSURE_TYPE(notification, NSDictionary);
for (UILocalNotification *scheduledNotification in UIApplication.sharedApplication.scheduledLocalNotifications) {
for (id notification in args) {
ENSURE_TYPE(notification, NSDictionary);

if ([notification[@"userInfo"][@"id"] isEqual:scheduledNotification.userInfo[@"id"]]) {
[UIApplication.sharedApplication cancelLocalNotification:scheduledNotification];
break;
if ([notification[@"userInfo"][@"id"] isEqual:scheduledNotification.userInfo[@"id"]]) {
[UIApplication.sharedApplication cancelLocalNotification:scheduledNotification];
break;
}
}
}
}
}
},
},
NO);
}
}
Expand Down Expand Up @@ -178,11 +179,11 @@ - (void)requestUserNotificationSettings:(id)callback
@"carPlaySetting" : @([settings carPlaySetting]),
@"alertStyle" : @([settings alertStyle])
} mutableCopy];
#if IS_SDK_IOS_11

if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
propertiesDict[@"showPreviewsSetting"] = @([settings showPreviewsSetting]);
}
#endif

#if IS_SDK_IOS_12
if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
propertiesDict[@"criticalAlertSetting"] = @([settings criticalAlertSetting]);
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2238,7 +2238,6 @@ - (void)viewResignFocus

- (void)viewGetFocus
{
#if IS_SDK_IOS_11
if (isSearchBarInNavigation) {
id proxy = [(TiViewProxy *)self.proxy parent];
while ([proxy isKindOfClass:[TiViewProxy class]] && ![proxy isKindOfClass:[TiWindowProxy class]]) {
Expand All @@ -2254,7 +2253,6 @@ - (void)viewGetFocus
controller.navigationItem.searchController = searchController;
}
}
#endif

if (isSearched && self.searchedString && ![searchController isActive]) {
isSearched = NO;
Expand Down
4 changes: 0 additions & 4 deletions iphone/Classes/TiUINavigationWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ - (void)navigationController:(UINavigationController *)navigationController will
}
}
TiWindowProxy *theWindow = (TiWindowProxy *)[(TiViewController *)viewController proxy];
#if IS_SDK_IOS_11
[theWindow processForSafeArea];
#endif
if ((theWindow != rootWindow) && [theWindow opening]) {
[theWindow windowWillOpen];
[theWindow windowDidOpen];
Expand Down Expand Up @@ -389,7 +387,6 @@ - (void)viewDidDisappear:(BOOL)animated
[super viewDidDisappear:animated];
}

#if IS_SDK_IOS_11
- (BOOL)homeIndicatorAutoHide
{
UIViewController *topVC = [navController topViewController];
Expand All @@ -401,7 +398,6 @@ - (BOOL)homeIndicatorAutoHide
}
return [super homeIndicatorAutoHide];
}
#endif

- (BOOL)hidesStatusBar
{
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ - (TiUIScrollViewImpl *)scrollView

- (void)adjustScrollViewInsets
{
#if IS_SDK_IOS_11
id viewProxy = self.proxy;
while (viewProxy && ![viewProxy isKindOfClass:[TiWindowProxy class]]) {
viewProxy = [viewProxy parent];
Expand All @@ -160,7 +159,6 @@ - (void)adjustScrollViewInsets
[scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
}
#endif
}

- (id)accessibilityElement
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUITabGroupProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ - (UIStatusBarStyle)preferredStatusBarStyle;
return [super preferredStatusBarStyle];
}

#if IS_SDK_IOS_11
- (BOOL)homeIndicatorAutoHide
{
UITabBarController *tabController = [(TiUITabGroup *)[self view] tabController];
Expand All @@ -277,7 +276,6 @@ - (BOOL)homeIndicatorAutoHide
}
return [super homeIndicatorAutoHide];
}
#endif

- (BOOL)hidesStatusBar
{
Expand Down
9 changes: 3 additions & 6 deletions iphone/Classes/TiUITabProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,8 @@ - (void)openWindow:(NSArray *)args
TiWindowProxy *window = [args objectAtIndex:0];
ENSURE_TYPE(window, TiWindowProxy);

#if IS_SDK_IOS_11
[window processForSafeArea];
#endif

if (window == rootWindow) {
[rootWindow windowWillOpen];
[rootWindow windowDidOpen];
Expand Down Expand Up @@ -404,9 +403,8 @@ - (void)handleWillShowViewController:(UIViewController *)viewController animated
}
}
TiWindowProxy *theWindow = (TiWindowProxy *)[(TiViewController *)viewController proxy];
#if IS_SDK_IOS_11
[theWindow processForSafeArea];
#endif

if (theWindow == rootWindow) {
//This is probably too late for the root view controller.
//Figure out how to call open before this callback
Expand Down Expand Up @@ -766,7 +764,6 @@ - (void)popToRootWindow:(id)args

@synthesize parentOrientationController;

#if IS_SDK_IOS_11
- (BOOL)homeIndicatorAutoHide
{
if (rootWindow == nil) {
Expand All @@ -783,7 +780,7 @@ - (BOOL)homeIndicatorAutoHide
}
return NO;
}
#endif

- (BOOL)hidesStatusBar
{
if (rootWindow == nil) {
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUITableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2390,7 +2390,6 @@ - (void)viewResignFocus

- (void)viewGetFocus
{
#if IS_SDK_IOS_11
if (isSearchBarInNavigation) {
id proxy = [(TiViewProxy *)self.proxy parent];
while ([proxy isKindOfClass:[TiViewProxy class]] && ![proxy isKindOfClass:[TiWindowProxy class]]) {
Expand All @@ -2406,7 +2405,6 @@ - (void)viewGetFocus
controller.navigationItem.searchController = searchController;
}
}
#endif
if (!hideOnSearch && isSearched && self.searchedString && ![searchController isActive]) {
isSearched = NO;
searchController.searchBar.text = self.searchedString;
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@

@end

#if IS_SDK_IOS_11
@interface WebAppProtocolHandler : NSObject <WKURLSchemeHandler> {
}

+ (NSString *)specialProtocolScheme;

@end
#endif

#endif

0 comments on commit 0cc644e

Please sign in to comment.