diff --git a/app/ios/.gitignore b/app/ios/.gitignore new file mode 100644 index 0000000..f470299 --- /dev/null +++ b/app/ios/.gitignore @@ -0,0 +1,13 @@ +App/build +App/Pods +App/output +App/App/public +DerivedData +xcuserdata + +# Cordova plugins for Capacitor +capacitor-cordova-ios-plugins + +# Generated Config files +App/App/capacitor.config.json +App/App/config.xml diff --git a/app/ios/App/App.xcodeproj/project.pbxproj b/app/ios/App/App.xcodeproj/project.pbxproj new file mode 100644 index 0000000..33df573 --- /dev/null +++ b/app/ios/App/App.xcodeproj/project.pbxproj @@ -0,0 +1,408 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 2FAD9763203C412B000D30F8 /* config.xml in Resources */ = {isa = PBXBuildFile; fileRef = 2FAD9762203C412B000D30F8 /* config.xml */; }; + 50379B232058CBB4000EE86E /* capacitor.config.json in Resources */ = {isa = PBXBuildFile; fileRef = 50379B222058CBB4000EE86E /* capacitor.config.json */; }; + 504EC3081FED79650016851F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504EC3071FED79650016851F /* AppDelegate.swift */; }; + 504EC30D1FED79650016851F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30B1FED79650016851F /* Main.storyboard */; }; + 504EC30F1FED79650016851F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30E1FED79650016851F /* Assets.xcassets */; }; + 504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; }; + 50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; }; + A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 2FAD9762203C412B000D30F8 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = config.xml; sourceTree = ""; }; + 50379B222058CBB4000EE86E /* capacitor.config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = capacitor.config.json; sourceTree = ""; }; + 504EC3041FED79650016851F /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 504EC3071FED79650016851F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 504EC30C1FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 504EC30E1FED79650016851F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = ""; }; + AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = ""; }; + FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 504EC3011FED79650016851F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 27E2DDA53C4D2A4D1A88CE4A /* Frameworks */ = { + isa = PBXGroup; + children = ( + AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 504EC2FB1FED79650016851F = { + isa = PBXGroup; + children = ( + 504EC3061FED79650016851F /* App */, + 504EC3051FED79650016851F /* Products */, + 7F8756D8B27F46E3366F6CEA /* Pods */, + 27E2DDA53C4D2A4D1A88CE4A /* Frameworks */, + ); + sourceTree = ""; + }; + 504EC3051FED79650016851F /* Products */ = { + isa = PBXGroup; + children = ( + 504EC3041FED79650016851F /* App.app */, + ); + name = Products; + sourceTree = ""; + }; + 504EC3061FED79650016851F /* App */ = { + isa = PBXGroup; + children = ( + 50379B222058CBB4000EE86E /* capacitor.config.json */, + 504EC3071FED79650016851F /* AppDelegate.swift */, + 504EC30B1FED79650016851F /* Main.storyboard */, + 504EC30E1FED79650016851F /* Assets.xcassets */, + 504EC3101FED79650016851F /* LaunchScreen.storyboard */, + 504EC3131FED79650016851F /* Info.plist */, + 2FAD9762203C412B000D30F8 /* config.xml */, + 50B271D01FEDC1A000F3C39B /* public */, + ); + path = App; + sourceTree = ""; + }; + 7F8756D8B27F46E3366F6CEA /* Pods */ = { + isa = PBXGroup; + children = ( + FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */, + AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 504EC3031FED79650016851F /* App */ = { + isa = PBXNativeTarget; + buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */; + buildPhases = ( + 6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */, + 504EC3001FED79650016851F /* Sources */, + 504EC3011FED79650016851F /* Frameworks */, + 504EC3021FED79650016851F /* Resources */, + 9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = App; + productName = App; + productReference = 504EC3041FED79650016851F /* App.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 504EC2FC1FED79650016851F /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 0920; + TargetAttributes = { + 504EC3031FED79650016851F = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 504EC2FB1FED79650016851F; + packageReferences = ( + ); + productRefGroup = 504EC3051FED79650016851F /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 504EC3031FED79650016851F /* App */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 504EC3021FED79650016851F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */, + 50B271D11FEDC1A000F3C39B /* public in Resources */, + 504EC30F1FED79650016851F /* Assets.xcassets in Resources */, + 50379B232058CBB4000EE86E /* capacitor.config.json in Resources */, + 504EC30D1FED79650016851F /* Main.storyboard in Resources */, + 2FAD9763203C412B000D30F8 /* config.xml in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 504EC3001FED79650016851F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 504EC3081FED79650016851F /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 504EC30B1FED79650016851F /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 504EC30C1FED79650016851F /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 504EC3101FED79650016851F /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 504EC3111FED79650016851F /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 504EC3141FED79650016851F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 504EC3151FED79650016851F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 504EC3171FED79650016851F /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_FILE = App/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 1.0; + OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; + PRODUCT_BUNDLE_IDENTIFIER = com.goldenchart.app; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 504EC3181FED79650016851F /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_FILE = App/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.goldenchart.app; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 504EC3141FED79650016851F /* Debug */, + 504EC3151FED79650016851F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 504EC3171FED79650016851F /* Debug */, + 504EC3181FED79650016851F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 504EC2FC1FED79650016851F /* Project object */; +} diff --git a/app/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/app/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/app/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/app/ios/App/App/AppDelegate.swift b/app/ios/App/App/AppDelegate.swift new file mode 100644 index 0000000..c3cd83b --- /dev/null +++ b/app/ios/App/App/AppDelegate.swift @@ -0,0 +1,49 @@ +import UIKit +import Capacitor + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { + // Called when the app was launched with a url. Feel free to add additional processing here, + // but if you want the App API to support tracking app url opens, make sure to keep this call + return ApplicationDelegateProxy.shared.application(app, open: url, options: options) + } + + func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { + // Called when the app was launched with an activity, including Universal Links. + // Feel free to add additional processing here, but if you want the App API to support + // tracking app url opens, make sure to keep this call + return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler) + } + +} diff --git a/app/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png b/app/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png new file mode 100644 index 0000000..adf6ba0 Binary files /dev/null and b/app/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png differ diff --git a/app/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json b/app/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9b7d382 --- /dev/null +++ b/app/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "AppIcon-512@2x.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/app/ios/App/App/Assets.xcassets/Contents.json b/app/ios/App/App/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/app/ios/App/App/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/app/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json b/app/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json new file mode 100644 index 0000000..d7d96a6 --- /dev/null +++ b/app/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "splash-2732x2732-2.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "splash-2732x2732-1.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "splash-2732x2732.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/app/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png b/app/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png new file mode 100644 index 0000000..33ea6c9 Binary files /dev/null and b/app/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png differ diff --git a/app/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png b/app/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png new file mode 100644 index 0000000..33ea6c9 Binary files /dev/null and b/app/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png differ diff --git a/app/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png b/app/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png new file mode 100644 index 0000000..33ea6c9 Binary files /dev/null and b/app/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png differ diff --git a/app/ios/App/App/Base.lproj/LaunchScreen.storyboard b/app/ios/App/App/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..e7ae5d7 --- /dev/null +++ b/app/ios/App/App/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/ios/App/App/Base.lproj/Main.storyboard b/app/ios/App/App/Base.lproj/Main.storyboard new file mode 100644 index 0000000..b44df7b --- /dev/null +++ b/app/ios/App/App/Base.lproj/Main.storyboard @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/ios/App/App/Info.plist b/app/ios/App/App/Info.plist new file mode 100644 index 0000000..bb5e034 --- /dev/null +++ b/app/ios/App/App/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + GoldenChart + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/app/ios/App/Podfile b/app/ios/App/Podfile new file mode 100644 index 0000000..4bbe753 --- /dev/null +++ b/app/ios/App/Podfile @@ -0,0 +1,23 @@ +require_relative '../../node_modules/@capacitor/ios/scripts/pods_helpers' + +platform :ios, '14.0' +use_frameworks! + +# workaround to avoid Xcode caching of Pods that requires +# Product -> Clean Build Folder after new Cordova plugins installed +# Requires CocoaPods 1.6 or newer +install! 'cocoapods', :disable_input_output_paths => true + +def capacitor_pods + pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' + pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' +end + +target 'App' do + capacitor_pods + # Add your Pods here +end + +post_install do |installer| + assertDeploymentTarget(installer) +end diff --git a/app/ios/README.md b/app/ios/README.md new file mode 100644 index 0000000..1ddf2cb --- /dev/null +++ b/app/ios/README.md @@ -0,0 +1,28 @@ +# GoldenChart iOS (Capacitor) + +Xcode 네이티브 프로젝트입니다. TestFlight 배포 절차는 [`docs/ios-testflight-setup.md`](../../docs/ios-testflight-setup.md)를 참고하세요. + +## 빠른 시작 + +```bash +cd app +npm run cap:sync # CocoaPods 필요 — 없으면 pod install만 수동 +npx cap open ios +``` + +CocoaPods 미설치 시: + +```bash +brew install cocoapods +cd app/ios/App && pod install +``` + +또는 저장소 루트: + +```bash +./scripts/init-ios-capacitor.sh +``` + +## Bundle ID + +`com.goldenchart.app` (`capacitor.config.ts`와 동일) diff --git a/app/src/App.tsx b/app/src/App.tsx index 4af0ce0..c3b83cf 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -8,6 +8,7 @@ import { TradeNotificationProvider, useTradeNotification } from './contexts/Trad import { useAppSettings, resolveAppDefaults } from './hooks/useAppSettings'; import TabBar, { type TabId } from './components/TabBar'; import LiveSignalBridge from './components/LiveSignalBridge'; +import AppUpdateGate from './components/AppUpdateGate'; import LoginScreen from './screens/LoginScreen'; import '@frontend/styles/splashScreen.css'; import './theme/global.css'; @@ -116,7 +117,9 @@ function AppRoot() { popupEnabled={false} settingsSessionKey={sessionKey} > - + + + ); diff --git a/app/src/components/AppUpdateGate.tsx b/app/src/components/AppUpdateGate.tsx new file mode 100644 index 0000000..0b5452b --- /dev/null +++ b/app/src/components/AppUpdateGate.tsx @@ -0,0 +1,50 @@ +import React, { useEffect, useState } from 'react'; +import { Capacitor } from '@capacitor/core'; +import { promptAppUpdateIfNeeded } from '../services/appUpdate'; + +type Props = { + children: React.ReactNode; +}; + +/** Android 네이티브 — 시작 시 서버 APK 버전 확인 (무음 스킵, 이후 설정에서 수동 확인) */ +export default function AppUpdateGate({ children }: Props) { + const [ready, setReady] = useState(() => + !Capacitor.isNativePlatform() || Capacitor.getPlatform() !== 'android', + ); + + useEffect(() => { + if (ready) return; + let cancelled = false; + void (async () => { + try { + const { checkForAppUpdate, openApkDownload } = await import('../services/appUpdate'); + const check = await checkForAppUpdate(); + if (!cancelled && check.updateAvailable && check.remoteVersion) { + const dismissed = sessionStorage.getItem(`gc_skip_update_${check.remoteVersion}`); + if (!dismissed) { + const ok = window.confirm( + `GoldenChart v${check.remoteVersion} 업데이트가 있습니다.\n` + + `(현재 v${check.currentVersion})\n\n지금 APK를 다운로드하시겠습니까?`, + ); + if (ok) { + await openApkDownload(check.release); + } else { + sessionStorage.setItem(`gc_skip_update_${check.remoteVersion}`, '1'); + } + } + } + } catch { + /* 네트워크 오류 — 앱 진입 허용 */ + } finally { + if (!cancelled) setReady(true); + } + })(); + return () => { cancelled = true; }; + }, [ready]); + + if (!ready) { + return
업데이트 확인…
; + } + + return <>{children}; +} diff --git a/app/src/screens/settings/SettingsScreen.tsx b/app/src/screens/settings/SettingsScreen.tsx index ef57ce5..9d9bb1c 100644 --- a/app/src/screens/settings/SettingsScreen.tsx +++ b/app/src/screens/settings/SettingsScreen.tsx @@ -1,4 +1,6 @@ import React, { useCallback, useEffect, useState } from 'react'; +import { App } from '@capacitor/app'; +import { Capacitor } from '@capacitor/core'; import { resetPaperAccount, sendFcmTest, @@ -20,11 +22,21 @@ export default function SettingsScreen() { const [fcmAvailable, setFcmAvailable] = useState(false); const [pushPerm, setPushPerm] = useState('—'); const [fcmBusy, setFcmBusy] = useState(false); + const [updateBusy, setUpdateBusy] = useState(false); + const [appVersion, setAppVersion] = useState('—'); useEffect(() => { void loadFcmStatus().then(s => setFcmAvailable(!!s?.available)); }, []); + useEffect(() => { + if (Capacitor.isNativePlatform()) { + void App.getInfo().then(i => setAppVersion(i.version ?? '—')); + } else { + setAppVersion('web'); + } + }, []); + const patch = useCallback((p: AppSettingsDto) => save(p as unknown as Parameters[0]), [save]); const onLogout = () => { @@ -205,6 +217,30 @@ export default function SettingsScreen() { + + + {appVersion} + + {Capacitor.getPlatform() === 'android' && ( + + + + )} + + { + if (!Capacitor.isNativePlatform()) { + return import.meta.env.VITE_APP_VERSION ?? '0.0.0'; + } + try { + const info = await App.getInfo(); + return info.version ?? '0.0.0'; + } catch { + return '0.0.0'; + } +} + +export async function checkForAppUpdate(): Promise { + const currentVersion = await getCurrentAppVersion(); + const release = await loadMobileAppReleaseInfo(); + const remoteVersion = release?.version?.trim(); + const updateAvailable = Boolean( + release?.available + && remoteVersion + && isRemoteVersionNewer(currentVersion, remoteVersion), + ); + return { updateAvailable, currentVersion, remoteVersion, release }; +} + +export async function openApkDownload(release?: MobileAppReleaseInfoDto | null): Promise { + const info = release ?? await loadMobileAppReleaseInfo(); + const url = info?.downloadUrl?.trim(); + if (!url) return false; + + window.location.href = url; + return true; +} + +export async function promptAppUpdateIfNeeded(silent = false): Promise { + if (!Capacitor.isNativePlatform() || Capacitor.getPlatform() !== 'android') { + return false; + } + + const check = await checkForAppUpdate(); + if (!check.updateAvailable || !check.remoteVersion) { + return false; + } + + if (silent) { + return false; + } + + const ok = window.confirm( + `새 버전(v${check.remoteVersion})이 있습니다.\n` + + `현재: v${check.currentVersion}\n\n` + + 'APK를 다운로드하여 설치하시겠습니까?', + ); + if (!ok) return false; + + await openApkDownload(check.release); + return true; +} + +/** 설정 화면 등 — 수동 업데이트 확인 */ +export async function checkAndPromptAppUpdate(): Promise { + const result = await checkForAppUpdate(); + if (!result.updateAvailable) { + window.alert(`최신 버전입니다 (v${result.currentVersion}).`); + return result; + } + const ok = window.confirm( + `새 버전 v${result.remoteVersion} 사용 가능.\nAPK를 다운로드하시겠습니까?`, + ); + if (ok) { + await openApkDownload(result.release); + } + return result; +} diff --git a/backend/src/main/java/com/goldenchart/dto/MobileAppReleaseInfoDto.java b/backend/src/main/java/com/goldenchart/dto/MobileAppReleaseInfoDto.java index 920c50e..5e6e819 100644 --- a/backend/src/main/java/com/goldenchart/dto/MobileAppReleaseInfoDto.java +++ b/backend/src/main/java/com/goldenchart/dto/MobileAppReleaseInfoDto.java @@ -15,4 +15,8 @@ public class MobileAppReleaseInfoDto { private String downloadUrl; /** 모바일 설치 안내 페이지 URL */ private String installPageUrl; + /** iPad TestFlight 초대 URL (App Store 정책상 ipa 직접 배포 불가) */ + private String iosTestFlightUrl; + /** TestFlight 링크 제공 여부 */ + private boolean iosAvailable; } diff --git a/backend/src/main/java/com/goldenchart/service/MobileAppReleaseService.java b/backend/src/main/java/com/goldenchart/service/MobileAppReleaseService.java index a0926f3..f9c5baa 100644 --- a/backend/src/main/java/com/goldenchart/service/MobileAppReleaseService.java +++ b/backend/src/main/java/com/goldenchart/service/MobileAppReleaseService.java @@ -36,13 +36,19 @@ public class MobileAppReleaseService { @Value("${goldenchart.mobile-app.public-base-url:}") private String configuredPublicBaseUrl; + @Value("${goldenchart.mobile-app.ios-testflight-url:}") + private String iosTestFlightUrl; + public MobileAppReleaseInfoDto getInfo(String requestBaseUrl) { String publicBaseUrl = resolvePublicBaseUrl(requestBaseUrl); + boolean iosAvailable = iosTestFlightUrl != null && !iosTestFlightUrl.isBlank(); Optional apk = resolveApkPath(); if (apk.isEmpty()) { return MobileAppReleaseInfoDto.builder() .available(false) .installPageUrl(buildInstallPageUrl(publicBaseUrl)) + .iosAvailable(iosAvailable) + .iosTestFlightUrl(iosAvailable ? iosTestFlightUrl.trim() : null) .build(); } Path file = apk.get(); @@ -61,12 +67,16 @@ public class MobileAppReleaseService { .updatedAt(DT_FMT.format(updated)) .downloadUrl(downloadUrl) .installPageUrl(buildInstallPageUrl(publicBaseUrl)) + .iosAvailable(iosAvailable) + .iosTestFlightUrl(iosAvailable ? iosTestFlightUrl.trim() : null) .build(); } catch (IOException e) { log.warn("[mobile-app] stat failed: {}", e.getMessage()); return MobileAppReleaseInfoDto.builder() .available(false) .installPageUrl(buildInstallPageUrl(publicBaseUrl)) + .iosAvailable(iosAvailable) + .iosTestFlightUrl(iosAvailable ? iosTestFlightUrl.trim() : null) .build(); } } diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index 35fb621..14880b4 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -112,6 +112,14 @@ goldenchart: version: ${GC_MOBILE_APP_VERSION:} # QR·APK 다운로드 절대 URL (로컬 개발 시에도 exdev 서버 APK 사용) public-base-url: ${GC_MOBILE_APP_PUBLIC_BASE_URL:http://exdev.co.kr} + ios-testflight-url: ${GC_MOBILE_APP_IOS_TESTFLIGHT_URL:} + jenkins: + enabled: ${GC_MOBILE_JENKINS_ENABLED:true} + url: ${GC_MOBILE_JENKINS_URL:http://127.0.0.1:8090} + job: ${GC_MOBILE_JENKINS_JOB:goldenChart-Mobile-Pipeline} + user: ${GC_MOBILE_JENKINS_USER:} + token: ${GC_MOBILE_JENKINS_TOKEN:} + trigger-token: ${GC_MOBILE_JENKINS_TRIGGER_TOKEN:goldenchart-mobile-build} desktop-app: release-dir: ${GC_DESKTOP_APP_RELEASE_DIR:data/desktop-releases} version: ${GC_DESKTOP_APP_VERSION:} diff --git a/data/mobile-releases/README.md b/data/mobile-releases/README.md index 93ae583..7b1c1ed 100644 --- a/data/mobile-releases/README.md +++ b/data/mobile-releases/README.md @@ -2,7 +2,24 @@ APK는 **Git에 포함하지 않습니다.** 로컬에서 빌드 후 서버 `data/mobile-releases/`에 업로드합니다. -## exdev.co.kr 업로드 (권장) +## exdev.co.kr 업로드 + +### Jenkins 자동 (git push main) + +`post-receive` → `trigger-mobile-jenkins-build.sh` → `goldenChart-Mobile-Pipeline` + +```bash +# 서버 최초 1회 +./scripts/server-install-mobile-jenkins.sh +``` + +로컬 CI와 동일한 빌드: + +```bash +./scripts/jenkins-mobile-pipeline.sh +``` + +### 수동 업로드 ```bash # 1) docker-compose 볼륨 변경을 서버에 반영 (최초 1회) @@ -51,7 +68,8 @@ docker compose up -d backend # 볼륨 마운트 후 | 변수 | 설명 | |------|------| | `GC_MOBILE_APP_RELEASE_DIR` | 컨테이너 내부 APK 경로 (compose 기본값 사용) | -| `GC_MOBILE_APP_VERSION` | 웹 UI 표시 버전 (`--version` 옵션으로 설정) | +| `GC_MOBILE_APP_VERSION` | 웹 UI 표시 버전 (Jenkins가 `build.gradle` versionName 반영) | +| `GC_MOBILE_APP_IOS_TESTFLIGHT_URL` | iPad TestFlight 초대 URL | ## 앱 API URL diff --git a/docker-compose.yml b/docker-compose.yml index 9dc944f..bb4d32d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,6 +69,7 @@ services: GC_MOBILE_APP_RELEASE_DIR: /app/data/mobile-releases GC_MOBILE_APP_VERSION: ${GC_MOBILE_APP_VERSION:-} GC_MOBILE_APP_PUBLIC_BASE_URL: ${GC_MOBILE_APP_PUBLIC_BASE_URL:-http://exdev.co.kr} + GC_MOBILE_APP_IOS_TESTFLIGHT_URL: ${GC_MOBILE_APP_IOS_TESTFLIGHT_URL:-} GC_DESKTOP_APP_RELEASE_DIR: /app/data/desktop-releases GC_DESKTOP_APP_PUBLIC_BASE_URL: ${GC_DESKTOP_APP_PUBLIC_BASE_URL:-http://exdev.co.kr} GC_DESKTOP_JENKINS_ENABLED: ${GC_DESKTOP_JENKINS_ENABLED:-true} diff --git a/docs/ios-testflight-setup.md b/docs/ios-testflight-setup.md new file mode 100644 index 0000000..ddbe4a2 --- /dev/null +++ b/docs/ios-testflight-setup.md @@ -0,0 +1,38 @@ +# iPad — Capacitor iOS / TestFlight + +## 사전 요구 + +- macOS + Xcode +- Apple Developer Program ($99/년) +- CocoaPods: `brew install cocoapods` + +## iOS 프로젝트 생성 (최초 1회) + +```bash +cd app +npm run cap:sync +npx cap add ios +npx cap open ios +``` + +Xcode에서 **Signing & Capabilities** → Team 선택, Bundle ID `com.goldenchart.app`. + +## TestFlight 업로드 + +1. Xcode → Product → Archive +2. Organizer → Distribute App → App Store Connect → Upload +3. App Store Connect → TestFlight → 내부/외부 테스터 초대 +4. 초대 URL을 서버 `.env`에 설정: + +```env +GC_MOBILE_APP_IOS_TESTFLIGHT_URL=https://testflight.apple.com/join/XXXXXXXX +``` + +5. `docker compose up -d --no-deps backend` (또는 deploy) + +PC 프로그램 탭과 `/api/mobile-app/info`의 `iosTestFlightUrl`에 반영됩니다. + +## 참고 + +- App Store/TestFlight 배포 앱은 **ipa 직접 다운로드·앱 내 APK식 updater 불가** +- iPad와 iPhone은 동일 iOS 빌드 사용 가능 (UI 반응형) diff --git a/docs/mobile-tablet-phase1.md b/docs/mobile-tablet-phase1.md new file mode 100644 index 0000000..23e430a --- /dev/null +++ b/docs/mobile-tablet-phase1.md @@ -0,0 +1,61 @@ +# 모바일·태블릿 Phase 1 — Capacitor 확장 (A) + +## 스택 결정 + +| 항목 | 선택 | +|------|------| +| 단기 경로 | **1단계 A — Capacitor 확장** (`app/`) | +| 장기(선택) | 2단계 B — Tauri Mobile 이전 (미착수) | +| Android 패드 | 동일 APK (반응형 UI) | +| iPad | TestFlight 링크 (ipa 직접 다운로드·앱 내 updater 불가) | + +Phase 1 목표: 데스크톱과 동일한 **git push → CI 빌드 → 다운로드 허브** 흐름을 Android에 맞추고, PC 프로그램 탭에서 Android·iPad를 함께 제공한다. + +## 파이프라인 + +``` +git push main + → post-receive (deploy.sh) + → trigger-mobile-jenkins-build.sh + → jenkins-mobile-pipeline.sh + → build-mobile-apk.sh + → data/mobile-releases/goldenchart-android.apk + → GC_MOBILE_APP_VERSION (.env) +``` + +## 다운로드 UI + +**PC 프로그램** 탭 (`AppDownloadModal`): + +- macOS (.dmg) — 기존 +- Windows (.exe) — 기존 +- Android 패드/폰 (.apk) — `/api/mobile-app/info` +- iPad (TestFlight) — `GC_MOBILE_APP_IOS_TESTFLIGHT_URL` 링크 + +## Android 앱 내 업데이트 + +- 시작 시 `/api/mobile-app/info` 버전 vs `@capacitor/app` `version` +- 새 버전이면 APK 다운로드 URL 열기 (재설치) + +## iPad / TestFlight + +1. Mac + Xcode + Apple Developer Program +2. `cd app && npm run cap:sync && npx cap open ios` +3. Archive → TestFlight 업로드 +4. 서버 `.env`: `GC_MOBILE_APP_IOS_TESTFLIGHT_URL=https://testflight.apple.com/join/...` + +## Jenkins 설치 (서버 1회) + +```bash +./scripts/server-install-mobile-jenkins.sh +# .env 예시 +# GC_MOBILE_JENKINS_TRIGGER_TOKEN=goldenchart-mobile-build +``` + +## 환경 변수 + +| 변수 | 설명 | +|------|------| +| `GC_MOBILE_APP_VERSION` | 웹·API 표시 버전 | +| `GC_MOBILE_APP_IOS_TESTFLIGHT_URL` | iPad TestFlight 초대 URL | +| `GC_MOBILE_JENKINS_*` | Jenkins mobile job (desktop과 동일 패턴) | diff --git a/frontend/src/App.css b/frontend/src/App.css index 0f8f8d2..9d9188e 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -13467,6 +13467,10 @@ html.theme-light .tam-disclaimer { color: #90a4ae; } color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; } .app-download-pc-btn:hover { filter: brightness(1.06); } +.app-download-pc-btn--link { + display: inline-flex; align-items: center; justify-content: center; + text-decoration: none; box-sizing: border-box; +} .tmb-desktop-update-btn.busy { opacity: 0.65; cursor: wait; } .tmb-desktop-update-btn.busy svg { animation: tmb-update-spin 0.9s linear infinite; } @keyframes tmb-update-spin { to { transform: rotate(360deg); } } diff --git a/frontend/src/components/AppDownloadModal.tsx b/frontend/src/components/AppDownloadModal.tsx index 36a38ec..cadd167 100644 --- a/frontend/src/components/AppDownloadModal.tsx +++ b/frontend/src/components/AppDownloadModal.tsx @@ -147,20 +147,98 @@ const MobileTab: React.FC = () => {

- iOS는 App Store / TestFlight 배포가 필요합니다. 현재 QR·APK 설치는 Android 전용입니다. + iPad는 PC 프로그램 탭의 TestFlight 링크를 이용하세요. 이 탭의 QR·APK는 Android 전용입니다.

); }; const PlatformCard: React.FC<{ - platform: 'mac' | 'windows'; + platform: 'mac' | 'windows' | 'android' | 'ipad'; release?: DesktopAppPlatformReleaseDto; -}> = ({ platform, release }) => { - const isMac = platform === 'mac'; - const label = isMac ? 'macOS (Apple Silicon · Intel)' : 'Windows (64-bit)'; - const icon = isMac ? '🍎' : '🪟'; - const ext = isMac ? '.dmg' : '.exe'; + mobile?: MobileAppReleaseInfoDto | null; +}> = ({ platform, release, mobile }) => { + const configs = { + mac: { label: 'macOS (Apple Silicon · Intel)', icon: '🍎', ext: '.dmg', isLink: false }, + windows: { label: 'Windows (64-bit)', icon: '🪟', ext: '.exe', isLink: false }, + android: { label: 'Android (패드 · 폰)', icon: '🤖', ext: '.apk', isLink: false }, + ipad: { label: 'iPad (TestFlight)', icon: '📱', ext: '', isLink: true }, + } as const; + const { label, icon, ext } = configs[platform]; + + if (platform === 'android') { + if (!mobile?.available || !mobile.downloadUrl) { + return ( +
+
{icon}
+
+ {label} +

설치 파일 준비 중 ({ext})

+
+
+ ); + } + return ( +
+
{icon}
+
+ {label} +

+ {mobile.version && v{mobile.version}} + {mobile.sizeBytes != null && {formatBytes(mobile.sizeBytes)}} + {mobile.updatedAt && {mobile.updatedAt}} +

+

+ {mobile.fileName ?? `goldenchart-android${ext}`} +

+
+ +
+ ); + } + + if (platform === 'ipad') { + const testFlightUrl = mobile?.iosTestFlightUrl?.trim(); + if (!mobile?.iosAvailable || !testFlightUrl) { + return ( +
+
{icon}
+
+ {label} +

TestFlight 링크 준비 중

+
+
+ ); + } + return ( +
+
{icon}
+
+ {label} +

+ TestFlight 베타 +

+

+ Apple TestFlight 초대 링크 +

+
+ + TestFlight 열기 + +
+ ); + } if (!release?.available || !release.downloadUrl) { return ( @@ -309,6 +387,7 @@ const DesktopBuildProgressPanel: React.FC<{ const DesktopTab: React.FC<{ canBuildDesktop: boolean }> = ({ canBuildDesktop }) => { const [info, setInfo] = useState(null); + const [mobileInfo, setMobileInfo] = useState(null); const [buildStatus, setBuildStatus] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); @@ -318,9 +397,13 @@ const DesktopTab: React.FC<{ canBuildDesktop: boolean }> = ({ canBuildDesktop }) const [elapsedTick, setElapsedTick] = useState(0); const reloadRelease = useCallback(async () => { - const data = await loadDesktopAppReleaseInfo(); - setInfo(data); - return data; + const [desktop, mobile] = await Promise.all([ + loadDesktopAppReleaseInfo(), + loadMobileAppReleaseInfo(), + ]); + setInfo(desktop); + setMobileInfo(mobile); + return desktop; }, []); const reloadBuildStatus = useCallback(async () => { @@ -388,7 +471,8 @@ const DesktopTab: React.FC<{ canBuildDesktop: boolean }> = ({ canBuildDesktop }) } }, [canBuildDesktop, buildBusy, isBuilding, reloadBuildStatus]); - const hasAny = info?.mac?.available || info?.windows?.available; + const hasAny = info?.mac?.available || info?.windows?.available + || mobileInfo?.available || mobileInfo?.iosAvailable; if (loading) return

PC 프로그램 정보 불러오는 중…

; if (error) return

{error}

; @@ -450,7 +534,7 @@ const DesktopTab: React.FC<{ canBuildDesktop: boolean }> = ({ canBuildDesktop })
💻

설치 파일 준비 중

- macOS(.dmg) 또는 Windows(.exe) 설치 파일이 아직 서버에 없습니다. + macOS(.dmg), Windows(.exe), Android(.apk) 또는 iPad TestFlight 링크가 아직 준비되지 않았습니다.
{canBuildDesktop ? '우측 상단 「앱 빌드」 버튼으로 Jenkins 빌드를 시작하세요.' @@ -469,6 +553,8 @@ const DesktopTab: React.FC<{ canBuildDesktop: boolean }> = ({ canBuildDesktop })

+ +
)} @@ -486,7 +572,10 @@ const DesktopTab: React.FC<{ canBuildDesktop: boolean }> = ({ canBuildDesktop }) xattr -cr /Applications/GoldenChart.app 실행 후 다시 열어보세요.
  • Windows: setup.exe를 실행하고 안내에 따라 설치합니다.
  • +
  • Android (패드·폰): APK를 다운로드한 뒤 설치합니다. 패드와 폰은 동일 APK입니다.
  • +
  • iPad: TestFlight 링크로 베타 앱을 설치합니다 (App Store 정책상 ipa 직접 다운로드 불가).
  • 설치된 PC 앱은 메뉴 우측 상단 업데이트 버튼으로 자동 업데이트할 수 있습니다.
  • +
  • Android 앱은 시작 시 또는 설정에서 새 APK 버전을 안내합니다.
  • 빌드는 Git main 최신 커밋 기준이며, 완료 후 설치 파일이 자동으로 배포됩니다.
  • diff --git a/frontend/src/utils/backendApi.ts b/frontend/src/utils/backendApi.ts index 0436868..5a3f15c 100644 --- a/frontend/src/utils/backendApi.ts +++ b/frontend/src/utils/backendApi.ts @@ -637,6 +637,8 @@ export interface MobileAppReleaseInfoDto { updatedAt?: string; downloadUrl?: string; installPageUrl?: string; + iosAvailable?: boolean; + iosTestFlightUrl?: string; } export async function loadMobileAppReleaseInfo(): Promise { diff --git a/packages/shared/src/api/backendApi.ts b/packages/shared/src/api/backendApi.ts index 68e7a65..ff3167e 100644 --- a/packages/shared/src/api/backendApi.ts +++ b/packages/shared/src/api/backendApi.ts @@ -1506,3 +1506,37 @@ export async function fetchTrendSearchDetail( return request(`/trend-search/detail?${params}`); } +// ── 모바일 앱 배포 ───────────────────────────────────────────────────────────── + +export interface MobileAppReleaseInfoDto { + available: boolean; + fileName?: string; + version?: string; + sizeBytes?: number; + updatedAt?: string; + downloadUrl?: string; + installPageUrl?: string; + iosAvailable?: boolean; + iosTestFlightUrl?: string; +} + +export async function loadMobileAppReleaseInfo(): Promise { + return request('/mobile-app/info'); +} + +/** semver 유사 비교 — remote > local 이면 true */ +export function isRemoteVersionNewer(local: string, remote: string): boolean { + const parse = (v: string) => + v.trim().replace(/^v/i, '').split(/[.-]/).map(p => parseInt(p, 10)).map(n => (Number.isFinite(n) ? n : 0)); + const a = parse(local); + const b = parse(remote); + const len = Math.max(a.length, b.length); + for (let i = 0; i < len; i += 1) { + const av = a[i] ?? 0; + const bv = b[i] ?? 0; + if (bv > av) return true; + if (bv < av) return false; + } + return false; +} + diff --git a/scripts/build-mobile-apk.sh b/scripts/build-mobile-apk.sh new file mode 100755 index 0000000..708fcad --- /dev/null +++ b/scripts/build-mobile-apk.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +# GoldenChart Android APK — 로컬(CI) 빌드 → data/mobile-releases/ +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +cd "$ROOT" + +APK_REMOTE_NAME="${APK_REMOTE_NAME:-goldenchart-android.apk}" +LOCAL_APK="${LOCAL_APK:-$ROOT/data/mobile-releases/$APK_REMOTE_NAME}" + +log() { echo "[build-mobile-apk $(date '+%H:%M:%S')] $*"; } + +sign_release_apk() { + local unsigned="$ROOT/app/android/app/build/outputs/apk/release/app-release-unsigned.apk" + local signed="$ROOT/app/android/app/build/outputs/apk/release/app-release.apk" + local keystore="$ROOT/app/android/goldenchart-release.keystore" + + if [[ ! -f "$unsigned" ]]; then + echo "unsigned APK 없음: $unsigned" >&2 + exit 1 + fi + + if [[ ! -f "$keystore" ]]; then + log "keystore 생성..." + "${JAVA_HOME}/bin/keytool" -genkeypair -v -keystore "$keystore" -alias goldenchart \ + -keyalg RSA -keysize 2048 -validity 10000 \ + -storepass goldenchart -keypass goldenchart \ + -dname "CN=GoldenChart, OU=Mobile, O=GoldenChart, L=Seoul, ST=Seoul, C=KR" + fi + + local apksigner + apksigner="${ANDROID_HOME:-$HOME/Library/Android/sdk}/build-tools/35.0.0/apksigner" + if [[ ! -x "$apksigner" ]]; then + apksigner=$(command -v apksigner 2>/dev/null || true) + fi + if [[ -z "$apksigner" || ! -x "$apksigner" ]]; then + echo "apksigner 없음. Android SDK build-tools 설치 필요." >&2 + exit 1 + fi + + cp "$unsigned" "$signed" + "$apksigner" sign --ks "$keystore" --ks-key-alias goldenchart \ + --ks-pass pass:goldenchart --key-pass pass:goldenchart "$signed" + mkdir -p "$(dirname "$LOCAL_APK")" + cp "$signed" "$LOCAL_APK" + log "서명 완료: $LOCAL_APK" +} + +if [[ -z "${JAVA_HOME:-}" ]] && [[ -x "$HOME/.local/jdk-21.0.11+10/Contents/Home/bin/java" ]]; then + export JAVA_HOME="$HOME/.local/jdk-21.0.11+10/Contents/Home" +fi +if [[ -z "${JAVA_HOME:-}" ]]; then + echo "JAVA_HOME 미설정" >&2 + exit 1 +fi + +log "google-services.json 확인" +"$ROOT/scripts/ensure-android-google-services.sh" + +log "cap:sync" +npm run cap:sync + +log "assembleRelease" +(cd "$ROOT/app/android" && ./gradlew assembleRelease --no-daemon) + +sign_release_apk + +log "완료 $(du -h "$LOCAL_APK" | cut -f1)" diff --git a/scripts/init-ios-capacitor.sh b/scripts/init-ios-capacitor.sh new file mode 100755 index 0000000..25d3aa6 --- /dev/null +++ b/scripts/init-ios-capacitor.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Capacitor iOS 플랫폼 추가·동기화 (Mac + CocoaPods 권장) +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +cd "$ROOT/app" + +npm run build + +if command -v pod >/dev/null 2>&1; then + npx cap add ios 2>/dev/null || true + npx cap sync ios +else + echo "CocoaPods 없음 — iOS 템플릿만 추출합니다 (pod install은 나중에)." + node --input-type=module <<'NODE' +import { loadConfig } from '@capacitor/cli/dist/config.js'; +import { addIOS } from '@capacitor/cli/dist/ios/add.js'; +import { editProjectSettingsIOS } from '@capacitor/cli/dist/ios/common.js'; +const config = await loadConfig({ cwd: process.cwd() }); +const fs = await import('fs'); +if (!fs.existsSync('ios')) { + await addIOS(config); + await editProjectSettingsIOS(config); +} +NODE + echo "완료. brew install cocoapods 후: cd ios/App && pod install" +fi + +echo "Xcode: npm run cap:open:ios" +echo "TestFlight: docs/ios-testflight-setup.md" diff --git a/scripts/jenkins-mobile-pipeline.sh b/scripts/jenkins-mobile-pipeline.sh new file mode 100755 index 0000000..c3c4f98 --- /dev/null +++ b/scripts/jenkins-mobile-pipeline.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# Jenkins goldenChart-Mobile-Pipeline — Android APK 빌드·배포 +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +WORK_TREE="${WORK_TREE:-/Users/aidev/apps/goldenChart}" +export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:${PATH:-/usr/bin:/bin}" +for prefix in "$HOME/homebrew" /opt/homebrew; do + [[ -x "$prefix/bin/brew" ]] && eval "$("$prefix/bin/brew" shellenv)" +done + +log() { echo "[mobile-pipeline $(date '+%H:%M:%S')] $*"; } + +log "=== goldenChart Mobile Pipeline #${BUILD_NUMBER:-local} ===" +log "WORK_TREE=$WORK_TREE" + +cd "$WORK_TREE" + +if [[ -d "${GIT_DIR:-/Volumes/ADATA/git/goldenChart.git}" ]]; then + git --git-dir="${GIT_DIR:-/Volumes/ADATA/git/goldenChart.git}" \ + --work-tree="$WORK_TREE" checkout -f main 2>/dev/null || true +fi + +chmod +x "$ROOT/scripts/"*.sh 2>/dev/null || true + +"$ROOT/scripts/build-mobile-apk.sh" + +VERSION_NAME="$(grep -E 'versionName\s+"' "$ROOT/app/android/app/build.gradle" | head -1 | sed -E 's/.*versionName\s+"([^"]+)".*/\1/' || true)" + +if [[ -n "$VERSION_NAME" ]]; then + log "APK version → $VERSION_NAME" + ENV_FILE="$WORK_TREE/.env" + if [[ -f "$ENV_FILE" ]]; then + { grep -v '^GC_MOBILE_APP_VERSION=' "$ENV_FILE" || true; echo "GC_MOBILE_APP_VERSION=${VERSION_NAME}"; } > "${ENV_FILE}.tmp" + mv "${ENV_FILE}.tmp" "$ENV_FILE" + else + echo "GC_MOBILE_APP_VERSION=${VERSION_NAME}" >> "$ENV_FILE" + fi +fi + +if [[ -x "$WORK_TREE/scripts/restart-backend-if-running.sh" ]]; then + WORK_TREE="$WORK_TREE" "$WORK_TREE/scripts/restart-backend-if-running.sh" || true +elif docker compose -f "$WORK_TREE/docker-compose.yml" ps -q backend 2>/dev/null | grep -q .; then + log "backend 재시작 (APK 볼륨 반영)" + (cd "$WORK_TREE" && docker compose up -d --no-deps backend) || true +fi + +log "Artifacts: $WORK_TREE/data/mobile-releases/" +log "Pipeline complete." diff --git a/scripts/post-receive b/scripts/post-receive index 5d4e2ee..d81fa19 100755 --- a/scripts/post-receive +++ b/scripts/post-receive @@ -62,6 +62,19 @@ while read -r OLDREV NEWREV REFNAME; do else echo "$(date '+%Y-%m-%d %H:%M:%S') $HOOK_TAG [WARN] trigger-desktop-jenkins-build.sh 없음: $TRIGGER" fi + + # Mobile(Android APK) Jenkins 빌드 — git push 성공 후 자동 + TRIGGER_MOBILE="${WORK_TREE}/scripts/trigger-mobile-jenkins-build.sh" + if [ -x "$TRIGGER_MOBILE" ]; then + echo "$(date '+%Y-%m-%d %H:%M:%S') $HOOK_TAG Mobile Jenkins 빌드 트리거" + if "$TRIGGER_MOBILE" >> "$DEPLOY_LOG" 2>&1; then + echo "$(date '+%Y-%m-%d %H:%M:%S') $HOOK_TAG Mobile 빌드 큐 등록 완료" + else + echo "$(date '+%Y-%m-%d %H:%M:%S') $HOOK_TAG [WARN] Mobile Jenkins 트리거 실패 (웹 배포는 성공)" + fi + else + echo "$(date '+%Y-%m-%d %H:%M:%S') $HOOK_TAG [WARN] trigger-mobile-jenkins-build.sh 없음: $TRIGGER_MOBILE" + fi else echo "$(date '+%Y-%m-%d %H:%M:%S') $HOOK_TAG '$BRANCH_NAME' — 배포 스킵 (main만)" fi diff --git a/scripts/restart-backend-if-running.sh b/scripts/restart-backend-if-running.sh new file mode 100755 index 0000000..a093f98 --- /dev/null +++ b/scripts/restart-backend-if-running.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# docker compose backend가 실행 중이면 재시작 (APK·env 반영) +set -euo pipefail + +WORK_TREE="${WORK_TREE:-$(cd "$(dirname "$0")/.." && pwd)}" +cd "$WORK_TREE" + +if docker compose ps -q backend 2>/dev/null | grep -q .; then + echo "[restart-backend] docker compose up -d --no-deps backend" + docker compose up -d --no-deps backend +fi diff --git a/scripts/server-install-mobile-jenkins.sh b/scripts/server-install-mobile-jenkins.sh new file mode 100755 index 0000000..280e46c --- /dev/null +++ b/scripts/server-install-mobile-jenkins.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +# exdev Jenkins — goldenChart-Mobile-Pipeline Job 생성 +set -euo pipefail + +export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:${PATH:-/usr/bin:/bin}" + +JENKINS_HOME="${JENKINS_HOME:-$HOME/.jenkins}" +JENKINS_JOB="goldenChart-Mobile-Pipeline" +JENKINS_TRIGGER_TOKEN="${JENKINS_MOBILE_TRIGGER_TOKEN:-${GC_MOBILE_JENKINS_TRIGGER_TOKEN:-goldenchart-mobile-build}}" +GIT_DIR="${GIT_DIR:-/Volumes/ADATA/git/goldenChart.git}" +WORK_TREE="${WORK_TREE:-/Users/aidev/apps/goldenChart}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +log() { echo "[install-mobile-jenkins] $*"; } + +log "Jenkins job 생성: $JENKINS_JOB" +mkdir -p "${JENKINS_HOME}/jobs/${JENKINS_JOB}" + +cat > "${JENKINS_HOME}/jobs/${JENKINS_JOB}/config.xml" << JENKINS_XML + + + GoldenChart Mobile — Capacitor Android APK + false + + + 2 + + + file://${GIT_DIR} + + + + + */main + + + false + + + + true + false + false + false + ${JENKINS_TRIGGER_TOKEN} + + false + + + #!/bin/bash +set -euo pipefail +export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:\$PATH" +export WORK_TREE="${WORK_TREE}" +export GIT_DIR="${GIT_DIR}" +export BUILD_NUMBER="\${BUILD_NUMBER}" +export ANDROID_HOME="\${ANDROID_HOME:-\$HOME/Library/Android/sdk}" +export JAVA_HOME="\${JAVA_HOME:-\$HOME/.local/jdk-21.0.11+10/Contents/Home}" +"${WORK_TREE}/scripts/jenkins-mobile-pipeline.sh" + + + + + + data/mobile-releases/** + true + false + false + true + + + + +JENKINS_XML + +if curl -sf -o /dev/null "http://127.0.0.1:8090/login" 2>/dev/null; then + curl -sf -X POST "http://127.0.0.1:8090/reload" 2>/dev/null || true +fi + +log "완료: http://127.0.0.1:8090/job/${JENKINS_JOB}/" +log "원격 트리거 토큰: $JENKINS_TRIGGER_TOKEN" +log "post-receive: trigger-mobile-jenkins-build.sh (git push main)" diff --git a/scripts/trigger-mobile-jenkins-build.sh b/scripts/trigger-mobile-jenkins-build.sh new file mode 100755 index 0000000..ea33209 --- /dev/null +++ b/scripts/trigger-mobile-jenkins-build.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +# Git push(main) 후 Jenkins goldenChart-Mobile-Pipeline 트리거 +set -euo pipefail + +JENKINS_URL="${JENKINS_URL:-${GC_MOBILE_JENKINS_URL:-http://127.0.0.1:8090}}" +JENKINS_JOB="${JENKINS_JOB:-${GC_MOBILE_JENKINS_JOB:-goldenChart-Mobile-Pipeline}}" +JENKINS_USER="${JENKINS_USER:-${GC_MOBILE_JENKINS_USER:-}}" +JENKINS_TOKEN="${JENKINS_TOKEN:-${GC_MOBILE_JENKINS_TOKEN:-}}" +JENKINS_TRIGGER_TOKEN="${JENKINS_TRIGGER_TOKEN:-${GC_MOBILE_JENKINS_TRIGGER_TOKEN:-goldenchart-mobile-build}}" +LOG_TAG="[trigger-mobile]" + +log() { echo "$(date '+%Y-%m-%d %H:%M:%S') $LOG_TAG $*"; } + +JENKINS_URL="${JENKINS_URL%/}" +JOB_API="${JENKINS_URL}/job/${JENKINS_JOB// /%20}" + +curl_get() { + if [[ -n "$JENKINS_USER" && -n "$JENKINS_TOKEN" ]]; then + curl -sf -u "${JENKINS_USER}:${JENKINS_TOKEN}" "$@" + else + curl -sf "$@" + fi +} + +curl_post() { + if [[ -n "$JENKINS_USER" && -n "$JENKINS_TOKEN" ]]; then + curl -sf -X POST -u "${JENKINS_USER}:${JENKINS_TOKEN}" "$@" + else + curl -sf -X POST "$@" + fi +} + +log "Jenkins mobile build — $JENKINS_JOB @ $JENKINS_URL" + +if ! curl -sf -o /dev/null "${JENKINS_URL}/login" 2>/dev/null; then + log "[ERROR] Jenkins unreachable: $JENKINS_URL" + exit 1 +fi + +if curl_get "${JOB_API}/lastBuild/api/json?tree=building" 2>/dev/null | grep -q '"building":true'; then + log "[SKIP] 이미 빌드 진행 중" + exit 0 +fi + +CRUMB_HDR=() +CRUMB_JSON="$(curl_get "${JENKINS_URL}/crumbIssuer/api/json" 2>/dev/null || true)" +if [[ -n "$CRUMB_JSON" ]]; then + FIELD="$(node -e "try{console.log(JSON.parse(process.argv[1]).crumbRequestField||'')}catch{}" "$CRUMB_JSON" 2>/dev/null || true)" + VAL="$(node -e "try{console.log(JSON.parse(process.argv[1]).crumb||'')}catch{}" "$CRUMB_JSON" 2>/dev/null || true)" + if [[ -n "$FIELD" && -n "$VAL" ]]; then + CRUMB_HDR=(-H "${FIELD}: ${VAL}") + fi +fi + +if ((${#CRUMB_HDR[@]})); then + if curl_post "${CRUMB_HDR[@]}" -H "Content-Type: application/x-www-form-urlencoded" \ + "${JOB_API}/build?token=${JENKINS_TRIGGER_TOKEN}"; then + log "빌드 큐 등록 완료 (token)" + exit 0 + fi + + if curl_post "${CRUMB_HDR[@]}" -H "Content-Type: application/x-www-form-urlencoded" "${JOB_API}/build"; then + log "빌드 큐 등록 완료" + exit 0 + fi +else + if curl_post -H "Content-Type: application/x-www-form-urlencoded" \ + "${JOB_API}/build?token=${JENKINS_TRIGGER_TOKEN}"; then + log "빌드 큐 등록 완료 (token)" + exit 0 + fi + + if curl_post -H "Content-Type: application/x-www-form-urlencoded" "${JOB_API}/build"; then + log "빌드 큐 등록 완료" + exit 0 + fi +fi + +log "[ERROR] Jenkins build trigger failed" +exit 1