@capgo/capacitor-updater 7.2.19 → 7.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ import Alamofire
14
14
  import Compression
15
15
  import UIKit
16
16
 
17
- @objc public class CapacitorUpdater: NSObject {
17
+ @objc public class CapgoUpdater: NSObject {
18
18
 
19
19
  private let versionCode: String = Bundle.main.versionCode ?? ""
20
20
  private let versionOs = UIDevice.current.systemVersion
@@ -108,7 +108,7 @@ import UIKit
108
108
  do {
109
109
  try FileManager.default.createDirectory(atPath: source.path, withIntermediateDirectories: true, attributes: nil)
110
110
  } catch {
111
- print("\(CapacitorUpdater.TAG) Cannot createDirectory \(source.path)")
111
+ print("\(CapgoUpdater.TAG) Cannot createDirectory \(source.path)")
112
112
  throw CustomError.cannotCreateDirectory
113
113
  }
114
114
  }
@@ -118,7 +118,7 @@ import UIKit
118
118
  do {
119
119
  try FileManager.default.removeItem(atPath: source.path)
120
120
  } catch {
121
- print("\(CapacitorUpdater.TAG) File not removed. \(source.path)")
121
+ print("\(CapgoUpdater.TAG) File not removed. \(source.path)")
122
122
  throw CustomError.cannotDeleteDirectory
123
123
  }
124
124
  }
@@ -135,14 +135,14 @@ import UIKit
135
135
  return false
136
136
  }
137
137
  } catch {
138
- print("\(CapacitorUpdater.TAG) File not moved. source: \(source.path) dest: \(dest.path)")
138
+ print("\(CapgoUpdater.TAG) File not moved. source: \(source.path) dest: \(dest.path)")
139
139
  throw CustomError.cannotUnflat
140
140
  }
141
141
  }
142
142
 
143
143
  private func unzipProgressHandler(entry: String, zipInfo: unz_file_info, entryNumber: Int, total: Int, destUnZip: URL, id: String, unzipError: inout NSError?) {
144
144
  if entry.contains("\\") {
145
- print("\(CapacitorUpdater.TAG) unzip: Windows path is not supported, please use unix path as required by zip RFC: \(entry)")
145
+ print("\(CapgoUpdater.TAG) unzip: Windows path is not supported, please use unix path as required by zip RFC: \(entry)")
146
146
  self.sendStats(action: "windows_path_fail")
147
147
  }
148
148
 
@@ -245,7 +245,7 @@ import UIKit
245
245
  if let channel = channel {
246
246
  parameters.defaultChannel = channel
247
247
  }
248
- print("\(CapacitorUpdater.TAG) Auto-update parameters: \(parameters)")
248
+ print("\(CapgoUpdater.TAG) Auto-update parameters: \(parameters)")
249
249
  let request = AF.request(url, method: .post, parameters: parameters, encoder: JSONParameterEncoder.default, requestModifier: { $0.timeoutInterval = self.timeout })
250
250
 
251
251
  request.validate().responseDecodable(of: AppVersionDec.self) { response in
@@ -279,7 +279,7 @@ import UIKit
279
279
  latest.manifest = manifest
280
280
  }
281
281
  case let .failure(error):
282
- print("\(CapacitorUpdater.TAG) Error getting Latest", response.value ?? "", error )
282
+ print("\(CapgoUpdater.TAG) Error getting Latest", response.value ?? "", error )
283
283
  latest.message = "Error getting Latest \(String(describing: response.value))"
284
284
  latest.error = "response_error"
285
285
  }
@@ -292,7 +292,7 @@ import UIKit
292
292
  private func setCurrentBundle(bundle: String) {
293
293
  UserDefaults.standard.set(bundle, forKey: self.CAP_SERVER_PATH)
294
294
  UserDefaults.standard.synchronize()
295
- print("\(CapacitorUpdater.TAG) Current bundle set to: \((bundle ).isEmpty ? BundleInfo.ID_BUILTIN : bundle)")
295
+ print("\(CapgoUpdater.TAG) Current bundle set to: \((bundle ).isEmpty ? BundleInfo.ID_BUILTIN : bundle)")
296
296
  }
297
297
 
298
298
  private var tempDataPath: URL {
@@ -311,7 +311,7 @@ import UIKit
311
311
 
312
312
  public func downloadManifest(manifest: [ManifestEntry], version: String, sessionKey: String) throws -> BundleInfo {
313
313
  let id = self.randomString(length: 10)
314
- print("\(CapacitorUpdater.TAG) downloadManifest start \(id)")
314
+ print("\(CapgoUpdater.TAG) downloadManifest start \(id)")
315
315
  let destFolder = self.getBundleDirectory(id: id)
316
316
  let builtinFolder = Bundle.main.bundleURL.appendingPathComponent("public")
317
317
 
@@ -343,7 +343,7 @@ import UIKit
343
343
  fileHash = try CryptoCipherV2.decryptChecksum(checksum: fileHash, publicKey: self.publicKey)
344
344
  } catch {
345
345
  downloadError = error
346
- print("\(CapacitorUpdater.TAG) CryptoCipherV2.decryptChecksum error \(id) \(fileName) error: \(error)")
346
+ print("\(CapgoUpdater.TAG) CryptoCipherV2.decryptChecksum error \(id) \(fileName) error: \(error)")
347
347
  }
348
348
  }
349
349
 
@@ -360,13 +360,13 @@ import UIKit
360
360
 
361
361
  if FileManager.default.fileExists(atPath: builtinFilePath.path) && verifyChecksum(file: builtinFilePath, expectedHash: fileHash) {
362
362
  try FileManager.default.copyItem(at: builtinFilePath, to: destFilePath)
363
- print("\(CapacitorUpdater.TAG) downloadManifest \(fileName) using builtin file \(id)")
363
+ print("\(CapgoUpdater.TAG) downloadManifest \(fileName) using builtin file \(id)")
364
364
  completedFiles += 1
365
365
  self.notifyDownload(id: id, percent: self.calcTotalPercent(percent: Int((Double(completedFiles) / Double(totalFiles)) * 100), min: 10, max: 70))
366
366
  dispatchGroup.leave()
367
367
  } else if FileManager.default.fileExists(atPath: cacheFilePath.path) && verifyChecksum(file: cacheFilePath, expectedHash: fileHash) {
368
368
  try FileManager.default.copyItem(at: cacheFilePath, to: destFilePath)
369
- print("\(CapacitorUpdater.TAG) downloadManifest \(fileName) copy from cache \(id)")
369
+ print("\(CapgoUpdater.TAG) downloadManifest \(fileName) copy from cache \(id)")
370
370
  completedFiles += 1
371
371
  self.notifyDownload(id: id, percent: self.calcTotalPercent(percent: Int((Double(completedFiles) / Double(totalFiles)) * 100), min: 10, max: 70))
372
372
  dispatchGroup.leave()
@@ -430,13 +430,13 @@ import UIKit
430
430
 
431
431
  completedFiles += 1
432
432
  self.notifyDownload(id: id, percent: self.calcTotalPercent(percent: Int((Double(completedFiles) / Double(totalFiles)) * 100), min: 10, max: 70))
433
- print("\(CapacitorUpdater.TAG) downloadManifest \(id) \(fileName) downloaded\(isBrotli ? ", decompressed" : "")\(!self.publicKey.isEmpty && !sessionKey.isEmpty ? ", decrypted" : ""), and cached")
433
+ print("\(CapgoUpdater.TAG) downloadManifest \(id) \(fileName) downloaded\(isBrotli ? ", decompressed" : "")\(!self.publicKey.isEmpty && !sessionKey.isEmpty ? ", decrypted" : ""), and cached")
434
434
  } catch {
435
435
  downloadError = error
436
- NSLog("\(CapacitorUpdater.TAG) downloadManifest \(id) \(fileName) error: \(error.localizedDescription)")
436
+ NSLog("\(CapgoUpdater.TAG) downloadManifest \(id) \(fileName) error: \(error.localizedDescription)")
437
437
  }
438
438
  case .failure(let error):
439
- NSLog("\(CapacitorUpdater.TAG) downloadManifest \(id) \(fileName) download error: \(error.localizedDescription). Debug response: \(response.debugDescription).")
439
+ NSLog("\(CapgoUpdater.TAG) downloadManifest \(id) \(fileName) download error: \(error.localizedDescription). Debug response: \(response.debugDescription).")
440
440
  }
441
441
  }
442
442
  }
@@ -455,7 +455,7 @@ import UIKit
455
455
  let updatedBundle = bundleInfo.setStatus(status: BundleStatus.PENDING.localizedString)
456
456
  self.saveBundleInfo(id: id, bundle: updatedBundle)
457
457
 
458
- print("\(CapacitorUpdater.TAG) downloadManifest done \(id)")
458
+ print("\(CapgoUpdater.TAG) downloadManifest done \(id)")
459
459
  return updatedBundle
460
460
  }
461
461
 
@@ -496,7 +496,7 @@ import UIKit
496
496
  var status = compression_stream_init(streamPointer, COMPRESSION_STREAM_DECODE, COMPRESSION_BROTLI)
497
497
 
498
498
  guard status != COMPRESSION_STATUS_ERROR else {
499
- print("\(CapacitorUpdater.TAG) Error: Failed to initialize Brotli stream for \(fileName). Status: \(status)")
499
+ print("\(CapgoUpdater.TAG) Error: Failed to initialize Brotli stream for \(fileName). Status: \(status)")
500
500
  return nil
501
501
  }
502
502
 
@@ -518,7 +518,7 @@ import UIKit
518
518
  if let baseAddress = rawBufferPointer.baseAddress {
519
519
  streamPointer.pointee.src_ptr = baseAddress.assumingMemoryBound(to: UInt8.self)
520
520
  } else {
521
- print("\(CapacitorUpdater.TAG) Error: Failed to get base address for \(fileName)")
521
+ print("\(CapgoUpdater.TAG) Error: Failed to get base address for \(fileName)")
522
522
  status = COMPRESSION_STATUS_ERROR
523
523
  return
524
524
  }
@@ -528,7 +528,7 @@ import UIKit
528
528
  if status == COMPRESSION_STATUS_ERROR {
529
529
  let maxBytes = min(32, data.count)
530
530
  let hexDump = data.prefix(maxBytes).map { String(format: "%02x", $0) }.joined(separator: " ")
531
- print("\(CapacitorUpdater.TAG) Error: Brotli decompression failed for \(fileName). First \(maxBytes) bytes: \(hexDump)")
531
+ print("\(CapgoUpdater.TAG) Error: Brotli decompression failed for \(fileName). First \(maxBytes) bytes: \(hexDump)")
532
532
  break
533
533
  }
534
534
 
@@ -542,18 +542,18 @@ import UIKit
542
542
  if status == COMPRESSION_STATUS_END {
543
543
  break
544
544
  } else if status == COMPRESSION_STATUS_ERROR {
545
- print("\(CapacitorUpdater.TAG) Error: Brotli process failed for \(fileName). Status: \(status)")
545
+ print("\(CapgoUpdater.TAG) Error: Brotli process failed for \(fileName). Status: \(status)")
546
546
  if let text = String(data: data, encoding: .utf8) {
547
547
  let asciiCount = text.unicodeScalars.filter { $0.isASCII }.count
548
548
  let totalCount = text.unicodeScalars.count
549
549
  if totalCount > 0 && Double(asciiCount) / Double(totalCount) >= 0.8 {
550
- print("\(CapacitorUpdater.TAG) Error: Input appears to be plain text: \(text)")
550
+ print("\(CapgoUpdater.TAG) Error: Input appears to be plain text: \(text)")
551
551
  }
552
552
  }
553
553
 
554
554
  let maxBytes = min(32, data.count)
555
555
  let hexDump = data.prefix(maxBytes).map { String(format: "%02x", $0) }.joined(separator: " ")
556
- print("\(CapacitorUpdater.TAG) Error: Raw data (\(fileName)): \(hexDump)")
556
+ print("\(CapgoUpdater.TAG) Error: Raw data (\(fileName)): \(hexDump)")
557
557
 
558
558
  return nil
559
559
  }
@@ -564,7 +564,7 @@ import UIKit
564
564
  }
565
565
 
566
566
  if input.count == 0 {
567
- print("\(CapacitorUpdater.TAG) Error: Zero input size for \(fileName)")
567
+ print("\(CapgoUpdater.TAG) Error: Zero input size for \(fileName)")
568
568
  break
569
569
  }
570
570
  }
@@ -593,7 +593,7 @@ import UIKit
593
593
  let monitor = ClosureEventMonitor()
594
594
  monitor.requestDidCompleteTaskWithError = { (_, _, error) in
595
595
  if error != nil {
596
- print("\(CapacitorUpdater.TAG) Downloading failed - ClosureEventMonitor activated")
596
+ print("\(CapgoUpdater.TAG) Downloading failed - ClosureEventMonitor activated")
597
597
  mainError = error as NSError?
598
598
  }
599
599
  }
@@ -624,11 +624,11 @@ import UIKit
624
624
  }
625
625
 
626
626
  } else {
627
- print("\(CapacitorUpdater.TAG) Download failed")
627
+ print("\(CapgoUpdater.TAG) Download failed")
628
628
  }
629
629
 
630
630
  case .complete:
631
- print("\(CapacitorUpdater.TAG) Download complete, total received bytes: \(totalReceivedBytes)")
631
+ print("\(CapgoUpdater.TAG) Download complete, total received bytes: \(totalReceivedBytes)")
632
632
  self.notifyDownload(id: id, percent: 70, ignoreMultipleOfTen: true)
633
633
  semaphore.signal()
634
634
  }
@@ -650,7 +650,7 @@ import UIKit
650
650
  reachabilityManager?.stopListening()
651
651
 
652
652
  if mainError != nil {
653
- print("\(CapacitorUpdater.TAG) Failed to download: \(String(describing: mainError))")
653
+ print("\(CapgoUpdater.TAG) Failed to download: \(String(describing: mainError))")
654
654
  self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.ERROR, downloaded: Date(), checksum: checksum))
655
655
  throw mainError!
656
656
  }
@@ -660,7 +660,7 @@ import UIKit
660
660
  try CryptoCipherV2.decryptFile(filePath: tempDataPath, publicKey: self.publicKey, sessionKey: sessionKey, version: version)
661
661
  try FileManager.default.moveItem(at: tempDataPath, to: finalPath)
662
662
  } catch {
663
- print("\(CapacitorUpdater.TAG) Failed decrypt file : \(error)")
663
+ print("\(CapgoUpdater.TAG) Failed decrypt file : \(error)")
664
664
  self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.ERROR, downloaded: Date(), checksum: checksum))
665
665
  cleanDownloadData()
666
666
  throw error
@@ -668,11 +668,11 @@ import UIKit
668
668
 
669
669
  do {
670
670
  checksum = CryptoCipherV2.calcChecksum(filePath: finalPath)
671
- print("\(CapacitorUpdater.TAG) Downloading: 80% (unzipping)")
671
+ print("\(CapgoUpdater.TAG) Downloading: 80% (unzipping)")
672
672
  try self.saveDownloaded(sourceZip: finalPath, id: id, base: self.libraryDir.appendingPathComponent(self.bundleDirectory), notify: true)
673
673
 
674
674
  } catch {
675
- print("\(CapacitorUpdater.TAG) Failed to unzip file: \(error)")
675
+ print("\(CapgoUpdater.TAG) Failed to unzip file: \(error)")
676
676
  self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.ERROR, downloaded: Date(), checksum: checksum))
677
677
  cleanDownloadData()
678
678
  // todo: cleanup zip attempts
@@ -680,25 +680,25 @@ import UIKit
680
680
  }
681
681
 
682
682
  self.notifyDownload(id: id, percent: 90)
683
- print("\(CapacitorUpdater.TAG) Downloading: 90% (wrapping up)")
683
+ print("\(CapgoUpdater.TAG) Downloading: 90% (wrapping up)")
684
684
  let info = BundleInfo(id: id, version: version, status: BundleStatus.PENDING, downloaded: Date(), checksum: checksum)
685
685
  self.saveBundleInfo(id: id, bundle: info)
686
686
  self.cleanDownloadData()
687
687
  self.notifyDownload(id: id, percent: 100)
688
- print("\(CapacitorUpdater.TAG) Downloading: 100% (complete)")
688
+ print("\(CapgoUpdater.TAG) Downloading: 100% (complete)")
689
689
  return info
690
690
  }
691
691
  private func ensureResumableFilesExist() {
692
692
  let fileManager = FileManager.default
693
693
  if !fileManager.fileExists(atPath: tempDataPath.path) {
694
694
  if !fileManager.createFile(atPath: tempDataPath.path, contents: Data()) {
695
- print("\(CapacitorUpdater.TAG) Cannot ensure that a file at \(tempDataPath.path) exists")
695
+ print("\(CapgoUpdater.TAG) Cannot ensure that a file at \(tempDataPath.path) exists")
696
696
  }
697
697
  }
698
698
 
699
699
  if !fileManager.fileExists(atPath: updateInfo.path) {
700
700
  if !fileManager.createFile(atPath: updateInfo.path, contents: Data()) {
701
- print("\(CapacitorUpdater.TAG) Cannot ensure that a file at \(updateInfo.path) exists")
701
+ print("\(CapgoUpdater.TAG) Cannot ensure that a file at \(updateInfo.path) exists")
702
702
  }
703
703
  }
704
704
  }
@@ -710,7 +710,7 @@ import UIKit
710
710
  do {
711
711
  try fileManager.removeItem(at: tempDataPath)
712
712
  } catch {
713
- print("\(CapacitorUpdater.TAG) Could not delete file at \(tempDataPath): \(error)")
713
+ print("\(CapgoUpdater.TAG) Could not delete file at \(tempDataPath): \(error)")
714
714
  }
715
715
  }
716
716
  // Deleting update.dat
@@ -718,7 +718,7 @@ import UIKit
718
718
  do {
719
719
  try fileManager.removeItem(at: updateInfo)
720
720
  } catch {
721
- print("\(CapacitorUpdater.TAG) Could not delete file at \(updateInfo): \(error)")
721
+ print("\(CapgoUpdater.TAG) Could not delete file at \(updateInfo): \(error)")
722
722
  }
723
723
  }
724
724
  }
@@ -746,7 +746,7 @@ import UIKit
746
746
  do {
747
747
  try "\(version)".write(to: updateInfo, atomically: true, encoding: .utf8)
748
748
  } catch {
749
- print("\(CapacitorUpdater.TAG) Failed to save progress: \(error)")
749
+ print("\(CapgoUpdater.TAG) Failed to save progress: \(error)")
750
750
  }
751
751
  }
752
752
  private func getLocalUpdateVersion() -> String { // Return the version that was tried to be downloaded on last download attempt
@@ -768,7 +768,7 @@ import UIKit
768
768
  return fileSize.int64Value
769
769
  }
770
770
  } catch {
771
- print("\(CapacitorUpdater.TAG) Could not retrieve already downloaded data size : \(error)")
771
+ print("\(CapgoUpdater.TAG) Could not retrieve already downloaded data size : \(error)")
772
772
  }
773
773
  return 0
774
774
  }
@@ -780,7 +780,7 @@ import UIKit
780
780
  do {
781
781
  let files: [String] = try FileManager.default.contentsOfDirectory(atPath: dest.path)
782
782
  var res: [BundleInfo] = []
783
- print("\(CapacitorUpdater.TAG) list File : \(dest.path)")
783
+ print("\(CapgoUpdater.TAG) list File : \(dest.path)")
784
784
  if dest.exist {
785
785
  for id: String in files {
786
786
  res.append(self.getBundleInfo(id: id))
@@ -788,12 +788,12 @@ import UIKit
788
788
  }
789
789
  return res
790
790
  } catch {
791
- print("\(CapacitorUpdater.TAG) No version available \(dest.path)")
791
+ print("\(CapgoUpdater.TAG) No version available \(dest.path)")
792
792
  return []
793
793
  }
794
794
  } else {
795
795
  guard let regex = try? NSRegularExpression(pattern: "^[0-9A-Za-z]{10}_info$") else {
796
- print("\(CapacitorUpdater.TAG) Invald regex ?????")
796
+ print("\(CapgoUpdater.TAG) Invald regex ?????")
797
797
  return []
798
798
  }
799
799
  return UserDefaults.standard.dictionaryRepresentation().keys.filter {
@@ -812,7 +812,7 @@ import UIKit
812
812
  public func delete(id: String, removeInfo: Bool) -> Bool {
813
813
  let deleted: BundleInfo = self.getBundleInfo(id: id)
814
814
  if deleted.isBuiltin() || self.getCurrentBundleId() == id {
815
- print("\(CapacitorUpdater.TAG) Cannot delete \(id)")
815
+ print("\(CapgoUpdater.TAG) Cannot delete \(id)")
816
816
  return false
817
817
  }
818
818
 
@@ -821,7 +821,7 @@ import UIKit
821
821
  !next.isDeleted() &&
822
822
  !next.isErrorStatus() &&
823
823
  next.getId() == id {
824
- print("\(CapacitorUpdater.TAG) Cannot delete the next bundle \(id)")
824
+ print("\(CapgoUpdater.TAG) Cannot delete the next bundle \(id)")
825
825
  return false
826
826
  }
827
827
 
@@ -829,7 +829,7 @@ import UIKit
829
829
  do {
830
830
  try FileManager.default.removeItem(atPath: destPersist.path)
831
831
  } catch {
832
- print("\(CapacitorUpdater.TAG) Folder \(destPersist.path), not removed.")
832
+ print("\(CapgoUpdater.TAG) Folder \(destPersist.path), not removed.")
833
833
  // even if, we don;t care. Android doesn't care
834
834
  if removeInfo {
835
835
  self.removeBundleInfo(id: id)
@@ -842,7 +842,7 @@ import UIKit
842
842
  } else {
843
843
  self.saveBundleInfo(id: id, bundle: deleted.setStatus(status: BundleStatus.DELETED.localizedString))
844
844
  }
845
- print("\(CapacitorUpdater.TAG) bundle delete \(deleted.getVersionName())")
845
+ print("\(CapgoUpdater.TAG) bundle delete \(deleted.getVersionName())")
846
846
  self.sendStats(action: "delete", versionName: deleted.getVersionName())
847
847
  return true
848
848
  }
@@ -895,7 +895,7 @@ import UIKit
895
895
  public func autoReset() {
896
896
  let currentBundle: BundleInfo = self.getCurrentBundle()
897
897
  if !currentBundle.isBuiltin() && !self.bundleExists(id: currentBundle.getId()) {
898
- print("\(CapacitorUpdater.TAG) Folder at bundle path does not exist. Triggering reset.")
898
+ print("\(CapgoUpdater.TAG) Folder at bundle path does not exist. Triggering reset.")
899
899
  self.reset()
900
900
  }
901
901
  }
@@ -905,7 +905,7 @@ import UIKit
905
905
  }
906
906
 
907
907
  public func reset(isInternal: Bool) {
908
- print("\(CapacitorUpdater.TAG) reset: \(isInternal)")
908
+ print("\(CapgoUpdater.TAG) reset: \(isInternal)")
909
909
  let currentBundleName = self.getCurrentBundle().getVersionName()
910
910
  self.setCurrentBundle(bundle: "")
911
911
  self.setFallbackBundle(fallback: Optional<BundleInfo>.none)
@@ -918,14 +918,14 @@ import UIKit
918
918
  public func setSuccess(bundle: BundleInfo, autoDeletePrevious: Bool) {
919
919
  self.setBundleStatus(id: bundle.getId(), status: BundleStatus.SUCCESS)
920
920
  let fallback: BundleInfo = self.getFallbackBundle()
921
- print("\(CapacitorUpdater.TAG) Fallback bundle is: \(fallback.toString())")
922
- print("\(CapacitorUpdater.TAG) Version successfully loaded: \(bundle.toString())")
921
+ print("\(CapgoUpdater.TAG) Fallback bundle is: \(fallback.toString())")
922
+ print("\(CapgoUpdater.TAG) Version successfully loaded: \(bundle.toString())")
923
923
  if autoDeletePrevious && !fallback.isBuiltin() && fallback.getId() != bundle.getId() {
924
924
  let res = self.delete(id: fallback.getId())
925
925
  if res {
926
- print("\(CapacitorUpdater.TAG) Deleted previous bundle: \(fallback.toString())")
926
+ print("\(CapgoUpdater.TAG) Deleted previous bundle: \(fallback.toString())")
927
927
  } else {
928
- print("\(CapacitorUpdater.TAG) Failed to delete previous bundle: \(fallback.toString())")
928
+ print("\(CapgoUpdater.TAG) Failed to delete previous bundle: \(fallback.toString())")
929
929
  }
930
930
  }
931
931
  self.setFallbackBundle(fallback: bundle)
@@ -938,7 +938,7 @@ import UIKit
938
938
  func unsetChannel() -> SetChannel {
939
939
  let setChannel: SetChannel = SetChannel()
940
940
  if (self.channelUrl ).isEmpty {
941
- print("\(CapacitorUpdater.TAG) Channel URL is not set")
941
+ print("\(CapgoUpdater.TAG) Channel URL is not set")
942
942
  setChannel.message = "Channel URL is not set"
943
943
  setChannel.error = "missing_config"
944
944
  return setChannel
@@ -961,7 +961,7 @@ import UIKit
961
961
  setChannel.message = message
962
962
  }
963
963
  case let .failure(error):
964
- print("\(CapacitorUpdater.TAG) Error unset Channel", response.value ?? "", error)
964
+ print("\(CapgoUpdater.TAG) Error unset Channel", response.value ?? "", error)
965
965
  setChannel.message = "Error unset Channel \(String(describing: response.value))"
966
966
  setChannel.error = "response_error"
967
967
  }
@@ -974,7 +974,7 @@ import UIKit
974
974
  func setChannel(channel: String) -> SetChannel {
975
975
  let setChannel: SetChannel = SetChannel()
976
976
  if (self.channelUrl ).isEmpty {
977
- print("\(CapacitorUpdater.TAG) Channel URL is not set")
977
+ print("\(CapgoUpdater.TAG) Channel URL is not set")
978
978
  setChannel.message = "Channel URL is not set"
979
979
  setChannel.error = "missing_config"
980
980
  return setChannel
@@ -998,7 +998,7 @@ import UIKit
998
998
  setChannel.message = message
999
999
  }
1000
1000
  case let .failure(error):
1001
- print("\(CapacitorUpdater.TAG) Error set Channel", response.value ?? "", error)
1001
+ print("\(CapgoUpdater.TAG) Error set Channel", response.value ?? "", error)
1002
1002
  setChannel.message = "Error set Channel \(String(describing: response.value))"
1003
1003
  setChannel.error = "response_error"
1004
1004
  }
@@ -1011,7 +1011,7 @@ import UIKit
1011
1011
  func getChannel() -> GetChannel {
1012
1012
  let getChannel: GetChannel = GetChannel()
1013
1013
  if (self.channelUrl ).isEmpty {
1014
- print("\(CapacitorUpdater.TAG) Channel URL is not set")
1014
+ print("\(CapgoUpdater.TAG) Channel URL is not set")
1015
1015
  getChannel.message = "Channel URL is not set"
1016
1016
  getChannel.error = "missing_config"
1017
1017
  return getChannel
@@ -1050,7 +1050,7 @@ import UIKit
1050
1050
  }
1051
1051
  }
1052
1052
 
1053
- print("\(CapacitorUpdater.TAG) Error get Channel", response.value ?? "", error)
1053
+ print("\(CapgoUpdater.TAG) Error get Channel", response.value ?? "", error)
1054
1054
  getChannel.message = "Error get Channel \(String(describing: response.value)))"
1055
1055
  getChannel.error = "response_error"
1056
1056
  }
@@ -1085,9 +1085,9 @@ import UIKit
1085
1085
  ).responseData { response in
1086
1086
  switch response.result {
1087
1087
  case .success:
1088
- print("\(CapacitorUpdater.TAG) Stats sent for \(action), version \(versionName)")
1088
+ print("\(CapgoUpdater.TAG) Stats sent for \(action), version \(versionName)")
1089
1089
  case let .failure(error):
1090
- print("\(CapacitorUpdater.TAG) Error sending stats: ", response.value ?? "", error.localizedDescription)
1090
+ print("\(CapgoUpdater.TAG) Error sending stats: ", response.value ?? "", error.localizedDescription)
1091
1091
  }
1092
1092
  semaphore.signal()
1093
1093
  }
@@ -1102,7 +1102,7 @@ import UIKit
1102
1102
  if id != nil {
1103
1103
  trueId = id!
1104
1104
  }
1105
- // print("\(CapacitorUpdater.TAG) Getting info for bundle [\(trueId)]")
1105
+ // print("\(CapgoUpdater.TAG) Getting info for bundle [\(trueId)]")
1106
1106
  let result: BundleInfo
1107
1107
  if BundleInfo.ID_BUILTIN == trueId {
1108
1108
  result = BundleInfo(id: trueId, version: "", status: BundleStatus.SUCCESS, checksum: "")
@@ -1112,11 +1112,11 @@ import UIKit
1112
1112
  do {
1113
1113
  result = try UserDefaults.standard.getObj(forKey: "\(trueId)\(self.INFO_SUFFIX)", castTo: BundleInfo.self)
1114
1114
  } catch {
1115
- print("\(CapacitorUpdater.TAG) Failed to parse info for bundle [\(trueId)]", error.localizedDescription)
1115
+ print("\(CapgoUpdater.TAG) Failed to parse info for bundle [\(trueId)]", error.localizedDescription)
1116
1116
  result = BundleInfo(id: trueId, version: "", status: BundleStatus.PENDING, checksum: "")
1117
1117
  }
1118
1118
  }
1119
- // print("\(CapacitorUpdater.TAG) Returning info bundle [\(result.toString())]")
1119
+ // print("\(CapgoUpdater.TAG) Returning info bundle [\(result.toString())]")
1120
1120
  return result
1121
1121
  }
1122
1122
 
@@ -1136,26 +1136,26 @@ import UIKit
1136
1136
 
1137
1137
  public func saveBundleInfo(id: String, bundle: BundleInfo?) {
1138
1138
  if bundle != nil && (bundle!.isBuiltin() || bundle!.isUnknown()) {
1139
- print("\(CapacitorUpdater.TAG) Not saving info for bundle [\(id)]", bundle?.toString() ?? "")
1139
+ print("\(CapgoUpdater.TAG) Not saving info for bundle [\(id)]", bundle?.toString() ?? "")
1140
1140
  return
1141
1141
  }
1142
1142
  if bundle == nil {
1143
- print("\(CapacitorUpdater.TAG) Removing info for bundle [\(id)]")
1143
+ print("\(CapgoUpdater.TAG) Removing info for bundle [\(id)]")
1144
1144
  UserDefaults.standard.removeObject(forKey: "\(id)\(self.INFO_SUFFIX)")
1145
1145
  } else {
1146
1146
  let update = bundle!.setId(id: id)
1147
- print("\(CapacitorUpdater.TAG) Storing info for bundle [\(id)]", update.toString())
1147
+ print("\(CapgoUpdater.TAG) Storing info for bundle [\(id)]", update.toString())
1148
1148
  do {
1149
1149
  try UserDefaults.standard.setObj(update, forKey: "\(id)\(self.INFO_SUFFIX)")
1150
1150
  } catch {
1151
- print("\(CapacitorUpdater.TAG) Failed to save info for bundle [\(id)]", error.localizedDescription)
1151
+ print("\(CapgoUpdater.TAG) Failed to save info for bundle [\(id)]", error.localizedDescription)
1152
1152
  }
1153
1153
  }
1154
1154
  UserDefaults.standard.synchronize()
1155
1155
  }
1156
1156
 
1157
1157
  private func setBundleStatus(id: String, status: BundleStatus) {
1158
- print("\(CapacitorUpdater.TAG) Setting status for bundle [\(id)] to \(status)")
1158
+ print("\(CapgoUpdater.TAG) Setting status for bundle [\(id)] to \(status)")
1159
1159
  let info = self.getBundleInfo(id: id)
1160
1160
  self.saveBundleInfo(id: id, bundle: info.setStatus(status: status.localizedString))
1161
1161
  }