-
Notifications
You must be signed in to change notification settings - Fork 5
RR-T40 Fixing map error, staffing issues, bottom sheets, edit call. #97
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
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| const filePath = path.join(__dirname, '../node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt'); | ||
|
|
||
| // Restore from backup if exists | ||
| const origPath = filePath + '.original'; | ||
| if (fs.existsSync(origPath)) { | ||
| fs.copyFileSync(origPath, filePath); | ||
| } | ||
|
|
||
| let content = fs.readFileSync(filePath, 'utf8'); | ||
| const lines = content.split('\n'); | ||
|
|
||
| // Properties/functions to remove | ||
| const deprecatedProps = [ | ||
| 'fillPatternCrossFade', | ||
| 'lineElevationReference', | ||
| 'lineCrossSlope', | ||
| 'linePatternCrossFade', | ||
| 'circleElevationReference', | ||
| 'fillExtrusionPatternCrossFade', | ||
| 'fillExtrusionHeightAlignment', | ||
| 'fillExtrusionBaseAlignment', | ||
| 'backgroundPitchAlignment', | ||
| ]; | ||
|
|
||
| const result = []; | ||
| let i = 0; | ||
|
|
||
| while (i < lines.length) { | ||
| const line = lines[i]; | ||
|
|
||
| // Check if this is a case statement for a deprecated property | ||
| let isDeprecatedCase = false; | ||
| for (const prop of deprecatedProps) { | ||
| if (line.match(new RegExp(`"${prop}"\\s*->\\s*$`))) { | ||
| isDeprecatedCase = true; | ||
| // Comment out this line | ||
| result.push(line.replace(/^(\s*)(.*)$/, '$1// $2 // Deprecated in Mapbox SDK 11.8+')); | ||
|
|
||
| // Find and comment out the next statement (could be a function call or block) | ||
| let j = i + 1; | ||
| let braceDepth = 0; | ||
| let inBlock = false; | ||
|
|
||
| while (j < lines.length) { | ||
| const nextLine = lines[j]; | ||
|
|
||
| // Check if we've hit another case or end of when block | ||
| if (nextLine.match(/^\s*"/)) { | ||
| break; | ||
| } | ||
| if (nextLine.match(/^\s*else\s*->/)) { | ||
| break; | ||
| } | ||
|
|
||
| // Count braces to handle blocks | ||
| const openBraces = (nextLine.match(/{/g) || []).length; | ||
| const closeBraces = (nextLine.match(/}/g) || []).length; | ||
| braceDepth += openBraces - closeBraces; | ||
|
|
||
| if (openBraces > 0) inBlock = true; | ||
|
|
||
| // Comment out non-empty lines | ||
| if (nextLine.trim()) { | ||
| result.push(nextLine.replace(/^(\s*)(.*)$/, '$1// $2')); | ||
| } else { | ||
| result.push(nextLine); | ||
| } | ||
|
|
||
| // If we were in a block and braces are balanced, we're done | ||
| if (inBlock && braceDepth === 0) { | ||
| j++; | ||
| break; | ||
| } | ||
|
|
||
| // If not in a block and we have a statement, move on | ||
| if (!inBlock && nextLine.trim() && !nextLine.trim().startsWith('//')) { | ||
| j++; | ||
| break; | ||
| } | ||
|
|
||
| j++; | ||
| } | ||
|
|
||
| i = j; | ||
| continue; | ||
| } | ||
| } | ||
|
|
||
| if (!isDeprecatedCase) { | ||
| // Check if this is a function definition for deprecated function | ||
| let isDeprecatedFunc = false; | ||
| for (const prop of deprecatedProps) { | ||
| const funcName = 'set' + prop.charAt(0).toUpperCase() + prop.slice(1); | ||
| if (line.match(new RegExp(`fun\\s+${funcName}\\s*\\(`))) { | ||
| isDeprecatedFunc = true; | ||
|
|
||
| // Comment out entire function | ||
| let braceDepth = 0; | ||
| let j = i; | ||
|
|
||
| while (j < lines.length) { | ||
| const funcLine = lines[j]; | ||
| const openBraces = (funcLine.match(/{/g) || []).length; | ||
| const closeBraces = (funcLine.match(/}/g) || []).length; | ||
| braceDepth += openBraces - closeBraces; | ||
|
|
||
| // Comment the line | ||
| if (funcLine.trim()) { | ||
| result.push(funcLine.replace(/^(\s*)(.*)$/, '$1// $2')); | ||
| } else { | ||
| result.push(funcLine); | ||
| } | ||
|
|
||
| j++; | ||
|
|
||
| // Function complete when braces balance | ||
| if (braceDepth === 0 && closeBraces > 0) { | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| i = j; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| if (!isDeprecatedFunc) { | ||
| result.push(line); | ||
| i++; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Write the modified content | ||
| fs.writeFileSync(filePath, result.join('\n')); | ||
|
|
||
| console.log('Successfully patched RNMBXStyleFactory.kt'); | ||
| console.log('Deprecated properties and functions have been commented out'); | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| const filePath = path.join(__dirname, '../node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt'); | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| console.log('Reading file:', filePath); | ||
| let content = fs.readFileSync(filePath, 'utf8'); | ||
|
|
||
| // Backup original | ||
| fs.writeFileSync(filePath + '.original', content); | ||
|
|
||
| // Functions to remove | ||
| const functionsToRemove = [ | ||
| 'setFillPatternCrossFade', | ||
| 'setLineElevationReference', | ||
| 'setLineCrossSlope', | ||
| 'setLinePatternCrossFade', | ||
| 'setCircleElevationReference', | ||
| 'setFillExtrusionPatternCrossFade', | ||
| 'setFillExtrusionHeightAlignment', | ||
| 'setFillExtrusionBaseAlignment', | ||
| 'setBackgroundPitchAlignment', | ||
| ]; | ||
|
|
||
| functionsToRemove.forEach((funcName) => { | ||
| console.log(`Commenting out function: ${funcName}`); | ||
|
|
||
| // Match the function and its body with proper brace matching | ||
| const regex = new RegExp(`(\\s+)(fun\\s+${funcName}\\s*\\([^)]+\\)[^{]*\\{)([\\s\\S]*?)(\\n\\s+\\})`, 'gm'); | ||
|
|
||
| content = content.replace(regex, (match, indent, funcDecl, funcBody, closeBrace) => { | ||
| // Comment each line | ||
| const commentedDecl = indent + '// ' + funcDecl.trim(); | ||
| const commentedBody = funcBody | ||
| .split('\n') | ||
| .map((line) => { | ||
| if (line.trim()) { | ||
| // Preserve original indentation and add comment | ||
| return line.replace(/^(\s*)/, '$1// '); | ||
| } | ||
| return line; | ||
| }) | ||
| .join('\n'); | ||
| const commentedClose = closeBrace.replace(/^(\s*)/, '$1// '); | ||
|
|
||
| return commentedDecl + commentedBody + commentedClose; | ||
| }); | ||
| }); | ||
|
|
||
| // Write the modified content | ||
| fs.writeFileSync(filePath, content); | ||
|
|
||
| console.log('Successfully patched RNMBXStyleFactory.kt'); | ||
| console.log('Original backed up to', filePath + '.original'); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| #!/usr/bin/env perl | ||
| use strict; | ||
| use warnings; | ||
|
|
||
| my $file = 'node_modules/@rnmapbox/maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt'; | ||
|
|
||
| # Read file | ||
| open(my $fh, '<', $file) or die "Cannot open $file: $!"; | ||
| my @lines = <$fh>; | ||
| close($fh); | ||
|
|
||
| # Backup (restore from original if exists) | ||
| if (-f "$file.original") { | ||
| open(my $orig, '<', "$file.original") or die "Cannot open original: $!"; | ||
| @lines = <$orig>; | ||
| close($orig); | ||
| } | ||
|
|
||
| my @functions = qw( | ||
| setFillPatternCrossFade | ||
| setLineElevationReference | ||
| setLineCrossSlope | ||
| setLinePatternCrossFade | ||
| setCircleElevationReference | ||
| setFillExtrusionPatternCrossFade | ||
| setFillExtrusionHeightAlignment | ||
| setFillExtrusionBaseAlignment | ||
| setBackgroundPitchAlignment | ||
| ); | ||
|
|
||
| my $in_function = 0; | ||
| my $in_case = 0; | ||
| my $brace_count = 0; | ||
| my @output; | ||
|
|
||
| for (my $i = 0; $i < @lines; $i++) { | ||
| my $line = $lines[$i]; | ||
|
|
||
| # Check if we're in a case statement for one of the deprecated functions | ||
| foreach my $func (@functions) { | ||
| # Convert function names to property names (e.g., setFillPatternCrossFade -> fillPatternCrossFade) | ||
| my $propName = $func; | ||
| $propName =~ s/^set(.)/lc($1)/e; # Remove 'set' and lowercase first letter | ||
|
|
||
| if ($line =~ /"$propName"\s*->/ && !$in_case) { | ||
| $in_case = 1; | ||
| # Comment this line and peek ahead to find where the case ends | ||
| push @output, $line; | ||
| $output[-1] =~ s/^(\s*)(.+)$/$1\/\/ $2/; | ||
|
|
||
| # Look ahead to find what comes next and comment it too | ||
| my $j = $i + 1; | ||
| while ($j < @lines && $lines[$j] !~ /^\s*"/ && $lines[$j] !~ /^\s*else\s*->/ && $lines[$j] !~ /^\s*\}/) { | ||
| push @output, $lines[$j]; | ||
| $output[-1] =~ s/^(\s*)(.+)$/$1\/\/ $2/ if $lines[$j] =~ /\S/; | ||
| $i = $j; | ||
| $j++; | ||
| # If we hit a closing brace that's part of the case, stop | ||
| if ($lines[$j] =~ /^\s*}\s*$/) { | ||
| last; | ||
| } | ||
| } | ||
| $in_case = 0; | ||
| next; | ||
| } | ||
| } | ||
|
|
||
| # Check if we're starting a function we want to comment | ||
| if (!$in_function) { | ||
| foreach my $func (@functions) { | ||
| if ($line =~ /fun\s+$func\s*\(/) { | ||
| $in_function = 1; | ||
| $brace_count = 0; | ||
| last; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if ($in_function) { | ||
| # Count braces | ||
| my $open = () = $line =~ /{/g; | ||
| my $close = () = $line =~ /}/g; | ||
| $brace_count += $open - $close; | ||
|
|
||
| # Comment the line | ||
| if ($line =~ /^(\s*)(.+)$/) { | ||
| push @output, "$1// $2\n"; | ||
| } else { | ||
| push @output, $line; | ||
| } | ||
|
|
||
| # Check if function is complete | ||
| if ($brace_count == 0 && $close > 0) { | ||
| $in_function = 0; | ||
| } | ||
| } else { | ||
| push @output, $line unless $in_case; | ||
| } | ||
| } | ||
|
|
||
| # Write output | ||
| open(my $out, '>', $file) or die "Cannot write to $file: $!"; | ||
| print $out @output; | ||
| close($out); | ||
|
|
||
| print "Successfully patched $file\n"; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.