From a9db9356ab48c5e2a00b05a95dd2065720ebf3bc Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Fri, 31 Jul 2020 16:52:07 +0200 Subject: [PATCH] Copied registration code from HelloLinphone to standalone tutorial --- .gitignore | 6 +- .../LoginTutorial.xcodeproj/project.pbxproj | 422 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../LoginTutorial/AppDelegate.swift | 37 ++ .../AppIcon.appiconset/Contents.json | 98 ++++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 ++ .../LoginTutorial/ContentView.swift | 66 +++ swift/LoginTutorial/LoginTutorial/Info.plist | 60 +++ .../LoginTutorial/LoginExample.swift | 123 +++++ .../Preview Assets.xcassets/Contents.json | 6 + .../LoginTutorial/SceneDelegate.swift | 64 +++ swift/LoginTutorial/Podfile | 24 + 16 files changed, 967 insertions(+), 3 deletions(-) create mode 100644 swift/LoginTutorial/LoginTutorial.xcodeproj/project.pbxproj create mode 100644 swift/LoginTutorial/LoginTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 swift/LoginTutorial/LoginTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 swift/LoginTutorial/LoginTutorial.xcworkspace/contents.xcworkspacedata create mode 100644 swift/LoginTutorial/LoginTutorial.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 swift/LoginTutorial/LoginTutorial/AppDelegate.swift create mode 100644 swift/LoginTutorial/LoginTutorial/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 swift/LoginTutorial/LoginTutorial/Assets.xcassets/Contents.json create mode 100644 swift/LoginTutorial/LoginTutorial/Base.lproj/LaunchScreen.storyboard create mode 100644 swift/LoginTutorial/LoginTutorial/ContentView.swift create mode 100644 swift/LoginTutorial/LoginTutorial/Info.plist create mode 100644 swift/LoginTutorial/LoginTutorial/LoginExample.swift create mode 100644 swift/LoginTutorial/LoginTutorial/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 swift/LoginTutorial/LoginTutorial/SceneDelegate.swift create mode 100644 swift/LoginTutorial/Podfile diff --git a/.gitignore b/.gitignore index 4dacb80..b47d107 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,6 @@ java/.externalNativeBuild java/.cxx swift/*/Podfile.lock swift/*/Pods/ -swift/*/HelloLinphone.xcodeproj/project.xcworkspace/xcuserdata/ -swift/*/HelloLinphone.xcodeproj/xcuserdata/ -swift/*/HelloLinphone.xcworkspace/xcuserdata/ +swift/*/*.xcodeproj/project.xcworkspace/xcuserdata/ +swift/*/*.xcodeproj/xcuserdata/ +swift/*/*.xcworkspace/xcuserdata/ diff --git a/swift/LoginTutorial/LoginTutorial.xcodeproj/project.pbxproj b/swift/LoginTutorial/LoginTutorial.xcodeproj/project.pbxproj new file mode 100644 index 0000000..f50008d --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial.xcodeproj/project.pbxproj @@ -0,0 +1,422 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 43EDF804909F295D8FD16E72 /* Pods_LoginTutorial.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52A14DA7DC9DFF94D4A572CE /* Pods_LoginTutorial.framework */; }; + 6604167924D4606A0064FC6C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6604167824D4606A0064FC6C /* AppDelegate.swift */; }; + 6604167B24D4606A0064FC6C /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6604167A24D4606A0064FC6C /* SceneDelegate.swift */; }; + 6604167D24D4606A0064FC6C /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6604167C24D4606A0064FC6C /* ContentView.swift */; }; + 6604167F24D4606B0064FC6C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6604167E24D4606B0064FC6C /* Assets.xcassets */; }; + 6604168224D4606B0064FC6C /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6604168124D4606B0064FC6C /* Preview Assets.xcassets */; }; + 6604168524D4606B0064FC6C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6604168324D4606B0064FC6C /* LaunchScreen.storyboard */; }; + 6604168D24D4607A0064FC6C /* LoginExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6604168C24D4607A0064FC6C /* LoginExample.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 52A14DA7DC9DFF94D4A572CE /* Pods_LoginTutorial.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LoginTutorial.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6604167524D4606A0064FC6C /* LoginTutorial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LoginTutorial.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 6604167824D4606A0064FC6C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 6604167A24D4606A0064FC6C /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 6604167C24D4606A0064FC6C /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 6604167E24D4606B0064FC6C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 6604168124D4606B0064FC6C /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 6604168424D4606B0064FC6C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 6604168624D4606B0064FC6C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6604168C24D4607A0064FC6C /* LoginExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginExample.swift; sourceTree = ""; }; + 86EBE739D84760246FCA17F1 /* Pods-LoginTutorial.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LoginTutorial.debug.xcconfig"; path = "Target Support Files/Pods-LoginTutorial/Pods-LoginTutorial.debug.xcconfig"; sourceTree = ""; }; + A3C6682B4C89F9C91835CCC0 /* Pods-LoginTutorial.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LoginTutorial.release.xcconfig"; path = "Target Support Files/Pods-LoginTutorial/Pods-LoginTutorial.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6604167224D4606A0064FC6C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 43EDF804909F295D8FD16E72 /* Pods_LoginTutorial.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0A22ADFA8AED8923D454874F /* Pods */ = { + isa = PBXGroup; + children = ( + 86EBE739D84760246FCA17F1 /* Pods-LoginTutorial.debug.xcconfig */, + A3C6682B4C89F9C91835CCC0 /* Pods-LoginTutorial.release.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 3200FE58EDFCC48A3C66678D /* Frameworks */ = { + isa = PBXGroup; + children = ( + 52A14DA7DC9DFF94D4A572CE /* Pods_LoginTutorial.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 6604166C24D4606A0064FC6C = { + isa = PBXGroup; + children = ( + 6604167724D4606A0064FC6C /* LoginTutorial */, + 6604167624D4606A0064FC6C /* Products */, + 0A22ADFA8AED8923D454874F /* Pods */, + 3200FE58EDFCC48A3C66678D /* Frameworks */, + ); + sourceTree = ""; + }; + 6604167624D4606A0064FC6C /* Products */ = { + isa = PBXGroup; + children = ( + 6604167524D4606A0064FC6C /* LoginTutorial.app */, + ); + name = Products; + sourceTree = ""; + }; + 6604167724D4606A0064FC6C /* LoginTutorial */ = { + isa = PBXGroup; + children = ( + 6604167824D4606A0064FC6C /* AppDelegate.swift */, + 6604167A24D4606A0064FC6C /* SceneDelegate.swift */, + 6604168C24D4607A0064FC6C /* LoginExample.swift */, + 6604167C24D4606A0064FC6C /* ContentView.swift */, + 6604167E24D4606B0064FC6C /* Assets.xcassets */, + 6604168324D4606B0064FC6C /* LaunchScreen.storyboard */, + 6604168624D4606B0064FC6C /* Info.plist */, + 6604168024D4606B0064FC6C /* Preview Content */, + ); + path = LoginTutorial; + sourceTree = ""; + }; + 6604168024D4606B0064FC6C /* Preview Content */ = { + isa = PBXGroup; + children = ( + 6604168124D4606B0064FC6C /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6604167424D4606A0064FC6C /* LoginTutorial */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6604168924D4606B0064FC6C /* Build configuration list for PBXNativeTarget "LoginTutorial" */; + buildPhases = ( + 4EF45A68E9E85663FD1A4EC6 /* [CP] Check Pods Manifest.lock */, + 6604167124D4606A0064FC6C /* Sources */, + 6604167224D4606A0064FC6C /* Frameworks */, + 6604167324D4606A0064FC6C /* Resources */, + 0131188DB5E696F536B36946 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = LoginTutorial; + productName = LoginTutorial; + productReference = 6604167524D4606A0064FC6C /* LoginTutorial.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6604166D24D4606A0064FC6C /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1150; + LastUpgradeCheck = 1150; + ORGANIZATIONNAME = BelledonneCommunications; + TargetAttributes = { + 6604167424D4606A0064FC6C = { + CreatedOnToolsVersion = 11.5; + }; + }; + }; + buildConfigurationList = 6604167024D4606A0064FC6C /* Build configuration list for PBXProject "LoginTutorial" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 6604166C24D4606A0064FC6C; + productRefGroup = 6604167624D4606A0064FC6C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6604167424D4606A0064FC6C /* LoginTutorial */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6604167324D4606A0064FC6C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6604168524D4606B0064FC6C /* LaunchScreen.storyboard in Resources */, + 6604168224D4606B0064FC6C /* Preview Assets.xcassets in Resources */, + 6604167F24D4606B0064FC6C /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 0131188DB5E696F536B36946 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-LoginTutorial/Pods-LoginTutorial-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-LoginTutorial/Pods-LoginTutorial-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-LoginTutorial/Pods-LoginTutorial-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 4EF45A68E9E85663FD1A4EC6 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-LoginTutorial-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; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6604167124D4606A0064FC6C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6604167924D4606A0064FC6C /* AppDelegate.swift in Sources */, + 6604167B24D4606A0064FC6C /* SceneDelegate.swift in Sources */, + 6604168D24D4607A0064FC6C /* LoginExample.swift in Sources */, + 6604167D24D4606A0064FC6C /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 6604168324D4606B0064FC6C /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 6604168424D4606B0064FC6C /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 6604168724D4606B0064FC6C /* 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_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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; + 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 = 13.5; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 6604168824D4606B0064FC6C /* 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_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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; + 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 = 13.5; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6604168A24D4606B0064FC6C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 86EBE739D84760246FCA17F1 /* Pods-LoginTutorial.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"LoginTutorial/Preview Content\""; + DEVELOPMENT_TEAM = Z2V957B3D6; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = LoginTutorial/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = BC.LoginTutorial; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6604168B24D4606B0064FC6C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = A3C6682B4C89F9C91835CCC0 /* Pods-LoginTutorial.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"LoginTutorial/Preview Content\""; + DEVELOPMENT_TEAM = Z2V957B3D6; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = LoginTutorial/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = BC.LoginTutorial; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6604167024D4606A0064FC6C /* Build configuration list for PBXProject "LoginTutorial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6604168724D4606B0064FC6C /* Debug */, + 6604168824D4606B0064FC6C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6604168924D4606B0064FC6C /* Build configuration list for PBXNativeTarget "LoginTutorial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6604168A24D4606B0064FC6C /* Debug */, + 6604168B24D4606B0064FC6C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6604166D24D4606A0064FC6C /* Project object */; +} diff --git a/swift/LoginTutorial/LoginTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/swift/LoginTutorial/LoginTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..850b263 --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/swift/LoginTutorial/LoginTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/swift/LoginTutorial/LoginTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/swift/LoginTutorial/LoginTutorial.xcworkspace/contents.xcworkspacedata b/swift/LoginTutorial/LoginTutorial.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..3896073 --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/swift/LoginTutorial/LoginTutorial.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/swift/LoginTutorial/LoginTutorial.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/swift/LoginTutorial/LoginTutorial/AppDelegate.swift b/swift/LoginTutorial/LoginTutorial/AppDelegate.swift new file mode 100644 index 0000000..8d50e6a --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial/AppDelegate.swift @@ -0,0 +1,37 @@ +// +// AppDelegate.swift +// LoginTutorial +// +// Created by QuentinArguillere on 31/07/2020. +// Copyright © 2020 BelledonneCommunications. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/swift/LoginTutorial/LoginTutorial/Assets.xcassets/AppIcon.appiconset/Contents.json b/swift/LoginTutorial/LoginTutorial/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/swift/LoginTutorial/LoginTutorial/Assets.xcassets/Contents.json b/swift/LoginTutorial/LoginTutorial/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/swift/LoginTutorial/LoginTutorial/Base.lproj/LaunchScreen.storyboard b/swift/LoginTutorial/LoginTutorial/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swift/LoginTutorial/LoginTutorial/ContentView.swift b/swift/LoginTutorial/LoginTutorial/ContentView.swift new file mode 100644 index 0000000..a55ebec --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial/ContentView.swift @@ -0,0 +1,66 @@ +// +// ContentView.swift +// LoginTutorial +// +// Created by QuentinArguillere on 31/07/2020. +// Copyright © 2020 BelledonneCommunications. All rights reserved. +// + +import SwiftUI + +struct ContentView: View { + + @ObservedObject var tutorialContext = LoginTutorialContext() + + var body: some View { + + VStack { + Group { + HStack { + Text("Identity :") + .font(.title) + TextField("", text : $tutorialContext.id) + .textFieldStyle(RoundedBorderTextFieldStyle()) + } + HStack { + Text("Password :") + .font(.title) + TextField("", text : $tutorialContext.passwd) + .textFieldStyle(RoundedBorderTextFieldStyle()) + } + VStack { + Button(action: tutorialContext.registrationExample) + { + Text("Login") + .font(.largeTitle) + .foregroundColor(Color.white) + .frame(width: 100.0, height: 42.0) + .background(Color.gray) + } + HStack { + Text("Login State : ") + .font(.footnote) + Text(tutorialContext.loggedIn ? "Looged in" : "Unregistered") + .font(.footnote) + .foregroundColor(tutorialContext.loggedIn ? Color.green : Color.black) + } + } + } + Group { + Spacer() + Toggle(isOn: $tutorialContext.logsEnabled) { + Text("Logs collection") + .multilineTextAlignment(.trailing) + } + Text("Hello, Linphone, Core Version is \n \(tutorialContext.coreVersion)") + } + } + .padding() + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/swift/LoginTutorial/LoginTutorial/Info.plist b/swift/LoginTutorial/LoginTutorial/Info.plist new file mode 100644 index 0000000..9742bf0 --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial/Info.plist @@ -0,0 +1,60 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/swift/LoginTutorial/LoginTutorial/LoginExample.swift b/swift/LoginTutorial/LoginTutorial/LoginExample.swift new file mode 100644 index 0000000..c1c8c9b --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial/LoginExample.swift @@ -0,0 +1,123 @@ +// +// LoginExample.swift +// LoginTutorial +// +// Created by QuentinArguillere on 31/07/2020. +// Copyright © 2020 BelledonneCommunications. All rights reserved. +// + +import linphonesw + +class LoginTutorialContext : ObservableObject +{ + var mCore: Core! // We need a Core for... anything, basically + @Published var coreVersion: String = Core.getVersion + + /*------------ Logs related variables ------------------------*/ + var log : LoggingService? + var logManager : LinphoneLoggingServiceManager? + @Published var logsEnabled : Bool = true + + /*------------ Login tutorial related variables -------*/ + var proxy_cfg: ProxyConfig! + let mRegistrationDelegate = LinphoneRegistrationDelegate() + @Published var id : String = "sip:peche5@sip.linphone.org" + @Published var passwd : String = "peche5" + @Published var loggedIn: Bool = false + + init() + { + let factory = Factory.Instance // Instanciate + + logManager = LinphoneLoggingServiceManager() + logManager!.tutorialContext = self; + log = LoggingService.Instance + log!.addDelegate(delegate: logManager!) + log!.logLevel = LogLevel.Debug + factory.enableLogCollection(state: LogCollectionState.Enabled) + + // Initialize Linphone Core + try? mCore = factory.createCore(configPath: "", factoryConfigPath: "", systemContext: nil) + + // main loop for receiving notifications and doing background linphonecore work: + mCore.autoIterateEnabled = true + try? mCore.start() + + } + + + func createProxyConfigAndRegister(identity sId : String, password sPwd : String, factoryUri fUri : String) -> ProxyConfig? + { + let factory = Factory.Instance + do { + let proxy_cfg = try mCore.createProxyConfig() + let address = try factory.createAddress(addr: sId) + let info = try factory.createAuthInfo(username: address.username, userid: "", passwd: sPwd, ha1: "", realm: "", domain: address.domain) + mCore.addAuthInfo(info: info) + + try proxy_cfg.setIdentityaddress(newValue: address) + let server_addr = "sip:" + address.domain + ";transport=tls" + try proxy_cfg.setServeraddr(newValue: server_addr) + proxy_cfg.registerEnabled = true + proxy_cfg.conferenceFactoryUri = fUri + try mCore.addProxyConfig(config: proxy_cfg) + if ( mCore.defaultProxyConfig == nil) + { + // IMPORTANT : default proxy config setting MUST be done AFTER adding the config to the core ! + mCore.defaultProxyConfig = proxy_cfg + } + return proxy_cfg + + } catch { + print(error) + } + return nil + } + + func registrationExample() + { + mCore.addDelegate(delegate: mRegistrationDelegate) // Add registration specific logs + + let factory = Factory.Instance + do { + let proxy_cfg = try mCore.createProxyConfig() + let address = try factory.createAddress(addr: id) + let info = try factory.createAuthInfo(username: address.username, userid: "", passwd: passwd, ha1: "", realm: "", domain: address.domain) + mCore.addAuthInfo(info: info) + + try proxy_cfg.setIdentityaddress(newValue: address) + let server_addr = "sip:" + address.domain + ";transport=tls" + try proxy_cfg.setServeraddr(newValue: server_addr) + proxy_cfg.registerEnabled = true + try mCore.addProxyConfig(config: proxy_cfg) + if ( mCore.defaultProxyConfig == nil) + { + // IMPORTANT : default proxy config setting MUST be done AFTER adding the config to the core ! + mCore.defaultProxyConfig = proxy_cfg + } + loggedIn = true + + } catch { + print(error) + } + } + +} + +class LinphoneLoggingServiceManager: LoggingServiceDelegate { + + var tutorialContext : LoginTutorialContext! + + override func onLogMessageWritten(logService: LoggingService, domain: String, lev: LogLevel, message: String) { + if (tutorialContext.logsEnabled) + { + print("Logging service log: \(message)s\n") + } + } +} + +class LinphoneRegistrationDelegate: CoreDelegate { + override func onRegistrationStateChanged(lc: Core, cfg: ProxyConfig, cstate: RegistrationState, message: String?) { + print("New registration state \(cstate) for user id \( String(describing: cfg.identityAddress?.asString()))\n") + } +} diff --git a/swift/LoginTutorial/LoginTutorial/Preview Content/Preview Assets.xcassets/Contents.json b/swift/LoginTutorial/LoginTutorial/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/swift/LoginTutorial/LoginTutorial/SceneDelegate.swift b/swift/LoginTutorial/LoginTutorial/SceneDelegate.swift new file mode 100644 index 0000000..1211e9c --- /dev/null +++ b/swift/LoginTutorial/LoginTutorial/SceneDelegate.swift @@ -0,0 +1,64 @@ +// +// SceneDelegate.swift +// LoginTutorial +// +// Created by QuentinArguillere on 31/07/2020. +// Copyright © 2020 BelledonneCommunications. All rights reserved. +// + +import UIKit +import SwiftUI + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + + // Create the SwiftUI view that provides the window contents. + let contentView = ContentView() + + // Use a UIHostingController as window root view controller. + if let windowScene = scene as? UIWindowScene { + let window = UIWindow(windowScene: windowScene) + window.rootViewController = UIHostingController(rootView: contentView) + self.window = window + window.makeKeyAndVisible() + } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/swift/LoginTutorial/Podfile b/swift/LoginTutorial/Podfile new file mode 100644 index 0000000..f5bd328 --- /dev/null +++ b/swift/LoginTutorial/Podfile @@ -0,0 +1,24 @@ +# Uncomment the next line to define a global platform for your project +platform :ios, '11.0' +source "https://gitlab.linphone.org/BC/public/podspec.git" +#source "https://github.com/CocoaPods/Specs.git" + +def basic_pods + if ENV['PODFILE_PATH'].nil? + pod 'linphone-sdk', '~> 4.5.0-alpha' + else + pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk + end + +end + + + +target 'LoginTutorial' do + # Comment the next line if you don't want to use dynamic frameworks + use_frameworks! + + # Pods for HelloLinphone + basic_pods + +end