Skip to content

Commit

Permalink
- google maven reference fix
Browse files Browse the repository at this point in the history
  • Loading branch information
prscms committed May 31, 2018
1 parent b2ca300 commit 402fc3e
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 140 deletions.
6 changes: 3 additions & 3 deletions Example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
buildscript {
repositories {
jcenter()
google()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -18,7 +18,7 @@ allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
Expand Down
3 changes: 2 additions & 1 deletion Example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed May 30 18:27:15 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

This comment has been minimized.

Copy link
@Noitidart

Noitidart May 31, 2018

Contributor

To get it to work for me, I did not have o touch the gradle-wrapper.properties file. Are you sure we need this? I didn't make this change.

This comment has been minimized.

Copy link
@prscX

prscX May 31, 2018

Owner

That's true @Noitidart. This particular commit is not related to the fix. I just have upgraded to latest gradle version. Please let me know in case it does not works.

Thanks
</ Pranav >

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This library is a React Native bridge around native app tour libraries. It allow
buildscript {
repositories {
jcenter()
google()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
...
}
Expand All @@ -40,7 +40,7 @@ allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
...
}
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
buildscript {
repositories {
jcenter()
google()
maven { url "https://maven.google.com" }
}

dependencies {
Expand All @@ -29,7 +29,7 @@ android {

repositories {
mavenCentral()
google()
maven { url "https://maven.google.com" }
}


Expand Down
27 changes: 9 additions & 18 deletions android/src/main/java/ui/apptour/RNAppTourModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void onSequenceCanceled(TapTarget lastTarget) {

@ReactMethod
public void ShowFor(final int view, final ReadableMap props, final Promise promise) {
final Activity activity = this.getCurrentActivity();
final Activity activity = getCurrentActivity();
final Dialog dialog = new AlertDialog.Builder(activity).create();

activity.runOnUiThread(new Runnable() {
Expand Down Expand Up @@ -218,15 +218,6 @@ private TapTarget generateTapTarget(final View view, final ReadableMap props) {
} catch (Exception e) {
}

float finalOuterCircleAlpha = outerCircleAlpha;
int finalTitleTextSize = titleTextSize;
int finalDescriptionTextSize = descriptionTextSize;
boolean finalDrawShadow = drawShadow;
boolean finalCancelable = cancelable;
boolean finalTintTarget = tintTarget;
boolean finalTransparentTarget = transparentTarget;
int finalTargetRadius = targetRadius;


//Populate Props
TapTarget targetView = TapTarget.forView(view, title, description);
Expand All @@ -245,14 +236,14 @@ private TapTarget generateTapTarget(final View view, final ReadableMap props) {
targetView.dimColorInt(Color.parseColor(dimColor));


targetView.outerCircleAlpha(finalOuterCircleAlpha);
targetView.titleTextSize(finalTitleTextSize);
targetView.descriptionTextSize(finalDescriptionTextSize);
targetView.drawShadow(finalDrawShadow);
targetView.cancelable(finalCancelable);
targetView.tintTarget(finalTintTarget);
targetView.transparentTarget(finalTransparentTarget);
targetView.targetRadius(finalTargetRadius);
targetView.outerCircleAlpha(outerCircleAlpha);
targetView.titleTextSize(titleTextSize);
targetView.descriptionTextSize(descriptionTextSize);
targetView.drawShadow(drawShadow);
targetView.cancelable(cancelable);
targetView.tintTarget(tintTarget);
targetView.transparentTarget(transparentTarget);
targetView.targetRadius(targetRadius);

return targetView;
}
Expand Down
195 changes: 98 additions & 97 deletions ios/RNAppTour.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,73 +68,10 @@ - (id)init {
return self;
}


- (dispatch_queue_t)methodQueue {
return dispatch_get_main_queue();
}


- (NSTextAlignment*) getTextAlignmentByString: (NSString*) strAlignment {
if (strAlignment == nil) {
return NSTextAlignmentLeft; // default is left
}

NSString *lowCaseString = [strAlignment lowercaseString];
if ([lowCaseString isEqualToString:@"left"]) {
return NSTextAlignmentLeft;
} if ([lowCaseString isEqualToString:@"right"]) {
return NSTextAlignmentRight;
} if ([lowCaseString isEqualToString:@"center"]) {
return NSTextAlignmentCenter;
} if ([lowCaseString isEqualToString:@"justify"]) {
return NSTextAlignmentJustified;
}

return NSTextAlignmentLeft;
}

- (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start length: (NSUInteger) length {
NSString *substring = [string substringWithRange: NSMakeRange(start, length)];
NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring];
unsigned hexComponent;
[[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent];
return hexComponent / 255.0;
}

- (UIColor *) colorWithHexString: (NSString *) hexString {
NSString *colorString = [[hexString stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
CGFloat alpha, red, blue, green;
switch ([colorString length]) {
case 3: // #RGB
alpha = 1.0f;
red = [self colorComponentFrom: colorString start: 0 length: 1];
green = [self colorComponentFrom: colorString start: 1 length: 1];
blue = [self colorComponentFrom: colorString start: 2 length: 1];
break;
case 4: // #ARGB
alpha = [self colorComponentFrom: colorString start: 0 length: 1];
red = [self colorComponentFrom: colorString start: 1 length: 1];
green = [self colorComponentFrom: colorString start: 2 length: 1];
blue = [self colorComponentFrom: colorString start: 3 length: 1];
break;
case 6: // #RRGGBB
alpha = 1.0f;
red = [self colorComponentFrom: colorString start: 0 length: 2];
green = [self colorComponentFrom: colorString start: 2 length: 2];
blue = [self colorComponentFrom: colorString start: 4 length: 2];
break;
case 8: // #AARRGGBB
alpha = [self colorComponentFrom: colorString start: 0 length: 2];
red = [self colorComponentFrom: colorString start: 2 length: 2];
green = [self colorComponentFrom: colorString start: 4 length: 2];
blue = [self colorComponentFrom: colorString start: 6 length: 2];
break;
default:
return nil;
}
return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
}

RCT_EXPORT_MODULE()

RCT_EXPORT_METHOD(ShowSequence:(NSArray *)views props:(NSDictionary *)props)
Expand All @@ -148,40 +85,6 @@ - (UIColor *) colorWithHexString: (NSString *) hexString {
[self ShowFor:[NSNumber numberWithLongLong:[showTargetKey longLongValue]] props:[targets objectForKey:showTargetKey] ];
}

- (void)showCaseWillDismissWithShowcase:(MaterialShowcase *)materialShowcase {
NSLog(@"");
}
- (void)showCaseDidDismissWithShowcase:(MaterialShowcase *)materialShowcase {
NSLog(@"");

NSArray *targetKeys = [targets allKeys];
if (targetKeys.count <= 0) {
return;
}

NSString *removeTargetKey = [targetKeys objectAtIndex: 0];
[targets removeObjectForKey: removeTargetKey];

NSMutableArray *viewIds = [[NSMutableArray alloc] init];
NSMutableDictionary *props = [[NSMutableDictionary alloc] init];

if (targetKeys.count <= 1) {
[self.bridge.eventDispatcher sendDeviceEventWithName:onFinishShowStepEvent body:@{@"finish": @YES}];
}
else {
[self.bridge.eventDispatcher sendDeviceEventWithName:onShowSequenceStepEvent body:@{@"next_step": @YES}];
}

for (NSString *view in [targets allKeys]) {
[viewIds addObject: [NSNumber numberWithLongLong:[view longLongValue]]];
[props setObject:(NSDictionary *)[targets objectForKey: view] forKey:view];
}

if ([viewIds count] > 0) {
[self ShowSequence:viewIds props:props];
}
}

RCT_EXPORT_METHOD(ShowFor:(nonnull NSNumber *)view props:(NSDictionary *)props)
{
MaterialShowcase *materialShowcase = [self generateMaterialShowcase:view props:props];
Expand Down Expand Up @@ -327,4 +230,102 @@ - (MaterialShowcase *)generateMaterialShowcase:(NSNumber *)view props:(NSDiction
return materialShowcase;
}


- (void)showCaseWillDismissWithShowcase:(MaterialShowcase *)materialShowcase {
NSLog(@"");
}
- (void)showCaseDidDismissWithShowcase:(MaterialShowcase *)materialShowcase {
NSLog(@"");

NSArray *targetKeys = [targets allKeys];
if (targetKeys.count <= 0) {
return;
}

NSString *removeTargetKey = [targetKeys objectAtIndex: 0];
[targets removeObjectForKey: removeTargetKey];

NSMutableArray *viewIds = [[NSMutableArray alloc] init];
NSMutableDictionary *props = [[NSMutableDictionary alloc] init];

if (targetKeys.count <= 1) {
[self.bridge.eventDispatcher sendDeviceEventWithName:onFinishShowStepEvent body:@{@"finish": @YES}];
}
else {
[self.bridge.eventDispatcher sendDeviceEventWithName:onShowSequenceStepEvent body:@{@"next_step": @YES}];
}

for (NSString *view in [targets allKeys]) {
[viewIds addObject: [NSNumber numberWithLongLong:[view longLongValue]]];
[props setObject:(NSDictionary *)[targets objectForKey: view] forKey:view];
}

if ([viewIds count] > 0) {
[self ShowSequence:viewIds props:props];
}
}


- (NSTextAlignment*) getTextAlignmentByString: (NSString*) strAlignment {
if (strAlignment == nil) {
return NSTextAlignmentLeft; // default is left
}

NSString *lowCaseString = [strAlignment lowercaseString];
if ([lowCaseString isEqualToString:@"left"]) {
return NSTextAlignmentLeft;
} if ([lowCaseString isEqualToString:@"right"]) {
return NSTextAlignmentRight;
} if ([lowCaseString isEqualToString:@"center"]) {
return NSTextAlignmentCenter;
} if ([lowCaseString isEqualToString:@"justify"]) {
return NSTextAlignmentJustified;
}

return NSTextAlignmentLeft;
}

- (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start length: (NSUInteger) length {
NSString *substring = [string substringWithRange: NSMakeRange(start, length)];
NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring];
unsigned hexComponent;
[[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent];
return hexComponent / 255.0;
}

- (UIColor *) colorWithHexString: (NSString *) hexString {
NSString *colorString = [[hexString stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
CGFloat alpha, red, blue, green;
switch ([colorString length]) {
case 3: // #RGB
alpha = 1.0f;
red = [self colorComponentFrom: colorString start: 0 length: 1];
green = [self colorComponentFrom: colorString start: 1 length: 1];
blue = [self colorComponentFrom: colorString start: 2 length: 1];
break;
case 4: // #ARGB
alpha = [self colorComponentFrom: colorString start: 0 length: 1];
red = [self colorComponentFrom: colorString start: 1 length: 1];
green = [self colorComponentFrom: colorString start: 2 length: 1];
blue = [self colorComponentFrom: colorString start: 3 length: 1];
break;
case 6: // #RRGGBB
alpha = 1.0f;
red = [self colorComponentFrom: colorString start: 0 length: 2];
green = [self colorComponentFrom: colorString start: 2 length: 2];
blue = [self colorComponentFrom: colorString start: 4 length: 2];
break;
case 8: // #AARRGGBB
alpha = [self colorComponentFrom: colorString start: 0 length: 2];
red = [self colorComponentFrom: colorString start: 2 length: 2];
green = [self colorComponentFrom: colorString start: 4 length: 2];
blue = [self colorComponentFrom: colorString start: 6 length: 2];
break;
default:
return nil;
}
return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
}


@end
16 changes: 0 additions & 16 deletions ios/RNAppTour.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
58B511D71A9E6C8500147676 /* Sources */,
58B511D81A9E6C8500147676 /* Frameworks */,
58B511D91A9E6C8500147676 /* CopyFiles */,
14C24E4574DDBAEA75B69BED /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -187,21 +186,6 @@
/* End PBXReferenceProxy section */

/* Begin PBXShellScriptBuildPhase section */
14C24E4574DDBAEA75B69BED /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RNAppTour/Pods-RNAppTour-resources.sh\"\n";
showEnvVarsInLog = 0;
};
59BECF4019998478B6B4E997 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-app-tour",
"version": "0.0.7",
"version": "0.0.8",
"description": "React Native: Native App Tour Library",
"repository": {
"type": "git",
Expand Down

0 comments on commit 402fc3e

Please sign in to comment.