kopia lustrzana https://github.com/ge0rg/aprsdroid
				
				
				
			Fix Derp
							rodzic
							
								
									6cde237df5
								
							
						
					
					
						commit
						6c36ff291f
					
				|  | @ -596,33 +596,28 @@ class AprsService extends Service { | ||||||
| 		// Create a new list of components with modifications | 		// Create a new list of components with modifications | ||||||
| 		val (modifiedPath, modified) = pathComponents.foldLeft((List.empty[String], false)) { | 		val (modifiedPath, modified) = pathComponents.foldLeft((List.empty[String], false)) { | ||||||
| 			case ((acc, hasModified), component) => | 			case ((acc, hasModified), component) => | ||||||
|  | 			 | ||||||
| 				// Check if callssid* is in the path and skip if found | 				// Check if callssid* is in the path and skip if found | ||||||
| 				if (component == s"$callssid*") { | 				if (component == s"$callssid*") { | ||||||
| 					// Skip digipeating if callssid* is found | 					// Skip digipeating if callssid* is found | ||||||
| 					return (lastUsedDigi, false) // Return the original path, do not modify | 					return (lastUsedDigi, false) // Return the original path, do not modify | ||||||
| 				} else if (!hasModified && (digipeaterPaths.exists(path => component.split("-")(0) == path) || digipeaterPaths.contains(component)) || component == callssid) { | 									 | ||||||
|  | 				} else if (!hasModified && (digipeaterPaths.exists(path => component.split("-")(0) == path) || digipeaterPaths.contains(component) || component == callssid)) { | ||||||
| 					// We need to check if the first unused component matches digipeaterpath | 					// We need to check if the first unused component matches digipeaterpath | ||||||
| 					if (acc.isEmpty || acc.last.endsWith("*")) { | 					if (acc.isEmpty || acc.last.endsWith("*")) { | ||||||
| 						// This is the first unused component | 						// This is the first unused component | ||||||
| 						component match { | 						component match { | ||||||
| 	 | 	 | ||||||
| 						 case w if w == callssid => |  | ||||||
| 						 	 // If `callssid` is found (without *), replace with `callssid*` |  | ||||||
| 							if (!hasModified) { |  | ||||||
| 								(acc :+ s"$callssid*", true)							 |  | ||||||
| 							} else { |  | ||||||
| 								(acc :+ w, hasModified) // If already modified, keep `callssid` as-is |  | ||||||
| 							}				 |  | ||||||
| 							 |  | ||||||
| 						  case w if w.matches(".*-(\\d+)$") => | 						  case w if w.matches(".*-(\\d+)$") => | ||||||
| 							// Extract the number from the suffix | 							// Extract the number from the suffix | ||||||
| 							val number = w.split("-").last.toInt | 							val number = w.split("-").last.toInt | ||||||
| 							// Decrement the number | 							// Decrement the number | ||||||
| 							val newNumber = number - 1  | 							val newNumber = number - 1  | ||||||
| 														 | 														 | ||||||
| 							if (newNumber == 0) { | 							if (newNumber == 0 || w == callssid) { | ||||||
| 							  // If the number is decremented to 0, remove the component and insert callssid* | 							  // If the number is decremented to 0, remove the component and insert callssid* | ||||||
| 							  (acc :+ s"$callssid*", true) | 							  (acc :+ s"$callssid*", true) | ||||||
|  | 							   | ||||||
| 							} else { | 							} else { | ||||||
| 							  // Otherwise, decrement the number and keep the component | 							  // Otherwise, decrement the number and keep the component | ||||||
| 							  val newComponent = w.stripSuffix(s"-$number") + s"-$newNumber" | 							  val newComponent = w.stripSuffix(s"-$number") + s"-$newNumber" | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Mike
						Mike