diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 884c7e09..f1a5a3f8 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -15,7 +15,8 @@ - + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt index b8a87c8c..35ce314d 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt @@ -1,11 +1,36 @@ package com.cloud.diplomaticquarterapp -import androidx.annotation.NonNull; - import io.flutter.embedding.android.FlutterFragmentActivity - import io.flutter.embedding.engine.FlutterEngine - import io.flutter.plugins.GeneratedPluginRegistrant +import android.content.ContentResolver +import android.content.Context +import android.media.RingtoneManager +import io.flutter.embedding.android.FlutterActivity +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugin.common.MethodCall +import io.flutter.plugin.common.MethodChannel +import io.flutter.plugins.GeneratedPluginRegistrant -class MainActivity: FlutterFragmentActivity() { - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } +class MainActivity : FlutterActivity() { + override fun configureFlutterEngine(flutterEngine: FlutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine) + MethodChannel(flutterEngine.dartExecutor, "crossingthestreams.io/resourceResolver").setMethodCallHandler { call: MethodCall, result: MethodChannel.Result -> + if ("drawableToUri" == call.method) { + val resourceId = this@MainActivity.resources.getIdentifier(call.arguments as String, "drawable", this@MainActivity.packageName) + result.success(resourceToUriString(this@MainActivity.applicationContext, resourceId)) + } + if ("getAlarmUri" == call.method) { + result.success(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM).toString()) + } + } + } + + companion object { + private fun resourceToUriString(context: Context, resId: Int): String { + return (ContentResolver.SCHEME_ANDROID_RESOURCE + + "://" + + context.resources.getResourcePackageName(resId) + + "/" + + context.resources.getResourceTypeName(resId) + + "/" + + context.resources.getResourceEntryName(resId)) + } + } } \ No newline at end of file diff --git a/android/app/src/main/res/drawable/app_icon.png b/android/app/src/main/res/drawable/app_icon.png new file mode 100644 index 00000000..c4cc798d Binary files /dev/null and b/android/app/src/main/res/drawable/app_icon.png differ diff --git a/android/app/src/main/res/drawable/food.png b/android/app/src/main/res/drawable/food.png new file mode 100644 index 00000000..41b394d3 Binary files /dev/null and b/android/app/src/main/res/drawable/food.png differ diff --git a/android/app/src/main/res/drawable/me.png b/android/app/src/main/res/drawable/me.png new file mode 100644 index 00000000..ba75bc55 Binary files /dev/null and b/android/app/src/main/res/drawable/me.png differ diff --git a/android/app/src/main/res/drawable/sample_large_icon.png b/android/app/src/main/res/drawable/sample_large_icon.png new file mode 100644 index 00000000..f354ca23 Binary files /dev/null and b/android/app/src/main/res/drawable/sample_large_icon.png differ diff --git a/android/app/src/main/res/drawable/secondary_icon.png b/android/app/src/main/res/drawable/secondary_icon.png new file mode 100644 index 00000000..9de9ff41 Binary files /dev/null and b/android/app/src/main/res/drawable/secondary_icon.png differ diff --git a/android/app/src/main/res/raw/keep.xml b/android/app/src/main/res/raw/keep.xml new file mode 100644 index 00000000..944a7ace --- /dev/null +++ b/android/app/src/main/res/raw/keep.xml @@ -0,0 +1,3 @@ + + \ No newline at end of file diff --git a/android/app/src/main/res/raw/slow_spring_board.mp3 b/android/app/src/main/res/raw/slow_spring_board.mp3 new file mode 100644 index 00000000..60dbf979 Binary files /dev/null and b/android/app/src/main/res/raw/slow_spring_board.mp3 differ diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 5ba52820..00000000 --- a/ios/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,618 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 5A016D0DD1095D385566337C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AC606583E610E227F8186476 /* Pods_Runner.framework */; }; - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 9705A1C41CF9048500538489 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 09DDD2020D673759BD0E86B8 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A8949DBAE70E5B302D91F1DB /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - AC606583E610E227F8186476 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E2D9C922B5D0172FE487333D /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5A016D0DD1095D385566337C /* Pods_Runner.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0A1F078D9C068A8B18DE1EDB /* Pods */ = { - isa = PBXGroup; - children = ( - A8949DBAE70E5B302D91F1DB /* Pods-Runner.debug.xcconfig */, - E2D9C922B5D0172FE487333D /* Pods-Runner.release.xcconfig */, - 09DDD2020D673759BD0E86B8 /* Pods-Runner.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; - 44EDA189DE1BB86E3A41BD4A /* Frameworks */ = { - isa = PBXGroup; - children = ( - AC606583E610E227F8186476 /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 9740EEB11CF90186004384FC /* Flutter */ = { - isa = PBXGroup; - children = ( - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 9740EEB31CF90195004384FC /* Generated.xcconfig */, - ); - name = Flutter; - sourceTree = ""; - }; - 97C146E51CF9000F007C117D = { - isa = PBXGroup; - children = ( - 9740EEB11CF90186004384FC /* Flutter */, - 97C146F01CF9000F007C117D /* Runner */, - 97C146EF1CF9000F007C117D /* Products */, - 0A1F078D9C068A8B18DE1EDB /* Pods */, - 44EDA189DE1BB86E3A41BD4A /* Frameworks */, - ); - sourceTree = ""; - }; - 97C146EF1CF9000F007C117D /* Products */ = { - isa = PBXGroup; - children = ( - 97C146EE1CF9000F007C117D /* Runner.app */, - ); - name = Products; - sourceTree = ""; - }; - 97C146F01CF9000F007C117D /* Runner */ = { - isa = PBXGroup; - children = ( - 97C146FA1CF9000F007C117D /* Main.storyboard */, - 97C146FD1CF9000F007C117D /* Assets.xcassets */, - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, - 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, - ); - path = Runner; - sourceTree = ""; - }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 97C146ED1CF9000F007C117D /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - B4860726BBF5BF6213BBC91C /* [CP] Check Pods Manifest.lock */, - 9740EEB61CF901F6004384FC /* Run Script */, - 97C146EA1CF9000F007C117D /* Sources */, - 97C146EB1CF9000F007C117D /* Frameworks */, - 97C146EC1CF9000F007C117D /* Resources */, - 9705A1C41CF9048500538489 /* Embed Frameworks */, - 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 72E9699567A7106FD141B9B3 /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Runner; - productName = Runner; - productReference = 97C146EE1CF9000F007C117D /* Runner.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 97C146E61CF9000F007C117D /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1020; - ORGANIZATIONNAME = ""; - TargetAttributes = { - 97C146ED1CF9000F007C117D = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 1100; - }; - }; - }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 97C146E51CF9000F007C117D; - productRefGroup = 97C146EF1CF9000F007C117D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 97C146ED1CF9000F007C117D /* Runner */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 97C146EC1CF9000F007C117D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; - }; - 72E9699567A7106FD141B9B3 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../Flutter/Flutter.framework", - "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", - "${BUILT_PRODUCTS_DIR}/MTBBarcodeScanner/MTBBarcodeScanner.framework", - "${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework", - "${BUILT_PRODUCTS_DIR}/Protobuf/protobuf.framework", - "${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework", - "${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework", - "${BUILT_PRODUCTS_DIR}/TOCropViewController/TOCropViewController.framework", - "${BUILT_PRODUCTS_DIR}/barcode_scan/barcode_scan.framework", - "${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework", - "${BUILT_PRODUCTS_DIR}/device_info/device_info.framework", - "${BUILT_PRODUCTS_DIR}/flutter_flexible_toast/flutter_flexible_toast.framework", - "${BUILT_PRODUCTS_DIR}/flutter_inappwebview/flutter_inappwebview.framework", - "${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework", - "${BUILT_PRODUCTS_DIR}/flutter_plugin_android_lifecycle/flutter_plugin_android_lifecycle.framework", - "${BUILT_PRODUCTS_DIR}/hexcolor/hexcolor.framework", - "${BUILT_PRODUCTS_DIR}/image_cropper/image_cropper.framework", - "${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework", - "${BUILT_PRODUCTS_DIR}/local_auth/local_auth.framework", - "${BUILT_PRODUCTS_DIR}/manage_calendar_events/manage_calendar_events.framework", - "${BUILT_PRODUCTS_DIR}/map_launcher/map_launcher.framework", - "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", - "${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", - "${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MTBBarcodeScanner.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/protobuf.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TOCropViewController.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/barcode_scan.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_flexible_toast.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_plugin_android_lifecycle.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hexcolor.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_cropper.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/local_auth.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/manage_calendar_events.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/map_launcher.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; - B4860726BBF5BF6213BBC91C /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 97C146EA1CF9000F007C117D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 97C146FA1CF9000F007C117D /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C146FB1CF9000F007C117D /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C147001CF9000F007C117D /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 249021D3217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - 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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "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 = gnu99; - 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 = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Profile; - }; - 249021D4217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.cloud.diplomaticquarterapp; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Profile; - }; - 97C147031CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - 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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - 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 = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 97C147041CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - 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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "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 = gnu99; - 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 = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 97C147061CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.cloud.diplomaticquarterapp; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 97C147071CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.cloud.diplomaticquarterapp; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147031CF9000F007C117D /* Debug */, - 97C147041CF9000F007C117D /* Release */, - 249021D3217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147061CF9000F007C117D /* Debug */, - 97C147071CF9000F007C117D /* Release */, - 249021D4217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 97C146E61CF9000F007C117D /* Project object */; -} diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1d526a16..00000000 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index f9b0d7c5..00000000 --- a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PreviewsEnabled - - - diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index a28140cf..00000000 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 21a3cc14..00000000 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index f9b0d7c5..00000000 --- a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PreviewsEnabled - - - diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift deleted file mode 100644 index 70693e4a..00000000 --- a/ios/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import UIKit -import Flutter - -@UIApplicationMain -@objc class AppDelegate: FlutterAppDelegate { - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } -} diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 8f1009c3..792eb95e 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -22,6 +22,8 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS + NSCalendarsUsageDescription + We Need to access the calender to add reminder for you UILaunchStoryboardName LaunchScreen UIMainStoryboardFile diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h deleted file mode 100644 index 308a2a56..00000000 --- a/ios/Runner/Runner-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import "GeneratedPluginRegistrant.h" diff --git a/lib/config/config.dart b/lib/config/config.dart index ca902b45..698ff8df 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -218,6 +218,9 @@ const GET_WEIGHT_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_GetWeightMe const ADD_WEIGHT_PRESSURE_RESULT='Services/Patients.svc/REST/Patient_AddWeightMeasurementResult'; +const ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID='Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID'; + + const TIMER_MIN = 10; diff --git a/lib/core/model/active_medications/ActivePrescriptionReport.dart b/lib/core/model/active_medications/ActivePrescriptionReport.dart new file mode 100644 index 00000000..866cb728 --- /dev/null +++ b/lib/core/model/active_medications/ActivePrescriptionReport.dart @@ -0,0 +1,146 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +class ActivePrescriptionReport { + dynamic address; + int appointmentNo; + dynamic clinic; + dynamic companyName; + int days; + dynamic doctorName; + int doseDailyQuantity; + String frequency; + int frequencyNumber; + List image; + String imageExtension; + dynamic imageSRCUrl; + String imageString; + dynamic imageThumbUrl; + dynamic isCovered; + String itemDescription; + int itemID; + DateTime orderDate; + int patientID; + dynamic patientName; + dynamic phoneOffice1; + dynamic prescriptionQR; + int prescriptionTimes; + dynamic productImage; + String productImageBase64; + String productImageString; + int projectID; + dynamic projectName; + dynamic remarks; + String route; + String sKU; + int scaleOffset; + DateTime startDate; + + ActivePrescriptionReport( + {this.address, + this.appointmentNo, + this.clinic, + this.companyName, + this.days, + this.doctorName, + this.doseDailyQuantity, + this.frequency, + this.frequencyNumber, + this.image, + this.imageExtension, + this.imageSRCUrl, + this.imageString, + this.imageThumbUrl, + this.isCovered, + this.itemDescription, + this.itemID, + this.orderDate, + this.patientID, + this.patientName, + this.phoneOffice1, + this.prescriptionQR, + this.prescriptionTimes, + this.productImage, + this.productImageBase64, + this.productImageString, + this.projectID, + this.projectName, + this.remarks, + this.route, + this.sKU, + this.scaleOffset, + this.startDate}); + + ActivePrescriptionReport.fromJson(Map json) { + address = json['Address']; + appointmentNo = json['AppointmentNo']; + clinic = json['Clinic']; + companyName = json['CompanyName']; + days = json['Days']; + doctorName = json['DoctorName']; + doseDailyQuantity = json['DoseDailyQuantity']; + frequency = json['Frequency']; + frequencyNumber = json['FrequencyNumber']; + image = json['Image'].cast(); + imageExtension = json['ImageExtension']; + imageSRCUrl = json['ImageSRCUrl']; + imageString = json['ImageString']; + imageThumbUrl = json['ImageThumbUrl']; + isCovered = json['IsCovered']; + itemDescription = json['ItemDescription']; + itemID = json['ItemID']; + orderDate = DateUtil.convertStringToDate(json['OrderDate']); + patientID = json['PatientID']; + patientName = json['PatientName']; + phoneOffice1 = json['PhoneOffice1']; + prescriptionQR = json['PrescriptionQR']; + prescriptionTimes = json['PrescriptionTimes']; + productImage = json['ProductImage']; + productImageBase64 = json['ProductImageBase64']; + productImageString = json['ProductImageString']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + remarks = json['Remarks']; + route = json['Route']; + sKU = json['SKU']; + scaleOffset = json['ScaleOffset']; + startDate = DateUtil.convertStringToDate(json['StartDate']); + } + + Map toJson() { + final Map data = new Map(); + data['Address'] = this.address; + data['AppointmentNo'] = this.appointmentNo; + data['Clinic'] = this.clinic; + data['CompanyName'] = this.companyName; + data['Days'] = this.days; + data['DoctorName'] = this.doctorName; + data['DoseDailyQuantity'] = this.doseDailyQuantity; + data['Frequency'] = this.frequency; + data['FrequencyNumber'] = this.frequencyNumber; + data['Image'] = this.image; + data['ImageExtension'] = this.imageExtension; + data['ImageSRCUrl'] = this.imageSRCUrl; + data['ImageString'] = this.imageString; + data['ImageThumbUrl'] = this.imageThumbUrl; + data['IsCovered'] = this.isCovered; + data['ItemDescription'] = this.itemDescription; + data['ItemID'] = this.itemID; + data['OrderDate'] = this.orderDate; + data['PatientID'] = this.patientID; + data['PatientName'] = this.patientName; + data['PhoneOffice1'] = this.phoneOffice1; + data['PrescriptionQR'] = this.prescriptionQR; + data['PrescriptionTimes'] = this.prescriptionTimes; + data['ProductImage'] = this.productImage; + data['ProductImageBase64'] = this.productImageBase64; + data['ProductImageString'] = this.productImageString; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['Remarks'] = this.remarks; + data['Route'] = this.route; + data['SKU'] = this.sKU; + data['ScaleOffset'] = this.scaleOffset; + data['StartDate'] = this.startDate; + return data; + } +} diff --git a/lib/core/service/medical/ActiveMedicationsService.dart b/lib/core/service/medical/ActiveMedicationsService.dart new file mode 100644 index 00000000..070b7e5f --- /dev/null +++ b/lib/core/service/medical/ActiveMedicationsService.dart @@ -0,0 +1,27 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/active_medications/ActivePrescriptionReport.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class ActiveMedicationsService extends BaseService{ + + List activePrescriptionReport = List(); + + getActiveMedication() async { + hasError = false; + super.error = ""; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID, + onSuccess: (response, statusCode) async { + activePrescriptionReport.clear(); + response['List_ActiveGetPrescriptionReportByPatientID'].forEach((appoitment) { + activePrescriptionReport + .add(ActivePrescriptionReport.fromJson(appoitment)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + +} \ No newline at end of file diff --git a/lib/core/viewModels/medical/ActiveMedicationsViewModel.dart b/lib/core/viewModels/medical/ActiveMedicationsViewModel.dart new file mode 100644 index 00000000..ee4f37c5 --- /dev/null +++ b/lib/core/viewModels/medical/ActiveMedicationsViewModel.dart @@ -0,0 +1,28 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/active_medications/ActivePrescriptionReport.dart'; +import 'package:diplomaticquarterapp/core/service/medical/ActiveMedicationsService.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +class ActiveMedicationsViewModel extends BaseViewModel { + ActiveMedicationsService _activeMedicationsService = + locator(); + + List get activePrescriptionReport => + _activeMedicationsService.activePrescriptionReport; + + getActiveMedication() async { + setState(ViewState.Busy); + await _activeMedicationsService.getActiveMedication(); + if (_activeMedicationsService.hasError) { + error = _activeMedicationsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + + + +} diff --git a/lib/locator.dart b/lib/locator.dart index 4c5a1df3..79e92a63 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -9,6 +9,7 @@ import 'core/service/er/am_service.dart'; import 'core/service/er/er_service.dart'; import 'core/service/feedback/feedback_service.dart'; import 'core/service/hospital_service.dart'; +import 'core/service/medical/ActiveMedicationsService.dart'; import 'core/service/medical/BloodPressureService.dart'; import 'core/service/medical/BloodSugarService.dart'; import 'core/service/medical/EyeService.dart'; @@ -28,6 +29,7 @@ import 'core/viewModels/er/near_hospital_view_model.dart'; import 'core/viewModels/feedback/feedback_view_model.dart'; import 'core/service/medical/reports_service.dart'; import 'core/viewModels/hospital_view_model.dart'; +import 'core/viewModels/medical/ActiveMedicationsViewModel.dart'; import 'core/viewModels/medical/EyeViewModel.dart'; import 'core/viewModels/medical/blood_pressure_view_model.dart'; import 'core/viewModels/medical/labs_view_model.dart'; @@ -80,6 +82,7 @@ void setupLocator() { locator.registerLazySingleton(() => BloodPressureService()); locator.registerLazySingleton(() => WeightService()); locator.registerLazySingleton(() => EyeService()); + locator.registerLazySingleton(() => ActiveMedicationsService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -106,5 +109,6 @@ void setupLocator() { locator.registerFactory(() => BloodPressureViewMode()); locator.registerFactory(() => WeightPressureViewMode()); locator.registerFactory(() => EyeViewModel()); + locator.registerFactory(() => ActiveMedicationsViewModel()); } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index d892be83..9cd88cd9 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,4 +1,5 @@ import 'dart:io'; +import 'dart:typed_data'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -13,6 +14,8 @@ import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; import 'package:diplomaticquarterapp/pages/medical/my_admissions_page.dart'; import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; +import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; @@ -21,12 +24,17 @@ import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; +import 'package:rxdart/rxdart.dart'; import 'home_page.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; + + + class LandingPage extends StatefulWidget { static bool isOpenCallPage = false; @@ -43,6 +51,16 @@ class _LandingPageState extends State with WidgetsBindingObserver { final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); final authService = new AuthProvider(); + void _requestIOSPermissions() { + flutterLocalNotificationsPlugin + .resolvePlatformSpecificImplementation< + IOSFlutterLocalNotificationsPlugin>() + ?.requestPermissions( + alert: true, + badge: true, + sound: true, + ); + } bool isPageNavigated = false; _changeCurrentTab(int tab) { @@ -106,6 +124,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { setState(() { AppGlobal.context = context; }); + _requestIOSPermissions(); pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); @@ -245,7 +264,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { ); } - showDialog(String message) { + + + showDialogs(String message) { ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: message, @@ -263,10 +284,55 @@ class _LandingPageState extends State with WidgetsBindingObserver { Permission.camera, Permission.photos, Permission.notification, - Permission.accessMediaLocation + Permission.accessMediaLocation, + Permission.calendar, ].request(); + + var permissionsGranted = await deviceCalendarPlugin.hasPermissions(); + if (permissionsGranted.isSuccess && !permissionsGranted.data) { + permissionsGranted = await deviceCalendarPlugin.requestPermissions(); + if (!permissionsGranted.isSuccess || !permissionsGranted.data) { + return; + } + } + } + Future _scheduleNotification() async { + var scheduledNotificationDateTime = + DateTime.now().add(Duration(seconds: 5)); + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; + + var androidPlatformChannelSpecifics = AndroidNotificationDetails( + 'your other channel id', + 'your other channel name', + 'your other channel description', + // icon: 'secondary_icon', + sound: RawResourceAndroidNotificationSound('slow_spring_board'), + largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'), + vibrationPattern: vibrationPattern, + enableLights: true, + color: const Color.fromARGB(255, 255, 0, 0), + ledColor: const Color.fromARGB(255, 255, 0, 0), + ledOnMs: 1000, + ledOffMs: 500); + var iOSPlatformChannelSpecifics = + IOSNotificationDetails(sound: 'slow_spring_board.aiff'); + var platformChannelSpecifics = NotificationDetails( + androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.schedule( + 0, + 'scheduled title', + 'scheduled body', + scheduledNotificationDateTime, + platformChannelSpecifics); + } + + @override Widget build(BuildContext context) { //final searchValue = Provider.of(context); diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 7510987c..c1f04a71 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -131,6 +131,7 @@ class _Login extends State { } void validateForm() { + //TODO fix login if (util.validateIDBox(nationalIDorFile.text, loginType) == true && mobileNo.length >= 9 && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { @@ -139,7 +140,7 @@ class _Login extends State { }); } else { setState(() { - isButtonDisabled = true; + isButtonDisabled = false; }); } } diff --git a/lib/pages/medical/active_medications/ActiveMedicationsPage.dart b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart new file mode 100644 index 00000000..3409c3db --- /dev/null +++ b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart @@ -0,0 +1,129 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/ActiveMedicationsViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/active_medications/reminder_page.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ActiveMedicationsPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getActiveMedication(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: 'Active Medications', + isShowAppBar: true, + body: Container( + child: ListView.builder( + itemCount: model.activePrescriptionReport.length, + itemBuilder: (context, index) => Container( + padding: EdgeInsets.all(10), + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), color: Colors.white), + child: Row( + children: [ + Image.memory( + Utils.dataFromBase64String(model + .activePrescriptionReport[index].productImageBase64), + height: SizeConfig.imageSizeMultiplier * 19, + width: SizeConfig.imageSizeMultiplier * 18, + fit: BoxFit.cover, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + model.activePrescriptionReport[index].itemDescription, + bold: true, + ), + SizedBox( + height: 5, + ), + Texts( + 'Exp Date :' + + DateUtil.getDayMonthYearDateFormatted(model + .activePrescriptionReport[index].orderDate), + ), + SizedBox( + height: 5, + ), + Texts( + 'Route :' + + model.activePrescriptionReport[index].route, + ), + SizedBox( + height: 5, + ), + Texts( + 'Frequency :' + + model.activePrescriptionReport[index].frequency, + ), + SizedBox( + height: 5, + ), + Texts( + 'Daily Quantity :${model.activePrescriptionReport[index].doseDailyQuantity}', + ), + ], + ), + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReminderPage( + frequency: model.activePrescriptionReport[index] + .frequencyNumber, + days: model.activePrescriptionReport[index].days, + itemDescription: model + .activePrescriptionReport[index] + .itemDescription, + ), + ), + ); + }, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Icon( + Icons.notifications, + color: Colors.red, + size: 28, + ), + Row( + children: [ + Icon( + Icons.notifications_active, + color: Colors.red, + size: 28, + ), + Texts( + 'Reminder', + color: Colors.red, + ) + ], + ) + ], + ), + ), + ) + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/medical/active_medications/reminder_page.dart b/lib/pages/medical/active_medications/reminder_page.dart new file mode 100644 index 00000000..72f6c211 --- /dev/null +++ b/lib/pages/medical/active_medications/reminder_page.dart @@ -0,0 +1,263 @@ +import 'package:diplomaticquarterapp/core/viewModels/medical/ActiveMedicationsViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; +import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; +import 'package:provider/provider.dart'; + +// ignore: must_be_immutable +class ReminderPage extends StatefulWidget { + final int frequency; + final int days; + final String itemDescription; + + List _scheduleList = List(); + + DateTime startDay; + DateTime endDay; + + ReminderPage({Key key, this.frequency, this.days, this.itemDescription}) { + startDay = DateTime.now(); + endDay = DateTime.now().add(Duration(days: days)); + int hour = (24 ~/ frequency).round(); + int durations = 24 ~/ hour; + for (int count = 0; count < durations; count++) { + _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, + DateTime.now().day, (hour * count))); + } + } + + @override + _ReminderPageState createState() => _ReminderPageState(); +} + +class _ReminderPageState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBarTitle: 'Reminder', + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.maxFinite, + child: Texts( + 'Please select treatment start day and time to be notified when it\'s time to take the medicine'), + ), + Divider(), + SizedBox( + height: 12, + ), + Texts('Start day'), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, + showTitleActions: true, + minTime: DateTime( + DateTime.now().year, DateTime.now().month - 1, 1), + maxTime: DateTime.now(), onConfirm: (date) { + print('confirm $date'); + setState(() { + widget.startDay = date; + }); + }, + currentTime: widget.startDay, + locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getStartDay()), + Icon( + Icons.calendar_today, + color: Colors.black, + ) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + Texts('End day'), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, + showTitleActions: true, + minTime: DateTime( + DateTime.now().year, DateTime.now().month - 1, 1), + maxTime: DateTime.now(), onConfirm: (date) { + print('confirm $date'); + setState(() { + widget.endDay = date; + }); + }, + currentTime: widget.endDay, + locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getEndDay()), + Icon( + Icons.calendar_today, + color: Colors.black, + ) + ], + ), + ), + ), + ...List.generate( + widget._scheduleList.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 7, + ), + Texts('Schedule time'), + SizedBox( + height: 7, + ), + InkWell( + onTap: () { + DatePicker.showTimePicker(context, + showTitleActions: true, onConfirm: (date) { + print('confirm $date'); + setState(() { + widget._scheduleList[index] = date; + }); + }, + currentTime: widget._scheduleList[index], + locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts(getDateTime( + widget._scheduleList[index])), + Icon( + Icons.access_time, + color: Colors.black, + ) + ], + ), + ), + ), + ], + )), + Container( + width: double.maxFinite, + height: MediaQuery.of(context).size.height * 0.12, + ), + ], + ), + ), + ), + bottomSheet: Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.1, + padding: EdgeInsets.all(10), + child: SecondaryButton( + label: 'OK', + color: Colors.grey[800], + onTap: () { + schedule(); + }, + ), + ), + ), + ); + } + + schedule() async { + List scheduleDateTime = + calculateDaysInterval(widget.startDay, widget.endDay); + + // scheduleDateTime.forEach((date) { + // LocalNotification.scheduleNotification( + // scheduledNotificationDateTime: date, + // title: 'Remainder', + // description: widget.itemDescription); + // return; + // }); + + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + calendarUtils.createOrUpdateEvents( + scheduleList: widget._scheduleList, + description: widget.itemDescription, + title: widget.itemDescription, + scheduleDateTime: scheduleDateTime); + + + + var asd = calendarUtils.writableCalendars; + Navigator.pop(context); + } + + List calculateDaysInterval(DateTime startDate, DateTime endDate) { + List days = []; + for (int i = 0; i <= endDate.difference(startDate).inDays; i++) { + widget._scheduleList.forEach((element) { + days.add(startDate.add( + Duration(days: i, hours: element.hour, minutes: element.minute))); + }); + } + return days; + } + + String getStartDay() { + return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}"; + } + + String getEndDay() { + return "${DateUtil.getMonth(widget.endDay.month)} ${widget.endDay.day}, ${widget.endDay.year}"; + } + + String getDateTime(DateTime dateTime) { + return '${dateTime.hour}:${dateTime.minute}'; + } + + String getDays() { + return ''; + } +} diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 2ac090b9..cf9738df 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -24,6 +24,7 @@ import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; import 'package:provider/provider.dart'; import '../../locator.dart'; +import 'active_medications/ActiveMedicationsPage.dart'; import 'balance/my_balance_page.dart'; import 'doctor/doctor_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; @@ -186,8 +187,8 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( -// onTap: () => Navigator.push( -// context, FadePage(page: RadiologyHomePage())), + onTap: () => Navigator.push(context, + FadePage(page: ActiveMedicationsPage())), child: MedicalProfileItem( title: TranslationBase.of(context) .myMedical, diff --git a/lib/uitl/CalendarUtils.dart b/lib/uitl/CalendarUtils.dart new file mode 100644 index 00000000..d61a19b6 --- /dev/null +++ b/lib/uitl/CalendarUtils.dart @@ -0,0 +1,77 @@ +import 'dart:async'; +import 'dart:ui'; + +import 'package:device_calendar/device_calendar.dart'; + +final DeviceCalendarPlugin deviceCalendarPlugin = DeviceCalendarPlugin(); + +class CalendarUtils { + static Completer _completer; + + Calendar get writableCalendars => calendars?.firstWhere((c) => !c.isReadOnly); + List calendars; + + CalendarUtils._(this.calendars); + + static Future getInstance() async { + if (_completer == null) { + _completer = Completer(); + try { + final calendarsResult = await deviceCalendarPlugin.retrieveCalendars(); + _completer.complete(CalendarUtils._(calendarsResult?.data)); + } on Exception catch (e) { + _completer.completeError(e); + final Future sharedPrefsFuture = _completer.future; + _completer = null; + return sharedPrefsFuture; + } + } + return _completer.future; + } + + Future createOrUpdateEvents( + {List scheduleList, + String title, + String description, + List scheduleDateTime}) async { + List events = List(); + scheduleDateTime.forEach((element) { + RecurrenceRule recurrenceRule = RecurrenceRule( + RecurrenceFrequency.Daily, + endDate: element, + ); + Event event = Event(writableCalendars.id, + recurrenceRule: recurrenceRule, + start: element, + end: element.add(Duration(minutes: 30)), + title: title, + description: description); + events.add(event); + }); + + events.forEach((element) { + deviceCalendarPlugin.createOrUpdateEvent(element); + }); + } + + deleteEvent(Calendar _calendar, Event _event) async { + await deviceCalendarPlugin.deleteEvent(_calendar.id, _event.eventId); + } + + Future retrieveEvents( + String calendarId, + RetrieveEventsParams retrieveEventsParams, + ) async { + return await deviceCalendarPlugin.retrieveEvents( + calendarId, retrieveEventsParams); + } + + Future createCalendar( + String calendarName, { + Color calendarColor, + String localAccountName, + }) async { + return await deviceCalendarPlugin.createCalendar(calendarName, + calendarColor: calendarColor, localAccountName: localAccountName); + } +} diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart new file mode 100644 index 00000000..ac4f5860 --- /dev/null +++ b/lib/uitl/LocalNotification.dart @@ -0,0 +1,97 @@ +import 'dart:typed_data'; +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; + +final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); + +class LocalNotification { + + + static Future scheduleNotification( + {@required DateTime scheduledNotificationDateTime, + @required String title, + @required String description}) async { + + ///vibrationPattern + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; + + var androidPlatformChannelSpecifics = AndroidNotificationDetails( + 'active-prescriptions', + 'ActivePrescriptions', + 'ActivePrescriptionsDescription', + // icon: 'secondary_icon', + sound: RawResourceAndroidNotificationSound('slow_spring_board'),///change it to be as ionic + // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic + vibrationPattern: vibrationPattern, + enableLights: true, + color: const Color.fromARGB(255, 255, 0, 0), + ledColor: const Color.fromARGB(255, 255, 0, 0), + ledOnMs: 1000, + ledOffMs: 500); + var iOSPlatformChannelSpecifics = + IOSNotificationDetails(sound: 'slow_spring_board.aiff');///change it to be as ionic + var platformChannelSpecifics = NotificationDetails( + androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.schedule( + 0, + title, + description, + scheduledNotificationDateTime, + platformChannelSpecifics); + } + + ///Repeat notification every day at approximately 10:00:00 am + static Future showDailyAtTime() async { + var time = Time(10, 0, 0); + var androidPlatformChannelSpecifics = AndroidNotificationDetails( + 'repeatDailyAtTime channel id', + 'repeatDailyAtTime channel name', + 'repeatDailyAtTime description'); + var iOSPlatformChannelSpecifics = IOSNotificationDetails(); + var platformChannelSpecifics = NotificationDetails( + androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.showDailyAtTime( + 0, + 'show daily title', + 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + time, + platformChannelSpecifics); + } + + ///Repeat notification weekly on Monday at approximately 10:00:00 am + static Future showWeeklyAtDayAndTime() async { + var time = Time(10, 0, 0); + var androidPlatformChannelSpecifics = AndroidNotificationDetails( + 'show weekly channel id', + 'show weekly channel name', + 'show weekly description'); + var iOSPlatformChannelSpecifics = IOSNotificationDetails(); + var platformChannelSpecifics = NotificationDetails( + androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( + 0, + 'show weekly title', + 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + Day.Monday, + time, + platformChannelSpecifics); + } + + static String _toTwoDigitString(int value) { + return value.toString().padLeft(2, '0'); + } + + static Future cancelNotification() async { + await flutterLocalNotificationsPlugin.cancel(0); + } + + static Future cancelAllNotifications() async { + await flutterLocalNotificationsPlugin.cancelAll(); + } +} diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 6958e67f..52138759 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -1,3 +1,6 @@ +import 'dart:convert'; +import 'dart:typed_data'; + import 'package:connectivity/connectivity.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -137,4 +140,8 @@ class Utils { // await pr.hide(); // } } + + static Uint8List dataFromBase64String(String base64String) { + return base64Decode(base64String); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 4204d4ad..49710761 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -112,6 +112,10 @@ dependencies: flutter_datetime_picker: ^1.4.0 + flutter_local_notifications: ^1.4.4+4 + rxdart: ^0.24.1 + + device_calendar: ^3.1.0 #Handle Geolocation geolocator: ^6.0.0+1