diff --git a/.gitignore b/.gitignore index 41f6bb494..9796ab682 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,7 @@ npm-debug.log* /android /package-lock.json - + src/app/architect/ src/environments/environment.e2e.ts .env @@ -51,4 +51,6 @@ src/app/store/notification.service.ts src/assets/www/pdfjs/web/compressed.tracemonkey-pldi-09.pdf.pdf node_modules_ -node_modules__ \ No newline at end of file +node_modules__ +plugins_ +ios diff --git a/capacitor.config.json b/capacitor.config.json deleted file mode 100644 index 1119e4dc1..000000000 --- a/capacitor.config.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "appId": "com.gpr.gabinetedigital", - "appName": "gabinete-digital", - "webDir": "www", - "npmClient": "npm", - "linuxAndroidStudioPath": "/snap/android-studio/current/android-studio/bin/studio.sh", - "cordova": { - "preferences": { - "ScrollEnabled": "false", - "BackupWebStorage": "none", - "SplashMaintainAspectRatio": "true", - "FadeSplashScreenDuration": "300", - "SplashShowOnlyFirstTime": "false", - "SplashScreen": "screen", - "SplashScreenDelay": "3000" - } - }, - "android": { - "allowMixedContent": true - }, - "bundledWebRuntime": false -} diff --git a/capacitor.config.ts b/capacitor.config.ts new file mode 100644 index 000000000..35aed5d7f --- /dev/null +++ b/capacitor.config.ts @@ -0,0 +1,25 @@ +// / +// / +// / + +import { CapacitorConfig } from '@capacitor/cli'; + +const config: CapacitorConfig = { + appId: 'com.capacitorjs.app.testapp', + appName: 'capacitor-testapp', + webDir: 'build', + plugins: { + SplashScreen: { + launchAutoHide: false, + }, + LocalNotifications: { + smallIcon: 'ic_stat_icon_config_sample', + iconColor: '#CE0B7C', + }, + PushNotifications: { + presentationOptions: ['alert', 'sound'], + }, + }, +}; + +export default config; diff --git a/config.xml b/config.xml index 978013e02..815386583 100644 --- a/config.xml +++ b/config.xml @@ -46,6 +46,55 @@ +<<<<<<< HEAD +<<<<<<< HEAD + + 3077110622 + 3619450036 + + + + + + 1979143311 + 1328564293 + + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + 0 + + 8.0.0.00-20210905-154328 + + + + + en + /adapters/MobileAPIProxy + 2 +======= +>>>>>>> d9593fa592ca58a1f04e3fcd0aaf596f9a54cd3a +======= +>>>>>>> 562e405f192af623ae8d2ac244c729b150b0cf99 diff --git a/firebase-messaging-sw.js b/firebase-messaging-sw.js index aa3917c40..138a7fd1c 100644 --- a/firebase-messaging-sw.js +++ b/firebase-messaging-sw.js @@ -1,11 +1,29 @@ - if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('./firebase-messaging-sw.js') - .then(function(registration) { - console.log('Registration successful, scope is:', registration.scope); - }).catch(function(err) { - console.log('Service worker registration failed, error:', err); - }); - } +if ("serviceWorker" in navigator) { + navigator.serviceWorker + .register("./firebase-messaging-sw.js") + .then(function(registration) { + console.log("Registration successful, scope is:", registration.scope); + messaging.getToken({vapidKey: 'BEuyzkUKcx4FSs-6GaIz_si2oV5Ut7e5ZEtcrVvr5L_tMVWZtS1NTqdtQkih5QCt2FZKuRUxZIaLm5GaxI6nJEw', serviceWorkerRegistration : registration }) + .then((currentToken) => { + if (currentToken) { + console.log('current token for client: ', currentToken); + + // Track the token -> client mapping, by sending to backend server + // show on the UI that permission is secured + } else { + console.log('No registration token available. Request permission to generate one.'); + + // shows on the UI that permission is required + } + }).catch((err) => { + console.log('An error occurred while retrieving token. ', err); + // catch error while creating client token + }); + }) + .catch(function(err) { + console.log("Service worker registration failed, error:" , err ); + }); + } // Scripts for firebase and firebase messaging diff --git a/ios/.gitignore b/ios/.gitignore deleted file mode 100644 index 75e8c5aec..000000000 --- a/ios/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -App/build -App/Pods -App/Podfile.lock -App/App/public -DerivedData -xcuserdata - -# Cordova plugins for Capacitor -capacitor-cordova-ios-plugins diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj deleted file mode 100644 index 8d49770cd..000000000 --- a/ios/App/App.xcodeproj/project.pbxproj +++ /dev/null @@ -1,402 +0,0 @@ -// !$*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; - 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 = 12.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 = 12.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; - INFOPLIST_FILE = App/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; - PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital; - 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; - INFOPLIST_FILE = App/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital; - 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/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 42daef8a1..000000000 --- a/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/ios/App/App.xcworkspace/contents.xcworkspacedata b/ios/App/App.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index b301e824b..000000000 --- a/ios/App/App.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/ios/App/App/AppDelegate.swift b/ios/App/App/AppDelegate.swift deleted file mode 100644 index 53e376039..000000000 --- a/ios/App/App/AppDelegate.swift +++ /dev/null @@ -1,60 +0,0 @@ -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) - } - - override func touchesBegan(_ touches: Set, with event: UIEvent?) { - super.touchesBegan(touches, with: event) - - let statusBarRect = UIApplication.shared.statusBarFrame - guard let touchPoint = event?.allTouches?.first?.location(in: self.window) else { return } - - if statusBarRect.contains(touchPoint) { - NotificationCenter.default.post(name: .capacitorStatusBarTapped, object: nil) - } - } - -} diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png deleted file mode 100644 index 2f503741c..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png deleted file mode 100644 index dd72c1ce8..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png deleted file mode 100644 index dd72c1ce8..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png deleted file mode 100644 index 7fbf0a84a..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png deleted file mode 100644 index f996ea18f..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png deleted file mode 100644 index bb2935fb7..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png deleted file mode 100644 index bb2935fb7..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png deleted file mode 100644 index 21d16e5b1..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png deleted file mode 100644 index dd72c1ce8..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png deleted file mode 100644 index ff0754519..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png deleted file mode 100644 index ff0754519..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png deleted file mode 100644 index 3401fa887..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png deleted file mode 100644 index adf6ba01d..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png deleted file mode 100644 index ffd0da781..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png deleted file mode 100644 index 90aea7cd2..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png deleted file mode 100644 index 2f5eafb6b..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png deleted file mode 100644 index 89c8d0448..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png b/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png deleted file mode 100644 index ef541c90a..000000000 Binary files a/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 90eea7ec7..000000000 --- a/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "images" : [ - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "AppIcon-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "AppIcon-20x20@3x.png", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "AppIcon-29x29@2x-1.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "AppIcon-29x29@3x.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "AppIcon-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "AppIcon-40x40@3x.png", - "scale" : "3x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "AppIcon-60x60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "AppIcon-60x60@3x.png", - "scale" : "3x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "AppIcon-20x20@1x.png", - "scale" : "1x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "AppIcon-20x20@2x-1.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "AppIcon-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "AppIcon-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "AppIcon-40x40@1x.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "AppIcon-40x40@2x-1.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "AppIcon-76x76@1x.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "AppIcon-76x76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "AppIcon-83.5x83.5@2x.png", - "scale" : "2x" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "AppIcon-512@2x.png", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios/App/App/Assets.xcassets/Contents.json b/ios/App/App/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c9..000000000 --- a/ios/App/App/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json b/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json deleted file mode 100644 index d7d96a67c..000000000 --- a/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "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/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png b/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png deleted file mode 100644 index 33ea6c970..000000000 Binary files a/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png b/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png deleted file mode 100644 index 33ea6c970..000000000 Binary files a/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png and /dev/null differ diff --git a/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png b/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png deleted file mode 100644 index 33ea6c970..000000000 Binary files a/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png and /dev/null differ diff --git a/ios/App/App/Base.lproj/LaunchScreen.storyboard b/ios/App/App/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index e7ae5d780..000000000 --- a/ios/App/App/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ios/App/App/Base.lproj/Main.storyboard b/ios/App/App/Base.lproj/Main.storyboard deleted file mode 100644 index b44df7be8..000000000 --- a/ios/App/App/Base.lproj/Main.storyboard +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/ios/App/App/Info.plist b/ios/App/App/Info.plist deleted file mode 100644 index a63138a44..000000000 --- a/ios/App/App/Info.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - gabinete-digital - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - NSMicrophoneUsageDescription - We want to record some audio from you - - diff --git a/ios/App/App/capacitor.config.json b/ios/App/App/capacitor.config.json deleted file mode 100644 index 8deba142d..000000000 --- a/ios/App/App/capacitor.config.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "appId": "com.gpr.gabinetedigital", - "appName": "gabinete-digital", - "webDir": "www", - "npmClient": "npm", - "linuxAndroidStudioPath": "/snap/android-studio/current/android-studio/bin/studio.sh", - "cordova": { - "preferences": { - "ScrollEnabled": "false", - "BackupWebStorage": "none", - "SplashMaintainAspectRatio": "true", - "FadeSplashScreenDuration": "300", - "SplashShowOnlyFirstTime": "false", - "SplashScreen": "screen", - "SplashScreenDelay": "3000" - } - }, - "android": { - "allowMixedContent": true - }, - "bundledWebRuntime": false -} diff --git a/ios/App/App/config.xml b/ios/App/App/config.xml deleted file mode 100644 index 43b503a74..000000000 --- a/ios/App/App/config.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ios/App/Podfile b/ios/App/Podfile deleted file mode 100644 index ee4cde511..000000000 --- a/ios/App/Podfile +++ /dev/null @@ -1,27 +0,0 @@ -platform :ios, '12.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' - pod 'CapacitorApp', :path => '..\..\node_modules\@capacitor\app' - pod 'CapacitorCamera', :path => '..\..\node_modules\@capacitor\camera' - pod 'CapacitorHaptics', :path => '..\..\node_modules\@capacitor\haptics' - pod 'CapacitorKeyboard', :path => '..\..\node_modules\@capacitor\keyboard' - pod 'CapacitorNetwork', :path => '..\..\node_modules\@capacitor\network' - pod 'CapacitorFilesystem', :path => '..\..\node_modules\@capacitor\filesystem' - pod 'CapacitorPushNotifications', :path => '..\..\node_modules\@capacitor\push-notifications' - pod 'CapacitorVoiceRecorder', :path => '..\..\node_modules\capacitor-voice-recorder' - pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins' - pod 'CordovaPluginsResources', :path => '../capacitor-cordova-ios-plugins' -end - -target 'App' do - capacitor_pods - # Add your Pods here -end diff --git a/package-lock.json b/package-lock.json index ac401ff1e..c0cec9246 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2030,16 +2030,39 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "@capacitor-community/camera-preview": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@capacitor-community/camera-preview/-/camera-preview-1.2.1.tgz", + "integrity": "sha512-rskj/12TR4X8cUzvkWvygf7A/4TFUld9BU5nAc1gc3LXU06FGP0R/6MxZKQdf20qqRaTRLPrF3HFAlkz7xb6yg==", + "requires": { + "@capacitor/core": "^3.3.2" + }, + "dependencies": { + "@capacitor/core": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-3.3.2.tgz", + "integrity": "sha512-pyI3dQdQjA1L5iEw0jkeKCogx9t5d5kIFTB5M3CJRg9Uj5MIpU2J5CRj+74A7BflvZJo8IBd6IfMJaOArRumaw==", + "requires": { + "tslib": "^2.1.0" + } + } + } + }, "@capacitor/android": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-3.3.1.tgz", - "integrity": "sha512-TB9UJh6/e6CV6KDpu/lNHKhgVvnDL2d3crNYtfKzp64CzeZhttQGIQShXSdMb3DG4kk7Zi/qBlfSaWBBD95NhQ==" + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-3.3.2.tgz", + "integrity": "sha512-TG+tGz0KxkT/BgvSLQfbQwQ9c4Budub5TRijIGdmMbB1ZYB76TFhwvVuwWZ52HFSlKS3sx/UYLlbULL7UQ2aug==" }, "@capacitor/app": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@capacitor/app/-/app-1.0.5.tgz", "integrity": "sha512-U0dAw1CAjKyguSRxKDabszsQ4dj679RnxaUZrSHDR5Jnt5x308oQuKXFP++wnMBbw72D02iqjG0a+/Ujye7C9g==" }, + "@capacitor/browser": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@capacitor/browser/-/browser-1.0.6.tgz", + "integrity": "sha512-ZDx+HNPRQZKHpWxbYEyDz34Ge4fwhiiGg2UEnA+ol+pmdvHyYxw/c8HafCEVRJutHrXcVdSNoBNAeEPkQeabrQ==" + }, "@capacitor/camera": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@capacitor/camera/-/camera-1.2.0.tgz", @@ -2157,6 +2180,11 @@ "tslib": "^2.1.0" } }, + "@capacitor/device": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@capacitor/device/-/device-1.1.0.tgz", + "integrity": "sha512-HCFwOxmK7igEgNm20y+zYi+XQ0OlZYnE4oCaI82TGmA7sehlDpBBKbjmI2Bd8aM09+BXFbAAtq7JCxkEfY8nIg==" + }, "@capacitor/filesystem": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@capacitor/filesystem/-/filesystem-1.0.6.tgz", @@ -2187,6 +2215,16 @@ "resolved": "https://registry.npmjs.org/@capacitor/push-notifications/-/push-notifications-1.0.7.tgz", "integrity": "sha512-vbvAptFq5cI6xKYYWMb7tsWvA88/PTG4v6ptxN0Ygtc1fQ4l/AzONQiYqdtFpbBhF2fML2kXQ/5eSAfn8HY9aw==" }, + "@capacitor/share": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@capacitor/share/-/share-1.0.7.tgz", + "integrity": "sha512-v7FRld2SdV64YjrZrKGoDyfYqcoEC2I4tk6nkhbOI8ZOaqm6XNiqCWEeTdeb6XPwDftozmfILSzhCxbASrXKMg==" + }, + "@capacitor/storage": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@capacitor/storage/-/storage-1.2.3.tgz", + "integrity": "sha512-Rc5CKS53sfxokF5dxzNQDhig4lnZonky6VqskHZKTe3Ltl37FKmrG+I8ttZCinFZ5MPWfGSuP44m93hsQqitjQ==" + }, "@cnakazawa/watch": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", @@ -3096,6 +3134,21 @@ "@types/cordova": "^0.0.34" } }, + "@ionic-native/social-sharing": { + "version": "5.36.0", + "resolved": "https://registry.npmjs.org/@ionic-native/social-sharing/-/social-sharing-5.36.0.tgz", + "integrity": "sha512-DTgEpSYJxgLri0Hry3PpohtVIyi5srMqfPhhGfqVHh20xtvC56sHMvm9xpRg9cH6xtfBCzJbB0S+aGBtrU9m8g==", + "requires": { + "@types/cordova": "^0.0.34" + }, + "dependencies": { + "@types/cordova": { + "version": "0.0.34", + "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz", + "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ=" + } + } + }, "@ionic-native/splash-screen": { "version": "5.36.0", "resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-5.36.0.tgz", @@ -3415,6 +3468,46 @@ "tslib": "^1.10.0" }, "dependencies": { + "localforage-cordovasqlitedriver": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/localforage-cordovasqlitedriver/-/localforage-cordovasqlitedriver-1.7.0.tgz", + "integrity": "sha1-i5OVd1nuaI06WNW6fAR39sy1ODg=", + "requires": { + "localforage": ">=1.5.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, + "@ionic/storage-angular": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@ionic/storage-angular/-/storage-angular-3.0.6.tgz", + "integrity": "sha512-ZXlIFWGU27aCxVFgZb0KFJFtWwnn6+HK6v0rMGzjN8f7oV2ewXaQ2dl1gTw/A8YoozTVPOFxwfFHCjhWLFR1Fw==", + "requires": { + "@ionic/storage": "^3.0.4", + "tslib": "^1.10.0" + }, + "dependencies": { + "@ionic/storage": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@ionic/storage/-/storage-3.0.6.tgz", + "integrity": "sha512-sw+zSJINIpbQCGZR9mEtb9N0WmZLuhcMVqOZJBqLuDACAMdXqG39zmp5nSVqhGI1/9X3nd0K5gVn6icyVfUnUg==", + "requires": { + "localforage": "^1.9.0" + } + }, + "localforage": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", + "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", + "requires": { + "lie": "3.1.1" + } + }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -5318,6 +5411,14 @@ } } }, + "angular-cropperjs": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/angular-cropperjs/-/angular-cropperjs-0.1.5.tgz", + "integrity": "sha512-3SekYbl7uuS8/ypa2xCwv04SY55HCvWmpAnSwVCA7GTdanKuu3rjODIhJiEnSpouG+xEOOUY83qt/+2kRR/nEA==", + "requires": { + "cropperjs": "^1.0.0" + } + }, "angular-draggable-droppable": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/angular-draggable-droppable/-/angular-draggable-droppable-4.6.0.tgz", @@ -5993,6 +6094,16 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -7814,6 +7925,11 @@ "integrity": "sha1-C8ZXVyduvZIMASzpIOJ0F3V2Nz4=", "dev": true }, + "cordova-plugin-crop": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-crop/-/cordova-plugin-crop-0.4.0.tgz", + "integrity": "sha1-TZ6Jgsz7OOBPqQnIe0vsBuLR2Ss=" + }, "cordova-plugin-dbcopy": { "version": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git#861f585e4313db828d6b8c7d354c32c83373d0d2", "from": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git" @@ -7894,6 +8010,11 @@ "resolved": "https://registry.npmjs.org/cordova-plugin-okhttp/-/cordova-plugin-okhttp-2.0.0.tgz", "integrity": "sha1-6GT2C//zQqHZJHeugvckmqYIXIA=" }, + "cordova-plugin-screen-orientation": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.2.tgz", + "integrity": "sha512-2w6CMC+HGvbhogJetalwGurL2Fx8DQCCPy3wlSZHN1/W7WoQ5n9ujVozcoKrY4VaagK6bxrPFih+ElkO8Uqfzg==" + }, "cordova-plugin-splashscreen": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-5.0.4.tgz", @@ -7994,19 +8115,6 @@ } } }, - "cordova-sqlite-storage": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cordova-sqlite-storage/-/cordova-sqlite-storage-5.1.0.tgz", - "integrity": "sha512-UmHe9yQiYblDBToh3z91WHuD6ZgmCm3VX+1QFseYQs4WVQ3+ndj22qyGby/NV0uyCgok91gB1obLjLM+9vYJEw==", - "requires": { - "cordova-sqlite-storage-dependencies": "3.0.0" - } - }, - "cordova-sqlite-storage-dependencies": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cordova-sqlite-storage-dependencies/-/cordova-sqlite-storage-dependencies-3.0.0.tgz", - "integrity": "sha512-A7gV5lQZc0oPrJ/a+lsZmMZr7vYou4MXyQFOY+b/dwuCMsagLT0EsL7oY54tqzpvjtzLfh0aZGGm9i8DMAIFSA==" - }, "core-js": { "version": "3.18.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.18.1.tgz", @@ -8084,6 +8192,11 @@ } } }, + "cropperjs": { + "version": "1.5.12", + "resolved": "https://registry.npmjs.org/cropperjs/-/cropperjs-1.5.12.tgz", + "integrity": "sha512-re7UdjE5UnwdrovyhNzZ6gathI4Rs3KGCBSc8HCIjUo5hO42CtzyblmWLj6QWVw7huHyDMfpKxhiO2II77nhDw==" + }, "cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -10097,6 +10210,13 @@ "escape-string-regexp": "^1.0.5" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -15307,14 +15427,6 @@ "lie": "3.1.1" } }, - "localforage-cordovasqlitedriver": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/localforage-cordovasqlitedriver/-/localforage-cordovasqlitedriver-1.7.0.tgz", - "integrity": "sha1-i5OVd1nuaI06WNW6fAR39sy1ODg=", - "requires": { - "localforage": ">=1.5.0" - } - }, "localtunnel": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/localtunnel/-/localtunnel-2.0.2.tgz", @@ -15989,6 +16101,13 @@ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" }, + "nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "dev": true, + "optional": true + }, "nanocolors": { "version": "0.2.12", "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.2.12.tgz", @@ -16157,6 +16276,14 @@ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, + "ng-lazyload-image": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/ng-lazyload-image/-/ng-lazyload-image-9.1.0.tgz", + "integrity": "sha512-ZdfCXMTaehfzxcSRRThpz9YZbEA+8LPA086Od6JiylrGj0yNM7Aq830A1x6NE/M8o2VuVq93emH9m8T6SFBHlA==", + "requires": { + "tslib": "^2.0.0" + } + }, "ng2-pdf-viewer": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/ng2-pdf-viewer/-/ng2-pdf-viewer-7.0.1.tgz", @@ -16181,6 +16308,22 @@ "tslib": "^2.0.0" } }, + "ngx-image-compress": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/ngx-image-compress/-/ngx-image-compress-11.0.3.tgz", + "integrity": "sha512-F1+93cBosm9bNEUmuQM3LvfBg9lzhEITfh8tEhqYb5+OH1HYsjW/nZLQGu5rDS4YCDEA8TQKwmYrrsYjR1t/WA==", + "requires": { + "tslib": "^2.0.0" + } + }, + "ngx-image-cropper": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ngx-image-cropper/-/ngx-image-cropper-5.0.1.tgz", + "integrity": "sha512-WGfDJsYizOq3VE82JJkqjSjfvp+o2xrzsOwwm2rVtqNO64SvNJ8/PHP7ctkIjZmEkfjBfFE+eNZR82lLJJ+47w==", + "requires": { + "tslib": "^2.0.0" + } + }, "ngx-socket-io": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/ngx-socket-io/-/ngx-socket-io-3.4.0.tgz", @@ -22040,7 +22183,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "has-flag": { "version": "3.0.0", @@ -23685,7 +23832,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", diff --git a/package.json b/package.json index 503a89ac7..d2b3d0859 100644 --- a/package.json +++ b/package.json @@ -31,16 +31,21 @@ "@angular/platform-browser": "~12.1.2", "@angular/platform-browser-dynamic": "~12.1.2", "@angular/router": "~12.1.2", - "@capacitor/android": "^3.3.1", + "@capacitor-community/camera-preview": "^1.2.1", + "@capacitor/android": "^3.3.2", "@capacitor/app": "^1.0.5", + "@capacitor/browser": "1.0.6", "@capacitor/camera": "^1.2.0", "@capacitor/core": "^3.3.0", + "@capacitor/device": "^1.1.0", "@capacitor/filesystem": "^1.0.6", "@capacitor/haptics": "^1.1.2", "@capacitor/ios": "3.3.0", "@capacitor/keyboard": "^1.1.2", "@capacitor/network": "^1.0.6", "@capacitor/push-notifications": "^1.0.7", + "@capacitor/share": "^1.0.7", + "@capacitor/storage": "^1.2.3", "@fortawesome/angular-fontawesome": "^0.9.0", "@fortawesome/fontawesome-free": "^5.15.3", "@fortawesome/fontawesome-svg-core": "^1.2.35", @@ -66,6 +71,7 @@ "@ionic-native/network": "^5.36.0", "@ionic-native/photo-viewer": "^5.36.0", "@ionic-native/screen-orientation": "^5.35.0", + "@ionic-native/social-sharing": "^5.36.0", "@ionic-native/splash-screen": "^5.31.1", "@ionic-native/sqlite": "^5.36.0", "@ionic-native/sqlite-porter": "^4.20.0", @@ -76,6 +82,7 @@ "@ionic/core": "^5.8.1", "@ionic/pwa-elements": "^3.0.2", "@ionic/storage": "^2.3.1", + "@ionic/storage-angular": "^3.0.6", "@logisticinfotech/ionic4-datepicker": "^1.4.4", "@ng-bootstrap/ng-bootstrap": "^9.1.2", "@ngx-translate/core": "^13.0.0", @@ -83,6 +90,7 @@ "@types/jest-environment-puppeteer": "^4.4.1", "@types/puppeteer": "^5.4.4", "angular-calendar": "^0.28.22", + "angular-cropperjs": "^0.1.5", "angular-svg-icon": "^12.0.0", "angular-tag-cloud-module": "^5.2.2", "bootstrap": "^4.5.0", @@ -90,11 +98,12 @@ "capacitor-voice-recorder": "^2.0.0", "ci": "^2.1.1", "cordova": "^10.0.0", + "cordova-plugin-crop": "^0.4.0", "cordova-plugin-dbcopy": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git", "cordova-plugin-filepath": "^1.5.8", "cordova-plugin-okhttp": "^2.0.0", + "cordova-plugin-screen-orientation": "^3.0.2", "cordova-res": "^0.15.3", - "cordova-sqlite-storage": "^5.1.0", "cross-env": "^7.0.3", "crypto-js": "^4.0.0", "date-fns": "^2.17.0", @@ -115,8 +124,11 @@ "jetifier": "^1.6.8", "lite-server": "^2.6.1", "moment": "^2.29.1", + "ng-lazyload-image": "^9.1.0", "ng2-pdf-viewer": "^7.0.1", "ngx-cookie-service": "^12.0.3", + "ngx-image-compress": "^11.0.3", + "ngx-image-cropper": "^5.0.1", "ngx-socket-io": "^3.2.0", "pdfjs": "^2.4.6", "pdfjs-dist": "^2.9.359", diff --git a/src/app/Rules/despacho.service.ts b/src/app/Rules/despacho.service.ts index 3dade3928..ae89903af 100644 --- a/src/app/Rules/despacho.service.ts +++ b/src/app/Rules/despacho.service.ts @@ -232,7 +232,7 @@ export class DespachoService { } - async getList({updateStore = false}): Promise | null { + async getList({updateStore = false}) { if (this.LoaderService.loading) { return this.despachoStore.list @@ -253,11 +253,8 @@ export class DespachoService { }); - console.log(despachoList); - - - despachoList = this.sortService.sortArrayISODate(despachoList).reverse(); - + despachoList = this.sortService.sortDate(despachoList, 'CreateDate') + if(updateStore) { this.despachoStore.reset(despachoList); } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 807acec62..db3b417bf 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -203,6 +203,26 @@ const routes = [ path: 'event-details-documents-options', loadChildren: () => import('./shared/popover/event-details-documents-options/event-details-documents-options.module').then( m => m.EventDetailsDocumentsOptionsPageModule) }, + { + path: 'preview-camera', + loadChildren: () => import('./modals/preview-camera/preview-camera.module').then( m => m.PreviewCameraPageModule) + }, + { + path: 'group-icons', + loadChildren: () => import('./modals/group-icons/group-icons.module').then( m => m.GroupIconsPageModule) + }, + { + path: 'video-allowed', + loadChildren: () => import('./modals/video-allowed/video-allowed.module').then( m => m.VideoAllowedPageModule) + }, + { + path: 'preview-photo', + loadChildren: () => import('./modals/preview-photo/preview-photo.module').then( m => m.PreviewPhotoPageModule) + }, + { + path: 'custom-image-cache', + loadChildren: () => import('./services/file/custom-image-cache/custom-image-cache.module').then( m => m.CustomImageCachePageModule) + }, diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 447d26c0d..4d545495e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -9,7 +9,9 @@ import { NgxMatDateFormats } from '@angular-material-components/datetime-picker' const moment = _rollupMoment || _moment; import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { SqliteService } from 'src/app/services/sqlite.service'; +import { BackgroundService } from 'src/app/services/background.service'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; +import { StorageService } from 'src/app/services/storage.service'; const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { @@ -39,20 +41,30 @@ export class AppComponent { /* private splashScreen: SplashScreen, */ private statusBar: StatusBar, private screenOrientation: ScreenOrientation, - private sqliteservice: SqliteService + private sqliteservice: SqliteService, + private backgroundservice: BackgroundService, + private storageservice: StorageService ) { + // this.createCacheFolder() this.initializeApp(); } + // async createCacheFolder(){ + // await Filesystem.mkdir({ + // directory: Directory.Cache, + // path: `CACHED-IMG` + // }) + // } + initializeApp() { this.platform.ready().then(() => { this.statusBar.styleDefault(); /* this.splashScreen.hide(); */ if (this.platform.is("tablet")) { - this.screenOrientation.unlock(); + window.screen.orientation.unlock(); } else if( this.platform.is("mobile")) { - this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT_PRIMARY); + window.screen.orientation.lock('portrait'); console.log('Orientation locked') } @@ -65,6 +77,16 @@ export class AppComponent { console.log("Error creating local database: ", error) } } + + this.storageservice.get('networkCheckStore').then((network) => { + if(network === 'online') { + console.log('Network app componente check', network) + this.backgroundservice.online() + } else { + console.log('Network app componente check', network) + this.backgroundservice.offline(); + } + }) }); } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 4a8f6e002..9b2c367a6 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -38,6 +38,7 @@ import { Network } from '@ionic-native/network/ngx'; import { File } from '@ionic-native/file/ngx'; + import { NgxMatDatetimePickerModule, NgxMatNativeDateModule, @@ -64,6 +65,8 @@ import { MediaCapture } from '@ionic-native/media-capture/ngx'; import { Media } from '@ionic-native/media/ngx'; import { StreamingMedia } from '@ionic-native/streaming-media/ngx'; import { PhotoViewer } from '@ionic-native/photo-viewer/ngx'; +import {NgxImageCompressService} from 'ngx-image-compress'; +import { CustomImageCachePageRoutingModule } from './services/file/custom-image-cache/custom-image-cache-routing.module'; /* import { FCM } from '@ionic-native/fcm/ngx'; import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ @@ -80,7 +83,11 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ useFactory: adapterFactory }), IonicModule.forRoot({animated: false}), - IonicStorageModule.forRoot(), + IonicStorageModule.forRoot({ + name: '__mydb', + driverOrder: ['indexeddb', 'sqlite', 'websql'] + }), + AppRoutingModule, FontAwesomeModule, HttpClientModule, @@ -102,6 +109,9 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ // PdfViewerModule, HammerModule, + CustomImageCachePageRoutingModule + + ], providers: [ { provide: MAT_DATE_LOCALE, useValue: 'pt' }, @@ -128,7 +138,8 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ MediaCapture, Media, StreamingMedia, - PhotoViewer + PhotoViewer, + NgxImageCompressService ], bootstrap: [AppComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA] diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index bfcabdb5c..96fb9d42e 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -3,7 +3,7 @@ - {{toDayEventStorage.eventsList.length + expedienteGdStore.count}} + Início @@ -15,8 +15,8 @@ - {{ documentCounterService.mdTotalDocument }} - {{ documentCounterService.prTotalDocument }} + Gabinete diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 2df4678e0..36ac32e4e 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -1,6 +1,6 @@ /* eslint-disable */ /* tslint:disable */ -import { Component, OnInit, NgZone } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { Event } from '../models/event.model'; import { NotificationsService } from '../services/notifications.service'; /*import { WebNotificationsService } from '../services/webnotifications.service'; */ @@ -22,7 +22,10 @@ import { BackgroundService } from 'src/app/services/background.service'; import { OfflineManagerService } from 'src/app/services/offline-manager.service'; import { Storage } from '@ionic/storage'; import { EventsService } from 'src/app/services/events.service'; +import { ProcessesService } from 'src/app/services/processes.service'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; +import { SqliteService } from 'src/app/services/sqlite.service'; +import { Device } from '@capacitor/device'; @Component({ selector: 'app-home', @@ -66,7 +69,6 @@ export class HomePage implements OnInit { status: string = ""; audioName: string = ""; constructor( - private zone: NgZone, private router: Router, public modalCtrl: AlertController, private notificationsService: NotificationsService, @@ -83,19 +85,26 @@ export class HomePage implements OnInit { private offlinemanager: OfflineManagerService, private storage: Storage, private eventservice: EventsService, - private screenOrientation: ScreenOrientation,) { + private processservice: ProcessesService, + private screenOrientation: ScreenOrientation, + private sqliteservice: SqliteService) { /* this.webNotificationPopupService.askNotificationPermission() */ this.router.events.subscribe((val) => { document.querySelectorAll('ion-modal').forEach((e: any) => e.remove()) + document.querySelectorAll('popover-viewport').forEach((e: any) => e.remove()) }); window['platform'] = platform + window['inactivity/function'] = () => { if (window.location.pathname != '/inactivity') { + document.querySelectorAll('ion-modal').forEach((e: any) => e.remove()) + document.querySelectorAll('.popover-viewport').forEach((e: any) => e.remove()) + const pathname = window.location.pathname SessionStore.setUrlBeforeInactivity(pathname) this.router.navigate(['/inactivity']); @@ -103,6 +112,7 @@ export class HomePage implements OnInit { } + } goto(url) { @@ -113,6 +123,8 @@ export class HomePage implements OnInit { ngOnInit() { + this.logDeviceInfo(); + this.notificationsService.onReciveForeground(); this.notificationsService.onReciveBackground(); @@ -121,8 +133,7 @@ export class HomePage implements OnInit { this.backgroundservice.online() if (this.platform.is('desktop') || this.platform.is('mobileweb')) { } else { - /* this.notificationsService.onReceviNotification(); */ - this.offlinemanager.synchnize() + this.synchWhenOnline() } }); window.addEventListener('offline', () => { @@ -141,6 +152,12 @@ export class HomePage implements OnInit { myWorker.postMessage('ali'); */ } + logDeviceInfo = async () => { + const info = await Device.getInfo(); + + console.log('Device info',info); + }; + updateList() { /* this.notificationsService.registerCallback( @@ -160,4 +177,50 @@ export class HomePage implements OnInit { } + async synchWhenOnline() { + try { + await this.storage.get('eventEdit').then((req) => { + JSON.parse(req).forEach(element => { + this.eventservice.editEvent(element, 2, 3).subscribe((res) => { + this.storage.remove('eventEdit') + this.sqliteservice.deleteEventTable(); + console.log('eventEdit synchnize', res) + }) + }); + }) + } catch (error) { + console.log('error synch eventedit') + } + + try { + await this.storage.get('eventDelete').then((req) => { + JSON.parse(req).forEach(element => { + console.log('DELETE data SYNC', element) + this.eventservice.deleteEvent(element.eventid, element.eventDeleteType, element.calendarName).subscribe((res) => { + this.storage.remove('eventDelete') + this.sqliteservice.deleteEventTable(); + console.log('eventDelete synchnize', res) + }) + }); + }) + } catch (error) { + console.log('error delete event synch') + } + + try { + await this.storage.get('event-listRever').then((req) => { + JSON.parse(req).forEach(element => { + console.log('REVER data SYNC', element) + this.processservice.PostTaskAction(element).subscribe((res) => { + this.storage.remove('event-listRever') + this.sqliteservice.deleteEventTable(); + console.log('event-listRever synchnize', res) + }) + }); + }) + } catch (error) { + console.log('error event-list rever synch') + } + } + } diff --git a/src/app/modals/create-process/create-process.page.ts b/src/app/modals/create-process/create-process.page.ts index a2ef20d21..9e65782ad 100644 --- a/src/app/modals/create-process/create-process.page.ts +++ b/src/app/modals/create-process/create-process.page.ts @@ -291,7 +291,7 @@ export class CreateProcessPage implements OnInit { this.modalController.dismiss(); } catch (error) { - this.toastService.badRequest('Processo não efectuado'); + this.toastService._badRequest('Processo não efectuado'); } finally { loader.remove() @@ -319,10 +319,10 @@ export class CreateProcessPage implements OnInit { } this.modalController.dismiss(); - this.toastService.successMessage('Pedido de Parecer enviado'); + this.toastService._successMessage('Pedido de Parecer enviado'); } catch (error) { - this.toastService.badRequest('Processo não efectuado'); + this.toastService._badRequest('Processo não efectuado'); } finally { loader.remove() } @@ -344,10 +344,10 @@ export class CreateProcessPage implements OnInit { await this.pedidoService.taskCompleteDeferimento({serialNumber:this.task.serialNumber}).toPromise(); this.modalController.dismiss(); - this.toastService.successMessage('Pedido de Deferimento criado'); + this.toastService._successMessage('Pedido de Deferimento criado'); } catch (error) { - this.toastService.badRequest('Processo não efectuado'); + this.toastService._badRequest('Processo não efectuado'); } finally { loader.remove() @@ -376,16 +376,16 @@ export class CreateProcessPage implements OnInit { await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise(); this.modalController.dismiss(); - this.toastService.successMessage('Despacho criado'); + this.toastService._successMessage('Despacho criado'); } catch (error) { - this.toastService.badRequest('Processo não efectuado'); + this.toastService._badRequest('Processo não efectuado'); } finally { //loader.remove(); } } else{ this.validateField = true; - this.toastService.badRequest('Por favor adicione uma descrição'); + this.toastService._badRequest('Por favor adicione uma descrição'); } loader.remove(); break; @@ -411,10 +411,10 @@ export class CreateProcessPage implements OnInit { } this.modalController.dismiss(); - this.toastService.successMessage('Pedido de Parecer criado'); + this.toastService._successMessage('Pedido de Parecer criado'); } catch (error) { - this.toastService.badRequest('Processo não efectuado'); + this.toastService._badRequest('Processo não efectuado'); } finally { loader.remove() } @@ -436,10 +436,10 @@ export class CreateProcessPage implements OnInit { await this.pedidoService.taskCompleteDeferimento({serialNumber:this.task.serialNumber}).toPromise(); this.modalController.dismiss(); - this.toastService.successMessage('Pedido de Deferimento criado'); + this.toastService._successMessage('Pedido de Deferimento criado'); } catch (error) { - this.toastService.badRequest('Processo não efectuado'); + this.toastService._badRequest('Processo não efectuado'); } finally { loader.remove() } @@ -494,9 +494,9 @@ export class CreateProcessPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise(); - this.toastService.successMessage(message); + this.toastService._successMessage(message); } catch (error) { - this.toastService.badRequest('Processo não efectuado'); + this.toastService._badRequest('Processo não efectuado'); } finally { loader.remove() } diff --git a/src/app/modals/dar-parecer/dar-parecer.page.ts b/src/app/modals/dar-parecer/dar-parecer.page.ts index a649265cb..e31ff5945 100644 --- a/src/app/modals/dar-parecer/dar-parecer.page.ts +++ b/src/app/modals/dar-parecer/dar-parecer.page.ts @@ -69,9 +69,9 @@ export class DarParecerPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise(); this.modalController.dismiss(); - this.toastService.successMessage('Parecer enviado'); + this.toastService._successMessage('Parecer enviado'); } catch (error) { - this.toastService.badRequest("Parecer não solicitado"); + this.toastService._badRequest("Parecer não solicitado"); } finally { loader.remove() } diff --git a/src/app/modals/delegar/delegar.page.ts b/src/app/modals/delegar/delegar.page.ts index 93304a383..b72e269e1 100644 --- a/src/app/modals/delegar/delegar.page.ts +++ b/src/app/modals/delegar/delegar.page.ts @@ -88,10 +88,10 @@ export class DelegarPage implements OnInit { async saveTask() { if(this.taskParticipants.length < 1){ - this.toastService.badRequest("Selecione um destinatário"); + this.toastService._badRequest("Selecione um destinatário"); } else if(this.taskParticipants.length > 1){ - this.toastService.badRequest("Selecione apenas um destinatário"); + this.toastService._badRequest("Selecione apenas um destinatário"); } else { let body = { @@ -109,11 +109,11 @@ export class DelegarPage implements OnInit { this.processes.DelegateTask(body).subscribe(res=>{ console.log(res); - this.toastService.successMessage('Processo delegado') + this.toastService._successMessage('Processo delegado') this.close(); }, (error)=>{ - this.toastService.badRequest("Processo não delegado") + this.toastService._badRequest("Processo não delegado") }, ()=>{ loader.remove() diff --git a/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts b/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts index 3d2429b35..4e1798522 100644 --- a/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts +++ b/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts @@ -224,11 +224,11 @@ export class DocumentSetUpMeetingPage implements OnInit { this.eventService.create({ body: postEvent, calendar: this.postData.CalendarName }).subscribe(async (respose) => { laoder.remove() - this.toastService.successMessage('Reunião criada') + this.toastService._successMessage('Reunião criada') this.modalController.dismiss() }, (error) => { laoder.remove() - this.toastService.badRequest('Não foi possível marcar a reunião'); + this.toastService._badRequest('Não foi possível marcar a reunião'); }, ()=>{ laoder.remove() }); diff --git a/src/app/modals/forward/forward.page.ts b/src/app/modals/forward/forward.page.ts index d56c77b7a..a40c1747c 100644 --- a/src/app/modals/forward/forward.page.ts +++ b/src/app/modals/forward/forward.page.ts @@ -124,7 +124,7 @@ export class ForwardPage implements OnInit { } if(this.taskParticipants.length < 1){ - this.toastService.badRequest("Selecione um destinatário"); + this.toastService._badRequest("Selecione um destinatário"); } else { @@ -150,11 +150,11 @@ export class ForwardPage implements OnInit { console.log(body); this.processes.CompleteParecerPrTask(body).subscribe(res=>{ console.log(res); - this.toastService.successMessage('Processo delegado'); + this.toastService._successMessage('Processo delegado'); this.goBack(); }, (error)=>{ - this.toastService.badRequest("Processo não delegado") + this.toastService._badRequest("Processo não delegado") }); } } diff --git a/src/app/modals/group-icons/group-icons-routing.module.ts b/src/app/modals/group-icons/group-icons-routing.module.ts new file mode 100644 index 000000000..8d08a1178 --- /dev/null +++ b/src/app/modals/group-icons/group-icons-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { GroupIconsPage } from './group-icons.page'; + +const routes: Routes = [ + { + path: '', + component: GroupIconsPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class GroupIconsPageRoutingModule {} diff --git a/src/app/modals/group-icons/group-icons.module.ts b/src/app/modals/group-icons/group-icons.module.ts new file mode 100644 index 000000000..8eb53d81e --- /dev/null +++ b/src/app/modals/group-icons/group-icons.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { GroupIconsPageRoutingModule } from './group-icons-routing.module'; + +import { GroupIconsPage } from './group-icons.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + GroupIconsPageRoutingModule + ], + declarations: [GroupIconsPage] +}) +export class GroupIconsPageModule {} diff --git a/src/app/modals/group-icons/group-icons.page.html b/src/app/modals/group-icons/group-icons.page.html new file mode 100644 index 000000000..b8f37cf02 --- /dev/null +++ b/src/app/modals/group-icons/group-icons.page.html @@ -0,0 +1,23 @@ + + + + + + + Tem certeza que apagar imagem? + + + + Sim + + + + Não + + + + + + + + diff --git a/src/app/modals/group-icons/group-icons.page.scss b/src/app/modals/group-icons/group-icons.page.scss new file mode 100644 index 000000000..fdc5fe30a --- /dev/null +++ b/src/app/modals/group-icons/group-icons.page.scss @@ -0,0 +1,67 @@ +// .animated{ +// animation: duration 5s; +// animation-fill-mode: both; +// } + +// @keyframes bounceInUp{ +// 0%{ +// opacity:0; +// transform: translateY(300px); + +// } +// 60%{ +// opacity:0; +// transform: translateY(-30px); +// } +// 80%{ +// opacity:0; +// transform: translateY(10px); +// } +// 100%{ +// opacity:0; +// transform: translateY(0); +// } +// } +// .bounceInUp{ +// animation-name: bounceInUp; +// } + +// @keyframes bounceInUp{ +// from{down:0px} +// 30% {top: 100px !important;} /* ignored */ +// from{down:200px} +// } + + +.rollover { + position: relative; + animation: mymove 5s infinite; + } + + @keyframes mymove { + from {bottom: 0px; } + to {bottom: 100px;} + } + + @media only screen and (min-height: 600px) and (min-width: 768px) +{ + .custom-modal { + .modal-wrapper { + + position: absolute !important; + height: 500px !important; + top: calc(100% - (500px)); + + } + } +} + +.redla{ + + color: rgb(255, 38, 0); + // background-color: rgb(255, 72, 0); +} + +.placed{ + float:right +} \ No newline at end of file diff --git a/src/app/modals/group-icons/group-icons.page.spec.ts b/src/app/modals/group-icons/group-icons.page.spec.ts new file mode 100644 index 000000000..029dc6794 --- /dev/null +++ b/src/app/modals/group-icons/group-icons.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { GroupIconsPage } from './group-icons.page'; + +describe('GroupIconsPage', () => { + let component: GroupIconsPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ GroupIconsPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(GroupIconsPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modals/group-icons/group-icons.page.ts b/src/app/modals/group-icons/group-icons.page.ts new file mode 100644 index 000000000..47d79442a --- /dev/null +++ b/src/app/modals/group-icons/group-icons.page.ts @@ -0,0 +1,46 @@ +import { Component, OnInit } from '@angular/core'; +import { IonSlides, ModalController, NavParams } from '@ionic/angular'; +import { PublicationsService } from 'src/app/services/publications.service'; + +@Component({ + selector: 'app-group-icons', + templateUrl: './group-icons.page.html', + styleUrls: ['./group-icons.page.scss'], +}) +export class GroupIconsPage implements OnInit { + + constructor( private modalController: ModalController, + private navParams:NavParams, + private publicService:PublicationsService ) { } + + ngOnInit() { + } + + removerIcone(){ + + } + openGaleria(){ + + } + OpenCamera(){ + + } + pesquizarWeb(){ + + } + + + dismiss() { + // using the injected ModalController this page + // can "dismiss" itself and optionally pass back data + this.modalController.dismiss({ + 'dismissed': true + }); + + + } + // delete(){ + // this.publicService.DeletePublication() + // } +} + diff --git a/src/app/modals/preview-camera/preview-camera-routing.module.ts b/src/app/modals/preview-camera/preview-camera-routing.module.ts new file mode 100644 index 000000000..a8f8e5440 --- /dev/null +++ b/src/app/modals/preview-camera/preview-camera-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { PreviewCameraPage } from './preview-camera.page'; + +const routes: Routes = [ + { + path: '', + component: PreviewCameraPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class PreviewCameraPageRoutingModule {} diff --git a/src/app/modals/preview-camera/preview-camera.module.ts b/src/app/modals/preview-camera/preview-camera.module.ts new file mode 100644 index 000000000..53fa3c78d --- /dev/null +++ b/src/app/modals/preview-camera/preview-camera.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { PreviewCameraPageRoutingModule } from './preview-camera-routing.module'; + +import { PreviewCameraPage } from './preview-camera.page'; +import { ImageCropperModule } from 'ngx-image-cropper'; +import { GroupIconsPage } from '../group-icons/group-icons.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + ImageCropperModule, + PreviewCameraPageRoutingModule + ], + declarations: [PreviewCameraPage], + + +}) +export class PreviewCameraPageModule {} diff --git a/src/app/modals/preview-camera/preview-camera.page.html b/src/app/modals/preview-camera/preview-camera.page.html new file mode 100644 index 000000000..1f853c4d8 --- /dev/null +++ b/src/app/modals/preview-camera/preview-camera.page.html @@ -0,0 +1,70 @@ + + + + + + + + + {{username}} {{_updatedAt | date}}
+ + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/app/modals/preview-camera/preview-camera.page.scss b/src/app/modals/preview-camera/preview-camera.page.scss new file mode 100644 index 000000000..f1d3a917e --- /dev/null +++ b/src/app/modals/preview-camera/preview-camera.page.scss @@ -0,0 +1,60 @@ +ion-footer { + margin-bottom: 10px; +} + +ion-slides { + height: 100%; +} + +.redla{ + color: rgb(250, 250, 4); + background-color: rgb(255, 238, 0); + border-radius: 120px; + width: 30px; + height: 30px; +} +.blacking{ + background-color: rgb(168, 41, 41); +} + +.cardconteudo { + background: rgb(253, 252, 252); + display: flex; + flex-wrap: wrap; + +} + +.whiter{ + color: white; + +} +.right{ +float: right; +} +.center{ + clear: both; + } + + + circle-xmark-solid{ + + // position: relative; + width: 512px; + height: 515px; + position: absolute; + left: 0%; + right: 0%; + top: 0%; + bottom: 0%; + + background: #FCD13A; + + + } + + + + + +/* Vector */ + diff --git a/src/app/modals/preview-camera/preview-camera.page.spec.ts b/src/app/modals/preview-camera/preview-camera.page.spec.ts new file mode 100644 index 000000000..ec3ebfda4 --- /dev/null +++ b/src/app/modals/preview-camera/preview-camera.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { PreviewCameraPage } from './preview-camera.page'; + +describe('PreviewCameraPage', () => { + let component: PreviewCameraPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ PreviewCameraPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(PreviewCameraPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modals/preview-camera/preview-camera.page.ts b/src/app/modals/preview-camera/preview-camera.page.ts new file mode 100644 index 000000000..ae2dac286 --- /dev/null +++ b/src/app/modals/preview-camera/preview-camera.page.ts @@ -0,0 +1,148 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { IonSlides, ModalController, NavParams } from '@ionic/angular'; +import { ImageCroppedEvent } from 'ngx-image-cropper'; +import { PublicationsService } from 'src/app/services/publications.service'; +import { GroupIconsPage } from '../group-icons/group-icons.page'; +import { Share } from '@capacitor/share'; +import { Router } from '@angular/router'; +import { Directory, Filesystem } from '@capacitor/filesystem'; + +@Component({ + selector: 'app-preview-camera', + templateUrl: './preview-camera.page.html', + styleUrls: ['./preview-camera.page.scss'], +}) +export class PreviewCameraPage implements OnInit { + + constructor( private modalController: ModalController, + private navParams:NavParams, + public router: Router, + private publicService: PublicationsService) { } + + +@ViewChild(IonSlides) slides : IonSlides + image: any; + username: string + _updatedAt: string + + + // myimage: null + // croppedImageBase64: any + +// @Input('img') img: any +// @Input() username: string; +// @Input() date: string; + + slideOpts = { + zoom: true + + } + +ngOnInit() { + this.image = this.navParams.get('image') + this.username = this.navParams.get('username') + this._updatedAt = this.navParams.get('_updatedAt') + console.log(this.image) + // this.image = this.myimage +} + +ionViewDidEnter(){ + this.slides.update() +} + +async zoom(zoomIn: boolean){ + const slider = await this.slides.getSwiper() //is swipper =! + const zoom = slider.zoom + zoomIn ? zoom.in(): zoom.out() + } + +close(){ + this.modalController.dismiss() + } + +// imageCropped(ev: ImageCroppedEvent){ +// this.croppedImageBase64 = ev.base64 +// } + + +// async grupo(){ +// const modal = await this.modalController.create({ +// component: GroupIconsPage, +// cssClass: 'transparent-modal', +// }); +// modal.present(); +// } + +async getIconGallery(){ + + const modal = await this.modalController.create({ + component: GroupIconsPage , + animated: true, + cssClass: 'transparent-modal', + }); + modal.present(); + } + + openChat(){ + + + } + + clear() { + this.getIconGallery() + + } + + openChatVideo(){ + + } + deleteImage(){ + document.addEventListener('DOMContentLoaded', ()=>{ + document.querySelector('img').addEventListener('click',removeImage) + }) + function removeImage(ev){ + console.log(ev.target, ev.currentTarget) + let img = ev.currentTarget + let src = ev.target.closest('.img') + src?.parentElement.removeChild(src) + + } + } + + + + +async getIconShare(){ + + + await Share.share({ + title: 'See cool stuff', + text: 'Really awesome thing you need to see right meow', + url: this.image, + dialogTitle: 'Share with buddies', + }); + +} + +redirPage(){ + this.router.navigateByUrl('/chat') +} + +async deleteFile(entry){ + if(entry.isFile){ + await Filesystem.deleteFile({ + directory: Directory.Documents, + path: this.image.src + '/' + entry.name + }) + }else{ + await Filesystem.rmdir({ + directory: Directory.Documents, + path: this.image.src + '/' + entry.name, + recursive:true //remove all file as well + }) + } + +} +} + + diff --git a/src/app/modals/preview-photo/preview-photo-routing.module.ts b/src/app/modals/preview-photo/preview-photo-routing.module.ts new file mode 100644 index 000000000..6a8d5e20c --- /dev/null +++ b/src/app/modals/preview-photo/preview-photo-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { PreviewPhotoPage } from './preview-photo.page'; + +const routes: Routes = [ + { + path: '', + component: PreviewPhotoPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class PreviewPhotoPageRoutingModule {} diff --git a/src/app/modals/preview-photo/preview-photo.module.ts b/src/app/modals/preview-photo/preview-photo.module.ts new file mode 100644 index 000000000..56980fefd --- /dev/null +++ b/src/app/modals/preview-photo/preview-photo.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { PreviewPhotoPageRoutingModule } from './preview-photo-routing.module'; + +import { PreviewPhotoPage } from './preview-photo.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + PreviewPhotoPageRoutingModule + ], + declarations: [PreviewPhotoPage] +}) +export class PreviewPhotoPageModule {} diff --git a/src/app/modals/preview-photo/preview-photo.page.html b/src/app/modals/preview-photo/preview-photo.page.html new file mode 100644 index 000000000..7d321438a --- /dev/null +++ b/src/app/modals/preview-photo/preview-photo.page.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/app/modals/preview-photo/preview-photo.page.scss b/src/app/modals/preview-photo/preview-photo.page.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/modals/preview-photo/preview-photo.page.spec.ts b/src/app/modals/preview-photo/preview-photo.page.spec.ts new file mode 100644 index 000000000..5bb31b8c1 --- /dev/null +++ b/src/app/modals/preview-photo/preview-photo.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { PreviewPhotoPage } from './preview-photo.page'; + +describe('PreviewPhotoPage', () => { + let component: PreviewPhotoPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ PreviewPhotoPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(PreviewPhotoPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modals/preview-photo/preview-photo.page.ts b/src/app/modals/preview-photo/preview-photo.page.ts new file mode 100644 index 000000000..e91170d93 --- /dev/null +++ b/src/app/modals/preview-photo/preview-photo.page.ts @@ -0,0 +1,33 @@ +import { Component, OnInit } from '@angular/core'; +import { ModalController, NavParams } from '@ionic/angular'; + + +@Component({ + selector: 'app-preview-photo', + templateUrl: './preview-photo.page.html', + styleUrls: ['./preview-photo.page.scss'], +}) +export class PreviewPhotoPage implements OnInit { + + constructor(private modalController: ModalController, + private navParams:NavParams) { } + + ngOnInit() { + } + + image: any; + + exit( ){ this.modalController.dismiss() + + } + save(img){ + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + canvas.width=300 + canvas.height=234 + ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234); + document.body.appendChild(canvas); +} + + +} diff --git a/src/app/modals/profile/edit-profile/edit-profile.page.html b/src/app/modals/profile/edit-profile/edit-profile.page.html index 93d007657..dd5a6e265 100644 --- a/src/app/modals/profile/edit-profile/edit-profile.page.html +++ b/src/app/modals/profile/edit-profile/edit-profile.page.html @@ -72,9 +72,9 @@ - diff --git a/src/app/modals/profile/profile.page.html b/src/app/modals/profile/profile.page.html index 5069a3183..01b6bdc77 100644 --- a/src/app/modals/profile/profile.page.html +++ b/src/app/modals/profile/profile.page.html @@ -57,7 +57,7 @@

{{item.Location}}

{{item.title}}

-

{{item.body}}

+

{{item.body}}

    -
  • Todos
  • -
  • Oficial
  • -
  • Pessoal
  • +
  • Todos
  • +
  • Oficial
  • +
  • Pessoal
diff --git a/src/app/pages/agenda/agenda.page.scss b/src/app/pages/agenda/agenda.page.scss index 05c3185a0..171a72a24 100644 --- a/src/app/pages/agenda/agenda.page.scss +++ b/src/app/pages/agenda/agenda.page.scss @@ -292,6 +292,11 @@ td.monthview-primary-with-event { .segment { +} + + div ion-raw > ul > li{ + font-size: 11pt; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; } /* Timeline */ @@ -794,4 +799,17 @@ app-approve-event{ border-top-right-radius: 25px; } -} \ No newline at end of file +} + + + + +$font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; +$font-size: 11pt; + +.changeText{ + font-family: $font-family; + font-size: $font-size; + +} + \ No newline at end of file diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 54cace2f4..136a6a819 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -161,6 +161,7 @@ export class AgendaPage implements OnInit { dropdownScrollWeal = false CalendarStore = CalendarStore listToPresent + array = [] constructor( private alertCtrl: AlertController, @@ -232,6 +233,8 @@ export class AgendaPage implements OnInit { ngOnInit() { + this.getFromDB(); + const pathname = window.location.pathname let realoadCounter = 0 this.router.events.forEach((event) => { @@ -240,14 +243,14 @@ export class AgendaPage implements OnInit { this.segment = "Combinado"; } if (realoadCounter != 0) { - this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); + //this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); } realoadCounter++; } }); this.backgroundservice.registerBackService('Online', () => { - this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); + //this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); }); window.onresize = (event) => { @@ -487,6 +490,7 @@ export class AgendaPage implements OnInit { } loadRangeEvents(startTime: Date, endTime: Date) { + this.array = []; this.rangeStartDate = startTime this.rangeEndDate = endTime @@ -514,6 +518,7 @@ export class AgendaPage implements OnInit { this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); @@ -540,13 +545,17 @@ export class AgendaPage implements OnInit { this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); this.showLoader = false; this.showTimeline = true; - }).finally(() => { + }).catch((error) => { + this.getFromDB() + }) + .finally(() => { this.showLoader = false; }) @@ -567,6 +576,7 @@ export class AgendaPage implements OnInit { this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); @@ -603,6 +613,7 @@ export class AgendaPage implements OnInit { this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); @@ -614,7 +625,10 @@ export class AgendaPage implements OnInit { } - }).finally(() => { + }).catch((error) => { + this.getFromDB() + }) + .finally(() => { counter++; if (counter == 2) { this.showLoader = false; @@ -633,6 +647,8 @@ export class AgendaPage implements OnInit { this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); + this.myCal.update(); this.myCal.loadEvents(); @@ -644,7 +660,10 @@ export class AgendaPage implements OnInit { this.showLoader = false; } - }).finally(() => { + }).catch((error) => { + this.getFromDB() + }) + .finally(() => { counter++; if (counter == 2) { this.showLoader = false; @@ -674,6 +693,7 @@ export class AgendaPage implements OnInit { this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate }) + console.log('check list to present data', this.listToPresent); this.myCal.update(); this.myCal.loadEvents(); @@ -685,7 +705,10 @@ export class AgendaPage implements OnInit { this.showLoader = false; } - }).finally(() => { + }).catch((error) => { + this.getFromDB() + }) + .finally(() => { if (counter == 1 || this.loggeduser.Profile == 'PR') { this.showLoader = false; } @@ -697,7 +720,6 @@ export class AgendaPage implements OnInit { } trasnformData(response,profile) { - let array = [] response.forEach(element => { let event = { startTime: new Date(element.StartDate), @@ -708,10 +730,9 @@ export class AgendaPage implements OnInit { profile: profile, id: element.EventId, } - array.push(event) + this.array.push(event) }); - - this.listToPresent = array; + this.listToPresent = this.array; console.log('LIST TO PRESET', this.listToPresent) } @@ -952,7 +973,7 @@ export class AgendaPage implements OnInit { // }); this.myCal.update(); this.myCal.loadEvents(); - // this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); + this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); } this.cloneAllmobileComponent(); @@ -992,7 +1013,6 @@ export class AgendaPage implements OnInit { this.postEvent = data.event; this.mobileComponent.showEditEvent = true; - } this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); @@ -1147,6 +1167,7 @@ export class AgendaPage implements OnInit { async closeComponentEditEventOrAdd() { if (this.IsEvent = 'edit') { + this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); this.eventClicked(this.viewingEventObject); } else if (this.IsEvent = 'add') { this.cloneAllmobileComponent(); diff --git a/src/app/pages/agenda/new-event/new-event.page.ts b/src/app/pages/agenda/new-event/new-event.page.ts index 2c9954bcd..2c727befa 100644 --- a/src/app/pages/agenda/new-event/new-event.page.ts +++ b/src/app/pages/agenda/new-event/new-event.page.ts @@ -281,12 +281,12 @@ export class NewEventPage implements OnInit { }); - this.toastService.successMessage() + this.toastService._successMessage() this.modalController.dismiss(this.postEvent); } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() } diff --git a/src/app/pages/agenda/view-event/view-event.page.ts b/src/app/pages/agenda/view-event/view-event.page.ts index ad1989d2b..ea60b28bd 100644 --- a/src/app/pages/agenda/view-event/view-event.page.ts +++ b/src/app/pages/agenda/view-event/view-event.page.ts @@ -171,9 +171,9 @@ export class ViewEventPage implements OnInit { loader.remove() }, (error) => { - console.log('errorstatus',error.status) + console.log('errorstatus ss',error.status) - if (error.status == 0) { + if (error.status === 0) { this.getFromDb(); } else { this.toastService.badRequest('Este evento já não existe na sua agenda') @@ -205,6 +205,8 @@ export class ViewEventPage implements OnInit { () => { loader.remove(); }); + + loader.remove(); } @@ -421,8 +423,9 @@ export class ViewEventPage implements OnInit { const loader = this.toastService.loading(); this.sqliteservice.getEventById(this.eventId).then((event) => { let arrayevent = []; + console.log('EVENT ATTENDEES',event[0].Attendees) let elemet = { - Attendees: JSON.parse(event[0].Attendees) || "", + Attendees: (typeof JSON.parse(event[0].Attendees) === 'undefined') ? "" : JSON.parse(event[0].Attendees), Body: JSON.parse(event[0].Body) || "", CalendarId: event[0].CalendarId, CalendarName: event[0].CalendarName, diff --git a/src/app/pages/chat/chat.module.ts b/src/app/pages/chat/chat.module.ts index 596e53b7a..7c341c85a 100644 --- a/src/app/pages/chat/chat.module.ts +++ b/src/app/pages/chat/chat.module.ts @@ -29,6 +29,7 @@ import { HeaderPageModule } from 'src/app/shared/header/header.module'; import { NewEventPageModule } from 'src/app/shared/agenda/new-event/new-event.module'; import { AttendeeModalPageModule } from 'src/app/shared/event/attendee-modal/attendee-modal.module'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { ImageCropperModule } from 'ngx-image-cropper'; @NgModule({ imports: [ @@ -48,6 +49,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; GroupContactsPageModule, EmptyChatPageModule, NewEventPageModule, + ImageCropperModule, AttendeeModalPageModule, ], declarations: [ diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 9e432d89f..d9da4bea1 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -97,8 +97,6 @@ - -
@@ -125,6 +123,7 @@
+ diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index b6b265601..6bf4d6f50 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -32,6 +32,7 @@ import { ThemeService } from 'src/app/services/theme.service' import { DataService } from 'src/app/services/data.service'; + @Component({ selector: 'app-chat', templateUrl: './chat.page.html', @@ -119,6 +120,7 @@ export class ChatPage implements OnInit { public ThemeService: ThemeService, private dataService:DataService, private router: Router, + ){ this.loggedUserChat = authService.ValidatedUserChat['data']; this.headers = new HttpHeaders(); @@ -549,4 +551,10 @@ hideRefreshButton(){ modal.onDidDismiss(); } -} +// this.crop.crop('path/to/image.jpg', {quality: 75}) +// .then( +// newImage => console.log('new image path is: ' + newImage), +// error => console.error('Error cropping image', error) +// ); + + } diff --git a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html index 0b571f4f3..00bbea785 100644 --- a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html +++ b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html @@ -29,9 +29,6 @@ - - -
Contactos selecção: diff --git a/src/app/pages/chat/group-messages/group-messages.module.ts b/src/app/pages/chat/group-messages/group-messages.module.ts index a799129af..cc970708b 100644 --- a/src/app/pages/chat/group-messages/group-messages.module.ts +++ b/src/app/pages/chat/group-messages/group-messages.module.ts @@ -13,6 +13,8 @@ import { ChatPopoverPageModule } from 'src/app/shared/popover/chat-popover/chat- import { BtnModalDismissPageModule } from 'src/app/shared/btn-modal-dismiss/btn-modal-dismiss.module'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { ImageCropperModule } from 'ngx-image-cropper'; +import { AngularCropperjsModule } from 'angular-cropperjs'; @NgModule({ imports: [ @@ -24,6 +26,9 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; GroupMessagesPageRoutingModule, ChatPopoverPageModule, BtnModalDismissPageModule, + ImageCropperModule, + AngularCropperjsModule + ], declarations: [GroupMessagesPage] }) diff --git a/src/app/pages/chat/group-messages/group-messages.page.html b/src/app/pages/chat/group-messages/group-messages.page.html index d0ee28435..fe648ee08 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.html +++ b/src/app/pages/chat/group-messages/group-messages.page.html @@ -57,7 +57,7 @@ A conversa original mantêm-se como chat individual
-
+
{{msg.u.name}} {{showDateDuration(msg._updatedAt)}} @@ -66,7 +66,7 @@ {{msg.msg}}
- image + image
@@ -90,7 +90,9 @@
+
+
{{last ? scrollToBottom() : ''}}
@@ -152,4 +154,5 @@
+ diff --git a/src/app/pages/chat/group-messages/group-messages.page.scss b/src/app/pages/chat/group-messages/group-messages.page.scss index f0d364001..c08d1b385 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.scss +++ b/src/app/pages/chat/group-messages/group-messages.page.scss @@ -278,3 +278,36 @@ } } +.preview-slides { + margin-top: 20%; + background: #e6e6e6; + + img { + padding-top: 20px; + padding-bottom: 20px; + } +} + +.transparent-modal { + .modal-wrapper { + --background: rgba(44, 39, 45, 0.2); + } +} + + +.image-slide, +.image-card { + overflow: visible; +} + +.image-card { + z-index: 9; +} + +.backdrop { + height: 200%; + width: 100%; + background: black; + position: absolute; + z-index: 10; +} \ No newline at end of file diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index b89e7e8b1..4f6cbab0b 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -1,5 +1,5 @@ -import { Component, ElementRef, OnInit, ViewChild, AfterViewChecked, AfterViewInit, OnDestroy, } from '@angular/core'; -import { ActionSheetController, MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular'; +import { Component, ElementRef, OnInit, ViewChild, AfterViewChecked, AfterViewInit, OnDestroy, ChangeDetectorRef, } from '@angular/core'; +import { ActionSheetController, IonSlides, MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular'; import { AlertService } from 'src/app/services/alert.service'; import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; @@ -20,6 +20,7 @@ import { NewEventPage } from '../../agenda/new-event/new-event.page'; import { EventPerson } from 'src/app/models/eventperson.model'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ThemeService } from 'src/app/services/theme.service' +import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page'; @Component({ selector: 'app-group-messages', @@ -27,6 +28,9 @@ import { ThemeService } from 'src/app/services/theme.service' styleUrls: ['./group-messages.page.scss'], }) export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { + + + showLoader: boolean; isGroupCreated:boolean; loggedUser: any; @@ -75,7 +79,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { private fileToBase64Service: FileToBase64Service, private fileService: FileService, private toastService: ToastService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private changeDetectorRef: ChangeDetectorRef ) { this.loggedUserChat = authService.ValidatedUserChat['data']; this.isGroupCreated = true; @@ -464,7 +469,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { //this.loadPicture(); } else if(res['data'] == 'add-picture'){ - this.fileService.addPictureToChat(this.roomId); + this.fileService.addPictureToChatMobile(this.roomId); //this.loadPicture(); } else if(res['data'] == 'add-document'){ @@ -580,4 +585,59 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { }); } + sliderOpts = { + zoom: false, + slidesPerView: 1.5, + spaceBetween: 20, + centeredSlides: true + }; + zoomActive = false; +zoomScale = 1; + +sliderZoomOpts = { + allowSlidePrev: false, + allowSlideNext: false, + zoom: { + maxRatio: 5 + }, + on: { + zoomChange: (scale, imageEl, slideEl) => { + this.zoomActive = true; + this.zoomScale = scale/5; + this.changeDetectorRef.detectChanges(); + } + } } + +async touchEnd(zoomslides: IonSlides, card) { + // Zoom back to normal + const slider = await zoomslides.getSwiper(); + const zoom = slider.zoom; + zoom.out(); + + // Card back to normal + card.el.style['z-index'] = 9; + + this.zoomActive = false; + this.changeDetectorRef.detectChanges(); +} + +touchStart(card) { + // Make card appear above backdrop + card.el.style['z-index'] = 11; +} + + async openPreview(img) { + const modal = await this.modalController.create({ + component: PreviewCameraPage, + cssClass: 'transparent-modal', + componentProps: { + image: img.attachments[0].image_url, + username: img.u.username, + _updatedAt: img._updatedAt + } + }); + modal.present(); + } +} + diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index d97245b37..cf14f59d9 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -50,8 +50,8 @@ -->
-
+ [class.messages-list-item-wrapper-active]="msg._id == selectedMsgId" > +
{{msg.u.name}} {{showDateDuration(msg._updatedAt)}} @@ -60,7 +60,7 @@ {{msg.msg}}
- image + image
@@ -138,6 +138,7 @@ -->
+
+ diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index aac84926d..971268b39 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -1,6 +1,6 @@ -import { AfterViewChecked, AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'; +import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router' -import { GestureController, Gesture, ModalController, NavParams, PopoverController } from '@ionic/angular'; +import { GestureController, Gesture, ModalController, NavParams, PopoverController, IonSlides } from '@ionic/angular'; import { map } from 'rxjs/operators'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { EventPerson } from 'src/app/models/eventperson.model'; @@ -23,6 +23,11 @@ import { ThemeService } from 'src/app/services/theme.service' import { Filesystem, Directory, Encoding } from '@capacitor/filesystem'; import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder'; import { Haptics, ImpactStyle } from '@capacitor/haptics'; +import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page'; +// import { SocialSharing } from '@ionic-native/social-sharing/ngx'; +//import { Share } from '@capacitor/share'; + +const IMAGE_DIR = 'stored-images'; @Component({ selector: 'app-messages', @@ -36,8 +41,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { /* @ViewChild('messageContainer') messageContainer: ElementRef; */ @ViewChild('rectangle') private rectangle: ElementRef; + canvas: any + ctx: any loggedUser: any; - message = ''; messages:any; userPresence=''; @@ -83,7 +89,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { private fileService: FileService, private gestureController: GestureController, private processes: ProcessesService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private changeDetectorRef: ChangeDetectorRef, + // private socialSharing: SocialSharing ) { this.loggedUser = authService.ValidatedUserChat['data']; this.roomId = this.navParams.get('roomId'); @@ -101,6 +109,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { this.loadFiles(); VoiceRecorder.requestAudioRecordingPermission(); + Filesystem.mkdir({ + path: IMAGE_DIR, + directory: Directory.Data, + recursive: true + }); } ngAfterViewInit() { @@ -583,8 +596,95 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { }); } - openPreview(){ + + sliderOpts = { + zoom: false, + slidesPerView: 1.5, + spaceBetween: 20, + centeredSlides: true + }; + zoomActive = false; +zoomScale = 1; + +sliderZoomOpts = { + allowSlidePrev: false, + allowSlideNext: false, + zoom: { + maxRatio: 5 + }, + on: { + zoomChange: (scale, imageEl, slideEl) => { + this.zoomActive = true; + this.zoomScale = scale/5; + this.changeDetectorRef.detectChanges(); + } + } +} + +async touchEnd(zoomslides: IonSlides, card) { + // Zoom back to normal + const slider = await zoomslides.getSwiper(); + const zoom = slider.zoom; + zoom.out(); + + // Card back to normal + card.el.style['z-index'] = 9; + + this.zoomActive = false; + this.changeDetectorRef.detectChanges(); +} + +touchStart(card) { + // Make card appear above backdrop + card.el.style['z-index'] = 11; +} + + + async openPreview(msg) { + const modal = await this.modalController.create({ + component: PreviewCameraPage, + cssClass: 'transparent-modal', + componentProps: { + image: msg.attachments[0].image_url, + username: msg.u.username, + _updatedAt: msg._updatedAt, + } + + + }); + modal.present(); + } + + + imageSize(img){ + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + canvas.width=300 + canvas.height=234 + ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234); + document.body.appendChild(canvas); +} + +getPicture(img){ + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + canvas.width=300 + canvas.height=234 + ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234); + document.body.appendChild(canvas); } + // async ShareEmail(msg){ + // // Check if sharing via email is supported + // await Share.share({ + // title: msg.u.username, + // text: msg._updatedAt, + // url: msg.attachments[0].image_url, + // dialogTitle: 'Share with buddies', + // }); + // } } + + + diff --git a/src/app/pages/events/events.page.html b/src/app/pages/events/events.page.html index 7ad906034..9792c8a6c 100644 --- a/src/app/pages/events/events.page.html +++ b/src/app/pages/events/events.page.html @@ -1,8 +1,8 @@ - + - +

{{customDate}}

diff --git a/src/app/pages/events/events.page.scss b/src/app/pages/events/events.page.scss index 3080ac852..0a534d223 100644 --- a/src/app/pages/events/events.page.scss +++ b/src/app/pages/events/events.page.scss @@ -275,6 +275,7 @@ ion-toolbar{ // new .main{ padding: 0px em(20px); + background: linear-gradient(270deg, var(--color2) 100%, var(--color3) 100%, var(--color4) 100%, var(--color5) 100%) !important; } .event-number{ @@ -402,8 +403,8 @@ ion-toolbar{ display: flex; justify-content: space-between; align-items: center; - background-color: transparent !important; - --background: transparent !important; + background-color: transparent; + --background: transparent; .schedule-time{ margin-right: 10px; .time-start{ diff --git a/src/app/pages/events/events.page.ts b/src/app/pages/events/events.page.ts index 709122a83..e9a4177b0 100644 --- a/src/app/pages/events/events.page.ts +++ b/src/app/pages/events/events.page.ts @@ -318,6 +318,36 @@ export class EventsPage implements OnInit { if (list.length > 0) { list.forEach(element => { this.sqliteservice.addEvent(element) + + this.sqliteservice.getAllEvents().then((event: any[]) => { + let todayEvents = new Array() + event.forEach((element) => { + let eventObject = { + AppointmentState: element.AppointmentState, + Attachments: element.Attachments, + Attendees: element.Attendees, + CalendarId: element.CalendarId, + CalendarName: element.CalendarName, + Category: element.Category, + EndDate: element.EndDate, + EventId: element.EventId, + EventRecurrence: element.EventRecurrence, + EventType: element.EventType, + HasAttachments: element.HasAttachments, + HumanDate: element.HumanDate, + IsAllDayEvent: element.IsAllDayEvent, + IsMeeting: element.IsMeeting, + IsRecurring: element.IsRecurring, + Location: element.Location, + Organizer: element.Organizer, + Profile: element.Profile, + StartDate: element.StartDate, + Subject: element.Subject + } + todayEvents.push(eventObject); + }) + console.log('JIFJSOSDJSDONS',todayEvents) + }) }); } } diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html index 3df1fa9ac..d0b92ddcb 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html @@ -1,4 +1,4 @@ - + diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts index e80b51e2b..d295e2e60 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts @@ -157,7 +157,7 @@ export class DespachoPrPage implements OnInit { } catch (e) { window.history.back(); } - this.toastService.badRequest('Processo não encontrado') + this.toastService._badRequest('Processo não encontrado') } }); @@ -272,9 +272,9 @@ export class DespachoPrPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise() this.close(); - this.toastService.successMessage() + this.toastService._successMessage() } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() @@ -297,10 +297,10 @@ export class DespachoPrPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise() - this.toastService.successMessage('Processo arquivado') + this.toastService._successMessage('Processo arquivado') this.close(); } catch (error) { - this.toastService.badRequest('Processo não arquivado') + this.toastService._badRequest('Processo não arquivado') } finally { loader.remove() @@ -320,10 +320,10 @@ export class DespachoPrPage implements OnInit { documents }).toPromise() - this.toastService.successMessage('Processo criado') + this.toastService._successMessage('Processo criado') this.close(); } catch (error) { - this.toastService.badRequest('Processo não criado') + this.toastService._badRequest('Processo não criado') } finally { loader.remove() @@ -346,10 +346,10 @@ export class DespachoPrPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise() - this.toastService.successMessage('') + this.toastService._successMessage('') this.close(); } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() @@ -373,10 +373,10 @@ export class DespachoPrPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise() - this.toastService.successMessage() + this.toastService._successMessage() this.close(); } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() @@ -391,11 +391,11 @@ export class DespachoPrPage implements OnInit { sendExpedienteToPending() { this.processes.SetTaskToPending(this.serialNumber).subscribe(res => { this.popoverController.dismiss('close') - this.toastService.successMessage('Processo enviado para pendentes') + this.toastService._successMessage('Processo enviado para pendentes') this.goBack() }, () => { - this.toastService.badRequest('Processo não encontrado') + this.toastService._badRequest('Processo não encontrado') }); } @@ -448,6 +448,7 @@ export class DespachoPrPage implements OnInit { else if (actionName == 'Reexecução') { await this.reexecutar(res.data.note, docs); } + this.goBack(); } }); @@ -535,7 +536,15 @@ export class DespachoPrPage implements OnInit { backdropDismiss: false }); await modal.present(); - modal.onDidDismiss(); + modal.onDidDismiss().then(res => { + if(res){ + const data = res.data; + if(data == 'close') { + this.goBack(); + } + } + + }); } async distartExpedientModal() { diff --git a/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.ts index 80fa3d4be..a237e0c7e 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.ts @@ -157,8 +157,9 @@ export class DespachosPrPage implements OnInit { } this.despachoList.push(task); - console.log(this.despachoList); }); + + this.despachoList = this.sortService.sortDate(this.despachoList, 'CreateDate') this.listToPresent = this.despachoList }, (error) => { diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts index 270c49bca..e4eb59fc6 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts @@ -117,15 +117,15 @@ export class DiplomaAssinarPage implements OnInit { }, (error)=>{ try { - this.toastService.badRequest('Processo não encontrado') + this.toastService._badRequest('Processo não encontrado') this.goBack() } catch (e) { window.history.back(); } finally { if(error.status == 0) { - this.toastService.badRequest('Não é possível visualizar este processo no modo offline') + this.toastService._badRequest('Não é possível visualizar este processo no modo offline') } else { - this.toastService.badRequest('Processo não encontrado') + this.toastService._badRequest('Processo não encontrado') } } }); @@ -179,11 +179,11 @@ export class DiplomaAssinarPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise() - this.toastService.successMessage(false, ()=>{ + this.toastService._successMessage(false, ()=>{ this.goBack(); }) } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts b/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts index e9cfdf5ca..564ea7b51 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts @@ -80,13 +80,14 @@ export class DiplomasAssinarPage implements OnInit { let diplomas = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise(); this.diplomasList = []; - let diplomasAssinar = diplomas.reverse().filter(data => data.activityInstanceName == "Assinar Diploma"); - diplomasAssinar = this.sortService.sortArrayISODate(diplomasAssinar); + let diplomasAssinar = diplomas.filter(data => data.activityInstanceName == "Assinar Diploma"); diplomasAssinar.forEach(element => { let task: customTask = this.customTaskPipe.transform(element) this.diplomasList.push(task); }); + this.diplomasList = this.sortService.sortDate(this.diplomasList, 'CreateDate') + this.skeletonLoader = false this.showLoader = false; diff --git a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts index 54c9862f8..914df88d3 100644 --- a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts +++ b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts @@ -163,7 +163,7 @@ export class DiplomaPage implements OnInit { } catch (e) { window.history.back(); } - this.toastService.badRequest('Processo não encontrado') + this.toastService._badRequest('Processo não encontrado') } }); @@ -282,12 +282,12 @@ export class DiplomaPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise() - this.toastService.successMessage(false, () => { + this.toastService._successMessage(false, () => { this.close(); }) } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() @@ -308,9 +308,9 @@ export class DiplomaPage implements OnInit { const loader = this.toastService.loading() try { await this.processes.CompleteTask(body).toPromise() - this.toastService.successMessage() + this.toastService._successMessage() } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() @@ -334,9 +334,9 @@ export class DiplomaPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise(); - this.toastService.successMessage('Processo concluído') + this.toastService._successMessage('Processo concluído') } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() diff --git a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html index b5b84d976..2fb25a676 100644 --- a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html +++ b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html @@ -16,10 +16,10 @@ - Por validar + Por validar ... - Assinados PR + Assinados PR ... diff --git a/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts b/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts index 49a5df6e8..5f49173e7 100644 --- a/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts +++ b/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts @@ -182,7 +182,6 @@ export class DiplomasPage implements OnInit, OnDestroy { this.skeletonLoader = false this.showLoader = false; - let diplomasValidar = diplomas.filter(data => data.activityInstanceName == "Revisar Diploma"); let diplomasList = []; diplomasValidar.forEach(async element => { @@ -191,18 +190,19 @@ export class DiplomasPage implements OnInit, OnDestroy { diplomasList.push(task); }); - this.diplomasList = this.sortService.sortArrayISODate(diplomasList.reverse()); + + this.diplomasList = this.sortService.sortDate(diplomasList, 'CreateDate'); + let diplomasAssinados = diplomas.filter(data => data.activityInstanceName == "Diploma Assinado"); + let diplomasAssinadoList = []; - let diplomasAssinados = diplomas.reverse().filter(data => data.activityInstanceName == "Diploma Assinado"); - let diplomasAssinadoList = [] diplomasAssinados.forEach(async element => { let task = this.pipeTask(element); diplomasAssinadoList.push(task); }); - console.log('diplomasAssinados', diplomasAssinados) - this.diplomasAssinadoList = this.sortService.sortArrayISODate(diplomasAssinadoList).reverse(); + + this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'CreateDate') }, (error) => { this.getFromDb() @@ -220,21 +220,21 @@ export class DiplomasPage implements OnInit, OnDestroy { let task = this.pipeTaskOffline(element) diplomasList.push(task); + }); - }); - console.log(diplomasList); + console.log(diplomasList); + this.diplomasList = this.sortService.sortDate(diplomasList, 'taskStartDate'); - this.diplomasList = this.sortService.sortArrayISODate(diplomasList).reverse(); - - let diplomasAssinados = process.reverse().filter(data => data.activityInstanceName == "Diploma Assinado"); + let diplomasAssinados = process.filter(data => data.activityInstanceName == "Diploma Assinado"); let diplomasAssinadoList = [] diplomasAssinados.forEach(async element => { - let task = this.pipeTaskOffline(element) - diplomasAssinadoList.push(task); - }); - console.log('diplomasAssinados', diplomasAssinados) - this.diplomasAssinadoList = this.sortService.sortArrayISODate(diplomasAssinadoList).reverse(); + let task = this.pipeTaskOffline(element) + diplomasAssinadoList.push(task); + }); + + console.log('diplomasAssinados', diplomasAssinados) + this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'taskStartDate') }) } diff --git a/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.ts b/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.ts index 3dc0df31b..3318f254c 100644 --- a/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.ts +++ b/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.ts @@ -110,13 +110,13 @@ export class ApproveEventModalPage implements OnInit { try { await this.processes.PostTaskAction(body).toPromise() - this.toastService.successMessage('Evento aprovado', ()=>{ + this.toastService._successMessage('Evento aprovado', ()=>{ this.router.navigate(['/home/gabinete-digital/event-list']); this.modalController.dismiss(null); }) } catch (error) { - this.toastService.badRequest('Evento não aprovado') + this.toastService._badRequest('Evento não aprovado') } finally { loader.remove() @@ -141,11 +141,11 @@ export class ApproveEventModalPage implements OnInit { try { await this.processes.PostTaskAction(body).toPromise() - this.toastService.successMessage('Evento rejeitado', () =>{ + this.toastService._successMessage('Evento rejeitado', () =>{ this.router.navigate(['/home/gabinete-digital/event-list']); }) } catch (error) { - this.toastService.badRequest('Evento não rejeitado') + this.toastService._badRequest('Evento não rejeitado') } finally { loader.remove() diff --git a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts index eb15015f1..6ed90e273 100644 --- a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts +++ b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.ts @@ -17,6 +17,7 @@ import { SqliteService } from '../../../../services/sqlite.service'; import { BackgroundService } from '../../../../services/background.service'; import { Platform } from '@ionic/angular'; import { ThemeService } from 'src/app/services/theme.service' +import { OfflineManagerService } from 'src/app/services/offline-manager.service'; @Component({ @@ -62,6 +63,7 @@ export class ApproveEventPage implements OnInit { private platform: Platform, private backgroundservice: BackgroundService, public ThemeService: ThemeService, + private offlineManager: OfflineManagerService ) { this.activatedRoute.paramMap.subscribe(params => { // console.log(params["params"]); @@ -203,11 +205,11 @@ export class ApproveEventPage implements OnInit { try { await this.processes.PostTaskAction(body).toPromise() - this.toastService.successMessage(); + this.toastService._successMessage(); this.goBack(); } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() @@ -255,11 +257,15 @@ export class ApproveEventPage implements OnInit { const loader = this.toastService.loading() try { - await this.processes.PostTaskAction(body).toPromise(); - this.toastService.successMessage('Pedido enviado'); + await this.processes.PostTaskAction(body).toPromise() + .catch(() => { + console.log('Send event to approve for revition') + this.offlineManager.storeRequestData('event-listRever', body); + }); + this.toastService._successMessage('Pedido enviado'); this.goBack(); } catch (error) { - this.toastService.badRequest(); + this.toastService._badRequest(); } finally { loader.remove() } @@ -280,10 +286,10 @@ export class ApproveEventPage implements OnInit { const loader = this.toastService.loading() try { await this.processes.PostTaskAction(body).toPromise(); - await this.toastService.successMessage('Processo rejeitado'); + await this.toastService._successMessage('Processo rejeitado'); this.goBack(); } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() @@ -358,10 +364,10 @@ export class ApproveEventPage implements OnInit { try { await this.processes.PostTaskAction(body).toPromise(); - this.toastService.successMessage(); + this.toastService._successMessage(); this.goBack(); } catch (error) { - this.toastService.badRequest(); + this.toastService._badRequest(); } finally { loader.remove() } diff --git a/src/app/pages/gabinete-digital/event-list/event-list.page.ts b/src/app/pages/gabinete-digital/event-list/event-list.page.ts index 444e0e291..aa7a02372 100644 --- a/src/app/pages/gabinete-digital/event-list/event-list.page.ts +++ b/src/app/pages/gabinete-digital/event-list/event-list.page.ts @@ -84,14 +84,13 @@ export class EventListPage implements OnInit { this.platform.ready().then(() => { this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[]) => { - this.eventsMDGPRList = this.sortService.sortArrayByDate(event).reverse() + this.eventsMDGPRList = this.sortService.sortDate(event, 'taskStartDate') - console.log("All evento to aprove from db ", event) }) this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[]) => { - this.eventsPRList = this.sortService.sortArrayByDate(event).reverse() - console.log("All evento to aprove from db ", event) + this.eventsPRList = this.sortService.sortDate(event, 'taskStartDate') + }) }) console.log('Offlineee') @@ -111,14 +110,14 @@ export class EventListPage implements OnInit { let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise(); let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise(); this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal); - this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse() + this.eventsMDGPRList = this.sortService.sortDate(this.eventsMDGPRList, 'taskStartDate') this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse()); } else if (this.segment == 'PR') { let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise(); let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise(); this.eventsPRList = prEventsOficial.concat(prEventsPessoal); - this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList).reverse(); + this.eventsPRList = this.sortService.sortDate(this.eventsPRList, 'taskStartDate') this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse()); } this.showLoader = false; diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts index 7411339b3..060b0afb9 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts @@ -275,10 +275,10 @@ export class BookMeetingModalPage implements OnInit { this.modalController.dismiss(); // this.distartExpedientModal(); - this.toastService.successMessage('Reunião criada'); + this.toastService._successMessage('Reunião criada'); } catch (error) { - this.toastService.badRequest('Reunião não criada') + this.toastService._badRequest('Reunião não criada') } finally { loader.remove() @@ -300,10 +300,10 @@ export class BookMeetingModalPage implements OnInit { break; } this.close(); - this.toastService.successMessage('Reunião criada'); + this.toastService._successMessage('Reunião criada'); } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() } diff --git a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts index 66a2f128e..6b2a10354 100644 --- a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts @@ -328,11 +328,11 @@ export class ExpedientTaskModalPage implements OnInit { try { this.taskResult = await this.processes.postDespatcho(this.postData).toPromise(); - await this.toastService.successMessage('Processo efetuado'); + await this.toastService._successMessage('Processo efetuado'); this.modalController.dismiss(action_despacho); } catch (error) { - await this.toastService.badRequest('Processo não efetuado') + await this.toastService._badRequest('Processo não efetuado') } finally { loader.remove() } @@ -362,11 +362,11 @@ export class ExpedientTaskModalPage implements OnInit { try { this.taskResult = await this.processes.postParecer(this.postData).toPromise(); - await this.toastService.successMessage('Pedido enviado'); + await this.toastService._successMessage('Pedido enviado'); this.modalController.dismiss(action_parecer); } catch (error) { - await this.toastService.badRequest('Processo não efetuado') + await this.toastService._badRequest('Processo não efetuado') } finally { loader.remove() } @@ -394,10 +394,10 @@ export class ExpedientTaskModalPage implements OnInit { try { this.taskResult = await this.processes.postDeferimento(this.postData).toPromise(); - this.toastService.successMessage('Processo efetuado'); + this.toastService._successMessage('Processo efetuado'); this.modalController.dismiss(action_deferimento); } catch (error) { - await this.toastService.badRequest('Processo não efetuado') + await this.toastService._badRequest('Processo não efetuado') } finally { loader.remove() } @@ -436,18 +436,18 @@ export class ExpedientTaskModalPage implements OnInit { if(this.postData.DispatchFolder.Message){ try { this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise(); - await this.toastService.successMessage('Processo efetuado'); + await this.toastService._successMessage('Processo efetuado'); this.modalController.dismiss(action_despacho_pr); } catch (error) { - await this.toastService.badRequest('Processo não efetuado') + await this.toastService._badRequest('Processo não efetuado') } finally { //loader.remove() } } else{ this.validateField = true; - this.toastService.badRequest('Por favor adicione uma descrição'); + this.toastService._badRequest('Por favor adicione uma descrição'); } loader.remove(); break; @@ -474,11 +474,11 @@ export class ExpedientTaskModalPage implements OnInit { try { this.taskResult = await this.processes.postParecerPr(this.postData).toPromise(); - await this.toastService.successMessage('Pedido enviado'); + await this.toastService._successMessage('Pedido enviado'); this.modalController.dismiss(action_parecer_pr); } catch (error) { - await this.toastService.badRequest('Processo não efetuado') + await this.toastService._badRequest('Processo não efetuado') } finally { loader.remove() } diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html index 25b9444c2..a980387ca 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html @@ -111,7 +111,7 @@
-
+
diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index 1307cae28..685853c82 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -171,9 +171,9 @@ export class ExpedienteDetailPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise(); this.close(); - this.toastService.successMessage('Processo aprovado') + this.toastService._successMessage('Processo aprovado') } catch (error) { - this.toastService.badRequest('Processo não aprovado') + this.toastService._badRequest('Processo não aprovado') } finally { loader.remove() } @@ -196,9 +196,9 @@ export class ExpedienteDetailPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise() this.close(); - this.toastService.successMessage() + this.toastService._successMessage() } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() } @@ -293,11 +293,11 @@ export class ExpedienteDetailPage implements OnInit { sendExpedienteToPending() { this.processes.SetTaskToPending(this.serialNumber).subscribe(res => { console.log(res); - this.toastService.successMessage('Processo enviado para pendentes') + this.toastService._successMessage('Processo enviado para pendentes') this.goBack(); }, (error) => { - this.toastService.badRequest('Processo não enviado para pendentes') + this.toastService._badRequest('Processo não enviado para pendentes') }); } @@ -349,12 +349,12 @@ export class ExpedienteDetailPage implements OnInit { this.getFromDB(); } else { try { - this.toastService.badRequest('Processo não encontrado') + this.toastService._badRequest('Processo não encontrado') this.goBack() } catch (e) { window.history.back(); } - this.toastService.badRequest('Processo não encontrado') + this.toastService._badRequest('Processo não encontrado') } }); @@ -441,9 +441,9 @@ export class ExpedienteDetailPage implements OnInit { const loader = this.toastService.loading() this.attachmentsService.AddAttachment(body).subscribe((res) => { - this.toastService.successMessage() + this.toastService._successMessage() }, () => { - this.toastService.badRequest() + this.toastService._badRequest() }, () => { loader.remove() }); @@ -479,7 +479,7 @@ export class ExpedienteDetailPage implements OnInit { await this.processes.CompleteTask(body).toPromise(); this.goBack(); } catch (error) { - this.toastService.badRequest('Processo não descartado') + this.toastService._badRequest('Processo não descartado') } finally { loader.remove() } @@ -510,10 +510,10 @@ export class ExpedienteDetailPage implements OnInit { try { await this.expedienteService.discard({ SerialNumber: this.task.SerialNumber }).toPromise() - this.toastService.successMessage('Processo descartado'); + this.toastService._successMessage('Processo descartado'); this.goBack(); } catch (error) { - this.toastService.badRequest('Processo não descartado') + this.toastService._badRequest('Processo não descartado') } finally { loader.remove() } @@ -529,10 +529,10 @@ export class ExpedienteDetailPage implements OnInit { const loader = this.toastService.loading() try { await this.expedienteService.CompleteTask(body).toPromise(); - //this.toastService.successMessage('Processo descartado'); + //this.toastService._successMessage('Processo descartado'); this.goBack(); } catch (error) { - this.toastService.badRequest('Processo não descartado') + this.toastService._badRequest('Processo não descartado') } finally { loader.remove() } @@ -543,10 +543,10 @@ export class ExpedienteDetailPage implements OnInit { const loader = this.toastService.loading() try { await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise(); - this.toastService.successMessage(); + this.toastService._successMessage(); this.goBack(); } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() } diff --git a/src/app/pages/gabinete-digital/expediente/expediente.page.ts b/src/app/pages/gabinete-digital/expediente/expediente.page.ts index 3f165a4a1..fbb867aa7 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente.page.ts @@ -8,7 +8,7 @@ import { SqliteService } from 'src/app/services/sqlite.service'; import { Platform } from '@ionic/angular'; import { BackgroundService } from '../../../services/background.service'; import { ThemeService } from 'src/app/services/theme.service' - +import { SortService } from 'src/app/services/functions/sort.service'; @Component({ selector: 'app-expediente', @@ -38,7 +38,8 @@ export class ExpedientePage implements OnInit { public platform: Platform, private sqliteservice: SqliteService, private backgroundservice: BackgroundService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { } ngOnInit() { @@ -70,7 +71,7 @@ export class ExpedientePage implements OnInit { const result = res this.taskslist = new Array(); - let ress = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active"); + let ress = result.filter((data: any) => data.workflowInstanceDataFields.Status == "Active"); ress.forEach((element: any) => { @@ -78,7 +79,7 @@ export class ExpedientePage implements OnInit { this.taskslist.push(task); this.addProcessTODb(task); }); - this.listToPresent = this.taskslist + this.listToPresent = this.sortService.sortDate(this.taskslist, 'taskStartDate') console.log('expediente list', this.listToPresent) this.skeletonLoader = false; diff --git a/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts b/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts index bdf1e1646..a23d40c14 100644 --- a/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts +++ b/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts @@ -135,11 +135,11 @@ export class ExpedientePrPage implements OnInit { sendExpedienteToPending() { this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ console.log(res); - this.toastService.successMessage('Processo enviado para pendentes') + this.toastService._successMessage('Processo enviado para pendentes') this.goBack(); }, (error)=>{ - this.toastService.badRequest('Processo não enviado para pendentes') + this.toastService._badRequest('Processo não enviado para pendentes') }); } @@ -184,15 +184,15 @@ export class ExpedientePrPage implements OnInit { }, (error)=>{ try { - this.toastService.badRequest('Processo não encontrado') + this.toastService._badRequest('Processo não encontrado') this.goBack() } catch (e) { window.history.back(); } finally { if(error.status == 0) { - this.toastService.badRequest('Não é possível visualizar este processo no modo offline') + this.toastService._badRequest('Não é possível visualizar este processo no modo offline') } else { - this.toastService.badRequest('Processo não encontrado') + this.toastService._badRequest('Processo não encontrado') } } }); @@ -303,9 +303,9 @@ export class ExpedientePrPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise(); this.close(); - this.toastService.successMessage('Processo aprovado') + this.toastService._successMessage('Processo aprovado') } catch(error) { - this.toastService.badRequest('Processo não aprovado') + this.toastService._badRequest('Processo não aprovado') } finally { loader.remove() } @@ -328,9 +328,9 @@ export class ExpedientePrPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise() this.close(); - this.toastService.successMessage() + this.toastService._successMessage() } catch(error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() } @@ -448,10 +448,10 @@ export class ExpedientePrPage implements OnInit { try { await this.processes.CompleteTask(otherbody).toPromise() - this.toastService.successMessage('Processo descartado'); + this.toastService._successMessage('Processo descartado'); this.goBack(); } catch (error) { - this.toastService.badRequest('Processo não descartado') + this.toastService._badRequest('Processo não descartado') } finally { loader.remove() } @@ -468,10 +468,10 @@ export class ExpedientePrPage implements OnInit { try { await this.processes.CompleteTask(body).toPromise(); - // this.toastService.successMessage('Processo descartado'); + // this.toastService._successMessage('Processo descartado'); this.goBack(); } catch (error) { - // this.toastService.badRequest('Processo não descartado') + // this.toastService._badRequest('Processo não descartado') } finally { loader.remove() } @@ -485,10 +485,10 @@ export class ExpedientePrPage implements OnInit { try { await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise(); - this.toastService.successMessage(); + this.toastService._successMessage(); this.goBack(); } catch (error) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() } diff --git a/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts b/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts index 590200750..9ce1fd431 100644 --- a/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts +++ b/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts @@ -12,7 +12,7 @@ import { Location } from '@angular/common' import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service'; import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe'; import { ThemeService } from 'src/app/services/theme.service' - +import { SortService } from 'src/app/services/functions/sort.service'; @Component({ selector: 'app-expedientes-pr', @@ -41,7 +41,8 @@ export class ExpedientesPrPage implements OnInit { private authService: AuthService, private router: Router, private location: Location, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { this.loggeduser = authService.ValidatedUser; } @@ -80,6 +81,8 @@ export class ExpedientesPrPage implements OnInit { this.taskslist.push(task); }); console.log(this.taskslist); + + this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate') this.expedienteGdStore.reset(this.taskslist); this.skeletonLoader = false }) diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.html b/src/app/pages/gabinete-digital/gabinete-digital.page.html index 6c3fcf1a9..bcdf3a838 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.html +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.html @@ -181,7 +181,7 @@
- diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index a82247f04..4d68e061e 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { ModalController, NavParams } from '@ionic/angular'; +import { ModalController, NavParams, Platform, LoadingController } from '@ionic/angular'; /* import {Plugins, CameraResultType, CameraSource} from '@capacitor/core'; */ import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; @@ -16,14 +16,25 @@ import { formatDate } from 'src/plugin/momentG.js' import { FileLoaderService } from 'src/app/services/file/file-loader.service'; import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service'; import { ThemeService } from 'src/app/services/theme.service'; -import { Camera, CameraResultType, CameraSource, Photo} from '@capacitor/camera'; +import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera'; +import { Filesystem, Directory } from '@capacitor/filesystem'; +import { NgxImageCompressService } from "ngx-image-compress"; +import { SocialSharing } from '@ionic-native/social-sharing/ngx'; +const IMAGE_DIR = 'stored-images'; + +interface LocalFile { + name: string; + path: string; + data: string; +} @Component({ selector: 'app-new-publication', templateUrl: './new-publication.page.html', styleUrls: ['./new-publication.page.scss'], }) export class NewPublicationPage implements OnInit { + images: LocalFile[] = []; // date picker public date: any; @@ -32,7 +43,7 @@ export class NewPublicationPage implements OnInit { public showSeconds = false; public touchUi = false; public enableMeridian = false; - public minDate = new Date().toISOString().slice(0,10) + public minDate = new Date().toISOString().slice(0, 10) public endMinDate = new Date(new Date().getTime() + 15 * 60000); public stepHour = 1; public stepMinute = 5; @@ -48,20 +59,23 @@ export class NewPublicationPage implements OnInit { folderId: string; image: Image = new Image(); - publicationType:string; - publicationTitle:string; - imgUrl:any; + publicationType: string; + publicationTitle: string; + imgUrl: any; - Defaultimage:any = ''; + Defaultimage: any = ''; photo: SafeResourceUrl; - guestPicture:any; + guestPicture: any; - capturedImage:any = ''; - capturedImageTitle:any; + capturedImage: any = ''; + capturedImageTitle: any; public photos: any[] = []; + imgResultBeforeCompress: string; + imgResultAfterCompress: string; + constructor( private modalController: ModalController, public photoService: PhotoService, @@ -70,49 +84,64 @@ export class NewPublicationPage implements OnInit { private toastService: ToastService, private fileLoaderService: FileLoaderService, private fileToBase64Service: FileToBase64Service, - public ThemeService: ThemeService - ) { + public ThemeService: ThemeService, + private platform: Platform, + private loadingCtrl: LoadingController, + public imageCompress: NgxImageCompressService, + private socialSharing: SocialSharing + ) { - this.publicationType = this.navParams.get('publicationType'); - this.folderId = this.navParams.get('folderId'); - this.publicationTitle = 'Nova Publicação'; - } + this.publicationType = this.navParams.get('publicationType'); + this.folderId = this.navParams.get('folderId'); + this.publicationTitle = 'Nova Publicação'; + } ngOnInit() { this.setTitle(); console.log(this.folderId); + Filesystem.mkdir({ + path: IMAGE_DIR, + directory: Directory.Data, + recursive: true + }); // this.takePicture(); } -async takePicture() { - const capturedImage = await Camera.getPhoto({ - quality: 90, - // allowEditing: true, - resultType: CameraResultType.Uri, - source: CameraSource.Camera + async takePicture() { + const image = await Camera.getPhoto({ + quality: 20, + allowEditing: false, + width:50, + height: 50, + resultType: CameraResultType.Uri, + source: CameraSource.Camera // Camera, Photos or Prompt! - }); - const response = await fetch(capturedImage.webPath!); - const blob = await response.blob(); - - this.photos.unshift({ - filepath: "soon...", - webviewPath: capturedImage.webPath }); - this.capturedImage = await this.convertBlobToBase64(blob); - this.capturedImageTitle = new Date().getTime() + '.jpeg'; + if (image) { + this.saveImage(image) + } - //console.log(this.capturedImage); + } + + imageSize(image) { + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + canvas.width = 100 + canvas.height = 34 + ctx.drawImage(image, 0, 0, 100, 34); + document.body.appendChild(canvas); + } + convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => { const reader = new FileReader; reader.onerror = reject; reader.onload = () => { - resolve(reader.result); + resolve(reader.result); }; reader.readAsDataURL(blob); }); @@ -121,7 +150,7 @@ async takePicture() { async laodPicture() { const capturedImage = await Camera.getPhoto({ resultType: CameraResultType.Uri, - source: CameraSource.Photos, + source: CameraSource.Camera, quality: 90, width: 1080, height: 720, @@ -159,7 +188,7 @@ async takePicture() { runValidation() { - this.validateFrom = true + this.validateFrom = true } injectValidation() { @@ -185,18 +214,18 @@ async takePicture() { this.injectValidation() this.runValidation() - if(this.Form.invalid) return false + if (this.Form.invalid) return false - if(this.publicationType == '3') { + if (this.publicationType == '3') { console.log(this.navParams.get('publication')); - if(this.capturedImage != ''){ + if (this.capturedImage != '') { this.publication = { DateIndex: this.publication.DateIndex, - DocumentId:this.publication.DocumentId, - ProcessId:this.publication.ProcessId, + DocumentId: this.publication.DocumentId, + ProcessId: this.publication.ProcessId, Title: this.pub.Title, Message: this.pub.Message, DatePublication: this.publication.DatePublication, @@ -225,8 +254,8 @@ async takePicture() { this.publication = { DateIndex: this.publication.DateIndex, - DocumentId:this.publication.DocumentId, - ProcessId:this.publication.ProcessId, + DocumentId: this.publication.DocumentId, + ProcessId: this.publication.ProcessId, Title: this.pub.Title, Message: this.pub.Message, DatePublication: this.publication.DatePublication, @@ -247,15 +276,15 @@ async takePicture() { this.close(); } catch (error) { this.toastService.badRequest("Publicação não criado") - } finally { + } finally { loader.remove() } - } else { + } else { this.publication = { DateIndex: this.publication.DateIndex, - DocumentId:this.publication.DocumentId, - ProcessId:this.publication.ProcessId, + DocumentId: this.publication.DocumentId, + ProcessId: this.publication.ProcessId, Title: this.pub.Title, Message: this.pub.Message, DatePublication: this.publication.DatePublication, @@ -275,7 +304,7 @@ async takePicture() { this.close(); } catch (error) { this.toastService.badRequest("Publicação não criado") - } finally { + } finally { loader.remove() } @@ -283,15 +312,15 @@ async takePicture() { } else { - const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss') + const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss') console.log(date); console.log(this.folderId); this.publication = { DateIndex: date, - DocumentId:null, - ProcessId:this.folderId, + DocumentId: null, + ProcessId: this.folderId, Title: this.pub.Title, Message: this.pub.Message, DatePublication: date, @@ -312,7 +341,7 @@ async takePicture() { this.close(); } catch (error) { this.toastService.badRequest("Publicação não criado") - } finally { + } finally { loader.remove() } @@ -321,8 +350,8 @@ async takePicture() { close() { - this.modalController.dismiss().then(()=>{ - this.showLoader=true; + this.modalController.dismiss().then(() => { + this.showLoader = true; }); } @@ -331,13 +360,13 @@ async takePicture() { } setTitle() { - if(this.publicationType == '1') { + if (this.publicationType == '1') { this.publicationTitle = 'Nova Publicação Rápida'; } - else if(this.publicationType == '2') { + else if (this.publicationType == '2') { this.publicationTitle = 'Nova Publicação'; } - else if(this.publicationType == '3') { + else if (this.publicationType == '3') { this.publicationTitle = 'Editar Publicação'; this.pub = this.navParams.get('publication'); @@ -357,16 +386,156 @@ async takePicture() { modal.onDidDismiss(); } */ - /* async takePicture(){ - const image = await Plugins.Camera.getPhoto({ - quality: 100, - allowEditing: false, - resultType: CameraResultType.DataUrl, - source: CameraSource.Camera - }); - console.log(image); + /* async takePicture(){ + const image = await Plugins.Camera.getPhoto({ + quality: 100, + allowEditing: false, + resultType: CameraResultType.DataUrl, + source: CameraSource.Camera + }); + console.log(image); + + this.photo = this.sanitizer.bypassSecurityTrustResourceUrl(image && (image.dataUrl)); + } */ + + async selectImage() { + const image = await Camera.getPhoto({ + quality: 20, + allowEditing: false, + resultType: CameraResultType.Uri, + source: CameraSource.Camera // Camera, Photos or Prompt! + }); + if (image) { + this.saveImage(image) + } + } + + + + // Create a new file from a capture image + async saveImage(photo: Photo) { + const base64Data = await this.readAsBase64(photo); + + const fileName = new Date().getTime() + '.jpeg'; + const savedFile = await Filesystem.writeFile({ + path: `${IMAGE_DIR}/${fileName}`, + data: base64Data, + directory: Directory.Data + }); + + //this.loadFiles(fileName); + this.loadFileData(fileName); + } + + private async readAsBase64(photo: Photo) { + if (this.platform.is('hybrid')) { + const file = await Filesystem.readFile({ + path: photo.path + }); + + return file.data; + } + else { + // Fetch the photo, read as a blob, then convert to base64 format + const response = await fetch(photo.webPath); + const blob = await response.blob(); + + return await this.convertBlobToBase64(blob) as string; + } + } + + async loadFiles(fileName) { + this.images = []; + + const loading = await this.loadingCtrl.create({ + message: 'Loading data...', + }); + await loading.present(); + + /* Filesystem.readdir({ + path: `${IMAGE_DIR}/${fileName}`, + directory: Directory.Data, + }).then(result => { + console.log('ALL RESULTS', result.files) + let lastphoto = result.files[result.files.length - 1] + this.loadFileData(lastphoto); + }, + async (err) => { + console.log('ERROR FILE DOSENT EXIST', err) + // Folder does not yet exists! + await Filesystem.mkdir({ + path: IMAGE_DIR, + directory: Directory.Data, + recursive: true + }); + } + ).then(_ => { + loading.dismiss(); + }); */ + } + + async loadFileData(fileName: string) { + console.log('ALL PHOTOT FILE', fileName) + + const loading = await this.loadingCtrl.create({ + message: 'Loading data...', + }); + await loading.present(); + + const filePath = `${IMAGE_DIR}/${fileName}`; + + const readFile = await Filesystem.readFile({ + path: filePath, + directory: Directory.Data, + }); + + this.images.push({ + name: fileName, + path: filePath, + data: `data:image/jpeg;base64,${readFile.data}`, + }); + + console.log('ALL IMAGE', this.images) + + this.capturedImage = this.images[0].data + + this.compressFile(); + + loading.dismiss(); + + } + + /* compressImage() { + let image = this.capturedImage; + this.imageCompress.compressFile(image, orientation, 50, 50,).then(() => { + + this.imgResultBeforeCompress = image; + console.log('Size in bytes was:', this.imageCompress.byteCount(image)); + + this.imageCompress.compressFile(image, orientation, 50, 50).then( + result => { + this.imgResultAfterCompress = result; + console.log('Size in bytes is now:', this.imageCompress.byteCount(result)); + } + ); + }) + } */ + + compressFile() { + + //this.imgResultBeforeCompress = image; + this.imageCompress.getOrientation(this.capturedImage).then((orientation) => { + console.log('Size in bytes was:', this.imageCompress.byteCount(this.capturedImage)); + this.imageCompress.compressFile(this.capturedImage, orientation, 20, 20).then( + result => { + this.capturedImage = result; + console.log('Size in bytes is now:', this.imageCompress.byteCount(result)); + } + ); + + }); + } + - this.photo = this.sanitizer.bypassSecurityTrustResourceUrl(image && (image.dataUrl)); - } */ } diff --git a/src/app/pages/publications/new-publication/photos.ts b/src/app/pages/publications/new-publication/photos.ts new file mode 100644 index 000000000..0690d6cc0 --- /dev/null +++ b/src/app/pages/publications/new-publication/photos.ts @@ -0,0 +1,4 @@ +export interface Photos { + filepath: string; + webviewPath: string; +} \ No newline at end of file diff --git a/src/app/pages/publications/publications.module.ts b/src/app/pages/publications/publications.module.ts index dbb7e19a7..5f121647f 100644 --- a/src/app/pages/publications/publications.module.ts +++ b/src/app/pages/publications/publications.module.ts @@ -15,6 +15,7 @@ import { PublicationDetailPageModule } from 'src/app/shared/publication/view-pub import { HeaderPageModule } from 'src/app/shared/header/header.module'; import { EditActionPageModule } from 'src/app/shared/publication/edit-action/edit-action.module'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { LazyLoadImageModule } from 'ng-lazyload-image'; // <-- import it @NgModule({ imports: [ @@ -29,6 +30,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; PublicationDetailPageModule, NewActionPageModule, EditActionPageModule, + LazyLoadImageModule ], declarations: [ PublicationsPage, diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index f1c15bcad..9951a3376 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -66,7 +66,7 @@ @@ -77,7 +77,6 @@ - { if (window.innerWidth < 801) { @@ -238,9 +242,9 @@ export class PublicationsPage implements OnInit { try { await this.publications.DeletePresidentialAction(id).toPromise(); - this.toastService.successMessage() + this.toastService._successMessage() } catch (e) { - this.toastService.badRequest() + this.toastService._badRequest() } finally { loader.remove() @@ -452,4 +456,10 @@ export class PublicationsPage implements OnInit { }); } + // this.crop.crop('path/to/image.jpg', {quality: 75}) + // .then( + // newImage => console.log('new image path is: ' + newImage), + // error => console.error('Error cropping image', error) + // ); + } diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html index 70c3a110a..0a0caf116 100644 --- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html +++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html @@ -24,7 +24,7 @@
- image + image
image diff --git a/src/app/pages/publications/view-publications/view-publications.module.ts b/src/app/pages/publications/view-publications/view-publications.module.ts index d05bd8b49..35b432670 100644 --- a/src/app/pages/publications/view-publications/view-publications.module.ts +++ b/src/app/pages/publications/view-publications/view-publications.module.ts @@ -10,6 +10,9 @@ import { ViewPublicationsPage } from './view-publications.page'; import { HeaderPageModule } from 'src/app/shared/header/header.module'; +import { LazyLoadImageModule } from 'ng-lazyload-image'; // <-- import it + + @NgModule({ imports: [ CommonModule, @@ -18,6 +21,7 @@ import { HeaderPageModule } from 'src/app/shared/header/header.module'; ViewPublicationsPageRoutingModule, HeaderPageModule, + LazyLoadImageModule ], exports: [ViewPublicationsPage], declarations: [ViewPublicationsPage] diff --git a/src/app/pages/publications/view-publications/view-publications.page.html b/src/app/pages/publications/view-publications/view-publications.page.html index fd3a2a111..32001f7d2 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.html +++ b/src/app/pages/publications/view-publications/view-publications.page.html @@ -34,12 +34,12 @@
-
- image +
image diff --git a/src/app/pages/publications/view-publications/view-publications.page.scss b/src/app/pages/publications/view-publications/view-publications.page.scss index e4c1a0dd2..77534f9d2 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.scss +++ b/src/app/pages/publications/view-publications/view-publications.page.scss @@ -126,7 +126,7 @@ } .post-img{ width: 100%; - //height: 400px; + height: 400px; margin: 0 auto; border-radius: 0px!important; overflow: hidden; diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index ad0095192..8d8839623 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -13,6 +13,7 @@ import { PublicationDetailPage } from './publication-detail/publication-detail.p import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ThemeService } from 'src/app/services/theme.service' +import { forkJoin } from 'rxjs'; @Component({ selector: 'app-view-publications', @@ -25,7 +26,9 @@ export class ViewPublicationsPage implements OnInit { publicationList: Publication[] = new Array(); item: PublicationFolder; + defaultImage = "https://governo.gov.ao/ao/noticias/presidente-joao-lourenco-ouviu-a-voz-da-igreja/" folderId: string; + id: string; error: any; publicationListStorage = PublicationListStorage @@ -65,15 +68,15 @@ export class ViewPublicationsPage implements OnInit { if (typeof (this.folderId) == 'object') { this.folderId = this.folderId['ProcessId'] } - + this.testForkJoin() this.getPublicationDetail(); setTimeout(() => { - this.getPublications(); - }, 5000); + this.getPublicationsIds(); + }, 1000); - this.backgroundservice.registerBackService('Online',() => { + this.backgroundservice.registerBackService('Online', () => { this.getPublicationDetail(); - this.getPublications(); + this.testForkJoin() }) @@ -85,14 +88,19 @@ export class ViewPublicationsPage implements OnInit { this.folderId = this.folderId['ProcessId'] } + // if (typeof (this.id == 'object') { + // this.id = this.id['ProcessId'] + // } + this.testForkJoin() this.getPublicationDetail(); - this.getPublications(); + // this.getPublicationsIds(); } doRefresh = (event) => { setTimeout(() => { + this.testForkJoin() this.getPublicationDetail(); - this.getPublications(); + // this.getPublicationsIds(); event.target.complete(); }, 3000); @@ -110,50 +118,125 @@ export class ViewPublicationsPage implements OnInit { getPublicationDetail() { setTimeout(() => { + let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list) this.item = allActions.find((e) => e.ProcessId == this.folderId); this.publicationDitails = this.item console.log('item', this.item) + }, 100); } +// goes to fork + // getPublicationsIds() { + + // this.showLoader = true; + // const folderId = this.folderId + + // this.publications.GetIdsPublicationsImages(this.id).subscribe(res => { + + // console.log(this.id) + + // this.publicationList = new Array(); + + getPublicationsIds() { - getPublications() { this.showLoader = true; const folderId = this.folderId - this.publications.GetPublications(this.folderId).subscribe(res => { - console.log(this.folderId) + this.publications.GetPublicationsImages(this.folderId).subscribe(res => { + + console.log('publications ids', res) this.publicationList = new Array(); + for(let i of res) { + this.publications.GetPublicationById(i).subscribe(ress => { + console.log('publications by ids', ress) + let item: Publication = this.publicationPipe.itemList(ress) + console.log('publications by ids 2', item) + this.publicationList.push(item); + }) + } + + /* res.forEach(element => { + console.log('publications elements', element) + this.publications.GetPublicationById(element).subscribe(ress => { + console.log('publications by ids', ress) + let item: Publication = this.publicationPipe.itemList(ress) + console.log('publications by ids 2', item) + this.publicationList.push(ress); + }) + + }); */ - res.forEach(element => { - console.log('getPublications', element) - let item: Publication = this.publicationPipe.itemList(element) - this.publicationList.push(item); - }); this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList)); - this.publicationListStorage.add(folderId, this.publicationList) this.getpublication = this.publicationList; this.showLoader = false; - }, - (error) => { - if(error.status == '0') { - this.getFromDB(); - } - if (error.status == '404') { - this.error = 'Sem publicações disponíveis!'; - this.publicationList = []; - this.publicationListStorage.add(folderId, this.publicationList) - } - this.showLoader = false; + /* this.publicationList = new Array(); + + res.forEach(element => { + console.log('getPublications', element) + let item: Publication = this.publicationPipe.itemList(element) + this.publicationList.push(item); + }); + this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList)); + + this.publicationListStorage.add(folderId, this.publicationList) + this.getpublication = this.publicationList; */ + }); + } + + getPublications() { + + this.showLoader = true; + const folderId = this.folderId + + this.publications.GetPublications(this.folderId).subscribe(res => { + + console.log(this.folderId) + + this.publicationList = new Array(); + + res.forEach(element => { + console.log('getPublications', element) + let item: Publication = this.publicationPipe.itemList(element) + this.publicationList.push(item); + console.log('getPublications 222', item) }); + this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList)); + this.publicationListStorage.add(folderId, this.publicationList) + this.getpublication = this.publicationList; + + this.showLoader = false; + }, (error) => { + + if (error.status == '0') { + this.getFromDB(); + } + if (error.status == '404') { + this.error = 'Sem publicações disponíveis!'; + this.publicationList = []; + this.publicationListStorage.add(folderId, this.publicationList) + } + this.showLoader = false; + }); + } + + testForkJoin(){ + forkJoin([ + this.getPublicationsIds(), + this.getPublications(), + + + ]).subscribe(allResults =>{ + this.publicationList = allResults[2] + }) } getFromDB() { @@ -223,7 +306,7 @@ export class ViewPublicationsPage implements OnInit { }); await modal.present(); modal.onDidDismiss().then(() => { - this.getPublications(); + this.getPublicationsIds(); }); } diff --git a/src/app/services/agenda/list-box.service.ts b/src/app/services/agenda/list-box.service.ts index 04066f1da..8070c3a21 100644 --- a/src/app/services/agenda/list-box.service.ts +++ b/src/app/services/agenda/list-box.service.ts @@ -8,11 +8,11 @@ import { DateService } from '../date.service'; export class ListBoxService { constructor( - private dateService: DateService - ){} + private dateService: DateService + ){} - filterProfile(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all') { + filterProfile(eventSource: EventListStore[] = [], profile: 'md' | 'pr' | 'all') { return eventSource.filter((e) => e.profile == profile) } @@ -26,32 +26,34 @@ export class ListBoxService { }) } - filterSegment(eventSource: EventListStore[], segment): EventListStore[] { - return eventSource.filter( data => data.calendarName == segment) - } - + filterSegment(eventSource: EventListStore[], segment): EventListStore[] { + return eventSource.filter( data => data.calendarName == segment) + } daysBetween(){ } list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'Combinado', selectedDate= null}) { - // filter range - if(selectedDate) { - eventSource = eventSource.filter(data => - data.startTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt') && - data.endTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt') - ) - } + // console.log('eventSource', eventSource ,'rangeStartDate', new Date(rangeStartDate).toLocaleDateString('pt') , 'randEndDate', new Date(randEndDate).toLocaleDateString('pt')) - if(segment!='Combinado') { - eventSource = this.filterSegment(eventSource, segment) - } + // // filter range + // if(selectedDate) { + // eventSource = eventSource.filter(data => + // data.startTime.toLocaleDateString('pt') >= new Date(rangeStartDate).toLocaleDateString('pt') && + // data.startTime.toLocaleDateString('pt') <= new Date(rangeStartDate).toLocaleDateString('pt') + // ) + // } + + + if(segment!='Combinado') { + eventSource = this.filterSegment(eventSource, segment) + } if(profile != 'all') { eventSource = this.filterProfile(eventSource, profile) } - let newStracture:CustomCalendarEvent[]; + let newStracture:CustomCalendarEvent[]; if(profile == 'md') { newStracture = this.encapsulation(eventSource, 'mdgpr'); @@ -92,12 +94,12 @@ export class ListBoxService { if (diffDays >= 1) { const StartEvent = this.transForm(event, {startMany: true,endMany: false, middle: false, profile}) - - if(this.push(event, selectedDate)) days[day].push(StartEvent) + + if(this.push(event, selectedDate)) days[day].push(StartEvent) let i = 1; - // create event between date + // create event between date while (startDate.getFullYear() != endDate.getFullYear() || startDate.getMonth() != endDate.getMonth() || startDate.getDate() != endDate.getDate()) { @@ -130,12 +132,15 @@ export class ListBoxService { } } else { + + if(this.push(event, selectedDate)) days[day].push(event) } } else { + if(this.push(event, selectedDate)) days[day].push(event) } - } + } if(this.push(event, selectedDate)) days[day].push(event) @@ -155,10 +160,12 @@ export class ListBoxService { } - push(event: any, selectedDate: Date) { - return new Date(event.start).getMonth() == selectedDate.getMonth() && - new Date(event.start).getFullYear() == selectedDate.getFullYear() - } + push(event: any, selectedDate: Date) { + + return new Date(event.start).getMonth() == selectedDate.getMonth() && + new Date(event.start).getFullYear() == selectedDate.getFullYear() && + new Date(event.start).getDate() >= selectedDate.getDate() + } encapsulation(eventsList:EventListStore[], profile): CustomCalendarEvent[] { diff --git a/src/app/services/background.service.ts b/src/app/services/background.service.ts index e1670c200..acd6153ec 100644 --- a/src/app/services/background.service.ts +++ b/src/app/services/background.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import { ThemeService } from 'src/app/services/theme.service'; +import { StorageService} from 'src/app/services/storage.service'; @Injectable({ providedIn: 'root' @@ -13,7 +14,8 @@ export class BackgroundService { }[] = [] constructor( - private themeservice: ThemeService + private themeservice: ThemeService, + private storageservice: StorageService ) { } online() { @@ -24,6 +26,7 @@ export class BackgroundService { document.body.style.setProperty(`--color3`, "#d9d9d9"); document.body.style.setProperty(`--color4`, "#d9d9d9ee"); document.body.style.setProperty(`--color5`, "#ececec"); + this.storageservice.store('networkCheckStore','online'); } else { document.body.style.setProperty(`--color`, "#0782C9"); @@ -31,6 +34,7 @@ export class BackgroundService { document.body.style.setProperty(`--color3`, "#0782C9"); document.body.style.setProperty(`--color4`, "#0782c9f0"); document.body.style.setProperty(`--color5`, "#45BAFF"); + this.storageservice.store('networkCheckStore','online'); } this.callBacks.forEach((e) => { @@ -46,6 +50,7 @@ export class BackgroundService { document.body.style.setProperty(`--color3`, "#ffb703"); document.body.style.setProperty(`--color4`, "#ffb703"); document.body.style.setProperty(`--color5`, "#ffb703"); + this.storageservice.store('networkCheckStore','offline'); this.callBacks.forEach((e) => { if (e.type == 'Offline') { e.funx() diff --git a/src/app/services/date.service.ts b/src/app/services/date.service.ts index 2895fea2d..c1c98e440 100644 --- a/src/app/services/date.service.ts +++ b/src/app/services/date.service.ts @@ -7,7 +7,6 @@ export class DateService { constructor() { } - deferenceBetweenDays(start: any, end: any) { const diffTime = Math.abs(end - start); return Math.ceil(diffTime / (1000 * 60 * 60 * 24)); diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index ed264d7ba..c2fd4b9b6 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -346,6 +346,7 @@ export class EventsService { return this.http.put(`${puturl}`, event, options).pipe( catchError(err => { + console.log('Event edit saved offline') this.offlinemanager.storeRequestData('eventEdit', arrayReq); throw new Error(err); }) @@ -481,6 +482,7 @@ export class EventsService { return this.http.delete(`${puturl}`, options).pipe( catchError(err => { + console.log('Event edit saved offline') this.offlinemanager.storeRequestData('eventDelete', arrayReq); throw new Error(err); }) diff --git a/src/app/services/file/custom-image-cache/custom-image-cache-routing.module.ts b/src/app/services/file/custom-image-cache/custom-image-cache-routing.module.ts new file mode 100644 index 000000000..4632ffd0b --- /dev/null +++ b/src/app/services/file/custom-image-cache/custom-image-cache-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { CustomImageCachePage } from './custom-image-cache.page'; + +const routes: Routes = [ + { + path: '', + component: CustomImageCachePage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class CustomImageCachePageRoutingModule {} diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.module.ts b/src/app/services/file/custom-image-cache/custom-image-cache.module.ts new file mode 100644 index 000000000..7f1fa8b50 --- /dev/null +++ b/src/app/services/file/custom-image-cache/custom-image-cache.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { CustomImageCachePageRoutingModule } from './custom-image-cache-routing.module'; + +import { CustomImageCachePage } from './custom-image-cache.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + CustomImageCachePageRoutingModule + ], + exports: [CustomImageCachePage], + declarations: [CustomImageCachePage] +}) +export class CustomImageCachePageModule {} diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.page.html b/src/app/services/file/custom-image-cache/custom-image-cache.page.html new file mode 100644 index 000000000..0f86fae9f --- /dev/null +++ b/src/app/services/file/custom-image-cache/custom-image-cache.page.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.page.scss b/src/app/services/file/custom-image-cache/custom-image-cache.page.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.page.spec.ts b/src/app/services/file/custom-image-cache/custom-image-cache.page.spec.ts new file mode 100644 index 000000000..eb8009136 --- /dev/null +++ b/src/app/services/file/custom-image-cache/custom-image-cache.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { CustomImageCachePage } from './custom-image-cache.page'; + +describe('CustomImageCachePage', () => { + let component: CustomImageCachePage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ CustomImageCachePage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(CustomImageCachePage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/services/file/custom-image-cache/custom-image-cache.page.ts b/src/app/services/file/custom-image-cache/custom-image-cache.page.ts new file mode 100644 index 000000000..e225ba059 --- /dev/null +++ b/src/app/services/file/custom-image-cache/custom-image-cache.page.ts @@ -0,0 +1,76 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { Directory, Filesystem } from '@capacitor/filesystem'; +// import { readFile } from 'fs'; + + + +const CACHE_FOLDER = 'CACHED-IMG' + +@Component({ + selector: 'app-custom-image-cache', + templateUrl: './custom-image-cache.page.html', + styleUrls: ['./custom-image-cache.page.scss'], +}) +export class CustomImageCachePage implements OnInit { + + _src =""; + @Input () spinner = false + + ngOnInit() { + } + constructor() { } + + @Input() + set src(imageUrl: string){ + console.log('SET SOURCE', imageUrl) + + const imageName = imageUrl.split('/').pop() + const fileType = imageName.split('.').pop() + + Filesystem.readFile({ + directory: Directory.Cache, + path: `${CACHE_FOLDER}/${imageName}`}).then(readFile =>{ + console.log('LOCAL FILE: ', readFile) + // set to SRC + this._src = `data:image/${fileType};base64ToFile, ${readFile.data}` + }).catch(async e =>{ + await this.storedImage(imageUrl, imageName) + }) + Filesystem.readFile({ + directory: Directory.Cache, + path: `${CACHE_FOLDER}/${imageName}` + }).then(readFile =>{ + this._src = `data:image/${fileType};base64ToFile, ${readFile.data}` + }) + + } + async storedImage(url, path){ + const response = await fetch(`http://api-cors-proxy-devdactic.herokuapp.com/${url}`) + const blob = await response.blob() + + const base64Data = await this.convertBlobToBase64(blob) as string; + const savedFile = await Filesystem.writeFile({ + path: `${CACHE_FOLDER}/${path}`, + data: base64Data, + directory: Directory.Cache + }) + return savedFile + } + + convertBlobToBase64(blob: Blob){ + return new Promise((resolve, reject) =>{ + const reader = new FileReader; + reader.onerror = reject; + reader.onload = () => { + resolve(reader.result) + } + reader.readAsDataURL(blob) + }) + } + } + + + + + + diff --git a/src/app/services/functions/file.service.ts b/src/app/services/functions/file.service.ts index 040f13324..146f8cb91 100644 --- a/src/app/services/functions/file.service.ts +++ b/src/app/services/functions/file.service.ts @@ -4,18 +4,29 @@ import { FileToBase64Service } from '../file/file-to-base64.service'; import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; import { ChatService } from '../chat.service'; -import { ModalController } from '@ionic/angular'; +import { ModalController, Platform,LoadingController } from '@ionic/angular'; import { SearchPage } from 'src/app/pages/search/search.page'; import { SearchList } from 'src/app/models/search-document'; import { ProcessesService } from '../processes.service'; import { ToastService } from '../toast.service'; import { Camera, CameraResultType, CameraSource, Photo} from '@capacitor/camera'; +import { Filesystem, Directory } from '@capacitor/filesystem'; + +const IMAGE_DIR = 'stored-images'; + +interface LocalFile { + name: string; + path: string; + data: string; +} + @Injectable({ providedIn: 'root' }) export class FileService { + images: LocalFile[] = []; capturedImage:any; capturedImageTitle:any; documents:SearchList[] = []; @@ -23,6 +34,7 @@ export class FileService { files: Set; photos: any[] = []; + idroom: any; constructor( private fileLoaderService: FileLoaderService, @@ -32,6 +44,8 @@ export class FileService { private modalController: ModalController, private processesService: ProcessesService, private toastService: ToastService, + private platform: Platform, + private loadingCtrl: LoadingController ) { } async takePicture() { @@ -93,59 +107,156 @@ export class FileService { }; } + //new method1 + async saveImage(photo: Photo, roomid: any) { + const base64Data = await this.readAsBase64(photo); + + const fileName = new Date().getTime() + '.jpeg'; + const savedFile = await Filesystem.writeFile({ + path: `${IMAGE_DIR}/${fileName}`, + data: base64Data, + directory: Directory.Data + }); + + this.loadFiles(roomid); + } + + //new method 2 + private async readAsBase64(photo: Photo) { + if (this.platform.is('hybrid')) { + const file = await Filesystem.readFile({ + path: photo.path + }); + + return file.data; + } + else { + // Fetch the photo, read as a blob, then convert to base64 format + const response = await fetch(photo.webPath); + const blob = await response.blob(); + + return await this.convertBlobToBase64(blob) as string; + } + } + + //new method 3 + async loadFiles(roomid) { + this.images = []; + + const loading = await this.loadingCtrl.create({ + message: 'Loading data...', + }); + await loading.present(); + + Filesystem.readdir({ + path: IMAGE_DIR, + directory: Directory.Data, + }).then(result => { + console.log('ALL RESULTS', result.files[0]) + let lastphoto = result.files[result.files.length - 1] + this.loadFileData(lastphoto,roomid); + }, + async (err) => { + console.log('ERROR FILE DOSENT EXIST', err) + // Folder does not yet exists! + await Filesystem.mkdir({ + path: IMAGE_DIR, + directory: Directory.Data, + recursive: true + }); + } + ).then(_ => { + loading.dismiss(); + }); + } + + //new method 4 + async loadFileData(fileName: string, roomid: any) { + console.log('ALL PHOTOT FILE', fileName) + // for (let f of fileNames) { + const filePath = `${IMAGE_DIR}/${fileName}`; + + const readFile = await Filesystem.readFile({ + path: filePath, + directory: Directory.Data, + }); + + this.images.push({ + name: fileName, + path: filePath, + data: `data:image/jpeg;base64,${readFile.data}`, + }); + + console.log('ALL IMAGE', this.images) + + this.capturedImage = this.images[0].data + + this.capturedImageTitle = new Date().getTime() + '.jpeg'; + + let body = { + "message": + { + "rid": roomid, + "msg": "", + "attachments": [{ + "title": this.capturedImageTitle, + "title_link_download": false, + "image_url": this.capturedImage, + }] + } + } + console.log('BODY TAKE PICTURE CHAT', body) + const loader = this.toastService.loading(); + this.chatService.sendMessage(body).subscribe(res=> { + console.log(res); + loader.remove(); + },(error) => { + loader.remove(); + this.toastService.badRequest("Não foi possível adicionar a fotografia!"); + }); + } + + + async addCameraPictureToChat(roomId){ - const capturedImage = await Camera.getPhoto({ - quality: 90, - // allowEditing: true, + const image = await Camera.getPhoto({ + quality: 50, + allowEditing: false, resultType: CameraResultType.Uri, - source: CameraSource.Camera - + source: CameraSource.Camera // Camera, Photos or Prompt! }); - const response = await fetch(capturedImage.webPath!); + + if (image) { + await this.saveImage(image,roomId) + } +/* const response = await fetch(capturedImage.webPath!); const blob = await response.blob(); this.photos.unshift({ filepath: "soon...", webviewPath: capturedImage.webPath - }); + }); */ - this.capturedImage = await this.convertBlobToBase64(blob); - this.capturedImageTitle = new Date().getTime() + '.jpeg'; - - let body = { - "message": - { - "rid": roomId, - "msg": "", - "attachments": [{ - "title": this.capturedImageTitle, - "title_link_download": false, - "image_url": this.capturedImage, - }] - } - } - const loader = this.toastService.loading(); - this.chatService.sendMessage(body).subscribe(res=> { - console.log(res); - loader.remove(); - },(error) => { - loader.remove(); - this.toastService.badRequest("Não foi possível adicionar a fotografia!"); - }); + //this.capturedImage = this.capturedImage; + } async addPictureToChatMobile(roomId) { const capturedImage = await Camera.getPhoto({ - quality: 90, + quality: 50, // allowEditing: true, resultType: CameraResultType.Uri, - source: CameraSource.Photos + source: CameraSource.Camera }); - const response = await fetch(capturedImage.webPath!); + + if (capturedImage) { + await this.saveImage(capturedImage,roomId) + } + /* const response = await fetch(capturedImage.webPath!); const blob = await response.blob(); this.photos.unshift({ @@ -177,7 +288,7 @@ export class FileService { },(error) => { //loader.remove(); }); - } + */ } addPictureToChat(roomId) { @@ -193,7 +304,7 @@ export class FileService { input.onchange = async () => { - alert('Onchange AQUI') + //alert('Onchange AQUI') const file = this.fileLoaderService.getFirstFile(input) @@ -218,6 +329,7 @@ export class FileService { } } + console.log('SELECT PICTURE GALLERY', body) console.log(this.capturedImage) this.chatService.sendMessage(body).subscribe(res=> { diff --git a/src/app/services/functions/object.service.spec.ts b/src/app/services/functions/object.service.spec.ts new file mode 100644 index 000000000..ed7a3d76a --- /dev/null +++ b/src/app/services/functions/object.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { ObjectService } from './object.service'; + +describe('ObjectService', () => { + let service: ObjectService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ObjectService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/functions/object.service.ts b/src/app/services/functions/object.service.ts new file mode 100644 index 000000000..9b52713c8 --- /dev/null +++ b/src/app/services/functions/object.service.ts @@ -0,0 +1,25 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class ObjectService { + + constructor() { } + + + deepFind(obj, path) { + var paths = path.split('.') + , current = obj + , i; + + for (i = 0; i < paths.length; ++i) { + if (current[paths[i]] == undefined) { + return undefined; + } else { + current = current[paths[i]]; + } + } + return current; + } +} diff --git a/src/app/services/functions/sort.service.ts b/src/app/services/functions/sort.service.ts index 9d580897b..c248ff958 100644 --- a/src/app/services/functions/sort.service.ts +++ b/src/app/services/functions/sort.service.ts @@ -1,11 +1,12 @@ import { Injectable } from '@angular/core'; +import { ObjectService } from './object.service'; @Injectable({ providedIn: 'root' }) export class SortService { - constructor() { } + constructor(private ObjectService: ObjectService) { } sortArrayISODate(myArray: any) { if(myArray.length > 0){ @@ -14,6 +15,7 @@ export class SortService { }); } } + sortArrayByDate(myArray: any) { console.log(myArray[0].taskStartDate); if(myArray.length > 0){ @@ -22,4 +24,15 @@ export class SortService { }); } } + + sortDate(array = [], path: string) { + + return array.sort( (a,b)=> { + + return new Date(this.ObjectService.deepFind(b, path)).getTime() - + new Date(this.ObjectService.deepFind(a, path)).getTime() + + }) + + } } diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 50dab7589..d05b89b07 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -157,6 +157,12 @@ export class NotificationsService { PushNotifications.addListener('pushNotificationActionPerformed', (notification: ActionPerformed) => { console.log('Push action performed: ' + JSON.stringify(notification)); + /* this.DataArray.push(notification.notification) + console.log("On ReceiveNotification", this.DataArray) + this.storageService.store("Notifications", this.DataArray) + this.eventtrigger.publishSomeData({ + notification: "recive" + }) */ this.notificatinsRoutes(notification) } ); diff --git a/src/app/services/publications.service.ts b/src/app/services/publications.service.ts index 3d14a1344..e381adad9 100644 --- a/src/app/services/publications.service.ts +++ b/src/app/services/publications.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Injectable, OnInit } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { environment } from 'src/environments/environment'; import { AuthService } from '../services/auth.service'; @@ -6,20 +6,27 @@ import { LoginUserRespose } from '../models/user.model'; import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators' import { Publication } from '../models/publication'; +import { getUrl } from 'ionicons/dist/types/components/icon/utils'; +import { ActivatedRoute, Router } from '@angular/router'; @Injectable({ providedIn: 'root' }) -export class PublicationsService { +export class PublicationsService { + + authheader = {}; loggeduser: LoginUserRespose; headers: HttpHeaders; - constructor(private http: HttpClient, user: AuthService) { + constructor(private http: HttpClient, user: AuthService, + private activatedRoute: ActivatedRoute, + private router: Router) { this.loggeduser = user.ValidatedUser; this.headers = new HttpHeaders(); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); + } GetPublicationFolderList(){ @@ -77,6 +84,20 @@ export class PublicationsService { return this.http.delete(`${geturl}`, options); } + GetPublicationsImages(folder:any) { + const geturl = environment.apiURL + 'presidentialActions/'+ folder +'/posts/ids'; + let params = new HttpParams(); + + params = params.set("folderId", folder); + + let options = { + headers: this.headers, + params: params + }; + return this.http.get(`${geturl}`, options) + + } + GetPublications(id:any){ const geturl = environment.apiURL + 'presidentialActions/'+ id +'/posts'; let params = new HttpParams(); @@ -90,19 +111,88 @@ export class PublicationsService { return this.http.get(`${geturl}`, options) } + // this one too,goes to observable as a first api call + GetIdsPublicationsImages(id:any) { + const geturl = environment.apiURL + 'presidentialActions/'+ id +'/posts/ids'; + let params = new HttpParams(); + + params = params.set("folderId", id); + + let options = { + headers: this.headers, + params: params + }; + return this.http.get(`${geturl}`, options) + } + + GetPublicationById( publicationId:any){ const geturl = environment.apiURL + 'presidentialActions/posts/'+ publicationId; let params = new HttpParams(); - /* params = params.set("id", publicationId); */ + params = params.set("id", publicationId); let options = { headers: this.headers, - /* params: params */ + params: params }; return this.http.get(`${geturl}`, options); } +// my own tries + +GetPublicationByIdNext( publicationId:any){ + let geturl = environment.apiURL + 'presidentialActions/'+ publicationId + '/posts/ids'; + let params = new HttpParams(); + + params = params.set("folderId", publicationId); + + let options = { + headers: this.headers, + /* params: params */ + }; + + const imageLoads = !!(+localStorage.getItem('loadedimage')) + if(imageLoads){ + return true + }else{ + const navigation = this.router.getCurrentNavigation() + console.log('nav:', navigation) + + if(navigation){ + geturl = navigation.extractedUrl.toString() + } + + this.router.navigate([URL], {queryParams: {returnto: geturl}}) + + } +} + +GetIdsPublicationNext(id:any){ + let geturl = environment.apiURL + 'presidentialActions/posts/' + id; + let params = new HttpParams(); + + params = params.set("id", id); + + let options = { + headers: this.headers, + params: params + }; + + var search = this.http.get(`${geturl}`, options).subscribe( + res => { + res.this.activatedRoute.snapshot.queryParams.get('returnto') || '/posts' + + } + + ) + + return search + +} + +//my last tries + CreatePublication(folderId:any,body:any){ const geturl = environment.apiURL + 'presidentialActions/'+folderId+'/posts'; let params = new HttpParams(); diff --git a/src/app/services/sqlite.service.ts b/src/app/services/sqlite.service.ts index c7ef44e7a..ce1bd7a58 100644 --- a/src/app/services/sqlite.service.ts +++ b/src/app/services/sqlite.service.ts @@ -207,15 +207,18 @@ export class SqliteService { //updateActions public updateactions(id, data) { - console.log("update action data", data) - this.dbInstance.executeSql(` - UPDATE ${this.actions} SET publications = ? WHERE ProcessId = ${id}`, [data]) - .then(() => { - console.log("action update with Success"); + try { + console.log("update action data", data) + this.dbInstance.executeSql(` + UPDATE ${this.actions} SET publications = ? WHERE ProcessId = ${id}`, [data]) + .then(() => { + console.log("action update with Success"); + + }, (e) => { + console.log(JSON.stringify(e.err)); + }); + } catch(error) {} - }, (e) => { - console.log(JSON.stringify(e.err)); - }); } @@ -512,4 +515,10 @@ export class SqliteService { console.log(" Get events by id error", JSON.stringify(e)); }); } + + deleteEventTable() { + this.dbInstance.executeSql("delete from "+ this.events).then((res) => { + console.log('DELETE EVENT TABLE RESULT ', res) + }); + } } diff --git a/src/app/services/toast.service.ts b/src/app/services/toast.service.ts index db279af79..60fbde25a 100644 --- a/src/app/services/toast.service.ts +++ b/src/app/services/toast.service.ts @@ -24,6 +24,73 @@ export class ToastService { toast.present(); } + + async _successMessage(message?: any, callback?) { + + let notification = document.createElement('div') + notification.className = 'notification' + notification.innerHTML = ` + +
+

+ +

{{ message }}

+

+ +
+ ` + + document.body.append(notification) + notification.querySelector('.text').innerHTML = message || 'Processo efetuado' + setTimeout(()=>{ + if (callback) { + callback() + } + + notification.style.right = "-100%" + + setTimeout(()=>{ + notification.remove() + },1000) + + },6000) + + } + + async _badRequest(message?: string, callback?) { + + let notification = document.createElement('div') + notification.className = 'notification' + notification.innerHTML = ` + +
+

+ +

{{ message }}

+

+ +
+ ` + + notification.style.animationName = 'notification-top' + + document.body.append(notification) + notification.querySelector('.text').innerHTML = message || 'Processo não efetuado' + setTimeout(()=>{ + if (callback) { + callback() + } + + notification.style.right = "-100%" + + setTimeout(()=>{ + notification.remove() + },1000) + + },6000) + + } + async successMessage(message?: any, callback?) { let notification = document.createElement('div') @@ -129,16 +196,30 @@ export class ToastService { loading() : HTMLDivElement { + let loader: HTMLDivElement = document.createElement('div') + + let theme; + + if(document.querySelector('body').className.includes('gov')) { + theme = 'gov' + } else if(document.querySelector('body').className.includes('default')) { + theme = 'blue' + } else if(document.querySelector('body').className.includes('tribunal')) { + theme = 'tribunal' + } else { + theme = 'gov' + } + loader.innerHTML = ` - -
-
- +
+
+ +
-
- ` - + `; + + console.log(document.querySelector('body').classList) document.body.append(loader) loader.addEventListener('click', ()=>{ diff --git a/src/app/services/webnotifications.service.ts b/src/app/services/webnotifications.service.ts index db0818093..f67bdcd3e 100644 --- a/src/app/services/webnotifications.service.ts +++ b/src/app/services/webnotifications.service.ts @@ -24,8 +24,7 @@ export class WebNotificationsService { private animationController: AnimationController, private platform: Platform, private router: Router, - private toastService: ToastService, - private zone: NgZone) { } + private toastService: ToastService) { } webconnection() { diff --git a/src/app/shared/agenda/edit-event/edit-event.page.ts b/src/app/shared/agenda/edit-event/edit-event.page.ts index 4eef38a80..f66e97819 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -142,6 +142,10 @@ export class EditEventPage implements OnInit { } + ngOnChanges(changes: any): void { + // this.loadedEventAttachments = this.loadedEventAttachments.concat(this.postEvent.Attachments) + } + close() { this.closeComponent.emit(); this.setIntervenient.emit([]); @@ -193,6 +197,7 @@ export class EditEventPage implements OnInit { ]), }) + } openInicio() { @@ -252,7 +257,8 @@ export class EditEventPage implements OnInit { this.showLoader = true; - await this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => { + try { + await this.eventsService.editEvent(this.postEvent, 2, 3).toPromise() if(this.initCalendarName != this.postEvent.CalendarName) { let body = { "EventId": this.postEvent.EventId, @@ -265,11 +271,10 @@ export class EditEventPage implements OnInit { } this.showLoader = false; this.toastService.successMessage() - }, - error => { + } catch(error) { this.showLoader = false this.toastService.badRequest() - }); + } this.clearPostEvent.emit(); this.deleteTemporaryData(); @@ -282,7 +287,6 @@ export class EditEventPage implements OnInit { async saveDocument() { - console.log(this.loadedEventAttachments) await this.loadedEventAttachments.forEach( async (e)=>{ @@ -303,10 +307,10 @@ export class EditEventPage implements OnInit { }; await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise(); - this.getAttachments(this.postEvent.EventId); + await this.getAttachments(this.postEvent.EventId); } else if(remove) { - this.attachmentsService.deleteEventAttachmentById(e.Id).subscribe( res=> {}) + await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise() } }) @@ -365,11 +369,9 @@ export class EditEventPage implements OnInit { window['temp.path:/home/agenda/edit-event.component.ts'] = {} } - getAttachments(eventId: string){ - this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{ - this.loadedEventAttachments = res; - console.log('res', res); - }); + async getAttachments(eventId: string){ + const rest: any = this.attachmentsService.getAttachmentsById(eventId).toPromise() + this.loadedEventAttachments = rest; } deleteAttachment(attachmentID: string, index) { diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index bcf7d5dc4..058c0910f 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -409,14 +409,14 @@ export class NewEventPage implements OnInit { this.afterSave(); } - this.toastService.successMessage('Evento criado') + this.toastService._successMessage('Evento criado') }, error => { loader.remove() this.showLoader = false - this.toastService.badRequest('Evento não criado') + this.toastService._badRequest('Evento não criado') }); diff --git a/src/app/shared/agenda/view-event/view-event.page.ts b/src/app/shared/agenda/view-event/view-event.page.ts index cff1408fe..2de4d89da 100644 --- a/src/app/shared/agenda/view-event/view-event.page.ts +++ b/src/app/shared/agenda/view-event/view-event.page.ts @@ -95,6 +95,7 @@ export class ViewEventPage implements OnInit { } loadEvent() { + this.eventsService.getEvent(this.eventId).subscribe(res => { console.log(res); this.loadedEvent = res; diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html index e8ba47bdc..0ebc7fdbb 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -44,7 +44,7 @@ A conversa original mantêm-se como chat individual
-
+
diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 9c9d56edb..cf0ac3345 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -1,5 +1,5 @@ -import { Component, OnChanges, OnInit, Input, SimpleChanges, Output, EventEmitter, ViewChild, ElementRef, AfterViewChecked, AfterViewInit, OnDestroy} from '@angular/core'; -import { ActionSheetController, AnimationController, MenuController, ModalController, PopoverController } from '@ionic/angular'; +import { Component, OnChanges, OnInit, Input, SimpleChanges,ChangeDetectorRef,Output, EventEmitter, ViewChild, ElementRef, AfterViewChecked, AfterViewInit, OnDestroy} from '@angular/core'; +import { ActionSheetController, AnimationController, IonSlides, MenuController, ModalController, PopoverController } from '@ionic/angular'; import { AlertService } from 'src/app/services/alert.service'; import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; @@ -19,6 +19,7 @@ import { ProcessesService } from 'src/app/services/processes.service'; import { FileService } from 'src/app/services/functions/file.service'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ThemeService } from 'src/app/services/theme.service' +import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page'; /* import * as pdfjsLib from 'pdfjs-dist'; @@ -86,7 +87,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe private fileToBase64Service: FileToBase64Service, private processesService: ProcessesService, private fileService: FileService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private changeDetectorRef: ChangeDetectorRef ) { this.loggedUserChat = authService.ValidatedUserChat['data']; this.isGroupCreated = true; @@ -767,7 +769,61 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } } + + sliderOpts = { + zoom: false, + slidesPerView: 1.5, + spaceBetween: 20, + centeredSlides: true + }; + zoomActive = false; +zoomScale = 1; + +sliderZoomOpts = { + allowSlidePrev: false, + allowSlideNext: false, + zoom: { + maxRatio: 5 + }, + on: { + zoomChange: (scale, imageEl, slideEl) => { + this.zoomActive = true; + this.zoomScale = scale/5; + this.changeDetectorRef.detectChanges(); + } + } +} + +async touchEnd(zoomslides: IonSlides, card) { + // Zoom back to normal + const slider = await zoomslides.getSwiper(); + const zoom = slider.zoom; + zoom.out(); + + // Card back to normal + card.el.style['z-index'] = 9; + + this.zoomActive = false; + this.changeDetectorRef.detectChanges(); +} + +touchStart(card) { + // Make card appear above backdrop + card.el.style['z-index'] = 11; +} + async openPreview(img) { + const modal = await this.modalController.create({ + component: PreviewCameraPage, + cssClass: 'transparent-modal', + componentProps: { + image: img.attachments[0].image_url, + username: img.u.username, + _updatedAt: img._updatedAt + } + }); + modal.present(); + } } diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index 53f592363..8f1fe149b 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -37,7 +37,7 @@
-
+
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 8f11f9533..b3eec13c2 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -1,5 +1,5 @@ -import { AfterViewChecked, AfterViewInit, Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; -import { AnimationController, GestureController, ModalController, PopoverController } from '@ionic/angular'; +import { AfterViewChecked, AfterViewInit, Component, ElementRef,ChangeDetectorRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; +import { AnimationController, GestureController, IonSlides, ModalController, PopoverController } from '@ionic/angular'; import { AlertService } from 'src/app/services/alert.service'; import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; @@ -16,6 +16,7 @@ import { FileService } from 'src/app/services/functions/file.service'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ThemeService } from 'src/app/services/theme.service' +import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page'; @Component({ selector: 'app-messages', @@ -71,7 +72,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy private fileService: FileService, private gestureController: GestureController, private http:HttpClient, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private changeDetectorRef: ChangeDetectorRef ) { this.loggedUser = authService.ValidatedUserChat['data']; @@ -553,7 +555,61 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy this.serverLongPull(); }); + }sliderOpts = { + zoom: false, + slidesPerView: 1.5, + spaceBetween: 20, + centeredSlides: true + }; + zoomActive = false; +zoomScale = 1; + +sliderZoomOpts = { + allowSlidePrev: false, + allowSlideNext: false, + zoom: { + maxRatio: 5 + }, + on: { + zoomChange: (scale, imageEl, slideEl) => { + this.zoomActive = true; + this.zoomScale = scale/5; + this.changeDetectorRef.detectChanges(); + } } - +} + +async touchEnd(zoomslides: IonSlides, card) { + // Zoom back to normal + const slider = await zoomslides.getSwiper(); + const zoom = slider.zoom; + zoom.out(); + + // Card back to normal + card.el.style['z-index'] = 9; + + this.zoomActive = false; + this.changeDetectorRef.detectChanges(); +} + +touchStart(card) { + // Make card appear above backdrop + card.el.style['z-index'] = 11; } + async openPreview(msg) { + const modal = await this.modalController.create({ + component: PreviewCameraPage, + cssClass: 'transparent-modal', + componentProps: { + image: msg.attachments[0].image_url, + username: msg.u.username, + _updatedAt: msg._updatedAt + } + }); + modal.present(); + } +} + + + diff --git a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts index 5ccb1343c..e41d4bd93 100644 --- a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts +++ b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts @@ -66,6 +66,8 @@ export class AllProcessesPage implements OnInit { let allProcessesList = await this.processesService.GetTasksList("", false).toPromise(); //console.log(allProcessesList); + allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento') + this.skeletonLoader = true; this.allProcessesList = []; @@ -73,14 +75,11 @@ export class AllProcessesPage implements OnInit { allProcessesList.forEach(element => { let date = new Date(element.taskStartDate); date.setMonth(date.getMonth() + 1); - let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); - let task = { "SerialNumber": element.serialNumber, "Folio": element.workflowInstanceDataFields.Subject, "Senders": element.workflowInstanceDataFields.Sender, - //"CreateDate": taskDate, "CreateDate": new Date(element.taskStartDate), "DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "Remetente": element.workflowInstanceDataFields.Remetente, @@ -93,10 +92,11 @@ export class AllProcessesPage implements OnInit { "Agenda": element.workflowInstanceDataFields.Agenda, "customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent), } + this.allProcessesList.push(task); this.allProcessesList = removeDuplicate(this.allProcessesList) - //this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse(); - this.allProcessesList = this.sortService.sortArrayISODate(this.allProcessesList).reverse(); + + this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate'); }); diff --git a/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts b/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts index 1da06551a..c5a97201e 100644 --- a/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts +++ b/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts @@ -74,7 +74,7 @@ constructor ( despachoList.push(task); }); - despachoList = this.sortService.sortArrayISODate(despachoList).reverse() + despachoList = this.sortService.sortDate(despachoList, 'CreateDate') this.despachosprstore.reset(despachoList); this.skeletonLoader = false; diff --git a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts index 2292ba298..047ba3e66 100644 --- a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts +++ b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts @@ -31,7 +31,7 @@ export class DiplomasAssinarPage implements OnInit { private router: Router, private sortService: SortService, public ThemeService: ThemeService - ) { } + ) {} ngOnInit() { @@ -56,30 +56,30 @@ export class DiplomasAssinarPage implements OnInit { doRefresh() { setTimeout(() => { this.LoadList(); - //event.target.complete(); }, 1000); } async LoadList() { + + this.skeletonLoader = true let diplomas = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise(); this.diplomasList = new Array(); this.skeletonLoader = false - console.log(diplomas); let diplomasAssinar = diplomas.reverse().filter(data => data.activityInstanceName == "Assinar Diploma"); - console.log(diplomasAssinar); diplomasAssinar.forEach(element => { - let task: customTask = this.customTaskPipe.transform(element) this.diplomasList.push(task); - this.deplomasStore.resetDiplomasList(this.sortService.sortArrayByDate(this.diplomasList)); - }); + this.diplomasList = this.sortService.sortDate(this.diplomasList, 'CreateDate') + + + this.deplomasStore.resetDiplomasList(this.diplomasList); } } diff --git a/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts b/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts index 53a5fdeb1..452d7a033 100644 --- a/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts +++ b/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts @@ -8,6 +8,7 @@ import { removeDuplicate } from 'src/plugin/removeDuplicate.js' import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; import { DeplomasStore } from 'src/app/store/deplomas.service'; import { ThemeService } from 'src/app/services/theme.service' +import { SortService } from 'src/app/services/functions/sort.service'; @Component({ selector: 'app-diplomas', @@ -34,10 +35,9 @@ constructor( private alertService: AlertService, private router: Router, private activatedRoute: ActivatedRoute, - public ThemeService: ThemeService - ) { - - } + public ThemeService: ThemeService, + private sortService: SortService, + ) {} ngOnInit() { // update list @@ -82,7 +82,7 @@ constructor( diplomasList.push(task); }); - this.diplomasList = this.sortArrayISODate(diplomasList).reverse(); + this.diplomasList = this.sortService.sortDate(diplomasList, 'CreateDate') this.deplomasStore.resetDiplomasList(this.diplomasList) let diplomasAssinadoList = [] @@ -93,7 +93,7 @@ constructor( diplomasAssinadoList.push(task); }); - this.diplomasAssinadoList = this.sortArrayISODate(diplomasAssinadoList).reverse(); + this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'CreateDate') this.deplomasStore.resetDiplomasAssinadoList(this.diplomasAssinadoList) this.showLoader = false; @@ -120,12 +120,6 @@ constructor( } } - sortArrayISODate(myArray: any) { - return myArray.sort(function(a, b) { - return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0); - }); - } - async refreshing() { setTimeout(() => { this.LoadList(); diff --git a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts index e04bf0a86..93a20876d 100644 --- a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts +++ b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts @@ -69,13 +69,14 @@ export class EventsToApprovePage implements OnInit { this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal); console.log(this.sortService.sortArrayByDate(this.eventsMDGPRList)); - this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse()); + this.eventaprovacaostore.resetmd(this.sortService.sortDate(this.eventsMDGPRList, 'CreateDate')); } else if(this.segment == 'PR'){ let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise(); let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise(); this.eventsPRList = prEventsOficial.concat(prEventsPessoal); - this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse()); + + this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate')); } this.showLoader = false; } diff --git a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts index d89169481..fc6b10e54 100644 --- a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts +++ b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts @@ -10,6 +10,7 @@ import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service'; import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe'; import { ThemeService } from 'src/app/services/theme.service' +import { SortService } from 'src/app/services/functions/sort.service'; @Component({ @@ -35,7 +36,8 @@ export class ExpedientesPrPage implements OnInit { private alertService: AlertService, private authService: AuthService, private router: Router, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { this.loggeduser = authService.ValidatedUser; } @@ -75,7 +77,8 @@ export class ExpedientesPrPage implements OnInit { let task = this.expedienteTaskPipe.transform(element); this.taskslist.push(task); }); - console.log(this.taskslist); + + this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate') this.expedienteGdStore.reset(this.taskslist); this.skeletonLoader = false; diff --git a/src/app/shared/gabinete-digital/expedients/expedients.page.ts b/src/app/shared/gabinete-digital/expedients/expedients.page.ts index 2f0237c92..84d2baad5 100644 --- a/src/app/shared/gabinete-digital/expedients/expedients.page.ts +++ b/src/app/shared/gabinete-digital/expedients/expedients.page.ts @@ -5,6 +5,7 @@ import { AlertService } from 'src/app/services/alert.service'; import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service'; import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe'; import { ThemeService } from 'src/app/services/theme.service' +import { SortService } from 'src/app/services/functions/sort.service'; @Component({ selector: 'app-expedients', @@ -27,7 +28,8 @@ export class ExpedientsPage implements OnInit { private processes:ProcessesService, private alertService: AlertService, private router: Router, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private sortService: SortService, ) { this.profile = 'mdgpr'; @@ -67,13 +69,14 @@ export class ExpedientsPage implements OnInit { this.taskslist = []; this.skeletonLoader = false - let res = result.reverse().filter(data => data.workflowInstanceDataFields.Status == "Active"); + let res = result.filter(data => data.workflowInstanceDataFields.Status == "Active"); res.forEach(element => { let task = this.expedienteTaskPipe.transform(element) this.taskslist.push(task); }); + this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate') this.expedientegbstore.reset(this.taskslist); }); } diff --git a/src/app/shared/gabinete-digital/pedidos/pedidos.page.html b/src/app/shared/gabinete-digital/pedidos/pedidos.page.html index 898c7c71c..d552bb84a 100644 --- a/src/app/shared/gabinete-digital/pedidos/pedidos.page.html +++ b/src/app/shared/gabinete-digital/pedidos/pedidos.page.html @@ -110,7 +110,7 @@
Lista vazia @@ -119,7 +119,7 @@
Lista vazia diff --git a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts index 785392167..409e85bf9 100644 --- a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts +++ b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts @@ -50,7 +50,7 @@ export class PedidosPage implements OnInit { public ThemeService: ThemeService ) { this.profile = 'mdgpr'; - } + } ngOnInit() { @@ -96,7 +96,8 @@ export class PedidosPage implements OnInit { let task: customTask = this.customTaskPipe.transform(element); this.parecerList.push(task); }); - this.pedidosstore.resetparecer(this.sortService.sortArrayISODate(this.parecerList)); + + this.pedidosstore.resetparecer(this.sortService.sortDate(this.parecerList, 'CreateDate')); } else if(this.segment == 'deferimento') { @@ -112,7 +113,9 @@ export class PedidosPage implements OnInit { let task: customTask = this.customTaskPipe.transform(element); this.deferimentoList.push(task); }); - this.pedidosstore.resetdeferimento(this.sortService.sortArrayISODate(this.deferimentoList)); + + + this.pedidosstore.resetdeferimento(this.sortService.sortDate(this.deferimentoList, 'CreateDate')); }); } diff --git a/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts b/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts index cc20a4a26..c74f98171 100644 --- a/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts +++ b/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts @@ -62,7 +62,7 @@ export class PendentesPage implements OnInit { }); pendentesList = removeDuplicate( pendentesList) - pendentesList = this.sortService.sortArrayISODate(pendentesList); + pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate') this.pendentesstore.reset(pendentesList); this.skeletonLoader = false; diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index ad92feb8b..34d0f448b 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -1,6 +1,6 @@
-
+