Commit 4ead1bf6 authored by Kevin Reynaldo's avatar Kevin Reynaldo
Browse files

Merge branch 'release/2.16.0'

parents 4105cd6d eb370cb4
......@@ -3,7 +3,7 @@ Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.name = "TapTalk"
s.version = "2.15.5"
s.version = "2.16.0"
s.summary = "TapTalk.io is a complete in-app chat SDK and messaging API. TapTalk.io provides UI-based and code-based implementation & fully customizable."
s.homepage = "https://taptalk.io"
......
......@@ -204,6 +204,8 @@
UIColor *buttonColor = [[TAPStyleManager sharedManager] getTextColorForType:TAPTextColorButtonLabel];
self.buttonTitleLabel.textColor = buttonColor;
self.buttonIconImageView.image = [self.buttonIconImageView.image setImageTintColor:buttonColor];
self.buttonIconImageView.alpha = 1.0f;
}];
}
else {
......@@ -222,6 +224,8 @@
UIColor *buttonInactiveLabelColor = [[TAPStyleManager sharedManager] getTextColorForType:TAPTextColorButtonInactiveLabel];
self.buttonTitleLabel.textColor = buttonInactiveLabelColor;
self.buttonIconImageView.image = [self.buttonIconImageView.image setImageTintColor:[buttonInactiveLabelColor colorWithAlphaComponent:1.0f]];
self.buttonIconImageView.alpha = 0.4f;
}];
}
}
......
......@@ -153,7 +153,8 @@
+ (CGFloat)safeAreaTopPadding;
+ (CGFloat)topGapPresentingViewController;
+ (void)performBlock:(void (^)(void))block afterDelay:(NSTimeInterval)delay;
+ (UIViewController *_Nullable) topViewController;
+ (UIViewController * _Nullable)topViewController;
+ (UIViewController * _Nullable)topViewControllerWithRootViewController:(UIViewController *)rootViewController;
+ (NSDictionary *) objectToDictionary:(id)object;
+ (NSArray *)getUrlsFromString:(NSString *)text;
+ (void)getImageFromRemoteUrl:(NSString *)urlString success:(void (^)(UIImage *image))success failure:(void (^)(NSError *error))failure;
......
......@@ -1303,15 +1303,43 @@ static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWi
[self performSelector:@selector(performBlock:) withObject:block_ afterDelay:delay];
}
+ (UIViewController *_Nullable) topViewController {
UIViewController *topViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
if (topViewController == nil) {
return nil;
+ (UIViewController * _Nullable)topViewControllerWithRootViewController:(UIViewController *)rootViewController {
if (rootViewController == nil) {
rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
if (rootViewController == nil) {
return nil;
}
}
if ([rootViewController isKindOfClass:[UITabBarController class]]) {
UITabBarController *tabBarController = (UITabBarController *) rootViewController;
if (tabBarController.selectedViewController != nil) {
return [self topViewControllerWithRootViewController:tabBarController.selectedViewController];
}
else {
return rootViewController;
}
}
while (topViewController.presentedViewController) {
topViewController = topViewController.presentedViewController;
else if ([rootViewController isKindOfClass:[UINavigationController class]]) {
UINavigationController *navigationController = (UINavigationController *) rootViewController;
if (navigationController.visibleViewController != nil) {
return [self topViewControllerWithRootViewController:navigationController.visibleViewController];
}
else {
return rootViewController;
}
}
else if (rootViewController.presentedViewController) {
UIViewController *presentedViewController = rootViewController.presentedViewController;
if (rootViewController.presentedViewController != nil) {
return [self topViewControllerWithRootViewController:presentedViewController];
}
else {
return rootViewController;
}
}
else {
return rootViewController;
}
return topViewController;
}
+ (void)getContentDataFromURL:(NSURL *)url success:(void (^)(NSString *title, NSString *body, NSURL*imageUrl))success failure:(void (^)(NSError *error))failure {
......
......@@ -484,8 +484,7 @@
- (void)initializeGooglePlacesAPIKey:(NSString * _Nonnull)apiKey {
//Google API Key
[GMSPlacesClient provideAPIKey:apiKey];
[GMSServices provideAPIKey:apiKey];
_isGooglePlacesAPIInitialize = YES;
_isGooglePlacesAPIInitialize = [GMSServices provideAPIKey:apiKey];
}
- (BOOL)obtainGooglePlacesAPIInitializeState {
......
......@@ -396,12 +396,12 @@ Use to set custom right bar button view for chat room navigation bar.
/**
Obtain current active navigation controller
*/
- (UINavigationController *)getCurrentTapTalkActiveNavigationController;
- (UINavigationController * _Nullable)getCurrentTapTalkActiveNavigationController;
/**
Obtain current active view controller
*/
- (UIViewController *)getCurrentTapTalkActiveViewController;
- (UIViewController * _Nullable)getCurrentTapTalkActiveViewController;
//==========================================================
// Custom Bubble Chat
......
......@@ -129,29 +129,43 @@
return !self.isDisableActivateInAppNotification;
}
- (UINavigationController *)getCurrentTapTalkActiveNavigationController {
return [self getCurrentTapTalkActiveViewController].navigationController;
}
- (UIViewController *)getCurrentTapTalkActiveViewController {
return [self topViewControllerWithRootViewController:self.activeWindow.rootViewController];
}
- (UIViewController*)topViewControllerWithRootViewController:(UIViewController*)rootViewController {
if ([rootViewController isKindOfClass:[UITabBarController class]]) {
UITabBarController* tabBarController = (UITabBarController*)rootViewController;
return [self topViewControllerWithRootViewController:tabBarController.selectedViewController];
} else if ([rootViewController isKindOfClass:[UINavigationController class]]) {
UINavigationController* navigationController = (UINavigationController*)rootViewController;
return [self topViewControllerWithRootViewController:navigationController.visibleViewController];
} else if (rootViewController.presentedViewController) {
UIViewController* presentedViewController = rootViewController.presentedViewController;
return [self topViewControllerWithRootViewController:presentedViewController];
} else {
return rootViewController;
- (UINavigationController * _Nullable)getCurrentTapTalkActiveNavigationController {
UIViewController *currentActiveViewController = [self getCurrentTapTalkActiveViewController];
if (currentActiveViewController != nil) {
return currentActiveViewController.navigationController;
}
return nil;
}
- (UIViewController * _Nullable)getCurrentTapTalkActiveViewController {
UIViewController *rootViewController;
if (self.activeWindow != nil && self.activeWindow.rootViewController != nil) {
rootViewController = self.activeWindow.rootViewController;
}
else {
rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
}
if (rootViewController == nil) {
return nil;
}
return [TAPUtil topViewControllerWithRootViewController:rootViewController];
}
//- (UIViewController*)topViewControllerWithRootViewController:(UIViewController*)rootViewController {
// if ([rootViewController isKindOfClass:[UITabBarController class]]) {
// UITabBarController* tabBarController = (UITabBarController*)rootViewController;
// return [self topViewControllerWithRootViewController:tabBarController.selectedViewController];
// } else if ([rootViewController isKindOfClass:[UINavigationController class]]) {
// UINavigationController* navigationController = (UINavigationController*)rootViewController;
// return [self topViewControllerWithRootViewController:navigationController.visibleViewController];
// } else if (rootViewController.presentedViewController) {
// UIViewController* presentedViewController = rootViewController.presentedViewController;
// return [self topViewControllerWithRootViewController:presentedViewController];
// } else {
// return rootViewController;
// }
//}
//Custom Bubble
- (void)addCustomBubbleWithClassName:(NSString *)className type:(NSInteger)type delegate:(id)delegate bundle:(NSBundle *)bundle {
[[TAPCustomBubbleManager sharedManager] addCustomBubbleDataWithCellName:className type:type delegate:delegate bundle:bundle];
......
......@@ -10,6 +10,7 @@
#import "TAPPickLocationView.h"
#import "TAPPinLocationSearchResultTableViewCell.h"
#import <MapKit/MapKit.h>
#import <Contacts/CNPostalAddressFormatter.h>
@import GooglePlaces;
@import GoogleMaps;
......@@ -273,19 +274,27 @@
CLLocationCoordinate2D center = [mapView centerCoordinate];
[self.pickLocationView setAsLoading:YES];
[[GMSGeocoder geocoder] reverseGeocodeCoordinate:center completionHandler:
^(GMSReverseGeocodeResponse *response, NSError *error){
if ([[response.firstResult valueForKey:@"lines"] objectAtIndex:0]) {
NSString *currentLocation = [NSString stringWithFormat:@"%@", [[response.firstResult valueForKey:@"lines"] objectAtIndex:0]];
NSString *currentPostalCode = [NSString stringWithFormat:@"%@", [response.firstResult valueForKey:@"postalCode"]];
if(![currentLocation isEqualToString:@""]) {
_selectedLocationCoordinate = center;
_selectedLocationAddress = currentLocation;
_selectedPostalCode = currentPostalCode;
[self.pickLocationView setAsLoading:NO];
[self.pickLocationView setAddress:currentLocation];
[self.pickLocationView.sendLocationButton setAsActiveState:YES animated:YES];
if ([[TapTalk sharedInstance] obtainGooglePlacesAPIInitializeState]) {
[[GMSGeocoder geocoder] reverseGeocodeCoordinate:center completionHandler:
^(GMSReverseGeocodeResponse *response, NSError *error){
if ([[response.firstResult valueForKey:@"lines"] objectAtIndex:0]) {
NSString *currentLocation = [NSString stringWithFormat:@"%@", [[response.firstResult valueForKey:@"lines"] objectAtIndex:0]];
NSString *currentPostalCode = [NSString stringWithFormat:@"%@", [response.firstResult valueForKey:@"postalCode"]];
if(![currentLocation isEqualToString:@""]) {
_selectedLocationCoordinate = center;
_selectedLocationAddress = currentLocation;
_selectedPostalCode = currentPostalCode;
[self.pickLocationView setAsLoading:NO];
[self.pickLocationView setAddress:currentLocation];
[self.pickLocationView.sendLocationButton setAsActiveState:YES animated:YES];
}
else {
//Location not found
[self.pickLocationView setAsLoading:YES];
[self.pickLocationView setAddress:NSLocalizedStringFromTableInBundle(@"Location not found", nil, [TAPUtil currentBundle], @"")];
[self.pickLocationView.sendLocationButton setAsActiveState:NO animated:YES];
}
}
else {
//Location not found
......@@ -293,14 +302,37 @@
[self.pickLocationView setAddress:NSLocalizedStringFromTableInBundle(@"Location not found", nil, [TAPUtil currentBundle], @"")];
[self.pickLocationView.sendLocationButton setAsActiveState:NO animated:YES];
}
}
else {
//Location not found
[self.pickLocationView setAsLoading:YES];
[self.pickLocationView setAddress:NSLocalizedStringFromTableInBundle(@"Location not found", nil, [TAPUtil currentBundle], @"")];
[self.pickLocationView.sendLocationButton setAsActiveState:NO animated:YES];
}
}];
}];
}
else {
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
CLLocation *location = [[CLLocation alloc] initWithLatitude:center.latitude longitude:center.longitude];
[geocoder reverseGeocodeLocation:location completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
if (![TAPUtil isEmptyArray:placemarks]) {
CNPostalAddressFormatter *formatter = [[CNPostalAddressFormatter alloc] init];
_selectedLocationAddress = [[formatter stringFromPostalAddress:placemarks[0].postalAddress] stringByReplacingOccurrencesOfString:@"\n" withString:@", "];
if (![TAPUtil isEmptyString:self.selectedLocationAddress]) {
_selectedLocationCoordinate = center;
_selectedPostalCode = placemarks[0].postalCode;
[self.pickLocationView setAsLoading:NO];
[self.pickLocationView setAddress:self.selectedLocationAddress];
[self.pickLocationView.sendLocationButton setAsActiveState:YES animated:YES];
}
else {
//Location not found
[self.pickLocationView setAsLoading:YES];
[self.pickLocationView setAddress:NSLocalizedStringFromTableInBundle(@"Location not found", nil, [TAPUtil currentBundle], @"")];
[self.pickLocationView.sendLocationButton setAsActiveState:NO animated:YES];
}
}
else {
//Location not found
[self.pickLocationView setAsLoading:YES];
[self.pickLocationView setAddress:NSLocalizedStringFromTableInBundle(@"Location not found", nil, [TAPUtil currentBundle], @"")];
[self.pickLocationView.sendLocationButton setAsActiveState:NO animated:YES];
}
}];
}
}
#pragma mark - TAPCustomButtonView
......
......@@ -2801,7 +2801,7 @@ static const NSInteger kInputMessageAccessoryExtensionViewDefaultHeight = 68.0f;
[alertController addAction:galleryAction];
}
if ([[TapTalk sharedInstance] obtainGooglePlacesAPIInitializeState] &&
if (//[[TapTalk sharedInstance] obtainGooglePlacesAPIInitializeState] &&
[[TapUI sharedInstance] isLocationAttachmentEnabled]
) {
//Only show when Google Places API Key is insert
......
......@@ -8568,7 +8568,7 @@ CGPoint center;
[alertController addAction:galleryAction];
}
if ([[TapTalk sharedInstance] obtainGooglePlacesAPIInitializeState] &&
if (//[[TapTalk sharedInstance] obtainGooglePlacesAPIInitializeState] &&
[[TapUI sharedInstance] isLocationAttachmentEnabled]
) {
//Only show when Google Places API Key is insert
......
......@@ -36,14 +36,14 @@
self.addressView.layer.shadowOpacity = 0.18f;
[self addSubview:self.addressView];
_addressIconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10.0f, 10.0f, 32.0f, 32.0f)];
_addressIconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(16.0f, 16.0f, 16.0f, 16.0f)];
self.addressIconImageView.image = [UIImage imageNamed:@"TAPIconLocation" inBundle:[TAPUtil currentBundle] compatibleWithTraitCollection:nil];
self.addressIconImageView.image = [self.addressIconImageView.image setImageTintColor:[[TAPStyleManager sharedManager] getComponentColorForType:TAPComponentColorIconLocationPickerAddressInactive]];
[self.addressView addSubview:self.addressIconImageView];
UIFont *placeholderLabelFont = [[TAPStyleManager sharedManager] getComponentFontForType:TAPComponentFontLocationPickerAddressPlaceholder];
UIColor *placeholderLabelColor = [[TAPStyleManager sharedManager] getTextColorForType:TAPTextColorLocationPickerAddressPlaceholder];
_addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.addressIconImageView.frame) + 8.0f, 20.0f, CGRectGetWidth(self.addressView.frame) - (CGRectGetMaxX(self.addressIconImageView.frame) + 8.0f) - 16.0f, 64.0f)];
_addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.addressIconImageView.frame) + 8.0f, 16.0f, CGRectGetWidth(self.addressView.frame) - (CGRectGetMaxX(self.addressIconImageView.frame) + 8.0f) - 16.0f, 64.0f)];
self.addressLabel.font = placeholderLabelFont;
self.addressLabel.textColor = placeholderLabelColor;
self.addressLabel.numberOfLines = 0;
......@@ -84,6 +84,10 @@
self.searchBarView.placeholder = NSLocalizedStringFromTableInBundle(@"Search Address", nil, [TAPUtil currentBundle], @"");
self.searchBarView.leftViewImage = [UIImage imageNamed:@"TAPIconSearch" inBundle:[TAPUtil currentBundle] compatibleWithTraitCollection:nil];
self.searchBarView.leftViewImage = [self.searchBarView.leftViewImage setImageTintColor:[[TAPStyleManager sharedManager] getComponentColorForType:TAPComponentColorIconSearchBarMagnifier]];
if (![[TapTalk sharedInstance] obtainGooglePlacesAPIInitializeState]) {
self.searchBarView.alpha = 0.0f;
}
[self.searchBarView setReturnKeyType:UIReturnKeySearch];
[self addSubview:self.searchBarView];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment